GammaLib  2.0.0
 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 GModelSpatialEllipticalGeneralGauss GModelSpatialRadialDisk GModelSpatialRadialGauss GModelSpatialRadialGeneralGauss GModelSpatialRadialProfile GModelSpatialRadialRing 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 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 std::string print (const GChatter &chatter=NORMAL) const =0
 Print content of object. More...
 
virtual double flux (const GSkyRegion &region, const GEnergy &srcEng=GEnergy(), const GTime &srcTime=GTime()) const
 Returns model flux integrated in circular 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 GModelSpatial &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
virtual void set_region (void) const =0
 

Protected Attributes

std::string m_type
 Spatial model type. More...
 
GSkyRegionCircle m_region
 Bounding circle. More...
 
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()[.
Returns
Model parameter.
Exceptions
GException::out_of_rangeParameter index is out of range.

Returns model parameter with index range checking.

Definition at line 216 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()[.
Returns
Model parameter.
Exceptions
GException::out_of_rangeParameter index is out of range.

Returns model parameter with index range checking.

Definition at line 239 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 306 of file GModelSpatial.cpp.

References m_pars.

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

void GModelSpatial::copy_members ( const GModelSpatial model)
protected

Copy class members.

Parameters
[in]modelSpatial model.

Definition at line 447 of file GModelSpatial.cpp.

References m_pars, m_region, and m_type.

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

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

Returns model flux integrated in circular sky region.

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

Reimplemented in GModelSpatialDiffuseCube, GModelSpatialPointSource, GModelSpatialDiffuseMap, GModelSpatialDiffuseConst, and GModelSpatialComposite.

Definition at line 344 of file GModelSpatial.cpp.

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

Referenced by GModelSky::eflux(), GModelSpatial::circle_int_kern_rho::eval(), GModelSpatial::circle_int_kern_omega::eval(), GModelSky::flux_kern::eval(), and GModelSky::flux().

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 283 of file GModelSpatial.cpp.

References m_pars, and size().

Referenced by GCTAResponseCube::irf_spatial(), GResponse::irf_spatial(), 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 260 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=(), GModelSpatialRadial::operator=(), GModelSpatialElliptical::operator=(), and GModelSpatialPointSource::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 231 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 246 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::invalid_argumentParameter with specified name not found.

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::invalid_argumentParameter with specified name not found.

Returns reference to the model parameter of specified name.

Definition at line 177 of file GModelSpatial.cpp.

References G_ACCESS, m_pars, and size().

virtual std::string GModelSpatial::print ( const GChatter chatter = NORMAL) const
pure virtual
void GModelSpatial::type ( const std::string &  type)
inline

Set model type.

Parameters
[in]typeModel type.

Set the type of the spatial model.

Definition at line 215 of file GModelSpatial.hpp.

References m_type, and type().

Member Data Documentation

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

Parameter pointers.

Definition at line 189 of file GModelSpatial.hpp.

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

std::string GModelSpatial::m_type
protected

Spatial model type.

Definition at line 187 of file GModelSpatial.hpp.

Referenced by GModelSpatialRadialProfileGauss::copy_members(), GModelSpatialRadialProfileDMBurkert::copy_members(), GModelSpatialRadialProfileDMEinasto::copy_members(), GModelSpatialRadialProfileDMZhao::copy_members(), GModelSpatialDiffuseConst::copy_members(), GModelSpatialEllipticalDisk::copy_members(), GModelSpatialRadialGauss::copy_members(), GModelSpatialEllipticalGauss::copy_members(), GModelSpatialRadialDisk::copy_members(), GModelSpatialComposite::copy_members(), GModelSpatialRadialGeneralGauss::copy_members(), GModelSpatialRadialRing::copy_members(), GModelSpatialEllipticalGeneralGauss::copy_members(), GModelSpatialDiffuseMap::copy_members(), GModelSpatialPointSource::copy_members(), GModelSpatialRadialShell::copy_members(), GModelSpatialDiffuseCube::copy_members(), copy_members(), GModelSpatialComposite::GModelSpatialComposite(), GModelSpatialDiffuseConst::GModelSpatialDiffuseConst(), GModelSpatialDiffuseCube::GModelSpatialDiffuseCube(), GModelSpatialDiffuseMap::GModelSpatialDiffuseMap(), GModelSpatialEllipticalGauss::GModelSpatialEllipticalGauss(), GModelSpatialPointSource::GModelSpatialPointSource(), GModelSpatialRadialDisk::GModelSpatialRadialDisk(), GModelSpatialRadialGauss::GModelSpatialRadialGauss(), GModelSpatialRadialShell::GModelSpatialRadialShell(), GModelSpatialRadialProfileGauss::init_members(), GModelSpatialRadialProfileDMBurkert::init_members(), GModelSpatialRadialProfileDMEinasto::init_members(), GModelSpatialRadialProfileDMZhao::init_members(), GModelSpatialDiffuseConst::init_members(), GModelSpatialEllipticalDisk::init_members(), GModelSpatialRadialGauss::init_members(), GModelSpatialEllipticalGauss::init_members(), GModelSpatialRadialDisk::init_members(), GModelSpatialComposite::init_members(), GModelSpatialRadialGeneralGauss::init_members(), GModelSpatialRadialRing::init_members(), GModelSpatialEllipticalGeneralGauss::init_members(), GModelSpatialDiffuseMap::init_members(), GModelSpatialPointSource::init_members(), GModelSpatialRadialShell::init_members(), GModelSpatialDiffuseCube::init_members(), init_members(), and type().


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