GammaLib
2.1.0.dev
|
Interface for the Fermi/LAT effective area. More...
#include <GLATAeff.hpp>
Public Member Functions | |
GLATAeff (void) | |
Void constructor. More... | |
GLATAeff (const GFilename &filename, const std::string &evtype) | |
File constructor. More... | |
GLATAeff (const GLATAeff &aeff) | |
Copy constructor. More... | |
virtual | ~GLATAeff (void) |
Destructor. More... | |
GLATAeff & | operator= (const GLATAeff &aeff) |
Assignment operator. More... | |
double | operator() (const double &logE, const double &ctheta) |
Return effective area in units of cm2. More... | |
double | operator() (const double &logE, const double &ctheta, const double &phi) |
Return effective area in units of cm2. More... | |
void | clear (void) |
Clear effective area. More... | |
GLATAeff * | clone (void) const |
Clone effective area. More... | |
std::string | classname (void) const |
Return class name. More... | |
const std::string & | evtype (void) const |
Return event type. More... | |
void | load (const GFilename &filename, const std::string &evtype) |
Load effective area from FITS file. More... | |
void | save (const GFilename &filename, const bool &clobber=false) |
Save effective area into FITS file. More... | |
void | read (const GFits &file, const std::string &evtype) |
Read effective area from FITS file. More... | |
void | write (GFits &file) const |
Write effective area into FITS file. More... | |
int | size (void) const |
Return number of bins in effective area response. More... | |
int | nenergies (void) const |
Return number of energies in effective area response. More... | |
int | ncostheta (void) const |
Return number of cosine theta bins in effective area response. More... | |
const double & | costhetamin (void) const |
Return cosine theta minimum. More... | |
void | costhetamin (const double &ctheta) |
Set minimum cos(theta) angle for effective area access. More... | |
bool | has_phi (void) const |
Signal that effective area has Phi dependence. More... | |
bool | has_efficiency (void) const |
Signals whether efficiency factors are present. More... | |
double | efficiency_factor1 (const GEnergy &srcEng) const |
Returns efficiency factor 1. More... | |
double | efficiency_factor2 (const GEnergy &srcEng) const |
Returns efficiency factor 2. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print effective area information. 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 GLATAeff &aeff) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | read_aeff (const GFitsTable &hdu) |
Read effective area from FITS table. More... | |
void | read_efficiency (const GFitsTable &hdu) |
Read efficiency factor parameters from FITS table. More... | |
void | write_aeff (GFits &file) const |
Write effective area into FITS file. More... | |
void | write_efficiency (GFits &file) const |
Write efficiency factors into FITS file. More... | |
Private Attributes | |
std::string | m_evtype |
Event type. More... | |
GLATResponseTable | m_aeff_bins |
Aeff energy and cos theta binning. More... | |
std::vector< double > | m_aeff |
Aeff array. More... | |
double | m_min_ctheta |
Minimum valid cos(theta) More... | |
GLATEfficiency * | m_eff_func1 |
Efficiency functor 1. More... | |
GLATEfficiency * | m_eff_func2 |
Efficiency functor 2. More... | |
Interface for the Fermi/LAT effective area.
This class handles the effective area information for Fermi/LAT. It also handles the IRF efficiency information that has been introduced for Pass 7 data analysis.
Definition at line 59 of file GLATAeff.hpp.
GLATAeff::GLATAeff | ( | void | ) |
Void constructor.
Definition at line 63 of file GLATAeff.cpp.
References init_members().
Referenced by clone().
GLATAeff::GLATAeff | ( | const GFilename & | filename, |
const std::string & | evtype | ||
) |
File constructor.
[in] | filename | FITS file name. |
[in] | evtype | Event type. |
Construct instance by loading the information from a FITS file. Both the effective area information and the efficiency factor parameters are loaded when available.
Definition at line 83 of file GLATAeff.cpp.
References init_members(), and load().
GLATAeff::GLATAeff | ( | const GLATAeff & | aeff | ) |
Copy constructor.
[in] | aeff | Effective area. |
Definition at line 101 of file GLATAeff.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 122 of file GLATAeff.hpp.
|
virtual |
Clear effective area.
This method properly resets the object to an initial state.
Implements GBase.
Definition at line 229 of file GLATAeff.cpp.
References free_members(), and init_members().
Referenced by read().
|
virtual |
Clone effective area.
Implements GBase.
Definition at line 247 of file GLATAeff.cpp.
References GLATAeff().
|
private |
Copy class members.
[in] | aeff | Effective area. |
Definition at line 516 of file GLATAeff.cpp.
References GLATEfficiency::clone(), m_aeff, m_aeff_bins, m_eff_func1, m_eff_func2, m_evtype, and m_min_ctheta.
Referenced by GLATAeff(), and operator=().
|
inline |
Return cosine theta minimum.
Definition at line 182 of file GLATAeff.hpp.
References m_min_ctheta.
|
inline |
Set minimum cos(theta) angle for effective area access.
[in] | ctheta | Cosine of maximum zenith angle. |
Definition at line 194 of file GLATAeff.hpp.
References m_min_ctheta.
double GLATAeff::efficiency_factor1 | ( | const GEnergy & | srcEng | ) | const |
Returns efficiency factor 1.
[in] | srcEng | True energy of photon. |
Returns the efficiency factor 1 as function of the true photon energy.
If no efficiency factors are present returns 1.
Definition at line 403 of file GLATAeff.cpp.
References GEnergy::log10MeV(), and m_eff_func2.
Referenced by GLATLtCube::operator()().
double GLATAeff::efficiency_factor2 | ( | const GEnergy & | srcEng | ) | const |
Returns efficiency factor 2.
[in] | srcEng | True energy of photon. |
Returns the efficiency factor 2 as function of the true photon energy.
If no efficiency factors are present returns 2.
Definition at line 432 of file GLATAeff.cpp.
References GEnergy::log10MeV(), and m_eff_func1.
Referenced by GLATLtCube::operator()().
|
inline |
Return event type.
Definition at line 134 of file GLATAeff.hpp.
References m_evtype.
Referenced by read().
|
private |
Delete class members.
Definition at line 536 of file GLATAeff.cpp.
References m_eff_func1, and m_eff_func2.
Referenced by clear(), operator=(), and ~GLATAeff().
bool GLATAeff::has_efficiency | ( | void | ) | const |
Signals whether efficiency factors are present.
Verifies whether 2 efficiency factors are present. If efficiency factors are included in the effective area FITS file, they will be automatically loaded from the file, and efficiency factor functors will be allocated. Otherwise, the functors point towards NULL.
The method returns true if both efficiency factor functors exist, false otherwise.
Definition at line 384 of file GLATAeff.cpp.
References m_eff_func1, and m_eff_func2.
Referenced by GLATLtCube::operator()(), print(), and write_efficiency().
|
inline |
Signal that effective area has Phi dependence.
Definition at line 207 of file GLATAeff.hpp.
Referenced by GLATLtCubeMap::operator()().
|
private |
Initialise class members.
Definition at line 496 of file GLATAeff.cpp.
References GLATResponseTable::clear(), m_aeff, m_aeff_bins, m_eff_func1, m_eff_func2, m_evtype, and m_min_ctheta.
Referenced by clear(), GLATAeff(), and operator=().
void GLATAeff::load | ( | const GFilename & | filename, |
const std::string & | evtype | ||
) |
Load effective area from FITS file.
[in] | filename | FITS file. |
[in] | evtype | Event type. |
This method loads the effective area information, and if available, the efficiency factors, from the FITS response file. See the GLATAeff::read method for details.
Definition at line 263 of file GLATAeff.cpp.
References read().
Referenced by GLATAeff().
|
inline |
Return number of cosine theta bins in effective area response.
Definition at line 170 of file GLATAeff.hpp.
References m_aeff_bins, and GLATResponseTable::ncostheta().
|
inline |
Return number of energies in effective area response.
Definition at line 158 of file GLATAeff.hpp.
References m_aeff_bins, and GLATResponseTable::nenergies().
double GLATAeff::operator() | ( | const double & | logE, |
const double & | ctheta | ||
) |
Return effective area in units of cm2.
[in] | logE | Log10 of the true photon energy (MeV). |
[in] | ctheta | Cosine of zenith angle. |
Returns the effective area in units of cm2 for a given energy and cos(theta) angle. The effective area is bi-linearily interpolated in the log10(energy) - cos(theta) plane. The method assures that the effective area value never becomes negative.
Definition at line 171 of file GLATAeff.cpp.
References GLATResponseTable::interpolate(), m_aeff, m_aeff_bins, and m_min_ctheta.
double GLATAeff::operator() | ( | const double & | logE, |
const double & | ctheta, | ||
const double & | phi | ||
) |
Return effective area in units of cm2.
[in] | logE | Log10 of the true photon energy (MeV). |
[in] | ctheta | Cosine of zenith angle. |
[in] | phi | Azimuth angle. |
Returns the effective area in units of cm2 for a given energy, cos(theta) angle and azimuth angle. The effective area is bi-linearily interpolated in the log10(energy) - cos(theta) plane. The method assures that the effective area value never becomes negative.
Definition at line 201 of file GLATAeff.cpp.
References GLATResponseTable::interpolate(), m_aeff, m_aeff_bins, and m_min_ctheta.
Assignment operator.
[in] | aeff | Effective area. |
Definition at line 139 of file GLATAeff.cpp.
References copy_members(), free_members(), and init_members().
Print effective area information.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 455 of file GLATAeff.cpp.
References has_efficiency(), m_evtype, ncostheta(), nenergies(), gammalib::parformat(), SILENT, and gammalib::str().
void GLATAeff::read | ( | const GFits & | fits, |
const std::string & | evtype | ||
) |
Read effective area from FITS file.
[in] | fits | FITS file. |
[in] | evtype | Event type. |
Reads the effective area and efficiency parameter information form the FITS file. The effective area is read from the extension EFFECTIVE AREA
(or EFFECTIVE AREA_<evtype>
for Pass 8), the efficiency parameter information from the extension EFFICIENCY_PARAMS
(or EFFICIENCY_PARAMS_<evtype>
for Pass 8). If the latter extension does not exist, no efficiency parameters will be loaded.
Definition at line 317 of file GLATAeff.cpp.
References clear(), GFits::contains(), evtype(), gammalib::extname_lat_aeff, gammalib::extname_lat_efficiency, m_evtype, read_aeff(), read_efficiency(), and GFits::table().
Referenced by load().
|
private |
Read effective area from FITS table.
[in] | hdu | FITS table. |
GException::invalid_argument | Inconsistent response table encountered |
The effective area is converted into units of cm2.
Definition at line 561 of file GLATAeff.cpp.
References GLATResponseTable::costheta_lo(), G_READ_AEFF, m_aeff, m_aeff_bins, m_evtype, m_min_ctheta, GFitsTableCol::number(), GLATResponseTable::read(), GFitsTableCol::real(), GLATResponseTable::size(), size(), gammalib::str(), GFitsHDU::string(), and gammalib::strip_whitespace().
Referenced by read().
|
private |
Read efficiency factor parameters from FITS table.
[in] | hdu | FITS table. |
Reads the efficiency factor parameters from the EFFICIENCY_PARS column of the EFFICIENCY_PARAMS extension in the effective area file. Note that the column contains efficiency factor parameters for the front and back section of the LAT detector, and we read here only those factors that apply to the section for which the effective area has been defined. In that way, we keep the efficiency factors separate for each detector section, which is more precise than the handling in ScienceTools which apply average efficiency factors.
This method does not read efficiency factor parameters if neither the front nor the back section of the detector has been identified.
Definition at line 672 of file GLATAeff.cpp.
References m_eff_func1, m_eff_func2, m_evtype, GFitsTableCol::nrows(), and GFitsTableCol::real().
Referenced by read().
void GLATAeff::save | ( | const GFilename & | filename, |
const bool & | clobber = false |
||
) |
Save effective area into FITS file.
[in] | filename | FITS file. |
[in] | clobber | Overwrite existing file? (default: false) |
This method saves the effective area information, and if available, the efficiency factors, into the FITS response file. See the GLATAeff::write method for details.
Definition at line 286 of file GLATAeff.cpp.
References GFits::saveto(), and write().
|
inline |
Return number of bins in effective area response.
Definition at line 146 of file GLATAeff.hpp.
References ncostheta(), and nenergies().
Referenced by read_aeff(), and write_aeff().
void GLATAeff::write | ( | GFits & | fits | ) | const |
Write effective area into FITS file.
[in] | fits | FITS file. |
Definition at line 360 of file GLATAeff.cpp.
References write_aeff(), and write_efficiency().
Referenced by save().
|
private |
Write effective area into FITS file.
[in] | file | FITS file. |
This method does not write anything if the instance is empty.
Definition at line 616 of file GLATAeff.cpp.
References GFitsTable::append(), GFits::append(), GFitsHDU::card(), GFitsHDU::extname(), gammalib::extname_lat_aeff, m_aeff, m_aeff_bins, m_evtype, GLATResponseTable::size(), size(), and GLATResponseTable::write().
Referenced by write().
|
private |
Write efficiency factors into FITS file.
[in] | file | FITS file. |
Writes efficiency factors into FITS file. The Pass 8 response format is used for writing the factors.
Definition at line 742 of file GLATAeff.cpp.
References GFitsTable::append(), GFits::append(), GFitsHDU::extname(), gammalib::extname_lat_efficiency, has_efficiency(), m_eff_func1, m_eff_func2, and GLATEfficiency::pars().
Referenced by write().
|
private |
Aeff array.
Definition at line 109 of file GLATAeff.hpp.
Referenced by copy_members(), init_members(), operator()(), read_aeff(), and write_aeff().
|
private |
Aeff energy and cos theta binning.
Definition at line 108 of file GLATAeff.hpp.
Referenced by copy_members(), init_members(), ncostheta(), nenergies(), operator()(), read_aeff(), and write_aeff().
|
private |
Efficiency functor 1.
Definition at line 111 of file GLATAeff.hpp.
Referenced by copy_members(), efficiency_factor2(), free_members(), has_efficiency(), init_members(), read_efficiency(), and write_efficiency().
|
private |
Efficiency functor 2.
Definition at line 112 of file GLATAeff.hpp.
Referenced by copy_members(), efficiency_factor1(), free_members(), has_efficiency(), init_members(), read_efficiency(), and write_efficiency().
|
private |
Event type.
Definition at line 107 of file GLATAeff.hpp.
Referenced by copy_members(), evtype(), init_members(), print(), read(), read_aeff(), read_efficiency(), and write_aeff().
|
private |
Minimum valid cos(theta)
Definition at line 110 of file GLATAeff.hpp.
Referenced by copy_members(), costhetamin(), init_members(), operator()(), and read_aeff().