GammaLib
2.1.0.dev
|
Constant temporal model class. More...
#include <GModelTemporalConst.hpp>
Public Member Functions | |
GModelTemporalConst (void) | |
Void constructor. More... | |
GModelTemporalConst (const GXmlElement &xml) | |
XML constructor. More... | |
GModelTemporalConst (const double &norm) | |
Value constructor. More... | |
GModelTemporalConst (const GModelTemporalConst &model) | |
Copy constructor. More... | |
virtual | ~GModelTemporalConst (void) |
Destructor. More... | |
virtual GModelTemporalConst & | operator= (const GModelTemporalConst &model) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear constant temporal model. More... | |
virtual GModelTemporalConst * | clone (void) const |
Clone constant temporal 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 GTime &srcTime, const bool &gradients=false) const |
Evaluate function. More... | |
virtual GTimes | mc (const double &rate, const GTime &tmin, const GTime &tmax, GRan &ran) const |
Returns vector of random event times. 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 constant information. More... | |
double | norm (void) const |
Return normalization factor. More... | |
void | norm (const double &norm) |
Set normalization factor. More... | |
Public Member Functions inherited from GModelTemporal | |
GModelTemporal (void) | |
Void constructor. More... | |
GModelTemporal (const GModelTemporal &model) | |
Copy constructor. More... | |
virtual | ~GModelTemporal (void) |
Destructor. More... | |
virtual GModelTemporal & | operator= (const GModelTemporal &model) |
Assignment operator. More... | |
virtual GModelPar & | operator[] (const int &index) |
Returns model parameter. More... | |
virtual const GModelPar & | operator[] (const int &index) const |
Returns model parameter (const version) More... | |
virtual GModelPar & | operator[] (const std::string &name) |
Returns reference to model parameter. More... | |
virtual const GModelPar & | operator[] (const std::string &name) const |
Returns reference to model parameter (const version) More... | |
GModelPar & | at (const int &index) |
Returns model parameter. More... | |
const GModelPar & | at (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 GModelTemporalConst &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Member Functions inherited from GModelTemporal | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GModelTemporal &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Attributes | |
GModelPar | m_norm |
Constant. More... | |
Protected Attributes inherited from GModelTemporal | |
std::vector< GModelPar * > | m_pars |
Parameter pointers. More... | |
Constant temporal model class.
This class implements a constant light curve. The model is defined by
\[ S_{\rm t}(t) = {\tt m\_norm} \]
where \({\tt m\_norm}\) is the normalization constant which by default is set to unity. The parameter \({\tt m\_norm}\) is not supposed to be fitted.
Definition at line 55 of file GModelTemporalConst.hpp.
GModelTemporalConst::GModelTemporalConst | ( | void | ) |
Void constructor.
Definition at line 62 of file GModelTemporalConst.cpp.
References init_members().
Referenced by clone().
|
explicit |
XML constructor.
[in] | xml | XML element. |
Constructs constant temporal 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 81 of file GModelTemporalConst.cpp.
References init_members(), and read().
|
explicit |
Value constructor.
[in] | norm | Normalization factor. |
Constructs constant temporal model by setting the normalization factor.
Definition at line 104 of file GModelTemporalConst.cpp.
References init_members(), m_norm, and GOptimizerPar::value().
GModelTemporalConst::GModelTemporalConst | ( | const GModelTemporalConst & | model | ) |
Copy constructor.
[in] | model | Constant temporal model |
Definition at line 125 of file GModelTemporalConst.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GModelTemporal.
Definition at line 102 of file GModelTemporalConst.hpp.
|
virtual |
Clear constant temporal model.
Implements GModelTemporal.
Definition at line 197 of file GModelTemporalConst.cpp.
References free_members(), GModelTemporal::free_members(), init_members(), and GModelTemporal::init_members().
|
virtual |
Clone constant temporal model.
Implements GModelTemporal.
Definition at line 217 of file GModelTemporalConst.cpp.
References GModelTemporalConst().
Referenced by GCTAModelAeffBackground::GCTAModelAeffBackground(), GCTAModelBackground::GCTAModelBackground(), GCTAModelCubeBackground::GCTAModelCubeBackground(), GCTAModelIrfBackground::GCTAModelIrfBackground(), GCTAModelRadialAcceptance::GCTAModelRadialAcceptance(), GCTAModelSkyCube::GCTAModelSkyCube(), GModelSky::GModelSky(), GCTAModelIrfBackground::read(), GCTAModelAeffBackground::read(), GCTAModelCubeBackground::read(), GCTAModelRadialAcceptance::read(), GCTAModelBackground::read(), GCTAModelSkyCube::read(), and GModelSky::read().
|
protected |
Copy class members.
[in] | model | Constant temporal model |
Definition at line 432 of file GModelTemporalConst.cpp.
References m_norm, and GModelTemporal::m_pars.
Referenced by GModelTemporalConst(), and operator=().
|
virtual |
Evaluate function.
[in] | srcTime | True photon arrival time (not used). |
[in] | gradients | Compute gradients? |
Computes
\[ S_{\rm t}(t) = {\tt m\_norm} \]
where \({\tt m\_norm}\) is the normalization constant.
If the gradients
flag is true the method will also evaluate the partial derivatives of the model with respect to the normalization parameter using
\[ \frac{\delta S_{\rm t}(t)}{\delta {\tt m\_norm}} = 1 \]
Implements GModelTemporal.
Definition at line 247 of file GModelTemporalConst.cpp.
References GOptimizerPar::factor_gradient(), GOptimizerPar::is_free(), m_norm, GOptimizerPar::scale(), and GOptimizerPar::value().
|
protected |
Delete class members.
Definition at line 449 of file GModelTemporalConst.cpp.
Referenced by clear(), operator=(), and ~GModelTemporalConst().
|
protected |
Initialise class members.
Definition at line 407 of file GModelTemporalConst.cpp.
References GOptimizerPar::clear(), GOptimizerPar::fix(), GOptimizerPar::gradient(), GOptimizerPar::has_grad(), m_norm, GModelTemporal::m_pars, GOptimizerPar::name(), GOptimizerPar::unit(), and GOptimizerPar::value().
Referenced by clear(), GModelTemporalConst(), and operator=().
|
virtual |
Returns vector of random event times.
[in] | rate | Mean event rate (events per second). |
[in] | tmin | Minimum event time. |
[in] | tmax | Maximum event time. |
[in,out] | ran | Random number generator. |
This method returns a vector of random event times assuming a constant event rate that is specified by the rate parameter.
Implements GModelTemporal.
Definition at line 280 of file GModelTemporalConst.cpp.
References GTimes::append(), GRan::exp(), norm(), and GTime::secs().
|
inline |
Return normalization factor.
Returns the normalization factor.
Definition at line 130 of file GModelTemporalConst.hpp.
References m_norm, and GOptimizerPar::value().
Referenced by mc(), read(), write(), GCTAModelBackground::write(), and GModelSky::write().
|
inline |
Set normalization factor.
[in] | norm | Normalization factor. |
Sets the normalization factor.
Definition at line 144 of file GModelTemporalConst.hpp.
References m_norm, and GOptimizerPar::value().
|
virtual |
Assignment operator.
[in] | model | Constant temporal model. |
Definition at line 164 of file GModelTemporalConst.cpp.
References copy_members(), free_members(), init_members(), and GModelTemporal::operator=().
Print constant information.
[in] | chatter | Chattiness. |
Implements GModelTemporal.
Definition at line 373 of file GModelTemporalConst.cpp.
References GModelTemporal::m_pars, gammalib::parformat(), SILENT, GModelTemporal::size(), and gammalib::str().
|
virtual |
Read model from XML element.
[in] | xml | XML element. |
Writes the temporal information from an XML element having the format
<temporal type="Constant"> <parameter name="Normalization" scale="1" value="1" min="0.1" max="10" free="1"/> </temporal>
Implements GModelTemporal.
Definition at line 324 of file GModelTemporalConst.cpp.
References G_READ, m_norm, GOptimizerPar::name(), norm(), GModelPar::read(), gammalib::xml_check_parnum(), and gammalib::xml_get_par().
Referenced by GModelTemporalConst().
|
inlinevirtual |
Return model type.
Returns the type of the constant temporal model.
Implements GModelTemporal.
Definition at line 116 of file GModelTemporalConst.hpp.
Referenced by write().
|
virtual |
Write model into XML element.
[in] | xml | XML element. |
Writes the temporal information into an XML element in the format
<temporal type="Constant"> <parameter name="Normalization" scale="1" value="1" min="0.1" max="10" free="1"/> </temporal>
Implements GModelTemporal.
Definition at line 351 of file GModelTemporalConst.cpp.
References G_WRITE, m_norm, GOptimizerPar::name(), norm(), type(), GModelPar::write(), gammalib::xml_check_type(), and gammalib::xml_need_par().
|
protected |
Constant.
Definition at line 92 of file GModelTemporalConst.hpp.
Referenced by copy_members(), eval(), GModelTemporalConst(), init_members(), norm(), read(), and write().