GammaLib
2.1.0.dev
|
Radial Profile CTA model class. More...
#include <GCTAModelRadialProfile.hpp>
Classes | |
class | integrand |
Public Member Functions | |
GCTAModelRadialProfile (void) | |
Void constructor. More... | |
GCTAModelRadialProfile (const double &width, const double &core, const double &tail) | |
Constructor. More... | |
GCTAModelRadialProfile (const GXmlElement &xml) | |
XML constructor. More... | |
GCTAModelRadialProfile (const GCTAModelRadialProfile &model) | |
Copy constructor. More... | |
virtual | ~GCTAModelRadialProfile (void) |
Destructor. More... | |
virtual GCTAModelRadialProfile & | operator= (const GCTAModelRadialProfile &model) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear instance. More... | |
virtual GCTAModelRadialProfile * | 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 | width (void) const |
Return profile width. More... | |
double | core (void) const |
Return profile core. More... | |
double | tail (void) const |
Return profile tail. More... | |
void | width (const double &width) |
Set profile width. More... | |
void | core (const double &core) |
Set profile core. More... | |
void | tail (const double &tail) |
Set profile tail. 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 GCTAModelRadialProfile &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_width |
Width parameter. More... | |
GModelPar | m_core |
Core parameter. More... | |
GModelPar | m_tail |
Tail parameter. More... | |
Protected Attributes inherited from GCTAModelSpatial | |
std::vector< GModelPar * > | m_pars |
Parameter pointers. More... | |
Radial Profile CTA model class.
This class implements the radial profile function
\[f(\theta) = (1 + (\theta/c_0)^{c_1})^{-c_2/c_1}\]
where \(\theta\) is the offset angle (in degrees), \(c_0\) is the width of the profile (width), \(c_1\) is the width of the central plateau (core), and \(c_2\) is the size of the tail (tail). Note that all 3 parameters are positive values.
Definition at line 59 of file GCTAModelRadialProfile.hpp.
GCTAModelRadialProfile::GCTAModelRadialProfile | ( | void | ) |
Void constructor.
Definition at line 71 of file GCTAModelRadialProfile.cpp.
References init_members().
Referenced by clone().
|
explicit |
Constructor.
[in] | width | Width. |
[in] | core | Core size. |
[in] | tail | Tail size. |
Definition at line 88 of file GCTAModelRadialProfile.cpp.
References core(), init_members(), tail(), and width().
|
explicit |
XML constructor.
[in] | xml | XML element. |
Creates instance of a radial Profile model by extracting information from an XML element. See GCTAModelRadialProfile::read() for more information about the expected structure of the XML element.
Definition at line 114 of file GCTAModelRadialProfile.cpp.
References init_members(), and read().
GCTAModelRadialProfile::GCTAModelRadialProfile | ( | const GCTAModelRadialProfile & | model | ) |
Copy constructor.
[in] | model | Radial Profile model. |
Definition at line 133 of file GCTAModelRadialProfile.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GCTAModelRadial.
Definition at line 126 of file GCTAModelRadialProfile.hpp.
|
virtual |
Clear instance.
Implements GCTAModelRadial.
Definition at line 204 of file GCTAModelRadialProfile.cpp.
References GCTAModelRadial::free_members(), free_members(), GCTAModelRadial::init_members(), and init_members().
|
virtual |
Clone instance.
Implements GCTAModelRadial.
Definition at line 222 of file GCTAModelRadialProfile.cpp.
References GCTAModelRadialProfile().
|
protected |
Copy class members.
[in] | model | Radial Profileian model. |
Definition at line 564 of file GCTAModelRadialProfile.cpp.
References m_core, GCTAModelSpatial::m_pars, m_tail, and m_width.
Referenced by GCTAModelRadialProfile(), and operator=().
|
inline |
Return profile core.
Definition at line 162 of file GCTAModelRadialProfile.hpp.
References m_core, and GOptimizerPar::value().
Referenced by eval(), GCTAModelRadialProfile(), read(), and write().
|
inline |
Set profile core.
[in] | core | Profile core. |
Definition at line 199 of file GCTAModelRadialProfile.hpp.
References m_core, and GOptimizerPar::value().
|
virtual |
Evaluate function.
[in] | offset | Offset angle [degrees]. |
[in] | gradients | Compute gradients? |
Evaluates the Profile model for a given offset. The Profile model is defined as
\[f(\theta) = (1 + (\theta/c_0)^{c_1})^{-c_2/c_1}\]
where \(\theta\) is the offset angle (in degrees), \(c_0\) is the width of the profile (width), \(c_1\) is the width of the central plateau (core), and \(c_2\) is the size of the tail (tail).
Note that no analytical partial derivatives are implemented for this function.
Implements GCTAModelRadial.
Definition at line 247 of file GCTAModelRadialProfile.cpp.
References core(), gammalib::is_infinite(), gammalib::is_notanumber(), pow(), tail(), and width().
Referenced by GCTAModelRadialProfile::integrand::eval(), and mc().
|
protected |
Delete class members.
Definition at line 585 of file GCTAModelRadialProfile.cpp.
Referenced by clear(), operator=(), and ~GCTAModelRadialProfile().
|
protected |
Initialise class members.
Definition at line 515 of file GCTAModelRadialProfile.cpp.
References GOptimizerPar::clear(), GOptimizerPar::fix(), GOptimizerPar::free(), GOptimizerPar::gradient(), GOptimizerPar::has_grad(), m_core, GCTAModelSpatial::m_pars, m_tail, m_width, GOptimizerPar::min(), GOptimizerPar::name(), GOptimizerPar::scale(), GOptimizerPar::unit(), and GOptimizerPar::value().
Referenced by clear(), GCTAModelRadialProfile(), and operator=().
|
virtual |
Returns MC instrument direction.
[in,out] | ran | Random number generator. |
Draws an arbitrary CTA instrument position from
\[f(\theta) = \sin(\theta) (1 + (\theta/c_0)^{c_1})^{-c_2/c_1}\]
where \(\theta\) is the offset angle (in degrees), \(c_0\) is the width of the profile (width), \(c_1\) is the width of the central plateau (core), and \(c_2\) is the size of the tail (tail). using the rejection method.
The maximum offset angle that is thrown by this method is fixed to 10 degrees.
Implements GCTAModelRadial.
Definition at line 294 of file GCTAModelRadialProfile.cpp.
References cos(), gammalib::deg2rad, eval(), sin(), and GRan::uniform().
|
virtual |
Return maximum function value for Monte Carlo simulations.
[in] | obs | CTA Observation (not used). |
Implements GCTAModelRadial.
Definition at line 361 of file GCTAModelRadialProfile.cpp.
References gammalib::deg2rad, 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) = (1 + (\theta/c_0)^{c_1})^{-c_2/c_1}\]
\(\theta\) is the offset angle (in degrees), \(c_0\) is the width of the profile (width), \(c_1\) is the width of the central plateau (core), and \(c_2\) is the size of the tail (tail).
The integration is performed numerically, and the upper integration bound \(\pi\) is fixed to 10 degrees.
Implements GCTAModelRadial.
Definition at line 388 of file GCTAModelRadialProfile.cpp.
References gammalib::deg2rad, GIntegral::romberg(), and gammalib::twopi.
|
virtual |
Assignment operator.
[in] | model | Radial Profile model. |
Definition at line 171 of file GCTAModelRadialProfile.cpp.
References copy_members(), free_members(), init_members(), and GCTAModelRadial::operator=().
Print point source information.
[in] | chatter | Chattiness. |
Implements GCTAModelRadial.
Definition at line 481 of file GCTAModelRadialProfile.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 Profile radial model information from an XML element in the following format
<radialModel type="..."> <parameter name="Width" scale="1.0" value="1.5" min="0.1" max="10.0" free="1"/> <parameter name="Core" scale="1.0" value="3.0" min="1.0" max="10.0" free="1"/> <parameter name="Tail" scale="1.0" value="5.0" min="1.0" max="10.0" free="1"/> </radialModel>
Implements GCTAModelRadial.
Definition at line 421 of file GCTAModelRadialProfile.cpp.
References core(), G_READ, m_core, m_tail, m_width, GOptimizerPar::name(), GModelPar::read(), tail(), width(), gammalib::xml_check_parnum(), and gammalib::xml_get_par().
Referenced by GCTAModelRadialProfile().
|
inline |
Return profile tail.
Definition at line 174 of file GCTAModelRadialProfile.hpp.
References m_tail, and GOptimizerPar::value().
Referenced by eval(), GCTAModelRadialProfile(), read(), and write().
|
inline |
Set profile tail.
[in] | tail | Profile tail. |
Definition at line 212 of file GCTAModelRadialProfile.hpp.
References m_tail, and GOptimizerPar::value().
|
inlinevirtual |
Return model type.
Implements GCTAModelRadial.
Definition at line 138 of file GCTAModelRadialProfile.hpp.
Referenced by write().
|
inline |
Return profile width.
Definition at line 150 of file GCTAModelRadialProfile.hpp.
References m_width, and GOptimizerPar::value().
Referenced by eval(), GCTAModelRadialProfile(), read(), and write().
|
inline |
Set profile width.
[in] | width | Profile width. |
Definition at line 186 of file GCTAModelRadialProfile.hpp.
References m_width, and GOptimizerPar::value().
|
virtual |
Write model into XML element.
[in] | xml | XML element. |
Write the radial Profile model information into an XML element in the following format
<radialModel type="..."> <parameter name="Width" scale="1.0" value="1.5" min="0.1" max="10.0" free="1"/> <parameter name="Core" scale="1.0" value="3.0" min="1.0" max="10.0" free="1"/> <parameter name="Tail" scale="1.0" value="5.0" min="1.0" max="10.0" free="1"/> </radialModel>
Implements GCTAModelRadial.
Definition at line 455 of file GCTAModelRadialProfile.cpp.
References core(), G_WRITE, m_core, m_tail, m_width, GOptimizerPar::name(), tail(), type(), width(), GModelPar::write(), gammalib::xml_check_type(), and gammalib::xml_need_par().
|
protected |
Core parameter.
Definition at line 115 of file GCTAModelRadialProfile.hpp.
Referenced by copy_members(), core(), init_members(), read(), and write().
|
protected |
Tail parameter.
Definition at line 116 of file GCTAModelRadialProfile.hpp.
Referenced by copy_members(), init_members(), read(), tail(), and write().
|
protected |
Width parameter.
Definition at line 114 of file GCTAModelRadialProfile.hpp.
Referenced by copy_members(), init_members(), read(), width(), and write().