GammaLib 2.1.0.dev
Loading...
Searching...
No Matches
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.
 
 GCOMResponse (const GCOMResponse &rsp)
 Copy constructor.
 
 GCOMResponse (const GCaldb &caldb, const std::string &rspname)
 Response constructor.
 
virtual ~GCOMResponse (void)
 Destructor.
 
virtual GCOMResponseoperator= (const GCOMResponse &rsp)
 Assignment operator.
 
virtual void clear (void)
 Clear instance.
 
virtual GCOMResponseclone (void) const
 Clone instance.
 
virtual std::string classname (void) const
 Return class name.
 
virtual bool use_edisp (void) const
 Signal if energy dispersion will be used.
 
virtual bool use_tdisp (void) const
 Signal if time dispersion will be used.
 
virtual double irf (const GEvent &event, const GPhoton &photon, const GObservation &obs) const
 Return value of instrument response function.
 
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.
 
virtual GEbounds ebounds (const GEnergy &obsEnergy) const
 Return true energy boundaries for a specific observed energy.
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print COMPTEL response information.
 
void caldb (const GCaldb &caldb)
 Set calibration database.
 
const GCaldbcaldb (void) const
 Return calibration database.
 
const std::string & rspname (void) const
 Return response name.
 
void load (const std::string &rspname)
 Load COMPTEL response.
 
void read (const GFitsImage &hdu)
 Read COMPTEL response from FITS image.
 
void write (GFitsImageFloat &image) const
 Write COMPTEL response into FITS image.
 
void load_cache (const GFilename &filename)
 Load response cache.
 
void save_cache (const GFilename &filename) const
 Save response cache.
 
void backproject (const GObservation &obs, const GEvents *events, GSkyMap *map) const
 Backproject events using instrument response function to sky map.
 
- Public Member Functions inherited from GResponse
 GResponse (void)
 Void constructor.
 
 GResponse (const GResponse &rsp)
 Copy constructor.
 
virtual ~GResponse (void)
 Destructor.
 
virtual GResponseoperator= (const GResponse &rsp)
 Assignment operator.
 
virtual double convolve (const GModelSky &model, const GEvent &event, const GObservation &obs, const bool &grad=true) const
 Convolve sky model with the instrument response.
 
virtual GVector convolve (const GModelSky &model, const GObservation &obs, GMatrixSparse *gradients=NULL) const
 Convolve sky model with the instrument response.
 
virtual double irf_spatial (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response integrated over the spatial model.
 
virtual GVector irf_spatial (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
 Return instrument response vector integrated over the spatial model.
 
virtual void remove_response_cache (const std::string &cache_id)
 Remove response cache for specific observation and model.
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor.
 

Private Member Functions

void init_members (void)
 Initialise class members.
 
void copy_members (const GCOMResponse &rsp)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
void compute_faq (void)
 Compute FAQ.
 
virtual GVector irf_ptsrc (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
 Return instrument response to point source.
 
virtual GVector irf_radial (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
 Return instrument response to radial source.
 
virtual GVector irf_elliptical (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
 Return instrument response to elliptical source.
 
virtual GVector irf_diffuse (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
 Return instrument response to diffuse source.
 

Private Attributes

GCaldb m_caldb
 Calibration database.
 
std::string m_rspname
 Response name.
 
std::vector< double > m_iaq
 IAQ array.
 
GSkyMap m_faq
 FAQ array.
 
std::vector< bool > m_faq_zero
 Array of zero FAQ bins.
 
std::vector< GVectorm_faq_native
 Array of native FAQ vectors.
 
GVector m_faq_solidangle
 Array of FAQ solid angles.
 
int m_phigeo_bins
 Number of Phigeo bins.
 
int m_phibar_bins
 Number of Phibar bins.
 
int m_faq_bins
 Number of FAQ bins.
 
double m_phigeo_ref_value
 Phigeo reference value (deg)
 
double m_phigeo_ref_pixel
 Phigeo reference pixel (starting from 1)
 
double m_phigeo_bin_size
 Phigeo binsize (deg)
 
double m_phigeo_min
 Phigeo value of first bin (deg)
 
double m_phibar_ref_value
 Phigeo reference value (deg)
 
double m_phibar_ref_pixel
 Phigeo reference pixel (starting from 1)
 
double m_phibar_bin_size
 Phigeo binsize (deg)
 
double m_phibar_min
 Phigeo value of first bin (deg)
 

Friends

class GCOMDri
 

Additional Inherited Members

- Protected Member Functions inherited from GResponse
void init_members (void)
 Initialise class members.
 
void copy_members (const GResponse &rsp)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
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.
 
GVector eval_probs (const GModelSky &model, const GObservation &obs, GMatrixSparse *gradients=NULL) const
 Convolve sky model with the instrument response.
 
int size_edisp_vector (const GModelSky &model, const GObservation &obs, const bool &grad) const
 Return size of vector for energy dispersion computation.
 
GEbounds ebounds_model (const GModelSky &model) const
 Return true energy intervals for sky model.
 
virtual double irf_ptsrc (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response to point source.
 
virtual double irf_radial (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response to radial source.
 
virtual double irf_elliptical (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response to elliptical source.
 
virtual double irf_diffuse (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response to diffuse source.
 
virtual double irf_composite (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response to composite source.
 
virtual GVector irf_composite (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
 Return instrument response to composite source sky model.
 
- Protected Attributes inherited from GResponse
bool m_use_irf_cache
 Control usage of irf cache.
 
bool m_use_nroi_cache
 Control usage of nroi cache.
 
int m_irf_radial_iter_theta
 Radial model integration theta iterations.
 
int m_irf_radial_iter_phi
 Radial model integration phi iterations.
 
int m_irf_elliptical_iter_theta
 Elliptical model integration theta iterations.
 
int m_irf_elliptical_iter_phi
 Elliptical model integration phi iterations.
 
double m_irf_diffuse_resolution
 Angular resolution for diffuse model.
 
GResponseCache m_irf_cache
 
GResponseCache m_nroi_cache
 
GResponseVectorCache m_irf_vector_cache
 

Detailed Description

Interface for the COMPTEL instrument response function.

Definition at line 59 of file GCOMResponse.hpp.

Constructor & Destructor Documentation

◆ GCOMResponse() [1/3]

GCOMResponse::GCOMResponse ( void )

Void constructor.

Creates an empty COMPTEL response.

Definition at line 105 of file GCOMResponse.cpp.

References init_members().

Referenced by clone().

◆ GCOMResponse() [2/3]

GCOMResponse::GCOMResponse ( const GCOMResponse & rsp)

Copy constructor.

Parameters
[in]rspCOM response.

Definition at line 120 of file GCOMResponse.cpp.

References copy_members(), and init_members().

◆ GCOMResponse() [3/3]

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 142 of file GCOMResponse.cpp.

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

◆ ~GCOMResponse()

GCOMResponse::~GCOMResponse ( void )
virtual

Destructor.

Destroys instance of COMPTEL response object.

Definition at line 164 of file GCOMResponse.cpp.

References free_members().

Member Function Documentation

◆ backproject()

void GCOMResponse::backproject ( const GObservation & obs,
const GEvents * events,
GSkyMap * map ) const

Backproject events using instrument response function to sky map.

Parameters
[in]obsObservation.
[in]eventsEvents.
[in,out]mapSky map.
Exceptions
GException::invalid_argumentEvents pointer invalid. Sky map pointer invalid. Observation is not a COMPTEL observation. Events are not a COMPTEL event cube.
GException::invalid_valueResponse not initialised with a valid IAQ Incompatible IAQ encountered

Backprojects events using the instrument response function to sky map using

\[ f_j = \sum_i n_i R_{ij} \]

where

  • \(f_j\) is the sky map pixel \(j\),
  • \(n_i\) is the event bin \(i\), and
  • \(R_{ij}\) is the response function for event bin \(i\) and sky map pixel \(j\).

If the sky map contains at least two maps, the second map will contain on output the normalisation map

\[ f_j = \sum_i R_{ij} \]

Definition at line 770 of file GCOMResponse.cpp.

References GSkyMap::contains(), GCOMObservation::deadc(), gammalib::deg2rad, GSkyDir::dist_deg(), GCOMEventCube::dre(), GCOMObservation::drg(), GCOMObservation::drx(), G_BACKPROJECT, GSkyMap::inx2dir(), irf(), m_iaq, m_phibar_bins, m_phigeo_bin_size, m_phigeo_bins, m_phigeo_min, GCOMDri::map(), GCOMDri::nchi(), GSkyMap::nmaps(), norm(), GCOMDri::nphibar(), GSkyMap::npix(), GCOMDri::npsi(), GCOMObservation::ontime(), GCOMDri::phase_correction(), GSkyMap::pixels(), GCOMDri::size(), gammalib::str(), and GCOMDri::tof_correction().

◆ caldb() [1/2]

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 202 of file GCOMResponse.hpp.

References caldb(), and m_caldb.

Referenced by GCOMObservation::response().

◆ caldb() [2/2]

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

Return calibration database.

Returns
Calibration database.

Definition at line 188 of file GCOMResponse.hpp.

References m_caldb.

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

◆ classname()

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

Return class name.

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

Implements GResponse.

Definition at line 152 of file GCOMResponse.hpp.

◆ clear()

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 227 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().

◆ clone()

GCOMResponse * GCOMResponse::clone ( void ) const
virtual

Clone instance.

Returns
Pointer to deep copy of COMPTEL response.

Implements GResponse.

Definition at line 247 of file GCOMResponse.cpp.

References GCOMResponse().

◆ compute_faq()

void GCOMResponse::compute_faq ( void )
private

Compute FAQ.

Computes FAQ from IAQ that is needed for direction projection computation

Definition at line 1107 of file GCOMResponse.cpp.

References GSkyMap::clear(), GVector::clear(), gammalib::deg2rad, m_faq, m_faq_bins, m_faq_native, m_faq_solidangle, m_faq_zero, m_iaq, m_phibar_bins, m_phigeo_bin_size, m_phigeo_bins, GSkyMap::npix(), GSkyMap::save(), and GSkyMap::solidangle().

Referenced by read().

◆ copy_members()

void GCOMResponse::copy_members ( const GCOMResponse & rsp)
private

◆ ebounds()

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 469 of file GCOMResponse.cpp.

References ebounds(), and G_EBOUNDS.

Referenced by ebounds().

◆ free_members()

void GCOMResponse::free_members ( void )
private

Delete class members.

Definition at line 1095 of file GCOMResponse.cpp.

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

◆ init_members()

◆ irf()

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.
GException::invalid_valueResponse not initialised with a valid IAQ

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

\[ {\tt IRF} = \frac{{\tt IAQ} \times {\tt DRG} \times {\tt DRX}} {T \times {\tt TOFCOR}} \times {\tt PHASECOR} \]

where

  • \({\tt IRF}\) is the instrument response function ( \(cm^2 sr^{-1}\)),
  • \({\tt IAQ}\) is the COMPTEL response matrix ( \(sr^{-1}\)),
  • \({\tt DRG}\) is the geometry factor (probability),
  • \({\tt DRX}\) is the exposure ( \(cm^2 s\)),
  • \(T\) is the ontime ( \(s\)), and
  • \({\tt TOFCOR}\) is a correction that accounts for the Time of Flight selection window.
  • \({\tt PHASECOR}\) is a correction that accounts for pulsar phase selection.

The observed photon direction is spanned by the three values \(\Chi\), \(\Psi\), and \(\bar{\varphi})\). \(\Chi\) and \(\Psi\) is the scatter direction of the event, given in sky coordinates. \(\bar{\varphi}\) is the Compton scatter angle, computed from the energy deposits in the two detector planes.

Implements GResponse.

Definition at line 293 of file GCOMResponse.cpp.

References GObservation::deadc(), GCOMEventBin::dir(), GCOMInstDir::dir(), GPhoton::dir(), GSkyDir::dist_deg(), GCOMEventCube::dre(), GCOMObservation::drg(), GCOMObservation::drx(), GObservation::events(), G_IRF, irf(), gammalib::is_infinite(), gammalib::is_notanumber(), m_iaq, m_phibar_bin_size, m_phibar_bins, m_phigeo_bin_size, m_phigeo_bins, GCOMDri::map(), GCOMObservation::ontime(), GCOMDri::phase_correction(), GCOMInstDir::phibar(), GPhoton::time(), and GCOMDri::tof_correction().

Referenced by backproject(), irf(), irf_diffuse(), irf_elliptical(), irf_ptsrc(), and irf_radial().

◆ irf_diffuse()

GVector GCOMResponse::irf_diffuse ( const GModelSky & model,
const GObservation & obs,
GMatrix * gradients = NULL ) const
privatevirtual

Return instrument response to diffuse source.

Parameters
[in]modelSky model.
[in]obsObservation.
[out]gradientsGradients matrix.
Returns
Instrument response to diffuse source for all events in observation ( \(cm^2\)).
Exceptions
GException::invalid_valueResponse not initialised with a valid IAQ Incompatible IAQ encountered

Returns the instrument response to a diffuse source sky model for all events. The methods works on response vectors that are computed per pointing. The method assumes that the spatial model component is of type GModelSpatialDiffuse, that the observations is of type GCOMObservation and that the events are of type GCOMEventCube. No checking of these assumptions is performed by the method, and not respecting the assumptions will results in a segfault.

The computation is done using a direct convolution in the system of the instrument response function, sampling fully the resolution of the data space.

For details about the choice of the convolution method and its parameters see https://gitlab.in2p3.fr/gammalib/gammalib/-/issues/14.

gradients is an optional matrix where the number of rows corresponds to the number of events in the observation and the number of columns corresponds to the number of spatial model parameters. Since for diffuse sources no gradients are computed, the method does not alter the content of gradients.

Reimplemented from GResponse.

Definition at line 2144 of file GCOMResponse.cpp.

References GSkyMap::contains(), GCOMObservation::deadc(), GSkyDir::dec_deg(), gammalib::deg2rad, GCOMEventBin::dir(), GCOMInstDir::dir(), GCOMEventCube::dre(), GCOMObservation::drg(), GCOMObservation::drx(), GCOMEventBin::energy(), GMatrix::eulery(), GMatrix::eulerz(), GModelSpatial::eval(), GModelSpatialDiffuse::eval(), GObservation::events(), G_IRF_DIFFUSE, gammalib::get_current_clock(), irf(), GSkyMap::is_empty(), m_faq, m_faq_bins, m_faq_native, m_faq_solidangle, m_faq_zero, m_iaq, m_phibar_bins, m_phigeo_bin_size, m_phigeo_bins, m_phigeo_min, GCOMDri::map(), GCOMEventCube::naxis(), GCOMObservation::ontime(), GCOMDri::phase_correction(), GSkyMap::pixels(), GSkyDir::ra_deg(), GSkyDir::rotate(), GCOMEventCube::size(), GModelSky::spatial(), gammalib::str(), GCOMEventBin::time(), GCOMDri::tof_correction(), and gammalib::twopi.

◆ irf_elliptical()

GVector GCOMResponse::irf_elliptical ( const GModelSky & model,
const GObservation & obs,
GMatrix * gradients = NULL ) const
privatevirtual

Return instrument response to elliptical source.

Parameters
[in]modelSky model.
[in]obsObservation.
[out]gradientsGradients matrix.
Returns
Instrument response to elliptical source for all events in observation ( \(cm^2\)).
Exceptions
GException::invalid_valueResponse not initialised with a valid IAQ Incompatible IAQ encountered

Returns the instrument response to an elliptical source sky model for all events. The methods works on response vectors that are computed per pointing. The method assumes that the spatial model component is of type GModelSpatialElliptical, that the observations is of type GCOMObservation and that the events are of type GCOMEventCube. No checking of these assumptions is performed by the method, and not respecting the assumptions will results in a segfault.

The method toggles between two convolution methods that are used depending on the extent of the elliptical source. Extent means here the larger of the minor and major "radius" parameters, which is the radius for a disk or the sigma parameter for a Gaussian.

For extents smaller than 10 degrees a numerical integration is performed in a radial system around the elliptical model that is fast but that may become inaccurate for larger extents as the model sampling will exceed the resolution of the data space. The number of iterations in the zenith and azimuth angle was fixed to 6.

For extents larger than 15 degrees a direct convolution is performed in the system of the instrument response function, that is slower, but that samples fully the resolution of the data space. The direct convolution is however not accurate for angles smaller than about 1 degree, hence it is not appropriate to compute for the response for the determination of upper limits.

For intermediate extents (in the interval 10 - 15 degrees), both convolutions are computed and combined according to a weight that varies linearly with source extent. In principle the convolved results should be identical in that intermediate range, but computing both and their weighted combination assures that no steps occur when varying the source extent, which is required for seamless log-likelihood fits.

For details about the choice of the convolution method and its parameters see https://gitlab.in2p3.fr/gammalib/gammalib/-/issues/14.

gradients is an optional matrix where the number of rows corresponds to the number of events in the observation and the number of columns corresponds to the number of spatial model parameters. Since for elliptical sources no gradients are computed, the method does not alter the content of gradients.

< 6 iterations

< 6 iterations

< Integration for extent < 10 deg

< Direct for extent > 15 deg

Reimplemented from GResponse.

Definition at line 1819 of file GCOMResponse.cpp.

References GSkyMap::contains(), GModelSpatialElliptical::coordsys(), GCOMObservation::deadc(), GSkyDir::dec_deg(), gammalib::deg2rad, GCOMEventBin::dir(), GCOMInstDir::dir(), GModelSpatialElliptical::dir(), GSkyDir::dist(), GCOMEventCube::dre(), GCOMObservation::drg(), GCOMObservation::drx(), GCOMEventBin::energy(), GMatrix::eulery(), GMatrix::eulerz(), GModelSpatialElliptical::eval(), GObservation::events(), GIntegrals::fixed_iter(), G_IRF_ELLIPTICAL, gammalib::get_current_clock(), irf(), GSkyMap::is_empty(), m_faq, m_faq_bins, m_faq_native, m_faq_solidangle, m_faq_zero, m_iaq, m_phibar_bins, m_phigeo_bin_size, m_phigeo_bins, m_phigeo_min, GCOMDri::map(), GCOMEventCube::naxis(), norm(), GCOMObservation::ontime(), GCOMDri::phase_correction(), GSkyMap::pixels(), GSkyDir::posang(), GSkyDir::ra_deg(), GIntegrals::romberg(), GCOMEventCube::size(), GModelSky::spatial(), gammalib::str(), GModelSpatialElliptical::theta_max(), GCOMEventBin::time(), and GCOMDri::tof_correction().

◆ irf_ptsrc()

GVector GCOMResponse::irf_ptsrc ( const GModelSky & model,
const GObservation & obs,
GMatrix * gradients = NULL ) const
privatevirtual

Return instrument response to point source.

Parameters
[in]modelSky model.
[in]obsObservation.
[out]gradientsGradients matrix.
Returns
Instrument response to point source for all events in observation ( \(cm^2\)).
Exceptions
GException::invalid_argumentObservation is not a COMPTEL observation. Event is not a COMPTEL event bin.
GException::invalid_valueResponse not initialised with a valid IAQ Incompatible IAQ encountered

Returns the instrument response to a point source for all events in the observations.

gradients is an optional matrix where the number of rows corresponds to the number of events in the observation and the number of columns corresponds to the number of spatial model parameters. Since for point sources no gradients are computed, the method does not alter the content of gradients.

Reimplemented from GResponse.

Definition at line 1277 of file GCOMResponse.cpp.

References GCOMObservation::deadc(), GCOMEventBin::dir(), GCOMInstDir::dir(), GSkyDir::dist_deg(), GCOMEventCube::dre(), GCOMObservation::drg(), GCOMObservation::drx(), GObservation::events(), G_IRF_PTSRC, GObservation::id(), irf(), m_iaq, m_phibar_bins, m_phigeo_bin_size, m_phigeo_bins, GCOMDri::map(), GObservation::name(), GCOMEventCube::naxis(), GCOMObservation::ontime(), GCOMDri::phase_correction(), GSkyMap::pixels(), GCOMEventCube::size(), GModelSky::spatial(), gammalib::str(), and GCOMDri::tof_correction().

◆ irf_radial()

GVector GCOMResponse::irf_radial ( const GModelSky & model,
const GObservation & obs,
GMatrix * gradients = NULL ) const
privatevirtual

Return instrument response to radial source.

Parameters
[in]modelSky model.
[in]obsObservation.
[out]gradientsGradients matrix.
Returns
Instrument response to radial source for all events in observation ( \(cm^2\)).
Exceptions
GException::invalid_valueResponse not initialised Incompatible IAQ encountered

Returns the instrument response to a radial source sky model for all events. The methods works on response vectors that are computed per pointing. The method assumes that the spatial model component is of type GModelSpatialRadial, that the observations is of type GCOMObservation and that the events are of type GCOMEventCube. No checking of these assumptions is performed by the method, and not respecting the assumptions will results in a segfault.

The method toggles between two convolution methods that are used depending on the extent of the radial source. Extent means here the value of the radial parameter, which is the radius for a disk or the sigma parameter for a Gaussian.

For extents smaller than 10 degrees a numerical integration is performed in the system of the radial model that is fast but that may become inaccurate for larger extents as the model sampling will exceed the resolution of the data space. The number of iterations in the zenith and azimuth angle was fixed to 6.

For extents larger than 15 degrees a direct convolution is performed in the system of the instrument response function, that is slower, but that samples fully the resolution of the data space. The direct convolution is however not accurate for angles smaller than about 1 degree, hence it is not appropriate to compute for the response for the determination of upper limits.

For intermediate extents (in the interval 10 - 15 degrees), both convolutions are computed and combined according to a weight that varies linearly with source extent. In principle the convolved results should be identical in that intermediate range, but computing both and their weighted combination assures that no steps occur when varying the source extent, which is required for seamless log-likelihood fits.

For details about the choice of the convolution method and its parameters see https://gitlab.in2p3.fr/gammalib/gammalib/-/issues/14.

gradients is an optional matrix where the number of rows corresponds to the number of events in the observation and the number of columns corresponds to the number of spatial model parameters. Since for radial sources no gradients are computed, the method does not alter the content of gradients.

< 6 iterations

< 6 iterations

< Integration for extent < 10 deg

< Direct for extent > 15 deg

Reimplemented from GResponse.

Definition at line 1479 of file GCOMResponse.cpp.

References GSkyMap::contains(), GCOMObservation::deadc(), GSkyDir::dec_deg(), gammalib::deg2rad, GCOMEventBin::dir(), GCOMInstDir::dir(), GModelSpatialRadial::dir(), GSkyDir::dist(), GCOMEventCube::dre(), GCOMObservation::drg(), GCOMObservation::drx(), GCOMEventBin::energy(), GMatrix::eulery(), GMatrix::eulerz(), GModelSpatialRadial::eval(), GObservation::events(), GIntegrals::fixed_iter(), G_IRF_RADIAL, gammalib::get_current_clock(), irf(), GSkyMap::is_empty(), m_faq, m_faq_bins, m_faq_native, m_faq_solidangle, m_faq_zero, m_iaq, m_phibar_bins, m_phigeo_bin_size, m_phigeo_bins, m_phigeo_min, GCOMDri::map(), GCOMEventCube::naxis(), norm(), GCOMObservation::ontime(), GCOMDri::phase_correction(), GSkyMap::pixels(), GSkyDir::ra_deg(), GIntegrals::romberg(), GCOMEventCube::size(), GModelSky::spatial(), gammalib::str(), GModelSpatialRadial::theta_max(), GCOMEventBin::time(), and GCOMDri::tof_correction().

◆ load()

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 501 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().

◆ load_cache()

void GCOMResponse::load_cache ( const GFilename & filename)

Load response cache.

Parameters
[in]filenameResponse cache filename.

Loads response cache from FITS file.

Definition at line 707 of file GCOMResponse.cpp.

References GResponseVectorCache::load(), and GResponse::m_irf_vector_cache.

Referenced by GCOMObservation::read().

◆ nroi()

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 445 of file GCOMResponse.cpp.

References G_NROI.

◆ operator=()

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 191 of file GCOMResponse.cpp.

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

◆ print()

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

◆ read()

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.

The IAQ values are divided by the solid angle of a Phigeo bin which is given by

\begin{eqnarray*} \Omega & = & 2 \pi \left[ \left( 1 - \cos \left( \varphi_{\rm geo} + \frac{1}{2} \Delta \varphi_{\rm geo} \right) \right) - \left( 1 - \cos \left( \varphi_{\rm geo} - \frac{1}{2} \Delta \varphi_{\rm geo} \right) \right) \right] \\ &=& 2 \pi \left[ \cos \left( \varphi_{\rm geo} - \frac{1}{2} \Delta \varphi_{\rm geo} \right) - \cos \left( \varphi_{\rm geo} + \frac{1}{2} \Delta \varphi_{\rm geo} \right) \right] \\ &=& 4 \pi \sin \left( \varphi_{\rm geo} \right) \sin \left( \frac{1}{2} \Delta \varphi_{\rm geo} \right) \end{eqnarray*}

Definition at line 583 of file GCOMResponse.cpp.

References compute_faq(), 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(), and GFitsHDU::real().

Referenced by load().

◆ rspname()

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

Return response name.

Returns
Response name.

Definition at line 215 of file GCOMResponse.hpp.

References m_rspname.

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

◆ save_cache()

void GCOMResponse::save_cache ( const GFilename & filename) const

Save response cache.

Parameters
[in]filenameResponse cache filename.

Saves response cache from FITS file.

Definition at line 724 of file GCOMResponse.cpp.

References GResponse::m_irf_vector_cache, and GResponseVectorCache::save().

Referenced by GCOMObservation::write().

◆ use_edisp()

bool GCOMResponse::use_edisp ( void ) const
inlinevirtual

Signal if energy dispersion will be used.

Returns
False.

Implements GResponse.

Definition at line 164 of file GCOMResponse.hpp.

◆ use_tdisp()

bool GCOMResponse::use_tdisp ( void ) const
inlinevirtual

Signal if time dispersion will be used.

Returns
False.

Implements GResponse.

Definition at line 176 of file GCOMResponse.hpp.

◆ write()

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 652 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, and m_phigeo_ref_value.

Friends And Related Symbol Documentation

◆ GCOMDri

friend class GCOMDri
friend

Definition at line 62 of file GCOMResponse.hpp.

Member Data Documentation

◆ m_caldb

GCaldb GCOMResponse::m_caldb
private

Calibration database.

Definition at line 125 of file GCOMResponse.hpp.

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

◆ m_faq

GSkyMap GCOMResponse::m_faq
private

FAQ array.

Definition at line 128 of file GCOMResponse.hpp.

Referenced by compute_faq(), copy_members(), init_members(), irf_diffuse(), irf_elliptical(), and irf_radial().

◆ m_faq_bins

int GCOMResponse::m_faq_bins
private

Number of FAQ bins.

Definition at line 134 of file GCOMResponse.hpp.

Referenced by compute_faq(), copy_members(), init_members(), irf_diffuse(), irf_elliptical(), and irf_radial().

◆ m_faq_native

std::vector<GVector> GCOMResponse::m_faq_native
private

Array of native FAQ vectors.

Definition at line 130 of file GCOMResponse.hpp.

Referenced by compute_faq(), copy_members(), init_members(), irf_diffuse(), irf_elliptical(), and irf_radial().

◆ m_faq_solidangle

GVector GCOMResponse::m_faq_solidangle
private

Array of FAQ solid angles.

Definition at line 131 of file GCOMResponse.hpp.

Referenced by compute_faq(), copy_members(), init_members(), irf_diffuse(), irf_elliptical(), and irf_radial().

◆ m_faq_zero

std::vector<bool> GCOMResponse::m_faq_zero
private

Array of zero FAQ bins.

Definition at line 129 of file GCOMResponse.hpp.

Referenced by compute_faq(), copy_members(), init_members(), irf_diffuse(), irf_elliptical(), and irf_radial().

◆ m_iaq

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

◆ m_phibar_bin_size

double GCOMResponse::m_phibar_bin_size
private

Phigeo binsize (deg)

Definition at line 141 of file GCOMResponse.hpp.

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

◆ m_phibar_bins

int GCOMResponse::m_phibar_bins
private

◆ m_phibar_min

double GCOMResponse::m_phibar_min
private

Phigeo value of first bin (deg)

Definition at line 142 of file GCOMResponse.hpp.

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

◆ m_phibar_ref_pixel

double GCOMResponse::m_phibar_ref_pixel
private

Phigeo reference pixel (starting from 1)

Definition at line 140 of file GCOMResponse.hpp.

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

◆ m_phibar_ref_value

double GCOMResponse::m_phibar_ref_value
private

Phigeo reference value (deg)

Definition at line 139 of file GCOMResponse.hpp.

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

◆ m_phigeo_bin_size

double GCOMResponse::m_phigeo_bin_size
private

◆ m_phigeo_bins

int GCOMResponse::m_phigeo_bins
private

◆ m_phigeo_min

double GCOMResponse::m_phigeo_min
private

Phigeo value of first bin (deg)

Definition at line 138 of file GCOMResponse.hpp.

Referenced by backproject(), copy_members(), init_members(), irf_diffuse(), irf_elliptical(), irf_radial(), print(), read(), and write().

◆ m_phigeo_ref_pixel

double GCOMResponse::m_phigeo_ref_pixel
private

Phigeo reference pixel (starting from 1)

Definition at line 136 of file GCOMResponse.hpp.

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

◆ m_phigeo_ref_value

double GCOMResponse::m_phigeo_ref_value
private

Phigeo reference value (deg)

Definition at line 135 of file GCOMResponse.hpp.

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

◆ m_rspname

std::string GCOMResponse::m_rspname
private

Response name.

Definition at line 126 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: