GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GSource Class Reference

Class that handles gamma-ray sources. More...

#include <GSource.hpp>

Inheritance diagram for GSource:
GBase

Public Member Functions

 GSource (void)
 Void constructor.
 
 GSource (const std::string &name, GModelSpatial *model, const GEnergy &energy, const GTime &time)
 Source constructor.
 
 GSource (const GSource &src)
 Copy constructor.
 
virtual ~GSource (void)
 Destructor.
 
GSource & operator= (const GSource &src)
 Assignment operator.
 
void clear (void)
 Clear instance.
 
GSource * clone (void) const
 Clone object.
 
std::string classname (void) const
 Return class name.
 
const std::string & name (void) const
 Return model name.
 
const GModelSpatial * model (void) const
 Return spatial model component.
 
const GEnergy & energy (void) const
 Return photon energy.
 
const GTime & time (void) const
 Return photon arrival time.
 
void name (const std::string &name)
 Set model name.
 
void model (GModelSpatial *model)
 Set spatial model component.
 
void energy (const GEnergy &energy)
 Set photon energy.
 
void time (const GTime &time)
 Set photon arrival time.
 
std::string print (const GChatter &chatter=NORMAL) const
 Print source.
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor.
 

Protected Member Functions

void init_members (void)
 Initialise class members.
 
void copy_members (const GSource &src)
 Copy class members.
 
void free_members (void)
 Delete class members.
 

Protected Attributes

std::string m_name
 Source name.
 
GModelSpatial * m_model
 Spatial model.
 
GEnergy m_energy
 Photon energy.
 
GTime m_time
 Photon arrival time.
 

Detailed Description

Class that handles gamma-ray sources.

The GSource class stores the physical attributes of a gamma-ray source, which is the distribution of photon arrival directions in form of a spatial source model, the photon energy, and the photon arrival time. The class is very similar to the GPhoton class, yet instead of a given photon arrival direction it contains a spatial model pointer. Note that the class does not allocate or deallocate the spatial model pointer, it just is a carrier of a pointer which is handled outside the class.

Each source also has a name so that it can be identified.

Definition at line 53 of file GSource.hpp.

Constructor & Destructor Documentation

◆ GSource() [1/3]

GSource::GSource ( void )

Void constructor.

Definition at line 54 of file GSource.cpp.

References init_members().

Referenced by clone().

◆ GSource() [2/3]

GSource::GSource ( const std::string & name,
GModelSpatial * model,
const GEnergy & energy,
const GTime & time )

Source constructor.

Parameters
[in]nameSource name.
[in]modelSpatial model pointer.
[in]energyEnergy.
[in]timeTime.

Definition at line 72 of file GSource.cpp.

References energy(), init_members(), m_energy, m_model, m_name, m_time, model(), name(), and time().

◆ GSource() [3/3]

GSource::GSource ( const GSource & src)

Copy constructor.

Parameters
[in]srcSource.

Definition at line 96 of file GSource.cpp.

References copy_members(), and init_members().

◆ ~GSource()

GSource::~GSource ( void )
virtual

Destructor.

Definition at line 112 of file GSource.cpp.

References free_members().

Member Function Documentation

◆ classname()

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

Return class name.

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

Implements GBase.

Definition at line 100 of file GSource.hpp.

◆ clear()

void GSource::clear ( void )
virtual

Clear instance.

Implements GBase.

Definition at line 164 of file GSource.cpp.

References free_members(), and init_members().

◆ clone()

GSource * GSource::clone ( void ) const
virtual

Clone object.

Returns
Pointer to deep copy of source.

Implements GBase.

Definition at line 182 of file GSource.cpp.

References GSource().

◆ copy_members()

void GSource::copy_members ( const GSource & src)
protected

Copy class members.

Parameters
[in]srcSource.

Definition at line 250 of file GSource.cpp.

References m_energy, m_model, m_name, and m_time.

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

◆ energy() [1/2]

void GSource::energy ( const GEnergy & energy)
inline

Set photon energy.

Parameters
[in]energyPhoton energy.

Sets the photon energy.

Definition at line 200 of file GSource.hpp.

References energy(), and m_energy.

◆ energy() [2/2]

◆ free_members()

void GSource::free_members ( void )
protected

Delete class members.

Definition at line 266 of file GSource.cpp.

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

◆ init_members()

void GSource::init_members ( void )
protected

Initialise class members.

Definition at line 232 of file GSource.cpp.

References GEnergy::clear(), GTime::clear(), m_energy, m_model, m_name, and m_time.

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

◆ model() [1/2]

void GSource::model ( GModelSpatial * model)
inline

Set spatial model component.

Parameters
[in]modelSpatial model component.

Sets the spatial model component.

Definition at line 185 of file GSource.hpp.

References m_model, and model().

◆ model() [2/2]

◆ name() [1/2]

void GSource::name ( const std::string & name)
inline

Set model name.

Parameters
[in]nameModel name.

Sets the model name.

Definition at line 170 of file GSource.hpp.

References m_name, and name().

◆ name() [2/2]

const std::string & GSource::name ( void ) const
inline

Return model name.

Returns
Model name.

Returns the model name.

Definition at line 114 of file GSource.hpp.

References m_name.

Referenced by GSource(), GResponse::irf_composite(), GCTAResponseCube::irf_spatial(), GResponse::irf_spatial(), GLATResponse::irf_spatial_bin(), and name().

◆ operator=()

GSource & GSource::operator= ( const GSource & src)

Assignment operator.

Parameters
[in]srcSource.
Returns
Source.

Definition at line 134 of file GSource.cpp.

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

◆ print()

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

Print source.

Parameters
[in]chatterChattiness.
Returns
String containing source information

Implements GBase.

Definition at line 195 of file GSource.cpp.

References m_energy, m_model, m_name, m_time, GEnergy::print(), GTime::print(), SILENT, and GModelSpatial::type().

◆ time() [1/2]

void GSource::time ( const GTime & time)
inline

Set photon arrival time.

Parameters
[in]timePhoton arrival time.

Sets the photon arrival time.

Definition at line 215 of file GSource.hpp.

References m_time, and time().

◆ time() [2/2]

const GTime & GSource::time ( void ) const
inline

Member Data Documentation

◆ m_energy

GEnergy GSource::m_energy
protected

Photon energy.

Definition at line 89 of file GSource.hpp.

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

◆ m_model

GModelSpatial* GSource::m_model
protected

Spatial model.

Definition at line 88 of file GSource.hpp.

Referenced by copy_members(), GSource(), init_members(), model(), model(), and print().

◆ m_name

std::string GSource::m_name
protected

Source name.

Definition at line 87 of file GSource.hpp.

Referenced by copy_members(), GSource(), init_members(), name(), name(), and print().

◆ m_time

GTime GSource::m_time
protected

Photon arrival time.

Definition at line 90 of file GSource.hpp.

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


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