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

Fermi/LAT mean PSF class. More...

#include <GLATMeanPsf.hpp>

Inheritance diagram for GLATMeanPsf:
GBase

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...
 
GLATMeanPsfoperator= (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...
 
GLATMeanPsfclone (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 GSkyDirdir (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
[in]dirSky direction.
[in]obsLAT observation.

Definition at line 84 of file GLATMeanPsf.cpp.

References init_members(), and set().

GLATMeanPsf::GLATMeanPsf ( const GLATMeanPsf psf)

Copy constructor.

Parameters
[in]psfMean PSF.

Definition at line 102 of file GLATMeanPsf.cpp.

References copy_members(), and init_members().

GLATMeanPsf::~GLATMeanPsf ( void  )
virtual

Destructor.

Definition at line 118 of file GLATMeanPsf.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GBase.

Definition at line 124 of file GLATMeanPsf.hpp.

void GLATMeanPsf::clear ( void  )
virtual

Clear mean PSF.

Implements GBase.

Definition at line 260 of file GLATMeanPsf.cpp.

References free_members(), and init_members().

GLATMeanPsf * GLATMeanPsf::clone ( void  ) const
virtual

Clone mean PSF.

Returns
Pointer to deep copy of mean PSF.

Implements GBase.

Definition at line 278 of file GLATMeanPsf.cpp.

References GLATMeanPsf().

void GLATMeanPsf::copy_members ( const GLATMeanPsf psf)
private

Copy class members.

Parameters
[in]psfMean PSF.

Definition at line 630 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=().

const GSkyDir & GLATMeanPsf::dir ( void  ) const
inline

Return sky direction for mean PSF.

Returns
Sky direction.

Definition at line 202 of file GLATMeanPsf.hpp.

References m_dir.

Referenced by set().

const double & GLATMeanPsf::energy ( const int &  inx) const
inline

Return energy for given bin.

Parameters
[in]inxBin index [0,...,nenergies()-1]
Returns
Energy.

Definition at line 190 of file GLATMeanPsf.hpp.

References m_energy.

Referenced by print(), and set().

double GLATMeanPsf::exposure ( const double &  logE)

Return exposure value.

Parameters
[in]logElog10 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 495 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().

void GLATMeanPsf::free_members ( void  )
private

Delete class members.

Definition at line 662 of file GLATMeanPsf.cpp.

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

void GLATMeanPsf::init_members ( void  )
private
double GLATMeanPsf::integral ( const double &  offsetmax,
const double &  logE 
)
private

Compute integral over PSF.

Parameters
[in]offsetmaxMaximum offset angle.
[in]logElog10 of energy in MeV.

Definition at line 778 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().

const std::string & GLATMeanPsf::name ( void  ) const
inline

Return source name for mean PSF.

Returns
Source name.

Definition at line 214 of file GLATMeanPsf.hpp.

References m_name.

Referenced by GLATResponse::irf(), name(), and print().

void GLATMeanPsf::name ( const std::string &  name)
inline

Set source name for mean PSF.

Parameters
[in]nameSource name.

Definition at line 226 of file GLATMeanPsf.hpp.

References m_name, and name().

int GLATMeanPsf::nenergies ( void  ) const
inline

Return number of energy bins.

Returns
Number of energy bins.

Definition at line 164 of file GLATMeanPsf.hpp.

References m_energy, and GNodeArray::size().

Referenced by print().

int GLATMeanPsf::noffsets ( void  ) const
inline

Return number of offset bins.

Returns
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().

const double & GLATMeanPsf::offset ( const int &  inx) const
inline

Return offset angle for given bin.

Parameters
[in]inxBin index [0,...,noffsets()-1]
Returns
Offset angle.

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.

Parameters
[in]offsetAngular distance from true source direction (degrees).
[in]logElog10 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.

Parameters
[in]psfMean PSF.
Returns
Mean PSF.

Definition at line 140 of file GLATMeanPsf.cpp.

References copy_members(), free_members(), and init_members().

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

Print livetime cube information.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing ROI information.

Implements GBase.

Definition at line 528 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.

Parameters
[in]offsetAngular distance from true source direction (degrees).
[in]logElog10 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 408 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.

Parameters
[in]dirSource location.
[in]obsLAT observation.
Exceptions
GLATException::no_ltcubeLivetime cube has not been defined.

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().

void GLATMeanPsf::set_map_corrections ( const GLATObservation obs)
private

Compute map corrections.

Parameters
[in]obsLAT 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.

Todo:
We can also implement a method for event atoms, yet it is not clear whether we really need this.

Definition at line 713 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().

void GLATMeanPsf::set_offsets ( void  )
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 675 of file GLATMeanPsf.cpp.

References GNodeArray::append(), GNodeArray::clear(), exp(), log(), and m_offset.

Referenced by init_members().

int GLATMeanPsf::size ( void  ) const
inline

Return number of bins in mean PSF.

Returns
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().

const double & GLATMeanPsf::thetamax ( void  ) const
inline

Return maximum theta angle.

Returns
Maximum theta angle.

Definition at line 239 of file GLATMeanPsf.hpp.

References m_theta_max.

void GLATMeanPsf::thetamax ( const double &  value)
inline

Set maximum theta angle.

Parameters
[in]valueMaximum theta angle.

Definition at line 251 of file GLATMeanPsf.hpp.

References m_theta_max.

Member Data Documentation

GSkyDir GLATMeanPsf::m_dir
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().

GNodeArray GLATMeanPsf::m_energy
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().

std::vector<double> GLATMeanPsf::m_exposure
private

Mean exposure.

Definition at line 96 of file GLATMeanPsf.hpp.

Referenced by copy_members(), exposure(), init_members(), operator()(), print(), and set().

int GLATMeanPsf::m_inx1
private

Index 1.

Definition at line 107 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), operator()(), and psf().

int GLATMeanPsf::m_inx1_exp
private

Exposure index 1.

Definition at line 105 of file GLATMeanPsf.hpp.

Referenced by copy_members(), exposure(), init_members(), operator()(), and psf().

int GLATMeanPsf::m_inx2
private

Index 2.

Definition at line 108 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), operator()(), and psf().

int GLATMeanPsf::m_inx2_exp
private

Exposure index 2.

Definition at line 106 of file GLATMeanPsf.hpp.

Referenced by copy_members(), exposure(), init_members(), operator()(), and psf().

int GLATMeanPsf::m_inx3
private

Index 3.

Definition at line 109 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), operator()(), and psf().

int GLATMeanPsf::m_inx4
private

Index 4.

Definition at line 110 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), operator()(), and psf().

double GLATMeanPsf::m_last_energy
private

Last requested logE value.

Definition at line 103 of file GLATMeanPsf.hpp.

Referenced by copy_members(), and init_members().

double GLATMeanPsf::m_last_offset
private

Last requested offset value.

Definition at line 104 of file GLATMeanPsf.hpp.

Referenced by copy_members(), and init_members().

std::vector<double> GLATMeanPsf::m_mapcorr
private

Map corrections.

Definition at line 97 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), operator()(), print(), psf(), and set_map_corrections().

std::string GLATMeanPsf::m_name
private

Source name for mean PSF.

Definition at line 93 of file GLATMeanPsf.hpp.

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

GNodeArray GLATMeanPsf::m_offset
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().

std::vector<double> GLATMeanPsf::m_psf
private

Mean PSF values.

Definition at line 95 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), integral(), operator()(), psf(), and set().

double GLATMeanPsf::m_theta_max
private

Maximum inclination angle (default 70 deg)

Definition at line 100 of file GLATMeanPsf.hpp.

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

double GLATMeanPsf::m_wgt1
private

Weighting factor 1.

Definition at line 111 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), operator()(), and psf().

double GLATMeanPsf::m_wgt2
private

Weighting factor 2.

Definition at line 112 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), operator()(), and psf().

double GLATMeanPsf::m_wgt3
private

Weighting factor 3.

Definition at line 113 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), operator()(), and psf().

double GLATMeanPsf::m_wgt4
private

Weighting factor 4.

Definition at line 114 of file GLATMeanPsf.hpp.

Referenced by copy_members(), init_members(), operator()(), and psf().


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