GammaLib  1.7.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTACubePsf Class Reference

CTA point spread function for cube analysis. More...

#include <GCTACubePsf.hpp>

Inheritance diagram for GCTACubePsf:
GBase

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...
 
GCTACubePsfoperator= (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...
 
GCTACubePsfclone (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 GSkyMapcube (void) const
 Return psf cube sky map. More...
 
const GEnergiesenergies (void) const
 Return energies. More...
 
const GNodeArraydeltas (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 GFilenamefilename (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
[in]cubePoint spread function.

Definition at line 83 of file GCTACubePsf.cpp.

References copy_members(), and init_members().

GCTACubePsf::GCTACubePsf ( const GFilename filename)
explicit

File constructor.

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

Parameters
[in]cubeEvent cube.
[in]dmaxMaximum delta (deg).
[in]ndbinsNumber 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.

Parameters
[in]wcsWorld Coordinate System.
[in]coordsCoordinate System (CEL or GAL).
[in]xX coordinate of sky map centre (deg).
[in]yY coordinate of sky map centre (deg).
[in]dxPixel size in x direction at centre (deg/pixel).
[in]dyPixel size in y direction at centre (deg/pixel).
[in]nxNumber of pixels in x direction.
[in]nyNumber of pixels in y direction.
[in]energiesEnergies.
[in]dmaxMaximum delta (deg).
[in]ndbinsNumber 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().

GCTACubePsf::~GCTACubePsf ( void  )
virtual

Destructor.

Definition at line 249 of file GCTACubePsf.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GBase.

Definition at line 151 of file GCTACubePsf.hpp.

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

void GCTACubePsf::clear_cube ( void  )
protected

Clear all pixels in the PSF cube.

Definition at line 737 of file GCTACubePsf.cpp.

References m_cube, GSkyMap::nmaps(), and GSkyMap::npix().

Referenced by fill(), and set().

GCTACubePsf * GCTACubePsf::clone ( void  ) const
virtual

Clone instance.

Returns
Deep copy of mean PSF instance.

Implements GBase.

Definition at line 356 of file GCTACubePsf.cpp.

References GCTACubePsf().

void GCTACubePsf::copy_members ( const GCTACubePsf cube)
protected

Copy class members.

Parameters
[in]cubePSF cube.

Definition at line 699 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=().

const GSkyMap & GCTACubePsf::cube ( void  ) const
inline

Return psf cube sky map.

Returns
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.

double GCTACubePsf::delta_max ( void  ) const
inline
const GNodeArray & GCTACubePsf::deltas ( void  ) const
inline

Return offset angles between true and measured photon direction.

Returns
Offset angles between true and measured photon direction

Definition at line 191 of file GCTACubePsf.hpp.

References m_deltas.

const GEnergies & GCTACubePsf::energies ( void  ) const
inline

Return energies.

Returns
Energies

Definition at line 179 of file GCTACubePsf.hpp.

References m_energies.

Referenced by GCTACubePsf().

const GFilename & GCTACubePsf::filename ( void  ) const
inline

Return exposure cube filename.

Returns
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.

Parameters
[in]obsObservation container.
[in]logPointer 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(), GEnergies::size(), GNodeArray::size(), and GObservations::size().

void GCTACubePsf::fill_cube ( const GCTAObservation obs,
GSkyMap exposure = NULL,
GLog log = NULL 
)
protected
void GCTACubePsf::free_members ( void  )
protected

Delete class members.

Definition at line 727 of file GCTACubePsf.cpp.

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

void GCTACubePsf::init_members ( void  )
protected
void GCTACubePsf::load ( const GFilename filename)

Load PSF cube from FITS file.

Parameters
[in]filenamePerformance table file name.

Loads the PSF cube from a FITS file into the object.

Definition at line 543 of file GCTACubePsf.cpp.

References GFits::close(), filename(), m_filename, and read().

Referenced by GCTACubePsf(), and GCTAResponseCube::read().

int GCTACubePsf::offset ( const int &  idelta,
const int &  iebin 
) const
inline

Return map offset.

Returns
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)

Parameters
[in]dirCoordinate of the true photon position.
[in]deltaAngular separation between true and measured photon directions (rad).
[in]energyEnergy of the true photon.
Returns
point spread function (in units of sr^-1)

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.

Parameters
[in]cubeMean PSF cube.
Returns
Mean PSF cube.

Definition at line 271 of file GCTACubePsf.cpp.

References copy_members(), free_members(), and init_members().

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

Print PSF cube information.

Parameters
[in]chatterChattiness.
Returns
String containing PSF cube information.

Implements GBase.

Definition at line 610 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.

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

Parameters
[in]filenamePSF cube FITS file name.
[in]clobberOverwrite existing file?

Save the PSF cube into a FITS file.

Definition at line 576 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.

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

void GCTACubePsf::set_delta_axis ( void  )
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.

Todo:
Check that none of the axis boundaries is non-positive.

Definition at line 947 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().

void GCTACubePsf::set_eng_axis ( void  )
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\).

Todo:
Check that none of the axis boundaries is non-positive.

Definition at line 1004 of file GCTACubePsf.cpp.

References GNodeArray::append(), GNodeArray::clear(), m_elogmeans, m_energies, and GEnergies::size().

Referenced by GCTACubePsf(), and read().

void GCTACubePsf::set_to_smooth ( void  )
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 1031 of file GCTACubePsf.cpp.

References m_cube, m_deltas, m_energies, GSkyMap::npix(), offset(), GNodeArray::size(), and GEnergies::size().

Referenced by fill(), read(), and set().

void GCTACubePsf::update ( const double &  delta,
const double &  logE 
) const
protected

Update PSF parameter cache.

Parameters
[in]deltaAngular separation between true and measured photon directions (radians).
[in]logELog10 true photon energy (TeV).

This method updates the PSF parameter cache.

Definition at line 908 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.

Parameters
[in]fitsFITS object.

Write the CTA PSF cube into a FITS object.

Definition at line 517 of file GCTACubePsf.cpp.

References gammalib::extname_deltas, m_cube, m_deltas, m_energies, GFits::table(), GEnergies::write(), GNodeArray::write(), and GSkyMap::write().

Referenced by save().

Member Data Documentation

GSkyMap GCTACubePsf::m_cube
protected
GNodeArray GCTACubePsf::m_deltas
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().

GNodeArray GCTACubePsf::m_deltas_cache
protected

Internal delta bins (rad)

Definition at line 129 of file GCTACubePsf.hpp.

Referenced by copy_members(), init_members(), set_delta_axis(), and update().

GNodeArray GCTACubePsf::m_elogmeans
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().

GEnergies GCTACubePsf::m_energies
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().

GFilename GCTACubePsf::m_filename
mutableprotected

Filename.

Definition at line 124 of file GCTACubePsf.hpp.

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

int GCTACubePsf::m_inx1
mutableprivate

Index of upper left node.

Definition at line 134 of file GCTACubePsf.hpp.

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

int GCTACubePsf::m_inx2
mutableprivate

Index of lower left node.

Definition at line 135 of file GCTACubePsf.hpp.

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

int GCTACubePsf::m_inx3
mutableprivate

Index of upper right node.

Definition at line 136 of file GCTACubePsf.hpp.

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

int GCTACubePsf::m_inx4
mutableprivate

Index of lower right node.

Definition at line 137 of file GCTACubePsf.hpp.

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

bool GCTACubePsf::m_quadratic_binning
protected

Internal binning is linear.

Definition at line 130 of file GCTACubePsf.hpp.

Referenced by copy_members(), init_members(), set_delta_axis(), and update().

double GCTACubePsf::m_wgt1
mutableprivate

Weight of upper left node.

Definition at line 138 of file GCTACubePsf.hpp.

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

double GCTACubePsf::m_wgt2
mutableprivate

Weight of lower left node.

Definition at line 139 of file GCTACubePsf.hpp.

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

double GCTACubePsf::m_wgt3
mutableprivate

Weight of upper right node.

Definition at line 140 of file GCTACubePsf.hpp.

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

double GCTACubePsf::m_wgt4
mutableprivate

Weight of lower right node.

Definition at line 141 of file GCTACubePsf.hpp.

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


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