SatAndLight  2.2.2-hubble
Simulation toolkit for space telescopes
Loading...
Searching...
No Matches
SpecTime Class Reference

Astrophysical source spectra and light curves. More...

#include <SpecTime.h>

Inheritance diagram for SpecTime:
Collaboration diagram for SpecTime:

Public Member Functions

void ApplyExtinction (TGraph *aArea=NULL)
 Applies extinction processes to the flux.
 
double DrawEnergy (const double aTime)
 Draws an energy value at a given time.
 
TH2D * GetFlux (void)
 Returns a pointer to the flux TH2D object.
 
TH1D * GetLightCurve (const double aEnergyMin=0.0, const double aEnergyMax=-1.0)
 Returns the source light curve between two energies.
 
double GetMagnitude (const double aTimeMin, const double aTimeMax, TGraph *aEnergyTransmission)
 Returns the mean magnitude.
 
TH1D * GetMagnitude (TGraph *aEnergyTransmission)
 Returns the magnitude light curve.
 
int GetParticleN (const ULong64_t aTime, const UInt_t aDuration, const double aCosTheta=1.0)
 Computes the number of particles generated between 2 times.
 
TH2D * GetRate (void)
 Returns a pointer to the flux TH2D object.
 
TH1D * GetSpectrum (const double aTimeMin=0.0, const double aTimeMax=-1.0, const bool aObserved=false)
 Returns the source energy spectrum between two times.
 
double GetTimeMax (void)
 Returns the maximum time defining the SpecTime object.
 
double GetTimeMin (void)
 Returns the minimum time defining the SpecTime object.
 
void MakeBandLimited (const double aFlux, const double aEnergyMin, const double aEnergyMax, TGraph *aArea=NULL)
 Makes a band-limited flux SpecTime object.
 
void MakeExpDecayEnergy (const double aFlux, const double aEnergyDecay, TGraph *aArea=NULL)
 Makes an energy exponential decay flux SpecTime object.
 
void MakeExpDecayTime (const double aFlux, const double aTimeDecay, const double aEnergyMin, const double aEnergyMax, TGraph *aArea=NULL)
 Makes a time exponential decay flux SpecTime object.
 
void MakeGRBData (TH1D *aLightCurveExp, const double aE1, const double aE2, const double aPhotonIndex, const double aNint, const double aNgal, const double aZ, TGraph *aAreaExp, TGraph *aArea=NULL)
 Makes a SpecTime object using GRB data.
 
void MakeGRBModel0 (const double aFlux, const double aTime0, const double aAlpha, const double aEnergy0, const double aBeta, TGraph *aArea=NULL)
 Makes a SpecTime object using a GRB model (0).
 
void MakeGRBModel1 (const double aFlux, const double aEnergy0, const double aAlpha, const double aBeta, TGraph *aArea=NULL)
 Makes a SpecTime object using a GRB model (I).
 
void MakeRate (const double aArea)
 Computes the rate given a constant integration area.
 
void MakeRate (TGraph *aArea)
 Computes the rate given an integration area.
 
void MakeUniform (const double aFlux, TGraph *aArea=NULL)
 Makes a uniform flux SpecTime object.
 
void SetFlux (TH2D *aFlux, TGraph *aArea=NULL)
 Defines a new flux fonction.
 
void SetPhotoElectricCrossSection (TGraph *aGraph)
 Sets the photo-electric cross-section.
 
Constructors and destructors
 SpecTime (const int aNt, const double *aTimeBins, const int aNe, const double *aEnergyBins)
 SpecTime class constuctor.
 
 SpecTime (const int aNt, const double aTimeMin, const double aTimeMax, const bool aUseTimeLog, const int aNe, const double aEnergyMin, const double aEnergyMax, const bool aUseEnergyLog)
 SpecTime class constuctor.
 
 SpecTime (TH2D *aFlux, TH2D *aRate=NULL)
 SpecTime class constuctor.
 
virtual ~SpecTime (void)
 SpecTime class destructor.
 
- Public Member Functions inherited from Extinction
double GetMeiksin2006 (const double aRedshift, const double aEnergyObs)
 Returns the intergalactic extinction factor predicted by the Meiksin 2006 model.
 
TGraph * GetMeiksin2006 (const double aRedshift, const unsigned int aN, const double aWavelengthObsMin, const double aWavelengthObsMax)
 Returns the intergalactic extinction factor as a function of the wavelength predicted by the Meiksin 2006 model.
 
double GetPei1992 (const double aEnergy, const double aExtinctionV, const string aExtLaw)
 Returns the galactic dust extinction factor predicted by the Pei 1992 model.
 
TGraph * GetScaleFactorPei1992 (const string aExtLaw="MW")
 Returns the extinction scaling factor as a function of the wavelength.
 
double GetSourceExtinction (const double aEnergyObs)
 Returns the overall extinction factor (transmission) for an astrophysical source.
 
void SetSource (const double aRedshift, const double aMwExtinctionV, const double aHostExtinctionV)
 Defines the source properties.
 
 Extinction (void)
 Constructor of the Extinction class.
 
virtual ~Extinction (void)
 Destructor of the Extinction class.
 

Protected Attributes

TH2D * flux
 Source flux \({\cal{F}}(E,t)\).
 
TH2D * flux_x
 Source flux \({\cal{F}}(E,t)\) after extinction.
 
TRandom3 * randgen
 Random generator.
 
TH2D * rate
 Source rate \({\cal{R}}(E,t)\).
 

Private Member Functions

void ConstructHistos (const int aNt, const double *aTimeBins, const int aNe, const double *aEnergyBins)
 for constructors.
 
void MakeCum (void)
 Computes cumulative rate.
 

Private Attributes

TGraph * photoelectric_xsec
 Photo-electric cross-section.
 
double ** rate_cum
 Cumulative rate (over \(E\)).
 

Detailed Description

Astrophysical source spectra and light curves.

A SpecTime object is used to describe an astrophysical source spectrum as a function of time. It describes both the time and energy distributions of astro-particles. It includes 2-dimensional histograms (TH2D) to describe the particle flux, \({\cal{F}}(E,t)=\frac{d^4N}{dSdtdE}(E,t)\), and the particle rate, \({\cal{R}}(E,t)=\frac{d^2N}{dtdE}(E,t)\). A area of interest \(S(E)\) must be provided to derive the rate from the flux:

\[ {\cal{R}}(E,t)=\frac{d^2N}{dtdE}(E,t)=\iint_S{\cal{F}}(E,t)dS=\iint_S\frac{d^4N}{dSdtdE}(E,t)dS. \]

The flux and rate functions are represented by 2-dimensional histograms (TH2D in ROOT). The x-axis is binned in time and the y-axis is binned in energy. By convention, the flux is measured in the observer reference frame. It means that energies are redshifted. It also means that extinction processes, described by the Extinction class, are included in the flux.

This class offers many methods (MakeUniform(), MakeBandLimited(), MakeExpDecayTime(), MakeExpDecayEnergy(), MakeGRBModel1(),...) to compute realistic (or not) flux/rate models.

Finally, the SpecTime object can be used to randomly draw particle parameters.

Author
Florent Robinet

Constructor & Destructor Documentation

◆ SpecTime() [1/3]

SpecTime::SpecTime ( const int  aNt,
const double *  aTimeBins,
const int  aNe,
const double *  aEnergyBins 
)

SpecTime class constuctor.

In this constructor TH2D objects are initialized and the binning must be provided. The binning can no longer be changed.

Parameters
[in]aNtNumber of time bins.
[in]aTimeBinsPointer to an array of bin limits \([\mathrm{ms}]\).
[in]aNeNumber of energy bins.
[in]aEnergyBinsPointer to an array of bin limits \([\mathrm{keV}]\).
Precondition
The number of bin limits must be equal to the number of bins +1.

◆ SpecTime() [2/3]

SpecTime::SpecTime ( const int  aNt,
const double  aTimeMin,
const double  aTimeMax,
const bool  aUseTimeLog,
const int  aNe,
const double  aEnergyMin,
const double  aEnergyMax,
const bool  aUseEnergyLog 
)

SpecTime class constuctor.

The flux and rate functions are represented by 2-dimensional histograms (TH2D in ROOT). The x-axis is binned in time and the y-axis is binned in energy. In this constructor TH2D objects are initialized and the binning must be provided. The binning can no longer be changed.

Parameters
[in]aNtNumber of time bins.
[in]aTimeMinMinimum time \([\mathrm{ms}]\).
[in]aTimeMaxMaximum time \([\mathrm{ms}]\).
[in]aUseTimeLogFlag to use logarithmic bins (true) or linear bins (false) for time.
[in]aNeNumber of energy bins.
[in]aEnergyMinMinimum energy \([\mathrm{keV}]\).
[in]aEnergyMaxMaximum energy \([\mathrm{keV}]\).
[in]aUseEnergyLogFlag to use logarithmic bins (true) or linear bins (false) for energy.

◆ SpecTime() [3/3]

SpecTime::SpecTime ( TH2D *  aFlux,
TH2D *  aRate = NULL 
)

SpecTime class constuctor.

The flux and rate functions are represented by 2-dimensional histograms (TH2D in ROOT). The x-axis is binned in time and the y-axis is binned in energy. In this constructor TH2D objects are initialized using input histograms with or without content.

Parameters
[in]aFluxFlux histogram.
[in]aRateRate histogram. If a pointer to NULL is provided, a copy of the flux histogram is used.
Note
The input histograms can be deleted after calling this constructor.
Precondition
No check is performed about the sanity of input histograms. In particular the user must make sure the binning is exactly the same for both histograms.

◆ ~SpecTime()

SpecTime::~SpecTime ( void  )
virtual

SpecTime class destructor.

Member Function Documentation

◆ ApplyExtinction()

void SpecTime::ApplyExtinction ( TGraph *  aArea = NULL)

Applies extinction processes to the flux.

For a distant astrophysical source, the flux must include extinction processes \(X(E)\). Extinction processes can be applied with this function. The extinction is modeled with the Extinction class. Before calling this function, the properties of the source must be defined with Extinction::SetSource().

The original flux object (without extinction), as defined with the constructor or with the MakeXXX functions, is kept in memory. It means that this function can be called multiple times in a row with updated source properties. The original flux object is applied the latest extinction parameters.

Warning
The energy is always measured at the observer (redshifted energy).
Parameters
[in]aAreaPointer to a valid TGraph object to describe the area as a function of energy in \([\mathrm{mm}^2]\).

◆ ConstructHistos()

void SpecTime::ConstructHistos ( const int  aNt,
const double *  aTimeBins,
const int  aNe,
const double *  aEnergyBins 
)
private

for constructors.

◆ DrawEnergy()

double SpecTime::DrawEnergy ( const double  aTime)

Draws an energy value at a given time.

The energy value is randomly drawn following the rate function, using an input time.

Parameters
[in]aTimeTime \([\mathrm{ms}]\).
Returns
An energy value in \([\mathrm{keV}]\).

◆ GetFlux()

TH2D * SpecTime::GetFlux ( void  )
inline

Returns a pointer to the flux TH2D object.

Note
The flux after extinction, if any, is returned.
Warning
Do not modify/delete the returned object as it is a part of the class.

◆ GetLightCurve()

TH1D * SpecTime::GetLightCurve ( const double  aEnergyMin = 0.0,
const double  aEnergyMax = -1.0 
)

Returns the source light curve between two energies.

The light curve is defined as:

\[ {\cal{L}}(t)=\frac{dN}{dt}(t)=\int_{E_{min}}^{E_{max}}{{\cal{R}}(E,t)dE}. \]

It is obtained by integrating the rate object (TH2D) over energies.

See also
The light curve definition.
Note
The returned histogram must be deleted by the user.
Parameters
[in]aEnergyMinMinimum energy, \(E_{min}\), in \([\mathrm{keV}]\). Use 0.0 to start at lowest energy of the SpecTime object.
[in]aEnergyMaxMaximum energy, \(E_{max}\), in \([\mathrm{keV}]\). Use -1.0 to stop at highest energy of the SpecTime object.

◆ GetMagnitude() [1/2]

double SpecTime::GetMagnitude ( const double  aTimeMin,
const double  aTimeMax,
TGraph *  aEnergyTransmission 
)

Returns the mean magnitude.

The magnitude is defined in The magnitude definition. It is obtained by integrating the flux object (TH2D) over energies. The flux is weighted by an energy transmission function which must be provided as a TGraph. The transmission is interpolated if within the TGraph energy range, extrapolated otherwise. Here the magnitude is averaged between two times.

Parameters
[in]aTimeMinMinimum time, \(t_{min}\), in \([\mathrm{ms}]\). Use 0.0 to use the start time of the SpecTime object.
[in]aTimeMaxMaximum time, \(t_{max}\), in \([\mathrm{ms}]\). Use -1.0 to use the stop time of the SpecTime object.
[in]aEnergyTransmissionEnergy transmission function \(\Delta(E)\)

◆ GetMagnitude() [2/2]

TH1D * SpecTime::GetMagnitude ( TGraph *  aEnergyTransmission)

Returns the magnitude light curve.

The magnitude is defined in The magnitude definition. It is obtained by integrating the flux object (TH2D) over energies. The flux is weighted by an energy transmission function which must be provided as a TGraph. The transmission is interpolated if within the TGraph energy range, extrapolated otherwise.

Note
The returned histogram must be deleted by the user.
Parameters
[in]aEnergyTransmissionEnergy transmission function \(\Delta(E)\)

◆ GetParticleN()

int SpecTime::GetParticleN ( const ULong64_t  aTime,
const UInt_t  aDuration,
const double  aCosTheta = 1.0 
)

Computes the number of particles generated between 2 times.

The rate object is integrated over time (time range is given) and energy (full range) to get the mean number of particles. The actual number of particles is randomly drawn from a Poisson distribution with this mean value.

It is possible to correct the mean value for non-axis emission. The \(\cos\theta\) value must then be provided, where \(\theta\) is the angle between the detector axis and the source direction.

Warning
If the input time range does not match the time range of the SpecTime object, no (or less) particles are generated.
If you call this function twice with the same parameters, you will not get the same result.
Parameters
[in]aTimeStart time [ms].
[in]aDurationTime duration [ms].
[in]aCosThetaNon-axis correction: \(\cos\theta\).

◆ GetRate()

TH2D * SpecTime::GetRate ( void  )
inline

Returns a pointer to the flux TH2D object.

Warning
Do not modify/delete the returned object as it is a part of the class.

◆ GetSpectrum()

TH1D * SpecTime::GetSpectrum ( const double  aTimeMin = 0.0,
const double  aTimeMax = -1.0,
const bool  aObserved = false 
)

Returns the source energy spectrum between two times.

The energy spectrum is defined as:

\[ {\cal{S}}(E)=\frac{1}{t_{max}-t_{min}}\int_{t_{min}}^{t_{max}}{{\cal{F}}(E,t)dt} \]

It is obtained by integrating the flux object (TH2D) over time.

It is also possible to request the observed source energy spectrum by integrating the rate object:

\[ {\cal{S}}_{obs}(E)=\frac{1}{t_{max}-t_{min}}\int_{t_{min}}^{t_{max}}{{\cal{R}}(E,t)dt} \]

See also
The spectrum definition.
Note
The returned histogram must be deleted by the user.
Parameters
[in]aTimeMinMinimum time, \(t_{min}\), in \([\mathrm{ms}]\). Use 0.0 to use the start time of the SpecTime object.
[in]aTimeMaxMaximum time, \(t_{max}\), in \([\mathrm{ms}]\). Use -1.0 to use the stop time of the SpecTime object.
[in]aObservedSet this to true to return the observed source energy spectrum.

◆ GetTimeMax()

double SpecTime::GetTimeMax ( void  )
inline

Returns the maximum time defining the SpecTime object.

◆ GetTimeMin()

double SpecTime::GetTimeMin ( void  )
inline

Returns the minimum time defining the SpecTime object.

◆ MakeBandLimited()

void SpecTime::MakeBandLimited ( const double  aFlux,
const double  aEnergyMin,
const double  aEnergyMax,
TGraph *  aArea = NULL 
)

Makes a band-limited flux SpecTime object.

The flux is constant beween two energy values and is constant over time:

\[ {\cal{F}}(E,t) = {\cal{F}}_0 \times \Theta(E-E_{min}) \times \Theta(E_{max}-E). \]

The minimum and maximum energies must be within the energy range defined in the constructor. If not, they are adjusted to fit the original energy range.

Example of a band-limited SpecTime object: the flux is constant between 0.8 and 4 keV.

Additionally, it is possible to provide an area of interest to compute the associated rate. The MakeRate() function is called at the end of this function.

Parameters
[in]aFluxConstant flux value, \({\cal{F}}_0\), in \([\mathrm{keV}^{-1}\mathrm{ms}^{-1}\mathrm{mm}^{-2}]\).
[in]aEnergyMinMinimum energy \([\mathrm{keV}]\).
[in]aEnergyMaxMaximum energy \([\mathrm{keV}]\).
[in]aAreaArea of interest \(S(E)\) in \([\mathrm{mm}^2]\).
Precondition
The pointer to the TGraph object must be valid.

◆ MakeCum()

void SpecTime::MakeCum ( void  )
private

Computes cumulative rate.

◆ MakeExpDecayEnergy()

void SpecTime::MakeExpDecayEnergy ( const double  aFlux,
const double  aEnergyDecay,
TGraph *  aArea = NULL 
)

Makes an energy exponential decay flux SpecTime object.

The flux is constant over time and decays in energy following an exponential distribution:

\[ {\cal{F}}(E,t) = {\cal{F}}_0 \times \exp\left(-\frac{E-E_0}{\epsilon}\right), \]

where \({\cal{F}}_0\) is the flux at the minimum energy \(E_0\), defined in the constructor, and \(\epsilon\) is the flux energy decay. The flux is only computed in the limits defined in the constructor, it is null elsewhere.

Example of a power-law SpecTime object: the flux is constant over time and exponentially decreases with energy (epsilon=1 keV).

Additionally, it is possible to provide an area of interest to compute the associated rate. The MakeRate() function is called at the end of this function.

Parameters
[in]aFluxFlux \({\cal{F}}_0\) value in \([\mathrm{keV}^{-1}\mathrm{ms}^{-1}\mathrm{mm}^{-2}]\).
[in]aEnergyDecayFlux energy decay \(\epsilon\) in \([\mathrm{keV}]\).
[in]aAreaArea of interest \(S(E)\) in \([\mathrm{mm}^2]\).
Precondition
The pointer to the TGraph object must be valid.

◆ MakeExpDecayTime()

void SpecTime::MakeExpDecayTime ( const double  aFlux,
const double  aTimeDecay,
const double  aEnergyMin,
const double  aEnergyMax,
TGraph *  aArea = NULL 
)

Makes a time exponential decay flux SpecTime object.

The flux is constant beween two energy values and decays in time following an exponential distribution:

\[ {\cal{F}}(E,t) = {\cal{F}}_0 \times \exp\left(-\frac{t-t_0}{\tau}\right) \times \Theta(E-E_{min}) \times \Theta(E_{max}-E), \]

where \({\cal{F}}_0\) is the flux at the initial time \(t_0\), defined in the constructor, and \(\tau\) is the flux time decay. The minimum and maximum energies must be within the energy range defined in the constructor. If not, they are adjusted to fit the original energy range.

Example of a power-law SpecTime object: the flux is constant between 0.8 and 4 keV and exponentially decreases with time (tau=3000 ms).

Additionally, it is possible to provide an area of interest to compute the associated rate. The MakeRate() function is called at the end of this function.

Parameters
[in]aFluxInitial flux \({\cal{F}}_0\) value in \([\mathrm{keV}^{-1}\mathrm{ms}^{-1}\mathrm{mm}^{-2}]\).
[in]aTimeDecayFlux time decay \(\tau\) in \([\mathrm{ms}]\).
[in]aEnergyMinMinimum energy \([\mathrm{keV}]\).
[in]aEnergyMaxMaximum energy \([\mathrm{keV}]\).
[in]aAreaArea of interest \(S(E)\) in \([\mathrm{mm}^2]\).
Precondition
The pointer to the TGraph object must be valid.

◆ MakeGRBData()

void SpecTime::MakeGRBData ( TH1D *  aLightCurveExp,
const double  aE1,
const double  aE2,
const double  aPhotonIndex,
const double  aNint,
const double  aNgal,
const double  aZ,
TGraph *  aAreaExp,
TGraph *  aArea = NULL 
)

Makes a SpecTime object using GRB data.

The source flux is modeled as:

\[ {\cal{F}}(E,t) = f_1(t)\times f_2(E), \]

where the energy dependence includes the energy absorption due to the photo-electric effect and is described by:

\[ f_2(E) = A\times E^{-\lambda} \times \exp{\left(-N_H^{int}\sigma(E)\right)} \times \exp{\left(-N_H^{Gal}\sigma(E/(1+z))\right)}. \]

  • \(A\) is an amplitude factor.
  • \(\lambda\) is the photon index.
  • \(N_H^{int}\) is the intrinsic column density.
  • \(N_H^{Gal}\) is the galactic column density.
  • \(\sigma(E)\) is the cross-section of the photo-electric effect. Set this function with SetPhotoElectricCrossSection().
  • \(z\) is the absorber redshift.
Note
These parameters are often obtained from a fit on spectral data.
The units of \(\sigma(E)\) and \(N_H\) should be consistent, e.g. \([cm^2]\) and \([cm^{-2}]\).

The time dependence is derived from experimental data using the light curve:

\[ {\cal{L}}_{exp}(t) = \frac{dN_{exp}}{dt}(t) = \int_{E_1}^{E_2}{{\cal{R}}_{exp}(E,t)dE} = \int_{E_1}^{E_2}{S_{exp}(E)\times {\cal{F}}(E,t) dE}. \]

Here the rate is derived from the flux using the experiment effective area \(S_{exp}(E)\) and is integrated over the energy range \(E_1\)- \(E_2\).

Then it comes:

\[ f_1(t) = \frac{{\cal{L}}_{exp}(t)}{\int_{E_1}^{E_2}{S_{exp}(E)\times f_2(E) dE}}. \]

Finally:

\[ {\cal{F}}(E,t) = {\cal{L}}_{exp}(t)\times \frac{E^{-\lambda} \times \exp{\left(-N_H^{int}\sigma(E)\right)} \times \exp{\left(-N_H^{Gal}\sigma(E/(1+z))\right)}}{\int_{E_1}^{E_2}{S_{exp}(E)\times E^{-\lambda} \times \exp{\left(-N_H^{int}\sigma(E)\right)} \times \exp{\left(-N_H^{Gal}\sigma(E/(1+z))\right)} dE}}. \]

This equation is used to compute the flux object. The integral at the denominator is calculated using the numerical precision of \(S_{exp}(E)\).

Warning
The experimental light curve histogram is assumed to be complete. In other words, any missing data (empty bin) is interpreted as a true effect (no interpolation is performed).

The example below shows the resulting SpecTime object obtained with GRB091020 downloaded from the Swift/XRT database. The absorption at low energies is included.

Example of a GRB SpectTime object obtained from GRB091020
Reconstructed light curve for GRB091020
Reconstructed spectrum for GRB091020

Additionally, it is possible to provide an area of interest to compute the associated rate. The MakeRate() function is called at the end of this function.

Parameters
[in]aLightCurveExpExperimental light curve \({\cal{L}}_{exp}(t)\).
[in]aE1Lower energy bound \(E_1\) used for \({\cal{L}}_{exp}(t)\), in \([keV]\).
[in]aE1Upper energy bound \(E_2\) used for \({\cal{L}}_{exp}(t)\), in \([keV]\).
[in]aPhotonIndexPhoton index \(\lambda\).
[in]aNintIntrinsic column density. The unit should be consistent with the cross-section of the photo-electric effect.
[in]aNgalGalactic column density. The unit should be consistent with the cross-section of the photo-electric effect.
[in]aZAbsorber redshift \(z\).
[in]aAreaExpEffective area for the experiment \(S_{exp}(E)\). The energy range of this function must entirely contain the \(E_1\)- \(E_2\) range (no extrapolation). The points are assumed to be sorted in energy.
[in]aAreaArea of interest \(S(E)\) in \([\mathrm{mm}^2]\).
Precondition
The pointer to the TGraph objects must be valid.
Todo:
detect binning type and use GetBinCenter() or GetBinCenterLog().

◆ MakeGRBModel0()

void SpecTime::MakeGRBModel0 ( const double  aFlux,
const double  aTime0,
const double  aAlpha,
const double  aEnergy0,
const double  aBeta,
TGraph *  aArea = NULL 
)

Makes a SpecTime object using a GRB model (0).

The particle flux is a power law in time and energy:

\[ {\cal{F}}(E,t) = {\cal{F}}_0 \times \left(\frac{t}{t_0}\right)^{-\alpha} \times \left(\frac{E}{E_0}\right)^{-\beta} \]

Example of a GRB SpecTime object: the flux is a power law in time and energy (alpha=1, beta=2).

Additionally, it is possible to provide an area of interest to compute the associated rate. The MakeRate() function is called at the end of this function.

Parameters
[in]aFluxReference flux \({\cal{F}}_0\) value in \([\mathrm{keV}^{-1}\mathrm{ms}^{-1}\mathrm{mm}^{-2}]\).
[in]aTime0Reference time, \(t_0\), in \([\mathrm{ms}]\).
[in]aAlphaTime index, \(\alpha\).
[in]aEnergy0Reference energy, \(E_0\), in \([\mathrm{keV}]\).
[in]aBetaSpectral index, \(\beta\).
[in]aAreaArea of interest \(S(E)\) in \([\mathrm{mm}^2]\).
Precondition
The pointer to the TGraph object must be valid.
Todo:
Detect binning type and use GetBinCenter() or GetBinCenterLog().

◆ MakeGRBModel1()

void SpecTime::MakeGRBModel1 ( const double  aFlux,
const double  aEnergy0,
const double  aAlpha,
const double  aBeta,
TGraph *  aArea = NULL 
)

Makes a SpecTime object using a GRB model (I).

The particle flux energy dependency is modeled using BATSE Observations of Gamma-Ray Burst Spectra. I. Spectral Diversity as a reference:

\[ {\cal{F}}(E,t) = {\cal{F}}_0 \times \left(\frac{E}{100\,\mathrm{keV}}\right)^\alpha \times \exp\left(-\frac{E}{E_0}\right), \; E < E_0~(\alpha-\beta), \]

and

\[ {\cal{F}}(E,t) = {\cal{F}}_0 \times \left(\frac{E_0(\alpha-\beta)}{100\,\mathrm{keV}}\right)^{(\alpha-\beta)} \times \left(\frac{E}{100\,\mathrm{keV}}\right)^\beta \times \exp(\beta-\alpha), \; E\geq E_0~(\alpha-\beta). \]

This model was constructed so that it and its derivative are continuous. The resulting flux is constant over the time range specified in the constructor and is null eslewhere.

Example of a GRB SpecTime object: the flux is constant over time and exponentially decreases with energy with 2 different slopes (alpha=-1, beta=-2).

Additionally, it is possible to provide an area of interest to compute the associated rate. The MakeRate() function is called at the end of this function.

Parameters
[in]aFluxFlux \({\cal{F}}_0\) value in \([\mathrm{keV}^{-1}\mathrm{ms}^{-1}\mathrm{mm}^{-2}]\).
[in]aEnergy0Energy transition, \(E_0\), in \([\mathrm{keV}]\).
[in]aAlphaSpectral index, \(\alpha\), at low energy.
[in]aBetaSpectral index, \(\beta\), at high energy.
[in]aAreaArea of interest \(S(E)\) in \([\mathrm{mm}^2]\).
Precondition
The pointer to the TGraph object must be valid.
Todo:
Detect binning type and use GetBinCenter() or GetBinCenterLog().

◆ MakeRate() [1/2]

void SpecTime::MakeRate ( const double  aArea)

Computes the rate given a constant integration area.

The flux must be set first (e.g. SetFlux()). The flux is assumed to be uniform over the area of interest. This area is considered to be independent of the energy (constant). The rate is then computed as:

\[ {\cal{R}}(E,t)=\frac{d^2N}{dtdE}(E,t)=\iint_S{\cal{F}}(E,t)dS=S\times {\cal{F}}(E,t). \]

Parameters
[in]aAreaArea of interest \(S\) in \([\mathrm{mm}^2]\).

◆ MakeRate() [2/2]

void SpecTime::MakeRate ( TGraph *  aArea)

Computes the rate given an integration area.

The flux must be set first (e.g. SetFlux()). The flux is assumed to be uniform over the area of interest. This area is provided as a TGraph object to include an energy dependency: x-axis = energy in \([\mathrm{keV}]\), y-axis = area in \([\mathrm{mm}^2]\). The rate is then computed as:

\[ {\cal{R}}(E,t)=\frac{d^2N}{dtdE}(E,t)=\iint_S{\cal{F}}(E,t)dS=S(E)\times {\cal{F}}(E,t). \]

The rate is set to 0, if the energy is not in the range of the TGraph. When within the range, a linear interpolation is performed to access the area at a given energy.

Warning
The points in the TGraph are assumed to be sorted in energy.
If the input area object is not valid, the flux object is copied in the rate object. It means that the rate is computed using a \(1\times 1 \mathrm{mm}^2\) area.
Parameters
[in]aAreaArea of interest \(S(E)\) in \([\mathrm{mm}^2]\).
Precondition
The pointer to the TGraph object must be valid.

◆ MakeUniform()

void SpecTime::MakeUniform ( const double  aFlux,
TGraph *  aArea = NULL 
)

Makes a uniform flux SpecTime object.

The particle flux is constant over energies and times (in the limits declared in SpecTime()):

\[ {\cal{F}}(E,t) = {\cal{F}}_0. \]

Additionally, it is possible to provide an area of interest to compute the associated rate. The MakeRate() function is called at the end of this function.

Parameters
[in]aFluxConstant flux \({\cal{F}}_0\) value in \([\mathrm{keV}^{-1}\mathrm{ms}^{-1}\mathrm{mm}^{-2}]\).
[in]aAreaArea of interest in \([\mathrm{mm}^2]\).
Precondition
The pointer to the TGraph object must be valid.

◆ SetFlux()

void SpecTime::SetFlux ( TH2D *  aFlux,
TGraph *  aArea = NULL 
)

Defines a new flux fonction.

The input flux histogram must comply with the definition of a Flux object. In particular, one must make sure to use correct Units units for all quantities.

Moreover, one must be careful with the parameters given in SpecTime(). The time and energy bins will not be modified. However the input time and energy bins will be resampled to match the resolution declared in SpecTime(). Upsampling and downsampling are supported.

Additionally, it is possible to provide an area of interest to compute the associated rate. The MakeRate() function is called at the end of this function.

Note
The extinction is assumed to be already included. If not, call ApplyExtinction().
Parameters
[in]aFluxPointer to a valid TH2D object. It can be deleted after calling this function.
[in]aAreaPointer to a valid TGraph object to describe the area as a function of energy in \([\mathrm{mm}^2]\).

◆ SetPhotoElectricCrossSection()

void SpecTime::SetPhotoElectricCrossSection ( TGraph *  aGraph)
inline

Sets the photo-electric cross-section.

This is given as a TGraph as a function of energy \([keV]\). It is locally saved.

Note
The cross-section unit is not required. It is a unit of area which should be consistent with the usage of this function. See, for example, MakeGRBData().
Parameters
[in]aGraphPointer to a valid TGraph object to describe the photo-electric cross-section. The points are assumed to be sorted in energy.

Member Data Documentation

◆ flux

TH2D* SpecTime::flux
protected

Source flux \({\cal{F}}(E,t)\).

◆ flux_x

TH2D* SpecTime::flux_x
protected

Source flux \({\cal{F}}(E,t)\) after extinction.

◆ photoelectric_xsec

TGraph* SpecTime::photoelectric_xsec
private

Photo-electric cross-section.

◆ randgen

TRandom3* SpecTime::randgen
protected

Random generator.

◆ rate

TH2D* SpecTime::rate
protected

Source rate \({\cal{R}}(E,t)\).

◆ rate_cum

double** SpecTime::rate_cum
private

Cumulative rate (over \(E\)).


The documentation for this class was generated from the following files: