GammaLib
2.0.0
|
Interface for the circular sky region class. More...
#include <GSkyRegionCircle.hpp>
Public Member Functions | |
GSkyRegionCircle (void) | |
Void constructor. More... | |
GSkyRegionCircle (const GSkyDir ¢re, const double &radius) | |
Direction constructor. More... | |
GSkyRegionCircle (const double &ra, const double &dec, const double &radius) | |
Direction constructor. More... | |
GSkyRegionCircle (const std::string &line) | |
String constructor. More... | |
GSkyRegionCircle (const GSkyRegionCircle ®ion) | |
Copy constructor. More... | |
virtual | ~GSkyRegionCircle (void) |
Destructor. More... | |
GSkyRegionCircle & | operator= (const GSkyRegionCircle ®ion) |
Assignment operator. More... | |
void | clear (void) |
Clear instance. More... | |
GSkyRegionCircle * | clone (void) const |
Clone circular sky region. More... | |
std::string | classname (void) const |
Return class name. More... | |
const double & | radius (void) const |
Return circular region radius (in degrees) More... | |
void | radius (const double &radius) |
Set radius of circular region. More... | |
const GSkyDir & | centre (void) const |
Return circular region centre. More... | |
void | centre (const GSkyDir ¢re) |
Set circular region centre. More... | |
void | centre (const double &ra, const double &dec) |
Set circular region centre Right Ascension and Declincation. More... | |
double | ra (void) const |
Return circular region centre Right Ascension. More... | |
double | dec (void) const |
Return circular region centre Declination. More... | |
void | read (const std::string &line) |
Read region from DS9 string. More... | |
std::string | write (void) const |
Write region into a string. More... | |
bool | contains (const GSkyDir &dir) const |
Checks if sky direction lies within region. More... | |
bool | contains (const GSkyRegion ®) const |
Checks if region is fully contained within this region. More... | |
bool | overlaps (const GSkyRegion ®) const |
Checks if region is overlapping with this region. More... | |
std::string | print (const GChatter &chatter=NORMAL) const |
Print circular region. More... | |
Public Member Functions inherited from GSkyRegion | |
GSkyRegion (void) | |
Void constructor. More... | |
GSkyRegion (const GSkyRegion ®ion) | |
Copy constructor. More... | |
virtual | ~GSkyRegion (void) |
Destructor. More... | |
virtual GSkyRegion & | operator= (const GSkyRegion ®ion) |
Assignment operator. More... | |
const std::string & | type (void) const |
Return region type. More... | |
const std::string & | name (void) const |
Return region name. More... | |
const double & | solidangle (void) const |
Return solid angle of region. More... | |
void | type (const std::string &type) |
Set region type. More... | |
void | name (const std::string &name) |
Set region name. More... | |
void | solidangle (const double &solidangle) |
Set solid angle of 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 GSkyRegionCircle ®ion) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | compute_solid_angle (void) |
Compute solid angle. More... | |
Protected Member Functions inherited from GSkyRegion | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GSkyRegion ®ion) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Attributes | |
GSkyDir | m_centre |
Centre or reference point of the region. More... | |
double | m_radius |
Radius of circular the region (degrees) More... | |
Protected Attributes inherited from GSkyRegion | |
std::string | m_type |
Type of the region (circle, rectangle,...) More... | |
std::string | m_name |
Name of the region. More... | |
double | m_solid |
Solid angle subtended by the region (sr) More... | |
Friends | |
bool | operator== (const GSkyRegionCircle &a, const GSkyRegionCircle &b) |
Equality operator. More... | |
bool | operator!= (const GSkyRegionCircle &a, const GSkyRegionCircle &b) |
Non equality operator. More... | |
Interface for the circular sky region class.
This class provides an implementation for a circular sky region. The sky region is defined by an array of parameters, the meaning of which is specific to the derived class where the region type or shape is defined. The parameters are GModelPar objects for convenience.
The class holds several properties such as solid angle subtended by the region and computed through internal method compute_solid().
To be clarified:
Definition at line 58 of file GSkyRegionCircle.hpp.
GSkyRegionCircle::GSkyRegionCircle | ( | void | ) |
Void constructor.
Definition at line 60 of file GSkyRegionCircle.cpp.
References init_members().
Referenced by clone().
GSkyRegionCircle::GSkyRegionCircle | ( | const GSkyDir & | centre, |
const double & | radius | ||
) |
Direction constructor.
[in] | centre | Centre sky direction. |
[in] | radius | Region radius (degrees). |
Definition at line 76 of file GSkyRegionCircle.cpp.
References centre(), compute_solid_angle(), init_members(), and radius().
GSkyRegionCircle::GSkyRegionCircle | ( | const double & | ra, |
const double & | dec, | ||
const double & | radius | ||
) |
Direction constructor.
[in] | ra | Right Ascension of region centre (degrees). |
[in] | dec | Declination of region centre (degrees). |
[in] | radius | Region radius (degrees). |
Definition at line 101 of file GSkyRegionCircle.cpp.
References centre(), compute_solid_angle(), init_members(), and radius().
|
explicit |
String constructor.
[in] | line | DS9 region file line. |
Constructs region from a DS9 region file line.
Definition at line 127 of file GSkyRegionCircle.cpp.
References init_members(), and read().
GSkyRegionCircle::GSkyRegionCircle | ( | const GSkyRegionCircle & | region | ) |
Copy constructor.
[in] | region | Circular sky region. |
Definition at line 146 of file GSkyRegionCircle.cpp.
References copy_members(), and init_members().
|
virtual |
|
inline |
Return circular region centre.
Returns the region centre.
Definition at line 141 of file GSkyRegionCircle.hpp.
References m_centre.
Referenced by GSkyRegionMap::contains(), GModelSpatialDiffuseMap::contains(), GModelSpatialDiffuseCube::contains(), contains(), GSkyRegionRectangle::contains(), GModelSpatial::flux(), GSkyRegionCircle(), GModelSpatialDiffuseMap::mc(), GModelSpatialDiffuseCube::mc(), GModelSpatialDiffuseMap::mc_cone(), GModelSpatialDiffuseCube::mc_cone(), overlaps(), GSkyRegionRectangle::overlaps(), GSkyMap::overlaps_circle(), GModelSpatialDiffuseMap::print(), read(), and GSkyRegionMap::set_region_circle().
|
inline |
Set circular region centre.
[in] | dir | Region centre. |
Sets the centre of the circular region to the specified sky direction.
Definition at line 155 of file GSkyRegionCircle.hpp.
References m_centre.
|
inline |
Set circular region centre Right Ascension and Declincation.
[in] | ra | Right Ascension [deg]. |
[in] | dec | Declination [deg]. |
Sets the centre of the circular region to the specified Right Ascension and Declination.
Definition at line 175 of file GSkyRegionCircle.hpp.
References m_centre, and GSkyDir::radec_deg().
|
inlinevirtual |
Return class name.
Implements GSkyRegion.
Definition at line 113 of file GSkyRegionCircle.hpp.
|
virtual |
Clear instance.
Implements GSkyRegion.
Definition at line 218 of file GSkyRegionCircle.cpp.
References GSkyRegion::free_members(), free_members(), GSkyRegion::init_members(), and init_members().
Referenced by GModelSpatialDiffuseMap::init_members(), GModelSpatialDiffuseCube::init_members(), GModelSpatial::init_members(), GModelSpatialDiffuseCube::load_cube(), GModelSpatialDiffuseMap::prepare_map(), and read().
|
virtual |
Clone circular sky region.
Implements GSkyRegion.
Definition at line 238 of file GSkyRegionCircle.cpp.
References GSkyRegionCircle().
|
protected |
Compute solid angle.
Definition at line 724 of file GSkyRegionCircle.cpp.
References cos(), gammalib::deg2rad, m_radius, GSkyRegion::m_solid, and gammalib::twopi.
Referenced by GSkyRegionCircle(), radius(), and read().
|
virtual |
Checks if sky direction lies within region.
[in] | dir | Sky direction. |
A sky direction lies within a region when its distance to the region centre is not larger than the region radius.
Implements GSkyRegion.
Definition at line 502 of file GSkyRegionCircle.cpp.
References GSkyDir::dist_deg(), m_centre, and radius().
Referenced by contains(), and GSkyMap::overlaps_circle().
|
virtual |
Checks if region is fully contained within this region.
[in] | reg | Sky region. |
GException::feature_not_implemented | Regions differ in type. |
Implements GSkyRegion.
Definition at line 528 of file GSkyRegionCircle.cpp.
References centre(), contains(), GSkyRegionRectangle::corner(), GSkyDir::dist_deg(), G_CONTAINS, m_centre, m_radius, GSkyRegionMap::map(), GSkyRegionMap::nonzero_indices(), radius(), and GSkyRegion::type().
|
protected |
Copy class members.
[in] | region | Circular sky region. |
Definition at line 700 of file GSkyRegionCircle.cpp.
References m_centre, and m_radius.
Referenced by GSkyRegionCircle(), and operator=().
|
inline |
Return circular region centre Declination.
Returns the region centre Declination in degrees.
Definition at line 207 of file GSkyRegionCircle.hpp.
References GSkyDir::dec_deg(), and m_centre.
Referenced by print(), and GSkyRegionMap::set_region_circle().
|
protected |
Delete class members.
Definition at line 714 of file GSkyRegionCircle.cpp.
Referenced by clear(), operator=(), and ~GSkyRegionCircle().
|
protected |
Initialise class members.
Definition at line 683 of file GSkyRegionCircle.cpp.
References m_centre, m_radius, and GSkyRegion::m_type.
Referenced by clear(), GSkyRegionCircle(), and operator=().
GSkyRegionCircle & GSkyRegionCircle::operator= | ( | const GSkyRegionCircle & | region | ) |
Assignment operator.
[in] | region | Circular sky region. |
Definition at line 185 of file GSkyRegionCircle.cpp.
References copy_members(), free_members(), init_members(), and GSkyRegion::operator=().
|
virtual |
Checks if region is overlapping with this region.
[in] | reg | Sky region. |
GException::feature_not_implemented | Regions differ in type. |
Implements GSkyRegion.
Definition at line 617 of file GSkyRegionCircle.cpp.
References centre(), GSkyDir::dist_deg(), G_CONTAINS, m_centre, m_radius, GSkyRegionMap::overlaps(), GSkyRegionRectangle::overlaps(), radius(), and GSkyRegion::type().
Print circular region.
[in] | chatter | Chattiness |
Implements GSkyRegion.
Definition at line 468 of file GSkyRegionCircle.cpp.
References dec(), gammalib::parformat(), ra(), radius(), SILENT, and gammalib::str().
|
inline |
Return circular region centre Right Ascension.
Returns the region centre Right Ascension in degrees.
Definition at line 193 of file GSkyRegionCircle.hpp.
References m_centre, and GSkyDir::ra_deg().
Referenced by print(), and GSkyRegionMap::set_region_circle().
|
inline |
Return circular region radius (in degrees)
Returns the region radius in degrees.
Definition at line 127 of file GSkyRegionCircle.hpp.
References m_radius.
Referenced by GCTAOnOffObservation::arf_rad_max(), GSkyRegionMap::contains(), GModelSpatialDiffuseMap::contains(), GModelSpatialDiffuseCube::contains(), contains(), GSkyRegionRectangle::contains(), GModelSpatial::flux(), GSkyRegionCircle(), GModelSpatialDiffuseMap::mc_cone(), GModelSpatialDiffuseCube::mc_cone(), overlaps(), GSkyRegionRectangle::overlaps(), GModelSpatialDiffuseMap::print(), print(), radius(), read(), and GSkyRegionMap::set_region_circle().
void GSkyRegionCircle::radius | ( | const double & | radius | ) |
Set radius of circular region.
[in] | radius | Radius (degrees). |
GException::invalid_argument | Radius value is less than 0. |
Sets the radius of the circular sky region. Only non-negative radii are allowed.
Definition at line 256 of file GSkyRegionCircle.cpp.
References compute_solid_angle(), G_RADIUS, m_radius, radius(), and gammalib::str().
|
virtual |
Read region from DS9 string.
[in] | line | String in DS9 format. |
GException::invalid_value | Invalid value found in DS9 format string. |
Implements GSkyRegion.
Definition at line 286 of file GSkyRegionCircle.cpp.
References centre(), clear(), compute_solid_angle(), gammalib::contains(), G_READ, GSkyDir::lb_deg(), GSkyRegion::m_name, GSkyDir::radec_deg(), radius(), gammalib::split(), gammalib::str(), and gammalib::todouble().
Referenced by GSkyRegionCircle(), and GSkyRegions::load().
|
virtual |
Write region into a string.
Writes a DS9 region into a string. The region name is only written if it is defined.
Implements GSkyRegion.
Definition at line 435 of file GSkyRegionCircle.cpp.
References GSkyDir::dec_deg(), m_centre, GSkyRegion::m_name, m_radius, GSkyDir::ra_deg(), and gammalib::str().
|
friend |
Non equality operator.
[in] | a | First sky region circle. |
[in] | b | Second sky region circle. |
Definition at line 760 of file GSkyRegionCircle.cpp.
|
friend |
Equality operator.
[in] | a | First sky region circle. |
[in] | b | Second sky region circle. |
Returns true if two sky region circles and identical.
Definition at line 746 of file GSkyRegionCircle.cpp.
|
protected |
Centre or reference point of the region.
Definition at line 102 of file GSkyRegionCircle.hpp.
Referenced by centre(), contains(), copy_members(), dec(), init_members(), operator!=(), operator==(), overlaps(), ra(), and write().
|
protected |
Radius of circular the region (degrees)
Definition at line 103 of file GSkyRegionCircle.hpp.
Referenced by compute_solid_angle(), contains(), copy_members(), init_members(), operator!=(), operator==(), overlaps(), radius(), and write().