1
|
|
2
|
#include <background/AcceptanceLookupIR.hh>
|
3
|
#include <background/BgMaps.hh>
|
4
|
#include <plotters/SkyHist.hh>
|
5
|
#include <crash/EquatorSystem.hh>
|
6
|
#include <response/Smoothing.hh>
|
7
|
|
8
|
#include <TCanvas.h>
|
9
|
#include <TLegend.h>
|
10
|
|
11
|
#include <sstream>
|
12
|
|
13
|
int test_radialAcceptance() {
|
14
|
|
15
|
Stash::Coordinate pos( Stash::Lambda( "18h0m0s" ),
|
16
|
Stash::Beta( "0d" ),
|
17
|
Crash::GetRADecJ2000System() );
|
18
|
|
19
|
double binning = 0.02;
|
20
|
double fov = 3.0;
|
21
|
double zenith = 25.;
|
22
|
Background::BgMaps* maps = new Background::BgMaps(Sash::HESSArray::GetHESSArray());
|
23
|
maps->Init( pos, binning, fov, fov, false );
|
24
|
|
25
|
Background::AcceptanceLookupIR lookup("std");
|
26
|
|
27
|
Plotters::SkyHist* exposure = &(maps->GetOnExposureMap());
|
28
|
lookup.FillAcceptanceMap( *exposure, pos, zenith );
|
29
|
|
30
|
TCanvas* canv = new TCanvas("canv","canvas",800,800);
|
31
|
|
32
|
canv->cd();
|
33
|
exposure->Draw();
|
34
|
gPad->Modified();
|
35
|
|
36
|
|
37
|
return 0;
|
38
|
}
|
39
|
|
40
|
|
41
|
|
42
|
|
43
|
|
44
|
int test_edep( const char* config = "std", double Emin = 2., double Emax = 10.,
|
45
|
double zenith = 25., double psiSqrMax = 12.25,
|
46
|
int degree = 6, int nbins = 150, int stepsize = 1) {
|
47
|
|
48
|
Background::AcceptanceLookupIR lookup( config, "RadialAcceptance.root" );
|
49
|
|
50
|
|
51
|
TCanvas* canv = new TCanvas("edepcanv","edep",1000,800);
|
52
|
|
53
|
canv->cd();
|
54
|
|
55
|
TH1F* ac = lookup.CreateAcceptanceCurve(zenith, Emin, Emax);
|
56
|
if( !ac ) return 1;
|
57
|
|
58
|
ac->Draw();
|
59
|
|
60
|
TH1F* smooth = lookup.CreateSmoothedAcceptanceCurve(zenith, Emin, Emax, psiSqrMax,
|
61
|
degree, nbins, stepsize );
|
62
|
if( !smooth ) return 1;
|
63
|
|
64
|
smooth->SetLineColor(4);
|
65
|
smooth->Draw("same");
|
66
|
|
67
|
return 0;
|
68
|
}
|
69
|
|
70
|
|
71
|
|
72
|
|
73
|
|
74
|
|
75
|
|
76
|
|
77
|
|
78
|
|
79
|
|
80
|
|
81
|
|
82
|
|
83
|
|
84
|
int test_all_edep( const char* config = "std", double Emin = 2., double Emax = 10.,
|
85
|
int degree = 6, int nbins = 150, int stepsize = 1,
|
86
|
double psiSqrMax = 12.25 ) {
|
87
|
|
88
|
Background::AcceptanceLookupIR lookup( config, "RadialAcceptance.root" );
|
89
|
|
90
|
TCanvas* canv = new TCanvas("lookupCanvas","energy-dependent acceptances",1100,900);
|
91
|
canv->Divide(3,2);
|
92
|
|
93
|
TCanvas* rescanv = new TCanvas("residualsCanvas","smoothing residulas",1200,900);
|
94
|
rescanv->Divide(1,6);
|
95
|
|
96
|
double zeniths[6] = { 10., 25., 35., 42., 47., 60. };
|
97
|
|
98
|
for( int i=0 ; i<6 ; ++i ){
|
99
|
|
100
|
double zenith = zeniths[i];
|
101
|
|
102
|
canv->cd(i+1);
|
103
|
|
104
|
TH1F* ac = lookup.CreateAcceptanceCurve(zenith, Emin, Emax);
|
105
|
if( !ac ) return 1;
|
106
|
|
107
|
ac->Draw();
|
108
|
|
109
|
TH1F* smooth = lookup.CreateSmoothedAcceptanceCurve(zenith, Emin, Emax, psiSqrMax,
|
110
|
degree, nbins, stepsize );
|
111
|
if( !smooth ) return 1;
|
112
|
|
113
|
smooth->SetLineColor(4);
|
114
|
smooth->Draw("same");
|
115
|
|
116
|
rescanv->cd(i+1);
|
117
|
|
118
|
std::stringstream resname;
|
119
|
resname << "residuals_" << i;
|
120
|
TH1F* residuals = (TH1F*)smooth->Clone(resname.str().c_str());
|
121
|
residuals->Reset();
|
122
|
|
123
|
for( int bin=1 ; bin<=smooth->GetNbinsX() ; ++bin ){
|
124
|
|
125
|
double pull = 0.0;
|
126
|
int acbin = ac->FindBin(smooth->GetBinCenter(bin));
|
127
|
if( ac->GetBinError(acbin) > 0.0 )
|
128
|
pull = ( smooth->GetBinContent(bin)-ac->GetBinContent(acbin) ) / ac->GetBinError(acbin);
|
129
|
|
130
|
residuals->SetBinContent(bin,pull);
|
131
|
residuals->SetBinError(bin,1.);
|
132
|
|
133
|
}
|
134
|
|
135
|
residuals->Draw();
|
136
|
residuals->SetMinimum(-3.);
|
137
|
residuals->SetMaximum(3.);
|
138
|
residuals->SetStats(0);
|
139
|
residuals->GetYaxis()->SetTickLength(-0.005);
|
140
|
gPad->SetGridy();
|
141
|
}
|
142
|
|
143
|
return 0;
|
144
|
}
|
145
|
|
146
|
|
147
|
int compare_edep() {
|
148
|
|
149
|
const char* config = "std";
|
150
|
double Emin_1 = 0.1;
|
151
|
double Emin_2 = 1.5;
|
152
|
double Emax = 50.;
|
153
|
double zenith = 10.;
|
154
|
double psiSqrMax = 9.;
|
155
|
int degree = 6;
|
156
|
int nbins = 150;
|
157
|
int stepsize = 1;
|
158
|
|
159
|
Background::AcceptanceLookupIR lookup( config, "RadialAcceptance.root" );
|
160
|
|
161
|
TCanvas* canv = new TCanvas("edepcanv","edep",1000,800);
|
162
|
canv->cd();
|
163
|
|
164
|
|
165
|
TH1F* smooth1 = lookup.CreateSmoothedAcceptanceCurve(zenith, Emin_1, Emax, psiSqrMax,
|
166
|
degree, nbins, stepsize );
|
167
|
if( !smooth1 ) return 1;
|
168
|
|
169
|
smooth1->SetLineColor(2);
|
170
|
|
171
|
TH1F* smooth2 = lookup.CreateSmoothedAcceptanceCurve(zenith, Emin_2, Emax, psiSqrMax,
|
172
|
degree, nbins, stepsize );
|
173
|
if( !smooth2 ) return 2;
|
174
|
|
175
|
smooth2->SetLineColor(4);
|
176
|
|
177
|
smooth2->Scale(smooth1->GetMaximum()/smooth2->GetMaximum());
|
178
|
|
179
|
smooth1->Draw();
|
180
|
smooth2->Draw("same");
|
181
|
|
182
|
std::stringstream le1, le2;
|
183
|
le1 << "E > " << Emin_1 << " TeV";
|
184
|
le2 << "E > " << Emin_2 << " TeV";
|
185
|
|
186
|
TLegend* leg = new TLegend(0.8,0.8,0.99,0.99);
|
187
|
leg->SetFillColor(kWhite);
|
188
|
leg->AddEntry(smooth1,le1.str().c_str(),"L");
|
189
|
leg->AddEntry(smooth2,le2.str().c_str(),"L");
|
190
|
leg->Draw();
|
191
|
|
192
|
return 0;
|
193
|
}
|