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
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) {
virtual void write(GXmlElement &xml) const =0
virtual void write(GXmlElement &xml) const
Write model into XML element.
void free_members(void)
Delete class members.
void update_mc_cache(const GEnergy &emin, const GEnergy &emax) const
Update Monte Carlo pre computation cache.
virtual GEnergy mc(const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const
Returns MC energy between [emin, emax].
double romberg(std::vector< double > bounds, const int &order=5)
Perform Romberg integration.
Random number generator class definition.
Abstract spectral model base class.
GModelSpectral * m_exponent
Exponent model component.
void init_members(void)
Initialise class members.
double gradient(void) const
Return parameter gradient.
int size(void) const
Return number of parameters.
virtual GModelSpectral & operator=(const GModelSpectral &model)
Assignment operator.
virtual std::string type(void) const
Return model type.
GEnergy m_mc_emin
Last minimum energy.
virtual double eval(const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const =0
virtual GModelSpectralExponential * clone(void) const
Clone Exponential spectral model model.
virtual void read(const GXmlElement &xml)
Read model from XML element.
std::vector< GModelPar * > m_pars
Parameter pointers.
Spectral model registry class definition.
Exponential spectral model class interface definition.
Random number generator class.
Spectral nodes model class definition.
double MeV(void) const
Return energy in MeV.
virtual int elements(void) const
Return number of GXMLElement children of node.
GIntegral class interface definition.
const GModelSpectralExponential g_spectral_expo_seed
virtual void clear(void)
Clear Exponential spectral model.
double log10MeV(void) const
Return log10 of energy in MeV.
virtual double eval(const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const
Evaluate function.
bool is_notanumber(const double &x)
Signal if argument is not a number.
bool is_infinite(const double &x)
Signal if argument is infinite.
void append(const GEnergy &energy, const double &intensity)
Append node.
Energy container class definition.
int size(void) const
Return number of energies in container.
virtual GModelSpectralExponential & operator=(const GModelSpectralExponential &model)
Assignment operator.
void check_energy_interval(const std::string &origin, const GEnergy &emin, const GEnergy &emax)
Checks energy interval.
virtual double flux(const GEnergy &emin, const GEnergy &emax) const
Returns model photon flux between emin, emax
GModelSpectral * alloc(const GXmlElement &xml) const
Allocate spectral model that is found in XML element.
GModelSpectralNodes m_mc_spectrum
MC spectrum cache.
const GModelSpectral * exponent(void) const
Return exponent.
Exponential spectral model class.
Interface definition for the spectral model registry class.
virtual GModelSpectral * clone(void) const =0
Clones object.
void eps(const double &eps)
Set relative precision.
virtual GXmlElement * element(const int &index)
Return pointer to GXMLElement child.
virtual void clear(void)
Clear spectral nodes model.
void init_members(void)
Initialise class members.
virtual ~GModelSpectralExponential(void)
Destructor.
Exception handler interface definition.
std::string m_type
Model type.
GVector exp(const GVector &vector)
Computes exponential of vector elements.
GEnergy m_mc_emax
Last maximum energy.
virtual double eflux(const GEnergy &emin, const GEnergy &emax) const
Returns model energy flux between emin, emax
virtual GXmlNode * append(const GXmlNode &node)
Append XML child node.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
virtual GEnergy mc(const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const
Returns Monte Carlo energy between [emin, emax].
Integration class interface definition.
GModelSpectralExponential(void)
Void constructor.
void copy_members(const GModelSpectralExponential &model)
Copy class members.
void free_members(void)
Delete class members.
void clear(void)
Clear instance.
std::vector< double > m_mc_values
Parameter values.
Class that handles energies in a unit independent way.
std::string str(const unsigned short int &value)
Convert unsigned short integer value into string.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print Exponential spectral model information.
void xml_check_type(const std::string &origin, GXmlElement &xml, const std::string &type)
Checks the model type.