GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAEdispPerfTable Class Reference

CTA performance table energy dispersion class. More...

#include <GCTAEdispPerfTable.hpp>

Inheritance diagram for GCTAEdispPerfTable:
GCTAEdisp GBase

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...
 
GCTAEdispPerfTableoperator= (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...
 
GCTAEdispPerfTableclone (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...
 
GCTAEdispoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

GCTAEdispPerfTable::GCTAEdispPerfTable ( void  )

Void constructor.

Definition at line 60 of file GCTAEdispPerfTable.cpp.

References init_members().

Referenced by clone().

GCTAEdispPerfTable::GCTAEdispPerfTable ( const GFilename filename)
explicit

File constructor.

Parameters
[in]filenamePerformance 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.

Parameters
[in]edispEnergy dispersion

Definition at line 97 of file GCTAEdispPerfTable.cpp.

References copy_members(), and init_members().

GCTAEdispPerfTable::~GCTAEdispPerfTable ( void  )
virtual

Destructor.

Definition at line 114 of file GCTAEdispPerfTable.cpp.

References free_members().

Member Function Documentation

std::string GCTAEdispPerfTable::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GCTAEdispPerfTable").

Implements GCTAEdisp.

Definition at line 139 of file GCTAEdispPerfTable.hpp.

void GCTAEdispPerfTable::clear ( void  )
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().

GCTAEdispPerfTable * GCTAEdispPerfTable::clone ( void  ) const
virtual

Clone instance.

Returns
Deep copy of instance.

Implements GCTAEdisp.

Definition at line 244 of file GCTAEdispPerfTable.cpp.

References GCTAEdispPerfTable().

void GCTAEdispPerfTable::copy_members ( const GCTAEdispPerfTable edisp)
private

Copy class members.

Parameters
[in]edispEnergy dispersion

Definition at line 559 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=().

GEbounds GCTAEdispPerfTable::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
virtual

Return observed energy interval that contains the energy dispersion.

Parameters
[in]etrueTrue photon energy.
[in]thetaOffset angle in camera system (radians). Not used.
[in]phiAzimuth angle in camera system (radians). Not used.
[in]zenithZenith angle in Earth system (radians). Not used.
[in]azimuthAzimuth angle in Earth system (radians). Not used.
Returns
Boundaries of reconstruced energies.

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 375 of file GCTAEdispPerfTable.cpp.

References GNodeArray::interpolate(), GEnergy::log10TeV(), m_logE, and m_sigma.

GEbounds GCTAEdispPerfTable::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
virtual

Return true energy interval that contains the energy dispersion.

Parameters
[in]erecoReconstructed event energy.
[in]thetaOffset angle in camera system (radians). Not used.
[in]phiAzimuth angle in camera system (radians). Not used.
[in]zenithZenith angle in Earth system (radians). Not used.
[in]azimuthAzimuth angle in Earth system (radians). Not used.
Returns
Boundaries of true energies.

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 416 of file GCTAEdispPerfTable.cpp.

References GNodeArray::interpolate(), GEnergy::log10TeV(), m_logE, and m_sigma.

GFilename GCTAEdispPerfTable::filename ( void  ) const
inlinevirtual

Return filename.

Returns
Returns filename from which the energy resolution was loaded

Implements GCTAEdisp.

Definition at line 151 of file GCTAEdispPerfTable.hpp.

References m_filename.

Referenced by load().

void GCTAEdispPerfTable::free_members ( void  )
private

Delete class members.

Definition at line 578 of file GCTAEdispPerfTable.cpp.

Referenced by clear(), operator=(), and ~GCTAEdispPerfTable().

void GCTAEdispPerfTable::init_members ( void  )
private

Initialise class members.

Definition at line 538 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=().

void GCTAEdispPerfTable::load ( const GFilename filename)
virtual

Load energy dispersion from performance table.

Parameters
[in]filenamePerformance table file name.
Exceptions
GCTAExceptionHandler::file_open_errorFile 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().

GEnergy GCTAEdispPerfTable::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
virtual

Simulate energy dispersion.

Parameters
[in]ranRandom number generator.
[in]etrueTrue photon energy.
[in]thetaOffset angle in camera system (radians). Not used.
[in]phiAzimuth angle in camera system (radians). Not used.
[in]zenithZenith angle in Earth system (radians). Not used.
[in]azimuthAzimuth angle in Earth system (radians). Not used.
Returns
Energy.

Draws observed energy value from a normal distribution of width m_par_sigma around logE.

Implements GCTAEdisp.

Definition at line 335 of file GCTAEdispPerfTable.cpp.

References GEnergy::log10TeV(), m_par_sigma, GRan::normal(), and update().

double GCTAEdispPerfTable::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
virtual

Return energy dispersion in units of MeV \(^{-1}\).

Parameters
[in]erecoReconstructed photon energy.
[in]etrueTrue photon energy.
[in]thetaOffset angle in camera system (radians). Not used.
[in]phiAzimuth angle in camera system (radians). Not used.
[in]zenithZenith angle in Earth system (radians). Not used.
[in]azimuthAzimuth angle in Earth system (radians). Not used.
Returns
Energy dispersion (MeV \(^{-1}\))

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.

Parameters
[in]edispEnergy dispersion
Returns
Energy dispersion

Definition at line 136 of file GCTAEdispPerfTable.cpp.

References copy_members(), free_members(), init_members(), and GCTAEdisp::operator=().

std::string GCTAEdispPerfTable::print ( const GChatter chatter = NORMAL) const
virtual

Print energy dispersion information.

Parameters
[in]chatterChattiness.
Returns
String containing energy dispersion information.

Implements GCTAEdisp.

Definition at line 489 of file GCTAEdispPerfTable.cpp.

References GNodeArray::append(), m_filename, m_logE, m_sigma, gammalib::parformat(), pow(), gammalib::reduce(), SILENT, GNodeArray::size(), and gammalib::str().

double GCTAEdispPerfTable::prob_erecobin ( const GEnergy ereco_min,
const GEnergy ereco_max,
const GEnergy etrue,
const double &  theta 
) const
virtual

Return energy dispersion probability for reconstructed energy interval.

Parameters
[in]ereco_minMinimum of reconstructed energy interval.
[in]ereco_maxMaximum of reconstructed energy interval.
[in]etrueTrue energy.
[in]thetaOffset angle (radians). Not used.
Returns
Integrated energy dispersion probability.

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 463 of file GCTAEdispPerfTable.cpp.

References gammalib::gauss_integral(), GEnergy::log10TeV(), m_par_sigma, and update().

void GCTAEdispPerfTable::update ( const double &  logE) const
private

Update energy dispersion parameter cache.

Parameters
[in]logELog10 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 595 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().

Member Data Documentation

GFilename GCTAEdispPerfTable::m_filename
mutableprivate

Name of response file.

Definition at line 121 of file GCTAEdispPerfTable.hpp.

Referenced by copy_members(), filename(), init_members(), load(), and print().

GNodeArray GCTAEdispPerfTable::m_logE
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().

double GCTAEdispPerfTable::m_par_logE
mutableprivate

Energy for which precomputation is done.

Definition at line 126 of file GCTAEdispPerfTable.hpp.

Referenced by copy_members(), init_members(), and update().

double GCTAEdispPerfTable::m_par_scale
mutableprivate

Gaussian normalization.

Definition at line 127 of file GCTAEdispPerfTable.hpp.

Referenced by copy_members(), init_members(), operator()(), and update().

double GCTAEdispPerfTable::m_par_sigma
mutableprivate

Gaussian sigma.

Definition at line 128 of file GCTAEdispPerfTable.hpp.

Referenced by copy_members(), init_members(), mc(), prob_erecobin(), and update().

double GCTAEdispPerfTable::m_par_width
mutableprivate

Gaussian width parameter.

Definition at line 129 of file GCTAEdispPerfTable.hpp.

Referenced by copy_members(), init_members(), operator()(), and update().

std::vector<double> GCTAEdispPerfTable::m_sigma
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().


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