GammaLib 2.0.0
Loading...
Searching...
No Matches
GCOMModelDRBPhibarNodes.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCOMModelDRBPhibarNodes.hpp - COMPTEL DRB model fitting class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2012-2022 by Juergen Knoedlseder *
5 * ----------------------------------------------------------------------- *
6 * *
7 * This program is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19 * *
20 ***************************************************************************/
21/**
22 * @file GCOMModelDRBPhibarNodes.hpp
23 * @brief COMPTEL DRB Phibar nodes model fitting class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCOMMODELDRBPHIBARNODES_HPP
28#define GCOMMODELDRBPHIBARNODES_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include "GModelData.hpp"
33#include "GModelPar.hpp"
34#include "GEvent.hpp"
35#include "GObservation.hpp"
36#include "GNodeArray.hpp"
37#include "GXmlElement.hpp"
38#include "GCOMEventCube.hpp"
39
40
41/***********************************************************************//**
42 * @class GCOMModelDRBPhibarNodes
43 *
44 * @brief COMPTEL DRB Phibar nodes model fitting class
45 *
46 * This class implements a COMPTEL background model that is based on fitting
47 * of a DRB model. The model parameters are a set of normalization parameters
48 * defined for a given Phibar value, and linear interpolations are performed
49 * between these values.
50 ***************************************************************************/
52
53public:
54 // Constructors and destructors
56 explicit GCOMModelDRBPhibarNodes(const GXmlElement& xml);
58 virtual ~GCOMModelDRBPhibarNodes(void);
59
60 // Operators
62
63 // Implemented pure virtual methods
64 virtual void clear(void);
65 virtual GCOMModelDRBPhibarNodes* clone(void) const;
66 virtual std::string classname(void) const;
67 virtual std::string type(void) const;
68 virtual bool is_constant(void) const;
69 virtual double eval(const GEvent& event,
70 const GObservation& obs,
71 const bool& gradients = false) const;
72 virtual double npred(const GEnergy& obsEng, const GTime& obsTime,
73 const GObservation& obs) const;
74 virtual GCOMEventCube* mc(const GObservation& obs, GRan& ran) const;
75 virtual void read(const GXmlElement& xml);
76 virtual void write(GXmlElement& xml) const;
77 virtual std::string print(const GChatter& chatter = NORMAL) const;
78
79protected:
80 // Protected methods
81 void init_members(void);
82 void copy_members(const GCOMModelDRBPhibarNodes& model);
83 void free_members(void);
84 void set_pointers(void);
85 void set_cache(void) const;
86 void update_cache(void) const;
87
88 // Proteced data members
89 std::vector<GModelPar> m_phibars; //!< Node Phibar values
90 std::vector<GModelPar> m_values; //!< Node values
91
92 // Evaluation cache
93 mutable bool m_scale; //!< Model is a scale factor
94 mutable bool m_fixed; //!< All Phibar values are fixed
95 mutable std::vector<double> m_old_phibars; //!< Old Phibar values
96 mutable GNodeArray m_nodes; //!< Phibar node values
97};
98
99
100/***********************************************************************//**
101 * @brief Return class name
102 *
103 * @return String containing the class name ("GCOMModelDRBPhibarNodes").
104 ***************************************************************************/
105inline
107{
108 return ("GCOMModelDRBPhibarNodes");
109}
110
111
112/***********************************************************************//**
113 * @brief Return model type
114 *
115 * @return Model type.
116 *
117 * Returns the type of the model. The type for a DRB fitting model is
118 * "DRBPhibarNodes".
119 ***************************************************************************/
120inline
121std::string GCOMModelDRBPhibarNodes::type(void) const
122{
123 return ("DRBPhibarNodes");
124}
125
126
127/***********************************************************************//**
128 * @brief Signals if model is temporally constant
129 *
130 * @return True if model is temporally constant, false otherwise.
131 *
132 * Signals if the model is temporally constant. By definition, a DRB fitting
133 * model is always temporally constant.
134 ***************************************************************************/
135inline
137{
138 return (true);
139}
140
141#endif /* GCOMMODELDRBPHIBARNODES_HPP */
COMPTEL event bin container class interface definition.
Abstract event base class definition.
Abstract data model base class interface definition.
Model parameter class interface definition.
Node array class interface definition.
Abstract observation base class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
XML element node class interface definition.
COMPTEL event bin container class.
COMPTEL DRB Phibar nodes model fitting class.
void free_members(void)
Delete class members.
GNodeArray m_nodes
Phibar node values.
std::vector< GModelPar > m_values
Node values.
virtual std::string classname(void) const
Return class name.
void set_cache(void) const
Set evaluation cache.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual double npred(const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const
Return spatially integrated data model.
virtual GCOMEventCube * mc(const GObservation &obs, GRan &ran) const
Return simulated list of events.
virtual GCOMModelDRBPhibarNodes & operator=(const GCOMModelDRBPhibarNodes &model)
Assignment operator.
std::vector< double > m_old_phibars
Old Phibar values.
bool m_scale
Model is a scale factor.
GCOMModelDRBPhibarNodes(void)
Void constructor.
void init_members(void)
Initialise class members.
virtual GCOMModelDRBPhibarNodes * clone(void) const
Clone instance.
virtual ~GCOMModelDRBPhibarNodes(void)
Destructor.
virtual void clear(void)
Clear instance.
void set_pointers(void)
Set pointers.
virtual double eval(const GEvent &event, const GObservation &obs, const bool &gradients=false) const
Evaluate function.
void update_cache(void) const
Update evaluation cache.
bool m_fixed
All Phibar values are fixed.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print model information.
virtual void write(GXmlElement &xml) const
Write model into XML element.
std::vector< GModelPar > m_phibars
Node Phibar values.
virtual bool is_constant(void) const
Signals if model is temporally constant.
virtual std::string type(void) const
Return model type.
void copy_members(const GCOMModelDRBPhibarNodes &model)
Copy class members.
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Abstract interface for the event classes.
Definition GEvent.hpp:71
Abstract data model class.
Node array class.
Abstract observation base class.
Random number generator class.
Definition GRan.hpp:44
Time class.
Definition GTime.hpp:55
XML element node class.