GammaLib
2.1.0.dev
|
CTA vector point spread function class. More...
#include <GCTAPsfVector.hpp>
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... | |
GCTAPsfVector & | operator= (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... | |
GCTAPsfVector * | clone (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... | |
GCTAPsf & | operator= (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... | |
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.
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.
[in] | filename | PSF 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.
[in] | psf | Point spread function. |
Definition at line 100 of file GCTAPsfVector.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GCTAPsf.
Definition at line 127 of file GCTAPsfVector.hpp.
|
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().
|
virtual |
Clone instance.
Implements GCTAPsf.
Definition at line 245 of file GCTAPsfVector.cpp.
References GCTAPsfVector().
|
virtual |
Return the radius that contains a fraction of the events (radians)
[in] | fraction | of events (0.0-1.0) |
[in] | logE | Log10 of the true photon energy (TeV). |
[in] | theta | Offset angle in camera system (rad). Not used. |
[in] | phi | Azimuth angle in camera system (rad). Not used. |
[in] | zenith | Zenith angle in Earth system (rad). Not used. |
[in] | azimuth | Azimuth angle in Earth system (rad). Not used. |
[in] | etrue | Use true energy (true/false). Not used. |
GException::invalid_argument | Invalid 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().
|
private |
Copy class members.
[in] | psf | Point 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=().
|
virtual |
Return maximum size of PSF (radians)
[in] | logE | Log10 of the true photon energy (TeV). |
[in] | theta | Offset angle in camera system (rad). Not used. |
[in] | phi | Azimuth angle in camera system (rad). Not used. |
[in] | zenith | Zenith angle in Earth system (rad). Not used. |
[in] | azimuth | Azimuth angle in Earth system (rad). Not used. |
[in] | etrue | Use 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().
|
inlinevirtual |
Return 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().
|
private |
Delete class members.
Definition at line 590 of file GCTAPsfVector.cpp.
Referenced by clear(), operator=(), and ~GCTAPsfVector().
|
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=().
|
virtual |
Load point spread function from FITS file.
[in] | filename | FITS 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().
|
virtual |
Simulate PSF offset (radians)
[in] | ran | Random number generator. |
[in] | logE | Log10 of the true photon energy (TeV). |
[in] | theta | Offset angle in camera system (rad). Not used. |
[in] | phi | Azimuth angle in camera system (rad). Not used. |
[in] | zenith | Zenith angle in Earth system (rad). Not used. |
[in] | azimuth | Azimuth angle in Earth system (rad). Not used. |
[in] | etrue | Use true energy (true/false). Not used. |
Implements GCTAPsf.
Definition at line 386 of file GCTAPsfVector.cpp.
References GRan::chisq2(), m_par_sigma, and update().
|
virtual |
Return point spread function (in units of sr^-1)
[in] | delta | Angular separation between true and measured photon directions (rad). |
[in] | logE | Log10 of the true photon energy (TeV). |
[in] | theta | Offset angle in camera system (rad). Not used. |
[in] | phi | Azimuth angle in camera system (rad). Not used. |
[in] | zenith | Zenith angle in Earth system (rad). Not used. |
[in] | azimuth | Azimuth angle in Earth system (rad). Not used. |
[in] | etrue | Use 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.
[in] | psf | Point spread function. |
Definition at line 138 of file GCTAPsfVector.cpp.
References copy_members(), free_members(), init_members(), and GCTAPsf::operator=().
Print point spread function information.
[in] | chatter | Chattiness. |
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.
[in] | table | FITS 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().
|
private |
Update PSF parameter cache.
[in] | logE | Log10 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()().
|
private |
Name of Aeff response file.
Definition at line 108 of file GCTAPsfVector.hpp.
Referenced by copy_members(), filename(), init_members(), load(), and print().
|
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().
|
mutableprivate |
Energy for which precomputation is done.
Definition at line 114 of file GCTAPsfVector.hpp.
Referenced by copy_members(), init_members(), and update().
|
mutableprivate |
Gaussian normalization.
Definition at line 115 of file GCTAPsfVector.hpp.
Referenced by containment_radius(), copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Gaussian sigma (radians)
Definition at line 116 of file GCTAPsfVector.hpp.
Referenced by copy_members(), delta_max(), init_members(), mc(), and update().
|
mutableprivate |
Gaussian width parameter.
Definition at line 117 of file GCTAPsfVector.hpp.
Referenced by containment_radius(), copy_members(), init_members(), operator()(), and update().
|
private |
68% containment radius of PSF in degrees
Definition at line 110 of file GCTAPsfVector.hpp.
Referenced by copy_members(), init_members(), and read().
|
private |
Sigma value of PSF in radians.
Definition at line 111 of file GCTAPsfVector.hpp.
Referenced by copy_members(), init_members(), read(), and update().