-
Notifications
You must be signed in to change notification settings - Fork 0
/
coverage.h
178 lines (127 loc) · 5.35 KB
/
coverage.h
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
#ifndef _COVERAGE_H_
#define _COVERAGE_H_
#include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <cmath>
#include "angdist.h"
#include "timemod.h"
#include "maptools.h"
#include "healpixmap.h"
#include "harmotools.h"
#include "events.h"
#include "STClibrary.h"
#include "common.h"
// ROOT
#include "TGraph.h"
#include "TRandom2.h"
#include "TMath.h"
/*!
This class is dedicated to the coverage map computation. Both scrambling and Semi-Analytical methods are present.
It is possible to correct the map estimated with the Semi-Analytical technique from the acceptance effects using
an acceptance file or just fitting the UTC distribution of the events and interpolating the JD distribution.
*/
//! Coverage map.
class TCoverage
{
public :
//! Constructor.
TCoverage(unsigned int nside = 0);
//! Returns #fMap.
THealpixMap GetMap() const {return fMap;}
//! Returns #fLatitude.
double GetLatitude() const {return fLatitude;}
//! Returns the nside of #fMap.
unsigned int NSide() const {return fMap.NSide();}
//! Set #fCoordSystem.
void SetCoordSystem(char str) {fCoordSystem = str;}
//! Returns #fCoordSystem.
char GetCoordSystem() const {return fCoordSystem;}
//! Set #fLatitude, #fcosLatitude and #fsinLatitude.
void SetLatitude(double latitude) {fLatitude = latitude; fcosLatitude = cos(latitude*DTOR); fsinLatitude = sin(latitude*DTOR);}
//! Returns #fLongitude.
double GetLongitude() const {return fLongitude;}
//! Set #fLongitude.
void SetLongitude(double longitude) {fLongitude = longitude;}
//! set filename extension for plots
void SetExtension(string ext) {fExtension = ext;}
//! Get filename extension for plots
string GetExtension() const {return fExtension;}
//! Returns TFitFunction::fDataMin using the TAngularDistribution::GetMinAngle() function of #fThetaDist.
double GetThetaMin() const {return fThetaDist.GetMinAngle();}
//! Returns TFitFunction::fDataMax using the TAngularDistribution::GetMaxAngle() function of #fThetaDist.
double GetThetaMax() const {return fThetaDist.GetMaxAngle();}
//! Returns #fDecMin.
double GetDecMin() const {return fDecMin;}
//! Returns #fDecMax.
double GetDecMax() const {return fDecMax;}
//! Look for pixels in the field of view.
void ComputeConstants() const;
//! Get array of zenith Right Ascension as function of time.
vector<double> GetZenithalRA(unsigned int nptsra = 1000) const;
//! Returns true if #fDecMin \f$ \leq \f$ dec \f$ \leq \f$ #fDecMax.
bool IsInFOV(double dec) const {return dec >= fDecMin-(fMap.GetPixSize()/2.) && dec <= fDecMax+(fMap.GetPixSize()/2.);}
//! Compute the declination limits. To be called once #fLatitude and TFitFunction::fDataMax of #fThetaDist
//! are set.
void ComputeDeclinationLimits();
//! Geometric transformation to get the declination distribution of the events from the zenithal one.
void ZenithToDeclination(unsigned int nb = 1000);
/*!
We use a linear interpolation to evaluate the value of the distribution at \b HEALPix declination. We then
fill a THealpixMap vector with these values. The resulting coverage map is independent of the Right
Ascension when the argument is FLAT (default).
*/
void ComputeCoverage(unsigned int npts = 1000);
//! Declination.
vector<double> fDeclination;
//! Declination distribution.
vector<double> fDecDistribution;
//! Right ascension.
vector<double> fRightAscension;
//! A TAngularDistribution instance (\f$ \theta \f$).
TAngularDistribution fThetaDist;
//! A TPhiModulation instance (\f$ \phi \f$ modulated by \f$ \theta \f$).
TPhiModulation fPhiMod;
//! A TTimeModulation instance (UTC, UTC+JD or a file).
TTimeModulation fTimeMod;
//! Correct for angular (\f$ \theta \f$ or \f$ \phi \f$) modulation.
void CorrectForAngularModulation(string angleName);
//! Correct for time modulation
void CorrectForTimeModulation(string timeModel);
//! \f$ \theta \f$ angular modulation .
bool fThetaModulation;
//! \f$ \phi \f$ angular modulation.
bool fPhiModulation;
//! Time modulation.
bool fTimeModulation;
//! A THealpixMap instance.
THealpixMap fMap;
private :
//! Coordinate system of the \b HEALPix map.
char fCoordSystem;
//! Latitude of the observatory.
double fLatitude;
//! Longitude of the observatory.
double fLongitude;
//! Cosinus of #fLatitude.
double fcosLatitude;
//! Sinus of #fLatitude.
double fsinLatitude;
//! Lower limit of the declination.
double fDecMin;
//! Upper limit of the declination.
double fDecMax;
//! filename extension for declination distribution plot
string fExtension;
};
/*!
This function returns the coverage map for a detector with saturated acceptance up to thetamax. Meaning that
the zenith angle distribution of events is \f$ \sin \theta \cos \theta \f$ below thetamax and 0 above. One
needs to specify the nside of the \b HEALPix map and the latitude of the experiment. The calculation of the
coverage map in this case is described in : P. Sommers, Astropart.Phys., \b 14 (2001) 271-286.
*/
THealpixMap GetAnalyticalCoverage(int nside, double thetamax, double latsite);
//! The scrambling method to compute the coverage map.
THealpixMap ComputeCoverageScrambling(const vector<TEvent>& eventsInput, unsigned int nSide, double thetaMax, double latitude, double longitude, unsigned int nScramble, unsigned int nBins, string binning = "EVENTS", string variable = "UTC");
#endif