GammaLib
2.1.0.dev
|
Radial Polynom CTA model class. More...
#include <GCTAModelRadialPolynom.hpp>
Classes | |
class | integrand |
Public Member Functions | |
GCTAModelRadialPolynom (void) | |
Void constructor. More... | |
GCTAModelRadialPolynom (const std::vector< double > &coeffs) | |
Constructor. More... | |
GCTAModelRadialPolynom (const GXmlElement &xml) | |
XML constructor. More... | |
GCTAModelRadialPolynom (const GCTAModelRadialPolynom &model) | |
Copy constructor. More... | |
virtual | ~GCTAModelRadialPolynom (void) |
Destructor. More... | |
virtual GCTAModelRadialPolynom & | operator= (const GCTAModelRadialPolynom &model) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear instance. More... | |
virtual GCTAModelRadialPolynom * | 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 double &offset, const bool &gradients=false) const |
Evaluate function. More... | |
virtual GCTAInstDir | mc (GRan &ran) const |
Returns MC instrument direction. More... | |
virtual double | mc_max_value (const GCTAObservation &obs) const |
Return maximum function value for Monte Carlo simulations. More... | |
virtual double | omega (void) const |
Returns integral over radial model (in steradians) 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... | |
Public Member Functions inherited from GCTAModelRadial | |
GCTAModelRadial (void) | |
Void constructor. More... | |
GCTAModelRadial (const GCTAModelRadial &model) | |
Copy constructor. More... | |
virtual | ~GCTAModelRadial (void) |
Destructor. More... | |
virtual GCTAModelRadial & | operator= (const GCTAModelRadial &model) |
Assignment operator. More... | |
virtual double | eval (const GCTAInstDir &dir, const GEnergy &energy, const GTime &time, const bool &gradients=false) const |
Evaluate function. More... | |
virtual GCTAInstDir | mc (const GEnergy &energy, const GTime &time, const GCTAObservation &obs, GRan &ran) const |
Returns MC instrument direction. 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... | |
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 GCTAModelRadialPolynom &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | update_pars (void) |
Update parameter mapping. More... | |
Protected Member Functions inherited from GCTAModelRadial | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GCTAModelRadial &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::vector< GModelPar > | m_coeffs |
Coefficients. More... | |
Protected Attributes inherited from GCTAModelSpatial | |
std::vector< GModelPar * > | m_pars |
Parameter pointers. More... | |
Radial Polynom CTA model class.
This class implements the radial function
\[f(\theta) = \sum_{i=0}^m c_i \theta^i\]
where \(\theta\) is the offset angle (in degrees), and \(c_i\) are the polynomial coefficients.
This function represents a Polynom in \(\theta\).
Definition at line 59 of file GCTAModelRadialPolynom.hpp.
GCTAModelRadialPolynom::GCTAModelRadialPolynom | ( | void | ) |
Void constructor.
Definition at line 72 of file GCTAModelRadialPolynom.cpp.
References init_members().
Referenced by clone().
|
explicit |
Constructor.
[in] | coeffs | Vector of polynomial coefficients. |
Definition at line 87 of file GCTAModelRadialPolynom.cpp.
References GOptimizerPar::free(), GOptimizerPar::gradient(), GOptimizerPar::has_grad(), init_members(), m_coeffs, GOptimizerPar::name(), GOptimizerPar::scale(), gammalib::str(), GOptimizerPar::unit(), update_pars(), and GOptimizerPar::value().
|
explicit |
XML constructor.
[in] | xml | XML element. |
Creates instance of a radial Polynom model by extracting information from an XML element. See GCTAModelRadialPolynom::read() for more information about the expected structure of the XML element.
Definition at line 133 of file GCTAModelRadialPolynom.cpp.
References init_members(), and read().
GCTAModelRadialPolynom::GCTAModelRadialPolynom | ( | const GCTAModelRadialPolynom & | model | ) |
Copy constructor.
[in] | model | Radial Polynom model. |
Definition at line 152 of file GCTAModelRadialPolynom.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GCTAModelRadial.
Definition at line 120 of file GCTAModelRadialPolynom.hpp.
|
virtual |
Clear instance.
Implements GCTAModelRadial.
Definition at line 223 of file GCTAModelRadialPolynom.cpp.
References GCTAModelRadial::free_members(), free_members(), GCTAModelRadial::init_members(), and init_members().
|
virtual |
Clone instance.
Implements GCTAModelRadial.
Definition at line 241 of file GCTAModelRadialPolynom.cpp.
References GCTAModelRadialPolynom().
|
protected |
Copy class members.
[in] | model | Radial Polynomian model. |
Definition at line 727 of file GCTAModelRadialPolynom.cpp.
References m_coeffs, and update_pars().
Referenced by GCTAModelRadialPolynom(), and operator=().
|
virtual |
Evaluate function.
[in] | offset | Offset angle [degrees]. |
[in] | gradients | Compute gradients? |
Evaluates the radial polynomial model for a given offset. The model is defined as
\[f(\theta) = \sum_{i=0}^m c_i \theta^i\]
where \(\theta\) is the offset angle (in degrees), and \(c_i\) are the polynomial coefficients.
If the gradients
flag is true the method will also compute the partial derivatives of the parameters. The partial derivative of the Polynom are given by
\[\frac{df}{d{c_i}_v} = {c_i}_s \theta^i\]
where \({c_i}_v\) is the value part, \({c_i}_s\) is the scaling part, and \(c_i = {c_i}_v {c_i}_s\).
Implements GCTAModelRadial.
Definition at line 270 of file GCTAModelRadialPolynom.cpp.
References gammalib::is_infinite(), gammalib::is_notanumber(), and m_coeffs.
Referenced by GCTAModelRadialPolynom::integrand::eval(), and mc().
|
protected |
Delete class members.
Definition at line 743 of file GCTAModelRadialPolynom.cpp.
Referenced by clear(), operator=(), and ~GCTAModelRadialPolynom().
|
protected |
Initialise class members.
Definition at line 709 of file GCTAModelRadialPolynom.cpp.
References m_coeffs, and update_pars().
Referenced by clear(), GCTAModelRadialPolynom(), and operator=().
|
virtual |
Returns MC instrument direction.
[in,out] | ran | Random number generator. |
Draws an arbitrary CTA instrument position from
\[f(\theta) = \sin(\theta) \left( \sum_{i=0}^m c_i \theta^i \right)\]
where \(\theta\) is the offset angle (in degrees), and \(c_i\) are the polynomial coefficients, using the rejection method.
Note that the maximum offset angle is fixed by the constant g_cta_radial_polynom_offset_max. This needs eventually adjusting on real data. The main reason for the tight limit is to avoid divergence at large offset angles.
Implements GCTAModelRadial.
Definition at line 353 of file GCTAModelRadialPolynom.cpp.
References cos(), gammalib::deg2rad, eval(), g_cta_radial_polynom_offset_max, sin(), and GRan::uniform().
|
virtual |
Return maximum function value for Monte Carlo simulations.
[in] | obs | CTA Observation (not used). |
Implements GCTAModelRadial.
Definition at line 420 of file GCTAModelRadialPolynom.cpp.
References gammalib::deg2rad, g_cta_radial_polynom_offset_max, and sin().
|
virtual |
Returns integral over radial model (in steradians)
Computes
\[\Omega = 2 \pi \int_0^{\pi} \sin \theta f(\theta) d\theta\]
where
\[f(\theta) = \sum_{i=0}^m c_i \theta^i\]
\(\theta\) is the offset angle (in degrees), and \(c_i\) are the polynomial coefficients.
The integration is performed numerically, and the upper integration bound \(\pi\) is fixed to < g_cta_radial_polynom_offset_max. This needs eventually adjusting on real data. The main reason for the tight limit is to avoid divergence at large offset angles.
Implements GCTAModelRadial.
Definition at line 447 of file GCTAModelRadialPolynom.cpp.
References gammalib::deg2rad, g_cta_radial_polynom_offset_max, GIntegral::romberg(), and gammalib::twopi.
|
virtual |
Assignment operator.
[in] | model | Radial Polynom model. |
Definition at line 190 of file GCTAModelRadialPolynom.cpp.
References copy_members(), free_members(), init_members(), and GCTAModelRadial::operator=().
Print point source information.
[in] | chatter | Chattiness (defaults to NORMAL). |
Implements GCTAModelRadial.
Definition at line 675 of file GCTAModelRadialPolynom.cpp.
References GCTAModelSpatial::m_pars, gammalib::parformat(), SILENT, GCTAModelSpatial::size(), and gammalib::str().
|
virtual |
Read model from XML element.
[in] | xml | XML element. |
GException::invalid_value | Invalid XML format encountered. |
Read the radial Polynom model information from an XML element in the following format
<radialModel type="..."> <parameter name="Coeff0" scale="1.0" value="1.5" min="0.1" max="10.0" free="1"/> <parameter name="Coeff1" scale="1.0" value="3.0" min="1.0" max="10.0" free="1"/> <parameter name="Coeff2" scale="1.0" value="5.0" min="1.0" max="10.0" free="1"/> ... </radialModel>
Implements GCTAModelRadial.
Definition at line 487 of file GCTAModelRadialPolynom.cpp.
References GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), G_READ, m_coeffs, GOptimizerPar::name(), GModelPar::read(), gammalib::str(), gammalib::toint(), GOptimizerPar::unit(), and update_pars().
Referenced by GCTAModelRadialPolynom().
|
inlinevirtual |
Return model type.
Implements GCTAModelRadial.
Definition at line 132 of file GCTAModelRadialPolynom.hpp.
Referenced by write().
|
protected |
Update parameter mapping.
Definition at line 753 of file GCTAModelRadialPolynom.cpp.
References m_coeffs, and GCTAModelSpatial::m_pars.
Referenced by copy_members(), GCTAModelRadialPolynom(), init_members(), and read().
|
virtual |
Write model into XML element.
[in] | xml | XML element. |
Write the polynomial radial model information into an XML element in the following format
<radialModel type="..."> <parameter name="Coeff0" scale="1.0" value="1.5" min="0.1" max="10.0" free="1"/> <parameter name="Coeff1" scale="1.0" value="3.0" min="1.0" max="10.0" free="1"/> <parameter name="Coeff2" scale="1.0" value="5.0" min="1.0" max="10.0" free="1"/> ... </radialModel>
Implements GCTAModelRadial.
Definition at line 642 of file GCTAModelRadialPolynom.cpp.
References G_WRITE, m_coeffs, gammalib::str(), type(), gammalib::xml_check_type(), and gammalib::xml_need_par().
|
protected |
Coefficients.
Definition at line 110 of file GCTAModelRadialPolynom.hpp.
Referenced by copy_members(), eval(), GCTAModelRadialPolynom(), init_members(), read(), update_pars(), and write().