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

CTA cube-style response function class. More...

#include <GCTAResponseCube.hpp>

Inheritance diagram for GCTAResponseCube:
GCTAResponse GResponse GBase

Public Member Functions

 GCTAResponseCube (void)
 Void constructor. More...
 
 GCTAResponseCube (const GCTAResponseCube &rsp)
 Copy constructor. More...
 
 GCTAResponseCube (const GXmlElement &xml)
 XML constructor. More...
 
 GCTAResponseCube (const GCTACubeExposure &exposure, const GCTACubePsf &psf, const GCTACubeBackground &background)
 Response constructor. More...
 
 GCTAResponseCube (const GCTACubeExposure &exposure, const GCTACubePsf &psf, const GCTACubeEdisp &edisp, const GCTACubeBackground &background)
 Response constructor. More...
 
virtual ~GCTAResponseCube (void)
 Destructor. More...
 
virtual GCTAResponseCubeoperator= (const GCTAResponseCube &rsp)
 Assignment operator. More...
 
virtual void clear (void)
 Clear instance. More...
 
virtual GCTAResponseCubeclone (void) const
 Clone instance. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual bool is_valid (void) const
 Signal if response is valid. More...
 
virtual bool use_edisp (void) const
 Signal if response uses energy dispersion. More...
 
virtual bool use_tdisp (void) const
 Signal if time dispersion will be used. More...
 
virtual bool apply_edisp (void) const
 Signal if energy dispersion should be applied. More...
 
virtual void apply_edisp (const bool &apply_edisp) const
 Signal if energy dispersion should be applied. More...
 
virtual double irf (const GEvent &event, const GPhoton &photon, 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 &obsEng) const
 Return true energy boundaries for a specific observed energy. More...
 
virtual void read (const GXmlElement &xml)
 Read response information from XML element. More...
 
virtual void write (GXmlElement &xml) const
 Write response information into XML element. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print response information. More...
 
virtual double irf_spatial (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response integrated over the spatial model. More...
 
const GCTACubeExposureexposure (void) const
 Return exposure cube. More...
 
void exposure (const GCTACubeExposure &exposure)
 Set exposure cube. More...
 
const GCTACubePsfpsf (void) const
 Return cube analysis point spread function. More...
 
void psf (const GCTACubePsf &psf)
 Set cube analysis point spread function cube. More...
 
const GCTACubeEdispedisp (void) const
 Return cube analysis energy dispersion cube. More...
 
void edisp (const GCTACubeEdisp &edisp)
 Set cube analysis energy dispersion cube. More...
 
const GCTACubeBackgroundbackground (void) const
 Return cube analysis background cube. More...
 
void background (const GCTACubeBackground &background)
 Set cube analysis background cube. More...
 
- Public Member Functions inherited from GCTAResponse
 GCTAResponse (void)
 Void constructor. More...
 
 GCTAResponse (const GCTAResponse &rsp)
 Copy constructor. More...
 
virtual ~GCTAResponse (void)
 Destructor. More...
 
virtual GCTAResponseoperator= (const GCTAResponse &rsp)
 Assignment operator. 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...
 
virtual GVector convolve (const GModelSky &model, const GObservation &obs, GMatrixSparse *gradients=NULL) const
 Convolve sky model with the instrument response. More...
 
virtual GVector irf_spatial (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
 Return instrument response vector integrated over the spatial model. More...
 
virtual void remove_response_cache (const std::string &name)
 Remove response cache for model. 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 GCTAResponseCube &rsp)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
double psf_radial (const GModelSpatialRadial *model, const double &rho_obs, const GSkyDir &obsDir, const GEnergy &srcEng, const GTime &srcTime) const
 Integrate Psf over radial model. More...
 
double psf_elliptical (const GModelSpatialElliptical *model, const double &rho_obs, const double &posangle_obs, const GSkyDir &obsDir, const GEnergy &srcEng, const GTime &srcTime) const
 Integrate Psf over elliptical model. More...
 
double psf_diffuse (const GModelSpatial *model, const GSkyDir &obsDir, const GEnergy &srcEng, const GTime &srcTime) const
 Integrate PSF over diffuse model. More...
 
double irf_ptsrc (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response to point source. More...
 
double irf_radial (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response to radial source. More...
 
double irf_elliptical (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response to elliptical source. More...
 
double irf_diffuse (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return instrument response to diffuse source. More...
 
GVector irf_radial (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const
 Return instrument response to radial source. More...
 
GVector psf_radial (const GModelSpatialRadial *model, const double &zeta, const GSkyDir &obsDir, const GEnergies &srcEngs, const GTime &srcTime, const bool &grad) const
 Integrate Psf over radial model. More...
 

Private Attributes

GCTACubeExposure m_exposure
 Exposure cube. More...
 
GCTACubePsf m_psf
 Mean point spread function. More...
 
GCTACubeBackground m_background
 Background cube. More...
 
GCTACubeEdisp m_edisp
 Energy dispersion cube. More...
 
bool m_apply_edisp
 Apply energy dispersion. More...
 
bool m_has_edisp
 Flag to indicate if energy. More...
 
std::vector< std::string > m_cache_names
 Model names. More...
 
std::vector< GNdarraym_cache_values
 Cached values. More...
 

Additional Inherited Members

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

Detailed Description

CTA cube-style response function class.

Definition at line 64 of file GCTAResponseCube.hpp.

Constructor & Destructor Documentation

GCTAResponseCube::GCTAResponseCube ( void  )

Void constructor.

Constructs void CTA response.

Definition at line 97 of file GCTAResponseCube.cpp.

References init_members().

Referenced by clone().

GCTAResponseCube::GCTAResponseCube ( const GCTAResponseCube rsp)

Copy constructor.

Parameters
[in]rspCTA response.

Constructs CTA cube response by making a deep copy of an existing object.

Definition at line 115 of file GCTAResponseCube.cpp.

References copy_members(), and init_members().

GCTAResponseCube::GCTAResponseCube ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML element.

Construct CTA response from XML element.

Definition at line 136 of file GCTAResponseCube.cpp.

References init_members(), and read().

GCTAResponseCube::GCTAResponseCube ( const GCTACubeExposure exposure,
const GCTACubePsf psf,
const GCTACubeBackground background 
)

Response constructor.

Parameters
[in]exposureCTA cube analysis exposure.
[in]psfCTA cube analysis point spread function.
[in]backgroundCTA cube background response.

Constructs CTA cube analysis response from a cube analysis exposure, a point spread function cube and a background cube.

Definition at line 159 of file GCTAResponseCube.cpp.

References background(), exposure(), init_members(), m_background, m_exposure, m_has_edisp, m_psf, and psf().

GCTAResponseCube::GCTAResponseCube ( const GCTACubeExposure exposure,
const GCTACubePsf psf,
const GCTACubeEdisp edisp,
const GCTACubeBackground background 
)

Response constructor.

Parameters
[in]exposureCTA cube analysis exposure.
[in]psfCTA cube analysis point spread function.
[in]edispCTA cube energy dispersion response.
[in]backgroundCTA cube background response.

Constructs CTA cube analysis response from a cube analysis exposure, a point spread function cube, an energy dispersion cube and a background cube.

Definition at line 191 of file GCTAResponseCube.cpp.

References background(), edisp(), exposure(), init_members(), m_background, m_edisp, m_exposure, m_has_edisp, m_psf, and psf().

GCTAResponseCube::~GCTAResponseCube ( void  )
virtual

Destructor.

Destroys instance of CTA response object.

Definition at line 219 of file GCTAResponseCube.cpp.

References free_members().

Member Function Documentation

bool GCTAResponseCube::apply_edisp ( void  ) const
inlinevirtual

Signal if energy dispersion should be applied.

Returns
True if energy dispersion should be applied

Implements GCTAResponse.

Definition at line 240 of file GCTAResponseCube.hpp.

References m_apply_edisp.

Referenced by apply_edisp(), and print().

void GCTAResponseCube::apply_edisp ( const bool &  apply_edisp) const
inlinevirtual

Signal if energy dispersion should be applied.

Parameters
[in]apply_edispSet true if energy dispersion should be applied

Implements GCTAResponse.

Definition at line 251 of file GCTAResponseCube.hpp.

References apply_edisp(), and m_apply_edisp.

const GCTACubeBackground & GCTAResponseCube::background ( void  ) const
inline

Return cube analysis background cube.

Returns
Reference to cube analysis background cube.

Definition at line 353 of file GCTAResponseCube.hpp.

References m_background.

Referenced by background(), GCTAModelCubeBackground::eval(), GCTAResponseCube(), and GCTAModelCubeBackground::npred().

void GCTAResponseCube::background ( const GCTACubeBackground background)
inline

Set cube analysis background cube.

Parameters
[in]backgroundCube analysis background cube.

Definition at line 340 of file GCTAResponseCube.hpp.

References background(), and m_background.

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

Return class name.

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

Implements GCTAResponse.

Definition at line 186 of file GCTAResponseCube.hpp.

void GCTAResponseCube::clear ( void  )
virtual

Clear instance.

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

Implements GCTAResponse.

Definition at line 282 of file GCTAResponseCube.cpp.

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

Referenced by read().

GCTAResponseCube * GCTAResponseCube::clone ( void  ) const
virtual

Clone instance.

Returns
Pointer to deep copy of CTA response.

Creates a clone (deep copy) of a CTA response object.

Implements GCTAResponse.

Definition at line 306 of file GCTAResponseCube.cpp.

References GCTAResponseCube().

void GCTAResponseCube::copy_members ( const GCTAResponseCube rsp)
private

Copy class members.

Parameters
[in]rspResponse.

Definition at line 843 of file GCTAResponseCube.cpp.

References m_apply_edisp, m_background, m_cache_names, m_cache_values, m_edisp, m_exposure, m_has_edisp, and m_psf.

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

GEbounds GCTAResponseCube::ebounds ( const GEnergy obsEng) const
virtual

Return true energy boundaries for a specific observed energy.

Parameters
[in]obsEngObserved photon energy.
Returns
Boundaries in true energy.

Implements GCTAResponse.

Definition at line 443 of file GCTAResponseCube.cpp.

References GCTACubeEdisp::ebounds(), and m_edisp.

const GCTACubeEdisp & GCTAResponseCube::edisp ( void  ) const
inline

Return cube analysis energy dispersion cube.

Returns
Reference to cube analysis energy dispersion cube.

Definition at line 328 of file GCTAResponseCube.hpp.

References m_edisp.

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

void GCTAResponseCube::edisp ( const GCTACubeEdisp edisp)
inline

Set cube analysis energy dispersion cube.

Parameters
[in]edispCube analysis energy dispersion cube.

Definition at line 314 of file GCTAResponseCube.hpp.

References edisp(), m_edisp, and m_has_edisp.

const GCTACubeExposure & GCTAResponseCube::exposure ( void  ) const
inline

Return exposure cube.

Returns
Reference to exposure cube.

Definition at line 264 of file GCTAResponseCube.hpp.

References m_exposure.

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

void GCTAResponseCube::exposure ( const GCTACubeExposure exposure)
inline

Set exposure cube.

Parameters
[in]exposureExposure cube.

Definition at line 276 of file GCTAResponseCube.hpp.

References exposure(), and m_exposure.

void GCTAResponseCube::free_members ( void  )
private

Delete class members.

Definition at line 865 of file GCTAResponseCube.cpp.

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

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

Return instrument response.

Parameters
[in]eventObserved event.
[in]photonIncident photon.
[in]obsObservation (not used).
Returns
Instrument response.

Implements GCTAResponse.

Definition at line 320 of file GCTAResponseCube.cpp.

References gammalib::cta_dir(), GCTACubeExposure::deadc(), GCTACubePsf::delta_max(), GPhoton::dir(), GCTAInstDir::dir(), GSkyDir::dist(), edisp(), GPhoton::energy(), exposure(), G_IRF, gammalib::is_infinite(), gammalib::is_notanumber(), GCTACubeExposure::livetime(), psf(), and use_edisp().

Referenced by irf_diffuse(), irf_elliptical(), irf_ptsrc(), irf_radial(), irf_spatial(), and psf_elliptical().

double GCTAResponseCube::irf_diffuse ( const GEvent event,
const GSource source,
const GObservation obs 
) const
privatevirtual

Return instrument response to diffuse source.

Parameters
[in]eventObserved event.
[in]sourceSource.
[in]obsObservation.
Returns
Instrument response to diffuse source.

Returns the instrument response to a specified diffuse source.

The method uses a pre-computation cache to store the instrument response for the spatial model component. The pre-computation cache is initialised if no cache has yet been allocated, or if at the beginning of a scan over the events, the model parameters have changed. The beginning of a scan is defined by an event bin index of 0.

Reimplemented from GResponse.

Definition at line 1514 of file GCTAResponseCube.cpp.

References GModelSpatialDiffuse::contains(), GCTACubeExposure::deadc(), GCTACubePsf::delta_max(), GCTAEventBin::dir(), GCTAInstDir::dir(), edisp(), GSource::energy(), GCTAEventBin::energy(), exposure(), G_IRF_DIFFUSE, irf(), GEvent::is_bin(), gammalib::is_infinite(), gammalib::is_notanumber(), GCTACubeExposure::livetime(), GSource::model(), psf(), psf_diffuse(), gammalib::rad2deg, GCTAEventBin::time(), and use_edisp().

Referenced by irf_spatial().

double GCTAResponseCube::irf_elliptical ( const GEvent event,
const GSource source,
const GObservation obs 
) const
privatevirtual

Return instrument response to elliptical source.

Parameters
[in]eventObserved event.
[in]sourceSource.
[in]obsObservation (not used).
Returns
Instrument response to elliptical source.

Returns the instrument response to a specified elliptical source.

Todo:
Correct assumptions in exposure computation, PSF computation and energy dispersion computation.

Reimplemented from GResponse.

Definition at line 1408 of file GCTAResponseCube.cpp.

References GCTACubeExposure::deadc(), GCTAEventBin::dir(), GCTAInstDir::dir(), GModelSpatialElliptical::dir(), GSkyDir::dist(), edisp(), GSource::energy(), GCTAEventBin::energy(), exposure(), G_IRF_RADIAL, irf(), GEvent::is_bin(), gammalib::is_infinite(), gammalib::is_notanumber(), GCTACubeExposure::livetime(), GSource::model(), GSkyDir::posang(), psf(), psf_elliptical(), GCTAEventBin::time(), and use_edisp().

Referenced by irf_spatial().

double GCTAResponseCube::irf_ptsrc ( const GEvent event,
const GSource source,
const GObservation obs 
) const
privatevirtual

Return instrument response to point source.

Parameters
[in]eventObserved event.
[in]sourceSource.
[in]obsObservation (not used).
Returns
Instrument response to point source.

Returns the instrument response to a specified point source.

Reimplemented from GResponse.

Definition at line 1213 of file GCTAResponseCube.cpp.

References GCTACubeExposure::deadc(), GCTACubePsf::delta_max(), GCTAEventBin::dir(), GCTAInstDir::dir(), GModelSpatialPointSource::dir(), edisp(), GSource::energy(), GCTAEventBin::energy(), exposure(), G_IRF_PTSRC, irf(), GEvent::is_bin(), gammalib::is_infinite(), gammalib::is_notanumber(), GCTACubeExposure::livetime(), GSource::model(), psf(), and use_edisp().

Referenced by irf_spatial().

double GCTAResponseCube::irf_radial ( const GEvent event,
const GSource source,
const GObservation obs 
) const
privatevirtual

Return instrument response to radial source.

Parameters
[in]eventObserved event.
[in]sourceSource.
[in]obsObservation (not used).
Returns
Instrument response to radial source.

Returns the instrument response to a specified radial source.

Todo:
Correct assumptions in exposure computation, PSF computation and energy dispersion computation.

Reimplemented from GResponse.

Definition at line 1306 of file GCTAResponseCube.cpp.

References GCTACubeExposure::deadc(), GCTAEventBin::dir(), GCTAInstDir::dir(), GModelSpatialRadial::dir(), GSkyDir::dist(), edisp(), GSource::energy(), GCTAEventBin::energy(), exposure(), G_IRF_RADIAL, irf(), GEvent::is_bin(), gammalib::is_infinite(), gammalib::is_notanumber(), GCTACubeExposure::livetime(), GSource::model(), psf(), psf_radial(), GCTAEventBin::time(), and use_edisp().

Referenced by irf_spatial().

GVector GCTAResponseCube::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]gradientsOptional spatial model gradients for all events.
Returns
Instrument response to radial source for all events in observation.

Returns the instrument response to a specified radial source.

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.

Reimplemented from GResponse.

Definition at line 1625 of file GCTAResponseCube.cpp.

References GEnergies::append(), GMatrix::column(), GMatrixBase::columns(), GObservation::computed_gradient(), GCTAEventCube::counts(), gammalib::cta_event_cube(), GCTACubeExposure::deadc(), GModelSpatialRadial::dir(), GSkyDir::dist(), GCTAEventCube::ebins(), GCTAEventCube::energy(), GObservation::events(), exposure(), G_IRF_RADIAL2, GOptimizerPar::has_grad(), GOptimizerPar::is_free(), GCTACubeExposure::livetime(), norm(), GCTAEventCube::npix(), psf(), psf_radial(), GMatrixBase::rows(), GEvents::size(), GModelSpatial::size(), GModelSky::spatial(), gammalib::str(), and GCTAEventCube::time().

double GCTAResponseCube::irf_spatial ( const GEvent event,
const GSource source,
const GObservation obs 
) const
virtual

Return instrument response integrated over the spatial model.

Parameters
[in]eventEvent.
[in]sourceSource.
[in]obsObservation.
Returns
Instrument response to a spatial model.

Returns the instrument response for a given event, source and observation integrated over the spatial model component. The method computes

\[ {\tt irf}(p', E', t') = \int_p M_{\rm S}(p | E, t) \, R(p', E', t' | p, E, t) \, d\,p \]

where

  • \(M_{\rm S}(p | E, t)\) is the spatial model component,
  • \(R(p', E', t' | p, E, t)\) is the Instrument Response Function (IRF),
  • \(p'\) is the measured instrument direction,
  • \(E'\) is the measured or reconstructed energy,
  • \(t'\) is the measured arrival time,
  • \(p\) is the true photon arrival direction,
  • \(E\) is the true photon energy, and
  • \(t\) is the true trigger time.

The integration is done over all relevant true sky directions \(p\).

Depending on the type of the source model the method branches to the following methods to perform the actual computations

 irf_ptsrc() - for the handling of a point source
 irf_radial() - for radial models
 irf_elliptical() - for elliptical models
 irf_diffuse() - for diffuse models
 irf_composite() - for composite models

The method implements a caching mechanism for spatial models that have all parameters fixed. For those models the instrument response for a given event and observation is only computed once and then stored in an internal cache from which it is fetched back in case that the method is called again for the same event and observation.

Reimplemented from GResponse.

Definition at line 496 of file GCTAResponseCube.cpp.

References GModelSpatial::code(), GResponseCache::contains(), GCTAEventCube::ebins(), GSource::energy(), GObservation::events(), GMODEL_SPATIAL_COMPOSITE, GMODEL_SPATIAL_DIFFUSE, GMODEL_SPATIAL_ELLIPTICAL, GMODEL_SPATIAL_POINT_SOURCE, GMODEL_SPATIAL_RADIAL, GModelSpatial::has_free_pars(), GObservation::id(), GCTAEventBin::ieng(), GCTAEventBin::ipix(), irf(), GResponse::irf_composite(), irf_diffuse(), irf_elliptical(), irf_ptsrc(), irf_radial(), m_cache_names, m_cache_values, GResponse::m_irf_cache, GResponse::m_use_irf_cache, GSource::model(), GSource::name(), GCTAEventCube::nx(), GCTAEventCube::ny(), GResponseCache::set(), and use_edisp().

bool GCTAResponseCube::is_valid ( void  ) const
inlinevirtual

Signal if response is valid.

Returns
True if response is valid
Todo:
: To be implemented (check if GCTACubeExposure and GCTACubePsf is loaded)

Implements GCTAResponse.

Definition at line 200 of file GCTAResponseCube.hpp.

double GCTAResponseCube::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.

Computes the integral

\[ N_{\rm ROI}(E',t') = \int_{\rm ROI} P(p',E',t') dp' \]

of the event probability

\[ P(p',E',t') = \int \int \int S(p,E,t) \times R(p',E',t'|p,E,t) \, dp \, dE \, dt \]

for a given sky model \(S(p,E,t)\) and response function \(R(p',E',t'|p,E,t)\) over the Region of Interest (ROI).

Todo:
Implement method (is maybe not really needed)

Implements GCTAResponse.

Definition at line 422 of file GCTAResponseCube.cpp.

References G_NROI.

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

Assignment operator.

Parameters
[in]rspCTA response.
Returns
CTA response.

Assigns CTA response object to another CTA 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 246 of file GCTAResponseCube.cpp.

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

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

Print response information.

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

Implements GCTAResponse.

Definition at line 753 of file GCTAResponseCube.cpp.

References apply_edisp(), m_background, m_edisp, m_exposure, m_has_edisp, GResponse::m_irf_cache, m_psf, NORMAL, gammalib::parformat(), GCTACubeBackground::print(), GResponseCache::print(), GCTACubeExposure::print(), GCTACubePsf::print(), GCTACubeEdisp::print(), gammalib::reduce(), SILENT, and use_edisp().

const GCTACubePsf & GCTAResponseCube::psf ( void  ) const
inline
void GCTAResponseCube::psf ( const GCTACubePsf psf)
inline

Set cube analysis point spread function cube.

Parameters
[in]psfCube analysis point spread function.

Definition at line 301 of file GCTAResponseCube.hpp.

References m_psf, and psf().

double GCTAResponseCube::psf_diffuse ( const GModelSpatial model,
const GSkyDir obsDir,
const GEnergy srcEng,
const GTime srcTime 
) const
private

Integrate PSF over diffuse model.

Parameters
[in]modelDiffuse spatial model.
[in]obsDirObserved event direction.
[in]srcEngTrue photon energy.
[in]srcTimeTrue photon arrival time.

Computes the integral

\[ \int_0^{\delta_{\rm max}} {\rm PSF}(\delta) \times \int_0^{2\pi} {\rm Map}(\delta, \phi) \sin \delta {\rm d}\phi {\rm d}\delta \]

where \({\rm Map}(\delta, \phi)\) is the diffuse map in the coordinate system of the point spread function, defined by the angle \(\delta\) between the true and the measured photon direction and the azimuth angle \(\phi\) around the measured photon direction. \({\rm PSF}(\delta)\) is the azimuthally symmetric point spread function.

Definition at line 1147 of file GCTAResponseCube.cpp.

References GSkyDir::dec_deg(), GCTACubePsf::delta_max(), GMatrix::eulery(), GMatrix::eulerz(), GIntegral::fixed_iter(), gammalib::iter_rho(), psf(), GSkyDir::ra_deg(), gammalib::resolution(), and GIntegral::romberg().

Referenced by irf_diffuse().

double GCTAResponseCube::psf_elliptical ( const GModelSpatialElliptical model,
const double &  rho_obs,
const double &  posangle_obs,
const GSkyDir obsDir,
const GEnergy srcEng,
const GTime srcTime 
) const
private

Integrate Psf over elliptical model.

Parameters
[in]modelElliptical model.
[in]rho_obsAngle between model centre and measured photon direction (radians).
[in]posangle_obsPosition angle of measured photon direction with respect to model centre (radians).
[in]obsDirObserved event direction.
[in]srcEngTrue photon energy.
[in]srcTimeTrue photon arrival time.

Integrates the product of the spatial model and the point spread function over the true photon arrival direction using

\[ \int_{\rho_{\rm min}}^{\rho_{\rm max}} \sin \rho \times \int_{\omega} S_{\rm p}(\rho, \omega | E, t) \times {\rm Psf}(\rho, \omega) d\omega d\rho \]

where \(S_{\rm p}(\rho, \omega | E, t)\) is the elliptical spatial model, \({\rm Psf}(\rho, \omega)\) is the point spread function, \(\rho\) is the radial distance from the model centre, and \(\omega\) is the position angle around the model centre measured counterclockwise from the connecting line between the model centre and the observed photon arrival direction.

Definition at line 1009 of file GCTAResponseCube.cpp.

References gammalib::deg2rad, GCTACubePsf::delta_max(), GIntegral::fixed_iter(), irf(), gammalib::is_infinite(), gammalib::is_notanumber(), gammalib::iter_phi(), gammalib::iter_rho(), gammalib::pihalf, GModelSpatialElliptical::posangle(), psf(), GIntegral::romberg(), GModelSpatialElliptical::semimajor(), GModelSpatialElliptical::semiminor(), and GModelSpatialElliptical::theta_max().

Referenced by irf_elliptical().

double GCTAResponseCube::psf_radial ( const GModelSpatialRadial model,
const double &  delta_mod,
const GSkyDir obsDir,
const GEnergy srcEng,
const GTime srcTime 
) const
private

Integrate Psf over radial model.

Parameters
[in]modelRadial model.
[in]delta_modAngle between model centre and measured photon direction (radians).
[in]obsDirObserved event direction.
[in]srcEngTrue photon energy.
[in]srcTimeTrue photon arrival time.

Integrates the product of the spatial model and the point spread function over the true photon arrival direction using

\[ \int_{\delta_{\rm min}}^{\delta_{\rm max}} \sin \delta \times {\rm Psf}(\delta) \times \int_{\phi_{\rm min}}^{\phi_{\rm max}} S_{\rm p}(\delta, \phi | E, t) d\phi d\delta \]

where \(S_{\rm p}(\delta, \phi | E, t)\) is the radial spatial model, \({\rm Psf}(\delta)\) is the point spread function, \(\delta\) is angular distance between the true and the measured photon direction, and \(\phi\) is the position angle around the observed photon direction measured counterclockwise from the connecting line between the model centre and the observed photon arrival direction.

Definition at line 901 of file GCTAResponseCube.cpp.

References GCTACubePsf::delta_max(), GIntegral::fixed_iter(), gammalib::is_infinite(), gammalib::is_notanumber(), gammalib::iter_phi(), psf(), GIntegral::romberg(), and GModelSpatialRadial::theta_max().

Referenced by irf_radial().

GVector GCTAResponseCube::psf_radial ( const GModelSpatialRadial model,
const double &  zeta,
const GSkyDir obsDir,
const GEnergies srcEngs,
const GTime srcTime,
const bool &  grad 
) const
private

Integrate Psf over radial model.

Parameters
[in]modelRadial model.
[in]zetaAngle between model centre and event direction (radians).
[in]obsDirObserved event direction.
[in]srcEngsTrue photon energies.
[in]srcTimeTrue photon arrival time.
[in]gradCompute gradients?

Definition at line 1784 of file GCTAResponseCube.cpp.

References GCTACubePsf::delta_max(), GIntegrals::fixed_iter(), gammalib::is_infinite(), gammalib::is_notanumber(), gammalib::iter_phi(), psf(), GIntegrals::romberg(), GEnergies::size(), and GModelSpatialRadial::theta_max().

void GCTAResponseCube::read ( const GXmlElement xml)
virtual

Read response information from XML element.

Parameters
[in]xmlXML element.

Reads response information from an XML element. The Exposure, Psf, background cubes, and optionally the energy dispersion cube, are specified using

 <observation name="..." id="..." instrument="...">
   ...
   <parameter name="ExposureCube" file="..."/>
   <parameter name="PsfCube"      file="..."/>
   <parameter name="EdispCube"    file="..."/>
   <parameter name="BkgCube"      file="..."/>
 </observation>

Implements GCTAResponse.

Definition at line 653 of file GCTAResponseCube.cpp.

References GXmlElement::attribute(), clear(), G_READ, GCTACubeBackground::load(), GCTACubeExposure::load(), GCTACubePsf::load(), GCTACubeEdisp::load(), m_background, m_edisp, m_exposure, m_has_edisp, m_psf, gammalib::xml_file_expand(), gammalib::xml_get_par(), and gammalib::xml_has_par().

Referenced by GCTAResponseCube().

bool GCTAResponseCube::use_edisp ( void  ) const
inlinevirtual

Signal if response uses energy dispersion.

Returns
True if response uses energy dispersion

Signals if the response uses energy dispersion. This implies that the apply_edisp flag has been set to true and that energy dispersion response information is available.

Implements GCTAResponse.

Definition at line 216 of file GCTAResponseCube.hpp.

References m_apply_edisp, and m_has_edisp.

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

bool GCTAResponseCube::use_tdisp ( void  ) const
inlinevirtual

Signal if time dispersion will be used.

Returns
False.

Implements GCTAResponse.

Definition at line 228 of file GCTAResponseCube.hpp.

void GCTAResponseCube::write ( GXmlElement xml) const
virtual

Write response information into XML element.

Parameters
[in]xmlXML element.

Writes response information into an XML element. The Exposure, Psf and background cubes, and optionally the energy dispersion cube, are specified using

 <observation name="..." id="..." instrument="...">
   ...
   <parameter name="ExposureCube" file="..."/>
   <parameter name="PsfCube"      file="..."/>
   <parameter name="EdispCube"    file="..."/>
   <parameter name="BkgCube"      file="..."/>
 </observation>

Implements GCTAResponse.

Definition at line 710 of file GCTAResponseCube.cpp.

References GXmlElement::attribute(), GCTACubeBackground::filename(), GCTACubeExposure::filename(), GCTACubePsf::filename(), GCTACubeEdisp::filename(), G_WRITE, m_background, m_edisp, m_exposure, m_has_edisp, m_psf, gammalib::xml_file_reduce(), and gammalib::xml_need_par().

Member Data Documentation

bool GCTAResponseCube::m_apply_edisp
mutableprivate

Apply energy dispersion.

Definition at line 171 of file GCTAResponseCube.hpp.

Referenced by apply_edisp(), copy_members(), init_members(), and use_edisp().

GCTACubeBackground GCTAResponseCube::m_background
private

Background cube.

Definition at line 169 of file GCTAResponseCube.hpp.

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

std::vector<std::string> GCTAResponseCube::m_cache_names
mutableprivate

Model names.

Definition at line 175 of file GCTAResponseCube.hpp.

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

std::vector<GNdarray> GCTAResponseCube::m_cache_values
mutableprivate

Cached values.

Definition at line 176 of file GCTAResponseCube.hpp.

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

GCTACubeEdisp GCTAResponseCube::m_edisp
private

Energy dispersion cube.

Definition at line 170 of file GCTAResponseCube.hpp.

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

GCTACubeExposure GCTAResponseCube::m_exposure
private

Exposure cube.

Definition at line 167 of file GCTAResponseCube.hpp.

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

bool GCTAResponseCube::m_has_edisp
mutableprivate

Flag to indicate if energy.

Definition at line 172 of file GCTAResponseCube.hpp.

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

GCTACubePsf GCTAResponseCube::m_psf
private

Mean point spread function.

Definition at line 168 of file GCTAResponseCube.hpp.

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


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