GammaLib
2.0.0
|
COMPTEL event bin container class. More...
#include <GCOMEventCube.hpp>
Public Member Functions | |
GCOMEventCube (void) | |
Void constructor. More... | |
GCOMEventCube (const GFilename &filename) | |
Load constructor. More... | |
GCOMEventCube (const GCOMDri &dre) | |
DRE constructor. More... | |
GCOMEventCube (const GCOMEventCube &cube) | |
Copy constructor. More... | |
virtual | ~GCOMEventCube (void) |
Destructor. More... | |
virtual GCOMEventCube & | operator= (const GCOMEventCube &cube) |
Assignment operator. More... | |
virtual GCOMEventBin * | operator[] (const int &index) |
Event bin access operator. More... | |
virtual const GCOMEventBin * | operator[] (const int &index) const |
Event bin access operator (const version) More... | |
virtual void | clear (void) |
Clear instance. More... | |
virtual GCOMEventCube * | clone (void) const |
Clone instance. More... | |
virtual std::string | classname (void) const |
Return class name. More... | |
virtual int | size (void) const |
Return number of bins in event cube. More... | |
virtual int | dim (void) const |
Return dimension of event cube. More... | |
virtual int | naxis (const int &axis) const |
Return number of bins in axis. More... | |
virtual void | load (const GFilename &filename) |
Load COMPTEL event cube from FITS file. More... | |
virtual void | save (const GFilename &filename, const bool &clobber=false) const |
Save COMPTEL event cube into FITS file. More... | |
virtual void | read (const GFits &file) |
Read COMPTEL event cube from FITS file. More... | |
virtual void | write (GFits &file) const |
Write COMPTEL event cube into FITS file. More... | |
virtual int | number (void) const |
Return number of events in cube. More... | |
virtual std::string | print (const GChatter &chatter=NORMAL) const |
Print event cube information. More... | |
const GCOMDri & | dre (void) const |
Return reference to DRE data. More... | |
Public Member Functions inherited from GEventCube | |
GEventCube (void) | |
Void constructor. More... | |
GEventCube (const GEventCube &cube) | |
Copy constructor. More... | |
virtual | ~GEventCube (void) |
Destructor. More... | |
virtual GEventCube & | operator= (const GEventCube &cube) |
Assignment operator. More... | |
Public Member Functions inherited from GEvents | |
GEvents (void) | |
Void constructor. More... | |
GEvents (const GEvents &events) | |
Copy constructor. More... | |
virtual | ~GEvents (void) |
Destructor. More... | |
virtual GEvents & | operator= (const GEvents &events) |
Assignment operator. More... | |
void | ebounds (const GEbounds &ebounds) |
Set energy boundaries. More... | |
void | gti (const GGti >i) |
Set Good Time Intervals. More... | |
const GEbounds & | ebounds (void) const |
Return energy boundaries. More... | |
const GGti & | gti (void) const |
Return Good Time Intervals. More... | |
const GTime & | tstart (void) const |
Return start time. More... | |
const GTime & | tstop (void) const |
Return stop time. More... | |
const GEnergy & | emin (void) const |
Return minimum energy. More... | |
const GEnergy & | emax (void) const |
Return maximum energy. 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 GCOMEventCube &cube) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | init_cube (void) |
Initialise event cube. More... | |
void | set_scatter_directions (void) |
Set sky directions and solid angles of events cube. More... | |
void | set_scatter_angles (void) |
Set Compton scatter angles of event cube. More... | |
virtual void | set_energies (void) |
Set log mean energy and energy width of event cube. More... | |
virtual void | set_times (void) |
Set mean event time and ontime of event cube. More... | |
void | init_bin (void) |
Initialise event bin. More... | |
void | set_bin (const int &index) |
Set event bin. More... | |
Protected Member Functions inherited from GEventCube | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GEventCube &cube) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Member Functions inherited from GEvents | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GEvents &events) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Attributes | |
GCOMEventBin | m_bin |
Actual event bin. More... | |
GCOMInstDir | m_dir |
Actual event direction. More... | |
GCOMDri | m_dri |
DRI cube. More... | |
GTime | m_time |
Event cube mean time. More... | |
double | m_ontime |
Event cube ontime (sec) More... | |
GEnergy | m_energy |
Event cube mean energy. More... | |
GEnergy | m_ewidth |
Event cube energy bin width. More... | |
int | m_npix |
Number of DRI pixels. More... | |
std::vector< GSkyDir > | m_dirs |
Array of event scatter directions. More... | |
std::vector< double > | m_solidangle |
Array of solid angles (sr) More... | |
std::vector< double > | m_phibar |
Array of event scatter angles. More... | |
Protected Attributes inherited from GEvents | |
GEbounds | m_ebounds |
Energy boundaries covered by events. More... | |
GGti | m_gti |
Good time intervals covered by events. More... | |
COMPTEL event bin container class.
This class is a container class for COMPTEL event bins.
Definition at line 54 of file GCOMEventCube.hpp.
GCOMEventCube::GCOMEventCube | ( | void | ) |
Void constructor.
Constructs an empty event cube.
Definition at line 65 of file GCOMEventCube.cpp.
References init_members().
Referenced by clone().
|
explicit |
Load constructor.
[in] | filename | DRE FITS filename. |
Constructs an event cube from a DRE FITS file.
Definition at line 82 of file GCOMEventCube.cpp.
References init_members(), and load().
|
explicit |
DRE constructor.
[in] | dre | DRE event cube. |
Constructs an event cube from a DRE event cube.
Definition at line 102 of file GCOMEventCube.cpp.
References dre(), init_cube(), init_members(), and m_dri.
GCOMEventCube::GCOMEventCube | ( | const GCOMEventCube & | cube | ) |
Copy constructor.
[in] | cube | Event cube. |
Definition at line 123 of file GCOMEventCube.cpp.
References copy_members(), and init_members().
|
virtual |
|
inlinevirtual |
Return class name.
Implements GEventCube.
Definition at line 121 of file GCOMEventCube.hpp.
|
virtual |
Clear instance.
This method properly resets the object to an initial state.
Implements GEventCube.
Definition at line 236 of file GCOMEventCube.cpp.
References GEventCube::free_members(), free_members(), GEvents::free_members(), GEventCube::init_members(), init_members(), and GEvents::init_members().
Referenced by read().
|
virtual |
Clone instance.
Implements GEventCube.
Definition at line 258 of file GCOMEventCube.cpp.
References GCOMEventCube().
|
protected |
Copy class members.
[in] | cube | Event cube. |
This method copies the class members from another event cube in the actual object. It also prepares the event bin member that will be returned in case of an operator access to the class.
Definition at line 552 of file GCOMEventCube.cpp.
References init_bin(), m_dir, m_dirs, m_dri, m_energy, m_ewidth, m_npix, m_ontime, m_phibar, m_solidangle, and m_time.
Referenced by GCOMEventCube(), and operator=().
|
virtual |
Return dimension of event cube.
The dimension of the cube is either 2 or 3, depending on whether several scatter angle layers exist or not.
Implements GEventCube.
Definition at line 272 of file GCOMEventCube.cpp.
References m_dri, and GCOMDri::nphibar().
Referenced by naxis().
|
inline |
Return reference to DRE data.
Definition at line 145 of file GCOMEventCube.hpp.
References m_dri.
Referenced by GCOMObservation::compute_drb_bgdlixa(), GCOMObservation::compute_drb_bgdlixe(), GCOMObservation::compute_drb_phinor(), GCOMObservation::drm(), GCOMEventCube(), GCOMResponse::irf(), GCOMResponse::irf_diffuse(), GCOMResponse::irf_elliptical(), GCOMResponse::irf_ptsrc(), and GCOMResponse::irf_radial().
|
protected |
Delete class members.
Definition at line 580 of file GCOMEventCube.cpp.
Referenced by clear(), operator=(), and ~GCOMEventCube().
|
protected |
Initialise event bin.
This method initialises the event bin. The event bin is cleared and all fixed pointers are set. Only the m_counts and the m_solidangle member of the event bin will be set to NULL, but these will be set by the set_bin method which is called before any event bin access.
< Will be set by set_bin method
< Content will be set by set_bin method
< Will be set by set_bin method
< Fixed content
< Fixed content
< Fixed content
< Fixed content
Definition at line 761 of file GCOMEventCube.cpp.
References GCOMEventBin::free_members(), m_bin, GCOMEventBin::m_counts, GCOMEventBin::m_dir, m_dir, GCOMEventBin::m_energy, m_energy, GCOMEventBin::m_ewidth, m_ewidth, GCOMEventBin::m_ontime, m_ontime, GCOMEventBin::m_solidangle, GCOMEventBin::m_time, and m_time.
Referenced by copy_members(), and init_members().
|
protected |
Initialise event cube.
This method needs to be called once a new DRI dataset has been read.
The method copies the energy boundaries and the Good Time Intervals from the DRI cube into the event cube and sets up arrays that will be used for event bin access. In particular, the set_scatter_directions(), set_scatter_angles(), set_energies() and set_times() methods will be called by this method.
Definition at line 598 of file GCOMEventCube.cpp.
References GCOMDri::ebounds(), GEvents::ebounds(), GCOMDri::gti(), GEvents::gti(), m_dri, set_energies(), set_scatter_angles(), set_scatter_directions(), and set_times().
Referenced by GCOMEventCube(), and read().
|
protected |
Initialise class members.
The method initialises the class members to a well defined state. It also prepares the event bin member that will be returned in case of an operator access to the class. As the event bin member manipulates pointers, it will be possible to directly write to the memory that has been associated with a bin.
Definition at line 520 of file GCOMEventCube.cpp.
References GCOMInstDir::clear(), GCOMEventBin::clear(), GCOMDri::clear(), GEnergy::clear(), GTime::clear(), init_bin(), m_bin, m_dir, m_dirs, m_dri, m_energy, m_ewidth, m_npix, m_ontime, m_phibar, m_solidangle, and m_time.
Referenced by clear(), GCOMEventCube(), and operator=().
|
virtual |
Load COMPTEL event cube from FITS file.
[in] | filename | FITS filename. |
Loads the event cube from a DRE FITS file.
Implements GEventCube.
Definition at line 328 of file GCOMEventCube.cpp.
References GFits::close(), and read().
Referenced by GCOMEventCube().
|
virtual |
Return number of bins in axis.
[in] | axis | Axis [0,...,dim()-1]. |
GException::out_of_range | Axis is out of range. |
Returns the number of bins along a given event cube axis
.
Implements GEventCube.
Definition at line 293 of file GCOMEventCube.cpp.
References dim(), G_NAXIS, m_dri, GCOMDri::nchi(), GCOMDri::nphibar(), and GCOMDri::npsi().
Referenced by GCOMResponse::irf_diffuse(), GCOMResponse::irf_elliptical(), GCOMResponse::irf_ptsrc(), and GCOMResponse::irf_radial().
|
virtual |
Return number of events in cube.
This method returns the number of events in the event cube rounded to the nearest integer.
Implements GEventCube.
Definition at line 419 of file GCOMEventCube.cpp.
References m_dri, and GCOMDri::size().
Referenced by print().
|
virtual |
Assignment operator.
[in] | cube | Event cube. |
Definition at line 161 of file GCOMEventCube.cpp.
References copy_members(), free_members(), init_members(), and GEventCube::operator=().
|
virtual |
Event bin access operator.
[in] | index | Event index [0,...,size()-1]. |
Returns pointer to an event bin. Note that the returned pointer is in fact always the same, but the method sets the pointers within the event bin so that they point to the appropriate information.
Implements GEventCube.
Definition at line 195 of file GCOMEventCube.cpp.
|
virtual |
Event bin access operator (const version)
[in] | index | Event index [0,...,size()-1]. |
Returns pointer to an event bin. Note that the returned pointer is in fact always the same, but the method sets the pointers within the event bin so that they point to the appropriate information.
Implements GEventCube.
Definition at line 215 of file GCOMEventCube.cpp.
Print event cube information.
[in] | chatter | Chattiness. |
Implements GEventCube.
Definition at line 440 of file GCOMEventCube.cpp.
References gammalib::com_tics(), gammalib::com_tjd(), GEvents::emax(), GEvents::emin(), EXPLICIT, m_dri, m_energy, m_ewidth, m_ontime, m_time, GCOMDri::nchi(), GCOMDri::nphibar(), GCOMDri::npsi(), number(), gammalib::parformat(), GCOMDri::phase_correction(), GCOMDri::print(), GEnergy::print(), GTime::print(), SILENT, size(), gammalib::str(), GCOMDri::tof_correction(), GEvents::tstart(), and GEvents::tstop().
|
virtual |
Read COMPTEL event cube from FITS file.
[in] | fits | FITS file. |
Reads an COMPTEL event cube from a DRE FITS file.
Implements GEventCube.
Definition at line 375 of file GCOMEventCube.cpp.
References clear(), GFits::image(), init_cube(), m_dri, and GCOMDri::read().
Referenced by load().
|
virtual |
Save COMPTEL event cube into FITS file.
[in] | filename | FITS filename. |
[in] | clobber | Overwrite existing FITS file? (default: false). |
Saves the COMPTEL event cube into a DRE FITS file.
Implements GEventCube.
Definition at line 352 of file GCOMEventCube.cpp.
References GFits::saveto(), and write().
|
protected |
Set event bin.
[in] | index | Event index [0,...,size()[. |
GException::out_of_range | Event index is outside valid range. |
GException::invalid_value | Sky directions and solid angles vectors have not been set up. |
This method provides the event attributes to the event bin. The event bin is in fact physically stored in the event cube, and only a single event bin is indeed allocated. This method sets up the pointers in the event bin so that a client can easily access the information of individual bins as if they were stored in an array.
Definition at line 794 of file GCOMEventCube.cpp.
References GCOMInstDir::dir(), G_SET_BIN, m_bin, GCOMEventBin::m_counts, m_dir, m_dirs, m_dri, GCOMEventBin::m_index, m_npix, m_phibar, GCOMEventBin::m_solidangle, m_solidangle, GCOMInstDir::phibar(), and size().
Referenced by operator[]().
|
protectedvirtual |
Set log mean energy and energy width of event cube.
GException::invalid_value | No energy boundaries found. |
Computes the mean energy and energy bin width of the event cube.
Reimplemented from GEventCube.
Definition at line 701 of file GCOMEventCube.cpp.
References GEbounds::elogmean(), GEbounds::emax(), GEbounds::emin(), G_SET_ENERGIES, GEvents::m_ebounds, m_energy, m_ewidth, and GEbounds::size().
Referenced by init_cube().
|
protected |
Set Compton scatter angles of event cube.
Sets a vector of the Compton scatter angles.
Definition at line 674 of file GCOMEventCube.cpp.
References m_dri, m_phibar, GCOMDri::nphibar(), GCOMDri::phibin(), and GCOMDri::phimin().
Referenced by init_cube().
|
protected |
Set sky directions and solid angles of events cube.
GException::invalid_value | No sky pixels have been defined. |
This method computes the sky directions and solid angles for all (Chi,Psi) values of the event cube. Sky directions are stored in an array of GSkyDir objects while solid angles are stored in units of sr in an array of double precision variables.
Definition at line 634 of file GCOMEventCube.cpp.
References G_SET_SCATTER_DIRECTIONS, m_dirs, m_dri, m_npix, m_solidangle, GCOMDri::map(), GCOMDri::nchi(), GCOMDri::npsi(), GSkyMap::pix2dir(), and GSkyMap::solidangle().
Referenced by init_cube().
|
protectedvirtual |
Set mean event time and ontime of event cube.
GException::invalid_value | No Good Time Intervals found. |
Computes the mean time of the event cube by taking the mean between start and stop time. Computes also the ontime by summing up of all good time intervals.
Reimplemented from GEventCube.
Definition at line 732 of file GCOMEventCube.cpp.
References G_SET_TIMES, GEvents::m_gti, m_ontime, m_time, GGti::ontime(), GGti::size(), GGti::tstart(), and GGti::tstop().
Referenced by init_cube().
|
inlinevirtual |
Return number of bins in event cube.
Implements GEventCube.
Definition at line 133 of file GCOMEventCube.hpp.
References m_dri, and GCOMDri::size().
Referenced by GCOMObservation::drm(), GCOMResponse::irf_diffuse(), GCOMResponse::irf_elliptical(), GCOMResponse::irf_ptsrc(), GCOMResponse::irf_radial(), print(), and set_bin().
|
virtual |
Write COMPTEL event cube into FITS file.
[in] | file | FITS file. |
Writes the COMPTEL event cube into a DRE FITS file.
Implements GEventCube.
Definition at line 401 of file GCOMEventCube.cpp.
References m_dri, and GCOMDri::write().
Referenced by save().
|
protected |
Actual event bin.
Definition at line 101 of file GCOMEventCube.hpp.
Referenced by init_bin(), init_members(), operator[](), and set_bin().
|
protected |
Actual event direction.
Definition at line 102 of file GCOMEventCube.hpp.
Referenced by copy_members(), init_bin(), init_members(), and set_bin().
|
protected |
Array of event scatter directions.
Definition at line 109 of file GCOMEventCube.hpp.
Referenced by copy_members(), init_members(), set_bin(), and set_scatter_directions().
|
protected |
DRI cube.
Definition at line 103 of file GCOMEventCube.hpp.
Referenced by copy_members(), dim(), dre(), GCOMEventCube(), init_cube(), init_members(), naxis(), number(), print(), read(), set_bin(), set_scatter_angles(), set_scatter_directions(), size(), and write().
|
protected |
Event cube mean energy.
Definition at line 106 of file GCOMEventCube.hpp.
Referenced by copy_members(), init_bin(), init_members(), print(), and set_energies().
|
protected |
Event cube energy bin width.
Definition at line 107 of file GCOMEventCube.hpp.
Referenced by copy_members(), init_bin(), init_members(), print(), and set_energies().
|
protected |
Number of DRI pixels.
Definition at line 108 of file GCOMEventCube.hpp.
Referenced by copy_members(), init_members(), set_bin(), and set_scatter_directions().
|
protected |
Event cube ontime (sec)
Definition at line 105 of file GCOMEventCube.hpp.
Referenced by copy_members(), init_bin(), init_members(), print(), and set_times().
|
protected |
Array of event scatter angles.
Definition at line 111 of file GCOMEventCube.hpp.
Referenced by copy_members(), init_members(), set_bin(), and set_scatter_angles().
|
protected |
Array of solid angles (sr)
Definition at line 110 of file GCOMEventCube.hpp.
Referenced by copy_members(), init_members(), set_bin(), and set_scatter_directions().
|
protected |
Event cube mean time.
Definition at line 104 of file GCOMEventCube.hpp.
Referenced by copy_members(), init_bin(), init_members(), print(), and set_times().