GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAModelSpatialMultiplicative Class Reference

Multiplicative spatial model class. More...

#include <GCTAModelSpatialMultiplicative.hpp>

Inheritance diagram for GCTAModelSpatialMultiplicative:
GCTAModelSpatial GBase

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 GCTAModelSpatialcomponent (const int &index) const
 Return spatial model component by index. More...
 
const GCTAModelSpatialcomponent (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 GCTAModelSpatialoperator= (const GCTAModelSpatial &model)
 Assignment operator. More...
 
virtual GModelParoperator[] (const int &index)
 Returns model parameter. More...
 
virtual const GModelParoperator[] (const int &index) const
 Returns model parameter (const version) More...
 
virtual GModelParoperator[] (const std::string &name)
 Returns reference to model parameter. More...
 
virtual const GModelParoperator[] (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...
 

Detailed Description

Multiplicative spatial model class.

This class implements a multiplicative spatial component of the CTA background model.

Definition at line 53 of file GCTAModelSpatialMultiplicative.hpp.

Constructor & Destructor Documentation

GCTAModelSpatialMultiplicative::GCTAModelSpatialMultiplicative ( void  )

Void constructor.

Definition at line 76 of file GCTAModelSpatialMultiplicative.cpp.

References init_members().

Referenced by clone().

GCTAModelSpatialMultiplicative::GCTAModelSpatialMultiplicative ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML 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.

Parameters
[in]modelSpatial model.

Definition at line 116 of file GCTAModelSpatialMultiplicative.cpp.

References copy_members(), and init_members().

GCTAModelSpatialMultiplicative::~GCTAModelSpatialMultiplicative ( void  )
virtual

Destructor.

Definition at line 133 of file GCTAModelSpatialMultiplicative.cpp.

References free_members().

Member Function Documentation

void GCTAModelSpatialMultiplicative::append ( const GCTAModelSpatial spatial,
const std::string &  name = "" 
)

Append spatial component.

Parameters
[in]spatialSpatial model component.
[in]nameName of spatial component (can be empty).
Exceptions
GException::invalid_valueInvalid 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().

std::string GCTAModelSpatialMultiplicative::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GCTAModelSpatialMultiplicative").

Implements GCTAModelSpatial.

Definition at line 105 of file GCTAModelSpatialMultiplicative.hpp.

void GCTAModelSpatialMultiplicative::clear ( void  )
virtual
GCTAModelSpatialMultiplicative * GCTAModelSpatialMultiplicative::clone ( void  ) const
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.

Parameters
[in]indexIndex of spectral component.
Returns
Pointer to spatial model.
Exceptions
GException::out_of_rangeModel 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.

Parameters
[in]nameName of spatial component.
Returns
Pointer to spatial model.
Exceptions
GException::invalid_argumentSpatial 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.

int GCTAModelSpatialMultiplicative::components ( void  ) const
inline

Return number of spatial components.

Returns
Number of model components.

Returns the number of spatial components.

Definition at line 133 of file GCTAModelSpatialMultiplicative.hpp.

References m_spatial.

Referenced by copy_members(), and print().

void GCTAModelSpatialMultiplicative::copy_members ( const GCTAModelSpatialMultiplicative model)
protected

Copy class members.

Parameters
[in]modelSpatial 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=().

double GCTAModelSpatialMultiplicative::eval ( const GCTAInstDir dir,
const GEnergy energy,
const GTime time,
const bool &  gradients = false 
) const
virtual

Evaluate function (in units of sr^-1)

Parameters
[in]dirEvent direction.
[in]energyEvent energy.
[in]timeEvent time.
[in]gradientsCompute gradients?
Returns
Model value

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().

void GCTAModelSpatialMultiplicative::free_members ( void  )
protected

Delete class members.

Definition at line 647 of file GCTAModelSpatialMultiplicative.cpp.

References m_spatial.

Referenced by clear(), operator=(), and ~GCTAModelSpatialMultiplicative().

void GCTAModelSpatialMultiplicative::init_members ( void  )
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=().

double GCTAModelSpatialMultiplicative::mc_max_value ( const GCTAObservation obs) const
virtual

Return maximum function value for Monte Carlo simulations.

Parameters
[in]obsCTA Observation.
Returns
Maximum function value for Monte Carlo simulations.

Implements GCTAModelSpatial.

Definition at line 304 of file GCTAModelSpatialMultiplicative.cpp.

References m_spatial.

GCTAModelSpatialMultiplicative & GCTAModelSpatialMultiplicative::operator= ( const GCTAModelSpatialMultiplicative model)
virtual

Assignment operator.

Parameters
[in]modelSpatial model.

Definition at line 154 of file GCTAModelSpatialMultiplicative.cpp.

References copy_members(), free_members(), init_members(), and GCTAModelSpatial::operator=().

std::string GCTAModelSpatialMultiplicative::print ( const GChatter chatter = NORMAL) const
virtual

Print multiplicative spatial model information.

Parameters
[in]chatterChattiness.
Returns
String containing model information.

Implements GCTAModelSpatial.

Definition at line 552 of file GCTAModelSpatialMultiplicative.cpp.

References components(), GCTAModelSpatial::m_pars, gammalib::parformat(), SILENT, GCTAModelSpatial::size(), and gammalib::str().

void GCTAModelSpatialMultiplicative::read ( const GXmlElement xml)
virtual

Read model from XML element.

Parameters
[in]xmlXML 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().

std::string GCTAModelSpatialMultiplicative::type ( void  ) const
inlinevirtual

Return model type.

Returns
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().

void GCTAModelSpatialMultiplicative::write ( GXmlElement xml) const
virtual

Member Data Documentation

std::vector<std::string> GCTAModelSpatialMultiplicative::m_components
protected

Names of components.

Definition at line 95 of file GCTAModelSpatialMultiplicative.hpp.

Referenced by append(), component(), copy_members(), init_members(), and write().

std::vector<GCTAModelSpatial*> GCTAModelSpatialMultiplicative::m_spatial
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().

std::string GCTAModelSpatialMultiplicative::m_type
protected

Model type.

Definition at line 93 of file GCTAModelSpatialMultiplicative.hpp.

Referenced by copy_members(), init_members(), and type().


The documentation for this class was generated from the following files: