GammaLib
2.1.0.dev
|
COMPTEL Data Space container class. More...
#include <GCOMDris.hpp>
Classes | |
class | likelihood |
Public Member Functions | |
GCOMDris (void) | |
Void constructor. More... | |
GCOMDris (const GCOMDris &dris) | |
Copy constructor. More... | |
virtual | ~GCOMDris (void) |
Destructor. More... | |
GCOMDris & | operator= (const GCOMDris &dris) |
Assignment operator. More... | |
GCOMDri & | operator[] (const int &index) |
Return reference to Data space instance. More... | |
const GCOMDri & | operator[] (const int &index) const |
Return reference to Data space instance (const version) More... | |
void | clear (void) |
Clear Data Space container. More... | |
GCOMDris * | clone (void) const |
Clone Data Space container. More... | |
std::string | classname (void) const |
Return class name. More... | |
GCOMDri & | at (const int &index) |
Return reference to Data Space. More... | |
const GCOMDri & | at (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... | |
GCOMDri & | append (const GCOMDri &dri) |
Append Data Space to container. More... | |
GCOMDri & | insert (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< GCOMDri > | m_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... | |
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.
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.
[in] | dris | Data Space container. |
Definition at line 102 of file GCOMDris.cpp.
References copy_members(), and init_members().
|
virtual |
Append Data Space to container.
[in] | dri | 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.
GCOMDri & GCOMDris::at | ( | const int & | index | ) |
Return reference to Data Space.
[in] | index | Data Space index [0,...,size()-1]. |
GException::out_of_range | Data 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.
const GCOMDri & GCOMDris::at | ( | const int & | index | ) | const |
Return reference to Data Space (const version)
[in] | index | Data Space index [0,...,size()-1]. |
GException::out_of_range | Data 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.
|
inlinevirtual |
Return class name.
Implements GBase.
Definition at line 169 of file GCOMDris.hpp.
|
virtual |
Clear Data Space container.
Implements GBase.
Definition at line 170 of file GCOMDris.cpp.
References free_members(), and init_members().
|
virtual |
Clone 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.
[in] | obs | COMPTEL observation. |
[in] | select | Selection set. |
[in] | zetamin | Minimum Earth horizon - Phibar cut (deg). |
[in] | timebin | Time binning for rate determination (sec). |
[in] | method | Method to compute DRWs ("energy", "phibar" or "vetorate"). |
GException::invalid_value | DRW with mismatching definition encountered in container. |
GException::invalid_argument | No 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().
|
protected |
Compute background weighting cubes using energy dependent rates.
[in] | obs | COMPTEL observation. |
[in] | events | COMPTEL event list. |
[in] | select | Selection set. |
[in] | zetamin | Minimum Earth horizon - Phibar cut (deg). |
[in] | timebin | Time 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().
|
protected |
Compute background weighting cubes using Phibar dependent rates.
[in] | obs | COMPTEL observation. |
[in] | events | COMPTEL event list. |
[in] | select | Selection set. |
[in] | zetamin | Minimum Earth horizon - Phibar cut (deg). |
[in] | timebin | Time 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().
|
protected |
Compute background weighting cubes using veto rates.
[in] | obs | COMPTEL observation. |
[in] | events | COMPTEL event list. |
[in] | select | Selection set. |
[in] | zetamin | Minimum 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().
|
protected |
Copy class members.
[in] | dris | Data 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.
[in] | oads | Data 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().
|
protected |
Delete class members.
Definition at line 572 of file GCOMDris.cpp.
Referenced by clear(), operator=(), and ~GCOMDris().
|
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=().
Insert Data Space into container.
[in] | index | Data Space index (0,...,size()-1). |
[in] | dri | Data Space. |
GException::out_of_range | Data 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().
|
inlinevirtual |
Signals if there are no Data space instances in container.
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().
Assignment operator.
[in] | dris | Data Space container. |
Definition at line 140 of file GCOMDris.cpp.
References copy_members(), free_members(), and init_members().
|
inline |
Return reference to Data space instance.
[in] | index | Data 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.
|
inline |
Return reference to Data space instance (const version)
[in] | index | Data 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.
Print Data Space container.
[in] | chatter | Chattiness. |
Implements GBase.
Definition at line 497 of file GCOMDris.cpp.
References gammalib::parformat(), SILENT, size(), and gammalib::str().
|
virtual |
Remove Data Space from container.
[in] | index | Data Space index (0,...,size()-1). |
GException::out_of_range | Data Space index is out of range. |
Remove Data Space of specified index
from container.
Implements GContainer.
Definition at line 307 of file GCOMDris.cpp.
|
inlinevirtual |
Reserves space for Data space instances in container.
[in] | num | Number 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().
|
inlinevirtual |
Return 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().
|
protected |
Finish DRWs.
[in] | obs | COMPTEL observation. |
Set DRW binary tables
Definition at line 2039 of file GCOMDris.cpp.
References GFitsTable::append(), GFitsBinTable::clear(), GFitsHDU::extname(), m_dris, GCOMDri::m_drw_table, m_wrk_activrate, m_wrk_rate, m_wrk_use_sp, m_wrk_vetorate, GCOMObservation::oads(), GCOMOads::size(), size(), GCOMOad::tics(), and GCOMOad::tjd().
Referenced by compute_drws_vetorate().
|
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().
|
protected |
Generate DRWs.
[in] | obs | COMPTEL observation. |
[in] | select | Selection set. |
[in] | zetamin | Minimum Earth horizon - Phibar cut (deg). |
Definition at line 1888 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, m_wrk_rate, m_wrk_use_sp, GCOMDri::nphibar(), GSkyMap::npix(), GCOMObservation::oads(), GCOMOad::phi(), GCOMSelection::pulsar(), GSkyDir::radec_deg(), GCOMTim::reduce(), GCOMOads::size(), size(), GSkyMap::solidangle(), GCOMOad::theta(), GCOMObservation::tim(), GCOMOad::tjd(), and GPulsar::validity().
Referenced by compute_drws_vetorate().
|
protected |
Load working arrays for vetorate computation.
[in] | filename | FITS 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().
|
protected |
Save working arrays for vetorate computation.
[in] | filename | FITS 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().
|
protected |
Setup working arrays for vetorate computation.
[in] | obs | COMPTEL observation. |
[in] | events | COMPTEL event list. |
[in] | select | Selection set. |
[in] | zetamin | Minimum 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().
|
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().
|
protected |
Data space instances.
Definition at line 151 of file GCOMDris.hpp.
Referenced by append(), at(), compute_drws(), compute_drws_energy(), compute_drws_phibar(), compute_drws_vetorate(), copy_members(), extend(), init_members(), insert(), is_empty(), operator[](), remove(), reserve(), size(), vetorate_finish(), vetorate_fit(), vetorate_generate(), and vetorate_setup().
|
protected |
2D activation rate array
Definition at line 157 of file GCOMDris.hpp.
Referenced by copy_members(), init_members(), GCOMDris::likelihood::likelihood(), vetorate_finish(), vetorate_fit(), vetorate_load(), vetorate_save(), vetorate_setup(), and vetorate_update_activ().
|
protected |
3D event cube array
Definition at line 154 of file GCOMDris.hpp.
Referenced by copy_members(), init_members(), GCOMDris::likelihood::likelihood(), vetorate_fit(), vetorate_load(), vetorate_save(), vetorate_setup(), and vetorate_update_activ().
|
protected |
2D geometry response array
Definition at line 155 of file GCOMDris.hpp.
Referenced by copy_members(), init_members(), GCOMDris::likelihood::likelihood(), vetorate_load(), vetorate_save(), vetorate_setup(), and vetorate_update_activ().
|
protected |
2D rate array
Definition at line 158 of file GCOMDris.hpp.
Referenced by copy_members(), init_members(), vetorate_finish(), vetorate_fit(), vetorate_generate(), and vetorate_update_activ().
|
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().
|
protected |
1D vetorates array
Definition at line 156 of file GCOMDris.hpp.
Referenced by copy_members(), init_members(), GCOMDris::likelihood::likelihood(), vetorate_finish(), vetorate_fit(), vetorate_load(), vetorate_save(), and vetorate_setup().