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

Fermi/LAT Response class. More...

#include <GLATResponse.hpp>

Inheritance diagram for GLATResponse:
GResponse GBase

Public Member Functions

 GLATResponse (void)
 Void constructor. More...
 
 GLATResponse (const GLATResponse &rsp)
 Copy constructor. More...
 
virtual ~GLATResponse (void)
 Destructor. More...
 
GLATResponseoperator= (const GLATResponse &rsp)
 Assignment operator. More...
 
virtual void clear (void)
 Clear response. More...
 
virtual GLATResponseclone (void) const
 Clone response. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual bool use_edisp (void) const
 Signal if response uses energy dispersion. More...
 
virtual bool use_tdisp (void) const
 Signal if response uses time dispersion. More...
 
virtual double irf (const GEvent &event, const GPhoton &photon, const GObservation &obs) const
 Return value of point source IRF. More...
 
virtual double irf (const GEvent &event, const GSource &source, const GObservation &obs) const
 Return value of model instrument response function. 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 Fermi-LAT response information. More...
 
int size (void) const
 Return number of event types. More...
 
const std::string & rspname (void) const
 Return response name. More...
 
void load (const std::string &rspname)
 Load Fermi LAT response from calibration database. More...
 
void save (const std::string &rspname) const
 Save Fermi LAT response in calibration database. More...
 
const bool & force_mean (void) const
 Signal if mean PSF should be used for response computation. More...
 
void force_mean (const bool &value)
 Set if mean PSF should be used for response computation. More...
 
GLATAeffaeff (const int &index) const
 Return pointer on effective area. More...
 
GLATPsfpsf (const int &index) const
 Return pointer on point spread function. More...
 
GLATEdispedisp (const int &index) const
 Return pointer on energy dispersion. More...
 
double irf (const GLATEventAtom &event, const GSource &source, const GObservation &obs) const
 Return value of model IRF for event atom. More...
 
double irf (const GLATEventBin &event, const GSource &source, const GObservation &obs) const
 Return value of model IRF for event bin. 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 GLATResponse &rsp)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Private Attributes

std::string m_rspname
 Name of the instrument response. More...
 
bool m_force_mean
 Use mean PSF in any case. More...
 
std::vector< GLATAeff * > m_aeff
 Effective areas. More...
 
std::vector< GLATPsf * > m_psf
 Point spread functions. More...
 
std::vector< GLATEdisp * > m_edisp
 Energy dispersions. More...
 
std::vector< GLATMeanPsf * > m_ptsrc
 Mean PSFs for point sources. More...
 

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

Fermi/LAT Response class.

Definition at line 56 of file GLATResponse.hpp.

Constructor & Destructor Documentation

GLATResponse::GLATResponse ( void  )

Void constructor.

Definition at line 84 of file GLATResponse.cpp.

References init_members().

Referenced by clone().

GLATResponse::GLATResponse ( const GLATResponse rsp)

Copy constructor.

Parameters
[in]rspResponse.

Definition at line 99 of file GLATResponse.cpp.

References copy_members(), and init_members().

GLATResponse::~GLATResponse ( void  )
virtual

Destructor.

Definition at line 115 of file GLATResponse.cpp.

References free_members().

Member Function Documentation

GLATAeff * GLATResponse::aeff ( const int &  index) const

Return pointer on effective area.

Parameters
[in]indexResponse index (starting from 0).

Definition at line 699 of file GLATResponse.cpp.

References G_AEFF, and m_aeff.

Referenced by load(), and GLATMeanPsf::set().

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

Return class name.

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

Implements GResponse.

Definition at line 127 of file GLATResponse.hpp.

void GLATResponse::clear ( void  )
virtual
GLATResponse * GLATResponse::clone ( void  ) const
virtual

Clone response.

Returns
Pointer to deep copy of response.

Implements GResponse.

Definition at line 190 of file GLATResponse.cpp.

References GLATResponse().

void GLATResponse::copy_members ( const GLATResponse rsp)
private

Copy class members.

Parameters
[in]rspResponse.

Definition at line 822 of file GLATResponse.cpp.

References m_aeff, m_edisp, m_force_mean, m_psf, m_ptsrc, and m_rspname.

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

GEbounds GLATResponse::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 531 of file GLATResponse.cpp.

References G_EBOUNDS.

GLATEdisp * GLATResponse::edisp ( const int &  index) const

Return pointer on energy dispersion.

Parameters
[in]indexResponse index (starting from 0).

Definition at line 737 of file GLATResponse.cpp.

References G_EDISP, and m_edisp.

Referenced by load().

const bool & GLATResponse::force_mean ( void  ) const
inline

Signal if mean PSF should be used for response computation.

Returns
True if mean PSF should be used for response computation.

Definition at line 189 of file GLATResponse.hpp.

References m_force_mean.

void GLATResponse::force_mean ( const bool &  value)
inline

Set if mean PSF should be used for response computation.

Parameters
[in]valueTrue if mean PSF should be used for response computation.

Definition at line 201 of file GLATResponse.hpp.

References m_force_mean.

void GLATResponse::free_members ( void  )
private

Delete class members.

Definition at line 860 of file GLATResponse.cpp.

References m_aeff, m_edisp, m_psf, and m_ptsrc.

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

void GLATResponse::init_members ( void  )
private

Initialise class members.

Definition at line 802 of file GLATResponse.cpp.

References m_aeff, m_edisp, m_force_mean, m_psf, m_ptsrc, and m_rspname.

Referenced by clear(), GLATResponse(), and operator=().

double GLATResponse::irf ( const GEvent event,
const GPhoton photon,
const GObservation obs 
) const
virtual

Return value of point source IRF.

Parameters
[in]eventObserved event.
[in]photonIncident photon.
[in]obsObservation.
Exceptions
GLATException::bad_instdir_typeInstrument direction is not a valid LAT instrument direction.
Todo:
The IRF value is not divided by ontime of the event, but it is already time integrated.

Implements GResponse.

Definition at line 209 of file GLATResponse.cpp.

References GSkyDir::dec_deg(), GLATInstDir::dir(), GPhoton::dir(), GPhoton::energy(), G_IRF, GEnergy::log10MeV(), m_ptsrc, GLATMeanPsf::name(), psf(), GSkyDir::ra_deg(), and gammalib::str().

Referenced by irf().

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

Return value of model instrument response function.

Parameters
[in]eventEvent.
[in]sourceSource.
[in]obsObservation.

This method returns the response of the instrument to a specific source model. The method handles both event atoms and event bins.

Implements GResponse.

Definition at line 277 of file GLATResponse.cpp.

References irf(), and GEvent::is_atom().

double GLATResponse::irf ( const GLATEventAtom event,
const GSource source,
const GObservation obs 
) const

Return value of model IRF for event atom.

Parameters
[in]eventEvent atom.
[in]sourceSource.
[in]obsObservations.
Exceptions
GException::feature_not_implementedMethod not yet implemented.
Todo:
Not yet implemented.

Definition at line 307 of file GLATResponse.cpp.

References G_IRF_ATOM, and irf().

double GLATResponse::irf ( const GLATEventBin event,
const GSource source,
const GObservation obs 
) const

Return value of model IRF for event bin.

Parameters
[in]eventEvent bin.
[in]sourceSource.
[in]obsObservation.
Exceptions
GLATException::diffuse_not_foundDiffuse model not found.

This method first searches for a corresponding source map, and if found, computes the response from the source map. If no source map is present it checks if the source is a point source. If this is the case a mean PSF is allocated for the source and the response is computed from the mean PSF. Otherwise an GLATException::diffuse_not_found exception is thrown.

Todo:

Extract event cube from observation. We do not need the cube pointer in the event anymore.

Implement more efficient method for response search (name search is not very rapid).

Instead of calling "offset = event.dir().dist_deg(srcDir)" we can precompute and store for each PSF the offsets. This should save quite some time since the distance computation is time consuming.

Definition at line 348 of file GLATResponse.cpp.

References GLATEventCube::diffname(), GLATEventCube::diffrsp(), GModelSpatialPointSource::dir(), GSkyDir::dist_deg(), GSource::energy(), GLATEventCube::enodes(), G_IRF_BIN, GNodeArray::inx_left(), GNodeArray::inx_right(), GEnergy::log10MeV(), m_force_mean, m_ptsrc, GEnergy::MeV(), GSource::model(), GSource::name(), GLATMeanPsf::name(), GLATEventCube::ndiffrsp(), GSkyMap::npix(), GLATEventBin::ontime(), GSkyMap::pixels(), psf(), GNodeArray::set_value(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().

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

Load Fermi LAT response from calibration database.

Parameters
[in]rspnameResponse name.
Exceptions
GException::invalid_argumentInvalid response type encountered.

Loads the specified Fermi LAT response from the calibration database. The following response names are supported (case insensitive):

 name (is equivalent to front+back)
 name::front
 name::back
 name::psf(0-3)
 name::edisp(0-3)

where name is the response name (for example "P8R2_SOURCE_V6"). Note that the name is case sensitive, but the event typ is not case sensitive.

Definition at line 565 of file GLATResponse.cpp.

References aeff(), clear(), edisp(), GCaldb::filename(), G_LOAD, m_aeff, m_edisp, m_psf, m_rspname, psf(), gammalib::split(), gammalib::strip_whitespace(), gammalib::tolower(), and gammalib::toupper().

Referenced by GLATObservation::response().

double GLATResponse::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
Exceptions
GException::feature_not_implementedMethod is not implemented.

Implements GResponse.

Definition at line 507 of file GLATResponse.cpp.

References G_NROI.

GLATResponse & GLATResponse::operator= ( const GLATResponse rsp)

Assignment operator.

Parameters
[in]rspResponse.
Returns
Response.

Definition at line 137 of file GLATResponse.cpp.

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

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

Print Fermi-LAT response information.

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

Implements GResponse.

Definition at line 757 of file GLATResponse.cpp.

References m_aeff, m_edisp, m_psf, m_ptsrc, m_rspname, gammalib::parformat(), gammalib::reduce(), SILENT, size(), and TERSE.

Referenced by GLATObservation::print().

GLATPsf * GLATResponse::psf ( const int &  index) const

Return pointer on point spread function.

Parameters
[in]indexResponse index (starting from 0).

Definition at line 718 of file GLATResponse.cpp.

References G_PSF, and m_psf.

Referenced by irf(), load(), and GLATMeanPsf::set().

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

Return response name.

Returns
Response name.

Definition at line 177 of file GLATResponse.hpp.

References m_rspname.

Referenced by GLATObservation::write().

void GLATResponse::save ( const std::string &  rspname) const

Save Fermi LAT response in calibration database.

Parameters
[in]rspnameResponse name.
Todo:
Not yet implemented.

Definition at line 687 of file GLATResponse.cpp.

int GLATResponse::size ( void  ) const
inline

Return number of event types.

Returns
Number of event types.

Returns the number of events types in this reponse.

Definition at line 165 of file GLATResponse.hpp.

References m_aeff.

Referenced by print(), and GLATMeanPsf::set().

bool GLATResponse::use_edisp ( void  ) const
inlinevirtual

Signal if response uses energy dispersion.

Returns
True if response uses energy dispersion.

Implements GResponse.

Definition at line 139 of file GLATResponse.hpp.

bool GLATResponse::use_tdisp ( void  ) const
inlinevirtual

Signal if response uses time dispersion.

Returns
True if response uses time dispersion.

Implements GResponse.

Definition at line 151 of file GLATResponse.hpp.

Member Data Documentation

std::vector<GLATAeff*> GLATResponse::m_aeff
private

Effective areas.

Definition at line 114 of file GLATResponse.hpp.

Referenced by aeff(), copy_members(), free_members(), init_members(), load(), print(), and size().

std::vector<GLATEdisp*> GLATResponse::m_edisp
private

Energy dispersions.

Definition at line 116 of file GLATResponse.hpp.

Referenced by copy_members(), edisp(), free_members(), init_members(), load(), and print().

bool GLATResponse::m_force_mean
private

Use mean PSF in any case.

Definition at line 113 of file GLATResponse.hpp.

Referenced by copy_members(), force_mean(), init_members(), and irf().

std::vector<GLATPsf*> GLATResponse::m_psf
private

Point spread functions.

Definition at line 115 of file GLATResponse.hpp.

Referenced by copy_members(), free_members(), init_members(), load(), print(), and psf().

std::vector<GLATMeanPsf*> GLATResponse::m_ptsrc
private

Mean PSFs for point sources.

Definition at line 117 of file GLATResponse.hpp.

Referenced by copy_members(), free_members(), init_members(), irf(), and print().

std::string GLATResponse::m_rspname
private

Name of the instrument response.

Definition at line 112 of file GLATResponse.hpp.

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


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