GammaLib
2.1.0.dev
|
Spatial gradient CTA model class. More...
#include <GCTAModelSpatialGradient.hpp>
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 GCTAModelSpatialGradient & | operator= (const GCTAModelSpatialGradient &model) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear instance. More... | |
virtual GCTAModelSpatialGradient * | 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. 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 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 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... | |
Spatial gradient CTA model class.
Definition at line 50 of file GCTAModelSpatialGradient.hpp.
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.
[in] | detx_gradient | DETX gradient (degrees \(^{-1}\)). |
[in] | dety_gradient | DETY gradient (degrees \(^{-1}\)). |
Definition at line 84 of file GCTAModelSpatialGradient.cpp.
References detx_gradient(), dety_gradient(), and init_members().
|
explicit |
XML constructor.
[in] | xml | XML 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.
[in] | model | Spatial gradient model. |
Definition at line 127 of file GCTAModelSpatialGradient.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GCTAModelSpatial.
Definition at line 102 of file GCTAModelSpatialGradient.hpp.
|
virtual |
Clear instance.
Implements GCTAModelSpatial.
Definition at line 198 of file GCTAModelSpatialGradient.cpp.
References free_members(), GCTAModelSpatial::free_members(), init_members(), and GCTAModelSpatial::init_members().
|
virtual |
Clone instance.
Implements GCTAModelSpatial.
Definition at line 216 of file GCTAModelSpatialGradient.cpp.
References GCTAModelSpatialGradient().
|
protected |
Copy class members.
[in] | model | Radial 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=().
|
inline |
Return DETX gradient.
Definition at line 126 of file GCTAModelSpatialGradient.hpp.
References m_detx_gradient, and GOptimizerPar::value().
Referenced by GCTAModelSpatialGradient().
|
inline |
Set DETX gradient.
[in] | detx_gradient | DETX gradient. |
Definition at line 150 of file GCTAModelSpatialGradient.hpp.
References m_detx_gradient, and GOptimizerPar::value().
|
inline |
Return DETY gradient.
Definition at line 138 of file GCTAModelSpatialGradient.hpp.
References m_dety_gradient, and GOptimizerPar::value().
Referenced by GCTAModelSpatialGradient().
|
inline |
Set DETY gradient.
[in] | dety_gradient | DETY gradient. |
Definition at line 163 of file GCTAModelSpatialGradient.hpp.
References m_dety_gradient, and GOptimizerPar::value().
|
virtual |
Evaluate function.
[in] | dir | Event direction. |
[in] | energy | Event energy (not used). |
[in] | time | Event time (not used). |
[in] | gradients | Compute gradients? |
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().
|
protected |
Delete class members.
Definition at line 472 of file GCTAModelSpatialGradient.cpp.
Referenced by clear(), operator=(), and ~GCTAModelSpatialGradient().
|
protected |
Initialise class members.
Definition at line 416 of file GCTAModelSpatialGradient.cpp.
References GOptimizerPar::clear(), GOptimizerPar::free(), GOptimizerPar::gradient(), GOptimizerPar::has_grad(), m_detx_gradient, m_dety_gradient, GCTAModelSpatial::m_pars, GOptimizerPar::name(), GOptimizerPar::scale(), GOptimizerPar::unit(), and GOptimizerPar::value().
Referenced by clear(), GCTAModelSpatialGradient(), and operator=().
|
virtual |
Return maximum function value for Monte Carlo simulations.
[in] | obs | CTA Observation. |
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().
|
virtual |
Assignment operator.
[in] | model | Spatial gradient model. |
Definition at line 165 of file GCTAModelSpatialGradient.cpp.
References copy_members(), free_members(), init_members(), and GCTAModelSpatial::operator=().
Print point source information.
[in] | chatter | Chattiness. |
Implements GCTAModelSpatial.
Definition at line 382 of file GCTAModelSpatialGradient.cpp.
References GCTAModelSpatial::m_pars, gammalib::parformat(), SILENT, GCTAModelSpatial::size(), and gammalib::str().
|
virtual |
Read model from XML element.
[in] | xml | XML 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().
|
inlinevirtual |
Return model type.
Implements GCTAModelSpatial.
Definition at line 114 of file GCTAModelSpatialGradient.hpp.
Referenced by write().
|
virtual |
Write model into XML element.
[in] | xml | XML 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().
|
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().
|
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().