GammaLib
2.0.0
|
CTA Redistribution Matrix File (RMF) energy dispersion class. More...
#include <GCTAEdispRmf.hpp>
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... | |
GCTAEdispRmf & | operator= (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... | |
GCTAEdispRmf * | clone (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 GRmf & | rmf (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... | |
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 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< GEbounds > | m_ereco_bounds |
std::vector< GEbounds > | m_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... | |
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.
GCTAEdispRmf::GCTAEdispRmf | ( | void | ) |
Void constructor.
Definition at line 68 of file GCTAEdispRmf.cpp.
References init_members().
Referenced by clone().
|
explicit |
File constructor.
[in] | filename | Redistribution 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.
[in] | edisp | Energy dispersion |
Definition at line 103 of file GCTAEdispRmf.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GCTAEdisp.
Definition at line 159 of file GCTAEdispRmf.hpp.
|
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().
|
virtual |
Clone instance.
Implements GCTAEdisp.
Definition at line 243 of file GCTAEdispRmf.cpp.
References GCTAEdispRmf().
|
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().
|
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().
|
private |
Copy class members.
[in] | edisp | Energy dispersion |
Definition at line 667 of file GCTAEdispRmf.cpp.
References m_ereco, m_ereco_bounds, m_ereco_bounds_computed, m_etrue, m_etrue_bounds, m_etrue_bounds_computed, m_filename, m_index_ereco, m_index_etrue, m_ireco1, m_ireco2, m_itrue1, m_itrue2, m_last_ereco, m_last_ereco_bounds, m_last_etrue, m_last_etrue_bounds, m_matrix, m_max_edisp, m_rmf, m_wgt1, m_wgt2, m_wgt3, and m_wgt4.
Referenced by GCTAEdispRmf(), 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 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().
|
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
.
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().
|
inlinevirtual |
Return filename.
Implements GCTAEdisp.
Definition at line 171 of file GCTAEdispRmf.hpp.
References m_filename.
Referenced by load().
|
private |
Delete class members.
Definition at line 707 of file GCTAEdispRmf.cpp.
Referenced by clear(), operator=(), and ~GCTAEdispRmf().
|
private |
Initialise class members.
Definition at line 625 of file GCTAEdispRmf.cpp.
References GNodeArray::clear(), GEnergy::clear(), GRmf::clear(), GFilename::clear(), GMatrixSparse::clear(), m_ereco, m_ereco_bounds, m_ereco_bounds_computed, m_etrue, m_etrue_bounds, m_etrue_bounds_computed, m_filename, m_index_ereco, m_index_etrue, m_ireco1, m_ireco2, m_itrue1, m_itrue2, m_last_ereco, m_last_ereco_bounds, m_last_etrue, m_last_etrue_bounds, m_matrix, m_max_edisp, m_rmf, m_wgt1, m_wgt2, m_wgt3, and m_wgt4.
Referenced by clear(), GCTAEdispRmf(), and operator=().
|
virtual |
Load energy dispersion from RMF file.
[in] | filename | of 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().
|
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. |
GException::invalid_return_value | Energy 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().
|
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}) \]
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.
[in] | edisp | Energy dispersion |
Definition at line 141 of file GCTAEdispRmf.cpp.
References copy_members(), free_members(), init_members(), and GCTAEdisp::operator=().
Print RMF information.
[in] | chatter | Chattiness. |
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().
|
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. 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 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().
|
inline |
Return Redistribution Matrix File.
Definition at line 183 of file GCTAEdispRmf.hpp.
References m_rmf.
|
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().
|
private |
Set redistribution matrix.
Definition at line 717 of file GCTAEdispRmf.cpp.
References GEbounds::elogmean(), GEbounds::emax(), GRmf::emeasured(), GEbounds::emin(), ereco_bounds(), GRmf::etrue(), m_matrix, m_rmf, GEnergy::MeV(), GRmf::nmeasured(), GRmf::ntrue(), prob_erecobin(), GEbounds::size(), and sum().
Referenced by load().
|
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().
Update cache.
[in] | ereco | Reconstructed energy. |
[in] | etrue | True 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()().
|
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().
|
mutableprivate |
Definition at line 148 of file GCTAEdispRmf.hpp.
Referenced by compute_ereco_bounds(), copy_members(), ereco_bounds(), and init_members().
|
mutableprivate |
Definition at line 142 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), ereco_bounds(), and init_members().
|
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().
|
mutableprivate |
Definition at line 149 of file GCTAEdispRmf.hpp.
Referenced by compute_etrue_bounds(), copy_members(), etrue_bounds(), and init_members().
|
mutableprivate |
Definition at line 143 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), etrue_bounds(), and init_members().
|
private |
Name of response file.
Definition at line 122 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), filename(), init_members(), load(), and print().
|
mutableprivate |
Definition at line 146 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), ereco_bounds(), and init_members().
|
mutableprivate |
Definition at line 147 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), etrue_bounds(), and init_members().
|
mutableprivate |
Index of left Ereco.
Definition at line 134 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Index of right Ereco.
Definition at line 135 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Index of left Etrue.
Definition at line 132 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Index of right Etrue.
Definition at line 133 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Last reconstructed energy.
Definition at line 131 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), and update().
|
mutableprivate |
Definition at line 145 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), etrue_bounds(), and init_members().
|
mutableprivate |
Last true energy.
Definition at line 130 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), and update().
|
mutableprivate |
Definition at line 144 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), ereco_bounds(), and init_members().
|
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().
|
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().
|
private |
Redistribution matrix file.
Definition at line 123 of file GCTAEdispRmf.hpp.
Referenced by compute_ereco_bounds(), compute_etrue_bounds(), copy_members(), ereco_bounds(), etrue_bounds(), init_members(), load(), print(), rmf(), set_cache(), and set_matrix().
|
mutableprivate |
Weight of lower left node.
Definition at line 136 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Weight of upper left node.
Definition at line 137 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Weight of lower right node.
Definition at line 138 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Weight of upper right node.
Definition at line 139 of file GCTAEdispRmf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().