|
GammaLib 2.2.0.dev
|
Spatial gradient CTA model class. More...
#include <GCTAModelSpatialGradient.hpp>
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 GCTAModelSpatialGradient & | operator= (const GCTAModelSpatialGradient &model) |
| Assignment operator. | |
| virtual void | clear (void) |
| Clear instance. | |
| virtual GCTAModelSpatialGradient * | clone (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 GCTAModelSpatial & | operator= (const GCTAModelSpatial &model) |
| Assignment operator. | |
| virtual GModelPar & | operator[] (const int &index) |
| Returns model parameter. | |
| virtual const GModelPar & | operator[] (const int &index) const |
| Returns model parameter (const version) | |
| virtual GModelPar & | operator[] (const std::string &name) |
| Returns reference to model parameter. | |
| virtual const GModelPar & | operator[] (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. | |
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 GCTAModelSpatial::free_members(), free_members(), GCTAModelSpatial::init_members(), and 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 |
Set DETX gradient.
| [in] | detx_gradient | DETX gradient. |
Definition at line 150 of file GCTAModelSpatialGradient.hpp.
References detx_gradient(), m_detx_gradient, and GOptimizerPar::value().
|
inline |
Return DETX gradient.
Definition at line 126 of file GCTAModelSpatialGradient.hpp.
References m_detx_gradient, and GOptimizerPar::value().
Referenced by detx_gradient(), and GCTAModelSpatialGradient().
|
inline |
Set DETY gradient.
| [in] | dety_gradient | DETY gradient. |
Definition at line 163 of file GCTAModelSpatialGradient.hpp.
References dety_gradient(), m_dety_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 dety_gradient(), and GCTAModelSpatialGradient().
|
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(), GCTAModelSpatialGradient(), GCTAModelSpatialGradient(), 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(), print(), SILENT, GCTAModelSpatial::size(), and gammalib::str().
Referenced by print().
|
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(), 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(), dety_gradient(), eval(), init_members(), mc_max_value(), read(), and write().