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

#include <GModelSpatialRadialProfile.hpp>

Inheritance diagram for GModelSpatialRadialProfile:
GModelSpatialRadial GModelSpatial GBase GModelSpatialRadialProfileDMBurkert GModelSpatialRadialProfileDMEinasto GModelSpatialRadialProfileDMZhao GModelSpatialRadialProfileGauss

Classes

struct  profile
 

Public Member Functions

 GModelSpatialRadialProfile (void)
 Void constructor. More...
 
 GModelSpatialRadialProfile (const GXmlElement &xml)
 XML constructor. More...
 
 GModelSpatialRadialProfile (const GModelSpatialRadialProfile &model)
 Copy constructor. More...
 
virtual ~GModelSpatialRadialProfile (void)
 Destructor. More...
 
virtual
GModelSpatialRadialProfile
operator= (const GModelSpatialRadialProfile &model)
 Assignment operator. More...
 
virtual void clear (void)=0
 Clear object. More...
 
virtual
GModelSpatialRadialProfile
clone (void) const =0
 Clones object. More...
 
virtual std::string classname (void) const =0
 Return class name. More...
 
virtual double theta_min (void) const =0
 
virtual double theta_max (void) const =0
 
virtual std::string print (const GChatter &chatter=NORMAL) const =0
 Print content of object. More...
 
virtual double eval (const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
 Evaluate function (in units of sr^-1) More...
 
virtual GSkyDir mc (const GEnergy &energy, const GTime &time, GRan &ran) const
 Return MC sky direction. More...
 
virtual bool contains (const GSkyDir &dir, const double &margin=0.0) const
 Checks where model contains specified sky direction. More...
 
int num_nodes (void) const
 Return number of nodes. More...
 
void num_nodes (const int &number)
 Set number of nodes. More...
 
- Public Member Functions inherited from GModelSpatialRadial
 GModelSpatialRadial (void)
 Void constructor. More...
 
 GModelSpatialRadial (const GModelSpatialRadial &model)
 Copy constructor. More...
 
 GModelSpatialRadial (const GXmlElement &xml)
 XML constructor. More...
 
virtual ~GModelSpatialRadial (void)
 Destructor. More...
 
virtual GModelSpatialRadialoperator= (const GModelSpatialRadial &model)
 Assignment operator. More...
 
virtual GClassCode code (void) const
 Return class code. More...
 
virtual bool is_energy_dependent (void) const
 Signals whether radial model is energy dependent. More...
 
virtual bool is_time_dependent (void) const
 Signals whether radial model is time dependent. More...
 
virtual double eval (const GPhoton &photon, const bool &gradients=false) const
 Return model value. More...
 
virtual double mc_norm (const GSkyDir &dir, const double &radius) const
 Return normalization of radial source for Monte Carlo simulations. 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...
 
std::string coordsys (void) const
 Return coordinate system. More...
 
const GSkyDirdir (void) const
 Return position of radial spatial model. More...
 
void dir (const GSkyDir &dir)
 Set position of radial spatial model. More...
 
- Public Member Functions inherited from GModelSpatial
 GModelSpatial (void)
 Void constructor. More...
 
 GModelSpatial (const GModelSpatial &model)
 Copy constructor. More...
 
virtual ~GModelSpatial (void)
 Destructor. More...
 
virtual GModelSpatialoperator= (const GModelSpatial &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 model parameter. More...
 
virtual const GModelParoperator[] (const std::string &name) const
 Returns model parameter (const version) More...
 
virtual double flux (const GSkyRegion &region, const GEnergy &srcEng=GEnergy(), const GTime &srcTime=GTime()) const
 Returns model flux within sky region. More...
 
std::string type (void) const
 Return model type. More...
 
void type (const std::string &type)
 Set model type. More...
 
GModelParat (const int &index)
 Returns model parameter. More...
 
const GModelParat (const int &index) const
 Returns model parameter (const version) More...
 
bool has_par (const std::string &name) const
 Checks if parameter name exists. More...
 
bool has_free_pars (void) const
 Checks if the spatial model has free parameters. More...
 
int size (void) const
 Return number of parameters. More...
 
void autoscale (void)
 Autoscale parameters. More...
 
const GSkyRegionregion (void) const
 Return boundary sky region. 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 GModelSpatialRadialProfile &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
int cache_index (void) const
 Return index to pre-computation cache. More...
 
virtual double profile_value (const double &theta) const =0
 
virtual void set_region (void) const
 Set boundary sky region. More...
 
- Protected Member Functions inherited from GModelSpatialRadial
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GModelSpatialRadial &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
bool is_celestial (void) const
 Check if model holds celestial coordinates. More...
 
- Protected Member Functions inherited from GModelSpatial
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GModelSpatial &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

bool m_coord_indep
 True if model independent of sky coordinates. More...
 
int m_num_nodes
 Number of profile nodes. More...
 
std::vector< profilem_profile
 Pre-computation cache. More...
 
- Protected Attributes inherited from GModelSpatialRadial
GModelPar m_lon
 Right Ascension or Galactic longitude (deg) More...
 
GModelPar m_lat
 Declination or Galactic latitude (deg) More...
 
GSkyDir m_dir
 Sky direction representing parameters. More...
 
double m_last_lon
 Last longitude. More...
 
double m_last_lat
 Last latitude. More...
 
- Protected Attributes inherited from GModelSpatial
std::string m_type
 Spatial model type. More...
 
GSkyRegionCircle m_region
 Bounding circle. More...
 
std::vector< GModelPar * > m_pars
 Parameter pointers. More...
 

Detailed Description

Definition at line 49 of file GModelSpatialRadialProfile.hpp.

Constructor & Destructor Documentation

GModelSpatialRadialProfile::GModelSpatialRadialProfile ( void  )

Void constructor.

Constructs empty radial profile

Definition at line 63 of file GModelSpatialRadialProfile.cpp.

References init_members().

GModelSpatialRadialProfile::GModelSpatialRadialProfile ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML element.

Constructs radial profile model by extracting information from an XML elements.

Definition at line 82 of file GModelSpatialRadialProfile.cpp.

References init_members(), and GModelSpatialRadial::read().

GModelSpatialRadialProfile::GModelSpatialRadialProfile ( const GModelSpatialRadialProfile model)

Copy constructor.

Parameters
[in]modelRadial profile model.

Copies radial profile model from another radial profile model.

Definition at line 103 of file GModelSpatialRadialProfile.cpp.

References copy_members(), and init_members().

GModelSpatialRadialProfile::~GModelSpatialRadialProfile ( void  )
virtual

Destructor.

Destructs radial profile model.

Definition at line 122 of file GModelSpatialRadialProfile.cpp.

References free_members().

Member Function Documentation

int GModelSpatialRadialProfile::cache_index ( void  ) const
protected

Return index to pre-computation cache.

Returns
Index to pre-computation cache

Returns the index to the pre-computation cache. If no pre-computation cache was found the method will create one and return the index to that cache.

Definition at line 342 of file GModelSpatialRadialProfile.cpp.

References GNodeArray::append(), GNodeArray::clear(), m_coord_indep, m_num_nodes, GModelSpatial::m_pars, m_profile, mc(), GModelSpatialRadialProfile::profile::mc, GModelSpatialRadialProfile::profile::mc_max, GModelSpatialRadialProfile::profile::nodes, norm(), GModelSpatialRadialProfile::profile::pars, profile_value(), sin(), theta_max(), theta_min(), gammalib::twopi, and GModelSpatialRadialProfile::profile::values.

Referenced by eval(), and mc().

virtual std::string GModelSpatialRadialProfile::classname ( void  ) const
pure virtual

Return class name.

Returns
String containing the class name.

Returns the class name for non-abstract classes in a human readable way.

Implements GModelSpatialRadial.

Implemented in GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, and GModelSpatialRadialProfileGauss.

virtual void GModelSpatialRadialProfile::clear ( void  )
pure virtual

Clear object.

Sets the object to a clean initial state. After calling the method the object will be in the same state as it were if an empty instance of the object would have been created.

Implements GModelSpatialRadial.

Implemented in GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, and GModelSpatialRadialProfileGauss.

virtual GModelSpatialRadialProfile* GModelSpatialRadialProfile::clone ( void  ) const
pure virtual

Clones object.

Returns
Pointer to deep copy of object.

Creates a deep copy of the object and returns a pointer to the object.

Implements GModelSpatialRadial.

Implemented in GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, and GModelSpatialRadialProfileGauss.

bool GModelSpatialRadialProfile::contains ( const GSkyDir dir,
const double &  margin = 0.0 
) const
virtual

Checks where model contains specified sky direction.

Parameters
[in]dirSky direction.
[in]marginMargin to be added to sky direction (degrees)
Returns
True if the model contains the sky direction.

Signals whether a sky direction is contained in the radial disk model.

Implements GModelSpatialRadial.

Definition at line 271 of file GModelSpatialRadialProfile.cpp.

References gammalib::deg2rad, GModelSpatialRadial::dir(), GSkyDir::dist(), theta_max(), and theta_min().

void GModelSpatialRadialProfile::copy_members ( const GModelSpatialRadialProfile model)
protected

Copy class members.

Parameters
[in]modelRadial disk model.

Definition at line 311 of file GModelSpatialRadialProfile.cpp.

References m_coord_indep, m_num_nodes, and m_profile.

Referenced by GModelSpatialRadialProfile(), and operator=().

double GModelSpatialRadialProfile::eval ( const double &  theta,
const GEnergy energy,
const GTime time,
const bool &  gradients = false 
) const
virtual

Evaluate function (in units of sr^-1)

Parameters
[in]thetaAngular distance from model centre (radians).
[in]energyPhoton energy.
[in]timePhoton arrival time.
[in]gradientsCompute gradients?
Returns
Model value.

Evaluate the radial profile model for a given angular distance theta the model centre, a given photon energy and a given time. The method evaluates the model by linear interpolation.

Implements GModelSpatialRadial.

Definition at line 189 of file GModelSpatialRadialProfile.cpp.

References cache_index(), gammalib::is_infinite(), gammalib::is_notanumber(), and m_profile.

GSkyDir GModelSpatialRadialProfile::mc ( const GEnergy energy,
const GTime time,
GRan ran 
) const
virtual

Return MC sky direction.

Parameters
[in]energyPhoton energy.
[in]timePhoton arrival time.
[in,out]ranRandom number generator.
Returns
Sky direction.

Draws an arbitrary sky direction from the radial profile using a rejection method.

Implements GModelSpatialRadial.

Definition at line 231 of file GModelSpatialRadialProfile.cpp.

References cache_index(), GModelSpatialRadial::dir(), m_profile, gammalib::rad2deg, GSkyDir::rotate_deg(), theta_max(), theta_min(), and GRan::uniform().

Referenced by cache_index().

int GModelSpatialRadialProfile::num_nodes ( void  ) const
inline

Return number of nodes.

Returns
Number of nodes.

Returns the number of nodes in the radial profile.

Definition at line 119 of file GModelSpatialRadialProfile.hpp.

References m_num_nodes.

void GModelSpatialRadialProfile::num_nodes ( const int &  number)
inline

Set number of nodes.

Parameters
[in]numberNumber of nodes.

Sets the number of nodes in the radial profile.

Definition at line 133 of file GModelSpatialRadialProfile.hpp.

References m_num_nodes, and gammalib::number().

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

Assignment operator.

Parameters
[in]modelRadial profile model.
Returns
Radial profile model.

Assigns radial profile model.

Definition at line 146 of file GModelSpatialRadialProfile.cpp.

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

Referenced by GModelSpatialRadialProfileGauss::operator=(), GModelSpatialRadialProfileDMEinasto::operator=(), GModelSpatialRadialProfileDMZhao::operator=(), and GModelSpatialRadialProfileDMBurkert::operator=().

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

Print content of object.

Parameters
[in]chatterChattiness (defaults to NORMAL).
Returns
String containing the content of the object.

Formats the content in a standard way and puts this content in a C++ string that is returned.

Implements GModelSpatialRadial.

Implemented in GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, and GModelSpatialRadialProfileGauss.

virtual double GModelSpatialRadialProfile::profile_value ( const double &  theta) const
protectedpure virtual
void GModelSpatialRadialProfile::set_region ( void  ) const
protectedvirtual
virtual double GModelSpatialRadialProfile::theta_max ( void  ) const
pure virtual
virtual double GModelSpatialRadialProfile::theta_min ( void  ) const
pure virtual

Member Data Documentation

bool GModelSpatialRadialProfile::m_coord_indep
protected

True if model independent of sky coordinates.

Definition at line 94 of file GModelSpatialRadialProfile.hpp.

Referenced by cache_index(), copy_members(), GModelSpatialRadialProfileGauss::init_members(), and init_members().

int GModelSpatialRadialProfile::m_num_nodes
protected

Number of profile nodes.

Definition at line 95 of file GModelSpatialRadialProfile.hpp.

Referenced by cache_index(), copy_members(), init_members(), and num_nodes().

std::vector<profile> GModelSpatialRadialProfile::m_profile
mutableprotected

Pre-computation cache.

Definition at line 107 of file GModelSpatialRadialProfile.hpp.

Referenced by cache_index(), copy_members(), eval(), init_members(), and mc().


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