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

CTA vector point spread function class. More...

#include <GCTAPsfVector.hpp>

Inheritance diagram for GCTAPsfVector:
GCTAPsf GBase

Public Member Functions

 GCTAPsfVector (void)
 Void constructor. More...
 
 GCTAPsfVector (const GFilename &filename)
 File constructor. More...
 
 GCTAPsfVector (const GCTAPsfVector &psf)
 Copy constructor. More...
 
virtual ~GCTAPsfVector (void)
 Destructor. More...
 
GCTAPsfVectoroperator= (const GCTAPsfVector &psf)
 Assignment operator. More...
 
double operator() (const double &delta, const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
 Return point spread function (in units of sr^-1) More...
 
void clear (void)
 Clear instance. More...
 
GCTAPsfVectorclone (void) const
 Clone instance. More...
 
std::string classname (void) const
 Return class name. More...
 
void load (const GFilename &filename)
 Load point spread function from FITS file. More...
 
GFilename filename (void) const
 Return filename. More...
 
double mc (GRan &ran, const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
 Simulate PSF offset (radians) More...
 
double delta_max (const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
 Return maximum size of PSF (radians) More...
 
double containment_radius (const double &fraction, const double &logE, const double &theta=0.0, const double &phi=0.0, const double &zenith=0.0, const double &azimuth=0.0, const bool &etrue=true) const
 Return the radius that contains a fraction of the events (radians) More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print point spread function information. More...
 
void read (const GFitsTable &table)
 Read point spread function vector from FITS table. More...
 
- Public Member Functions inherited from GCTAPsf
 GCTAPsf (void)
 Void constructor. More...
 
 GCTAPsf (const GCTAPsf &psf)
 Copy constructor. More...
 
virtual ~GCTAPsf (void)
 Destructor. More...
 
GCTAPsfoperator= (const GCTAPsf &psf)
 Assignment operator. 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 GCTAPsfVector &psf)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void update (const double &logE) const
 Update PSF parameter cache. More...
 

Private Attributes

GFilename m_filename
 Name of Aeff response file. More...
 
GNodeArray m_logE
 log(E) nodes for Aeff interpolation More...
 
std::vector< double > m_r68
 68% containment radius of PSF in degrees More...
 
std::vector< double > m_sigma
 Sigma value of PSF in radians. More...
 
double m_par_logE
 Energy for which precomputation is done. More...
 
double m_par_scale
 Gaussian normalization. More...
 
double m_par_sigma
 Gaussian sigma (radians) More...
 
double m_par_width
 Gaussian width parameter. More...
 

Additional Inherited Members

- Protected Member Functions inherited from GCTAPsf
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GCTAPsf &psf)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Detailed Description

CTA vector point spread function class.

This class implements the CTA point spread function response as function of energy as determined from a FITS table.

Definition at line 50 of file GCTAPsfVector.hpp.

Constructor & Destructor Documentation

GCTAPsfVector::GCTAPsfVector ( void  )

Void constructor.

Definition at line 65 of file GCTAPsfVector.cpp.

References init_members().

Referenced by clone().

GCTAPsfVector::GCTAPsfVector ( const GFilename filename)

File constructor.

Parameters
[in]filenamePSF FITS file.

Constructs point spread function vector from a FITS file.

Definition at line 82 of file GCTAPsfVector.cpp.

References init_members(), and load().

GCTAPsfVector::GCTAPsfVector ( const GCTAPsfVector psf)

Copy constructor.

Parameters
[in]psfPoint spread function.

Definition at line 100 of file GCTAPsfVector.cpp.

References copy_members(), and init_members().

GCTAPsfVector::~GCTAPsfVector ( void  )
virtual

Destructor.

Definition at line 116 of file GCTAPsfVector.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GCTAPsf.

Definition at line 127 of file GCTAPsfVector.hpp.

void GCTAPsfVector::clear ( void  )
virtual

Clear instance.

This method properly resets the object to an initial state.

Implements GCTAPsf.

Definition at line 225 of file GCTAPsfVector.cpp.

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

GCTAPsfVector * GCTAPsfVector::clone ( void  ) const
virtual

Clone instance.

Returns
Deep copy of point spread function instance.

Implements GCTAPsf.

Definition at line 245 of file GCTAPsfVector.cpp.

References GCTAPsfVector().

double GCTAPsfVector::containment_radius ( const double &  fraction,
const double &  logE,
const double &  theta = 0.0,
const double &  phi = 0.0,
const double &  zenith = 0.0,
const double &  azimuth = 0.0,
const bool &  etrue = true 
) const
virtual

Return the radius that contains a fraction of the events (radians)

Parameters
[in]fractionof events (0.0-1.0)
[in]logELog10 of the true photon energy (TeV).
[in]thetaOffset angle in camera system (rad). Not used.
[in]phiAzimuth angle in camera system (rad). Not used.
[in]zenithZenith angle in Earth system (rad). Not used.
[in]azimuthAzimuth angle in Earth system (rad). Not used.
[in]etrueUse true energy (true/false). Not used.
Returns
Containment radius (radians).
Exceptions
GException::invalid_argumentInvalid fraction specified.

Evaluates:

\[ radius = \sqrt{ \frac{\ln{\left( \frac{ fraction * m\_par\_width} {\pi*m\_par\_scale} +1\right)}}{m\_par\_width} } \]

which is derived by integrating

\[ fraction = \int_{0}^{2\pi}\int_{0}^{radius}r * e^{ m\_par\_width * r^{2}}dr d\phi \]

and solving for radius.

Calculate the radius from the center that contains 'fraction' percent of the events. fraction * 100. = Containment % .

Implements GCTAPsf.

Definition at line 475 of file GCTAPsfVector.cpp.

References G_CONTAINMENT_RADIUS, log(), m_par_scale, m_par_width, gammalib::pi, sqrt(), gammalib::str(), and update().

void GCTAPsfVector::copy_members ( const GCTAPsfVector psf)
private

Copy class members.

Parameters
[in]psfPoint spread function.

Definition at line 570 of file GCTAPsfVector.cpp.

References m_filename, m_logE, m_par_logE, m_par_scale, m_par_sigma, m_par_width, m_r68, and m_sigma.

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

double GCTAPsfVector::delta_max ( const double &  logE,
const double &  theta = 0.0,
const double &  phi = 0.0,
const double &  zenith = 0.0,
const double &  azimuth = 0.0,
const bool &  etrue = true 
) const
virtual

Return maximum size of PSF (radians)

Parameters
[in]logELog10 of the true photon energy (TeV).
[in]thetaOffset angle in camera system (rad). Not used.
[in]phiAzimuth angle in camera system (rad). Not used.
[in]zenithZenith angle in Earth system (rad). Not used.
[in]azimuthAzimuth angle in Earth system (rad). Not used.
[in]etrueUse true energy (true/false). Not used.

Determine the radius beyond which the PSF becomes negligible. This radius is set by this method to \(5 \times \sigma\), where \(\sigma\) is the Gaussian width of the largest PSF component.

Implements GCTAPsf.

Definition at line 419 of file GCTAPsfVector.cpp.

References m_par_sigma, and update().

GFilename GCTAPsfVector::filename ( void  ) const
inlinevirtual

Return filename.

Returns
Filename.

Returns filename from which point spread function was loaded.

Implements GCTAPsf.

Definition at line 141 of file GCTAPsfVector.hpp.

References m_filename.

Referenced by load().

void GCTAPsfVector::free_members ( void  )
private

Delete class members.

Definition at line 590 of file GCTAPsfVector.cpp.

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

void GCTAPsfVector::init_members ( void  )
private

Initialise class members.

Definition at line 548 of file GCTAPsfVector.cpp.

References GNodeArray::clear(), GFilename::clear(), m_filename, m_logE, m_par_logE, m_par_scale, m_par_sigma, m_par_width, m_r68, and m_sigma.

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

void GCTAPsfVector::load ( const GFilename filename)
virtual

Load point spread function from FITS file.

Parameters
[in]filenameFITS file name.

Loads the point spread function from a FITS file.

If no extension name is provided, the point spread function will be loaded from the "PSF" extension.

Implements GCTAPsf.

Definition at line 261 of file GCTAPsfVector.cpp.

References GFits::close(), GFilename::extname(), filename(), m_filename, read(), and GFits::table().

Referenced by GCTAPsfVector().

double GCTAPsfVector::mc ( GRan ran,
const double &  logE,
const double &  theta = 0.0,
const double &  phi = 0.0,
const double &  zenith = 0.0,
const double &  azimuth = 0.0,
const bool &  etrue = true 
) const
virtual

Simulate PSF offset (radians)

Parameters
[in]ranRandom number generator.
[in]logELog10 of the true photon energy (TeV).
[in]thetaOffset angle in camera system (rad). Not used.
[in]phiAzimuth angle in camera system (rad). Not used.
[in]zenithZenith angle in Earth system (rad). Not used.
[in]azimuthAzimuth angle in Earth system (rad). Not used.
[in]etrueUse true energy (true/false). Not used.

Implements GCTAPsf.

Definition at line 386 of file GCTAPsfVector.cpp.

References GRan::chisq2(), m_par_sigma, and update().

double GCTAPsfVector::operator() ( const double &  delta,
const double &  logE,
const double &  theta = 0.0,
const double &  phi = 0.0,
const double &  zenith = 0.0,
const double &  azimuth = 0.0,
const bool &  etrue = true 
) const
virtual

Return point spread function (in units of sr^-1)

Parameters
[in]deltaAngular separation between true and measured photon directions (rad).
[in]logELog10 of the true photon energy (TeV).
[in]thetaOffset angle in camera system (rad). Not used.
[in]phiAzimuth angle in camera system (rad). Not used.
[in]zenithZenith angle in Earth system (rad). Not used.
[in]azimuthAzimuth angle in Earth system (rad). Not used.
[in]etrueUse true energy (true/false). Not used.

Returns the point spread function for a given angular separation in units of sr^-1 for a given energy.

Implements GCTAPsf.

Definition at line 177 of file GCTAPsfVector.cpp.

References exp(), m_par_scale, m_par_width, and update().

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

Assignment operator.

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

Definition at line 138 of file GCTAPsfVector.cpp.

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

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

Print point spread function information.

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

Implements GCTAPsf.

Definition at line 509 of file GCTAPsfVector.cpp.

References m_filename, m_logE, gammalib::parformat(), pow(), SILENT, GNodeArray::size(), and gammalib::str().

void GCTAPsfVector::read ( const GFitsTable table)

Read point spread function vector from FITS table.

Parameters
[in]tableFITS table.

Reads a point spread function vector from the FITS table.

The energies are converted to TeV. Conversion is done based on the units provided for the energy columns. Units that are recognized are 'keV', 'MeV', 'GeV', and 'TeV' (case independent).

The Gaussian width parameter may be either given in 68% containment radius (R68) or in sigma (ANGRES40; corresponding to a 38% containment radius). The former format is used for CTA and H.E.S.S. data, the latter for MAGIC data. All these things should be more uniform once we have a well defined format.

Definition at line 300 of file GCTAPsfVector.cpp.

References GNodeArray::append(), GNodeArray::clear(), GFitsTable::contains(), gammalib::deg2rad, log10(), m_logE, m_r68, m_sigma, GFitsTableCol::nrows(), GFitsTableCol::real(), gammalib::strip_whitespace(), gammalib::tolower(), and GFitsTableCol::unit().

Referenced by load().

void GCTAPsfVector::update ( const double &  logE) const
private

Update PSF parameter cache.

Parameters
[in]logELog10 of the true photon energy (TeV).

This method updates the PSF parameter cache. As the performance table PSF only depends on energy, the only parameter on which the cache values depend is the energy.

Definition at line 606 of file GCTAPsfVector.cpp.

References GNodeArray::interpolate(), m_logE, m_par_logE, m_par_scale, m_par_sigma, m_par_width, m_sigma, and gammalib::twopi.

Referenced by containment_radius(), delta_max(), mc(), and operator()().

Member Data Documentation

GFilename GCTAPsfVector::m_filename
private

Name of Aeff response file.

Definition at line 108 of file GCTAPsfVector.hpp.

Referenced by copy_members(), filename(), init_members(), load(), and print().

GNodeArray GCTAPsfVector::m_logE
private

log(E) nodes for Aeff interpolation

Definition at line 109 of file GCTAPsfVector.hpp.

Referenced by copy_members(), init_members(), print(), read(), and update().

double GCTAPsfVector::m_par_logE
mutableprivate

Energy for which precomputation is done.

Definition at line 114 of file GCTAPsfVector.hpp.

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

double GCTAPsfVector::m_par_scale
mutableprivate

Gaussian normalization.

Definition at line 115 of file GCTAPsfVector.hpp.

Referenced by containment_radius(), copy_members(), init_members(), operator()(), and update().

double GCTAPsfVector::m_par_sigma
mutableprivate

Gaussian sigma (radians)

Definition at line 116 of file GCTAPsfVector.hpp.

Referenced by copy_members(), delta_max(), init_members(), mc(), and update().

double GCTAPsfVector::m_par_width
mutableprivate

Gaussian width parameter.

Definition at line 117 of file GCTAPsfVector.hpp.

Referenced by containment_radius(), copy_members(), init_members(), operator()(), and update().

std::vector<double> GCTAPsfVector::m_r68
private

68% containment radius of PSF in degrees

Definition at line 110 of file GCTAPsfVector.hpp.

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

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

Sigma value of PSF in radians.

Definition at line 111 of file GCTAPsfVector.hpp.

Referenced by copy_members(), init_members(), read(), and update().


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