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

Abstract spatial model base class. More...

#include <GModelSpatial.hpp>

Inheritance diagram for GModelSpatial:
GBase GModelSpatialComposite GModelSpatialDiffuse GModelSpatialElliptical GModelSpatialPointSource GModelSpatialRadial GModelSpatialDiffuseConst GModelSpatialDiffuseCube GModelSpatialDiffuseMap GModelSpatialEllipticalDisk GModelSpatialEllipticalGauss GModelSpatialRadialDisk GModelSpatialRadialGauss GModelSpatialRadialProfile GModelSpatialRadialShell

Classes

class  circle_int_kern_omega
 
class  circle_int_kern_rho
 

Public Member Functions

 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 void clear (void)=0
 Clear object. More...
 
virtual GModelSpatialclone (void) const =0
 Clones object. More...
 
virtual std::string classname (void) const =0
 Return class name. More...
 
virtual std::string type (void) const =0
 
virtual GClassCode code (void) const =0
 
virtual double eval (const GPhoton &photon, const bool &gradients=false) const =0
 
virtual GSkyDir mc (const GEnergy &energy, const GTime &time, GRan &ran) const =0
 
virtual double mc_norm (const GSkyDir &dir, const double &radius) const =0
 
virtual bool contains (const GSkyDir &dir, const double &margin=0.0) const =0
 
virtual void read (const GXmlElement &xml)=0
 
virtual void write (GXmlElement &xml) const =0
 
virtual GSkyRegionregion (void) const =0
 
virtual std::string print (const GChatter &chatter=NORMAL) const =0
 Print content of object. 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...
 
double flux (const GSkyRegion *reg, const GEnergy &srcEng=GEnergy(), const GTime &srcTime=GTime()) const
 Returns model flux integrated in circular 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 GModelSpatial &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

std::vector< GModelPar * > m_pars
 Parameter pointers. More...
 

Detailed Description

Abstract spatial model base class.

This class implements the spatial component of the factorized gamma-ray source model. The spatial component is given by

\[ S_{\rm p}(\vec{p} | E, t) \]

where

  • \(\vec{p}\) is the true photon arrival direction,
  • \(E\) is the true photon energy, and
  • \(t\) is the true photon arrival time.

The spatial component describes the energy and time dependent morphology of the source. It satisfies

\[ \int_{\Omega} S_{\rm p}(\vec{p} | E, t) d\Omega = 1 \]

for all \(E\) and \(t\), hence the spatial component does not impact the spatially integrated spectral and temporal properties of the source.

Definition at line 75 of file GModelSpatial.hpp.

Constructor & Destructor Documentation

GModelSpatial::GModelSpatial ( void  )

Void constructor.

Definition at line 59 of file GModelSpatial.cpp.

References init_members().

GModelSpatial::GModelSpatial ( const GModelSpatial model)

Copy constructor.

Parameters
[in]modelSpatial model.

Definition at line 74 of file GModelSpatial.cpp.

References copy_members(), and init_members().

GModelSpatial::~GModelSpatial ( void  )
virtual

Destructor.

Definition at line 90 of file GModelSpatial.cpp.

References free_members().

Member Function Documentation

GModelPar & GModelSpatial::at ( const int &  index)

Returns model parameter.

Parameters
[in]indexParameter index [0,...,size()-1].
Returns
Model parameter.
Exceptions
GException::out_of_rangeParameter index is out of range.

Returns model parameter with index range checking.

Definition at line 212 of file GModelSpatial.cpp.

References G_AT, m_pars, and size().

const GModelPar & GModelSpatial::at ( const int &  index) const

Returns model parameter (const version)

Parameters
[in]indexParameter index [0,...,size()-1].
Returns
Model parameter.
Exceptions
GException::out_of_rangeParameter index is out of range.

Returns model parameter with index range checking.

Definition at line 235 of file GModelSpatial.cpp.

References G_AT, m_pars, and size().

void GModelSpatial::autoscale ( void  )

Autoscale parameters.

Sets the scale factors for all parameters so that the values are unity.

Definition at line 302 of file GModelSpatial.cpp.

References m_pars.

Referenced by GModelSpatialDiffuseConst::GModelSpatialDiffuseConst(), and GModelSpatialDiffuseCube::GModelSpatialDiffuseCube().

virtual void GModelSpatial::clear ( void  )
pure virtual
void GModelSpatial::copy_members ( const GModelSpatial model)
protected

Copy class members.

Parameters
[in]modelSpatial model.

Definition at line 455 of file GModelSpatial.cpp.

References m_pars.

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

double GModelSpatial::flux ( const GSkyRegion reg,
const GEnergy srcEng = GEnergy(),
const GTime srcTime = GTime() 
) const

Returns model flux integrated in circular sky region.

Parameters
[in]regSky region.
[in]srcEngEnergy.
[in]srcTimeTime.
Returns
Flux (adimensional or ph/cm2/s).
Exceptions
GException::feature_not_implementedRegions are not circular.

Computes

\[ \int_{\rho_{\rm min}}^{\rho_{\rm max}} \sin \rho \times \int_{\omega} M(\rho, \omega | E, t) d\omega d\rho \]

where \(M(\rho, \omega | E, t)\) is the spatial model, \(\rho\) is the distance from the region centre, and \(\omega\) is the position angle with respect to the connecting line between the region centre and the direction on the sky.

Definition at line 340 of file GModelSpatial.cpp.

References GSkyRegionCircle::centre(), cos(), gammalib::deg2rad, GSkyDir::dist(), G_FLUX, GSkyRegion::overlaps(), GSkyRegionCircle::radius(), region(), GIntegral::romberg(), and sin().

Referenced by GModelSpatial::circle_int_kern_rho::eval(), GModelSpatialDiffuseMap::prepare_map(), GModelSpatialDiffuseMap::set_mc_cone(), and GModelSpatialDiffuseCube::set_mc_cone().

bool GModelSpatial::has_free_pars ( void  ) const

Checks if the spatial model has free parameters.

Returns
True if spatial model has free parameters.

Definition at line 279 of file GModelSpatial.cpp.

References m_pars, and size().

Referenced by GCTAResponse::irf(), and GCTAResponseIrf::nroi().

bool GModelSpatial::has_par ( const std::string &  name) const

Checks if parameter name exists.

Parameters
[in]nameParameter name.
Returns
True if parameter with specified name exists.

Searches all parameter names for a match with the specified name. If the specified name has been found, true is returned.

Definition at line 256 of file GModelSpatial.cpp.

References m_pars, and size().

virtual double GModelSpatial::mc_norm ( const GSkyDir dir,
const double &  radius 
) const
pure virtual
GModelSpatial & GModelSpatial::operator= ( const GModelSpatial model)
virtual

Assignment operator.

Parameters
[in]modelSpatial model.
Returns
Spatial model.

Definition at line 112 of file GModelSpatial.cpp.

References copy_members(), free_members(), and init_members().

Referenced by GModelSpatialComposite::operator=(), GModelSpatialDiffuse::operator=(), GModelSpatialPointSource::operator=(), GModelSpatialElliptical::operator=(), and GModelSpatialRadial::operator=().

GModelPar & GModelSpatial::operator[] ( const int &  index)
inlinevirtual

Returns model parameter.

Parameters
[in]indexParameter index [0,...,size()-1].
Returns
Model parameter.

Returns model parameter without index range checking.

Definition at line 196 of file GModelSpatial.hpp.

References m_pars.

const GModelPar & GModelSpatial::operator[] ( const int &  index) const
inlinevirtual

Returns model parameter (const version)

Parameters
[in]indexParameter index [0,...,size()-1].
Returns
Model parameter.

Returns model parameter without index range checking.

Definition at line 211 of file GModelSpatial.hpp.

References m_pars.

GModelPar & GModelSpatial::operator[] ( const std::string &  name)
virtual

Returns model parameter.

Parameters
[in]nameParameter name.
Returns
Model parameter reference.
Exceptions
GException::par_not_foundParameter with specified name not found in container.

Returns reference to the model parameter of specified name.

Definition at line 144 of file GModelSpatial.cpp.

References G_ACCESS, m_pars, and size().

const GModelPar & GModelSpatial::operator[] ( const std::string &  name) const
virtual

Returns model parameter (const version)

Parameters
[in]nameParameter name.
Returns
Model parameter reference.
Exceptions
GException::par_not_foundParameter with specified name not found in container.

Returns reference to the model parameter of specified name.

Definition at line 175 of file GModelSpatial.cpp.

References G_ACCESS, m_pars, and size().

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

Member Data Documentation

std::vector<GModelPar*> GModelSpatial::m_pars
protected

Parameter pointers.

Definition at line 183 of file GModelSpatial.hpp.

Referenced by GModelSpatialComposite::append(), at(), autoscale(), GModelSpatialRadialProfile::cache_index(), GModelSpatialDiffuseConst::copy_members(), GModelSpatialComposite::copy_members(), GModelSpatialPointSource::copy_members(), GModelSpatialRadial::copy_members(), GModelSpatialDiffuseMap::copy_members(), GModelSpatialElliptical::copy_members(), GModelSpatialDiffuseCube::copy_members(), copy_members(), has_free_pars(), has_par(), GModelSpatialRadialProfileGauss::init_members(), GModelSpatialRadialProfileDMBurkert::init_members(), GModelSpatialRadialProfileDMEinasto::init_members(), GModelSpatialDiffuseConst::init_members(), GModelSpatialRadialDisk::init_members(), GModelSpatialRadialGauss::init_members(), GModelSpatialRadialProfileDMZhao::init_members(), GModelSpatialComposite::init_members(), GModelSpatialPointSource::init_members(), GModelSpatialRadial::init_members(), GModelSpatialDiffuseMap::init_members(), GModelSpatialRadialShell::init_members(), GModelSpatialElliptical::init_members(), GModelSpatialDiffuseCube::init_members(), init_members(), operator[](), GModelSpatialRadialProfileGauss::print(), GModelSpatialRadialProfileDMEinasto::print(), GModelSpatialRadialProfileDMBurkert::print(), GModelSpatialRadialProfileDMZhao::print(), GModelSpatialComposite::print(), GModelSpatialDiffuseConst::print(), GModelSpatialRadialDisk::print(), GModelSpatialPointSource::print(), GModelSpatialRadialGauss::print(), GModelSpatialEllipticalDisk::print(), GModelSpatialEllipticalGauss::print(), GModelSpatialDiffuseMap::print(), GModelSpatialRadialShell::print(), GModelSpatialDiffuseCube::print(), and size().


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