1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: EusoHistoFactory.cc 2846 2010-04-18 06:09:05Z fenu $ |
---|
3 | // created Apr, 18 2003 |
---|
4 | |
---|
5 | #include "Riostream.h" |
---|
6 | #include "TTree.h" |
---|
7 | #include "TCanvas.h" |
---|
8 | #include "TH1.h" |
---|
9 | #include "TH2.h" |
---|
10 | #include "TText.h" |
---|
11 | #include "TPad.h" |
---|
12 | #include "TStyle.h" |
---|
13 | |
---|
14 | #include "EusoHistoFactory.hh" |
---|
15 | #include "EEvent.hh" |
---|
16 | #include "EDetPhoton.hh" |
---|
17 | #include "EFee.hh" |
---|
18 | #include "EAFee.hh" |
---|
19 | #include "EDetector.hh" |
---|
20 | |
---|
21 | #include "Config.hh" |
---|
22 | |
---|
23 | ClassImp(EusoHistoFactory) |
---|
24 | |
---|
25 | EusoHistoFactory *EusoHistoFactory::fMe = NULL; |
---|
26 | |
---|
27 | // constructor |
---|
28 | EusoHistoFactory::EusoHistoFactory() { |
---|
29 | SetCanvas( NULL ); |
---|
30 | } |
---|
31 | |
---|
32 | // destructor |
---|
33 | EusoHistoFactory::~EusoHistoFactory() { |
---|
34 | Close(); |
---|
35 | } |
---|
36 | |
---|
37 | // close canvas if owner |
---|
38 | void EusoHistoFactory::Close() { |
---|
39 | if ( Canvas() ) |
---|
40 | delete Canvas(); |
---|
41 | SetCanvas( NULL ); |
---|
42 | } |
---|
43 | |
---|
44 | // instance |
---|
45 | EusoHistoFactory* EusoHistoFactory::Get() { |
---|
46 | if ( fMe == NULL ) |
---|
47 | fMe = new EusoHistoFactory(); |
---|
48 | return fMe; |
---|
49 | } |
---|
50 | |
---|
51 | // standard interface to event histograms |
---|
52 | void EusoHistoFactory::DoHisto(EusoStandardHistoId h, EEvent* pEv, TCanvas*c) { |
---|
53 | |
---|
54 | if (!pEv) return; |
---|
55 | |
---|
56 | TCanvas *canvas; |
---|
57 | if ( c ) { |
---|
58 | canvas = c; |
---|
59 | SetCanvas( NULL ); |
---|
60 | } |
---|
61 | else { |
---|
62 | canvas = new TCanvas( "EusoHisto", "Euso Histogram" ); |
---|
63 | SetCanvas( canvas ); |
---|
64 | } |
---|
65 | switch ( h ) { |
---|
66 | case HS_GTUTIME_1: DoGtuPhotonsHisto(pEv,canvas); break; |
---|
67 | case HS_PHOTON_PHICOSTH_1: DoPhiCosThetaHisto(pEv,canvas); break; |
---|
68 | case HS_PHOTON_XY_1: DoXYHisto(pEv, canvas); break; |
---|
69 | case HS_PHOTON_WLXY_1: DoWavelengthXYHisto(pEv, canvas); break; |
---|
70 | default: break; |
---|
71 | } |
---|
72 | } |
---|
73 | |
---|
74 | // global histogram on a tree |
---|
75 | void EusoHistoFactory::DoGlobalHisto(EusoStandardHistoId h,TTree* tree,TCanvas* c) { |
---|
76 | if (!tree) return; |
---|
77 | |
---|
78 | TCanvas *canvas; |
---|
79 | if ( c ) { |
---|
80 | canvas = c; |
---|
81 | SetCanvas( NULL ); |
---|
82 | } |
---|
83 | else { |
---|
84 | canvas = new TCanvas( "EusoGlobalHisto", "Euso Global Histogram" ); |
---|
85 | SetCanvas( canvas ); |
---|
86 | } |
---|
87 | switch ( h ) { |
---|
88 | case HG_TRIGGER_EFF_1: DoTriggerEffic1(tree,canvas); break; |
---|
89 | default: break; |
---|
90 | } |
---|
91 | } |
---|
92 | |
---|
93 | |
---|
94 | // Time distribution of photons at various stage of Euso detector |
---|
95 | void EusoHistoFactory::DoGtuPhotonsHisto(EEvent* pEv,TCanvas *canvas) { |
---|
96 | |
---|
97 | cout << "DoGtuPhotonsOnHito called" << endl; |
---|
98 | |
---|
99 | EDetector* pDet; |
---|
100 | if ( !(pDet = pEv->GetDetector()) ) { |
---|
101 | cout << "No EDetector in this event, exiting." << endl; |
---|
102 | return; |
---|
103 | } |
---|
104 | |
---|
105 | canvas->Clear(); |
---|
106 | canvas->cd(); |
---|
107 | |
---|
108 | TPad *pad1 = new TPad("Pad1","Pad1",0.05,0.50,0.45,0.95,21); |
---|
109 | TPad *pad2 = new TPad("Pad2","Pad2",0.50,0.50,0.95,0.95,21); |
---|
110 | TPad *pad3 = new TPad("Pad3","Pad3",0.05,0.05,0.45,0.45,21); |
---|
111 | TPad *pad4 = new TPad("Pad4","Pad4",0.50,0.05,0.95,0.45,21); |
---|
112 | |
---|
113 | pad1->Draw(); |
---|
114 | pad2->Draw(); |
---|
115 | pad3->Draw(); |
---|
116 | pad4->Draw(); |
---|
117 | |
---|
118 | Double_t GtuLength = Config::Get()->GetCF("Electronics","Macrocell")->GetNum("GtuTimeLength"); |
---|
119 | Int_t Gtus = (Int_t) ((pDet->GetLastTime() - pDet->GetFirstTime() ) / GtuLength); |
---|
120 | gROOT->Delete( "EusoHF_GtuPho*" ); |
---|
121 | TH1F *th0 = new TH1F( "EusoHF_GtuPho0", "Photons vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
122 | TH1F *th1 = new TH1F( "EusoHF_GtuPho1", "Photons vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
123 | TH1F *th2 = new TH1F( "EusoHF_GtuPho2", "Photons vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
124 | for( Int_t i=0; i < pDet->GetNumPhotons(); i++ ) { |
---|
125 | EDetPhoton& ph = *(pDet->GetPhoton( i )); |
---|
126 | Float_t time = ( ph.GetTime() - pDet->GetFirstTime() ) / GtuLength; |
---|
127 | th0->Fill( time ); |
---|
128 | if ( ph.CrossedIFS() ) th1->Fill( time ); |
---|
129 | if ( ph.CrossedIFS() && ph.MadeSignal() ) th2->Fill( time ); |
---|
130 | } |
---|
131 | pad1->cd(); |
---|
132 | // draw histograms with colors and filling |
---|
133 | th0->SetStats(0); |
---|
134 | th0->SetLineColor(9); |
---|
135 | th0->SetFillColor(0); |
---|
136 | th0->SetXTitle("GTU number"); |
---|
137 | th0->SetYTitle("Number of Photons"); |
---|
138 | th0->Draw(); |
---|
139 | th1->SetStats(0); |
---|
140 | th1->SetLineColor(2); |
---|
141 | th1->SetFillColor(0); |
---|
142 | th1->Draw("same"); |
---|
143 | th2->SetStats(0); |
---|
144 | th2->SetLineColor(8); |
---|
145 | th2->SetFillColor(8); |
---|
146 | th2->Draw("same"); |
---|
147 | |
---|
148 | // write meaning and statistics |
---|
149 | TText *t = new TText(); |
---|
150 | char txt[200]; |
---|
151 | t->SetTextFont(62); |
---|
152 | t->SetTextColor(9); |
---|
153 | t->SetTextSize(0.04); |
---|
154 | sprintf(txt,"Ph. on Pupil:%d",(int)th0->GetEntries()); |
---|
155 | t->DrawText(60.,th0->GetMaximum()*0.94,txt); |
---|
156 | t->SetTextColor(2); |
---|
157 | sprintf(txt,"Ph. on FS:%d",(int)th1->GetEntries()); |
---|
158 | t->DrawText(60.,th0->GetMaximum()*0.86,txt); |
---|
159 | t->SetTextColor(8); |
---|
160 | sprintf(txt,"Ph. detected:%d",(int)th2->GetEntries()); |
---|
161 | t->DrawText(60.,th0->GetMaximum()*0.78,txt); |
---|
162 | |
---|
163 | canvas->Update(); |
---|
164 | |
---|
165 | // second pad |
---|
166 | pad2->cd(); |
---|
167 | TH1F *th3 = new TH1F( "EusoHF_GtuPho3", "Photons vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
168 | TH1F *th4 = new TH1F( "EusoHF_GtuPho4", "Photons vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
169 | TH1F *th5 = new TH1F( "EusoHF_GtuPho5", "Photons vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
170 | TH1F *th6 = new TH1F( "EusoHF_GtuPho6", "Photons vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
171 | for( Int_t i=0; i < pDet->GetNumPhotons(); i++ ) { |
---|
172 | EDetPhoton& ph = *(pDet->GetPhoton( i )); |
---|
173 | Float_t time = ( ph.GetTime() - pDet->GetFirstTime() ) / GtuLength; |
---|
174 | if ( ph.CrossedIFS() ) th3->Fill( time ); |
---|
175 | if ( ph.CrossedIFS() && ph.MadeCount() ) th5->Fill( time ); |
---|
176 | if ( ph.CrossedIFS() && ph.MadeFastOR() ) th6->Fill( time ); |
---|
177 | } |
---|
178 | |
---|
179 | th3->SetStats(0); |
---|
180 | th3->SetLineColor(9); |
---|
181 | th3->SetFillColor(0); |
---|
182 | th3->SetXTitle("GTU number"); |
---|
183 | th3->SetYTitle("Number of Photons"); |
---|
184 | th3->Draw(); |
---|
185 | th4->SetStats(0); |
---|
186 | th4->SetLineColor(6); |
---|
187 | th4->SetFillColor(0); |
---|
188 | th4->Draw("same"); |
---|
189 | th5->SetStats(0); |
---|
190 | th5->SetLineColor(2); |
---|
191 | th5->SetFillColor(2); |
---|
192 | th5->Draw("same"); |
---|
193 | th6->SetStats(0); |
---|
194 | th6->SetLineColor(8); |
---|
195 | th6->SetFillColor(8); |
---|
196 | th6->Draw("same"); |
---|
197 | |
---|
198 | TText *t2 = new TText(); |
---|
199 | t2->SetTextFont(62); |
---|
200 | t2->SetTextColor(9); |
---|
201 | t2->SetTextSize(0.04); |
---|
202 | sprintf(txt,"Photons on FS:%d",(int)th3->GetEntries()); |
---|
203 | t2->DrawText(65.,th3->GetMaximum()*0.94,txt); |
---|
204 | t2->SetTextColor(6); |
---|
205 | sprintf(txt,"Pmt signals:%d",(int)th4->GetEntries()); |
---|
206 | t2->DrawText(65.,th3->GetMaximum()*0.86,txt); |
---|
207 | t2->SetTextColor(2); |
---|
208 | sprintf(txt,"Frontend hits:%d",(int)th5->GetEntries()); |
---|
209 | t2->DrawText(65.,th3->GetMaximum()*0.78,txt); |
---|
210 | t2->SetTextColor(8); |
---|
211 | sprintf(txt,"Fast OR counts:%d",(int)th6->GetEntries()); |
---|
212 | t2->DrawText(65.,th3->GetMaximum()*0.70,txt); |
---|
213 | |
---|
214 | canvas->Update(); |
---|
215 | |
---|
216 | // third pad: charge |
---|
217 | pad3->cd(); |
---|
218 | TH1F *th7 = new TH1F( "EusoHF_GtuPho7", "Photons vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
219 | TH1F *th8 = new TH1F( "EusoHF_GtuPho8", "Photons vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
220 | TH1F *th9 = new TH1F( "EusoHF_GtuPho9", "Charge vs GTU", Gtus, 0., (Float_t) Gtus); |
---|
221 | for( Int_t i=0; i < pDet->GetNumPhotons(); i++ ) { |
---|
222 | EDetPhoton& ph = *(pDet->GetPhoton( i )); |
---|
223 | Float_t time = ( ph.GetTime() - pDet->GetFirstTime() ) / GtuLength; |
---|
224 | if ( ph.CrossedIFS() && ph.MadeCount() ) th7->Fill( time ); |
---|
225 | if ( ph.CrossedIFS() && ph.MadeFastOR() ) th8->Fill( time ); |
---|
226 | } |
---|
227 | Float_t total_afee_charge=0.; |
---|
228 | for(Int_t i=0; i < pDet->GetNumAFee(); i++ ) { |
---|
229 | EAFee *afee = pDet->GetAFee( i ); |
---|
230 | Int_t gtu = afee->GetGtu(); |
---|
231 | Float_t charge = afee->GetDyCharge(); |
---|
232 | Int_t numpe = (Int_t)(charge*2.e13); // convert into NOMINAL photoelectrons, gain 3.E5 |
---|
233 | if ( gtu > 0 && gtu < Gtus) { |
---|
234 | Int_t old = (Int_t)(th3->GetBinContent( gtu )); |
---|
235 | th9->SetBinContent( gtu, old + numpe ); |
---|
236 | total_afee_charge += numpe; |
---|
237 | } |
---|
238 | } |
---|
239 | |
---|
240 | th7->SetStats(0); |
---|
241 | th7->SetLineColor(9); |
---|
242 | th7->SetFillColor(0); |
---|
243 | th7->SetXTitle("GTU number"); |
---|
244 | th7->SetYTitle("Number of Photons"); |
---|
245 | th7->Draw(); |
---|
246 | th8->SetStats(0); |
---|
247 | th8->SetLineColor(6); |
---|
248 | th8->SetFillColor(0); |
---|
249 | th8->Draw("same"); |
---|
250 | th9->SetStats(0); |
---|
251 | th9->SetLineColor(8); |
---|
252 | th9->SetFillColor(8); |
---|
253 | th9->Draw("same"); |
---|
254 | |
---|
255 | TText *t3 = new TText(); |
---|
256 | t3->SetTextFont(62); |
---|
257 | t3->SetTextColor(9); |
---|
258 | t3->SetTextSize(0.04); |
---|
259 | sprintf(txt,"Ph. detected:%d",(Int_t)th7->GetEntries()); |
---|
260 | t3->DrawText(65.,th7->GetMaximum()*0.94,txt); |
---|
261 | t3->SetTextColor(6); |
---|
262 | sprintf(txt,"Ph. in DFEE:%d",(Int_t)th8->GetEntries()); |
---|
263 | t3->DrawText(65.,th7->GetMaximum()*0.86,txt); |
---|
264 | t3->SetTextColor(2); |
---|
265 | sprintf(txt,"Charge (pC,dynode):%f",total_afee_charge); |
---|
266 | t3->DrawText(65.,th7->GetMaximum()*0.78,txt); |
---|
267 | |
---|
268 | canvas->Update(); |
---|
269 | } |
---|
270 | |
---|
271 | // photons on focal surface |
---|
272 | void EusoHistoFactory::DoPhiCosThetaHisto(EEvent* ev, TCanvas *canvas){ |
---|
273 | |
---|
274 | cout << "DoPhiCosThetaHisto called" << endl; |
---|
275 | EDetector* pDet; |
---|
276 | if ( !(pDet = ev->GetDetector()) ) { |
---|
277 | cout << "No EDetector in this event, exiting." << endl; |
---|
278 | return; |
---|
279 | } |
---|
280 | |
---|
281 | canvas->Clear(); |
---|
282 | canvas->Divide(2,2); |
---|
283 | |
---|
284 | Float_t th0CosThMin(10),th0CosThMax(-10); |
---|
285 | Float_t th0PhiMin(10),th0PhiMax(-10); |
---|
286 | |
---|
287 | for ( Int_t i=0; i < pDet->GetNumPhotons(); i++){ |
---|
288 | EDetPhoton& ph=*(pDet->GetPhoton(i)); |
---|
289 | if (TMath::Cos(ph.GetTheta()) > th0CosThMax) |
---|
290 | th0CosThMax = TMath::Cos(ph.GetTheta()); |
---|
291 | |
---|
292 | if (ph.GetPhi() > th0PhiMax) |
---|
293 | th0PhiMax = ph.GetPhi(); |
---|
294 | |
---|
295 | if (TMath::Cos(ph.GetTheta()) < th0CosThMin) |
---|
296 | th0CosThMin = TMath::Cos(ph.GetTheta()); |
---|
297 | |
---|
298 | if (ph.GetPhi() < th0PhiMin) |
---|
299 | th0PhiMin = ph.GetPhi(); |
---|
300 | |
---|
301 | } |
---|
302 | Float_t th0Delta = th0CosThMax-th0CosThMin; |
---|
303 | th0CosThMin-=0.1*th0Delta; |
---|
304 | th0CosThMax+=0.1*th0Delta; |
---|
305 | |
---|
306 | th0Delta = th0PhiMax-th0PhiMin; |
---|
307 | th0PhiMin-=0.1*th0Delta; |
---|
308 | th0PhiMax+=0.1*th0Delta; |
---|
309 | |
---|
310 | gDirectory->Delete("EusoHF_PhiCosTh*"); |
---|
311 | |
---|
312 | TH2F *th0 = new TH2F( "EusoHF_PhiCosTh0", "Cos(Theta) vs Phi", 100, |
---|
313 | th0CosThMin, th0CosThMax, 100, th0PhiMin, th0PhiMax); |
---|
314 | TH2F *th1 = new TH2F( "EusoHF_PhiCosTh1", "Cos(Theta) vs Phi", 100, |
---|
315 | th0CosThMin, th0CosThMax, 100, th0PhiMin, th0PhiMax); |
---|
316 | TH2F *th2 = new TH2F( "EusoHF_PhiCosTh2", "Cos(Theta) vs Phi", 100, |
---|
317 | th0CosThMin, th0CosThMax, 100, th0PhiMin, th0PhiMax); |
---|
318 | TH2F *th3 = new TH2F( "EusoHF_PhiCosTh3", "Cos(Theta) vs Phi", 100, |
---|
319 | th0CosThMin, th0CosThMax, 100, th0PhiMin, th0PhiMax); |
---|
320 | |
---|
321 | for ( Int_t i=0; i < pDet->GetNumPhotons(); i++){ |
---|
322 | EDetPhoton& ph = *(pDet->GetPhoton( i )); |
---|
323 | th0->Fill(TMath::Cos(ph.GetTheta()),ph.GetPhi()); |
---|
324 | if (ph.MadeSignal() && ph.CrossedIFS()) th1->Fill(TMath::Cos(ph.GetTheta()),ph.GetPhi()); |
---|
325 | if (ph.CrossedIFS()) th2->Fill(TMath::Cos(ph.GetTheta()),ph.GetPhi()); |
---|
326 | if (ph.MadeFastOR()) th3->Fill(TMath::Cos(ph.GetTheta()),ph.GetPhi()); |
---|
327 | } |
---|
328 | |
---|
329 | th0->SetStats(0); |
---|
330 | th1->SetStats(0); |
---|
331 | th2->SetStats(0); |
---|
332 | th3->SetStats(0); |
---|
333 | |
---|
334 | canvas->cd(1); |
---|
335 | th0->Draw("colz"); |
---|
336 | canvas->cd(3); |
---|
337 | th1->Draw("colz"); |
---|
338 | canvas->cd(2); |
---|
339 | th2->Draw("colz"); |
---|
340 | canvas->cd(4); |
---|
341 | th3->Draw("colz"); |
---|
342 | |
---|
343 | canvas->Update(); |
---|
344 | } |
---|
345 | |
---|
346 | //photons on XY plane |
---|
347 | void EusoHistoFactory::DoXYHisto(EEvent* ev, TCanvas *c){ |
---|
348 | |
---|
349 | cout << "DoXY called" << endl; |
---|
350 | |
---|
351 | EDetector* pDet; |
---|
352 | if ( !(pDet = ev->GetDetector()) ) { |
---|
353 | cout << "No EDetector in this event, exiting." << endl; |
---|
354 | return; |
---|
355 | } |
---|
356 | |
---|
357 | c->Clear(); |
---|
358 | c->Divide(2,2); |
---|
359 | |
---|
360 | |
---|
361 | //Get the number of photons |
---|
362 | Int_t numph=pDet->GetNumPhotons(); |
---|
363 | cout << "Total number of photons: " << numph << endl; |
---|
364 | |
---|
365 | gDirectory->Delete("EusoHF_XY*"); |
---|
366 | |
---|
367 | |
---|
368 | Float_t x[numph]; |
---|
369 | Float_t y[numph]; |
---|
370 | Float_t xsh[numph]; |
---|
371 | Float_t ysh[numph]; |
---|
372 | Float_t xshmax=0, xshmin=0, yshmax=0, yshmin=0; |
---|
373 | |
---|
374 | Int_t nlist[numph]; |
---|
375 | |
---|
376 | //read coordinates x,y for each photon |
---|
377 | for (Int_t i=0; i<numph; i++) { |
---|
378 | EDetPhoton& ph=*(pDet->GetPhoton(i)); |
---|
379 | x[i]=ph.GetPos()[0]; |
---|
380 | y[i]=ph.GetPos()[1]; |
---|
381 | } |
---|
382 | |
---|
383 | Int_t j=0; |
---|
384 | |
---|
385 | //roughly determinate which photons belong to the shower |
---|
386 | for (Int_t i=0; i<numph; i++){ |
---|
387 | Float_t deltax=TMath::Abs(x[i]-x[i+1]); |
---|
388 | |
---|
389 | if (deltax < 1.5) { |
---|
390 | Float_t deltay=TMath::Abs(y[i]-y[i+1]); |
---|
391 | |
---|
392 | if (deltay < 1.5) { |
---|
393 | xsh[j]=x[i]; |
---|
394 | ysh[j]=y[i]; |
---|
395 | xsh[j+1]=x[i+1]; |
---|
396 | ysh[j+1]=y[i+1]; |
---|
397 | j++; |
---|
398 | } |
---|
399 | } |
---|
400 | } |
---|
401 | |
---|
402 | j++; |
---|
403 | |
---|
404 | //calculate x,y of the shower minimum and maximum |
---|
405 | for (Int_t i=0; i<j; i++) { |
---|
406 | if (i==0) { |
---|
407 | xshmin=xsh[0]; |
---|
408 | xshmax=xsh[0]; |
---|
409 | yshmin=ysh[0]; |
---|
410 | yshmax=ysh[0]; |
---|
411 | } |
---|
412 | if (i>0) { |
---|
413 | if (xsh[i]<xshmin) {xshmin=xsh[i];} |
---|
414 | if (xsh[i]>xshmax) {xshmax=xsh[i];} |
---|
415 | if (ysh[i]<yshmin) {yshmin=ysh[i];} |
---|
416 | if (ysh[i]>yshmax) {yshmax=ysh[i];} |
---|
417 | } |
---|
418 | } |
---|
419 | |
---|
420 | Float_t deltashx = xshmax - xshmin; |
---|
421 | Float_t deltashy = yshmax - yshmin; |
---|
422 | xshmin -= deltashx / 10.0; |
---|
423 | xshmax += deltashx / 10.0; |
---|
424 | yshmin -= deltashy / 10.0; |
---|
425 | yshmax += deltashy / 10.0; |
---|
426 | |
---|
427 | cout << "Creating istograms..." << endl; |
---|
428 | cout << "X-Min: " << xshmin << endl; |
---|
429 | cout << "X-Max: " << xshmax << endl; |
---|
430 | cout << "Y-Min: " << yshmin << endl; |
---|
431 | cout << "Y-Max: " << yshmax << endl; |
---|
432 | |
---|
433 | //Select photons in the interval (xshmin,xshmax);(yshmin,yshmax) |
---|
434 | Int_t l=0; |
---|
435 | for (Int_t i=0; i<numph; i++) { |
---|
436 | if ((((x[i]>xshmin && x[i]<xshmax) && y[i]>yshmin) && y[i]<yshmax)) { |
---|
437 | nlist[l]=i; |
---|
438 | l++; |
---|
439 | } |
---|
440 | } |
---|
441 | l++; |
---|
442 | |
---|
443 | //Create istograms and fill them |
---|
444 | TH2F *th1=new TH2F("EusoHF_XY1","Hits on IFS",1000,xshmin,xshmax,1000,yshmin,yshmax); |
---|
445 | TH2F *th2=new TH2F("EusoHF_XY2","MadeSignal",1000,xshmin,xshmax,1000,yshmin,yshmax); |
---|
446 | TH2F *th3=new TH2F("EusoHF_XY3","MadeCount",1000,xshmin,xshmax,1000,yshmin,yshmax); |
---|
447 | TH2F *th4=new TH2F("EusoHF_XY4","MadeFastOR",1000,xshmin,xshmax,1000,yshmin,yshmax); |
---|
448 | |
---|
449 | for (Int_t i=0; i<l; i++) { |
---|
450 | Int_t k=nlist[i]; |
---|
451 | EDetPhoton& ph=*(pDet->GetPhoton(k)); |
---|
452 | if (ph.CrossedIFS()) th1->Fill(ph.GetPos()[0],ph.GetPos()[1]); |
---|
453 | if (ph.MadeSignal()) th2->Fill(ph.GetPos()[0],ph.GetPos()[1]); |
---|
454 | if (ph.MadeCount()) th3->Fill(ph.GetPos()[0],ph.GetPos()[1]); |
---|
455 | if (ph.MadeFastOR()) th4->Fill(ph.GetPos()[0],ph.GetPos()[1]); |
---|
456 | } |
---|
457 | |
---|
458 | gStyle->SetOptStat(10); |
---|
459 | |
---|
460 | th1->SetStats(kTRUE); |
---|
461 | th1->SetXTitle("x"); |
---|
462 | th1->SetYTitle("y"); |
---|
463 | th2->SetStats(kTRUE); |
---|
464 | th2->SetXTitle("x"); |
---|
465 | th2->SetYTitle("y"); |
---|
466 | th3->SetStats(kTRUE); |
---|
467 | th3->SetXTitle("x"); |
---|
468 | th3->SetYTitle("y"); |
---|
469 | th4->SetStats(kTRUE); |
---|
470 | th4->SetXTitle("x"); |
---|
471 | th4->SetYTitle("y"); |
---|
472 | |
---|
473 | |
---|
474 | c->cd(1); |
---|
475 | th1->Draw(); |
---|
476 | c->cd(2); |
---|
477 | th2->Draw(); |
---|
478 | c->cd(3); |
---|
479 | th3->Draw(); |
---|
480 | c->cd(4); |
---|
481 | th4->Draw(); |
---|
482 | |
---|
483 | c->Update(); |
---|
484 | |
---|
485 | cout << "DoXY ended" << endl; |
---|
486 | } |
---|
487 | |
---|
488 | //photons on the IFS in XY plane at various wavelenghts |
---|
489 | void EusoHistoFactory::DoWavelengthXYHisto(EEvent* ev, TCanvas *c){ |
---|
490 | |
---|
491 | cout << "DoWaveLength called" << endl; |
---|
492 | |
---|
493 | EDetector* pDet; |
---|
494 | if ( !(pDet = ev->GetDetector()) ) { |
---|
495 | cout << "No EDetector in this event, exiting." << endl; |
---|
496 | return; |
---|
497 | } |
---|
498 | |
---|
499 | c->Clear(); |
---|
500 | c->Divide(2,2); |
---|
501 | |
---|
502 | |
---|
503 | //Get the number of photons |
---|
504 | Int_t numph=pDet->GetNumPhotons(); |
---|
505 | cout << "Total number of photons: " << numph << endl; |
---|
506 | |
---|
507 | gDirectory->Delete("EusoHF_WLXY*"); |
---|
508 | |
---|
509 | |
---|
510 | Float_t x[numph]; |
---|
511 | Float_t y[numph]; |
---|
512 | Float_t xsh[numph]; |
---|
513 | Float_t ysh[numph]; |
---|
514 | Float_t xshmax=0, xshmin=0, yshmax=0, yshmin=0; |
---|
515 | |
---|
516 | Int_t nlist[numph]; |
---|
517 | |
---|
518 | //read coordinates x,y for each photon |
---|
519 | for (Int_t i=0; i<numph; i++) { |
---|
520 | EDetPhoton& ph=*(pDet->GetPhoton(i)); |
---|
521 | x[i]=ph.GetPos()[0]; |
---|
522 | y[i]=ph.GetPos()[1]; |
---|
523 | } |
---|
524 | |
---|
525 | Int_t j=0; |
---|
526 | |
---|
527 | //determinate which photons belong to the shower |
---|
528 | for (Int_t i=0; i<numph; i++){ |
---|
529 | Float_t deltax=TMath::Abs(x[i]-x[i+1]); |
---|
530 | |
---|
531 | if (deltax < 1.5) { |
---|
532 | Float_t deltay=TMath::Abs(y[i]-y[i+1]); |
---|
533 | |
---|
534 | if (deltay < 1.5) { |
---|
535 | xsh[j]=x[i]; |
---|
536 | ysh[j]=y[i]; |
---|
537 | xsh[j+1]=x[i+1]; |
---|
538 | ysh[j+1]=y[i+1]; |
---|
539 | j++; |
---|
540 | } |
---|
541 | } |
---|
542 | } |
---|
543 | |
---|
544 | j++; |
---|
545 | |
---|
546 | //calculate x,y of the shower minimum and maximum |
---|
547 | for (Int_t i=0; i<j; i++) { |
---|
548 | if (i==0) { |
---|
549 | xshmin=xsh[0]; |
---|
550 | xshmax=xsh[0]; |
---|
551 | yshmin=ysh[0]; |
---|
552 | yshmax=ysh[0]; |
---|
553 | } |
---|
554 | if (i>0) { |
---|
555 | if (xsh[i]<xshmin) {xshmin=xsh[i];} |
---|
556 | if (xsh[i]>xshmax) {xshmax=xsh[i];} |
---|
557 | if (ysh[i]<yshmin) {yshmin=ysh[i];} |
---|
558 | if (ysh[i]>yshmax) {yshmax=ysh[i];} |
---|
559 | } |
---|
560 | } |
---|
561 | |
---|
562 | Float_t deltashx = xshmax - xshmin; |
---|
563 | Float_t deltashy = yshmax - yshmin; |
---|
564 | xshmin -= deltashx / 10.0; |
---|
565 | xshmax += deltashx / 10.0; |
---|
566 | yshmin -= deltashy / 10.0; |
---|
567 | yshmax += deltashy / 10.0; |
---|
568 | |
---|
569 | cout << "Creating istograms..." << endl; |
---|
570 | cout << "X-Min: " << xshmin << endl; |
---|
571 | cout << "X-Max: " << xshmax << endl; |
---|
572 | cout << "Y-Min: " << yshmin << endl; |
---|
573 | cout << "Y-Max: " << yshmax << endl; |
---|
574 | |
---|
575 | //Select photons in the interval (xshmin,xshmax);(yshmin,yshmax) |
---|
576 | Int_t l=0; |
---|
577 | for (Int_t i=0; i<numph; i++) { |
---|
578 | if ((((x[i]>xshmin && x[i]<xshmax) && y[i]>yshmin) && y[i]<yshmax)) { |
---|
579 | nlist[l]=i; |
---|
580 | l++; |
---|
581 | } |
---|
582 | } |
---|
583 | l++; |
---|
584 | |
---|
585 | //Create istograms and fill them |
---|
586 | |
---|
587 | TH2F *th1=new TH2F("EusoHF_WLXY1","Hits on IFS, all wavelengths", 1000,xshmin,xshmax,1000,yshmin,yshmax); |
---|
588 | TH2F *th2=new TH2F("EusoHF_WLXY2","Hits on IFS, #lambda < 350 nm", 1000,xshmin,xshmax,1000,yshmin,yshmax); |
---|
589 | TH2F *th3=new TH2F("EusoHF_WLXY3","Hits on IFS, 350 nm #leq #lambda #leq 370 nm", 1000,xshmin,xshmax,1000,yshmin,yshmax); |
---|
590 | TH2F *th4=new TH2F("EusoHF_WLXY4","Hits on IFS, #lambda > 370 nm", 1000,xshmin,xshmax,1000,yshmin,yshmax); |
---|
591 | |
---|
592 | for (Int_t i=0; i<l; i++) { |
---|
593 | Int_t k=nlist[i]; |
---|
594 | EDetPhoton& ph=*(pDet->GetPhoton(k)); |
---|
595 | if (ph.CrossedIFS()) th1->Fill(ph.GetPos()[0],ph.GetPos()[1]); |
---|
596 | if (ph.CrossedIFS() && ph.GetLambda()<0.00035) th2->Fill(ph.GetPos()[0],ph.GetPos()[1]); |
---|
597 | if (ph.CrossedIFS() && ph.GetLambda()>=0.00035 && ph.GetLambda()<=0.00037) th3->Fill(ph.GetPos()[0],ph.GetPos()[1]); |
---|
598 | if (ph.CrossedIFS() && ph.GetLambda()>0.00037) th4->Fill(ph.GetPos()[0],ph.GetPos()[1]); |
---|
599 | } |
---|
600 | |
---|
601 | gStyle->SetOptStat(10); |
---|
602 | |
---|
603 | th1->SetStats(kTRUE); |
---|
604 | th1->SetXTitle("x"); |
---|
605 | th1->SetYTitle("y"); |
---|
606 | th2->SetStats(kTRUE); |
---|
607 | th2->SetXTitle("x"); |
---|
608 | th2->SetYTitle("y"); |
---|
609 | th3->SetStats(kTRUE); |
---|
610 | th3->SetXTitle("x"); |
---|
611 | th3->SetYTitle("y"); |
---|
612 | th4->SetStats(kTRUE); |
---|
613 | th4->SetXTitle("x"); |
---|
614 | th4->SetYTitle("y"); |
---|
615 | |
---|
616 | |
---|
617 | c->cd(1); |
---|
618 | th1->Draw(); |
---|
619 | c->cd(2); |
---|
620 | th2->Draw(); |
---|
621 | c->cd(3); |
---|
622 | th3->Draw(); |
---|
623 | c->cd(4); |
---|
624 | th4->Draw(); |
---|
625 | |
---|
626 | c->Update(); |
---|
627 | |
---|
628 | cout << "DoWaveLenght ended" << endl; |
---|
629 | } |
---|
630 | |
---|
631 | |
---|
632 | // global histograms |
---|
633 | void EusoHistoFactory::DoTriggerEffic1(TTree* tree, TCanvas* canvas) { |
---|
634 | canvas->cd(); |
---|
635 | } |
---|