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

Interface for the Fermi LAT point spread function. More...

#include <GLATPsf.hpp>

Inheritance diagram for GLATPsf:
GBase

Public Member Functions

 GLATPsf (void)
 Void constructor. More...
 
 GLATPsf (const GFilename &filename, const std::string &evtype)
 File constructor. More...
 
 GLATPsf (const GLATPsf &psf)
 Copy constructor. More...
 
virtual ~GLATPsf (void)
 Destructor. More...
 
GLATPsfoperator= (const GLATPsf &psf)
 Assignment operator. More...
 
double operator() (const double &offset, const double &logE, const double &ctheta)
 Return point spread function value. More...
 
void clear (void)
 Clear instance. More...
 
GLATPsfclone (void) const
 Clone instance. More...
 
std::string classname (void) const
 Return class name. More...
 
const std::string & evtype (void) const
 Return event type. More...
 
void load (const GFilename &filename, const std::string &evtype)
 Load point spread function from FITS file. More...
 
void save (const GFilename &filename, const bool &clobber=false)
 Save point spread function into FITS file. More...
 
void read (const GFits &file, const std::string &evtype)
 Read point spread function from FITS file. More...
 
void write (GFits &file) const
 Write point spread function into FITS file. More...
 
int size (void) const
 Returns size of PSF. More...
 
int nenergies (void) const
 Returns number of energy bins in PSF. More...
 
int ncostheta (void) const
 Returns number of cos(theta) bins in PSF. More...
 
double costhetamin (void) const
 Returns minimum cos(theta) angle. More...
 
void costhetamin (const double &ctheta)
 Set minimum cos(theta) angle for point spread function access. More...
 
bool has_phi (void) const
 Signals if PSF has phi dependence. More...
 
int version (void) const
 Returns PSF version. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print point spread function information. 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 GLATPsf &psf)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Private Attributes

std::string m_evtype
 Event type. More...
 
GLATPsfBasem_psf
 Pointer to versioned point spread function. More...
 

Detailed Description

Interface for the Fermi LAT point spread function.

This class provides the interface to the Fermi LAT point spread function (PSF). An instance of the class holds the PSF for a specific event type. The class handles different PSF versions by holding a pointer to the versioned PSF, which is defined by the abstract base class GLATPsfBase. On loading (or reading) of the PSF information from the FITS file, the appropriate versioned PSF will be allocated.

Todo:
Implement Phi dependence

Definition at line 54 of file GLATPsf.hpp.

Constructor & Destructor Documentation

GLATPsf::GLATPsf ( void  )

Void constructor.

Constructs an empty Fermi LAT point spread function.

Definition at line 65 of file GLATPsf.cpp.

References init_members().

Referenced by clone().

GLATPsf::GLATPsf ( const GFilename filename,
const std::string &  evtype 
)

File constructor.

Parameters
[in]filenameFITS file name.
[in]evtypeEvent type.

Constructs a Fermi LAT point spread function by loading the point spread function for a given event type from a FITS response file.

Definition at line 84 of file GLATPsf.cpp.

References init_members(), and load().

GLATPsf::GLATPsf ( const GLATPsf psf)

Copy constructor.

Parameters
[in]psfPoint spread function.

Constructs point spread function by copying point spread function from another object.

Definition at line 105 of file GLATPsf.cpp.

References copy_members(), and init_members().

GLATPsf::~GLATPsf ( void  )
virtual

Destructor.

Definition at line 121 of file GLATPsf.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GBase.

Definition at line 106 of file GLATPsf.hpp.

void GLATPsf::clear ( void  )
virtual

Clear instance.

This method properly resets the object to an initial state.

Implements GBase.

Definition at line 199 of file GLATPsf.cpp.

References free_members(), and init_members().

Referenced by read().

GLATPsf * GLATPsf::clone ( void  ) const
virtual

Clone instance.

Returns
Pointer to deep copy of point spread function.

Implements GBase.

Definition at line 217 of file GLATPsf.cpp.

References GLATPsf().

void GLATPsf::copy_members ( const GLATPsf psf)
private

Copy class members.

Parameters
[in]psfPoint spread function.

Definition at line 561 of file GLATPsf.cpp.

References GLATPsfBase::clone(), m_evtype, and m_psf.

Referenced by GLATPsf(), and operator=().

double GLATPsf::costhetamin ( void  ) const

Returns minimum cos(theta) angle.

Returns
Minimum cos(theta) angle.

Returns the minimum cos(theta) angle for point spread function access. If no PSF has been allocated, 0 is returned.

Definition at line 443 of file GLATPsf.cpp.

References GLATPsfBase::costhetamin(), and m_psf.

void GLATPsf::costhetamin ( const double &  ctheta)

Set minimum cos(theta) angle for point spread function access.

Parameters
[in]cthetaCosine of maximum zenith angle.

Sets the minimum cos(theta) angle. No verification of the specified maximum cos(theta) value is done.

Definition at line 461 of file GLATPsf.cpp.

References GLATPsfBase::costhetamin(), and m_psf.

const std::string & GLATPsf::evtype ( void  ) const
inline

Return event type.

Returns
Event type.

Returns the event type for this point spread function.

Definition at line 120 of file GLATPsf.hpp.

References m_evtype.

Referenced by print(), and read().

void GLATPsf::free_members ( void  )
private

Delete class members.

Definition at line 582 of file GLATPsf.cpp.

References m_psf.

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

bool GLATPsf::has_phi ( void  ) const
inline

Signals if PSF has phi dependence.

Todo:
Implement phi dependence

Definition at line 132 of file GLATPsf.hpp.

void GLATPsf::init_members ( void  )
private

Initialise class members.

Definition at line 545 of file GLATPsf.cpp.

References m_evtype, and m_psf.

Referenced by clear(), GLATPsf(), and operator=().

void GLATPsf::load ( const GFilename filename,
const std::string &  evtype 
)

Load point spread function from FITS file.

Parameters
[in]filenameFITS file.
[in]evtypeEvent type.

Loads Fermi/LAT point spread function from FITS file.

Definition at line 231 of file GLATPsf.cpp.

References read().

Referenced by GLATPsf().

int GLATPsf::ncostheta ( void  ) const

Returns number of cos(theta) bins in PSF.

Returns
Number of cos(theta) bins.

Returns the number of cos(theta) bins in PSF. If no PSF has been allocated, 0 is returned.

Definition at line 425 of file GLATPsf.cpp.

References m_psf, and GLATPsfBase::ncostheta().

Referenced by size().

int GLATPsf::nenergies ( void  ) const

Returns number of energy bins in PSF.

Returns
Number of energy bins.

Returns the number of energy bins in PSF. If no PSF has been allocated, 0 is returned.

Definition at line 407 of file GLATPsf.cpp.

References m_psf, and GLATPsfBase::nenergies().

Referenced by size().

double GLATPsf::operator() ( const double &  offset,
const double &  logE,
const double &  ctheta 
)

Return point spread function value.

Parameters
[in]offsetOffset angle (deg).
[in]logELog10 of the true photon energy (MeV).
[in]cthetaCosine of zenith angle.

Returns the PSF value as function of the offset angle, the base 10 logarithm of the energy, and the cosine of the zenith angle. This method calls the version dependent method.

Returns 0 is no PSF has been allocated.

Definition at line 177 of file GLATPsf.cpp.

References m_psf, and GLATPsfBase::psf().

GLATPsf & GLATPsf::operator= ( const GLATPsf psf)

Assignment operator.

Parameters
[in]psfPoint spread function.
Returns
Point spread function.

Definition at line 143 of file GLATPsf.cpp.

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

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

Print point spread function information.

Parameters
[in]chatterChattiness.
Returns
String containing point spread function information.

Implements GBase.

Definition at line 499 of file GLATPsf.cpp.

References evtype(), m_psf, gammalib::parformat(), GLATPsfBase::scale_index(), GLATPsfBase::scale_par1(), GLATPsfBase::scale_par2(), SILENT, gammalib::str(), and version().

void GLATPsf::read ( const GFits fits,
const std::string &  evtype 
)

Read point spread function from FITS file.

Parameters
[in]fitsFITS file.
[in]evtypeEvent type.
Exceptions
GException::invalid_responseInvalid response type or unsupported response version found.

Reads the Fermi LAT point spread function from FITS file. The method determines the PSF version from the information found in the FITS file and allocates the proper PSF version class. It reads the PSF information from the FITS file.

Todo:
Implement PSF version 2.

Definition at line 284 of file GLATPsf.cpp.

References clear(), GFits::contains(), evtype(), GLATPsfBase::front(), G_READ, GFitsHDU::has_card(), GFitsHDU::integer(), m_evtype, m_psf, GLATPsfBase::read(), GLATPsfBase::read_scale(), gammalib::str(), GFitsHDU::string(), gammalib::strip_whitespace(), GFits::table(), gammalib::toupper(), and version().

Referenced by load().

void GLATPsf::save ( const GFilename filename,
const bool &  clobber = false 
)

Save point spread function into FITS file.

Parameters
[in]filenameFITS file.
[in]clobberOverwrite existing file?

Saves Fermi/LAT point spread function into FITS file.

Definition at line 252 of file GLATPsf.cpp.

References GFits::saveto(), and write().

int GLATPsf::size ( void  ) const

Returns size of PSF.

Returns
Size of point spread function.

Returns the size of the PSF which is defined as the number of energy bins times the number of cos(theta) bins. If no PSF has been allocated, 0 is returned.

Definition at line 392 of file GLATPsf.cpp.

References ncostheta(), and nenergies().

int GLATPsf::version ( void  ) const

Returns PSF version.

Returns the PSF version number.

Returns 0 if no PSF has been allocated.

Definition at line 483 of file GLATPsf.cpp.

References m_psf, and GLATPsfBase::version().

Referenced by print(), and read().

void GLATPsf::write ( GFits fits) const

Write point spread function into FITS file.

Parameters
[in]fitsFITS file.

Writes the version dependent point spread function into the FITS file. The method does nothing if no PSF has been allocated.

Todo:
Implement PSF versions 2 and 3.

Definition at line 365 of file GLATPsf.cpp.

References m_psf, GLATPsfBase::write(), and GLATPsfBase::write_scale().

Referenced by save().

Member Data Documentation

std::string GLATPsf::m_evtype
private

Event type.

Definition at line 95 of file GLATPsf.hpp.

Referenced by copy_members(), evtype(), init_members(), and read().

GLATPsfBase* GLATPsf::m_psf
private

Pointer to versioned point spread function.

Definition at line 96 of file GLATPsf.hpp.

Referenced by copy_members(), costhetamin(), free_members(), init_members(), ncostheta(), nenergies(), operator()(), print(), read(), version(), and write().


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