GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCOMModelDRM.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCOMModelDRM.hpp - COMPTEL DRM model class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2021 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 GCOMModelDRM.hpp
23  * @brief COMPTEL DRM model class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCOMMODELDRM_HPP
28 #define GCOMMODELDRM_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 GCOMModelDRM
43  *
44  * @brief COMPTEL DRM model class
45  *
46  * This class implements a COMPTEL data space model. The model has a
47  * normalization parameters.
48  ***************************************************************************/
49 class GCOMModelDRM : public GModelData {
50 
51 public:
52  // Constructors and destructors
53  GCOMModelDRM(void);
54  explicit GCOMModelDRM(const GXmlElement& xml);
55  GCOMModelDRM(const GCOMModelDRM& model);
56  virtual ~GCOMModelDRM(void);
57 
58  // Operators
59  virtual GCOMModelDRM& operator=(const GCOMModelDRM& model);
60 
61  // Implemented pure virtual methods
62  virtual void clear(void);
63  virtual GCOMModelDRM* clone(void) const;
64  virtual std::string classname(void) const;
65  virtual std::string type(void) const;
66  virtual bool is_constant(void) const;
67  virtual double eval(const GEvent& event,
68  const GObservation& obs,
69  const bool& gradients = false) const;
70  virtual double npred(const GEnergy& obsEng, const GTime& obsTime,
71  const GObservation& obs) const;
72  virtual GCOMEventCube* mc(const GObservation& obs, GRan& ran) const;
73  virtual void read(const GXmlElement& xml);
74  virtual void write(GXmlElement& xml) const;
75  virtual std::string print(const GChatter& chatter = NORMAL) const;
76 
77 protected:
78  // Protected methods
79  void init_members(void);
80  void copy_members(const GCOMModelDRM& model);
81  void free_members(void);
82 
83  // Proteced data members
84  GModelPar m_norm; //!< Normalisation
85  GCOMDri m_drm; //!< Model
86  GFilename m_filename; //!< Name of DRM FITS file
87 };
88 
89 
90 /***********************************************************************//**
91  * @brief Return class name
92  *
93  * @return String containing the class name ("GCOMModelDRM").
94  ***************************************************************************/
95 inline
96 std::string GCOMModelDRM::classname(void) const
97 {
98  return ("GCOMModelDRM");
99 }
100 
101 
102 /***********************************************************************//**
103  * @brief Return model type
104  *
105  * @return Model type.
106  *
107  * Returns the type of the model. The type for a DRM model is "DRM".
108  ***************************************************************************/
109 inline
110 std::string GCOMModelDRM::type(void) const
111 {
112  return ("DRM");
113 }
114 
115 
116 /***********************************************************************//**
117  * @brief Signals if model is temporally constant
118  *
119  * @return True if model is temporally constant, false otherwise.
120  *
121  * Signals if the model is temporally constant. By definition, a DRM model
122  * is always temporally constant.
123  ***************************************************************************/
124 inline
126 {
127  return (true);
128 }
129 
130 #endif /* GCOMMODELDRM_HPP */
virtual void clear(void)
Clear instance.
virtual GCOMModelDRM * clone(void) const
Clone instance.
virtual double npred(const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const
Return spatially integrated DRM model.
XML element node class interface definition.
virtual GCOMEventCube * mc(const GObservation &obs, GRan &ran) const
Return simulated list of events.
Abstract interface for the event classes.
Definition: GEvent.hpp:71
XML element node class.
Definition: GXmlElement.hpp:48
Random number generator class.
Definition: GRan.hpp:44
void init_members(void)
Initialise class members.
Time class.
Definition: GTime.hpp:55
virtual void write(GXmlElement &xml) const
Write model into XML element.
Model parameter class interface definition.
Model parameter class.
Definition: GModelPar.hpp:87
virtual ~GCOMModelDRM(void)
Destructor.
Node array class interface definition.
virtual std::string classname(void) const
Return class name.
Filename class.
Definition: GFilename.hpp:62
Abstract data model base class interface definition.
Abstract event base class definition.
virtual bool is_constant(void) const
Signals if model is temporally constant.
Abstract data model class.
Definition: GModelData.hpp:55
GChatter
Definition: GTypemaps.hpp:33
GCOMDri m_drm
Model.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print model information.
Abstract observation base class.
COMPTEL event bin container class.
Abstract observation base class interface definition.
GFilename m_filename
Name of DRM FITS file.
void copy_members(const GCOMModelDRM &model)
Copy class members.
void free_members(void)
Delete class members.
GCOMModelDRM(void)
Void constructor.
GModelPar m_norm
Normalisation.
COMPTEL Data Space class.
Definition: GCOMDri.hpp:61
virtual double eval(const GEvent &event, const GObservation &obs, const bool &gradients=false) const
Evaluate function.
COMPTEL event bin container class interface definition.
virtual std::string type(void) const
Return model type.
virtual void read(const GXmlElement &xml)
Read model from XML element.
COMPTEL DRM model class.
virtual GCOMModelDRM & operator=(const GCOMModelDRM &model)
Assignment operator.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48