GammaLib 2.1.0.dev
Loading...
Searching...
No Matches
GCTAModelRadialAcceptance.hpp
Go to the documentation of this file.
1/***************************************************************************
2 * GCTAModelRadialAcceptance.hpp - Radial acceptance 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 GCTAModelRadialAcceptance.hpp
23 * @brief Radial acceptance model class interface definition
24 * @author Juergen Knoedlseder
25 */
26
27#ifndef GCTAMODELRADIALACCEPTANCE_HPP
28#define GCTAMODELRADIALACCEPTANCE_HPP
29
30/* __ Includes ___________________________________________________________ */
31#include <string>
32#include <cmath>
33#include "GModelData.hpp"
34#include "GModelPar.hpp"
35#include "GModelSpectral.hpp"
36#include "GModelTemporal.hpp"
37#include "GEvent.hpp"
38#include "GObservation.hpp"
39#include "GXmlElement.hpp"
40#include "GFunction.hpp"
41#include "GCTAEventList.hpp"
42#include "GCTAModelRadial.hpp"
43
44
45/***********************************************************************//**
46 * @class GCTAModelRadialAcceptance
47 *
48 * @brief Radial acceptance model class
49 *
50 * This class implements a radial acceptance model for CTA.
51 ***************************************************************************/
53
54public:
55 // Constructors and destructors
57 explicit GCTAModelRadialAcceptance(const GXmlElement& xml);
64 virtual ~GCTAModelRadialAcceptance(void);
65
66 // Operators
68
69 // Implemented pure virtual methods
70 virtual void clear(void);
71 virtual GCTAModelRadialAcceptance* clone(void) const;
72 virtual std::string classname(void) const;
73 virtual std::string type(void) const;
74 virtual bool is_constant(void) const;
75 virtual double eval(const GEvent& event,
76 const GObservation& obs,
77 const bool& gradients = false) const;
78 virtual double npred(const GEnergy& obsEng, const GTime& obsTime,
79 const GObservation& obs) const;
80 virtual GCTAEventList* mc(const GObservation& obs, GRan& ran) 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 GCTAModelRadial* radial(void) const;
87 GModelSpectral* spectral(void) const;
88 GModelTemporal* temporal(void) const;
89 void radial(const GCTAModelRadial* radial);
90 void spectral(const GModelSpectral* spectral);
91 void temporal(const GModelTemporal* temporal);
92
93protected:
94 // Protected methods
95 void init_members(void);
96 void copy_members(const GCTAModelRadialAcceptance& model);
97 void free_members(void);
98 void set_pointers(void);
99 bool valid_model(void) const;
103
104 // ROI integration kernel
105 class roi_kern : public GFunction {
106 public:
107 roi_kern(const GCTAModelRadial* parent, const double& roi, const double& dist) :
108 m_parent(parent),
109 m_roi(roi),
110 m_cosroi(std::cos(roi)),
111 m_dist(dist),
112 m_cosdist(std::cos(dist)),
113 m_sindist(std::sin(dist)) { }
114 double eval(const double& r);
115 protected:
116 const GCTAModelRadial* m_parent; //!< Pointer to radial model
117 double m_roi; //!< ROI radius in radians
118 double m_cosroi; //!< Cosine of ROI radius
119 double m_dist; //!< Distance between pointing and ROI centre in radians
120 double m_cosdist; //!< Cosine of distance
121 double m_sindist; //!< Sinus of distance
122 };
123
124 // Proteced data members
125 GCTAModelRadial* m_radial; //!< Radial model
126 GModelSpectral* m_spectral; //!< Spectral model
127 GModelTemporal* m_temporal; //!< Temporal model
128};
129
130
131/***********************************************************************//**
132 * @brief Return class name
133 *
134 * @return String containing the class name ("GCTAModelRadialAcceptance").
135 ***************************************************************************/
136inline
138{
139 return ("GCTAModelRadialAcceptance");
140}
141
142
143/***********************************************************************//**
144 * @brief Return model type
145 *
146 * @return Model type.
147 *
148 * Returns the type of the model. The type for a radial acceptance model is
149 * "RadialAcceptance".
150 ***************************************************************************/
151inline
152std::string GCTAModelRadialAcceptance::type(void) const
153{
154 return ("RadialAcceptance");
155}
156
157
158/***********************************************************************//**
159 * @brief Signals if model is temporally constant
160 *
161 * @return True if model is temporally constant, false otherwise.
162 *
163 * Signals if the model is temporally constant. A temporally constant model
164 * is a model that has a temporal component of type "Constant".
165 ***************************************************************************/
166inline
168{
169 return (m_temporal != NULL && m_temporal->type() == "Constant");
170}
171
172
173/***********************************************************************//**
174 * @brief Return radial model component
175 *
176 * @return Pointer to radial model component.
177 *
178 * Returns a pointer to the radial model component of the model. The pointer
179 * is of type GCTAModelRadial. Note that a NULL pointer may be returned if
180 * the model has no radial model component.
181 ***************************************************************************/
182inline
184{
185 return (m_radial);
186}
187
188
189/***********************************************************************//**
190 * @brief Return spectral model component
191 *
192 * @return Pointer to spectral model component.
193 *
194 * Returns a pointer to the spectral model component of the model. The
195 * pointer is of type GModelSpectral. Note that a NULL pointer may be
196 * returned if the model has no spectral model component.
197 ***************************************************************************/
198inline
203
204
205/***********************************************************************//**
206 * @brief Return temporal model component
207 *
208 * @return Pointer to temporal model component.
209 *
210 * Returns a pointer to the temporal model component of the model. The
211 * pointer is of type GModelTemporal. Note that a NULL pointer may be
212 * returned if the model has no temporal model component.
213 ***************************************************************************/
214inline
219
220#endif /* GCTAMODELRADIALACCEPTANCE_HPP */
CTA event list class interface definition.
Abstract radial acceptance model class interface definition.
Abstract event base class definition.
Single parameter function abstract base class definition.
Abstract data model base class interface definition.
Model parameter class interface definition.
Abstract spectral model base class interface definition.
Abstract temporal model base class interface definition.
Abstract observation base class interface definition.
GChatter
Definition GTypemaps.hpp:33
@ NORMAL
Definition GTypemaps.hpp:36
GVector cos(const GVector &vector)
Computes cosine of vector elements.
Definition GVector.cpp:1258
GVector sin(const GVector &vector)
Computes sine of vector elements.
Definition GVector.cpp:1384
XML element node class interface definition.
CTA event list class.
roi_kern(const GCTAModelRadial *parent, const double &roi, const double &dist)
double m_dist
Distance between pointing and ROI centre in radians.
const GCTAModelRadial * m_parent
Pointer to radial model.
double eval(const double &r)
Integration kernel for the Npred method.
Radial acceptance model class.
GModelTemporal * xml_temporal(const GXmlElement &temporal) const
Return pointer to temporal model from XML element.
GCTAModelRadial * xml_radial(const GXmlElement &radial) const
Construct radial model from XML element.
GModelSpectral * m_spectral
Spectral model.
virtual GCTAModelRadialAcceptance & operator=(const GCTAModelRadialAcceptance &model)
Assignment operator.
virtual std::string classname(void) const
Return class name.
virtual double npred(const GEnergy &obsEng, const GTime &obsTime, const GObservation &obs) const
Return spatially integrated background rate in units of events MeV s .
GCTAModelRadial * m_radial
Radial model.
virtual bool is_constant(void) const
Signals if model is temporally constant.
GCTAModelRadial * radial(void) const
Return radial model component.
void init_members(void)
Initialise class members.
GModelSpectral * xml_spectral(const GXmlElement &spectral) const
Return pointer to spectral model from XML element.
GModelSpectral * spectral(void) const
Return spectral model component.
void copy_members(const GCTAModelRadialAcceptance &model)
Copy class members.
bool valid_model(void) const
Verifies if model has all components.
GModelTemporal * temporal(void) const
Return temporal model component.
virtual std::string type(void) const
Return model type.
virtual void write(GXmlElement &xml) const
Write model into XML element.
void free_members(void)
Delete class members.
virtual std::string print(const GChatter &chatter=NORMAL) const
Print model information.
virtual GCTAEventList * mc(const GObservation &obs, GRan &ran) const
Return simulated list of events.
GCTAModelRadialAcceptance(void)
Void constructor.
virtual ~GCTAModelRadialAcceptance(void)
Destructor.
virtual GCTAModelRadialAcceptance * clone(void) const
Clone instance.
GModelTemporal * m_temporal
Temporal model.
virtual void clear(void)
Clear instance.
virtual double eval(const GEvent &event, const GObservation &obs, const bool &gradients=false) const
Return background rate in units of events MeV s sr .
virtual void read(const GXmlElement &xml)
Read model from XML element.
Abstract radial acceptance model class.
Class that handles energies in a unit independent way.
Definition GEnergy.hpp:48
Abstract interface for the event classes.
Definition GEvent.hpp:71
Single parameter function abstract base class.
Definition GFunction.hpp:44
Abstract data model class.
Abstract spectral model base class.
Abstract temporal model base class.
virtual std::string type(void) const =0
Abstract observation base class.
Random number generator class.
Definition GRan.hpp:44
Time class.
Definition GTime.hpp:55
XML element node class.