GammaLib  2.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GModelData.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GModelData.hpp - Abstract virtual data model class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2011-2020 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 GModelData.hpp
23  * @brief Abstract data model base class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GMODELDATA_HPP
28 #define GMODELDATA_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <vector>
32 #include <string>
33 #include "GModel.hpp"
34 
35 /* __ Forward declarations _______________________________________________ */
36 class GEnergy;
37 class GTime;
38 class GEvent;
39 class GEvents;
40 class GObservation;
41 class GRan;
42 class GXmlElement;
43 class GVector;
44 class GMatrixSparse;
45 
46 
47 /***********************************************************************//**
48  * @class GModelData
49  *
50  * @brief Abstract data model class
51  *
52  * This abstract base class implements a model of the event distribution in
53  * the instrument's data space.
54  ***************************************************************************/
55 class GModelData : public GModel {
56 
57 public:
58  // Constructors and destructors
59  GModelData(void);
60  explicit GModelData(const GXmlElement& xml);
61  GModelData(const GModelData& model);
62  virtual ~GModelData(void);
63 
64  // Operators
65  virtual GModelData& operator=(const GModelData& model);
66 
67  // Pure virtual methods
68  virtual void clear(void) = 0;
69  virtual GModelData* clone(void) const = 0;
70  virtual std::string classname(void) const = 0;
71  virtual std::string type(void) const = 0;
72  virtual bool is_constant(void) const = 0;
73  virtual double eval(const GEvent& event,
74  const GObservation& obs,
75  const bool& gradients = false) const = 0;
76  virtual double npred(const GEnergy& obsEng, const GTime& obsTime,
77  const GObservation& obs) const = 0;
78  virtual GEvents* mc(const GObservation& obs, GRan& ran) const = 0;
79  virtual void read(const GXmlElement& xml) = 0;
80  virtual void write(GXmlElement& xml) const = 0;
81  virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
82 
83  // Implemented pure virtual base class methods
84  virtual GVector eval(const GObservation& obs,
85  GMatrixSparse* gradients = NULL) const;
86 
87 protected:
88  // Protected methods
89  void init_members(void);
90  void copy_members(const GModelData& model);
91  void free_members(void);
92 };
93 
94 #endif /* GMODELDATA_HPP */
Abstract model class.
Definition: GModel.hpp:100
Abstract model base class interface definition.
Sparse matrix class interface definition.
virtual bool is_constant(void) const =0
Abstract interface for the event classes.
Definition: GEvent.hpp:71
XML element node class.
Definition: GXmlElement.hpp:48
void free_members(void)
Delete class members.
Definition: GModelData.cpp:300
Random number generator class.
Definition: GRan.hpp:44
Time class.
Definition: GTime.hpp:55
virtual GModelData * clone(void) const =0
Clones object.
virtual void clear(void)=0
Clear object.
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
GModelData(void)
Void constructor.
Definition: GModelData.cpp:57
Abstract data model class.
Definition: GModelData.hpp:55
virtual GModelData & operator=(const GModelData &model)
Assignment operator.
Definition: GModelData.cpp:125
virtual void read(const GXmlElement &xml)=0
GChatter
Definition: GTypemaps.hpp:33
virtual double npred(const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const =0
Abstract observation base class.
virtual GEvents * mc(const GObservation &obs, GRan &ran) const =0
virtual ~GModelData(void)
Destructor.
Definition: GModelData.cpp:103
void copy_members(const GModelData &model)
Copy class members.
Definition: GModelData.cpp:290
virtual void write(GXmlElement &xml) const =0
Abstract event container class.
Definition: GEvents.hpp:66
virtual std::string type(void) const =0
virtual std::string classname(void) const =0
Return class name.
Vector class.
Definition: GVector.hpp:46
virtual double eval(const GEvent &event, const GObservation &obs, const bool &gradients=false) const =0
void init_members(void)
Initialise class members.
Definition: GModelData.cpp:278
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48