GammaLib
2.1.0.dev
|
Fermi/LAT mean PSF class. More...
#include <GLATMeanPsf.hpp>
Public Member Functions | |
GLATMeanPsf (void) | |
Void constructor. More... | |
GLATMeanPsf (const GSkyDir &dir, const GLATObservation &obs) | |
PSF constructor. More... | |
GLATMeanPsf (const GLATMeanPsf &cube) | |
Copy constructor. More... | |
virtual | ~GLATMeanPsf (void) |
Destructor. More... | |
GLATMeanPsf & | operator= (const GLATMeanPsf &cube) |
Assignment operator. More... | |
double | operator() (const double &offset, const double &logE) |
Return mean PSF*exposure value. More... | |
void | clear (void) |
Clear mean PSF. More... | |
GLATMeanPsf * | clone (void) const |
Clone mean PSF. More... | |
std::string | classname (void) const |
Return class name. More... | |
int | size (void) const |
Return number of bins in mean PSF. More... | |
void | set (const GSkyDir &dir, const GLATObservation &obs) |
Compute mean PSF and exposure. More... | |
int | noffsets (void) const |
Return number of offset bins. More... | |
int | nenergies (void) const |
Return number of energy bins. More... | |
const double & | offset (const int &inx) const |
Return offset angle for given bin. More... | |
const double & | energy (const int &inx) const |
Return energy for given bin. More... | |
const GSkyDir & | dir (void) const |
Return sky direction for mean PSF. More... | |
const std::string & | name (void) const |
Return source name for mean PSF. More... | |
void | name (const std::string &name) |
Set source name for mean PSF. More... | |
const double & | thetamax (void) const |
Return maximum theta angle. More... | |
void | thetamax (const double &value) |
Set maximum theta angle. More... | |
double | psf (const double &offset, const double &logE) |
Return mean PSF value. More... | |
double | exposure (const double &logE) |
Return exposure value. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print livetime cube information. 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 GLATMeanPsf &psf) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | set_offsets (void) |
Set array of offset values in degrees. More... | |
void | set_map_corrections (const GLATObservation &obs) |
Compute map corrections. More... | |
double | integral (const double &radmax, const double &logE) |
Compute integral over PSF. More... | |
Private Attributes | |
std::string | m_name |
Source name for mean PSF. More... | |
GSkyDir | m_dir |
Source direction for mean PSF. More... | |
std::vector< double > | m_psf |
Mean PSF values. More... | |
std::vector< double > | m_exposure |
Mean exposure. More... | |
std::vector< double > | m_mapcorr |
Map corrections. More... | |
GNodeArray | m_offset |
Offsets of mean PSF. More... | |
GNodeArray | m_energy |
log10(energy) of mean PSF More... | |
double | m_theta_max |
Maximum inclination angle (default 70 deg) More... | |
double | m_last_energy |
Last requested logE value. More... | |
double | m_last_offset |
Last requested offset value. More... | |
int | m_inx1_exp |
Exposure index 1. More... | |
int | m_inx2_exp |
Exposure index 2. More... | |
int | m_inx1 |
Index 1. More... | |
int | m_inx2 |
Index 2. More... | |
int | m_inx3 |
Index 3. More... | |
int | m_inx4 |
Index 4. More... | |
double | m_wgt1 |
Weighting factor 1. More... | |
double | m_wgt2 |
Weighting factor 2. More... | |
double | m_wgt3 |
Weighting factor 3. More... | |
double | m_wgt4 |
Weighting factor 4. More... | |
Fermi/LAT mean PSF class.
The position-dependent mean PSF is the point spread function that has been averaged over the zenith and azimuth angles of an observation. The averaging is done using the livetime cube which holds the livetime as function and zenith and azimuth angles for an observation.
Definition at line 51 of file GLATMeanPsf.hpp.
GLATMeanPsf::GLATMeanPsf | ( | void | ) |
Void constructor.
Definition at line 68 of file GLATMeanPsf.cpp.
References init_members().
Referenced by clone().
GLATMeanPsf::GLATMeanPsf | ( | const GSkyDir & | dir, |
const GLATObservation & | obs | ||
) |
PSF constructor.
[in] | dir | Sky direction. |
[in] | obs | LAT observation. |
Definition at line 84 of file GLATMeanPsf.cpp.
References init_members(), and set().
GLATMeanPsf::GLATMeanPsf | ( | const GLATMeanPsf & | psf | ) |
Copy constructor.
[in] | psf | Mean PSF. |
Definition at line 102 of file GLATMeanPsf.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 124 of file GLATMeanPsf.hpp.
|
virtual |
Clear mean PSF.
Implements GBase.
Definition at line 260 of file GLATMeanPsf.cpp.
References free_members(), and init_members().
|
virtual |
Clone mean PSF.
Implements GBase.
Definition at line 278 of file GLATMeanPsf.cpp.
References GLATMeanPsf().
|
private |
Copy class members.
[in] | psf | Mean PSF. |
Definition at line 633 of file GLATMeanPsf.cpp.
References m_dir, m_energy, m_exposure, m_inx1, m_inx1_exp, m_inx2, m_inx2_exp, m_inx3, m_inx4, m_last_energy, m_last_offset, m_mapcorr, m_name, m_offset, m_psf, m_theta_max, m_wgt1, m_wgt2, m_wgt3, and m_wgt4.
Referenced by GLATMeanPsf(), and operator=().
|
inline |
Return sky direction for mean PSF.
Definition at line 202 of file GLATMeanPsf.hpp.
References m_dir.
Referenced by set().
|
inline |
Return energy for given bin.
[in] | inx | Bin index [0,...,nenergies()-1] |
Definition at line 190 of file GLATMeanPsf.hpp.
References m_energy.
double GLATMeanPsf::exposure | ( | const double & | logE | ) |
Return exposure value.
[in] | logE | log10 of energy in MeV. |
Computes
\[{\rm exposure}(\log E)\]
by linear interpolation, where \(\log E\) is the logarithm of base 10 of the energy in MeV. A zero value is returned if \(\log E\) is not positive.
Definition at line 498 of file GLATMeanPsf.cpp.
References GNodeArray::inx_left(), GNodeArray::inx_right(), m_energy, m_exposure, m_inx1_exp, m_inx2_exp, GNodeArray::set_value(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().
Referenced by set().
|
private |
Delete class members.
Definition at line 665 of file GLATMeanPsf.cpp.
Referenced by clear(), operator=(), and ~GLATMeanPsf().
|
private |
Initialise class members.
< Maximum zenith angle
Definition at line 596 of file GLATMeanPsf.cpp.
References GNodeArray::clear(), GSkyDir::clear(), m_dir, m_energy, m_exposure, m_inx1, m_inx1_exp, m_inx2, m_inx2_exp, m_inx3, m_inx4, m_last_energy, m_last_offset, m_mapcorr, m_name, m_offset, m_psf, m_theta_max, m_wgt1, m_wgt2, m_wgt3, m_wgt4, and set_offsets().
Referenced by clear(), GLATMeanPsf(), and operator=().
|
private |
Compute integral over PSF.
[in] | offsetmax | Maximum offset angle. |
[in] | logE | log10 of energy in MeV. |
Definition at line 781 of file GLATMeanPsf.cpp.
References gammalib::deg2rad, GNodeArray::inx_left(), GNodeArray::inx_right(), m_energy, m_offset, m_psf, noffsets(), GNodeArray::set_value(), sin(), GNodeArray::size(), gammalib::twopi, GNodeArray::wgt_left(), and GNodeArray::wgt_right().
Referenced by set_map_corrections().
|
inline |
Return source name for mean PSF.
Definition at line 214 of file GLATMeanPsf.hpp.
References m_name.
Referenced by GLATResponse::irf(), GLATResponse::irf_spatial_bin(), name(), and print().
|
inline |
Set source name for mean PSF.
[in] | name | Source name. |
Definition at line 226 of file GLATMeanPsf.hpp.
|
inline |
Return number of energy bins.
Definition at line 164 of file GLATMeanPsf.hpp.
References m_energy, and GNodeArray::size().
Referenced by print().
|
inline |
Return number of offset bins.
Definition at line 152 of file GLATMeanPsf.hpp.
References m_offset, and GNodeArray::size().
Referenced by integral(), operator()(), print(), and psf().
|
inline |
Return offset angle for given bin.
[in] | inx | Bin index [0,...,noffsets()-1] |
Definition at line 177 of file GLATMeanPsf.hpp.
References m_offset.
Referenced by operator()(), psf(), and set_map_corrections().
double GLATMeanPsf::operator() | ( | const double & | offset, |
const double & | logE | ||
) |
Return mean PSF*exposure value.
[in] | offset | Angular distance from true source direction (degrees). |
[in] | logE | log10 of energy in MeV. |
Computes
\[{\rm PSF}(\delta, \log E) \times {\rm exposure}(\log E)\]
by bilinear interpolation, where \(\delta\) is the offset angle from the source direction in degrees, and \(\log E\) is the logarithm of base 10 of the energy in MeV. A zero value is returned if the offset angle is equal or larger than 70 degrees or if \(\log E\) is not positive.
Definition at line 175 of file GLATMeanPsf.cpp.
References GNodeArray::inx_left(), GNodeArray::inx_right(), m_energy, m_exposure, m_inx1, m_inx1_exp, m_inx2, m_inx2_exp, m_inx3, m_inx4, m_mapcorr, m_offset, m_psf, m_wgt1, m_wgt2, m_wgt3, m_wgt4, noffsets(), offset(), GNodeArray::set_value(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().
GLATMeanPsf & GLATMeanPsf::operator= | ( | const GLATMeanPsf & | psf | ) |
Assignment operator.
[in] | psf | Mean PSF. |
Definition at line 140 of file GLATMeanPsf.cpp.
References copy_members(), free_members(), and init_members().
Print livetime cube information.
[in] | chatter | Chattiness (defaults to NORMAL). |
Implements GBase.
Definition at line 531 of file GLATMeanPsf.cpp.
References GSkyDir::dec_deg(), energy(), GEnergy::log10MeV(), m_dir, m_energy, m_exposure, m_mapcorr, name(), nenergies(), noffsets(), gammalib::parformat(), GEnergy::print(), GSkyDir::ra_deg(), SILENT, and gammalib::str().
double GLATMeanPsf::psf | ( | const double & | offset, |
const double & | logE | ||
) |
Return mean PSF value.
[in] | offset | Angular distance from true source direction (degrees). |
[in] | logE | log10 of energy in MeV. |
Computes
\[{\rm PSF}(\delta, \log E)\]
by bilinear interpolation, where \(\delta\) is the offset angle from the source direction in degrees, and \(\log E\) is the logarithm of base 10 of the energy in MeV. A zero value is returned if the offset angle is equal or larger than 70 degrees or if \(\log E\) is not positive.
Definition at line 411 of file GLATMeanPsf.cpp.
References GNodeArray::inx_left(), GNodeArray::inx_right(), m_energy, m_inx1, m_inx1_exp, m_inx2, m_inx2_exp, m_inx3, m_inx4, m_mapcorr, m_offset, m_psf, m_wgt1, m_wgt2, m_wgt3, m_wgt4, noffsets(), offset(), GNodeArray::set_value(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().
Referenced by set(), and set_map_corrections().
void GLATMeanPsf::set | ( | const GSkyDir & | dir, |
const GLATObservation & | obs | ||
) |
Compute mean PSF and exposure.
[in] | dir | Source location. |
[in] | obs | LAT observation. |
GException::invalid_argument | No livetime cube found in observation. |
Computes the mean PSF and the energy dependent exposure for a source at a given sky location. The PSF is computed for all bin boundaries of the observation, hence if there are N energy bins there will be N+1 energies at which the mean PSF is computed.
Definition at line 298 of file GLATMeanPsf.cpp.
References GLATResponse::aeff(), GNodeArray::append(), GNodeArray::clear(), dir(), GEvents::ebounds(), GEbounds::emax(), GEbounds::emin(), energy(), GObservation::events(), exposure(), G_SET, GEnergy::log10MeV(), GLATObservation::ltcube(), m_dir, m_energy, m_exposure, m_offset, m_psf, psf(), GLATResponse::psf(), GLATObservation::response(), set_map_corrections(), size(), GNodeArray::size(), GEbounds::size(), and GLATResponse::size().
Referenced by GLATMeanPsf().
|
private |
Compute map corrections.
[in] | obs | LAT observation. |
Sets up a vector of energy dependent corrections that assures that the integral over the PSF in a specific event cube is correctly normalised. For this purpose the PSF is integrated over a radius that fully lies within the event cube and devided by the PSF pixel sum within this radius. The map corrections are mainly important at high energies where the PSF size can become comparable to the pixel size.
See SourceMap::getMapCorrections for the original code in the Fermi/LAT ScienceTools.
Definition at line 716 of file GLATMeanPsf.cpp.
References GObservation::events(), integral(), m_dir, m_energy, m_mapcorr, GLATEventCube::map(), GLATEventCube::maxrad(), GLATEventCube::nx(), GLATEventCube::ny(), offset(), psf(), GNodeArray::size(), and sum().
Referenced by set().
|
private |
Set array of offset values in degrees.
The array of offset values defines the points at with the mean PSF will be evaluated and stored. The array is logarithmically spaced.
Definition at line 678 of file GLATMeanPsf.cpp.
References GNodeArray::append(), GNodeArray::clear(), exp(), log(), and m_offset.
Referenced by init_members().
|
inline |
Return number of bins in mean PSF.
Definition at line 136 of file GLATMeanPsf.hpp.
References m_energy, m_offset, and GNodeArray::size().
Referenced by set().
|
inline |
Return maximum theta angle.
Definition at line 239 of file GLATMeanPsf.hpp.
References m_theta_max.
|
inline |
Set maximum theta angle.
[in] | value | Maximum theta angle. |
Definition at line 251 of file GLATMeanPsf.hpp.
References m_theta_max.
|
private |
Source direction for mean PSF.
Definition at line 94 of file GLATMeanPsf.hpp.
Referenced by copy_members(), dir(), init_members(), print(), set(), and set_map_corrections().
|
private |
log10(energy) of mean PSF
Definition at line 99 of file GLATMeanPsf.hpp.
Referenced by copy_members(), energy(), exposure(), init_members(), integral(), nenergies(), operator()(), print(), psf(), set(), set_map_corrections(), and size().
|
private |
Mean exposure.
Definition at line 96 of file GLATMeanPsf.hpp.
Referenced by copy_members(), exposure(), init_members(), operator()(), print(), and set().
|
private |
Index 1.
Definition at line 107 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and psf().
|
private |
Exposure index 1.
Definition at line 105 of file GLATMeanPsf.hpp.
Referenced by copy_members(), exposure(), init_members(), operator()(), and psf().
|
private |
Index 2.
Definition at line 108 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and psf().
|
private |
Exposure index 2.
Definition at line 106 of file GLATMeanPsf.hpp.
Referenced by copy_members(), exposure(), init_members(), operator()(), and psf().
|
private |
Index 3.
Definition at line 109 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and psf().
|
private |
Index 4.
Definition at line 110 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and psf().
|
private |
Last requested logE value.
Definition at line 103 of file GLATMeanPsf.hpp.
Referenced by copy_members(), and init_members().
|
private |
Last requested offset value.
Definition at line 104 of file GLATMeanPsf.hpp.
Referenced by copy_members(), and init_members().
|
private |
Map corrections.
Definition at line 97 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), operator()(), print(), psf(), and set_map_corrections().
|
private |
Source name for mean PSF.
Definition at line 93 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), and name().
|
private |
Offsets of mean PSF.
Definition at line 98 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), integral(), noffsets(), offset(), operator()(), psf(), set(), set_offsets(), and size().
|
private |
Mean PSF values.
Definition at line 95 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), integral(), operator()(), psf(), and set().
|
private |
Maximum inclination angle (default 70 deg)
Definition at line 100 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), and thetamax().
|
private |
Weighting factor 1.
Definition at line 111 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and psf().
|
private |
Weighting factor 2.
Definition at line 112 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and psf().
|
private |
Weighting factor 3.
Definition at line 113 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and psf().
|
private |
Weighting factor 4.
Definition at line 114 of file GLATMeanPsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and psf().