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

CTA performance table point spread function class. More...

#include <GCTAPsfPerfTable.hpp>

Inheritance diagram for GCTAPsfPerfTable:
GCTAPsf GBase

Public Member Functions

 GCTAPsfPerfTable (void)
 Void constructor. More...
 
 GCTAPsfPerfTable (const GFilename &filename)
 File constructor. More...
 
 GCTAPsfPerfTable (const GCTAPsfPerfTable &psf)
 Copy constructor. More...
 
virtual ~GCTAPsfPerfTable (void)
 Destructor. More...
 
GCTAPsfPerfTableoperator= (const GCTAPsfPerfTable &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...
 
GCTAPsfPerfTableclone (void) const
 Clone instance. More...
 
std::string classname (void) const
 Return class name. More...
 
void load (const GFilename &filename)
 Load point spread function from performance table. 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...
 
- 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 GCTAPsfPerfTable &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_r80
 80% 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 performance table point spread function class.

This class implements the CTA point spread function response as function of energy as determined from a performance table. The performance table is an ASCII file that specifies the CTA performance parameters in a simple way.

Definition at line 50 of file GCTAPsfPerfTable.hpp.

Constructor & Destructor Documentation

GCTAPsfPerfTable::GCTAPsfPerfTable ( void  )

Void constructor.

Definition at line 63 of file GCTAPsfPerfTable.cpp.

References init_members().

Referenced by clone().

GCTAPsfPerfTable::GCTAPsfPerfTable ( const GFilename filename)

File constructor.

Parameters
[in]filenamePerformance table file name.

Construct instance by loading the point spread function information from an ASCII performance table.

Definition at line 81 of file GCTAPsfPerfTable.cpp.

References init_members(), and load().

GCTAPsfPerfTable::GCTAPsfPerfTable ( const GCTAPsfPerfTable psf)

Copy constructor.

Parameters
[in]psfPoint spread function.

Definition at line 99 of file GCTAPsfPerfTable.cpp.

References copy_members(), and init_members().

GCTAPsfPerfTable::~GCTAPsfPerfTable ( void  )
virtual

Destructor.

Definition at line 115 of file GCTAPsfPerfTable.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GCTAPsf.

Definition at line 125 of file GCTAPsfPerfTable.hpp.

void GCTAPsfPerfTable::clear ( void  )
virtual

Clear instance.

This method properly resets the object to an initial state.

Implements GCTAPsf.

Definition at line 224 of file GCTAPsfPerfTable.cpp.

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

GCTAPsfPerfTable * GCTAPsfPerfTable::clone ( void  ) const
virtual

Clone instance.

Returns
Deep copy of point spread function instance.

Implements GCTAPsf.

Definition at line 244 of file GCTAPsfPerfTable.cpp.

References GCTAPsfPerfTable().

double GCTAPsfPerfTable::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 425 of file GCTAPsfPerfTable.cpp.

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

void GCTAPsfPerfTable::copy_members ( const GCTAPsfPerfTable psf)
private

Copy class members.

Parameters
[in]psfPoint spread function.

Definition at line 521 of file GCTAPsfPerfTable.cpp.

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

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

double GCTAPsfPerfTable::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 369 of file GCTAPsfPerfTable.cpp.

References m_par_sigma, and update().

GFilename GCTAPsfPerfTable::filename ( void  ) const
inlinevirtual

Return filename.

Returns
Returns filename from which point spread function was loaded

Implements GCTAPsf.

Definition at line 137 of file GCTAPsfPerfTable.hpp.

References m_filename.

Referenced by load().

void GCTAPsfPerfTable::free_members ( void  )
private

Delete class members.

Definition at line 542 of file GCTAPsfPerfTable.cpp.

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

void GCTAPsfPerfTable::init_members ( void  )
private

Initialise class members.

Definition at line 498 of file GCTAPsfPerfTable.cpp.

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

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

void GCTAPsfPerfTable::load ( const GFilename filename)
virtual

Load point spread function from performance table.

Parameters
[in]filenamePerformance table file name.
Exceptions
GException::file_errorFile could not be opened for read access.

This method loads the point spread function information from an ASCII performance table.

Implements GCTAPsf.

Definition at line 261 of file GCTAPsfPerfTable.cpp.

References GNodeArray::append(), GNodeArray::clear(), gammalib::deg2rad, filename(), G_LOAD, m_filename, m_logE, m_r68, m_r80, m_sigma, gammalib::split(), gammalib::strip_whitespace(), gammalib::todouble(), and GFilename::url().

Referenced by GCTAPsfPerfTable().

double GCTAPsfPerfTable::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 336 of file GCTAPsfPerfTable.cpp.

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

double GCTAPsfPerfTable::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 176 of file GCTAPsfPerfTable.cpp.

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

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

Assignment operator.

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

Definition at line 137 of file GCTAPsfPerfTable.cpp.

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

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

Print point spread function information.

Parameters
[in]chatterChattiness.
Returns
String containing point spread function information.

Implements GCTAPsf.

Definition at line 459 of file GCTAPsfPerfTable.cpp.

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

void GCTAPsfPerfTable::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 558 of file GCTAPsfPerfTable.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 GCTAPsfPerfTable::m_filename
private

Name of Aeff response file.

Definition at line 105 of file GCTAPsfPerfTable.hpp.

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

GNodeArray GCTAPsfPerfTable::m_logE
private

log(E) nodes for Aeff interpolation

Definition at line 106 of file GCTAPsfPerfTable.hpp.

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

double GCTAPsfPerfTable::m_par_logE
mutableprivate

Energy for which precomputation is done.

Definition at line 112 of file GCTAPsfPerfTable.hpp.

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

double GCTAPsfPerfTable::m_par_scale
mutableprivate

Gaussian normalization.

Definition at line 113 of file GCTAPsfPerfTable.hpp.

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

double GCTAPsfPerfTable::m_par_sigma
mutableprivate

Gaussian sigma (radians)

Definition at line 114 of file GCTAPsfPerfTable.hpp.

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

double GCTAPsfPerfTable::m_par_width
mutableprivate

Gaussian width parameter.

Definition at line 115 of file GCTAPsfPerfTable.hpp.

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

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

68% containment radius of PSF in degrees

Definition at line 107 of file GCTAPsfPerfTable.hpp.

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

std::vector<double> GCTAPsfPerfTable::m_r80
private

80% containment radius of PSF in degrees

Definition at line 108 of file GCTAPsfPerfTable.hpp.

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

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

Sigma value of PSF in radians.

Definition at line 109 of file GCTAPsfPerfTable.hpp.

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


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