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

Class that handles photons. More...

#include <GPhoton.hpp>

Inheritance diagram for GPhoton:
GBase

Public Member Functions

 GPhoton (void)
 Void constructor. More...
 
 GPhoton (const GSkyDir &dir, const GEnergy &energy, const GTime &time, const int &mc_id=-1)
 Photon constructor. More...
 
 GPhoton (const GPhoton &photon)
 Copy constructor. More...
 
virtual ~GPhoton (void)
 Destructor. More...
 
GPhotonoperator= (const GPhoton &photon)
 Assignment operator. More...
 
void clear (void)
 Clear photon. More...
 
GPhotonclone (void) const
 Clone photon. More...
 
std::string classname (void) const
 Return class name. More...
 
const GSkyDirdir (void) const
 Return photon sky direction. More...
 
const GEnergyenergy (void) const
 Return photon energy. More...
 
const GTimetime (void) const
 Return photon time. More...
 
const int & mc_id (void) const
 Return photon Monte-Carlo identifier. More...
 
void dir (const GSkyDir &dir)
 Set photon sky direction. More...
 
void energy (const GEnergy &energy)
 Set photon energy. More...
 
void time (const GTime &time)
 Set photon time. More...
 
void mc_id (const int &mc_id)
 Set photon Monte-Carlo identifier. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print photon. 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 GPhoton &photon)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

GSkyDir m_dir
 Photon arrival direction. More...
 
GEnergy m_energy
 Photon energy. More...
 
GTime m_time
 Photon arrival time. More...
 
int m_mc_id
 Monte Carlo simulation origin. More...
 

Friends

bool operator== (const GPhoton &a, const GPhoton &b)
 Equality friend operator. More...
 
bool operator!= (const GPhoton &a, const GPhoton &b)
 Non-equality friend operator. More...
 

Detailed Description

Class that handles photons.

The GPhoton class stores the physical attributes of a photon such as the photon arrival direction, its energy and its arrival time. This class is mainly used for Monte Carlo simulations.

Definition at line 47 of file GPhoton.hpp.

Constructor & Destructor Documentation

GPhoton::GPhoton ( void  )

Void constructor.

Definition at line 54 of file GPhoton.cpp.

References init_members().

Referenced by clone().

GPhoton::GPhoton ( const GSkyDir dir,
const GEnergy energy,
const GTime time,
const int &  mc_id = -1 
)

Photon constructor.

Parameters
[in]dirSky direction.
[in]energyEnergy.
[in]timeTime.
[in]mc_idMonte-Carlo identifier.

Definition at line 72 of file GPhoton.cpp.

References dir(), energy(), init_members(), m_dir, m_energy, m_mc_id, m_time, mc_id(), and time().

GPhoton::GPhoton ( const GPhoton photon)

Copy constructor.

Parameters
[in]photonPhoton.

Definition at line 94 of file GPhoton.cpp.

References copy_members(), and init_members().

GPhoton::~GPhoton ( void  )
virtual

Destructor.

Definition at line 110 of file GPhoton.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GBase.

Definition at line 98 of file GPhoton.hpp.

void GPhoton::clear ( void  )
virtual

Clear photon.

Implements GBase.

Definition at line 162 of file GPhoton.cpp.

References free_members(), and init_members().

GPhoton * GPhoton::clone ( void  ) const
virtual

Clone photon.

Returns
Pointer to deep copy of photon.

Implements GBase.

Definition at line 180 of file GPhoton.cpp.

References GPhoton().

void GPhoton::copy_members ( const GPhoton photon)
protected

Copy class members.

Parameters
[in]photonPhoton.

Definition at line 246 of file GPhoton.cpp.

References m_dir, m_energy, m_mc_id, and m_time.

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

void GPhoton::dir ( const GSkyDir dir)
inline

Set photon sky direction.

Parameters
[in]dirSky direction of photon.

Definition at line 158 of file GPhoton.hpp.

References dir(), and m_dir.

void GPhoton::energy ( const GEnergy energy)
inline

Set photon energy.

Parameters
[in]energyPhoton energy.

Definition at line 171 of file GPhoton.hpp.

References energy(), and m_energy.

void GPhoton::free_members ( void  )
protected

Delete class members.

Definition at line 262 of file GPhoton.cpp.

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

void GPhoton::init_members ( void  )
protected

Initialise class members.

Definition at line 228 of file GPhoton.cpp.

References GSkyDir::clear(), GEnergy::clear(), GTime::clear(), m_dir, m_energy, m_mc_id, and m_time.

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

const int & GPhoton::mc_id ( void  ) const
inline

Return photon Monte-Carlo identifier.

Returns
Photon Monte-Carlo identifier.

Definition at line 146 of file GPhoton.hpp.

References m_mc_id.

Referenced by GPhoton(), and mc_id().

void GPhoton::mc_id ( const int &  mc_id)
inline

Set photon Monte-Carlo identifier.

Parameters
[in]mc_idPhoton Monte-Carlo identifier.

Definition at line 197 of file GPhoton.hpp.

References m_mc_id, and mc_id().

GPhoton & GPhoton::operator= ( const GPhoton photon)

Assignment operator.

Parameters
[in]photonPhoton.
Returns
Photon.

Definition at line 132 of file GPhoton.cpp.

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

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

Print photon.

Parameters
[in]chatterChattiness.
Returns
String containing photon information.

Implements GBase.

Definition at line 193 of file GPhoton.cpp.

References GSkyDir::dec_deg(), m_dir, m_energy, m_mc_id, m_time, GEnergy::print(), GTime::print(), GSkyDir::ra_deg(), SILENT, and gammalib::str().

void GPhoton::time ( const GTime time)
inline

Set photon time.

Parameters
[in]timePhoton time.

Definition at line 184 of file GPhoton.hpp.

References m_time, and time().

Friends And Related Function Documentation

bool operator!= ( const GPhoton a,
const GPhoton b 
)
friend

Non-equality friend operator.

Parameters
[in]aFirst photon.
[in]bSecond photon.
Returns
True is first photon is not identical to second photon

Definition at line 227 of file GPhoton.hpp.

bool operator== ( const GPhoton a,
const GPhoton b 
)
friend

Equality friend operator.

Parameters
[in]aFirst photon.
[in]bSecond photon.
Returns
True is first photon is identical to second photon

Definition at line 212 of file GPhoton.hpp.

Member Data Documentation

GSkyDir GPhoton::m_dir
protected

Photon arrival direction.

Definition at line 85 of file GPhoton.hpp.

Referenced by copy_members(), dir(), GPhoton(), init_members(), operator!=(), operator==(), and print().

GEnergy GPhoton::m_energy
protected

Photon energy.

Definition at line 86 of file GPhoton.hpp.

Referenced by copy_members(), energy(), GPhoton(), init_members(), operator!=(), operator==(), and print().

int GPhoton::m_mc_id
protected

Monte Carlo simulation origin.

Definition at line 88 of file GPhoton.hpp.

Referenced by copy_members(), GPhoton(), init_members(), mc_id(), and print().

GTime GPhoton::m_time
protected

Photon arrival time.

Definition at line 87 of file GPhoton.hpp.

Referenced by copy_members(), GPhoton(), init_members(), operator!=(), operator==(), print(), and time().


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