GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAAeff2D Class Reference

CTA 2D effective area class. More...

#include <GCTAAeff2D.hpp>

Inheritance diagram for GCTAAeff2D:
GCTAAeff GBase

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...
 
GCTAAeff2Doperator= (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...
 
GCTAAeff2Dclone (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 GCTAResponseTabletable (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...
 
GCTAAeffoperator= (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

GCTAAeff2D::GCTAAeff2D ( void  )

Void constructor.

Constructs empty effective area.

Definition at line 64 of file GCTAAeff2D.cpp.

References init_members().

Referenced by clone().

GCTAAeff2D::GCTAAeff2D ( const GFilename filename)
explicit

File constructor.

Parameters
[in]filenameFITS 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.

Parameters
[in]aeffEffective area.

Constructs effective area by copying from another effective area.

Definition at line 101 of file GCTAAeff2D.cpp.

References copy_members(), and init_members().

GCTAAeff2D::~GCTAAeff2D ( void  )
virtual

Destructor.

Destructs effective area.

Definition at line 119 of file GCTAAeff2D.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GCTAAeff.

Definition at line 128 of file GCTAAeff2D.hpp.

void GCTAAeff2D::clear ( void  )
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().

GCTAAeff2D * GCTAAeff2D::clone ( void  ) const
virtual

Clone effective area.

Returns
Deep copy of 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().

void GCTAAeff2D::copy_members ( const GCTAAeff2D aeff)
private

Copy class members.

Parameters
[in]aeffEffective 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=().

GEbounds GCTAAeff2D::ebounds ( void  ) const
inlinevirtual

Return energy boundaries.

Returns
Energy boundaries of effective area

Implements GCTAAeff.

Definition at line 152 of file GCTAAeff2D.hpp.

References m_ebounds.

GFilename GCTAAeff2D::filename ( void  ) const
inlinevirtual

Return filename.

Returns
Filename from which effective area was loaded

Implements GCTAAeff.

Definition at line 140 of file GCTAAeff2D.hpp.

References m_filename.

Referenced by load().

void GCTAAeff2D::free_members ( void  )
private

Delete class members.

Definition at line 689 of file GCTAAeff2D.cpp.

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

void GCTAAeff2D::init_members ( void  )
private
void GCTAAeff2D::load ( const GFilename filename)
virtual

Load effective area from FITS file.

Parameters
[in]filenameFITS 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().

double GCTAAeff2D::max ( const double &  logE,
const double &  zenith,
const double &  azimuth,
const bool &  etrue = true 
) const
virtual

Return maximum effective area at a given energy in cm2.

Parameters
[in]logELog10 of the true photon energy (TeV).
[in]zenithZenith angle in Earth system (rad).
[in]azimuthAzimuth angle in Earth system (rad).
[in]etrueUse true energy?
Returns
Maximum effective area (cm2).

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.

double GCTAAeff2D::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
virtual

Return effective area in units of cm2.

Parameters
[in]logELog10 of the true photon energy (TeV).
[in]thetaOffset angle in camera system (rad) (default: 0.0).
[in]phiAzimuth angle in camera system (rad).
[in]zenithZenith angle in Earth system (rad).
[in]azimuthAzimuth angle in Earth system (rad).
[in]etrueUse true energy?
Returns
Effective area in cm2.

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.

Parameters
[in]aeffEffective area.
Returns
Effective area.

Assigns effective area.

Definition at line 143 of file GCTAAeff2D.cpp.

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

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

Print effective area information.

Parameters
[in]chatterChattiness.
Returns
String containing effective area information.

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().

const double & GCTAAeff2D::rad_max ( void  ) const
inline

Return radius cut value.

Returns
Radius cut value (degrees)

Definition at line 164 of file GCTAAeff2D.hpp.

References m_rad_max.

Referenced by GCTAOnOffObservation::arf_rad_max(), and rad_max().

void GCTAAeff2D::rad_max ( const double &  rad_max)
inline

Set radius cut value.

Parameters
[in]rad_maxRadius cut value (degrees)

Definition at line 176 of file GCTAAeff2D.hpp.

References m_rad_max, and rad_max().

void GCTAAeff2D::read ( const GFitsTable table)

Read effective area from FITS table.

Parameters
[in]tableFITS table.
Exceptions
GException::invalid_valueResponse 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.

Todo:
Analyse the unit of the parameter axis to determine the conversion factor for the effective areas. For the moment they are hard wired.

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.

Parameters
[in]filenameFITS file name.
[in]clobberOverwrite 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().

void GCTAAeff2D::set_boundaries ( void  )
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.

Referenced by read(), and table().

void GCTAAeff2D::set_indices ( void  )
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().

Referenced by read(), and table().

const GCTAResponseTable & GCTAAeff2D::table ( void  ) const
inline

Return response table.

Returns
Response table.

Returns the response table of the effective area. The effective area values are given in units of cm2.

Definition at line 192 of file GCTAAeff2D.hpp.

References m_aeff.

Referenced by load(), save(), and table().

void GCTAAeff2D::table ( const GCTAResponseTable table)

Assign response table.

Parameters
[in]tableResponse 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.

Parameters
[in]tableFITS 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().

Member Data Documentation

GCTAResponseTable GCTAAeff2D::m_aeff
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().

GEbounds GCTAAeff2D::m_ebounds
private

Energy boundaries.

Definition at line 107 of file GCTAAeff2D.hpp.

Referenced by copy_members(), ebounds(), init_members(), and set_boundaries().

GFilename GCTAAeff2D::m_filename
private

Name of Aeff response file.

Definition at line 105 of file GCTAAeff2D.hpp.

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

double GCTAAeff2D::m_hi_thres
private

Upper energy threshold (TeV)

Definition at line 117 of file GCTAAeff2D.hpp.

Referenced by copy_members(), init_members(), print(), read(), and write().

int GCTAAeff2D::m_inx_aeff
private

Effective area (true energy)

Definition at line 110 of file GCTAAeff2D.hpp.

Referenced by copy_members(), init_members(), max(), operator()(), and set_indices().

int GCTAAeff2D::m_inx_aeff_reco
private

Effective area (reco. energy)

Definition at line 111 of file GCTAAeff2D.hpp.

Referenced by copy_members(), init_members(), max(), operator()(), and set_indices().

int GCTAAeff2D::m_inx_energy
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().

int GCTAAeff2D::m_inx_theta
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().

double GCTAAeff2D::m_lo_thres
private

Lower energy threshold (TeV)

Definition at line 116 of file GCTAAeff2D.hpp.

Referenced by copy_members(), init_members(), print(), read(), and write().

double GCTAAeff2D::m_logE_max
private

Maximum logE (log10(E/TeV))

Definition at line 113 of file GCTAAeff2D.hpp.

Referenced by copy_members(), init_members(), operator()(), and set_boundaries().

double GCTAAeff2D::m_logE_min
private

Minimum logE (log10(E/TeV))

Definition at line 112 of file GCTAAeff2D.hpp.

Referenced by copy_members(), init_members(), operator()(), and set_boundaries().

double GCTAAeff2D::m_rad_max
private

Radius cut (degrees)

Definition at line 118 of file GCTAAeff2D.hpp.

Referenced by copy_members(), init_members(), print(), rad_max(), read(), and write().

double GCTAAeff2D::m_theta_max
private

Maximum theta (radians)

Definition at line 115 of file GCTAAeff2D.hpp.

Referenced by copy_members(), init_members(), operator()(), and set_boundaries().

double GCTAAeff2D::m_theta_min
private

Minimum theta (radians)

Definition at line 114 of file GCTAAeff2D.hpp.

Referenced by copy_members(), init_members(), operator()(), and set_boundaries().


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