42 #if defined(G_LEGACY_XML_FORMAT)
48 #define G_FLUX "GModelSpectralConst::flux(GEnergy&, GEnergy&)"
49 #define G_EFLUX "GModelSpectralConst::eflux(GEnergy&, GEnergy&)"
50 #define G_MC "GModelSpectralConst::mc(GEnergy&, GEnergy&, GTime&, GRan&)"
51 #define G_READ "GModelSpectralConst::read(GXmlElement&)"
52 #define G_WRITE "GModelSpectralConst::write(GXmlElement&)"
87 const std::string& value) :
195 if (
this != &model) {
278 const GTime& srcTime,
279 const bool& gradients)
const
473 result.append(
"=== GModelSpectralConst ===");
478 for (
int i = 0; i <
size(); ++i) {
virtual void read(const GXmlElement &xml)
Read model from XML element.
void init_members(void)
Initialise class members.
const double & factor_gradient(void) const
Return parameter factor gradient.
double norm(const GVector &vector)
Computes vector norm.
virtual GModelSpectralConst & operator=(const GModelSpectralConst &model)
Assignment operator.
const std::string & name(void) const
Return parameter name.
Random number generator class definition.
Abstract spectral model base class.
virtual GModelSpectralConst * clone(void) const
Clone constant spectral model.
double gradient(void) const
Return parameter gradient.
virtual double eval(const GEnergy &srcEng, const GTime &srcTime=GTime(), const bool &gradients=false) const
Evaluate model value.
int size(void) const
Return number of parameters.
virtual GModelSpectral & operator=(const GModelSpectral &model)
Assignment operator.
void write(GXmlElement &xml) const
Set or update parameter attributes in XML element.
std::vector< GModelPar * > m_pars
Parameter pointers.
virtual double eflux(const GEnergy &emin, const GEnergy &emax) const
Returns model energy flux between emin, emax
std::string m_type
Model type.
double value(void) const
Return model value.
Spectral model registry class definition.
const GModelSpectralConst g_spectral_const_seed1("Constant","Normalization")
Random number generator class.
double MeV(void) const
Return energy in MeV.
void copy_members(const GModelSpectralConst &model)
Copy class members.
bool is_free(void) const
Signal if parameter is free.
const double & scale(void) const
Return parameter scale.
GModelSpectralConst(void)
Void constructor.
virtual void clear(void)
Clear constant spectral model.
bool has_grad(void) const
Signal if parameter gradient is computed analytically.
void free(void)
Free a parameter.
GXmlElement * xml_need_par(const std::string &origin, GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
Constant spectral model class interface definition.
double uniform(void)
Returns random double precision floating value in range 0 to 1.
void check_energy_interval(const std::string &origin, const GEnergy &emin, const GEnergy &emax)
Checks energy interval.
void clear(void)
Clear parameter.
virtual double flux(const GEnergy &emin, const GEnergy &emax) const
Returns model photon flux between emin, emax
virtual std::string print(const GChatter &chatter=NORMAL) const
Print spectral model information.
void xml_check_parnum(const std::string &origin, const GXmlElement &xml, const int &number)
Checks number of parameters.
Interface definition for the spectral model registry class.
virtual std::string type(void) const
Return model type.
void init_members(void)
Initialise class members.
void range(const double &min, const double &max)
Set minimum and maximum parameter boundaries.
void read(const GXmlElement &xml)
Extract parameter attributes from XML element.
double value(void) const
Return parameter value.
Exception handler interface definition.
virtual ~GModelSpectralConst(void)
Destructor.
GModelPar m_norm
Normalization factor.
virtual void write(GXmlElement &xml) const
Write model into XML element.
std::string parformat(const std::string &s, const int &indent=0)
Convert string in parameter format.
const GXmlElement * xml_get_par(const std::string &origin, const GXmlElement &xml, const std::string &name)
Return pointer to parameter with given name in XML element.
void free_members(void)
Delete class members.
Constant spectral model class.
void free_members(void)
Delete class members.
virtual GEnergy mc(const GEnergy &emin, const GEnergy &emax, const GTime &time, GRan &ran) const
Returns MC energy between [emin, emax].
Class that handles energies in a unit independent way.
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.