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

Spatial gradient CTA model class. More...

#include <GCTAModelSpatialGradient.hpp>

Inheritance diagram for GCTAModelSpatialGradient:
GCTAModelSpatial GBase

Public Member Functions

 GCTAModelSpatialGradient (void)
 Void constructor. More...
 
 GCTAModelSpatialGradient (const double &detx_gradient, const double &dety_gradient)
 Gradient constructor. More...
 
 GCTAModelSpatialGradient (const GXmlElement &xml)
 XML constructor. More...
 
 GCTAModelSpatialGradient (const GCTAModelSpatialGradient &model)
 Copy constructor. More...
 
virtual ~GCTAModelSpatialGradient (void)
 Destructor. More...
 
virtual GCTAModelSpatialGradientoperator= (const GCTAModelSpatialGradient &model)
 Assignment operator. More...
 
virtual void clear (void)
 Clear instance. More...
 
virtual GCTAModelSpatialGradientclone (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. 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 point source information. More...
 
double detx_gradient (void) const
 Return DETX gradient. More...
 
double dety_gradient (void) const
 Return DETY gradient. More...
 
void detx_gradient (const double &detx_gradient)
 Set DETX gradient. More...
 
void dety_gradient (const double &dety_gradient)
 Set DETY gradient. 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 GCTAModelSpatialGradient &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

GModelPar m_detx_gradient
 DETX gradient. More...
 
GModelPar m_dety_gradient
 DETY gradient. More...
 
- Protected Attributes inherited from GCTAModelSpatial
std::vector< GModelPar * > m_pars
 Parameter pointers. More...
 

Detailed Description

Spatial gradient CTA model class.

Definition at line 50 of file GCTAModelSpatialGradient.hpp.

Constructor & Destructor Documentation

GCTAModelSpatialGradient::GCTAModelSpatialGradient ( void  )

Void constructor.

Definition at line 68 of file GCTAModelSpatialGradient.cpp.

References init_members().

Referenced by clone().

GCTAModelSpatialGradient::GCTAModelSpatialGradient ( const double &  detx_gradient,
const double &  dety_gradient 
)

Gradient constructor.

Parameters
[in]detx_gradientDETX gradient (degrees \(^{-1}\)).
[in]dety_gradientDETY gradient (degrees \(^{-1}\)).

Definition at line 84 of file GCTAModelSpatialGradient.cpp.

References detx_gradient(), dety_gradient(), and init_members().

GCTAModelSpatialGradient::GCTAModelSpatialGradient ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML element.

Creates instance of a spatial gradient model by extracting information from an XML element. See GCTAModelSpatialGradient::read() for more information about the expected structure of the XML element.

Definition at line 109 of file GCTAModelSpatialGradient.cpp.

References init_members(), and read().

GCTAModelSpatialGradient::GCTAModelSpatialGradient ( const GCTAModelSpatialGradient model)

Copy constructor.

Parameters
[in]modelSpatial gradient model.

Definition at line 127 of file GCTAModelSpatialGradient.cpp.

References copy_members(), and init_members().

GCTAModelSpatialGradient::~GCTAModelSpatialGradient ( void  )
virtual

Destructor.

Definition at line 144 of file GCTAModelSpatialGradient.cpp.

References free_members().

Member Function Documentation

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

Return class name.

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

Implements GCTAModelSpatial.

Definition at line 102 of file GCTAModelSpatialGradient.hpp.

void GCTAModelSpatialGradient::clear ( void  )
virtual
GCTAModelSpatialGradient * GCTAModelSpatialGradient::clone ( void  ) const
virtual

Clone instance.

Implements GCTAModelSpatial.

Definition at line 216 of file GCTAModelSpatialGradient.cpp.

References GCTAModelSpatialGradient().

void GCTAModelSpatialGradient::copy_members ( const GCTAModelSpatialGradient model)
protected

Copy class members.

Parameters
[in]modelRadial Gaussian model.

Definition at line 465 of file GCTAModelSpatialGradient.cpp.

References m_detx_gradient, m_dety_gradient, and GCTAModelSpatial::m_pars.

Referenced by GCTAModelSpatialGradient(), and operator=().

double GCTAModelSpatialGradient::detx_gradient ( void  ) const
inline

Return DETX gradient.

Returns
DETX gradient.

Definition at line 126 of file GCTAModelSpatialGradient.hpp.

References m_detx_gradient, and GOptimizerPar::value().

Referenced by GCTAModelSpatialGradient().

void GCTAModelSpatialGradient::detx_gradient ( const double &  detx_gradient)
inline

Set DETX gradient.

Parameters
[in]detx_gradientDETX gradient.

Definition at line 150 of file GCTAModelSpatialGradient.hpp.

References m_detx_gradient, and GOptimizerPar::value().

double GCTAModelSpatialGradient::dety_gradient ( void  ) const
inline

Return DETY gradient.

Returns
DETY gradient.

Definition at line 138 of file GCTAModelSpatialGradient.hpp.

References m_dety_gradient, and GOptimizerPar::value().

Referenced by GCTAModelSpatialGradient().

void GCTAModelSpatialGradient::dety_gradient ( const double &  dety_gradient)
inline

Set DETY gradient.

Parameters
[in]dety_gradientDETY gradient.

Definition at line 163 of file GCTAModelSpatialGradient.hpp.

References m_dety_gradient, and GOptimizerPar::value().

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

Evaluate function.

Parameters
[in]dirEvent direction.
[in]energyEvent energy (not used).
[in]timeEvent time (not used).
[in]gradientsCompute gradients?
Returns
Function value

Evaluates the spatial gradient model for a given event direction. The energy and time of the event are not used.

The spatial gradient model is defined as

\[f(x,y) = 1 + g_x \times x + g_y \times y\]

where \(x\) is x direction, \(y\) is y direction, \(g_x\) is the spatial gradient in the x direction, and \(g_y\) is the spatial gradient in the y direction.

If the gradients flag is true the method will also compute the partial derivatives of the parameters. The partial derivative of the spatial gradient model are given by

\[ \frac{df}{dg_{xv}} = g_{xs} x\]

and

\[ \frac{df}{dg_{yv}} = g_{ys} y\]

where \(g_{xv}\) is the value part and \(g_{xs}\) is the scaling part of gradient in x, and \(g_{yv}\) is the value part and \(g_{ys}\) is the scaling part of gradient in y.

Implements GCTAModelSpatial.

Definition at line 260 of file GCTAModelSpatialGradient.cpp.

References GCTAInstDir::detx(), GCTAInstDir::dety(), GOptimizerPar::factor_gradient(), gammalib::is_infinite(), gammalib::is_notanumber(), m_detx_gradient, m_dety_gradient, gammalib::rad2deg, GOptimizerPar::scale(), and GOptimizerPar::value().

void GCTAModelSpatialGradient::free_members ( void  )
protected

Delete class members.

Definition at line 484 of file GCTAModelSpatialGradient.cpp.

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

double GCTAModelSpatialGradient::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 301 of file GCTAModelSpatialGradient.cpp.

References GCTARoi::centre(), GCTAInstDir::detx(), GCTAInstDir::dety(), m_detx_gradient, m_dety_gradient, gammalib::rad2deg, GCTARoi::radius(), GCTAObservation::roi(), and GOptimizerPar::value().

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

Assignment operator.

Parameters
[in]modelSpatial gradient model.

Definition at line 165 of file GCTAModelSpatialGradient.cpp.

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

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

Print point source information.

Parameters
[in]chatterChattiness.
Returns
String containing point source information.

Implements GCTAModelSpatial.

Definition at line 394 of file GCTAModelSpatialGradient.cpp.

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

void GCTAModelSpatialGradient::read ( const GXmlElement xml)
virtual

Read model from XML element.

Parameters
[in]xmlXML element.

Read the gradient spatial model information from an XML element.

Implements GCTAModelSpatial.

Definition at line 336 of file GCTAModelSpatialGradient.cpp.

References G_READ, m_detx_gradient, m_dety_gradient, GOptimizerPar::name(), GModelPar::read(), and gammalib::xml_get_par().

Referenced by GCTAModelSpatialGradient().

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

Return model type.

Returns
Model type "Gradient".

Implements GCTAModelSpatial.

Definition at line 114 of file GCTAModelSpatialGradient.hpp.

Referenced by write().

void GCTAModelSpatialGradient::write ( GXmlElement xml) const
virtual

Write model into XML element.

Parameters
[in]xmlXML element.
Exceptions
GException::invalid_valueSpatial model is not of valid type.

Write the gradient spatial model information into an XML element.

Implements GCTAModelSpatial.

Definition at line 361 of file GCTAModelSpatialGradient.cpp.

References GXmlElement::attribute(), G_WRITE, m_detx_gradient, m_dety_gradient, GOptimizerPar::name(), type(), GModelPar::write(), and gammalib::xml_need_par().

Member Data Documentation

GModelPar GCTAModelSpatialGradient::m_detx_gradient
protected

DETX gradient.

Definition at line 91 of file GCTAModelSpatialGradient.hpp.

Referenced by copy_members(), detx_gradient(), eval(), init_members(), mc_max_value(), read(), and write().

GModelPar GCTAModelSpatialGradient::m_dety_gradient
protected

DETY gradient.

Definition at line 92 of file GCTAModelSpatialGradient.hpp.

Referenced by copy_members(), dety_gradient(), eval(), init_members(), mc_max_value(), read(), and write().


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