GammaLib
2.1.0.dev
|
COMPTEL DRB model Phibar bin fitting class. More...
#include <GCOMModelDRBPhibarBins.hpp>
Public Member Functions | |
GCOMModelDRBPhibarBins (void) | |
Void constructor. More... | |
GCOMModelDRBPhibarBins (const GXmlElement &xml) | |
XML constructor. More... | |
GCOMModelDRBPhibarBins (const GCOMModelDRBPhibarBins &model) | |
Copy constructor. More... | |
virtual | ~GCOMModelDRBPhibarBins (void) |
Destructor. More... | |
virtual GCOMModelDRBPhibarBins & | operator= (const GCOMModelDRBPhibarBins &model) |
Assignment operator. More... | |
virtual void | clear (void) |
Clear instance. More... | |
virtual GCOMModelDRBPhibarBins * | clone (void) const |
Clone instance. More... | |
virtual std::string | classname (void) const |
Return class name. More... | |
virtual std::string | type (void) const |
Return model type. More... | |
virtual bool | is_constant (void) const |
Signals if model is temporally constant. More... | |
virtual double | eval (const GEvent &event, const GObservation &obs, const bool &gradients=false) const |
Evaluate function. More... | |
virtual double | npred (const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const |
Return spatially integrated data model. More... | |
virtual GCOMEventCube * | mc (const GObservation &obs, GRan &ran) const |
Return simulated list of events. More... | |
virtual void | read (const GXmlElement &xml) |
Read model from XML element. More... | |
virtual void | write (GXmlElement &xml) const |
Write model into XML element. More... | |
virtual std::string | print (const GChatter &chatter=NORMAL) const |
Print model information. More... | |
Public Member Functions inherited from GModelData | |
GModelData (void) | |
Void constructor. More... | |
GModelData (const GXmlElement &xml) | |
XML constructor. More... | |
GModelData (const GModelData &model) | |
Copy constructor. More... | |
virtual | ~GModelData (void) |
Destructor. More... | |
virtual GModelData & | operator= (const GModelData &model) |
Assignment operator. More... | |
virtual GVector | eval (const GObservation &obs, GMatrixSparse *gradients=NULL) const |
Return model values and gradients. More... | |
Public Member Functions inherited from GModel | |
GModel (void) | |
Void constructor. More... | |
GModel (const GXmlElement &xml) | |
XML constructor. More... | |
GModel (const GModel &model) | |
Copy constructor. More... | |
virtual | ~GModel (void) |
Destructor. More... | |
virtual GModel & | operator= (const GModel &model) |
Assignment operator. More... | |
virtual GModelPar & | operator[] (const int &index) |
Returns reference to model parameter by index. More... | |
virtual const GModelPar & | operator[] (const int &index) const |
Returns reference to model parameter by index (const version) More... | |
virtual GModelPar & | operator[] (const std::string &name) |
Returns reference to model parameter by name. More... | |
virtual const GModelPar & | operator[] (const std::string &name) const |
Returns reference to model parameter by name const version) More... | |
int | size (void) const |
Return number of parameters in model. More... | |
int | scales (void) const |
Return number of scale parameters in model. More... | |
GModelPar & | at (const int &index) |
Returns reference to model parameter by index. More... | |
const GModelPar & | at (const int &index) const |
Returns reference to model parameter by index (const version) More... | |
bool | has_par (const std::string &name) const |
Checks if parameter name exists. More... | |
bool | has_scales (void) const |
Signals that model has scales. More... | |
const std::string & | name (void) const |
Return parameter name. More... | |
void | name (const std::string &name) |
Set parameter name. More... | |
const double & | ts (void) const |
Return Test Statistic value. More... | |
void | ts (const double &ts) |
Set Test Statistic value. More... | |
const bool & | tscalc (void) const |
Return Test Statistic computation flag. More... | |
void | tscalc (const bool &tscalc) |
Set Test Statistic computation flag. More... | |
const bool & | has_ts (void) const |
Signals that model has Test Statistics value. More... | |
std::string | instruments (void) const |
Returns instruments to which model applies. More... | |
void | instruments (const std::string &instruments) |
Set instruments to which model applies. More... | |
GModelPar & | scale (const int &index) |
Returns reference to scale parameter by index. More... | |
const GModelPar & | scale (const int &index) const |
Returns reference to scale parameter by index (const version) More... | |
GModelPar | scale (const std::string &instrument) const |
Returns model scale factor for a given instrument. More... | |
void | scale (const GModelPar &par) |
Set model scale factor for a given instrument. More... | |
std::string | ids (void) const |
Returns observation identifiers to which model applies. More... | |
void | ids (const std::string &ids) |
Set observation identifiers to which model applies. More... | |
bool | is_valid (const std::string &instruments, const std::string &ids) const |
Verifies if model is valid for a given instrument and identifier. More... | |
const GModelAssociations & | associations (void) const |
Return model associations. More... | |
void | associations (const GModelAssociations &associations) |
Set model associations. More... | |
const bool & | has_eval_indices (void) const |
Signals that parameter indices updated by eval() method were set. More... | |
const std::vector< int > & | eval_indices (void) const |
Return vector of parameter indices updated by eval() method. 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 GCOMModelDRBPhibarBins &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | set_pointers (void) |
Set pointers. More... | |
Protected Member Functions inherited from GModelData | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GModelData &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
Protected Member Functions inherited from GModel | |
void | init_members (void) |
Initialise class members. More... | |
void | copy_members (const GModel &model) |
Copy class members. More... | |
void | free_members (void) |
Delete class members. More... | |
void | read_attributes (const GXmlElement &xml) |
Read model attributes. More... | |
void | write_attributes (GXmlElement &xml) const |
Write model attributes. More... | |
std::string | print_attributes (void) const |
Print model attributes. More... | |
void | read_scales (const GXmlElement &xml) |
Read instrument scales from XML element. More... | |
void | write_scales (GXmlElement &xml) const |
Write instrument scales into XML element. More... | |
Protected Attributes | |
std::vector< GModelPar > | m_values |
Normalisation values. More... | |
Protected Attributes inherited from GModel | |
std::string | m_name |
Model name. More... | |
std::vector< std::string > | m_instruments |
Instruments to which model applies. More... | |
std::vector< GModelPar > | m_scales |
Model instrument scale factors. More... | |
std::vector< std::string > | m_ids |
Identifiers to which model applies. More... | |
std::vector< GModelPar * > | m_pars |
Pointers to all model parameters. More... | |
GModelAssociations | m_associations |
Model associations. More... | |
bool | m_has_ts |
Signals if TS is available. More... | |
bool | m_has_tscalc |
Signals if tscalc attribute is available. More... | |
bool | m_tscalc |
Signals if TS should be computed. More... | |
double | m_ts |
Test Statistic of the model. More... | |
bool | m_has_eval_inx |
std::vector< int > | m_eval_inx |
COMPTEL DRB model Phibar bin fitting class.
This class implements a COMPTEL background model that is based on fitting of a DRB model. The model parameters are a set of normalization parameters defined for a given Phibar value.
Definition at line 51 of file GCOMModelDRBPhibarBins.hpp.
GCOMModelDRBPhibarBins::GCOMModelDRBPhibarBins | ( | void | ) |
Void constructor.
Constructs an empty COMPTEL DRB Phibar bin fitting model.
Definition at line 74 of file GCOMModelDRBPhibarBins.cpp.
References init_members().
Referenced by clone().
|
explicit |
XML constructor.
[in] | xml | XML element. |
Constructs a COMPTEL DRB Phibar bin fitting model from the information that is found in an XML element. Please refer to the method GCOMModelDRBPhibarBins::read to learn more about the information that is expected in the XML element.
Definition at line 94 of file GCOMModelDRBPhibarBins.cpp.
References init_members(), and read().
GCOMModelDRBPhibarBins::GCOMModelDRBPhibarBins | ( | const GCOMModelDRBPhibarBins & | model | ) |
Copy constructor.
[in] | model | COMPTEL DRB Phibar bin fitting model. |
Constructs a COMPTEL DRB Phibar bin fitting model by copying information from an existing model. Note that the copy is a deep copy, so the original object can be destroyed after the copy without any loss of information.
Definition at line 117 of file GCOMModelDRBPhibarBins.cpp.
References copy_members(), and init_members().
|
virtual |
Destructor.
Destroys a COMPTEL DRB Phibar bin fitting model.
Definition at line 136 of file GCOMModelDRBPhibarBins.cpp.
References free_members().
|
inlinevirtual |
Return class name.
Implements GModelData.
Definition at line 97 of file GCOMModelDRBPhibarBins.hpp.
|
virtual |
Clear instance.
Resets the object to a clean initial state. All information that resided in the object will be lost.
Implements GModelData.
Definition at line 199 of file GCOMModelDRBPhibarBins.cpp.
References free_members(), GModelData::free_members(), GModel::free_members(), init_members(), GModelData::init_members(), and GModel::init_members().
|
virtual |
Clone instance.
Clone a COMPTEL DRB Phibar bin fitting model. Cloning performs a deep copy of the information, so the original object can be destroyed after cloning without any loss of information.
Implements GModelData.
Definition at line 225 of file GCOMModelDRBPhibarBins.cpp.
References GCOMModelDRBPhibarBins().
|
protected |
Copy class members.
[in] | model | Model. |
Definition at line 621 of file GCOMModelDRBPhibarBins.cpp.
References m_values, and set_pointers().
Referenced by GCOMModelDRBPhibarBins(), and operator=().
|
virtual |
Evaluate function.
[in] | event | Observed event. |
[in] | obs | Observation. |
[in] | gradients | Compute gradients? |
GException::invalid_argument | Observation is not a COMPTEL observation. Event is not a COMPTEL event bin. |
GException::invalid_value | Model incompatible with data space. |
Evaluates the COMPTEL DRB Phibar bin fitting model.
Implements GModelData.
Definition at line 247 of file GCOMModelDRBPhibarBins.cpp.
References GCOMObservation::drb(), G_EVAL, GCOMEventBin::index(), gammalib::is_infinite(), gammalib::is_notanumber(), m_values, GCOMDri::map(), GModel::name(), GSkyMap::nmaps(), GSkyMap::npix(), GSkyMap::pixels(), GModel::scale(), GCOMEventBin::size(), GModel::size(), and gammalib::str().
|
protected |
Delete class members.
Definition at line 637 of file GCOMModelDRBPhibarBins.cpp.
Referenced by clear(), operator=(), and ~GCOMModelDRBPhibarBins().
|
protected |
Initialise class members.
Definition at line 606 of file GCOMModelDRBPhibarBins.cpp.
References m_values.
Referenced by clear(), GCOMModelDRBPhibarBins(), and operator=().
|
inlinevirtual |
Signals if model is temporally constant.
Signals if the model is temporally constant. By definition, a DRB Phibar bin fitting model is always temporally constant.
Implements GModelData.
Definition at line 127 of file GCOMModelDRBPhibarBins.hpp.
|
virtual |
Return simulated list of events.
[in] | obs | Observation. |
[in] | ran | Random number generator. |
GException::feature_not_implemented | Method is not implemented. |
Draws a sample of events from the COMPTEL DRB Phibar bin fitting model using a Monte Carlo simulation.
Implements GModelData.
Definition at line 396 of file GCOMModelDRBPhibarBins.cpp.
References G_MC.
|
virtual |
Return spatially integrated data model.
[in] | obsEng | Measured event energy. |
[in] | obsTime | Measured event time. |
[in] | obs | Observation. |
GException::feature_not_implemented | Method is not implemented. |
Spatially integrates the data model for a given measured event energy and event time.
Implements GModelData.
Definition at line 365 of file GCOMModelDRBPhibarBins.cpp.
References G_NRED.
|
virtual |
Assignment operator.
[in] | model | COMPTEL DRB Phibar bin fitting model. |
Assigns the information from a COMPTEL DRB Phibar bin fitting model to the actual object. Note that a deep copy of the information is performed, so the original object can be destroyed after the assignment without any loss of information.
Definition at line 163 of file GCOMModelDRBPhibarBins.cpp.
References copy_members(), free_members(), init_members(), and GModelData::operator=().
Print model information.
[in] | chatter | Chattiness. |
Implements GModelData.
Definition at line 569 of file GCOMModelDRBPhibarBins.cpp.
References GModel::m_pars, gammalib::parformat(), GModel::print_attributes(), SILENT, GModel::size(), and gammalib::str().
|
virtual |
Read model from XML element.
[in] | xml | XML element. |
Read the COMPTEL DRB Phibar bin fitting model from an XML element.
The model is composed of normalization values that define the scale factors for all Phibar layers. The following XML file syntax is expected:
<source name="Background" type="DRBPhibarBins" instrument="COM"> <parameter name="Normalization" .../> ... <parameter name="Normalization" .../> </source>
Implements GModelData.
Definition at line 428 of file GCOMModelDRBPhibarBins.cpp.
References GXmlNode::element(), GXmlNode::elements(), GOptimizerPar::has_grad(), m_values, GOptimizerPar::name(), GModelPar::read(), GModel::read_attributes(), set_pointers(), gammalib::str(), and GOptimizerPar::unit().
Referenced by GCOMModelDRBPhibarBins().
|
protected |
Set pointers.
Set pointers to all model parameters. The pointers are stored in a vector that is member of the GModel base class.
Definition at line 650 of file GCOMModelDRBPhibarBins.cpp.
References GModel::m_pars, and m_values.
Referenced by copy_members(), and read().
|
inlinevirtual |
Return model type.
Returns the type of the model. The type for a DRB Phibar bin fitting model is "DRBPhibarBins".
Implements GModelData.
Definition at line 112 of file GCOMModelDRBPhibarBins.hpp.
Referenced by write().
|
virtual |
Write model into XML element.
[in] | xml | XML element. |
GException::invalid_value | Existing XML element is not of required type Invalid number of model parameters or bins found in XML element. |
Write the COMPTEL DRB Phibar bin fitting model into an XML element.
The model is composed of normalization values that define the scale factors for all Phibar layers. The following XML file syntax is expected:
<source name="Background" type="DRBPhibarBins" instrument="COM"> <parameter name="Normalization" .../> ... <parameter name="Normalization" .../> </source>
Implements GModelData.
Definition at line 491 of file GCOMModelDRBPhibarBins.cpp.
References GXmlNode::append(), GXmlElement::attribute(), GXmlNode::element(), GXmlNode::elements(), G_WRITE, GModel::instruments(), m_values, GModel::name(), GOptimizerPar::name(), gammalib::str(), type(), GModelPar::write(), and GModel::write_attributes().
|
protected |
Normalisation values.
Definition at line 87 of file GCOMModelDRBPhibarBins.hpp.
Referenced by copy_members(), eval(), init_members(), read(), set_pointers(), and write().