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

CTA instrument direction class. More...

#include <GCTAInstDir.hpp>

Inheritance diagram for GCTAInstDir:
GInstDir GBase

Public Member Functions

 GCTAInstDir (void)
 Void constructor. More...
 
 GCTAInstDir (const GSkyDir &dir)
 Sky direction constructor. More...
 
 GCTAInstDir (const double &detx, const double &dety)
 Instrument coordinates constructor. More...
 
 GCTAInstDir (const GSkyDir &dir, const double &detx, const double &dety)
 Instrument direction constructor. More...
 
 GCTAInstDir (const GCTAInstDir &dir)
 Copy constructor. More...
 
virtual ~GCTAInstDir (void)
 Destructor. More...
 
GCTAInstDiroperator= (const GCTAInstDir &dir)
 Assignment operator. More...
 
virtual void clear (void)
 Clear CTA instrument direction. More...
 
virtual GCTAInstDirclone (void) const
 CTA instrument direction. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual u_int64_t hash (void) const
 Return instrument direction hash value. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print instrument direction information. More...
 
void dir (const GSkyDir &dir)
 Set sky direction. More...
 
const GSkyDirdir (void) const
 Return reference to sky direction (const version) More...
 
void detx (const double &x)
 Set DETX coordinate (in radians) More...
 
void dety (const double &y)
 Set DETY coordinate (in radians) More...
 
const double & detx (void) const
 Return reference to DETX coordinate (in radians) More...
 
const double & dety (void) const
 Return reference to DETY coordinate (in radians) More...
 
double theta (void) const
 Return offset angle (in radians) More...
 
double phi (void) const
 Return azimuth angle (in radians) More...
 
const bool & has_dir (void) const
 Signal if instrument direction has valid sky direction. More...
 
const bool & has_detx (void) const
 Signal if instrument direction has valid DETX coordinate. More...
 
const bool & has_dety (void) const
 Signal if instrument direction has valid DETY coordinate. More...
 
- Public Member Functions inherited from GInstDir
 GInstDir (void)
 Void constructor. More...
 
 GInstDir (const GInstDir &dir)
 Copy constructor. More...
 
virtual ~GInstDir (void)
 Destructor. More...
 
virtual GInstDiroperator= (const GInstDir &dir)
 Assignment operator. 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 GCTAInstDir &dir)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
- Protected Member Functions inherited from GInstDir
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GInstDir &dir)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

GSkyDir m_dir
 Observed incident direction of event. More...
 
double m_detx
 Instrument coordinate X (radians) More...
 
double m_dety
 Instrument coordinate Y (radians) More...
 
bool m_has_dir
 Has valid incident direction. More...
 
bool m_has_detx
 Has valid instrument coordinate X. More...
 
bool m_has_dety
 Has valid instrument coordinate Y. More...
 

Detailed Description

CTA instrument direction class.

The CTA instrument direction defines the measured (or reconstructed) direction of an event. The instrument direction comprises a sky direction and detector coordinates. Not all the information is necessary provided, and the has_dir(), has_detx() and has_dety() methods inform which information is contained in a class instance. Note also that the dir(), detx() and dety() methods will throw an exception in case that no information exists. This assures that only valid information can be accessed.

Definition at line 63 of file GCTAInstDir.hpp.

Constructor & Destructor Documentation

GCTAInstDir::GCTAInstDir ( void  )

Void constructor.

Definition at line 56 of file GCTAInstDir.cpp.

References init_members().

Referenced by clone().

GCTAInstDir::GCTAInstDir ( const GSkyDir dir)
explicit

Sky direction constructor.

Parameters
[in]dirSky direction.

Construct CTA instrument direction from sky direction.

Definition at line 73 of file GCTAInstDir.cpp.

References dir(), and init_members().

GCTAInstDir::GCTAInstDir ( const double &  detx,
const double &  dety 
)

Instrument coordinates constructor.

Parameters
[in]detxInstrument coordinate X (radians).
[in]detyInstrument coordinate Y (radians).

Construct CTA instrument direction from instrument coordinates.

Definition at line 94 of file GCTAInstDir.cpp.

References detx(), dety(), and init_members().

GCTAInstDir::GCTAInstDir ( const GSkyDir dir,
const double &  detx,
const double &  dety 
)

Instrument direction constructor.

Parameters
[in]dirSky direction.
[in]detxInstrument coordinate X (radians).
[in]detyInstrument coordinate Y (radians).

Construct CTA instrument direction from sky direction and instrument coordinates.

Definition at line 118 of file GCTAInstDir.cpp.

References detx(), dety(), dir(), and init_members().

GCTAInstDir::GCTAInstDir ( const GCTAInstDir dir)

Copy constructor.

Parameters
[in]dirCTA instrument direction.

Definition at line 140 of file GCTAInstDir.cpp.

References copy_members(), and init_members().

GCTAInstDir::~GCTAInstDir ( void  )
virtual

Destructor.

Definition at line 156 of file GCTAInstDir.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GInstDir.

Definition at line 119 of file GCTAInstDir.hpp.

void GCTAInstDir::clear ( void  )
virtual

Clear CTA instrument direction.

Implements GInstDir.

Definition at line 211 of file GCTAInstDir.cpp.

References GInstDir::free_members(), free_members(), GInstDir::init_members(), and init_members().

Referenced by GCTARoi::init_members(), GCTAEventAtom::init_members(), and GCTAEventBin::init_members().

GCTAInstDir * GCTAInstDir::clone ( void  ) const
virtual

CTA instrument direction.

Returns
Pointer to deep copy of CTA instrument direction.

Implements GInstDir.

Definition at line 231 of file GCTAInstDir.cpp.

References GCTAInstDir().

void GCTAInstDir::copy_members ( const GCTAInstDir dir)
protected

Copy class members.

Parameters
[in]dirCTA instrument direction.

Definition at line 318 of file GCTAInstDir.cpp.

References m_detx, m_dety, m_dir, m_has_detx, m_has_dety, and m_has_dir.

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

void GCTAInstDir::detx ( const double &  x)
inline
const double & GCTAInstDir::detx ( void  ) const
inline

Return reference to DETX coordinate (in radians)

Returns
Reference to DETX coordinate (in radians).
Exceptions
GException::runtime_errorInstrument coordinate has no valid DETX coordinate

Returns reference DETX coordinate (in radians).

Definition at line 205 of file GCTAInstDir.hpp.

References G_DETX, m_detx, and m_has_detx.

Referenced by GCTAInstDir().

void GCTAInstDir::dety ( const double &  y)
inline
const double & GCTAInstDir::dety ( void  ) const
inline

Return reference to DETY coordinate (in radians)

Returns
Reference to DETY coordinate (in radians).
Exceptions
GException::runtime_errorInstrument coordinate has no valid DETY coordinate

Returns reference DETY coordinate (in radians).

Definition at line 226 of file GCTAInstDir.hpp.

References G_DETY, m_dety, and m_has_dety.

Referenced by GCTAInstDir().

const GSkyDir & GCTAInstDir::dir ( void  ) const
inline

Return reference to sky direction (const version)

Returns
Reference to sky direction.
Exceptions
GException::runtime_errorInstrument coordinate has no valid sky direction

Returns reference to the sky direction.

Definition at line 152 of file GCTAInstDir.hpp.

References G_DIR, m_dir, and m_has_dir.

Referenced by dir(), and GCTAInstDir().

void GCTAInstDir::free_members ( void  )
protected

Delete class members.

Definition at line 336 of file GCTAInstDir.cpp.

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

const bool & GCTAInstDir::has_detx ( void  ) const
inline

Signal if instrument direction has valid DETX coordinate.

Returns
True of instrument direction has valid DETX coordinate.

Definition at line 307 of file GCTAInstDir.hpp.

References m_has_detx.

const bool & GCTAInstDir::has_dety ( void  ) const
inline

Signal if instrument direction has valid DETY coordinate.

Returns
True of instrument direction has valid DETY coordinate.

Definition at line 319 of file GCTAInstDir.hpp.

References m_has_dety.

const bool & GCTAInstDir::has_dir ( void  ) const
inline

Signal if instrument direction has valid sky direction.

Returns
True of instrument direction has valid sky direction.

Definition at line 295 of file GCTAInstDir.hpp.

References m_has_dir.

Referenced by GCTAEventList::write_ds_keys().

u_int64_t GCTAInstDir::hash ( void  ) const
virtual

Return instrument direction hash value.

Returns
Hash value.

Returns a hash value that can be used in the response cache.

Implements GInstDir.

Definition at line 244 of file GCTAInstDir.cpp.

References GSkyDir::dec(), m_dir, and GSkyDir::ra().

void GCTAInstDir::init_members ( void  )
protected

Initialise class members.

Definition at line 298 of file GCTAInstDir.cpp.

References GSkyDir::clear(), m_detx, m_dety, m_dir, m_has_detx, m_has_dety, and m_has_dir.

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

GCTAInstDir & GCTAInstDir::operator= ( const GCTAInstDir dir)

Assignment operator.

Parameters
[in]dirCTA instrument direction.
Returns
CTA instrument direction.

Definition at line 178 of file GCTAInstDir.cpp.

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

double GCTAInstDir::phi ( void  ) const
inline

Return azimuth angle (in radians)

Returns
Azimuth angle (in radians).
Exceptions
GException::runtime_errorInstrument coordinate has no valid DETX or DETY coordinate

Returns the azimuth angle from the camera centre (in radians). The azimuth angle \(\phi\) is computed using

\[\phi = \arctan \left( \frac{{\rm DETY}}{{\rm DETX}} \right)\]

where \({\rm DETX}\) and \({\rm DETY}\) are the detector coordinates. The atan2(DETY,DETX) function is used for the computation.

Definition at line 279 of file GCTAInstDir.hpp.

References gammalib::atan2(), G_PHI, m_detx, m_dety, m_has_detx, and m_has_dety.

Referenced by GCTAModelAeffBackground::eval(), and GCTAModelAeffBackground::npred_roi_kern_phi::eval().

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

Print instrument direction information.

Parameters
[in]chatterChattiness.
Returns
String containing instrument direction information.

Implements GInstDir.

Definition at line 267 of file GCTAInstDir.cpp.

References GSkyDir::dec_deg(), m_detx, m_dety, m_dir, GSkyDir::ra_deg(), SILENT, and gammalib::str().

Referenced by GCTAModelSpatialMultiplicative::eval(), GCTARoi::print(), and GCTAEventAtom::print().

double GCTAInstDir::theta ( void  ) const
inline

Return offset angle (in radians)

Returns
Offset angle (in radians).
Exceptions
GException::runtime_errorInstrument coordinate has no valid DETX or DETY coordinate

Returns the offset angle from the camera centre (in radians). The offset angle \(\theta\) is computed using

\[\theta = \sqrt{{\rm DETX}^2 + {\rm DETY}^2}\]

where \({\rm DETX}\) and \({\rm DETY}\) are the detector coordinates.

Definition at line 252 of file GCTAInstDir.hpp.

References G_THETA, m_detx, m_dety, m_has_detx, m_has_dety, and sqrt().

Referenced by GCTAModelRadial::eval(), GCTAModelSpatialGaussSpectrum::eval(), GCTAModelAeffBackground::eval(), GCTAModelSpatialLookup::eval(), GCTAModelAeffBackground::npred_roi_kern_phi::eval(), GCTAModelSpatialLookup::fill_buffer(), and GCTABackgroundPerfTable::rate_ebin().

Member Data Documentation

double GCTAInstDir::m_detx
protected

Instrument coordinate X (radians)

Definition at line 105 of file GCTAInstDir.hpp.

Referenced by copy_members(), detx(), init_members(), phi(), print(), and theta().

double GCTAInstDir::m_dety
protected

Instrument coordinate Y (radians)

Definition at line 106 of file GCTAInstDir.hpp.

Referenced by copy_members(), dety(), init_members(), phi(), print(), and theta().

GSkyDir GCTAInstDir::m_dir
protected

Observed incident direction of event.

Definition at line 104 of file GCTAInstDir.hpp.

Referenced by copy_members(), dir(), hash(), init_members(), print(), and GCTAEventList::read_events().

bool GCTAInstDir::m_has_detx
protected

Has valid instrument coordinate X.

Definition at line 108 of file GCTAInstDir.hpp.

Referenced by copy_members(), detx(), has_detx(), init_members(), phi(), and theta().

bool GCTAInstDir::m_has_dety
protected

Has valid instrument coordinate Y.

Definition at line 109 of file GCTAInstDir.hpp.

Referenced by copy_members(), dety(), has_dety(), init_members(), phi(), and theta().

bool GCTAInstDir::m_has_dir
protected

Has valid incident direction.

Definition at line 107 of file GCTAInstDir.hpp.

Referenced by copy_members(), dir(), has_dir(), and init_members().


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