GammaLib
2.0.0
|
Radial Gaussian CTA model class. More...
#include <GCTAModelRadialGauss.hpp>
Classes | |
class | integrand |
Public Member Functions | |
GCTAModelRadialGauss (void) | |
Void constructor. More... | |
GCTAModelRadialGauss (const double &sigma) | |
Constructor. More... | |
GCTAModelRadialGauss (const GXmlElement &xml) | |
XML constructor. More... | |
GCTAModelRadialGauss (const GCTAModelRadialGauss &model) | |
Copy constructor. More... | |
virtual | ~GCTAModelRadialGauss (void) |
Destructor. More... | |
virtual GCTAModelRadialGauss & | operator= (const GCTAModelRadialGauss &model) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear instance. More... | |
virtual GCTAModelRadialGauss * | 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... | |
double | sigma (void) const |
Return Gaussian width parameter. More... | |
void | sigma (const double &sigma) |
Set Gaussian width parameter. 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 GCTAModelRadialGauss &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. 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 | |
GModelPar | m_sigma |
Width parameter (degrees^2) More... | |
Protected Attributes inherited from GCTAModelSpatial | |
std::vector< GModelPar * > | m_pars |
Parameter pointers. More... | |
Radial Gaussian CTA model class.
This class implements the radial function
\[f(\theta) = \exp \left(-\frac{1}{2} \left( \frac{\theta^2}{\sigma} \right)^2 \right)\]
where \(\theta\) is the offset angle (in degrees), and \(\sigma\) is the width parameter (in degrees \(^2\)).
This function represents a Gaussian in \(\theta^2\).
Definition at line 58 of file GCTAModelRadialGauss.hpp.
GCTAModelRadialGauss::GCTAModelRadialGauss | ( | void | ) |
Void constructor.
Definition at line 71 of file GCTAModelRadialGauss.cpp.
References init_members().
Referenced by clone().
|
explicit |
Constructor.
[in] | sigma | Gaussian width (degrees \(^2\)). |
Definition at line 86 of file GCTAModelRadialGauss.cpp.
References init_members(), and sigma().
|
explicit |
XML constructor.
[in] | xml | XML element. |
Creates instance of a radial Gaussian model by extracting information from an XML element. See GCTAModelRadialGauss::read() for more information about the expected structure of the XML element.
Definition at line 108 of file GCTAModelRadialGauss.cpp.
References init_members(), and read().
GCTAModelRadialGauss::GCTAModelRadialGauss | ( | const GCTAModelRadialGauss & | model | ) |
Copy constructor.
[in] | model | Radial Gaussian model. |
Definition at line 126 of file GCTAModelRadialGauss.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GCTAModelRadial.
Definition at line 121 of file GCTAModelRadialGauss.hpp.
|
virtual |
Clear instance.
Implements GCTAModelRadial.
Definition at line 197 of file GCTAModelRadialGauss.cpp.
References GCTAModelRadial::free_members(), free_members(), GCTAModelRadial::init_members(), and init_members().
|
virtual |
Clone instance.
Implements GCTAModelRadial.
Definition at line 215 of file GCTAModelRadialGauss.cpp.
References GCTAModelRadialGauss().
|
protected |
Copy class members.
[in] | model | Radial Gaussian model. |
Definition at line 526 of file GCTAModelRadialGauss.cpp.
References GCTAModelSpatial::m_pars, and m_sigma.
Referenced by GCTAModelRadialGauss(), and operator=().
|
virtual |
Evaluate function.
[in] | offset | Offset angle (degrees). |
[in] | gradients | Compute gradients? |
Evaluates the Gaussian model for a given offset. The Gaussian model is defined as
\[f(\theta) = \exp \left(-\frac{1}{2} \left( \frac{\theta^2}{\sigma} \right)^2 \right)\]
where \(\theta\) is the offset angle (in degrees), and \(\sigma\) is the Gaussian width (in degrees \(^2\)).
If the gradients
flag is true the method will also compute the partial derivatives of the parameters. The partial derivative of the Gaussian width is given by
\[\frac{df}{d\sigma_v} = f(\theta) \frac{\theta^4}{\sigma^3} \sigma_s\]
where \(\sigma_v\) is the value part, \(\sigma_s\) is the scaling part, and \(\sigma = \sigma_v \sigma_s\).
Note that this method implements a function which is unity for \(\theta=0\).
Implements GCTAModelRadial.
Definition at line 248 of file GCTAModelRadialGauss.cpp.
References exp(), GOptimizerPar::factor_gradient(), gammalib::is_infinite(), gammalib::is_notanumber(), m_sigma, GOptimizerPar::scale(), and sigma().
|
protected |
Delete class members.
Definition at line 543 of file GCTAModelRadialGauss.cpp.
Referenced by clear(), operator=(), and ~GCTAModelRadialGauss().
|
protected |
Initialise class members.
Definition at line 499 of file GCTAModelRadialGauss.cpp.
References GOptimizerPar::clear(), GOptimizerPar::free(), GOptimizerPar::gradient(), GOptimizerPar::has_grad(), GCTAModelSpatial::m_pars, m_sigma, GOptimizerPar::min(), GOptimizerPar::name(), GOptimizerPar::scale(), GOptimizerPar::unit(), and GOptimizerPar::value().
Referenced by clear(), GCTAModelRadialGauss(), and operator=().
|
virtual |
Returns MC instrument direction.
[in,out] | ran | Random number generator. |
Draws an arbitrary CTA instrument position from
\[f(\theta) = \sin(\theta) \exp \left(-\frac{1}{2}\frac{\theta^4}{\sigma^2} \right)\]
where \(\theta\) is the offset angle (in degrees), and \(\sigma\) is the Gaussian width (in degrees \(^2\)), using the rejection method.
Implements GCTAModelRadial.
Definition at line 301 of file GCTAModelRadialGauss.cpp.
References cos(), gammalib::deg2rad, exp(), sigma(), sin(), sqrt(), and GRan::uniform().
|
virtual |
Return maximum function value for Monte Carlo simulations.
[in] | obs | CTA Observation. |
Implements GCTAModelRadial.
Definition at line 355 of file GCTAModelRadialGauss.cpp.
|
virtual |
Returns integral over radial model (in steradians)
Computes
\[\Omega = 2 \pi \int_0^{\pi} \sin \theta f(\theta) d\theta\]
where
\[f(\theta) = \exp \left(-\frac{1}{2} \left( \frac{\theta^2}{\sigma} \right)^2 \right)\]
\(\theta\) is the offset angle (in degrees), and \(\sigma\) is the Gaussian width (in degrees \(^2\)).
The integration is performed numerically, and the upper integration bound \(\pi\) is set to \(\sqrt(10 \sigma)\) to reduce inaccuracies in the numerical integration.
Implements GCTAModelRadial.
Definition at line 379 of file GCTAModelRadialGauss.cpp.
References gammalib::deg2rad, gammalib::pi, GIntegral::romberg(), sigma(), sqrt(), and gammalib::twopi.
|
virtual |
Assignment operator.
[in] | model | Radial Gaussian model. |
Definition at line 164 of file GCTAModelRadialGauss.cpp.
References copy_members(), free_members(), init_members(), and GCTAModelRadial::operator=().
Print point source information.
[in] | chatter | Chattiness. |
Implements GCTAModelRadial.
Definition at line 465 of file GCTAModelRadialGauss.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 Gaussian radial model information from an XML element in the following format
<radialModel type="..."> <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> </radialModel>
Implements GCTAModelRadial.
Definition at line 415 of file GCTAModelRadialGauss.cpp.
References G_READ, m_sigma, GOptimizerPar::name(), GModelPar::read(), sigma(), gammalib::xml_check_parnum(), and gammalib::xml_get_par().
Referenced by GCTAModelRadialGauss().
|
inline |
Return Gaussian width parameter.
Definition at line 145 of file GCTAModelRadialGauss.hpp.
References m_sigma, and GOptimizerPar::value().
Referenced by eval(), GCTAModelRadialGauss(), mc(), omega(), read(), and write().
|
inline |
Set Gaussian width parameter.
[in] | sigma | Gaussian width parameter. |
Definition at line 157 of file GCTAModelRadialGauss.hpp.
References m_sigma, and GOptimizerPar::value().
|
inlinevirtual |
Return model type.
Implements GCTAModelRadial.
Definition at line 133 of file GCTAModelRadialGauss.hpp.
Referenced by write().
|
virtual |
Write model into XML element.
[in] | xml | XML element. |
Write the Gaussian radial model information into an XML element in the following format
<radialModel type="..."> <parameter name="Sigma" scale="1.0" value="3.0" min="0.01" max="10.0" free="1"/> </radialModel>
Implements GCTAModelRadial.
Definition at line 443 of file GCTAModelRadialGauss.cpp.
References G_WRITE, m_sigma, GOptimizerPar::name(), sigma(), type(), GModelPar::write(), gammalib::xml_check_type(), and gammalib::xml_need_par().
|
protected |
Width parameter (degrees^2)
Definition at line 111 of file GCTAModelRadialGauss.hpp.
Referenced by copy_members(), eval(), init_members(), read(), sigma(), and write().