GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GLATPsfV1 Class Reference

Fermi/LAT point spread function version 1 class. More...

#include <GLATPsfV1.hpp>

Inheritance diagram for GLATPsfV1:
GLATPsfBase GBase

Classes

class  base_integrand
 

Public Member Functions

 GLATPsfV1 (void)
 Void constructor. More...
 
 GLATPsfV1 (const GLATPsfV1 &psf)
 Copy constructor. More...
 
virtual ~GLATPsfV1 (void)
 Destructor. More...
 
GLATPsfV1operator= (const GLATPsfV1 &psf)
 Assignment operator. More...
 
void clear (void)
 Clear point spread function. More...
 
GLATPsfV1clone (void) const
 Clone point spread function. More...
 
std::string classname (void) const
 Return class name. More...
 
void read (const GFitsTable &table)
 Read point spread function from FITS table. More...
 
void write (GFits &file) const
 Write point spread function into FITS file. More...
 
double psf (const double &offset, const double &logE, const double &ctheta)
 Return point spread function value. More...
 
int version (void) const
 Return point spread function version number. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print point spread function. More...
 
- Public Member Functions inherited from GLATPsfBase
 GLATPsfBase (void)
 Void constructor. More...
 
 GLATPsfBase (const GLATPsfBase &psf)
 Copy constructor. More...
 
virtual ~GLATPsfBase (void)
 Destructor. More...
 
GLATPsfBaseoperator= (const GLATPsfBase &psf)
 Assignment operator. More...
 
void read_scale (const GFitsTable &hdu)
 Read PSF scale factors from FITS table. More...
 
void write_scale (GFits &file) const
 Write PSF scale factors. More...
 
int size (void) const
 Return number of bins in point spread function. More...
 
int nenergies (void) const
 Return number of energies in point spread function. More...
 
int ncostheta (void) const
 Return number of cosine theta bins in point spread function. More...
 
const double & costhetamin (void) const
 Return cosine theta minimum. More...
 
void costhetamin (const double &ctheta)
 Set minimum cos(theta) angle for point spread function. More...
 
bool has_phi (void) const
 Signal that point spread function has Phi dependence. More...
 
const bool & front (void) const
 Signal that point spread function is for front section. More...
 
void front (const bool &front)
 Set if point spread function is for front section. More...
 
const double & scale_par1 (void) const
 Return first scaling parameter. More...
 
const double & scale_par2 (void) const
 Return second scaling parameter. More...
 
const double & scale_index (void) const
 Return scaling index. 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 GLATPsfV1 &psf)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Static Private Member Functions

static double base_fct (const double &u, const double &gamma)
 Return point spread base function value. More...
 
static double base_int (const double &u, const double &gamma)
 Return approximation of point spread base function integral. More...
 

Private Attributes

std::vector< double > m_ncore
 PSF ncore parameter. More...
 
std::vector< double > m_sigma
 PSF sigma parameter. More...
 
std::vector< double > m_gcore
 PSF gcore parameter. More...
 
std::vector< double > m_gtail
 PSF gtail parameter. More...
 

Additional Inherited Members

- Protected Member Functions inherited from GLATPsfBase
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GLATPsfBase &psf)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
double scale_factor (const double &energy) const
 Return scale factor for energy (in MeV) More...
 
- Protected Attributes inherited from GLATPsfBase
bool m_front
 PSF is for front section? More...
 
GLATResponseTable m_rpsf_bins
 PSF energy and cos theta binning. More...
 
double m_scale_par1
 PSF scaling parameter 1. More...
 
double m_scale_par2
 PSF scaling parameter 2. More...
 
double m_scale_index
 PSF scaling index. More...
 
double m_min_ctheta
 Minimum valid cos(theta) More...
 

Detailed Description

Fermi/LAT point spread function version 1 class.

This class has been inspired by code from the Fermi/LAT ScienceTools. For comparison check the file irfs/latResponse/src/Psf.h

Definition at line 47 of file GLATPsfV1.hpp.

Constructor & Destructor Documentation

GLATPsfV1::GLATPsfV1 ( void  )

Void constructor.

Definition at line 60 of file GLATPsfV1.cpp.

References init_members().

Referenced by clone().

GLATPsfV1::GLATPsfV1 ( const GLATPsfV1 psf)

Copy constructor.

Parameters
[in]psfPoint spread function.

Definition at line 75 of file GLATPsfV1.cpp.

References copy_members(), and init_members().

GLATPsfV1::~GLATPsfV1 ( void  )
virtual

Destructor.

Definition at line 91 of file GLATPsfV1.cpp.

References free_members().

Member Function Documentation

double GLATPsfV1::base_fct ( const double &  u,
const double &  gamma 
)
staticprivate

Return point spread base function value.

Parameters
[in]uFunction argument.
[in]gammaIndex.

The version 1 PSF base function is given by

\[\left(1 - \frac{1}{\Gamma} \right) \left(1 + \frac{u}{\Gamma} \right)^{-\Gamma}\]

Definition at line 495 of file GLATPsfV1.cpp.

References pow().

Referenced by GLATPsfV1::base_integrand::eval(), and psf().

double GLATPsfV1::base_int ( const double &  u,
const double &  gamma 
)
staticprivate

Return approximation of point spread base function integral.

Parameters
[in]uFunction argument.
[in]gammaIndex.

The version 1 PSF base function integral is approximated by

\[1 - \left(1 + \frac{u}{\Gamma} \right)^{1-\Gamma}\]

which is valid for small angles \(u\). For larger angles a numerical integration of the base function has to be performed.

Todo:
Verify that 1+u/gamma is not negative

Definition at line 522 of file GLATPsfV1.cpp.

References pow().

Referenced by psf().

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

Return class name.

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

Implements GLATPsfBase.

Definition at line 115 of file GLATPsfV1.hpp.

void GLATPsfV1::clear ( void  )
virtual

Clear point spread function.

Implements GLATPsfBase.

Definition at line 146 of file GLATPsfV1.cpp.

References free_members(), GLATPsfBase::free_members(), init_members(), and GLATPsfBase::init_members().

GLATPsfV1 * GLATPsfV1::clone ( void  ) const
virtual

Clone point spread function.

Returns
Pointer to deep copy of point spread function.

Implements GLATPsfBase.

Definition at line 166 of file GLATPsfV1.cpp.

References GLATPsfV1().

void GLATPsfV1::copy_members ( const GLATPsfV1 psf)
private

Copy class members.

Parameters
[in]psfPoint spread function.

Definition at line 462 of file GLATPsfV1.cpp.

References m_gcore, m_gtail, m_ncore, and m_sigma.

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

void GLATPsfV1::free_members ( void  )
private

Delete class members.

Definition at line 478 of file GLATPsfV1.cpp.

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

void GLATPsfV1::init_members ( void  )
private

Initialise class members.

Definition at line 444 of file GLATPsfV1.cpp.

References m_gcore, m_gtail, m_ncore, and m_sigma.

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

GLATPsfV1 & GLATPsfV1::operator= ( const GLATPsfV1 psf)

Assignment operator.

Parameters
[in]psfPoint spread function.
Returns
Point spread function.

Definition at line 113 of file GLATPsfV1.cpp.

References copy_members(), free_members(), init_members(), and GLATPsfBase::operator=().

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

Print point spread function.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing point spread function information.

Implements GLATPsfBase.

Definition at line 417 of file GLATPsfV1.cpp.

References SILENT.

double GLATPsfV1::psf ( const double &  offset,
const double &  logE,
const double &  ctheta 
)
virtual

Return point spread function value.

Parameters
[in]offsetOffset angle (deg).
[in]logELog10 of the true photon energy (MeV).
[in]cthetaCosine of zenith angle.
Todo:
Some optimisation could be done as in many cases gcore==gtail, and for this special case ntail=ncore, hence things become a little simpler.

Implements GLATPsfBase.

Definition at line 342 of file GLATPsfV1.cpp.

References base_fct(), base_int(), gammalib::deg2rad, GLATResponseTable::interpolate(), m_gcore, m_gtail, GLATPsfBase::m_min_ctheta, m_ncore, GLATPsfBase::m_rpsf_bins, m_sigma, norm(), gammalib::pihalf, pow(), GIntegral::romberg(), GLATPsfBase::scale_factor(), sum(), and gammalib::twopi.

void GLATPsfV1::read ( const GFitsTable table)
virtual

Read point spread function from FITS table.

Parameters
[in]tableFITS table.
Exceptions
GException::invalid_argumentInconsistent response table encountered

Reads point spread function information from FITS HDU. In addition to the energy and costheta binning information, 4 columns are expected: NCORE, SIGMA, GCORE, and GTAIL.

Implements GLATPsfBase.

Definition at line 184 of file GLATPsfV1.cpp.

References GLATResponseTable::costheta_lo(), G_READ, m_gcore, m_gtail, GLATPsfBase::m_min_ctheta, m_ncore, GLATPsfBase::m_rpsf_bins, m_sigma, GFitsTableCol::number(), GLATResponseTable::read(), GFitsTableCol::real(), GLATPsfBase::size(), GLATResponseTable::size(), and gammalib::str().

int GLATPsfV1::version ( void  ) const
inlinevirtual

Return point spread function version number.

Returns
Point spread function version number (1).

Implements GLATPsfBase.

Definition at line 127 of file GLATPsfV1.hpp.

void GLATPsfV1::write ( GFits file) const
virtual

Write point spread function into FITS file.

Parameters
[in]fileFITS file.

Writes the PSF into the extension "RPSF" of a FITS file. This method does not check if a "RPSF" extension exists so far, it simply adds one each time it is called.

Nothing is done if the PSF size is 0.

Todo:
Check if a RPSF extension exists already in FITS file

Implements GLATPsfBase.

Definition at line 276 of file GLATPsfV1.cpp.

References GFitsTable::append(), GFits::append(), GFitsHDU::card(), GFitsHDU::extname(), GLATPsfBase::front(), m_gcore, m_gtail, m_ncore, GLATPsfBase::m_rpsf_bins, m_sigma, GLATPsfBase::size(), GLATResponseTable::size(), and GLATResponseTable::write().

Member Data Documentation

std::vector<double> GLATPsfV1::m_gcore
private

PSF gcore parameter.

Definition at line 104 of file GLATPsfV1.hpp.

Referenced by copy_members(), init_members(), psf(), read(), and write().

std::vector<double> GLATPsfV1::m_gtail
private

PSF gtail parameter.

Definition at line 105 of file GLATPsfV1.hpp.

Referenced by copy_members(), init_members(), psf(), read(), and write().

std::vector<double> GLATPsfV1::m_ncore
private

PSF ncore parameter.

Definition at line 102 of file GLATPsfV1.hpp.

Referenced by copy_members(), init_members(), psf(), read(), and write().

std::vector<double> GLATPsfV1::m_sigma
private

PSF sigma parameter.

Definition at line 103 of file GLATPsfV1.hpp.

Referenced by copy_members(), init_members(), psf(), read(), and write().


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