GammaLib
2.1.0.dev
|
Interface for the COMPTEL D2 module response class. More...
#include <GCOMD2Response.hpp>
Classes | |
class | bkg_gauss_kernel |
class | kn_gauss_kernel |
Public Member Functions | |
GCOMD2Response (void) | |
Void constructor. More... | |
GCOMD2Response (const GCOMD2Response &rsp) | |
Copy constructor. More... | |
GCOMD2Response (const GCaldb &caldb, const std::string &sdbname) | |
Response constructor. More... | |
~GCOMD2Response (void) | |
Destructor. More... | |
GCOMD2Response & | operator= (const GCOMD2Response &rsp) |
Assignment operator. More... | |
double | operator() (const double &etrue, const double &ereco) const |
D2 module response evaluation operator. More... | |
void | clear (void) |
Clear instance. More... | |
GCOMD2Response * | 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 &sdbname) |
Load COMPTEL D2 module response. More... | |
void | read (const GFitsTable &table) |
Read COMPTEL D2 module response. More... | |
void | write (GFitsBinTable &table) |
Write COMPTEL D2 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 | escape1 (const double &etrue) const |
Return first escape peak amplitude. More... | |
double | escape2 (const double &etrue) const |
Return second escape peak amplitude. More... | |
double | comptontail (const double &etrue) const |
Return Compton tail amplitude. More... | |
double | background (const double &etrue) const |
Return background 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 D2 input energy (MeV) More... | |
double | emax (void) const |
Return maximum D2 input energy (MeV) More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print COMPTEL D2 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 GCOMD2Response &rsp) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | update_cache (const double &etrue) const |
Update computation cache. More... | |
void | update_response_vector (const double &etrue) const |
Update response vector. 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_escapes1 |
Amplitude of first escape peak. More... | |
std::vector< double > | m_escapes2 |
Amplitude of second escape peak. More... | |
std::vector< double > | m_tails |
Amplitude of Compton tail. More... | |
std::vector< double > | m_backgrounds |
Amplitude of Compton background. More... | |
std::vector< double > | m_emins |
Lower energy threshold of D2. More... | |
std::vector< double > | m_ewidths |
Lower energy threshold width of D2. More... | |
std::vector< double > | m_emaxs |
Upper energy limit of D2. More... | |
double | m_energy |
Incident total energy (MeV) More... | |
double | m_position |
Position of photo peak (MeV) More... | |
double | m_sigma |
Width of photo peak (MeV) More... | |
double | m_amplitude |
Amplitude of photo peak. More... | |
double | m_escape1 |
Amplitude of first escape peak. More... | |
double | m_escape2 |
Amplitude of second escape peak. More... | |
double | m_tail |
Amplitude of Compton tail. More... | |
double | m_background |
double | m_emin |
More... | |
double | m_ewidth |
Lower energy threshold width of D2 (MeV) More... | |
double | m_emax |
Upper energy limit of D2 (MeV) More... | |
double | m_pos_escape1 |
Position of first escape peak (MeV) More... | |
double | m_pos_escape2 |
Position of second escape peak (MeV) More... | |
double | m_wgt_photo |
Inverse of width of photo peak (1/MeV) More... | |
double | m_wgt_escape1 |
Inverse of width of first escape peak (1/MeV) More... | |
double | m_wgt_escape2 |
Inverse of width of first escape peak (1/MeV) More... | |
double | m_compton_edge |
Position of Compton edge (MeV) More... | |
double | m_rsp_etrue |
True energy of response vector. More... | |
GNodeArray | m_rsp_energies |
Response vector energies. More... | |
std::vector< double > | m_rsp_values |
Response vector values. More... | |
Interface for the COMPTEL D2 module response class.
Definition at line 49 of file GCOMD2Response.hpp.
GCOMD2Response::GCOMD2Response | ( | void | ) |
Void constructor.
Creates an empty COMPTEL D2 module response.
Definition at line 64 of file GCOMD2Response.cpp.
References init_members().
Referenced by clone().
GCOMD2Response::GCOMD2Response | ( | const GCOMD2Response & | rsp | ) |
Copy constructor.
[in] | rsp | COMPTEL D2 module response. |
Definition at line 79 of file GCOMD2Response.cpp.
References copy_members(), and init_members().
GCOMD2Response::GCOMD2Response | ( | const GCaldb & | caldb, |
const std::string & | sdbname | ||
) |
Response constructor.
[in] | caldb | Calibration database. |
[in] | sdbname | SDB response name. |
Create COMPTEL D2 module response by loading an SDB file from a calibration database.
Definition at line 101 of file GCOMD2Response.cpp.
References caldb(), init_members(), and load().
GCOMD2Response::~GCOMD2Response | ( | void | ) |
Destructor.
Destroys instance of COMPTEL response object.
Definition at line 122 of file GCOMD2Response.cpp.
References free_members().
|
inline |
Return photo peak amplitude.
[in] | etrue | True energy (MeV). |
Definition at line 243 of file GCOMD2Response.hpp.
References m_amplitude, and update_cache().
|
inline |
Return background amplitude.
[in] | etrue | True energy (MeV). |
Definition at line 299 of file GCOMD2Response.hpp.
References m_background, and update_cache().
|
inline |
Set calibration database.
[in] | caldb | Calibration database. |
Sets the calibration database containing the COMPTEL D2 module response.
Definition at line 201 of file GCOMD2Response.hpp.
|
inline |
Return calibration database.
Definition at line 187 of file GCOMD2Response.hpp.
References m_caldb.
Referenced by caldb(), GCOMD2Response(), and load().
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 175 of file GCOMD2Response.hpp.
|
virtual |
Clear instance.
Clears COMPTEL D2 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 244 of file GCOMD2Response.cpp.
References free_members(), and init_members().
Referenced by GCOMIaq::init_members(), and load().
|
virtual |
Clone instance.
Implements GBase.
Definition at line 262 of file GCOMD2Response.cpp.
References GCOMD2Response().
|
inline |
Return Compton tail amplitude.
[in] | etrue | True energy (MeV). |
Definition at line 285 of file GCOMD2Response.hpp.
References m_tail, and update_cache().
|
private |
Copy class members.
[in] | rsp | COMPTEL response. |
Definition at line 550 of file GCOMD2Response.cpp.
References m_amplitude, m_amplitudes, m_background, m_backgrounds, m_caldb, m_compton_edge, m_emax, m_emaxs, m_emin, m_emins, m_energies, m_energy, m_escape1, m_escape2, m_escapes1, m_escapes2, m_ewidth, m_ewidths, m_pos_escape1, m_pos_escape2, m_position, m_positions, m_rsp_energies, m_rsp_etrue, m_rsp_values, m_sigma, m_sigmas, m_tail, m_tails, m_wgt_escape1, m_wgt_escape2, and m_wgt_photo.
Referenced by GCOMD2Response(), and operator=().
|
inline |
Return maximum energy.
[in] | etrue | True energy (MeV). |
Definition at line 341 of file GCOMD2Response.hpp.
References m_emax, and update_cache().
Referenced by GCOMIaq::set().
|
inline |
Return maximum D2 input energy (MeV)
Returns the maximum D2 input energy (MeV). In case that no information has been read from a SDB file so far, the method returns 0.
Definition at line 373 of file GCOMD2Response.hpp.
References m_energies, and GNodeArray::size().
Referenced by update_response_vector().
|
inline |
Return minimum energy.
[in] | etrue | True energy (MeV). |
Definition at line 313 of file GCOMD2Response.hpp.
References m_emin, and update_cache().
|
inline |
Return minimum D2 input energy (MeV)
Returns the minimum D2 input energy (MeV). In case that no information has been read from a SDB file so far, the method returns 0.
Definition at line 357 of file GCOMD2Response.hpp.
References m_energies, and GNodeArray::size().
Referenced by update_response_vector().
|
inline |
Return first escape peak amplitude.
[in] | etrue | True energy (MeV). |
Definition at line 257 of file GCOMD2Response.hpp.
References m_escape1, and update_cache().
|
inline |
Return second escape peak amplitude.
[in] | etrue | True energy (MeV). |
Definition at line 271 of file GCOMD2Response.hpp.
References m_escape2, and update_cache().
|
inline |
Return energy threshold width.
[in] | etrue | True energy (MeV). |
Definition at line 327 of file GCOMD2Response.hpp.
References m_ewidth, and update_cache().
|
private |
Delete class members.
Definition at line 598 of file GCOMD2Response.cpp.
Referenced by clear(), operator=(), and ~GCOMD2Response().
|
private |
Initialise class members.
Definition at line 500 of file GCOMD2Response.cpp.
References GNodeArray::clear(), GCaldb::clear(), m_amplitude, m_amplitudes, m_background, m_backgrounds, m_caldb, m_compton_edge, m_emax, m_emaxs, m_emin, m_emins, m_energies, m_energy, m_escape1, m_escape2, m_escapes1, m_escapes2, m_ewidth, m_ewidths, m_pos_escape1, m_pos_escape2, m_position, m_positions, m_rsp_energies, m_rsp_etrue, m_rsp_values, m_sigma, m_sigmas, m_tail, m_tails, m_wgt_escape1, m_wgt_escape2, and m_wgt_photo.
Referenced by clear(), GCOMD2Response(), and operator=().
void GCOMD2Response::load | ( | const std::string & | sdbname | ) |
Load COMPTEL D2 module response.
[in] | sdbname | COMPTEL D2 module response name. |
Loads the COMPTEL D2 module response with specified name sdbname
. 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 279 of file GCOMD2Response.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 GCOMD2Response().
double GCOMD2Response::operator() | ( | const double & | etrue, |
const double & | ereco | ||
) | const |
D2 module response evaluation operator.
[in] | etrue | True energy (MeV). |
[in] | ereco | Reconstructed energy (MeV). |
Computes the D2 response for reconstructed energy ereco
in case that the true energy was etrue
. A zero response is returned if the reconstucted energy is outside the validity limit, defined by
\[ [{\tt m\_emin} - 0.75 {\tt m\_ewidth}, {\tt m\_emax}] \]
The code implementation is based on the COMPASS RESD1 function RESRS209.RESD2.F (release 1.0, 14-OCT-91).
Definition at line 183 of file GCOMD2Response.cpp.
References exp(), GNodeArray::interpolate(), GNodeArray::is_empty(), gammalib::ln2, m_emax, m_emin, m_energies, m_ewidth, m_rsp_energies, m_rsp_values, sqrt(), update_cache(), and update_response_vector().
GCOMD2Response & GCOMD2Response::operator= | ( | const GCOMD2Response & | rsp | ) |
Assignment operator.
[in] | rsp | COMPTEL D2 module response. |
Definition at line 144 of file GCOMD2Response.cpp.
References copy_members(), free_members(), and init_members().
|
inline |
Return photo peak position.
[in] | etrue | True energy (MeV). |
Definition at line 215 of file GCOMD2Response.hpp.
References m_position, and update_cache().
Print COMPTEL D2 module response information.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 456 of file GCOMD2Response.cpp.
References m_caldb, m_energies, gammalib::parformat(), GCaldb::print(), SILENT, GNodeArray::size(), and gammalib::str().
void GCOMD2Response::read | ( | const GFitsTable & | table | ) |
Read COMPTEL D2 module response.
[in] | table | FITS table. |
Read the COMPTEL D2 module response from a SDB FITS table.
Definition at line 325 of file GCOMD2Response.cpp.
References GNodeArray::append(), GNodeArray::clear(), m_amplitudes, m_backgrounds, m_emaxs, m_emins, m_energies, m_escapes1, m_escapes2, m_ewidths, m_positions, m_sigmas, m_tails, GFitsTable::nrows(), and GFitsTableCol::real().
Referenced by load().
|
inline |
Return photo peak standard deviation.
[in] | etrue | True energy (MeV). |
Definition at line 229 of file GCOMD2Response.hpp.
References m_sigma, and update_cache().
Referenced by update_response_vector().
|
private |
Update computation cache.
[in] | etrue | True energy (MeV). |
The method assumes that there is a valid D2 module response.
Definition at line 612 of file GCOMD2Response.cpp.
References GNodeArray::interpolate(), gammalib::inv_sqrt2pi, m_amplitude, m_amplitudes, m_background, m_backgrounds, m_compton_edge, m_emax, m_emaxs, m_emin, m_emins, m_energies, m_energy, m_escape1, m_escape2, m_escapes1, m_escapes2, m_ewidth, m_ewidths, m_pos_escape1, m_pos_escape2, m_position, m_positions, m_sigma, m_sigmas, m_tail, m_tails, m_wgt_escape1, m_wgt_escape2, m_wgt_photo, gammalib::mec2, and GNodeArray::size().
Referenced by amplitude(), background(), comptontail(), emax(), emin(), escape1(), escape2(), ewidth(), operator()(), position(), sigma(), and update_response_vector().
|
private |
Update response vector.
[in] | etrue | True energy (MeV). |
Updates the vector that stores the normalised D2 module response as function of energy. The vector is computed using
\[ R_{\rm D2}(E|E_0) = B_1 \exp \left( -\frac{1}{2} \frac{(E_0-E)^2}{\sigma^2(E_0)} \right) + B_2 \exp \left( -\frac{1}{2} \frac{(E_0-m_e c^2-E)^2}{\sigma^2(E_0-m_e c^2)} \right) + B_3 \exp \left( -\frac{1}{2} \frac{(E_0-2m_e c^2-E)^2}{\sigma^2(E_0-2m_e c^2)} \right) + B_4 \int_{E'} KN_{\rm mod}(E'|E,E_0) dE' + B_5 \int_{E'} B_{\rm c}(E'|E,E_0) dE' \]
where \(B1\) is the amplitude of the photo peak, \(B2\) is the amplitude of the first escape peak, \(B3\) is the amplitude of the second escape peak, \(B4\) is the amplitude of the Compton tail, \(B5\) is the amplitude of the Compton background, \(E_0\) is the position of the photo peak, and \(\sigma(E)\) is the energy dependent width of the photo peak. The constant \(n\) is chosen so that
\[ \int_{E} R_{\rm D2}(E|E_0) dE = 1 \]
The method assumes that there is a valid D2 module response.
The code implementation is based on the COMPASS RESRS209 function INITIL.F (release 1.0, 14-Oct-91).
Definition at line 727 of file GCOMD2Response.cpp.
References abs(), GNodeArray::append(), GNodeArray::clear(), emax(), emin(), GIntegral::eps(), exp(), GNodeArray::interpolate(), m_amplitude, m_background, m_compton_edge, m_emin, m_energies, m_escape1, m_escape2, m_pos_escape1, m_pos_escape2, m_position, m_rsp_energies, m_rsp_etrue, m_rsp_values, m_sigma, m_sigmas, m_tail, m_wgt_escape1, m_wgt_escape2, m_wgt_photo, norm(), GNodeArray::reserve(), GIntegral::romberg(), sigma(), GIntegral::silent(), and update_cache().
Referenced by operator()().
void GCOMD2Response::write | ( | GFitsBinTable & | table | ) |
Write COMPTEL D2 module response.
[in] | table | FITS table. |
Write the COMPTEL D2 module response into a SDB FITS table.
Definition at line 388 of file GCOMD2Response.cpp.
References GFitsTable::append(), GFitsHDU::extname(), m_amplitudes, m_backgrounds, m_emaxs, m_emins, m_energies, m_escapes1, m_escapes2, m_ewidths, m_positions, m_sigmas, m_tails, GNodeArray::size(), and GFitsTableCol::unit().
|
mutableprivate |
Amplitude of photo peak.
Definition at line 146 of file GCOMD2Response.hpp.
Referenced by amplitude(), copy_members(), init_members(), update_cache(), and update_response_vector().
|
private |
Photo peak amplitude.
Definition at line 133 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
mutableprivate |
Definition at line 150 of file GCOMD2Response.hpp.
Referenced by background(), copy_members(), init_members(), update_cache(), and update_response_vector().
|
private |
Amplitude of Compton background.
Definition at line 137 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
private |
Calibration database.
Definition at line 129 of file GCOMD2Response.hpp.
Referenced by caldb(), copy_members(), init_members(), load(), and print().
|
mutableprivate |
Position of Compton edge (MeV)
Definition at line 159 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), update_cache(), and update_response_vector().
|
mutableprivate |
Upper energy limit of D2 (MeV)
Definition at line 153 of file GCOMD2Response.hpp.
Referenced by copy_members(), emax(), init_members(), operator()(), and update_cache().
|
private |
Upper energy limit of D2.
Definition at line 140 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
mutableprivate |
Amplitude of Compton background
Lower energy threshold of D2 (MeV)
Definition at line 151 of file GCOMD2Response.hpp.
Referenced by copy_members(), emin(), init_members(), operator()(), update_cache(), and update_response_vector().
|
private |
Lower energy threshold of D2.
Definition at line 138 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
private |
Input energies.
Definition at line 130 of file GCOMD2Response.hpp.
Referenced by copy_members(), emax(), emin(), init_members(), operator()(), print(), read(), update_cache(), update_response_vector(), and write().
|
mutableprivate |
Incident total energy (MeV)
Definition at line 143 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), and update_cache().
|
mutableprivate |
Amplitude of first escape peak.
Definition at line 147 of file GCOMD2Response.hpp.
Referenced by copy_members(), escape1(), init_members(), update_cache(), and update_response_vector().
|
mutableprivate |
Amplitude of second escape peak.
Definition at line 148 of file GCOMD2Response.hpp.
Referenced by copy_members(), escape2(), init_members(), update_cache(), and update_response_vector().
|
private |
Amplitude of first escape peak.
Definition at line 134 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
private |
Amplitude of second escape peak.
Definition at line 135 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
mutableprivate |
Lower energy threshold width of D2 (MeV)
Definition at line 152 of file GCOMD2Response.hpp.
Referenced by copy_members(), ewidth(), init_members(), operator()(), and update_cache().
|
private |
Lower energy threshold width of D2.
Definition at line 139 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
mutableprivate |
Position of first escape peak (MeV)
Definition at line 154 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), update_cache(), and update_response_vector().
|
mutableprivate |
Position of second escape peak (MeV)
Definition at line 155 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), update_cache(), and update_response_vector().
|
mutableprivate |
Position of photo peak (MeV)
Definition at line 144 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), position(), update_cache(), and update_response_vector().
|
private |
Photo peak position in MeV.
Definition at line 131 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
mutableprivate |
Response vector energies.
Definition at line 163 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), operator()(), and update_response_vector().
|
mutableprivate |
True energy of response vector.
Definition at line 162 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), and update_response_vector().
|
mutableprivate |
Response vector values.
Definition at line 164 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), operator()(), and update_response_vector().
|
mutableprivate |
Width of photo peak (MeV)
Definition at line 145 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), sigma(), update_cache(), and update_response_vector().
|
private |
Photo peak width in MeV.
Definition at line 132 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), update_response_vector(), and write().
|
mutableprivate |
Amplitude of Compton tail.
Definition at line 149 of file GCOMD2Response.hpp.
Referenced by comptontail(), copy_members(), init_members(), update_cache(), and update_response_vector().
|
private |
Amplitude of Compton tail.
Definition at line 136 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), read(), update_cache(), and write().
|
mutableprivate |
Inverse of width of first escape peak (1/MeV)
Definition at line 157 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), update_cache(), and update_response_vector().
|
mutableprivate |
Inverse of width of first escape peak (1/MeV)
Definition at line 158 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), update_cache(), and update_response_vector().
|
mutableprivate |
Inverse of width of photo peak (1/MeV)
Definition at line 156 of file GCOMD2Response.hpp.
Referenced by copy_members(), init_members(), update_cache(), and update_response_vector().