GammaLib
2.1.0.dev
|
Interface for the COMPTEL D1 module response class. More...
#include <GCOMD1Response.hpp>
Public Member Functions | |
GCOMD1Response (void) | |
Void constructor. More... | |
GCOMD1Response (const GCOMD1Response &rsp) | |
Copy constructor. More... | |
GCOMD1Response (const GCaldb &caldb, const std::string &sdaname) | |
Response constructor. More... | |
~GCOMD1Response (void) | |
Destructor. More... | |
GCOMD1Response & | operator= (const GCOMD1Response &rsp) |
Assignment operator. More... | |
double | operator() (const double &etrue, const double &ereco) const |
D1 module response evaluation operator. More... | |
void | clear (void) |
Clear instance. More... | |
GCOMD1Response * | clone (void) const |
Clone instance. More... | |
std::string | classname (void) const |
Return class name. More... | |
void | caldb (const GCaldb &caldb) |
Set calibration database. More... | |
const GCaldb & | caldb (void) const |
Return calibration database. More... | |
void | load (const std::string &sdaname) |
Load COMPTEL D1 module response. More... | |
void | read (const GFitsTable &table) |
Read COMPTEL D1 module response. More... | |
void | write (GFitsBinTable &table) |
Write COMPTEL D1 module response. More... | |
double | position (const double &etrue) const |
Return photo peak position. More... | |
double | sigma (const double &etrue) const |
Return photo peak standard deviation. More... | |
double | amplitude (const double &etrue) const |
Return photo peak amplitude. More... | |
double | emin (const double &etrue) const |
Return minimum energy. More... | |
double | ewidth (const double &etrue) const |
Return energy threshold width. More... | |
double | emax (const double &etrue) const |
Return maximum energy. More... | |
double | emin (void) const |
Return minimum D1 input energy (MeV) More... | |
double | emax (void) const |
Return maximum D1 input energy (MeV) More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print COMPTEL D1 module response information. 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 GCOMD1Response &rsp) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | update_cache (const double &etrue) const |
Update computation cache. More... | |
Private Attributes | |
GCaldb | m_caldb |
Calibration database. More... | |
GNodeArray | m_energies |
Input energies. More... | |
std::vector< double > | m_positions |
Photo peak position in MeV. More... | |
std::vector< double > | m_sigmas |
Photo peak width in MeV. More... | |
std::vector< double > | m_amplitudes |
Photo peak amplitude. More... | |
std::vector< double > | m_emins |
Lower energy threshold of D1. More... | |
std::vector< double > | m_ewidths |
Lower energy threshold width of D1. More... | |
std::vector< double > | m_emaxs |
Upper energy limit of D1. More... | |
double | m_energy |
double | m_position |
double | m_sigma |
double | m_amplitude |
double | m_emin |
double | m_ewidth |
double | m_emax |
Interface for the COMPTEL D1 module response class.
Definition at line 48 of file GCOMD1Response.hpp.
GCOMD1Response::GCOMD1Response | ( | void | ) |
Void constructor.
Creates an empty COMPTEL D1 module response.
Definition at line 62 of file GCOMD1Response.cpp.
References init_members().
Referenced by clone().
GCOMD1Response::GCOMD1Response | ( | const GCOMD1Response & | rsp | ) |
Copy constructor.
[in] | rsp | COMPTEL D1 module response. |
Definition at line 77 of file GCOMD1Response.cpp.
References copy_members(), and init_members().
GCOMD1Response::GCOMD1Response | ( | const GCaldb & | caldb, |
const std::string & | sdaname | ||
) |
Response constructor.
[in] | caldb | Calibration database. |
[in] | sdaname | SDA response name. |
Create COMPTEL D1 module response by loading an SDA file from a calibration database.
Definition at line 99 of file GCOMD1Response.cpp.
References caldb(), init_members(), and load().
GCOMD1Response::~GCOMD1Response | ( | void | ) |
Destructor.
Destroys instance of COMPTEL response object.
Definition at line 120 of file GCOMD1Response.cpp.
References free_members().
|
inline |
Return photo peak amplitude.
[in] | etrue | True energy (MeV). |
Definition at line 182 of file GCOMD1Response.hpp.
References m_amplitude, and update_cache().
|
inline |
Set calibration database.
[in] | caldb | Calibration database. |
Sets the calibration database containing the COMPTEL D1 module response.
Definition at line 140 of file GCOMD1Response.hpp.
|
inline |
Return calibration database.
Definition at line 126 of file GCOMD1Response.hpp.
References m_caldb.
Referenced by caldb(), GCOMD1Response(), and load().
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 114 of file GCOMD1Response.hpp.
|
virtual |
Clear instance.
Clears COMPTEL D1 module response object by resetting all members to an initial state. Any information that was present in the object before will be lost.
Implements GBase.
Definition at line 264 of file GCOMD1Response.cpp.
References free_members(), and init_members().
Referenced by GCOMIaq::init_members(), and load().
|
virtual |
Clone instance.
Implements GBase.
Definition at line 282 of file GCOMD1Response.cpp.
References GCOMD1Response().
|
private |
Copy class members.
[in] | rsp | COMPTEL response. |
Definition at line 527 of file GCOMD1Response.cpp.
References m_amplitude, m_amplitudes, m_caldb, m_emax, m_emaxs, m_emin, m_emins, m_energies, m_energy, m_ewidth, m_ewidths, m_position, m_positions, m_sigma, and m_sigmas.
Referenced by GCOMD1Response(), and operator=().
|
inline |
Return maximum energy.
[in] | etrue | True energy (MeV). |
Definition at line 224 of file GCOMD1Response.hpp.
References m_emax, and update_cache().
Referenced by GCOMIaq::compute_iaq_bin(), and GCOMIaq::set().
|
inline |
Return maximum D1 input energy (MeV)
Returns the maximum D1 input energy (MeV). In case that no information has been read from a SDA file so far, the method returns 0.
Definition at line 256 of file GCOMD1Response.hpp.
References m_energies, and GNodeArray::size().
|
inline |
Return minimum energy.
[in] | etrue | True energy (MeV). |
Definition at line 196 of file GCOMD1Response.hpp.
References m_emin, and update_cache().
Referenced by GCOMIaq::compute_iaq_bin().
|
inline |
Return minimum D1 input energy (MeV)
Returns the minimum D1 input energy (MeV). In case that no information has been read from a SDA file so far, the method returns 0.
Definition at line 240 of file GCOMD1Response.hpp.
References m_energies, and GNodeArray::size().
|
inline |
Return energy threshold width.
[in] | etrue | True energy (MeV). |
Definition at line 210 of file GCOMD1Response.hpp.
References m_ewidth, and update_cache().
Referenced by GCOMIaq::compute_iaq_bin().
|
private |
Delete class members.
Definition at line 556 of file GCOMD1Response.cpp.
Referenced by clear(), operator=(), and ~GCOMD1Response().
|
private |
Initialise class members.
Definition at line 496 of file GCOMD1Response.cpp.
References GNodeArray::clear(), GCaldb::clear(), m_amplitude, m_amplitudes, m_caldb, m_emax, m_emaxs, m_emin, m_emins, m_energies, m_energy, m_ewidth, m_ewidths, m_position, m_positions, m_sigma, and m_sigmas.
Referenced by clear(), GCOMD1Response(), and operator=().
void GCOMD1Response::load | ( | const std::string & | sdaname | ) |
Load COMPTEL D1 module response.
[in] | sdaname | COMPTEL D1 module response name. |
Loads the COMPTEL D1 module response with specified name sdaname
. The method first searchs for an appropriate response in the calibration database. If no appropriate response is found, the method takes the database root path and response name to build the full path to the response file, and tries to load the response from these paths.
Definition at line 299 of file GCOMD1Response.cpp.
References caldb(), clear(), GFits::close(), GFilename::exists(), GCaldb::filename(), gammalib::filepath(), GFilename::is_empty(), m_caldb, read(), GCaldb::rootdir(), and GFits::table().
Referenced by GCOMD1Response().
double GCOMD1Response::operator() | ( | const double & | etrue, |
const double & | ereco | ||
) | const |
D1 module response evaluation operator.
[in] | etrue | True energy (MeV). |
[in] | ereco | Reconstructed energy (MeV). |
Computes
\[ R_{\rm D1}(E|E_0) = n \times \left[ A_1 \exp \left( -\frac{1}{2} \frac{(E_0-E)^2}{\sigma^2(E_0)} \right) \right] \]
where \(B1\) is the amplitude of the photo peak, \(\sigma(E_0)\) is width of the photo peak, and \(E_0\) is the position of the photo peak. The constant \(n\) is chosen so that
\[ \int_{E} R_{\rm D1}(E|E_0) dE = 1 \]
The code implementation is based on the COMPASS RESD1 function SPDERC01.RESD1.F (release ?, date ?).
Definition at line 191 of file GCOMD1Response.cpp.
References abs(), exp(), GNodeArray::is_empty(), m_amplitude, m_emax, m_emin, m_energies, m_ewidth, m_position, m_sigma, and update_cache().
GCOMD1Response & GCOMD1Response::operator= | ( | const GCOMD1Response & | rsp | ) |
Assignment operator.
[in] | rsp | COMPTEL D1 module response. |
Definition at line 142 of file GCOMD1Response.cpp.
References copy_members(), free_members(), and init_members().
|
inline |
Return photo peak position.
[in] | etrue | True energy (MeV). |
Definition at line 154 of file GCOMD1Response.hpp.
References m_position, and update_cache().
Referenced by GCOMIaq::compute_iaq_bin().
Print COMPTEL D1 module response information.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 452 of file GCOMD1Response.cpp.
References m_caldb, m_energies, gammalib::parformat(), GCaldb::print(), SILENT, GNodeArray::size(), and gammalib::str().
void GCOMD1Response::read | ( | const GFitsTable & | table | ) |
Read COMPTEL D1 module response.
[in] | table | FITS table. |
Read the COMPTEL D1 module response from a SDA FITS table.
Definition at line 345 of file GCOMD1Response.cpp.
References GNodeArray::append(), GNodeArray::clear(), m_amplitudes, m_emaxs, m_emins, m_energies, m_ewidths, m_positions, m_sigmas, GFitsTable::nrows(), and GFitsTableCol::real().
Referenced by load().
|
inline |
Return photo peak standard deviation.
[in] | etrue | True energy (MeV). |
Definition at line 168 of file GCOMD1Response.hpp.
References m_sigma, and update_cache().
Referenced by GCOMIaq::compute_iaq_bin().
|
private |
Update computation cache.
[in] | etrue | True energy (MeV). |
The method assumes that there is a valid D1 module response.
Definition at line 570 of file GCOMD1Response.cpp.
References GNodeArray::interpolate(), m_amplitude, m_amplitudes, m_emax, m_emaxs, m_emin, m_emins, m_energies, m_energy, m_ewidth, m_ewidths, m_position, m_positions, m_sigma, m_sigmas, GNodeArray::size(), and gammalib::sqrt_twopi.
Referenced by amplitude(), emax(), emin(), ewidth(), operator()(), position(), and sigma().
void GCOMD1Response::write | ( | GFitsBinTable & | table | ) |
Write COMPTEL D1 module response.
[in] | table | FITS table. |
Write the COMPTEL D1 module response into a SDA FITS table.
Definition at line 396 of file GCOMD1Response.cpp.
References GFitsTable::append(), GFitsHDU::extname(), m_amplitudes, m_emaxs, m_emins, m_energies, m_ewidths, m_positions, m_sigmas, GNodeArray::size(), and GFitsTableCol::unit().
|
mutableprivate |
Definition at line 101 of file GCOMD1Response.hpp.
Referenced by amplitude(), copy_members(), init_members(), operator()(), and update_cache().
|
private |
Photo peak amplitude.
Definition at line 92 of file GCOMD1Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
private |
Calibration database.
Definition at line 88 of file GCOMD1Response.hpp.
Referenced by caldb(), copy_members(), init_members(), load(), and print().
|
mutableprivate |
Definition at line 104 of file GCOMD1Response.hpp.
Referenced by copy_members(), emax(), init_members(), operator()(), and update_cache().
|
private |
Upper energy limit of D1.
Definition at line 95 of file GCOMD1Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
mutableprivate |
Definition at line 102 of file GCOMD1Response.hpp.
Referenced by copy_members(), emin(), init_members(), operator()(), and update_cache().
|
private |
Lower energy threshold of D1.
Definition at line 93 of file GCOMD1Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
private |
Input energies.
Definition at line 89 of file GCOMD1Response.hpp.
Referenced by copy_members(), emax(), emin(), init_members(), operator()(), print(), read(), update_cache(), and write().
|
mutableprivate |
Definition at line 98 of file GCOMD1Response.hpp.
Referenced by copy_members(), init_members(), and update_cache().
|
mutableprivate |
Definition at line 103 of file GCOMD1Response.hpp.
Referenced by copy_members(), ewidth(), init_members(), operator()(), and update_cache().
|
private |
Lower energy threshold width of D1.
Definition at line 94 of file GCOMD1Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
mutableprivate |
Definition at line 99 of file GCOMD1Response.hpp.
Referenced by copy_members(), init_members(), operator()(), position(), and update_cache().
|
private |
Photo peak position in MeV.
Definition at line 90 of file GCOMD1Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
mutableprivate |
Definition at line 100 of file GCOMD1Response.hpp.
Referenced by copy_members(), init_members(), operator()(), sigma(), and update_cache().
|
private |
Photo peak width in MeV.
Definition at line 91 of file GCOMD1Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().