energyhistogram.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <fstream>
3 #include <string>
4 #include <TCanvas.h>
5 #include <TH2F.h>
6 #include <TMath.h>
7 #include <TFile.h>
8 #include <TGraph.h>
9 #include <TROOT.h>
10 #include <TStyle.h>
11 #include <TColor.h>
12 #include <TTimeStamp.h>
13 #define AUGER_RADIO_ENABLED
14 #include "RecEventFile.h"
15 #include "RecEvent.h"
16 #include "RdEvent.h"
17 #include "DetectorGeometry.h"
18 #include "SDEvent.h"
19 #include "DetectorGeometry.h"
20 #include "SdRecStation.h"
23 #include "PolarHist.h"
24 #include <TEllipse.h>
25 #include <TGraphPolar.h>
26 #include <TPaletteAxis.h>
27 #include <TText.h>
28 //Added
29 #include <TVector3.h>
30 #include <TProfile.h>
31 #include <RdTrace.h>
32 #include <vector>
33 #include <TArrow.h>
34 
35 using namespace std;
36 
37 void reverse(double arr[], int count)
38 {
39  double temp;
40  for (int i = 0; i < count/2; ++i)
41  {
42  temp = arr[i];
43  arr[i] = arr[count-i-1];
44  arr[count-i-1] = temp;
45  }
46 }
47 
48 //from https://root-forum.cern.ch/t/set-real-aspect-ratio-of-th2-or-tgraph/20734
62 bool SetRealAspectRatio(TCanvas* const c, const Int_t axis = 1)
63 {
64  if(!c)
65  {
66  cout << "Error in SetRealAspectRatio: canvas is NULL";
67  return false;
68  }
69 
70  {
71  //Get the current min-max values if SetUserRange has been called
72  c->Update();
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();
77 
78  //Get the length of zoomed x and y axes
79  const Double_t xlength = xmax - xmin;
80  const Double_t ylength = ymax - ymin;
81  const Double_t ratio = xlength/ylength;
82 
83  //Get how many pixels are occupied by the canvas
84  const Int_t npx = c->GetWw();
85  const Int_t npy = c->GetWh();
86 
87  //Get x-y coordinates at the edges of the canvas
88  //(extrapolating outside the axes, NOT at the edges of the histogram)
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();
93 
94  //Get the length of extrapolated x and y axes
95  const Double_t xlength2 = x2 - x1;
96  const Double_t ylength2 = y2 - y1;
97  const Double_t ratio2 = xlength2/ylength2;
98 
99  //Get now number of pixels including window borders
100  const Int_t bnpx = c->GetWindowWidth();
101  const Int_t bnpy = c->GetWindowHeight();
102 
103  /*
104  cout << "WindX\tWindY\tCanvX\tCanvY\tx1\ty1\tx2\ty2\tratiox/y\tCanvX/CanvY" << endl;
105  cout << bnpx << "\t" << bnpy << "\t" << npx << "\t" << npy
106  << "\t" << x1 << "\t" << y1 << "\t" << x2 << "\t" << y2 << "\t"
107  << ratio2 << "\t" << (double)npx/npy << "\tOriginal Canvas" << endl;
108  */
109 
110  if(axis==1)
111  {
112  c->SetCanvasSize(TMath::Nint(npy*ratio2), npy);
113  c->SetWindowSize((bnpx-npx)+TMath::Nint(npy*ratio2), bnpy);
114  }
115  else if(axis==2)
116  {
117  c->SetCanvasSize(npx, TMath::Nint(npx/ratio2));
118  c->SetWindowSize(bnpx, (bnpy-npy)+TMath::Nint(npx/ratio2));
119  }
120  else
121  {
122  cout << "Error in SetRealAspectRatio: axis value " << axis
123  << " is neither 1 (resize along x-axis) nor 2 (resize along y-axis).";
124  return false;
125  }
126  }
127 
128  //Check now that resizing has worked
129  {
130  //Get the current min-max values if SetUserRange has been called
131  c->Update();
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();
136 
137  //Get the length of zoomed x and y axes
138  const Double_t xlength = xmax - xmin;
139  const Double_t ylength = ymax - ymin;
140  const Double_t ratio = xlength/ylength;
141 
142  //Get how many pixels are occupied by the canvas
143  const Int_t npx = c->GetWw();
144  const Int_t npy = c->GetWh();
145 
146  //Get x-y coordinates at the edges of the canvas
147  //(extrapolating outside the axes, NOT at the edges of the histogram)
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();
152 
153  //Get the length of extrapolated x and y axes
154  const Double_t xlength2 = x2 - x1;
155  const Double_t ylength2 = y2 - y1;
156  const Double_t ratio2 = xlength2/ylength2;
157 
158  //Get now number of pixels including window borders
159  const Int_t bnpx = c->GetWindowWidth();
160  const Int_t bnpy = c->GetWindowHeight();
161 
162  /*
163  cout << bnpx << "\t" << bnpy << "\t" << npx << "\t" << npy << "\t"
164  << x1 << "\t" << y1 << "\t" << x2 << "\t" << y2 << "\t" << ratio2
165  << "\t" << (double)npx/npy << "\tModified Canvas" << endl;*/
166 
167  //Check accuracy +/-1 pixel due to rounding
168  if(abs(TMath::Nint(npy*ratio2) - npx)<2)
169  {
170  cout << "Resizing finished successfully." << endl;
171  return true;
172  }
173  else
174  {
175  cout << "Resizing failed." << endl;
176  return false;
177  }
178  }
179  // References:
180  // https://root.cern.ch/root/roottalk/roottalk01/3676.html
181  // https://root-forum.cern.ch/t/making-the-both-axes-square-on-the-pad/4325/1
182 }
183 
184 int main() {
185  //TH1F* Hist_Energy_sd = new TH1F("Hist_Energy_sd", "Hist_Energy_sd", 40, 17, 20);
186  //TH1F* Hist_Energy_sd = new TH1F("Hist_Energy_sd", "Hist_Energy_sd", 40, 17.5, 20);
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);
190  //0.9891 = sin^2(84 degree)
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);
194 
195  vector<string> v_filename;
196  ifstream fileList ("./filelist.txt");
197  char filename[10000] ;
198  while (fileList >> filename) {
199  v_filename.push_back(filename);
200  }
201 
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);
209 
210  std::vector<double> pphi;
211  std::vector<double> ttheta;
212 
213  //Loop over events
214  while(file->ReadNextEvent()==RecEventFile::eSuccess) {
215  const RdEvent& theradio= theevent->GetRdEvent();
216  const RdRecShower& rshow=theradio.GetRdRecShower();
217 
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();
222 
223  const TVector3& score = sshow.GetCoreSiteCS();
224  const TVector3& rcore = rshow.GetCoreSiteCS();
225 
226  const TVector3& saxis = sshow.GetAxisSiteCS();
227 
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();
232 
233  if (stheta<60 || stheta>84)
234  continue;
235 
236  //SD quality check
237  const int minRecLevel=3; // has reconstructed energy
238  const int minCandidateStations=4;
239  const int T4Trigger=2; // has T4 and SD triggered independently of FD
240  const int T5Trigger=3; //has T5 Posterior, which is the T5 HAS in this case
241 
242  const float minZenithSD=60;
243  const float maxZenithSD=84;
244 
245 // if (sdev.GetRecLevel()<minRecLevel) continue;// alle events
246 // if (sdev.GetNumberOfCandidates()<minCandidateStations) continue; //alle events
247 // if (sdev.GetT4Trigger()<T4Trigger) continue;
248 // if (sdev.GetT5Trigger()<T5Trigger) continue;
249  if (stheta>maxZenithSD) continue;
250  if (stheta<minZenithSD) continue;
251 // if (log10(sshow.GetEnergy()) < 18.5) continue;
252 
253  //Hist SD energy
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));
260 
261  //Hist Zenith angle
262  double zenith_sd = sshow.GetZenith()*TMath::RadToDeg();
263  double zenith_err_sd = sshow.GetZenithError()*TMath::RadToDeg();
264  Hist_Zenith_sd->Fill(zenith_sd);
265 
266  // Hist Azimuth angle
267  double azimuth_sd = sshow.GetAzimuth()*TMath::RadToDeg();
268  double azimuth_err_sd = sshow.GetAzimuthError()*TMath::RadToDeg();
269  Hist_Azimuth_sd->Fill(azimuth_sd);
270 
271  // Hist sin2theta
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);
278 
279  pphi.push_back(sphi);
280  ttheta.push_back(stheta);
281  }
282  //Saving histogramms
283  TFile *f = new TFile("energyhistogram.root","RECREATE");
284  Hist_Energy_sd->Write();
285  f->Close();
286 
287  //Making plots
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);
293 
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);
311  //Hist_Energy_sd->SetMarkerStyle(20);
312  //Hist_Energy_sd->SetMarkerSize(0.4);
313  //Hist_Energy_sd->SetMarkerColor(kBlack);
314  //Hist_Energy_sd->GetXaxis()->SetTitleOffset(1.2);
315  //Hist_Energy_sd->GetYaxis()->SetTitleOffset(1.2);
316  Hist_Energy_sd->SetTitle("");
317  //Hist_Energy_sd->SetFillColor(4);
318  Hist_Energy_sd->SetLineWidth(3);
319  Hist_Energy_sd->SetLineColor(kBlack);
320  Hist_Energy_sd->Draw("HIST E");
321 
322  TH1F* test = (TH1F*)Hist_Energy_sd->Clone();
323 // test->SetLineWidth(3);
324 // test->Draw("E SAME");
325 
326  Histo.SetLogy();
327  Histo.SaveAs("Hist_Energy.pdf");
328 
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");
349 
350  /*
351  gStyle->SetStatY(0.9);
352  gStyle->SetStatX(0.5);
353  gStyle->SetStatW(0.3);
354  gStyle->SetStatH(0.2);
355  */
356 
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);
362 // Histo2.Divide(3);
363 // Histo2.cd(1);
364 
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);
383  //Hist_sin2theta->SetFillColor(4);
384  Hist_sin2theta->SetLineWidth(3);
385  Hist_sin2theta->Draw("HIST E");
386 
387  //test = (TH1F*)Hist_sin2theta->Clone();
388  //test->SetLineWidth(3);
389  //test->Draw("E SAME");
390 
391 /*
392  //Histo2.cd(2);
393  Hist_sin2theta2->SetLineColor(kBlack);
394  Hist_sin2theta2->SetFillColor(5);
395  Hist_sin2theta2->Draw("HIST SAME");
396 
397  //Histo2.cd(3);
398  Hist_sin2theta3->SetLineColor(kBlack);
399  Hist_sin2theta3->SetFillColor(6);
400  Hist_sin2theta3->Draw("HIST SAME");
401 */
402  Histo2.SetLogy(0);
403  Histo2.SaveAs("Hist_sin2theta.pdf");
404 
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("");
426  //Hist_Azimuth_sd->GetYaxis()->SetNdivisions(810);
427  Hist_Azimuth_sd->GetYaxis()->SetRangeUser(0, 100);
428  Hist_Azimuth_sd->SetLineColor(kBlack);
429  //Hist_Azimuth_sd->SetFillColor(4);
430  Hist_Azimuth_sd->SetLineWidth(3);
431  Hist_Azimuth_sd->Draw("HIST E");
432 
433  //test = (TH1F*)Hist_Azimuth_sd->Clone();
434  //test->SetLineWidth(3);
435  //test->Draw("E SAME");
436 
437  Histo3.SaveAs("Hist_Azimuth.pdf");
438 
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);
444  //TH2F skymap("skymap", "", 72, 0, 360, 30, 0, 90); // 5x3 Grad bins
445  TH2F skymap("skymap", "", 36, 0, 360, 18, 0, 90); // 10x5 Grad bins
446 
447  skymap.SetStats(kFALSE);
448  for (int k=0; k<pphi.size(); k++){
449  skymap.Fill(pphi[k], ttheta[k]);
450  }
451  cout << pphi.size() << " entries in map" << endl;
452 
453  double maxBinContent = skymap.GetMaximum();
454  for (int i=0; i<skymap.GetSize(); i++){
455  skymap.SetBinContent(i, skymap.GetBinContent(i)/maxBinContent);
456  }
457 
458 
459  Double_t stops[9] = { 0.0000, 0.1250, 0.2500, 0.3750, 0.5000,
460  0.6250, 0.7500, 0.8750, 1.0000};
461  double alpha = 1.;
462 
463  //Viridis
464 /* Double_t red[9] = { 26./255., 51./255., 43./255., 33./255., 28./255.,
465  35./255., 74./255., 144./255., 246./255.};
466  Double_t green[9] = { 9./255., 24./255., 55./255., 87./255., 118./255.,
467  150./255., 180./255., 200./255., 222./255.};
468  Double_t blue[9] = { 30./255., 96./255., 112./255., 114./255., 112./255.,
469  101./255., 72./255., 35./255., 0./255.};
470 */
471 
472  //inverted kCherry
473 /* Double_t red[9] = { 251./255., 235./255., 223./255., 214./255., 196./255.,
474  188./255., 157./255., 102./255., 37./255.};
475  Double_t green[9] = { 251./255., 185./255., 132./255., 91./255., 67./255.,
476  37./255., 25./255., 29./255., 37./255.};
477  Double_t blue[9] = { 251./255., 137./255., 98./255., 66./255., 45./255.,
478  33./255., 32./255., 37./255.};
479 */
480  //ocean
481 /* Double_t red[9] = { 14./255., 7./255., 2./255., 0./255., 5./255.,
482  11./255., 55./255., 131./255., 229./255.};
483  Double_t green[9] = {105./255., 56./255., 26./255., 1./255., 42./255.,
484  74./255., 131./255., 171./255., 229./255.};
485  Double_t blue[9] = { 2./255., 21./255., 35./255., 60./255., 92./255.,
486  113./255., 160./255., 185./255., 229./255.};
487 */
488 
489  //avocado
490 /* Double_t red[9] = { 0./255., 4./255., 12./255., 30./255., 52./255.,
491  101./255., 142./255., 190./255., 237./255.};
492  Double_t green[9] = { 0./255., 40./255., 86./255., 121./255., 140./255.,
493  172./255., 187./255., 213./255., 240./255.};
494  Double_t blue[9] = { 0./255., 9./255., 14./255., 18./255., 21./255.,
495  23./255., 27./255., 35./255., 101./255.};
496 */
497 
498  //lake
499 /* Double_t red[9] = { 57./255., 72./255., 94./255., 117./255., 136./255.,
500  154./255., 174./255., 192./255., 215./255.};
501  Double_t green[9] = { 0./255., 33./255., 68./255., 109./255., 140./255.,
502  171./255., 192./255., 196./255., 209./255.};
503  Double_t blue[9] = { 116./255., 137./255., 173./255., 201./255., 200./255.,
504  201./255., 203./255., 190./255., 187./255.};
505 */
506 
507  //sunset
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.};
514 
515  reverse(red, 9);
516  reverse(green, 9);
517  reverse(blue, 9);
518 
519  TColor::CreateGradientColorTable(9, stops, red, green, blue, 255, alpha);
520 
521  skymap.Draw("SURF1Z POL");
522  gPad->SetTheta(90.0);
523  gPad->SetPhi(0.0);
524  //gPad->SetLogz(1);
525  gStyle->SetOptStat(10);
526 
527  SetRealAspectRatio(&canvas, 2);
528  TText *t = new TText(-.02,0.6,"N");
529  t->Draw();
530  t = new TText(-.02,-.65,"S");
531  t->Draw();
532  t = new TText(-.68,-.02,"W");
533  t->Draw();
534  t = new TText(.65,-.02,"E");
535  t->Draw();
536  t = new TText(.007,.29,"*");
537  t->SetTextSize(0.08);
538  t->Draw();
539 
540 /*
541  TH2F bfield("fuu", "", 36, 0, 360, 18, 0, 90);
542  bfield.Fill(87., 55.);
543  bfield.Fill(0., 0.);
544  bfield.SetMarkerStyle(29);
545  bfield.SetMarkerSize(20);
546  bfield.SetMarkerColor(kBlack);
547  bfield.Draw("SAMES P");
548 */
549 
550  gPad->Update();
551  TPaletteAxis *palette = (TPaletteAxis*)skymap.GetListOfFunctions()->FindObject("palette");
552 
553  palette->SetX1NDC(0.85);
554  palette->SetX2NDC(0.80);
555  palette->SetY1NDC(0.05);
556  palette->SetY2NDC(0.95);
557 
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);
568 
569  gPad->Modified();
570  gPad->Update();
571 
572  canvas.SaveAs("skymap_hist_pol.pdf");
573 }
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[])
Definition: DBSync.cc:58
double abs(const SVector< n, T > &v)
static const G4Colour red(1.0, 0.0, 0.0)
const string file
char * filename
Definition: dump1090.h:266
static const G4Colour blue(0.0, 0.0, 1.0)

, generated on Tue Sep 26 2023.