GammaLib
2.1.0.dev
|
CTA point spread function for cube analysis. More...
#include <GCTACubePsf.hpp>
Public Member Functions | |
GCTACubePsf (void) | |
Void constructor. More... | |
GCTACubePsf (const GCTACubePsf &cube) | |
Copy constructor. More... | |
GCTACubePsf (const GFilename &filename) | |
File constructor. More... | |
GCTACubePsf (const GCTAEventCube &cube, const double &dmax, const int &ndbins) | |
Event cube constructor. More... | |
GCTACubePsf (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, const double &dmax, const int &ndbins) | |
PSF cube constructor. More... | |
virtual | ~GCTACubePsf (void) |
Destructor. More... | |
GCTACubePsf & | operator= (const GCTACubePsf &cube) |
Assignment operator. More... | |
double | operator() (const GSkyDir &dir, const double &delta, const GEnergy &energy) const |
Return point spread function (in units of sr \(^{-1}\)) More... | |
void | clear (void) |
Clear instance. More... | |
GCTACubePsf * | clone (void) const |
Clone instance. More... | |
std::string | classname (void) const |
Return class name. More... | |
void | set (const GCTAObservation &obs) |
Set PSF cube from one CTA observation. More... | |
void | fill (const GObservations &obs, GLog *log=NULL) |
Fill PSF cube from observation container. More... | |
const GSkyMap & | cube (void) const |
Return psf cube sky map. More... | |
const GEnergies & | energies (void) const |
Return energies. More... | |
const GNodeArray & | deltas (void) const |
Return offset angles between true and measured photon direction. More... | |
double | delta_max (void) const |
Return maximum delta value in radians. More... | |
int | offset (const int &idelta, const int &iebin) const |
Return map offset. More... | |
void | read (const GFits &fits) |
Read PSF cube from FITS object. More... | |
void | write (GFits &file) const |
Write CTA PSF cube into FITS object. More... | |
void | load (const GFilename &filename) |
Load PSF cube from FITS file. More... | |
void | save (const GFilename &filename, const bool &clobber=false) const |
Save PSF cube into FITS file. More... | |
const GFilename & | filename (void) const |
Return exposure cube filename. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print PSF 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 GCTACubePsf &cube) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | clear_cube (void) |
Clear all pixels in the PSF cube. More... | |
void | fill_cube (const GCTAObservation &obs, GSkyMap *exposure=NULL, GLog *log=NULL) |
Fill PSF cube for one observation. More... | |
void | update (const double &delta, const double &logE) const |
Update PSF parameter cache. More... | |
void | set_delta_axis (void) |
Set nodes for delta axis in radians. More... | |
void | set_eng_axis (void) |
Set nodes for a logarithmic (base 10) energy axis. More... | |
void | set_to_smooth (void) |
Pad the last delta bins with zero. More... | |
Protected Attributes | |
GFilename | m_filename |
Filename. More... | |
GSkyMap | m_cube |
PSF cube. More... | |
GEnergies | m_energies |
Energy values for the PSF cube. More... | |
GNodeArray | m_elogmeans |
Mean log10TeV energy for the PSF cube. More... | |
GNodeArray | m_deltas |
Delta bins (deg) for the PSF cube. More... | |
GNodeArray | m_deltas_cache |
Internal delta bins (rad) More... | |
bool | m_quadratic_binning |
Internal binning is linear. More... | |
Private Attributes | |
int | m_inx1 |
Index of upper left node. More... | |
int | m_inx2 |
Index of lower left node. More... | |
int | m_inx3 |
Index of upper right node. More... | |
int | m_inx4 |
Index of lower right node. More... | |
double | m_wgt1 |
Weight of upper left node. More... | |
double | m_wgt2 |
Weight of lower left node. More... | |
double | m_wgt3 |
Weight of upper right node. More... | |
double | m_wgt4 |
Weight of lower right node. More... | |
CTA point spread function for cube analysis.
This class implements a mean CTA point spread function which provides the average point spread function for cube analysis as function of sky position, log10 energy and delta angle between true and measured photon direction.
Definition at line 62 of file GCTACubePsf.hpp.
GCTACubePsf::GCTACubePsf | ( | void | ) |
Void constructor.
Definition at line 68 of file GCTACubePsf.cpp.
References init_members().
Referenced by clone().
GCTACubePsf::GCTACubePsf | ( | const GCTACubePsf & | cube | ) |
Copy constructor.
[in] | cube | Point spread function. |
Definition at line 83 of file GCTACubePsf.cpp.
References copy_members(), and init_members().
|
explicit |
File constructor.
[in] | filename | PSF cube filename. |
Construct PSF cube by loading the information from a PSF cube file.
Definition at line 103 of file GCTACubePsf.cpp.
References init_members(), and load().
GCTACubePsf::GCTACubePsf | ( | const GCTAEventCube & | cube, |
const double & | dmax, | ||
const int & | ndbins | ||
) |
Event cube constructor.
[in] | cube | Event cube. |
[in] | dmax | Maximum delta (deg). |
[in] | ndbins | Number of delta bins. |
Construct PSF cube using the same binning and sky projection that is used for the event cube.
Definition at line 126 of file GCTACubePsf.cpp.
References GNodeArray::append(), GNodeArray::clear(), GCTAEventCube::counts(), GEvents::ebounds(), init_members(), m_cube, m_deltas, m_energies, GSkyMap::nmaps(), GEnergies::set(), set_delta_axis(), set_eng_axis(), GSkyMap::shape(), GNodeArray::size(), GEnergies::size(), and sqrt().
GCTACubePsf::GCTACubePsf | ( | 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, | ||
const double & | dmax, | ||
const int & | ndbins | ||
) |
PSF 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. |
[in] | dmax | Maximum delta (deg). |
[in] | ndbins | Number of delta bins. |
Constructs a PSF cube by specifying the sky map grid and the energies.
Definition at line 194 of file GCTACubePsf.cpp.
References GNodeArray::append(), GNodeArray::clear(), energies(), init_members(), m_cube, m_deltas, m_energies, set_delta_axis(), set_eng_axis(), GSkyMap::shape(), GNodeArray::size(), GEnergies::size(), and sqrt().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 151 of file GCTACubePsf.hpp.
|
virtual |
Clear instance.
This method properly resets the object to an initial state.
Implements GBase.
Definition at line 338 of file GCTACubePsf.cpp.
References free_members(), and init_members().
Referenced by GCTAResponseCube::init_members(), and read().
|
protected |
Clear all pixels in the PSF cube.
Definition at line 743 of file GCTACubePsf.cpp.
References m_cube, GSkyMap::nmaps(), and GSkyMap::npix().
|
virtual |
Clone instance.
Implements GBase.
Definition at line 356 of file GCTACubePsf.cpp.
References GCTACubePsf().
|
protected |
Copy class members.
[in] | cube | PSF cube. |
Definition at line 705 of file GCTACubePsf.cpp.
References m_cube, m_deltas, m_deltas_cache, m_elogmeans, m_energies, m_filename, m_inx1, m_inx2, m_inx3, m_inx4, m_quadratic_binning, m_wgt1, m_wgt2, m_wgt3, and m_wgt4.
Referenced by GCTACubePsf(), and operator=().
|
inline |
Return psf cube sky map.
The GCTACubePsf represents the psf cube as a sky map. This methods returns the sky map that is stored internally by GCTACubePsf as psf cube.
Definition at line 167 of file GCTACubePsf.hpp.
References m_cube.
|
inline |
Return maximum delta value in radians.
Definition at line 203 of file GCTACubePsf.hpp.
References gammalib::deg2rad, m_deltas, and GNodeArray::size().
Referenced by GCTAResponseCube::irf(), GCTAResponseCube::irf_diffuse(), GCTAResponseCube::irf_ptsrc(), GCTAResponseCube::psf_diffuse(), GCTAResponseCube::psf_elliptical(), and GCTAResponseCube::psf_radial().
|
inline |
Return offset angles between true and measured photon direction.
Definition at line 191 of file GCTACubePsf.hpp.
References m_deltas.
|
inline |
Return energies.
Definition at line 179 of file GCTACubePsf.hpp.
References m_energies.
Referenced by GCTACubePsf().
|
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 222 of file GCTACubePsf.hpp.
References m_filename.
Referenced by load(), save(), and GCTAResponseCube::write().
void GCTACubePsf::fill | ( | const GObservations & | obs, |
GLog * | log = NULL |
||
) |
Fill PSF cube from observation container.
[in] | obs | Observation container. |
[in] | log | Pointer towards logger. |
Sets the PSF cube from all CTA observations in the observation container.
Definition at line 395 of file GCTACubePsf.cpp.
References clear_cube(), GCTAObservation::eventtype(), fill_cube(), GObservation::id(), GCTAObservation::instrument(), m_cube, m_deltas, m_energies, GObservation::name(), norm(), GSkyMap::npix(), offset(), set_to_smooth(), GNodeArray::size(), GEnergies::size(), and GObservations::size().
|
protected |
Fill PSF cube for one observation.
[in] | obs | Observation. |
[in] | exposure | Pointer towards exposure map. |
[in] | log | Pointer towards logger. |
GException::invalid_value | No RoI or response found in CTA observation. |
Definition at line 773 of file GCTACubePsf.cpp.
References GCTARoi::centre(), gammalib::deg2rad, GCTAInstDir::dir(), GSkyDir::dist(), GCTAObservation::ebounds(), GCTAObservation::eventtype(), G_FILL_CUBE, GObservation::id(), GCTAObservation::instrument(), GSkyMap::inx2dir(), GCTARoi::is_valid(), GCTAObservation::livetime(), m_cube, m_deltas, m_energies, GObservation::name(), GSkyMap::npix(), offset(), GSkyMap::overlaps(), GCTAObservation::pointing(), GCTARoi::radius(), GCTAObservation::response(), GCTAObservation::roi(), GNodeArray::size(), and GEnergies::size().
|
protected |
Delete class members.
Definition at line 733 of file GCTACubePsf.cpp.
Referenced by clear(), operator=(), and ~GCTACubePsf().
|
protected |
Initialise class members.
Definition at line 674 of file GCTACubePsf.cpp.
References GNodeArray::clear(), GEnergies::clear(), GFilename::clear(), GSkyMap::clear(), m_cube, m_deltas, m_deltas_cache, m_elogmeans, m_energies, m_filename, m_inx1, m_inx2, m_inx3, m_inx4, m_quadratic_binning, m_wgt1, m_wgt2, m_wgt3, and m_wgt4.
Referenced by clear(), GCTACubePsf(), and operator=().
void GCTACubePsf::load | ( | const GFilename & | filename | ) |
Load PSF cube from FITS file.
[in] | filename | Performance table file name. |
Loads the PSF cube from a FITS file into the object.
Definition at line 549 of file GCTACubePsf.cpp.
References GFits::close(), filename(), m_filename, and read().
Referenced by GCTACubePsf(), and GCTAResponseCube::read().
|
inline |
Return map offset.
Definition at line 234 of file GCTACubePsf.hpp.
References m_deltas, and GNodeArray::size().
Referenced by fill(), fill_cube(), set_to_smooth(), and update().
double GCTACubePsf::operator() | ( | const GSkyDir & | dir, |
const double & | delta, | ||
const GEnergy & | energy | ||
) | const |
Return point spread function (in units of sr \(^{-1}\))
[in] | dir | Coordinate of the true photon position. |
[in] | delta | Angular separation between true and measured photon directions (rad). |
[in] | energy | Energy of the true photon. |
Returns the point spread function for a given angular separation in units of sr^-1 for a given energy and coordinate.
Definition at line 304 of file GCTACubePsf.cpp.
References GEnergy::log10TeV(), m_cube, m_inx1, m_inx2, m_inx3, m_inx4, m_wgt1, m_wgt2, m_wgt3, m_wgt4, and update().
GCTACubePsf & GCTACubePsf::operator= | ( | const GCTACubePsf & | cube | ) |
Assignment operator.
[in] | cube | Mean PSF cube. |
Definition at line 271 of file GCTACubePsf.cpp.
References copy_members(), free_members(), and init_members().
Print PSF cube information.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 616 of file GCTACubePsf.cpp.
References m_cube, m_deltas, m_energies, m_filename, gammalib::parformat(), GEnergies::print(), GSkyMap::print(), SILENT, GNodeArray::size(), GEnergies::size(), and gammalib::str().
Referenced by GCTAResponseCube::print().
void GCTACubePsf::read | ( | const GFits & | fits | ) |
Read PSF cube from FITS object.
[in] | fits | FITS object. |
Read the PSF cube from a FITS object.
Definition at line 475 of file GCTACubePsf.cpp.
References clear(), gammalib::extname_deltas, gammalib::extname_energies, GFits::image(), m_cube, m_deltas, m_energies, GEnergies::read(), GNodeArray::read(), GSkyMap::read(), set_delta_axis(), set_eng_axis(), set_to_smooth(), and GFits::table().
Referenced by load().
void GCTACubePsf::save | ( | const GFilename & | filename, |
const bool & | clobber = false |
||
) | const |
Save PSF cube into FITS file.
[in] | filename | PSF cube FITS file name. |
[in] | clobber | Overwrite existing file? |
Save the PSF cube into a FITS file.
Definition at line 582 of file GCTACubePsf.cpp.
References GFits::close(), filename(), m_filename, GFits::saveto(), and write().
void GCTACubePsf::set | ( | const GCTAObservation & | obs | ) |
Set PSF cube from one CTA observation.
[in] | obs | CTA observation. |
Sets the PSF cube for one CTA observation.
Definition at line 369 of file GCTACubePsf.cpp.
References clear_cube(), fill_cube(), and set_to_smooth().
|
protected |
Set nodes for delta axis in radians.
Set the delta axis nodes in radians. If a quadratic binning is detected, the axis is set to sqrt(delta) so that a linear interpolation scheme can be used which is much faster than a quadratic scheme.
Definition at line 953 of file GCTACubePsf.cpp.
References abs(), GNodeArray::append(), GNodeArray::clear(), gammalib::deg2rad, m_deltas, m_deltas_cache, m_quadratic_binning, GNodeArray::size(), and sqrt().
Referenced by GCTACubePsf(), and read().
|
protected |
Set nodes for a logarithmic (base 10) energy axis.
Set axis nodes so that each node is the logarithmic mean of the lower and upper energy boundary, i.e.
\[ n_i = \log \sqrt{{\rm LO}_i \times {\rm HI}_i} \]
where \(n_i\) is node \(i\), \({\rm LO}_i\) is the lower bin boundary for bin \(i\), and \({\rm HI}_i\) is the upper bin boundary for bin \(i\).
Definition at line 1010 of file GCTACubePsf.cpp.
References GNodeArray::append(), GNodeArray::clear(), m_elogmeans, m_energies, and GEnergies::size().
Referenced by GCTACubePsf(), and read().
|
protected |
Pad the last delta bins with zero.
Zero padding of the last delta bins assures that the Psf goes to zero without any step at the last delta value.
Definition at line 1037 of file GCTACubePsf.cpp.
References m_cube, m_deltas, m_energies, GSkyMap::npix(), offset(), GNodeArray::size(), and GEnergies::size().
|
protected |
Update PSF parameter cache.
[in] | delta | Angular separation between true and measured photon directions (radians). |
[in] | logE | Log10 true photon energy (TeV). |
This method updates the PSF parameter cache.
Definition at line 914 of file GCTACubePsf.cpp.
References GNodeArray::inx_left(), GNodeArray::inx_right(), m_deltas_cache, m_elogmeans, m_inx1, m_inx2, m_inx3, m_inx4, m_quadratic_binning, m_wgt1, m_wgt2, m_wgt3, m_wgt4, offset(), GNodeArray::set_value(), sqrt(), GNodeArray::wgt_left(), and GNodeArray::wgt_right().
Referenced by operator()().
void GCTACubePsf::write | ( | GFits & | fits | ) | const |
Write CTA PSF cube into FITS object.
[in] | fits | FITS object. |
Write the CTA PSF cube into a FITS object.
Definition at line 517 of file GCTACubePsf.cpp.
References GFitsHDU::card(), gammalib::extname_deltas, m_cube, m_deltas, m_energies, GFits::size(), GFits::table(), GEnergies::write(), GNodeArray::write(), and GSkyMap::write().
Referenced by save().
|
protected |
PSF cube.
Definition at line 125 of file GCTACubePsf.hpp.
Referenced by clear_cube(), copy_members(), cube(), fill(), fill_cube(), GCTACubePsf(), init_members(), operator()(), print(), read(), set_to_smooth(), and write().
|
protected |
Delta bins (deg) for the PSF cube.
Definition at line 128 of file GCTACubePsf.hpp.
Referenced by copy_members(), delta_max(), deltas(), fill(), fill_cube(), GCTACubePsf(), init_members(), offset(), print(), read(), set_delta_axis(), set_to_smooth(), and write().
|
protected |
Internal delta bins (rad)
Definition at line 129 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), set_delta_axis(), and update().
|
protected |
Mean log10TeV energy for the PSF cube.
Definition at line 127 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), set_eng_axis(), and update().
|
protected |
Energy values for the PSF cube.
Definition at line 126 of file GCTACubePsf.hpp.
Referenced by copy_members(), energies(), fill(), fill_cube(), GCTACubePsf(), init_members(), print(), read(), set_eng_axis(), set_to_smooth(), and write().
|
mutableprotected |
Filename.
Definition at line 124 of file GCTACubePsf.hpp.
Referenced by copy_members(), filename(), init_members(), load(), print(), and save().
|
mutableprivate |
Index of upper left node.
Definition at line 134 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Index of lower left node.
Definition at line 135 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Index of upper right node.
Definition at line 136 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Index of lower right node.
Definition at line 137 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
protected |
Internal binning is linear.
Definition at line 130 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), set_delta_axis(), and update().
|
mutableprivate |
Weight of upper left node.
Definition at line 138 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Weight of lower left node.
Definition at line 139 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Weight of upper right node.
Definition at line 140 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().
|
mutableprivate |
Weight of lower right node.
Definition at line 141 of file GCTACubePsf.hpp.
Referenced by copy_members(), init_members(), operator()(), and update().