GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAModelRadialProfile Class Reference

Radial Profile CTA model class. More...

#include <GCTAModelRadialProfile.hpp>

Inheritance diagram for GCTAModelRadialProfile:
GCTAModelRadial GCTAModelSpatial GBase

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 GCTAModelRadialProfileoperator= (const GCTAModelRadialProfile &model)
 Assignment operator. More...
 
virtual void clear (void)
 Clear instance. More...
 
virtual GCTAModelRadialProfileclone (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 GCTAModelRadialoperator= (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 GCTAModelSpatialoperator= (const GCTAModelSpatial &model)
 Assignment operator. More...
 
virtual GModelParoperator[] (const int &index)
 Returns model parameter. More...
 
virtual const GModelParoperator[] (const int &index) const
 Returns model parameter (const version) More...
 
virtual GModelParoperator[] (const std::string &name)
 Returns reference to model parameter. More...
 
virtual const GModelParoperator[] (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

GCTAModelRadialProfile::GCTAModelRadialProfile ( void  )

Void constructor.

Definition at line 71 of file GCTAModelRadialProfile.cpp.

References init_members().

Referenced by clone().

GCTAModelRadialProfile::GCTAModelRadialProfile ( const double &  width,
const double &  core,
const double &  tail 
)
explicit

Constructor.

Parameters
[in]widthWidth.
[in]coreCore size.
[in]tailTail size.

Definition at line 88 of file GCTAModelRadialProfile.cpp.

References core(), init_members(), tail(), and width().

GCTAModelRadialProfile::GCTAModelRadialProfile ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML 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.

Parameters
[in]modelRadial Profile model.

Definition at line 133 of file GCTAModelRadialProfile.cpp.

References copy_members(), and init_members().

GCTAModelRadialProfile::~GCTAModelRadialProfile ( void  )
virtual

Destructor.

Definition at line 150 of file GCTAModelRadialProfile.cpp.

References free_members().

Member Function Documentation

std::string GCTAModelRadialProfile::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GCTAModelRadialProfile").

Implements GCTAModelRadial.

Definition at line 126 of file GCTAModelRadialProfile.hpp.

void GCTAModelRadialProfile::clear ( void  )
virtual
GCTAModelRadialProfile * GCTAModelRadialProfile::clone ( void  ) const
virtual

Clone instance.

Implements GCTAModelRadial.

Definition at line 222 of file GCTAModelRadialProfile.cpp.

References GCTAModelRadialProfile().

void GCTAModelRadialProfile::copy_members ( const GCTAModelRadialProfile model)
protected

Copy class members.

Parameters
[in]modelRadial 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=().

double GCTAModelRadialProfile::core ( void  ) const
inline

Return profile core.

Returns
Profile core.

Definition at line 162 of file GCTAModelRadialProfile.hpp.

References m_core, and GOptimizerPar::value().

Referenced by eval(), GCTAModelRadialProfile(), read(), and write().

void GCTAModelRadialProfile::core ( const double &  core)
inline

Set profile core.

Parameters
[in]coreProfile core.

Definition at line 199 of file GCTAModelRadialProfile.hpp.

References m_core, and GOptimizerPar::value().

double GCTAModelRadialProfile::eval ( const double &  offset,
const bool &  gradients = false 
) const
virtual

Evaluate function.

Parameters
[in]offsetOffset angle [degrees].
[in]gradientsCompute gradients?
Returns
Function value

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().

void GCTAModelRadialProfile::free_members ( void  )
protected

Delete class members.

Definition at line 585 of file GCTAModelRadialProfile.cpp.

Referenced by clear(), operator=(), and ~GCTAModelRadialProfile().

GCTAInstDir GCTAModelRadialProfile::mc ( GRan ran) const
virtual

Returns MC instrument direction.

Parameters
[in,out]ranRandom number generator.
Returns
CTA instrument direction.

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.

Todo:
Method can be optimised by using a random deviate of sin instead of the uniform random deviate which leads to many unnecessary rejections.

Implements GCTAModelRadial.

Definition at line 294 of file GCTAModelRadialProfile.cpp.

References cos(), gammalib::deg2rad, eval(), sin(), and GRan::uniform().

double GCTAModelRadialProfile::mc_max_value ( const GCTAObservation obs) const
virtual

Return maximum function value for Monte Carlo simulations.

Parameters
[in]obsCTA Observation (not used).
Returns
Maximum function value for Monte Carlo simulations.

Implements GCTAModelRadial.

Definition at line 361 of file GCTAModelRadialProfile.cpp.

References gammalib::deg2rad, and sin().

double GCTAModelRadialProfile::omega ( void  ) const
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.

GCTAModelRadialProfile & GCTAModelRadialProfile::operator= ( const GCTAModelRadialProfile model)
virtual

Assignment operator.

Parameters
[in]modelRadial Profile model.

Definition at line 171 of file GCTAModelRadialProfile.cpp.

References copy_members(), free_members(), init_members(), and GCTAModelRadial::operator=().

std::string GCTAModelRadialProfile::print ( const GChatter chatter = NORMAL) const
virtual

Print point source information.

Parameters
[in]chatterChattiness.
Returns
String containing point source information.

Implements GCTAModelRadial.

Definition at line 481 of file GCTAModelRadialProfile.cpp.

References GCTAModelSpatial::m_pars, gammalib::parformat(), SILENT, GCTAModelSpatial::size(), and gammalib::str().

void GCTAModelRadialProfile::read ( const GXmlElement xml)
virtual

Read model from XML element.

Parameters
[in]xmlXML 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().

double GCTAModelRadialProfile::tail ( void  ) const
inline

Return profile tail.

Returns
Profile tail.

Definition at line 174 of file GCTAModelRadialProfile.hpp.

References m_tail, and GOptimizerPar::value().

Referenced by eval(), GCTAModelRadialProfile(), read(), and write().

void GCTAModelRadialProfile::tail ( const double &  tail)
inline

Set profile tail.

Parameters
[in]tailProfile tail.

Definition at line 212 of file GCTAModelRadialProfile.hpp.

References m_tail, and GOptimizerPar::value().

std::string GCTAModelRadialProfile::type ( void  ) const
inlinevirtual

Return model type.

Returns
Model type "Profile".

Implements GCTAModelRadial.

Definition at line 138 of file GCTAModelRadialProfile.hpp.

Referenced by write().

double GCTAModelRadialProfile::width ( void  ) const
inline

Return profile width.

Returns
Profile width.

Definition at line 150 of file GCTAModelRadialProfile.hpp.

References m_width, and GOptimizerPar::value().

Referenced by eval(), GCTAModelRadialProfile(), read(), and write().

void GCTAModelRadialProfile::width ( const double &  width)
inline

Set profile width.

Parameters
[in]widthProfile width.

Definition at line 186 of file GCTAModelRadialProfile.hpp.

References m_width, and GOptimizerPar::value().

void GCTAModelRadialProfile::write ( GXmlElement xml) const
virtual

Write model into XML element.

Parameters
[in]xmlXML 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().

Member Data Documentation

GModelPar GCTAModelRadialProfile::m_core
protected

Core parameter.

Definition at line 115 of file GCTAModelRadialProfile.hpp.

Referenced by copy_members(), core(), init_members(), read(), and write().

GModelPar GCTAModelRadialProfile::m_tail
protected

Tail parameter.

Definition at line 116 of file GCTAModelRadialProfile.hpp.

Referenced by copy_members(), init_members(), read(), tail(), and write().

GModelPar GCTAModelRadialProfile::m_width
protected

Width parameter.

Definition at line 114 of file GCTAModelRadialProfile.hpp.

Referenced by copy_members(), init_members(), read(), width(), and write().


The documentation for this class was generated from the following files: