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

Smoothly broken power law spectral model class. More...

#include <GModelSpectralSmoothBrokenPlaw.hpp>

Inheritance diagram for GModelSpectralSmoothBrokenPlaw:
GModelSpectral GBase

Classes

class  eflux_kern
 
class  flux_kern
 

Public Member Functions

 GModelSpectralSmoothBrokenPlaw (void)
 Void constructor. More...
 
 GModelSpectralSmoothBrokenPlaw (const std::string &type, const std::string &prefactor, const std::string &index1, const std::string &pivot, const std::string &index2, const std::string &breakenergy, const std::string &beta)
 Model type and parameter name constructor. More...
 
 GModelSpectralSmoothBrokenPlaw (const double &prefactor, const double &index1, const GEnergy &pivot, const double &index2, const GEnergy &breakenergy, const double &beta)
 Parameter constructor. More...
 
 GModelSpectralSmoothBrokenPlaw (const GXmlElement &xml)
 XML constructor. More...
 
 GModelSpectralSmoothBrokenPlaw (const GModelSpectralSmoothBrokenPlaw &model)
 Copy constructor. More...
 
virtual ~GModelSpectralSmoothBrokenPlaw (void)
 Destructor. More...
 
virtual
GModelSpectralSmoothBrokenPlaw
operator= (const GModelSpectralSmoothBrokenPlaw &model)
 Assignment operator. More...
 
virtual void clear (void)
 Clear smoothly broken power law model. More...
 
virtual
GModelSpectralSmoothBrokenPlaw
clone (void) const
 Clone smoothly broken power law model. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual std::string type (void) const
 Return model type. More...
 
virtual double eval (const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const
 Evaluate function. More...
 
virtual double flux (const GEnergy &emin, const GEnergy &emax) const
 Returns model photon flux between emin, emax More...
 
virtual double eflux (const GEnergy &emin, const GEnergy &emax) const
 Returns model energy flux between emin, emax More...
 
virtual GEnergy mc (const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const
 Returns Monte Carlo energy between [emin, emax]. More...
 
virtual void read (const GXmlElement &xml)
 Read model from XML element. More...
 
virtual void write (GXmlElement &xml) const
 Write model into XML element. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print smooth broken powerlaw information. More...
 
void type (const std::string &type)
 Set model type. More...
 
double prefactor (void) const
 Return pre factor. More...
 
double index1 (void) const
 Return smoothly broken power law index1. More...
 
double index2 (void) const
 Return smoothly broken power law index2. More...
 
GEnergy pivot (void) const
 Return pivot energy. More...
 
GEnergy breakenergy (void) const
 Return breakenergy energy. More...
 
double beta (void) const
 Returns break smoothness parameter beta. More...
 
void prefactor (const double &prefactor)
 Set pre factor. More...
 
void index1 (const double &index1)
 Set smoothly broken power law index1. More...
 
void index2 (const double &index2)
 Set smoothly broken power law index2. More...
 
void pivot (const GEnergy &pivot)
 Set pivot energy. More...
 
void breakenergy (const GEnergy &breakenergy)
 Set breakenergy energy. More...
 
void beta (const double &beta)
 Set break smoothness. More...
 
- Public Member Functions inherited from GModelSpectral
 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...
 
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 GModelSpectralSmoothBrokenPlaw &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void update_eval_cache (const GEnergy &energy) const
 Update eval precomputation cache. More...
 
void update_mc_cache (void) const
 Update Monte Carlo pre computation cache. More...
 
- Protected Member Functions inherited from GModelSpectral
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::string m_type
 Model type. More...
 
GModelPar m_norm
 Normalization factor. More...
 
GModelPar m_index1
 Spectral index1. More...
 
GModelPar m_index2
 Spectral index2. More...
 
GModelPar m_pivot
 Pivot energy. More...
 
GModelPar m_breakenergy
 Energy of spectral break. More...
 
GModelPar m_beta
 Break smoothness. More...
 
GEnergy m_last_energy
 Last energy value. More...
 
double m_last_index1
 Last index1 parameter. More...
 
double m_last_index2
 Last index2 parameter. More...
 
double m_last_pivot
 Last pivot parameter. More...
 
double m_last_breakenergy
 Last breakenergy parameter. More...
 
double m_last_beta
 Last beta parameter. More...
 
double m_last_epivot_norm
 Last E/Epivot value. More...
 
double m_last_ebreak_norm
 Last E/Ebreakenergy value. More...
 
double m_last_log_epivot_norm
 Last ln(E/Epivot) value. More...
 
double m_last_log_ebreak_norm
 Last ln(E/Ebreakenergy) value. More...
 
double m_last_epivot_pow
 Last pow(E/Epivot,index1) value. More...
 
double m_last_ebreak_pow
 Last pow(E/Ebreakenergy,(index1-index2)/beta) More...
 
double m_mc_prefactor
 Last pre factor. More...
 
double m_mc_index1
 Last first index. More...
 
double m_mc_index2
 Last second index. More...
 
double m_mc_pivot
 Last pivot energy. More...
 
double m_mc_breakenergy
 Last break energy. More...
 
GModelSpectralBrokenPlaw m_mc_brokenplaw
 Broken power plaw. More...
 
- Protected Attributes inherited from GModelSpectral
std::vector< GModelPar * > m_pars
 Parameter pointers. More...
 

Detailed Description

Smoothly broken power law spectral model class.

This class implements a smoothly broken power law spectrum. The model is defined by

\[ S_{\rm E}(E | t) = k_0 \left( \frac{E}{E_0} \right)^{\gamma_1} \left[ 1 + \left( \frac{E}{E_b} \right)^{\frac{\gamma_1 - \gamma_2}{\beta}} \right]^{-\beta} \]

where

  • \(k_0\) is the normalization or prefactor,
  • \(\gamma_1\) is the spectral index before the break,
  • \(\gamma_2\) is the spectral index after the break,
  • \(E_0\) is the pivot energy,
  • \(E_b\) is the break energy,
  • \(\beta\) defines the break smoothness (larger = smoother transition)

Notes:

  • The pivot energy should be set far away from the expected break energy value.
  • When the two indices are close together, the beta parameter becomes poorly constrained. Since the beta parameter also scales the indices, this can cause very large errors in the estimates of the various spectral parameters. In this case, consider fixing beta.

Definition at line 75 of file GModelSpectralSmoothBrokenPlaw.hpp.

Constructor & Destructor Documentation

GModelSpectralSmoothBrokenPlaw::GModelSpectralSmoothBrokenPlaw ( void  )

Void constructor.

Definition at line 82 of file GModelSpectralSmoothBrokenPlaw.cpp.

References init_members().

Referenced by clone().

GModelSpectralSmoothBrokenPlaw::GModelSpectralSmoothBrokenPlaw ( const std::string &  type,
const std::string &  prefactor,
const std::string &  index1,
const std::string &  pivot,
const std::string &  index2,
const std::string &  breakenergy,
const std::string &  beta 
)

Model type and parameter name constructor.

Parameters
[in]typeModel type.
[in]prefactorName of prefactor parameter.
[in]index1Name of index1 parameter.
[in]pivotName of pivot parameter.
[in]index2Name of index2 parameter.
[in]breakenergyName of breakenergy parameter.
[in]betaName of beta parameter.

Definition at line 104 of file GModelSpectralSmoothBrokenPlaw.cpp.

References init_members(), m_beta, m_breakenergy, m_index1, m_index2, m_norm, m_pivot, m_type, GOptimizerPar::name(), and type().

GModelSpectralSmoothBrokenPlaw::GModelSpectralSmoothBrokenPlaw ( const double &  prefactor,
const double &  index1,
const GEnergy pivot,
const double &  index2,
const GEnergy breakenergy,
const double &  beta 
)

Parameter constructor.

Parameters
[in]prefactorSmoothly broken power law pre factor (ph/cm2/s/MeV).
[in]index1Smoothly broken power law index1.
[in]pivotSmoothly broken power law pivot energy
[in]index2Smoothly broken power law index1.
[in]breakenergyBreak energy.
[in]betaBreak smoothness parameter

Constructs a smoothly broken power law using the model parameters power law prefactor (ph/cm2/s/MeV), spectral index1, pivot energy, spectral index2, breakenergy of spectral break, and smoothness parameter beta.

Definition at line 151 of file GModelSpectralSmoothBrokenPlaw.cpp.

References GModelSpectral::autoscale(), init_members(), m_beta, m_breakenergy, m_index1, m_index2, m_norm, m_pivot, GEnergy::MeV(), and GOptimizerPar::value().

GModelSpectralSmoothBrokenPlaw::GModelSpectralSmoothBrokenPlaw ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML element containing position information.

Constructs a smoothly broken power law spectral model by extracting information from an XML element. See the read() method for more information about the expected structure of the XML element.

Definition at line 188 of file GModelSpectralSmoothBrokenPlaw.cpp.

References init_members(), and read().

GModelSpectralSmoothBrokenPlaw::GModelSpectralSmoothBrokenPlaw ( const GModelSpectralSmoothBrokenPlaw model)

Copy constructor.

Parameters
[in]modelSmoothly broken power law model.

Definition at line 207 of file GModelSpectralSmoothBrokenPlaw.cpp.

References copy_members(), and init_members().

GModelSpectralSmoothBrokenPlaw::~GModelSpectralSmoothBrokenPlaw ( void  )
virtual

Destructor.

Definition at line 225 of file GModelSpectralSmoothBrokenPlaw.cpp.

References free_members().

Member Function Documentation

double GModelSpectralSmoothBrokenPlaw::beta ( void  ) const
inline

Returns break smoothness parameter beta.

Returns
break smoothness parameter.

Returns the break smoothness parameter 'beta'.

Definition at line 428 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_beta, and GOptimizerPar::value().

Referenced by eflux(), flux(), read(), update_eval_cache(), and write().

void GModelSpectralSmoothBrokenPlaw::beta ( const double &  beta)
inline

Set break smoothness.

Parameters
[in]betabreak smoothness parameter.

Sets the beta break smoothness parameter.

Definition at line 442 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_beta, and GOptimizerPar::value().

GEnergy GModelSpectralSmoothBrokenPlaw::breakenergy ( void  ) const
inline

Return breakenergy energy.

Returns
breakenergy energy.

Returns the breakenergy energy.

Definition at line 397 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_breakenergy, GEnergy::MeV(), and GOptimizerPar::value().

Referenced by eflux(), flux(), read(), update_eval_cache(), update_mc_cache(), and write().

void GModelSpectralSmoothBrokenPlaw::breakenergy ( const GEnergy breakenergy)
inline

Set breakenergy energy.

Parameters
[in]breakenergybreak energy.

Sets the "breakenergy" energy.

Definition at line 413 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_breakenergy, GEnergy::MeV(), and GOptimizerPar::value().

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

Return class name.

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

Implements GModelSpectral.

Definition at line 236 of file GModelSpectralSmoothBrokenPlaw.hpp.

void GModelSpectralSmoothBrokenPlaw::clear ( void  )
virtual

Clear smoothly broken power law model.

Implements GModelSpectral.

Definition at line 281 of file GModelSpectralSmoothBrokenPlaw.cpp.

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

GModelSpectralSmoothBrokenPlaw * GModelSpectralSmoothBrokenPlaw::clone ( void  ) const
virtual

Clone smoothly broken power law model.

Returns
Pointer to deep copy of smoothly broken power law model.

Implements GModelSpectral.

Definition at line 301 of file GModelSpectralSmoothBrokenPlaw.cpp.

References GModelSpectralSmoothBrokenPlaw().

double GModelSpectralSmoothBrokenPlaw::eflux ( const GEnergy emin,
const GEnergy emax 
) const
virtual

Returns model energy flux between emin, emax

Parameters
[in]eminMinimum photon energy.
[in]emaxMaximum photon energy.
Returns
Energy flux (erg/cm2/s).

Computes

\[ \int_{\tt emin}^{\tt emax} S_{\rm E}(E | t) E \, dE \]

where

  • [emin, emax] is an energy interval, and
  • \(S_{\rm E}(E | t)\) is the spectral model (ph/cm2/s/MeV). The integration is done numerically.

Implements GModelSpectral.

Definition at line 531 of file GModelSpectralSmoothBrokenPlaw.cpp.

References beta(), breakenergy(), GIntegral::eps(), index1(), index2(), GEnergy::MeV(), gammalib::MeV2erg, pivot(), prefactor(), and GIntegral::romberg().

double GModelSpectralSmoothBrokenPlaw::eval ( const GEnergy srcEng,
const GTime srcTime = GTime(),
const bool &  gradients = false 
) const
virtual

Evaluate function.

Parameters
[in]srcEngTrue photon energy.
[in]srcTimeTrue photon arrival time.
[in]gradientsCompute gradients?
Returns
Model value (ph/cm2/s/MeV).

Evaluates

\[ S_{\rm E}(E | t) = k_0 \left( \frac{E}{E_0} \right)^{\gamma_1} \left[ 1 + \left( \frac{E}{E_b} \right)^{\frac{\gamma_1 - \gamma_2}{\beta}} \right]^{-\beta} \]

where:

  • \(k_0\) is the normalization or prefactor,
  • \(\gamma_1\) is the spectral index before the break,
  • \(\gamma_2\) is the spectral index after the break,
  • \(E_0\) is the pivot energy,
  • \(E_b\) is the break energy,
  • \(\beta\) is the break smoothness.

If the gradients flag is true the method will also compute the partial derivatives of the model with respect to the parameters using

\[ \frac{\delta S_{\rm E}(E | t)}{\delta k_0} = \frac{S_{\rm E}(E | t)}{k_0} \]

\[ \frac{\delta S_{\rm E}(E | t)}{\delta \gamma_1} = S_{\rm E}(E | t) \left[ \ln\left( \frac{E}{E_0} \right) - \frac{\left(\frac{E}{E_b}\right)^{\frac{\gamma_1 - \gamma_2}{\beta}} \ln\left( \frac{E}{E_b} \right)} {\left(\frac{E}{E_b}\right)^{\frac{\gamma_1 - \gamma_2}{\beta}} + 1}\right] \]

\[ \frac{\delta S_{\rm E}(E | t)}{\delta \gamma_2} = S_{\rm E}(E | t) \frac{\left(\frac{E}{E_b}\right)^{\frac{\gamma_1 - \gamma_2}{\beta}} \ln\left( \frac{E}{E_b} \right)} {\left(\frac{E}{E_b}\right)^{\frac{\gamma_1 - \gamma_2}{\beta}} + 1} \]

\[ \frac{\delta S_{\rm E}(E | t)}{\delta E_0} = S_{\rm E}(E | t) \frac{\gamma_1}{E_0} \]

\[ \frac{\delta S_{\rm E}(E | t)}{\delta E_b} = S_{\rm E}(E | t) \frac{\left(\gamma_1 - \gamma_2 \right) \left( \frac{E}{E_b} \right)^{\frac{\gamma_1 - \gamma_2}{\beta}}} {E_b \left(1 + \left(\frac{E}{E_b}\right)^{\frac{\gamma_1 - \gamma_2}{\beta}} \right)} \]

\[ \frac{\delta S_{\rm E}(E | t)}{\delta \beta} = S_{\rm E}(E | t) \left[ \frac{ \left( \frac{E}{E_b} \right)^{\frac{\gamma_1 - \gamma_2}{\beta}} \ln \left( \left( \frac{E}{E_b}\right)^{ \frac{\gamma_1 - \gamma_2}{\beta}} \right)} {1 + \left(\frac{E}{E_b}\right)^{\frac{\gamma_1 - \gamma_2}{\beta}}} - \ln \left( 1 + \left(\frac{E}{E_b}\right)^{\frac{\gamma_1 - \gamma_2}{\beta}} \right) \right] \]

Todo:
The method expects that energy!=0. Otherwise Inf or NaN may result.

Implements GModelSpectral.

Definition at line 380 of file GModelSpectralSmoothBrokenPlaw.cpp.

References GOptimizerPar::factor_gradient(), GOptimizerPar::factor_value(), GOptimizerPar::is_free(), gammalib::is_infinite(), gammalib::is_notanumber(), log(), m_beta, m_breakenergy, m_index1, m_index2, m_last_beta, m_last_ebreak_norm, m_last_ebreak_pow, m_last_epivot_norm, m_last_epivot_pow, m_last_index1, m_last_index2, m_last_log_ebreak_norm, m_last_log_epivot_norm, m_norm, m_pivot, pow(), GOptimizerPar::scale(), update_eval_cache(), and GOptimizerPar::value().

Referenced by mc().

double GModelSpectralSmoothBrokenPlaw::flux ( const GEnergy emin,
const GEnergy emax 
) const
virtual

Returns model photon flux between emin, emax

Parameters
[in]eminMinimum photon energy.
[in]emaxMaximum photon energy.
Returns
Photon flux (ph/cm2/s).

Computes

\[ \int_{\tt emin}^{\tt emax} S_{\rm E}(E | t) dE \]

where

  • [emin, emax] is an energy interval, and
  • \(S_{\rm E}(E | t)\) is the spectral model (ph/cm2/s/MeV). The integration is done numerically.

Implements GModelSpectral.

Definition at line 484 of file GModelSpectralSmoothBrokenPlaw.cpp.

References beta(), breakenergy(), GIntegral::eps(), index1(), index2(), GEnergy::MeV(), pivot(), prefactor(), and GIntegral::romberg().

void GModelSpectralSmoothBrokenPlaw::free_members ( void  )
protected

Delete class members.

Definition at line 888 of file GModelSpectralSmoothBrokenPlaw.cpp.

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

double GModelSpectralSmoothBrokenPlaw::index1 ( void  ) const
inline

Return smoothly broken power law index1.

Returns
Power law index1.

Returns the power law index1.

Definition at line 308 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_index1, and GOptimizerPar::value().

Referenced by eflux(), flux(), read(), update_eval_cache(), update_mc_cache(), and write().

void GModelSpectralSmoothBrokenPlaw::index1 ( const double &  index1)
inline

Set smoothly broken power law index1.

Parameters
[in]index1Power law index1.

Sets the power law index1.

Definition at line 322 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_index1, and GOptimizerPar::value().

double GModelSpectralSmoothBrokenPlaw::index2 ( void  ) const
inline

Return smoothly broken power law index2.

Returns
Power law index2.

Returns the power law index2.

Definition at line 337 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_index2, and GOptimizerPar::value().

Referenced by eflux(), flux(), read(), update_eval_cache(), update_mc_cache(), and write().

void GModelSpectralSmoothBrokenPlaw::index2 ( const double &  index2)
inline

Set smoothly broken power law index2.

Parameters
[in]index2Power law index2.

Sets the power law index2.

Definition at line 351 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_index2, and GOptimizerPar::value().

GEnergy GModelSpectralSmoothBrokenPlaw::mc ( const GEnergy emin,
const GEnergy emax,
const GTime time,
GRan ran 
) const
virtual

Returns Monte Carlo energy between [emin, emax].

Parameters
[in]eminMinimum photon energy.
[in]emaxMaximum photon energy.
[in]timeTrue photon arrival time.
[in,out]ranRandom number generator.
Returns
Energy.
Exceptions
GException::erange_invalidEnergy range is invalid (emin < emax required).

Returns Monte Carlo energy by randomly drawing from a smoothly broken power law.

Implements GModelSpectral.

Definition at line 578 of file GModelSpectralSmoothBrokenPlaw.cpp.

References GModelSpectralBrokenPlaw::eval(), eval(), G_MC, m_mc_brokenplaw, GModelSpectralBrokenPlaw::mc(), GEnergy::MeV(), GRan::uniform(), and update_mc_cache().

GModelSpectralSmoothBrokenPlaw & GModelSpectralSmoothBrokenPlaw::operator= ( const GModelSpectralSmoothBrokenPlaw model)
virtual

Assignment operator.

Parameters
[in]modelSmoothly broken power law model.
Returns
Smoothly broken power law model.

Definition at line 247 of file GModelSpectralSmoothBrokenPlaw.cpp.

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

GEnergy GModelSpectralSmoothBrokenPlaw::pivot ( void  ) const
inline

Return pivot energy.

Returns
Smoothly broken power law pivot energy.

Returns the smoothly broken power law scale energy.

Definition at line 366 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_pivot, GEnergy::MeV(), and GOptimizerPar::value().

Referenced by eflux(), flux(), read(), update_eval_cache(), update_mc_cache(), and write().

void GModelSpectralSmoothBrokenPlaw::pivot ( const GEnergy pivot)
inline

Set pivot energy.

Parameters
[in]pivotSmoothly broken power law pivot energy.

Sets the smoothly broken power law pivot energy.

Definition at line 382 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_pivot, GEnergy::MeV(), and GOptimizerPar::value().

double GModelSpectralSmoothBrokenPlaw::prefactor ( void  ) const
inline

Return pre factor.

Returns
Pre factor (ph/cm2/s/MeV).

Returns the pre factor.

Definition at line 279 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_norm, and GOptimizerPar::value().

Referenced by eflux(), flux(), read(), and update_mc_cache().

void GModelSpectralSmoothBrokenPlaw::prefactor ( const double &  prefactor)
inline

Set pre factor.

Parameters
[in]prefactorPre factor (ph/cm2/s/MeV).

Sets the pre factor.

Definition at line 293 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_norm, and GOptimizerPar::value().

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

Print smooth broken powerlaw information.

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

Implements GModelSpectral.

Definition at line 697 of file GModelSpectralSmoothBrokenPlaw.cpp.

References GModelSpectral::m_pars, gammalib::parformat(), SILENT, GModelSpectral::size(), and gammalib::str().

void GModelSpectralSmoothBrokenPlaw::read ( const GXmlElement xml)
virtual

Read model from XML element.

Parameters
[in]xmlXML element.

Reads the spectral information from an XML element.

Implements GModelSpectral.

Definition at line 624 of file GModelSpectralSmoothBrokenPlaw.cpp.

References beta(), breakenergy(), G_READ, index1(), index2(), m_beta, m_breakenergy, m_index1, m_index2, m_norm, m_pivot, GOptimizerPar::name(), pivot(), prefactor(), GModelPar::read(), and gammalib::xml_get_par().

Referenced by GModelSpectralSmoothBrokenPlaw().

std::string GModelSpectralSmoothBrokenPlaw::type ( void  ) const
inlinevirtual

Return model type.

Returns
"SmoothBrokenPowerLaw".

Returns the type of the spectral smoothly broken power law model.

Implements GModelSpectral.

Definition at line 250 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_type.

Referenced by GModelSpectralSmoothBrokenPlaw(), type(), and write().

void GModelSpectralSmoothBrokenPlaw::type ( const std::string &  type)
inline

Set model type.

Parameters
[in]typeModel type.

Set the type of the spectral smoothly broken power law model.

Definition at line 264 of file GModelSpectralSmoothBrokenPlaw.hpp.

References m_type, and type().

void GModelSpectralSmoothBrokenPlaw::update_eval_cache ( const GEnergy energy) const
protected
void GModelSpectralSmoothBrokenPlaw::update_mc_cache ( void  ) const
protected

Update Monte Carlo pre computation cache.

Updates the precomputation cache for Monte Carlo simulations.

Definition at line 951 of file GModelSpectralSmoothBrokenPlaw.cpp.

References breakenergy(), index1(), index2(), m_mc_breakenergy, m_mc_brokenplaw, m_mc_index1, m_mc_index2, m_mc_pivot, m_mc_prefactor, GEnergy::MeV(), pivot(), pow(), and prefactor().

Referenced by mc().

void GModelSpectralSmoothBrokenPlaw::write ( GXmlElement xml) const
virtual

Write model into XML element.

Parameters
[in]xmlXML element.
Exceptions
GException::model_invalid_spectralExisting XML element is not of the expected type.

Writes the spectral information into an XML element.

Implements GModelSpectral.

Definition at line 657 of file GModelSpectralSmoothBrokenPlaw.cpp.

References GXmlElement::attribute(), beta(), breakenergy(), G_WRITE, index1(), index2(), m_beta, m_breakenergy, m_index1, m_index2, m_norm, m_pivot, GOptimizerPar::name(), norm(), pivot(), type(), GModelPar::write(), and gammalib::xml_need_par().

Member Data Documentation

GModelPar GModelSpectralSmoothBrokenPlaw::m_beta
protected
GModelPar GModelSpectralSmoothBrokenPlaw::m_breakenergy
protected

Energy of spectral break.

Definition at line 203 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by breakenergy(), copy_members(), eval(), GModelSpectralSmoothBrokenPlaw(), init_members(), read(), and write().

GModelPar GModelSpectralSmoothBrokenPlaw::m_index1
protected
GModelPar GModelSpectralSmoothBrokenPlaw::m_index2
protected
double GModelSpectralSmoothBrokenPlaw::m_last_beta
mutableprotected

Last beta parameter.

Definition at line 212 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_breakenergy
mutableprotected

Last breakenergy parameter.

Definition at line 211 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_ebreak_norm
mutableprotected

Last E/Ebreakenergy value.

Definition at line 214 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_ebreak_pow
mutableprotected

Last pow(E/Ebreakenergy,(index1-index2)/beta)

Definition at line 218 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), init_members(), and update_eval_cache().

GEnergy GModelSpectralSmoothBrokenPlaw::m_last_energy
mutableprotected

Last energy value.

Definition at line 207 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_epivot_norm
mutableprotected

Last E/Epivot value.

Definition at line 213 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_epivot_pow
mutableprotected

Last pow(E/Epivot,index1) value.

Definition at line 217 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_index1
mutableprotected

Last index1 parameter.

Definition at line 208 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_index2
mutableprotected

Last index2 parameter.

Definition at line 209 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_log_ebreak_norm
mutableprotected

Last ln(E/Ebreakenergy) value.

Definition at line 216 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_log_epivot_norm
mutableprotected

Last ln(E/Epivot) value.

Definition at line 215 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_last_pivot
mutableprotected

Last pivot parameter.

Definition at line 210 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), init_members(), and update_eval_cache().

double GModelSpectralSmoothBrokenPlaw::m_mc_breakenergy
mutableprotected

Last break energy.

Definition at line 225 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), init_members(), and update_mc_cache().

GModelSpectralBrokenPlaw GModelSpectralSmoothBrokenPlaw::m_mc_brokenplaw
mutableprotected

Broken power plaw.

Definition at line 226 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), init_members(), mc(), and update_mc_cache().

double GModelSpectralSmoothBrokenPlaw::m_mc_index1
mutableprotected

Last first index.

Definition at line 222 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), init_members(), and update_mc_cache().

double GModelSpectralSmoothBrokenPlaw::m_mc_index2
mutableprotected

Last second index.

Definition at line 223 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), init_members(), and update_mc_cache().

double GModelSpectralSmoothBrokenPlaw::m_mc_pivot
mutableprotected

Last pivot energy.

Definition at line 224 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), init_members(), and update_mc_cache().

double GModelSpectralSmoothBrokenPlaw::m_mc_prefactor
mutableprotected

Last pre factor.

Definition at line 221 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), init_members(), and update_mc_cache().

GModelPar GModelSpectralSmoothBrokenPlaw::m_norm
protected

Normalization factor.

Definition at line 199 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), eval(), GModelSpectralSmoothBrokenPlaw(), init_members(), prefactor(), read(), and write().

GModelPar GModelSpectralSmoothBrokenPlaw::m_pivot
protected
std::string GModelSpectralSmoothBrokenPlaw::m_type
protected

Model type.

Definition at line 198 of file GModelSpectralSmoothBrokenPlaw.hpp.

Referenced by copy_members(), GModelSpectralSmoothBrokenPlaw(), init_members(), and type().


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