GammaLib
2.1.0.dev
|
Fermi/LAT Response class. More...
#include <GLATResponse.hpp>
Public Member Functions | |
GLATResponse (void) | |
Void constructor. More... | |
GLATResponse (const GLATResponse &rsp) | |
Copy constructor. More... | |
virtual | ~GLATResponse (void) |
Destructor. More... | |
GLATResponse & | operator= (const GLATResponse &rsp) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear response. More... | |
virtual GLATResponse * | clone (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 | 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... | |
virtual double | irf_spatial (const GEvent &event, const GSource &source, const GObservation &obs) const |
Return value of model instrument response function. 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... | |
GLATAeff * | aeff (const int &index) const |
Return pointer on effective area. More... | |
GLATPsf * | psf (const int &index) const |
Return pointer on point spread function. More... | |
GLATEdisp * | edisp (const int &index) const |
Return pointer on energy dispersion. More... | |
double | irf_spatial_atom (const GLATEventAtom &event, const GSource &source, const GObservation &obs) const |
Return value of model IRF for event atom. More... | |
double | irf_spatial_bin (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 GResponse & | operator= (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 GLATResponse &rsp) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
virtual double | irf_ptsrc (const GEvent &event, const GSource &source, const GObservation &obs) const |
Return instrument response to point source. More... | |
virtual double | irf_diffuse (const GEvent &event, const GSource &source, const GObservation &obs) const |
Return instrument response to diffuse source. 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... | |
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_radial (const GEvent &event, const GSource &source, const GObservation &obs) const |
Return instrument response to radial source. More... | |
virtual double | irf_elliptical (const GEvent &event, const GSource &source, const GObservation &obs) const |
Return instrument response to elliptical source. 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_radial (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const |
Return instrument response to radial 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 |
Fermi/LAT Response class.
Definition at line 56 of file GLATResponse.hpp.
GLATResponse::GLATResponse | ( | void | ) |
Void constructor.
Definition at line 85 of file GLATResponse.cpp.
References init_members().
Referenced by clone().
GLATResponse::GLATResponse | ( | const GLATResponse & | rsp | ) |
Copy constructor.
[in] | rsp | Response. |
Definition at line 100 of file GLATResponse.cpp.
References copy_members(), and init_members().
|
virtual |
GLATAeff * GLATResponse::aeff | ( | const int & | index | ) | const |
Return pointer on effective area.
[in] | index | Response index [0,...,m_aeff.size()-1]. |
Definition at line 713 of file GLATResponse.cpp.
References G_AEFF, and m_aeff.
Referenced by load(), and GLATMeanPsf::set().
|
inlinevirtual |
Return class name.
Implements GResponse.
Definition at line 137 of file GLATResponse.hpp.
|
virtual |
Clear response.
Implements GResponse.
Definition at line 171 of file GLATResponse.cpp.
References free_members(), GResponse::free_members(), init_members(), and GResponse::init_members().
Referenced by GLATObservation::init_members(), load(), and GLATObservation::response().
|
virtual |
Clone response.
Implements GResponse.
Definition at line 191 of file GLATResponse.cpp.
References GLATResponse().
|
private |
Copy class members.
[in] | rsp | Response. |
Definition at line 839 of file GLATResponse.cpp.
References m_aeff, m_edisp, m_force_mean, m_psf, m_ptsrc, and m_rspname.
Referenced by GLATResponse(), and operator=().
Return true energy boundaries for a specific observed energy.
[in] | obsEnergy | Observed Energy. |
GException::feature_not_implemented | Method is not implemented. |
Implements GResponse.
Definition at line 541 of file GLATResponse.cpp.
References G_EBOUNDS.
GLATEdisp * GLATResponse::edisp | ( | const int & | index | ) | const |
Return pointer on energy dispersion.
[in] | index | Response index [0,...,m_edisp.size()-1]. |
Definition at line 753 of file GLATResponse.cpp.
References G_EDISP, and m_edisp.
Referenced by load().
|
inline |
Signal if mean PSF should be used for response computation.
Definition at line 199 of file GLATResponse.hpp.
References m_force_mean.
|
inline |
Set if mean PSF should be used for response computation.
[in] | value | True if mean PSF should be used for response computation. |
Definition at line 211 of file GLATResponse.hpp.
References m_force_mean.
|
private |
Delete class members.
Definition at line 877 of file GLATResponse.cpp.
References m_aeff, m_edisp, m_psf, and m_ptsrc.
Referenced by clear(), operator=(), and ~GLATResponse().
|
private |
Initialise class members.
Definition at line 819 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=().
|
virtual |
Return value of point source IRF.
[in] | event | Observed event. |
[in] | photon | Incident photon. |
[in] | obs | Observation. |
GException::invalid_argument | Instrument direction is not a valid LAT instrument direction. |
Implements GResponse.
Definition at line 210 of file GLATResponse.cpp.
References GSkyDir::dec_deg(), GPhoton::dir(), GLATInstDir::dir(), GEvent::dir(), GPhoton::energy(), G_IRF, GEnergy::log10MeV(), m_ptsrc, GLATMeanPsf::name(), psf(), GSkyDir::ra_deg(), and gammalib::str().
Referenced by irf_diffuse(), irf_ptsrc(), and irf_spatial_atom().
|
privatevirtual |
Return instrument response to diffuse source.
[in] | event | Observed event. |
[in] | source | Source. |
[in] | obs | Observation. |
Returns the instrument response to a diffuse source.
Reimplemented from GResponse.
Definition at line 952 of file GLATResponse.cpp.
References irf(), irf_spatial_atom(), irf_spatial_bin(), and GEvent::is_atom().
|
privatevirtual |
Return instrument response to point source.
[in] | event | Observed event. |
[in] | source | Source. |
[in] | obs | Observation. |
Returns the instrument response to a point source.
Reimplemented from GResponse.
Definition at line 922 of file GLATResponse.cpp.
References irf(), irf_spatial_atom(), irf_spatial_bin(), and GEvent::is_atom().
|
virtual |
Return value of model instrument response function.
[in] | event | Event. |
[in] | source | Source. |
[in] | obs | Observation. |
This method returns the response of the instrument to a specific source model. The method handles both event atoms and event bins.
Reimplemented from GResponse.
Definition at line 284 of file GLATResponse.cpp.
References irf_spatial_atom(), irf_spatial_bin(), and GEvent::is_atom().
double GLATResponse::irf_spatial_atom | ( | const GLATEventAtom & | event, |
const GSource & | source, | ||
const GObservation & | obs | ||
) | const |
Return value of model IRF for event atom.
[in] | event | Event atom. |
[in] | source | Source. |
[in] | obs | Observations. |
GException::feature_not_implemented | Method not yet implemented. |
Definition at line 314 of file GLATResponse.cpp.
References G_IRF_ATOM, and irf().
Referenced by irf_diffuse(), irf_ptsrc(), and irf_spatial().
double GLATResponse::irf_spatial_bin | ( | const GLATEventBin & | event, |
const GSource & | source, | ||
const GObservation & | obs | ||
) | const |
Return value of model IRF for event bin.
[in] | event | Event bin. |
[in] | source | Source. |
[in] | obs | Observation. |
GException::invalid_value | Diffuse 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 GException::invalid_value exception is thrown.
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 354 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().
Referenced by irf_diffuse(), irf_ptsrc(), and irf_spatial().
void GLATResponse::load | ( | const std::string & | rspname | ) |
Load Fermi LAT response from calibration database.
[in] | rspname | Response name. |
GException::invalid_argument | Invalid 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 575 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().
|
virtual |
Return integral of event probability for a given sky model over ROI.
[in] | model | Sky model. |
[in] | obsEng | Observed photon energy. |
[in] | obsTime | Observed photon arrival time. |
[in] | obs | Observation. |
GException::feature_not_implemented | Method is not implemented. |
Implements GResponse.
Definition at line 517 of file GLATResponse.cpp.
References G_NROI.
GLATResponse & GLATResponse::operator= | ( | const GLATResponse & | rsp | ) |
Assignment operator.
[in] | rsp | Response. |
Definition at line 138 of file GLATResponse.cpp.
References copy_members(), free_members(), init_members(), and GResponse::operator=().
Print Fermi-LAT response information.
[in] | chatter | Chattiness. |
Implements GResponse.
Definition at line 774 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.
[in] | index | Response index [0,...,m_psf.size()-1]. |
Definition at line 733 of file GLATResponse.cpp.
Referenced by irf(), irf_spatial_bin(), load(), and GLATMeanPsf::set().
|
inline |
Return response name.
Definition at line 187 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.
[in] | rspname | Response name. |
Definition at line 697 of file GLATResponse.cpp.
References G_SAVE.
|
inline |
Return number of event types.
Returns the number of events types in this reponse.
Definition at line 175 of file GLATResponse.hpp.
References m_aeff.
Referenced by print(), and GLATMeanPsf::set().
|
inlinevirtual |
Signal if response uses energy dispersion.
Implements GResponse.
Definition at line 149 of file GLATResponse.hpp.
|
inlinevirtual |
Signal if response uses time dispersion.
Implements GResponse.
Definition at line 161 of file GLATResponse.hpp.
|
private |
Effective areas.
Definition at line 124 of file GLATResponse.hpp.
Referenced by aeff(), copy_members(), free_members(), init_members(), load(), print(), and size().
|
private |
Energy dispersions.
Definition at line 126 of file GLATResponse.hpp.
Referenced by copy_members(), edisp(), free_members(), init_members(), load(), and print().
|
private |
Use mean PSF in any case.
Definition at line 123 of file GLATResponse.hpp.
Referenced by copy_members(), force_mean(), init_members(), and irf_spatial_bin().
|
private |
Point spread functions.
Definition at line 125 of file GLATResponse.hpp.
Referenced by copy_members(), free_members(), init_members(), load(), print(), and psf().
|
private |
Mean PSFs for point sources.
Definition at line 127 of file GLATResponse.hpp.
Referenced by copy_members(), free_members(), init_members(), irf(), irf_spatial_bin(), and print().
|
private |
Name of the instrument response.
Definition at line 122 of file GLATResponse.hpp.
Referenced by copy_members(), init_members(), load(), print(), and rspname().