GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMD1Response Class Reference

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

#include <GCOMD1Response.hpp>

Inheritance diagram for GCOMD1Response:
GBase

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...
 
GCOMD1Responseoperator= (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...
 
GCOMD1Responseclone (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 &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
 

Detailed Description

Interface for the COMPTEL D1 module response class.

Definition at line 48 of file GCOMD1Response.hpp.

Constructor & Destructor Documentation

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.

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

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

Member Function Documentation

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

Return photo peak amplitude.

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

Definition at line 182 of file GCOMD1Response.hpp.

References m_amplitude, and update_cache().

void GCOMD1Response::caldb ( const GCaldb caldb)
inline

Set calibration database.

Parameters
[in]caldbCalibration database.

Sets the calibration database containing the COMPTEL D1 module response.

Definition at line 140 of file GCOMD1Response.hpp.

References caldb(), and m_caldb.

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

Return calibration database.

Returns
Calibration database.

Definition at line 126 of file GCOMD1Response.hpp.

References m_caldb.

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

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

Return class name.

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

Implements GBase.

Definition at line 114 of file GCOMD1Response.hpp.

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

GCOMD1Response * GCOMD1Response::clone ( void  ) const
virtual

Clone instance.

Returns
Pointer to deep copy of COMPTEL D1 module response.

Implements GBase.

Definition at line 282 of file GCOMD1Response.cpp.

References GCOMD1Response().

void GCOMD1Response::copy_members ( const GCOMD1Response rsp)
private

Copy class members.

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

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

Return maximum energy.

Parameters
[in]etrueTrue energy (MeV).
Returns
Maximum 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().

double GCOMD1Response::emax ( void  ) const
inline

Return maximum D1 input energy (MeV)

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

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

Return minimum energy.

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

Definition at line 196 of file GCOMD1Response.hpp.

References m_emin, and update_cache().

Referenced by GCOMIaq::compute_iaq_bin().

double GCOMD1Response::emin ( void  ) const
inline

Return minimum D1 input energy (MeV)

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

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

Return energy threshold width.

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

Definition at line 210 of file GCOMD1Response.hpp.

References m_ewidth, and update_cache().

Referenced by GCOMIaq::compute_iaq_bin().

void GCOMD1Response::free_members ( void  )
private

Delete class members.

Definition at line 556 of file GCOMD1Response.cpp.

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

void GCOMD1Response::init_members ( void  )
private
void GCOMD1Response::load ( const std::string &  sdaname)

Load COMPTEL D1 module response.

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

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

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.

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

Definition at line 142 of file GCOMD1Response.cpp.

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

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

Return photo peak position.

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

Definition at line 154 of file GCOMD1Response.hpp.

References m_position, and update_cache().

Referenced by GCOMIaq::compute_iaq_bin().

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

Print COMPTEL D1 module response information.

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

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.

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

double GCOMD1Response::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 168 of file GCOMD1Response.hpp.

References m_sigma, and update_cache().

Referenced by GCOMIaq::compute_iaq_bin().

void GCOMD1Response::update_cache ( const double &  etrue) const
private

Update computation cache.

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

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

Member Data Documentation

double GCOMD1Response::m_amplitude
mutableprivate

Definition at line 101 of file GCOMD1Response.hpp.

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

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

Photo peak amplitude.

Definition at line 92 of file GCOMD1Response.hpp.

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

GCaldb GCOMD1Response::m_caldb
private

Calibration database.

Definition at line 88 of file GCOMD1Response.hpp.

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

double GCOMD1Response::m_emax
mutableprivate

Definition at line 104 of file GCOMD1Response.hpp.

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

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

double GCOMD1Response::m_emin
mutableprivate

Definition at line 102 of file GCOMD1Response.hpp.

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

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

GNodeArray GCOMD1Response::m_energies
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().

double GCOMD1Response::m_energy
mutableprivate

Definition at line 98 of file GCOMD1Response.hpp.

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

double GCOMD1Response::m_ewidth
mutableprivate

Definition at line 103 of file GCOMD1Response.hpp.

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

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

double GCOMD1Response::m_position
mutableprivate

Definition at line 99 of file GCOMD1Response.hpp.

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

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

double GCOMD1Response::m_sigma
mutableprivate

Definition at line 100 of file GCOMD1Response.hpp.

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

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


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