GammaLib  1.7.0.dev
 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 GModelSpatialRadialProfile 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 std::string type (void) const =0
 
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 GSkyRegionregion (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 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...
 
double ra (void) const
 Return Right Ascencion of model centre. More...
 
double dec (void) const
 Return Declination of model centre. More...
 
void ra (const double &ra)
 Set Right Ascencion of model centre. More...
 
void dec (const double &dec)
 Set Declination of model centre. More...
 
GSkyDir dir (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...
 
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 GModelSpatialRadial &model)
 Copy class members. More...
 
void free_members (void)
 Delete class members. 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

GModelPar m_ra
 Right Ascension (deg) More...
 
GModelPar m_dec
 Declination (deg) More...
 
- Protected Attributes inherited from GModelSpatial
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 52 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

Return class name.

Returns
String containing the class name.

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

Implements GModelSpatial.

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

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, GModelSpatialRadialGauss, GModelSpatialRadialDisk, GModelSpatialRadialProfile, GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, and GModelSpatialRadialProfileGauss.

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

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

GClassCode GModelSpatialRadial::code ( void  ) const
inlinevirtual

Return class code.

Returns
GModelSpatialRadial.

Returns the code GModelSpatialRadial of the class.

Implements GModelSpatial.

Definition at line 118 of file GModelSpatialRadial.hpp.

References GMODEL_SPATIAL_RADIAL.

virtual bool GModelSpatialRadial::contains ( const GSkyDir dir,
const double &  margin = 0.0 
) const
pure virtual
void GModelSpatialRadial::copy_members ( const GModelSpatialRadial model)
protected

Copy class members.

Parameters
[in]modelRadial spatial model.

Definition at line 383 of file GModelSpatialRadial.cpp.

References m_dec, GModelSpatial::m_pars, and m_ra.

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

double GModelSpatialRadial::dec ( void  ) const
inline

Return Declination of model centre.

Returns
Declination of model centre (degrees).

Returns the Declination of the model centre in degrees.

Definition at line 161 of file GModelSpatialRadial.hpp.

References m_dec, and GOptimizerPar::value().

Referenced by dir(), GCTAResponseIrf::nroi_radial(), read(), and write().

void GModelSpatialRadial::dec ( const double &  dec)
inline

Set Declination of model centre.

Parameters
[in]decDeclination (degrees).

Sets the Declination of the model centre in degrees.

Definition at line 175 of file GModelSpatialRadial.hpp.

References m_dec, and GOptimizerPar::value().

void GModelSpatialRadial::dir ( const GSkyDir dir)

Set position of radial spatial model.

Definition at line 328 of file GModelSpatialRadial.cpp.

References GSkyDir::dec_deg(), m_dec, m_ra, GSkyDir::ra_deg(), and GOptimizerPar::value().

virtual double GModelSpatialRadial::eval ( const double &  theta,
const GEnergy energy,
const GTime time,
const bool &  gradients = false 
) const
pure virtual
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().

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 194 of file GModelSpatialRadial.hpp.

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

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

Assignment operator.

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

Definition at line 131 of file GModelSpatialRadial.cpp.

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

Referenced by GModelSpatialRadialProfile::operator=(), GModelSpatialRadialDisk::operator=(), GModelSpatialRadialGauss::operator=(), and GModelSpatialRadialShell::operator=().

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, GModelSpatialRadialGauss, GModelSpatialRadialDisk, GModelSpatialRadialProfileDMBurkert, GModelSpatialRadialProfileDMEinasto, GModelSpatialRadialProfileDMZhao, GModelSpatialRadialProfileGauss, and GModelSpatialRadialProfile.

double GModelSpatialRadial::ra ( void  ) const
inline

Return Right Ascencion of model centre.

Returns
Right Ascencion of model centre (degrees).

Returns the Right Ascension of the model centre in degrees.

Definition at line 132 of file GModelSpatialRadial.hpp.

References m_ra, and GOptimizerPar::value().

Referenced by dir(), GCTAResponseIrf::nroi_radial(), read(), and write().

void GModelSpatialRadial::ra ( const double &  ra)
inline

Set Right Ascencion of model centre.

Parameters
[in]raRight Ascension (degrees).

Sets the Right Ascension of the model centre in degrees.

Definition at line 146 of file GModelSpatialRadial.hpp.

References m_ra, and GOptimizerPar::value().

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.63" min="-360" max="360" free="1"/>
  <parameter name="DEC" scale="1" value="22.01" min="-90"  max="90"  free="1"/>
  ...
</spatialModel>

or

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

Implements GModelSpatial.

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

Definition at line 216 of file GModelSpatialRadial.cpp.

References dec(), GSkyDir::dec_deg(), dir(), G_READ, GSkyDir::lb_deg(), m_dec, m_ra, GOptimizerPar::name(), ra(), GSkyDir::ra_deg(), GModelPar::read(), GOptimizerPar::value(), gammalib::xml_get_par(), and gammalib::xml_has_par().

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

virtual GSkyRegion* GModelSpatialRadial::region ( void  ) const
pure virtual
void GModelSpatialRadial::write ( GXmlElement xml) const
virtual

Write model into XML element.

Parameters
[in]xmlXML element into which model information is written.
Exceptions
GException::model_invalid_spatialExisting XML element is not of type 'GaussFunction'
GException::model_invalid_parnumInvalid number of model parameters found in XML element.
GException::model_invalid_parnamesInvalid model parameter names found in XML element.

Writes the radial source location and position angle information into an XML element in the following format

<spatialModel type="...">
  <parameter name="RA"  scale="1" value="83.63" min="-360" max="360" free="1"/>
  <parameter name="DEC" scale="1" value="22.01" min="-90"  max="90"  free="1"/>
  ...
</spatialModel>
Todo:
The case that an existing spatial XML element with "GLON" and "GLAT" as coordinates is not supported.

Implements GModelSpatial.

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

Definition at line 283 of file GModelSpatialRadial.cpp.

References GXmlElement::attribute(), dec(), G_WRITE, m_dec, m_ra, GOptimizerPar::name(), ra(), type(), GModelPar::write(), and gammalib::xml_need_par().

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

Member Data Documentation


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