GammaLib 2.0.0
Loading...
Searching...
No Matches
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.
 
 GCTAEdispRmf (const GFilename &filename)
 File constructor.
 
 GCTAEdispRmf (const GCTAEdispRmf &edisp)
 Copy constructor.
 
virtual ~GCTAEdispRmf (void)
 Destructor.
 
GCTAEdispRmfoperator= (const GCTAEdispRmf &edisp)
 Assignment operator.
 
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}\).
 
void clear (void)
 Clear instance.
 
GCTAEdispRmfclone (void) const
 Clone instance.
 
std::string classname (void) const
 Return class name.
 
void load (const GFilename &filename)
 Load energy dispersion from RMF file.
 
GFilename filename (void) const
 Return filename.
 
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.
 
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.
 
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.
 
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.
 
std::string print (const GChatter &chatter=NORMAL) const
 Print RMF information.
 
const GRmfrmf (void) const
 Return Redistribution Matrix File.
 
- Public Member Functions inherited from GCTAEdisp
 GCTAEdisp (void)
 Void constructor.
 
 GCTAEdisp (const GCTAEdisp &edisp)
 Copy constructor.
 
virtual ~GCTAEdisp (void)
 Destructor.
 
GCTAEdispoperator= (const GCTAEdisp &edisp)
 Assignment operator.
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor.
 

Private Member Functions

void init_members (void)
 Initialise class members.
 
void copy_members (const GCTAEdispRmf &psf)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
void set_matrix (void)
 Set redistribution matrix.
 
void set_max_edisp (void)
 Set maximum energy dispersion value.
 
void set_cache (void) const
 Set interpolation cache.
 
void update (const GEnergy &ereco, const GEnergy &etrue) const
 Update cache.
 
void compute_ereco_bounds (void) const
 Compute m_ereco_bounds vector.
 
void compute_etrue_bounds (void) const
 Compute m_etrue_bounds vector.
 

Private Attributes

GFilename m_filename
 Name of response file.
 
GRmf m_rmf
 Redistribution matrix file.
 
GMatrixSparse m_matrix
 Normalised redistribution matrix.
 
double m_max_edisp
 Maximum energy dispersion value for MC.
 
GNodeArray m_etrue
 Array of log10(Etrue)
 
GNodeArray m_ereco
 Array of log10(Ereco)
 
GEnergy m_last_etrue
 Last true energy.
 
GEnergy m_last_ereco
 Last reconstructed energy.
 
int m_itrue1
 Index of left Etrue.
 
int m_itrue2
 Index of right Etrue.
 
int m_ireco1
 Index of left Ereco.
 
int m_ireco2
 Index of right Ereco.
 
double m_wgt1
 Weight of lower left node.
 
double m_wgt2
 Weight of upper left node.
 
double m_wgt3
 Weight of lower right node.
 
double m_wgt4
 Weight of upper right node.
 
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.
 
void copy_members (const GCTAEdisp &edisp)
 Copy class members.
 
void free_members (void)
 Delete class members.
 

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() [1/3]

GCTAEdispRmf::GCTAEdispRmf ( void )

Void constructor.

Definition at line 68 of file GCTAEdispRmf.cpp.

References init_members().

Referenced by clone().

◆ GCTAEdispRmf() [2/3]

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 filename(), init_members(), and load().

◆ GCTAEdispRmf() [3/3]

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::~GCTAEdispRmf ( void )
virtual

Destructor.

Definition at line 119 of file GCTAEdispRmf.cpp.

References free_members().

Member Function Documentation

◆ classname()

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.

◆ clear()

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().

◆ clone()

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().

◆ compute_ereco_bounds()

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().

◆ compute_etrue_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().

◆ copy_members()

void GCTAEdispRmf::copy_members ( const GCTAEdispRmf & edisp)
private

◆ ereco_bounds()

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().

◆ etrue_bounds()

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().

◆ filename()

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 GCTAEdispRmf(), and load().

◆ free_members()

void GCTAEdispRmf::free_members ( void )
private

Delete class members.

Definition at line 707 of file GCTAEdispRmf.cpp.

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

◆ init_members()

◆ load()

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().

◆ mc()

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().

◆ operator()()

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().

◆ operator=()

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=().

◆ print()

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().

◆ prob_erecobin()

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().

◆ rmf()

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.

◆ set_cache()

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().

◆ set_matrix()

void GCTAEdispRmf::set_matrix ( void )
private

◆ set_max_edisp()

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().

◆ update()

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

◆ m_ereco

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().

◆ m_ereco_bounds

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().

◆ m_ereco_bounds_computed

bool GCTAEdispRmf::m_ereco_bounds_computed
mutableprivate

Definition at line 142 of file GCTAEdispRmf.hpp.

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

◆ m_etrue

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().

◆ m_etrue_bounds

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().

◆ m_etrue_bounds_computed

bool GCTAEdispRmf::m_etrue_bounds_computed
mutableprivate

Definition at line 143 of file GCTAEdispRmf.hpp.

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

◆ m_filename

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().

◆ m_index_ereco

int GCTAEdispRmf::m_index_ereco
mutableprivate

Definition at line 146 of file GCTAEdispRmf.hpp.

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

◆ m_index_etrue

int GCTAEdispRmf::m_index_etrue
mutableprivate

Definition at line 147 of file GCTAEdispRmf.hpp.

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

◆ m_ireco1

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().

◆ m_ireco2

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().

◆ m_itrue1

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().

◆ m_itrue2

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().

◆ m_last_ereco

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().

◆ m_last_ereco_bounds

GEnergy GCTAEdispRmf::m_last_ereco_bounds
mutableprivate

Definition at line 145 of file GCTAEdispRmf.hpp.

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

◆ m_last_etrue

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().

◆ m_last_etrue_bounds

GEnergy GCTAEdispRmf::m_last_etrue_bounds
mutableprivate

Definition at line 144 of file GCTAEdispRmf.hpp.

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

◆ m_matrix

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().

◆ m_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().

◆ m_rmf

GRmf GCTAEdispRmf::m_rmf
private

◆ m_wgt1

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().

◆ m_wgt2

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().

◆ m_wgt3

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().

◆ m_wgt4

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: