1 | // $Id: ESimpleDetectorPainter.cc 2845 2010-02-25 05:43:43Z fenu $ |
---|
2 | // Author: Sylvain Moreggia 2006/03/29 |
---|
3 | |
---|
4 | /***************************************************************************** |
---|
5 | * ESAF: Euso Simulation and Analysis Framework * |
---|
6 | * * |
---|
7 | * Id: ESimpleDetectorPainter * |
---|
8 | * Package: <packagename> * |
---|
9 | * Coordinator: <coordinator> * |
---|
10 | * * |
---|
11 | *****************************************************************************/ |
---|
12 | |
---|
13 | //_____________________________________________________________________________ |
---|
14 | // |
---|
15 | // ESimpleDetectorPainter |
---|
16 | // |
---|
17 | // <extensive class description> |
---|
18 | // |
---|
19 | // Config file parameters |
---|
20 | // ====================== |
---|
21 | // |
---|
22 | // <parameter name>: <parameter description> |
---|
23 | // -Valid options: <available options> |
---|
24 | // |
---|
25 | |
---|
26 | #include "ESimpleDetectorPainter.hh" |
---|
27 | #include "ESimpleDetector.hh" |
---|
28 | #include "EPhotoElectron.hh" |
---|
29 | #include "EGeometry.hh" |
---|
30 | #include "ESystemOfUnits.hh" |
---|
31 | #include "ETruth.hh" |
---|
32 | #include "Etypes.hh" |
---|
33 | |
---|
34 | #include <TH1F.h> |
---|
35 | #include <TH2F.h> |
---|
36 | #include <TH2I.h> |
---|
37 | #include <THStack.h> |
---|
38 | #include <TF1.h> |
---|
39 | #include <TTimer.h> |
---|
40 | #include <TPad.h> |
---|
41 | #include <TPaveText.h> |
---|
42 | #include <TGaxis.h> |
---|
43 | #include <TVector3.h> |
---|
44 | #include <TMath.h> |
---|
45 | #include <TLegend.h> |
---|
46 | #include <TCanvas.h> |
---|
47 | #include <TFile.h> |
---|
48 | |
---|
49 | #include <map> |
---|
50 | #include <vector> |
---|
51 | using std::vector; |
---|
52 | using std::map; |
---|
53 | |
---|
54 | |
---|
55 | ClassImp(ESimpleDetectorPainter) |
---|
56 | |
---|
57 | extern Double_t Zv(const TVector3&); |
---|
58 | using namespace TMath; |
---|
59 | using namespace sou; |
---|
60 | using std::vector; |
---|
61 | using std::map; |
---|
62 | |
---|
63 | |
---|
64 | |
---|
65 | //_____________________________________________________________________________ |
---|
66 | ESimpleDetectorPainter::ESimpleDetectorPainter( ESimpleDetector* det, const EGeometry* geometry, ETruth* truth,Int_t maxscatorder) { |
---|
67 | // |
---|
68 | // Constructor |
---|
69 | // |
---|
70 | |
---|
71 | fDetector = 0; |
---|
72 | |
---|
73 | if ( !det || !geometry) { |
---|
74 | MakeZombie(); |
---|
75 | return; |
---|
76 | } |
---|
77 | fDetector = new ESimpleDetector(*det); |
---|
78 | fTruth = new ETruth(*truth); |
---|
79 | fHistos = new TList(); |
---|
80 | |
---|
81 | fGTUlength = fDetector->GetGTUlength(); |
---|
82 | fEUSO = geometry->GetPos(); |
---|
83 | fRadius = geometry->GetRadius(); |
---|
84 | fNumPe = fDetector->GetNumPhotoElectrons(); |
---|
85 | fNbGTUs = fDetector->GetNbGTUs(); |
---|
86 | fFirstGtuTime = fDetector->GetFirstGtuTime(); |
---|
87 | fMaxScatOrder = maxscatorder; // if < 0 (no atmosphere in the output, fixed in preprocess method) |
---|
88 | fMeanBgnd = fDetector->GetMeanBgnd(); |
---|
89 | fNbPixelOnSide = fDetector->GetNbPixelOnSide(); |
---|
90 | |
---|
91 | Info("ESimpleDetectorPainter::Build()","USE pupil radius = %.2f mm, euso altitude = %.2f km, GTUlength = %.1f nanosec",fRadius/mm,fEUSO.Z()/km,fGTUlength); |
---|
92 | |
---|
93 | Preprocess(); |
---|
94 | Info("ESimpleDetectorPainter::Build()","Max scattering order = %d",fMaxScatOrder); |
---|
95 | BuildAll(); |
---|
96 | } |
---|
97 | |
---|
98 | //_____________________________________________________________________________ |
---|
99 | ESimpleDetectorPainter::~ESimpleDetectorPainter() { |
---|
100 | // |
---|
101 | // Destructor |
---|
102 | // |
---|
103 | if (IsZombie()) return; |
---|
104 | if ( fHistos ) fHistos->Delete(); |
---|
105 | TFile* temp = (TFile*)gROOT->FindObject("temp_file_viewer"); |
---|
106 | temp->Close(); |
---|
107 | } |
---|
108 | |
---|
109 | //_____________________________________________________________________________ |
---|
110 | void ESimpleDetectorPainter::Preprocess() { |
---|
111 | // |
---|
112 | // preprocess : build histos NBpixelshit vs/ GTU (as function of SNR) |
---|
113 | // |
---|
114 | |
---|
115 | // list of photoelectrons, stored per GTU (index=0 means GTU nb=0, GTU id within [0,fNbGTUs-1]) |
---|
116 | // NB : EPhotoElectron elements belong to ROOT tree, MUST not be destroyed |
---|
117 | map<UInt_t, vector<EPhotoElectron*>* > PEMap; |
---|
118 | for(UInt_t i=0; i < fNbGTUs; i++) PEMap[i] = NULL; |
---|
119 | |
---|
120 | // array of pe- time |
---|
121 | TArrayD tofarray(fNumPe); |
---|
122 | if(fMaxScatOrder < 0) { |
---|
123 | // search for maximum scattering order |
---|
124 | Int_t maxSCAT = 0; |
---|
125 | for (Int_t i=0; i<fNumPe; i++) { |
---|
126 | EPhotoElectron* peee = fDetector->GetPhotoElectron(i); |
---|
127 | tofarray[i] = peee->GetTime(); |
---|
128 | if(peee->GetAtmoNbinter() > maxSCAT) maxSCAT = peee->GetAtmoNbinter(); |
---|
129 | } |
---|
130 | fMaxScatOrder = maxSCAT; |
---|
131 | } |
---|
132 | else |
---|
133 | for (Int_t i=0; i<fNumPe; i++) tofarray[i] = fDetector->GetPhotoElectron(i)->GetTime(); |
---|
134 | |
---|
135 | |
---|
136 | // 1. fill the map + find FoV bounds where signal exists |
---|
137 | // 1.1 sort tofarray elements using time info |
---|
138 | Int_t sortedindex[fNumPe]; |
---|
139 | Sort(fNumPe,tofarray.GetArray(),sortedindex,false); // false means in increasing order |
---|
140 | // 1.2 fill PEMap using GTU info + find FoV bounds |
---|
141 | Float_t tof = 0.; |
---|
142 | EPhotoElectron* pe = 0; |
---|
143 | UInt_t GTUnb(0), oldGTUnb(100000); |
---|
144 | fFoV_xmin = 100000; |
---|
145 | fFoV_ymin = 0; |
---|
146 | fFoV_xmax = 0; |
---|
147 | fFoV_ymax = -100000; |
---|
148 | fFoV_xmin2 = 100000; |
---|
149 | fFoV_ymin2 = 0; |
---|
150 | fFoV_xmax2 = 0; |
---|
151 | fFoV_ymax2 = -100000; |
---|
152 | fFoV_xmin_sig = 100000; |
---|
153 | fFoV_ymin_sig = 0; |
---|
154 | fFoV_xmax_sig = 0; |
---|
155 | fFoV_ymax_sig = -100000; |
---|
156 | for(Int_t i=0; i < fNumPe; i++) { |
---|
157 | // |
---|
158 | pe = fDetector->GetPhotoElectron(sortedindex[i]); |
---|
159 | tof = pe->GetTime(); |
---|
160 | GTUnb = UInt_t(floor( (tof - fFirstGtuTime) / fGTUlength )); |
---|
161 | if(GTUnb == 0 && oldGTUnb == 100000) PEMap[0] = new vector<EPhotoElectron*>; |
---|
162 | else if(oldGTUnb < GTUnb) PEMap[GTUnb] = new vector<EPhotoElectron*>; |
---|
163 | else if(GTUnb > 0 && oldGTUnb > GTUnb) Printf("<Preprocess> It seems pe- are not chronologically sorted"); |
---|
164 | PEMap[GTUnb]->push_back(pe); |
---|
165 | oldGTUnb = GTUnb; |
---|
166 | // |
---|
167 | Int_t pix_i = - fDetector->GetPixelRowID(pe->GetPixelID()); |
---|
168 | Int_t pix_j = fDetector->GetPixelColumnID(pe->GetPixelID()); |
---|
169 | if(pix_i < fFoV_ymin) fFoV_ymin = pix_i; |
---|
170 | if(pix_i > fFoV_ymax) fFoV_ymax = pix_i; |
---|
171 | if(pix_j < fFoV_xmin) fFoV_xmin = pix_j; |
---|
172 | if(pix_j > fFoV_xmax) fFoV_xmax = pix_j; |
---|
173 | if(pe->GetSNR() > 2) { |
---|
174 | if(pix_i < fFoV_ymin2) fFoV_ymin2 = pix_i; |
---|
175 | if(pix_i > fFoV_ymax2) fFoV_ymax2 = pix_i; |
---|
176 | if(pix_j < fFoV_xmin2) fFoV_xmin2 = pix_j; |
---|
177 | if(pix_j > fFoV_xmax2) fFoV_xmax2 = pix_j; |
---|
178 | } |
---|
179 | if(pe->GetSNR() > 3) { |
---|
180 | if(pix_i < fFoV_ymin_sig) fFoV_ymin_sig = pix_i; |
---|
181 | if(pix_i > fFoV_ymax_sig) fFoV_ymax_sig = pix_i; |
---|
182 | if(pix_j < fFoV_xmin_sig) fFoV_xmin_sig = pix_j; |
---|
183 | if(pix_j > fFoV_xmax_sig) fFoV_xmax_sig = pix_j; |
---|
184 | } |
---|
185 | } |
---|
186 | |
---|
187 | |
---|
188 | // 2. build "Nbpixels_GTU" histo |
---|
189 | TH1F* h = GetTimeHisto("Nbpixels_GTU_all","Mean bgnd to be substracted"); |
---|
190 | TH1F* h0 = GetTimeHisto("Nbpixels_GTU_0sigma"); |
---|
191 | TH1F* h1 = GetTimeHisto("Nbpixels_GTU_1sigma"); |
---|
192 | TH1F* h2 = GetTimeHisto("Nbpixels_GTU_2sigma"); |
---|
193 | TH1F* h3 = GetTimeHisto("Nbpixels_GTU_3sigma"); |
---|
194 | TH1F* h4 = GetTimeHisto("Nbpixels_GTU_trigg"); |
---|
195 | TH1F* Signal = GetTimeHisto("Nbpixels_GTU_Signal"); // just to know nb of pixels hit by signal pe- |
---|
196 | |
---|
197 | // 2.1 loop on GTUs |
---|
198 | map<UInt_t, vector<EPhotoElectron*>* >::const_iterator it; |
---|
199 | for(it = PEMap.begin(); it != PEMap.end(); it++) { |
---|
200 | vector<EPhotoElectron*>* pelist = it->second; |
---|
201 | |
---|
202 | // if pe- exist in this GTU |
---|
203 | if(pelist) { |
---|
204 | // init |
---|
205 | Int_t prev_pixID = -1; |
---|
206 | Int_t pixID = 0; |
---|
207 | TArrayI pixelIDs(pelist->size()); |
---|
208 | |
---|
209 | // sort pe- according to pixelID |
---|
210 | for(size_t n=0; n < pelist->size(); n++) pixelIDs[n] = Int_t((*pelist)[n]->GetPixelID()); |
---|
211 | Int_t sortedindex[pelist->size()]; |
---|
212 | Sort((Int_t)pelist->size(),pixelIDs.GetArray(),sortedindex,false); // false means in increasing order |
---|
213 | |
---|
214 | // then fill Nbpixels_GTU histo once per pixel |
---|
215 | for(size_t m=0; m < pelist->size(); m++) { |
---|
216 | EPhotoElectron * pe = (*pelist)[sortedindex[m]]; |
---|
217 | pixID = Int_t(pe->GetPixelID()); |
---|
218 | if(pixID > prev_pixID) { |
---|
219 | UInt_t GTUid = it->first; |
---|
220 | h->Fill(GTUid,fMeanBgnd); |
---|
221 | if(pe->GetSNR() > 0) h0->Fill(GTUid,fMeanBgnd); |
---|
222 | if(pe->GetSNR() > 1) h1->Fill(GTUid,fMeanBgnd); |
---|
223 | if(pe->GetSNR() > 2) h2->Fill(GTUid,fMeanBgnd); |
---|
224 | if(pe->GetSNR() > 3) h3->Fill(GTUid,fMeanBgnd); |
---|
225 | if(pe->IsTriggered()) h4->Fill(GTUid,fMeanBgnd); |
---|
226 | if(pe->GetType() == 0 && pe->GetAtmoHistory()==0) Signal->Fill(GTUid,1.); |
---|
227 | if(pe->GetType() == 1 && pe->GetAtmoHistory()==1) Signal->Fill(GTUid,1.); |
---|
228 | } |
---|
229 | else if(prev_pixID > pixID) Printf("<Preprocess> It seems pe- are not pixeliD sorted"); |
---|
230 | prev_pixID = pixID; |
---|
231 | } |
---|
232 | } |
---|
233 | } |
---|
234 | |
---|
235 | // delete map |
---|
236 | map<UInt_t, vector<EPhotoElectron*>* >::const_iterator it2; |
---|
237 | for(it2 = PEMap.begin(); it2 != PEMap.end(); it2++) { |
---|
238 | vector<EPhotoElectron*>* pelist = it2->second; |
---|
239 | if(pelist) { |
---|
240 | pelist->clear(); |
---|
241 | SafeDelete(pelist); |
---|
242 | } |
---|
243 | } |
---|
244 | PEMap.clear(); |
---|
245 | } |
---|
246 | |
---|
247 | //_____________________________________________________________________________ |
---|
248 | void ESimpleDetectorPainter::BuildAll() { |
---|
249 | // |
---|
250 | // Build |
---|
251 | // |
---|
252 | |
---|
253 | BuildTimeHistos(); |
---|
254 | BuildWlHistos(); |
---|
255 | BuildFoVHistos(); |
---|
256 | } |
---|
257 | |
---|
258 | //_____________________________________________________________________________ |
---|
259 | void ESimpleDetectorPainter::BuildTimeHistos() { |
---|
260 | // |
---|
261 | // generate histos of photons on pupil as function of time since PRIMARY cosmic ray first interaction |
---|
262 | // |
---|
263 | |
---|
264 | // if no data available |
---|
265 | if ( !fDetector ) { |
---|
266 | Info("BuildTimeHistos()","ESimpleDetector object is NULL. Painter made zombie."); |
---|
267 | MakeZombie(); |
---|
268 | return; |
---|
269 | } |
---|
270 | |
---|
271 | // if no pe- exist |
---|
272 | if ( fNumPe <= 0 ) { |
---|
273 | Info("BuildWlHistos()","No PhotoElectrons. Painter made zombie."); |
---|
274 | MakeZombie(); |
---|
275 | return; |
---|
276 | } |
---|
277 | |
---|
278 | |
---|
279 | // all pe- |
---|
280 | TH1F *th_tot0 = GetTimeHisto("Pe_total_all","All PhotoElectrons vs time (<B> substracted)"); |
---|
281 | TH1F *th_tot = GetTimeHisto("Pe_fluo_all","Fluo PhotoElectrons vs time (<B> substracted)"); |
---|
282 | TH1F *th_tot1 = GetTimeHisto("Pe_ckov_all","Ckov PhotoElectrons vs time (<B> substracted)"); |
---|
283 | TH1F *th_tot2 = GetTimeHisto("Pe_bgnd_all","Bgnd PhotoElectrons vs time (<B> substracted)"); |
---|
284 | |
---|
285 | // all w.r.t type (0sigma) |
---|
286 | TH1F *th030 = GetTimeHisto("Pe_total_0sigma","PhotoElectrons > <B> vs time (<B> substracted)"); |
---|
287 | TH1F *th03 = GetTimeHisto("Pe_fluo_0sigma","Fluo PhotoElectrons vs time (<B> substracted)"); |
---|
288 | TH1F *th031 = GetTimeHisto("Pe_ckov_0sigma","Ckov PhotoElectrons vs time (<B> substracted)"); |
---|
289 | TH1F *th032 = GetTimeHisto("Pe_bgnd_0sigma","Bgnd PhotoElectrons vs time (<B> substracted)"); |
---|
290 | // only triggered (nb sigma set in detector simu) |
---|
291 | TH1F *th130 = GetTimeHisto("Pe_total_trigg","Triggered PhotoElectrons vs time"); |
---|
292 | TH1F *th13 = GetTimeHisto("Pe_fluo_trigg","Fluo Triggered PhotoElectrons vs time"); |
---|
293 | TH1F *th131 = GetTimeHisto("Pe_ckov_trigg","Ckov Triggered PhotoElectrons vs time"); |
---|
294 | TH1F *th132 = GetTimeHisto("Pe_bgnd_trigg","Bgnd Triggered PhotoElectrons vs time"); |
---|
295 | // above 1sigma |
---|
296 | TH1F *th230 = GetTimeHisto("Pe_total_1sigma","PhotoElectrons > 1sigma vs time (<B> substracted)"); |
---|
297 | TH1F *th23 = GetTimeHisto("Pe_fluo_1sigma","Fluo PhotoElectrons > 1sigma vs time"); |
---|
298 | TH1F *th231 = GetTimeHisto("Pe_ckov_1sigma","Ckov PhotoElectrons > 1sigma vs time"); |
---|
299 | TH1F *th232 = GetTimeHisto("Pe_bgnd_1sigma","Bgnd PhotoElectrons > 1sigma vs time"); |
---|
300 | // above 2sigma |
---|
301 | TH1F *th330 = GetTimeHisto("Pe_total_2sigma","PhotoElectrons > 2sigma vs time (<B> substracted)"); |
---|
302 | TH1F *th33 = GetTimeHisto("Pe_fluo_2sigma","Fluo PhotoElectrons > 2sigma vs time"); |
---|
303 | TH1F *th331 = GetTimeHisto("Pe_ckov_2sigma","Ckov PhotoElectrons > 2sigma vs time"); |
---|
304 | TH1F *th332 = GetTimeHisto("Pe_bgnd_2sigma","Bgnd PhotoElectrons > 2sigma vs time"); |
---|
305 | // above 3sigma |
---|
306 | TH1F *th430 = GetTimeHisto("Pe_total_3sigma","PhotoElectrons > 3sigma vs time (<B> substracted)"); |
---|
307 | TH1F *th43 = GetTimeHisto("Pe_fluo_3sigma","Fluo PhotoElectrons > 3sigma vs time"); |
---|
308 | TH1F *th431 = GetTimeHisto("Pe_ckov_3sigma","Ckov PhotoElectrons > 3sigma vs time"); |
---|
309 | TH1F *th432 = GetTimeHisto("Pe_bgnd_3sigma","Bgnd PhotoElectrons > 3sigma vs time"); |
---|
310 | |
---|
311 | // all w.r.t atmosphere last history |
---|
312 | /* |
---|
313 | TH1F *th04 = GetTimeHisto("Pe_direct","Direct PhotoElectrons vs time"); |
---|
314 | TH1F *th041 = GetTimeHisto("Pe_refl","Reflected PhotoElectrons vs time"); |
---|
315 | TH1F *th042 = GetTimeHisto("Pe_rayl","Rayleigh scat PhotoElectrons vs time"); |
---|
316 | TH1F *th043 = GetTimeHisto("Pe_cloud","Cloud scat PhotoElectrons vs time"); |
---|
317 | TH1F *th044 = GetTimeHisto("Pe_aerosol","Aerosol scat PhotoElectrons vs time"); |
---|
318 | // only triggered |
---|
319 | TH1F *th14 = GetTimeHisto("Pe_direct_trigg","Direct PhotoElectrons vs time"); |
---|
320 | TH1F *th141 = GetTimeHisto("Pe_refl_trigg","Reflected PhotoElectrons vs time"); |
---|
321 | TH1F *th142 = GetTimeHisto("Pe_rayl_trigg","Rayleigh scat PhotoElectrons vs time"); |
---|
322 | TH1F *th143 = GetTimeHisto("Pe_cloud_trigg","Cloud scat PhotoElectrons vs time"); |
---|
323 | TH1F *th144 = GetTimeHisto("Pe_aerosol_trigg","Aerosol scat PhotoElectrons vs time"); |
---|
324 | */ |
---|
325 | |
---|
326 | // interaction order contribution |
---|
327 | TString prefix("Pe_nbinter"); |
---|
328 | TString suffix_tot("_all"); |
---|
329 | TString suffix("_trigg"); |
---|
330 | TString suffix0("_0sigma"); |
---|
331 | TString suffix1("_1sigma"); |
---|
332 | TString suffix2("_2sigma"); |
---|
333 | TString suffix3("_3sigma"); |
---|
334 | TString name(prefix); |
---|
335 | TH1F* temp_all = 0; |
---|
336 | TH1F* temp_sigma0 = 0; |
---|
337 | TH1F* temp_trigg = 0; |
---|
338 | TH1F* temp_sigma1 = 0; |
---|
339 | TH1F* temp_sigma2 = 0; |
---|
340 | TH1F* temp_sigma3 = 0; |
---|
341 | for(Int_t i=0; i<=fMaxScatOrder; i++) { |
---|
342 | // 0sigma |
---|
343 | name = prefix; |
---|
344 | name += i; |
---|
345 | name += suffix_tot; |
---|
346 | temp_all = GetTimeHisto(name.Data(),"ALl PhotoElectrons v.s. atmo scattering order"); |
---|
347 | // 0sigma |
---|
348 | name = prefix; |
---|
349 | name += i; |
---|
350 | name += suffix0; |
---|
351 | temp_sigma0 = GetTimeHisto(name.Data(),">0sigma PhotoElectrons v.s. atmo scattering order"); |
---|
352 | // only triggered |
---|
353 | name = prefix; |
---|
354 | name += i; |
---|
355 | name += suffix; |
---|
356 | temp_trigg = GetTimeHisto(name.Data(),"Triggered PhotoElectrons v.s. atmo scattering order"); |
---|
357 | // 1sigma |
---|
358 | name = prefix; |
---|
359 | name += i; |
---|
360 | name += suffix1; |
---|
361 | temp_sigma1 = GetTimeHisto(name.Data(),">1sigma PhotoElectrons v.s. atmo scattering order"); |
---|
362 | // 2sigma |
---|
363 | name = prefix; |
---|
364 | name += i; |
---|
365 | name += suffix2; |
---|
366 | temp_sigma2 = GetTimeHisto(name.Data(),">2sigma PhotoElectrons v.s. atmo scattering order"); |
---|
367 | // 3sigma |
---|
368 | name = prefix; |
---|
369 | name += i; |
---|
370 | name += suffix3; |
---|
371 | temp_sigma3 = GetTimeHisto(name.Data(),">3sigma PhotoElectrons v.s. atmo scattering order"); |
---|
372 | } |
---|
373 | |
---|
374 | |
---|
375 | |
---|
376 | // fill histograms |
---|
377 | TString histonb0(prefix); |
---|
378 | TString histonb_tot(prefix); |
---|
379 | TString histonb_trigg(prefix); |
---|
380 | TString histonb1(prefix); |
---|
381 | TString histonb2(prefix); |
---|
382 | TString histonb3(prefix); |
---|
383 | for (Int_t i=0; i<fNumPe; i++) { |
---|
384 | EPhotoElectron* pe = fDetector->GetPhotoElectron(i); |
---|
385 | // look for histo matching the pe- AtmoNbinter |
---|
386 | Int_t nbinter = pe->GetAtmoNbinter(); |
---|
387 | |
---|
388 | // all |
---|
389 | histonb_tot = prefix; |
---|
390 | histonb_tot += nbinter; |
---|
391 | histonb_tot += suffix_tot; |
---|
392 | temp_all = (TH1F*)fHistos->FindObject(histonb_tot.Data()); |
---|
393 | // 0sigma |
---|
394 | histonb0 = prefix; |
---|
395 | histonb0 += nbinter; |
---|
396 | histonb0 += suffix0; |
---|
397 | temp_sigma0 = (TH1F*)fHistos->FindObject(histonb0.Data()); |
---|
398 | // trigg only |
---|
399 | histonb_trigg = prefix; |
---|
400 | histonb_trigg += nbinter; |
---|
401 | histonb_trigg += suffix; |
---|
402 | temp_trigg = (TH1F*)fHistos->FindObject(histonb_trigg.Data()); |
---|
403 | // 1sigma |
---|
404 | histonb1 = prefix; |
---|
405 | histonb1 += nbinter; |
---|
406 | histonb1 += suffix1; |
---|
407 | temp_sigma1 = (TH1F*)fHistos->FindObject(histonb1.Data()); |
---|
408 | // 2sigma |
---|
409 | histonb2 = prefix; |
---|
410 | histonb2 += nbinter; |
---|
411 | histonb2 += suffix2; |
---|
412 | temp_sigma2 = (TH1F*)fHistos->FindObject(histonb2.Data()); |
---|
413 | // 3sigma |
---|
414 | histonb3 = prefix; |
---|
415 | histonb3 += nbinter; |
---|
416 | histonb3 += suffix3; |
---|
417 | temp_sigma3 = (TH1F*)fHistos->FindObject(histonb3.Data()); |
---|
418 | |
---|
419 | |
---|
420 | Float_t time = (pe->GetTime() - fFirstGtuTime) / fGTUlength; |
---|
421 | |
---|
422 | |
---|
423 | |
---|
424 | |
---|
425 | |
---|
426 | // 1. if pe- triggered |
---|
427 | if(pe->IsTriggered()) { |
---|
428 | if(temp_trigg && pe->GetType() < 2) temp_trigg->Fill(time); |
---|
429 | else if(pe->GetType() < 2) Printf("<BuildTimeHistos> Wrong histo identification %s",histonb_trigg.Data()); |
---|
430 | |
---|
431 | th130->Fill(time,1); |
---|
432 | if ( pe->GetType() == 0 ) { // fluo |
---|
433 | th13->Fill(time,1); |
---|
434 | //if(pe->GetAtmoHistory()==0) th14->Fill(time,1); |
---|
435 | //if(pe->GetAtmoHistory()==1) th141->Fill(time,1); |
---|
436 | //if(pe->GetAtmoHistory()==2) th142->Fill(time,1); |
---|
437 | //if(pe->GetAtmoHistory()==3) th143->Fill(time,1); |
---|
438 | //if(pe->GetAtmoHistory()==4) th144->Fill(time,1); |
---|
439 | } |
---|
440 | else if ( pe->GetType() == 1 ) { // ckov |
---|
441 | th131->Fill(time,1); |
---|
442 | //if(pe->GetAtmoHistory()==0) th14->Fill(time,1); |
---|
443 | //if(pe->GetAtmoHistory()==1) th141->Fill(time,1); |
---|
444 | //if(pe->GetAtmoHistory()==2) th142->Fill(time,1); |
---|
445 | //if(pe->GetAtmoHistory()==3) th143->Fill(time,1); |
---|
446 | //if(pe->GetAtmoHistory()==4) th144->Fill(time,1); |
---|
447 | } |
---|
448 | else if ( pe->GetType() == 2 ) { // bgnd |
---|
449 | th132->Fill(time,1); |
---|
450 | //if(pe->GetAtmoHistory()==0) th14->Fill(time,1); |
---|
451 | //if(pe->GetAtmoHistory()==1) th141->Fill(time,1); |
---|
452 | //if(pe->GetAtmoHistory()==2) th142->Fill(time,1); |
---|
453 | //if(pe->GetAtmoHistory()==3) th143->Fill(time,1); |
---|
454 | //if(pe->GetAtmoHistory()==4) th144->Fill(time,1); |
---|
455 | } |
---|
456 | } |
---|
457 | |
---|
458 | |
---|
459 | |
---|
460 | // 2. pe- as function of SNR |
---|
461 | th_tot0->Fill(time); |
---|
462 | if(temp_all && pe->GetType() < 2) temp_all->Fill(time); |
---|
463 | else if(pe->GetType() < 2) Printf("<BuildTimeHistos> ALL. Wrong histo identification %s",histonb_tot.Data()); |
---|
464 | // fluo |
---|
465 | if ( pe->GetType() == 0 ) { |
---|
466 | th_tot->Fill(time,1); |
---|
467 | if(pe->GetSNR() > 0) { |
---|
468 | th03->Fill(time,1); |
---|
469 | th030->Fill(time,1); |
---|
470 | if(temp_sigma0) temp_sigma0->Fill(time); |
---|
471 | else Printf("<BuildTimeHistos> 0. Wrong histo identification %s",histonb0.Data()); |
---|
472 | } |
---|
473 | if(pe->GetSNR() > 1) { |
---|
474 | if(temp_sigma1) temp_sigma1->Fill(time); |
---|
475 | else Printf("<BuildTimeHistos> 1. Wrong histo identification %s",histonb1.Data()); |
---|
476 | th23->Fill(time); |
---|
477 | th230->Fill(time,1); |
---|
478 | } |
---|
479 | if(pe->GetSNR() > 2) { |
---|
480 | if(temp_sigma2) temp_sigma2->Fill(time); |
---|
481 | else Printf("<BuildTimeHistos> 2. Wrong histo identification %s",histonb2.Data()); |
---|
482 | th33->Fill(time); |
---|
483 | th330->Fill(time,1); |
---|
484 | } |
---|
485 | if(pe->GetSNR() > 3){ |
---|
486 | if(temp_sigma3) temp_sigma3->Fill(time); |
---|
487 | else Printf("<BuildTimeHistos> 3. Wrong histo identification %s",histonb3.Data()); |
---|
488 | th43->Fill(time); |
---|
489 | th430->Fill(time,1); |
---|
490 | } |
---|
491 | //if(pe->GetAtmoHistory()==0) th04->Fill(time,1); |
---|
492 | //if(pe->GetAtmoHistory()==1) th041->Fill(time,1); |
---|
493 | //if(pe->GetAtmoHistory()==2) th042->Fill(time,1); |
---|
494 | //if(pe->GetAtmoHistory()==3) th043->Fill(time,1); |
---|
495 | //if(pe->GetAtmoHistory()==4) th044->Fill(time,1); |
---|
496 | } |
---|
497 | // ckov |
---|
498 | else if ( pe->GetType() == 1 ) { |
---|
499 | th_tot1->Fill(time,1); |
---|
500 | if(pe->GetSNR() > 0) { |
---|
501 | th030->Fill(time,1); |
---|
502 | th031->Fill(time,1); |
---|
503 | if(temp_sigma0) temp_sigma0->Fill(time); |
---|
504 | else Printf("<BuildTimeHistos> 0. Wrong histo identification %s",histonb0.Data()); |
---|
505 | } |
---|
506 | if(pe->GetSNR() > 1) { |
---|
507 | if(temp_sigma1) temp_sigma1->Fill(time); |
---|
508 | else Printf("<BuildTimeHistos> 1. Wrong histo identification %s",histonb1.Data()); |
---|
509 | th231->Fill(time); |
---|
510 | th230->Fill(time,1); |
---|
511 | } |
---|
512 | if(pe->GetSNR() > 2) { |
---|
513 | if(temp_sigma2) temp_sigma2->Fill(time); |
---|
514 | else Printf("<BuildTimeHistos> 2. Wrong histo identification %s",histonb2.Data()); |
---|
515 | th331->Fill(time); |
---|
516 | th330->Fill(time,1); |
---|
517 | } |
---|
518 | if(pe->GetSNR() > 3){ |
---|
519 | if(temp_sigma3) temp_sigma3->Fill(time); |
---|
520 | else Printf("<BuildTimeHistos> 3. Wrong histo identification %s",histonb3.Data()); |
---|
521 | th431->Fill(time); |
---|
522 | th430->Fill(time,1); |
---|
523 | } |
---|
524 | //if(pe->GetAtmoHistory()==0) th04->Fill(time,1); |
---|
525 | //if(pe->GetAtmoHistory()==1) th041->Fill(time,1); |
---|
526 | //if(pe->GetAtmoHistory()==2) th042->Fill(time,1); |
---|
527 | //if(pe->GetAtmoHistory()==3) th043->Fill(time,1); |
---|
528 | //if(pe->GetAtmoHistory()==4) th044->Fill(time,1); |
---|
529 | } |
---|
530 | // bgnd |
---|
531 | else if ( pe->GetType() == 2 ) { |
---|
532 | th_tot2->Fill(time,1); |
---|
533 | if(pe->GetSNR() > 0) { |
---|
534 | th030->Fill(time,1); |
---|
535 | th032->Fill(time,1); |
---|
536 | } |
---|
537 | if(pe->GetSNR() > 1) { |
---|
538 | th232->Fill(time); |
---|
539 | th230->Fill(time,1); |
---|
540 | } |
---|
541 | if(pe->GetSNR() > 2) { |
---|
542 | th332->Fill(time); |
---|
543 | th330->Fill(time,1); |
---|
544 | } |
---|
545 | if(pe->GetSNR() > 3){ |
---|
546 | th432->Fill(time); |
---|
547 | th430->Fill(time,1); |
---|
548 | } |
---|
549 | //if(pe->GetAtmoHistory()==0) th04->Fill(time,1); |
---|
550 | //if(pe->GetAtmoHistory()==1) th041->Fill(time,1); |
---|
551 | //if(pe->GetAtmoHistory()==2) th042->Fill(time,1); |
---|
552 | //if(pe->GetAtmoHistory()==3) th043->Fill(time,1); |
---|
553 | //if(pe->GetAtmoHistory()==4) th044->Fill(time,1); |
---|
554 | } |
---|
555 | } |
---|
556 | } |
---|
557 | |
---|
558 | //_____________________________________________________________________________ |
---|
559 | void ESimpleDetectorPainter::BuildWlHistos() { |
---|
560 | // |
---|
561 | // generate also wavelength spectra of photons that gave pe- |
---|
562 | // |
---|
563 | |
---|
564 | // if no data available |
---|
565 | if ( !fDetector ) { |
---|
566 | Info("BuildWlHistos()","EAtmosphere object is NULL. Painter made zombie."); |
---|
567 | MakeZombie(); |
---|
568 | return; |
---|
569 | } |
---|
570 | |
---|
571 | // if no pe- exist |
---|
572 | if ( fNumPe <= 0 ) { |
---|
573 | Info("BuildWlHistos()","No PhotoElectrons. Painter made zombie."); |
---|
574 | MakeZombie(); |
---|
575 | return; |
---|
576 | } |
---|
577 | |
---|
578 | |
---|
579 | |
---|
580 | // type contribution |
---|
581 | TH1F *th03 = GetWlHisto("Pe_wl_fluo","Fluo signal PhotoElectrons vs wl"); |
---|
582 | TH1F *th031 = GetWlHisto("Pe_wl_ckov","Ckov signal PhotoElectrons vs wl"); |
---|
583 | // only triggered |
---|
584 | TH1F *th13 = GetWlHisto("Pe_wl_fluo_trigg","Fluo signal Triggered PhotoElectrons vs wl"); |
---|
585 | TH1F *th131 = GetWlHisto("Pe_wl_ckov_trigg","Ckov signal Triggered PhotoElectrons vs wl"); |
---|
586 | |
---|
587 | |
---|
588 | |
---|
589 | // fill histograms |
---|
590 | for (Int_t i=0; i<fNumPe; i++) { |
---|
591 | EPhotoElectron* pe = fDetector->GetPhotoElectron(i); |
---|
592 | Float_t wl = pe->GetWl(); |
---|
593 | if(wl == kHuge) continue; // means bgnd pe- |
---|
594 | wl /= nm; |
---|
595 | |
---|
596 | // if pe- triggered |
---|
597 | if(pe->IsTriggered()) { |
---|
598 | if ( pe->GetType() == 0 ) { // fluo |
---|
599 | th13->Fill(wl,1); |
---|
600 | } |
---|
601 | else if ( pe->GetType() == 1 ) { // ckov |
---|
602 | th131->Fill(wl,1); |
---|
603 | } |
---|
604 | } |
---|
605 | |
---|
606 | // all pe- even those not triggered |
---|
607 | if ( pe->GetType() == 0 ) { // fluo |
---|
608 | th03->Fill(wl,1); |
---|
609 | } |
---|
610 | else if ( pe->GetType() == 1 ) { // ckov |
---|
611 | th031->Fill(wl,1); |
---|
612 | } |
---|
613 | } |
---|
614 | |
---|
615 | } |
---|
616 | |
---|
617 | //_____________________________________________________________________________ |
---|
618 | void ESimpleDetectorPainter::BuildFoVHistos() { |
---|
619 | // |
---|
620 | // generate FoV histo : pixel_i vs/ pixel_j |
---|
621 | // ONLY SIGNAL PHOTO ELECTRONS (excepted one plot) |
---|
622 | // |
---|
623 | |
---|
624 | // if no data available |
---|
625 | if ( !fDetector ) { |
---|
626 | Info("BuildTimeHistos()","ESimpleDetector object is NULL. Painter made zombie."); |
---|
627 | MakeZombie(); |
---|
628 | return; |
---|
629 | } |
---|
630 | |
---|
631 | // if no pe- exist |
---|
632 | if ( fNumPe <= 0 ) { |
---|
633 | Info("BuildWlHistos()","No PhotoElectrons. Painter made zombie."); |
---|
634 | MakeZombie(); |
---|
635 | return; |
---|
636 | } |
---|
637 | |
---|
638 | |
---|
639 | // all (<B> substracted) |
---|
640 | TH2I *th = GetFoVHisto("Pe_Fov_all","All PhotoElectrons"); |
---|
641 | // only triggered (nb sigma set in detector simu) |
---|
642 | TH2I *th_trigg = GetFoVHisto("Pe_Fov_trigg","Triggered PhotoElectrons",3); |
---|
643 | // above 0sigma |
---|
644 | TH2I *th0 = GetFoVHisto("Pe_Fov_0sigma","PhotoElectrons > <B>"); |
---|
645 | // above 1sigma |
---|
646 | TH2I *th1 = GetFoVHisto("Pe_Fov_1sigma","PhotoElectrons > 1sigma"); |
---|
647 | // above 2sigma |
---|
648 | TH2I *th2 = GetFoVHisto("Pe_Fov_2sigma","PhotoElectrons > 2sigma",2); |
---|
649 | // above 3sigma |
---|
650 | TH2I *th3 = GetFoVHisto("Pe_Fov_3sigma","PhotoElectrons > 3sigma",3); |
---|
651 | |
---|
652 | |
---|
653 | |
---|
654 | // fill histograms |
---|
655 | for (Int_t k=0; k<fNumPe; k++) { |
---|
656 | EPhotoElectron* pe = fDetector->GetPhotoElectron(k); |
---|
657 | Int_t i = - fDetector->GetPixelRowID(pe->GetPixelID()); |
---|
658 | Int_t j = fDetector->GetPixelColumnID(pe->GetPixelID()); |
---|
659 | |
---|
660 | th->Fill(j,i); |
---|
661 | if(pe->IsTriggered()) th_trigg->Fill(j,i); |
---|
662 | if(pe->GetSNR() > 0) th0->Fill(j,i); |
---|
663 | if(pe->GetSNR() > 1) th1->Fill(j,i); |
---|
664 | if(pe->GetSNR() > 2) th2->Fill(j,i); |
---|
665 | if(pe->GetSNR() > 3) th3->Fill(j,i); |
---|
666 | } |
---|
667 | } |
---|
668 | |
---|
669 | //_____________________________________________________________________________ |
---|
670 | TH1F *ESimpleDetectorPainter::GetTimeHisto(const char *name, const char *title) { |
---|
671 | // |
---|
672 | // Get wavelength histograms |
---|
673 | // |
---|
674 | |
---|
675 | if ( title == 0 ) title = name; |
---|
676 | TH1F* th = (TH1F*)fHistos->FindObject(name); |
---|
677 | |
---|
678 | //Int_t nbins = fNbGTUs + 20; |
---|
679 | |
---|
680 | if (!th) { |
---|
681 | th = new TH1F( name, title, 150, 0, 150); |
---|
682 | fHistos->Add(th); |
---|
683 | th->SetStats(0); |
---|
684 | th->SetXTitle("Time (GTU)"); |
---|
685 | th->SetFillColor(0); |
---|
686 | //th->SetDirectory(0); |
---|
687 | } |
---|
688 | |
---|
689 | return th; |
---|
690 | } |
---|
691 | |
---|
692 | //_____________________________________________________________________________ |
---|
693 | TH1F *ESimpleDetectorPainter::GetWlHisto(const char *name, const char *title) { |
---|
694 | // |
---|
695 | // Get wavelength histograms |
---|
696 | // |
---|
697 | |
---|
698 | if ( title == 0 ) title = name; |
---|
699 | TH1F* th = (TH1F*)fHistos->FindObject(name); |
---|
700 | |
---|
701 | if (!th) { |
---|
702 | th = new TH1F( name, title, 200, 200., 600.); |
---|
703 | fHistos->Add(th); |
---|
704 | th->SetStats(0); |
---|
705 | th->SetXTitle("Wavelength, nm"); |
---|
706 | th->SetFillColor(9); |
---|
707 | //th->SetDirectory(0); |
---|
708 | } |
---|
709 | |
---|
710 | return th; |
---|
711 | } |
---|
712 | |
---|
713 | //_____________________________________________________________________________ |
---|
714 | TH2I *ESimpleDetectorPainter::GetFoVHisto(const char *name, const char *title,Int_t nbsigmas) { |
---|
715 | // |
---|
716 | // Get FoV histograms |
---|
717 | // |
---|
718 | |
---|
719 | if ( title == 0 ) title = name; |
---|
720 | TH2I* th = (TH2I*)fHistos->FindObject(name); |
---|
721 | Int_t xmin, xmax, ymin, ymax; |
---|
722 | if(nbsigmas<0) { |
---|
723 | xmin = fFoV_xmin; |
---|
724 | xmax = fFoV_xmax; |
---|
725 | ymin = fFoV_ymin; |
---|
726 | ymax = fFoV_ymax; |
---|
727 | } |
---|
728 | else if(nbsigmas == 2) { |
---|
729 | xmin = fFoV_xmin2; |
---|
730 | xmax = fFoV_xmax2; |
---|
731 | ymin = fFoV_ymin2; |
---|
732 | ymax = fFoV_ymax2; |
---|
733 | } |
---|
734 | else { |
---|
735 | xmin = fFoV_xmin_sig; |
---|
736 | xmax = fFoV_xmax_sig; |
---|
737 | ymin = fFoV_ymin_sig; |
---|
738 | ymax = fFoV_ymax_sig; |
---|
739 | } |
---|
740 | |
---|
741 | if (!th) { |
---|
742 | th = new TH2I( name, title,(xmax - xmin) + 2,xmin - 1,xmax + 1,(ymax - ymin) + 2,ymin - 1,ymax + 1); |
---|
743 | fHistos->Add(th); |
---|
744 | th->SetXTitle("pixel X"); |
---|
745 | th->SetYTitle("pixel Y"); |
---|
746 | th->SetDirectory(0); |
---|
747 | } |
---|
748 | |
---|
749 | return th; |
---|
750 | } |
---|
751 | |
---|
752 | //______________________________________________________________________________ |
---|
753 | void ESimpleDetectorPainter::Draw(Option_t *opt) { |
---|
754 | // |
---|
755 | // |
---|
756 | // |
---|
757 | |
---|
758 | if ( IsZombie() ) return; |
---|
759 | TString option(opt); |
---|
760 | TH1F* th(0); |
---|
761 | TH1F* th1(0); |
---|
762 | TH1F* th2(0); |
---|
763 | TH1F* th3(0); |
---|
764 | TH1F* th4(0); |
---|
765 | TH1F* th5(0); |
---|
766 | TH1F* th6(0); |
---|
767 | TH1* hcopy(0); |
---|
768 | TH2I* h2Dint(0); |
---|
769 | if ( option == "" ) option = "Nph"; |
---|
770 | |
---|
771 | |
---|
772 | // ************************************ PhotoElectrons TIME in DETECTOR ***************************************// |
---|
773 | |
---|
774 | // <B> per GTU (summed over hit pixels) |
---|
775 | else if ( option == "Nbpixels_GTU" ){ |
---|
776 | TString name("name"); |
---|
777 | char txt[200]; |
---|
778 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
779 | th = GetTimeHisto("Nbpixels_GTU_all"); |
---|
780 | th->SetLineColor(2); |
---|
781 | sprintf(txt," Total %.1f",th->Integral()); |
---|
782 | name = TString(txt); |
---|
783 | name += TString(" "); |
---|
784 | leg->AddEntry(th,name.Data(),"f"); |
---|
785 | th->Draw(); |
---|
786 | |
---|
787 | th1 = GetTimeHisto("Nbpixels_GTU_0sigma"); |
---|
788 | th1->SetFillColor(7); |
---|
789 | th1->SetLineColor(7); |
---|
790 | sprintf(txt," 0 sigma %.1f",th1->Integral()); |
---|
791 | name = TString(txt); |
---|
792 | name += TString(" "); |
---|
793 | leg->AddEntry(th1,name.Data(),"f"); |
---|
794 | th1->Draw("same"); |
---|
795 | |
---|
796 | th2 = GetTimeHisto("Nbpixels_GTU_1sigma"); |
---|
797 | th2->SetFillColor(6); |
---|
798 | th2->SetLineColor(6); |
---|
799 | sprintf(txt," 1 sigma %.1f",th2->Integral()); |
---|
800 | name = TString(txt); |
---|
801 | name += TString(" "); |
---|
802 | leg->AddEntry(th2,name.Data(),"f"); |
---|
803 | th2->Draw("same"); |
---|
804 | |
---|
805 | th3 = GetTimeHisto("Nbpixels_GTU_2sigma"); |
---|
806 | th3->SetFillColor(3); |
---|
807 | th3->SetLineColor(3); |
---|
808 | sprintf(txt," 2 sigma %.1f",th3->Integral()); |
---|
809 | name = TString(txt); |
---|
810 | name += TString(" "); |
---|
811 | leg->AddEntry(th3,name.Data(),"f"); |
---|
812 | th3->Draw("same"); |
---|
813 | |
---|
814 | th4 = GetTimeHisto("Nbpixels_GTU_3sigma"); |
---|
815 | th4->SetFillColor(9); |
---|
816 | th4->SetLineColor(9); |
---|
817 | sprintf(txt," 3 sigma %.1f",th4->Integral()); |
---|
818 | name = TString(txt); |
---|
819 | name += TString(" "); |
---|
820 | leg->AddEntry(th4,name.Data(),"f"); |
---|
821 | th4->Draw("same"); |
---|
822 | |
---|
823 | th5 = GetTimeHisto("Nbpixels_GTU_trigg"); |
---|
824 | th5->SetFillColor(2); |
---|
825 | th5->SetLineColor(2); |
---|
826 | sprintf(txt," 4 sigma %.1f",th5->Integral()); |
---|
827 | name = TString(txt); |
---|
828 | name += TString(" "); |
---|
829 | leg->AddEntry(th5,name.Data(),"f"); |
---|
830 | th5->Draw("same"); |
---|
831 | |
---|
832 | th6 = GetTimeHisto("Nbpixels_GTU_Signal"); |
---|
833 | th6->SetFillColor(1); |
---|
834 | sprintf(txt," Signal %.1f",th6->Integral()); |
---|
835 | name = TString(txt); |
---|
836 | name += TString(" "); |
---|
837 | leg->AddEntry(th6,name.Data(),"f"); |
---|
838 | th6->Draw("same"); |
---|
839 | |
---|
840 | leg->Draw(); |
---|
841 | } |
---|
842 | |
---|
843 | // type contribution : all pe- (no SNR treatment) |
---|
844 | else if ( option == "PEtime_type_all" ) { |
---|
845 | TString name("name"); |
---|
846 | char txt[200]; |
---|
847 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
848 | th = GetTimeHisto("Pe_total_all"); |
---|
849 | th1 = GetTimeHisto("Pe_fluo_all"); |
---|
850 | th2 = GetTimeHisto("Pe_ckov_all"); |
---|
851 | th3 = GetTimeHisto("Pe_bgnd_all"); |
---|
852 | th4 = GetTimeHisto("Nbpixels_GTU_all"); |
---|
853 | |
---|
854 | THStack* STACK_PEtype = new THStack("STACK_PEtypeall","Type contribution - All pe^{-}"); |
---|
855 | if ( th1 ) { |
---|
856 | hcopy = (TH1F*)th1->Clone(); |
---|
857 | hcopy->SetFillColor(2); |
---|
858 | sprintf(txt," Fluo %d",(Int_t)hcopy->Integral()); |
---|
859 | name = TString(txt); |
---|
860 | name += TString(" "); |
---|
861 | STACK_PEtype->Add(hcopy); |
---|
862 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
863 | } |
---|
864 | if ( th2 ) { |
---|
865 | hcopy = (TH1F*)th2->Clone(); |
---|
866 | hcopy->SetFillColor(4); |
---|
867 | sprintf(txt," Ckov %d",(Int_t)hcopy->Integral()); |
---|
868 | name = TString(txt); |
---|
869 | name += TString(" "); |
---|
870 | STACK_PEtype->Add(hcopy); |
---|
871 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
872 | } |
---|
873 | if ( th3 ) { |
---|
874 | hcopy = (TH1F*)th3->Clone(); |
---|
875 | hcopy->Add(th4,-1); |
---|
876 | hcopy->SetFillColor(17); |
---|
877 | sprintf(txt," Bgnd %.2f",hcopy->Integral()); |
---|
878 | name = TString(txt); |
---|
879 | name += TString(" "); |
---|
880 | STACK_PEtype->Add(hcopy); |
---|
881 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
882 | } |
---|
883 | STACK_PEtype->Draw(""); |
---|
884 | if ( th ) { |
---|
885 | hcopy = (TH1F*)th->Clone(); |
---|
886 | hcopy->Add(th4,-1); |
---|
887 | hcopy->SetLineWidth(2); |
---|
888 | hcopy->SetFillColor(0); |
---|
889 | sprintf(txt," Total %.2f",hcopy->Integral()); |
---|
890 | name = TString(txt); |
---|
891 | name += TString(" "); |
---|
892 | hcopy->Draw("same"); |
---|
893 | leg->AddEntry(hcopy,name.Data(),"l"); |
---|
894 | } |
---|
895 | leg->Draw(); |
---|
896 | } |
---|
897 | |
---|
898 | // type contribution : above <B> |
---|
899 | else if ( option == "PEtime_type_0sigma" ) { |
---|
900 | TString name("name"); |
---|
901 | char txt[200]; |
---|
902 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
903 | th = GetTimeHisto("Pe_total_0sigma"); |
---|
904 | th1 = GetTimeHisto("Pe_fluo_0sigma"); |
---|
905 | th2 = GetTimeHisto("Pe_ckov_0sigma"); |
---|
906 | th3 = GetTimeHisto("Pe_bgnd_0sigma"); |
---|
907 | th4 = GetTimeHisto("Nbpixels_GTU_0sigma"); |
---|
908 | |
---|
909 | THStack* STACK_PEtype = new THStack("STACK_PEtype0","Type contribution - pe^{-} > <B>"); |
---|
910 | if ( th1 ) { |
---|
911 | hcopy = (TH1F*)th1->Clone(); |
---|
912 | hcopy->SetFillColor(2); |
---|
913 | sprintf(txt," Fluo %d",(Int_t)hcopy->Integral()); |
---|
914 | name = TString(txt); |
---|
915 | name += TString(" "); |
---|
916 | STACK_PEtype->Add(hcopy); |
---|
917 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
918 | } |
---|
919 | if ( th2 ) { |
---|
920 | hcopy = (TH1F*)th2->Clone(); |
---|
921 | hcopy->SetFillColor(4); |
---|
922 | sprintf(txt," Ckov %d",(Int_t)hcopy->Integral()); |
---|
923 | name = TString(txt); |
---|
924 | name += TString(" "); |
---|
925 | STACK_PEtype->Add(hcopy); |
---|
926 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
927 | } |
---|
928 | if ( th3 ) { |
---|
929 | hcopy = (TH1F*)th3->Clone(); |
---|
930 | hcopy->Add(th4,-1); |
---|
931 | hcopy->SetFillColor(17); |
---|
932 | sprintf(txt," Bgnd %.2f",hcopy->Integral()); |
---|
933 | name = TString(txt); |
---|
934 | name += TString(" "); |
---|
935 | STACK_PEtype->Add(hcopy); |
---|
936 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
937 | } |
---|
938 | STACK_PEtype->Draw(""); |
---|
939 | if ( th ) { |
---|
940 | hcopy = (TH1F*)th->Clone(); |
---|
941 | hcopy->Add(th4,-1); |
---|
942 | hcopy->SetLineWidth(2); |
---|
943 | hcopy->SetFillColor(0); |
---|
944 | sprintf(txt," Total %.2f",hcopy->Integral()); |
---|
945 | name = TString(txt); |
---|
946 | name += TString(" "); |
---|
947 | hcopy->Draw("same"); |
---|
948 | leg->AddEntry(hcopy,name.Data(),"l"); |
---|
949 | } |
---|
950 | leg->Draw(); |
---|
951 | } |
---|
952 | |
---|
953 | // type contribution : above <B> + 1sigma |
---|
954 | else if ( option == "PEtime_type_1sigma" ) { |
---|
955 | TString name("name"); |
---|
956 | char txt[200]; |
---|
957 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
958 | th = GetTimeHisto("Pe_total_1sigma"); |
---|
959 | th1 = GetTimeHisto("Pe_fluo_1sigma"); |
---|
960 | th2 = GetTimeHisto("Pe_ckov_1sigma"); |
---|
961 | th3 = GetTimeHisto("Pe_bgnd_1sigma"); |
---|
962 | th4 = GetTimeHisto("Nbpixels_GTU_1sigma"); |
---|
963 | |
---|
964 | THStack* STACK_PEtype = new THStack("STACK_PEtype1","Type contribution - pe^{-} > 1#sigma"); |
---|
965 | if ( th1 ) { |
---|
966 | hcopy = (TH1F*)th1->Clone(); |
---|
967 | hcopy->SetFillColor(2); |
---|
968 | sprintf(txt," Fluo %d",(Int_t)hcopy->Integral()); |
---|
969 | name = TString(txt); |
---|
970 | name += TString(" "); |
---|
971 | STACK_PEtype->Add(hcopy); |
---|
972 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
973 | } |
---|
974 | if ( th2 ) { |
---|
975 | hcopy = (TH1F*)th2->Clone(); |
---|
976 | hcopy->SetFillColor(4); |
---|
977 | sprintf(txt," Ckov %d",(Int_t)hcopy->Integral()); |
---|
978 | name = TString(txt); |
---|
979 | name += TString(" "); |
---|
980 | STACK_PEtype->Add(hcopy); |
---|
981 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
982 | } |
---|
983 | if ( th3 ) { |
---|
984 | hcopy = (TH1F*)th3->Clone(); hcopy->Add(th4,-1.); |
---|
985 | hcopy->SetFillColor(17); |
---|
986 | sprintf(txt," Bgnd %.2f",hcopy->Integral()); |
---|
987 | name = TString(txt); |
---|
988 | name += TString(" "); |
---|
989 | STACK_PEtype->Add(hcopy); |
---|
990 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
991 | } |
---|
992 | STACK_PEtype->Draw(); |
---|
993 | if ( th ) { |
---|
994 | hcopy = (TH1F*)th->Clone(); |
---|
995 | hcopy->Add(th4,-1); |
---|
996 | hcopy->SetLineWidth(2); |
---|
997 | hcopy->SetFillColor(0); |
---|
998 | sprintf(txt," Total %.2f",hcopy->Integral()); |
---|
999 | name = TString(txt); |
---|
1000 | name += TString(" "); |
---|
1001 | hcopy->Draw("same"); |
---|
1002 | leg->AddEntry(hcopy,name.Data(),"l"); |
---|
1003 | } |
---|
1004 | leg->Draw(); |
---|
1005 | } |
---|
1006 | |
---|
1007 | // type contribution : above <B> + 2sigma |
---|
1008 | else if ( option == "PEtime_type_2sigma" ) { |
---|
1009 | TString name("name"); |
---|
1010 | char txt[200]; |
---|
1011 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1012 | th = GetTimeHisto("Pe_total_2sigma"); |
---|
1013 | th1 = GetTimeHisto("Pe_fluo_2sigma"); |
---|
1014 | th2 = GetTimeHisto("Pe_ckov_2sigma"); |
---|
1015 | th3 = GetTimeHisto("Pe_bgnd_2sigma"); |
---|
1016 | th4 = GetTimeHisto("Nbpixels_GTU_2sigma"); |
---|
1017 | |
---|
1018 | THStack* STACK_PEtype = new THStack("STACK_PEtype2","Type contribution - pe^{-} > 2#sigma"); |
---|
1019 | if ( th1 ) { |
---|
1020 | hcopy = (TH1F*)th1->Clone(); |
---|
1021 | hcopy->SetFillColor(2); |
---|
1022 | sprintf(txt," Fluo %d",(Int_t)hcopy->Integral()); |
---|
1023 | name = TString(txt); |
---|
1024 | name += TString(" "); |
---|
1025 | STACK_PEtype->Add(hcopy); |
---|
1026 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1027 | } |
---|
1028 | if ( th2 ) { |
---|
1029 | hcopy = (TH1F*)th2->Clone(); |
---|
1030 | hcopy->SetFillColor(4); |
---|
1031 | sprintf(txt," Ckov %d",(Int_t)hcopy->Integral()); |
---|
1032 | name = TString(txt); |
---|
1033 | name += TString(" "); |
---|
1034 | STACK_PEtype->Add(hcopy); |
---|
1035 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1036 | } |
---|
1037 | if ( th3 ) { |
---|
1038 | hcopy = (TH1F*)th3->Clone(); |
---|
1039 | hcopy->Add(th4,-1); |
---|
1040 | hcopy->SetFillColor(17); |
---|
1041 | sprintf(txt," Bgnd %.2f",hcopy->Integral()); |
---|
1042 | name = TString(txt); |
---|
1043 | name += TString(" "); |
---|
1044 | STACK_PEtype->Add(hcopy); |
---|
1045 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1046 | } |
---|
1047 | STACK_PEtype->Draw(""); |
---|
1048 | if ( th ) { |
---|
1049 | hcopy = (TH1F*)th->Clone(); |
---|
1050 | hcopy->Add(th4,-1); |
---|
1051 | hcopy->SetLineWidth(2); |
---|
1052 | hcopy->SetFillColor(0); |
---|
1053 | sprintf(txt," Total %.2f",hcopy->Integral()); |
---|
1054 | name = TString(txt); |
---|
1055 | name += TString(" "); |
---|
1056 | hcopy->Draw("same"); |
---|
1057 | leg->AddEntry(hcopy,name.Data(),"l"); |
---|
1058 | } |
---|
1059 | leg->Draw(); |
---|
1060 | } |
---|
1061 | |
---|
1062 | // type contribution : above <B> + 3sigma |
---|
1063 | else if ( option == "PEtime_type_3sigma" ) { |
---|
1064 | TString name("name"); |
---|
1065 | char txt[200]; |
---|
1066 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1067 | th = GetTimeHisto("Pe_total_3sigma"); |
---|
1068 | th1 = GetTimeHisto("Pe_fluo_3sigma"); |
---|
1069 | th2 = GetTimeHisto("Pe_ckov_3sigma"); |
---|
1070 | th3 = GetTimeHisto("Pe_bgnd_3sigma"); |
---|
1071 | th4 = GetTimeHisto("Nbpixels_GTU_3sigma"); |
---|
1072 | |
---|
1073 | THStack* STACK_PEtype = new THStack("STACK_PEtype3","Type contribution - pe^{-} > 3#sigma"); |
---|
1074 | if ( th1 ) { |
---|
1075 | hcopy = (TH1F*)th1->Clone(); |
---|
1076 | hcopy->SetFillColor(2); |
---|
1077 | sprintf(txt," Fluo %d",(Int_t)hcopy->Integral()); |
---|
1078 | name = TString(txt); |
---|
1079 | name += TString(" "); |
---|
1080 | STACK_PEtype->Add(hcopy); |
---|
1081 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1082 | } |
---|
1083 | if ( th2 ) { |
---|
1084 | hcopy = (TH1F*)th2->Clone(); |
---|
1085 | hcopy->SetFillColor(4); |
---|
1086 | sprintf(txt," Ckov %d",(Int_t)hcopy->Integral()); |
---|
1087 | name = TString(txt); |
---|
1088 | name += TString(" "); |
---|
1089 | STACK_PEtype->Add(hcopy); |
---|
1090 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1091 | } |
---|
1092 | if ( th3 ) { |
---|
1093 | hcopy = (TH1F*)th3->Clone(); |
---|
1094 | hcopy->Add(th4,-1); |
---|
1095 | hcopy->SetFillColor(17); |
---|
1096 | sprintf(txt," Bgnd %.2f",hcopy->Integral()); |
---|
1097 | name = TString(txt); |
---|
1098 | name += TString(" "); |
---|
1099 | STACK_PEtype->Add(hcopy); |
---|
1100 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1101 | } |
---|
1102 | STACK_PEtype->Draw(""); |
---|
1103 | if ( th ) { |
---|
1104 | hcopy = (TH1F*)th->Clone(); |
---|
1105 | hcopy->Add(th4,-1); |
---|
1106 | hcopy->SetLineWidth(2); |
---|
1107 | hcopy->SetFillColor(0); |
---|
1108 | sprintf(txt," Total %.2f",hcopy->Integral()); |
---|
1109 | name = TString(txt); |
---|
1110 | name += TString(" "); |
---|
1111 | hcopy->Draw("same"); |
---|
1112 | leg->AddEntry(hcopy,name.Data(),"l"); |
---|
1113 | } |
---|
1114 | leg->Draw(); |
---|
1115 | } |
---|
1116 | |
---|
1117 | // type contribution - triggered only |
---|
1118 | else if ( option == "PEtime_type_trigg" ) { |
---|
1119 | TString name("name"); |
---|
1120 | char txt[200]; |
---|
1121 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1122 | th = GetTimeHisto("Pe_total_trigg"); |
---|
1123 | th1 = GetTimeHisto("Pe_fluo_trigg"); |
---|
1124 | th2 = GetTimeHisto("Pe_ckov_trigg"); |
---|
1125 | th3 = GetTimeHisto("Pe_bgnd_trigg"); |
---|
1126 | THStack* STACK_PEtype_trigg = new THStack("STACK_PEtype_trigg","Type contribution"); |
---|
1127 | if ( th ) { |
---|
1128 | hcopy = (TH1F*)th->DrawCopy(""); |
---|
1129 | hcopy->SetFillColor(0); |
---|
1130 | sprintf(txt," Total %d",(Int_t)hcopy->Integral()); |
---|
1131 | name = TString(txt); |
---|
1132 | name += TString(" "); |
---|
1133 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1134 | } |
---|
1135 | if ( th1 ) { |
---|
1136 | hcopy = (TH1F*)th1->Clone(); |
---|
1137 | hcopy->SetFillColor(2); |
---|
1138 | sprintf(txt," Fluo %d",(Int_t)hcopy->Integral()); |
---|
1139 | name = TString(txt); |
---|
1140 | name += TString(" "); |
---|
1141 | STACK_PEtype_trigg->Add(hcopy); |
---|
1142 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1143 | } |
---|
1144 | if ( th2 ) { |
---|
1145 | hcopy = (TH1F*)th2->Clone(); |
---|
1146 | hcopy->SetFillColor(4); |
---|
1147 | sprintf(txt," Ckov %d",(Int_t)hcopy->Integral()); |
---|
1148 | name = TString(txt); |
---|
1149 | name += TString(" "); |
---|
1150 | STACK_PEtype_trigg->Add(hcopy); |
---|
1151 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1152 | } |
---|
1153 | if ( th3 ) { |
---|
1154 | hcopy = (TH1F*)th3->DrawCopy("same"); |
---|
1155 | hcopy->SetFillColor(17); |
---|
1156 | sprintf(txt," Bgnd %d",(Int_t)hcopy->Integral()); |
---|
1157 | name = TString(txt); |
---|
1158 | name += TString(" "); |
---|
1159 | STACK_PEtype_trigg->Add(hcopy); |
---|
1160 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1161 | } |
---|
1162 | STACK_PEtype_trigg->Draw("same"); |
---|
1163 | leg->Draw(); |
---|
1164 | } |
---|
1165 | |
---|
1166 | // type contribution - triggered only -- Bgnd substracted |
---|
1167 | else if ( option == "PEtime_type_trigg_bgndsub" ) { |
---|
1168 | TString name("name"); |
---|
1169 | char txt[200]; |
---|
1170 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1171 | TLegend* leg_warning = new TLegend(0.3,0.8,0.6,0.9); |
---|
1172 | th = GetTimeHisto("Pe_total_trigg"); |
---|
1173 | th1 = GetTimeHisto("Pe_fluo_trigg"); |
---|
1174 | th2 = GetTimeHisto("Pe_ckov_trigg"); |
---|
1175 | th3 = GetTimeHisto("Pe_bgnd_trigg"); |
---|
1176 | th4 = GetTimeHisto("Nbpixels_GTU_trigg"); |
---|
1177 | THStack* STACK_PEtype_trigg = new THStack("STACK_PEtype_trigg_bgndsub","Type contribution -- triggered pe^{-} -- <B> substracted"); |
---|
1178 | if ( th1 ) { |
---|
1179 | hcopy = (TH1F*)th1->Clone(); |
---|
1180 | hcopy->SetFillColor(2); |
---|
1181 | sprintf(txt," Fluo %d",(Int_t)hcopy->Integral()); |
---|
1182 | name = TString(txt); |
---|
1183 | name += TString(" "); |
---|
1184 | STACK_PEtype_trigg->Add(hcopy); |
---|
1185 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1186 | } |
---|
1187 | if ( th2 ) { |
---|
1188 | hcopy = (TH1F*)th2->Clone(); |
---|
1189 | hcopy->SetFillColor(4); |
---|
1190 | sprintf(txt," Ckov %d",(Int_t)hcopy->Integral()); |
---|
1191 | name = TString(txt); |
---|
1192 | name += TString(" "); |
---|
1193 | STACK_PEtype_trigg->Add(hcopy); |
---|
1194 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1195 | } |
---|
1196 | if ( th3 ) { |
---|
1197 | hcopy = (TH1F*)th3->Clone(); |
---|
1198 | hcopy->Add(th4,-1); |
---|
1199 | hcopy->SetFillColor(17); |
---|
1200 | sprintf(txt," Bgnd %d",(Int_t)hcopy->Integral()); |
---|
1201 | name = TString(txt); |
---|
1202 | name += TString(" "); |
---|
1203 | STACK_PEtype_trigg->Add(hcopy); |
---|
1204 | leg->AddEntry(hcopy,name.Data(),"f"); |
---|
1205 | } |
---|
1206 | STACK_PEtype_trigg->Draw(""); |
---|
1207 | if ( th ) { |
---|
1208 | hcopy = (TH1F*)th->Clone(); |
---|
1209 | hcopy->Add(th4,-1); |
---|
1210 | hcopy->SetLineWidth(2); |
---|
1211 | hcopy->SetLineColor(1); |
---|
1212 | hcopy->SetFillColor(0); |
---|
1213 | sprintf(txt," Total %d",(Int_t)hcopy->Integral()); |
---|
1214 | name = TString(txt); |
---|
1215 | name += TString(" "); |
---|
1216 | hcopy->Draw("same"); |
---|
1217 | leg->AddEntry(hcopy,name.Data(),"l"); |
---|
1218 | leg_warning->AddEntry(hcopy,"OK only if trigg = 4#sigma",""); |
---|
1219 | } |
---|
1220 | leg->Draw(); |
---|
1221 | leg_warning->Draw(); |
---|
1222 | } |
---|
1223 | |
---|
1224 | // nb of scattering in atmo contribution : above <B> |
---|
1225 | else if ( option == "PEtime_atmonbinter_all" ) { |
---|
1226 | char txt[200]; |
---|
1227 | TString prefix("Pe_nbinter"); |
---|
1228 | TString suffix("_all"); |
---|
1229 | TString prefix2("order "); |
---|
1230 | TString histonb(prefix); |
---|
1231 | THStack* STACK_PEnbinter = new THStack("STACK_PEnbinterall","Scattering order contribution - All pe-"); |
---|
1232 | th2 = GetTimeHisto("Pe_total_all"); |
---|
1233 | th1 = GetTimeHisto("Pe_bgnd_all"); |
---|
1234 | th4 = GetTimeHisto("Nbpixels_GTU_all"); |
---|
1235 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1236 | for (Int_t i=0; i<=fMaxScatOrder; i++) { |
---|
1237 | histonb = prefix; |
---|
1238 | histonb += i; |
---|
1239 | histonb += suffix; |
---|
1240 | th = (TH1F*)fHistos->FindObject(histonb.Data()); |
---|
1241 | if( th ) { |
---|
1242 | hcopy = (TH1F*)th->Clone(); |
---|
1243 | histonb = prefix2; |
---|
1244 | histonb += i; |
---|
1245 | histonb += TString(" "); |
---|
1246 | histonb += hcopy->Integral(); |
---|
1247 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1248 | hcopy->SetFillColor(i+2); |
---|
1249 | STACK_PEnbinter->Add(hcopy); |
---|
1250 | } |
---|
1251 | else Printf("<Draw TimeHistos> Wrong histo identification %s",histonb.Data()); |
---|
1252 | } |
---|
1253 | if( th1 ) { |
---|
1254 | hcopy = (TH1F*)th1->Clone(); |
---|
1255 | hcopy->Add(th4,-1); |
---|
1256 | hcopy->SetFillColor(17); |
---|
1257 | histonb = TString(" Bgnd "); |
---|
1258 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1259 | histonb += TString(" "); |
---|
1260 | histonb += TString(txt); |
---|
1261 | STACK_PEnbinter->Add(hcopy); |
---|
1262 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1263 | } |
---|
1264 | STACK_PEnbinter->Draw(""); |
---|
1265 | if( th2 ) { |
---|
1266 | hcopy = (TH1F*)th2->Clone(); |
---|
1267 | hcopy->Add(th4,-1); |
---|
1268 | hcopy->SetLineWidth(2); |
---|
1269 | hcopy->SetLineColor(1); |
---|
1270 | hcopy->SetFillColor(0); |
---|
1271 | hcopy->SetTitle("Scattering order contribution - All pe-"); |
---|
1272 | histonb = TString(" Total "); |
---|
1273 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1274 | histonb += TString(" "); |
---|
1275 | histonb += TString(txt); |
---|
1276 | hcopy->Draw("same"); |
---|
1277 | leg->AddEntry(hcopy,histonb.Data(),"l"); |
---|
1278 | } |
---|
1279 | leg->Draw(); |
---|
1280 | } |
---|
1281 | |
---|
1282 | |
---|
1283 | // nb of scattering in atmo contribution : above <B> |
---|
1284 | else if ( option == "PEtime_atmonbinter_0sigma" ) { |
---|
1285 | char txt[200]; |
---|
1286 | TString prefix("Pe_nbinter"); |
---|
1287 | TString suffix("_0sigma"); |
---|
1288 | TString prefix2("order "); |
---|
1289 | TString histonb(prefix); |
---|
1290 | THStack* STACK_PEnbinter = new THStack("STACK_PEnbinter0","Scattering order contribution > <B>"); |
---|
1291 | th2 = GetTimeHisto("Pe_total_0sigma"); |
---|
1292 | th1 = GetTimeHisto("Pe_bgnd_0sigma"); |
---|
1293 | th4 = GetTimeHisto("Nbpixels_GTU_0sigma"); |
---|
1294 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1295 | for (Int_t i=0; i<=fMaxScatOrder; i++) { |
---|
1296 | histonb = prefix; |
---|
1297 | histonb += i; |
---|
1298 | histonb += suffix; |
---|
1299 | th = (TH1F*)fHistos->FindObject(histonb.Data()); |
---|
1300 | if( th ) { |
---|
1301 | hcopy = (TH1F*)th->Clone(); |
---|
1302 | histonb = prefix2; |
---|
1303 | histonb += i; |
---|
1304 | histonb += TString(" "); |
---|
1305 | histonb += hcopy->Integral(); |
---|
1306 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1307 | hcopy->SetFillColor(i+2); |
---|
1308 | STACK_PEnbinter->Add(hcopy); |
---|
1309 | } |
---|
1310 | else Printf("<Draw TimeHistos> Wrong histo identification %s",histonb.Data()); |
---|
1311 | } |
---|
1312 | if( th1 ) { |
---|
1313 | hcopy = (TH1F*)th1->Clone(); |
---|
1314 | hcopy->Add(th4,-1); |
---|
1315 | hcopy->SetFillColor(17); |
---|
1316 | histonb = TString(" Bgnd "); |
---|
1317 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1318 | histonb += TString(" "); |
---|
1319 | histonb += TString(txt); |
---|
1320 | STACK_PEnbinter->Add(hcopy); |
---|
1321 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1322 | } |
---|
1323 | STACK_PEnbinter->Draw(); |
---|
1324 | if( th2 ) { |
---|
1325 | hcopy = (TH1F*)th2->Clone(); |
---|
1326 | hcopy->Add(th4,-1); |
---|
1327 | hcopy->SetLineWidth(2); |
---|
1328 | hcopy->SetLineColor(1); |
---|
1329 | hcopy->SetFillColor(0); |
---|
1330 | hcopy->SetTitle("Scattering order contribution > <B>"); |
---|
1331 | histonb = TString(" Total "); |
---|
1332 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1333 | histonb += TString(" "); |
---|
1334 | histonb += TString(txt); |
---|
1335 | hcopy->Draw("same"); |
---|
1336 | leg->AddEntry(hcopy,histonb.Data(),"l"); |
---|
1337 | } |
---|
1338 | leg->Draw(); |
---|
1339 | } |
---|
1340 | |
---|
1341 | // nb of scattering in atmo contribution : above <B> |
---|
1342 | else if ( option == "PEtime_atmonbinter_1sigma" ) { |
---|
1343 | char txt[200]; |
---|
1344 | TString prefix("Pe_nbinter"); |
---|
1345 | TString suffix("_1sigma"); |
---|
1346 | TString prefix2("order "); |
---|
1347 | TString histonb(prefix); |
---|
1348 | THStack* STACK_PEnbinter = new THStack("STACK_PEnbinter1","Scattering order contribution > 1 sigma"); |
---|
1349 | th2 = GetTimeHisto("Pe_total_1sigma"); |
---|
1350 | th1 = GetTimeHisto("Pe_bgnd_1sigma"); |
---|
1351 | th4 = GetTimeHisto("Nbpixels_GTU_1sigma"); |
---|
1352 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1353 | for (Int_t i=0; i<=fMaxScatOrder; i++) { |
---|
1354 | histonb = prefix; |
---|
1355 | histonb += i; |
---|
1356 | histonb += suffix; |
---|
1357 | th = (TH1F*)fHistos->FindObject(histonb.Data()); |
---|
1358 | if( th ) { |
---|
1359 | hcopy = (TH1F*)th->Clone(); |
---|
1360 | histonb = prefix2; |
---|
1361 | histonb += i; |
---|
1362 | histonb += TString(" "); |
---|
1363 | histonb += hcopy->Integral(); |
---|
1364 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1365 | hcopy->SetFillColor(i+2); |
---|
1366 | STACK_PEnbinter->Add(hcopy); |
---|
1367 | } |
---|
1368 | else Printf("<Draw TimeHistos> Wrong histo identification %s",histonb.Data()); |
---|
1369 | } |
---|
1370 | if( th1 ) { |
---|
1371 | hcopy = (TH1F*)th1->Clone(); |
---|
1372 | hcopy->Add(th4,-1); |
---|
1373 | hcopy->SetFillColor(17); |
---|
1374 | histonb = TString(" Bgnd "); |
---|
1375 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1376 | histonb += TString(" "); |
---|
1377 | histonb += TString(txt); |
---|
1378 | STACK_PEnbinter->Add(hcopy); |
---|
1379 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1380 | } |
---|
1381 | STACK_PEnbinter->Draw(); |
---|
1382 | if( th2 ) { |
---|
1383 | hcopy = (TH1F*)th2->Clone(); |
---|
1384 | hcopy->Add(th4,-1); |
---|
1385 | hcopy->SetLineWidth(2); |
---|
1386 | hcopy->SetLineColor(1); |
---|
1387 | hcopy->SetFillColor(0); |
---|
1388 | hcopy->SetTitle("cattering order contribution > 1 sigma"); |
---|
1389 | histonb = TString(" Total "); |
---|
1390 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1391 | histonb += TString(" "); |
---|
1392 | histonb += TString(txt); |
---|
1393 | hcopy->Draw("same"); |
---|
1394 | leg->AddEntry(hcopy,histonb.Data(),"l"); |
---|
1395 | } |
---|
1396 | leg->Draw(); |
---|
1397 | } |
---|
1398 | |
---|
1399 | // nb of scattering in atmo contribution : above <B> |
---|
1400 | else if ( option == "PEtime_atmonbinter_2sigma" ) { |
---|
1401 | char txt[200]; |
---|
1402 | TString prefix("Pe_nbinter"); |
---|
1403 | TString suffix("_2sigma"); |
---|
1404 | TString prefix2("order "); |
---|
1405 | TString histonb(prefix); |
---|
1406 | THStack* STACK_PEnbinter = new THStack("STACK_PEnbinter2","Scattering order contribution > 2 sigma"); |
---|
1407 | th2 = GetTimeHisto("Pe_total_2sigma"); |
---|
1408 | th1 = GetTimeHisto("Pe_bgnd_2sigma"); |
---|
1409 | th4 = GetTimeHisto("Nbpixels_GTU_2sigma"); |
---|
1410 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1411 | for (Int_t i=0; i<=fMaxScatOrder; i++) { |
---|
1412 | histonb = prefix; |
---|
1413 | histonb += i; |
---|
1414 | histonb += suffix; |
---|
1415 | th = (TH1F*)fHistos->FindObject(histonb.Data()); |
---|
1416 | if( th ) { |
---|
1417 | hcopy = (TH1F*)th->Clone(); |
---|
1418 | histonb = prefix2; |
---|
1419 | histonb += i; |
---|
1420 | histonb += TString(" "); |
---|
1421 | histonb += hcopy->Integral(); |
---|
1422 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1423 | hcopy->SetFillColor(i+2); |
---|
1424 | STACK_PEnbinter->Add(hcopy); |
---|
1425 | } |
---|
1426 | else Printf("<Draw TimeHistos> Wrong histo identification %s",histonb.Data()); |
---|
1427 | } |
---|
1428 | if( th1 ) { |
---|
1429 | hcopy = (TH1F*)th1->Clone(); |
---|
1430 | hcopy->Add(th4,-1); |
---|
1431 | hcopy->SetFillColor(17); |
---|
1432 | histonb = TString(" Bgnd "); |
---|
1433 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1434 | histonb += TString(" "); |
---|
1435 | histonb += TString(txt); |
---|
1436 | STACK_PEnbinter->Add(hcopy); |
---|
1437 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1438 | } |
---|
1439 | STACK_PEnbinter->Draw(); |
---|
1440 | if( th2 ) { |
---|
1441 | hcopy = (TH1F*)th2->Clone(); |
---|
1442 | hcopy->Add(th4,-1); |
---|
1443 | hcopy->SetLineWidth(2); |
---|
1444 | hcopy->SetLineColor(1); |
---|
1445 | hcopy->SetFillColor(0); |
---|
1446 | hcopy->SetTitle("Scattering order contribution > 2 sigma"); |
---|
1447 | histonb = TString(" Total "); |
---|
1448 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1449 | histonb += TString(" "); |
---|
1450 | histonb += TString(txt); |
---|
1451 | hcopy->Draw("same"); |
---|
1452 | leg->AddEntry(hcopy,histonb.Data(),"l"); |
---|
1453 | } |
---|
1454 | leg->Draw(); |
---|
1455 | } |
---|
1456 | |
---|
1457 | // nb of scattering in atmo contribution : above <B> |
---|
1458 | else if ( option == "PEtime_atmonbinter_3sigma" ) { |
---|
1459 | char txt[200]; |
---|
1460 | TString prefix("Pe_nbinter"); |
---|
1461 | TString suffix("_3sigma"); |
---|
1462 | TString prefix2("order "); |
---|
1463 | TString histonb(prefix); |
---|
1464 | THStack* STACK_PEnbinter = new THStack("STACK_PEnbinter3","Scattering order contribution > 3 sigma"); |
---|
1465 | th2 = GetTimeHisto("Pe_total_3sigma"); |
---|
1466 | th1 = GetTimeHisto("Pe_bgnd_3sigma"); |
---|
1467 | th4 = GetTimeHisto("Nbpixels_GTU_3sigma"); |
---|
1468 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1469 | for (Int_t i=0; i<=fMaxScatOrder; i++) { |
---|
1470 | histonb = prefix; |
---|
1471 | histonb += i; |
---|
1472 | histonb += suffix; |
---|
1473 | th = (TH1F*)fHistos->FindObject(histonb.Data()); |
---|
1474 | if( th ) { |
---|
1475 | hcopy = (TH1F*)th->Clone(); |
---|
1476 | histonb = prefix2; |
---|
1477 | histonb += i; |
---|
1478 | histonb += TString(" "); |
---|
1479 | histonb += hcopy->Integral(); |
---|
1480 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1481 | hcopy->SetFillColor(i+2); |
---|
1482 | STACK_PEnbinter->Add(hcopy); |
---|
1483 | } |
---|
1484 | else Printf("<Draw TimeHistos> Wrong histo identification %s",histonb.Data()); |
---|
1485 | } |
---|
1486 | if( th1 ) { |
---|
1487 | hcopy = (TH1F*)th1->Clone(); |
---|
1488 | hcopy->Add(th4,-1); |
---|
1489 | hcopy->SetFillColor(17); |
---|
1490 | histonb = TString(" Bgnd "); |
---|
1491 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1492 | histonb += TString(" "); |
---|
1493 | histonb += TString(txt); |
---|
1494 | STACK_PEnbinter->Add(hcopy); |
---|
1495 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1496 | } |
---|
1497 | STACK_PEnbinter->Draw(); |
---|
1498 | if( th2 ) { |
---|
1499 | hcopy = (TH1F*)th2->Clone(); |
---|
1500 | hcopy->Add(th4,-1); |
---|
1501 | hcopy->SetLineWidth(2); |
---|
1502 | hcopy->SetLineColor(1); |
---|
1503 | hcopy->SetFillColor(0); |
---|
1504 | hcopy->SetTitle("Scattering order contribution > 3 sigma"); |
---|
1505 | histonb = TString(" Total "); |
---|
1506 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1507 | histonb += TString(" "); |
---|
1508 | histonb += TString(txt); |
---|
1509 | hcopy->Draw("same"); |
---|
1510 | leg->AddEntry(hcopy,histonb.Data(),"l"); |
---|
1511 | } |
---|
1512 | leg->Draw(); |
---|
1513 | } |
---|
1514 | |
---|
1515 | // nb of scattering in atmo contribution -- triggered only |
---|
1516 | else if ( option == "PEtime_atmonbinter_trigg" ) { |
---|
1517 | TString prefix("Pe_nbinter"); |
---|
1518 | TString suffix("_trigg"); |
---|
1519 | TString prefix2("order "); |
---|
1520 | TString histonb(prefix); |
---|
1521 | THStack* STACK_PEnbinter_trigg = new THStack("STACK_PEnbinter_trigg","Scattering order contribution -- triggered pe^{-}"); |
---|
1522 | th = GetTimeHisto("Pe_total_trigg"); |
---|
1523 | th1 = GetTimeHisto("Pe_bgnd_trigg"); |
---|
1524 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1525 | if( th ) { |
---|
1526 | hcopy = (TH1F*)th->Clone(); |
---|
1527 | hcopy->SetLineColor(1); |
---|
1528 | hcopy->SetFillColor(0); |
---|
1529 | hcopy->SetTitle("Scattering order contributions - Triggered pe^{-}"); |
---|
1530 | histonb = TString(" Total "); |
---|
1531 | histonb += hcopy->Integral(); |
---|
1532 | histonb += TString(" "); |
---|
1533 | hcopy->Draw(); |
---|
1534 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1535 | } |
---|
1536 | for (Int_t i=0; i<=fMaxScatOrder; i++) { |
---|
1537 | histonb = prefix; |
---|
1538 | histonb += i; |
---|
1539 | histonb += suffix; |
---|
1540 | th = (TH1F*)fHistos->FindObject(histonb.Data()); |
---|
1541 | if( th ) { |
---|
1542 | hcopy = (TH1F*)th->Clone(); |
---|
1543 | histonb = prefix2; |
---|
1544 | histonb += i; |
---|
1545 | histonb += TString(" "); |
---|
1546 | histonb += hcopy->Integral(); |
---|
1547 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1548 | hcopy->SetFillColor(i+2); |
---|
1549 | STACK_PEnbinter_trigg->Add(hcopy); |
---|
1550 | } |
---|
1551 | else Printf("<Draw TimeHistos> Wrong histo identification %s",histonb.Data()); |
---|
1552 | } |
---|
1553 | if( th1 ) { |
---|
1554 | hcopy = (TH1F*)th1->Clone(); |
---|
1555 | hcopy->SetFillColor(17); |
---|
1556 | histonb = TString(" Bgnd "); |
---|
1557 | histonb += hcopy->Integral(); |
---|
1558 | histonb += TString(" "); |
---|
1559 | STACK_PEnbinter_trigg->Add(hcopy); |
---|
1560 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1561 | } |
---|
1562 | STACK_PEnbinter_trigg->Draw("same"); |
---|
1563 | leg->Draw(); |
---|
1564 | } |
---|
1565 | |
---|
1566 | // nb of scattering in atmo contribution -- triggered only -- Bgnd substracted |
---|
1567 | else if ( option == "PEtime_atmonbinter_trigg_bgndsub" ) { |
---|
1568 | char txt[200]; |
---|
1569 | TString prefix("Pe_nbinter"); |
---|
1570 | TString suffix("_trigg"); |
---|
1571 | TString prefix2("order "); |
---|
1572 | TString histonb(prefix); |
---|
1573 | THStack* STACK_PEnbinter_trigg = new THStack("STACK_PEnbinter_trigg_bgndsub","Scattering order contribution -- triggered pe^{-} -- <B> substracted"); |
---|
1574 | th2 = GetTimeHisto("Pe_total_trigg"); |
---|
1575 | th1 = GetTimeHisto("Pe_bgnd_trigg"); |
---|
1576 | th4 = GetTimeHisto("Nbpixels_GTU_trigg"); |
---|
1577 | TLegend* leg = new TLegend(0.6,0.2,0.9,0.9); |
---|
1578 | TLegend* leg_warning = new TLegend(0.3,0.8,0.6,0.9); |
---|
1579 | for (Int_t i=0; i<=fMaxScatOrder; i++) { |
---|
1580 | histonb = prefix; |
---|
1581 | histonb += i; |
---|
1582 | histonb += suffix; |
---|
1583 | th = (TH1F*)fHistos->FindObject(histonb.Data()); |
---|
1584 | if( th ) { |
---|
1585 | hcopy = (TH1F*)th->Clone(); |
---|
1586 | histonb = prefix2; |
---|
1587 | histonb += i; |
---|
1588 | histonb += TString(" "); |
---|
1589 | histonb += hcopy->Integral(); |
---|
1590 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1591 | hcopy->SetFillColor(i+2); |
---|
1592 | STACK_PEnbinter_trigg->Add(hcopy); |
---|
1593 | } |
---|
1594 | else Printf("<Draw TimeHistos> Wrong histo identification %s",histonb.Data()); |
---|
1595 | } |
---|
1596 | if( th1 ) { |
---|
1597 | hcopy = (TH1F*)th1->Clone(); |
---|
1598 | hcopy->Add(th4,-1); |
---|
1599 | hcopy->SetFillColor(17); |
---|
1600 | histonb = TString(" Bgnd "); |
---|
1601 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1602 | histonb += TString(" "); |
---|
1603 | histonb += TString(txt); |
---|
1604 | STACK_PEnbinter_trigg->Add(hcopy); |
---|
1605 | leg->AddEntry(hcopy,histonb.Data(),"f"); |
---|
1606 | } |
---|
1607 | STACK_PEnbinter_trigg->Draw(""); |
---|
1608 | if( th2 ) { |
---|
1609 | hcopy = (TH1F*)th2->Clone(); |
---|
1610 | hcopy->Add(th4,-1); |
---|
1611 | hcopy->SetLineWidth(2); |
---|
1612 | hcopy->SetLineColor(1); |
---|
1613 | hcopy->SetFillColor(0); |
---|
1614 | hcopy->SetTitle("Scattering order contributions - Triggered pe^{-}"); |
---|
1615 | histonb = TString(" Total "); |
---|
1616 | sprintf(txt,"%.2f",hcopy->Integral()); |
---|
1617 | histonb += TString(" "); |
---|
1618 | histonb += TString(txt); |
---|
1619 | hcopy->Draw("same"); |
---|
1620 | leg->AddEntry(hcopy,histonb.Data(),"l"); |
---|
1621 | leg_warning->AddEntry(hcopy,"OK only if trigg = 4#sigma",""); |
---|
1622 | } |
---|
1623 | leg->Draw(); |
---|
1624 | } |
---|
1625 | |
---|
1626 | // ************************************ FoV ***************************************// |
---|
1627 | else if ( option == "Pe_Fov_all" ) { |
---|
1628 | h2Dint = GetFoVHisto("Pe_Fov_all"); |
---|
1629 | h2Dint->Draw("box"); |
---|
1630 | } |
---|
1631 | |
---|
1632 | else if ( option == "Pe_Fov_trigg" ) { |
---|
1633 | h2Dint = GetFoVHisto("Pe_Fov_trigg"); |
---|
1634 | h2Dint->Draw("box"); |
---|
1635 | } |
---|
1636 | |
---|
1637 | else if ( option == "Pe_Fov_0sigma" ) { |
---|
1638 | h2Dint = GetFoVHisto("Pe_Fov_0sigma"); |
---|
1639 | h2Dint->Draw("box"); |
---|
1640 | } |
---|
1641 | |
---|
1642 | else if ( option == "Pe_Fov_1sigma" ) { |
---|
1643 | h2Dint = GetFoVHisto("Pe_Fov_1sigma"); |
---|
1644 | h2Dint->Draw("box"); |
---|
1645 | } |
---|
1646 | |
---|
1647 | else if ( option == "Pe_Fov_2sigma" ) { |
---|
1648 | h2Dint = GetFoVHisto("Pe_Fov_2sigma"); |
---|
1649 | h2Dint->Draw("box"); |
---|
1650 | } |
---|
1651 | |
---|
1652 | else if ( option == "Pe_Fov_3sigma" ) { |
---|
1653 | h2Dint = GetFoVHisto("Pe_Fov_3sigma"); |
---|
1654 | h2Dint->Draw("box"); |
---|
1655 | } |
---|
1656 | |
---|
1657 | |
---|
1658 | // ************************************ WAVELENGTH ***************************************// |
---|
1659 | /* // all w.r.t type |
---|
1660 | TH1F *th03 = GetWlHisto("Pe_wl_fluo","Fluo signal PhotoElectrons vs wl"); |
---|
1661 | TH1F *th031 = GetWlHisto("Pe_wl_ckov","Ckov signal PhotoElectrons vs wl"); |
---|
1662 | // only triggered |
---|
1663 | TH1F *th13 = GetWlHisto("Pe_wl_fluo_trigg","Fluo signal Triggered PhotoElectrons vs wl"); |
---|
1664 | TH1F *th131 = GetWlHisto("Pe_wl_ckov_trigg","Ckov signal Triggered PhotoElectrons vs wl"); |
---|
1665 | */ |
---|
1666 | |
---|
1667 | // FLUO spectrum at pe- level |
---|
1668 | else if ( option == "PEwl_fluo" ) { |
---|
1669 | th1 = GetWlHisto("Pe_wl_fluo"); |
---|
1670 | th2 = GetWlHisto("Pe_wl_fluo_trigg"); |
---|
1671 | if ( th1 ) { |
---|
1672 | hcopy = (TH1F*)th1->DrawCopy(""); |
---|
1673 | hcopy->SetFillColor(2); |
---|
1674 | } |
---|
1675 | if ( th2 ) { |
---|
1676 | hcopy = (TH1F*)th2->DrawCopy("same"); |
---|
1677 | hcopy->SetFillColor(4); |
---|
1678 | } |
---|
1679 | } |
---|
1680 | |
---|
1681 | // CKOV spectrum at pe- level |
---|
1682 | else if ( option == "PEwl_ckov" ) { |
---|
1683 | th1 = GetWlHisto("Pe_wl_ckov"); |
---|
1684 | th2 = GetWlHisto("Pe_wl_ckov_trigg"); |
---|
1685 | if ( th1 ) { |
---|
1686 | hcopy = (TH1F*)th1->DrawCopy(""); |
---|
1687 | hcopy->SetFillColor(2); |
---|
1688 | } |
---|
1689 | if ( th2 ) { |
---|
1690 | hcopy = (TH1F*)th2->DrawCopy("same"); |
---|
1691 | hcopy->SetFillColor(4); |
---|
1692 | } |
---|
1693 | } |
---|
1694 | |
---|
1695 | } |
---|
1696 | |
---|
1697 | |
---|