27#ifndef GMODELSPECTRALBINS_HPP
28#define GMODELSPECTRALBINS_HPP
61 const double&
index = -2.0);
70 virtual void clear(
void);
72 virtual std::string
classname(
void)
const;
73 virtual std::string
type(
void)
const;
76 const bool& gradients =
false)
const;
101 double index(
void)
const;
148 return (
"GModelSpectralBins");
162 return "BinFunction";
Energy value class definition.
Model parameter class interface definition.
Abstract spectral model base class interface definition.
Energy boundaries container class.
Class that handles energies in a unit independent way.
Spectral bins model class.
std::vector< GModelPar > m_emax
Upper energy limits.
GEnergy emax(const int &index) const
Return upper energy limit of bin.
void reserve(const int &num)
Reserve space for bins.
int bin_index(const GEnergy &energy) const
Return bin index for energy.
virtual GModelSpectralBins & operator=(const GModelSpectralBins &model)
Assignment operator.
virtual GModelSpectralBins * clone(void) const
Clone spectral bins model.
GModelPar m_index
Spectral index of all bins.
void free_members(void)
Delete class members.
void mc_update(const GEnergy &emin, const GEnergy &emax) const
Set MC pre-computation cache.
std::vector< double > m_mc_cum
Cumulative distribution.
void copy_members(const GModelSpectralBins &model)
Copy class members.
void insert(const int &index, const GEnergy &emin, const GEnergy &emax, const double &intensity)
Insert bin.
std::vector< double > m_mc_exp
Exponent for MC.
GEnergy emin(const int &index) const
Return lower energy limit of bin.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual double eflux(const GEnergy &emin, const GEnergy &emax) const
Returns model energy flux between [emin, emax] (units: erg/cm2/s)
void update_pars(void)
Update parameter mapping.
std::vector< double > m_mc_min
Lower boundary for MC.
GEnergy m_mc_emax
Maximum energy.
std::vector< double > m_mc_max
Upper boundary for MC.
void append(const GEnergy &emin, const GEnergy &emax, const double &intensity)
Append bin.
virtual ~GModelSpectralBins(void)
Destructor.
virtual double eval(const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const
Evaluate function.
virtual void write(GXmlElement &xml) const
Write model into XML element.
void init_members(void)
Initialise class members.
void set_cache(void) const
Set cache.
double index(void) const
Return spectral power law index.
std::vector< GModelPar > m_values
Bin values.
GEnergy m_mc_emin
Minimum energy.
virtual GEnergy mc(const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const
Returns MC energy between [emin, emax].
virtual std::string classname(void) const
Return class name.
int bins(void) const
Return number of bins.
std::vector< GModelPar > m_emin
Lower energy limits.
double error(const int &index) const
Return intensity error of bin.
double intensity(const int &index) const
Return bin intensity.
void extend(const GModelSpectralBins &bins)
Append bins from bin function.
virtual void clear(void)
Clear spectral bins model.
virtual double flux(const GEnergy &emin, const GEnergy &emax) const
Returns model photon flux between [emin, emax] (units: ph/cm2/s)
void remove(const int &index)
Remove bin.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print bin function information.
virtual std::string type(void) const
Return model type.
std::vector< double > m_epivot
Power-law pivot energies in MeV.
GModelSpectralBins(void)
Void constructor.
Abstract spectral model base class.
Random number generator class.