12 #include <TTimeStamp.h>
13 #define AUGER_RADIO_ENABLED
14 #include "RecEventFile.h"
17 #include "DetectorGeometry.h"
19 #include "DetectorGeometry.h"
20 #include "SdRecStation.h"
25 #include <TGraphPolar.h>
26 #include <TPaletteAxis.h>
40 for (
int i = 0; i < count/2; ++i)
43 arr[i] = arr[count-i-1];
44 arr[count-i-1] = temp;
66 cout <<
"Error in SetRealAspectRatio: canvas is NULL";
73 const Double_t xmin = c->GetUxmin();
74 const Double_t xmax = c->GetUxmax();
75 const Double_t ymin = c->GetUymin();
76 const Double_t ymax = c->GetUymax();
79 const Double_t xlength = xmax - xmin;
80 const Double_t ylength = ymax - ymin;
81 const Double_t ratio = xlength/ylength;
84 const Int_t npx = c->GetWw();
85 const Int_t npy = c->GetWh();
89 const Double_t x1 = c->GetX1();
90 const Double_t y1 = c->GetY1();
91 const Double_t x2 = c->GetX2();
92 const Double_t y2 = c->GetY2();
95 const Double_t xlength2 = x2 - x1;
96 const Double_t ylength2 = y2 - y1;
97 const Double_t ratio2 = xlength2/ylength2;
100 const Int_t bnpx = c->GetWindowWidth();
101 const Int_t bnpy = c->GetWindowHeight();
112 c->SetCanvasSize(TMath::Nint(npy*ratio2), npy);
113 c->SetWindowSize((bnpx-npx)+TMath::Nint(npy*ratio2), bnpy);
117 c->SetCanvasSize(npx, TMath::Nint(npx/ratio2));
118 c->SetWindowSize(bnpx, (bnpy-npy)+TMath::Nint(npx/ratio2));
122 cout <<
"Error in SetRealAspectRatio: axis value " << axis
123 <<
" is neither 1 (resize along x-axis) nor 2 (resize along y-axis).";
132 const Double_t xmin = c->GetUxmin();
133 const Double_t xmax = c->GetUxmax();
134 const Double_t ymin = c->GetUymin();
135 const Double_t ymax = c->GetUymax();
138 const Double_t xlength = xmax - xmin;
139 const Double_t ylength = ymax - ymin;
140 const Double_t ratio = xlength/ylength;
143 const Int_t npx = c->GetWw();
144 const Int_t npy = c->GetWh();
148 const Double_t x1 = c->GetX1();
149 const Double_t y1 = c->GetY1();
150 const Double_t x2 = c->GetX2();
151 const Double_t y2 = c->GetY2();
154 const Double_t xlength2 = x2 - x1;
155 const Double_t ylength2 = y2 - y1;
156 const Double_t ratio2 = xlength2/ylength2;
159 const Int_t bnpx = c->GetWindowWidth();
160 const Int_t bnpy = c->GetWindowHeight();
168 if(
abs(TMath::Nint(npy*ratio2) - npx)<2)
170 cout <<
"Resizing finished successfully." << endl;
175 cout <<
"Resizing failed." << endl;
187 TH1F* Hist_Energy_sd =
new TH1F(
"Hist_Energy_sd",
"Hist_Energy_sd", 15, 18.5, 20);
188 TH1F* Hist_Zenith_sd =
new TH1F(
"Hist_Zenith_sd",
"Hist_Zenithy_sd", 25, 60, 90);
189 TH1F* Hist_Azimuth_sd =
new TH1F(
"Hist_Azimuth_sd",
"Hist_Azimuth_sd", 10, 0, 360);
191 TH1F* Hist_sin2theta =
new TH1F(
"foo",
"all E", 11, 0.75, 0.9891);
192 TH1F* Hist_sin2theta2 =
new TH1F(
"foo2",
"lg E > 18.2", 12, 0.75, 0.9891);
193 TH1F* Hist_sin2theta3 =
new TH1F(
"foo3",
"lg E > 18.5", 12, 0.75, 0.9891);
195 vector<string> v_filename;
196 ifstream fileList (
"./filelist.txt");
198 while (fileList >> filename) {
199 v_filename.push_back(filename);
202 const TVector3 vmag(-884.62,-19699.87,+14154.43);
203 RecEventFile *
file =
new RecEventFile(v_filename);
204 RecEvent* theevent=
new RecEvent();
205 int nevents=file->GetNEvents();
206 file->SetBuffers(&theevent);
207 DetectorGeometry *geo =
new DetectorGeometry();
208 file->ReadDetectorGeometry(*geo);
210 std::vector<double> pphi;
211 std::vector<double> ttheta;
215 const RdEvent& theradio= theevent->GetRdEvent();
216 const RdRecShower& rshow=theradio.GetRdRecShower();
218 if (!theradio.HasRdStations())
continue ;
219 const std::vector<RdRecStation>& vecRstat = theradio.GetRdStationVector();
220 const SDEvent& sdev = theevent->GetSDEvent();
221 const SdRecShower& sshow = sdev.GetSdRecShower();
223 const TVector3& score = sshow.GetCoreSiteCS();
224 const TVector3& rcore = rshow.GetCoreSiteCS();
226 const TVector3& saxis = sshow.GetAxisSiteCS();
228 double rtheta = TMath::RadToDeg()*rshow.GetZenith();
229 double rphi = TMath::RadToDeg()*rshow.GetAzimuth();
230 double stheta = TMath::RadToDeg()*sshow.GetZenith();
231 double sphi = TMath::RadToDeg()*sshow.GetAzimuth();
233 if (stheta<60 || stheta>84)
237 const int minRecLevel=3;
238 const int minCandidateStations=4;
239 const int T4Trigger=2;
240 const int T5Trigger=3;
242 const float minZenithSD=60;
243 const float maxZenithSD=84;
249 if (stheta>maxZenithSD)
continue;
250 if (stheta<minZenithSD)
continue;
254 double energy_sd = sshow.GetEnergy();
255 double energy_err_sd = sshow.GetEnergyError();
256 const double power_sd = energy_sd>0.?(int) log10(energy_sd):0.;
257 const double norm_sd =
pow(10, power_sd);
258 energy_err_sd /= norm_sd;
259 Hist_Energy_sd->Fill(log10(energy_sd));
262 double zenith_sd = sshow.GetZenith()*TMath::RadToDeg();
263 double zenith_err_sd = sshow.GetZenithError()*TMath::RadToDeg();
264 Hist_Zenith_sd->Fill(zenith_sd);
267 double azimuth_sd = sshow.GetAzimuth()*TMath::RadToDeg();
268 double azimuth_err_sd = sshow.GetAzimuthError()*TMath::RadToDeg();
269 Hist_Azimuth_sd->Fill(azimuth_sd);
272 double sintheta = sin(sshow.GetZenith());
273 Hist_sin2theta->Fill(sintheta*sintheta);
274 if(log10(sshow.GetEnergy()) > 18.2)
275 Hist_sin2theta2->Fill(sintheta*sintheta);
276 if(log10(sshow.GetEnergy()) > 18.5)
277 Hist_sin2theta3->Fill(sintheta*sintheta);
279 pphi.push_back(sphi);
280 ttheta.push_back(stheta);
283 TFile *f =
new TFile(
"energyhistogram.root",
"RECREATE");
284 Hist_Energy_sd->Write();
288 TCanvas Histo(
"Histo",
"Histo",1800,1000);
289 Histo.SetLeftMargin(0.1);
290 Histo.SetRightMargin(0.05);
291 Histo.SetTopMargin(0.06);
292 Histo.SetBottomMargin(0.14);
294 Hist_Energy_sd->SetStats(kFALSE);
295 Hist_Energy_sd->GetXaxis()->SetTitle(
"log_{10}(E_{SD}/eV)");
296 Hist_Energy_sd->GetXaxis()->SetLabelFont(42);
297 Hist_Energy_sd->GetXaxis()->SetLabelOffset(0.01);
298 Hist_Energy_sd->GetXaxis()->SetLabelSize(0.05);
299 Hist_Energy_sd->GetXaxis()->SetTitleSize(0.055);
300 Hist_Energy_sd->GetXaxis()->SetTitleOffset(1.15);
301 Hist_Energy_sd->GetXaxis()->SetNdivisions(804);
302 Hist_Energy_sd->GetXaxis()->SetRangeUser(18.4, 20.0);
303 Hist_Energy_sd->GetXaxis()->SetTitleFont(42);
304 Hist_Energy_sd->GetYaxis()->SetTitle(
"Entries");
305 Hist_Energy_sd->GetYaxis()->SetLabelFont(42);
306 Hist_Energy_sd->GetYaxis()->SetLabelOffset(0.01);
307 Hist_Energy_sd->GetYaxis()->SetLabelSize(0.05);
308 Hist_Energy_sd->GetYaxis()->SetTitleSize(0.055);
309 Hist_Energy_sd->GetYaxis()->SetTitleOffset(0.8);
310 Hist_Energy_sd->GetYaxis()->SetTitleFont(42);
316 Hist_Energy_sd->SetTitle(
"");
318 Hist_Energy_sd->SetLineWidth(3);
319 Hist_Energy_sd->SetLineColor(kBlack);
320 Hist_Energy_sd->Draw(
"HIST E");
322 TH1F* test = (TH1F*)Hist_Energy_sd->Clone();
327 Histo.SaveAs(
"Hist_Energy.pdf");
329 Hist_Zenith_sd->SetStats(kFALSE);
330 Hist_Zenith_sd->GetXaxis()->SetTitle(
"Zenith angle / #circ");
331 Hist_Zenith_sd->GetYaxis()->SetTitle(
"Entries");
332 Hist_Zenith_sd->GetXaxis()->SetRangeUser(0.7, 1.);
333 Hist_Zenith_sd->GetXaxis()->SetLabelFont(42);
334 Hist_Zenith_sd->GetXaxis()->SetLabelOffset(0.01);
335 Hist_Zenith_sd->GetXaxis()->SetLabelSize(0.05);
336 Hist_Zenith_sd->GetXaxis()->SetTitleSize(0.055);
337 Hist_Zenith_sd->GetXaxis()->SetTitleOffset(1.15);
338 Hist_Zenith_sd->GetXaxis()->SetTitleFont(42);
339 Hist_Zenith_sd->GetYaxis()->SetLabelFont(42);
340 Hist_Zenith_sd->GetYaxis()->SetLabelOffset(0.01);
341 Hist_Zenith_sd->GetYaxis()->SetLabelSize(0.05);
342 Hist_Zenith_sd->GetYaxis()->SetTitleSize(0.055);
343 Hist_Zenith_sd->GetYaxis()->SetTitleOffset(0.8);
344 Hist_Zenith_sd->GetYaxis()->SetTitleFont(42);
345 Hist_Zenith_sd->SetTitle(
"");
346 Hist_Zenith_sd->SetFillColor(4);
347 Hist_Zenith_sd->Draw(
"HIST");
348 Histo.SaveAs(
"Hist_Zenith.pdf");
357 TCanvas Histo2(
"Histo2",
"Histo2",1800,1000);
358 Histo2.SetLeftMargin(0.1);
359 Histo2.SetRightMargin(0.05);
360 Histo2.SetTopMargin(0.06);
361 Histo2.SetBottomMargin(0.14);
365 Hist_sin2theta->GetXaxis()->SetTitle(
"sin^{2}(#theta_{SD})");
366 Hist_sin2theta->GetYaxis()->SetTitle(
"Entries");
367 Hist_sin2theta->GetXaxis()->SetRangeUser(0.7, 1.);
368 Hist_sin2theta->GetXaxis()->SetLabelFont(42);
369 Hist_sin2theta->GetXaxis()->SetLabelOffset(0.01);
370 Hist_sin2theta->GetXaxis()->SetLabelSize(0.05);
371 Hist_sin2theta->GetXaxis()->SetTitleSize(0.055);
372 Hist_sin2theta->GetXaxis()->SetTitleOffset(1.15);
373 Hist_sin2theta->GetXaxis()->SetTitleFont(42);
374 Hist_sin2theta->GetYaxis()->SetLabelFont(42);
375 Hist_sin2theta->GetYaxis()->SetLabelOffset(0.01);
376 Hist_sin2theta->GetYaxis()->SetLabelSize(0.05);
377 Hist_sin2theta->GetYaxis()->SetTitleSize(0.055);
378 Hist_sin2theta->GetYaxis()->SetTitleOffset(0.8);
379 Hist_sin2theta->GetYaxis()->SetTitleFont(42);
380 Hist_sin2theta->SetStats(kFALSE);
381 Hist_sin2theta->SetTitle(
"");
382 Hist_sin2theta->SetLineColor(kBlack);
384 Hist_sin2theta->SetLineWidth(3);
385 Hist_sin2theta->Draw(
"HIST E");
403 Histo2.SaveAs(
"Hist_sin2theta.pdf");
405 TCanvas Histo3(
"Histo2",
"Histo2",1800,1000);
406 Histo3.SetLeftMargin(0.1);
407 Histo3.SetRightMargin(0.05);
408 Histo3.SetTopMargin(0.06);
409 Histo3.SetBottomMargin(0.14);
410 Hist_Azimuth_sd->SetStats(kFALSE);
411 Hist_Azimuth_sd->GetXaxis()->SetTitle(
"#phi_{SD} / #circ");
412 Hist_Azimuth_sd->GetYaxis()->SetTitle(
"Entries");
413 Hist_Azimuth_sd->GetXaxis()->SetLabelFont(42);
414 Hist_Azimuth_sd->GetXaxis()->SetLabelOffset(0.01);
415 Hist_Azimuth_sd->GetXaxis()->SetLabelSize(0.05);
416 Hist_Azimuth_sd->GetXaxis()->SetTitleSize(0.055);
417 Hist_Azimuth_sd->GetXaxis()->SetTitleOffset(1.15);
418 Hist_Azimuth_sd->GetXaxis()->SetTitleFont(42);
419 Hist_Azimuth_sd->GetYaxis()->SetLabelFont(42);
420 Hist_Azimuth_sd->GetYaxis()->SetLabelOffset(0.01);
421 Hist_Azimuth_sd->GetYaxis()->SetLabelSize(0.05);
422 Hist_Azimuth_sd->GetYaxis()->SetTitleSize(0.055);
423 Hist_Azimuth_sd->GetYaxis()->SetTitleOffset(0.8);
424 Hist_Azimuth_sd->GetYaxis()->SetTitleFont(42);
425 Hist_Azimuth_sd->SetTitle(
"");
427 Hist_Azimuth_sd->GetYaxis()->SetRangeUser(0, 100);
428 Hist_Azimuth_sd->SetLineColor(kBlack);
430 Hist_Azimuth_sd->SetLineWidth(3);
431 Hist_Azimuth_sd->Draw(
"HIST E");
437 Histo3.SaveAs(
"Hist_Azimuth.pdf");
439 TCanvas canvas(
"Histo",
"Histo",1800,1000);
440 canvas.SetLeftMargin(0.07);
441 canvas.SetRightMargin(0.28);
442 canvas.SetTopMargin(0.06);
443 canvas.SetBottomMargin(0.06);
445 TH2F skymap(
"skymap",
"", 36, 0, 360, 18, 0, 90);
447 skymap.SetStats(kFALSE);
448 for (
int k=0; k<pphi.size(); k++){
449 skymap.Fill(pphi[k], ttheta[k]);
451 cout << pphi.size() <<
" entries in map" << endl;
453 double maxBinContent = skymap.GetMaximum();
454 for (
int i=0; i<skymap.GetSize(); i++){
455 skymap.SetBinContent(i, skymap.GetBinContent(i)/maxBinContent);
459 Double_t stops[9] = { 0.0000, 0.1250, 0.2500, 0.3750, 0.5000,
460 0.6250, 0.7500, 0.8750, 1.0000};
508 Double_t
red[9] = { 0./255., 48./255., 119./255., 173./255., 212./255.,
509 224./255., 228./255., 228./255., 245./255.};
510 Double_t
green[9] = { 0./255., 13./255., 30./255., 47./255., 79./255.,
511 127./255., 167./255., 205./255., 245./255.};
512 Double_t
blue[9] = { 0./255., 68./255., 75./255., 43./255., 16./255.,
513 22./255., 55./255., 128./255., 245./255.};
519 TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
521 skymap.Draw(
"SURF1Z POL");
522 gPad->SetTheta(90.0);
525 gStyle->SetOptStat(10);
528 TText *t =
new TText(-.02,0.6,
"N");
530 t =
new TText(-.02,-.65,
"S");
532 t =
new TText(-.68,-.02,
"W");
534 t =
new TText(.65,-.02,
"E");
536 t =
new TText(.007,.29,
"*");
537 t->SetTextSize(0.08);
551 TPaletteAxis *palette = (TPaletteAxis*)skymap.GetListOfFunctions()->FindObject(
"palette");
553 palette->SetX1NDC(0.85);
554 palette->SetX2NDC(0.80);
555 palette->SetY1NDC(0.05);
556 palette->SetY2NDC(0.95);
558 skymap.GetZaxis()->SetNdivisions(5, 0, 0, kFALSE);
559 skymap.GetZaxis()->SetTitle(
"normalized density");
560 skymap.GetXaxis()->SetTitle(
"foo");
561 skymap.GetYaxis()->SetTitle(
"bar");
562 skymap.GetZaxis()->SetLabelFont(42);
563 skymap.GetZaxis()->SetTickLength(-0.07);
564 skymap.GetZaxis()->SetLabelOffset(0.07);
565 skymap.GetZaxis()->SetLabelSize(0.05);
566 skymap.GetZaxis()->SetTitleSize(0.055);
567 skymap.GetZaxis()->SetTitleOffset(1.7);
572 canvas.SaveAs(
"skymap_hist_pol.pdf");
bool SetRealAspectRatio(TCanvas *const c, const Int_t axis=1)
Function to resize a canvas so that a 2D histogram or TGraph / TGraph2D are shown in real aspect rati...
static const G4Colour green(0.0, 1.0, 0.0)
double pow(const double x, const unsigned int i)
void reverse(double arr[], int count)
int main(int argc, char *argv[])
double abs(const SVector< n, T > &v)
static const G4Colour red(1.0, 0.0, 0.0)
static const G4Colour blue(0.0, 0.0, 1.0)