GammaLib 2.0.0
Loading...
Searching...
No Matches
GCTAModelRadialPolynom.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCTAModelRadialPolynom.hpp - Radial Polynom CTA model class *
3 * ----------------------------------------------------------------------- *
4 * copyright (C) 2011-2018 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 GCTAModelRadialPolynom.hpp
23 * @brief Radial Polynom model class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCTAMODELRADIALPOLYNOM_HPP
28#define GCTAMODELRADIALPOLYNOM_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <vector>
33#include <cmath>
34#include "GMath.hpp"
35#include "GModelPar.hpp"
36#include "GCTAModelRadial.hpp"
37#include "GFunction.hpp"
38
39/* __ Forward declarations _______________________________________________ */
40class GRan;
41class GXmlElement;
42class GCTAObservation;
43class GCTAInstDir;
44
45
46/***********************************************************************//**
47 * @class GCTAModelRadialPolynom
48 *
49 * @brief Radial Polynom CTA model class
50 *
51 * This class implements the radial function
52 * \f[f(\theta) = \sum_{i=0}^m c_i \theta^i\f]
53 * where
54 * \f$\theta\f$ is the offset angle (in degrees), and
55 * \f$c_i\f$ are the polynomial coefficients.
56 *
57 * This function represents a Polynom in \f$\theta\f$.
58 ***************************************************************************/
60
61public:
62 // Constructors and destructors
64 explicit GCTAModelRadialPolynom(const std::vector<double>& coeffs);
65 explicit GCTAModelRadialPolynom(const GXmlElement& xml);
67 virtual ~GCTAModelRadialPolynom(void);
68
69 // Operators
71
72 // Implemented pure virtual methods
73 virtual void clear(void);
74 virtual GCTAModelRadialPolynom* clone(void) const;
75 virtual std::string classname(void) const;
76 virtual std::string type(void) const;
77 virtual double eval(const double& offset,
78 const bool& gradients = false) const;
79 virtual GCTAInstDir mc(GRan& ran) const;
80 virtual double mc_max_value(const GCTAObservation& obs) const;
81 virtual double omega(void) const;
82 virtual void read(const GXmlElement& xml);
83 virtual void write(GXmlElement& xml) const;
84 virtual std::string print(const GChatter& chatter = NORMAL) const;
85
86 // Other methods
87 //double coeff(void) const;
88 //void coeff(const double& value);
89
90protected:
91 // Protected methods
92 void init_members(void);
93 void copy_members(const GCTAModelRadialPolynom& model);
94 void free_members(void);
95 void update_pars(void);
96
97 // Radial integration class (used by omega() method). Note that the
98 // integration is done in radians
99 class integrand : public GFunction {
100 public:
101 integrand(const GCTAModelRadialPolynom* model) : m_model(model) { }
102 double eval(const double& x) {
103 return (std::sin(x)*m_model->eval(x*gammalib::rad2deg));
104 }
105 private:
107 };
108
109 // Protected members
110 std::vector<GModelPar> m_coeffs; //!< Coefficients
111};
112
113
114/***********************************************************************//**
115 * @brief Return class name
116 *
117 * @return String containing the class name ("GCTAModelRadialPolynom").
118 ***************************************************************************/
119inline
121{
122 return ("GCTAModelRadialPolynom");
123}
124
125
126/***********************************************************************//**
127 * @brief Return model type
128 *
129 * @return Model type "Polynom".
130 ***************************************************************************/
131inline
132std::string GCTAModelRadialPolynom::type(void) const
133{
134 return ("Polynom");
135}
136
137#endif /* GCTAMODELRADIALPOLYNOM_HPP */
Abstract radial acceptance model class interface definition.
Single parameter function abstract base class definition.
Mathematical function definitions.
Model parameter class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
CTA instrument direction class.
integrand(const GCTAModelRadialPolynom *model)
const GCTAModelRadialPolynom * m_model
Radial Polynom CTA model class.
virtual double eval(const double &offset, const bool &gradients=false) const
Evaluate function.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual void clear(void)
Clear instance.
virtual double mc_max_value(const GCTAObservation &obs) const
Return maximum function value for Monte Carlo simulations.
std::vector< GModelPar > m_coeffs
Coefficients.
void free_members(void)
Delete class members.
void copy_members(const GCTAModelRadialPolynom &model)
Copy class members.
virtual GCTAModelRadialPolynom & operator=(const GCTAModelRadialPolynom &model)
Assignment operator.
virtual std::string classname(void) const
Return class name.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual GCTAModelRadialPolynom * clone(void) const
Clone instance.
virtual GCTAInstDir mc(GRan &ran) const
Returns MC instrument direction.
virtual ~GCTAModelRadialPolynom(void)
Destructor.
GCTAModelRadialPolynom(void)
Void constructor.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print point source information.
void update_pars(void)
Update parameter mapping.
void init_members(void)
Initialise class members.
virtual std::string type(void) const
Return model type.
virtual double omega(void) const
Returns integral over radial model (in steradians)
Abstract radial acceptance model class.
CTA observation class.
Single parameter function abstract base class.
Definition GFunction.hpp:44
Random number generator class.
Definition GRan.hpp:44
XML element node class.
const double rad2deg
Definition GMath.hpp:44