GammaLib
2.1.0.dev
|
CTA exposure cube class. More...
#include <GCTACubeExposure.hpp>
Public Member Functions | |
GCTACubeExposure (void) | |
Void constructor. More... | |
GCTACubeExposure (const GCTACubeExposure &cube) | |
Copy constructor. More... | |
GCTACubeExposure (const GFilename &filename) | |
File constructor. More... | |
GCTACubeExposure (const GCTAEventCube &cube) | |
Event cube constructor. More... | |
GCTACubeExposure (const std::string &wcs, const std::string &coords, const double &x, const double &y, const double &dx, const double &dy, const int &nx, const int &ny, const GEnergies &energies) | |
Exposure cube constructor. More... | |
virtual | ~GCTACubeExposure (void) |
Destructor. More... | |
GCTACubeExposure & | operator= (const GCTACubeExposure &exp) |
Assignment operator. More... | |
double | operator() (const GSkyDir &dir, const GEnergy &energy) const |
Return exposure (in units of cm**2 s) More... | |
void | clear (void) |
Clear instance. More... | |
GCTACubeExposure * | clone (void) const |
Clone exposure cube. More... | |
std::string | classname (void) const |
Return class name. More... | |
void | set (const GCTAObservation &obs) |
Set exposure cube for one CTA observation. More... | |
void | fill (const GObservations &obs, GLog *log=NULL) |
Fill exposure cube from observation container. More... | |
const GSkyMap & | cube (void) const |
Return exposure cube. More... | |
const GEnergies & | energies (void) const |
Return energies. More... | |
const GGti & | gti (void) const |
Return Good Time Intervals. More... | |
const double & | livetime (void) const |
Return livetime. More... | |
const double & | ontime (void) const |
Return ontime. More... | |
double | deadc (void) const |
Return deadtime correction. More... | |
void | read (const GFits &fits) |
Read exposure cube from FITS object. More... | |
void | write (GFits &file) const |
Write CTA exposure cube into FITS file. More... | |
void | load (const GFilename &filename) |
Load exposure cube from FITS file. More... | |
void | save (const GFilename &filename, const bool &clobber=false) const |
Save exposure cube into FITS file. More... | |
const GFilename & | filename (void) const |
Return exposure cube filename. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print exposure cube information. More... | |
Public Member Functions inherited from GBase | |
virtual | ~GBase (void) |
Destructor. More... | |
Protected Member Functions | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GCTACubeExposure &exp) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | fill_cube (const GCTAObservation &obs, GLog *log=NULL) |
Fill exposure cube for one observation. More... | |
void | update (const double &logE) const |
Update 1D cache. More... | |
void | set_eng_axis (void) |
Set nodes for a logarithmic (base 10) energy axis. More... | |
void | read_attributes (const GFitsHDU &hdu) |
Read exposure attributes. More... | |
void | write_attributes (GFitsHDU &hdu) const |
Write attributes to exposure extension. More... | |
Protected Attributes | |
GFilename | m_filename |
Filename. More... | |
GSkyMap | m_cube |
Average Exposure cube. More... | |
GEnergies | m_energies |
Energy values for the Exposure cube. More... | |
GNodeArray | m_elogmeans |
Mean energy for the Exposure cube. More... | |
GGti | m_gti |
Good time interval for the Exposure cube. More... | |
double | m_livetime |
Livetime (sec) More... | |
Private Attributes | |
int | m_inx_left |
Index of left node. More... | |
int | m_inx_right |
Index of right node. More... | |
double | m_wgt_left |
Weight of left node. More... | |
double | m_wgt_right |
Weight of right node. More... | |
CTA exposure cube class.
This class implements a CTA exposure cube which provides the average exposure for binned analysis as function of sky position and energy.
Definition at line 55 of file GCTACubeExposure.hpp.
GCTACubeExposure::GCTACubeExposure | ( | void | ) |
Void constructor.
Definition at line 64 of file GCTACubeExposure.cpp.
References init_members().
Referenced by clone().
GCTACubeExposure::GCTACubeExposure | ( | const GCTACubeExposure & | cube | ) |
Copy constructor.
[in] | cube | Exposure cube. |
Definition at line 79 of file GCTACubeExposure.cpp.
References copy_members(), and init_members().
|
explicit |
File constructor.
[in] | filename | Exposure cube filename. |
Construct exposure cube by loading the information from an exposure cube file.
Definition at line 100 of file GCTACubeExposure.cpp.
References init_members(), and load().
|
explicit |
Event cube constructor.
[in] | cube | Event cube. |
Construct exposure cube using the same binning and sky projection that is used for the event cube.
Definition at line 121 of file GCTACubeExposure.cpp.
References GCTAEventCube::counts(), GEvents::ebounds(), init_members(), m_cube, m_energies, GSkyMap::nmaps(), GEnergies::set(), set_eng_axis(), and GEnergies::size().
GCTACubeExposure::GCTACubeExposure | ( | const std::string & | wcs, |
const std::string & | coords, | ||
const double & | x, | ||
const double & | y, | ||
const double & | dx, | ||
const double & | dy, | ||
const int & | nx, | ||
const int & | ny, | ||
const GEnergies & | energies | ||
) |
Exposure cube constructor.
[in] | wcs | World Coordinate System. |
[in] | coords | Coordinate System (CEL or GAL). |
[in] | x | X coordinate of sky map centre (deg). |
[in] | y | Y coordinate of sky map centre (deg). |
[in] | dx | Pixel size in x direction at centre (deg/pixel). |
[in] | dy | Pixel size in y direction at centre (deg/pixel). |
[in] | nx | Number of pixels in x direction. |
[in] | ny | Number of pixels in y direction. |
[in] | energies | Energies. |
Constructs an exposure cube by specifying the sky map grid and the energies.
Definition at line 162 of file GCTACubeExposure.cpp.
References energies(), init_members(), m_cube, m_energies, set_eng_axis(), and GEnergies::size().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 135 of file GCTACubeExposure.hpp.
|
virtual |
Clear instance.
This method properly resets the object to an initial state.
Implements GBase.
Definition at line 272 of file GCTACubeExposure.cpp.
References free_members(), and init_members().
Referenced by GCTAResponseCube::init_members(), and read().
|
virtual |
Clone exposure cube.
Implements GBase.
Definition at line 290 of file GCTACubeExposure.cpp.
References GCTACubeExposure().
|
protected |
Copy class members.
[in] | cube | Exposure cube |
Definition at line 602 of file GCTACubeExposure.cpp.
References m_cube, m_elogmeans, m_energies, m_filename, m_gti, m_inx_left, m_inx_right, m_livetime, m_wgt_left, and m_wgt_right.
Referenced by GCTACubeExposure(), and operator=().
|
inline |
Return exposure cube.
Returns the GSkyMap object that is used to store the exposure cube information.
Definition at line 150 of file GCTACubeExposure.hpp.
References m_cube.
|
inline |
Return deadtime correction.
Definition at line 210 of file GCTACubeExposure.hpp.
References m_gti, m_livetime, and GGti::ontime().
Referenced by GCTAResponseCube::irf(), GCTAResponseCube::irf_diffuse(), GCTAResponseCube::irf_elliptical(), GCTAResponseCube::irf_ptsrc(), GCTAResponseCube::irf_radial(), GCTAObservation::response(), and write_attributes().
|
inline |
Return energies.
Definition at line 162 of file GCTACubeExposure.hpp.
References m_energies.
Referenced by GCTACubeExposure().
|
inline |
Return exposure cube filename.
Returns the filename from which the exposure cube was loaded or into which the exposure cube has been saved.
Definition at line 225 of file GCTACubeExposure.hpp.
References m_filename.
Referenced by load(), save(), and GCTAResponseCube::write().
void GCTACubeExposure::fill | ( | const GObservations & | obs, |
GLog * | log = NULL |
||
) |
Fill exposure cube from observation container.
[in] | obs | Observation container. |
[in] | log | Pointer to logger. |
Set the exposure cube by summing the exposure for all CTA observations in an observation container. The cube pixel values are computed as the sum over the products of the effective area and the livetime.
Definition at line 329 of file GCTACubeExposure.cpp.
References GGti::clear(), GCTAObservation::eventtype(), fill_cube(), GObservation::id(), GCTAObservation::instrument(), m_cube, m_gti, m_livetime, GObservation::name(), and GObservations::size().
|
protected |
Fill exposure cube for one observation.
[in] | obs | Observation. |
[in] | log | Pointer to logger. |
GException::invalid_value | No RoI or response found in CTA observation. |
Fill the exposure cube from one CTA observations. The exposure cube pixel values are computed as the product of the effective area and the livetime.
Definition at line 644 of file GCTACubeExposure.cpp.
References GCTARoi::centre(), GCTAInstDir::dir(), GSkyDir::dist(), GCTAObservation::ebounds(), GCTAObservation::eventtype(), GGti::extend(), G_FILL_CUBE, GCTAObservation::gti(), GObservation::id(), GCTAObservation::instrument(), GSkyMap::inx2dir(), GGti::is_empty(), GCTARoi::is_valid(), GCTAObservation::livetime(), m_cube, m_energies, m_gti, m_livetime, GObservation::name(), GSkyMap::npix(), GSkyMap::overlaps(), GCTAObservation::pointing(), GCTARoi::radius(), GGti::reference(), GCTAObservation::response(), GCTAObservation::roi(), and GEnergies::size().
|
protected |
Delete class members.
Definition at line 625 of file GCTACubeExposure.cpp.
Referenced by clear(), operator=(), and ~GCTACubeExposure().
|
inline |
Return Good Time Intervals.
Definition at line 174 of file GCTACubeExposure.hpp.
References m_gti.
|
protected |
Initialise class members.
Definition at line 573 of file GCTACubeExposure.cpp.
References GNodeArray::clear(), GGti::clear(), GEnergies::clear(), GFilename::clear(), GSkyMap::clear(), G_CTA_MJDREF, m_cube, m_elogmeans, m_energies, m_filename, m_gti, m_inx_left, m_inx_right, m_livetime, m_wgt_left, m_wgt_right, and GGti::reference().
Referenced by clear(), GCTACubeExposure(), and operator=().
|
inline |
Return livetime.
Definition at line 186 of file GCTACubeExposure.hpp.
References m_livetime.
Referenced by GCTAResponseCube::irf(), GCTAResponseCube::irf_diffuse(), GCTAResponseCube::irf_elliptical(), GCTAResponseCube::irf_ptsrc(), GCTAResponseCube::irf_radial(), and GCTAObservation::response().
void GCTACubeExposure::load | ( | const GFilename & | filename | ) |
Load exposure cube from FITS file.
[in] | filename | Performance table file name. |
Loads the exposure cube from a FITS file into the object.
Definition at line 451 of file GCTACubeExposure.cpp.
References GFits::close(), filename(), m_filename, and read().
Referenced by GCTACubeExposure(), and GCTAResponseCube::read().
|
inline |
Return ontime.
Definition at line 198 of file GCTACubeExposure.hpp.
References m_gti, and GGti::ontime().
Referenced by GCTAObservation::response(), and write_attributes().
Return exposure (in units of cm**2 s)
[in] | dir | Coordinate of the true photon position. |
[in] | energy | Energy of the true photon. |
Definition at line 242 of file GCTACubeExposure.cpp.
References GEnergy::log10TeV(), m_cube, m_inx_left, m_inx_right, m_wgt_left, m_wgt_right, and update().
GCTACubeExposure & GCTACubeExposure::operator= | ( | const GCTACubeExposure & | cube | ) |
Assignment operator.
[in] | cube | Exposure cube. |
Definition at line 214 of file GCTACubeExposure.cpp.
References copy_members(), free_members(), and init_members().
Print exposure cube information.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 520 of file GCTACubeExposure.cpp.
References m_cube, m_energies, m_filename, m_gti, m_livetime, gammalib::parformat(), GEnergies::print(), GGti::print(), GSkyMap::print(), SILENT, GGti::size(), GEnergies::size(), and gammalib::str().
Referenced by GCTAResponseCube::print().
void GCTACubeExposure::read | ( | const GFits & | fits | ) |
Read exposure cube from FITS object.
[in] | fits | FITS object. |
Read the exposure cube from a FITS object.
Definition at line 384 of file GCTACubeExposure.cpp.
References clear(), gammalib::extname_energies, gammalib::extname_gti, GFits::image(), m_cube, m_energies, m_gti, GGti::read(), GEnergies::read(), GSkyMap::read(), read_attributes(), set_eng_axis(), and GFits::table().
Referenced by load().
|
protected |
Read exposure attributes.
[in] | hdu | FITS HDU. |
Reads CTA exposure attributes from the HDU.
Definition at line 822 of file GCTACubeExposure.cpp.
References GFitsHDU::has_card(), m_livetime, and GFitsHDU::real().
Referenced by read().
void GCTACubeExposure::save | ( | const GFilename & | filename, |
const bool & | clobber = false |
||
) | const |
Save exposure cube into FITS file.
[in] | filename | Exposure cube FITS file name. |
[in] | clobber | Overwrite existing file? |
Save the exposure cube into a FITS file.
Definition at line 484 of file GCTACubeExposure.cpp.
References GFits::close(), filename(), m_filename, GFits::saveto(), and write().
void GCTACubeExposure::set | ( | const GCTAObservation & | obs | ) |
Set exposure cube for one CTA observation.
[in] | obs | CTA observation. |
Set the exposure cube for one CTA observation. The cube pixel values are computed as product of the effective area and the livetime.
Definition at line 304 of file GCTACubeExposure.cpp.
References GGti::clear(), fill_cube(), m_cube, m_gti, and m_livetime.
|
protected |
Set nodes for a logarithmic (base 10) energy axis.
Set axis nodes so that each node is the logarithm of the energy values.
Definition at line 794 of file GCTACubeExposure.cpp.
References GNodeArray::append(), GNodeArray::clear(), m_elogmeans, m_energies, and GEnergies::size().
Referenced by GCTACubeExposure(), and read().
|
protected |
Update 1D cache.
[in] | logE | Log10 energy in TeV. |
Updates the 1D interpolation cache. The interpolation cache is composed of two indices and weights that define 2 data values of the 2D skymap that are used for linear interpolation.
Definition at line 773 of file GCTACubeExposure.cpp.
References GNodeArray::inx_left(), GNodeArray::inx_right(), m_elogmeans, m_inx_left, m_inx_right, m_wgt_left, m_wgt_right, GNodeArray::set_value(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().
Referenced by operator()().
void GCTACubeExposure::write | ( | GFits & | fits | ) | const |
Write CTA exposure cube into FITS file.
[in] | fits | FITS file. |
Writes the exposure cube image, the energies and the Good Time Intervals into the FITS file.
Definition at line 422 of file GCTACubeExposure.cpp.
References m_cube, m_energies, m_gti, GFits::size(), GGti::write(), GEnergies::write(), GSkyMap::write(), and write_attributes().
Referenced by save().
|
protected |
Write attributes to exposure extension.
[in] | hdu | FITS HDU. |
Definition at line 837 of file GCTACubeExposure.cpp.
References GFitsHDU::card(), GTime::convert(), deadc(), m_gti, m_livetime, ontime(), GGti::ontime(), GGti::reference(), GGti::telapse(), GGti::tstart(), GGti::tstop(), and GTime::utc().
Referenced by write().
|
protected |
Average Exposure cube.
Definition at line 112 of file GCTACubeExposure.hpp.
Referenced by copy_members(), cube(), fill(), fill_cube(), GCTACubeExposure(), init_members(), operator()(), print(), read(), set(), and write().
|
protected |
Mean energy for the Exposure cube.
Definition at line 114 of file GCTACubeExposure.hpp.
Referenced by copy_members(), init_members(), set_eng_axis(), and update().
|
protected |
Energy values for the Exposure cube.
Definition at line 113 of file GCTACubeExposure.hpp.
Referenced by copy_members(), energies(), fill_cube(), GCTACubeExposure(), init_members(), print(), read(), set_eng_axis(), and write().
|
mutableprotected |
Filename.
Definition at line 111 of file GCTACubeExposure.hpp.
Referenced by copy_members(), filename(), init_members(), load(), print(), and save().
|
protected |
Good time interval for the Exposure cube.
Definition at line 115 of file GCTACubeExposure.hpp.
Referenced by copy_members(), deadc(), fill(), fill_cube(), gti(), init_members(), ontime(), print(), read(), set(), write(), and write_attributes().
|
mutableprivate |
Index of left node.
Definition at line 122 of file GCTACubeExposure.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Index of right node.
Definition at line 123 of file GCTACubeExposure.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
protected |
Livetime (sec)
Definition at line 118 of file GCTACubeExposure.hpp.
Referenced by copy_members(), deadc(), fill(), fill_cube(), init_members(), livetime(), print(), read_attributes(), set(), and write_attributes().
|
mutableprivate |
Weight of left node.
Definition at line 124 of file GCTACubeExposure.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Weight of right node.
Definition at line 125 of file GCTACubeExposure.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().