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

COMPTEL Data Space container class. More...

#include <GCOMDris.hpp>

Inheritance diagram for GCOMDris:
GContainer GBase

Classes

class  likelihood
 

Public Member Functions

 GCOMDris (void)
 Void constructor. More...
 
 GCOMDris (const GCOMDris &dris)
 Copy constructor. More...
 
virtual ~GCOMDris (void)
 Destructor. More...
 
GCOMDrisoperator= (const GCOMDris &dris)
 Assignment operator. More...
 
GCOMDrioperator[] (const int &index)
 Return reference to Data space instance. More...
 
const GCOMDrioperator[] (const int &index) const
 Return reference to Data space instance (const version) More...
 
void clear (void)
 Clear Data Space container. More...
 
GCOMDrisclone (void) const
 Clone Data Space container. More...
 
std::string classname (void) const
 Return class name. More...
 
GCOMDriat (const int &index)
 Return reference to Data Space. More...
 
const GCOMDriat (const int &index) const
 Return reference to Data Space (const version) More...
 
int size (void) const
 Return number of Data space instances in container. More...
 
bool is_empty (void) const
 Signals if there are no Data space instances in container. More...
 
GCOMDriappend (const GCOMDri &dri)
 Append Data Space to container. More...
 
GCOMDriinsert (const int &index, const GCOMDri &dri)
 Insert Data Space into container. More...
 
void remove (const int &index)
 Remove Data Space from container. More...
 
void reserve (const int &num)
 Reserves space for Data space instances in container. More...
 
void extend (const GCOMDris &dris)
 Append Data Space container. More...
 
void compute_drws (const GCOMObservation &obs, const GCOMSelection &select=GCOMSelection(), const double &zetamin=5.0, const double &timebin=300.0, const std::string &method="phibar")
 Compute background weighting cubes. More...
 
std::string print (const GChatter &chatter=NORMAL) const
 Print Data Space container. More...
 
- Public Member Functions inherited from GContainer
virtual ~GContainer (void)
 Destructor. 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 GCOMDris &dris)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void compute_drws_energy (const GCOMObservation &obs, const GCOMEventList *events, const GCOMSelection &select, const double &zetamin, const double &timebin)
 Compute background weighting cubes using energy dependent rates. More...
 
void compute_drws_phibar (const GCOMObservation &obs, const GCOMEventList *events, const GCOMSelection &select, const double &zetamin, const double &timebin)
 Compute background weighting cubes using Phibar dependent rates. More...
 
void compute_drws_vetorate (const GCOMObservation &obs, const GCOMEventList *events, const GCOMSelection &select, const double &zetamin)
 Compute background weighting cubes using veto rates. More...
 
void vetorate_setup (const GCOMObservation &obs, const GCOMEventList *events, const GCOMSelection &select, const double &zetamin)
 Setup working arrays for vetorate computation. More...
 
void vetorate_fit (void)
 Fit working arrays for vetorate computation. More...
 
void vetorate_update_activ (void)
 Update activation rate. More...
 
void vetorate_generate (const GCOMObservation &obs, const GCOMSelection &select, const double &zetamin)
 Generate DRWs. More...
 
void vetorate_finish (const GCOMObservation &obs)
 Finish DRWs. More...
 
void vetorate_save (const GFilename &filename) const
 Save working arrays for vetorate computation. More...
 
void vetorate_load (const GFilename &filename)
 Load working arrays for vetorate computation. More...
 

Protected Attributes

std::vector< GCOMDrim_dris
 Data space instances. More...
 
GNdarray m_wrk_counts
 3D event cube array More...
 
GNdarray m_wrk_ehacutcorr
 2D geometry response array More...
 
GNdarray m_wrk_vetorate
 1D vetorates array More...
 
GNdarray m_wrk_activrate
 2D activation rate array More...
 
GNdarray m_wrk_rate
 2D rate array More...
 
std::vector< bool > m_wrk_use_sp
 1D superpacket usage array More...
 

Detailed Description

COMPTEL Data Space container class.

The COMPTEL Data Space container class holds instances of the COMPTEL Data Space. It allows for an efficient computation of data and response information for multiple energy bins.

Definition at line 56 of file GCOMDris.hpp.

Constructor & Destructor Documentation

GCOMDris::GCOMDris ( void  )

Void constructor.

Constructs an empty Data Space container.

Definition at line 87 of file GCOMDris.cpp.

References init_members().

Referenced by clone().

GCOMDris::GCOMDris ( const GCOMDris dris)

Copy constructor.

Parameters
[in]drisData Space container.

Definition at line 102 of file GCOMDris.cpp.

References copy_members(), and init_members().

GCOMDris::~GCOMDris ( void  )
virtual

Destructor.

Definition at line 118 of file GCOMDris.cpp.

References free_members().

Member Function Documentation

GCOMDri & GCOMDris::append ( const GCOMDri dri)

Append Data Space to container.

Parameters
[in]driData Space.
Returns
Reference to appended Data Space.

Appends Data Space to the container by making a deep copy of the Data Space.

Definition at line 249 of file GCOMDris.cpp.

References m_dris, and size().

GCOMDri & GCOMDris::at ( const int &  index)

Return reference to Data Space.

Parameters
[in]indexData Space index [0,...,size()-1].
Exceptions
GException::out_of_rangeData Space index is out of range.

Returns a reference to the Data Space with the specified index.

Definition at line 204 of file GCOMDris.cpp.

References G_AT, m_dris, and size().

const GCOMDri & GCOMDris::at ( const int &  index) const

Return reference to Data Space (const version)

Parameters
[in]indexData Space index [0,...,size()-1].
Exceptions
GException::out_of_rangeData Space index is out of range.

Returns a reference to the Data Space with the specified index.

Definition at line 227 of file GCOMDris.cpp.

References G_AT, m_dris, and size().

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

Return class name.

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

Implements GBase.

Definition at line 169 of file GCOMDris.hpp.

void GCOMDris::clear ( void  )
virtual

Clear Data Space container.

Implements GBase.

Definition at line 170 of file GCOMDris.cpp.

References free_members(), and init_members().

GCOMDris * GCOMDris::clone ( void  ) const
virtual

Clone Data Space container.

Returns
Pointer to deep copy of Data Space container.

Implements GBase.

Definition at line 188 of file GCOMDris.cpp.

References GCOMDris().

void GCOMDris::compute_drws ( const GCOMObservation obs,
const GCOMSelection select = GCOMSelection(),
const double &  zetamin = 5.0,
const double &  timebin = 300.0,
const std::string &  method = "phibar" 
)

Compute background weighting cubes.

Parameters
[in]obsCOMPTEL observation.
[in]selectSelection set.
[in]zetaminMinimum Earth horizon - Phibar cut (deg).
[in]timebinTime binning for rate determination (sec).
[in]methodMethod to compute DRWs ("energy", "phibar" or "vetorate").
Exceptions
GException::invalid_valueDRW with mismatching definition encountered in container.
GException::invalid_argumentNo event list found in COMPTEL observation.

Compute DRW cubes for a COMPTEL observation. DRW cubes are event-rate weighted geometry cubes which were multiplied by the solid angle of the (Chi,Psi) pixels.

The DRW cubes are normalised so that the sum of each Phibar layer equals to unity.

Definition at line 378 of file GCOMDris.cpp.

References compute_drws_energy(), compute_drws_phibar(), compute_drws_vetorate(), GObservation::events(), G_COMPUTE_DRWS, is_empty(), GCOMDri::m_dri, m_dris, GCOMDri::m_tstart, GCOMDri::m_tstop, GCOMDri::nphibar(), GSkyMap::npix(), size(), gammalib::str(), and sum().

void GCOMDris::compute_drws_energy ( const GCOMObservation obs,
const GCOMEventList events,
const GCOMSelection select,
const double &  zetamin,
const double &  timebin 
)
protected

Compute background weighting cubes using energy dependent rates.

Parameters
[in]obsCOMPTEL observation.
[in]eventsCOMPTEL event list.
[in]selectSelection set.
[in]zetaminMinimum Earth horizon - Phibar cut (deg).
[in]timebinTime binning for rate determination (sec).

Compute DRW cubes for a COMPTEL observation. DRW cubes are event-rate weighted geometry cubes which were multiplied by the solid angle of the (Chi,Psi) pixels.

For this method the event rates depend on time and energy. Three hard-wired energy ranges are defined for which the event rate is determined:

  E < 1.8 MeV
  1.8 < E < 4.3 MeV
  E > 4.3 MeV

For each superpacket, the event rates are linearly interpolated to the relevant superpacket time.

The DRW cubes are normalised so that the sum of each Phibar layer equals to unity.

Definition at line 606 of file GCOMDris.cpp.

References GNodeArray::append(), GCOMDri::compute_geometry(), GCOMOad::gcaz(), GCOMOad::gcel(), GCOMOad::georad(), GCOMSelection::has_pulsar(), GNodeArray::interpolate(), GSkyMap::inx2dir(), GCOMDri::m_dri, m_dris, GCOMDri::m_phibin, GCOMDri::nphibar(), GSkyMap::npix(), GCOMObservation::oads(), GCOMOad::phi(), GCOMSelection::pulsar(), GSkyDir::radec_deg(), GTime::secs(), GCOMEventList::size(), GCOMOads::size(), size(), GSkyMap::solidangle(), GCOMOad::theta(), GCOMObservation::tim(), GCOMOad::tjd(), GCOMOad::tstart(), GCOMOad::tstop(), GCOMSelection::use_event(), and GPulsar::validity().

Referenced by compute_drws().

void GCOMDris::compute_drws_phibar ( const GCOMObservation obs,
const GCOMEventList events,
const GCOMSelection select,
const double &  zetamin,
const double &  timebin 
)
protected

Compute background weighting cubes using Phibar dependent rates.

Parameters
[in]obsCOMPTEL observation.
[in]eventsCOMPTEL event list.
[in]selectSelection set.
[in]zetaminMinimum Earth horizon - Phibar cut (deg).
[in]timebinTime binning for rate determination (sec).

Compute DRW cubes for a COMPTEL observation. DRW cubes are event-rate weighted geometry cubes which were multiplied by the solid angle of the (Chi,Psi) pixels.

For this method the event rates depend on time and Phibar angle. For each superpacket, the event rates are linearly interpolated to the relevant superpacket time.

The DRW cubes are normalised so that the sum of each Phibar layer equals to unity.

< Maximum EHA correction factor

Definition at line 922 of file GCOMDris.cpp.

References GCOMDri::compute_geometry(), GCOMOad::gcaz(), GCOMOad::gcel(), GCOMOad::georad(), GCOMSelection::has_pulsar(), GSkyMap::inx2dir(), GCOMDri::m_dri, m_dris, GCOMDri::m_phibin, GCOMDri::nphibar(), GSkyMap::npix(), GCOMObservation::oads(), GCOMOad::phi(), GCOMDri::phibin(), GCOMDri::phimin(), GCOMSelection::pulsar(), GSkyDir::radec_deg(), GTime::secs(), GCOMEventList::size(), GCOMOads::size(), size(), GSkyMap::solidangle(), GCOMOad::theta(), GCOMObservation::tim(), GCOMOad::tjd(), GCOMOad::tstart(), GCOMOad::tstop(), GCOMSelection::use_event(), and GPulsar::validity().

Referenced by compute_drws().

void GCOMDris::compute_drws_vetorate ( const GCOMObservation obs,
const GCOMEventList events,
const GCOMSelection select,
const double &  zetamin 
)
protected

Compute background weighting cubes using veto rates.

Parameters
[in]obsCOMPTEL observation.
[in]eventsCOMPTEL event list.
[in]selectSelection set.
[in]zetaminMinimum Earth horizon - Phibar cut (deg).

Compute DRW cubes for a COMPTEL observation. DRW cubes are event-rate weighted geometry cubes which were multiplied by the solid angle of the (Chi,Psi) pixels.

< Initial fprompt value

< Perform 4 iterations

Definition at line 1250 of file GCOMDris.cpp.

References m_dris, size(), vetorate_finish(), vetorate_fit(), vetorate_generate(), vetorate_load(), vetorate_save(), vetorate_setup(), and vetorate_update_activ().

Referenced by compute_drws().

void GCOMDris::copy_members ( const GCOMDris dris)
protected

Copy class members.

Parameters
[in]drisData Space container.

Definition at line 551 of file GCOMDris.cpp.

References m_dris, m_wrk_activrate, m_wrk_counts, m_wrk_ehacutcorr, m_wrk_rate, m_wrk_use_sp, and m_wrk_vetorate.

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

void GCOMDris::extend ( const GCOMDris dris)

Append Data Space container.

Parameters
[in]oadsData Space container.

Append Data Space container to the container.

Definition at line 332 of file GCOMDris.cpp.

References is_empty(), m_dris, reserve(), and size().

void GCOMDris::free_members ( void  )
protected

Delete class members.

Definition at line 572 of file GCOMDris.cpp.

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

void GCOMDris::init_members ( void  )
protected

Initialise class members.

Definition at line 528 of file GCOMDris.cpp.

References GNdarray::clear(), m_dris, m_wrk_activrate, m_wrk_counts, m_wrk_ehacutcorr, m_wrk_rate, m_wrk_use_sp, and m_wrk_vetorate.

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

GCOMDri & GCOMDris::insert ( const int &  index,
const GCOMDri dri 
)

Insert Data Space into container.

Parameters
[in]indexData Space index (0,...,size()-1).
[in]driData Space.
Exceptions
GException::out_of_rangeData Space index is out of range.

Inserts a Data Space into the container before the Data Space with the specified index.

Definition at line 271 of file GCOMDris.cpp.

References G_INSERT, is_empty(), m_dris, and size().

bool GCOMDris::is_empty ( void  ) const
inlinevirtual

Signals if there are no Data space instances in container.

Returns
True if container is empty, false otherwise.

Signals if the Data space instances container does not contain any Data space instances.

Implements GContainer.

Definition at line 226 of file GCOMDris.hpp.

References m_dris.

Referenced by compute_drws(), extend(), and insert().

GCOMDris & GCOMDris::operator= ( const GCOMDris dris)

Assignment operator.

Parameters
[in]drisData Space container.
Returns
Data Space container.

Definition at line 140 of file GCOMDris.cpp.

References copy_members(), free_members(), and init_members().

GCOMDri & GCOMDris::operator[] ( const int &  index)
inline

Return reference to Data space instance.

Parameters
[in]indexData space index [0,...,size()-1].

Returns a reference to the Data space instance with the specified index.

Definition at line 183 of file GCOMDris.hpp.

References m_dris.

const GCOMDri & GCOMDris::operator[] ( const int &  index) const
inline

Return reference to Data space instance (const version)

Parameters
[in]indexData space index [0,...,size()-1].

Returns a reference to the Data space instance with the specified index.

Definition at line 197 of file GCOMDris.hpp.

References m_dris.

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

Print Data Space container.

Parameters
[in]chatterChattiness.
Returns
String containing Data Space container information.

Implements GBase.

Definition at line 497 of file GCOMDris.cpp.

References gammalib::parformat(), SILENT, size(), and gammalib::str().

void GCOMDris::remove ( const int &  index)
virtual

Remove Data Space from container.

Parameters
[in]indexData Space index (0,...,size()-1).
Exceptions
GException::out_of_rangeData Space index is out of range.

Remove Data Space of specified index from container.

Implements GContainer.

Definition at line 307 of file GCOMDris.cpp.

References G_REMOVE, m_dris, and size().

void GCOMDris::reserve ( const int &  num)
inlinevirtual

Reserves space for Data space instances in container.

Parameters
[in]numNumber of Data space instances.

Reserves space for num Data space instances in the container.

Implements GContainer.

Definition at line 240 of file GCOMDris.hpp.

References m_dris.

Referenced by extend().

int GCOMDris::size ( void  ) const
inlinevirtual

Return number of Data space instances in container.

Returns
Number of Data space instances in container.

Returns the number of Data space instances in the container.

Implements GContainer.

Definition at line 211 of file GCOMDris.hpp.

References m_dris.

Referenced by append(), at(), compute_drws(), compute_drws_energy(), compute_drws_phibar(), compute_drws_vetorate(), extend(), insert(), print(), remove(), vetorate_finish(), vetorate_generate(), and vetorate_setup().

void GCOMDris::vetorate_finish ( const GCOMObservation obs)
protected
void GCOMDris::vetorate_fit ( void  )
protected

Fit working arrays for vetorate computation.

Determines the f_prompt parameter for each energy bin using a maximum log-likelihood fit using the data in the working arrays for each energy bin. Based on the fitted f_prompt parameter the method also computes the expected background rate time variation for each energy bin.

Definition at line 1636 of file GCOMDris.cpp.

References GOptimizerPars::append(), GLog::cout(), GOptimizerLM::eps(), GOptimizerLM::errors(), GOptimizerPar::factor_gradient(), GOptimizerLM::iter(), log(), m_dris, m_wrk_activrate, m_wrk_counts, m_wrk_rate, m_wrk_vetorate, GOptimizerLM::max_iter(), norm(), GOptimizerLM::optimize(), GOptimizerPar::range(), GNdarray::shape(), GOptimizerLM::status_string(), and GOptimizerLM::value().

Referenced by compute_drws_vetorate().

void GCOMDris::vetorate_generate ( const GCOMObservation obs,
const GCOMSelection select,
const double &  zetamin 
)
protected
void GCOMDris::vetorate_load ( const GFilename filename)
protected

Load working arrays for vetorate computation.

Parameters
[in]filenameFITS filename.

Load working arrays for vetorate DRW computation from FITS file.

Definition at line 2194 of file GCOMDris.cpp.

References GFits::close(), GFits::image(), m_wrk_activrate, m_wrk_counts, m_wrk_ehacutcorr, m_wrk_use_sp, m_wrk_vetorate, GFitsImage::naxes(), and GFitsImage::pixel().

Referenced by compute_drws_vetorate().

void GCOMDris::vetorate_save ( const GFilename filename) const
protected

Save working arrays for vetorate computation.

Parameters
[in]filenameFITS filename.

Save working arrays for vetorate DRW computation in FITS file.

Definition at line 2126 of file GCOMDris.cpp.

References GFits::append(), GFitsHDU::extname(), m_wrk_activrate, m_wrk_counts, m_wrk_ehacutcorr, m_wrk_use_sp, m_wrk_vetorate, GFits::saveto(), and GNdarray::shape().

Referenced by compute_drws_vetorate().

void GCOMDris::vetorate_setup ( const GCOMObservation obs,
const GCOMEventList events,
const GCOMSelection select,
const double &  zetamin 
)
protected

Setup working arrays for vetorate computation.

Parameters
[in]obsCOMPTEL observation.
[in]eventsCOMPTEL event list.
[in]selectSelection set.
[in]zetaminMinimum Earth horizon - Phibar cut (deg).

Setup working arrays for vetorate DRW computation. There are five working arrays:

m_wrk_counts is a 3D working array spanned by superpacket index, phibar layer and energy bin, containing the number of events passing the event selections for the specified bin.

m_wrk_ehacutcorr is a 2D working array spanned by superpacket index and phibar layer, containing the fraction of the solid-angle weighted geometry that passes the Earth horizon cut for the specified bin. This array represents the response to a given incident event rate.

m_wrk_vetorate is a 1D working array, containing the veto rate as function of superpacket index.

m_wrk_activrate is a 2D working array, containing the activation rate as function of superpacket index and energy range.

m_wrk_use_sp is a 1D working array, signalling the usage of a given superpacket.

Note that the method also sets the superpacket usage and event selection statistics of all DRWs.

Definition at line 1325 of file GCOMDris.cpp.

References GNodeArray::append(), GCOMDri::compute_geometry(), GCOMOad::gcaz(), GCOMOad::gcel(), GCOMOad::georad(), GCOMDri::gti(), GCOMSelection::has_pulsar(), GCOMObservation::hkds(), GNodeArray::interpolate(), GSkyMap::inx2dir(), GNodeArray::is_empty(), GCOMDri::m_dri, m_dris, GCOMDri::m_phibin, GCOMDri::m_phimin, GCOMDri::m_selection, m_wrk_activrate, m_wrk_counts, m_wrk_ehacutcorr, m_wrk_use_sp, m_wrk_vetorate, GCOMDri::nphibar(), GSkyMap::npix(), GCOMObservation::oads(), GCOMOad::phi(), GCOMSelection::pulsar(), GSkyDir::radec_deg(), GCOMTim::reduce(), GNodeArray::reserve(), GTime::secs(), GCOMHkd::size(), GCOMEventList::size(), GCOMOads::size(), size(), GGti::size(), GNodeArray::size(), GSkyMap::solidangle(), GCOMOad::theta(), GCOMObservation::tim(), GCOMHkd::time(), GCOMOad::tjd(), GCOMOad::tstart(), GGti::tstart(), GCOMOad::tstop(), GGti::tstop(), GCOMSelection::use_event(), GPulsar::validity(), and GCOMHkd::value().

Referenced by compute_drws_vetorate().

void GCOMDris::vetorate_update_activ ( void  )
protected

Update activation rate.

< Cap reduction at 5%

Definition at line 1754 of file GCOMDris.cpp.

References GFft::backward(), exp(), m_wrk_activrate, m_wrk_counts, m_wrk_ehacutcorr, m_wrk_rate, norm(), GNdarray::shape(), and sum().

Referenced by compute_drws_vetorate().

Member Data Documentation

GNdarray GCOMDris::m_wrk_activrate
protected
GNdarray GCOMDris::m_wrk_counts
protected
GNdarray GCOMDris::m_wrk_ehacutcorr
protected
GNdarray GCOMDris::m_wrk_rate
protected
std::vector<bool> GCOMDris::m_wrk_use_sp
protected

1D superpacket usage array

Definition at line 159 of file GCOMDris.hpp.

Referenced by copy_members(), init_members(), vetorate_finish(), vetorate_generate(), vetorate_load(), vetorate_save(), and vetorate_setup().

GNdarray GCOMDris::m_wrk_vetorate
protected

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