GammaLib
2.1.0.dev
|
Abstract elliptical spatial model base class. More...
#include <GModelSpatialElliptical.hpp>
Public Member Functions | |
GModelSpatialElliptical (void) | |
Void constructor. More... | |
GModelSpatialElliptical (const GModelSpatialElliptical &model) | |
Copy constructor. More... | |
GModelSpatialElliptical (const GXmlElement &xml) | |
XML constructor. More... | |
virtual | ~GModelSpatialElliptical (void) |
Destructor. More... | |
virtual GModelSpatialElliptical & | operator= (const GModelSpatialElliptical &model) |
Assignment operator. More... | |
virtual void | clear (void)=0 |
Clear object. More... | |
virtual GModelSpatialElliptical * | clone (void) const =0 |
Clones object. More... | |
virtual std::string | classname (void) const =0 |
Return class name. More... | |
virtual double | eval (const double &theta, const double &posangle, 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 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 elliptical 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 GSkyDir & | dir (void) const |
Return position of elliptical spatial model. More... | |
void | dir (const GSkyDir &dir) |
Set position of radial spatial model. More... | |
double | posangle (void) const |
Return Position Angle of model. More... | |
void | posangle (const double &posangle) |
Set Position Angle of model. More... | |
double | semiminor (void) const |
Return semi-minor axis of ellipse. More... | |
double | semimajor (void) const |
Return semi-major axis of ellipse. More... | |
void | semiminor (const double &semiminor) |
Set semi-minor axis of ellipse. More... | |
void | semimajor (const double &semimajor) |
Set semi-major axis of ellipse. 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 GModelSpatial & | operator= (const GModelSpatial &model) |
Assignment operator. More... | |
virtual GModelPar & | operator[] (const int &index) |
Returns model parameter. More... | |
virtual const GModelPar & | operator[] (const int &index) const |
Returns model parameter (const version) More... | |
virtual GModelPar & | operator[] (const std::string &name) |
Returns model parameter. More... | |
virtual const GModelPar & | operator[] (const std::string &name) const |
Returns model parameter (const version) More... | |
virtual double | flux (const GSkyRegion ®ion, 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... | |
GModelPar & | at (const int &index) |
Returns model parameter. More... | |
const GModelPar & | at (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 GSkyRegion * | region (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 GModelSpatialElliptical &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... | |
GModelPar | m_posangle |
Position angle from North, counterclockwise (deg) More... | |
GModelPar | m_semiminor |
Semi-minor axis of ellipse (deg) More... | |
GModelPar | m_semimajor |
Semi-major axis of ellipse (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... | |
Abstract elliptical spatial model base class.
This class defines the interface for an elliptical model as spatial component of the factorized source model. Typical examples of elliptical components are elliptical Disk, Gaussian or Shell shaped sources.
Definition at line 55 of file GModelSpatialElliptical.hpp.
GModelSpatialElliptical::GModelSpatialElliptical | ( | void | ) |
Void constructor.
Definition at line 54 of file GModelSpatialElliptical.cpp.
References init_members().
GModelSpatialElliptical::GModelSpatialElliptical | ( | const GModelSpatialElliptical & | model | ) |
Copy constructor.
[in] | model | Elliptical spatial model. |
Definition at line 91 of file GModelSpatialElliptical.cpp.
References copy_members(), and init_members().
|
explicit |
XML constructor.
[in] | xml | XML element. |
Constructs an elliptical spatial model component 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 GModelSpatialElliptical.cpp.
References init_members(), and read().
|
virtual |
|
pure virtual |
Return class name.
Returns the class name for non-abstract classes in a human readable way.
Implements GModelSpatial.
Implemented in GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
|
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 GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
|
pure virtual |
Clones object.
Creates a deep copy of the object and returns a pointer to the object.
Implements GModelSpatial.
Implemented in GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
|
inlinevirtual |
Return class code.
Returns the code GModelSpatialElliptical of the class.
Implements GModelSpatial.
Definition at line 133 of file GModelSpatialElliptical.hpp.
References GMODEL_SPATIAL_ELLIPTICAL.
|
pure virtual |
Implements GModelSpatial.
Implemented in GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
|
inline |
Return coordinate system.
Returns "CEL" for a celestial coordinate system and "GAL" for a Galactic coordinate system.
Definition at line 258 of file GModelSpatialElliptical.hpp.
References is_celestial().
|
protected |
Copy class members.
[in] | model | Radial spatial model. |
Definition at line 441 of file GModelSpatialElliptical.cpp.
References m_dir, m_last_lat, m_last_lon, m_lat, m_lon, GModelSpatial::m_pars, m_posangle, m_semimajor, and m_semiminor.
Referenced by GModelSpatialElliptical(), and operator=().
const GSkyDir & GModelSpatialElliptical::dir | ( | void | ) | const |
Return position of elliptical spatial model.
Returns the sky direction of the elliptical spatial model.
Definition at line 305 of file GModelSpatialElliptical.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 GModelSpatialEllipticalDisk::contains(), GModelSpatialEllipticalGauss::contains(), GModelSpatialEllipticalGeneralGauss::contains(), eval(), GModelSpatialEllipticalDisk::GModelSpatialEllipticalDisk(), GModelSpatialEllipticalGauss::GModelSpatialEllipticalGauss(), GModelSpatialEllipticalGeneralGauss::GModelSpatialEllipticalGeneralGauss(), GCOMResponse::irf_elliptical(), GResponse::irf_elliptical(), GCTAResponseCube::irf_elliptical(), GCTAResponseIrf::irf_elliptical(), GModelSpatialEllipticalDisk::mc(), GModelSpatialEllipticalGauss::mc(), GModelSpatialEllipticalGeneralGauss::mc(), mc_norm(), GCTAResponseIrf::nroi_elliptical(), GModelSpatialEllipticalDisk::set_region(), GModelSpatialEllipticalGauss::set_region(), and GModelSpatialEllipticalGeneralGauss::set_region().
void GModelSpatialElliptical::dir | ( | const GSkyDir & | dir | ) |
Set position of radial spatial model.
[in] | dir | Sky direction of radial spatial model. |
Sets the sky direction of the radial spatial model.
Definition at line 341 of file GModelSpatialElliptical.cpp.
References GSkyDir::b_deg(), GSkyDir::dec_deg(), is_celestial(), GSkyDir::l_deg(), m_lat, m_lon, GSkyDir::ra_deg(), and GOptimizerPar::value().
|
virtual |
Return model value.
[in] | photon | Incident Photon. |
[in] | gradients | Compute gradients? |
Evaluates the elliptical 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 173 of file GModelSpatialElliptical.cpp.
References GPhoton::dir(), dir(), GSkyDir::dist(), GPhoton::energy(), eval(), GSkyDir::posang(), and GPhoton::time().
|
protected |
Delete class members.
Definition at line 471 of file GModelSpatialElliptical.cpp.
Referenced by GModelSpatialEllipticalDisk::clear(), GModelSpatialEllipticalGauss::clear(), GModelSpatialEllipticalGeneralGauss::clear(), operator=(), and ~GModelSpatialElliptical().
|
protected |
Initialise class members.
Definition at line 367 of file GModelSpatialElliptical.cpp.
References GSkyDir::clear(), GOptimizerPar::clear(), GOptimizerPar::fix(), GOptimizerPar::free(), GOptimizerPar::gradient(), GOptimizerPar::has_grad(), m_dir, m_last_lat, m_last_lon, m_lat, m_lon, GModelSpatial::m_pars, m_posangle, m_semimajor, m_semiminor, GOptimizerPar::min(), GOptimizerPar::name(), GOptimizerPar::scale(), GOptimizerPar::unit(), and GOptimizerPar::value().
Referenced by GModelSpatialEllipticalDisk::clear(), GModelSpatialEllipticalGauss::clear(), GModelSpatialEllipticalGeneralGauss::clear(), GModelSpatialElliptical(), and operator=().
|
inlineprotected |
Check if model holds celestial coordinates.
Definition at line 270 of file GModelSpatialElliptical.hpp.
References m_lon, and GOptimizerPar::name().
Referenced by coordsys(), and dir().
|
pure virtual |
Implements GModelSpatial.
Implemented in GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
|
inlinevirtual |
Return normalization of elliptical source for Monte Carlo simulations.
[in] | dir | Centre of simulation cone. |
[in] | radius | Radius of simulation cone (degrees). |
Returns the normalization for an elliptical source within a circular region. The normalization is 1 if the elliptical source falls within the circle define by dir
and radius
, 0 otherwise.
Implements GModelSpatial.
Definition at line 241 of file GModelSpatialElliptical.hpp.
References dir(), GSkyDir::dist_deg(), norm(), and theta_max().
|
virtual |
Assignment operator.
[in] | model | Elliptical spatial model. |
Definition at line 130 of file GModelSpatialElliptical.cpp.
References copy_members(), free_members(), init_members(), and GModelSpatial::operator=().
Referenced by GModelSpatialEllipticalDisk::operator=(), GModelSpatialEllipticalGauss::operator=(), and GModelSpatialEllipticalGeneralGauss::operator=().
|
inline |
Return Position Angle of model.
Returns the Position Angle of model in degrees, measured counterclockwise from celestial North.
Definition at line 148 of file GModelSpatialElliptical.hpp.
References m_posangle, and GOptimizerPar::value().
Referenced by GModelSpatialEllipticalGauss::eval(), GModelSpatialEllipticalGeneralGauss::eval(), cta_irf_elliptical_kern_omega::eval(), cta_nroi_elliptical_kern_omega::eval(), cta_psf_elliptical_kern_omega::eval(), GModelSpatialEllipticalDisk::GModelSpatialEllipticalDisk(), GModelSpatialEllipticalGauss::GModelSpatialEllipticalGauss(), GModelSpatialEllipticalGeneralGauss::GModelSpatialEllipticalGeneralGauss(), GCTAResponseIrf::irf_elliptical(), GModelSpatialEllipticalGauss::mc(), GCTAResponseIrf::nroi_elliptical(), GCTAResponseCube::psf_elliptical(), GModelSpatialEllipticalGauss::update(), and GModelSpatialEllipticalGeneralGauss::update().
|
inline |
Set Position Angle of model.
[in] | posangle | Position Angle of model (degrees). |
Sets the Position Angle of model in degrees, measured counterclockwise from celestial North.
Definition at line 163 of file GModelSpatialElliptical.hpp.
References m_posangle, and GOptimizerPar::value().
|
pure virtual |
Print content of object.
[in] | chatter | Chattiness (defaults to NORMAL). |
Formats the content in a standard way and puts this content in a C++ string that is returned.
Implements GModelSpatial.
Implemented in GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
|
virtual |
Read model from XML element.
[in] | xml | XML element. |
Reads the elliptical 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"/> <parameter name="PA" scale="1" value="45.0" min="-360" max="360" 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"/> <parameter name="PA" scale="1" value="45.0" min="-360" max="360" free="1"/> ... </spatialModel>
Implements GModelSpatial.
Reimplemented in GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
Definition at line 214 of file GModelSpatialElliptical.cpp.
References G_READ, m_lat, m_lon, m_posangle, GOptimizerPar::name(), GModelPar::read(), gammalib::xml_get_par(), and gammalib::xml_has_par().
Referenced by GModelSpatialElliptical(), GModelSpatialEllipticalDisk::read(), GModelSpatialEllipticalGauss::read(), and GModelSpatialEllipticalGeneralGauss::read().
|
inline |
Return semi-major axis of ellipse.
Returns the semi-major axis of the ellipse in degrees.
Definition at line 207 of file GModelSpatialElliptical.hpp.
References m_semimajor, and GOptimizerPar::value().
Referenced by cta_irf_elliptical_kern_omega::eval(), cta_nroi_elliptical_kern_omega::eval(), cta_psf_elliptical_kern_omega::eval(), GModelSpatialEllipticalDisk::GModelSpatialEllipticalDisk(), GModelSpatialEllipticalGauss::GModelSpatialEllipticalGauss(), GModelSpatialEllipticalGeneralGauss::GModelSpatialEllipticalGeneralGauss(), GCTAResponseIrf::irf_elliptical(), GModelSpatialEllipticalDisk::mc(), GModelSpatialEllipticalGauss::mc(), GCTAResponseIrf::nroi_elliptical(), GCTAResponseCube::psf_elliptical(), GModelSpatialEllipticalDisk::set_region(), GModelSpatialEllipticalGauss::set_region(), GModelSpatialEllipticalGeneralGauss::set_region(), GModelSpatialEllipticalDisk::theta_max(), GModelSpatialEllipticalGauss::theta_max(), GModelSpatialEllipticalGeneralGauss::theta_max(), GModelSpatialEllipticalDisk::update(), GModelSpatialEllipticalGauss::update(), and GModelSpatialEllipticalGeneralGauss::update().
|
inline |
Set semi-major axis of ellipse.
[in] | semimajor | Semi-major axis of ellipse (degrees) |
Sets the semi-major axis of the ellipse in degrees.
Definition at line 221 of file GModelSpatialElliptical.hpp.
References m_semimajor, and GOptimizerPar::value().
|
inline |
Return semi-minor axis of ellipse.
Returns the semi-minor axis of the ellipse in degrees.
Definition at line 178 of file GModelSpatialElliptical.hpp.
References m_semiminor, and GOptimizerPar::value().
Referenced by cta_irf_elliptical_kern_omega::eval(), cta_nroi_elliptical_kern_omega::eval(), cta_psf_elliptical_kern_omega::eval(), GModelSpatialEllipticalDisk::GModelSpatialEllipticalDisk(), GModelSpatialEllipticalGauss::GModelSpatialEllipticalGauss(), GModelSpatialEllipticalGeneralGauss::GModelSpatialEllipticalGeneralGauss(), GCTAResponseIrf::irf_elliptical(), GModelSpatialEllipticalGauss::mc(), GCTAResponseIrf::nroi_elliptical(), GCTAResponseCube::psf_elliptical(), GModelSpatialEllipticalDisk::set_region(), GModelSpatialEllipticalGauss::set_region(), GModelSpatialEllipticalGeneralGauss::set_region(), GModelSpatialEllipticalDisk::theta_max(), GModelSpatialEllipticalGauss::theta_max(), GModelSpatialEllipticalGeneralGauss::theta_max(), GModelSpatialEllipticalDisk::update(), GModelSpatialEllipticalGauss::update(), and GModelSpatialEllipticalGeneralGauss::update().
|
inline |
Set semi-minor axis of ellipse.
[in] | semiminor | Semi-minor axis of ellipse (degrees) |
Sets the semi-minor axis of the ellipse in degrees.
Definition at line 192 of file GModelSpatialElliptical.hpp.
References m_semiminor, and GOptimizerPar::value().
|
protectedpure virtual |
Implements GModelSpatial.
Implemented in GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
|
pure virtual |
Implemented in GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
Referenced by GCOMResponse::irf_elliptical(), GResponse::irf_elliptical(), GCTAResponseIrf::irf_elliptical(), mc_norm(), GCTAResponseIrf::nroi_elliptical(), and GCTAResponseCube::psf_elliptical().
|
virtual |
Write model into XML element.
[in] | xml | XML element into which model information is written. |
Depending on the coordinate system, write the elliptical 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" /> <parameter name="PA" scale="1" value="45.0" min="-360" max="360" free="1" /> ... </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" /> <parameter name="PA" scale="1" value="45.0" min="-360" max="360" free="1" /> ... </spatialModel>
Implements GModelSpatial.
Reimplemented in GModelSpatialEllipticalGeneralGauss, GModelSpatialEllipticalGauss, and GModelSpatialEllipticalDisk.
Definition at line 278 of file GModelSpatialElliptical.cpp.
References G_WRITE, m_lat, m_lon, m_posangle, GOptimizerPar::name(), GModelSpatial::type(), GModelPar::write(), gammalib::xml_check_type(), and gammalib::xml_need_par().
Referenced by GModelSpatialEllipticalDisk::write(), GModelSpatialEllipticalGauss::write(), and GModelSpatialEllipticalGeneralGauss::write().
|
mutableprotected |
Sky direction representing parameters.
Definition at line 119 of file GModelSpatialElliptical.hpp.
Referenced by copy_members(), dir(), and init_members().
|
mutableprotected |
Last latitude.
Definition at line 121 of file GModelSpatialElliptical.hpp.
Referenced by copy_members(), dir(), and init_members().
|
mutableprotected |
Last longitude.
Definition at line 120 of file GModelSpatialElliptical.hpp.
Referenced by copy_members(), dir(), and init_members().
|
protected |
Declination or Galactic latitude (deg)
Definition at line 113 of file GModelSpatialElliptical.hpp.
Referenced by copy_members(), dir(), GModelSpatialEllipticalDisk::GModelSpatialEllipticalDisk(), GModelSpatialEllipticalGauss::GModelSpatialEllipticalGauss(), GModelSpatialEllipticalGeneralGauss::GModelSpatialEllipticalGeneralGauss(), init_members(), read(), and write().
|
protected |
Right Ascension or Galactic longitude (deg)
Definition at line 112 of file GModelSpatialElliptical.hpp.
Referenced by copy_members(), dir(), GModelSpatialEllipticalDisk::GModelSpatialEllipticalDisk(), GModelSpatialEllipticalGauss::GModelSpatialEllipticalGauss(), GModelSpatialEllipticalGeneralGauss::GModelSpatialEllipticalGeneralGauss(), init_members(), is_celestial(), read(), and write().
|
protected |
Position angle from North, counterclockwise (deg)
Definition at line 114 of file GModelSpatialElliptical.hpp.
Referenced by copy_members(), GModelSpatialEllipticalDisk::eval(), init_members(), posangle(), read(), and write().
|
protected |
Semi-major axis of ellipse (deg)
Definition at line 116 of file GModelSpatialElliptical.hpp.
Referenced by copy_members(), init_members(), GModelSpatialEllipticalDisk::read(), GModelSpatialEllipticalGauss::read(), GModelSpatialEllipticalGeneralGauss::read(), semimajor(), GModelSpatialEllipticalDisk::write(), GModelSpatialEllipticalGauss::write(), and GModelSpatialEllipticalGeneralGauss::write().
|
protected |
Semi-minor axis of ellipse (deg)
Definition at line 115 of file GModelSpatialElliptical.hpp.
Referenced by copy_members(), init_members(), GModelSpatialEllipticalDisk::read(), GModelSpatialEllipticalGauss::read(), GModelSpatialEllipticalGeneralGauss::read(), semiminor(), GModelSpatialEllipticalDisk::write(), GModelSpatialEllipticalGauss::write(), and GModelSpatialEllipticalGeneralGauss::write().