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

Abstract spectral model base class. More...

#include <GModelSpectral.hpp>

Inheritance diagram for GModelSpectral:
GBase GModelSpectralBins GModelSpectralBrokenPlaw GModelSpectralComposite GModelSpectralConst GModelSpectralExpInvPlaw GModelSpectralExponential GModelSpectralExpPlaw GModelSpectralFunc GModelSpectralGauss GModelSpectralLogParabola GModelSpectralMultiplicative GModelSpectralNodes GModelSpectralPlaw GModelSpectralPlawEnergyFlux GModelSpectralPlawPhotonFlux GModelSpectralSmoothBrokenPlaw GModelSpectralSuperExpPlaw GModelSpectralTable

Public Member Functions

 GModelSpectral (void)
 Void constructor. More...
 
 GModelSpectral (const GModelSpectral &model)
 Copy constructor. More...
 
virtual ~GModelSpectral (void)
 Destructor. More...
 
virtual GModelSpectraloperator= (const GModelSpectral &model)
 Assignment operator. More...
 
virtual GModelParoperator[] (const int &index)
 Returns model parameter. More...
 
virtual const GModelParoperator[] (const int &index) const
 Returns model parameter (const version) More...
 
virtual GModelParoperator[] (const std::string &name)
 Returns reference to model parameter. More...
 
virtual const GModelParoperator[] (const std::string &name) const
 Returns reference to model parameter (const version) More...
 
virtual void clear (void)=0
 Clear object. More...
 
virtual GModelSpectralclone (void) const =0
 Clones object. More...
 
virtual std::string classname (void) const =0
 Return class name. More...
 
virtual std::string type (void) const =0
 
virtual double eval (const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const =0
 
virtual double flux (const GEnergy &emin, const GEnergy &emax) const =0
 
virtual double eflux (const GEnergy &emin, const GEnergy &emax) const =0
 
virtual GEnergy mc (const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const =0
 
virtual void read (const GXmlElement &xml)=0
 
virtual void write (GXmlElement &xml) const =0
 
virtual std::string print (const GChatter &chatter=NORMAL) const =0
 Print content of object. More...
 
GModelParat (const int &index)
 Returns model parameter. More...
 
const GModelParat (const int &index) const
 Returns model parameter (const version) More...
 
bool has_par (const std::string &name) const
 Checks if parameter name exists. More...
 
int size (void) const
 Return number of parameters. More...
 
void autoscale (void)
 Autoscale parameters. 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 GModelSpectral &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

std::vector< GModelPar * > m_pars
 Parameter pointers. More...
 

Detailed Description

Abstract spectral model base class.

This class implements the spectral component of the factorized source model

\[ S_{\rm E}(E | t) \]

where \(E\) is the true photon energy, and \(t\) is the true photon arrival time.

The spectral component describes the spatially integrated time dependent spectral distribution of the source. It satisfies

\[ \int_{E} S_{\rm E}(E | t) dE = \Phi \]

for all \(t\), where \(\Phi\) is the spatially and spectrally integrated total source flux. The spectral component does not impact the temporal properties of the integrated flux \(\Phi\).

Definition at line 68 of file GModelSpectral.hpp.

Constructor & Destructor Documentation

GModelSpectral::GModelSpectral ( void  )

Void constructor.

Definition at line 55 of file GModelSpectral.cpp.

References init_members().

GModelSpectral::GModelSpectral ( const GModelSpectral model)

Copy constructor.

Parameters
[in]modelSpectral model.

Definition at line 70 of file GModelSpectral.cpp.

References copy_members(), and init_members().

GModelSpectral::~GModelSpectral ( void  )
virtual

Destructor.

Definition at line 86 of file GModelSpectral.cpp.

References free_members().

Member Function Documentation

GModelPar & GModelSpectral::at ( const int &  index)

Returns model parameter.

Parameters
[in]indexParameter index [0,...,size()[.
Returns
Model parameter.
Exceptions
GException::out_of_rangeParameter index is out of range.

Returns model parameter with index range checking.

Definition at line 206 of file GModelSpectral.cpp.

References G_AT, m_pars, and size().

const GModelPar & GModelSpectral::at ( const int &  index) const

Returns model parameter (const version)

Parameters
[in]indexParameter index [0,...,size()[.
Returns
Model parameter.
Exceptions
GException::out_of_rangeParameter index is out of range.

Returns model parameter with index range checking.

Definition at line 229 of file GModelSpectral.cpp.

References G_AT, m_pars, and size().

virtual std::string GModelSpectral::classname ( void  ) const
pure virtual
virtual void GModelSpectral::clear ( void  )
pure virtual
virtual GModelSpectral* GModelSpectral::clone ( void  ) const
pure virtual

Clones object.

Returns
Pointer to deep copy of object.

Creates a deep copy of the object and returns a pointer to the object.

Implements GBase.

Implemented in GModelSpectralSmoothBrokenPlaw, GModelSpectralNodes, GModelSpectralPlawEnergyFlux, GModelSpectralPlawPhotonFlux, GModelSpectralExpInvPlaw, GModelSpectralSuperExpPlaw, GModelSpectralBrokenPlaw, GModelSpectralLogParabola, GModelSpectralExpPlaw, GModelSpectralPlaw, GModelSpectralGauss, GModelSpectralFunc, GModelSpectralConst, GModelSpectralTable, GModelSpectralBins, GModelSpectralExponential, GModelSpectralMultiplicative, and GModelSpectralComposite.

Referenced by GModelSpectralComposite::append(), GModelSpectralMultiplicative::append(), GCTAModelSpatialGaussSpectrum::copy_members(), GCTAModelIrfBackground::copy_members(), GCTAModelAeffBackground::copy_members(), GCTAModelCubeBackground::copy_members(), GCTAModelRadialAcceptance::copy_members(), GCTAModelBackground::copy_members(), GCTAModelSkyCube::copy_members(), GModelSky::copy_members(), GModelSpectralExponential::exponent(), GCTAModelAeffBackground::GCTAModelAeffBackground(), GCTAModelBackground::GCTAModelBackground(), GCTAModelCubeBackground::GCTAModelCubeBackground(), GCTAModelIrfBackground::GCTAModelIrfBackground(), GCTAModelRadialAcceptance::GCTAModelRadialAcceptance(), GCTAModelSkyCube::GCTAModelSkyCube(), GModelSky::GModelSky(), GCTAModelSpatialGaussSpectrum::sigma(), GCTAModelIrfBackground::spectral(), GCTAModelAeffBackground::spectral(), GCTAModelCubeBackground::spectral(), GCTAModelRadialAcceptance::spectral(), GCTAModelBackground::spectral(), GCTAModelSkyCube::spectral(), and GModelSky::spectral().

void GModelSpectral::copy_members ( const GModelSpectral model)
protected

Copy class members.

Parameters
[in]modelSpectral model.

Definition at line 311 of file GModelSpectral.cpp.

References m_pars.

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

virtual double GModelSpectral::eval ( const GEnergy srcEng,
const GTime srcTime = GTime(),
const bool &  gradients = false 
) const
pure virtual
bool GModelSpectral::has_par ( const std::string &  name) const

Checks if parameter name exists.

Parameters
[in]nameParameter name.
Returns
True if parameter with specified name exists.

Searches all parameter names for a match with the specified name. If the specified name has been found, true is returned.

Definition at line 250 of file GModelSpectral.cpp.

References m_pars, and size().

Referenced by GCTAOnOffObservation::N_gamma().

GModelPar & GModelSpectral::operator[] ( const int &  index)
inlinevirtual

Returns model parameter.

Parameters
[in]indexParameter index [0,...,size()-1].
Returns
Model parameter.

Returns model parameter without index range checking.

Definition at line 128 of file GModelSpectral.hpp.

References m_pars.

const GModelPar & GModelSpectral::operator[] ( const int &  index) const
inlinevirtual

Returns model parameter (const version)

Parameters
[in]indexParameter index [0,...,size()-1].
Returns
Model parameter.

Returns model parameter without index range checking.

Definition at line 143 of file GModelSpectral.hpp.

References m_pars.

GModelPar & GModelSpectral::operator[] ( const std::string &  name)
virtual

Returns reference to model parameter.

Parameters
[in]nameParameter name.
Exceptions
GException::invalid_argumentParameter with specified name not found.

Definition at line 137 of file GModelSpectral.cpp.

References G_ACCESS, m_pars, and size().

const GModelPar & GModelSpectral::operator[] ( const std::string &  name) const
virtual

Returns reference to model parameter (const version)

Parameters
[in]nameParameter name.
Exceptions
GException::invalid_argumentParameter with specified name not found.

Definition at line 167 of file GModelSpectral.cpp.

References G_ACCESS, m_pars, and size().

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

Print content of object.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing the content of the object.

Formats the content in a standard way and puts this content in a C++ string that is returned.

Implements GBase.

Implemented in GModelSpectralSmoothBrokenPlaw, GModelSpectralNodes, GModelSpectralPlawEnergyFlux, GModelSpectralPlawPhotonFlux, GModelSpectralExpInvPlaw, GModelSpectralSuperExpPlaw, GModelSpectralBrokenPlaw, GModelSpectralLogParabola, GModelSpectralExpPlaw, GModelSpectralPlaw, GModelSpectralGauss, GModelSpectralFunc, GModelSpectralConst, GModelSpectralTable, GModelSpectralBins, GModelSpectralExponential, GModelSpectralMultiplicative, and GModelSpectralComposite.

int GModelSpectral::size ( void  ) const
inline

Return number of parameters.

Returns
Number of parameters in spectral model component.

Returns the number of parameters in the spectral model component.

Definition at line 157 of file GModelSpectral.hpp.

References m_pars.

Referenced by at(), GResponse::convolve(), GModelSpectralComposite::copy_members(), GModelSpectralMultiplicative::copy_members(), GModelSpectralTable::create_par_table(), GResponse::edisp_kerns::edisp_kerns(), GCTAModelIrfBackground::eval(), GCTAModelSpatialGaussSpectrum::eval(), GCTAModelAeffBackground::eval(), GModelSpectralExponential::eval(), GCTAModelCubeBackground::eval(), GCTAModelRadialAcceptance::eval(), GCTAModelBackground::eval(), GCTAModelSkyCube::eval(), GResponse::eval_prob(), GResponse::eval_probs(), GModelSpectralExponential::exponent(), has_par(), operator[](), GModelSpectralTable::par_index(), GCTAModelSpatialGaussSpectrum::print(), GCTAModelIrfBackground::print(), GCTAModelAeffBackground::print(), GCTAModelCubeBackground::print(), GModelSpectralComposite::print(), GModelSpectralMultiplicative::print(), GCTAModelRadialAcceptance::print(), GModelSpectralExponential::print(), GCTAModelBackground::print(), GModelSpectralBins::print(), GCTAModelSkyCube::print(), GModelSpectralConst::print(), GModelSpectralTable::print(), GModelSpectralFunc::print(), GModelSpectralGauss::print(), GModelSpectralPlaw::print(), GModelSpectralExpPlaw::print(), GModelSpectralLogParabola::print(), GModelSpectralBrokenPlaw::print(), GModelSpectralExpInvPlaw::print(), GModelSpectralSuperExpPlaw::print(), GModelSpectralPlawPhotonFlux::print(), GModelSpectralPlawEnergyFlux::print(), GModelSpectralNodes::print(), GModelSpectralSmoothBrokenPlaw::print(), GModelSky::print(), GCTAModelSpatialGaussSpectrum::set_pointers(), GCTAModelIrfBackground::set_pointers(), GCTAModelAeffBackground::set_pointers(), GCTAModelCubeBackground::set_pointers(), GCTAModelRadialAcceptance::set_pointers(), GCTAModelBackground::set_pointers(), GCTAModelSkyCube::set_pointers(), GModelSky::set_pointers(), GModelSky::signal_analytical_gradients(), GResponse::size_edisp_vector(), GModelSpectralTable::table_par(), GModelSpectralExponential::update_mc_cache(), GModelSpectralComposite::update_mc_cache(), GModelSpectralMultiplicative::update_mc_cache(), GModelSpectralComposite::write(), and GModelSpectralMultiplicative::write().

Member Data Documentation

std::vector<GModelPar*> GModelSpectral::m_pars
protected

Parameter pointers.

Definition at line 115 of file GModelSpectral.hpp.

Referenced by GModelSpectralComposite::append(), GModelSpectralMultiplicative::append(), at(), autoscale(), GModelSpectralMultiplicative::copy_members(), GModelSpectralComposite::copy_members(), GModelSpectralConst::copy_members(), GModelSpectralGauss::copy_members(), GModelSpectralPlaw::copy_members(), copy_members(), GModelSpectralFunc::copy_members(), GModelSpectralExpPlaw::copy_members(), GModelSpectralLogParabola::copy_members(), GModelSpectralBrokenPlaw::copy_members(), GModelSpectralExpInvPlaw::copy_members(), GModelSpectralSuperExpPlaw::copy_members(), GModelSpectralPlawEnergyFlux::copy_members(), GModelSpectralPlawPhotonFlux::copy_members(), GModelSpectralSmoothBrokenPlaw::copy_members(), GModelSpectralPlaw::eval(), GModelSpectralExponential::exponent(), has_par(), GModelSpectralConst::init_members(), GModelSpectralGauss::init_members(), GModelSpectralPlaw::init_members(), init_members(), GModelSpectralFunc::init_members(), GModelSpectralExpPlaw::init_members(), GModelSpectralLogParabola::init_members(), GModelSpectralBrokenPlaw::init_members(), GModelSpectralExpInvPlaw::init_members(), GModelSpectralSuperExpPlaw::init_members(), GModelSpectralPlawEnergyFlux::init_members(), GModelSpectralPlawPhotonFlux::init_members(), GModelSpectralSmoothBrokenPlaw::init_members(), operator[](), GModelSpectralComposite::print(), GModelSpectralMultiplicative::print(), GModelSpectralExponential::print(), GModelSpectralBins::print(), GModelSpectralConst::print(), GModelSpectralTable::print(), GModelSpectralFunc::print(), GModelSpectralGauss::print(), GModelSpectralPlaw::print(), GModelSpectralExpPlaw::print(), GModelSpectralLogParabola::print(), GModelSpectralBrokenPlaw::print(), GModelSpectralExpInvPlaw::print(), GModelSpectralSuperExpPlaw::print(), GModelSpectralPlawPhotonFlux::print(), GModelSpectralPlawEnergyFlux::print(), GModelSpectralNodes::print(), GModelSpectralSmoothBrokenPlaw::print(), GModelSpectralTable::set_par_pointers(), size(), GModelSpectralExponential::update_mc_cache(), GModelSpectralMultiplicative::update_mc_cache(), GModelSpectralComposite::update_mc_cache(), GModelSpectralBins::update_pars(), and GModelSpectralNodes::update_pars().


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