GammaLib
2.0.0
|
Multiplicative spatial model class. More...
#include <GCTAModelSpatialMultiplicative.hpp>
Public Member Functions | |
GCTAModelSpatialMultiplicative (void) | |
Void constructor. More... | |
GCTAModelSpatialMultiplicative (const GXmlElement &xml) | |
XML constructor. More... | |
GCTAModelSpatialMultiplicative (const GCTAModelSpatialMultiplicative &model) | |
Copy constructor. More... | |
virtual | ~GCTAModelSpatialMultiplicative (void) |
Destructor. More... | |
virtual GCTAModelSpatialMultiplicative & | operator= (const GCTAModelSpatialMultiplicative &model) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear instance. More... | |
virtual GCTAModelSpatialMultiplicative * | clone (void) const |
Clone instance. 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 GCTAInstDir &dir, const GEnergy &energy, const GTime &time, const bool &gradients=false) const |
Evaluate function (in units of sr^-1) More... | |
virtual double | mc_max_value (const GCTAObservation &obs) const |
Return maximum function value for Monte Carlo simulations. 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 multiplicative spatial model information. More... | |
void | append (const GCTAModelSpatial &spatial, const std::string &name="") |
Append spatial component. More... | |
int | components (void) const |
Return number of spatial components. More... | |
const GCTAModelSpatial * | component (const int &index) const |
Return spatial model component by index. More... | |
const GCTAModelSpatial * | component (const std::string &name) const |
Return spatial model component by name. More... | |
Public Member Functions inherited from GCTAModelSpatial | |
GCTAModelSpatial (void) | |
Void constructor. More... | |
GCTAModelSpatial (const GCTAModelSpatial &model) | |
Copy constructor. More... | |
virtual | ~GCTAModelSpatial (void) |
Destructor. More... | |
virtual GCTAModelSpatial & | operator= (const GCTAModelSpatial &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... | |
virtual GCTAInstDir | mc (const GEnergy &energy, const GTime &time, const GCTAObservation &obs, GRan &ran) const |
Returns MC instrument direction. More... | |
int | size (void) const |
Return number of model parameters. More... | |
virtual double | npred (const GEnergy &energy, const GTime &time, const GObservation &obs) const |
Return integral of spatial model component. 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 GCTAModelSpatialMultiplicative &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Member Functions inherited from GCTAModelSpatial | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GCTAModelSpatial &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Attributes | |
std::string | m_type |
Model type. More... | |
std::vector< GCTAModelSpatial * > | m_spatial |
Container of spatial models. More... | |
std::vector< std::string > | m_components |
Names of components. More... | |
Protected Attributes inherited from GCTAModelSpatial | |
std::vector< GModelPar * > | m_pars |
Parameter pointers. More... | |
Multiplicative spatial model class.
This class implements a multiplicative spatial component of the CTA background model.
Definition at line 53 of file GCTAModelSpatialMultiplicative.hpp.
GCTAModelSpatialMultiplicative::GCTAModelSpatialMultiplicative | ( | void | ) |
Void constructor.
Definition at line 76 of file GCTAModelSpatialMultiplicative.cpp.
References init_members().
Referenced by clone().
|
explicit |
XML constructor.
[in] | xml | XML element. |
Creates instance of a multiplicative spatial model by extracting information from an XML element. See GCTAModelSpatialMultiplicative::read() for more information about the expected structure of the XML element.
Definition at line 97 of file GCTAModelSpatialMultiplicative.cpp.
References init_members(), and read().
GCTAModelSpatialMultiplicative::GCTAModelSpatialMultiplicative | ( | const GCTAModelSpatialMultiplicative & | model | ) |
Copy constructor.
[in] | model | Spatial model. |
Definition at line 116 of file GCTAModelSpatialMultiplicative.cpp.
References copy_members(), and init_members().
|
virtual |
Destructor.
Definition at line 133 of file GCTAModelSpatialMultiplicative.cpp.
References free_members().
void GCTAModelSpatialMultiplicative::append | ( | const GCTAModelSpatial & | spatial, |
const std::string & | name = "" |
||
) |
Append spatial component.
[in] | spatial | Spatial model component. |
[in] | name | Name of spatial component (can be empty). |
GException::invalid_value | Invalid component name specified |
Appends a spatial component to the multiplicative model
Definition at line 439 of file GCTAModelSpatialMultiplicative.cpp.
References GCTAModelSpatial::clone(), gammalib::contains(), G_APPEND, m_components, GCTAModelSpatial::m_pars, m_spatial, GOptimizerPar::name(), and gammalib::str().
Referenced by read().
|
inlinevirtual |
Return class name.
Implements GCTAModelSpatial.
Definition at line 105 of file GCTAModelSpatialMultiplicative.hpp.
|
virtual |
Clear instance.
Implements GCTAModelSpatial.
Definition at line 187 of file GCTAModelSpatialMultiplicative.cpp.
References free_members(), GCTAModelSpatial::free_members(), init_members(), and GCTAModelSpatial::init_members().
|
virtual |
Clone instance.
Implements GCTAModelSpatial.
Definition at line 205 of file GCTAModelSpatialMultiplicative.cpp.
References GCTAModelSpatialMultiplicative().
const GCTAModelSpatial * GCTAModelSpatialMultiplicative::component | ( | const int & | index | ) | const |
Return spatial model component by index.
[in] | index | Index of spectral component. |
GException::out_of_range | Model index out of valid range |
Returns a component of the multiplicative spatial model by index
.
Definition at line 499 of file GCTAModelSpatialMultiplicative.cpp.
References G_COMPONENT_INDEX, and m_spatial.
const GCTAModelSpatial * GCTAModelSpatialMultiplicative::component | ( | const std::string & | name | ) | const |
Return spatial model component by name.
[in] | name | Name of spatial component. |
GException::invalid_argument | Spatial component not found |
Returns a component of the multiplicative spatial model by name
.
Definition at line 523 of file GCTAModelSpatialMultiplicative.cpp.
References G_COMPONENT_NAME, m_components, and m_spatial.
|
inline |
Return number of spatial components.
Returns the number of spatial components.
Definition at line 133 of file GCTAModelSpatialMultiplicative.hpp.
References m_spatial.
Referenced by copy_members(), and print().
|
protected |
Copy class members.
[in] | model | Spatial background model component. |
Definition at line 609 of file GCTAModelSpatialMultiplicative.cpp.
References components(), m_components, GCTAModelSpatial::m_pars, m_spatial, m_type, and GCTAModelSpatial::size().
Referenced by GCTAModelSpatialMultiplicative(), and operator=().
|
virtual |
Evaluate function (in units of sr^-1)
[in] | dir | Event direction. |
[in] | energy | Event energy. |
[in] | time | Event time. |
[in] | gradients | Compute gradients? |
Evaluate spatial model for a given event direction.
Implements GCTAModelSpatial.
Definition at line 222 of file GCTAModelSpatialMultiplicative.cpp.
References GOptimizerPar::gradient(), gammalib::is_infinite(), gammalib::is_notanumber(), m_spatial, and GCTAInstDir::print().
|
protected |
Delete class members.
Definition at line 647 of file GCTAModelSpatialMultiplicative.cpp.
References m_spatial.
Referenced by clear(), operator=(), and ~GCTAModelSpatialMultiplicative().
|
protected |
Initialise class members.
Definition at line 590 of file GCTAModelSpatialMultiplicative.cpp.
References m_components, m_spatial, and m_type.
Referenced by clear(), GCTAModelSpatialMultiplicative(), and operator=().
|
virtual |
Return maximum function value for Monte Carlo simulations.
[in] | obs | CTA Observation. |
Implements GCTAModelSpatial.
Definition at line 304 of file GCTAModelSpatialMultiplicative.cpp.
References m_spatial.
|
virtual |
Assignment operator.
[in] | model | Spatial model. |
Definition at line 154 of file GCTAModelSpatialMultiplicative.cpp.
References copy_members(), free_members(), init_members(), and GCTAModelSpatial::operator=().
|
virtual |
Print multiplicative spatial model information.
[in] | chatter | Chattiness. |
Implements GCTAModelSpatial.
Definition at line 552 of file GCTAModelSpatialMultiplicative.cpp.
References components(), GCTAModelSpatial::m_pars, gammalib::parformat(), SILENT, GCTAModelSpatial::size(), and gammalib::str().
|
virtual |
Read model from XML element.
[in] | xml | XML element. |
Reads the spatial information from an XML element.
Implements GCTAModelSpatial.
Definition at line 326 of file GCTAModelSpatialMultiplicative.cpp.
References GCTAModelSpatialRegistry::alloc(), append(), GXmlElement::attribute(), GXmlNode::element(), and GXmlNode::elements().
Referenced by GCTAModelSpatialMultiplicative().
|
inlinevirtual |
Return model type.
Returns the type of the spatial multiplicative model.
Implements GCTAModelSpatial.
Definition at line 119 of file GCTAModelSpatialMultiplicative.hpp.
References m_type.
Referenced by write().
|
virtual |
Write model into XML element.
[in] | xml | XML element. |
Writes the spatial information into an XML element.
Implements GCTAModelSpatial.
Definition at line 366 of file GCTAModelSpatialMultiplicative.cpp.
References GXmlNode::append(), GXmlElement::attribute(), gammalib::contains(), GXmlNode::element(), GXmlNode::elements(), G_WRITE, m_components, m_spatial, GOptimizerPar::name(), GCTAModelSpatial::size(), gammalib::split(), gammalib::str(), type(), GCTAModelSpatial::write(), and gammalib::xml_check_type().
|
protected |
Names of components.
Definition at line 95 of file GCTAModelSpatialMultiplicative.hpp.
Referenced by append(), component(), copy_members(), init_members(), and write().
|
protected |
Container of spatial models.
Definition at line 94 of file GCTAModelSpatialMultiplicative.hpp.
Referenced by append(), component(), components(), copy_members(), eval(), free_members(), init_members(), mc_max_value(), and write().
|
protected |
Model type.
Definition at line 93 of file GCTAModelSpatialMultiplicative.hpp.
Referenced by copy_members(), init_members(), and type().