ctskymap.hpp
7.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
/***************************************************************************
* ctskymap - Sky mapping tool *
* ----------------------------------------------------------------------- *
* copyright (C) 2010-2018 by Juergen Knoedlseder *
* ----------------------------------------------------------------------- *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
***************************************************************************/
/**
* @file ctskymap.hpp
* @brief Sky mapping tool definition
* @author Juergen Knoedlseder
*/
#ifndef CTSKYMAP_HPP
#define CTSKYMAP_HPP
/* __ Includes ___________________________________________________________ */
#include <string>
#include "ctobservation.hpp"
/* __Definitions _________________________________________________________ */
#define CTSKYMAP_NAME "ctskymap"
/***********************************************************************//**
* @class ctskymap
*
* @brief Sky mapping tool
*
* This class creates a sky map from a CTA event list.
***************************************************************************/
class ctskymap : public ctobservation {
public:
// Constructors and destructors
ctskymap(void);
explicit ctskymap(const GObservations& obs);
ctskymap(int argc, char *argv[]);
ctskymap(const ctskymap& app);
virtual ~ctskymap(void);
// Operators
ctskymap& operator=(const ctskymap& app);
// Methods
void clear(void);
void run(void);
void save(void);
void publish(const std::string& name = "");
const GSkyMap& skymap(void) const;
void exclusion_map(const GSkyRegionMap& exclusion_map);
GSkyRegionMap exclusion_map(void) const;
protected:
// Protected methods
void init_members(void);
void copy_members(const ctskymap& app);
void free_members(void);
void get_parameters(void);
void setup_maps(void);
void setup_exclusion_map(void);
void setup_exclusion_map_fits(const GFilename& filename);
void setup_exclusion_map_region(const GFilename& filename);
void adjust_exclusion_map(void);
void fill_maps(void);
void fill_maps_counts(GCTAObservation* obs);
void fill_maps_acceptance(GCTAObservation* obs);
void compute_maps(void);
void compute_maps_ring_fft(void);
void compute_maps_ring_direct(void);
void compute_ring_values(const int& ipixel,
const GSkyMap& counts,
const GSkyMap& background,
double& non,
double& noff,
double& alpha);
void ring_bounding_box(const int& ipixel, int& ix1, int& ix2,
int& iy1, int& iy2) const;
GSkyMap ring_convolve(const GSkyMap& map, const double& rmin,
const double& rmax) const;
GNdarray ring_kernel(const double& rmin, const double& rmax) const;
double sigma_li_ma(const double& n_on,
const double& n_off,
const double& alpha) const;
void write_map(GFits& fits,
const GSkyMap& map,
const std::string& extname) const;
void write_hdu_keywords(GFitsHDU* hdu) const;
// User parameters
GFilename m_outmap; //!< Output file name
GFilename m_inexclusion; //!< Exclusion map file name
double m_emin; //!< Minimum energy (TeV)
double m_emax; //!< Maximum energy (TeV)
std::string m_bkgsubtract; //!< Background subtraction method
double m_roiradius; //!< Region of interest radius for RING bkg.
double m_inradius; //!< Inner ring radius for RING background
double m_outradius; //!< Outer ring radius for RING background
int m_iterations; //!< Number of iterations for RING background
double m_threshold; //!< Threshold for RING background
bool m_usefft; //!< Use FFT for RING background
bool m_publish; //!< Publish sky map?
GChatter m_chatter; //!< Chattiness
// Protected members
bool m_has_inmap; //!< Has valid input map
GSkyMap m_skymap; //!< Sky map
GSkyMap m_bkgmap; //!< Background map
GSkyMap m_sigmap; //!< Significance map
GSkyMap m_counts; //!< Counts map
GSkyMap m_acceptance; //!< Acceptance map
GSkyMap m_exclmap; //!< Exclusion map for RING background
// Caching variables to prevent multiple computations of the same thing
std::vector<double> m_solidangle; //!< Cached pixel solid angles
std::vector<GSkyDir> m_dirs; //!< Cached pixel directions
double m_cos_roiradius; //!< Cosine of RoI radius
double m_cos_inradius; //!< Cosine of inner ring radius
double m_cos_outradius; //!< Cosine of outer ring radius
};
/***********************************************************************//**
* @brief Return observation container
*
* @return Reference to observation container
***************************************************************************/
inline
const GSkyMap& ctskymap::skymap(void) const
{
return m_skymap;
}
/***********************************************************************//**
* @brief Set exclusion region map
*
* @param[in] exclusion_map Exclusion region map.
***************************************************************************/
inline
void ctskymap::exclusion_map(const GSkyRegionMap& exclusion_map)
{
// Assign exclusion map
m_exclmap = exclusion_map.map();
// Return
return;
}
/***********************************************************************//**
* @brief Return exclusion region map
*
* @return Exclusion region map
***************************************************************************/
inline
GSkyRegionMap ctskymap::exclusion_map(void) const
{
GSkyRegionMap exclusion_map(m_exclmap);
return exclusion_map;
}
#endif /* CTSKYMAP_HPP */