48#define G_MC "GModelSpectralExponential::mc(GEnergy&, GEnergy&, GTime&, "\
50#define G_WRITE "GModelSpectralExponential::write(GXmlElement&)"
163 if (
this != &model) {
246 const GTime& srcTime,
247 const bool& gradients)
const
259 value = std::exp(value);
280 #if defined(G_NAN_CHECK)
282 std::cout <<
"*** ERROR: GModelSpectralExponential::eval";
283 std::cout <<
"(srcEng=" << srcEng;
284 std::cout <<
", srcTime=" << srcTime <<
"):";
285 std::cout <<
" NaN/Inf encountered";
286 std::cout <<
" (value=" << value;
287 std::cout <<
")" << std::endl;
321 integral.
eps(1.0e-8);
359 integral.
eps(1.0e-8);
394 std::string msg =
"Exponent model is undefined.";
511 for (
int ipar = 0; ipar < npars; ++ipar) {
552 result.append(
"=== GModelSpectralExponential ===");
559 for (
int i = 0; i <
size(); ++i) {
662 if (par_changed ==
false) {
663 for (
int i = 0; i <
size(); ++i) {
682 for (
int i = 0; i <
size(); ++i) {
701 for (
int i = 0; i < energies.
size(); ++i) {
Energy container class definition.
Exception handler interface definition.
Integration class interface definition.
const GModelSpectralExponential g_spectral_expo_seed
Exponential spectral model class interface definition.
Spectral nodes model class definition.
Spectral model registry class definition.
Random number generator class definition.
int size(void) const
Return number of energies in container.
Class that handles energies in a unit independent way.
double MeV(void) const
Return energy in MeV.
double log10MeV(void) const
Return log10 of energy in MeV.
void clear(void)
Clear instance.
GIntegral class interface definition.
void eps(const double &eps)
Set relative precision.
double romberg(std::vector< double > bounds, const int &order=5)
Perform Romberg integration.
Exponential spectral model class.
void copy_members(const GModelSpectralExponential &model)
Copy class members.
void init_members(void)
Initialise class members.
void free_members(void)
Delete class members.
std::vector< double > m_mc_values
Parameter values.
const GModelSpectral * exponent(void) const
Return exponent.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual GEnergy mc(const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const
Returns Monte Carlo energy between [emin, emax].
GModelSpectralNodes m_mc_spectrum
MC spectrum cache.
virtual double eval(const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const
Evaluate function.
GEnergy m_mc_emax
Last maximum energy.
void update_mc_cache(const GEnergy &emin, const GEnergy &emax) const
Update Monte Carlo pre computation cache.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Exponential spectral model information.
GModelSpectralExponential(void)
Void constructor.
GEnergy m_mc_emin
Last minimum energy.
virtual double eflux(const GEnergy &emin, const GEnergy &emax) const
Returns model energy flux between [emin, emax] (units: erg/cm2/s)
virtual ~GModelSpectralExponential(void)
Destructor.
GModelSpectral * m_exponent
Exponent model component.
virtual std::string type(void) const
Return model type.
virtual double flux(const GEnergy &emin, const GEnergy &emax) const
Returns model photon flux between [emin, emax] (units: ph/cm2/s)
virtual GModelSpectralExponential * clone(void) const
Clone Exponential spectral model model.
std::string m_type
Model type.
virtual GModelSpectralExponential & operator=(const GModelSpectralExponential &model)
Assignment operator.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual void clear(void)
Clear Exponential spectral model.
virtual GEnergy mc(const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const
Returns MC energy between [emin, emax].
virtual void clear(void)
Clear spectral nodes model.
void append(const GEnergy &energy, const double &intensity)
Append node.
Interface definition for the spectral model registry class.
GModelSpectral * alloc(const GXmlElement &xml) const
Allocate spectral model that is found in XML element.
Abstract spectral model base class.
virtual double eval(const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const =0
void free_members(void)
Delete class members.
virtual GModelSpectral & operator=(const GModelSpectral &model)
Assignment operator.
std::vector< GModelPar * > m_pars
Parameter pointers.
virtual GModelSpectral * clone(void) const =0
Clones object.
virtual void write(GXmlElement &xml) const =0
int size(void) const
Return number of parameters.
void init_members(void)
Initialise class members.
double gradient(void) const
Return parameter gradient.
Random number generator class.
virtual GXmlNode * append(const GXmlNode &node)
Append XML child node.
virtual GXmlElement * element(const int &index)
Return pointer to GXMLElement child.
virtual int elements(void) const
Return number of GXMLElement children of node.
void check_energy_interval(const std::string &origin, const GEnergy &emin, const GEnergy &emax)
Checks energy interval.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
bool is_infinite(const double &x)
Signal if argument is infinite.
bool is_notanumber(const double &x)
Signal if argument is not a number.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
void xml_check_type(const std::string &origin, GXmlElement &xml, const std::string &type)
Checks the model type.