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

Interface for the COMPTEL instrument response function. More...

#include <GCOMResponse.hpp>

Inheritance diagram for GCOMResponse:
GResponse GBase

Public Member Functions

 GCOMResponse (void)
 Void constructor. More...
 
 GCOMResponse (const GCOMResponse &rsp)
 Copy constructor. More...
 
 GCOMResponse (const GCaldb &caldb, const std::string &rspname)
 Response constructor. More...
 
virtual ~GCOMResponse (void)
 Destructor. More...
 
virtual GCOMResponseoperator= (const GCOMResponse &rsp)
 Assignment operator. More...
 
virtual void clear (void)
 Clear instance. More...
 
virtual GCOMResponseclone (void) const
 Clone instance. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual bool use_edisp (void) const
 Signal if energy dispersion will be used. More...
 
virtual bool use_tdisp (void) const
 Signal if time dispersion will be used. More...
 
virtual double irf (const GEvent &event, const GPhoton &photon, const GObservation &obs) const
 Return value of instrument response function. More...
 
virtual double irf (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response. More...
 
virtual double nroi (const GModelSky &model, const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const
 Return integral of event probability for a given sky model over ROI. More...
 
virtual GEbounds ebounds (const GEnergy &obsEnergy) const
 Return true energy boundaries for a specific observed energy. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print COMPTEL response information. More...
 
void caldb (const GCaldb &caldb)
 Set calibration database. More...
 
const GCaldbcaldb (void) const
 Return calibration database. More...
 
const std::string & rspname (void) const
 Return response name. More...
 
void load (const std::string &rspname)
 Load COMPTEL response. More...
 
void read (const GFitsImage &hdu)
 Read COMPTEL response from FITS image. More...
 
void write (GFitsImageFloat &image) const
 Write COMPTEL response into FITS image. More...
 
- Public Member Functions inherited from GResponse
 GResponse (void)
 Void constructor. More...
 
 GResponse (const GResponse &rsp)
 Copy constructor. More...
 
virtual ~GResponse (void)
 Destructor. More...
 
virtual GResponseoperator= (const GResponse &rsp)
 Assignment operator. More...
 
virtual double convolve (const GModelSky &model, const GEvent &event, const GObservation &obs, const bool &grad=true) const
 Convolve sky model with the instrument response. 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 GCOMResponse &rsp)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Private Attributes

GCaldb m_caldb
 Calibration database. More...
 
std::string m_rspname
 Response name. More...
 
std::vector< double > m_iaq
 IAQ array. More...
 
int m_phigeo_bins
 Number of Phigeo bins. More...
 
int m_phibar_bins
 Number of Phibar bins. More...
 
double m_phigeo_ref_value
 Phigeo reference value (deg) More...
 
double m_phigeo_ref_pixel
 Phigeo reference pixel (starting from 1) More...
 
double m_phigeo_bin_size
 Phigeo binsize (deg) More...
 
double m_phigeo_min
 Phigeo value of first bin (deg) More...
 
double m_phibar_ref_value
 Phigeo reference value (deg) More...
 
double m_phibar_ref_pixel
 Phigeo reference pixel (starting from 1) More...
 
double m_phibar_bin_size
 Phigeo binsize (deg) More...
 
double m_phibar_min
 Phigeo value of first bin (deg) More...
 

Friends

class GCOMDri
 

Additional Inherited Members

- Protected Member Functions inherited from GResponse
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GResponse &rsp)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
double eval_prob (const GModelSky &model, const GEvent &event, const GEnergy &srcEng, const GTime &srcTime, const GObservation &obs, const bool &grad) const
 Convolve sky model with the instrument response. More...
 

Detailed Description

Interface for the COMPTEL instrument response function.

Definition at line 53 of file GCOMResponse.hpp.

Constructor & Destructor Documentation

GCOMResponse::GCOMResponse ( void  )

Void constructor.

Creates an empty COMPTEL response.

Definition at line 79 of file GCOMResponse.cpp.

References init_members().

Referenced by clone().

GCOMResponse::GCOMResponse ( const GCOMResponse rsp)

Copy constructor.

Parameters
[in]rspCOM response.

Definition at line 94 of file GCOMResponse.cpp.

References copy_members(), and init_members().

GCOMResponse::GCOMResponse ( const GCaldb caldb,
const std::string &  iaqname 
)

Response constructor.

Parameters
[in]caldbCalibration database.
[in]iaqnameIAQ file name.

Create COMPTEL response by loading an IAQ file from a calibration database.

Definition at line 116 of file GCOMResponse.cpp.

References caldb(), init_members(), and load().

GCOMResponse::~GCOMResponse ( void  )
virtual

Destructor.

Destroys instance of COMPTEL response object.

Definition at line 138 of file GCOMResponse.cpp.

References free_members().

Member Function Documentation

void GCOMResponse::caldb ( const GCaldb caldb)
inline

Set calibration database.

Parameters
[in]caldbCalibration database.

Sets the calibration database for the COMPTEL response.

Definition at line 174 of file GCOMResponse.hpp.

References caldb(), and m_caldb.

Referenced by GCOMObservation::response().

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

Return calibration database.

Returns
Calibration database.

Definition at line 160 of file GCOMResponse.hpp.

References m_caldb.

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

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

Return class name.

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

Implements GResponse.

Definition at line 124 of file GCOMResponse.hpp.

void GCOMResponse::clear ( void  )
virtual

Clear instance.

Clears COMPTEL response object by resetting all members to an initial state. Any information that was present in the object before will be lost.

Implements GResponse.

Definition at line 201 of file GCOMResponse.cpp.

References free_members(), GResponse::free_members(), init_members(), and GResponse::init_members().

Referenced by GCOMObservation::init_members(), load(), and GCOMObservation::response().

GCOMResponse * GCOMResponse::clone ( void  ) const
virtual

Clone instance.

Returns
Pointer to deep copy of COMPTEL response.

Implements GResponse.

Definition at line 221 of file GCOMResponse.cpp.

References GCOMResponse().

void GCOMResponse::copy_members ( const GCOMResponse rsp)
private

Copy class members.

Parameters
[in]rspCOMPTEL response.

Definition at line 798 of file GCOMResponse.cpp.

References m_caldb, m_iaq, m_phibar_bin_size, m_phibar_bins, m_phibar_min, m_phibar_ref_pixel, m_phibar_ref_value, m_phigeo_bin_size, m_phigeo_bins, m_phigeo_min, m_phigeo_ref_pixel, m_phigeo_ref_value, and m_rspname.

Referenced by GCOMResponse(), and operator=().

GEbounds GCOMResponse::ebounds ( const GEnergy obsEnergy) const
virtual

Return true energy boundaries for a specific observed energy.

Parameters
[in]obsEnergyObserved Energy.
Returns
True energy boundaries for given observed energy.
Exceptions
GException::feature_not_implementedMethod is not implemented.

Implements GResponse.

Definition at line 503 of file GCOMResponse.cpp.

References G_EBOUNDS.

void GCOMResponse::free_members ( void  )
private

Delete class members.

Definition at line 823 of file GCOMResponse.cpp.

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

void GCOMResponse::init_members ( void  )
private
double GCOMResponse::irf ( const GEvent event,
const GPhoton photon,
const GObservation obs 
) const
virtual

Return value of instrument response function.

Parameters
[in]eventObserved event.
[in]photonIncident photon.
[in]obsObservation.
Returns
Instrument response function (cm^2 sr^-1)
Exceptions
GException::invalid_argumentObservation is not a COMPTEL observation. Event is not a COMPTEL event bin.

Returns the instrument response function for a given observed photon direction as function of the assumed true photon direction. The result is given by

\[IRF = \frac{IAQ \times DRG \times DRX}{ontime \times ewidth}\]

where \(IRF\) is the instrument response function, \(IAQ\) is the COMPTEL response matrix (sr-1), \(DRG\) is the geometry factor (cm2), \(DRX\) is the exposure (s), \(ontime\) is the ontime (s), and \(ewidth\) is the energy width (MeV).

The observed photon direction is spanned by the 3 values (Chi,Psi,Phibar). (Chi,Psi) is the scatter direction of the event, given in sky coordinates. Phibar is the Compton scatter angle, computed from the energy deposits.

Implements GResponse.

Definition at line 255 of file GCOMResponse.cpp.

References GObservation::deadc(), GCOMInstDir::dir(), GCOMEventBin::dir(), GPhoton::dir(), GSkyDir::dist_deg(), GCOMObservation::drg(), GCOMObservation::drx(), G_IRF, gammalib::is_infinite(), gammalib::is_notanumber(), m_iaq, m_phibar_bin_size, m_phibar_bins, m_phigeo_bin_size, m_phigeo_bins, GCOMObservation::ontime(), GCOMInstDir::phibar(), and GPhoton::time().

Referenced by irf().

double GCOMResponse::irf ( const GEvent event,
const GSource source,
const GObservation obs 
) const
virtual

Return instrument response.

Parameters
[in]eventEvent.
[in]sourceSource.
[in]obsObservation.
Returns
Instrument response.
Exceptions
GException::invalid_argumentInvalid observation or event type specified.
GException::feature_not_implementedComputation for specified spatial model not implemented.

Returns the instrument response for a given event, source and observation. If all spatial model parameters are fixed a DRM cube stored in the COMPTEL observation is used. The computation of this cube is handled by the GCOMObservation::drm() method that also will update the cube in case that any of the parameters changes.

Implements GResponse.

Definition at line 385 of file GCOMResponse.cpp.

References GModelSpatial::code(), GModelSpatialPointSource::dir(), GCOMObservation::drm(), GSource::energy(), G_IRF, GMODEL_SPATIAL_DIFFUSE, GMODEL_SPATIAL_ELLIPTICAL, GMODEL_SPATIAL_POINT_SOURCE, GMODEL_SPATIAL_RADIAL, GCOMEventBin::index(), irf(), GEvent::is_bin(), GSource::model(), GModelSpatial::size(), GSource::time(), and GModelSpatial::type().

void GCOMResponse::load ( const std::string &  rspname)

Load COMPTEL response.

Parameters
[in]rspnameCOMPTEL response name.

Loads the COMPTEL response with specified name rspname.

The method first attempts to interpret rspname as a file name and to load the corresponding response.

If rspname is not a FITS file the method searches for an appropriate response in the calibration database. If no appropriate response is found, the method takes the CALDB root path and response name to build the full path to the response file, and tries to load the response from these paths.

If also this fails an exception is thrown.

Definition at line 535 of file GCOMResponse.cpp.

References caldb(), clear(), GFits::close(), GFilename::exists(), GCaldb::filename(), gammalib::filepath(), GFits::image(), GFilename::is_empty(), GFilename::is_fits(), m_caldb, m_rspname, read(), GCaldb::rootdir(), and rspname().

Referenced by GCOMResponse(), and GCOMObservation::response().

double GCOMResponse::nroi ( const GModelSky model,
const GEnergy obsEng,
const GTime obsTime,
const GObservation obs 
) const
virtual

Return integral of event probability for a given sky model over ROI.

Parameters
[in]modelSky model.
[in]obsEngObserved photon energy.
[in]obsTimeObserved photon arrival time.
[in]obsObservation.
Returns
0.0
Exceptions
GException::feature_not_implementedMethod is not implemented.

Implements GResponse.

Definition at line 479 of file GCOMResponse.cpp.

References G_NROI.

GCOMResponse & GCOMResponse::operator= ( const GCOMResponse rsp)
virtual

Assignment operator.

Parameters
[in]rspCOMPTEL response.
Returns
COMPTEL response.

Assigns COMPTEL response object to another COMPTEL response object. The assignment performs a deep copy of all information, hence the original object from which the assignment has been performed can be destroyed after this operation without any loss of information.

Definition at line 165 of file GCOMResponse.cpp.

References copy_members(), free_members(), init_members(), and GResponse::operator=().

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

Print COMPTEL response information.

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

Implements GResponse.

Definition at line 709 of file GCOMResponse.cpp.

References EXPLICIT, m_caldb, m_phibar_bin_size, m_phibar_bins, m_phibar_min, m_phibar_ref_pixel, m_phibar_ref_value, m_phigeo_bin_size, m_phigeo_bins, m_phigeo_min, m_phigeo_ref_pixel, m_phigeo_ref_value, m_rspname, gammalib::parformat(), GCaldb::print(), SILENT, gammalib::str(), and VERBOSE.

void GCOMResponse::read ( const GFitsImage image)

Read COMPTEL response from FITS image.

Parameters
[in]imageFITS image.

Read the COMPTEL response from IAQ FITS file and convert the IAQ values into a probability per steradian.

Definition at line 594 of file GCOMResponse.cpp.

References gammalib::deg2rad, gammalib::fourpi, m_iaq, m_phibar_bin_size, m_phibar_bins, m_phibar_min, m_phibar_ref_pixel, m_phibar_ref_value, m_phigeo_bin_size, m_phigeo_bins, m_phigeo_min, m_phigeo_ref_pixel, m_phigeo_ref_value, GFitsImage::naxes(), GFitsImage::naxis(), GFitsImage::pixel(), GFitsHDU::real(), and sin().

Referenced by load().

const std::string & GCOMResponse::rspname ( void  ) const
inline

Return response name.

Returns
Response name.

Definition at line 187 of file GCOMResponse.hpp.

References m_rspname.

Referenced by load(), and GCOMObservation::write().

bool GCOMResponse::use_edisp ( void  ) const
inlinevirtual

Signal if energy dispersion will be used.

Returns
False.

Implements GResponse.

Definition at line 136 of file GCOMResponse.hpp.

bool GCOMResponse::use_tdisp ( void  ) const
inlinevirtual

Signal if time dispersion will be used.

Returns
False.

Implements GResponse.

Definition at line 148 of file GCOMResponse.hpp.

void GCOMResponse::write ( GFitsImageFloat image) const

Write COMPTEL response into FITS image.

Parameters
[in]imageFITS image.

Writes the COMPTEL response into an IAQ FITS file.

Definition at line 655 of file GCOMResponse.cpp.

References GFitsHDU::card(), gammalib::deg2rad, gammalib::fourpi, m_iaq, m_phibar_bin_size, m_phibar_bins, m_phibar_ref_pixel, m_phibar_ref_value, m_phigeo_bin_size, m_phigeo_bins, m_phigeo_min, m_phigeo_ref_pixel, m_phigeo_ref_value, and sin().

Friends And Related Function Documentation

friend class GCOMDri
friend

Definition at line 56 of file GCOMResponse.hpp.

Member Data Documentation

GCaldb GCOMResponse::m_caldb
private

Calibration database.

Definition at line 102 of file GCOMResponse.hpp.

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

std::vector<double> GCOMResponse::m_iaq
private

IAQ array.

Definition at line 104 of file GCOMResponse.hpp.

Referenced by GCOMDri::compute_drm_ptsrc(), copy_members(), init_members(), irf(), read(), and write().

double GCOMResponse::m_phibar_bin_size
private

Phigeo binsize (deg)

Definition at line 113 of file GCOMResponse.hpp.

Referenced by copy_members(), init_members(), irf(), print(), read(), and write().

int GCOMResponse::m_phibar_bins
private

Number of Phibar bins.

Definition at line 106 of file GCOMResponse.hpp.

Referenced by copy_members(), init_members(), irf(), print(), read(), and write().

double GCOMResponse::m_phibar_min
private

Phigeo value of first bin (deg)

Definition at line 114 of file GCOMResponse.hpp.

Referenced by copy_members(), init_members(), print(), and read().

double GCOMResponse::m_phibar_ref_pixel
private

Phigeo reference pixel (starting from 1)

Definition at line 112 of file GCOMResponse.hpp.

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

double GCOMResponse::m_phibar_ref_value
private

Phigeo reference value (deg)

Definition at line 111 of file GCOMResponse.hpp.

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

double GCOMResponse::m_phigeo_bin_size
private

Phigeo binsize (deg)

Definition at line 109 of file GCOMResponse.hpp.

Referenced by GCOMDri::compute_drm_ptsrc(), copy_members(), init_members(), irf(), print(), read(), and write().

int GCOMResponse::m_phigeo_bins
private

Number of Phigeo bins.

Definition at line 105 of file GCOMResponse.hpp.

Referenced by GCOMDri::compute_drm_ptsrc(), copy_members(), init_members(), irf(), print(), read(), and write().

double GCOMResponse::m_phigeo_min
private

Phigeo value of first bin (deg)

Definition at line 110 of file GCOMResponse.hpp.

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

double GCOMResponse::m_phigeo_ref_pixel
private

Phigeo reference pixel (starting from 1)

Definition at line 108 of file GCOMResponse.hpp.

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

double GCOMResponse::m_phigeo_ref_value
private

Phigeo reference value (deg)

Definition at line 107 of file GCOMResponse.hpp.

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

std::string GCOMResponse::m_rspname
private

Response name.

Definition at line 103 of file GCOMResponse.hpp.

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


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