1 | |
---|
2 | void loadlibs() { |
---|
3 | gSystem->Load("libatmosphere.so"); |
---|
4 | gSystem->Load("libgenbase.so"); |
---|
5 | gSystem->Load("libshowers.so"); |
---|
6 | } |
---|
7 | |
---|
8 | ShowerTrack* CheckEnergyDistribution() { |
---|
9 | gROOT->Reset(); |
---|
10 | loadlibs(); |
---|
11 | gStyle->SetOptStat(0); |
---|
12 | SlastShowerGenerator *ShowerGenerator = new SlastShowerGenerator; |
---|
13 | ShowerTrack *track = ShowerGenerator->Get(); |
---|
14 | Int_t Nsteps = track->Size(); |
---|
15 | if ( !Nsteps ) { |
---|
16 | cout << "The track is empty\n"; |
---|
17 | return NULL; |
---|
18 | } |
---|
19 | TH1F* histos[10000]; |
---|
20 | TCanvas *c1; |
---|
21 | if (c1 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("c_checkEnergy")) |
---|
22 | c1->Clear(); |
---|
23 | else |
---|
24 | c1 = new TCanvas("c_checkEnergy"); |
---|
25 | TLegend *legend = new TLegend(0.8,0.9,1,0.6); |
---|
26 | Int_t frames = Nsteps/10; |
---|
27 | Float_t NumMax(-1); |
---|
28 | for (Int_t i = 0; i< TMath::Min(Nsteps,10000); i ++) { |
---|
29 | ShowerStep& s = track->GetStep(i); |
---|
30 | if (NumMax < s.GetNelectrons()) NumMax = s.GetNelectrons(); |
---|
31 | } |
---|
32 | for (Int_t i = 0; i< Nsteps; i +=frames) { |
---|
33 | ShowerStep& s = track->GetStep(i); |
---|
34 | histos[i] = s.GetHistoEnergy(); |
---|
35 | TString opt = ""; |
---|
36 | if (i != 0) opt = "same"; |
---|
37 | histos[i]->Draw(opt); |
---|
38 | histos[i]->SetLineColor(50 + (Int_t) (50.*s.GetNelectrons()/NumMax)); |
---|
39 | legend->AddEntry(histos[i],Form("step n = %d age = %.2f\n",i,s.GetAgei()),"lp"); |
---|
40 | } |
---|
41 | legend->Draw(); |
---|
42 | histos[0]->SetMaximum(1.e-1); |
---|
43 | histos[0]->SetMinimum(1.e-3); |
---|
44 | histos[0]->SetXTitle("Energy, [MeV]"); |
---|
45 | c1->SetLogy(kTRUE); |
---|
46 | c1->SetLogx(kTRUE); |
---|
47 | c1->cd(0); |
---|
48 | c1->Print("output/check_energydistributions.eps"); |
---|
49 | return track; |
---|
50 | } |
---|
51 | |
---|
52 | ShowerTrack* CheckLateralDistribution() { |
---|
53 | loadlibs(); |
---|
54 | gStyle->SetOptStat(0); |
---|
55 | SlastShowerGenerator *ShowerGenerator = new SlastShowerGenerator; |
---|
56 | ShowerTrack *track = ShowerGenerator->Get(); |
---|
57 | Int_t Nsteps = track->Size(); |
---|
58 | if ( !Nsteps ) { |
---|
59 | cout << "The track is empty\n"; |
---|
60 | return NULL; |
---|
61 | } |
---|
62 | TH1F* histos[10000]; |
---|
63 | TCanvas *c1; |
---|
64 | if (c1 = (TCanvas*)gROOT->GetListOfCanvases()->FindObject("c_checkLateral")) |
---|
65 | c1->Clear(); |
---|
66 | else |
---|
67 | c1 = new TCanvas("c_checkLateral"); |
---|
68 | TLegend *legend = new TLegend(0.8,0.9,1,0.6); |
---|
69 | Int_t frames = Nsteps/10; |
---|
70 | Float_t NumMax(-1); |
---|
71 | for (Int_t i = 0; i< TMath::Min(Nsteps,10000); i ++) { |
---|
72 | ShowerStep& s = track->GetStep(i); |
---|
73 | if (NumMax < s.GetNelectrons()) NumMax = s.GetNelectrons(); |
---|
74 | } |
---|
75 | for (Int_t i = 0; i< Nsteps; i +=frames) { |
---|
76 | ShowerStep& s = track->GetStep(i); |
---|
77 | histos[i] = s.GetHistoLateral(); |
---|
78 | TString opt = ""; |
---|
79 | if (i != 0) opt = "same"; |
---|
80 | histos[i]->Draw(opt); |
---|
81 | histos[i]->SetLineColor(50 + (Int_t) (50.*s.GetNelectrons()/NumMax)); |
---|
82 | legend->AddEntry(histos[i],Form("step n = %d age = %.2f\n",i,s.GetAgei()),"lp"); |
---|
83 | } |
---|
84 | legend->Draw(); |
---|
85 | histos[0]->SetMaximum(1.e0); |
---|
86 | histos[0]->SetMinimum(1.e-10); |
---|
87 | c1->SetLogy(kTRUE); |
---|
88 | c1->Print("output/check_lateraldistributions.eps"); |
---|
89 | |
---|
90 | return track; |
---|
91 | |
---|
92 | } |
---|
93 | |
---|
94 | // |
---|
95 | void CheckSteps() { |
---|
96 | loadlibs(); |
---|
97 | gStyle->SetOptStat(0); |
---|
98 | CorsikaFileShowerGenerator *ShowerGenerator = new CorsikaFileShowerGenerator; |
---|
99 | ShowerTrack *track = ShowerGenerator->Get(); |
---|
100 | Int_t Nsteps = track->Size(); |
---|
101 | TH1F *h1 = new TH1F ("h1", "fStep.fXi", Nsteps, 0, Nsteps); |
---|
102 | TH1F *h2 = new TH1F ("h2", "fStep.fXYZi[0]", Nsteps, 0, Nsteps); |
---|
103 | TH1F *h3 = new TH1F ("h3", "fStep.fXYXi[1]", Nsteps, 0, Nsteps); |
---|
104 | TH1F *h4 = new TH1F ("h4", "fStep.fXYZi[2]", Nsteps, 0, Nsteps); |
---|
105 | TH1F *h5 = new TH1F ("h5", "fStep.fTimei", Nsteps, 0, Nsteps); |
---|
106 | TH1F *h6 = new TH1F ("h6", "fStep.fAgei", Nsteps, 0, Nsteps); |
---|
107 | TH1F *h7 = new TH1F ("h7", "fStep.fNelectrons", Nsteps, 0, Nsteps); |
---|
108 | TH1F *h8 = new TH1F ("h8", "fStep.fNcharged", Nsteps, 0, Nsteps); |
---|
109 | TH1F *h9 = new TH1F ("h9", "fStep.fEloss", Nsteps, 0, Nsteps); |
---|
110 | |
---|
111 | TCanvas *c1 = new TCanvas(); |
---|
112 | Int_t icolor=3; |
---|
113 | c1->Divide(3,3); |
---|
114 | for (Int_t i = 0; i< Nsteps; i ++) { |
---|
115 | ShowerStep s = track->GetStep(i); |
---|
116 | h1->Fill(i,s.GetXi()); |
---|
117 | h2->Fill(i,s.GetXYZi().X()); |
---|
118 | h3->Fill(i,s.GetXYZi().Y()); |
---|
119 | h4->Fill(i,s.GetXYZi().Z()); |
---|
120 | h5->Fill(i,s.GetTimei()); |
---|
121 | h6->Fill(i,s.GetAgei()); |
---|
122 | h7->Fill(i,s.GetNelectrons()); |
---|
123 | h8->Fill(i,s.GetNcharged()); |
---|
124 | h9->Fill(i,s.GetEloss()); |
---|
125 | } |
---|
126 | |
---|
127 | c1->cd(1); |
---|
128 | h1->Draw(); |
---|
129 | c1->cd(2); |
---|
130 | h2->Draw(); |
---|
131 | c1->cd(3); |
---|
132 | h3->Draw(); |
---|
133 | c1->cd(4); |
---|
134 | h4->Draw(); |
---|
135 | c1->cd(5); |
---|
136 | h5->Draw(); |
---|
137 | c1->cd(6); |
---|
138 | h6->Draw(); |
---|
139 | c1->cd(7); |
---|
140 | h7->Draw(); |
---|
141 | c1->cd(8); |
---|
142 | h8->Draw(); |
---|
143 | c1->cd(9); |
---|
144 | h9->Draw(); |
---|
145 | |
---|
146 | c1->Print("output/check_steps.eps"); |
---|
147 | } |
---|