GammaLib
2.1.0.dev
|
CTA 2D effective area class. More...
#include <GCTAAeff2D.hpp>
Public Member Functions | |
GCTAAeff2D (void) | |
Void constructor. More... | |
GCTAAeff2D (const GFilename &filename) | |
File constructor. More... | |
GCTAAeff2D (const GCTAAeff2D &cta) | |
Copy constructor. More... | |
virtual | ~GCTAAeff2D (void) |
Destructor. More... | |
GCTAAeff2D & | operator= (const GCTAAeff2D &aeff) |
Assignment operator. More... | |
double | operator() (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 effective area in units of cm2. More... | |
void | clear (void) |
Clear effective area. More... | |
GCTAAeff2D * | clone (void) const |
Clone effective area. More... | |
std::string | classname (void) const |
Return class name. More... | |
void | load (const GFilename &filename) |
Load effective area from FITS file. More... | |
GFilename | filename (void) const |
Return filename. More... | |
double | max (const double &logE, const double &zenith, const double &azimuth, const bool &etrue=true) const |
Return maximum effective area at a given energy in cm2. More... | |
GEbounds | ebounds (void) const |
Return energy boundaries. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print effective area information. More... | |
const double & | rad_max (void) const |
Return radius cut value. More... | |
void | rad_max (const double &rad_max) |
Set radius cut value. More... | |
const GCTAResponseTable & | table (void) const |
Return response table. More... | |
void | table (const GCTAResponseTable &table) |
Assign response table. More... | |
void | read (const GFitsTable &table) |
Read effective area from FITS table. More... | |
void | write (GFitsBinTable &table) const |
Write effective area into FITS binary table. More... | |
void | save (const GFilename &filename, const bool &clobber=false) const |
Save effective area into FITS file. More... | |
Public Member Functions inherited from GCTAAeff | |
GCTAAeff (void) | |
Void constructor. More... | |
GCTAAeff (const GCTAAeff &aeff) | |
Copy constructor. More... | |
virtual | ~GCTAAeff (void) |
Destructor. More... | |
GCTAAeff & | operator= (const GCTAAeff &aeff) |
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 GCTAAeff2D &aeff) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | set_indices (void) |
Set table indices. More... | |
void | set_boundaries (void) |
Set effective area boundaries. More... | |
Private Attributes | |
GFilename | m_filename |
Name of Aeff response file. More... | |
GCTAResponseTable | m_aeff |
Aeff response table. More... | |
GEbounds | m_ebounds |
Energy boundaries. More... | |
int | m_inx_energy |
Energy index. More... | |
int | m_inx_theta |
Theta index. More... | |
int | m_inx_aeff |
Effective area (true energy) More... | |
int | m_inx_aeff_reco |
Effective area (reco. energy) More... | |
double | m_logE_min |
Minimum logE (log10(E/TeV)) More... | |
double | m_logE_max |
Maximum logE (log10(E/TeV)) More... | |
double | m_theta_min |
Minimum theta (radians) More... | |
double | m_theta_max |
Maximum theta (radians) More... | |
double | m_lo_thres |
Lower energy threshold (TeV) More... | |
double | m_hi_thres |
Upper energy threshold (TeV) More... | |
double | m_rad_max |
Radius cut (degrees) More... | |
Additional Inherited Members | |
Protected Member Functions inherited from GCTAAeff | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GCTAAeff &aeff) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
CTA 2D effective area class.
This class implements the CTA effective area response as function of energy and offset angle.
Definition at line 55 of file GCTAAeff2D.hpp.
GCTAAeff2D::GCTAAeff2D | ( | void | ) |
Void constructor.
Constructs empty effective area.
Definition at line 64 of file GCTAAeff2D.cpp.
References init_members().
Referenced by clone().
|
explicit |
File constructor.
[in] | filename | FITS file name. |
Constructs effective area from a FITS file.
Definition at line 81 of file GCTAAeff2D.cpp.
References init_members(), and load().
GCTAAeff2D::GCTAAeff2D | ( | const GCTAAeff2D & | aeff | ) |
Copy constructor.
[in] | aeff | Effective area. |
Constructs effective area by copying from another effective area.
Definition at line 101 of file GCTAAeff2D.cpp.
References copy_members(), and init_members().
|
virtual |
Destructor.
Destructs effective area.
Definition at line 119 of file GCTAAeff2D.cpp.
References free_members().
|
inlinevirtual |
Return class name.
Implements GCTAAeff.
Definition at line 128 of file GCTAAeff2D.hpp.
|
virtual |
Clear effective area.
Clears effective area.
Implements GCTAAeff.
Definition at line 233 of file GCTAAeff2D.cpp.
References GCTAAeff::free_members(), free_members(), GCTAAeff::init_members(), and init_members().
|
virtual |
Clone effective area.
Returns a pointer to a deep copy of the effective area.
Implements GCTAAeff.
Definition at line 255 of file GCTAAeff2D.cpp.
References GCTAAeff2D().
|
private |
Copy class members.
[in] | aeff | Effective area. |
Definition at line 663 of file GCTAAeff2D.cpp.
References m_aeff, m_ebounds, m_filename, m_hi_thres, m_inx_aeff, m_inx_aeff_reco, m_inx_energy, m_inx_theta, m_lo_thres, m_logE_max, m_logE_min, m_rad_max, m_theta_max, and m_theta_min.
Referenced by GCTAAeff2D(), and operator=().
|
inlinevirtual |
Return energy boundaries.
Implements GCTAAeff.
Definition at line 152 of file GCTAAeff2D.hpp.
References m_ebounds.
|
inlinevirtual |
Return filename.
Implements GCTAAeff.
Definition at line 140 of file GCTAAeff2D.hpp.
References m_filename.
Referenced by load().
|
private |
Delete class members.
Definition at line 689 of file GCTAAeff2D.cpp.
Referenced by clear(), operator=(), and ~GCTAAeff2D().
|
private |
Initialise class members.
Definition at line 635 of file GCTAAeff2D.cpp.
References GCTAResponseTable::clear(), GFilename::clear(), GEbounds::clear(), m_aeff, m_ebounds, m_filename, m_hi_thres, m_inx_aeff, m_inx_aeff_reco, m_inx_energy, m_inx_theta, m_lo_thres, m_logE_max, m_logE_min, m_rad_max, m_theta_max, and m_theta_min.
Referenced by clear(), GCTAAeff2D(), and operator=().
|
virtual |
Load effective area from FITS file.
[in] | filename | FITS file name. |
Loads the effective area from a FITS file.
If no extension name is given the method scans the HDUCLASS
keywords of all extensions and loads the effective area from the first extension for which HDUCLAS4=AEFF_2D
.
Otherwise, the effective area will be loaded from the EFFECTIVE AREA
extension.
Implements GCTAAeff.
Definition at line 386 of file GCTAAeff2D.cpp.
References GFits::close(), GFilename::extname(), gammalib::extname_cta_aeff2d, filename(), gammalib::gadf_hduclas4(), m_filename, read(), table(), and GFits::table().
Referenced by GCTAAeff2D().
|
virtual |
Return maximum effective area at a given energy in cm2.
[in] | logE | Log10 of the true photon energy (TeV). |
[in] | zenith | Zenith angle in Earth system (rad). |
[in] | azimuth | Azimuth angle in Earth system (rad). |
[in] | etrue | Use true energy? |
Returns the maximum effective area for a given energy, zenith and azimuth angle in units of cm2.
Implements GCTAAeff.
Definition at line 477 of file GCTAAeff2D.cpp.
References GCTAResponseTable::axis_bins(), GCTAResponseTable::axis_hi(), GCTAResponseTable::axis_lo(), gammalib::deg2rad, m_aeff, m_inx_aeff, m_inx_aeff_reco, m_inx_energy, and m_inx_theta.
|
virtual |
Return effective area in units of cm2.
[in] | logE | Log10 of the true photon energy (TeV). |
[in] | theta | Offset angle in camera system (rad) (default: 0.0). |
[in] | phi | Azimuth angle in camera system (rad). |
[in] | zenith | Zenith angle in Earth system (rad). |
[in] | azimuth | Azimuth angle in Earth system (rad). |
[in] | etrue | Use true energy? |
Returns the effective area in units of cm2 for a given energy and offset angle. The effective area is bi-linearly interpolated in the log10(energy) - offset angle plane. The method assures that the effective area value never becomes negative. Outside the logE - theta range covered by the response table the effective area will be set to zero.
The method supports true and reconstructed energies for logE. To access the effective area as function of true energy, specify etrue=true (this is the default). The obtained the effective area as function of reconstructed energy, specify etrue=false.
Implements GCTAAeff.
Definition at line 189 of file GCTAAeff2D.cpp.
References m_aeff, m_inx_aeff, m_inx_aeff_reco, m_inx_energy, m_logE_max, m_logE_min, m_theta_max, and m_theta_min.
GCTAAeff2D & GCTAAeff2D::operator= | ( | const GCTAAeff2D & | aeff | ) |
Assignment operator.
[in] | aeff | Effective area. |
Assigns effective area.
Definition at line 143 of file GCTAAeff2D.cpp.
References copy_members(), free_members(), init_members(), and GCTAAeff::operator=().
Print effective area information.
[in] | chatter | Chattiness. |
Implements GCTAAeff.
Definition at line 556 of file GCTAAeff2D.cpp.
References GCTAResponseTable::axes(), GCTAResponseTable::axis_bins(), GCTAResponseTable::axis_hi(), GCTAResponseTable::axis_lo(), m_aeff, m_filename, m_hi_thres, m_inx_energy, m_inx_theta, m_lo_thres, m_rad_max, gammalib::parformat(), SILENT, and gammalib::str().
|
inline |
Return radius cut value.
Definition at line 164 of file GCTAAeff2D.hpp.
References m_rad_max.
Referenced by GCTAOnOffObservation::arf_rad_max(), and rad_max().
|
inline |
Set radius cut value.
[in] | rad_max | Radius cut value (degrees) |
Definition at line 176 of file GCTAAeff2D.hpp.
void GCTAAeff2D::read | ( | const GFitsTable & | table | ) |
Read effective area from FITS table.
[in] | table | FITS table. |
GException::invalid_value | Response table is not two-dimensional. |
Reads the effective area form the FITS table
. The following column names are mandatory:
ENERG_LO - Energy lower bin boundaries ENERG_HI - Energy upper bin boundaries THETA_LO - Offset angle lower bin boundaries THETA_HI - Offset angle upper bin boundaries EFFAREA - Effective area
In addition, the following column names are optional:
EFFAREA_RECO - Effective area as function of reconstructed energy
The data are stored in the m_aeff member. The energy axis will be set to log10, the offset angle axis to radians.
Definition at line 288 of file GCTAAeff2D.cpp.
References GCTAResponseTable::axes(), GCTAResponseTable::axis_log10(), GCTAResponseTable::axis_radians(), GCTAResponseTable::clear(), G_READ, GFitsHDU::has_card(), m_aeff, m_hi_thres, m_inx_energy, m_inx_theta, m_lo_thres, m_rad_max, GCTAResponseTable::read(), GFitsHDU::real(), GCTAResponseTable::scale(), set_boundaries(), set_indices(), gammalib::str(), and GCTAResponseTable::tables().
Referenced by load().
void GCTAAeff2D::save | ( | const GFilename & | filename, |
const bool & | clobber = false |
||
) | const |
Save effective area into FITS file.
[in] | filename | FITS file name. |
[in] | clobber | Overwrite existing file? |
Saves effectiva area into a FITS file. If a file with the given filename
does not yet exist it will be created, otherwise the method opens the existing file. The method will create a (or replace an existing) effective area extension. The extension name can be specified as part of the filename
, or if no extension name is given, is assumed to be EFFECTIVE AREA
.
An existing file will only be modified if the clobber
flag is set to true.
Definition at line 431 of file GCTAAeff2D.cpp.
References GFitsHDU::extname(), GFilename::extname(), gammalib::extname_cta_aeff2d, GFits::remove(), table(), GFilename::url(), and write().
|
private |
Set effective area boundaries.
Sets the data members m_ebounds, m_logE_min, m_logE_max, m_theta_min and m_theta_max that define the validity range of the effective area.
Definition at line 724 of file GCTAAeff2D.cpp.
References GEbounds::append(), GCTAResponseTable::axis_bins(), GCTAResponseTable::axis_hi(), GCTAResponseTable::axis_hi_unit(), GCTAResponseTable::axis_lo(), GCTAResponseTable::axis_lo_unit(), GEbounds::clear(), gammalib::deg2rad, m_aeff, m_ebounds, m_inx_energy, m_inx_theta, m_logE_max, m_logE_min, m_theta_max, and m_theta_min.
|
private |
Set table indices.
Sets the data members m_inx_energy, m_inx_theta, m_inx_aeff and optionally m_inx_aeff_reco.
Definition at line 702 of file GCTAAeff2D.cpp.
References GCTAResponseTable::axis(), GCTAResponseTable::has_table(), m_aeff, m_inx_aeff, m_inx_aeff_reco, m_inx_energy, m_inx_theta, and GCTAResponseTable::table().
|
inline |
void GCTAAeff2D::table | ( | const GCTAResponseTable & | table | ) |
Assign response table.
[in] | table | Response table. |
Assigns the response table for an effective area. The effective area values are given in units of cm2.
Definition at line 528 of file GCTAAeff2D.cpp.
References GCTAResponseTable::axis_log10(), GCTAResponseTable::axis_radians(), m_aeff, m_inx_energy, m_inx_theta, set_boundaries(), set_indices(), and table().
void GCTAAeff2D::write | ( | GFitsBinTable & | table | ) | const |
Write effective area into FITS binary table.
[in] | table | FITS binary table. |
Writes effective area into a FITS binary table
.
Definition at line 341 of file GCTAAeff2D.cpp.
References GFitsHDU::card(), m_aeff, m_hi_thres, m_lo_thres, m_rad_max, GCTAResponseTable::scale(), GCTAResponseTable::tables(), and GCTAResponseTable::write().
Referenced by save().
|
private |
Aeff response table.
Definition at line 106 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), max(), operator()(), print(), read(), set_boundaries(), set_indices(), table(), and write().
|
private |
Energy boundaries.
Definition at line 107 of file GCTAAeff2D.hpp.
Referenced by copy_members(), ebounds(), init_members(), and set_boundaries().
|
private |
Name of Aeff response file.
Definition at line 105 of file GCTAAeff2D.hpp.
Referenced by copy_members(), filename(), init_members(), load(), and print().
|
private |
Upper energy threshold (TeV)
Definition at line 117 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), print(), read(), and write().
|
private |
Effective area (true energy)
Definition at line 110 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), max(), operator()(), and set_indices().
|
private |
Effective area (reco. energy)
Definition at line 111 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), max(), operator()(), and set_indices().
|
private |
Energy index.
Definition at line 108 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), max(), operator()(), print(), read(), set_boundaries(), set_indices(), and table().
|
private |
Theta index.
Definition at line 109 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), max(), print(), read(), set_boundaries(), set_indices(), and table().
|
private |
Lower energy threshold (TeV)
Definition at line 116 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), print(), read(), and write().
|
private |
Maximum logE (log10(E/TeV))
Definition at line 113 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), operator()(), and set_boundaries().
|
private |
Minimum logE (log10(E/TeV))
Definition at line 112 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), operator()(), and set_boundaries().
|
private |
Radius cut (degrees)
Definition at line 118 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), print(), rad_max(), read(), and write().
|
private |
Maximum theta (radians)
Definition at line 115 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), operator()(), and set_boundaries().
|
private |
Minimum theta (radians)
Definition at line 114 of file GCTAAeff2D.hpp.
Referenced by copy_members(), init_members(), operator()(), and set_boundaries().