GammaLib 2.1.0
Loading...
Searching...
No Matches
GPhoton Class Reference

Class that handles photons. More...

#include <GPhoton.hpp>

Inheritance diagram for GPhoton:
GBase

Public Member Functions

 GPhoton (void)
 Void constructor.
 
 GPhoton (const GSkyDir &dir, const GEnergy &energy, const GTime &time, const int &mc_id=-1)
 Photon constructor.
 
 GPhoton (const GPhoton &photon)
 Copy constructor.
 
virtual ~GPhoton (void)
 Destructor.
 
GPhoton & operator= (const GPhoton &photon)
 Assignment operator.
 
void clear (void)
 Clear photon.
 
GPhoton * clone (void) const
 Clone photon.
 
std::string classname (void) const
 Return class name.
 
const GSkyDir & dir (void) const
 Return photon sky direction.
 
const GEnergy & energy (void) const
 Return photon energy.
 
const GTime & time (void) const
 Return photon time.
 
const int & mc_id (void) const
 Return photon Monte-Carlo identifier.
 
void dir (const GSkyDir &dir)
 Set photon sky direction.
 
void energy (const GEnergy &energy)
 Set photon energy.
 
void time (const GTime &time)
 Set photon time.
 
void mc_id (const int &mc_id)
 Set photon Monte-Carlo identifier.
 
std::string print (const GChatter &chatter=NORMAL) const
 Print photon.
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor.
 

Protected Member Functions

void init_members (void)
 Initialise class members.
 
void copy_members (const GPhoton &photon)
 Copy class members.
 
void free_members (void)
 Delete class members.
 

Protected Attributes

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

Friends

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

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() [1/3]

GPhoton::GPhoton ( void )

Void constructor.

Definition at line 54 of file GPhoton.cpp.

References init_members().

Referenced by clone().

◆ GPhoton() [2/3]

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() [3/3]

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::~GPhoton ( void )
virtual

Destructor.

Definition at line 110 of file GPhoton.cpp.

References free_members().

Member Function Documentation

◆ classname()

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.

◆ clear()

void GPhoton::clear ( void )
virtual

Clear photon.

Implements GBase.

Definition at line 162 of file GPhoton.cpp.

References free_members(), and init_members().

◆ clone()

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().

◆ copy_members()

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=().

◆ dir() [1/2]

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.

◆ dir() [2/2]

◆ energy() [1/2]

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.

◆ energy() [2/2]

◆ free_members()

void GPhoton::free_members ( void )
protected

Delete class members.

Definition at line 262 of file GPhoton.cpp.

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

◆ init_members()

void GPhoton::init_members ( void )
protected

Initialise class members.

Definition at line 228 of file GPhoton.cpp.

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

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

◆ mc_id() [1/2]

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().

◆ mc_id() [2/2]

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().

◆ operator=()

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().

◆ print()

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().

◆ time() [1/2]

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().

◆ time() [2/2]

Friends And Related Symbol Documentation

◆ operator!=

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.

◆ operator==

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

◆ m_dir

GSkyDir GPhoton::m_dir
protected

Photon arrival direction.

Definition at line 85 of file GPhoton.hpp.

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

◆ m_energy

GEnergy GPhoton::m_energy
protected

Photon energy.

Definition at line 86 of file GPhoton.hpp.

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

◆ m_mc_id

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(), mc_id(), and print().

◆ m_time

GTime GPhoton::m_time
protected

Photon arrival time.

Definition at line 87 of file GPhoton.hpp.

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


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