GammaLib 2.2.0.dev
Loading...
Searching...
No Matches
GCOSEventList Class Reference

COSI event list class. More...

#include <GCOSEventList.hpp>

Inheritance diagram for GCOSEventList:
GEventList GEvents GBase

Public Member Functions

 GCOSEventList (void)
 Void constructor.
 
 GCOSEventList (const GFilename &filename)
 File name constructor.
 
 GCOSEventList (const GCOSEventList &list)
 Copy constructor.
 
virtual ~GCOSEventList (void)
 Destructor.
 
virtual GCOSEventListoperator= (const GCOSEventList &list)
 Assignment operator.
 
virtual GCOSEventAtomoperator[] (const int &index)
 COSI event atom access operator.
 
virtual const GCOSEventAtomoperator[] (const int &index) const
 COSI event atom access operator.
 
virtual void clear (void)
 Clear COSI event list.
 
virtual GCOSEventListclone (void) const
 Clone event list.
 
virtual std::string classname (void) const
 Return class name.
 
virtual int size (void) const
 Return number of events in list.
 
virtual void load (const GFilename &filename)
 Load COSI events from FITS file.
 
virtual void save (const GFilename &filename, const bool &clobber=false) const
 Save COSI events.
 
virtual void read (const GFits &fits)
 Read COSI events from FITS file.
 
virtual void write (GFits &fits) const
 Write COSI event list into FITS file.
 
virtual double number (void) const
 Return number of events in list.
 
virtual void roi (const GRoi &roi)
 Set region of interest.
 
virtual const GCOSRoiroi (void) const
 Return Region of Interest.
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print COSI event list information.
 
void append (const GCOSEventAtom &event)
 Append event to event list.
 
void extend (const GCOSEventList &list)
 Extend event list with another event list.
 
void reserve (const int &number)
 Reserves space for events.
 
void remove (const int &index, const int &number=1)
 Remove events from event list.
 
void sort (void)
 Sort events by increasing time.
 
- Public Member Functions inherited from GEventList
 GEventList (void)
 Void constructor.
 
 GEventList (const GEventList &list)
 Copy constructor.
 
virtual ~GEventList (void)
 Destructor.
 
virtual GEventListoperator= (const GEventList &list)
 Assignment operator.
 
- Public Member Functions inherited from GEvents
 GEvents (void)
 Void constructor.
 
 GEvents (const GEvents &events)
 Copy constructor.
 
virtual ~GEvents (void)
 Destructor.
 
virtual GEventsoperator= (const GEvents &events)
 Assignment operator.
 
void ebounds (const GEbounds &ebounds)
 Set energy boundaries.
 
void gti (const GGti &gti)
 Set Good Time Intervals.
 
const GEboundsebounds (void) const
 Return energy boundaries.
 
const GGtigti (void) const
 Return Good Time Intervals.
 
const GTimetstart (void) const
 Return start time.
 
const GTimetstop (void) const
 Return stop time.
 
const GEnergyemin (void) const
 Return minimum energy.
 
const GEnergyemax (void) const
 Return maximum energy.
 
- Public Member Functions inherited from GBase
virtual ~GBase (void)
 Destructor.
 

Protected Member Functions

void init_members (void)
 Initialise class members.
 
void copy_members (const GCOSEventList &list)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
virtual void set_energies (void)
 Set energies.
 
virtual void set_times (void)
 Set times.
 
- Protected Member Functions inherited from GEventList
void init_members (void)
 Initialise class members.
 
void copy_members (const GEventList &list)
 Copy class members.
 
void free_members (void)
 Delete class members.
 
- Protected Member Functions inherited from GEvents
void init_members (void)
 Initialise class members.
 
void copy_members (const GEvents &events)
 Copy class members.
 
void free_members (void)
 Delete class members.
 

Protected Attributes

GCOSRoi m_roi
 Region of interest.
 
std::vector< GCOSEventAtomm_events
 Events.
 
- Protected Attributes inherited from GEvents
GEbounds m_ebounds
 Energy boundaries covered by events.
 
GGti m_gti
 Good time intervals covered by events.
 

Detailed Description

COSI event list class.

Definition at line 50 of file GCOSEventList.hpp.

Constructor & Destructor Documentation

◆ GCOSEventList() [1/3]

GCOSEventList::GCOSEventList ( void )

Void constructor.

Creates an empty COSI event list.

Definition at line 63 of file GCOSEventList.cpp.

References init_members().

Referenced by clone().

◆ GCOSEventList() [2/3]

GCOSEventList::GCOSEventList ( const GFilename & filename)
explicit

File name constructor.

Parameters
[in]filenameCOSI event list filename.

Construct COSI event list object by loading the events from a FITS file.

Definition at line 81 of file GCOSEventList.cpp.

References init_members(), and load().

◆ GCOSEventList() [3/3]

GCOSEventList::GCOSEventList ( const GCOSEventList & list)

Copy constructor.

Parameters
[in]listCOSI event list.

Definition at line 99 of file GCOSEventList.cpp.

References copy_members(), and init_members().

◆ ~GCOSEventList()

GCOSEventList::~GCOSEventList ( void )
virtual

Destructor.

Definition at line 115 of file GCOSEventList.cpp.

References free_members().

Member Function Documentation

◆ append()

void GCOSEventList::append ( const GCOSEventAtom & event)

Append event to event list.

Parameters
[in]eventEvent.

Appends an event to the end of the event list.

Definition at line 567 of file GCOSEventList.cpp.

References m_events.

◆ classname()

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

Return class name.

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

Implements GEventList.

Definition at line 106 of file GCOSEventList.hpp.

◆ clear()

void GCOSEventList::clear ( void )
virtual

Clear COSI event list.

Clears COSI event list by resetting all class members to an initial state. Any information that was present before will be lost.

Implements GEventList.

Definition at line 223 of file GCOSEventList.cpp.

References free_members(), GEventList::free_members(), GEvents::free_members(), init_members(), GEventList::init_members(), and GEvents::init_members().

Referenced by read().

◆ clone()

GCOSEventList * GCOSEventList::clone ( void ) const
virtual

Clone event list.

Returns
Pointer to deep copy of COSI event list.

Implements GEventList.

Definition at line 245 of file GCOSEventList.cpp.

References GCOSEventList().

◆ copy_members()

void GCOSEventList::copy_members ( const GCOSEventList & list)
protected

Copy class members.

Parameters
[in]listCOSI event list.

Definition at line 732 of file GCOSEventList.cpp.

References m_events, and m_roi.

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

◆ extend()

void GCOSEventList::extend ( const GCOSEventList & list)

Extend event list with another event list.

Parameters
[in]listEvent list.

Extend event list with another event list. All events of list are appended after the existing events. If a sorted event list is required then call the sort() method after this method.

Definition at line 586 of file GCOSEventList.cpp.

References m_events, reserve(), and size().

◆ free_members()

void GCOSEventList::free_members ( void )
protected

Delete class members.

Definition at line 746 of file GCOSEventList.cpp.

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

◆ init_members()

void GCOSEventList::init_members ( void )
protected

Initialise class members.

Definition at line 716 of file GCOSEventList.cpp.

References GCOSRoi::clear(), m_events, and m_roi.

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

◆ load()

void GCOSEventList::load ( const GFilename & filename)
virtual

Load COSI events from FITS file.

Parameters
[in]filenameCOSI event list FITS file name.

Loads COSI events from a FITS file into the event list.

Implements GEventList.

Definition at line 258 of file GCOSEventList.cpp.

References GFits::close(), and read().

Referenced by GCOSEventList().

◆ number()

double GCOSEventList::number ( void ) const
inlinevirtual

Return number of events in list.

Returns
Number of events in list.

Implements GEventList.

Definition at line 130 of file GCOSEventList.hpp.

References m_events.

Referenced by print(), remove(), and reserve().

◆ operator=()

GCOSEventList & GCOSEventList::operator= ( const GCOSEventList & list)
virtual

Assignment operator.

Parameters
[in]listCOSI event list.
Returns
COSI event list.

Definition at line 137 of file GCOSEventList.cpp.

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

◆ operator[]() [1/2]

GCOSEventAtom * GCOSEventList::operator[] ( const int & index)
virtual

COSI event atom access operator.

Parameters
[in]indexEvent index [0,...,size()-1].
Returns
Pointer to COSI event atom.
Exceptions
GException::out_of_rangeEvent index outside valid range.

Returns pointer to a COSI event atom.

Implements GEventList.

Definition at line 172 of file GCOSEventList.cpp.

References G_OPERATOR, m_events, and size().

◆ operator[]() [2/2]

const GCOSEventAtom * GCOSEventList::operator[] ( const int & index) const
virtual

COSI event atom access operator.

Parameters
[in]indexEvent index [0,...,size()-1].
Returns
Pointer to COSI event atom.
Exceptions
GException::out_of_rangeEvent index outside valid range.

Returns pointer to a COSI event atom.

Implements GEventList.

Definition at line 197 of file GCOSEventList.cpp.

References G_OPERATOR, m_events, and size().

◆ print()

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

Print COSI event list information.

Parameters
[in]chatterChattiness.
Returns
String containing COSI event list information.

Implements GEventList.

Definition at line 660 of file GCOSEventList.cpp.

References GEvents::ebounds(), GEvents::emax(), GEvents::emin(), GEvents::gti(), number(), gammalib::parformat(), SILENT, size(), gammalib::str(), GEvents::tstart(), and GEvents::tstop().

◆ read()

void GCOSEventList::read ( const GFits & fits)
virtual

◆ remove()

void GCOSEventList::remove ( const int & index,
const int & number = 1 )

Remove events from event list.

Parameters
[in]indexIndex from which on events should be removed.
[in]numberNumber of event to remove (default: 1).

Removes events from the event list. This method does nothing if index points beyond the event list. The method does also gently accept number arguments where index + number reach beyond the event list. In that case, all events from event index on will be removed.

Definition at line 620 of file GCOSEventList.cpp.

References m_events, number(), and size().

◆ reserve()

void GCOSEventList::reserve ( const int & number)
inline

Reserves space for events.

Parameters
[in]numberNumber of events.

Reserves space for a number events in the event list.

Definition at line 156 of file GCOSEventList.hpp.

References m_events, and number().

Referenced by extend().

◆ roi() [1/2]

void GCOSEventList::roi ( const GRoi & roi)
virtual

Set region of interest.

Parameters
[in]roiRegion of interest.
Exceptions
GException::invalid_argumentSpecified RoI is not a COSI RoI.

Sets the region of interest for the observation.

Implements GEventList.

Definition at line 540 of file GCOSEventList.cpp.

References G_ROI, m_roi, and roi().

◆ roi() [2/2]

const GCOSRoi & GCOSEventList::roi ( void ) const
inlinevirtual

Return Region of Interest.

Returns
Region of Interest.

Implements GEventList.

Definition at line 142 of file GCOSEventList.hpp.

References m_roi.

Referenced by roi().

◆ save()

void GCOSEventList::save ( const GFilename & filename,
const bool & clobber = false ) const
virtual

Save COSI events.

Parameters
[in]filenameCOSI event list FITS file name.
[in]clobberOverwrite existing FITS file?

Save COSI events into a FITS file.

Implements GEventList.

Definition at line 282 of file GCOSEventList.cpp.

References GFits::close(), GFits::saveto(), and write().

◆ set_energies()

void GCOSEventList::set_energies ( void )
inlineprotectedvirtual

Set energies.

Sets energies.

Implements GEventList.

Definition at line 169 of file GCOSEventList.hpp.

◆ set_times()

void GCOSEventList::set_times ( void )
inlineprotectedvirtual

Set times.

Sets times.

Implements GEventList.

Definition at line 181 of file GCOSEventList.hpp.

◆ size()

int GCOSEventList::size ( void ) const
inlinevirtual

Return number of events in list.

Returns
Number of events in list.

Implements GEventList.

Definition at line 118 of file GCOSEventList.hpp.

References m_events.

Referenced by extend(), GCOSEventCube::fill(), operator[](), operator[](), print(), remove(), and write().

◆ sort()

void GCOSEventList::sort ( void )

Sort events by increasing time.

Sorts the events in the event list by increasing time value.

Definition at line 644 of file GCOSEventList.cpp.

References m_events.

◆ write()

void GCOSEventList::write ( GFits & fits) const
virtual

Write COSI event list into FITS file.

Parameters
[in]fitsFITS file.

Write the COSI event list into FITS file.

Implements GEventList.

Definition at line 454 of file GCOSEventList.cpp.

References GFits::append(), GFitsTable::append(), GFitsHDU::card(), gammalib::cos_seconds(), gammalib::deg2rad, GEvents::emax(), GEvents::emin(), GFitsHDU::extname(), gammalib::extname_gti, GEvents::gti(), m_events, m_roi, GCOSRoi::radius(), size(), gammalib::str(), GFitsTableCol::unit(), and GGti::write().

Referenced by save().

Member Data Documentation

◆ m_events

std::vector<GCOSEventAtom> GCOSEventList::m_events
protected

◆ m_roi

GCOSRoi GCOSEventList::m_roi
protected

Region of interest.

Definition at line 95 of file GCOSEventList.hpp.

Referenced by copy_members(), init_members(), read(), roi(), roi(), and write().


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