GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelSpatialRadial Class Referenceabstract

Abstract radial spatial model base class. More...

#include <GModelSpatialRadial.hpp>

Inheritance diagram for GModelSpatialRadial:
GModelSpatial GBase GModelSpatialRadialDisk GModelSpatialRadialGauss GModelSpatialRadialGeneralGauss GModelSpatialRadialProfile GModelSpatialRadialRing GModelSpatialRadialShell GModelSpatialRadialProfileDMBurkert GModelSpatialRadialProfileDMEinasto GModelSpatialRadialProfileDMZhao GModelSpatialRadialProfileGauss

Public Member Functions

 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 void clear (void)=0
 Clear object. More...
 
virtual GModelSpatialRadialclone (void) const =0
 Clones object. More...
 
virtual std::string classname (void) const =0
 Return class name. More...
 
virtual double eval (const double &theta, const GEnergy &energy, const GTime &time, const bool &gradients=false) const =0
 
virtual GSkyDir mc (const GEnergy &energy, const GTime &time, GRan &ran) const =0
 
virtual bool contains (const GSkyDir &dir, const double &margin=0.0) 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 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 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 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...
 
virtual void set_region (void) const =0
 
- 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

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

Abstract radial spatial model base class.

This class defines the interface for a radial model as spatial component of the factorized source model. Typical examples of radial components are axisymmetric Disk, Gaussian or Shell sources.

Definition at line 55 of file GModelSpatialRadial.hpp.

Constructor & Destructor Documentation

GModelSpatialRadial::GModelSpatialRadial ( void  )

Void constructor.

Definition at line 54 of file GModelSpatialRadial.cpp.

References init_members().

GModelSpatialRadial::GModelSpatialRadial ( const GModelSpatialRadial model)

Copy constructor.

Parameters
[in]modelRadial spatial model.

Definition at line 92 of file GModelSpatialRadial.cpp.

References copy_members(), and init_members().

GModelSpatialRadial::GModelSpatialRadial ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML element.

Constructs a radial spatial model by extracting information from an XML element. See the read() method for more information about the expected structure of the XML element.

Definition at line 73 of file GModelSpatialRadial.cpp.

References init_members(), and read().

GModelSpatialRadial::~GModelSpatialRadial ( void  )
virtual

Destructor.

Definition at line 109 of file GModelSpatialRadial.cpp.

References free_members().

Member Function Documentation

virtual std::string GModelSpatialRadial::classname ( void  ) const
pure virtual
virtual void GModelSpatialRadial::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 GModelSpatial.

Implemented in GModelSpatialRadialShell, GModelSpatialRadialDisk, GModelSpatialRadialGeneralGauss, GModelSpatialRadialRing, GModelSpatialRadialGauss, GModelSpatialRadialProfile, GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, and GModelSpatialRadialProfileGauss.

virtual GModelSpatialRadial* GModelSpatialRadial::clone ( void  ) const
pure virtual
GClassCode GModelSpatialRadial::code ( void  ) const
inlinevirtual

Return class code.

Returns
GModelSpatialRadial.

Returns the code GModelSpatialRadial of the class.

Implements GModelSpatial.

Definition at line 125 of file GModelSpatialRadial.hpp.

References GMODEL_SPATIAL_RADIAL.

virtual bool GModelSpatialRadial::contains ( const GSkyDir dir,
const double &  margin = 0.0 
) const
pure virtual
std::string GModelSpatialRadial::coordsys ( void  ) const
inline

Return coordinate system.

Returns
Coordinate system of point source model.

Returns "CEL" for a celestial coordinate system and "GAL" for a Galactic coordinate system.

Definition at line 190 of file GModelSpatialRadial.hpp.

References is_celestial().

Referenced by cta_psf_radial_kerns_delta::cta_psf_radial_kerns_delta().

void GModelSpatialRadial::copy_members ( const GModelSpatialRadial model)
protected

Copy class members.

Parameters
[in]modelRadial spatial model.

Definition at line 399 of file GModelSpatialRadial.cpp.

References m_dir, m_last_lat, m_last_lon, m_lat, m_lon, and GModelSpatial::m_pars.

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

const GSkyDir & GModelSpatialRadial::dir ( void  ) const

Return position of radial spatial model.

Returns
Radial spatial model sky direction.

Returns the sky direction of the radial spatial model.

Definition at line 297 of file GModelSpatialRadial.cpp.

References is_celestial(), GSkyDir::lb_deg(), m_dir, m_last_lat, m_last_lon, m_lat, m_lon, GSkyDir::radec_deg(), and GOptimizerPar::value().

Referenced by GModelSpatialRadialProfile::contains(), GModelSpatialRadialGauss::contains(), GModelSpatialRadialGeneralGauss::contains(), GModelSpatialRadialDisk::contains(), GModelSpatialRadialRing::contains(), GModelSpatialRadialShell::contains(), cta_psf_radial_kerns_delta::cta_psf_radial_kerns_delta(), eval(), GModelSpatialRadialDisk::GModelSpatialRadialDisk(), GModelSpatialRadialGauss::GModelSpatialRadialGauss(), GModelSpatialRadialGeneralGauss::GModelSpatialRadialGeneralGauss(), GModelSpatialRadialProfileGauss::GModelSpatialRadialProfileGauss(), GModelSpatialRadialRing::GModelSpatialRadialRing(), GModelSpatialRadialShell::GModelSpatialRadialShell(), GCOMResponse::irf_radial(), GResponse::irf_radial(), GCTAResponseCube::irf_radial(), GCTAResponseIrf::irf_radial(), GModelSpatialRadialProfile::mc(), GModelSpatialRadialGauss::mc(), GModelSpatialRadialGeneralGauss::mc(), GModelSpatialRadialDisk::mc(), GModelSpatialRadialRing::mc(), GModelSpatialRadialShell::mc(), mc_norm(), GCTAResponseIrf::nroi_radial(), GModelSpatialRadialProfile::set_region(), GModelSpatialRadialGauss::set_region(), GModelSpatialRadialDisk::set_region(), GModelSpatialRadialGeneralGauss::set_region(), GModelSpatialRadialRing::set_region(), and GModelSpatialRadialShell::set_region().

void GModelSpatialRadial::dir ( const GSkyDir dir)

Set position of radial spatial model.

Parameters
[in]dirSky direction of radial spatial model.

Sets the sky direction of the radial spatial model.

Definition at line 333 of file GModelSpatialRadial.cpp.

References GSkyDir::b_deg(), GSkyDir::dec_deg(), is_celestial(), GSkyDir::l_deg(), m_lat, m_lon, GSkyDir::ra_deg(), and GOptimizerPar::value().

double GModelSpatialRadial::eval ( const GPhoton photon,
const bool &  gradients = false 
) const
virtual

Return model value.

Parameters
[in]photonIncident Photon.
[in]gradientsCompute gradients?
Returns
Value of spatial radial model.

Evaluates the radial spatial model value for a specific incident photon.

If the gradients flag is true the method will also compute the parameter gradients for all model parameters.

Implements GModelSpatial.

Definition at line 174 of file GModelSpatialRadial.cpp.

References GPhoton::dir(), dir(), GSkyDir::dist(), GPhoton::energy(), eval(), and GPhoton::time().

bool GModelSpatialRadial::is_celestial ( void  ) const
inlineprotected

Check if model holds celestial coordinates.

Returns
True if model holds celestial coordinates, false otherwise.

Definition at line 202 of file GModelSpatialRadial.hpp.

References m_lon, and GOptimizerPar::name().

Referenced by coordsys(), and dir().

bool GModelSpatialRadial::is_energy_dependent ( void  ) const
inlinevirtual

Signals whether radial model is energy dependent.

Returns
True if radial model is energy dependent, false otherwise.

Signals whether the radial model is energy dependent. This method always returns false.

Definition at line 140 of file GModelSpatialRadial.hpp.

bool GModelSpatialRadial::is_time_dependent ( void  ) const
inlinevirtual

Signals whether radial model is time dependent.

Returns
True if radial model is time dependent, false otherwise.

Signals whether the radial model is time dependent. This method always returns false.

Definition at line 155 of file GModelSpatialRadial.hpp.

virtual GSkyDir GModelSpatialRadial::mc ( const GEnergy energy,
const GTime time,
GRan ran 
) const
pure virtual
double GModelSpatialRadial::mc_norm ( const GSkyDir dir,
const double &  radius 
) const
inlinevirtual

Return normalization of radial source for Monte Carlo simulations.

Parameters
[in]dirCentre of simulation cone.
[in]radiusRadius of simulation cone (degrees).
Returns
Normalization.

Returns the normalization for a radial source within a circular region. The normalization is 1 if the radial source falls within the circle defined by dir and radius, 0 otherwise.

Implements GModelSpatial.

Definition at line 173 of file GModelSpatialRadial.hpp.

References dir(), GSkyDir::dist_deg(), norm(), and theta_max().

virtual std::string GModelSpatialRadial::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 GModelSpatial.

Implemented in GModelSpatialRadialShell, GModelSpatialRadialRing, GModelSpatialRadialDisk, GModelSpatialRadialGeneralGauss, GModelSpatialRadialGauss, GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, GModelSpatialRadialProfileGauss, and GModelSpatialRadialProfile.

void GModelSpatialRadial::read ( const GXmlElement xml)
virtual

Read model from XML element.

Parameters
[in]xmlXML element.
Exceptions
GException::model_invalid_parnumInvalid number of model parameters found in XML element.
GException::model_invalid_parnamesInvalid model parameter names found in XML element.

Reads the radial source location and position angle information from an XML element in the following format

<spatialModel type="...">
  <parameter name="RA"  scale="1" value="83.6331" min="-360" max="360" free="0" />
  <parameter name="DEC" scale="1" value="22.0145" min="-90"  max="90"  free="0" />
  ...
</spatialModel>

or

<spatialModel type="...">
  <parameter name="GLON" scale="1" value="184.5575" min="-360" max="360" free="0" />
  <parameter name="GLAT" scale="1" value="-5.7843"  min="-90"  max="90"  free="0" />
  ...
</spatialModel>

Implements GModelSpatial.

Reimplemented in GModelSpatialRadialShell, GModelSpatialRadialRing, GModelSpatialRadialDisk, GModelSpatialRadialGeneralGauss, GModelSpatialRadialGauss, GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, and GModelSpatialRadialProfileGauss.

Definition at line 216 of file GModelSpatialRadial.cpp.

References G_READ, m_lat, m_lon, GModelPar::read(), gammalib::xml_get_par(), and gammalib::xml_has_par().

Referenced by GModelSpatialRadial(), GModelSpatialRadialProfile::GModelSpatialRadialProfile(), GModelSpatialRadialProfileGauss::read(), GModelSpatialRadialProfileDMZhao::read(), GModelSpatialRadialProfileDMBurkert::read(), GModelSpatialRadialProfileDMEinasto::read(), GModelSpatialRadialGauss::read(), GModelSpatialRadialDisk::read(), GModelSpatialRadialGeneralGauss::read(), GModelSpatialRadialRing::read(), and GModelSpatialRadialShell::read().

virtual void GModelSpatialRadial::set_region ( void  ) const
protectedpure virtual
void GModelSpatialRadial::write ( GXmlElement xml) const
virtual

Write model into XML element.

Parameters
[in]xmlXML element into which model information is written.

Depending on the coordinate system, write the radial source information into an XML element with the following format

<spatialModel type="...">
  <parameter name="RA"  scale="1" value="83.6331" min="-360" max="360" free="0" />
  <parameter name="DEC" scale="1" value="22.0145" min="-90"  max="90"  free="0" />
  ...
</spatialModel>

or

<spatialModel type="PointSource">
  <parameter name="GLON" scale="1" value="184.5575" min="-360" max="360" free="0" />
  <parameter name="GLAT" scale="1" value="-5.7843"  min="-90"  max="90"  free="0" />
  ...
</spatialModel>

Implements GModelSpatial.

Reimplemented in GModelSpatialRadialShell, GModelSpatialRadialRing, GModelSpatialRadialDisk, GModelSpatialRadialGeneralGauss, GModelSpatialRadialGauss, GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, and GModelSpatialRadialProfileGauss.

Definition at line 272 of file GModelSpatialRadial.cpp.

References G_WRITE, m_lat, m_lon, GOptimizerPar::name(), GModelSpatial::type(), GModelPar::write(), gammalib::xml_check_type(), and gammalib::xml_need_par().

Referenced by GModelSpatialRadialProfileGauss::write(), GModelSpatialRadialProfileDMEinasto::write(), GModelSpatialRadialProfileDMBurkert::write(), GModelSpatialRadialProfileDMZhao::write(), GModelSpatialRadialGauss::write(), GModelSpatialRadialDisk::write(), GModelSpatialRadialGeneralGauss::write(), GModelSpatialRadialRing::write(), and GModelSpatialRadialShell::write().

Member Data Documentation

GSkyDir GModelSpatialRadial::m_dir
mutableprotected

Sky direction representing parameters.

Definition at line 111 of file GModelSpatialRadial.hpp.

Referenced by copy_members(), dir(), and init_members().

double GModelSpatialRadial::m_last_lat
mutableprotected

Last latitude.

Definition at line 113 of file GModelSpatialRadial.hpp.

Referenced by copy_members(), dir(), and init_members().

double GModelSpatialRadial::m_last_lon
mutableprotected

Last longitude.

Definition at line 112 of file GModelSpatialRadial.hpp.

Referenced by copy_members(), dir(), and init_members().


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