-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrosscorrelation.h
More file actions
134 lines (95 loc) · 4.45 KB
/
Copy pathcrosscorrelation.h
File metadata and controls
134 lines (95 loc) · 4.45 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
#ifndef _CROSSCORR_H_
#define _CROSSCORR_H_
#include "events.h"
#include "TGraph.h"
#include "TH1F.h"
#include <TGraphAsymmErrors.h>
#include "healpixmap.h"
#define WITHSINE
//! Cross correlation between events and astrophysical objects.
class TCrossCorrelation
{
public:
//! Constructor.
TCrossCorrelation(const vector<TEvent>& events, const vector<double>& lSources, const vector<double>& bSources, const vector<double>& wSources, double alphaStep = 1, double alphaMax = 180);
//! Destructor.
~TCrossCorrelation();
//! Set fExtension.
void SetExtension(string ext) {fExtension = ext;}
/*!
Computes for each events the separation angle with the astrophysical objects. For each event direction,
\f$ \vec{u_i} \f$ (0 \f$ \leq i \leq \f$ #fNevents), and each astrophysical sources \f$ \vec{v_j} \f$
(0 \f$ \leq j \leq \f$ #fNsources), the separation angle \f$ \alpha = acos(\vec{u_i}.\vec{v_j})\f$ is
computed. #fEventsCrossCorrelation is filled according to #fWsources.
*/
void ComputeEventsCrossCorrelation();
/*!
Computes for each simulated data set of #fNevents the separation angle with the astrophysical objects. The
operation is repeated nSimu times and the average separation angle is computed. The error bars correspond
to the dispersion of disp% of the simulations.
*/
void ComputeCoverageCrossCorrelation(double longitude, double latitude, const THealpixMap& map, unsigned int nSimu, double dispersion, const vector<double>& thVal, const vector<double>& pthVal, string utcFile = "", string jdFile = "", string globalFile = "");
//! Draw #fEventsCrossCorrelation.
void DrawEvents() const;
//! Draw #fCoverageCrossCorrelation.
void DrawCov() const;
//! Draw #fEventsCrossCorrelation and #fCoverageCrossCorrelation in the same canvas.
void DrawBoth() const;
//! Draw #fHistoEvents and #fHistoCov in Relative excess in the same canvas.
void DrawBothRelativeExcess() const;
//! Get the number of event pairs with angular separation smaller than\f$ \alpha \f$.
void GetEventsCrossCorrelation(vector<double>& alpha, vector<double>& Np) const;
//! Get the mean number of pairs expected and their dispersion with angular separation smaller than\f$ \alpha \f$.
void GetCoverageCrossCorrelation(vector<double>& alpha,vector<double>& Np,vector<double>& errLow,vector<double>& errHigh) const;
private:
//! Initializes #fThetaEvents and #fPhiEvents.
void InitAnglesEvents(const vector<TEvent> & events);
//! Initializes #fThetaSources and #fPhiSources.
void InitAnglesSources();
//! Initializes #fNstep, #fEventsCrossCorrelation and #CoverageCrossCorrelation.
void InitGraph();
//! Computes the relative excess of cumulative number of pairs in each separation angle bin with respect to
//! #fCoverageCrossCorrelation.
void RelativeExcess();
//! Events (actual or simulated).
const vector<TEvent> & fEvents;
//! Galactic longitude of the astrophysical objects.
vector<double> fLsources;
//! Galactic latitude of the astrophysical objects.
vector<double> fBsources;
//! Statistical weight of the astrophysical objects.
vector<double> fWsources;
//! Number of bins of #fHistoEvents and #fHistoCov.
unsigned int fNstep;
//! Size of the bins of #fHistoEvents and #fHistoCov.
double fAlphaStep;
//! Upper limit for which we are looking for the cross correlation.
double fAlphaMax;
//! Events cross correlation angle distribution.
TGraph * fEventsCrossCorrelation;
//! Background cross correlation angle distribution.
TGraphAsymmErrors * fCoverageCrossCorrelation;
//! \f$ \theta \f$ spherical angle (on the sky) of fEvents.
double * fThetaEvents;
//! \f$ \phi \f$ spherical angle (on the sky) of fEvents.
double * fPhiEvents;
//! \f$ \cos \theta \f$. Cosinus of the spherical angle of fEvents.
double * fCosThetaEvents;
//! \f$ \sin \theta \f$. Cosinus of the spherical angle of fEvents.
double * fSinThetaEvents;
//! \f$ \theta \f$ spherical angle (on the sky) of the sources.
double * fThetaSources;
//! \f$ \phi \f$ spherical angle (on the sky) of the sources.
double * fPhiSources;
//! \f$ \cos \theta \f$. Cosinus of the spherical angle of the sources.
double * fCosThetaSources;
//! \f$ \sin \theta\f$. Cosinus of the spherical angle of the sources.
double * fSinThetaSources;
//! Number of events.
unsigned int fNevents;
//! Number of astrophysical objects
unsigned int fNsources;
//! Figure extension.
string fExtension;
};
#endif