GammaLib 2.0.0
Loading...
Searching...
No Matches
GCTAModelRadialGauss.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCTAModelRadialGauss.hpp - Radial Gaussian 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 GCTAModelRadialGauss.hpp
23 * @brief Radial Gaussian model class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCTAMODELRADIALGAUSS_HPP
28#define GCTAMODELRADIALGAUSS_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <cmath>
33#include "GModelPar.hpp"
34#include "GCTAModelRadial.hpp"
35#include "GFunction.hpp"
36
37/* __ Forward declarations _______________________________________________ */
38class GRan;
39class GXmlElement;
40class GCTAObservation;
41class GCTAInstDir;
42
43
44/***********************************************************************//**
45 * @class GCTAModelRadialGauss
46 *
47 * @brief Radial Gaussian CTA model class
48 *
49 * This class implements the radial function
50 * \f[f(\theta) = \exp \left(-\frac{1}{2}
51 * \left( \frac{\theta^2}{\sigma} \right)^2 \right)\f]
52 * where
53 * \f$\theta\f$ is the offset angle (in degrees), and
54 * \f$\sigma\f$ is the width parameter (in degrees\f$^2\f$).
55 *
56 * This function represents a Gaussian in \f$\theta^2\f$.
57 ***************************************************************************/
59
60public:
61 // Constructors and destructors
63 explicit GCTAModelRadialGauss(const double& sigma);
64 explicit GCTAModelRadialGauss(const GXmlElement& xml);
66 virtual ~GCTAModelRadialGauss(void);
67
68 // Operators
70
71 // Implemented pure virtual methods
72 virtual void clear(void);
73 virtual GCTAModelRadialGauss* clone(void) const;
74 virtual std::string classname(void) const;
75 virtual std::string type(void) const;
76 virtual double eval(const double& offset,
77 const bool& gradients = false) const;
78 virtual GCTAInstDir mc(GRan& ran) const;
79 virtual double mc_max_value(const GCTAObservation& obs) const;
80 virtual double omega(void) const;
81 virtual void read(const GXmlElement& xml);
82 virtual void write(GXmlElement& xml) const;
83 virtual std::string print(const GChatter& chatter = NORMAL) const;
84
85 // Other methods
86 double sigma(void) const;
87 void sigma(const double& sigma);
88
89protected:
90 // Protected methods
91 void init_members(void);
92 void copy_members(const GCTAModelRadialGauss& model);
93 void free_members(void);
94
95 // Radial integration class (used by omega() method). Note that the
96 // sigma parameter is given in rad^2
97 class integrand : public GFunction {
98 public:
100 double eval(const double& x) {
101 double arg = x * x / m_sigma;
102 double arg2 = arg * arg;
103 double f = std::exp(-0.5 * arg2);
104 return (f*std::sin(x));
105 }
106 private:
107 double m_sigma;
108 };
109
110 // Protected members
111 GModelPar m_sigma; //!< Width parameter (degrees^2)
112};
113
114
115/***********************************************************************//**
116 * @brief Return class name
117 *
118 * @return String containing the class name ("GCTAModelRadialGauss").
119 ***************************************************************************/
120inline
121std::string GCTAModelRadialGauss::classname(void) const
122{
123 return ("GCTAModelRadialGauss");
124}
125
126
127/***********************************************************************//**
128 * @brief Return model type
129 *
130 * @return Model type "Gaussian".
131 ***************************************************************************/
132inline
133std::string GCTAModelRadialGauss::type(void) const
134{
135 return ("Gaussian");
136}
137
138
139/***********************************************************************//**
140 * @brief Return Gaussian width parameter
141 *
142 * @return Gaussian width parameter.
143 ***************************************************************************/
144inline
146{
147 return (m_sigma.value());
148}
149
150
151/***********************************************************************//**
152 * @brief Set Gaussian width parameter
153 *
154 * @param[in] sigma Gaussian width parameter.
155 ***************************************************************************/
156inline
157void GCTAModelRadialGauss::sigma(const double& sigma)
158{
160 return;
161}
162
163#endif /* GCTAMODELRADIALGAUSS_HPP */
Abstract radial acceptance model class interface definition.
Single parameter function abstract base class definition.
Model parameter class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
CTA instrument direction class.
Radial Gaussian CTA model class.
virtual void write(GXmlElement &xml) const
Write model into XML element.
virtual void read(const GXmlElement &xml)
Read model from XML element.
virtual double eval(const double &offset, const bool &gradients=false) const
Evaluate function.
virtual double omega(void) const
Returns integral over radial model (in steradians)
virtual double mc_max_value(const GCTAObservation &obs) const
Return maximum function value for Monte Carlo simulations.
GModelPar m_sigma
Width parameter (degrees^2)
virtual std::string print(const GChatter &chatter=NORMAL) const
Print point source information.
void init_members(void)
Initialise class members.
GCTAModelRadialGauss(void)
Void constructor.
virtual GCTAModelRadialGauss & operator=(const GCTAModelRadialGauss &model)
Assignment operator.
virtual GCTAInstDir mc(GRan &ran) const
Returns MC instrument direction.
virtual GCTAModelRadialGauss * clone(void) const
Clone instance.
double sigma(void) const
Return Gaussian width parameter.
void free_members(void)
Delete class members.
virtual std::string classname(void) const
Return class name.
void copy_members(const GCTAModelRadialGauss &model)
Copy class members.
virtual ~GCTAModelRadialGauss(void)
Destructor.
virtual void clear(void)
Clear instance.
virtual std::string type(void) const
Return model type.
Abstract radial acceptance model class.
CTA observation class.
Single parameter function abstract base class.
Definition GFunction.hpp:44
Model parameter class.
Definition GModelPar.hpp:87
double value(void) const
Return parameter value.
Random number generator class.
Definition GRan.hpp:44
XML element node class.