GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTARoi Class Reference

Interface for the CTA region of interest class. More...

#include <GCTARoi.hpp>

Inheritance diagram for GCTARoi:
GRoi GBase

Public Member Functions

 GCTARoi (void)
 Void constructor. More...
 
 GCTARoi (const GXmlElement &xml)
 XML element constructor. More...
 
 GCTARoi (const GCTAInstDir &centre, const double &radius)
 Region of interest constructor. More...
 
 GCTARoi (const GCTARoi &roi)
 Copy constructor. More...
 
virtual ~GCTARoi (void)
 Destructor. More...
 
GCTARoioperator= (const GCTARoi &roi)
 Assignment operator. More...
 
virtual void clear (void)
 Clear instance. More...
 
virtual GCTARoiclone (void) const
 Clone instance. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual bool contains (const GEvent &event) const
 Check if region of interest contains an event. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print ROI information. More...
 
bool is_valid (void) const
 Checks if RoI is valid. More...
 
bool contains (const GCTAInstDir &dir) const
 Check if region of interest contains an instrument direction. More...
 
const GCTAInstDircentre (void) const
 Returns region of interest centre. More...
 
const double & radius (void) const
 Returns radius of region of interest in degrees. More...
 
void centre (const GCTAInstDir &centre)
 Set region of interest centre. More...
 
void radius (const double &radius)
 Set radius of region of interest. More...
 
void read (const GXmlElement &xml)
 Read region of interest from XML element. More...
 
void write (GXmlElement &xml) const
 Write region of interest into XML element. More...
 
- Public Member Functions inherited from GRoi
 GRoi (void)
 Void constructor. More...
 
 GRoi (const GRoi &roi)
 Copy constructor. More...
 
virtual ~GRoi (void)
 Destructor. More...
 
virtual GRoioperator= (const GRoi &roi)
 Assignment operator. 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 GCTARoi &roi)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
- Protected Member Functions inherited from GRoi
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GRoi &roi)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 

Protected Attributes

GCTAInstDir m_centre
 Centre of ROI in instrument coordinates. More...
 
double m_radius
 Radius of ROI in degrees. More...
 

Detailed Description

Interface for the CTA region of interest class.

The CTA region of interest class defines the region of photon arrival directions that is used for unbinned data analysis. A circular ROI has been implemented.

Definition at line 49 of file GCTARoi.hpp.

Constructor & Destructor Documentation

GCTARoi::GCTARoi ( void  )

Void constructor.

Definition at line 58 of file GCTARoi.cpp.

References init_members().

Referenced by clone().

GCTARoi::GCTARoi ( const GXmlElement xml)
explicit

XML element constructor.

Parameters
[in]xmlXML element.

Constructs region of interest from an XML element.

Definition at line 75 of file GCTARoi.cpp.

References init_members(), and read().

GCTARoi::GCTARoi ( const GCTAInstDir centre,
const double &  radius 
)

Region of interest constructor.

Parameters
[in]centreRegion of interest centre.
[in]radiusRadius of region of interest (degrees).

Definition at line 94 of file GCTARoi.cpp.

References centre(), init_members(), and radius().

GCTARoi::GCTARoi ( const GCTARoi roi)

Copy constructor.

Parameters
[in]roiRegion of interest.

Definition at line 113 of file GCTARoi.cpp.

References copy_members(), and init_members().

GCTARoi::~GCTARoi ( void  )
virtual

Destructor.

Definition at line 129 of file GCTARoi.cpp.

References free_members().

Member Function Documentation

const GCTAInstDir & GCTARoi::centre ( void  ) const
inline
void GCTARoi::centre ( const GCTAInstDir centre)
inline

Set region of interest centre.

Parameters
[in]centreRegion of interest centre sky direction.

Set the sky direction of the region of interest centre.

Definition at line 139 of file GCTARoi.hpp.

References centre(), and m_centre.

std::string GCTARoi::classname ( void  ) const
inlinevirtual

Return class name.

Returns
String containing the class name ("GCTARoi").

Implements GRoi.

Definition at line 97 of file GCTARoi.hpp.

void GCTARoi::clear ( void  )
virtual

Clear instance.

Implements GRoi.

Definition at line 184 of file GCTARoi.cpp.

References GRoi::free_members(), free_members(), GRoi::init_members(), and init_members().

Referenced by GCTAEventList::init_members(), and read().

GCTARoi * GCTARoi::clone ( void  ) const
virtual

Clone instance.

Returns
Pointer to deep copy of region of interest

Implements GRoi.

Definition at line 204 of file GCTARoi.cpp.

References GCTARoi().

bool GCTARoi::contains ( const GEvent event) const
virtual

Check if region of interest contains an event.

Returns
True if region of interest contains event, false otherwise

Implements GRoi.

Definition at line 215 of file GCTARoi.cpp.

Referenced by contains(), GCTACubeBackground::fill(), and GCTAModelSpatial::mc().

bool GCTARoi::contains ( const GCTAInstDir dir) const

Check if region of interest contains an instrument direction.

Returns
True if region of interest contains instrument direction, false otherwise

Definition at line 240 of file GCTARoi.cpp.

References contains(), GCTAInstDir::dir(), m_centre, and m_radius.

void GCTARoi::copy_members ( const GCTARoi roi)
protected

Copy class members.

Parameters
[in]roiRegion of interest from which members should be copied.

Definition at line 413 of file GCTARoi.cpp.

References m_centre, and m_radius.

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

void GCTARoi::free_members ( void  )
protected

Delete class members.

Definition at line 427 of file GCTARoi.cpp.

Referenced by clear(), operator=(), and ~GCTARoi().

void GCTARoi::init_members ( void  )
protected

Initialise class members.

Definition at line 397 of file GCTARoi.cpp.

References GCTAInstDir::clear(), m_centre, and m_radius.

Referenced by clear(), GCTARoi(), and operator=().

bool GCTARoi::is_valid ( void  ) const
inline

Checks if RoI is valid.

Returns
Bool flag if ROI information is valid.

Definition at line 152 of file GCTARoi.hpp.

References m_radius.

Referenced by GCTACubeBackground::fill(), GCTACubeExposure::fill_cube(), GCTACubePsf::fill_cube(), GCTACubeEdisp::fill_cube(), and GCTAEventList::write_ds_keys().

GCTARoi & GCTARoi::operator= ( const GCTARoi roi)

Assignment operator.

Parameters
[in]roiRegion of interest.
Returns
Region of interest.

Definition at line 151 of file GCTARoi.cpp.

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

std::string GCTARoi::print ( const GChatter chatter = NORMAL) const
virtual

Print ROI information.

Parameters
[in]chatterChattiness.
Returns
String containing ROI information.

Implements GRoi.

Definition at line 338 of file GCTARoi.cpp.

References m_centre, m_radius, gammalib::parformat(), GCTAInstDir::print(), SILENT, and gammalib::str().

const double & GCTARoi::radius ( void  ) const
inline
void GCTARoi::radius ( const double &  radius)

Set radius of region of interest.

Parameters
[in]radiusRegion of interest radius (degrees).
Exceptions
GException::invalid_argumentNon-positive ROI radius encountered

Set the radius of the region of interest.

Definition at line 371 of file GCTARoi.cpp.

References G_RADIUS, m_radius, radius(), and gammalib::str().

void GCTARoi::read ( const GXmlElement xml)

Read region of interest from XML element.

Parameters
[in]xmlXML element.
Exceptions
GException::invalid_valueInvalid XML format encountered.

Read region of interest from an XML element. The format of the region of interest is

<parameter name="RegionOfInterest" ra="..." dec="..." rad="..."/>

The units are deg.

Definition at line 265 of file GCTARoi.cpp.

References GXmlElement::attribute(), centre(), clear(), G_READ, GXmlElement::has_attribute(), radius(), gammalib::todouble(), and gammalib::xml_get_par().

Referenced by GCTARoi(), and GCTAObservation::read().

void GCTARoi::write ( GXmlElement xml) const

Write region of interest into XML element.

Parameters
[in]xmlXML element.

Writes region of interest into an XML element. The format of the region of interest is

<parameter name="RegionOfInterest" ra="..." dec="..." rad="..."/>

The units are deg.

This method does nothing if the region of interest is not valid (signaled by a radius of 0 deg).

Definition at line 312 of file GCTARoi.cpp.

References GXmlElement::attribute(), GCTAInstDir::dir(), G_WRITE, m_centre, m_radius, gammalib::str(), and gammalib::xml_need_par().

Member Data Documentation

GCTAInstDir GCTARoi::m_centre
protected

Centre of ROI in instrument coordinates.

Definition at line 86 of file GCTARoi.hpp.

Referenced by centre(), contains(), copy_members(), init_members(), print(), and write().

double GCTARoi::m_radius
protected

Radius of ROI in degrees.

Definition at line 87 of file GCTARoi.hpp.

Referenced by contains(), copy_members(), init_members(), is_valid(), print(), radius(), and write().


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