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

Interface class for COMPTEL observations. More...

#include <GCOMObservation.hpp>

Inheritance diagram for GCOMObservation:
GObservation GBase

Public Member Functions

 GCOMObservation (void)
 Void constructor. More...
 
 GCOMObservation (const GXmlElement &xml)
 XML constructor. More...
 
 GCOMObservation (const GFilename &drename, const GFilename &drbname, const GFilename &drgname, const GFilename &drxname)
 Binned observation constructor. More...
 
 GCOMObservation (const GFilename &evpname, const GFilename &timname, const std::vector< GFilename > &oadnames)
 Unbinned observation constructor. More...
 
 GCOMObservation (const GCOMObservation &obs)
 Copy constructor. More...
 
virtual ~GCOMObservation (void)
 Destructor. More...
 
virtual GCOMObservationoperator= (const GCOMObservation &obs)
 Assignment operator. More...
 
virtual void clear (void)
 Clear COMPTEL observation. More...
 
virtual GCOMObservationclone (void) const
 Clone COMPTEL observation. More...
 
virtual std::string classname (void) const
 Return class name. More...
 
virtual void response (const GResponse &rsp)
 Set response function. More...
 
virtual const GCOMResponseresponse (void) const
 Return response function. More...
 
virtual std::string instrument (void) const
 Return instrument. More...
 
virtual double ontime (void) const
 Return ontime. More...
 
virtual double livetime (void) const
 Return livetime. More...
 
virtual double deadc (const GTime &time=GTime()) const
 Return deadtime correction factor. More...
 
virtual void read (const GXmlElement &xml)
 Read observation from XML element. More...
 
virtual void write (GXmlElement &xml) const
 Write observation into XML element. More...
 
virtual std::string print (const GChatter &chatter=NORMAL) const
 Print observation information. More...
 
virtual void remove_response_cache (const std::string &name)
 Remove response cache for model. More...
 
bool is_unbinned (void) const
 Check whether observation is unbinned. More...
 
bool is_binned (void) const
 Check whether observation is binned. More...
 
void load (const GFilename &drename, const GFilename &drbname, const GFilename &drgname, const GFilename &drxname)
 Load data for a binned observation. More...
 
void load (const GFilename &evpname, const GFilename &timname, const std::vector< GFilename > &oadnames)
 Load data for an unbinned observation. More...
 
void response (const GCaldb &caldb, const std::string &rspname)
 Set response function. More...
 
void obs_id (const double &id)
 Set observation ID. More...
 
void ontime (const double &ontime)
 Set ontime. More...
 
void livetime (const double &livetime)
 Set livetime. More...
 
void deadc (const double &deadc)
 Set deadtime correction factor. More...
 
void ewidth (const double &ewidth)
 Set energy width. More...
 
const double & obs_id (void) const
 Return observation ID. More...
 
const double & ewidth (void) const
 Return energy width. More...
 
const GSkyMapdrb (void) const
 Return background model. More...
 
const GSkyMapdrg (void) const
 Return geometry factors. More...
 
const GSkyMapdrx (void) const
 Return exposure. More...
 
const GCOMDridrm (const GSource &source) const
 Return source model DRM cube. More...
 
GCOMDri drm (const GModels &models) const
 Compute DRM cube. More...
 
const GCOMTimtim (void) const
 Return COMPTEL Good Time Intervals. More...
 
const GCOMOadsoads (void) const
 Return Orbit Aspect Data. More...
 
- Public Member Functions inherited from GObservation
 GObservation (void)
 Void constructor. More...
 
 GObservation (const GObservation &obs)
 Copy constructor. More...
 
virtual ~GObservation (void)
 Destructor. More...
 
virtual GObservationoperator= (const GObservation &obs)
 Assignment operator. More...
 
virtual GEventsevents (void)
 Return events. More...
 
virtual const GEventsevents (void) const
 Return events (const version) More...
 
virtual void events (const GEvents &events)
 Set event container. More...
 
virtual double likelihood (const GModels &models, GVector *gradient, GMatrixSparse *curvature, double *npred) const
 Compute likelihood function. More...
 
virtual double model (const GModels &models, const GEvent &event, GVector *gradient=NULL) const
 Return model value and (optionally) gradient. More...
 
virtual int nobserved (void) const
 Return total number of observed events. More...
 
virtual double npred (const GModels &models, GVector *gradient=NULL) const
 Return total number (and optionally gradient) of predicted counts for all models. More...
 
virtual double npred (const GModel &model) const
 Return total number of predicted counts for one model. More...
 
virtual double model_grad (const GModel &model, const GModelPar &par, const GEvent &event) const
 Returns parameter gradient of model for a given event. More...
 
virtual double npred_grad (const GModel &model, const GModelPar &par) const
 Returns parameter gradient of Npred. More...
 
bool has_events (void) const
 Signal if observation has events. More...
 
void name (const std::string &name)
 Set observation name. More...
 
void id (const std::string &id)
 Set observation identifier. More...
 
void statistic (const std::string &statistic)
 Set optimizer statistic. More...
 
const std::string & name (void) const
 Return observation name. More...
 
const std::string & id (void) const
 Return observation identifier. More...
 
const std::string & statistic (void) const
 Return optimizer statistic. 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 GCOMObservation &obs)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
void load_dre (const GFilename &drename)
 Load event cube data from DRE file. More...
 
void load_drb (const GFilename &drbname)
 Load background model from DRB file. More...
 
void load_drg (const GFilename &drgname)
 Load geometry factors from DRG file. More...
 
void load_drx (const GFilename &drxname)
 Load exposure from DRX file. More...
 
void add_drm (const GSource &source)
 Add DRM cube to observation response cache. More...
 
bool check_map (const GSkyMap &map) const
 Check if sky map is compatible with event cube. More...
 
void read_attributes (const GFitsHDU *hdu)
 Read observation attributes. More...
 
void write_attributes (GFitsHDU *hdu) const
 Write observation attributes. More...
 
- Protected Member Functions inherited from GObservation
void init_members (void)
 Initialise class members. More...
 
void copy_members (const GObservation &obs)
 Copy class members. More...
 
void free_members (void)
 Delete class members. More...
 
virtual double likelihood_poisson_unbinned (const GModels &models, GVector *gradient, GMatrixSparse *curvature, double *npred) const
 Evaluate log-likelihood function for Poisson statistic and unbinned analysis (version with working arrays) More...
 
virtual double likelihood_poisson_binned (const GModels &models, GVector *gradient, GMatrixSparse *curvature, double *npred) const
 Evaluate log-likelihood function for Poisson statistic and binned analysis (version with working arrays) More...
 
virtual double likelihood_gaussian_binned (const GModels &models, GVector *gradient, GMatrixSparse *curvature, double *npred) const
 Evaluate log-likelihood function for Gaussian statistic and binned analysis (version with working arrays) More...
 
virtual double npred_spec (const GModel &model, const GTime &obsTime) const
 Integrates spatially integrated Npred kernel spectrally. More...
 

Protected Attributes

std::string m_instrument
 Instrument name. More...
 
GCOMResponse m_response
 Response functions. More...
 
double m_obs_id
 Observation ID. More...
 
double m_ontime
 Ontime (sec) More...
 
double m_livetime
 Livetime (sec) More...
 
double m_deadc
 Deadtime correction. More...
 
GFilename m_drename
 DRE filename. More...
 
GFilename m_drbname
 DRB filename. More...
 
GFilename m_drgname
 DRG filename. More...
 
GFilename m_drxname
 DRX filename. More...
 
GSkyMap m_drb
 Background model. More...
 
GSkyMap m_drg
 Geometry factors. More...
 
GSkyMap m_drx
 Exposure map. More...
 
double m_ewidth
 Energy width (MeV) More...
 
GFilename m_evpname
 EVP filename. More...
 
GFilename m_timname
 TIM filename. More...
 
std::vector< GFilenamem_oadnames
 OAD filenames. More...
 
GCOMTim m_tim
 COMPTEL Good Time Intervals. More...
 
GCOMOads m_oads
 Orbit Aspect Data. More...
 
std::vector< GCOMDrim_drms
 Convolved model cubes. More...
 
- Protected Attributes inherited from GObservation
std::string m_name
 Observation name. More...
 
std::string m_id
 Observation identifier. More...
 
std::string m_statistic
 Optimizer statistic. More...
 
GEventsm_events
 Pointer to event container. More...
 

Detailed Description

Interface class for COMPTEL observations.

This class implements a COMPTEL observation. Each COMPTEL observation is defined for a given energy range, and is composed of a DRE, DRB, DRG and DRX file. The DRE file contains the event data, the DRB file contains a background model, the DRG file contains geometry factors, and the DRX file contains the exposure.

Definition at line 64 of file GCOMObservation.hpp.

Constructor & Destructor Documentation

GCOMObservation::GCOMObservation ( void  )

Void constructor.

Creates an empty COMPTEL observation.

Definition at line 80 of file GCOMObservation.cpp.

References init_members().

Referenced by clone().

GCOMObservation::GCOMObservation ( const GXmlElement xml)
explicit

XML constructor.

Parameters
[in]xmlXML element.

Constructs a COMPTEL observation from the information that is found in an XML element.

Definition at line 98 of file GCOMObservation.cpp.

References init_members(), and read().

GCOMObservation::GCOMObservation ( const GFilename drename,
const GFilename drbname,
const GFilename drgname,
const GFilename drxname 
)

Binned observation constructor.

Parameters
[in]drenameEvent cube name.
[in]drbnameBackground cube name.
[in]drgnameGeometry cube name.
[in]drxnameExposure map name.

Creates COMPTEL observation by loading the following FITS files:

DRE - Events cube
DRB - Background model cube
DRG - Geometry factors cube
DRX - Exposure map

Each of the four files is mandatory.

Definition at line 128 of file GCOMObservation.cpp.

References init_members(), and load().

GCOMObservation::GCOMObservation ( const GFilename evpname,
const GFilename timname,
const std::vector< GFilename > &  oadnames 
)

Unbinned observation constructor.

Parameters
[in]evpnameEvent list FITS file name.
[in]timnameGood Time Intervals FITS file name.
[in]oadnamesList of Orbit Aspect Data FITS file names.

Creates a COMPTEL unbinned observation by loading the event list, Good Time Interval and Orbit Aspect Data from FITS files. All files are mandatory.

Definition at line 155 of file GCOMObservation.cpp.

References init_members(), and load().

GCOMObservation::GCOMObservation ( const GCOMObservation obs)

Copy constructor.

Parameters
[in]obsCOMPTEL observation.

Creates COMPTEL observation by copying an existing COMPTEL observation.

Definition at line 177 of file GCOMObservation.cpp.

References copy_members(), and init_members().

GCOMObservation::~GCOMObservation ( void  )
virtual

Destructor.

Definition at line 193 of file GCOMObservation.cpp.

References free_members().

Member Function Documentation

void GCOMObservation::add_drm ( const GSource source)
protected

Add DRM cube to observation response cache.

Parameters
[in]sourceSource.
Exceptions
GException::invalid_valueObservation does not contain an event cube.

Adds a DRM cube based on the given source to the observation response cache.

Definition at line 1089 of file GCOMObservation.cpp.

References GCOMDri::compute_drm(), GCOMEventCube::dre(), drm(), G_ADD_DRM, m_drms, GObservation::m_events, GSource::model(), GObservation::model(), GSource::name(), GCOMDri::name(), and GObservation::name().

Referenced by drm().

bool GCOMObservation::check_map ( const GSkyMap map) const
protected

Check if sky map is compatible with event cube.

Parameters
[in]mapSky map.
Returns
True if map is compatible, false otherwise.

Compares the dimension and the WCS definition of a sky map to that of the event cube. If both are identical, true is returned, false otherwise.

Definition at line 1130 of file GCOMObservation.cpp.

References GObservation::m_events, GSkyMap::nmaps(), GSkyMap::nx(), GSkyMap::ny(), and GSkyMap::projection().

Referenced by load_drb(), and load_drg().

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

Return class name.

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

Implements GObservation.

Definition at line 176 of file GCOMObservation.hpp.

void GCOMObservation::clear ( void  )
virtual

Clear COMPTEL observation.

Implements GObservation.

Definition at line 250 of file GCOMObservation.cpp.

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

Referenced by load(), and read().

GCOMObservation * GCOMObservation::clone ( void  ) const
virtual

Clone COMPTEL observation.

Returns
Pointer to deep copy of COMPTEL observation.

Implements GObservation.

Definition at line 270 of file GCOMObservation.cpp.

References GCOMObservation().

void GCOMObservation::copy_members ( const GCOMObservation obs)
protected

Copy class members.

Parameters
[in]obsCOMPTEL observation.

Definition at line 861 of file GCOMObservation.cpp.

References m_deadc, m_drb, m_drbname, m_drename, m_drg, m_drgname, m_drms, m_drx, m_drxname, m_evpname, m_ewidth, m_instrument, m_livetime, m_oadnames, m_oads, m_obs_id, m_ontime, m_response, m_tim, and m_timname.

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

double GCOMObservation::deadc ( const GTime time = GTime()) const
inlinevirtual

Return deadtime correction factor.

Parameters
[in]timeTime.
Returns
Deadtime correction factor.

Implements GObservation.

Definition at line 242 of file GCOMObservation.hpp.

References m_deadc.

Referenced by GCOMDri::compute_drm_ptsrc(), and deadc().

void GCOMObservation::deadc ( const double &  deadc)
inline

Set deadtime correction factor.

Parameters
[in]deadcDeadtime correction factor.

Definition at line 294 of file GCOMObservation.hpp.

References deadc(), and m_deadc.

const GSkyMap & GCOMObservation::drb ( void  ) const
inline

Return background model.

Returns
Background model.

Definition at line 346 of file GCOMObservation.hpp.

References m_drb.

Referenced by GCOMModelDRBFitting::eval().

const GSkyMap & GCOMObservation::drg ( void  ) const
inline

Return geometry factors.

Returns
Geometry factors.

Definition at line 359 of file GCOMObservation.hpp.

References m_drg.

Referenced by GCOMDri::compute_drm_ptsrc(), and GCOMResponse::irf().

const GCOMDri & GCOMObservation::drm ( const GSource source) const

Return source model DRM cube.

Parameters
[in]sourceSource.
Returns
Source model DRM cube.

Definition at line 646 of file GCOMObservation.cpp.

References add_drm(), m_drms, and GSource::name().

Referenced by add_drm(), drm(), and GCOMResponse::irf().

GCOMDri GCOMObservation::drm ( const GModels models) const

Compute DRM cube.

Parameters
[in]modelsModel container.
Exceptions
GException::invalid_valueObservation does not contain an event cube.

Computes a COMPTEL DRM cube from the information provided in a model container.

Definition at line 678 of file GCOMObservation.cpp.

References GCOMEventBin::counts(), GCOMEventCube::dre(), drm(), GModels::eval(), G_DRM, GObservation::m_events, GObservation::model(), GObservation::name(), GCOMEventBin::size(), and GCOMEventCube::size().

const GSkyMap & GCOMObservation::drx ( void  ) const
inline

Return exposure.

Returns
Exposure.

Definition at line 372 of file GCOMObservation.hpp.

References m_drx.

Referenced by GCOMDri::compute_drm_ptsrc(), and GCOMResponse::irf().

void GCOMObservation::ewidth ( const double &  ewidth)
inline

Set energy width.

Parameters
[in]ewidthEnergy width (MeV).

Definition at line 307 of file GCOMObservation.hpp.

References ewidth(), and m_ewidth.

const double & GCOMObservation::ewidth ( void  ) const
inline

Return energy width.

Returns
Energy width (MeV).

Definition at line 333 of file GCOMObservation.hpp.

References m_ewidth.

Referenced by ewidth().

void GCOMObservation::free_members ( void  )
protected

Delete class members.

Definition at line 899 of file GCOMObservation.cpp.

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

std::string GCOMObservation::instrument ( void  ) const
inlinevirtual

Return instrument.

Returns
Instrument name.

Implements GObservation.

Definition at line 201 of file GCOMObservation.hpp.

References m_instrument.

Referenced by print().

bool GCOMObservation::is_binned ( void  ) const
inline

Check whether observation is binned.

Returns
True if observation is unbinned.

Definition at line 423 of file GCOMObservation.hpp.

References GObservation::m_events.

Referenced by write().

bool GCOMObservation::is_unbinned ( void  ) const
inline

Check whether observation is unbinned.

Returns
True if observation is unbinned.

Definition at line 411 of file GCOMObservation.hpp.

References GObservation::m_events.

Referenced by write().

double GCOMObservation::livetime ( void  ) const
inlinevirtual

Return livetime.

Returns
Livetime (seconds).

Implements GObservation.

Definition at line 227 of file GCOMObservation.hpp.

References m_livetime.

Referenced by livetime(), and print().

void GCOMObservation::livetime ( const double &  livetime)
inline

Set livetime.

Parameters
[in]livetimeLivetime.

Definition at line 281 of file GCOMObservation.hpp.

References livetime(), and m_livetime.

void GCOMObservation::load ( const GFilename drename,
const GFilename drbname,
const GFilename drgname,
const GFilename drxname 
)

Load data for a binned observation.

Parameters
[in]drenameEvent cube name.
[in]drbnameBackground cube name.
[in]drgnameGeometry cube name.
[in]drxnameExposure map name.

Load event cube from DRE file, background model from DRB file, geometry factors from DRG file and the exposure map from the DRX file. All files are mandatory.

Definition at line 536 of file GCOMObservation.cpp.

References load_drb(), load_dre(), load_drg(), and load_drx().

Referenced by GCOMObservation(), and read().

void GCOMObservation::load ( const GFilename evpname,
const GFilename timname,
const std::vector< GFilename > &  oadnames 
)

Load data for an unbinned observation.

Parameters
[in]evpnameEvent list FITS file name.
[in]timnameGood Time Intervals FITS file name.
[in]oadnamesList of Orbit Aspect Data FITS file names.

Loads the event list, Good Time Interval and Orbit Aspect Data for an unbinned observation. All files are mandatory.

Definition at line 568 of file GCOMObservation.cpp.

References clear(), GFits::close(), GCOMOads::extend(), GCOMTim::gti(), GCOMTim::load(), m_deadc, GObservation::m_events, m_evpname, m_livetime, m_oadnames, m_oads, m_ontime, m_tim, m_timname, oads(), GGti::ontime(), read_attributes(), and GCOMOads::size().

void GCOMObservation::load_drb ( const GFilename drbname)
protected

Load background model from DRB file.

Parameters
[in]drbnameDRB filename.
Exceptions
GException::invalid_valueDRB data space incompatible with DRE data space.

Load the background model from the primary image of the specified FITS file.

Definition at line 971 of file GCOMObservation.cpp.

References check_map(), GFits::close(), gammalib::com_wcs_mer2car(), G_LOAD_DRB, GFits::image(), m_drb, m_drbname, m_drename, and GSkyMap::read().

Referenced by load().

void GCOMObservation::load_dre ( const GFilename drename)
protected

Load event cube data from DRE file.

Parameters
[in]drenameDRE filename.

Loads the event cube from a DRE file.

The ontime is extracted from the Good Time Intervals. The deadtime fraction is fixed to 15%, hence DEADC=0.85. The livetime is then computed by multiplying the deadtime correction by the ontime, i.e. LIVETIME = ONTIME * DEADC.

Definition at line 918 of file GCOMObservation.cpp.

References GFits::close(), GEvents::emax(), GEvents::emin(), GEvents::gti(), m_deadc, m_drename, GObservation::m_events, m_ewidth, m_livetime, m_ontime, GEnergy::MeV(), GEvents::read(), and read_attributes().

Referenced by load().

void GCOMObservation::load_drg ( const GFilename drgname)
protected

Load geometry factors from DRG file.

Parameters
[in]drgnameDRG filename.
Exceptions
GException::invalid_valueDRG data space incompatible with DRE data space.

Load the geometry factors from the primary image of the specified FITS file.

Definition at line 1014 of file GCOMObservation.cpp.

References check_map(), GFits::close(), gammalib::com_wcs_mer2car(), G_LOAD_DRB, GFits::image(), m_drename, m_drg, m_drgname, and GSkyMap::read().

Referenced by load().

void GCOMObservation::load_drx ( const GFilename drxname)
protected

Load exposure from DRX file.

Parameters
[in]drxnameDRX filename.

Load the exposure map from the primary image of the specified FITS file.

Definition at line 1053 of file GCOMObservation.cpp.

References GFits::close(), gammalib::com_wcs_mer2car(), GFits::image(), m_drx, m_drxname, and GSkyMap::read().

Referenced by load().

const GCOMOads & GCOMObservation::oads ( void  ) const
inline

Return Orbit Aspect Data.

Returns
Orbit Aspect Data

Definition at line 398 of file GCOMObservation.hpp.

References m_oads.

Referenced by GCOMDri::compute_dre(), GCOMDri::compute_drg(), GCOMDri::compute_drx(), and load().

void GCOMObservation::obs_id ( const double &  id)
inline

Set observation ID.

Parameters
[in]idObservation ID.

Definition at line 255 of file GCOMObservation.hpp.

References GObservation::id(), and m_obs_id.

const double & GCOMObservation::obs_id ( void  ) const
inline

Return observation ID.

Returns
Observation ID.

Definition at line 320 of file GCOMObservation.hpp.

References m_obs_id.

double GCOMObservation::ontime ( void  ) const
inlinevirtual

Return ontime.

Returns
Ontime (seconds).

Implements GObservation.

Definition at line 214 of file GCOMObservation.hpp.

References m_ontime.

Referenced by GCOMDri::compute_drm_ptsrc(), GCOMResponse::irf(), ontime(), and print().

void GCOMObservation::ontime ( const double &  ontime)
inline

Set ontime.

Parameters
[in]ontimeOntime.

Definition at line 268 of file GCOMObservation.hpp.

References m_ontime, and ontime().

GCOMObservation & GCOMObservation::operator= ( const GCOMObservation obs)
virtual

Assignment operator.

Parameters
[in]obsCOMPTEL observation.
Returns
COMPTEL observation.

Assign COMPTEL observation to this object.

Definition at line 217 of file GCOMObservation.cpp.

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

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

Print observation information.

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

Implements GObservation.

Definition at line 748 of file GCOMObservation.cpp.

References GCOMTim::gti(), instrument(), GCOMOads::is_empty(), livetime(), m_deadc, GObservation::m_events, m_oads, m_tim, GObservation::name(), ontime(), gammalib::parformat(), GCOMTim::print(), GCOMOads::print(), GEvents::print(), gammalib::reduce(), response(), SILENT, GGti::size(), GObservation::statistic(), and gammalib::str().

void GCOMObservation::read ( const GXmlElement xml)
virtual

Read observation from XML element.

Parameters
[in]xmlXML element.

Reads information for a COMPTEL observation from an XML element. The method supports both an unbinned and a binned observation.

For an unbinned observation the XML format is

<observation name="Crab" id="000001" instrument="COM">
  <parameter name="EVP" file="m16992_evp.fits"/>
  <parameter name="TIM" file="m10695_tim.fits"/>
  <parameter name="OAD" file="m20039_oad.fits"/>
  <parameter name="OAD" file="m20041_oad.fits"/>
  ...
</observation>

where the observation can contain an arbitrary number of OAD file parameters. The file attribute provide either absolute or relative file name. If a file name includes no access path it is assumed that the file resides in the same location as the XML file.

For a binned observation the XML format is

<observation name="Crab" id="000001" instrument="COM">
  <parameter name="DRE" file="m50438_dre.fits"/>
  <parameter name="DRB" file="m34997_drg.fits"/>
  <parameter name="DRG" file="m34997_drg.fits"/>
  <parameter name="DRX" file="m32171_drx.fits"/>
  <parameter name="IAQ" value="UNH(1.0-3.0)MeV"/>
</observation>

Implements GObservation.

Definition at line 364 of file GCOMObservation.cpp.

References GXmlElement::attribute(), clear(), GXmlNode::element(), GXmlNode::elements(), G_READ, load(), m_instrument, response(), gammalib::xml_file_expand(), gammalib::xml_get_attr(), and gammalib::xml_has_par().

Referenced by GCOMObservation().

void GCOMObservation::read_attributes ( const GFitsHDU hdu)
protected

Read observation attributes.

Parameters
[in]hduFITS HDU pointer

Reads optional attributes are

OBS_ID   - Observation identifier
OBJECT   - Object

Nothing is done if the HDU pointer is NULL.

Definition at line 1160 of file GCOMObservation.cpp.

References GFitsHDU::has_card(), GObservation::m_name, m_obs_id, GFitsHDU::real(), and GFitsHDU::string().

Referenced by load(), and load_dre().

void GCOMObservation::remove_response_cache ( const std::string &  name)
virtual

Remove response cache for model.

Parameters
[in]nameModel name.

Remove response cache for model name from response cache.

Reimplemented from GObservation.

Definition at line 722 of file GCOMObservation.cpp.

References m_drms, and GObservation::name().

void GCOMObservation::response ( const GResponse rsp)
virtual

Set response function.

Parameters
[in]rspResponse function.
Exceptions
GException::invalid_argumentSpecified response is not a COMPTEL response.

Sets the response function for the observation.

Implements GObservation.

Definition at line 286 of file GCOMObservation.cpp.

References G_RESPONSE, m_response, and GObservation::name().

Referenced by GCOMDri::compute_drm_ptsrc().

const GCOMResponse * GCOMObservation::response ( void  ) const
inlinevirtual

Return response function.

Returns
Response function.

Implements GObservation.

Definition at line 188 of file GCOMObservation.hpp.

References m_response.

Referenced by print(), and read().

void GCOMObservation::response ( const GCaldb caldb,
const std::string &  rspname 
)

Set response function.

Parameters
[in]caldbCalibration database.
[in]rspnameName of COMPTEL response.

Sets the response function by loading the response information from the calibration database.

Definition at line 315 of file GCOMObservation.cpp.

References GCOMResponse::caldb(), GCOMResponse::clear(), GCOMResponse::load(), and m_response.

const GCOMTim & GCOMObservation::tim ( void  ) const
inline

Return COMPTEL Good Time Intervals.

Returns
COMPTEL Good Time Intervals.

Definition at line 385 of file GCOMObservation.hpp.

References m_tim.

Referenced by GCOMDri::compute_dre(), GCOMDri::compute_drg(), and GCOMDri::compute_drx().

void GCOMObservation::write ( GXmlElement xml) const
virtual

Write observation into XML element.

Parameters
[in]xmlXML element.

Writes information for a COMPTEL observation into an XML element. The method supports both an unbinned and a binned observation.

For an unbinned observation the XML format is

<observation name="Crab" id="000001" instrument="COM">
  <parameter name="EVP" file="m16992_evp.fits"/>
  <parameter name="TIM" file="m10695_tim.fits"/>
  <parameter name="OAD" file="m20039_oad.fits"/>
  <parameter name="OAD" file="m20041_oad.fits"/>
  ...
</observation>

where the observation can contain an arbitrary number of OAD file parameters. The file attribute provide either absolute or relative file name. If a file name includes no access path it is assumed that the file resides in the same location as the XML file.

For a binned observation the XML format is

<observation name="Crab" id="000001" instrument="COM">
  <parameter name="DRE" file="m50438_dre.fits"/>
  <parameter name="DRB" file="m34997_drg.fits"/>
  <parameter name="DRG" file="m34997_drg.fits"/>
  <parameter name="DRX" file="m32171_drx.fits"/>
  <parameter name="IAQ" value="UNH(1.0-3.0)MeV"/>
</observation>

Implements GObservation.

Definition at line 462 of file GCOMObservation.cpp.

References GXmlNode::append(), GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), G_WRITE, is_binned(), is_unbinned(), m_drbname, m_drename, m_drgname, m_drxname, m_evpname, m_oadnames, m_response, m_timname, GXmlNode::remove(), GCOMResponse::rspname(), gammalib::xml_file_reduce(), and gammalib::xml_need_par().

void GCOMObservation::write_attributes ( GFitsHDU hdu) const
protected

Write observation attributes.

Parameters
[in]hduFITS HDU pointer

Nothing is done if the HDU pointer is NULL.

Todo:
Implement method.

Definition at line 1185 of file GCOMObservation.cpp.

Member Data Documentation

double GCOMObservation::m_deadc
protected

Deadtime correction.

Definition at line 146 of file GCOMObservation.hpp.

Referenced by copy_members(), deadc(), init_members(), load(), load_dre(), and print().

GSkyMap GCOMObservation::m_drb
protected

Background model.

Definition at line 153 of file GCOMObservation.hpp.

Referenced by copy_members(), drb(), init_members(), and load_drb().

GFilename GCOMObservation::m_drbname
protected

DRB filename.

Definition at line 150 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load_drb(), and write().

GFilename GCOMObservation::m_drename
protected

DRE filename.

Definition at line 149 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load_drb(), load_dre(), load_drg(), and write().

GSkyMap GCOMObservation::m_drg
protected

Geometry factors.

Definition at line 154 of file GCOMObservation.hpp.

Referenced by copy_members(), drg(), init_members(), and load_drg().

GFilename GCOMObservation::m_drgname
protected

DRG filename.

Definition at line 151 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load_drg(), and write().

std::vector<GCOMDri> GCOMObservation::m_drms
protected

Convolved model cubes.

Definition at line 166 of file GCOMObservation.hpp.

Referenced by add_drm(), copy_members(), drm(), init_members(), and remove_response_cache().

GSkyMap GCOMObservation::m_drx
protected

Exposure map.

Definition at line 155 of file GCOMObservation.hpp.

Referenced by copy_members(), drx(), init_members(), and load_drx().

GFilename GCOMObservation::m_drxname
protected

DRX filename.

Definition at line 152 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load_drx(), and write().

GFilename GCOMObservation::m_evpname
protected

EVP filename.

Definition at line 159 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load(), and write().

double GCOMObservation::m_ewidth
protected

Energy width (MeV)

Definition at line 156 of file GCOMObservation.hpp.

Referenced by copy_members(), ewidth(), init_members(), and load_dre().

std::string GCOMObservation::m_instrument
protected

Instrument name.

Definition at line 141 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), instrument(), and read().

double GCOMObservation::m_livetime
protected

Livetime (sec)

Definition at line 145 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), livetime(), load(), and load_dre().

std::vector<GFilename> GCOMObservation::m_oadnames
protected

OAD filenames.

Definition at line 161 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load(), and write().

GCOMOads GCOMObservation::m_oads
protected

Orbit Aspect Data.

Definition at line 163 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load(), oads(), and print().

double GCOMObservation::m_obs_id
protected

Observation ID.

Definition at line 143 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), obs_id(), and read_attributes().

double GCOMObservation::m_ontime
protected

Ontime (sec)

Definition at line 144 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load(), load_dre(), and ontime().

GCOMResponse GCOMObservation::m_response
protected

Response functions.

Definition at line 142 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), response(), and write().

GCOMTim GCOMObservation::m_tim
protected

COMPTEL Good Time Intervals.

Definition at line 162 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load(), print(), and tim().

GFilename GCOMObservation::m_timname
protected

TIM filename.

Definition at line 160 of file GCOMObservation.hpp.

Referenced by copy_members(), init_members(), load(), and write().


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