GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GCTAModelSpatialMultiplicative.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GCTAModelSpatialMultiplicative.hpp - Multiplicative spatial model class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2018-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 GCTAModelSpatialMultiplicative.hpp
23  * @brief Multiplicative spatial model class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GCTAMODELSPATIALMULTIPLICATIVE_HPP
28 #define GCTAMODELSPATIALMULTIPLICATIVE_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include <vector>
33 #include "GCTAModelSpatial.hpp"
34 
35 /* __ Forward declarations _______________________________________________ */
36 class GRan;
37 class GXmlElement;
38 class GCTAInstDir;
39 class GEnergy;
40 class GTime;
41 class GCTAInstDir;
42 class GCTAObservation;
43 
44 
45 /***********************************************************************//**
46  * @class GCTAModelSpatialMultiplicative
47  *
48  * @brief Multiplicative spatial model class
49  *
50  * This class implements a multiplicative spatial component of the CTA
51  * background model.
52  ***************************************************************************/
54 
55 public:
56  // Constructors and destructors
58  explicit GCTAModelSpatialMultiplicative(const GXmlElement& xml);
60  virtual ~GCTAModelSpatialMultiplicative(void);
61 
62  // Operators
64 
65  // Pure virtual methods
66  virtual void clear(void);
67  virtual GCTAModelSpatialMultiplicative* clone(void) const;
68  virtual std::string classname(void) const;
69  virtual std::string type(void) const;
70  virtual double eval(const GCTAInstDir& dir,
71  const GEnergy& energy,
72  const GTime& time,
73  const bool& gradients = false) const;
74  virtual double mc_max_value(const GCTAObservation& obs) 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 
79  // Other methods
80  void append(const GCTAModelSpatial& spatial,
81  const std::string& name="");
82  int components(void) const;
83  const GCTAModelSpatial* component(const int& index) const;
84  const GCTAModelSpatial* component(const std::string& name) const;
85 
86 protected:
87  // Protected methods
88  void init_members(void);
90  void free_members(void);
91 
92  // Protected members
93  std::string m_type; //!< Model type
94  std::vector<GCTAModelSpatial*> m_spatial; //!< Container of spatial models
95  std::vector<std::string> m_components; //!< Names of components
96 };
97 
98 
99 /***********************************************************************//**
100  * @brief Return class name
101  *
102  * @return String containing the class name ("GCTAModelSpatialMultiplicative").
103  ***************************************************************************/
104 inline
106 {
107  return ("GCTAModelSpatialMultiplicative");
108 }
109 
110 
111 /***********************************************************************//**
112  * @brief Return model type
113  *
114  * @return Model type.
115  *
116  * Returns the type of the spatial multiplicative model.
117  ***************************************************************************/
118 inline
120 {
121  return (m_type);
122 }
123 
124 
125 /***********************************************************************//**
126  * @brief Return number of spatial components
127  *
128  * @return Number of model components.
129  *
130  * Returns the number of spatial components.
131  ***************************************************************************/
132 inline
134 {
135  return ((int)m_spatial.size());
136 }
137 
138 #endif /* GCTAMODELSPATIALMULTIPLICATIVE_HPP */
void free_members(void)
Delete class members.
Abstract spatial model class.
int components(void) const
Return number of spatial components.
virtual void clear(void)
Clear instance.
Multiplicative spatial model class.
XML element node class.
Definition: GXmlElement.hpp:48
const GCTAModelSpatial * component(const int &index) const
Return spatial model component by index.
Random number generator class.
Definition: GRan.hpp:44
virtual double eval(const GCTAInstDir &dir, const GEnergy &energy, const GTime &time, const bool &gradients=false) const
Evaluate function (in units of sr^-1)
void copy_members(const GCTAModelSpatialMultiplicative &model)
Copy class members.
Time class.
Definition: GTime.hpp:55
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual double mc_max_value(const GCTAObservation &obs) const
Return maximum function value for Monte Carlo simulations.
std::vector< std::string > m_components
Names of components.
virtual void read(const GXmlElement &xml)
Read model from XML element.
void init_members(void)
Initialise class members.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print multiplicative spatial model information.
virtual GCTAModelSpatialMultiplicative & operator=(const GCTAModelSpatialMultiplicative &model)
Assignment operator.
virtual GCTAModelSpatialMultiplicative * clone(void) const
Clone instance.
virtual ~GCTAModelSpatialMultiplicative(void)
Destructor.
GChatter
Definition: GTypemaps.hpp:33
virtual std::string type(void) const
Return model type.
Abstract spatial model class interface definition.
virtual std::string classname(void) const
Return class name.
void append(const GCTAModelSpatial &spatial, const std::string &name="")
Append spatial component.
GCTAModelSpatialMultiplicative(void)
Void constructor.
CTA instrument direction class.
Definition: GCTAInstDir.hpp:63
CTA observation class.
std::vector< GCTAModelSpatial * > m_spatial
Container of spatial models.
Class that handles energies in a unit independent way.
Definition: GEnergy.hpp:48