GCOMSelection.hpp
21.3 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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
/***************************************************************************
* GCOMSelection.hpp - COMPTEL selection set class *
* ----------------------------------------------------------------------- *
* copyright (C) 2017-2021 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 GCOMSelection.hpp
* @brief COMPTEL selection set class definition
* @author Juergen Knoedlseder
*/
#ifndef GCOMSELECTION_HPP
#define GCOMSELECTION_HPP
/* __ Includes ___________________________________________________________ */
#include <string>
#include "GBase.hpp"
#include "GPhases.hpp"
#include "GModelTemporalPhaseCurve.hpp"
/* __ Forward declarations _______________________________________________ */
class GFitsHDU;
class GCOMEventAtom;
/* __ Constants __________________________________________________________ */
/***********************************************************************//**
* @class GCOMSelection
*
* @brief COMPTEL selection set class
*
* This class implements a COMPTEL selection set.
***************************************************************************/
class GCOMSelection : public GBase {
public:
// Constructors and destructors
GCOMSelection(void);
GCOMSelection(const GCOMSelection& select);
virtual ~GCOMSelection(void);
// Operators
GCOMSelection& operator=(const GCOMSelection& select);
// Implemented pure virtual base class methods
virtual void clear(void);
virtual GCOMSelection* clone(void) const;
virtual std::string classname(void) const;
virtual std::string print(const GChatter& chatter = NORMAL) const;
// Other methods
void init_statistics(void) const;
bool use_event(const GCOMEventAtom& event) const;
const double& e1_min(void) const;
void e1_min(const double& e1_min);
const double& e1_max(void) const;
void e1_max(const double& e1_max);
const double& e2_min(void) const;
void e2_min(const double& e2_min);
const double& e2_max(void) const;
void e2_max(const double& e2_max);
const int& tof_min(void) const;
void tof_min(const int& tof_min);
const int& tof_max(void) const;
void tof_max(const int& tof_max);
const int& psd_min(void) const;
void psd_min(const int& psd_min);
const int& psd_max(void) const;
void psd_max(const int& psd_max);
const double& zeta_min(void) const;
void zeta_min(const double& zeta_min);
const double& zeta_max(void) const;
void zeta_max(const double& zeta_max);
const int& reflag_min(void) const;
void reflag_min(const int& reflag_min);
const int& reflag_max(void) const;
void reflag_max(const int& reflag_max);
const int& vetoflag_min(void) const;
void vetoflag_min(const int& vetoflag_min);
const int& vetoflag_max(void) const;
void vetoflag_max(const int& vetoflag_max);
const int& fpmtflag(void) const;
void fpmtflag(const int& fpmtflag);
const bool& use_d1(const int& id1) const;
void use_d1(const int& id1, const bool& use);
const bool& use_d2(const int& id2) const;
void use_d2(const int& id2, const bool& use);
const GModelTemporalPhaseCurve& phase_curve(void) const;
void phase_curve(const GModelTemporalPhaseCurve& phase_curve);
const GPhases& phases(void) const;
void phases(const GPhases& phases);
void read(const GFitsHDU& hdu);
void write(GFitsHDU& hdu) const;
protected:
// Protected methods
void init_members(void);
void copy_members(const GCOMSelection& select);
void free_members(void);
// Protected members
double m_e1_min; //!< Minimum D1 energy deposit (MeV)
double m_e1_max; //!< Maximum D1 energy deposit (MeV)
double m_e2_min; //!< Minimum D2 energy deposit (MeV)
double m_e2_max; //!< Maximum D2 energy deposit (MeV)
int m_tof_min; //!< Minimum TOF window
int m_tof_max; //!< Maximum TOF window
int m_psd_min; //!< Minimum PSD window
int m_psd_max; //!< Maximum PSD window
double m_zeta_min; //!< Minimum Earth horizon angle - Phibar window
double m_zeta_max; //!< Maximum Earth horizon angle - Phibar window
int m_reflag_min; //!< Minimum rejection flag
int m_reflag_max; //!< Maximum rejection flag
int m_vetoflag_min; //!< Minimum veto flag
int m_vetoflag_max; //!< Maximum veto flag
int m_fpmtflag; //!< D2 PMT failures
//!< (0: exclude modules, 1: include modules,
//!< 2: use FPM information)
bool m_use_d1[7]; //!< D1 module usage
bool m_use_d2[14]; //!< D2 module usage
GModelTemporalPhaseCurve m_phase_curve; //!< Phase curve for phase selection
GPhases m_phases; //!< Phases for phase selection
// Selection statistics
mutable int m_num_events_checked; //!< Number of checked events
mutable int m_num_events_used; //!< Number of used events
mutable int m_num_events_rejected; //!< Number of rejected events
mutable int m_num_e1_min; //!< Number of events below E1 threshold
mutable int m_num_e1_max; //!< Number of events above E1 threshold
mutable int m_num_e2_min; //!< Number of events below E2 threshold
mutable int m_num_e2_max; //!< Number of events above E2 threshold
mutable int m_num_tof_min; //!< Number of events below TOF threshold
mutable int m_num_tof_max; //!< Number of events above TOF threshold
mutable int m_num_psd_min; //!< Number of events below PSD threshold
mutable int m_num_psd_max; //!< Number of events above PSD threshold
mutable int m_num_zeta_min; //!< Number of events below Zeta threshold
mutable int m_num_zeta_max; //!< Number of events above Zeta threshold
mutable int m_num_reflag_min; //!< Number of events below rejection flag threshold
mutable int m_num_reflag_max; //!< Number of events above rejection flag threshold
mutable int m_num_vetoflag_min; //!< Number of events below veto flag threshold
mutable int m_num_vetoflag_max; //!< Number of events above veto flag threshold
mutable int m_num_no_scatter; //!< Number of events without scatter angle
mutable int m_num_invalid_modcom; //!< Number of events with invalid minitelescopes
mutable int m_num_d1module_off; //!< Number of events excluded since D1 module off
mutable int m_num_d2module_off; //!< Number of events excluded since D2 module off
mutable int m_num_fpmt; //!< Number of events excluded due to failed PMT
mutable int m_num_d1[7]; //!< Number of events per D1 module
mutable int m_num_d2[14]; //!< Number of events per D2 module
};
/***********************************************************************//**
* @brief Return class name
*
* @return String containing the class name ("GCOMSelection").
***************************************************************************/
inline
std::string GCOMSelection::classname(void) const
{
return ("GCOMSelection");
}
/***********************************************************************//**
* @brief Return minimum of D1 energy selection window
*
* @return Minimum of D1 energy selection window.
***************************************************************************/
inline
const double& GCOMSelection::e1_min(void) const
{
return (m_e1_min);
}
/***********************************************************************//**
* @brief Set minimum of D1 energy selection window
*
* @param[in] e1_min Minimum of D1 energy selection window.
***************************************************************************/
inline
void GCOMSelection::e1_min(const double& e1_min)
{
m_e1_min = e1_min;
return;
}
/***********************************************************************//**
* @brief Return maximum of D1 energy selection window
*
* @return Maximum of D1 energy selection window.
***************************************************************************/
inline
const double& GCOMSelection::e1_max(void) const
{
return (m_e1_max);
}
/***********************************************************************//**
* @brief Set maximum of D1 energy selection window
*
* @param[in] e1_max Maximum of D1 energy selection window.
***************************************************************************/
inline
void GCOMSelection::e1_max(const double& e1_max)
{
m_e1_max = e1_max;
return;
}
/***********************************************************************//**
* @brief Return minimum of D2 energy selection window
*
* @return Minimum of D2 energy selection window.
***************************************************************************/
inline
const double& GCOMSelection::e2_min(void) const
{
return (m_e2_min);
}
/***********************************************************************//**
* @brief Set minimum of D2 energy selection window
*
* @param[in] e2_min Minimum of D2 energy selection window.
***************************************************************************/
inline
void GCOMSelection::e2_min(const double& e2_min)
{
m_e2_min = e2_min;
return;
}
/***********************************************************************//**
* @brief Return maximum of D2 energy selection window
*
* @return Maximum of D2 energy selection window.
***************************************************************************/
inline
const double& GCOMSelection::e2_max(void) const
{
return (m_e2_max);
}
/***********************************************************************//**
* @brief Set maximum of D2 energy selection window
*
* @param[in] e2_max Maximum of D2 energy selection window.
***************************************************************************/
inline
void GCOMSelection::e2_max(const double& e2_max)
{
m_e2_max = e2_max;
return;
}
/***********************************************************************//**
* @brief Return minimum of ToF selection window
*
* @return Minimum of ToF selection window.
***************************************************************************/
inline
const int& GCOMSelection::tof_min(void) const
{
return (m_tof_min);
}
/***********************************************************************//**
* @brief Set minimum of ToF selection window
*
* @param[in] tof_min Minimum of ToF selection window.
***************************************************************************/
inline
void GCOMSelection::tof_min(const int& tof_min)
{
m_tof_min = tof_min;
return;
}
/***********************************************************************//**
* @brief Return maximum of ToF selection window
*
* @return Maximum of ToF selection window.
***************************************************************************/
inline
const int& GCOMSelection::tof_max(void) const
{
return (m_tof_max);
}
/***********************************************************************//**
* @brief Set maximum of ToF selection window
*
* @param[in] tof_max Maximum of ToF selection window.
***************************************************************************/
inline
void GCOMSelection::tof_max(const int& tof_max)
{
m_tof_max = tof_max;
return;
}
/***********************************************************************//**
* @brief Return minimum of PSD selection window
*
* @return Minimum of PSD selection window.
***************************************************************************/
inline
const int& GCOMSelection::psd_min(void) const
{
return (m_psd_min);
}
/***********************************************************************//**
* @brief Set minimum of PSD selection window
*
* @param[in] psd_min Minimum of PSD selection window.
***************************************************************************/
inline
void GCOMSelection::psd_min(const int& psd_min)
{
m_psd_min = psd_min;
return;
}
/***********************************************************************//**
* @brief Return maximum of PSD selection window
*
* @return Maximum of PSD selection window.
***************************************************************************/
inline
const int& GCOMSelection::psd_max(void) const
{
return (m_psd_max);
}
/***********************************************************************//**
* @brief Set maximum of PSD selection window
*
* @param[in] psd_max Maximum of PSD selection window.
***************************************************************************/
inline
void GCOMSelection::psd_max(const int& psd_max)
{
m_psd_max = psd_max;
return;
}
/***********************************************************************//**
* @brief Return minimum of Earth horizon selection window
*
* @return Minimum of Earth horizon selection window.
***************************************************************************/
inline
const double& GCOMSelection::zeta_min(void) const
{
return (m_zeta_min);
}
/***********************************************************************//**
* @brief Set minimum of Earth horizon selection window
*
* @param[in] zeta_min Minimum of Earth horizon selection window.
***************************************************************************/
inline
void GCOMSelection::zeta_min(const double& zeta_min)
{
m_zeta_min = zeta_min;
return;
}
/***********************************************************************//**
* @brief Return maximum of Earth horizon selection window
*
* @return Maximum of Earth horizon selection window.
***************************************************************************/
inline
const double& GCOMSelection::zeta_max(void) const
{
return (m_zeta_max);
}
/***********************************************************************//**
* @brief Set maximum of Earth horizon selection window
*
* @param[in] zeta_max Maximum of Earth horizon selection window.
***************************************************************************/
inline
void GCOMSelection::zeta_max(const double& zeta_max)
{
m_zeta_max = zeta_max;
return;
}
/***********************************************************************//**
* @brief Return minimum of Rejection Flag selection window
*
* @return Minimum of Rejection Flag selection window.
***************************************************************************/
inline
const int& GCOMSelection::reflag_min(void) const
{
return (m_reflag_min);
}
/***********************************************************************//**
* @brief Set minimum of Rejection Flag selection window
*
* @param[in] reflag_min Minimum of Rejection Flag selection window.
***************************************************************************/
inline
void GCOMSelection::reflag_min(const int& reflag_min)
{
m_reflag_min = reflag_min;
return;
}
/***********************************************************************//**
* @brief Return maximum of Rejection Flag selection window
*
* @return Maximum of Rejection Flag selection window.
***************************************************************************/
inline
const int& GCOMSelection::reflag_max(void) const
{
return (m_reflag_max);
}
/***********************************************************************//**
* @brief Set maximum of Rejection Flag selection window
*
* @param[in] reflag_max Maximum of Rejection Flag selection window.
***************************************************************************/
inline
void GCOMSelection::reflag_max(const int& reflag_max)
{
m_reflag_max = reflag_max;
return;
}
/***********************************************************************//**
* @brief Return minimum of Veto Flag selection window
*
* @return Minimum of Veto Flag selection window.
***************************************************************************/
inline
const int& GCOMSelection::vetoflag_min(void) const
{
return (m_vetoflag_min);
}
/***********************************************************************//**
* @brief Set minimum of Veto Flag selection window
*
* @param[in] vetoflag_min Minimum of Veto Flag selection window.
***************************************************************************/
inline
void GCOMSelection::vetoflag_min(const int& vetoflag_min)
{
m_vetoflag_min = vetoflag_min;
return;
}
/***********************************************************************//**
* @brief Return maximum of Veto Flag selection window
*
* @return Maximum of Veto Flag selection window.
***************************************************************************/
inline
const int& GCOMSelection::vetoflag_max(void) const
{
return (m_vetoflag_max);
}
/***********************************************************************//**
* @brief Set maximum of Veto Flag selection window
*
* @param[in] vetoflag_max Maximum of Veto Flag selection window.
***************************************************************************/
inline
void GCOMSelection::vetoflag_max(const int& vetoflag_max)
{
m_vetoflag_max = vetoflag_max;
return;
}
/***********************************************************************//**
* @brief Return failed PMT flag for D2 modules
*
* @return Failed PMT flag for D2 modules.
*
* Returns the failed PMT flag for D2 modules. The following values can be
* returned:
* - 0: excluded D2 modules with failed PMTs
* - 1: include D2 modules with failed PMTs
* - 2: include D2 modules with failed PMTs by excluding zone around failed
* PMTs
***************************************************************************/
inline
const int& GCOMSelection::fpmtflag(void) const
{
return (m_fpmtflag);
}
/***********************************************************************//**
* @brief Return phase curve
*
* @return Phase curve.
***************************************************************************/
inline
const GModelTemporalPhaseCurve& GCOMSelection::phase_curve(void) const
{
return (m_phase_curve);
}
/***********************************************************************//**
* @brief Set phase curve
*
* @param[in] phase_curve Phase curve.
***************************************************************************/
inline
void GCOMSelection::phase_curve(const GModelTemporalPhaseCurve& phase_curve)
{
m_phase_curve = phase_curve;
return;
}
/***********************************************************************//**
* @brief Return phases
*
* @return Phases
***************************************************************************/
inline
const GPhases& GCOMSelection::phases(void) const
{
return (m_phases);
}
/***********************************************************************//**
* @brief Set phases
*
* @param[in] phases Phases.
***************************************************************************/
inline
void GCOMSelection::phases(const GPhases& phases)
{
m_phases = phases;
return;
}
#endif /* GCOMSELECTION_HPP */