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

Fermi LAT livetime cube map class. More...

#include <GLATLtCubeMap.hpp>

Inheritance diagram for GLATLtCubeMap:
GBase

Public Member Functions

 GLATLtCubeMap (void)
 Void constructor. More...
 
 GLATLtCubeMap (const GLATLtCubeMap &map)
 Copy constructor. More...
 
virtual ~GLATLtCubeMap (void)
 Destructor. More...
 
GLATLtCubeMapoperator= (const GLATLtCubeMap &cube)
 Assignment operator. More...
 
double operator() (const GSkyDir &dir, _ltcube_ctheta fct) const
 Sum function multiplied by livetime over zenith angle. More...
 
double operator() (const GSkyDir &dir, _ltcube_ctheta_phi fct) const
 Sum function multiplied by livetime over zenith and azimuth angles. More...
 
double operator() (const GSkyDir &dir, const GEnergy &energy, const GLATAeff &aeff) const
 Sum effective area multiplied by livetime over zenith and (optionally) azimuth angles. More...
 
double operator() (const GSkyDir &dir, const GEnergy &energy, const double &offset, const GLATPsf &psf, const GLATAeff &aeff) const
 Sum effective area multiplied by livetime over zenith angles. More...
 
void clear (void)
 Clear livetime cube map. More...
 
GLATLtCubeMapclone (void) const
 Clone livetime cube map. More...
 
std::string classname (void) const
 Return class name. More...
 
void read (const GFitsTable &table)
 Load livetime cube from FITS file. More...
 
void write (GFits &fits, const std::string &extname=gammalib::extname_lat_ltcubemap) const
 Write livetime cube map into FITS file. More...
 
const int & ncostheta (void) const
 Return number of cosine theta bins. More...
 
const int & nphi (void) const
 Return number of phi bins. More...
 
bool has_phi (void) const
 Signal if livetime cube map has phi dependence. More...
 
double costheta (const int &index) const
 Return cos theta value for an index. More...
 
double phi (const int &index) const
 Return phi value (in radians) for an index. More...
 
const double & costhetamin (void) const
 Return minimum of cosine theta. More...
 
std::string costhetabin (void) const
 Return cos theta binning scheme. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print livetime cube map 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 GLATLtCubeMap &cube)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Private Attributes

GSkyMap m_map
 Lifetime cube map. More...
 
int m_num_ctheta
 Number of bins in cos theta. More...
 
int m_num_phi
 Number of bins in phi. More...
 
double m_min_ctheta
 Minimum cos theta value. More...
 
bool m_sqrt_bin
 Square root binning? More...
 

Detailed Description

Fermi LAT livetime cube map class.

A livetime cube map holds a set of HEALPix skymaps that are a function of the cosine of the zenith angle and (optionally) of the azimuth angle.

Definition at line 60 of file GLATLtCubeMap.hpp.

Constructor & Destructor Documentation

GLATLtCubeMap::GLATLtCubeMap ( void  )

Void constructor.

Definition at line 61 of file GLATLtCubeMap.cpp.

References init_members().

Referenced by clone().

GLATLtCubeMap::GLATLtCubeMap ( const GLATLtCubeMap map)

Copy constructor.

Parameters
mapLivetime cube map.

Definition at line 76 of file GLATLtCubeMap.cpp.

References copy_members(), and init_members().

GLATLtCubeMap::~GLATLtCubeMap ( void  )
virtual

Destructor.

Definition at line 92 of file GLATLtCubeMap.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GBase.

Definition at line 115 of file GLATLtCubeMap.hpp.

void GLATLtCubeMap::clear ( void  )
virtual

Clear livetime cube map.

Implements GBase.

Definition at line 350 of file GLATLtCubeMap.cpp.

References free_members(), and init_members().

Referenced by GLATLtCube::init_members(), and read().

GLATLtCubeMap * GLATLtCubeMap::clone ( void  ) const
virtual

Clone livetime cube map.

Returns
Pointer to deep copy of livetime cube map

Implements GBase.

Definition at line 368 of file GLATLtCubeMap.cpp.

References GLATLtCubeMap().

void GLATLtCubeMap::copy_members ( const GLATLtCubeMap map)
private

Copy class members.

Parameters
mapLivetime cube map.

Definition at line 589 of file GLATLtCubeMap.cpp.

References m_map, m_min_ctheta, m_num_ctheta, m_num_phi, and m_sqrt_bin.

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

double GLATLtCubeMap::costheta ( const int &  index) const

Return cos theta value for an index.

Parameters
[in]indexBin index (starting from 0).
Exceptions
GException::out_of_rangeBin index outside value range.

The cos theta value is computed using

\[\cos \theta = 1 - \left( \frac{{\rm index} + 0.5}{\rm ncostheta} \right)^N (1 - {\rm costhetamin})\]

where \({\rm index}\) is the bin index, \({\rm ncostheta}\) is the number of cos theta bins, \(N\) is either 1 or 2, and \({\rm costhetamin}\) is the minimum cos theta value. Default values for LAT are \(N=2\) and \({\rm costhetamin}=0\).

Definition at line 452 of file GLATLtCubeMap.cpp.

References G_COSTHETA, m_min_ctheta, m_num_ctheta, and m_sqrt_bin.

Referenced by operator()().

std::string GLATLtCubeMap::costhetabin ( void  ) const

Return cos theta binning scheme.

Returns either "SQRT(1-COSTHETA)" or "COSTHETA".

Definition at line 511 of file GLATLtCubeMap.cpp.

References m_sqrt_bin.

Referenced by write().

const double & GLATLtCubeMap::costhetamin ( void  ) const
inline

Return minimum of cosine theta.

Returns
Minimum of cosine theta.

Definition at line 163 of file GLATLtCubeMap.hpp.

References m_min_ctheta.

Referenced by print().

void GLATLtCubeMap::free_members ( void  )
private

Delete class members.

Definition at line 606 of file GLATLtCubeMap.cpp.

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

bool GLATLtCubeMap::has_phi ( void  ) const
inline

Signal if livetime cube map has phi dependence.

Returns
True if livetime cube map has phi dependence.

Definition at line 151 of file GLATLtCubeMap.hpp.

References m_num_phi.

Referenced by operator()().

void GLATLtCubeMap::init_members ( void  )
private

Initialise class members.

Definition at line 570 of file GLATLtCubeMap.cpp.

References GSkyMap::clear(), m_map, m_min_ctheta, m_num_ctheta, m_num_phi, and m_sqrt_bin.

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

const int & GLATLtCubeMap::ncostheta ( void  ) const
inline

Return number of cosine theta bins.

Returns
Number of cosine theta bins.

Definition at line 127 of file GLATLtCubeMap.hpp.

References m_num_ctheta.

Referenced by print().

const int & GLATLtCubeMap::nphi ( void  ) const
inline

Return number of phi bins.

Returns
Number of phi bins.

Definition at line 139 of file GLATLtCubeMap.hpp.

References m_num_phi.

Referenced by print().

double GLATLtCubeMap::operator() ( const GSkyDir dir,
_ltcube_ctheta  fct 
) const

Sum function multiplied by livetime over zenith angle.

Parameters
[in]dirSky direction.
[in]fctFunction to evaluate.

Computes

\[\sum_{\cos \theta} T_{\rm live}(\cos \theta) f(\cos \theta)\]

where \(T_{\rm live}(\cos \theta)\) is the livetime as a function of the cosine of the zenith angle, and \(f(\cos \theta)\) is a function that depends on the cosine of the zenith angle. This method assumes that \(T_{\rm live}(\cos \theta)\) is stored as a set of maps.

Definition at line 151 of file GLATLtCubeMap.cpp.

References costheta(), GSkyMap::dir2pix(), m_map, m_num_ctheta, and sum().

double GLATLtCubeMap::operator() ( const GSkyDir dir,
_ltcube_ctheta_phi  fct 
) const

Sum function multiplied by livetime over zenith and azimuth angles.

Parameters
[in]dirSky direction.
[in]fctFunction to evaluate.

Computes

\[\sum_{\cos \theta, \phi} T_{\rm live}(\cos \theta, \phi) f(\cos \theta, \phi)\]

where \(T_{\rm live}(\cos \theta, \phi)\) is the livetime as a function of the cosine of the zenith and of the azimuth angle, and \(f(\cos \theta, \phi)\) is a function that depends on the cosine of the zenith angle and of the azimuth angle. This method assumes that \(T_{\rm live}(\cos \theta, \phi)\) is stored as a set of maps in a 2D array with \(\cos \theta\) being the most rapidely varying parameter and with the first map starting at index m_num_ctheta (the first m_num_ctheta maps are the livetime cube maps without any \(\phi\) dependence).

Definition at line 189 of file GLATLtCubeMap.cpp.

References costheta(), GSkyMap::dir2pix(), m_map, m_num_ctheta, m_num_phi, phi(), and sum().

double GLATLtCubeMap::operator() ( const GSkyDir dir,
const GEnergy energy,
const GLATAeff aeff 
) const

Sum effective area multiplied by livetime over zenith and (optionally) azimuth angles.

Parameters
[in]dirTrue sky direction.
[in]energyTrue photon energy.
[in]aeffEffective area.

Computes

\[\sum_{\cos \theta, \phi} T_{\rm live}(\cos \theta, \phi) A_{\rm eff}(\log E, \cos \theta, \phi)\]

where \(T_{\rm live}(\cos \theta, \phi)\) is the livetime as a function of the cosine of the zenith and the azimuth angle, and \(A_{\rm eff}(\log E, \cos \theta, \phi)\) is the effective area that depends on the log10 of the energy (in MeV), the cosine of the zenith angle, and the azimuth angle. This method assumes that \(T_{\rm live}(\cos \theta, \phi)\) is stored as a set of maps in a 2D array with \(\cos \theta\) being the most rapidely varying parameter and with the first map starting at index m_num_ctheta (the first m_num_ctheta maps are the livetime cube maps without any \(\phi\) dependence).

Definition at line 237 of file GLATLtCubeMap.cpp.

References costheta(), GSkyMap::dir2pix(), has_phi(), GLATAeff::has_phi(), GEnergy::log10MeV(), m_map, m_num_ctheta, m_num_phi, phi(), and sum().

double GLATLtCubeMap::operator() ( const GSkyDir dir,
const GEnergy energy,
const double &  offset,
const GLATPsf psf,
const GLATAeff aeff 
) const

Sum effective area multiplied by livetime over zenith angles.

Parameters
[in]dirTrue sky direction.
[in]energyTrue photon energy.
[in]offsetOffset from true direction (deg).
[in]psfPoint spread function.
[in]aeffEffective area.

Computes

\[\sum_{\cos \theta} T_{\rm live}(\cos \theta) PSF(\log E, \delta, \cos \theta) A_{\rm eff}(\cos \theta, \phi)\]

where \(T_{\rm live}(\cos \theta)\) is the livetime as a function of the cosine of the zenith angle, and \(PSF(\log E, \delta, \cos \theta)\) is the point spread function that depends on the log10 of the energy (in MeV), the offset angle from the true direction (in degrees), and the cosine of the zenith angle, and \(A_{\rm eff}(\cos \theta, \phi)\) is the effective area that depends on the cosine of the zenith angle and (optionally) of the azimuth angle.

Definition at line 297 of file GLATLtCubeMap.cpp.

References costheta(), GSkyMap::dir2pix(), has_phi(), GLATAeff::has_phi(), GEnergy::log10MeV(), m_map, m_num_ctheta, m_num_phi, phi(), and sum().

GLATLtCubeMap & GLATLtCubeMap::operator= ( const GLATLtCubeMap map)

Assignment operator.

Parameters
[in]mapLivetime cube map.
Returns
Livetime cube map.

Definition at line 114 of file GLATLtCubeMap.cpp.

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

double GLATLtCubeMap::phi ( const int &  index) const

Return phi value (in radians) for an index.

Parameters
[in]indexBin index (starting from 0).
Exceptions
GException::out_of_rangeBin index outside value range.

The phi value is computed using

\[\phi = \frac{{\rm index} + 0.5}{\rm nphi} \frac{\pi}{4}\]

where \({\rm index}\) is the bin index, and \({\rm nphi}\) is the number of phi bins.

Definition at line 489 of file GLATLtCubeMap.cpp.

References G_PHI, m_num_phi, and gammalib::pi.

Referenced by operator()().

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

Print livetime cube map information.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing livetime cube map information.

Implements GBase.

Definition at line 527 of file GLATLtCubeMap.cpp.

References costhetamin(), m_map, m_sqrt_bin, ncostheta(), nphi(), gammalib::parformat(), GSkyMap::print(), gammalib::reduce(), SILENT, and gammalib::str().

Referenced by GLATLtCube::print().

void GLATLtCubeMap::read ( const GFitsTable table)

Load livetime cube from FITS file.

Parameters
[in]tableFITS table.

Definition at line 379 of file GLATLtCubeMap.cpp.

References clear(), GFitsHDU::integer(), m_map, m_min_ctheta, m_num_ctheta, m_num_phi, m_sqrt_bin, GSkyMap::read(), GFitsHDU::real(), GFitsHDU::string(), gammalib::strip_whitespace(), and gammalib::toupper().

Referenced by GLATLtCube::read().

void GLATLtCubeMap::write ( GFits fits,
const std::string &  extname = gammalib::extname_lat_ltcubemap 
) const

Write livetime cube map into FITS file.

Parameters
[in]fitsFITS file.
[in]extnameLivetime cube map extension name.

Writes livetime cube map into a FITS file.

Definition at line 410 of file GLATLtCubeMap.cpp.

References GFitsHDU::card(), GFits::contains(), costhetabin(), m_map, m_min_ctheta, m_num_ctheta, m_num_phi, GFits::remove(), and GSkyMap::write().

Referenced by GLATLtCube::write().

Member Data Documentation

GSkyMap GLATLtCubeMap::m_map
private

Lifetime cube map.

Definition at line 101 of file GLATLtCubeMap.hpp.

Referenced by copy_members(), init_members(), operator()(), print(), read(), and write().

double GLATLtCubeMap::m_min_ctheta
private

Minimum cos theta value.

Definition at line 104 of file GLATLtCubeMap.hpp.

Referenced by copy_members(), costheta(), costhetamin(), init_members(), read(), and write().

int GLATLtCubeMap::m_num_ctheta
private

Number of bins in cos theta.

Definition at line 102 of file GLATLtCubeMap.hpp.

Referenced by copy_members(), costheta(), init_members(), ncostheta(), operator()(), read(), and write().

int GLATLtCubeMap::m_num_phi
private

Number of bins in phi.

Definition at line 103 of file GLATLtCubeMap.hpp.

Referenced by copy_members(), has_phi(), init_members(), nphi(), operator()(), phi(), read(), and write().

bool GLATLtCubeMap::m_sqrt_bin
private

Square root binning?

Definition at line 105 of file GLATLtCubeMap.hpp.

Referenced by copy_members(), costheta(), costhetabin(), init_members(), print(), and read().


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