GammaLib
2.0.0
|
CTA performance table energy dispersion class. More...
#include <GCTAEdispPerfTable.hpp>
Public Member Functions | |
GCTAEdispPerfTable (void) | |
Void constructor. More... | |
GCTAEdispPerfTable (const GFilename &filename) | |
File constructor. More... | |
GCTAEdispPerfTable (const GCTAEdispPerfTable &psf) | |
Copy constructor. More... | |
virtual | ~GCTAEdispPerfTable (void) |
Destructor. More... | |
GCTAEdispPerfTable & | operator= (const GCTAEdispPerfTable &psf) |
Assignment operator. More... | |
double | operator() (const GEnergy &ereco, const GEnergy &etrue, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0) const |
Return energy dispersion in units of MeV \(^{-1}\). More... | |
void | clear (void) |
Clear instance. More... | |
GCTAEdispPerfTable * | clone (void) const |
Clone instance. More... | |
std::string | classname (void) const |
Return class name. More... | |
void | load (const GFilename &filename) |
Load energy dispersion from performance table. More... | |
GFilename | filename (void) const |
Return filename. More... | |
GEnergy | mc (GRan &ran, const GEnergy &etrue, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0) const |
Simulate energy dispersion. More... | |
GEbounds | ereco_bounds (const GEnergy &etrue, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0) const |
Return observed energy interval that contains the energy dispersion. More... | |
GEbounds | etrue_bounds (const GEnergy &ereco, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0) const |
Return true energy interval that contains the energy dispersion. More... | |
double | prob_erecobin (const GEnergy &ereco_min, const GEnergy &ereco_max, const GEnergy &etrue, const double &theta) const |
Return energy dispersion probability for reconstructed energy interval. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print energy dispersion information. More... | |
Public Member Functions inherited from GCTAEdisp | |
GCTAEdisp (void) | |
Void constructor. More... | |
GCTAEdisp (const GCTAEdisp &edisp) | |
Copy constructor. More... | |
virtual | ~GCTAEdisp (void) |
Destructor. More... | |
GCTAEdisp & | operator= (const GCTAEdisp &edisp) |
Assignment operator. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Private Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GCTAEdispPerfTable &psf) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | update (const double &logE) const |
Update energy dispersion parameter cache. More... | |
Private Attributes | |
GFilename | m_filename |
Name of response file. More... | |
GNodeArray | m_logE |
log(E) nodes for interpolation More... | |
std::vector< double > | m_sigma |
Sigma value (rms) of energy resolution. More... | |
double | m_par_logE |
Energy for which precomputation is done. More... | |
double | m_par_scale |
Gaussian normalization. More... | |
double | m_par_sigma |
Gaussian sigma. More... | |
double | m_par_width |
Gaussian width parameter. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from GCTAEdisp | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GCTAEdisp &edisp) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
CTA performance table energy dispersion class.
This class implements the CTA energy dispersion response as function of true energy as determined from a performance table. A performance table is an ASCII file that represent a table, specifying the CTA performance parameters as function of true photon energy.
The energy dispersion is defined as
\[ E_{\rm disp}(E_{\rm true}, E_{\rm reco}) = \frac{1}{\sqrt{2\pi}\sigma(E_{\rm true})} \exp \left(\frac{-(\log_{10} E_{\rm reco} - \log_{10} E_{\rm true})^2} {2 \sigma(E_{\rm true})^2} \right) \times \frac{1}{\log_{10} E_{\rm reco}} \]
and given in units of MeV \(^{-1}\), where \(E_{\rm reco}\) is the reconstructed energy in units of MeV, \(E_{\rm true}\) is the true energy in units of MeV, and \(\sigma(E_{\rm true})\) is the standard deviation of the energy dispersion that depends on the true photon energy.
Definition at line 67 of file GCTAEdispPerfTable.hpp.
GCTAEdispPerfTable::GCTAEdispPerfTable | ( | void | ) |
Void constructor.
Definition at line 60 of file GCTAEdispPerfTable.cpp.
References init_members().
Referenced by clone().
|
explicit |
File constructor.
[in] | filename | Performance table file name. |
Construct instance by loading the energy dispersion information from an ASCII performance table.
Definition at line 78 of file GCTAEdispPerfTable.cpp.
References init_members(), and load().
GCTAEdispPerfTable::GCTAEdispPerfTable | ( | const GCTAEdispPerfTable & | edisp | ) |
Copy constructor.
[in] | edisp | Energy dispersion |
Definition at line 97 of file GCTAEdispPerfTable.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GCTAEdisp.
Definition at line 139 of file GCTAEdispPerfTable.hpp.
|
virtual |
Clear instance.
This method properly resets the object to an initial state.
Implements GCTAEdisp.
Definition at line 224 of file GCTAEdispPerfTable.cpp.
References GCTAEdisp::free_members(), free_members(), GCTAEdisp::init_members(), and init_members().
|
virtual |
Clone instance.
Implements GCTAEdisp.
Definition at line 244 of file GCTAEdispPerfTable.cpp.
References GCTAEdispPerfTable().
|
private |
Copy class members.
[in] | edisp | Energy dispersion |
Definition at line 562 of file GCTAEdispPerfTable.cpp.
References m_filename, m_logE, m_par_logE, m_par_scale, m_par_sigma, m_par_width, and m_sigma.
Referenced by GCTAEdispPerfTable(), and operator=().
|
virtual |
Return observed energy interval that contains the energy dispersion.
[in] | etrue | True photon energy. |
[in] | theta | Offset angle in camera system (radians). Not used. |
[in] | phi | Azimuth angle in camera system (radians). Not used. |
[in] | zenith | Zenith angle in Earth system (radians). Not used. |
[in] | azimuth | Azimuth angle in Earth system (radians). Not used. |
Returns the band of observed energies outside of which the energy dispersion becomes negligible for a given true energy logEsrc
. This band is set to \(\pm 5 \times \sigma\), where \(\sigma\) is the Gaussian width of the energy dispersion.
Implements GCTAEdisp.
Definition at line 378 of file GCTAEdispPerfTable.cpp.
References GNodeArray::interpolate(), GEnergy::log10TeV(), m_logE, and m_sigma.
|
virtual |
Return true energy interval that contains the energy dispersion.
[in] | ereco | Reconstructed event energy. |
[in] | theta | Offset angle in camera system (radians). Not used. |
[in] | phi | Azimuth angle in camera system (radians). Not used. |
[in] | zenith | Zenith angle in Earth system (radians). Not used. |
[in] | azimuth | Azimuth angle in Earth system (radians). Not used. |
Returns the band of true photon energies outside of which the energy dispersion becomes negligible for a given observed energy logEobs
. This band is set to \(\pm 5 \times \sigma\), where \(\sigma\) is the Gaussian width of the energy dispersion.
Implements GCTAEdisp.
Definition at line 419 of file GCTAEdispPerfTable.cpp.
References GNodeArray::interpolate(), GEnergy::log10TeV(), m_logE, and m_sigma.
|
inlinevirtual |
Return filename.
Implements GCTAEdisp.
Definition at line 151 of file GCTAEdispPerfTable.hpp.
References m_filename.
Referenced by load().
|
private |
Delete class members.
Definition at line 581 of file GCTAEdispPerfTable.cpp.
Referenced by clear(), operator=(), and ~GCTAEdispPerfTable().
|
private |
Initialise class members.
Definition at line 541 of file GCTAEdispPerfTable.cpp.
References GNodeArray::clear(), GFilename::clear(), m_filename, m_logE, m_par_logE, m_par_scale, m_par_sigma, m_par_width, and m_sigma.
Referenced by clear(), GCTAEdispPerfTable(), and operator=().
|
virtual |
Load energy dispersion from performance table.
[in] | filename | Performance table file name. |
GException::file_error | File could not be opened for read access. |
This method loads the energy dispersion information from an ASCII performance table. The energy resolution is stored in the 5th column of the performance table as RMS(ln(Eest/Etrue)). The method converts this internally to a sigma value by multiplying the stored values by 1/ln(10).
Implements GCTAEdisp.
Definition at line 264 of file GCTAEdispPerfTable.cpp.
References GNodeArray::append(), GNodeArray::clear(), filename(), G_LOAD, gammalib::inv_ln10, m_filename, m_logE, m_sigma, gammalib::split(), gammalib::strip_whitespace(), gammalib::todouble(), and GFilename::url().
Referenced by GCTAEdispPerfTable().
|
virtual |
Simulate energy dispersion.
[in] | ran | Random number generator. |
[in] | etrue | True photon energy. |
[in] | theta | Offset angle in camera system (radians). Not used. |
[in] | phi | Azimuth angle in camera system (radians). Not used. |
[in] | zenith | Zenith angle in Earth system (radians). Not used. |
[in] | azimuth | Azimuth angle in Earth system (radians). Not used. |
Draws observed energy value from a normal distribution of width m_par_sigma around logE
.
Implements GCTAEdisp.
Definition at line 338 of file GCTAEdispPerfTable.cpp.
References GEnergy::log10TeV(), m_par_sigma, GRan::normal(), and update().
|
virtual |
Return energy dispersion in units of MeV \(^{-1}\).
[in] | ereco | Reconstructed photon energy. |
[in] | etrue | True photon energy. |
[in] | theta | Offset angle in camera system (radians). Not used. |
[in] | phi | Azimuth angle in camera system (radians). Not used. |
[in] | zenith | Zenith angle in Earth system (radians). Not used. |
[in] | azimuth | Azimuth angle in Earth system (radians). Not used. |
Returns the energy dispersion
\[ E_{\rm disp}(E_{\rm reco} | E_{\rm true}) = \frac{1}{\sqrt{2\pi}\sigma(E_{\rm true})} \exp \left(\frac{-(\log_{10} E_{\rm reco} - \log_{10} E_{\rm true})^2} {2 \sigma(E_{\rm true})^2} \right) \times \frac{1}{\log_{10} E_{\rm reco}} \]
in units of MeV \(^{-1}\) where \(E_{\rm reco}\) is the reconstructed energy, \(E_{\rm true}\) is the true energy, and \(\sigma(E_{\rm true})\) is the standard deviation of the energy dispersion that depends on the true photon energy.
Implements GCTAEdisp.
Definition at line 187 of file GCTAEdispPerfTable.cpp.
References exp(), gammalib::ln10, GEnergy::log10TeV(), m_par_scale, m_par_width, GEnergy::MeV(), and update().
GCTAEdispPerfTable & GCTAEdispPerfTable::operator= | ( | const GCTAEdispPerfTable & | edisp | ) |
Assignment operator.
[in] | edisp | Energy dispersion |
Definition at line 136 of file GCTAEdispPerfTable.cpp.
References copy_members(), free_members(), init_members(), and GCTAEdisp::operator=().
Print energy dispersion information.
[in] | chatter | Chattiness. |
Implements GCTAEdisp.
Definition at line 492 of file GCTAEdispPerfTable.cpp.
References GNodeArray::append(), m_filename, m_logE, m_sigma, gammalib::parformat(), pow(), gammalib::reduce(), SILENT, GNodeArray::size(), and gammalib::str().
|
virtual |
Return energy dispersion probability for reconstructed energy interval.
[in] | ereco_min | Minimum of reconstructed energy interval. |
[in] | ereco_max | Maximum of reconstructed energy interval. |
[in] | etrue | True energy. |
[in] | theta | Offset angle (radians). Not used. |
Computes
\[ \int_{E_{\rm reco}^{\rm min}}^{E_{\rm reco}^{\rm max}} E_{\rm disp}(E_{\rm reco} | E_{\rm true}) \, dE_{\rm reco} \]
where \(E_{\rm reco}\) is the reconstructed energy and \(E_{\rm true}\) is the true energy.
Implements GCTAEdisp.
Definition at line 466 of file GCTAEdispPerfTable.cpp.
References gammalib::gauss_integral(), GEnergy::log10TeV(), m_par_sigma, and update().
|
private |
Update energy dispersion parameter cache.
[in] | logE | Log10 of the true photon energy ( \(\log_{10}\) TeV). |
This method updates the energy dispersion parameter cache. As the performance table energy dispersion only depends on true photon energy, the only parameter on which the cache values depend is the true photon energy.
Definition at line 598 of file GCTAEdispPerfTable.cpp.
References GNodeArray::interpolate(), gammalib::inv_sqrt2pi, m_logE, m_par_logE, m_par_scale, m_par_sigma, m_par_width, and m_sigma.
Referenced by mc(), operator()(), and prob_erecobin().
|
mutableprivate |
Name of response file.
Definition at line 121 of file GCTAEdispPerfTable.hpp.
Referenced by copy_members(), filename(), init_members(), load(), and print().
|
private |
log(E) nodes for interpolation
Definition at line 122 of file GCTAEdispPerfTable.hpp.
Referenced by copy_members(), ereco_bounds(), etrue_bounds(), init_members(), load(), print(), and update().
|
mutableprivate |
Energy for which precomputation is done.
Definition at line 126 of file GCTAEdispPerfTable.hpp.
Referenced by copy_members(), init_members(), and update().
|
mutableprivate |
Gaussian normalization.
Definition at line 127 of file GCTAEdispPerfTable.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Gaussian sigma.
Definition at line 128 of file GCTAEdispPerfTable.hpp.
Referenced by copy_members(), init_members(), mc(), prob_erecobin(), and update().
|
mutableprivate |
Gaussian width parameter.
Definition at line 129 of file GCTAEdispPerfTable.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
private |
Sigma value (rms) of energy resolution.
Definition at line 123 of file GCTAEdispPerfTable.hpp.
Referenced by copy_members(), ereco_bounds(), etrue_bounds(), init_members(), load(), print(), and update().