GammaLib 2.1.0.dev
|
INTEGRAL/SPI instrument response function class. More...
#include <GSPIResponse.hpp>
Public Member Functions | |
GSPIResponse (void) | |
Void constructor. | |
GSPIResponse (const GSPIResponse &rsp) | |
Copy constructor. | |
GSPIResponse (const GFilename &rspname) | |
Response constructor. | |
virtual | ~GSPIResponse (void) |
Destructor. | |
virtual GSPIResponse & | operator= (const GSPIResponse &rsp) |
Assignment operator. | |
virtual void | clear (void) |
Clear instance. | |
virtual GSPIResponse * | clone (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 INTEGRAL/SPI instrument response for a photon. | |
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 INTEGRAL/SPI response information. | |
void | rspname (const GFilename &rspname) |
Set response name. | |
const GFilename & | rspname (void) const |
Get response group file name. | |
bool | is_precomputed (void) const |
Signals if response is precomputed. | |
const double & | energy_keV (void) const |
Return line IRF energy in keV. | |
const double & | dlogE (void) const |
Return logarithmic step size for continuum IRFs. | |
const double & | gamma (void) const |
Return power-law index for continuum IRFs. | |
void | set (const GSPIObservation &obs, const GEnergy &energy=GEnergy()) |
Set response for a specific observation. | |
double | irf_value (const GSkyDir &srcDir, const GSPIEventBin &bin, const int &ireg) const |
Return value of INTEGRAL/SPI instrument response for sky direction and event bin. | |
double | zenith (const int &ipt, const GSkyDir &dir) const |
Return zenith angle of sky direction for pointing in radians. | |
double | azimuth (const int &ipt, const GSkyDir &dir) const |
Return azimuth angle of sky direction for pointing in radians. | |
void | read (const GFits &fits) |
Read SPI response from FITS object. | |
void | write (GFits &fits) const |
Write SPI response into FITS object. | |
void | load (const GFilename &filename) |
Load SPI response from file. | |
void | save (const GFilename &filename, const bool &clobber=false) const |
Save SPI response into file. | |
Public Member Functions inherited from GResponse | |
GResponse (void) | |
Void constructor. | |
GResponse (const GResponse &rsp) | |
Copy constructor. | |
virtual | ~GResponse (void) |
Destructor. | |
virtual GResponse & | operator= (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 GSPIResponse &rsp) |
Copy class members. | |
void | free_members (void) |
Delete class members. | |
void | read_detids (const GFits &fits) |
Read detector identifiers from FITS object. | |
void | read_energies (const GFits &fits) |
Read energies from FITS object. | |
void | write_detids (GFits &fits) const |
Write detector identifiers into FITS object. | |
void | write_energies (GFits &fits) const |
Write energies into FITS object. | |
void | load_irfs (const int ®ion) |
Load Instrument Response Functions. | |
GSkyMap | load_irf (const GFilename &rspname) const |
Load IRF as sky map. | |
GSkyMap | compute_irf (const double &emin, const double &emax) const |
Compute as sky map. | |
void | set_wcs (const GFitsImage *image) |
Set IRF image limits. | |
void | set_detids (const GSPIEventCube *cube) |
Set vector of detector identifiers used by the observation. | |
void | set_cache (const GSPIEventCube *cube) |
Set computation cache. | |
void | irf_vector (const GSPIEventCube *cube, const double &xpix, const double &ypix, const int &ireg, const double *livetimes, GVector *irf) const |
Fill vector of INTEGRAL/SPI instrument response for IRF pixel. | |
int | irf_detid (const int &detid) const |
Convert detector identifier into IRF detector identifier. | |
double | irf_weight (const double &beta, const double &emin, const double &emax) const |
Compute weight of logarithmic energy bin. | |
void | irf_diffuse_map (const GModelSpatialDiffuseMap *diffuse, const GObservation &obs, GVector *irfs, GMatrix *gradients=NULL) const |
Return instrument response to diffuse map sky model. | |
void | irf_init (const GObservation &obs, GSPIResponseIrf *irf) const |
Initialise structure for projection computation of response. | |
void | irf_rot_matrix (const int &ipt, GSPIResponseIrf *irf) const |
Set rotation matrix for pointing. | |
void | irf_skydir (const int &ipt, const int &inx, GSPIResponseIrf *irf) const |
Set sky direction for pointing and IRF pixel index. | |
int | irf_map (const int &idet, const int &ieng, const GSPIResponseIrf *irf) const |
Return map index for detector and energy index. | |
virtual GVector | irf_ptsrc (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const |
Return instrument response to point source sky model. | |
virtual GVector | irf_radial (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const |
Return instrument response to radial source sky model. | |
virtual GVector | irf_elliptical (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const |
Return instrument response to elliptical source sky model. | |
virtual GVector | irf_diffuse (const GModelSky &model, const GObservation &obs, GMatrix *gradients=NULL) const |
Return instrument response to diffuse source sky model. | |
Private Attributes | |
GFilename | m_rspname |
File name of response group. | |
std::vector< int > | m_detids |
Vector of detector IDs. | |
GNodeArray | m_energies |
Node array of IRF energies. | |
GEbounds | m_ebounds |
Energy bounaries of IRF. | |
GSkyMap | m_irfs |
IRFs stored as sky map. | |
double | m_energy_keV |
IRF line energy (optional) | |
double | m_dlogE |
Logarithmic energy step for IRF band. | |
double | m_gamma |
Power-law spectral index for IRF band. | |
std::vector< GSkyDir > | m_spix |
SPI pointing direction. | |
std::vector< double > | m_posang |
Position angle of Y axis (CEL, radians) | |
bool | m_has_wcs |
Has WCS information. | |
double | m_wcs_xmin |
Minimum X value (radians) | |
double | m_wcs_ymin |
Minimum Y value (radians) | |
double | m_wcs_xmax |
Maximum X value (radians) | |
double | m_wcs_ymax |
Maximum Y value (radians) | |
double | m_wcs_xbin |
X value bin size (radians) | |
double | m_wcs_ybin |
Y value bin size (radians) | |
double | m_wcs_xpix_max |
Maximum X pixel index. | |
double | m_wcs_ypix_max |
Maximum Y pixel index. | |
double | m_max_zenith |
Maximum zenith angle (radians) | |
Friends | |
class | spi_radial_kerns_rho |
class | spi_radial_kerns_omega |
class | spi_elliptical_kerns_rho |
class | spi_elliptical_kerns_omega |
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 |
INTEGRAL/SPI instrument response function class.
The INTEGRAL/SPI instrument response function class defines the function that translates from physical quantities to measured quantities.
Definition at line 89 of file GSPIResponse.hpp.
GSPIResponse::GSPIResponse | ( | void | ) |
Void constructor.
Creates an empty INTEGRAL/SPI response.
Definition at line 96 of file GSPIResponse.cpp.
References init_members().
Referenced by clone().
GSPIResponse::GSPIResponse | ( | const GSPIResponse & | rsp | ) |
Copy constructor.
[in] | rsp | INTEGRAL/SPI response. |
Definition at line 133 of file GSPIResponse.cpp.
References copy_members(), and init_members().
|
explicit |
Response constructor.
Constructs an INTEGRAL/SPI response for an observation using a response group filename.
This constructor simply stores the file name of a response group, the actual loading will be done using the set() method.
Definition at line 115 of file GSPIResponse.cpp.
References init_members(), m_rspname, and rspname().
|
virtual |
|
inline |
Return azimuth angle of sky direction for pointing in radians.
[in] | ipt | Pointing index. |
[in] | dir | Sky direction. |
Returns azimuth angle of sky direction for pointing in radians.
Definition at line 374 of file GSPIResponse.hpp.
References azimuth(), m_posang, m_spix, and gammalib::twopi.
Referenced by azimuth(), spi_elliptical_kerns_omega::eval(), spi_radial_kerns_omega::eval(), irf_diffuse_map(), irf_ptsrc(), irf_skydir(), and irf_value().
|
inlinevirtual |
Return class name.
Implements GResponse.
Definition at line 228 of file GSPIResponse.hpp.
|
virtual |
Clear instance.
Clears INTEGRAL/SPI response by resetting all class members to an initial state. Any information that was present before will be lost.
Implements GResponse.
Definition at line 212 of file GSPIResponse.cpp.
References GResponse::free_members(), free_members(), GResponse::init_members(), and init_members().
Referenced by GSPIObservation::init_members().
|
virtual |
Clone instance.
Implements GResponse.
Definition at line 232 of file GSPIResponse.cpp.
References GSPIResponse().
|
private |
Compute as sky map.
[in] | emin | Minimum energy (keV). |
[in] | emax | Maximum energy (keV). |
Compute IRF for an energy band specified by an energy interval. If the width of the energy interval is zero a line IRF will be computed.
Definition at line 1234 of file GSPIResponse.cpp.
References GNodeArray::inx_left(), GNodeArray::inx_right(), irf(), irf_weight(), gammalib::ln10, m_dlogE, m_energies, m_gamma, m_irfs, GSkyMap::npix(), GNodeArray::set_value(), GSkyMap::shape(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().
Referenced by set().
|
private |
Copy class members.
[in] | rsp | INTEGRAL/SPI response function. |
Definition at line 779 of file GSPIResponse.cpp.
References m_detids, m_dlogE, m_ebounds, m_energies, m_energy_keV, m_gamma, m_has_wcs, m_irfs, m_max_zenith, m_posang, m_rspname, m_spix, m_wcs_xbin, m_wcs_xmax, m_wcs_xmin, m_wcs_xpix_max, m_wcs_ybin, m_wcs_ymax, m_wcs_ymin, and m_wcs_ypix_max.
Referenced by GSPIResponse(), and operator=().
|
inline |
Return logarithmic step size for continuum IRFs.
Returns the logarithmic step size for the computation of continuum IRFs.
Definition at line 328 of file GSPIResponse.hpp.
References m_dlogE.
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 457 of file GSPIResponse.cpp.
References ebounds(), and G_EBOUNDS.
Referenced by ebounds().
|
inline |
Return line IRF energy in keV.
Returns the energy in keV for a line IRF. If the IRF is a continuum IRF the method returns 0.
Definition at line 314 of file GSPIResponse.hpp.
References m_energy_keV.
Referenced by GSPIObservation::write().
|
private |
Delete class members.
Definition at line 813 of file GSPIResponse.cpp.
Referenced by clear(), operator=(), and ~GSPIResponse().
|
inline |
Return power-law index for continuum IRFs.
Returns the power-law index for the computation of continuum IRFs.
Definition at line 342 of file GSPIResponse.hpp.
References m_gamma.
|
private |
Initialise class members.
Definition at line 743 of file GSPIResponse.cpp.
References GEbounds::clear(), GFilename::clear(), GNodeArray::clear(), GSkyMap::clear(), gammalib::deg2rad, m_detids, m_dlogE, m_ebounds, m_energies, m_energy_keV, m_gamma, m_has_wcs, m_irfs, m_max_zenith, m_posang, m_rspname, m_spix, m_wcs_xbin, m_wcs_xmax, m_wcs_xmin, m_wcs_xpix_max, m_wcs_ybin, m_wcs_ymax, m_wcs_ymin, and m_wcs_ypix_max.
Referenced by clear(), GSPIResponse(), GSPIResponse(), GSPIResponse(), and operator=().
|
virtual |
Return value of INTEGRAL/SPI instrument response for a photon.
[in] | event | Observed event. |
[in] | photon | Incident photon. |
[in] | obs | Observation. |
GException::invalid_argument | Observation is not a INTEGRAL/SPI observation. |
Returns the instrument response function for a given observed photon direction as function of the assumed true photon direction. The result is given by
\[ R(p'|p) = \]
Write down formula
Describe in detail how the response is computed.
Implements GResponse.
Definition at line 260 of file GSPIResponse.cpp.
References GPhoton::dir(), GEvents::ebounds(), GPhoton::energy(), GObservation::events(), G_IRF, GSPIEventBin::iebin(), irf(), irf_value(), gammalib::is_infinite(), gammalib::is_notanumber(), and GSPIEventBin::livetime().
Referenced by compute_irf(), irf(), irf_diffuse(), irf_elliptical(), irf_init(), irf_map(), irf_radial(), irf_rot_matrix(), irf_skydir(), irf_value(), irf_vector(), load_irf(), load_irfs(), and set().
|
private |
Convert detector identifier into IRF detector identifier.
[in] | detid | SPI event detector identifier. |
Converts a SPI event detector identifier into an IRF detector identifier. TODO: Describe how this is done and why
Definition at line 1613 of file GSPIResponse.cpp.
References irf_detid().
Referenced by irf_detid(), irf_init(), irf_value(), irf_vector(), and set_detids().
|
privatevirtual |
Return instrument response to diffuse source sky model.
[in] | model | Sky model. |
[in] | obs | Observation. |
[in] | gradients | Gradients matrix. |
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 and that the events in the observation are of type GSPIEventCube. No checking of these assumptions is performed by the method, and not respecting the assumptions will results in a segfault.
The computation is performed by projecting for each pointing the IRF pattern on the sky, and by evaluating the diffuse model at each IRF pixel.
Reimplemented from GResponse.
Definition at line 2203 of file GSPIResponse.cpp.
References GModelSpatialDiffuse::eval(), GObservation::events(), gammalib::get_current_clock(), irf(), GResponse::irf_diffuse(), irf_diffuse_map(), irf_init(), irf_map(), irf_rot_matrix(), irf_skydir(), GSPIEventCube::m_energy, m_irfs, GSPIEventCube::m_livetime, GSPIEventCube::m_num_det, GSPIEventCube::m_num_ebin, GSPIEventCube::m_num_pt, GModel::name(), GEvents::size(), and GModelSky::spatial().
|
private |
Return instrument response to diffuse map sky model.
[in] | diffuse | Pointer to diffuse map spatial model. |
[in] | obs | Observation. |
[out] | irfs | Pointer to IRF vector. |
[in] | gradients | Gradients matrix. |
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 GModelSpatialDiffuseMap and that the events in the observation are of type GSPIEventCube. No checking of these assumptions is performed by the method, and not respecting the assumptions will results in a segfault.
Definition at line 2366 of file GSPIResponse.cpp.
References azimuth(), GObservation::events(), GSkyMap::inx2dir(), irf_vector(), GSPIEventCube::m_livetime, m_max_zenith, GSPIEventCube::m_num_det, GSPIEventCube::m_num_ebin, GSPIEventCube::m_num_pt, m_wcs_xbin, m_wcs_xmin, m_wcs_xpix_max, m_wcs_ybin, m_wcs_ymin, m_wcs_ypix_max, GModelSpatialDiffuseMap::map(), GSkyMap::npix(), GEvents::size(), GSkyMap::solidangle(), and zenith().
Referenced by irf_diffuse().
|
privatevirtual |
Return instrument response to elliptical source sky model.
[in] | model | Sky model. |
[in] | obs | Observation. |
[in] | gradients | Gradients matrix. |
Returns the instrument response to a 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 and that the events in the observation are of type GSPIEventCube. No checking of these assumptions is performed by the method, and not respecting the assumptions will results in a segfault.
The computation is performed by projecting for each pointing the IRF pattern on the sky, and by evaluating the elliptical model at each IRF pixel.
Reimplemented from GResponse.
Definition at line 1979 of file GSPIResponse.cpp.
References GModelSpatialElliptical::coordsys(), GSkyDir::dec_deg(), GModelSpatialElliptical::dir(), GSkyDir::dist(), GMatrix::eulery(), GMatrix::eulerz(), GModelSpatialElliptical::eval(), GObservation::events(), GIntegrals::fixed_iter(), gammalib::get_current_clock(), irf(), irf_init(), irf_map(), irf_rot_matrix(), irf_skydir(), m_irfs, GSPIEventCube::m_livetime, m_max_zenith, GSPIEventCube::m_num_det, GSPIEventCube::m_num_ebin, GSPIEventCube::m_num_pt, GSkyDir::posang(), GSkyDir::ra_deg(), GIntegrals::romberg(), GEvents::size(), GModelSky::spatial(), GModelSpatialElliptical::theta_max(), and zenith().
|
private |
Initialise structure for projection computation of response.
[in] | obs | Observation. |
[out] | irf | Stucture for projection computation of response. |
The method initialises the irf
structure that is needed for the projection computations of the response. The method initialises the following members of the structure:
nevents : Number of events in observation nirf : Number of IRFs in observation nx : Number of pixels in x direction of IRF ny : Number of pixels in y direction of IRF nxy : Number of pixels of IRF ndet : Number of detectors in IRF nreg : Number of regions in IRF ireg : Used IRF region (set to 0, i.e. use photo peak response) detids : Vector of detector indices zero : Vector of booleans flagging IRF pixels that are zero zeniths : Zenith angles for all IRF pixels (radians) sin_zeniths : Sine of zenith angles for all IRF pixels cos_zeniths : Cosine of zenith angles for all IRF pixels azimuths : Azimuth angles for all IRF pixels (radians) solidangle : Solid angles for all IRF pixels
Definition at line 2477 of file GSPIResponse.cpp.
References GObservation::events(), irf(), irf_detid(), GSPIEventCube::m_detid, m_irfs, GSPIEventCube::m_num_det, GSPIEventCube::m_num_ebin, m_wcs_xbin, m_wcs_xmin, m_wcs_ybin, m_wcs_ymin, GSkyMap::nx(), GSkyMap::ny(), GSkyMap::shape(), GEvents::size(), and GSkyMap::solidangle().
Referenced by irf_diffuse(), irf_elliptical(), and irf_radial().
|
inlineprivate |
Return map index for detector and energy index.
[in] | idet | Detector index. |
[in] | ieng | Energy index. |
[in] | irf | Stucture for projection computation of response. |
Returns the map index for a specific detector index idet
and energy index ieng
.
The client needs to make sure that the indices are comprised within the valid ranges and that the GSPIResponse::irf_init() method was called prior to invoking this method.
Definition at line 400 of file GSPIResponse.hpp.
References irf().
Referenced by irf_diffuse(), irf_elliptical(), and irf_radial().
|
privatevirtual |
Return instrument response to point source sky model.
[in] | model | Sky model. |
[in] | obs | Observation. |
[in] | gradients | Gradients matrix. |
Returns the instrument response to a point 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 GModelSpatialPointSource and that the events in the observation are of type GSPIEventCube. No checking of these assumptions is performed by the method, and not respecting the assumptions will results in a segfault.
Reimplemented from GResponse.
Definition at line 1678 of file GSPIResponse.cpp.
References azimuth(), GModelSpatialPointSource::dir(), GObservation::events(), irf_vector(), GSPIEventCube::m_livetime, m_max_zenith, GSPIEventCube::m_num_det, GSPIEventCube::m_num_ebin, GSPIEventCube::m_num_pt, m_wcs_xbin, m_wcs_xmin, m_wcs_xpix_max, m_wcs_ybin, m_wcs_ymin, m_wcs_ypix_max, GEvents::size(), GModelSky::spatial(), and zenith().
|
privatevirtual |
Return instrument response to radial source sky model.
[in] | model | Sky model. |
[in] | obs | Observation. |
[in] | gradients | Gradients matrix. |
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 and that the events in the observation are of type GSPIEventCube. No checking of these assumptions is performed by the method, and not respecting the assumptions will results in a segfault.
The computation is performed by projecting for each pointing the IRF pattern on the sky, and by evaluating the radial model at each IRF pixel.
Reimplemented from GResponse.
Definition at line 1757 of file GSPIResponse.cpp.
References GSkyDir::dec_deg(), GModelSpatialRadial::dir(), GSkyDir::dist(), GMatrix::eulery(), GMatrix::eulerz(), GModelSpatialRadial::eval(), GObservation::events(), GIntegrals::fixed_iter(), gammalib::get_current_clock(), irf(), irf_init(), irf_map(), irf_rot_matrix(), irf_skydir(), m_irfs, GSPIEventCube::m_livetime, m_max_zenith, GSPIEventCube::m_num_det, GSPIEventCube::m_num_ebin, GSPIEventCube::m_num_pt, GSkyDir::ra_deg(), GIntegrals::romberg(), GEvents::size(), GModelSky::spatial(), GModelSpatialRadial::theta_max(), and zenith().
|
private |
Set rotation matrix for pointing.
[in] | ipt | Pointing index. |
[in,out] | irf | Stucture for projection computation of response. |
Sets the rotation matrix for the pointing with index ipt
in the irf
structure that allows rotation from the IRF coordinate system to the celestial coordinate system. The method sets the following member of the irf
structure:
rot : Rotation matrix
The client needs to make sure that the pointing index is comprised within the valid range and that the GSPIResponse::irf_init() method was called prior to invoking this method.
Definition at line 2569 of file GSPIResponse.cpp.
References GMatrix::eulery(), GMatrix::eulerz(), irf(), and m_spix.
Referenced by irf_diffuse(), irf_elliptical(), and irf_radial().
|
private |
Set sky direction for pointing and IRF pixel index.
[in] | ipt | Pointing index. |
[in] | inx | IRF pixel index. |
[in,out] | irf | Stucture for projection computation of response. |
Set the sky direction of the IRF pixel index inx
for a given pointing index ipt
. The method makes use of the rotation matrix that needs to be computed before by the GSPIResponse::irf_rot_matrix() method. The method sets the following member of the irf
structure:
dir : Sky direction
The client needs to make sure that the pointing index and thr IRF pixel index is comprised within the valid ranges and that the GSPIResponse::irf_init() and GSPIResponse::irf_rot_matrix() methods were called prior to invoking this method.
Definition at line 2607 of file GSPIResponse.cpp.
References azimuth(), irf(), m_posang, m_wcs_xbin, m_wcs_xmin, m_wcs_ybin, m_wcs_ymin, and zenith().
Referenced by irf_diffuse(), irf_elliptical(), and irf_radial().
double GSPIResponse::irf_value | ( | const GSkyDir & | srcDir, |
const GSPIEventBin & | bin, | ||
const int & | ireg ) const |
Return value of INTEGRAL/SPI instrument response for sky direction and event bin.
[in] | srcDir | Sky direction. |
[in] | bin | INTEGRAL/SPI event bin. |
[in] | ireg | IRF region (0 = photo peak). |
Returns the instrument response function for a given sky direction and event bin. The value of the IRF is bilinearly interpolated from the pre-computed IRFs cube that is stored in the class.
Definition at line 340 of file GSPIResponse.cpp.
References azimuth(), GSPIInstDir::detid(), GSPIEventBin::dir(), GSPIEventBin::iebin(), GSPIEventBin::ipt(), irf(), irf_detid(), m_irfs, m_max_zenith, m_wcs_xbin, m_wcs_xmin, m_wcs_xpix_max, m_wcs_ybin, m_wcs_ymin, m_wcs_ypix_max, GSkyMap::nx(), GSkyMap::shape(), and zenith().
Referenced by irf().
|
private |
Fill vector of INTEGRAL/SPI instrument response for IRF pixel.
[in] | cube | Pointer to event cube. |
[in] | xpix | Response pixel in X direction. |
[in] | ypix | Response pixel in Y direction. |
[in] | ireg | IRF region (0 = photo peak). |
[in] | livetimes | livetimes Pointer to livetime array (dimension m_num_det). |
[out] | irf | Response vector. |
Computes a response vector for all detectors and energy bins for a given response pixel defined by xpix
and ypix
, where
xpix = (zenith * std::cos(azimuth) - m_wcs_xmin) / m_wcs_xbin ypix = (zenith * std::sin(azimuth) - m_wcs_ymin) / m_wcs_ybin
Checking of the validity of xpix
and ypix
needs to be done by the client, makeing sure that
xpix > 0.0 && xpix < m_wcs_xpix_max && ypix > 0.0 && ypix < m_wcs_ypix_max
The client needs also to make sure that a vector with dimensions
m_num_det*m_num_ebin
is provided, and the method will fill all elements of the vector.
Definition at line 1521 of file GSPIResponse.cpp.
References irf(), irf_detid(), GSPIEventCube::m_detid, m_irfs, GSPIEventCube::m_num_det, GSPIEventCube::m_num_ebin, GSkyMap::nx(), and GSkyMap::shape().
Referenced by spi_elliptical_kerns_omega::eval(), spi_radial_kerns_omega::eval(), irf_diffuse_map(), and irf_ptsrc().
|
private |
Compute weight of logarithmic energy bin.
[in] | beta | 1-gamma. |
[in] | emin | Logarithmic minimum energy. |
[in] | emax | Logarithmic maximum energy. |
Definition at line 1641 of file GSPIResponse.cpp.
References gammalib::ln10.
Referenced by compute_irf().
|
inline |
Signals if response is precomputed.
Signals if the response was precomputed.
Definition at line 299 of file GSPIResponse.hpp.
References GEbounds::is_empty(), and m_ebounds.
void GSPIResponse::load | ( | const GFilename & | filename | ) |
Load SPI response from file.
[in] | filename | Response file name. |
Loads SPI response from response file.
Definition at line 628 of file GSPIResponse.cpp.
References GFits::close(), and read().
Referenced by GSPIObservation::read().
Load IRF as sky map.
[in] | irfname | IRF file name. |
Loads an IRF FITS file as a sky map. The sky map is returned in ARC projection that is a zenith equidistant projection, which is the projection that is natively used to store the IRFs.
Definition at line 1021 of file GSPIResponse.cpp.
References GFits::close(), gammalib::deg2rad, G_LOAD_IRF, GFits::image(), GFitsHDU::integer(), irf(), m_has_wcs, m_max_zenith, m_wcs_xbin, m_wcs_xmax, m_wcs_xmin, m_wcs_xpix_max, m_wcs_ybin, m_wcs_ymax, m_wcs_ymin, m_wcs_ypix_max, GFitsImage::pixel(), GFitsHDU::real(), and GFilename::url().
Referenced by load_irfs().
|
private |
Load Instrument Response Functions.
[in] | region | IRF region (-1 = load all regions) |
The method requires that the required detector identifiers were previously setup using the set_detids() method.
Definition at line 1128 of file GSPIResponse.cpp.
References GNodeArray::append(), GNodeArray::clear(), GSkyMap::clear(), GFits::close(), G_LOAD_IRFS, irf(), load_irf(), m_detids, m_energies, m_irfs, m_rspname, GSkyMap::nmaps(), GFilename::path(), GSkyMap::shape(), gammalib::spi_hdu(), gammalib::spi_num_hdus(), and GFilename::url().
Referenced by set().
|
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 431 of file GSPIResponse.cpp.
References G_NROI.
|
virtual |
Assignment operator.
[in] | rsp | INTEGRAL/SPI response. |
Assign INTEGRAL/SPI response to this object. The assignment performs a deep copy of all information, hence the original object from which the assignment was made can be destroyed after this operation without any loss of information.
Definition at line 176 of file GSPIResponse.cpp.
References copy_members(), free_members(), init_members(), and GResponse::operator=().
Print INTEGRAL/SPI response information.
[in] | chatter | Chattiness. |
Implements GResponse.
Definition at line 677 of file GSPIResponse.cpp.
References m_dlogE, m_energy_keV, m_gamma, m_irfs, m_max_zenith, m_rspname, m_wcs_xmax, m_wcs_xmin, m_wcs_ymax, m_wcs_ymin, GSkyMap::nx(), GSkyMap::ny(), gammalib::parformat(), gammalib::rad2deg, GSkyMap::shape(), SILENT, gammalib::str(), and GFilename::url().
Referenced by GSPIObservation::print().
void GSPIResponse::read | ( | const GFits & | fits | ) |
Read SPI response from FITS object.
[in] | fits | FITS object. |
Reads the SPI response from FITS object.
Definition at line 576 of file GSPIResponse.cpp.
References GFits::image(), m_irfs, GSkyMap::read(), read_detids(), read_energies(), and set_wcs().
Referenced by load().
|
private |
Read detector identifiers from FITS object.
[in] | fits | FITS object. |
Read the detector identifiers from a FITS file into the m_detids member.
Definition at line 827 of file GSPIResponse.cpp.
References GFitsTableCol::integer(), m_detids, GFitsTable::nrows(), and GFits::table().
Referenced by read().
|
private |
Read energies from FITS object.
[in] | fits | FITS object. |
Read the energies from a FITS file. If the FITS file contains energy boundaries then read them, otherwise read the energy vector.
Definition at line 860 of file GSPIResponse.cpp.
References GNodeArray::append(), GEbounds::clear(), GNodeArray::clear(), GFits::contains(), gammalib::extname_ebounds, gammalib::extname_energies, GFitsHDU::has_card(), GEnergy::keV(), m_dlogE, m_ebounds, m_energies, m_energy_keV, m_gamma, GFitsTable::nrows(), GEbounds::read(), GFitsHDU::real(), GFitsTableCol::real(), GNodeArray::reserve(), GFitsHDU::string(), and GFits::table().
Referenced by read().
|
inline |
Set response name.
[in] | rspname | Response group file name. |
Sets the response group file name.
Definition at line 270 of file GSPIResponse.hpp.
References m_rspname, and rspname().
Referenced by GSPIObservation::read(), and GSPIObservation::write().
|
inline |
Get response group file name.
Returns the response group file name.
Definition at line 285 of file GSPIResponse.hpp.
References m_rspname.
Referenced by GSPIResponse(), and rspname().
void GSPIResponse::save | ( | const GFilename & | filename, |
const bool & | clobber = false ) const |
Save SPI response into file.
[in] | filename | Response file name. |
[in] | clobber | Overwrite existing FITS file? |
Saves SPI response into response file.
Definition at line 652 of file GSPIResponse.cpp.
References GFits::close(), GFits::saveto(), and write().
void GSPIResponse::set | ( | const GSPIObservation & | obs, |
const GEnergy & | energy = GEnergy() ) |
Set response for a specific observation.
[in] | obs | INTEGRAL/SPI observation. |
[in] | energy | Line energy |
Sets the response for a specific INTEGRAL/SPI observation. This is the high-level method for loading and pre-computing SPI IRFs for a specific energy binning. The method loads the IRF from a response group file and pre-computes the IRFs for all energy bins of the SPI observation. If energy
is positive, IRFs will be pre-computed taking a line energy specified by energy
, otherwise the IRFs will be pre-computed taking the energy interval of the energy bins (continuum IRFs).
Definition at line 485 of file GSPIResponse.cpp.
References GEbounds::append(), GEbounds::clear(), GNodeArray::clear(), GSkyMap::clear(), compute_irf(), GEvents::ebounds(), GObservation::events(), irf(), GEnergy::keV(), load_irfs(), m_detids, m_ebounds, m_energies, m_energy_keV, m_has_wcs, m_irfs, GSPIEventCube::naxis(), GSkyMap::nmaps(), GSkyMap::npix(), set_cache(), set_detids(), and GSkyMap::shape().
Referenced by GSPIObservation::read().
|
private |
Set computation cache.
[in] | cube | INTEGRAL/SPI event cube. |
Setup of two vectors for fast coordinate transformation into the instrument system. The first vector m_spix stores the SPI pointing direction (the X direction) while the second vector stores the position angle in celestial coordinates of the SPI Y direction.
Definition at line 1466 of file GSPIResponse.cpp.
References m_posang, m_spix, GSPIEventCube::naxis(), gammalib::pihalf, GSkyDir::posang(), GSPIEventCube::spi_x(), and GSPIEventCube::spi_z().
Referenced by set().
|
private |
Set vector of detector identifiers used by the observation.
[in] | cube | INTEGRAL/SPI event cube. |
Sets the vector of detector identifiers that is used by the observation. The method scans the detector identifiers for all pointings and builds a vector of unique detector identifiers in the order they were encountered in the event cube.
Definition at line 1426 of file GSPIResponse.cpp.
References GSPIInstDir::detid(), GSPIEventCube::dir(), irf_detid(), m_detids, and GSPIEventCube::naxis().
Referenced by set().
|
private |
Set IRF image limits.
[in] | image | IRF FITS image. |
Computes the IRF image limits.
Definition at line 1380 of file GSPIResponse.cpp.
References gammalib::deg2rad, GFitsHDU::integer(), m_has_wcs, m_max_zenith, m_wcs_xbin, m_wcs_xmax, m_wcs_xmin, m_wcs_xpix_max, m_wcs_ybin, m_wcs_ymax, m_wcs_ymin, m_wcs_ypix_max, and GFitsHDU::real().
Referenced by read().
|
inlinevirtual |
Signal if energy dispersion will be used.
Implements GResponse.
Definition at line 242 of file GSPIResponse.hpp.
|
inlinevirtual |
Signal if time dispersion will be used.
Implements GResponse.
Definition at line 256 of file GSPIResponse.hpp.
void GSPIResponse::write | ( | GFits & | fits | ) | const |
Write SPI response into FITS object.
[in,out] | fits | FITS object. |
Writes the SPI response into FITS object.
Definition at line 605 of file GSPIResponse.cpp.
References m_irfs, GSkyMap::write(), write_detids(), and write_energies().
Referenced by save().
|
private |
Write detector identifiers into FITS object.
[in,out] | fits | FITS object. |
Writes the detector identifiers stored into the m_detids member into a FITS object.
Definition at line 929 of file GSPIResponse.cpp.
References GFits::append(), GFitsTable::append(), GFitsHDU::extname(), and m_detids.
Referenced by write().
|
private |
Write energies into FITS object.
[in,out] | fits | FITS object. |
Writes the energy nodes stored into the m_energies member into a FITS object. The energies are written in units of keV.
Definition at line 963 of file GSPIResponse.cpp.
References GFits::append(), GFitsTable::append(), GFitsHDU::card(), GFitsHDU::extname(), gammalib::extname_ebounds, gammalib::extname_energies, GEbounds::is_empty(), m_dlogE, m_ebounds, m_energies, m_energy_keV, m_gamma, GNodeArray::size(), GFits::table(), GFitsTableCol::unit(), and GEbounds::write().
Referenced by write().
|
inline |
Return zenith angle of sky direction for pointing in radians.
[in] | ipt | Pointing index. |
[in] | dir | Sky direction. |
Returns zenith angle of sky direction for pointing in radians.
Definition at line 358 of file GSPIResponse.hpp.
References m_spix.
Referenced by spi_elliptical_kerns_omega::eval(), spi_radial_kerns_omega::eval(), irf_diffuse_map(), irf_elliptical(), irf_ptsrc(), irf_radial(), irf_skydir(), and irf_value().
|
friend |
Definition at line 95 of file GSPIResponse.hpp.
|
friend |
Definition at line 94 of file GSPIResponse.hpp.
|
friend |
Definition at line 93 of file GSPIResponse.hpp.
|
friend |
Definition at line 92 of file GSPIResponse.hpp.
|
private |
Vector of detector IDs.
Definition at line 198 of file GSPIResponse.hpp.
Referenced by copy_members(), init_members(), load_irfs(), read_detids(), set(), set_detids(), and write_detids().
|
private |
Logarithmic energy step for IRF band.
Definition at line 203 of file GSPIResponse.hpp.
Referenced by compute_irf(), copy_members(), dlogE(), init_members(), print(), read_energies(), and write_energies().
|
private |
Energy bounaries of IRF.
Definition at line 200 of file GSPIResponse.hpp.
Referenced by copy_members(), init_members(), is_precomputed(), read_energies(), set(), and write_energies().
|
private |
Node array of IRF energies.
Definition at line 199 of file GSPIResponse.hpp.
Referenced by compute_irf(), copy_members(), init_members(), load_irfs(), read_energies(), set(), and write_energies().
|
private |
IRF line energy (optional)
Definition at line 202 of file GSPIResponse.hpp.
Referenced by copy_members(), energy_keV(), init_members(), print(), read_energies(), set(), and write_energies().
|
private |
Power-law spectral index for IRF band.
Definition at line 204 of file GSPIResponse.hpp.
Referenced by compute_irf(), copy_members(), gamma(), init_members(), print(), read_energies(), and write_energies().
|
mutableprivate |
Has WCS information.
Definition at line 209 of file GSPIResponse.hpp.
Referenced by copy_members(), init_members(), load_irf(), set(), and set_wcs().
|
private |
IRFs stored as sky map.
Definition at line 201 of file GSPIResponse.hpp.
Referenced by compute_irf(), copy_members(), init_members(), irf_diffuse(), irf_elliptical(), irf_init(), irf_radial(), irf_value(), irf_vector(), load_irfs(), print(), read(), set(), and write().
|
mutableprivate |
Maximum zenith angle (radians)
Definition at line 218 of file GSPIResponse.hpp.
Referenced by copy_members(), init_members(), irf_diffuse_map(), irf_elliptical(), irf_ptsrc(), irf_radial(), irf_value(), load_irf(), print(), and set_wcs().
|
private |
Position angle of Y axis (CEL, radians)
Definition at line 208 of file GSPIResponse.hpp.
Referenced by azimuth(), copy_members(), init_members(), irf_skydir(), and set_cache().
|
private |
File name of response group.
Definition at line 197 of file GSPIResponse.hpp.
Referenced by copy_members(), GSPIResponse(), init_members(), load_irfs(), print(), rspname(), and rspname().
|
private |
SPI pointing direction.
Definition at line 207 of file GSPIResponse.hpp.
Referenced by azimuth(), copy_members(), init_members(), irf_rot_matrix(), set_cache(), and zenith().
|
mutableprivate |
X value bin size (radians)
Definition at line 214 of file GSPIResponse.hpp.
Referenced by copy_members(), spi_elliptical_kerns_omega::eval(), spi_radial_kerns_omega::eval(), init_members(), irf_diffuse_map(), irf_init(), irf_ptsrc(), irf_skydir(), irf_value(), load_irf(), and set_wcs().
|
mutableprivate |
Maximum X value (radians)
Definition at line 212 of file GSPIResponse.hpp.
Referenced by copy_members(), init_members(), load_irf(), print(), and set_wcs().
|
mutableprivate |
Minimum X value (radians)
Definition at line 210 of file GSPIResponse.hpp.
Referenced by copy_members(), spi_elliptical_kerns_omega::eval(), spi_radial_kerns_omega::eval(), init_members(), irf_diffuse_map(), irf_init(), irf_ptsrc(), irf_skydir(), irf_value(), load_irf(), print(), and set_wcs().
|
mutableprivate |
Maximum X pixel index.
Definition at line 216 of file GSPIResponse.hpp.
Referenced by copy_members(), init_members(), irf_diffuse_map(), irf_ptsrc(), irf_value(), load_irf(), and set_wcs().
|
mutableprivate |
Y value bin size (radians)
Definition at line 215 of file GSPIResponse.hpp.
Referenced by copy_members(), spi_elliptical_kerns_omega::eval(), spi_radial_kerns_omega::eval(), init_members(), irf_diffuse_map(), irf_init(), irf_ptsrc(), irf_skydir(), irf_value(), load_irf(), and set_wcs().
|
mutableprivate |
Maximum Y value (radians)
Definition at line 213 of file GSPIResponse.hpp.
Referenced by copy_members(), init_members(), load_irf(), print(), and set_wcs().
|
mutableprivate |
Minimum Y value (radians)
Definition at line 211 of file GSPIResponse.hpp.
Referenced by copy_members(), spi_elliptical_kerns_omega::eval(), spi_radial_kerns_omega::eval(), init_members(), irf_diffuse_map(), irf_init(), irf_ptsrc(), irf_skydir(), irf_value(), load_irf(), print(), and set_wcs().
|
mutableprivate |
Maximum Y pixel index.
Definition at line 217 of file GSPIResponse.hpp.
Referenced by copy_members(), init_members(), irf_diffuse_map(), irf_ptsrc(), irf_value(), load_irf(), and set_wcs().