GammaLib
2.1.0.dev
|
Fermi/LAT point spread function version 3 class. More...
#include <GLATPsfV3.hpp>
Classes | |
class | base_integrand |
Public Member Functions | |
GLATPsfV3 (void) | |
Void constructor. More... | |
GLATPsfV3 (const GLATPsfV3 &psf) | |
Copy constructor. More... | |
virtual | ~GLATPsfV3 (void) |
Destructor. More... | |
GLATPsfV3 & | operator= (const GLATPsfV3 &psf) |
Assignment operator. More... | |
void | clear (void) |
Clear point spread function. More... | |
GLATPsfV3 * | clone (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... | |
GLATPsfBase & | operator= (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 GLATPsfV3 &psf) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
double | eval_psf (const double &offset, const double &energy, const int &index) |
Evaluate PSF for a specific set of parameters. More... | |
double | integrate_psf (const double &energy, const int &index) |
Integrates PSF for a specific set of parameters. More... | |
void | normalize_psf (void) |
Normalize PSF for all parameters. 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_ntail |
PSF ntail parameter. More... | |
std::vector< double > | m_score |
PSF score parameter. More... | |
std::vector< double > | m_stail |
PSF stail 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... | |
Fermi/LAT point spread function version 3 class.
Version 3 of the Fermi/LAT PSF is the sum of two King model functions. In contrast to version 2, this class interpolates the distributions rather than the parameters.
This class has been inspired by code from the Fermi/LAT ScienceTools. For comparison check the file irfs/latResponse/src/Psf3.h
Definition at line 51 of file GLATPsfV3.hpp.
GLATPsfV3::GLATPsfV3 | ( | void | ) |
Void constructor.
Definition at line 61 of file GLATPsfV3.cpp.
References init_members().
Referenced by clone().
GLATPsfV3::GLATPsfV3 | ( | const GLATPsfV3 & | psf | ) |
Copy constructor.
[in] | psf | Point spread function. |
Definition at line 76 of file GLATPsfV3.cpp.
References copy_members(), and init_members().
|
virtual |
|
staticprivate |
Return point spread base function value.
[in] | u | Function argument. |
[in] | gamma | Index. |
The version 3 PSF base function is given by
\[\left(1 - \frac{1}{\Gamma} \right) \left(1 + \frac{u}{\Gamma} \right)^{-\Gamma}\]
Definition at line 507 of file GLATPsfV3.cpp.
References pow().
Referenced by GLATPsfV3::base_integrand::eval(), and eval_psf().
|
staticprivate |
Return approximation of point spread base function integral.
[in] | u | Function argument. |
[in] | gamma | Index. |
The version 3 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.
Definition at line 534 of file GLATPsfV3.cpp.
References pow().
Referenced by integrate_psf().
|
inlinevirtual |
Return class name.
Implements GLATPsfBase.
Definition at line 130 of file GLATPsfV3.hpp.
|
virtual |
Clear point spread function.
Implements GLATPsfBase.
Definition at line 147 of file GLATPsfV3.cpp.
References free_members(), GLATPsfBase::free_members(), init_members(), and GLATPsfBase::init_members().
|
virtual |
Clone point spread function.
Implements GLATPsfBase.
Definition at line 167 of file GLATPsfV3.cpp.
References GLATPsfV3().
|
private |
Copy class members.
[in] | psf | Point spread function. |
Definition at line 472 of file GLATPsfV3.cpp.
References m_gcore, m_gtail, m_ncore, m_ntail, m_score, and m_stail.
Referenced by GLATPsfV3(), and operator=().
|
private |
Evaluate PSF for a specific set of parameters.
[in] | offset | Offset angle (radians). |
[in] | energy | Energy (MeV). |
[in] | index | Parameter array index. |
Evaluates PSF as function of offset angle and energy for a specific set of PSF parameters. The parameter set that is used is specified by the index parameter. The energy parameter only serves to scale the score and stail parameters of the PSF.
This method is inspired from the Fermi/LAT Science Tools method Psf3::evaluate.
Definition at line 559 of file GLATPsfV3.cpp.
References base_fct(), m_gcore, m_gtail, m_ncore, m_ntail, m_score, m_stail, psf(), and GLATPsfBase::scale_factor().
Referenced by psf().
|
private |
Delete class members.
Definition at line 490 of file GLATPsfV3.cpp.
Referenced by clear(), operator=(), and ~GLATPsfV3().
|
private |
Initialise class members.
Definition at line 452 of file GLATPsfV3.cpp.
References m_gcore, m_gtail, m_ncore, m_ntail, m_score, and m_stail.
Referenced by clear(), GLATPsfV3(), and operator=().
|
private |
Integrates PSF for a specific set of parameters.
[in] | energy | Energy (MeV). |
[in] | index | Parameter array index. |
Integrates PSF for a specific set of parameters.
Compile option G_APPROXIMATE_PSF_INTEGRAL: If defined, a numerical PSF integral is only performed for energies < 120 MeV, while for larger energies the small angle approximation is used. In not defined, a numerical PSF integral is performed for all energies. This option is kept for comparison with the Fermi/LAT ScienceTools who select the integration method based on the true photon energy. As the normalization is only performed once upon loading of the PSF, CPU time is not really an issue here, and we can afford the more precise numerical integration. Note that the uncertainties of the approximation at energies near to 120 MeV reaches 0.1%.
Definition at line 609 of file GLATPsfV3.cpp.
References base_int(), m_gcore, m_gtail, m_ncore, m_ntail, m_score, m_stail, gammalib::pihalf, psf(), GIntegral::romberg(), GLATPsfBase::scale_factor(), and gammalib::twopi.
Referenced by normalize_psf().
|
private |
Normalize PSF for all parameters.
Makes sure that PSF is normalized for all parameters. We assure this by looping over all parameter nodes, integrating the PSF for each set of parameters, and dividing the NCORE parameter by the integral.
Compile option G_CHECK_PSF_NORM: If defined, checks that the PSF is normalized correctly.
Definition at line 679 of file GLATPsfV3.cpp.
References GLATResponseTable::costheta_lo(), GLATResponseTable::energy(), GLATResponseTable::index(), integrate_psf(), m_gcore, m_gtail, m_ncore, m_ntail, GLATPsfBase::m_rpsf_bins, m_score, m_stail, GLATResponseTable::ncostheta(), GLATResponseTable::nenergies(), norm(), gammalib::pihalf, GIntegral::romberg(), GLATPsfBase::scale_factor(), sum(), and gammalib::twopi.
Referenced by read().
Assignment operator.
[in] | psf | Point spread function. |
Definition at line 114 of file GLATPsfV3.cpp.
References copy_members(), free_members(), init_members(), and GLATPsfBase::operator=().
Print point spread function.
[in] | chatter | Chattiness (defaults to NORMAL). |
Implements GLATPsfBase.
Definition at line 425 of file GLATPsfV3.cpp.
References SILENT.
|
virtual |
Return point spread function value.
[in] | offset | Offset angle (deg). |
[in] | logE | Log10 of the true photon energy (MeV). |
[in] | ctheta | Cosine of zenith angle. |
Evaluates point spread function by doing a bi-linear interpolation of PSF values obtained at the 4 corners that bound the specified energy and cos(theta) value.
This method is inspired by the Fermi/LAT Science Tools method Psf3::value.
Implements GLATPsfBase.
Definition at line 382 of file GLATPsfV3.cpp.
References gammalib::deg2rad, GLATResponseTable::energies(), eval_psf(), GLATResponseTable::indices(), GLATPsfBase::m_min_ctheta, GLATPsfBase::m_rpsf_bins, GLATResponseTable::set(), and GLATResponseTable::weights().
Referenced by eval_psf(), and integrate_psf().
|
virtual |
Read point spread function from FITS table.
[in] | table | FITS table. |
GException::invalid_argument | Inconsistent response table encountered |
Reads point spread function information from FITS HDU. In addition to the energy and costheta binning information, 6 columns are expected: NCORE, NTAIL, SCORE, STAIL, GCORE, and GTAIL.
The method assures that NCORE is set properly for each energy and cos(theta) bin so that the integral over the PSF amount to unity. This normalization is done by the method normalize_psf.
Implements GLATPsfBase.
Definition at line 189 of file GLATPsfV3.cpp.
References GLATResponseTable::costheta_lo(), G_READ, m_gcore, m_gtail, GLATPsfBase::m_min_ctheta, m_ncore, m_ntail, GLATPsfBase::m_rpsf_bins, m_score, m_stail, normalize_psf(), GFitsTableCol::number(), GLATResponseTable::read(), GFitsTableCol::real(), GLATPsfBase::size(), GLATResponseTable::size(), and gammalib::str().
|
inlinevirtual |
Return point spread function version number.
Implements GLATPsfBase.
Definition at line 142 of file GLATPsfV3.hpp.
|
virtual |
Write point spread function into FITS file.
[in] | file | FITS 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.
Implements GLATPsfBase.
Definition at line 308 of file GLATPsfV3.cpp.
References GFitsTable::append(), GFits::append(), GFitsHDU::card(), GFitsHDU::extname(), GLATPsfBase::front(), m_gcore, m_gtail, m_ncore, m_ntail, GLATPsfBase::m_rpsf_bins, m_score, m_stail, GLATPsfBase::size(), GLATResponseTable::size(), and GLATResponseTable::write().
|
private |
PSF gcore parameter.
Definition at line 119 of file GLATPsfV3.hpp.
Referenced by copy_members(), eval_psf(), init_members(), integrate_psf(), normalize_psf(), read(), and write().
|
private |
PSF gtail parameter.
Definition at line 120 of file GLATPsfV3.hpp.
Referenced by copy_members(), eval_psf(), init_members(), integrate_psf(), normalize_psf(), read(), and write().
|
private |
PSF ncore parameter.
Definition at line 115 of file GLATPsfV3.hpp.
Referenced by copy_members(), eval_psf(), init_members(), integrate_psf(), normalize_psf(), read(), and write().
|
private |
PSF ntail parameter.
Definition at line 116 of file GLATPsfV3.hpp.
Referenced by copy_members(), eval_psf(), init_members(), integrate_psf(), normalize_psf(), read(), and write().
|
private |
PSF score parameter.
Definition at line 117 of file GLATPsfV3.hpp.
Referenced by copy_members(), eval_psf(), init_members(), integrate_psf(), normalize_psf(), read(), and write().
|
private |
PSF stail parameter.
Definition at line 118 of file GLATPsfV3.hpp.
Referenced by copy_members(), eval_psf(), init_members(), integrate_psf(), normalize_psf(), read(), and write().