]>
Commit | Line | Data |
---|---|---|
3d9550f8 | 1 | //fbellini@cern.ch, 11/11/2011 |
2 | //----------------------------------------------------------- | |
3 | Int_t MakeTrendingTOFQA(char * runlist, Int_t year=2011, char *period="LHC11d", char* pass="cpass1", Int_t trainId=0){ | |
4 | Int_t filesCounter=0; | |
5 | ||
6 | if (!runlist) { | |
7 | printf("Invalid list of runs given as input: nothing done\n"); | |
8 | return 1; | |
9 | } | |
10 | Int_t runNumber; | |
11 | char infile[300]; | |
12 | char postFileName[20]; | |
13 | ||
14 | char trendFileName[100]; | |
15 | //Define trending output | |
16 | if (trainId==0){ | |
17 | sprintf(trendFileName,"treeTOFQA_%s_%s.root",period,pass); | |
18 | }else{ | |
19 | sprintf(trendFileName,"treeTOFQA_QA%i_%s_%s.root",trainId,period,pass); | |
20 | } | |
21 | TFile * trendFile=new TFile(trendFileName,"recreate"); | |
22 | ||
23 | Double_t avTime=-9999., peakTime=-9999., spreadTime=-9999., peakTimeErr=-9999., spreadTimeErr=-9999., negTimeRatio=-9999., | |
24 | avRawTime=-9999., peakRawTime=-9999., spreadRawTime=-9999., peakRawTimeErr=-9999., spreadRawTimeErr=-9999., | |
25 | avTot=-9999., peakTot=-9999.,spreadTot=-9999., peakTotErr=-9999.,spreadTotErr=-9999., | |
26 | orphansRatio=-9999., avL=-9999., negLratio=-9999., | |
27 | effPt1=-9999., effPt2=-9999., matchEffLinFit1Gev=-9999.,matchEffLinFit1GevErr=-9999.; | |
28 | ||
29 | Double_t avPiDiffTime=-9999.,peakPiDiffTime=-9999., spreadPiDiffTime=-9999.,peakPiDiffTimeErr=-9999., spreadPiDiffTimeErr=-9999.; | |
30 | ||
31 | Double_t avT0A=-9999.,peakT0A=-9999., spreadT0A=-9999.,peakT0AErr=-9999., spreadT0AErr=-9999.; | |
32 | Double_t avT0C=-9999.,peakT0C=-9999., spreadT0C=-9999.,peakT0CErr=-9999., spreadT0CErr=-9999.; | |
33 | Double_t avT0AC=-9999.,peakT0AC=-9999., spreadT0AC=-9999.,peakT0ACErr=-9999., spreadT0ACErr=-9999.; | |
34 | Double_t avT0res=-9999.,peakT0res=-9999., spreadT0res=-9999.,peakT0resErr=-9999., spreadT0resErr=-9999.; | |
35 | Double_t avT0fillRes=-9999.; | |
36 | ||
37 | Int_t avMulti=0; | |
38 | Float_t fractionEventsWHits=-9999.; | |
39 | ||
40 | TTree * ttree=new TTree("trendTree","tree of trending variables"); | |
41 | ttree->Branch("run",&runNumber,"run/I"); | |
42 | ttree->Branch("avMulti",&avMulti,"avMulti/I"); | |
43 | ttree->Branch("fractionEventsWHits",&fractionEventsWHits,"fractionEventsWHits/F"); | |
44 | ttree->Branch("avTime",&avTime,"avTime/D"); //mean time | |
45 | ttree->Branch("peakTime",&peakTime,"peakTime/D"); //main peak time after fit | |
46 | ttree->Branch("spreadTime",&spreadTime,"spreadTime/D"); //spread of main peak of time after fit | |
47 | ttree->Branch("peakTimeErr",&peakTimeErr,"peakTimeErr/D"); //main peak time after fit error | |
48 | ttree->Branch("spreadTimeErr",&spreadTimeErr,"spreadTimeErr/D"); //spread of main peak of time after fit error | |
49 | ttree->Branch("negTimeRatio",&negTimeRatio,"negTimeRatio/D"); //negative time ratio | |
50 | ||
51 | ttree->Branch("avRawTime",&avRawTime,"avRawTime/D"); //mean raw time | |
52 | ttree->Branch("peakRawTime",&peakRawTime,"peakRawTime/D"); //mean peak of RAW TIME after fit | |
53 | ttree->Branch("spreadRawTime",&spreadRawTime,"spreadRawTime/D"); //spread of main peak of raw time after fit | |
54 | ttree->Branch("peakRawTimeErr",&peakRawTimeErr,"peakRawTimeErr/D"); //main peak raw time after fit error | |
55 | ttree->Branch("spreadRawTimeErr",&spreadRawTimeErr,"spreadRawTimeErr/D"); //spread of raw main peak of time after fit error | |
56 | ||
57 | ttree->Branch("avTot",&avTot,"avTot/D"); //main peak tot | |
58 | ttree->Branch("peakTot",&peakTot,"peakTot/D"); // main peak of tot after fit | |
59 | ttree->Branch("spreadTot",&spreadTot,"spreadTot/D"); //spread of main peak of tot after fit | |
60 | ttree->Branch("peakTotErr",&peakTotErr,"peakTotErr/D"); // main peak of tot after fit | |
61 | ttree->Branch("spreadTotErr",&spreadTotErr,"spreadTotErr/D"); //spread of main peak of tot after fit | |
62 | ||
63 | ttree->Branch("orphansRatio",&orphansRatio,"orphansRatio/D"); //orphans ratio | |
64 | ||
65 | ttree->Branch("avL",&avL,"avL/D"); //mean track length | |
66 | ttree->Branch("negLratio",&negLratio,"negLratio/D");//ratio of tracks with track length <350 cm | |
67 | ||
68 | ttree->Branch("effPt1",&effPt1,"effPt1/D");//matching eff at 1 GeV/c | |
69 | ttree->Branch("effPt2",&effPt2,"effPt2/D"); //matching eff at 2 GeV/c | |
70 | ttree->Branch("matchEffLinFit1Gev",&matchEffLinFit1Gev,"matchEffLinFit1Gev/D");//matching eff fit param | |
71 | ttree->Branch("matchEffLinFit1GevErr",&matchEffLinFit1GevErr,"matchEffLinFit1GevErr/D");////matching eff fit param error | |
72 | ||
73 | ttree->Branch("avPiDiffTime",&avPiDiffTime,"avPiDiffTime/D"); //mean t-texp | |
74 | ttree->Branch("peakPiDiffTime",&peakPiDiffTime,"peakPiDiffTime/D"); //main peak t-texp after fit | |
75 | ttree->Branch("spreadPiDiffTime",&spreadPiDiffTime,"spreadPiDiffTime/D"); //spread of main peak t-texp after fit | |
76 | ttree->Branch("peakPiDiffTimeErr",&peakPiDiffTimeErr,"peakPiDiffTimeErr/D"); //main peak t-texp after fit error | |
77 | ttree->Branch("spreadPiDiffTimeErr",&spreadPiDiffTimeErr,"spreadPiDiffTimeErr/D"); //spread of main peak of t-texp after fit error | |
78 | ||
79 | ttree->Branch("avT0A",&avT0A,"avT0A/D"); //main peak t0A | |
80 | ttree->Branch("peakT0A",&peakT0A,"peakT0A/D"); // main peak of t0A after fit | |
81 | ttree->Branch("spreadT0A",&spreadT0A,"spreadTot/D"); //spread of main peak of t0A after fit | |
82 | ttree->Branch("peakT0AErr",&peakT0AErr,"peakT0AErr/D"); // main peak of t0A after fit | |
83 | ttree->Branch("spreadT0AErr",&spreadT0AErr,"spreadT0AErr/D"); //spread of main peak of t0A after fit | |
84 | ||
85 | ttree->Branch("avT0C",&avT0C,"avT0C/D"); //main peak t0C | |
86 | ttree->Branch("peakT0C",&peakT0C,"peakT0C/D"); // main peak of t0C after fit | |
87 | ttree->Branch("spreadT0C",&spreadT0C,"spreadT0C/D"); //spread of main peak of t0C after fit | |
88 | ttree->Branch("peakT0CErr",&peakT0CErr,"peakT0CErr/D"); // main peak of t0C after fit | |
89 | ttree->Branch("spreadT0CErr",&spreadT0CErr,"spreadT0CErr/D"); //spread of main peak of t0C after fit | |
90 | ||
91 | ttree->Branch("avT0AC",&avT0AC,"avT0AC/D"); //main peak t0AC | |
92 | ttree->Branch("peakT0AC",&peakT0AC,"peakT0AC/D"); // main peak of t0AC after fit | |
93 | ttree->Branch("spreadT0AC",&spreadT0AC,"spreadT0AC/D"); //spread of main peak of t0AC after fit | |
94 | ttree->Branch("peakT0ACErr",&peakT0ACErr,"peakT0ACErr/D"); // main peak of t0AC after fit | |
95 | ttree->Branch("spreadT0ACErr",&spreadT0ACErr,"spreadT0ACErr/D"); //spread of main peak of t0AC after fit | |
96 | ||
97 | ttree->Branch("avT0res",&avT0res,"avT0res/D"); //main peak t0AC | |
98 | ttree->Branch("peakT0res",&peakT0res,"peakT0res/D"); // main peak of t0AC after fit | |
99 | ttree->Branch("spreadT0res",&spreadT0res,"spreadT0res/D"); //spread of main peak of t0AC after fit | |
100 | ttree->Branch("peakT0resErr",&peakT0resErr,"peakT0resErr/D"); // main peak of t0AC after fit | |
101 | ttree->Branch("spreadT0resErr",&spreadT0resErr,"spreadT0resErr/D"); //spread of main peak of t0AC after fit | |
102 | ttree->Branch("avT0fillRes",&avT0fillRes,"avT0fillRes/D"); //t0 fill res | |
103 | ||
104 | ||
105 | FILE * files = fopen(runlist, "r") ; | |
106 | while (fscanf(files,"%d",&runNumber)==1 ){ | |
107 | ||
108 | //reset all variables | |
109 | avTime=-9999.; peakTime=-9999.; spreadTime=-9999.; peakTimeErr=-9999.; spreadTimeErr=-9999.;negTimeRatio=-9999.; | |
110 | avRawTime=-9999.; peakRawTime=-9999.; spreadRawTime=-9999.; peakRawTimeErr=-9999.; spreadRawTimeErr=-9999.; | |
111 | avTot=-9999.; peakTot=-9999.;spreadTot=-9999.; peakTotErr=-9999.;spreadTotErr=-9999.; | |
112 | orphansRatio=-9999.; avL=-9999.; negLratio=-9999.; | |
113 | effPt1=-9999.; effPt2=-9999.; matchEffLinFit1Gev=-9999.;matchEffLinFit1GevErr=-9999.; | |
114 | ||
115 | avPiDiffTime=-9999.;peakPiDiffTime=-9999.; spreadPiDiffTime=-9999.;peakPiDiffTimeErr=-9999.; spreadPiDiffTimeErr=-9999.; | |
116 | ||
117 | avT0A=-9999.;peakT0A=-9999.; spreadT0A=-9999.;peakT0AErr=-9999.; spreadT0AErr=-9999.; | |
118 | avT0C=-9999.;peakT0C=-9999.; spreadT0C=-9999.;peakT0CErr=-9999.; spreadT0CErr=-9999.; | |
119 | avT0AC=-9999.;peakT0AC=-9999.; spreadT0AC=-9999.;peakT0ACErr=-9999.; spreadT0ACErr=-9999.; | |
120 | avT0res=-9999.;peakT0res=-9999.; spreadT0res=-9999.;peakT0resErr=-9999.; spreadT0resErr=-9999.; | |
121 | avMulti=0; avT0fillRes=0.; | |
122 | fractionEventsWHits=-9999.; | |
123 | ||
124 | //get QAtrain output | |
125 | //SetQAtrainOutputName(runNumber, year,period,pass,trainId); | |
126 | if (trainId==0){ | |
127 | sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QAresults.root",year,period,runNumber,pass); | |
128 | } else{ | |
129 | sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId); | |
130 | } | |
131 | printf("============== Opening QA file(s) for run %i =======================\n",runNumber); | |
132 | ||
133 | ||
134 | //run post-analysis | |
135 | if (RunESDQApostAnalysis(infile,runNumber,kTRUE)==0){ | |
136 | filesCounter++; | |
137 | ||
138 | //get post-analysis output | |
139 | sprintf(postFileName,"postQA_%i.root",runNumber); | |
140 | TFile *postfile=TFile::Open(postFileName); | |
141 | if (!postfile) { | |
142 | printf("Post-analysis output not found - cannot perform trending analysis. Exiting."); | |
143 | return 2; | |
144 | } else { | |
145 | printf("============== Retrieving post-analysis for run %i ===============\n",runNumber); | |
146 | } | |
147 | //postfile->ls(); | |
148 | //save quantities for trending | |
149 | ||
150 | //--------------------------------- Multiplicity ----------------------------------// | |
151 | TH1F*hMulti=(TH1F*)postfile->Get("hTOFmatchedPerEvt"); | |
152 | if ((hMulti)&&(hMulti->GetEntries()>0)) { | |
153 | avMulti=hMulti->GetMean(); | |
154 | } | |
155 | ||
156 | //--------------------------------- T0F signal ----------------------------------// | |
157 | ||
158 | TH1F*hTime=(TH1F*)postfile->Get("hTOFmatchedESDtime"); | |
159 | if ((hTime)&&(hTime->GetEntries()>0)) { | |
160 | avTime=hTime->GetMean(); | |
161 | hTime->Fit("landau","","",0.,50.); | |
162 | peakTime=(hTime->GetFunction("landau"))->GetParameter(1); | |
163 | spreadTime=(hTime->GetFunction("landau"))->GetParameter(2); | |
164 | peakTimeErr=(hTime->GetFunction("landau"))->GetParError(1); | |
165 | spreadTimeErr=(hTime->GetFunction("landau"))->GetParError(2); | |
166 | ||
167 | negTimeRatio=((Double_t)hTime->Integral(1,3)*100.)/((Double_t)hTime->Integral()); | |
168 | printf("Main peak time (landau): mean = %f +- %f\n",peakTime,peakTimeErr ); | |
169 | printf("Main peak time (landau): spread = %f +- %f\n",spreadTime,spreadTimeErr ); | |
170 | printf("Ratio of tracks with time<12.5 ns / total = %f\n",negTimeRatio ); | |
171 | ||
172 | //add integral of main peak over total | |
173 | } | |
174 | printf("---------------------------------------------------------------- \n"); | |
175 | TH1F * hRawTime = (TH1F*)postfile->Get("hTOFmatchedESDrawTime"); | |
176 | if ((hRawTime)&&(hRawTime->GetEntries()>0)){ | |
177 | avRawTime=hRawTime->GetMean(); | |
178 | hRawTime->Fit("landau","","",200.,250.); | |
179 | peakRawTime=(hRawTime->GetFunction("landau"))->GetParameter(1); | |
180 | spreadRawTime=(hRawTime->GetFunction("landau"))->GetParameter(2); | |
181 | peakRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(1); | |
182 | spreadRawTimeErr=(hRawTime->GetFunction("landau"))->GetParError(2); | |
183 | printf("Main peak raw time (landau): mean = %f +- %f\n",peakTime,peakTimeErr ); | |
184 | printf("Main peak raw time (landau): spread = %f +- %f\n",spreadRawTime,spreadRawTimeErr ); | |
185 | } | |
186 | ||
187 | printf("---------------------------------------------------------------- \n"); | |
188 | ||
189 | TH1F * hTot = (TH1F*)postfile->Get("hTOFmatchedESDToT"); | |
190 | if ((hTot)&&(hTot->GetEntries()>0)){ | |
191 | avTot=hTot->GetMean(); | |
192 | hTot->Fit("gaus","","",0.,50.); | |
193 | peakTot=(hTot->GetFunction("gaus"))->GetParameter(1); | |
194 | spreadTot=(hTot->GetFunction("gaus"))->GetParameter(2); | |
195 | peakTotErr=(hTot->GetFunction("gaus"))->GetParError(1); | |
196 | spreadTotErr=(hTot->GetFunction("gaus"))->GetParError(2); | |
197 | printf("Main peak ToT (gaus): mean = %f +- %f\n",peakTot,peakTotErr ); | |
198 | printf("Main peak ToT (gaus): spread = %f +- %f\n",spreadTot,spreadTotErr ); | |
199 | } | |
200 | printf("---------------------------------------------------------------- \n"); | |
201 | TH1F * hOrphansRatio=(TH1F*)postfile->Get("hOrphansRatio"); | |
202 | if (hOrphansRatio) | |
203 | orphansRatio=hOrphansRatio->GetMean(); | |
204 | ||
205 | TH1F * hL=(TH1F*)postfile->Get("hTOFmatchedESDtrkLength"); | |
206 | if (hL) | |
207 | avL=hL->GetMean(); | |
208 | ||
209 | TH1F *hLnegRatio =(TH1F*)postfile->Get("hLnegRatio"); | |
210 | if (hLnegRatio) | |
211 | negLratio=hLnegRatio->GetMean(); | |
212 | ||
213 | //--------------------------------- matching eff ----------------------------------// | |
214 | ||
215 | //Double_t linFitEff1Param[3]={0.,0.,0.}; | |
216 | TH1F *hMatchingVsPt =(TH1F*)postfile->Get("hTOFmatchedESDPt"); | |
217 | if (hMatchingVsPt) { | |
218 | if (hMatchingVsPt->GetEntries()>0){ | |
219 | hMatchingVsPt->Fit("pol0","","",1.0,5.); | |
220 | hMatchingVsPt->Draw(); | |
221 | if (hMatchingVsPt->GetFunction("pol0")){ | |
222 | matchEffLinFit1Gev=(hMatchingVsPt->GetFunction("pol0"))->GetParameter(0); | |
223 | matchEffLinFit1GevErr=(hMatchingVsPt->GetFunction("pol0"))->GetParError(0); | |
224 | printf("Matching efficiency fit param is %f +- %f\n",matchEffLinFit1Gev,matchEffLinFit1GevErr ); | |
225 | } | |
226 | } else { | |
227 | printf("WARNING: matching efficiency plot has 0 entries. Skipped!\n"); | |
228 | } | |
229 | } else { | |
230 | printf("WARNING: cannot retrieve matching efficiency plot\n"); | |
231 | } | |
232 | ||
233 | //--------------------------------- t-texp ----------------------------------// | |
234 | ||
235 | TH1F*hPiDiffTime=(TH1F*)postfile->Get("hTOFmatchedExpTimePi"); | |
236 | if ((hPiDiffTime)&&(hPiDiffTime->GetEntries()>0)) { | |
237 | avPiDiffTime=hPiDiffTime->GetMean(); | |
238 | hPiDiffTime->Fit("gaus","","",-1000.,500.); | |
239 | if (hPiDiffTime->GetFunction("gaus")){ | |
240 | peakPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(1); | |
241 | spreadPiDiffTime=(hPiDiffTime->GetFunction("gaus"))->GetParameter(2); | |
242 | peakPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(1); | |
243 | spreadPiDiffTimeErr=(hPiDiffTime->GetFunction("gaus"))->GetParError(2); | |
244 | printf("Main peak t-t_exp (gaus): mean = %f +- %f\n",peakPiDiffTime,peakPiDiffTimeErr ); | |
245 | printf("Main peak t-t_exp (gaus): spread = %f +- %f\n",spreadPiDiffTime,spreadPiDiffTimeErr ); | |
246 | } | |
247 | } | |
248 | //--------------------------------- T0 detector ----------------------------------// | |
249 | ||
250 | TH1F*hT0A=(TH1F*)postfile->Get("hEventT0DetA"); | |
251 | if ((hT0A)&&(hT0A->GetEntries()>0)) { | |
252 | avhT0A=hT0A->GetMean(); | |
253 | hT0A->Fit("gaus"); | |
254 | peakT0A=(hT0A->GetFunction("gaus"))->GetParameter(1); | |
255 | spreadT0A=(hT0A->GetFunction("gaus"))->GetParameter(2); | |
256 | peakT0AErr=(hT0A->GetFunction("gaus"))->GetParError(1); | |
257 | spreadT0AErr=(hT0A->GetFunction("gaus"))->GetParError(2); | |
258 | printf("Main peak T0A(gaus): mean = %f +- %f\n",peakT0A,peakT0AErr ); | |
259 | printf("Main peak T0A (gaus): spread = %f +- %f\n",spreadT0A,spreadT0AErr ); | |
260 | //add integral of main peak over total | |
261 | } | |
262 | ||
263 | TH1F*hT0C=(TH1F*)postfile->Get("hEventT0DetC"); | |
264 | if ((hT0C)&&(hT0C->GetEntries()>0)) { | |
265 | avhT0C=hT0C->GetMean(); | |
266 | hT0C->Fit("gaus"); | |
267 | peakT0C=(hT0C->GetFunction("gaus"))->GetParameter(1); | |
268 | spreadT0C=(hT0C->GetFunction("gaus"))->GetParameter(2); | |
269 | peakT0CErr=(hT0C->GetFunction("gaus"))->GetParError(1); | |
270 | spreadT0CErr=(hT0C->GetFunction("gaus"))->GetParError(2); | |
271 | printf("Main peak T0C(gaus): mean = %f +- %f\n",peakT0C,peakT0CErr ); | |
272 | printf("Main peak T0C (gaus): spread = %f +- %f\n",spreadT0C,spreadT0CErr ); | |
273 | //add integral of main peak over total | |
274 | } | |
275 | ||
276 | TH1F*hT0AC=(TH1F*)postfile->Get("hEventT0DetAND"); | |
277 | if ((hT0AC)&&(hT0AC->GetEntries()>0)) { | |
278 | avhT0AC=hT0AC->GetMean(); | |
279 | hT0AC->Fit("gaus"); | |
280 | peakT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(1); | |
281 | spreadT0AC=(hT0AC->GetFunction("gaus"))->GetParameter(2); | |
282 | peakT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(1); | |
283 | spreadT0ACErr=(hT0AC->GetFunction("gaus"))->GetParError(2); | |
284 | printf("Main peak T0AC(gaus): mean = %f +- %f\n",peakT0AC,peakT0ACErr ); | |
285 | printf("Main peak T0AC (gaus): spread = %f +- %f\n",spreadT0AC,spreadT0ACErr ); | |
286 | } | |
287 | ||
288 | TH1F*hT0res=(TH1F*)postfile->Get("hT0DetRes"); | |
289 | if ((hT0res)&&(hT0res->GetEntries()>0)) { | |
290 | avhT0res=hT0res->GetMean(); | |
291 | hT0res->Fit("gaus"); | |
292 | peakT0res=(hT0res->GetFunction("gaus"))->GetParameter(1); | |
293 | spreadT0res=(hT0res->GetFunction("gaus"))->GetParameter(2); | |
294 | peakT0resErr=(hT0res->GetFunction("gaus"))->GetParError(1); | |
295 | spreadT0resErr=(hT0res->GetFunction("gaus"))->GetParError(2); | |
296 | printf("Main peak T0res(gaus): mean = %f +- %f\n",peakT0res,peakT0resErr ); | |
297 | printf("Main peak T0res (gaus): spread = %f +- %f\n",spreadT0res,spreadT0resErr ); | |
298 | //add integral of main peak over total | |
299 | } | |
300 | ||
301 | TH1F*hT0fillRes=(TH1F*)postfile->Get("hT0fillRes"); | |
302 | if ((hT0fillRes)&&(hT0fillRes->GetEntries()>0)) { | |
303 | avT0fillRes=hT0fillRes->GetMean(); | |
304 | } | |
305 | ||
306 | ttree->Fill(); | |
307 | printf("============== Saving trending quantities for run %i ===============\n",runNumber); | |
308 | if (postfile->IsOpen()) { | |
309 | printf("Trying to close\n"); | |
310 | postfile->Close(); | |
311 | } | |
312 | } else { | |
313 | printf("============== QA for run %i not available - skipping ===============\n",runNumber); | |
314 | } | |
315 | ||
316 | } | |
317 | printf("Number of files processed = %i\n",filesCounter); | |
318 | ||
319 | trendFile->cd(); | |
320 | ttree->Write(); | |
321 | trendFile->Close(); | |
322 | ||
323 | return MakeTrendingFromTreeWithErrors(trendFileName); | |
324 | } | |
325 | ||
326 | //______________________________________________________________________________ | |
327 | ||
328 | Int_t MakeTrendingFromTreeWithErrors(char* trendFileName=NULL){ | |
329 | ||
330 | if (!trendFileName) | |
331 | return 3; | |
332 | ||
333 | TFile *fin=TFile::Open(trendFileName); | |
334 | if (!fin) | |
335 | return 4; | |
336 | Int_t runNumber; | |
337 | Double_t avTime=0., peakTime=0., spreadTime=0., peakTimeErr=0., spreadTimeErr=0.,negTimeRatio=0., | |
338 | avRawTime=0., peakRawTime=0., spreadRawTime=0., peakRawTimeErr=0., spreadRawTimeErr=0., | |
339 | avTot=0., peakTot=0.,spreadTot=0., peakTotErr=0.,spreadTotErr=0., | |
340 | orphansRatio=0., avL=0., negLratio=0., | |
341 | effPt1=0., effPt2=0., matchEffLinFit1Gev=0.,matchEffLinFit1GevErr=0.; | |
342 | Double_t avDiffTime=0.,peakDiffTime=0., spreadDiffTime=0.,peakDiffTimeErr=0., spreadDiffTimeErr=0.,avT0fillRes=0.; | |
343 | ||
344 | Double_t avT0A=0.,peakT0A=0., spreadT0A=0.,peakT0AErr=0., spreadT0AErr=0.; | |
345 | Double_t avT0C=0.,peakT0C=0., spreadT0C=0.,peakT0CErr=0., spreadT0CErr=0.; | |
346 | Double_t avT0AC=0.,peakT0AC=0., spreadT0AC=0.,peakT0ACErr=0., spreadT0ACErr=0.; | |
347 | Double_t avT0res=0.,peakT0res=0., spreadT0res=0.,peakT0resErr=0., spreadT0resErr=0.; | |
348 | Int_t avMulti=0; | |
349 | Float_t fractionEventsWHits=0; | |
350 | ||
351 | TTree * ttree=(TTree*)fin->Get("trendTree"); | |
352 | ttree->SetBranchAddress("run",&runNumber); | |
353 | ||
354 | ttree->SetBranchAddress("avTime",&avTime); //mean time | |
355 | ttree->SetBranchAddress("peakTime",&peakTime); //main peak time after fit | |
356 | ttree->SetBranchAddress("spreadTime",&spreadTime); //spread of main peak of time after fit | |
357 | ttree->SetBranchAddress("peakTimeErr",&peakTimeErr); //main peak time after fit error | |
358 | ttree->SetBranchAddress("spreadTimeErr",&spreadTimeErr); //spread of main peak of time after fit error | |
359 | ||
360 | ttree->SetBranchAddress("negTimeRatio",&negTimeRatio); //negative time ratio | |
361 | ||
362 | ttree->SetBranchAddress("avRawTime",&avRawTime); //mean raw time | |
363 | ttree->SetBranchAddress("peakRawTime",&peakRawTime); //mean peak of raw time after fit | |
364 | ttree->SetBranchAddress("spreadRawTime",&spreadRawTime); //spread of main peak of raw time after fit | |
365 | ttree->SetBranchAddress("peakRawTimeErr",&peakRawTimeErr); //main peak raw time after fit error | |
366 | ttree->SetBranchAddress("spreadRawTimeErr",&spreadRawTimeErr); //spread of raw main peak of time after fit error | |
367 | ||
368 | ttree->SetBranchAddress("avTot",&avTot); //main peak tot | |
369 | ttree->SetBranchAddress("peakTot",&peakTot); // main peak of tot after fit | |
370 | ttree->SetBranchAddress("spreadTot",&spreadTot); //spread of main peak of tot after fit | |
371 | ttree->SetBranchAddress("peakTotErr",&peakTotErr); // main peak of tot after fit | |
372 | ttree->SetBranchAddress("spreadTotErr",&spreadTotErr); //spread of main peak of tot after fit | |
373 | ||
374 | ttree->SetBranchAddress("orphansRatio",&orphansRatio); //orphans ratio | |
375 | ||
376 | ttree->SetBranchAddress("avL",&avL); //mean track length | |
377 | ttree->SetBranchAddress("negLratio",&negLratio);//ratio of tracks with track length <350 cm | |
378 | ||
379 | ttree->SetBranchAddress("effPt1",&effPt1);//matching eff at 1 GeV/c | |
380 | ttree->SetBranchAddress("effPt2",&effPt2); //matching eff at 2 GeV/c | |
381 | ttree->SetBranchAddress("matchEffLinFit1Gev",&matchEffLinFit1Gev);//matching eff fit param | |
382 | ttree->SetBranchAddress("matchEffLinFit1GevErr",&matchEffLinFit1GevErr);////matching eff fit param error | |
383 | ||
384 | ttree->SetBranchAddress("avPiDiffTime",&avDiffTime); //mean t-texp | |
385 | ttree->SetBranchAddress("peakPiDiffTime",&peakDiffTime); //main peak t-texp after fit | |
386 | ttree->SetBranchAddress("spreadPiDiffTime",&spreadDiffTime); //spread of main peak t-texp after fit | |
387 | ttree->SetBranchAddress("peakPiDiffTimeErr",&peakDiffTimeErr); //main peak t-texp after fit error | |
388 | ttree->SetBranchAddress("spreadPiDiffTimeErr",&spreadDiffTimeErr); //spread of main peak of t-texp after fit error | |
389 | ||
390 | ttree->SetBranchAddress("avT0A",&avT0A); //main peak t0A | |
391 | ttree->SetBranchAddress("peakT0A",&peakT0A); // main peak of t0A after fit | |
392 | ttree->SetBranchAddress("spreadT0A",&spreadT0A); //spread of main peak of t0A after fit | |
393 | ttree->SetBranchAddress("peakT0AErr",&peakT0AErr); // main peak of t0A after fit | |
394 | ttree->SetBranchAddress("spreadT0AErr",&spreadT0AErr); //spread of main peak of t0A after fit | |
395 | ||
396 | ttree->SetBranchAddress("avT0C",&avT0C); //main peak t0C | |
397 | ttree->SetBranchAddress("peakT0C",&peakT0C); // main peak of t0C after fit | |
398 | ttree->SetBranchAddress("spreadT0C",&spreadT0C); //spread of main peak of t0C after fit | |
399 | ttree->SetBranchAddress("peakT0CErr",&peakT0CErr); // main peak of t0C after fit | |
400 | ttree->SetBranchAddress("spreadT0CErr",&spreadT0CErr); //spread of main peak of t0C after fit | |
401 | ||
402 | ttree->SetBranchAddress("avT0AC",&avT0AC); //main peak t0AC | |
403 | ttree->SetBranchAddress("peakT0AC",&peakT0AC); // main peak of t0AC after fit | |
404 | ttree->SetBranchAddress("spreadT0AC",&spreadT0AC); //spread of main peak of t0AC after fit | |
405 | ttree->SetBranchAddress("peakT0ACErr",&peakT0ACErr); // main peak of t0AC after fit | |
406 | ttree->SetBranchAddress("spreadT0ACErr",&spreadT0ACErr); //spread of main peak of t0AC after fit | |
407 | ||
408 | ttree->SetBranchAddress("avT0res",&avT0res); //main peak t0AC | |
409 | ttree->SetBranchAddress("peakT0res",&peakT0res); // main peak of t0AC after fit | |
410 | ttree->SetBranchAddress("spreadT0res",&spreadT0res); //spread of main peak of t0AC after fit | |
411 | ttree->SetBranchAddress("peakT0resErr",&peakT0resErr); // main peak of t0AC after fit | |
412 | ttree->SetBranchAddress("spreadT0resErr",&spreadT0resErr); //spread of main peak of t0AC after fit | |
413 | ttree->SetBranchAddress("avT0fillRes",&avT0fillRes); //t0 fill res | |
414 | ||
415 | Int_t nRuns=ttree->GetEntries(); | |
416 | TList lista; | |
417 | ||
418 | TH1F * hAvDiffTimeVsRun=new TH1F("hAvDiffTimeVsRun","hAvDiffTimeVsRun;run;<t^{TOF}-t_{exp,#pi}> (ps)",nRuns,0., nRuns);//, 600, 0. , 600.); | |
419 | hAvDiffTimeVsRun->SetDrawOption("E1"); | |
420 | hAvDiffTimeVsRun->SetMarkerStyle(20); | |
421 | hAvDiffTimeVsRun->SetMarkerColor(kBlue); | |
422 | // hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0); | |
423 | ||
424 | TH1F * hPeakDiffTimeVsRun=new TH1F("hPeakDiffTimeVsRun","hPeakDiffTimeVsRun (gaussian fit) ;run; <t^{TOF}-t_{exp,#pi}> (ps)",nRuns,0., nRuns);//,600, 0. , 600. ); | |
425 | hPeakDiffTimeVsRun->SetDrawOption("E1"); | |
426 | hPeakDiffTimeVsRun->SetMarkerStyle(20); | |
427 | hPeakDiffTimeVsRun->SetMarkerColor(kBlue); | |
428 | ||
429 | TH1F * hSpreadTimeVsRun=new TH1F("hSpreadDiffTimeVsRun","hSpreadDiffTimeVsRun (gaussian fit);run; #sigma(t^{TOF}-t_{exp,#pi}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); | |
430 | hSpreadDiffTimeVsRun->SetDrawOption("E1"); | |
431 | hSpreadDiffTimeVsRun->SetMarkerStyle(20); | |
432 | hSpreadDiffTimeVsRun->SetMarkerColor(kBlue); | |
433 | ||
434 | TH1F * hAvTimeVsRun=new TH1F("hAvTimeVsRun","hAvTimeVsRun;run;<t^{TOF}> (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); | |
435 | hAvTimeVsRun->SetDrawOption("E1"); | |
436 | hAvTimeVsRun->SetMarkerStyle(20); | |
437 | hAvTimeVsRun->SetMarkerColor(kBlue); | |
438 | // hAvTimeVsRun->GetYaxis()->SetRangeUser(0.0, 50.0); | |
439 | ||
440 | TH1F * hPeakTimeVsRun=new TH1F("hPeakTimeVsRun","hPeakTimeVsRun (gaussian fit);run;t_{peak}^{TOF} (ns)",nRuns,0., nRuns);//,600, 0. , 600. ); | |
441 | hPeakTimeVsRun->SetDrawOption("E1"); | |
442 | hPeakTimeVsRun->SetMarkerStyle(20); | |
443 | hPeakTimeVsRun->SetMarkerColor(kBlue); | |
444 | ||
445 | TH1F * hSpreadTimeVsRun=new TH1F("hSpreadTimeVsRun","hSpreadTimeVsRun (gaussian fit);run; #sigma(t^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); | |
446 | hSpreadTimeVsRun->SetDrawOption("E1"); | |
447 | hSpreadTimeVsRun->SetMarkerStyle(20); | |
448 | hSpreadTimeVsRun->SetMarkerColor(kBlue); | |
449 | ||
450 | ||
451 | TH1F * hAvRawTimeVsRun=new TH1F("hAvRawTimeVsRun","hAvRawTimeVsRun;run;<t_{raw}^{TOF}> (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); | |
452 | hAvRawTimeVsRun->SetDrawOption("E1"); | |
453 | hAvRawTimeVsRun->SetMarkerStyle(21); | |
454 | hAvRawTimeVsRun->SetMarkerColor(kGreen); | |
455 | ||
456 | TH1F * hPeakRawTimeVsRun=new TH1F("hPeakRawTimeVsRun","hPeakRawTimeVsRun (gaussian fit);run;t_{peak,raw}^{TOF} (ns)",nRuns,0., nRuns);//, 600, 0. , 600.); | |
457 | hPeakRawTimeVsRun->SetDrawOption("E1"); | |
458 | hPeakRawTimeVsRun->SetMarkerStyle(21); | |
459 | hPeakRawTimeVsRun->SetMarkerColor(kGreen); | |
460 | ||
461 | TH1F * hSpreadRawTimeVsRun=new TH1F("hSpreadRawTimeVsRun","hSpreadRawTimeVsRun (gaussian fit);run;#sigma(t_{raw}^{TOF}) (ns)",nRuns,0., nRuns);//, 100, 0. , 100.); | |
462 | hSpreadRawTimeVsRun->SetDrawOption("E1"); | |
463 | hSpreadRawTimeVsRun->SetMarkerStyle(21); | |
464 | hSpreadRawTimeVsRun->SetMarkerColor(kGreen); | |
465 | ||
466 | TH1F * hAvTotVsRun=new TH1F("hAvTotVsRun","hAvTotVsRun;run;<ToT> (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); | |
467 | hAvTotVsRun->SetDrawOption("E1"); | |
468 | hAvTotVsRun->SetMarkerStyle(22); | |
469 | ||
470 | TH1F * hPeakTotVsRun=new TH1F("hPeakTotVsRun","hPeakTotVsRun (gaussian fit);run;ToT_{peak} (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); | |
471 | hPeakTotVsRun->SetDrawOption("E1"); | |
472 | hPeakTotVsRun->SetMarkerStyle(22); | |
473 | ||
474 | TH1F * hSpreadTotVsRun=new TH1F("hSpreadTotVsRun","hSpreadTotVsRun (gaussian fit);#sigma(ToT) (ns)",nRuns,0., nRuns);//, 50, 0. , 50.); | |
475 | hSpreadTotVsRun->SetDrawOption("E1"); | |
476 | hSpreadTotVsRun->SetMarkerStyle(22); | |
477 | ||
478 | TH1F * hNegTimeRatioVsRun=new TH1F("hNegTimeRatioVsRun","hNegTimeRatioVsRun;run;ratio of tracks with t^{TOF}<12.5 ns (%)",nRuns, 0., nRuns);//, 100, 0. , 100.); | |
479 | hNegTimeRatioVsRun->SetDrawOption("E"); | |
480 | ||
481 | TH1F * hOrphansRatioVsRun=new TH1F("hOrphansRatioVsRun","hOrphansRatioVsRun; run; ratio of orphans (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.); | |
482 | hOrphansRatioVsRun->SetDrawOption("E"); | |
483 | ||
484 | TH1F * hMeanLVsRun=new TH1F("hMeanLVsRun","hMeanLVsRun;run; <L> (cm)",nRuns, 0., nRuns);//, 350, 350. , 700.); | |
485 | hMeanLVsRun->SetDrawOption("E"); | |
486 | TH1F * hNegLRatioVsRun=new TH1F("hNegLRatioVsRun","hNegLRatioVsRun;run; ratio of tracks with L<350 cm (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.); | |
487 | hNegLRatioVsRun->SetDrawOption("E"); | |
488 | TH1F * hMatchEffVsRun=new TH1F("hMatchEffVsRun","hMatchEffVsRun;run;matching efficiency (pT>1.5 GeV/c)",nRuns, 0., nRuns);//, 100, 0. , 1.); | |
489 | hMatchEffVsRun->SetDrawOption("E"); | |
490 | TH1F * hMatchEffVsRun1=new TH1F("hMatchEffVsRun1","hMatchEffVsRun;run;matching efficiency (pT>1.0 GeV/c)",nRuns, 0., nRuns); | |
491 | hMatchEffVsRun1->SetDrawOption("E"); | |
492 | TH1F * hPeakT0AVsRun=new TH1F("hPeakT0AVsRun","hPeakT0AVsRun (gaussian fit);run;t0A (ps)",nRuns,0., nRuns); | |
493 | TH1F * hPeakT0CVsRun=new TH1F("hPeakT0CVsRun","hPeakT0CVsRun (gaussian fit);run;t0AC (ps)",nRuns,0., nRuns); | |
494 | TH1F * hPeakT0ACVsRun=new TH1F("hPeakT0ACVsRun","hPeakT0ACVsRun (gaussian fit);run;t0AC (ps)",nRuns,0., nRuns); | |
495 | TH1F * hT0fillResVsRun=new TH1F("hT0fillResVsRun","hT0fillResVsRun;run;t0_spread (ps)",nRuns,0., nRuns); | |
496 | ||
497 | lista.Add(hAvDiffTimeVsRun); | |
498 | lista.Add(hPeakDiffTimeVsRun); | |
499 | lista.Add(hSpreadDiffTimeVsRun); | |
500 | lista.Add(hAvTimeVsRun); | |
501 | lista.Add(hPeakTimeVsRun); | |
502 | lista.Add(hSpreadTimeVsRun); | |
503 | lista.Add( hAvRawTimeVsRun); | |
504 | lista.Add( hPeakRawTimeVsRun); | |
505 | lista.Add( hSpreadRawTimeVsRun); | |
506 | lista.Add( hAvTotVsRun); | |
507 | lista.Add( hPeakTotVsRun); | |
508 | lista.Add( hSpreadTotVsRun); | |
509 | lista.Add( hNegTimeRatioVsRun); | |
510 | lista.Add( hOrphansRatioVsRun); | |
511 | lista.Add( hMeanLVsRun); | |
512 | lista.Add( hNegLRatioVsRun); | |
513 | lista.Add( hMatchEffVsRun); | |
514 | lista.Add(hPeakT0AVsRun); | |
515 | lista.Add(hPeakT0CVsRun); | |
516 | lista.Add(hPeakT0ACVsRun); | |
517 | lista.Add(hT0fillResVsRun); | |
518 | char runlabel[6]; | |
519 | ||
520 | for (Int_t irun=0;irun<nRuns;irun++){ | |
521 | ttree->GetEntry(irun); | |
522 | ||
523 | sprintf(runlabel,"%i",runNumber); | |
524 | ||
525 | hAvDiffTimeVsRun->SetBinContent(irun+1, avDiffTime); | |
526 | hAvDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
527 | ||
528 | hPeakDiffTimeVsRun->SetBinContent(irun+1,peakDiffTime); | |
529 | hPeakDiffTimeVsRun->SetBinError(irun+1,peakDiffTimeErr); | |
530 | hPeakDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
531 | ||
532 | hSpreadDiffTimeVsRun->SetBinContent(irun+1,spreadDiffTime); | |
533 | hSpreadDiffTimeVsRun->SetBinError(irun+1,spreadDiffTimeErr); | |
534 | hSpreadDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
535 | ||
536 | hAvTimeVsRun->SetBinContent(irun+1, avTime); | |
537 | hAvTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
538 | ||
539 | hPeakTimeVsRun->SetBinContent(irun+1,peakTime); | |
540 | hPeakTimeVsRun->SetBinError(irun+1,peakTimeErr); | |
541 | hPeakTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
542 | ||
543 | hSpreadTimeVsRun->SetBinContent(irun+1,spreadTime); | |
544 | hSpreadTimeVsRun->SetBinError(irun+1,spreadTimeErr); | |
545 | hSpreadTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
546 | ||
547 | hAvRawTimeVsRun->SetBinContent(irun+1, avRawTime); | |
548 | hAvRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
549 | ||
550 | hPeakRawTimeVsRun->SetBinContent(irun+1,peakRawTime); | |
551 | hPeakRawTimeVsRun->SetBinError(irun+1,peakRawTimeErr); | |
552 | hPeakRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
553 | ||
554 | hSpreadRawTimeVsRun->SetBinContent(irun+1,spreadRawTime); | |
555 | hSpreadRawTimeVsRun->SetBinError(irun+1,spreadRawTimeErr); | |
556 | hSpreadRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
557 | ||
558 | hAvTotVsRun->SetBinContent(irun,avTot); | |
559 | hAvTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
560 | ||
561 | hPeakTotVsRun->SetBinContent(irun,peakTot); | |
562 | hPeakTotVsRun->SetBinError(irun+1,peakTotErr); | |
563 | hPeakTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
564 | ||
565 | hSpreadTotVsRun->SetBinContent(irun,spreadTot); | |
566 | hSpreadTotVsRun->SetBinError(irun+1,spreadTotErr); | |
567 | hSpreadTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
568 | ||
569 | hNegTimeRatioVsRun->SetBinContent(irun,negTimeRatio); | |
570 | hNegTimeRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
571 | ||
572 | hOrphansRatioVsRun->SetBinContent(irun,orphansRatio); | |
573 | hOrphansRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
574 | ||
575 | hMeanLVsRun->SetBinContent(irun,avL); | |
576 | hMeanLVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
577 | ||
578 | hNegLRatioVsRun->SetBinContent(irun,negLratio); | |
579 | hNegLRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
580 | ||
581 | hMatchEffVsRun->SetBinContent(irun,matchEffLinFit1Gev); | |
582 | hMatchEffVsRun->SetBinError(irun+1,matchEffLinFit1GevErr); | |
583 | hMatchEffVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
584 | ||
585 | hPeakT0AVsRun->SetBinContent(irun+1,peakT0A); | |
586 | hPeakT0AVsRun->SetBinError(irun+1,spreadT0A); | |
587 | hPeakT0AVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
588 | ||
589 | hPeakT0CVsRun->SetBinContent(irun+1,peakT0C); | |
590 | hPeakT0CVsRun->SetBinError(irun+1,spreadT0C); | |
591 | hPeakT0CVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
592 | ||
593 | hPeakT0ACVsRun->SetBinContent(irun+1,peakT0AC); | |
594 | hPeakT0ACVsRun->SetBinError(irun+1,spreadT0AC); | |
595 | hPeakT0ACVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel); | |
596 | hT0fillResVsRun->SetBinContent(irun+1,avT0fillRes); | |
597 | ||
598 | } | |
599 | ||
600 | char outfilename[200]; | |
601 | sprintf(outfilename, "trend_%s",trendFileName); | |
602 | TFile * fout=new TFile(outfilename,"recreate"); | |
603 | fout->cd(); | |
604 | lista.Write(); | |
605 | fout->Close(); | |
606 | ||
607 | return 0; | |
608 | } | |
609 | ||
610 | //------------------------------------------------------------------------------------ | |
611 | ||
612 | Int_t RunESDQApostAnalysis(char *qafilename=NULL, Int_t runNumber=-1, Bool_t IsOnGrid=kFALSE, Bool_t canvasE=kFALSE) { | |
613 | ||
614 | Bool_t debug=kFALSE; | |
615 | ||
616 | /*access qa PWG1 output files - saved locally or on grid as specified by the second argument */ | |
617 | ||
618 | char defaultQAoutput[30]="QAresults.root"; | |
619 | TGrid::Connect("alien://"); | |
620 | TFile * fin= TFile::Open(qafilename,"r"); | |
621 | printf("Opening file %s\n",qafilename); | |
622 | if (!fin) { | |
623 | printf("ERROR: QA output not found. Exiting with status -1\n"); | |
624 | return -1; | |
625 | } else { | |
626 | printf("INFO: QA output file %s open. \n",fin->GetName()); | |
627 | } | |
628 | ||
629 | ||
630 | //access histograms lists | |
631 | char tofQAdirName[15]="TOF_Performance"; | |
632 | char genListName[15]="cGeneralTOFqa"; | |
633 | char t0ListName[15]="cTimeZeroTOFqa"; | |
634 | char pidListName[15]="cPIDTOFqa"; | |
635 | char posListName[15]="cPositiveTOFqa"; | |
636 | char negListName[15]="cNegativeTOFqa"; | |
637 | ||
638 | TDirectoryFile * tofQAdir=(TDirectoryFile*)fin->Get(tofQAdirName); | |
639 | if(debug){ | |
640 | printf("------------------------------------------------------------------\n"); | |
641 | tofQAdir->ls(); | |
642 | printf("------------------------------------------------------------------\n"); | |
643 | } | |
644 | ||
645 | TList * generalList=(TList*)tofQAdir->Get(genListName); | |
646 | TList *timeZeroList=(TList*)tofQAdir->Get(t0ListName); | |
647 | TList *pidList=(TList*)tofQAdir->Get(pidListName); | |
648 | TList *posList=(TList*)tofQAdir->Get(posListName); | |
649 | TList *negList=(TList*)tofQAdir->Get(negListName); | |
650 | ||
651 | if (!generalList) printf("WARNING: general QA histograms absent or not accessible\n"); | |
652 | if (!timeZeroList) printf("WARNING: timeZero QA histograms absent or not accessible\n"); | |
653 | if (!pidList) printf("WARNING: PID QA histograms absent or not accessible\n"); | |
654 | if (!posList) printf("WARNING: general QA histograms for positive tracks absent or not accessible\n"); | |
655 | if (!negList) printf("WARNING: general QA histograms for negative tracks absent or not accessible\n"); | |
656 | ||
657 | if ( (!generalList) && (!timeZeroList) && (!pidList) ){ | |
658 | printf("ERROR: no QA available \n"); | |
659 | return 1; | |
660 | } | |
661 | ||
662 | if (debug){ | |
663 | generalList->ls(); | |
664 | printf("------------------------------------------------------------------\n"); | |
665 | timeZeroList->ls(); | |
666 | printf("------------------------------------------------------------------\n"); | |
667 | pidList->ls(); | |
668 | printf("------------------------------------------------------------------\n"); | |
669 | } | |
670 | ||
671 | /*set graphic style*/ | |
672 | gStyle->SetCanvasColor(kWhite); | |
673 | gStyle->SetFrameFillColor(kWhite); | |
674 | gStyle->SetFrameBorderMode(0); | |
675 | gStyle->SetCanvasBorderMode(0); | |
676 | gStyle->SetTitleFillColor(kWhite); | |
677 | gStyle->SetTitleBorderSize(0) ; | |
678 | gStyle->SetTitleFont(42); | |
679 | gStyle->SetTextFont(42); | |
680 | gStyle->SetPalette(1); | |
681 | gStyle->SetStatColor(kWhite); | |
682 | gStyle->SetStatBorderSize(1); | |
683 | gStyle->SetOptStat(111111); | |
684 | ||
685 | //DEFINE OUTPUT FILE | |
686 | char outfilename[60]; | |
687 | sprintf(outfilename,"postQA_%i.root",runNumber); | |
688 | TFile * fout=new TFile(outfilename,"recreate"); | |
689 | ||
690 | TH1I* hRunNumber=new TH1I("hRunNumber","hRunNumber;run",1,runNumber,runNumber+1); | |
691 | hRunNumber->Fill(runNumber); | |
692 | ||
693 | //------------------------------------------------------------- | |
694 | /*GENERAL MONITOR - MULTIPLICITY*/ | |
695 | TH1F*hMulti= (TH1F*) generalList->At(0); | |
696 | ||
697 | TH1F* hFractionEventsWhits=new TH1F("hFractionEventsWhits","hFractionEventsWhits;fraction of events with hits (%)",200,0.,100.); | |
698 | Float_t fraction=0.0; | |
699 | if (hMulti->GetEntries()>0.0) fraction=((Float_t) hMulti->GetBinContent(1))/((Float_t) hMulti->GetEntries()); | |
700 | else fraction=0.0; | |
701 | hFractionEventsWhits->Fill(fraction*100.); | |
702 | ||
703 | //------------------------------------------------------------- | |
704 | /*GENERAL MONITOR - TIMING AND GEOMETRY*/ | |
705 | TH1F * hTime = (TH1F*) generalList->At(1); | |
706 | hTime->SetMarkerStyle(8); | |
707 | hTime->SetMarkerSize(0.7); | |
708 | hTime->SetMarkerColor(kBlue); | |
709 | hTime->SetLineColor(kBlue); | |
710 | hTime->SetFillColor(kBlue); | |
711 | hTime->SetFillStyle(3001); | |
712 | hTime->Rebin(2); | |
713 | hTime->GetYaxis()->SetTitle("matched tracks"); | |
714 | hTime->GetYaxis()->SetTitleOffset(1.35); | |
715 | ||
716 | TH1F * hRawTime = (TH1F*) generalList->At(2); | |
717 | hRawTime->SetMarkerStyle(21); | |
718 | hRawTime->SetMarkerSize(0.7); | |
719 | hRawTime->SetMarkerColor(kGreen); | |
720 | hRawTime->SetLineColor(kGreen); | |
721 | hRawTime->SetFillColor(kGreen); | |
722 | hRawTime->SetFillStyle(3001); | |
723 | hRawTime->Rebin(2); | |
724 | hRawTime->GetYaxis()->SetTitle("matched tracks"); | |
725 | hRawTime->GetYaxis()->SetTitleOffset(1.35); | |
726 | ||
727 | TLegend *lTime = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); | |
728 | lTime->SetTextSize(0.04281433); | |
729 | lTime->AddEntry(hRawTime, "raw","L"); | |
730 | lTime->AddEntry(hTime, "ESD","L"); | |
731 | lTime->SetFillColor(kWhite); | |
732 | lTime->SetShadowColor(0); | |
733 | ||
734 | TH1F * hTot = (TH1F*) generalList->At(3); | |
735 | hTot->SetMarkerStyle(8); | |
736 | hTot->SetMarkerSize(0.7); | |
737 | hTot->SetMarkerColor(kViolet-3); | |
738 | hTot->SetLineColor(kViolet-3); | |
739 | hTot->SetFillColor(kViolet-3); | |
740 | hTot->SetFillStyle(3001); | |
741 | //hTime->SetDrawOption(); | |
742 | hTot->GetYaxis()->SetTitle("matched tracks"); | |
743 | hTot->GetYaxis()->SetTitleOffset(1.35); | |
744 | ||
745 | ||
746 | char orphansTxt[200]; | |
747 | Float_t orphansRatio=0.0; | |
748 | if (hTot->GetEntries()>1){ | |
749 | orphansRatio=((Float_t) hTot->GetBinContent(1))/((Float_t) hTot->GetEntries()) ; | |
750 | } | |
751 | sprintf(orphansTxt,"orphans/matched tracks = %.4f ",orphansRatio); | |
752 | TH1F * hOrphansRatio=new TH1F("hOrphansRatio","Percentage of signals with only leading edge; percentage (%)",1000,0.,100.); | |
753 | hOrphansRatio->Fill(orphansRatio*100.); | |
754 | ||
755 | ||
756 | TPaveText *tOrphans = new TPaveText(0.38,0.63,0.88,0.7, "NDC"); | |
757 | //NDC sets coords relative to pad | |
758 | tOrphans->SetBorderSize(0); | |
759 | tOrphans->SetTextSize(0.045); | |
760 | tOrphans->SetFillColor(0); //white background | |
761 | tOrphans->SetTextAlign(12); | |
762 | tOrphans->SetTextColor(kViolet-3); | |
763 | tOrphans->AddText(orphansTxt); | |
764 | ||
765 | TH1F * hL = (TH1F*) generalList->At(4); | |
766 | hL->SetMarkerStyle(8); | |
767 | hL->SetMarkerSize(0.7); | |
768 | hL->SetMarkerColor(kOrange-3); | |
769 | hL->SetLineColor(kOrange-3); | |
770 | hL->SetFillColor(kOrange-3); | |
771 | hL->SetFillStyle(3001); | |
772 | //hTime->SetDrawOption(); | |
773 | hL->GetYaxis()->SetTitle("matched tracks"); | |
774 | hL->GetYaxis()->SetTitleOffset(1.35); | |
775 | ||
776 | char negLengthTxt[200]; | |
777 | Float_t negLengthRatio=0.0; | |
778 | if (hL->GetEntries()>1){ | |
779 | negLengthRatio=(hL->Integral(1,750))/((Float_t) hL->GetEntries()) ; | |
780 | } | |
781 | sprintf(negLengthTxt,"tracks with L<350cm /matched tracks = %.5f ",negLengthRatio); | |
782 | TH1F * hLnegRatio=new TH1F("hLnegRatio","Ratio of TOF-matched tracks with L<350cm; ratio (%)",10000,0.,100.); | |
783 | hLnegRatio->Fill(negLengthRatio*100); | |
784 | ||
785 | ||
786 | ||
787 | TPaveText *tLength = new TPaveText(0.15,0.83,0.65,0.87, "NDC"); | |
788 | //NDC sets coords relative to pad | |
789 | tLength->SetBorderSize(0); | |
790 | tLength->SetTextSize(0.04); | |
791 | tLength->SetFillColor(0); //white background | |
792 | tLength->SetTextAlign(11); | |
793 | tLength->SetTextColor(kOrange-3); | |
794 | tLength->AddText(negLengthTxt); | |
795 | ||
796 | if (canvasE){ | |
797 | TCanvas *cTrackProperties= new TCanvas("cTrackProperties","summary of matched tracks properties",900,900); | |
798 | cTrackProperties->Divide(2,2); | |
799 | cTrackProperties->cd(1); | |
800 | gPad->SetLogy(); | |
801 | hTime->Draw("BAR"); | |
802 | hRawTime ->Draw("BARsame"); | |
803 | lTime->Draw(); | |
804 | cTrackProperties->cd(2); | |
805 | gPad->SetLogy(); | |
806 | hTot->Draw("BAR"); | |
807 | tOrphans->Draw(); | |
808 | cTrackProperties->cd(3); | |
809 | gPad->SetLogy(); | |
810 | hL->Draw("BAR"); | |
811 | tLength->Draw(); | |
812 | } | |
813 | fout->cd(); | |
814 | hRunNumber->Write(); | |
815 | hMulti->Write(); | |
816 | hFractionEventsWhits->Write(); | |
817 | hTime->Write(); | |
818 | hRawTime->Write(); | |
819 | hTot->Write(); | |
820 | hOrphansRatio->Write(); | |
821 | hL->Write(); | |
822 | hLnegRatio->Write(); | |
823 | ||
824 | TH2F* hDxPos4profile = (TH2F*) generalList->At(14); | |
825 | TH2F* hDxNeg4profile = (TH2F*) generalList->At(13); | |
826 | ||
827 | char profilename[30]; | |
828 | const Int_t ybinMin = 0; | |
829 | const Int_t ybinMax =hDxPos4profile->GetYaxis()->GetNbins() ; | |
830 | sprintf(profilename,"profDxPos"); | |
831 | TProfile * profDxPos = (TProfile*)hDxPos4profile->ProfileX(profilename, ybinMin,ybinMax); | |
832 | sprintf(profilename,"profDxNeg"); | |
833 | profDxPos->SetLineWidth(2); | |
834 | TProfile * profDxNeg = (TProfile*)hDxNeg4profile->ProfileX(profilename, ybinMin, ybinMax); | |
835 | profDxNeg->SetLineWidth(2); | |
836 | ||
837 | TH1 *profRatioPosOverNegDx = (TH1*) profDxPos->Clone(); | |
838 | profRatioPosOverNegDx->SetName("profRatioPosOverNegDx"); | |
839 | profRatioPosOverNegDx->Divide((TH1*) profDxNeg); | |
840 | profRatioPosOverNegDx->GetYaxis()->SetRangeUser(-5.,5.); | |
841 | profRatioPosOverNegDx->GetXaxis()->SetRangeUser(0.,2.); | |
842 | if (canvasE){ | |
843 | TCanvas *residuals= new TCanvas("residuals","residuals",900,450); | |
844 | residuals->Divide(2,1); | |
845 | residuals->cd(1); | |
846 | hDxPos4profile->GetYaxis()->SetRangeUser(-5.,5.); | |
847 | hDxPos4profile->Draw("colz"); | |
848 | profDxPos->SetLineColor(kRed); | |
849 | profDxPos ->Draw("same"); | |
850 | residuals->cd(2); | |
851 | hDxNeg4profile->GetYaxis()->SetRangeUser(-5.,5.); | |
852 | hDxNeg4profile->Draw("colz"); | |
853 | profDxNeg->SetLineColor(kBlue); | |
854 | profDxNeg->Draw("same"); | |
855 | } | |
856 | ||
857 | fout->cd(); | |
858 | hDxPos4profile->Write(); | |
859 | hDxNeg4profile->Write(); | |
860 | profDxPos->Write(); | |
861 | profDxNeg->Write(); | |
862 | profRatioPosOverNegDx->Write(); | |
863 | //------------------------------------------------------------- | |
864 | /* T0 DETECTOR MONITOR*/ | |
865 | ||
866 | TH1F * hT0AC = (TH1F*) timeZeroList->At(0); | |
867 | hT0AC->SetMarkerStyle(8); | |
868 | hT0AC->SetMarkerSize(0.7); | |
869 | hT0AC->SetMarkerColor(kRed); | |
870 | hT0AC->SetLineColor(kRed); | |
871 | hT0AC->SetFillColor(kRed); | |
872 | hT0AC->SetFillStyle(1001); | |
873 | hT0AC->Rebin(2); | |
874 | hT0AC->GetYaxis()->SetTitle("events"); | |
875 | hT0AC->GetYaxis()->SetTitleOffset(1.35); | |
876 | hT0AC->GetXaxis()->SetLabelSize(0.03); | |
877 | ||
878 | TH1F * hT0A = (TH1F*) timeZeroList->At(1); | |
879 | hT0A->SetMarkerStyle(8); | |
880 | hT0A->SetMarkerSize(0.7); | |
881 | hT0A->SetMarkerColor(kBlue); | |
882 | hT0A->SetLineColor(kBlue); | |
883 | hT0A->SetFillColor(kBlue); | |
884 | hT0A->SetFillStyle(1001); | |
885 | hT0A->Rebin(2); | |
886 | hT0A->GetYaxis()->SetTitle("events"); | |
887 | hT0A->GetYaxis()->SetTitleOffset(1.35); | |
888 | hT0A->GetXaxis()->SetLabelSize(0.03); | |
889 | ||
890 | TH1F * hT0C = (TH1F*) timeZeroList->At(2); | |
891 | hT0C->SetMarkerStyle(8); | |
892 | hT0C->SetMarkerSize(0.7); | |
893 | hT0C->SetMarkerColor(kGreen); | |
894 | hT0C->SetLineColor(kGreen); | |
895 | hT0C->SetFillColor(kGreen); | |
896 | hT0C->SetFillStyle(1001); | |
897 | hT0C->Rebin(2); | |
898 | hT0C->GetYaxis()->SetTitle("events"); | |
899 | hT0C->GetYaxis()->SetTitleOffset(1.35); | |
900 | hT0C->GetXaxis()->SetLabelSize(0.03); | |
901 | ||
902 | TLegend *lT0 = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC"); | |
903 | lT0->SetTextSize(0.041); | |
904 | lT0->AddEntry(hT0AC, "T0 A&C","L"); | |
905 | lT0->AddEntry(hT0A, "T0 A","L"); | |
906 | lT0->AddEntry(hT0C, "T0 C","L"); | |
907 | lT0->SetFillColor(kWhite); | |
908 | lT0->SetShadowColor(0); | |
909 | ||
910 | TH1F * hT0res = (TH1F*) timeZeroList->At(3); | |
911 | hT0res->GetXaxis()->SetLabelSize(0.03); | |
912 | if (canvasE){ | |
913 | TCanvas *cT0detector= new TCanvas("cT0detector","T0 detector",900,450); | |
914 | cT0detector->Divide(2,1); | |
915 | cT0detector->cd(1); | |
916 | hT0AC->Draw("BAR"); | |
917 | hT0AC->SetTitle("timeZero measured by T0 detector"); | |
918 | hT0A ->Draw("BARsame"); | |
919 | hT0C ->Draw("BARsame"); | |
920 | lT0->Draw(); | |
921 | cT0detector->cd(2); | |
922 | // gPad->SetLogy(); | |
923 | hT0res->Draw(); | |
924 | // myText1->Draw(); | |
925 | // cTrackProperties->cd(3); | |
926 | // gPad->SetLogy(); | |
927 | // hL->Draw("BAR"); | |
928 | // myText2->Draw(); | |
929 | } | |
930 | ||
931 | TH1F * hT0fillRes = (TH1F*) timeZeroList->At(8); | |
932 | hT0fillRes->GetXaxis()->SetLabelSize(0.03); | |
933 | ||
934 | fout->cd(); | |
935 | hT0AC->Write(); | |
936 | hT0A->Write(); | |
937 | hT0C->Write(); | |
938 | hT0res->Write(); | |
939 | hT0fillRes->Write(); | |
940 | lT0->Write(); | |
941 | ||
942 | ||
943 | //------------------------------------------------------------- | |
944 | /*MATCHING EFFICIENCY MONITOR*/ | |
945 | ||
946 | //TH1F * hMatchingVsP =new TH1F("hMatchingVsP","Matching probability vs. P; P(GeV/c); matching probability", 50, 0., 5. ); | |
947 | ||
948 | TH1F * hMatchingVsPt =new TH1F("hMatchingVsPt","Matching probability vs. Pt; Pt(GeV/c); matching probability", 50, 0., 5. ); | |
949 | ||
950 | TH1F * hMatchingVsEta =new TH1F("hMatchingVsEta","Matching probability vs. #\Eta; #\Eta; matching probability", 20, -1., 1.); | |
951 | ||
952 | TH1F * hMatchingVsPhi =new TH1F("hMatchingVsPhi","Matching probability vs. Phi; Phi(rad); matching probability", 628, 0., 6.28); | |
953 | ||
954 | /*/matching as function of p | |
955 | TH1F * hDenom=(TH1F*)generalList->At(9); | |
956 | if (hDenom) { | |
957 | hMatchingVsP=(TH1F*) generalList->At(5); | |
958 | hMatchingVsP->Rebin(5); | |
959 | hDenom->Rebin(5); | |
960 | hMatchingVsP->Divide(hDenom); | |
961 | hMatchingVsP->GetYaxis()->SetTitle("matching efficiency"); | |
962 | hMatchingVsP->SetTitle("TOF matching efficiency as function of momentum"); | |
963 | }*/ | |
964 | ||
965 | //matching as function of pT | |
966 | ||
967 | // hDenom->Clear(); | |
968 | TH1F * hDenom=(TH1F*)generalList->At(10); | |
969 | if (hDenom) { | |
970 | hMatchingVsPt=(TH1F*) generalList->At(6); | |
971 | hMatchingVsPt->Rebin(5); | |
972 | hDenom->Rebin(5); | |
973 | hMatchingVsPt->Divide(hDenom); | |
974 | hMatchingVsPt->GetYaxis()->SetTitle("matching efficiency"); | |
975 | hMatchingVsPt->SetTitle("TOF matching efficiency as function of transverse momentum"); | |
976 | hMatchingVsPt->GetYaxis()->SetRangeUser(0,1.2); | |
977 | } | |
978 | ||
979 | //matching as function of eta | |
980 | hDenom->Clear(); | |
981 | hDenom=(TH1F*)generalList->At(11); | |
982 | if (hDenom) { | |
983 | hMatchingVsEta=(TH1F*) generalList->At(7); | |
984 | hMatchingVsEta->Rebin(5); | |
985 | hDenom->Rebin(5); | |
986 | hMatchingVsEta->Divide(hDenom); | |
987 | hMatchingVsEta->GetXaxis()->SetRangeUser(-1,1); | |
988 | hMatchingVsEta->GetYaxis()->SetTitle("matching efficiency"); | |
989 | hMatchingVsEta->GetYaxis()->SetRangeUser(0,1.2); | |
990 | hMatchingVsEta->SetTitle("TOF matching efficiency as function of pseudorapidity"); | |
991 | } | |
992 | //matching as function of phi | |
993 | hDenom->Clear(); | |
994 | hDenom=(TH1F*)generalList->At(12); | |
995 | if (hDenom) { | |
996 | hMatchingVsPhi=(TH1F*) generalList->At(8); | |
997 | //hMatchingVsPhi->Rebin(5); | |
998 | //hDenom->Rebin(5); | |
999 | hMatchingVsPhi->Divide(hDenom); | |
1000 | hMatchingVsPhi->GetYaxis()->SetTitle("matching efficiency"); | |
1001 | hMatchingVsPhi->SetTitle("TOF matching efficiency as function of phi"); | |
1002 | hMatchingVsPhi->GetYaxis()->SetRangeUser(0,1.2); | |
1003 | } | |
1004 | if ( canvasE){ | |
1005 | TCanvas *cMatchingPerformance= new TCanvas("cMatchingPerformance","summary of matching performance",700,400); | |
1006 | cMatchingPerformance->Divide(2,2); | |
1007 | cMatchingPerformance->cd(1); | |
1008 | gPad->SetGridy(); | |
1009 | hMatchingVsPt->Draw(); | |
1010 | cMatchingPerformance->cd(2); | |
1011 | gPad->SetGridy(); | |
1012 | hMatchingVsEta->Draw(); | |
1013 | cMatchingPerformance->cd(3); | |
1014 | gPad->SetGridy(); | |
1015 | hMatchingVsPhi->Draw(); | |
1016 | } | |
1017 | fout->cd(); | |
1018 | hMatchingVsPt->Write(); | |
1019 | hMatchingVsEta->Write(); | |
1020 | hMatchingVsPhi->Write(); | |
1021 | ||
1022 | //---------------------------------------------------- | |
1023 | /* PID PERFORMANCE MONITOR */ | |
1024 | ||
1025 | TH2F * hBetaP=(TH2F*)pidList->At(0); | |
1026 | hBetaP->GetYaxis()->SetRangeUser(0.,1.2); | |
1027 | TH1F * hMass=(TH1F*)pidList->At(1); | |
1028 | //hMass->SetMarkerColor(kBlue); | |
1029 | //hMass->SetLineColor(kBlue); | |
1030 | hMass->SetFillColor(kAzure+10); | |
1031 | hMass->SetFillStyle(1001); | |
1032 | hMass->Rebin(2); | |
1033 | hMass->GetYaxis()->SetTitle("tracks"); | |
1034 | hMass->GetYaxis()->SetTitleOffset(1.35); | |
1035 | hMass->GetXaxis()->SetLabelSize(0.03); | |
1036 | ||
1037 | TH1F * hPionDiff=(TH1F*)pidList->At(3); | |
1038 | ||
1039 | ||
1040 | TH2F * hDiffTimePi=(TH2F*)pidList->At(4); | |
1041 | hDiffTimePi->GetYaxis()->SetRangeUser(-2000.,2000.); | |
1042 | //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1043 | sprintf(profilename,"profDiffTimePi"); | |
1044 | ||
1045 | TProfile * profDiffTimePi = (TProfile*)hDiffTimePi->ProfileX(profilename, 490, 510); | |
1046 | profDiffTimePi->SetLineWidth(2); | |
1047 | profDiffTimePi->SetLineColor(kRed+2); | |
1048 | ||
1049 | TH2F * hDiffTimePiTh=(TH2F*)pidList->At(6); | |
1050 | //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1051 | sprintf(profilename,"profDiffTimePiTh"); | |
1052 | hDiffTimePiTh->GetYaxis()->SetRangeUser(-2000.,2000.); | |
1053 | ||
1054 | TProfile * profDiffTimePiTh = (TProfile*)hDiffTimePiTh->ProfileX(profilename, 490, 510); | |
1055 | profDiffTimePiTh->SetLineWidth(2); | |
1056 | profDiffTimePiTh->SetLineColor(kRed+2); | |
1057 | ||
1058 | TH2F * hDiffTimeKa=(TH2F*)pidList->At(9); | |
1059 | //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1060 | sprintf(profilename,"profDiffTimeKa"); | |
1061 | hDiffTimeKa->GetYaxis()->SetRangeUser(-2000.,2000.); | |
1062 | ||
1063 | TProfile * profDiffTimeKa = (TProfile*)hDiffTimeKa->ProfileX(profilename, 490, 510); | |
1064 | profDiffTimeKa->SetLineWidth(2); | |
1065 | profDiffTimeKa->SetLineColor(kBlue); | |
1066 | ||
1067 | TH2F * hDiffTimeKaTh=(TH2F*)pidList->At(11); | |
1068 | //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1069 | sprintf(profilename,"profDiffTimeKaTh"); | |
1070 | hDiffTimeKaTh->GetYaxis()->SetRangeUser(-2000.,2000.); | |
1071 | TProfile * profDiffTimeKaTh = (TProfile*)hDiffTimeKaTh->ProfileX(profilename, 490, 510); | |
1072 | profDiffTimeKaTh->SetLineWidth(2); | |
1073 | profDiffTimeKaTh->SetLineColor(kBlue); | |
1074 | ||
1075 | TH2F * hDiffTimePro=(TH2F*)pidList->At(14); | |
1076 | //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1077 | sprintf(profilename,"profDiffTimePro"); | |
1078 | hDiffTimePro->GetYaxis()->SetRangeUser(-2000.,2000.); | |
1079 | TProfile * profDiffTimePro = (TProfile*)hDiffTimePro->ProfileX(profilename, 490, 510); | |
1080 | profDiffTimePro->SetLineWidth(2); | |
1081 | profDiffTimePro->SetLineColor(kGreen+2); | |
1082 | ||
1083 | TH2F * hDiffTimeProTh=(TH2F*)pidList->At(16); | |
1084 | //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps | |
1085 | sprintf(profilename,"profDiffTimeProTh"); | |
1086 | hDiffTimeProTh->GetYaxis()->SetRangeUser(-2000.,2000.); | |
1087 | TProfile * profDiffTimeProTh = (TProfile*)hDiffTimeProTh->ProfileX(profilename, 490, 510); | |
1088 | profDiffTimeProTh->SetLineWidth(2); | |
1089 | profDiffTimeProTh->SetLineColor(kGreen+2); | |
1090 | ||
1091 | if (canvasE){ | |
1092 | TCanvas *cPidPerformance= new TCanvas("cPidPerformance","summary of pid performance",800,800); | |
1093 | cPidPerformance->Divide(2,1); | |
1094 | cPidPerformance->cd(1); | |
1095 | gPad->SetGridy(); | |
1096 | gPad->SetGridx(); | |
1097 | gPad->SetLogz(); | |
1098 | hBetaP->Draw("colz"); | |
1099 | ||
1100 | cPidPerformance->cd(2); | |
1101 | gPad->SetLogy(); | |
1102 | gPad->SetGridy(); | |
1103 | hMass->Draw("HIST BAR"); | |
1104 | ||
1105 | TLegend * lPid=new TLegend(0.75,0.75,0.95,0.95,"PID"); | |
1106 | lPid->AddEntry(profDiffTimePi,"#pi^{#pm}","l"); | |
1107 | lPid->AddEntry(profDiffTimeKa,"K^{#pm}","l"); | |
1108 | lPid->AddEntry(profDiffTimePro,"p^{#pm}","l"); | |
1109 | ||
1110 | gStyle->SetOptStat(10); | |
1111 | TCanvas *cPidPerformance2= new TCanvas("cPidPerformance2","summary of pid performance - tracking",700,700); | |
1112 | cPidPerformance2->Divide(2,2); | |
1113 | cPidPerformance2->cd(1); | |
1114 | gPad->SetLogz(); | |
1115 | hDiffTimePi->Draw("colz"); | |
1116 | // profDiffTimePi->Draw("same"); | |
1117 | ||
1118 | cPidPerformance2->cd(2); | |
1119 | gPad->SetLogz(); | |
1120 | hDiffTimeKa->Draw("colz"); | |
1121 | //profDiffTimeKa->Draw("same"); | |
1122 | cPidPerformance2->cd(3); | |
1123 | gPad->SetLogz(); | |
1124 | hDiffTimePro->Draw("colz"); | |
1125 | // profDiffTimePro->Draw("same"); | |
1126 | ||
1127 | // cPidPerformance2->cd(4); | |
1128 | // profDiffTimePi->Draw(); | |
1129 | // profDiffTimeKa->Draw("same"); | |
1130 | // profDiffTimePro->Draw("same"); | |
1131 | // lPid->Draw("same"); | |
1132 | ||
1133 | TCanvas *cPidPerformanceTh= new TCanvas("cPidPerformanceTh","summary of pid performance - theoretical times",700,700); | |
1134 | cPidPerformanceTh->Divide(2,2); | |
1135 | cPidPerformanceTh->cd(1); | |
1136 | gPad->SetLogz(); | |
1137 | hDiffTimePiTh->Draw("colz"); | |
1138 | profDiffTimePiTh->Draw("same"); | |
1139 | cPidPerformanceTh->cd(2); | |
1140 | gPad->SetLogz(); | |
1141 | hDiffTimeKaTh->Draw("colz"); | |
1142 | profDiffTimeKaTh->Draw("same"); | |
1143 | cPidPerformanceTh->cd(3); | |
1144 | gPad->SetLogz(); | |
1145 | hDiffTimeProTh->Draw("colz"); | |
1146 | profDiffTimeProTh->Draw("same"); | |
1147 | // cPidPerformanceTh->cd(4); | |
1148 | // profDiffTimePiTh->Draw(); | |
1149 | // profDiffTimeKaTh->Draw("same"); | |
1150 | // profDiffTimeProTh->Draw("same"); | |
1151 | // lPid->Draw("same"); | |
1152 | } | |
1153 | ||
1154 | TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePi"); | |
1155 | TH1F * hKaonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimeKa"); | |
1156 | TH1F * hProtonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePro"); | |
1157 | ||
1158 | ||
1159 | fout->cd(); | |
1160 | hPionDiff->Write(); | |
1161 | hKaonDiff->Write(); | |
1162 | hProtonDiff->Write(); | |
1163 | ||
1164 | hBetaP->Write(); | |
1165 | hMass->Write(); | |
1166 | hDiffTimePi->Write(); | |
1167 | profDiffTimePi->Write(); | |
1168 | hDiffTimeKa->Write(); | |
1169 | profDiffTimeKa->Write(); | |
1170 | hDiffTimePro->Write(); | |
1171 | profDiffTimePro->Write(); | |
1172 | //lPid->Draw(); | |
1173 | hDiffTimePiTh->Write(); | |
1174 | profDiffTimePiTh->Write(); | |
1175 | hDiffTimeKaTh->Write(); | |
1176 | profDiffTimeKaTh->Write(); | |
1177 | hDiffTimeProTh->Write(); | |
1178 | profDiffTimeProTh->Write(); | |
1179 | ||
1180 | //SIGMAS PID | |
1181 | TH2F * hSigmaPi=(TH2F*)pidList->At(7); | |
1182 | sprintf(profilename,"profSigmaPi"); | |
1183 | hSigmaPi->GetYaxis()->SetRangeUser(-5.,5.); | |
1184 | TProfile * profSigmaPi = (TProfile*)hSigmaPi->ProfileX(profilename); | |
1185 | profSigmaPi->SetLineWidth(2); | |
1186 | profSigmaPi->SetLineColor(kRed+2); | |
1187 | ||
1188 | TH2F * hSigmaKa=(TH2F*)pidList->At(12); | |
1189 | sprintf(profilename,"profSigmaKa"); | |
1190 | hSigmaKa->GetYaxis()->SetRangeUser(-5.,5.); | |
1191 | TProfile * profSigmaKa = (TProfile*)hSigmaKa->ProfileX(profilename); | |
1192 | profSigmaKa->SetLineWidth(2); | |
1193 | profSigmaKa->SetLineColor(kBlue); | |
1194 | ||
1195 | TH2F * hSigmaPro=(TH2F*)pidList->At(17); | |
1196 | sprintf(profilename,"profSigmaPro"); | |
1197 | hSigmaPro->GetYaxis()->SetRangeUser(-5.,5.); | |
1198 | TProfile * profSigmaPro = (TProfile*)hSigmaPro->ProfileX(profilename); | |
1199 | profSigmaPro->SetLineWidth(2); | |
1200 | profSigmaPro->SetLineColor(kGreen+2); | |
1201 | ||
1202 | ||
1203 | if (canvasE){ | |
1204 | TCanvas *cPidPerformance= new TCanvas("cPidPerformance","summary of pid performance",800,800); | |
1205 | cPidPerformance->Divide(2,1); | |
1206 | cPidPerformance->cd(1); | |
1207 | gPad->SetGridy(); | |
1208 | gPad->SetGridx(); | |
1209 | gPad->SetLogz(); | |
1210 | hBetaP->Draw("colz"); | |
1211 | ||
1212 | cPidPerformance->cd(2); | |
1213 | gPad->SetLogy(); | |
1214 | gPad->SetGridy(); | |
1215 | hMass->Draw("HIST BAR"); | |
1216 | ||
1217 | TLegend * lSigmaPid=new TLegend(0.75,0.75,0.95,0.95,"#sigma_{PID}"); | |
1218 | lSigmaPid->AddEntry(profSigmaPi,"#pi^{#pm}","l"); | |
1219 | lSigmaPid->AddEntry(profSigmaKa,"K^{#pm}","l"); | |
1220 | lSigmaPid->AddEntry(profSigmaPro,"p^{#pm}","l"); | |
1221 | ||
1222 | TCanvas *cPidPerformance3= new TCanvas("cPidPerformance3","summary of pid performance - sigmas",1200,400); | |
1223 | cPidPerformance3->Divide(3,1); | |
1224 | cPidPerformance3->cd(1); | |
1225 | gPad->SetLogz(); | |
1226 | gPad->SetGridy(); | |
1227 | ||
1228 | hSigmaPi->Draw("colz"); | |
1229 | profSigmaPi->Draw("same"); | |
1230 | ||
1231 | cPidPerformance3->cd(2); | |
1232 | gPad->SetLogz(); | |
1233 | gPad->SetGridy(); | |
1234 | hSigmaKa->Draw("colz"); | |
1235 | profSigmaKa->Draw("same"); | |
1236 | ||
1237 | cPidPerformance3->cd(3); | |
1238 | gPad->SetLogz(); | |
1239 | hSigmaPro->Draw("colz"); | |
1240 | profSigmaPro->Draw("same"); | |
1241 | } | |
1242 | ||
1243 | fout->cd(); | |
1244 | hSigmaPi->Write(); | |
1245 | profSigmaPi->Write(); | |
1246 | hSigmaKa->Write(); | |
1247 | profSigmaKa->Write(); | |
1248 | hSigmaPro->Write(); | |
1249 | profSigmaPro->Write(); | |
1250 | ||
1251 | return 0; | |
1252 | } | |
1253 | ||
1254 | //---------------------------------------------------------- | |
1255 | char * SetQAtrainOutputName(Int_t run=0,Int_t year=2011,char *period="LHC11a", char* pass="cpass1",Int_t trainId=76){ | |
1256 | ||
1257 | char infile[200]; | |
1258 | sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId); | |
1259 | return infile; | |
1260 | ||
1261 | } | |
1262 | ||
1263 | ||
1264 |