GCTAModelBackground.hpp
1 |
/***************************************************************************
|
---|---|
2 |
* GCTAModelBackground.hpp - generic background model class *
|
3 |
* ----------------------------------------------------------------------- *
|
4 |
* copyright (C) 2011-2013 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 Michael Mayer
|
25 |
*/
|
26 |
|
27 |
#ifndef GCTAMODELBACKGROUND_HPP
|
28 |
#define GCTAMODELBACKGROUND_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 "GModelSpatial.hpp" |
43 |
|
44 |
|
45 |
/***********************************************************************//** |
46 |
* @class GCTAModelBackground
|
47 |
*
|
48 |
* @brief CTA background model class
|
49 |
*
|
50 |
* This class implements a general background model for CTA.
|
51 |
***************************************************************************/
|
52 |
class GCTAModelBackground : public GModelData { |
53 |
|
54 |
public:
|
55 |
// Constructors and destructors
|
56 |
GCTAModelBackground(void);
|
57 |
explicit GCTAModelBackground(const GXmlElement& xml); |
58 |
explicit GCTAModelBackground(const GModelSpatial& spatial, |
59 |
const GModelSpectral& spectral);
|
60 |
GCTAModelBackground(const GCTAModelBackground& model);
|
61 |
virtual ~GCTAModelBackground(void); |
62 |
|
63 |
// Operators
|
64 |
virtual GCTAModelBackground& operator=(const GCTAModelBackground& model); |
65 |
|
66 |
// Implemented pure virtual methods
|
67 |
virtual void clear(void); |
68 |
virtual GCTAModelBackground* clone(void) const; |
69 |
virtual std::string type(void) const { return "BackgroundModel"; } |
70 |
virtual double eval(const GEvent& event, |
71 |
const GObservation& obs) const; |
72 |
virtual double eval_gradients(const GEvent& event, |
73 |
const GObservation& obs) const; |
74 |
virtual double npred(const GEnergy& obsEng, const GTime& obsTime, |
75 |
const GObservation& obs) const; |
76 |
virtual GCTAEventList* mc(const GObservation& obs, GRan& ran) const; |
77 |
virtual void read(const GXmlElement& xml); |
78 |
virtual void write(GXmlElement& xml) const; |
79 |
virtual std::string print(const GChatter& chatter = NORMAL) const; |
80 |
|
81 |
// Other methods
|
82 |
GModelSpatial* spatial(void) const { return m_spatial; } |
83 |
GModelSpectral* spectral(void) const { return m_spectral; } |
84 |
GModelTemporal* temporal(void) const { return m_temporal; } |
85 |
|
86 |
protected:
|
87 |
// Protected methods
|
88 |
void init_members(void); |
89 |
void copy_members(const GCTAModelBackground& model); |
90 |
void free_members(void); |
91 |
void set_pointers(void); |
92 |
bool valid_model(void) const; |
93 |
GModelSpatial* xml_spatial(const GXmlElement& spatial) const; |
94 |
GModelSpectral* xml_spectral(const GXmlElement& spectral) const; |
95 |
GModelTemporal* xml_temporal(const GXmlElement& temporal) const; |
96 |
|
97 |
class npred_roi_kern_theta : public GFunction { |
98 |
public:
|
99 |
npred_roi_kern_theta(const GModelSpatial* model,
|
100 |
const GEnergy& obsEng,
|
101 |
const GTime& obsTime,
|
102 |
const GMatrix& rot,
|
103 |
double roi,
|
104 |
double dist,
|
105 |
double omega0) :
|
106 |
m_model(model), |
107 |
m_obsEng(obsEng), |
108 |
m_obsTime(obsTime), |
109 |
m_rot(rot), |
110 |
m_roi(roi), |
111 |
m_cosroi(std::cos(roi)), |
112 |
m_dist(dist), |
113 |
m_cosdist(std::cos(dist)), |
114 |
m_sindist(std::sin(dist)), |
115 |
m_omega0(omega0) { } |
116 |
double eval(double theta); |
117 |
protected:
|
118 |
const GModelSpatial* m_model; //!< Spatial model |
119 |
const GEnergy& m_obsEng; //!< True photon energy |
120 |
const GTime& m_obsTime; //!< True photon arrival time |
121 |
const GMatrix& m_rot; //!< Rotation matrix |
122 |
double m_roi; //!< ROI radius in radians |
123 |
double m_cosroi; //!< Cosine of ROI radius |
124 |
double m_dist; //!< Distance between pointing and ROI centre in radians |
125 |
double m_cosdist; //!< Cosine of distance |
126 |
double m_sindist; //!< Sinus of distance |
127 |
const double& m_omega0; //!< Position angle of ROI |
128 |
}; |
129 |
|
130 |
class npred_roi_kern_phi : public GFunction { |
131 |
public:
|
132 |
npred_roi_kern_phi(const GModelSpatial* model,
|
133 |
const GEnergy& obsEng,
|
134 |
const GTime& obsTime,
|
135 |
const GMatrix& rot,
|
136 |
const double& theta, |
137 |
const double& sin_theta) : |
138 |
m_model(model), |
139 |
m_obsEng(obsEng), |
140 |
m_obsTime(obsTime), |
141 |
m_rot(rot), |
142 |
m_theta(theta), |
143 |
m_cos_theta(std::cos(theta)), |
144 |
m_sin_theta(sin_theta) { } |
145 |
double eval(double phi); |
146 |
protected:
|
147 |
const GModelSpatial* m_model; //!< Spatial model |
148 |
const GEnergy& m_obsEng; //!< True photon energy |
149 |
const GTime& m_obsTime; //!< True photon arrival time |
150 |
const GMatrix& m_rot; //!< Rotation matrix |
151 |
const double& m_theta; //!< Offset angle (radians) |
152 |
double m_cos_theta; //!< Cosine of offset angle |
153 |
const double& m_sin_theta; //!< Sine of offset angle |
154 |
}; |
155 |
|
156 |
// Proteced data members
|
157 |
GModelSpatial* m_spatial; //!< spatial model
|
158 |
GModelSpectral* m_spectral; //!< Spectral model
|
159 |
GModelTemporal* m_temporal; //!< Temporal model
|
160 |
GMatrix m_rot; //!!< Rotation matrix from instdir to skydir
|
161 |
}; |
162 |
|
163 |
#endif /* GMODELSPATIAL_HPP */ |