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

Interface for the COMPTEL D2 module response class. More...

#include <GCOMD2Response.hpp>

Inheritance diagram for GCOMD2Response:
GBase

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...
 
GCOMD2Responseoperator= (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...
 
GCOMD2Responseclone (void) const
 Clone instance. More...
 
std::string classname (void) const
 Return class name. More...
 
void caldb (const GCaldb &caldb)
 Set calibration database. More...
 
const GCaldbcaldb (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
 

Amplitude of Compton background

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

Detailed Description

Interface for the COMPTEL D2 module response class.

Definition at line 49 of file GCOMD2Response.hpp.

Constructor & Destructor Documentation

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.

Parameters
[in]rspCOMPTEL 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.

Parameters
[in]caldbCalibration database.
[in]sdbnameSDB 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().

Member Function Documentation

double GCOMD2Response::amplitude ( const double &  etrue) const
inline

Return photo peak amplitude.

Parameters
[in]etrueTrue energy (MeV).
Returns
Photo peak amplitude.

Definition at line 243 of file GCOMD2Response.hpp.

References m_amplitude, and update_cache().

double GCOMD2Response::background ( const double &  etrue) const
inline

Return background amplitude.

Parameters
[in]etrueTrue energy (MeV).
Returns
Background amplitude.

Definition at line 299 of file GCOMD2Response.hpp.

References m_background, and update_cache().

void GCOMD2Response::caldb ( const GCaldb caldb)
inline

Set calibration database.

Parameters
[in]caldbCalibration database.

Sets the calibration database containing the COMPTEL D2 module response.

Definition at line 201 of file GCOMD2Response.hpp.

References caldb(), and m_caldb.

const GCaldb & GCOMD2Response::caldb ( void  ) const
inline

Return calibration database.

Returns
Calibration database.

Definition at line 187 of file GCOMD2Response.hpp.

References m_caldb.

Referenced by caldb(), GCOMD2Response(), and load().

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

Return class name.

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

Implements GBase.

Definition at line 175 of file GCOMD2Response.hpp.

void GCOMD2Response::clear ( void  )
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().

GCOMD2Response * GCOMD2Response::clone ( void  ) const
virtual

Clone instance.

Returns
Pointer to deep copy of COMPTEL D2 module response.

Implements GBase.

Definition at line 262 of file GCOMD2Response.cpp.

References GCOMD2Response().

double GCOMD2Response::comptontail ( const double &  etrue) const
inline

Return Compton tail amplitude.

Parameters
[in]etrueTrue energy (MeV).
Returns
Compton tail amplitude.

Definition at line 285 of file GCOMD2Response.hpp.

References m_tail, and update_cache().

double GCOMD2Response::emax ( const double &  etrue) const
inline

Return maximum energy.

Parameters
[in]etrueTrue energy (MeV).
Returns
Maximum energy (MeV).

Definition at line 341 of file GCOMD2Response.hpp.

References m_emax, and update_cache().

Referenced by GCOMIaq::set().

double GCOMD2Response::emax ( void  ) const
inline

Return maximum D2 input energy (MeV)

Returns
Maximum energy 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().

double GCOMD2Response::emin ( const double &  etrue) const
inline

Return minimum energy.

Parameters
[in]etrueTrue energy (MeV).
Returns
Minimum energy (MeV).

Definition at line 313 of file GCOMD2Response.hpp.

References m_emin, and update_cache().

double GCOMD2Response::emin ( void  ) const
inline

Return minimum D2 input energy (MeV)

Returns
Minimum energy 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().

double GCOMD2Response::escape1 ( const double &  etrue) const
inline

Return first escape peak amplitude.

Parameters
[in]etrueTrue energy (MeV).
Returns
First escape peak amplitude.

Definition at line 257 of file GCOMD2Response.hpp.

References m_escape1, and update_cache().

double GCOMD2Response::escape2 ( const double &  etrue) const
inline

Return second escape peak amplitude.

Parameters
[in]etrueTrue energy (MeV).
Returns
Second escape peak amplitude.

Definition at line 271 of file GCOMD2Response.hpp.

References m_escape2, and update_cache().

double GCOMD2Response::ewidth ( const double &  etrue) const
inline

Return energy threshold width.

Parameters
[in]etrueTrue energy (MeV).
Returns
Energy threshold width (MeV).

Definition at line 327 of file GCOMD2Response.hpp.

References m_ewidth, and update_cache().

void GCOMD2Response::free_members ( void  )
private

Delete class members.

Definition at line 598 of file GCOMD2Response.cpp.

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

void GCOMD2Response::load ( const std::string &  sdbname)

Load COMPTEL D2 module response.

Parameters
[in]sdbnameCOMPTEL 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.

Parameters
[in]etrueTrue energy (MeV).
[in]erecoReconstructed energy (MeV).
Returns
COMPTEL D2 module response.

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.

Parameters
[in]rspCOMPTEL D2 module response.
Returns
COMPTEL D2 module response.

Definition at line 144 of file GCOMD2Response.cpp.

References copy_members(), free_members(), and init_members().

double GCOMD2Response::position ( const double &  etrue) const
inline

Return photo peak position.

Parameters
[in]etrueTrue energy (MeV).
Returns
Photo peak position (MeV).

Definition at line 215 of file GCOMD2Response.hpp.

References m_position, and update_cache().

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

Print COMPTEL D2 module response information.

Parameters
[in]chatterChattiness.
Returns
String containing COMPTEL D2 module response information.

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.

Parameters
[in]tableFITS 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().

double GCOMD2Response::sigma ( const double &  etrue) const
inline

Return photo peak standard deviation.

Parameters
[in]etrueTrue energy (MeV).
Returns
Photo peak standard deviation (MeV).

Definition at line 229 of file GCOMD2Response.hpp.

References m_sigma, and update_cache().

Referenced by update_response_vector().

void GCOMD2Response::update_cache ( const double &  etrue) const
private
void GCOMD2Response::update_response_vector ( const double &  etrue) const
private

Update response vector.

Parameters
[in]etrueTrue 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.

Parameters
[in]tableFITS 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().

Member Data Documentation

double GCOMD2Response::m_amplitude
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().

std::vector<double> GCOMD2Response::m_amplitudes
private

Photo peak amplitude.

Definition at line 133 of file GCOMD2Response.hpp.

Referenced by copy_members(), init_members(), read(), update_cache(), and write().

double GCOMD2Response::m_background
mutableprivate
std::vector<double> GCOMD2Response::m_backgrounds
private

Amplitude of Compton background.

Definition at line 137 of file GCOMD2Response.hpp.

Referenced by copy_members(), init_members(), read(), update_cache(), and write().

GCaldb GCOMD2Response::m_caldb
private

Calibration database.

Definition at line 129 of file GCOMD2Response.hpp.

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

double GCOMD2Response::m_compton_edge
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().

double GCOMD2Response::m_emax
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().

std::vector<double> GCOMD2Response::m_emaxs
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().

double GCOMD2Response::m_emin
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().

std::vector<double> GCOMD2Response::m_emins
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().

GNodeArray GCOMD2Response::m_energies
private
double GCOMD2Response::m_energy
mutableprivate

Incident total energy (MeV)

Definition at line 143 of file GCOMD2Response.hpp.

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

double GCOMD2Response::m_escape1
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().

double GCOMD2Response::m_escape2
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().

std::vector<double> GCOMD2Response::m_escapes1
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().

std::vector<double> GCOMD2Response::m_escapes2
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().

double GCOMD2Response::m_ewidth
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().

std::vector<double> GCOMD2Response::m_ewidths
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().

double GCOMD2Response::m_pos_escape1
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().

double GCOMD2Response::m_pos_escape2
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().

double GCOMD2Response::m_position
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().

std::vector<double> GCOMD2Response::m_positions
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().

GNodeArray GCOMD2Response::m_rsp_energies
mutableprivate

Response vector energies.

Definition at line 163 of file GCOMD2Response.hpp.

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

double GCOMD2Response::m_rsp_etrue
mutableprivate

True energy of response vector.

Definition at line 162 of file GCOMD2Response.hpp.

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

std::vector<double> GCOMD2Response::m_rsp_values
mutableprivate

Response vector values.

Definition at line 164 of file GCOMD2Response.hpp.

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

double GCOMD2Response::m_sigma
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().

std::vector<double> GCOMD2Response::m_sigmas
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().

double GCOMD2Response::m_tail
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().

std::vector<double> GCOMD2Response::m_tails
private

Amplitude of Compton tail.

Definition at line 136 of file GCOMD2Response.hpp.

Referenced by copy_members(), init_members(), read(), update_cache(), and write().

double GCOMD2Response::m_wgt_escape1
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().

double GCOMD2Response::m_wgt_escape2
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().

double GCOMD2Response::m_wgt_photo
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().


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