GammaLib 2.0.0
Loading...
Searching...
No Matches
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.
 
 GCTAModelSpatialGradient (const double &detx_gradient, const double &dety_gradient)
 Gradient constructor.
 
 GCTAModelSpatialGradient (const GXmlElement &xml)
 XML constructor.
 
 GCTAModelSpatialGradient (const GCTAModelSpatialGradient &model)
 Copy constructor.
 
virtual ~GCTAModelSpatialGradient (void)
 Destructor.
 
virtual GCTAModelSpatialGradientoperator= (const GCTAModelSpatialGradient &model)
 Assignment operator.
 
virtual void clear (void)
 Clear instance.
 
virtual GCTAModelSpatialGradientclone (void) const
 Clone instance.
 
virtual std::string classname (void) const
 Return class name.
 
virtual std::string type (void) const
 Return model type.
 
virtual double eval (const GCTAInstDir &dir, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
 Evaluate function.
 
virtual double mc_max_value (const GCTAObservation &obs) const
 Return maximum function value for Monte Carlo simulations.
 
virtual void read (const GXmlElement &xml)
 Read model from XML element.
 
virtual void write (GXmlElement &xml) const
 Write model into XML element.
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print point source information.
 
double detx_gradient (void) const
 Return DETX gradient.
 
double dety_gradient (void) const
 Return DETY gradient.
 
void detx_gradient (const double &detx_gradient)
 Set DETX gradient.
 
void dety_gradient (const double &dety_gradient)
 Set DETY gradient.
 
- Public Member Functions inherited from GCTAModelSpatial
 GCTAModelSpatial (void)
 Void constructor.
 
 GCTAModelSpatial (const GCTAModelSpatial &model)
 Copy constructor.
 
virtual ~GCTAModelSpatial (void)
 Destructor.
 
virtual GCTAModelSpatialoperator= (const GCTAModelSpatial &model)
 Assignment operator.
 
virtual GModelParoperator[] (const int &index)
 Returns model parameter.
 
virtual const GModelParoperator[] (const int &index) const
 Returns model parameter (const version)
 
virtual GModelParoperator[] (const std::string &name)
 Returns reference to model parameter.
 
virtual const GModelParoperator[] (const std::string &name) const
 Returns reference to model parameter (const version)
 
virtual GCTAInstDir mc (const GEnergy &energy, const GTime &time, const GCTAObservation &obs, GRan &ran) const
 Returns MC instrument direction.
 
int size (void) const
 Return number of model parameters.
 
virtual double npred (const GEnergy &energy, const GTime &time, const GObservation &obs) const
 Return integral of spatial model component.
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor.
 

Protected Member Functions

void init_members (void)
 Initialise class members.
 
void copy_members (const GCTAModelSpatialGradient &model)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
- Protected Member Functions inherited from GCTAModelSpatial
void init_members (void)
 Initialise class members.
 
void copy_members (const GCTAModelSpatial &model)
 Copy class members.
 
void free_members (void)
 Delete class members.
 

Protected Attributes

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

Detailed Description

Spatial gradient CTA model class.

Definition at line 50 of file GCTAModelSpatialGradient.hpp.

Constructor & Destructor Documentation

◆ GCTAModelSpatialGradient() [1/4]

GCTAModelSpatialGradient::GCTAModelSpatialGradient ( void )

Void constructor.

Definition at line 68 of file GCTAModelSpatialGradient.cpp.

References init_members().

Referenced by clone().

◆ GCTAModelSpatialGradient() [2/4]

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() [3/4]

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() [4/4]

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::~GCTAModelSpatialGradient ( void )
virtual

Destructor.

Definition at line 144 of file GCTAModelSpatialGradient.cpp.

References free_members().

Member Function Documentation

◆ classname()

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.

◆ clear()

void GCTAModelSpatialGradient::clear ( void )
virtual

◆ clone()

GCTAModelSpatialGradient * GCTAModelSpatialGradient::clone ( void ) const
virtual

Clone instance.

Implements GCTAModelSpatial.

Definition at line 216 of file GCTAModelSpatialGradient.cpp.

References GCTAModelSpatialGradient().

◆ copy_members()

void GCTAModelSpatialGradient::copy_members ( const GCTAModelSpatialGradient & model)
protected

Copy class members.

Parameters
[in]modelRadial Gaussian model.

Definition at line 453 of file GCTAModelSpatialGradient.cpp.

References m_detx_gradient, m_dety_gradient, and GCTAModelSpatial::m_pars.

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

◆ detx_gradient() [1/2]

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 detx_gradient(), m_detx_gradient, and GOptimizerPar::value().

◆ detx_gradient() [2/2]

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 detx_gradient(), and GCTAModelSpatialGradient().

◆ dety_gradient() [1/2]

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 dety_gradient(), m_dety_gradient, and GOptimizerPar::value().

◆ dety_gradient() [2/2]

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 dety_gradient(), and GCTAModelSpatialGradient().

◆ eval()

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

◆ free_members()

void GCTAModelSpatialGradient::free_members ( void )
protected

Delete class members.

Definition at line 472 of file GCTAModelSpatialGradient.cpp.

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

◆ init_members()

◆ mc_max_value()

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

◆ operator=()

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

◆ print()

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 382 of file GCTAModelSpatialGradient.cpp.

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

Referenced by print().

◆ read()

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

◆ type()

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

◆ write()

void GCTAModelSpatialGradient::write ( GXmlElement & xml) const
virtual

Write model into XML element.

Parameters
[in]xmlXML element.

Write the gradient spatial model information into an XML element.

Implements GCTAModelSpatial.

Definition at line 358 of file GCTAModelSpatialGradient.cpp.

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

Member Data Documentation

◆ m_detx_gradient

GModelPar GCTAModelSpatialGradient::m_detx_gradient
protected

◆ m_dety_gradient

GModelPar GCTAModelSpatialGradient::m_dety_gradient
protected

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