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

CTA Redistribution Matrix File (RMF) energy dispersion class. More...

#include <GCTAEdispRmf.hpp>

Inheritance diagram for GCTAEdispRmf:
GCTAEdisp GBase

Public Member Functions

 GCTAEdispRmf (void)
 Void constructor. More...
 
 GCTAEdispRmf (const GFilename &filename)
 File constructor. More...
 
 GCTAEdispRmf (const GCTAEdispRmf &edisp)
 Copy constructor. More...
 
virtual ~GCTAEdispRmf (void)
 Destructor. More...
 
GCTAEdispRmfoperator= (const GCTAEdispRmf &edisp)
 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...
 
GCTAEdispRmfclone (void) const
 Clone instance. More...
 
std::string classname (void) const
 Return class name. More...
 
void load (const GFilename &filename)
 Load energy dispersion from RMF file. 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 RMF information. More...
 
const GRmfrmf (void) const
 Return Redistribution Matrix File. 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 GCTAEdispRmf &psf)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void set_matrix (void)
 Set redistribution matrix. More...
 
void set_max_edisp (void)
 Set maximum energy dispersion value. More...
 
void set_cache (void) const
 Set interpolation cache. More...
 
void update (const GEnergy &ereco, const GEnergy &etrue) const
 Update cache. More...
 
void compute_ereco_bounds (void) const
 Compute m_ereco_bounds vector. More...
 
void compute_etrue_bounds (void) const
 Compute m_etrue_bounds vector. More...
 

Private Attributes

GFilename m_filename
 Name of response file. More...
 
GRmf m_rmf
 Redistribution matrix file. More...
 
GMatrixSparse m_matrix
 Normalised redistribution matrix. More...
 
double m_max_edisp
 Maximum energy dispersion value for MC. More...
 
GNodeArray m_etrue
 Array of log10(Etrue) More...
 
GNodeArray m_ereco
 Array of log10(Ereco) More...
 
GEnergy m_last_etrue
 Last true energy. More...
 
GEnergy m_last_ereco
 Last reconstructed energy. More...
 
int m_itrue1
 Index of left Etrue. More...
 
int m_itrue2
 Index of right Etrue. More...
 
int m_ireco1
 Index of left Ereco. More...
 
int m_ireco2
 Index of right Ereco. More...
 
double m_wgt1
 Weight of lower left node. More...
 
double m_wgt2
 Weight of upper left node. More...
 
double m_wgt3
 Weight of lower right node. More...
 
double m_wgt4
 Weight of upper right node. More...
 
bool m_ereco_bounds_computed
 
bool m_etrue_bounds_computed
 
GEnergy m_last_etrue_bounds
 
GEnergy m_last_ereco_bounds
 
int m_index_ereco
 
int m_index_etrue
 
std::vector< GEboundsm_ereco_bounds
 
std::vector< GEboundsm_etrue_bounds
 

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 Redistribution Matrix File (RMF) energy dispersion class.

The energy dispersion is defined as

\[ E_{\rm disp}(E_{\rm reco} | E_{\rm true}) \]

in units of MeV \(^{-1}\) where \(E_{\rm reco}\) is the reconstructed energy, and \(E_{\rm true}\) is the true energy.

Definition at line 60 of file GCTAEdispRmf.hpp.

Constructor & Destructor Documentation

GCTAEdispRmf::GCTAEdispRmf ( void  )

Void constructor.

Definition at line 68 of file GCTAEdispRmf.cpp.

References init_members().

Referenced by clone().

GCTAEdispRmf::GCTAEdispRmf ( const GFilename filename)
explicit

File constructor.

Parameters
[in]filenameRedistribution Matrix File name.

Construct instance by loading the Redistribution Matrix File.

Definition at line 85 of file GCTAEdispRmf.cpp.

References init_members(), and load().

GCTAEdispRmf::GCTAEdispRmf ( const GCTAEdispRmf edisp)

Copy constructor.

Parameters
[in]edispEnergy dispersion

Definition at line 103 of file GCTAEdispRmf.cpp.

References copy_members(), and init_members().

GCTAEdispRmf::~GCTAEdispRmf ( void  )
virtual

Destructor.

Definition at line 119 of file GCTAEdispRmf.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GCTAEdisp.

Definition at line 159 of file GCTAEdispRmf.hpp.

void GCTAEdispRmf::clear ( void  )
virtual

Clear instance.

This method properly resets the object to an initial state.

Implements GCTAEdisp.

Definition at line 223 of file GCTAEdispRmf.cpp.

References GCTAEdisp::free_members(), free_members(), GCTAEdisp::init_members(), and init_members().

GCTAEdispRmf * GCTAEdispRmf::clone ( void  ) const
virtual

Clone instance.

Returns
Deep copy of instance.

Implements GCTAEdisp.

Definition at line 243 of file GCTAEdispRmf.cpp.

References GCTAEdispRmf().

void GCTAEdispRmf::compute_ereco_bounds ( void  ) const
private

Compute m_ereco_bounds vector.

Definition at line 890 of file GCTAEdispRmf.cpp.

References GEbounds::elogmean(), GRmf::emeasured(), GRmf::etrue(), m_ereco_bounds, m_rmf, and GRmf::ntrue().

Referenced by ereco_bounds().

void GCTAEdispRmf::compute_etrue_bounds ( void  ) const
private

Compute m_etrue_bounds vector.

Definition at line 914 of file GCTAEdispRmf.cpp.

References GEbounds::elogmean(), GRmf::emeasured(), m_etrue_bounds, m_rmf, and GRmf::nmeasured().

Referenced by etrue_bounds().

void GCTAEdispRmf::copy_members ( const GCTAEdispRmf edisp)
private
GEbounds GCTAEdispRmf::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
Reconstructed energy boundaries.

Returns the band of observed energies outside of which the energy dispersion becomes negligible for a given true energy etrue.

Implements GCTAEdisp.

Definition at line 351 of file GCTAEdispRmf.cpp.

References compute_ereco_bounds(), GEbounds::emin(), GRmf::etrue(), m_ereco_bounds, m_ereco_bounds_computed, m_index_ereco, m_last_etrue_bounds, m_rmf, and GEnergy::TeV().

Referenced by mc(), and set_matrix().

GEbounds GCTAEdispRmf::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
True energy boundaries.

Returns the band of true photon energies outside of which the energy dispersion becomes negligible for a given observed energy logEobs.

Implements GCTAEdisp.

Definition at line 415 of file GCTAEdispRmf.cpp.

References compute_etrue_bounds(), GRmf::emeasured(), GEbounds::emin(), m_etrue_bounds, m_etrue_bounds_computed, m_index_etrue, m_last_ereco_bounds, m_rmf, and GEnergy::TeV().

GFilename GCTAEdispRmf::filename ( void  ) const
inlinevirtual

Return filename.

Returns
Returns filename from which the Redistribution Matrix was loaded.

Implements GCTAEdisp.

Definition at line 171 of file GCTAEdispRmf.hpp.

References m_filename.

Referenced by load().

void GCTAEdispRmf::free_members ( void  )
private

Delete class members.

Definition at line 707 of file GCTAEdispRmf.cpp.

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

void GCTAEdispRmf::load ( const GFilename filename)
virtual

Load energy dispersion from RMF file.

Parameters
[in]filenameof RMF file.

This method loads the energy dispersion information from an RMF file.

Implements GCTAEdisp.

Definition at line 256 of file GCTAEdispRmf.cpp.

References filename(), GRmf::load(), m_filename, m_rmf, set_cache(), set_matrix(), and set_max_edisp().

Referenced by GCTAEdispRmf().

GEnergy GCTAEdispRmf::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
Reconstructed energy.
Exceptions
GException::invalid_return_valueEnergy dispersion matrix is empty.

Draws reconstructed energy value from RMF matrix given a true energy etrue. If no energy dispersion information is available the method will return the true photon energy.

Implements GCTAEdisp.

Definition at line 296 of file GCTAEdispRmf.cpp.

References GEbounds::emax(), GEbounds::emin(), ereco_bounds(), G_MC, m_max_edisp, operator()(), GEnergy::TeV(), and GRan::uniform().

double GCTAEdispRmf::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}) \]

in units of MeV \(^{-1}\) where \(E_{\rm reco}\) is the reconstructed energy, and \(E_{\rm true}\) is the true energy.

Implements GCTAEdisp.

Definition at line 186 of file GCTAEdispRmf.cpp.

References m_ireco1, m_ireco2, m_itrue1, m_itrue2, m_matrix, m_wgt1, m_wgt2, m_wgt3, m_wgt4, and update().

Referenced by mc(), and prob_erecobin().

GCTAEdispRmf & GCTAEdispRmf::operator= ( const GCTAEdispRmf edisp)

Assignment operator.

Parameters
[in]edispEnergy dispersion
Returns
Energy dispersion

Definition at line 141 of file GCTAEdispRmf.cpp.

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

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

Print RMF information.

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

Implements GCTAEdisp.

Definition at line 582 of file GCTAEdispRmf.cpp.

References GEbounds::emax(), GRmf::emeasured(), GEbounds::emin(), GRmf::etrue(), m_filename, m_rmf, gammalib::parformat(), GEnergy::print(), SILENT, GEbounds::size(), and gammalib::str().

double GCTAEdispRmf::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. 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 487 of file GCTAEdispRmf.cpp.

References GNodeArray::inx_left(), GNodeArray::inx_right(), GEnergy::log10TeV(), m_ereco, m_etrue, m_matrix, GEnergy::MeV(), operator()(), GNodeArray::set_value(), GNodeArray::size(), GEnergy::TeV(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().

Referenced by set_matrix().

const GRmf & GCTAEdispRmf::rmf ( void  ) const
inline

Return Redistribution Matrix File.

Returns
Reference to Redistribution Matrix File.

Definition at line 183 of file GCTAEdispRmf.hpp.

References m_rmf.

void GCTAEdispRmf::set_cache ( void  ) const
private

Set interpolation cache.

Sets the interpolation cache.

Definition at line 789 of file GCTAEdispRmf.cpp.

References GNodeArray::append(), GNodeArray::clear(), GEbounds::elogmean(), GRmf::emeasured(), GRmf::etrue(), GEnergy::log10TeV(), m_ereco, m_etrue, m_rmf, GRmf::nmeasured(), GRmf::ntrue(), and GEnergy::TeV().

Referenced by load().

void GCTAEdispRmf::set_matrix ( void  )
private
void GCTAEdispRmf::set_max_edisp ( void  )
private

Set maximum energy dispersion value.

Definition at line 817 of file GCTAEdispRmf.cpp.

References GMatrixBase::columns(), m_matrix, m_max_edisp, and GMatrixBase::rows().

Referenced by load().

void GCTAEdispRmf::update ( const GEnergy ereco,
const GEnergy etrue 
) const
private

Update cache.

Parameters
[in]erecoReconstructed energy.
[in]etrueTrue energy.

Updates the interpolation cache. The interpolation cache is composed of four indices and weights that define 4 data values of the RMF matrix that are used for bilinear interpolation.

Definition at line 847 of file GCTAEdispRmf.cpp.

References GNodeArray::inx_left(), GNodeArray::inx_right(), GEnergy::log10TeV(), m_ereco, m_etrue, m_ireco1, m_ireco2, m_itrue1, m_itrue2, m_last_ereco, m_last_etrue, m_wgt1, m_wgt2, m_wgt3, m_wgt4, GNodeArray::set_value(), GEnergy::TeV(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().

Referenced by operator()().

Member Data Documentation

GNodeArray GCTAEdispRmf::m_ereco
mutableprivate

Array of log10(Ereco)

Definition at line 129 of file GCTAEdispRmf.hpp.

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

std::vector<GEbounds> GCTAEdispRmf::m_ereco_bounds
mutableprivate

Definition at line 148 of file GCTAEdispRmf.hpp.

Referenced by compute_ereco_bounds(), copy_members(), ereco_bounds(), and init_members().

bool GCTAEdispRmf::m_ereco_bounds_computed
mutableprivate

Definition at line 142 of file GCTAEdispRmf.hpp.

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

GNodeArray GCTAEdispRmf::m_etrue
mutableprivate

Array of log10(Etrue)

Definition at line 128 of file GCTAEdispRmf.hpp.

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

std::vector<GEbounds> GCTAEdispRmf::m_etrue_bounds
mutableprivate

Definition at line 149 of file GCTAEdispRmf.hpp.

Referenced by compute_etrue_bounds(), copy_members(), etrue_bounds(), and init_members().

bool GCTAEdispRmf::m_etrue_bounds_computed
mutableprivate

Definition at line 143 of file GCTAEdispRmf.hpp.

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

GFilename GCTAEdispRmf::m_filename
private

Name of response file.

Definition at line 122 of file GCTAEdispRmf.hpp.

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

int GCTAEdispRmf::m_index_ereco
mutableprivate

Definition at line 146 of file GCTAEdispRmf.hpp.

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

int GCTAEdispRmf::m_index_etrue
mutableprivate

Definition at line 147 of file GCTAEdispRmf.hpp.

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

int GCTAEdispRmf::m_ireco1
mutableprivate

Index of left Ereco.

Definition at line 134 of file GCTAEdispRmf.hpp.

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

int GCTAEdispRmf::m_ireco2
mutableprivate

Index of right Ereco.

Definition at line 135 of file GCTAEdispRmf.hpp.

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

int GCTAEdispRmf::m_itrue1
mutableprivate

Index of left Etrue.

Definition at line 132 of file GCTAEdispRmf.hpp.

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

int GCTAEdispRmf::m_itrue2
mutableprivate

Index of right Etrue.

Definition at line 133 of file GCTAEdispRmf.hpp.

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

GEnergy GCTAEdispRmf::m_last_ereco
mutableprivate

Last reconstructed energy.

Definition at line 131 of file GCTAEdispRmf.hpp.

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

GEnergy GCTAEdispRmf::m_last_ereco_bounds
mutableprivate

Definition at line 145 of file GCTAEdispRmf.hpp.

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

GEnergy GCTAEdispRmf::m_last_etrue
mutableprivate

Last true energy.

Definition at line 130 of file GCTAEdispRmf.hpp.

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

GEnergy GCTAEdispRmf::m_last_etrue_bounds
mutableprivate

Definition at line 144 of file GCTAEdispRmf.hpp.

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

GMatrixSparse GCTAEdispRmf::m_matrix
private

Normalised redistribution matrix.

Definition at line 124 of file GCTAEdispRmf.hpp.

Referenced by copy_members(), init_members(), operator()(), prob_erecobin(), set_matrix(), and set_max_edisp().

double GCTAEdispRmf::m_max_edisp
private

Maximum energy dispersion value for MC.

Definition at line 125 of file GCTAEdispRmf.hpp.

Referenced by copy_members(), init_members(), mc(), and set_max_edisp().

GRmf GCTAEdispRmf::m_rmf
private
double GCTAEdispRmf::m_wgt1
mutableprivate

Weight of lower left node.

Definition at line 136 of file GCTAEdispRmf.hpp.

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

double GCTAEdispRmf::m_wgt2
mutableprivate

Weight of upper left node.

Definition at line 137 of file GCTAEdispRmf.hpp.

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

double GCTAEdispRmf::m_wgt3
mutableprivate

Weight of lower right node.

Definition at line 138 of file GCTAEdispRmf.hpp.

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

double GCTAEdispRmf::m_wgt4
mutableprivate

Weight of upper right node.

Definition at line 139 of file GCTAEdispRmf.hpp.

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


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