1 | // ESAF : Euso Simulation and Analysis Framework |
---|
2 | // $Id: EDetectorHistoPainter.cc 3005 2012-01-06 08:06:11Z fenu $ |
---|
3 | // created May, 27 2004 |
---|
4 | |
---|
5 | #include "EDetectorHistoPainter.hh" |
---|
6 | #include "EEvent.hh" |
---|
7 | #include "EDetector.hh" |
---|
8 | #include "EDetPhoton.hh" |
---|
9 | #include "EElectronics.hh" |
---|
10 | #include "EFee.hh" |
---|
11 | #include "EAFee.hh" |
---|
12 | #include "EMacroCellHit.hh" |
---|
13 | |
---|
14 | #include "Etypes.hh" |
---|
15 | #include "ERunParameters.hh" |
---|
16 | |
---|
17 | #include "Riostream.h" |
---|
18 | #include "TCanvas.h" |
---|
19 | #include "TLegend.h" |
---|
20 | #include "TList.h" |
---|
21 | #include "TH1F.h" |
---|
22 | #include "TH2F.h" |
---|
23 | #include "THStack.h" |
---|
24 | #include "TStyle.h" |
---|
25 | #include "TVector3.h" |
---|
26 | #include "TPolyLine.h" |
---|
27 | #include <TMath.h> |
---|
28 | |
---|
29 | ClassImp(EDetectorHistoPainter) |
---|
30 | |
---|
31 | //_____________________________________________________________________________ |
---|
32 | EDetectorHistoPainter::EDetectorHistoPainter() { |
---|
33 | // |
---|
34 | // Constructor |
---|
35 | // |
---|
36 | |
---|
37 | fDetector = 0; |
---|
38 | fRunPars = 0; |
---|
39 | |
---|
40 | Build(); |
---|
41 | } |
---|
42 | |
---|
43 | //_____________________________________________________________________________ |
---|
44 | EDetectorHistoPainter::EDetectorHistoPainter( EEvent *ev ) { |
---|
45 | // |
---|
46 | // Constructor |
---|
47 | // |
---|
48 | |
---|
49 | fDetector = 0; |
---|
50 | fRunPars = 0; |
---|
51 | |
---|
52 | SetDetector(ev->GetDetector()); |
---|
53 | SetRunPars(ev->GetRunPars()); |
---|
54 | Build(); |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | //_____________________________________________________________________________ |
---|
59 | EDetectorHistoPainter::EDetectorHistoPainter( EDetector *det, ERunParameters* rp ) { |
---|
60 | // |
---|
61 | // Constructor |
---|
62 | // |
---|
63 | |
---|
64 | fDetector = 0; |
---|
65 | fRunPars = 0; |
---|
66 | |
---|
67 | SetDetector(det); |
---|
68 | SetRunPars(rp); |
---|
69 | Build(); |
---|
70 | } |
---|
71 | |
---|
72 | |
---|
73 | //_____________________________________________________________________________ |
---|
74 | EDetectorHistoPainter::~EDetectorHistoPainter() { |
---|
75 | // |
---|
76 | // Destuctor |
---|
77 | // |
---|
78 | |
---|
79 | fHistos->Delete(); |
---|
80 | } |
---|
81 | |
---|
82 | //_____________________________________________________________________________ |
---|
83 | void EDetectorHistoPainter::Build() { |
---|
84 | // |
---|
85 | // Build |
---|
86 | // |
---|
87 | |
---|
88 | if ( !fDetector || !fRunPars ) { |
---|
89 | Info("Build()","Either EDetector or EShower object are NULL. Painter made zombie."); |
---|
90 | MakeZombie(); |
---|
91 | return; |
---|
92 | } |
---|
93 | |
---|
94 | fHistos = new TList; |
---|
95 | |
---|
96 | gStyle->SetPalette(1); |
---|
97 | |
---|
98 | if ( fDetector ) { |
---|
99 | fGtuLength = fDetector->GetElectronics()->GetGtuLength(); |
---|
100 | fFirstGtu = TMath::Floor((fDetector->GetFirstTime() |
---|
101 | -fDetector->GetElectronics()->GetTimeGtu0() ) / fGtuLength); |
---|
102 | |
---|
103 | fLastGtu = TMath::Ceil((fDetector->GetLastTime() |
---|
104 | -fDetector->GetElectronics()->GetTimeGtu0() ) / fGtuLength); |
---|
105 | |
---|
106 | fNumGtus = (Int_t) (fLastGtu -fFirstGtu ); |
---|
107 | fGtuLength = fDetector->GetElectronics()->GetGtuLength(); |
---|
108 | } |
---|
109 | |
---|
110 | |
---|
111 | } |
---|
112 | //_____________________________________________________________________________ |
---|
113 | void EDetectorHistoPainter::Clear( Option_t *opt ) { |
---|
114 | TString option(opt); |
---|
115 | |
---|
116 | if (option.Contains("C")) |
---|
117 | fHistos->Delete(); |
---|
118 | else |
---|
119 | fHistos->Clear(); |
---|
120 | |
---|
121 | } |
---|
122 | |
---|
123 | //_____________________________________________________________________________ |
---|
124 | TH1F *EDetectorHistoPainter::GetGtuHisto(const char *name, const char *title){ |
---|
125 | TH1F* th = (TH1F*)fHistos->FindObject(name); |
---|
126 | |
---|
127 | if ( !title ) title = name; |
---|
128 | |
---|
129 | if (!th) { |
---|
130 | |
---|
131 | th = new TH1F( name, title, fNumGtus, fFirstGtu, fLastGtu); |
---|
132 | th->SetDirectory(0); |
---|
133 | fHistos->Add(th); |
---|
134 | } |
---|
135 | |
---|
136 | return th; |
---|
137 | } |
---|
138 | |
---|
139 | //_____________________________________________________________________________ |
---|
140 | void EDetectorHistoPainter::DoGtuPhotonsHisto(TVirtualPad *c) { |
---|
141 | // Time distribution of photons at various stage of Euso fDetector |
---|
142 | |
---|
143 | if ( !fDetector ) { |
---|
144 | cout << "No Event defined" << endl; |
---|
145 | return; |
---|
146 | } |
---|
147 | |
---|
148 | if ( !c && TPad::Pad() ) c = TPad::Pad()->GetCanvas(); |
---|
149 | if ( !c ) c = new TCanvas(); |
---|
150 | |
---|
151 | // c->Clear(); |
---|
152 | // c->cd(); |
---|
153 | |
---|
154 | TPad *pad1 = new TPad("Pad1","Pad1",0.01,0.51,0.49,0.99); |
---|
155 | TPad *pad2 = new TPad("Pad2","Pad2",0.51,0.51,0.99,0.99); |
---|
156 | TPad *pad3 = new TPad("Pad3","Pad3",0.01,0.01,0.49,0.49); |
---|
157 | TPad *pad4 = new TPad("Pad4","Pad4",0.51,0.01,0.99,0.49); |
---|
158 | |
---|
159 | pad1->Draw(); |
---|
160 | pad2->Draw(); |
---|
161 | pad3->Draw(); |
---|
162 | pad4->Draw(); |
---|
163 | |
---|
164 | // build histograms |
---|
165 | TH1F *th0 = GetGtuHisto("EusoHF_GtuPho0", "Photons vs GTU"); |
---|
166 | TH1F *th1 = GetGtuHisto("EusoHF_GtuPho1", "Photons(IFS) vs GTU"); |
---|
167 | TH1F *th2 = GetGtuHisto("EusoHF_GtuPho2", "Photons(Signal) vs GTU"); |
---|
168 | |
---|
169 | th0->Reset(); |
---|
170 | th1->Reset(); |
---|
171 | th2->Reset(); |
---|
172 | |
---|
173 | for( Int_t i=0; i < fDetector->GetNumPhotons(); i++ ) { |
---|
174 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
175 | Float_t time = ( ph.GetTime() - fDetector->GetElectronics()->GetTimeGtu0()) / fGtuLength; |
---|
176 | th0->Fill( time ); |
---|
177 | if ( ph.CrossedIFS() ) th1->Fill( time ); |
---|
178 | if ( ph.CrossedIFS() && ph.MadeSignal() ) th2->Fill( time ); |
---|
179 | } |
---|
180 | pad1->cd(); |
---|
181 | // draw histograms with colors and filling |
---|
182 | th0->SetStats(0); |
---|
183 | th0->SetXTitle("GTU number"); |
---|
184 | th0->SetYTitle("N_{ph}"); |
---|
185 | |
---|
186 | th0->SetFillColor(9); |
---|
187 | th1->SetFillColor(2); |
---|
188 | th2->SetFillColor(8); |
---|
189 | |
---|
190 | th0->Draw(); |
---|
191 | th1->Draw("same"); |
---|
192 | th2->Draw("same"); |
---|
193 | |
---|
194 | // write meaning and statistics |
---|
195 | Axis_t xMax = th0->GetXaxis()->GetXmax(); |
---|
196 | Axis_t yMax = th0->GetMaximum(); |
---|
197 | |
---|
198 | TLegend* leg; |
---|
199 | leg = new TLegend(0.12, 0.62, 0.39, 0.895); |
---|
200 | leg->SetHeader("Num. of Photons"); |
---|
201 | leg->AddEntry(th0,Form("On Pupil:%d",(int)th0->GetEntries()), "f"); |
---|
202 | leg->AddEntry(th1,Form("On FS:%d",(int)th1->GetEntries()), "f"); |
---|
203 | leg->AddEntry(th2,Form("Detected:%d",(int)th2->GetEntries()), "f"); |
---|
204 | leg->SetBorderSize(1); |
---|
205 | leg->SetName("legend"); |
---|
206 | leg->Draw(); |
---|
207 | |
---|
208 | // TText *t = new TText(); |
---|
209 | // t->SetTextFont(62); |
---|
210 | // t->SetTextAlign(31); |
---|
211 | // t->SetTextColor(9); |
---|
212 | // t->SetTextSize(0.04); |
---|
213 | // sprintf(txt,"Ph. on Pupil:%d",(int)th0->GetEntries()); |
---|
214 | // t->DrawText(0.92*xMax,0.94*yMax,txt); |
---|
215 | // t->SetTextColor(2); |
---|
216 | // sprintf(txt,"Ph. on FS:%d",(int)th1->GetEntries()); |
---|
217 | // t->DrawText(0.92*xMax,0.86*yMax,txt); |
---|
218 | // t->SetTextColor(8); |
---|
219 | // sprintf(txt,"Ph. detected:%d",(int)th2->GetEntries()); |
---|
220 | // t->DrawText(0.92*xMax,0.78*yMax,txt); |
---|
221 | |
---|
222 | c->Update(); |
---|
223 | |
---|
224 | // second pad |
---|
225 | pad2->cd(); |
---|
226 | TH1F *th3 = GetGtuHisto( "EusoHF_GtuPho3", "Photons vs GTU"); |
---|
227 | TH1F *th4 = GetGtuHisto( "EusoHF_GtuPho4", "Photons vs GTU"); |
---|
228 | TH1F *th5 = GetGtuHisto( "EusoHF_GtuPho5", "Photons vs GTU"); |
---|
229 | TH1F *th6 = GetGtuHisto( "EusoHF_GtuPho6", "Photons vs GTU"); |
---|
230 | |
---|
231 | th3->Reset(); |
---|
232 | th4->Reset(); |
---|
233 | th5->Reset(); |
---|
234 | th6->Reset(); |
---|
235 | |
---|
236 | for( Int_t i=0; i < fDetector->GetNumPhotons(); i++ ) { |
---|
237 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
238 | Float_t time = ( ph.GetTime() - fDetector->GetElectronics()->GetTimeGtu0()) / fGtuLength; |
---|
239 | if ( ph.CrossedIFS() ) { |
---|
240 | th3->Fill( time ); |
---|
241 | if ( ph.MadeSignal() ) th4->Fill( time ); |
---|
242 | if ( ph.MadeCount() ) th5->Fill( time ); |
---|
243 | if ( ph.MadeFastOR() ) th6->Fill( time ); |
---|
244 | } |
---|
245 | } |
---|
246 | |
---|
247 | th3->SetStats(0); |
---|
248 | th3->SetXTitle("GTU number"); |
---|
249 | th3->SetYTitle("Entries"); |
---|
250 | |
---|
251 | th3->Draw(); |
---|
252 | th4->Draw("same"); |
---|
253 | th5->Draw("same"); |
---|
254 | th6->Draw("same"); |
---|
255 | |
---|
256 | th3->SetFillColor(9); |
---|
257 | th4->SetFillColor(6); |
---|
258 | th5->SetFillColor(2); |
---|
259 | th6->SetFillColor(8); |
---|
260 | |
---|
261 | xMax = th3->GetXaxis()->GetXmax(); |
---|
262 | yMax = th3->GetMaximum(); |
---|
263 | |
---|
264 | leg = new TLegend(0.12, 0.62, 0.39, 0.895); |
---|
265 | leg->AddEntry(th3,Form("Photons on FS:%d",(int)th3->GetEntries()), "f"); |
---|
266 | leg->AddEntry(th4,Form("Pmt signals:%d",(int)th4->GetEntries()), "f"); |
---|
267 | leg->AddEntry(th5,Form("Frontend hits:%d",(int)th5->GetEntries()), "f"); |
---|
268 | leg->AddEntry(th6,Form("Fast OR counts:%d",(int)th6->GetEntries()), "f"); |
---|
269 | leg->SetBorderSize(1); |
---|
270 | leg->Draw(); |
---|
271 | // |
---|
272 | // |
---|
273 | // TText *t2 = new TText(); |
---|
274 | // t2->SetTextFont(62); |
---|
275 | // t2->SetTextAlign(31); |
---|
276 | // t2->SetTextColor(9); |
---|
277 | // t2->SetTextSize(0.04); |
---|
278 | // sprintf(txt,"Photons on FS:%d",(int)th3->GetEntries()); |
---|
279 | // t2->DrawText(0.92*xMax,0.94*yMax,txt); |
---|
280 | // t2->SetTextColor(6); |
---|
281 | // sprintf(txt,"Pmt signals:%d",(int)th4->GetEntries()); |
---|
282 | // t2->DrawText(0.92*xMax,0.86*yMax,txt); |
---|
283 | // t2->SetTextColor(2); |
---|
284 | // sprintf(txt,"Frontend hits:%d",(int)th5->GetEntries()); |
---|
285 | // t2->DrawText(0.92*xMax,0.78*yMax,txt); |
---|
286 | // t2->SetTextColor(8); |
---|
287 | // sprintf(txt,"Fast OR counts:%d",(int)th6->GetEntries()); |
---|
288 | // t2->DrawText(0.92*xMax,0.70*yMax,txt); |
---|
289 | |
---|
290 | c->Update(); |
---|
291 | |
---|
292 | // third pad: charge |
---|
293 | pad3->cd(); |
---|
294 | |
---|
295 | TH1F *th7 = GetGtuHisto("EusoHF_GtuPho7", "Charge vs GTU"); |
---|
296 | TH1F *th8 = GetGtuHisto("EusoHF_GtuPho9", "Photons vs GTU"); |
---|
297 | // TH1F *th9 = GetGtuHisto("EusoHF_GtuPho8", "Photons(IFS) vs GTU"); |
---|
298 | |
---|
299 | Float_t gain; |
---|
300 | gain = (fRunPars->GetPmtData()).GetGain(); |
---|
301 | for( Int_t i=0; i < fDetector->GetNumPhotons(); i++ ) { |
---|
302 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
303 | Float_t time = ( ph.GetTime() - fDetector->GetElectronics()->GetTimeGtu0() ) / fGtuLength; |
---|
304 | if ( ph.CrossedIFS() && ph.MadeCount() ) th8->Fill( time ); |
---|
305 | // if ( ph.CrossedIFS() && ph.MadeFastOR() ) th9->Fill( time ); |
---|
306 | } |
---|
307 | Float_t total_afee_charge=0.; |
---|
308 | for(Int_t i=0; i < fDetector->GetNumAFee(); i++ ) { |
---|
309 | EAFee *afee = fDetector->GetAFee( i ); |
---|
310 | Float_t gtu = (Float_t)afee->GetGtu(); |
---|
311 | Float_t charge = afee->GetDyCharge(); |
---|
312 | Int_t numpe = (Int_t)(charge/1.6e-19/gain); // convert into NOMINAL photoelectrons, gain 3.E5 |
---|
313 | if ( gtu > fFirstGtu && gtu < fLastGtu ) { |
---|
314 | Int_t gtubin = th7->FindBin( gtu ); |
---|
315 | Int_t old = (Int_t)(th7->GetBinContent( gtubin )); |
---|
316 | th7->SetBinContent( gtubin, old + numpe ); |
---|
317 | total_afee_charge += numpe; |
---|
318 | } |
---|
319 | } |
---|
320 | |
---|
321 | th7->SetEntries(total_afee_charge); |
---|
322 | |
---|
323 | th7->SetStats(0); |
---|
324 | th7->SetXTitle("GTU number"); |
---|
325 | th7->SetYTitle("N_{ph}"); |
---|
326 | |
---|
327 | th7->SetFillColor(6); |
---|
328 | th8->SetFillColor(9); |
---|
329 | // th9->SetFillColor(6); |
---|
330 | |
---|
331 | th7->Draw(); |
---|
332 | th8->Draw("same"); |
---|
333 | // th9->Draw("same"); |
---|
334 | |
---|
335 | |
---|
336 | xMax = th7->GetXaxis()->GetXmax(); |
---|
337 | yMax = th7->GetMaximum(); |
---|
338 | |
---|
339 | leg = new TLegend(0.11, 0.78, 0.38, 0.89); |
---|
340 | leg->AddEntry(th8,Form("Ph. detected:%d",(int)th8->GetEntries()), "f"); |
---|
341 | // leg->AddEntry(th9,Form("Ph. in DFEE:%d",(int)th9->GetEntries()), "f"); |
---|
342 | leg->AddEntry(th7,Form("Charge (in counts):%d",(int)th7->GetEntries()), "f"); |
---|
343 | // leg->AddEntry(th7,Form("Charge (in counts):%d",(int)total_afee_charge), "f"); |
---|
344 | leg->SetBorderSize(1); |
---|
345 | leg->Draw(); |
---|
346 | |
---|
347 | // TText *t3 = new TText(); |
---|
348 | // t3->SetTextFont(62); |
---|
349 | // t3->SetTextAlign(31); |
---|
350 | // t3->SetTextColor(9); |
---|
351 | // t3->SetTextSize(0.04); |
---|
352 | // sprintf(txt,"Ph. detected:%d",(Int_t)th8->GetEntries()); |
---|
353 | // t3->DrawText(0.92*xMax,0.94*yMax,txt); |
---|
354 | // t3->SetTextColor(6); |
---|
355 | // sprintf(txt,"Ph. in DFEE:%d",(Int_t)th9->GetEntries()); |
---|
356 | // t3->DrawText(0.92*xMax,0.86*yMax,txt); |
---|
357 | // t3->SetTextColor(8); |
---|
358 | // sprintf(txt,"Charge (pC,dynode):%.2f",total_afee_charge); |
---|
359 | // t3->DrawText(0.92*xMax,0.78*yMax,txt); |
---|
360 | |
---|
361 | |
---|
362 | // fourth pad |
---|
363 | pad4->cd(); |
---|
364 | TH1F *th10 = GetGtuHisto("EDFrontEndHits","FrontEnd Hits"); |
---|
365 | TH1F *th11 = GetGtuHisto("EDFrontEndSignals","FrontEnd Signal"); |
---|
366 | TH1F *th12 = GetGtuHisto("EDFrontEndAnalogHits","FrontEnd Signal"); |
---|
367 | |
---|
368 | for( Int_t i(0); i<fDetector->GetNumFee(); i++ ) { |
---|
369 | EFee* fe = fDetector->GetFee( i ); |
---|
370 | Int_t nSignals = fe->GetNumSignals(); |
---|
371 | Int_t nHits = fe->GetNumHits(); |
---|
372 | |
---|
373 | if ( nSignals > 0 ) |
---|
374 | while ( nHits-- > 0 ) |
---|
375 | th10->Fill((Float_t)fe->GetGtu()); |
---|
376 | |
---|
377 | while ( nSignals-- > 0 ) |
---|
378 | th11->Fill((Float_t)fe->GetGtu()); |
---|
379 | } |
---|
380 | |
---|
381 | for(Int_t i=0; i < fDetector->GetNumAFee(); i++ ) { |
---|
382 | EAFee *afee = fDetector->GetAFee( i ); |
---|
383 | Int_t nPe = (Int_t)(afee->GetDyCharge()/1.6e-19/gain); // convert into NOMINAL photoelectrons, gain 3.E5 |
---|
384 | |
---|
385 | while ( nPe-- > 0 ) |
---|
386 | th12->Fill((Float_t)afee->GetGtu()); |
---|
387 | } |
---|
388 | |
---|
389 | th10->SetStats(0); |
---|
390 | th10->SetXTitle("GTU number"); |
---|
391 | th10->SetYTitle("Hits"); |
---|
392 | |
---|
393 | th10->SetFillColor(216); |
---|
394 | th11->SetFillColor(220); |
---|
395 | th12->SetLineColor(kRed); |
---|
396 | |
---|
397 | th10->Draw(); |
---|
398 | th11->Draw("same"); |
---|
399 | th12->Draw("same"); |
---|
400 | |
---|
401 | xMax = th10->GetXaxis()->GetXmax(); |
---|
402 | yMax = th10->GetMaximum(); |
---|
403 | |
---|
404 | leg = new TLegend(0.12, 0.62, 0.39, 0.895); |
---|
405 | leg->AddEntry(th10,Form("DFee Hits:%d",(int)th10->GetEntries()), "f"); |
---|
406 | leg->AddEntry(th11,Form("DFee Signal:%d",(int)th11->GetEntries()), "f"); |
---|
407 | leg->AddEntry(th12,Form("AFee Hits:%d",(int)th12->GetEntries()), "f"); |
---|
408 | leg->SetBorderSize(1); |
---|
409 | leg->Draw(); |
---|
410 | |
---|
411 | // TText *t4 = new TText(); |
---|
412 | // t4->SetTextFont(62); |
---|
413 | // t4->SetTextAlign(31); |
---|
414 | // t4->SetTextColor(216); |
---|
415 | // t4->SetTextSize(0.04); |
---|
416 | // sprintf(txt,"DFee Hits:%d",(Int_t)th10->GetEntries()); |
---|
417 | // t4->DrawText(0.92*xMax,0.94*yMax,txt); |
---|
418 | // t4->SetTextColor(220); |
---|
419 | // sprintf(txt,"DFee Pure Signal Hits:%d",(Int_t)th11->GetEntries()); |
---|
420 | // t4->DrawText(0.92*xMax,0.86*yMax,txt); |
---|
421 | // t4->SetTextColor(kRed); |
---|
422 | // sprintf(txt,"AFee Hits:%d",(Int_t)th12->GetEntries()); |
---|
423 | // t4->DrawText(0.92*xMax,0.78*yMax,txt); |
---|
424 | // c->Update(); |
---|
425 | } |
---|
426 | |
---|
427 | //_____________________________________________________________________________ |
---|
428 | void EDetectorHistoPainter::DoGtuPhotonsHisto2(TVirtualPad *c) { |
---|
429 | // Time distribution of photons at various stage of Euso detector |
---|
430 | |
---|
431 | if ( !fDetector ) { |
---|
432 | cout << "No Event defined" << endl; |
---|
433 | return; |
---|
434 | } |
---|
435 | |
---|
436 | if ( !c && TPad::Pad() ) c = TPad::Pad()->GetCanvas(); |
---|
437 | if ( !c ) c = new TCanvas(); |
---|
438 | |
---|
439 | // c->Clear(); |
---|
440 | // c->cd(); |
---|
441 | |
---|
442 | TPad *pad1 = new TPad("Pad1","Pad1",0.01,0.51,0.49,0.99); |
---|
443 | TPad *pad2 = new TPad("Pad2","Pad2",0.51,0.51,0.99,0.99); |
---|
444 | TPad *pad3 = new TPad("Pad3","Pad3",0.01,0.01,0.49,0.49); |
---|
445 | TPad *pad4 = new TPad("Pad4","Pad4",0.51,0.01,0.99,0.49); |
---|
446 | |
---|
447 | pad1->Draw(); |
---|
448 | pad2->Draw(); |
---|
449 | pad3->Draw(); |
---|
450 | pad4->Draw(); |
---|
451 | |
---|
452 | pad1->cd(); |
---|
453 | |
---|
454 | // build histograms |
---|
455 | // |
---|
456 | //look for hs in fHistos list. |
---|
457 | |
---|
458 | THStack *hs1 = (THStack*)fHistos->FindObject("EStackGtuPho1"); |
---|
459 | if ( !hs1 ) { |
---|
460 | hs1 = new THStack("EStackGtuPho1","Photon's types"); |
---|
461 | // fHistos->Add( hs1 ); |
---|
462 | } |
---|
463 | |
---|
464 | TH1F *th0 = GetGtuHisto("EusoHF_GtuPho10", "#gamma vs GTU"); |
---|
465 | TH1F *th1 = GetGtuHisto("EusoHF_GtuPho11", "Fluorescence #gamma vs GTU"); |
---|
466 | TH1F *th2 = GetGtuHisto("EusoHF_GtuPho12", "Direct Cherenkov #gamma vs GTU"); |
---|
467 | TH1F *th3 = GetGtuHisto("EusoHF_GtuPho13", "BackScattered Cherenkov #gamma vs GTU"); |
---|
468 | |
---|
469 | th0->Reset(); |
---|
470 | th1->Reset(); |
---|
471 | th2->Reset(); |
---|
472 | th3->Reset(); |
---|
473 | |
---|
474 | for( Int_t i=0; i < fDetector->GetNumPhotons(); i++ ) { |
---|
475 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
476 | |
---|
477 | Float_t time = ( ph.GetTime() - fDetector->GetFirstTime() ) / fGtuLength; |
---|
478 | th0->Fill(time); |
---|
479 | if ( ph.GetType() == kFluorescence ) th1->Fill(time); |
---|
480 | if ( ph.GetType() == kDirectCherenkov ) th2->Fill(time); |
---|
481 | if ( ph.GetType() == kBackCherenkov ) th3->Fill(time); |
---|
482 | } |
---|
483 | |
---|
484 | th1->SetFillColor(kBlue); |
---|
485 | th2->SetFillColor(kRed); |
---|
486 | th3->SetFillColor(kGreen); |
---|
487 | |
---|
488 | //hs->Add(th0); |
---|
489 | hs1->Add(th1); |
---|
490 | hs1->Add(th2); |
---|
491 | hs1->Add(th3); |
---|
492 | // th0->Draw(); |
---|
493 | // th1->Draw("same"); |
---|
494 | // th2->Draw("same"); |
---|
495 | // th3->Draw("same"); |
---|
496 | hs1->Draw(); |
---|
497 | |
---|
498 | Float_t xMax, yMax; |
---|
499 | |
---|
500 | xMax = hs1->GetXaxis()->GetXmax(); |
---|
501 | yMax = hs1->GetMaximum(); |
---|
502 | |
---|
503 | TLegend* leg; |
---|
504 | leg = new TLegend(0.68, 0.78, 0.95, 0.95); |
---|
505 | leg->AddEntry(th1,Form("Fluo : %d",(int)th1->GetEntries()), "f"); |
---|
506 | leg->AddEntry(th2,Form("Dir. Cher. : %d",(int)th2->GetEntries()), "f"); |
---|
507 | leg->AddEntry(th3,Form("Bck. Cher. : %d",(int)th3->GetEntries()), "f"); |
---|
508 | leg->SetBorderSize(1); |
---|
509 | leg->Draw(); |
---|
510 | |
---|
511 | TString txt; |
---|
512 | // TText *t1 = new TText(); |
---|
513 | // t1->SetTextFont(62); |
---|
514 | // t1->SetTextAlign(31); |
---|
515 | // t1->SetTextSize(0.04); |
---|
516 | // |
---|
517 | // t1->SetTextColor(kBlue); |
---|
518 | // txt = Form("Fluorescence:%d",(Int_t)th1->GetEntries()); |
---|
519 | // t1->DrawText(0.92*xMax,0.94*yMax,txt); |
---|
520 | // |
---|
521 | // t1->SetTextColor(kRed); |
---|
522 | // txt = Form("Direct Cherenkov:%d",(Int_t)th2->GetEntries()); |
---|
523 | // t1->DrawText(0.92*xMax,0.86*yMax,txt); |
---|
524 | // |
---|
525 | // t1->SetTextColor(kGreen); |
---|
526 | // txt = Form("BackScattered Cherenkov:%d",(Int_t)th3->GetEntries()); |
---|
527 | // t1->DrawText(0.92*xMax,0.78*yMax,txt); |
---|
528 | |
---|
529 | // |
---|
530 | // ************************** |
---|
531 | // |
---|
532 | |
---|
533 | pad2->cd(); |
---|
534 | |
---|
535 | THStack *hs2 = (THStack*)fHistos->FindObject("EStackGtuPho2"); |
---|
536 | if ( !hs2 ) { |
---|
537 | hs2 = new THStack("EStackGtuPho2","Photons in the Detector"); |
---|
538 | // fHistos->Add( hs2 ); |
---|
539 | } |
---|
540 | TH1F *th4 = GetGtuHisto("EusoHF_GtuPho14", "#gamma in"); |
---|
541 | TH1F *th5 = GetGtuHisto("EusoHF_GtuPho15", "#gamma in"); |
---|
542 | TH1F *th6 = GetGtuHisto("EusoHF_GtuPho16", "#gamma in"); |
---|
543 | TH1F *th7 = GetGtuHisto("EusoHF_GtuPho17", "#gamma in"); |
---|
544 | TH1F *th8 = GetGtuHisto("EusoHF_GtuPho18", "#gamma in"); |
---|
545 | TH1F *th9 = GetGtuHisto("EusoHF_GtuPho19", "#gamma in"); |
---|
546 | |
---|
547 | th4->Reset(); |
---|
548 | th5->Reset(); |
---|
549 | th6->Reset(); |
---|
550 | th7->Reset(); |
---|
551 | th8->Reset(); |
---|
552 | th9->Reset(); |
---|
553 | |
---|
554 | for( Int_t i=0; i < fDetector->GetNumPhotons(); i++ ) { |
---|
555 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
556 | |
---|
557 | Float_t time = ( ph.GetTime() - fDetector->GetFirstTime() ) / fGtuLength; |
---|
558 | if ( ph.GetHistory() == kNotInside ) th4->Fill(time); |
---|
559 | if ( ph.GetHistory() == kBaffle ) th5->Fill(time); |
---|
560 | if ( ph.GetHistory() == kOptics ) th6->Fill(time); |
---|
561 | if ( ph.GetHistory() == kFocalPlane ) th7->Fill(time); |
---|
562 | if ( ph.GetHistory() == kWalls ) th8->Fill(time); |
---|
563 | if ( ph.GetHistory() == kEarth ) th9->Fill(time); |
---|
564 | } |
---|
565 | |
---|
566 | th4->SetFillColor(kBlue); |
---|
567 | th5->SetFillColor(kRed); |
---|
568 | th6->SetFillColor(kGreen); |
---|
569 | th7->SetFillColor(kCyan); |
---|
570 | th8->SetFillColor(kMagenta); |
---|
571 | th9->SetFillColor(kYellow); |
---|
572 | |
---|
573 | hs2->Add(th4); |
---|
574 | hs2->Add(th5); |
---|
575 | hs2->Add(th6); |
---|
576 | hs2->Add(th7); |
---|
577 | hs2->Add(th8); |
---|
578 | hs2->Add(th9); |
---|
579 | hs2->Draw(); |
---|
580 | |
---|
581 | xMax = hs2->GetXaxis()->GetXmax(); |
---|
582 | yMax = hs2->GetMaximum(); |
---|
583 | |
---|
584 | leg = new TLegend(0.68, 0.58, 0.95, 0.95); |
---|
585 | leg->AddEntry(th4,Form("Not Inside : %d",(int)th4->GetEntries()), "f"); |
---|
586 | leg->AddEntry(th5,Form("Baffle : %d",(int)th5->GetEntries()), "f"); |
---|
587 | leg->AddEntry(th6,Form("Optics : %d",(int)th6->GetEntries()), "f"); |
---|
588 | leg->AddEntry(th7,Form("FocalPlane : %d",(int)th7->GetEntries()), "f"); |
---|
589 | leg->AddEntry(th8,Form("Walls : %d",(int)th8->GetEntries()), "f"); |
---|
590 | leg->AddEntry(th9,Form("Reflected : %d",(int)th9->GetEntries()), "f"); |
---|
591 | leg->SetBorderSize(1); |
---|
592 | leg->Draw(); |
---|
593 | |
---|
594 | // TText *t2 = new TText(); |
---|
595 | // t2->SetTextFont(62); |
---|
596 | // t2->SetTextAlign(31); |
---|
597 | // t2->SetTextSize(0.04); |
---|
598 | // |
---|
599 | // t2->SetTextColor(kBlue); |
---|
600 | // txt = Form("Not Inside :%d",(Int_t)th4->GetEntries()); |
---|
601 | // t2->DrawText(0.92*xMax,0.94*yMax,txt); |
---|
602 | // |
---|
603 | // t2->SetTextColor(kRed); |
---|
604 | // txt = Form("Baffle:%d",(Int_t)th5->GetEntries()); |
---|
605 | // t2->DrawText(0.92*xMax,0.86*yMax,txt); |
---|
606 | // |
---|
607 | // t2->SetTextColor(kGreen); |
---|
608 | // txt = Form("Optics:%d",(Int_t)th6->GetEntries()); |
---|
609 | // t2->DrawText(0.92*xMax,0.78*yMax,txt); |
---|
610 | // |
---|
611 | // t2->SetTextColor(kCyan); |
---|
612 | // txt = Form("FocalPlane:%d",(Int_t)th6->GetEntries()); |
---|
613 | // t2->DrawText(0.92*xMax,0.70*yMax,txt); |
---|
614 | // |
---|
615 | // t2->SetTextColor(kMagenta); |
---|
616 | // txt = Form("Walls:%d",(Int_t)th6->GetEntries()); |
---|
617 | // t2->DrawText(0.92*xMax,0.62*yMax,txt); |
---|
618 | // |
---|
619 | // t2->SetTextColor(kYellow); |
---|
620 | // txt = Form("Reflected toward Earth:%d",(Int_t)th6->GetEntries()); |
---|
621 | // t2->DrawText(0.92*xMax,0.54*yMax,txt); |
---|
622 | |
---|
623 | // |
---|
624 | // ************************** |
---|
625 | // |
---|
626 | |
---|
627 | pad3->cd(); |
---|
628 | |
---|
629 | THStack *hs3 = (THStack*)fHistos->FindObject("EStackGtuPho3"); |
---|
630 | if ( !hs3 ) { |
---|
631 | hs3 = new THStack("EStackGtuPho2","Photons vs Wavelength"); |
---|
632 | // fHistos->Add( hs2 ); |
---|
633 | } |
---|
634 | TH1F *th10 = GetGtuHisto("EusoHF_GtuPho20", "#gamma in"); |
---|
635 | TH1F *th11 = GetGtuHisto("EusoHF_GtuPho21", "#gamma in"); |
---|
636 | TH1F *th12 = GetGtuHisto("EusoHF_GtuPho22", "#gamma in"); |
---|
637 | |
---|
638 | th10->Reset(); |
---|
639 | th11->Reset(); |
---|
640 | th12->Reset(); |
---|
641 | |
---|
642 | for( Int_t i=0; i < fDetector->GetNumPhotons(); i++ ) { |
---|
643 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
644 | |
---|
645 | Float_t time = ( ph.GetTime() - fDetector->GetFirstTime() ) / fGtuLength; |
---|
646 | if ( ph.GetLambda() < 340E-6 ) th10->Fill(time); |
---|
647 | else if ( ph.GetLambda() > 370E-6 ) th12->Fill(time); |
---|
648 | else th11->Fill(time); |
---|
649 | } |
---|
650 | |
---|
651 | th10->SetFillColor(223); |
---|
652 | th11->SetFillColor(211); |
---|
653 | th12->SetFillColor(94); |
---|
654 | |
---|
655 | hs3->Add(th10); |
---|
656 | hs3->Add(th11); |
---|
657 | hs3->Add(th12); |
---|
658 | hs3->Draw(); |
---|
659 | |
---|
660 | xMax = hs3->GetXaxis()->GetXmax(); |
---|
661 | yMax = hs3->GetMaximum(); |
---|
662 | |
---|
663 | leg = new TLegend(0.54, 0.78, 0.95, 0.95); |
---|
664 | leg->AddEntry(th10,Form("#lambda < 340 nm : %d",(int)th10->GetEntries()), "f"); |
---|
665 | leg->AddEntry(th11,Form("340 nm < #lambda < 370 nm : %d",(int)th11->GetEntries()), "f"); |
---|
666 | leg->AddEntry(th12,Form("#lambda > 370 nm : %d",(int)th12->GetEntries()), "f"); |
---|
667 | leg->SetBorderSize(1); |
---|
668 | leg->Draw(); |
---|
669 | // |
---|
670 | // TText *t3 = new TText(); |
---|
671 | // t3->SetTextFont(62); |
---|
672 | // t3->SetTextAlign(31); |
---|
673 | // t3->SetTextSize(0.04); |
---|
674 | // |
---|
675 | // t3->SetTextColor(223); |
---|
676 | // txt = Form("#lambda < 340 nm: %d",(Int_t)th6->GetEntries()); |
---|
677 | // t3->DrawText(0.92*xMax,0.94*yMax,txt); |
---|
678 | // |
---|
679 | // t3->SetTextColor(211); |
---|
680 | // txt = Form("340 nm < #lambda < 370 nm: %d",(Int_t)th6->GetEntries()); |
---|
681 | // t3->DrawText(0.92*xMax,0.86*yMax,txt); |
---|
682 | // |
---|
683 | // t3->SetTextColor(94); |
---|
684 | // txt = Form("#lambda > 370 nm: %d",(Int_t)th6->GetEntries()); |
---|
685 | // t3->DrawText(0.92*xMax,0.78*yMax,txt); |
---|
686 | // |
---|
687 | |
---|
688 | pad4->cd(); |
---|
689 | // Aggiungere lo spettro dei fotoni |
---|
690 | pad4->SetLogy(); |
---|
691 | |
---|
692 | |
---|
693 | Float_t lmin = kHuge; |
---|
694 | Float_t lmax = -kHuge; |
---|
695 | |
---|
696 | for( Int_t i=0; i < fDetector->GetNumPhotons(); i++ ) { |
---|
697 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
698 | |
---|
699 | if ( ph.GetLambda() > lmax ) lmax = ph.GetLambda(); |
---|
700 | if ( ph.GetLambda() < lmin ) lmin = ph.GetLambda(); |
---|
701 | } |
---|
702 | |
---|
703 | Bool_t status = TH1::AddDirectoryStatus(); |
---|
704 | TH1::AddDirectory(kFALSE); |
---|
705 | |
---|
706 | THStack *hs4 = (THStack*)fHistos->FindObject("EStackWlPho1"); |
---|
707 | if ( !hs4 ) { |
---|
708 | hs4 = new THStack("EStackWlPho1","Photons` spectrum"); |
---|
709 | } |
---|
710 | |
---|
711 | TH1F* th13 = (TH1F*)fHistos->FindObject("EusoHF_Wl1"); |
---|
712 | if (!th13) { |
---|
713 | th13 = new TH1F( "EusoHF_Wl1", "Photons' spectrum", 100, lmin, lmax); |
---|
714 | fHistos->Add(th13); |
---|
715 | } |
---|
716 | TH1F* th14 = (TH1F*)fHistos->FindObject("EusoHF_Wl2"); |
---|
717 | if (!th14) { |
---|
718 | th14 = new TH1F( "EusoHF_Wl2", "Photons' spectrum", 100, lmin, lmax); |
---|
719 | fHistos->Add(th14); |
---|
720 | } |
---|
721 | TH1F* th15 = (TH1F*)fHistos->FindObject("EusoHF_Wl3"); |
---|
722 | if (!th15) { |
---|
723 | th15 = new TH1F( "EusoHF_Wl3", "Photons' spectrum", 100, lmin, lmax); |
---|
724 | fHistos->Add(th15); |
---|
725 | } |
---|
726 | |
---|
727 | th13->Reset(); |
---|
728 | TH1::AddDirectory(status); |
---|
729 | |
---|
730 | for( Int_t i=0; i < fDetector->GetNumPhotons(); i++ ) { |
---|
731 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
732 | if ( ph.GetType() == kFluorescence ) th13->Fill( ph.GetLambda() ); |
---|
733 | if ( ph.GetType() == kDirectCherenkov ) th14->Fill( ph.GetLambda() ); |
---|
734 | if ( ph.GetType() == kBackCherenkov ) th15->Fill( ph.GetLambda() ); |
---|
735 | } |
---|
736 | |
---|
737 | th13->SetFillColor(kBlue); |
---|
738 | th14->SetFillColor(kRed); |
---|
739 | th15->SetFillColor(kGreen); |
---|
740 | |
---|
741 | hs4->Add(th14); |
---|
742 | hs4->Add(th15); |
---|
743 | hs4->Add(th13); |
---|
744 | |
---|
745 | hs4->Draw(); |
---|
746 | xMax = hs4->GetXaxis()->GetXmax(); |
---|
747 | yMax = hs4->GetMaximum(); |
---|
748 | |
---|
749 | leg = new TLegend(0.68, 0.78, 0.95, 0.95); |
---|
750 | leg->AddEntry(th13,Form("Fluo. : %d",(int)th13->GetEntries()), "f"); |
---|
751 | leg->AddEntry(th14,Form("Dir. Cher. : %d",(int)th14->GetEntries()), "f"); |
---|
752 | leg->AddEntry(th15,Form("Bak. Cher. : %d",(int)th15->GetEntries()), "f"); |
---|
753 | leg->SetBorderSize(1); |
---|
754 | leg->Draw(); |
---|
755 | |
---|
756 | // TText *t4 = new TText(); |
---|
757 | // t4->SetTextFont(62); |
---|
758 | // t4->SetTextAlign(31); |
---|
759 | // t4->SetTextSize(0.04); |
---|
760 | // |
---|
761 | // t4->SetTextColor(kBlue); |
---|
762 | // if (!pad4->GetLogy()) { |
---|
763 | // txt = Form("Fluorescence:%d",(Int_t)th13->GetEntries()); |
---|
764 | // t4->DrawText(0.92*xMax,0.94*yMax,txt); |
---|
765 | // |
---|
766 | // t4->SetTextColor(kRed); |
---|
767 | // txt = Form("Direct Cherenkov:%d",(Int_t)th14->GetEntries()); |
---|
768 | // t4->DrawText(0.92*xMax,0.86*yMax,txt); |
---|
769 | // |
---|
770 | // t4->SetTextColor(kGreen); |
---|
771 | // txt = Form("BackScattered Cherenkov:%d",(Int_t)th15->GetEntries()); |
---|
772 | // t4->DrawText(0.92*xMax,0.78*yMax,txt); |
---|
773 | // } |
---|
774 | // else { |
---|
775 | // // redefine a bit the layout |
---|
776 | // hs4->SetMaximum(yMax*5); |
---|
777 | // hs4->SetMinimum(yMax*1.e-4); |
---|
778 | // txt = Form("Fluorescence:%d",(Int_t)th13->GetEntries()); |
---|
779 | // t4->DrawText(0.92*xMax,5*yMax,txt); |
---|
780 | // |
---|
781 | // t4->SetTextColor(kRed); |
---|
782 | // txt = Form("Direct Cherenkov:%d",(Int_t)th14->GetEntries()); |
---|
783 | // t4->DrawText(0.92*xMax,2.5*yMax,txt); |
---|
784 | // |
---|
785 | // t4->SetTextColor(kGreen); |
---|
786 | // txt = Form("BackScattered Cherenkov:%d",(Int_t)th15->GetEntries()); |
---|
787 | // t4->DrawText(0.92*xMax,1*yMax,txt); |
---|
788 | // } |
---|
789 | |
---|
790 | } |
---|
791 | |
---|
792 | //______________________________________________________________________________ |
---|
793 | void EDetectorHistoPainter::DoPhiCosThetaHisto(TVirtualPad *c){ |
---|
794 | // photons on focal surface |
---|
795 | |
---|
796 | if ( !fDetector ) { |
---|
797 | cout << "No Event defined" << endl; |
---|
798 | return; |
---|
799 | } |
---|
800 | |
---|
801 | if ( !c && TPad::Pad() ) c = TPad::Pad()->GetCanvas(); |
---|
802 | if ( !c ) c = new TCanvas(); |
---|
803 | |
---|
804 | c->Clear(); |
---|
805 | c->Divide(2,2); |
---|
806 | |
---|
807 | Float_t th0CosThMin(10),th0CosThMax(-10); |
---|
808 | Float_t th0PhiMin(10),th0PhiMax(-10); |
---|
809 | |
---|
810 | for ( Int_t i=0; i < fDetector->GetNumPhotons(); i++){ |
---|
811 | EDetPhoton& ph=*(fDetector->GetPhoton(i)); |
---|
812 | if (TMath::Cos(ph.GetTheta()) > th0CosThMax) |
---|
813 | th0CosThMax = TMath::Cos(ph.GetTheta()); |
---|
814 | |
---|
815 | if (ph.GetPhi() > th0PhiMax) |
---|
816 | th0PhiMax = ph.GetPhi(); |
---|
817 | |
---|
818 | if (TMath::Cos(ph.GetTheta()) < th0CosThMin) |
---|
819 | th0CosThMin = TMath::Cos(ph.GetTheta()); |
---|
820 | |
---|
821 | if (ph.GetPhi() < th0PhiMin) |
---|
822 | th0PhiMin = ph.GetPhi(); |
---|
823 | |
---|
824 | } |
---|
825 | Float_t th0Delta = th0CosThMax-th0CosThMin; |
---|
826 | th0CosThMin-=0.1*th0Delta; |
---|
827 | th0CosThMax+=0.1*th0Delta; |
---|
828 | |
---|
829 | th0Delta = th0PhiMax-th0PhiMin; |
---|
830 | th0PhiMin-=0.1*th0Delta; |
---|
831 | th0PhiMax+=0.1*th0Delta; |
---|
832 | |
---|
833 | gDirectory->Delete("EusoHF_PhiCosTh*"); |
---|
834 | |
---|
835 | Bool_t status = TH1::AddDirectoryStatus(); |
---|
836 | TH1::AddDirectory(kFALSE); |
---|
837 | TH2F *th0 = new TH2F( "EusoHF_PhiCosTh0", "Cos(Theta) vs Phi (CrossedIFS)", 100, |
---|
838 | th0CosThMin, th0CosThMax, 100, th0PhiMin, th0PhiMax); |
---|
839 | TH2F *th1 = new TH2F( "EusoHF_PhiCosTh1", "Cos(Theta) vs Phi (MadeSignal)", 100, |
---|
840 | th0CosThMin, th0CosThMax, 100, th0PhiMin, th0PhiMax); |
---|
841 | TH2F *th2 = new TH2F( "EusoHF_PhiCosTh2", "Cos(Theta) vs Phi (MadeCount)", 100, |
---|
842 | th0CosThMin, th0CosThMax, 100, th0PhiMin, th0PhiMax); |
---|
843 | TH2F *th3 = new TH2F( "EusoHF_PhiCosTh3", "Cos(Theta) vs Phi (MadeFastOR)", 100, |
---|
844 | th0CosThMin, th0CosThMax, 100, th0PhiMin, th0PhiMax); |
---|
845 | TH1::AddDirectory(status); |
---|
846 | |
---|
847 | for ( Int_t i=0; i < fDetector->GetNumPhotons(); i++){ |
---|
848 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
849 | if ( ph.CrossedIFS() ) th0->Fill(TMath::Cos(ph.GetTheta()),ph.GetPhi()); |
---|
850 | if ( ph.MadeSignal() ) th1->Fill(TMath::Cos(ph.GetTheta()),ph.GetPhi()); |
---|
851 | if ( ph.MadeCount() ) th2->Fill(TMath::Cos(ph.GetTheta()),ph.GetPhi()); |
---|
852 | if ( ph.MadeFastOR() ) th3->Fill(TMath::Cos(ph.GetTheta()),ph.GetPhi()); |
---|
853 | } |
---|
854 | |
---|
855 | th0->SetStats(0); |
---|
856 | th1->SetStats(0); |
---|
857 | th2->SetStats(0); |
---|
858 | th3->SetStats(0); |
---|
859 | |
---|
860 | c->cd(1); |
---|
861 | th0->Draw("colz"); |
---|
862 | c->cd(3); |
---|
863 | th1->Draw("colz"); |
---|
864 | c->cd(2); |
---|
865 | th2->Draw("colz"); |
---|
866 | c->cd(4); |
---|
867 | th3->Draw("colz"); |
---|
868 | |
---|
869 | c->Update(); |
---|
870 | } |
---|
871 | //_____________________________________________________________________________ |
---|
872 | void EDetectorHistoPainter::DoPhotonsHistoCheckOptics(TVirtualPad* c) { |
---|
873 | // photons on focal surface |
---|
874 | |
---|
875 | if ( !fDetector ) { |
---|
876 | cout << "No Event defined" << endl; |
---|
877 | return; |
---|
878 | } |
---|
879 | |
---|
880 | if ( !c && TPad::Pad() ) c = TPad::Pad()->GetCanvas(); |
---|
881 | if ( !c ) c = new TCanvas(); |
---|
882 | |
---|
883 | c->Clear(); |
---|
884 | c->Divide(2,2); |
---|
885 | |
---|
886 | Float_t th0CosThMin(10),th0CosThMax(-10); |
---|
887 | |
---|
888 | for ( Int_t i=0; i < fDetector->GetNumPhotons(); i++){ |
---|
889 | EDetPhoton& ph=*(fDetector->GetPhoton(i)); |
---|
890 | if (TMath::Cos(ph.GetTheta()) > th0CosThMax) |
---|
891 | th0CosThMax = TMath::Cos(ph.GetTheta()); |
---|
892 | |
---|
893 | if (TMath::Cos(ph.GetTheta()) < th0CosThMin) |
---|
894 | th0CosThMin = TMath::Cos(ph.GetTheta()); |
---|
895 | } |
---|
896 | Float_t th0Delta = th0CosThMax-th0CosThMin; |
---|
897 | th0CosThMin-=0.1*th0Delta; |
---|
898 | th0CosThMax+=0.1*th0Delta; |
---|
899 | |
---|
900 | gDirectory->Delete("EusoHF_OpticsCosTh*"); |
---|
901 | |
---|
902 | Bool_t status = TH1::AddDirectoryStatus(); |
---|
903 | TH1::AddDirectory(kFALSE); |
---|
904 | TH1F *th0 = new TH1F( "EusoHF_OpticsCosTh0", "Cos(Theta) (At pupil)", 100,th0CosThMin, th0CosThMax); |
---|
905 | TH1F *th1 = new TH1F( "EusoHF_OpticsCosTh1", "Cos(Theta) (CrossedIFS)", 100,th0CosThMin, th0CosThMax); |
---|
906 | TH1F *th2 = new TH1F( "EusoHF_OpticsCosTh2", "Cos(Theta) (Ratio CrossedIFS/At pupil)", 100,th0CosThMin, th0CosThMax); |
---|
907 | TH1::AddDirectory(status); |
---|
908 | |
---|
909 | for ( Int_t i=0; i < fDetector->GetNumPhotons(); i++){ |
---|
910 | EDetPhoton& ph = *(fDetector->GetPhoton( i )); |
---|
911 | th0->Fill(TMath::Cos(ph.GetTheta())); |
---|
912 | if ( ph.CrossedIFS() ) th1->Fill(TMath::Cos(ph.GetTheta())); |
---|
913 | } |
---|
914 | th2 = (TH1F*)th1->Clone(); |
---|
915 | th2->SetTitle("Cos(Theta) (Ratio CrossedIFS/At pupil)"); |
---|
916 | th2->Divide(th0); |
---|
917 | th0->SetStats(0); |
---|
918 | th1->SetStats(0); |
---|
919 | th2->SetStats(0); |
---|
920 | // th3->SetStats(0); |
---|
921 | |
---|
922 | c->cd(1); |
---|
923 | th0->Draw(); th0->SetLineColor(kBlue); th0->SetXTitle("cos #theta"); |
---|
924 | th1->Draw("same"); th1->SetLineColor(kRed); |
---|
925 | c->cd(2); |
---|
926 | th2->Draw(); th2->SetLineColor(kBlue); th2->SetXTitle("cos #heta"); |
---|
927 | c->Update(); |
---|
928 | } |
---|
929 | |
---|
930 | //_____________________________________________________________________________ |
---|
931 | void EDetectorHistoPainter::DoXYHisto(TVirtualPad *c){ |
---|
932 | //photons on XY plane |
---|
933 | |
---|
934 | if ( !fDetector ) { |
---|
935 | cout << "No Event defined" << endl; |
---|
936 | return; |
---|
937 | } |
---|
938 | |
---|
939 | if ( !c && TPad::Pad() ) c = TPad::Pad()->GetCanvas(); |
---|
940 | if ( !c ) c = new TCanvas(); |
---|
941 | |
---|
942 | c->Clear(); |
---|
943 | c->Divide(2,2); |
---|
944 | |
---|
945 | |
---|
946 | //Get the number of photons |
---|
947 | Int_t numph=fDetector->GetNumPhotons(); |
---|
948 | cout << "Total number of photons: " << numph << endl; |
---|
949 | |
---|
950 | gDirectory->Delete("EusoHF_XY*"); |
---|
951 | |
---|
952 | |
---|
953 | Float_t *x = new Float_t[numph]; |
---|
954 | Float_t *y = new Float_t[numph]; |
---|
955 | Float_t *xsh = new Float_t[numph]; |
---|
956 | Float_t *ysh = new Float_t[numph]; |
---|
957 | Float_t xshmax=0, xshmin=0, yshmax=0, yshmin=0; |
---|
958 | |
---|
959 | Int_t *nlist = new Int_t[numph]; |
---|
960 | |
---|
961 | //read coordinates x,y for each photon |
---|
962 | for (Int_t i=0; i<numph; i++) { |
---|
963 | const TVector3& pos = fDetector->GetPhoton(i)->GetPos(); |
---|
964 | x[i]=pos[0]; |
---|
965 | y[i]=pos[1]; |
---|
966 | } |
---|
967 | |
---|
968 | Int_t j=0; |
---|
969 | |
---|
970 | //roughly determinate which photons belong to the shower |
---|
971 | for (Int_t i=0; i<numph; i++){ |
---|
972 | Float_t deltax=TMath::Abs(x[i]-x[i+1]); |
---|
973 | |
---|
974 | if (deltax < 1.5) { |
---|
975 | Float_t deltay=TMath::Abs(y[i]-y[i+1]); |
---|
976 | |
---|
977 | if (deltay < 1.5) { |
---|
978 | xsh[j]=x[i]; |
---|
979 | ysh[j]=y[i]; |
---|
980 | xsh[j+1]=x[i+1]; |
---|
981 | ysh[j+1]=y[i+1]; |
---|
982 | j++; |
---|
983 | } |
---|
984 | } |
---|
985 | } |
---|
986 | |
---|
987 | j++; |
---|
988 | |
---|
989 | //calculate x,y of the shower minimum and maximum |
---|
990 | for (Int_t i=0; i<j; i++) { |
---|
991 | if (i==0) { |
---|
992 | xshmin=xsh[0]; |
---|
993 | xshmax=xsh[0]; |
---|
994 | yshmin=ysh[0]; |
---|
995 | yshmax=ysh[0]; |
---|
996 | } |
---|
997 | if (i>0) { |
---|
998 | if (xsh[i]<xshmin) {xshmin=xsh[i];} |
---|
999 | if (xsh[i]>xshmax) {xshmax=xsh[i];} |
---|
1000 | if (ysh[i]<yshmin) {yshmin=ysh[i];} |
---|
1001 | if (ysh[i]>yshmax) {yshmax=ysh[i];} |
---|
1002 | } |
---|
1003 | } |
---|
1004 | |
---|
1005 | Float_t deltashx = xshmax - xshmin; |
---|
1006 | Float_t deltashy = yshmax - yshmin; |
---|
1007 | xshmin -= deltashx / 10.0; |
---|
1008 | xshmax += deltashx / 10.0; |
---|
1009 | yshmin -= deltashy / 10.0; |
---|
1010 | yshmax += deltashy / 10.0; |
---|
1011 | |
---|
1012 | cout << "Creating istograms..." << endl; |
---|
1013 | cout << "X-Min: " << xshmin << endl; |
---|
1014 | cout << "X-Max: " << xshmax << endl; |
---|
1015 | cout << "Y-Min: " << yshmin << endl; |
---|
1016 | cout << "Y-Max: " << yshmax << endl; |
---|
1017 | |
---|
1018 | //Select photons in the interval (xshmin,xshmax);(yshmin,yshmax) |
---|
1019 | Int_t l=0; |
---|
1020 | for (Int_t i=0; i<numph; i++) { |
---|
1021 | if ((((x[i]>xshmin && x[i]<xshmax) && y[i]>yshmin) && y[i]<yshmax)) { |
---|
1022 | nlist[l]=i; |
---|
1023 | l++; |
---|
1024 | } |
---|
1025 | } |
---|
1026 | l++; |
---|
1027 | |
---|
1028 | //Create istograms and fill them |
---|
1029 | |
---|
1030 | Bool_t status = TH1::AddDirectoryStatus(); |
---|
1031 | TH1::AddDirectory(kFALSE); |
---|
1032 | |
---|
1033 | TH2F *th1=new TH2F("EusoHF_XY1","Hits on Focal Surface",100,xshmin,xshmax,100,yshmin,yshmax); |
---|
1034 | TH2F *th2=new TH2F("EusoHF_XY2","MadeSignal",100,xshmin,xshmax,100,yshmin,yshmax); |
---|
1035 | TH2F *th3=new TH2F("EusoHF_XY3","MadeCount",100,xshmin,xshmax,100,yshmin,yshmax); |
---|
1036 | TH2F *th4=new TH2F("EusoHF_XY4","MadeFastOR",100,xshmin,xshmax,100,yshmin,yshmax); |
---|
1037 | |
---|
1038 | TH1::AddDirectory(status); |
---|
1039 | |
---|
1040 | for (Int_t i=0; i<l; i++) { |
---|
1041 | Int_t k=nlist[i]; |
---|
1042 | EDetPhoton* ph=fDetector->GetPhoton(k); |
---|
1043 | const TVector3& pos=(fDetector->GetPhoton(k)->GetPos()); |
---|
1044 | |
---|
1045 | if (ph->CrossedIFS()) th1->Fill(pos[0],pos[1]); |
---|
1046 | if (ph->MadeSignal()) th2->Fill(pos[0],pos[1]); |
---|
1047 | if (ph->MadeCount()) th3->Fill(pos[0],pos[1]); |
---|
1048 | if (ph->MadeFastOR()) th4->Fill(pos[0],pos[1]); |
---|
1049 | } |
---|
1050 | |
---|
1051 | gStyle->SetOptStat(10); |
---|
1052 | |
---|
1053 | th1->SetStats(kTRUE); |
---|
1054 | th1->SetXTitle("x"); |
---|
1055 | th1->SetYTitle("y"); |
---|
1056 | th2->SetStats(kTRUE); |
---|
1057 | th2->SetXTitle("x"); |
---|
1058 | th2->SetYTitle("y"); |
---|
1059 | th3->SetStats(kTRUE); |
---|
1060 | th3->SetXTitle("x"); |
---|
1061 | th3->SetYTitle("y"); |
---|
1062 | th4->SetStats(kTRUE); |
---|
1063 | th4->SetXTitle("x"); |
---|
1064 | th4->SetYTitle("y"); |
---|
1065 | |
---|
1066 | c->cd(1); |
---|
1067 | th1->Draw("colz"); |
---|
1068 | c->cd(2); |
---|
1069 | th2->Draw("colz"); |
---|
1070 | c->cd(3); |
---|
1071 | th3->Draw("colz"); |
---|
1072 | c->cd(4); |
---|
1073 | th4->Draw("colz"); |
---|
1074 | |
---|
1075 | c->Update(); |
---|
1076 | |
---|
1077 | if ( x ) delete x; |
---|
1078 | if ( y ) delete y; |
---|
1079 | if ( xsh ) delete xsh; |
---|
1080 | if ( ysh ) delete ysh; |
---|
1081 | if ( nlist ) delete nlist; |
---|
1082 | |
---|
1083 | } |
---|
1084 | |
---|
1085 | //______________________________________________________________________________ |
---|
1086 | void EDetectorHistoPainter::DoWavelengthXYHisto(TVirtualPad *c){ |
---|
1087 | // |
---|
1088 | // photons on the IFS in XY plane at various wavelenghts |
---|
1089 | // |
---|
1090 | |
---|
1091 | if ( !fDetector ) { |
---|
1092 | cout << "No Event defined" << endl; |
---|
1093 | return; |
---|
1094 | } |
---|
1095 | |
---|
1096 | if ( !c && TPad::Pad() ) c = TPad::Pad()->GetCanvas(); |
---|
1097 | if ( !c ) c = new TCanvas(); |
---|
1098 | |
---|
1099 | c->Clear(); |
---|
1100 | c->Divide(2,2); |
---|
1101 | |
---|
1102 | |
---|
1103 | //Get the number of photons |
---|
1104 | Int_t numph=fDetector->GetNumPhotons(); |
---|
1105 | cout << "Total number of photons: " << numph << endl; |
---|
1106 | |
---|
1107 | gDirectory->Delete("EusoHF_WLXY*"); |
---|
1108 | |
---|
1109 | |
---|
1110 | Float_t *x = new Float_t[numph]; |
---|
1111 | Float_t *y = new Float_t[numph]; |
---|
1112 | Float_t *xsh = new Float_t[numph]; |
---|
1113 | Float_t *ysh = new Float_t[numph]; |
---|
1114 | Float_t xshmax=0, xshmin=0, yshmax=0, yshmin=0; |
---|
1115 | |
---|
1116 | Int_t *nlist = new Int_t[numph]; |
---|
1117 | |
---|
1118 | //read coordinates x,y for each photon |
---|
1119 | for (Int_t i=0; i<numph; i++) { |
---|
1120 | const TVector3 &pos=(fDetector->GetPhoton(i)->GetPos()); |
---|
1121 | x[i]=pos[0]; |
---|
1122 | y[i]=pos[1]; |
---|
1123 | } |
---|
1124 | |
---|
1125 | Int_t j=0; |
---|
1126 | |
---|
1127 | //determinate which photons belong to the shower |
---|
1128 | for (Int_t i=0; i<numph; i++){ |
---|
1129 | Float_t deltax=TMath::Abs(x[i]-x[i+1]); |
---|
1130 | |
---|
1131 | if (deltax < 1.5) { |
---|
1132 | Float_t deltay=TMath::Abs(y[i]-y[i+1]); |
---|
1133 | |
---|
1134 | if (deltay < 1.5) { |
---|
1135 | xsh[j]=x[i]; |
---|
1136 | ysh[j]=y[i]; |
---|
1137 | xsh[j+1]=x[i+1]; |
---|
1138 | ysh[j+1]=y[i+1]; |
---|
1139 | j++; |
---|
1140 | } |
---|
1141 | } |
---|
1142 | } |
---|
1143 | |
---|
1144 | j++; |
---|
1145 | |
---|
1146 | //calculate x,y of the shower minimum and maximum |
---|
1147 | for (Int_t i=0; i<j; i++) { |
---|
1148 | if (i==0) { |
---|
1149 | xshmin=xsh[0]; |
---|
1150 | xshmax=xsh[0]; |
---|
1151 | yshmin=ysh[0]; |
---|
1152 | yshmax=ysh[0]; |
---|
1153 | } |
---|
1154 | if (i>0) { |
---|
1155 | if (xsh[i]<xshmin) {xshmin=xsh[i];} |
---|
1156 | if (xsh[i]>xshmax) {xshmax=xsh[i];} |
---|
1157 | if (ysh[i]<yshmin) {yshmin=ysh[i];} |
---|
1158 | if (ysh[i]>yshmax) {yshmax=ysh[i];} |
---|
1159 | } |
---|
1160 | } |
---|
1161 | |
---|
1162 | Float_t deltashx = xshmax - xshmin; |
---|
1163 | Float_t deltashy = yshmax - yshmin; |
---|
1164 | xshmin -= deltashx / 10.0; |
---|
1165 | xshmax += deltashx / 10.0; |
---|
1166 | yshmin -= deltashy / 10.0; |
---|
1167 | yshmax += deltashy / 10.0; |
---|
1168 | |
---|
1169 | cout << "Creating histograms..." << endl; |
---|
1170 | cout << "X-Min: " << xshmin << endl; |
---|
1171 | cout << "X-Max: " << xshmax << endl; |
---|
1172 | cout << "Y-Min: " << yshmin << endl; |
---|
1173 | cout << "Y-Max: " << yshmax << endl; |
---|
1174 | |
---|
1175 | //Select photons in the interval (xshmin,xshmax);(yshmin,yshmax) |
---|
1176 | Int_t l=0; |
---|
1177 | for (Int_t i=0; i<numph; i++) { |
---|
1178 | if ((((x[i]>xshmin && x[i]<xshmax) && y[i]>yshmin) && y[i]<yshmax)) { |
---|
1179 | nlist[l]=i; |
---|
1180 | l++; |
---|
1181 | } |
---|
1182 | } |
---|
1183 | l++; |
---|
1184 | |
---|
1185 | //Create istograms and fill them |
---|
1186 | |
---|
1187 | TH2F *th1=new TH2F("EusoHF_WLXY1","Hits on IFS, all wavelengths", 100,xshmin,xshmax,100,yshmin,yshmax); |
---|
1188 | TH2F *th2=new TH2F("EusoHF_WLXY2","Hits on IFS, #lambda < 350 nm", 100,xshmin,xshmax,100,yshmin,yshmax); |
---|
1189 | TH2F *th3=new TH2F("EusoHF_WLXY3","Hits on IFS, 350 nm #leq #lambda #leq 370 nm", 100,xshmin,xshmax,100,yshmin,yshmax); |
---|
1190 | TH2F *th4=new TH2F("EusoHF_WLXY4","Hits on IFS, #lambda > 370 nm", 100,xshmin,xshmax,100,yshmin,yshmax); |
---|
1191 | |
---|
1192 | for (Int_t i=0; i<l; i++) { |
---|
1193 | Int_t k=nlist[i]; |
---|
1194 | EDetPhoton* ph=fDetector->GetPhoton(k); |
---|
1195 | const TVector3& pos=(fDetector->GetPhoton(k)->GetPos()); |
---|
1196 | |
---|
1197 | if (ph->CrossedIFS()) th1->Fill(pos[0],pos[1]); |
---|
1198 | if (ph->CrossedIFS() && ph->GetLambda()<0.00035) th2->Fill(pos[0],pos[1]); |
---|
1199 | if (ph->CrossedIFS() && ph->GetLambda()>=0.00035 && ph->GetLambda()<=0.00037) th3->Fill(pos[0],pos[1]); |
---|
1200 | if (ph->CrossedIFS() && ph->GetLambda()>0.00037) th4->Fill(pos[0],pos[1]); |
---|
1201 | } |
---|
1202 | |
---|
1203 | gStyle->SetOptStat(10); |
---|
1204 | |
---|
1205 | th1->SetStats(kTRUE); |
---|
1206 | th1->SetXTitle("x"); |
---|
1207 | th1->SetYTitle("y"); |
---|
1208 | th2->SetStats(kTRUE); |
---|
1209 | th2->SetXTitle("x"); |
---|
1210 | th2->SetYTitle("y"); |
---|
1211 | th3->SetStats(kTRUE); |
---|
1212 | th3->SetXTitle("x"); |
---|
1213 | th3->SetYTitle("y"); |
---|
1214 | th4->SetStats(kTRUE); |
---|
1215 | th4->SetXTitle("x"); |
---|
1216 | th4->SetYTitle("y"); |
---|
1217 | |
---|
1218 | |
---|
1219 | c->cd(1); |
---|
1220 | th1->Draw("colz"); |
---|
1221 | c->cd(2); |
---|
1222 | th2->Draw("colz"); |
---|
1223 | c->cd(3); |
---|
1224 | th3->Draw("colz"); |
---|
1225 | c->cd(4); |
---|
1226 | th4->Draw("colz"); |
---|
1227 | |
---|
1228 | c->Update(); |
---|
1229 | |
---|
1230 | if ( x ) delete x; |
---|
1231 | if ( y ) delete y; |
---|
1232 | if ( xsh ) delete xsh; |
---|
1233 | if ( ysh ) delete ysh; |
---|
1234 | if ( nlist ) delete nlist; |
---|
1235 | |
---|
1236 | cout << "DoWaveLenght ended" << endl; |
---|
1237 | } |
---|
1238 | |
---|
1239 | void EDetectorHistoPainter::SetRangeUser(Double_t ufirst, Double_t ulast) { |
---|
1240 | TIter next(fHistos); |
---|
1241 | |
---|
1242 | while(TObject* obj = next() ) { |
---|
1243 | if ( obj->IsA() == TH1F::Class() ) |
---|
1244 | ((TH1F*)obj)->GetXaxis()->SetRangeUser(ufirst,ulast); |
---|
1245 | } |
---|
1246 | } |
---|