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){
7 printf("Invalid list of runs given as input: nothing done\n");
12 char postFileName[20];
14 char trendFileName[100];
15 //Define trending output
17 sprintf(trendFileName,"treeTOFQA_%s_%s.root",period,pass);
19 sprintf(trendFileName,"treeTOFQA_QA%i_%s_%s.root",trainId,period,pass);
21 TFile * trendFile=new TFile(trendFileName,"recreate");
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.;
29 Double_t avPiDiffTime=-9999.,peakPiDiffTime=-9999., spreadPiDiffTime=-9999.,peakPiDiffTimeErr=-9999., spreadPiDiffTimeErr=-9999.;
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.;
38 Float_t fractionEventsWHits=-9999.;
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
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
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
63 ttree->Branch("orphansRatio",&orphansRatio,"orphansRatio/D"); //orphans ratio
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
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
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
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
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
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
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
105 FILE * files = fopen(runlist, "r") ;
106 while (fscanf(files,"%d",&runNumber)==1 ){
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.;
115 avPiDiffTime=-9999.;peakPiDiffTime=-9999.; spreadPiDiffTime=-9999.;peakPiDiffTimeErr=-9999.; spreadPiDiffTimeErr=-9999.;
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.;
125 //SetQAtrainOutputName(runNumber, year,period,pass,trainId);
127 sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QAresults.root",year,period,runNumber,pass);
129 sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId);
131 printf("============== Opening QA file(s) for run %i =======================\n",runNumber);
135 if (RunESDQApostAnalysis(infile,runNumber,kTRUE)==0){
138 //get post-analysis output
139 sprintf(postFileName,"postQA_%i.root",runNumber);
140 TFile *postfile=TFile::Open(postFileName);
142 printf("Post-analysis output not found - cannot perform trending analysis. Exiting.");
145 printf("============== Retrieving post-analysis for run %i ===============\n",runNumber);
148 //save quantities for trending
150 //--------------------------------- Multiplicity ----------------------------------//
151 TH1F*hMulti=(TH1F*)postfile->Get("hTOFmatchedPerEvt");
152 if ((hMulti)&&(hMulti->GetEntries()>0)) {
153 avMulti=hMulti->GetMean();
156 //--------------------------------- T0F signal ----------------------------------//
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);
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 );
172 //add integral of main peak over total
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 );
187 printf("---------------------------------------------------------------- \n");
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 );
200 printf("---------------------------------------------------------------- \n");
201 TH1F * hOrphansRatio=(TH1F*)postfile->Get("hOrphansRatio");
203 orphansRatio=hOrphansRatio->GetMean();
205 TH1F * hL=(TH1F*)postfile->Get("hTOFmatchedESDtrkLength");
209 TH1F *hLnegRatio =(TH1F*)postfile->Get("hLnegRatio");
211 negLratio=hLnegRatio->GetMean();
213 //--------------------------------- matching eff ----------------------------------//
215 //Double_t linFitEff1Param[3]={0.,0.,0.};
216 TH1F *hMatchingVsPt =(TH1F*)postfile->Get("hTOFmatchedESDPt");
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 );
227 printf("WARNING: matching efficiency plot has 0 entries. Skipped!\n");
230 printf("WARNING: cannot retrieve matching efficiency plot\n");
233 //--------------------------------- t-texp ----------------------------------//
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 );
248 //--------------------------------- T0 detector ----------------------------------//
250 TH1F*hT0A=(TH1F*)postfile->Get("hEventT0DetA");
251 if ((hT0A)&&(hT0A->GetEntries()>0)) {
252 avhT0A=hT0A->GetMean();
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
263 TH1F*hT0C=(TH1F*)postfile->Get("hEventT0DetC");
264 if ((hT0C)&&(hT0C->GetEntries()>0)) {
265 avhT0C=hT0C->GetMean();
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
276 TH1F*hT0AC=(TH1F*)postfile->Get("hEventT0DetAND");
277 if ((hT0AC)&&(hT0AC->GetEntries()>0)) {
278 avhT0AC=hT0AC->GetMean();
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 );
288 TH1F*hT0res=(TH1F*)postfile->Get("hT0DetRes");
289 if ((hT0res)&&(hT0res->GetEntries()>0)) {
290 avhT0res=hT0res->GetMean();
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
301 TH1F*hT0fillRes=(TH1F*)postfile->Get("hT0fillRes");
302 if ((hT0fillRes)&&(hT0fillRes->GetEntries()>0)) {
303 avT0fillRes=hT0fillRes->GetMean();
307 printf("============== Saving trending quantities for run %i ===============\n",runNumber);
308 if (postfile->IsOpen()) {
309 printf("Trying to close\n");
313 printf("============== QA for run %i not available - skipping ===============\n",runNumber);
317 printf("Number of files processed = %i\n",filesCounter);
323 return MakeTrendingFromTreeWithErrors(trendFileName);
326 //______________________________________________________________________________
328 Int_t MakeTrendingFromTreeWithErrors(char* trendFileName=NULL){
333 TFile *fin=TFile::Open(trendFileName);
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.;
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.;
349 Float_t fractionEventsWHits=0;
351 TTree * ttree=(TTree*)fin->Get("trendTree");
352 ttree->SetBranchAddress("run",&runNumber);
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
360 ttree->SetBranchAddress("negTimeRatio",&negTimeRatio); //negative time ratio
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
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
374 ttree->SetBranchAddress("orphansRatio",&orphansRatio); //orphans ratio
376 ttree->SetBranchAddress("avL",&avL); //mean track length
377 ttree->SetBranchAddress("negLratio",&negLratio);//ratio of tracks with track length <350 cm
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
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
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
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
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
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
415 Int_t nRuns=ttree->GetEntries();
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);
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);
429 TH1F * hSpreadDiffTimeVsRun=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);
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);
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);
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);
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);
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);
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);
466 TH1F * hAvTotVsRun=new TH1F("hAvTotVsRun","hAvTotVsRun;run;<ToT> (ns)",nRuns,0., nRuns);//, 50, 0. , 50.);
467 hAvTotVsRun->SetDrawOption("E1");
468 hAvTotVsRun->SetMarkerStyle(22);
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);
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);
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");
481 TH1F * hOrphansRatioVsRun=new TH1F("hOrphansRatioVsRun","hOrphansRatioVsRun; run; ratio of orphans (%)",nRuns, 0., nRuns);//, 1000, 0. , 100.);
482 hOrphansRatioVsRun->SetDrawOption("E");
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);
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);
520 for (Int_t irun=0;irun<nRuns;irun++){
521 ttree->GetEntry(irun);
523 sprintf(runlabel,"%i",runNumber);
525 hAvDiffTimeVsRun->SetBinContent(irun+1, avDiffTime);
526 hAvDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
528 hPeakDiffTimeVsRun->SetBinContent(irun+1,peakDiffTime);
529 hPeakDiffTimeVsRun->SetBinError(irun+1,peakDiffTimeErr);
530 hPeakDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
532 hSpreadDiffTimeVsRun->SetBinContent(irun+1,spreadDiffTime);
533 hSpreadDiffTimeVsRun->SetBinError(irun+1,spreadDiffTimeErr);
534 hSpreadDiffTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
536 hAvTimeVsRun->SetBinContent(irun+1, avTime);
537 hAvTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
539 hPeakTimeVsRun->SetBinContent(irun+1,peakTime);
540 hPeakTimeVsRun->SetBinError(irun+1,peakTimeErr);
541 hPeakTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
543 hSpreadTimeVsRun->SetBinContent(irun+1,spreadTime);
544 hSpreadTimeVsRun->SetBinError(irun+1,spreadTimeErr);
545 hSpreadTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
547 hAvRawTimeVsRun->SetBinContent(irun+1, avRawTime);
548 hAvRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
550 hPeakRawTimeVsRun->SetBinContent(irun+1,peakRawTime);
551 hPeakRawTimeVsRun->SetBinError(irun+1,peakRawTimeErr);
552 hPeakRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
554 hSpreadRawTimeVsRun->SetBinContent(irun+1,spreadRawTime);
555 hSpreadRawTimeVsRun->SetBinError(irun+1,spreadRawTimeErr);
556 hSpreadRawTimeVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
558 hAvTotVsRun->SetBinContent(irun+1,avTot);
559 hAvTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
561 hPeakTotVsRun->SetBinContent(irun+1,peakTot);
562 hPeakTotVsRun->SetBinError(irun+1,peakTotErr);
563 hPeakTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
565 hSpreadTotVsRun->SetBinContent(irun+1,spreadTot);
566 hSpreadTotVsRun->SetBinError(irun+1,spreadTotErr);
567 hSpreadTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
569 hNegTimeRatioVsRun->SetBinContent(irun+1,negTimeRatio);
570 hNegTimeRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
572 hOrphansRatioVsRun->SetBinContent(irun+1,orphansRatio);
573 hOrphansRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
575 hMeanLVsRun->SetBinContent(irun+1,avL);
576 hMeanLVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
578 hNegLRatioVsRun->SetBinContent(irun+1,negLratio);
579 hNegLRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
581 hMatchEffVsRun->SetBinContent(irun+1,matchEffLinFit1Gev);
582 hMatchEffVsRun->SetBinError(irun+1,matchEffLinFit1GevErr);
583 hMatchEffVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
585 hPeakT0AVsRun->SetBinContent(irun+1,peakT0A);
586 hPeakT0AVsRun->SetBinError(irun+1,spreadT0A);
587 hPeakT0AVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
589 hPeakT0CVsRun->SetBinContent(irun+1,peakT0C);
590 hPeakT0CVsRun->SetBinError(irun+1,spreadT0C);
591 hPeakT0CVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
593 hPeakT0ACVsRun->SetBinContent(irun+1,peakT0AC);
594 hPeakT0ACVsRun->SetBinError(irun+1,spreadT0AC);
595 hPeakT0ACVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
597 hT0fillResVsRun->SetBinContent(irun+1,avT0fillRes);
598 hT0fillResVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
602 char outfilename[200];
603 sprintf(outfilename, "trend_%s",trendFileName);
604 TFile * fout=new TFile(outfilename,"recreate");
609 TString plotDir(Form("PlotsTrending"));
610 gSystem->Exec(Form("mkdir %s",plotDir.Data()));
612 TCanvas* cAvDiffTimeVsRun = new TCanvas("cAvDiffTimeVsRun","cAvDiffTimeVsRun",50,50,750,550);
615 hAvDiffTimeVsRun->Draw();
616 cAvDiffTimeVsRun->Print(Form("%s/cAvDiffTimeVsRun.png",plotDir.Data()));
618 TCanvas* cPeakDiffTimeVsRun = new TCanvas("cPeakDiffTimeVsRun","cPeakDiffTimeVsRun", 50,50,750,550);
619 hPeakDiffTimeVsRun->Draw();
620 cPeakDiffTimeVsRun->Print(Form("%s/cPeakDiffTimeVsRun.png",plotDir.Data()));
622 TCanvas* cSpreadDiffTimeVsRun = new TCanvas("cSpreadDiffTimeVsRun","cSpreadDiffTimeVsRun", 50,50,750,550);
623 hSpreadDiffTimeVsRun->Draw();
624 cSpreadDiffTimeVsRun->Print(Form("%s/cSpreadDiffTimeVsRun.png",plotDir.Data()));
626 TCanvas* cAvTimeVsRun = new TCanvas("cAvTimeVsRun","cAvTimeVsRun", 50,50,750,550);
627 hAvTimeVsRun->Draw();
628 cAvTimeVsRun->Print(Form("%s/cAvTimeVsRun.png",plotDir.Data()));
630 TCanvas* cPeakTimeVsRun = new TCanvas("cPeakTimeVsRun","cPeakTimeVsRun", 50,50,750,550);
631 hPeakTimeVsRun->Draw();
632 cPeakTimeVsRun->Print(Form("%s/cPeakTimeVsRun.png",plotDir.Data()));
634 TCanvas* cSpreadTimeVsRun = new TCanvas("cSpreadTimeVsRun","cSpreadTimeVsRun", 50,50,750,550);
635 hSpreadTimeVsRun->Draw();
636 cSpreadTimeVsRun->Print(Form("%s/cSpreadTimeVsRun.png",plotDir.Data()));
638 TCanvas* cAvRawTimeVsRun = new TCanvas("cAvRawTimeVsRun","cAvRawTimeVsRun", 50,50,750,550);
639 hAvRawTimeVsRun->Draw();
640 cAvRawTimeVsRun->Print(Form("%s/cAvRawTimeVsRun.png",plotDir.Data()));
642 TCanvas* cPeakRawTimeVsRun = new TCanvas("cPeakRawTimeVsRun","cPeakRawTimeVsRun", 50,50,750,550);
643 hPeakRawTimeVsRun->Draw();
644 cPeakRawTimeVsRun->Print(Form("%s/cPeakRawTimeVsRun.png",plotDir.Data()));
646 TCanvas* cSpreadRawTimeVsRun = new TCanvas("cSpreadRawTimeVsRun","cSpreadRawTimeVsRun", 50,50,750,550);
647 hSpreadRawTimeVsRun->Draw();
648 cSpreadRawTimeVsRun->Print(Form("%s/cSpreadRawTimeVsRun.png",plotDir.Data()));
650 TCanvas* cAvTotVsRun = new TCanvas("cAvTotVsRun","cAvTotVsRun", 50,50,750,550);
652 cAvTotVsRun->Print(Form("%s/cAvTotVsRun.png",plotDir.Data()));
654 TCanvas* cPeakTotVsRun = new TCanvas("cPeakTotVsRun","cPeakTotVsRun", 50,50,750,550);
655 hPeakTotVsRun->Draw();
656 cPeakTotVsRun->Print(Form("%s/cPeakTotVsRun.png",plotDir.Data()));
658 TCanvas* cSpreadTotVsRun = new TCanvas("cSpreadTotVsRun","cSpreadTotVsRun", 50,50,750,550);
659 hSpreadTotVsRun->Draw();
660 cSpreadTotVsRun->Print(Form("%s/cSpreadTotVsRun.png",plotDir.Data()));
662 TCanvas* cNegTimeRatioVsRun = new TCanvas("cNegTimeRatioVsRun","cNegTimeRatioVsRun", 50,50,750,550);
663 hNegTimeRatioVsRun->Draw();
664 cNegTimeRatioVsRun->Print(Form("%s/cNegTimeRatioVsRun.png",plotDir.Data()));
666 TCanvas* cOrphansRatioVsRun = new TCanvas("cOrphansRatioVsRun","cOrphansRatioVsRun", 50,50,750,550);
667 hOrphansRatioVsRun->Draw();
668 cOrphansRatioVsRun->Print(Form("%s/cOrphansRatioVsRun.png",plotDir.Data()));
670 TCanvas* cMeanLVsRun = new TCanvas("cMeanLVsRun","cMeanLVsRun", 50,50,750,550);
672 cMeanLVsRun->Print(Form("%s/cMeanLVsRun.png",plotDir.Data()));
674 TCanvas* cNegLRatioVsRun = new TCanvas("cNegLRatioVsRun","cNegLRatioVsRun", 50,50,750,550);
675 hNegLRatioVsRun->Draw();
676 cNegLRatioVsRun->Print(Form("%s/cNegLRatioVsRun.png",plotDir.Data()));
678 TCanvas* cMatchEffVsRun = new TCanvas("cMatchEffVsRun","cMatchEffVsRun", 50,50,750,550);
679 hMatchEffVsRun->Draw();
680 cMatchEffVsRun->Print(Form("%s/cMatchEffVsRun.png",plotDir.Data()));
682 TCanvas* cPeakT0AVsRun = new TCanvas("cPeakT0AVsRun","cPeakT0AVsRun", 50,50,750,550);
683 hPeakT0AVsRun->Draw();
684 cPeakT0AVsRun->Print(Form("%s/cPeakT0AVsRun.png",plotDir.Data()));
686 TCanvas* cPeakT0CVsRun = new TCanvas("cPeakT0CVsRun","cPeakT0CVsRun", 50,50,750,550);
687 hPeakT0CVsRun->Draw();
688 cPeakT0CVsRun->Print(Form("%s/cPeakT0CVsRun.png",plotDir.Data()));
690 TCanvas* cPeakT0ACVsRun = new TCanvas("cPeakT0ACVsRun","cPeakT0ACVsRun", 50,50,750,550);
691 hPeakT0ACVsRun->Draw();
692 cPeakT0ACVsRun->Print(Form("%s/cPeakT0ACVsRun.png",plotDir.Data()));
694 TCanvas* cT0fillResVsRun = new TCanvas("cT0fillResVsRun","cT0fillResVsRun", 50,50,750,550);
695 hT0fillResVsRun->Draw();
696 cT0fillResVsRun->Print(Form("%s/cT0fillResVsRun.png",plotDir.Data()));
702 //------------------------------------------------------------------------------------
704 Int_t RunESDQApostAnalysis(char *qafilename=NULL, Int_t runNumber=-1, Bool_t IsOnGrid=kFALSE, Bool_t canvasE=kFALSE) {
708 /*access qa PWG1 output files - saved locally or on grid as specified by the second argument */
710 char defaultQAoutput[30]="QAresults.root";
711 if (IsOnGrid) TGrid::Connect("alien://");
712 TFile * fin= TFile::Open(qafilename,"r");
713 printf("Opening file %s\n",qafilename);
715 printf("ERROR: QA output not found. Exiting with status -1\n");
718 printf("INFO: QA output file %s open. \n",fin->GetName());
722 //access histograms lists
723 char tofQAdirName[15]="TOF_Performance";
724 char genListName[15]="cGeneralTOFqa";
725 char t0ListName[15]="cTimeZeroTOFqa";
726 char pidListName[15]="cPIDTOFqa";
727 char posListName[15]="cPositiveTOFqa";
728 char negListName[15]="cNegativeTOFqa";
730 TDirectoryFile * tofQAdir=(TDirectoryFile*)fin->Get(tofQAdirName);
732 printf("------------------------------------------------------------------\n");
734 printf("------------------------------------------------------------------\n");
737 TList * generalList=(TList*)tofQAdir->Get(genListName);
738 TList *timeZeroList=(TList*)tofQAdir->Get(t0ListName);
739 TList *pidList=(TList*)tofQAdir->Get(pidListName);
740 TList *posList=(TList*)tofQAdir->Get(posListName);
741 TList *negList=(TList*)tofQAdir->Get(negListName);
743 if (!generalList) printf("WARNING: general QA histograms absent or not accessible\n");
744 if (!timeZeroList) printf("WARNING: timeZero QA histograms absent or not accessible\n");
745 if (!pidList) printf("WARNING: PID QA histograms absent or not accessible\n");
746 if (!posList) printf("WARNING: general QA histograms for positive tracks absent or not accessible\n");
747 if (!negList) printf("WARNING: general QA histograms for negative tracks absent or not accessible\n");
749 if ( (!generalList) && (!timeZeroList) && (!pidList) ){
750 printf("ERROR: no QA available \n");
756 printf("------------------------------------------------------------------\n");
758 printf("------------------------------------------------------------------\n");
760 printf("------------------------------------------------------------------\n");
763 /*set graphic style*/
764 gStyle->SetCanvasColor(kWhite);
765 gStyle->SetFrameFillColor(kWhite);
766 gStyle->SetFrameBorderMode(0);
767 gStyle->SetCanvasBorderMode(0);
768 gStyle->SetTitleFillColor(kWhite);
769 gStyle->SetTitleBorderSize(0) ;
770 gStyle->SetTitleFont(42);
771 gStyle->SetTextFont(42);
772 //gStyle->SetPalette(1);
773 gStyle->SetStatColor(kWhite);
774 gStyle->SetStatBorderSize(1);
775 gStyle->SetOptStat(0);
778 char outfilename[60];
779 sprintf(outfilename,"postQA_%i.root",runNumber);
780 TFile * fout=new TFile(outfilename,"recreate");
782 TH1I* hRunNumber=new TH1I("hRunNumber","hRunNumber;run",1,runNumber,runNumber+1);
783 hRunNumber->Fill(runNumber);
785 //-------------------------------------------------------------
786 /*GENERAL MONITOR - MULTIPLICITY*/
787 TH1F*hMulti= (TH1F*) generalList->At(0);
789 TH1F* hFractionEventsWhits=new TH1F("hFractionEventsWhits","hFractionEventsWhits;fraction of events with hits (%)",200,0.,100.);
790 Float_t fraction=0.0;
791 if (hMulti->GetEntries()>0.0) fraction=((Float_t) hMulti->GetBinContent(1))/((Float_t) hMulti->GetEntries());
793 hFractionEventsWhits->Fill(fraction*100.);
795 //-------------------------------------------------------------
796 /*GENERAL MONITOR - TIMING AND GEOMETRY*/
797 TH1F * hTime = (TH1F*) generalList->At(1);
798 hTime->SetMarkerStyle(8);
799 hTime->SetMarkerSize(0.7);
800 hTime->SetMarkerColor(kBlue);
801 hTime->SetLineColor(kBlue);
802 hTime->SetFillColor(kBlue);
803 hTime->SetFillStyle(3001);
805 hTime->GetYaxis()->SetTitle("matched tracks");
806 hTime->GetYaxis()->SetTitleOffset(1.35);
808 TH1F * hRawTime = (TH1F*) generalList->At(2);
809 hRawTime->SetMarkerStyle(21);
810 hRawTime->SetMarkerSize(0.7);
811 hRawTime->SetMarkerColor(kGreen);
812 hRawTime->SetLineColor(kGreen);
813 hRawTime->SetFillColor(kGreen);
814 hRawTime->SetFillStyle(3001);
816 hRawTime->GetYaxis()->SetTitle("matched tracks");
817 hRawTime->GetYaxis()->SetTitleOffset(1.35);
819 TLegend *lTime = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC");
820 lTime->SetTextSize(0.04281433);
821 lTime->AddEntry(hRawTime, "raw","L");
822 lTime->AddEntry(hTime, "ESD","L");
823 lTime->SetFillColor(kWhite);
824 lTime->SetShadowColor(0);
826 TH1F * hTot = (TH1F*) generalList->At(3);
827 hTot->SetMarkerStyle(8);
828 hTot->SetMarkerSize(0.7);
829 hTot->SetMarkerColor(kViolet-3);
830 hTot->SetLineColor(kViolet-3);
831 hTot->SetFillColor(kViolet-3);
832 hTot->SetFillStyle(3001);
833 //hTime->SetDrawOption();
834 hTot->GetYaxis()->SetTitle("matched tracks");
835 hTot->GetYaxis()->SetTitleOffset(1.35);
838 char orphansTxt[200];
839 Float_t orphansRatio=0.0;
840 if (hTot->GetEntries()>1){
841 orphansRatio=((Float_t) hTot->GetBinContent(1))/((Float_t) hTot->GetEntries()) ;
843 sprintf(orphansTxt,"orphans/matched tracks = %.4f ",orphansRatio);
844 TH1F * hOrphansRatio=new TH1F("hOrphansRatio","Percentage of signals with only leading edge; percentage (%)",1000,0.,100.);
845 hOrphansRatio->Fill(orphansRatio*100.);
848 TPaveText *tOrphans = new TPaveText(0.38,0.63,0.88,0.7, "NDC");
849 //NDC sets coords relative to pad
850 tOrphans->SetBorderSize(0);
851 tOrphans->SetTextSize(0.045);
852 tOrphans->SetFillColor(0); //white background
853 tOrphans->SetTextAlign(12);
854 tOrphans->SetTextColor(kViolet-3);
855 tOrphans->AddText(orphansTxt);
857 TH1F * hL = (TH1F*) generalList->At(4);
858 hL->SetMarkerStyle(8);
859 hL->SetMarkerSize(0.7);
860 hL->SetMarkerColor(kOrange-3);
861 hL->SetLineColor(kOrange-3);
862 hL->SetFillColor(kOrange-3);
863 hL->SetFillStyle(3001);
864 //hTime->SetDrawOption();
865 hL->GetYaxis()->SetTitle("matched tracks");
866 hL->GetYaxis()->SetTitleOffset(1.35);
868 char negLengthTxt[200];
869 Float_t negLengthRatio=0.0;
870 if (hL->GetEntries()>1){
871 negLengthRatio=(hL->Integral(1,750))/((Float_t) hL->GetEntries()) ;
873 sprintf(negLengthTxt,"tracks with L<350cm /matched tracks = %.5f ",negLengthRatio);
874 TH1F * hLnegRatio=new TH1F("hLnegRatio","Ratio of TOF-matched tracks with L<350cm; ratio (%)",10000,0.,100.);
875 hLnegRatio->Fill(negLengthRatio*100);
879 TPaveText *tLength = new TPaveText(0.15,0.83,0.65,0.87, "NDC");
880 //NDC sets coords relative to pad
881 tLength->SetBorderSize(0);
882 tLength->SetTextSize(0.04);
883 tLength->SetFillColor(0); //white background
884 tLength->SetTextAlign(11);
885 tLength->SetTextColor(kOrange-3);
886 tLength->AddText(negLengthTxt);
889 TCanvas *cTrackProperties= new TCanvas("cTrackProperties","summary of matched tracks properties",900,900);
890 cTrackProperties->Divide(2,2);
891 cTrackProperties->cd(1);
896 hRawTime ->Draw("BARsame");
898 cTrackProperties->cd(2);
904 cTrackProperties->cd(3);
914 hFractionEventsWhits->Write();
918 hOrphansRatio->Write();
922 TH2F* hDxPos4profile = (TH2F*) generalList->At(14);
923 TH2F* hDxNeg4profile = (TH2F*) generalList->At(13);
925 char profilename[30];
926 const Int_t ybinMin = 0;
927 const Int_t ybinMax =hDxPos4profile->GetYaxis()->GetNbins() ;
928 sprintf(profilename,"profDxPos");
929 TProfile * profDxPos = (TProfile*)hDxPos4profile->ProfileX(profilename, ybinMin,ybinMax);
930 sprintf(profilename,"profDxNeg");
931 profDxPos->SetLineWidth(2);
932 TProfile * profDxNeg = (TProfile*)hDxNeg4profile->ProfileX(profilename, ybinMin, ybinMax);
933 profDxNeg->SetLineWidth(2);
935 TH1 *profRatioPosOverNegDx = (TH1*) profDxPos->Clone();
936 profRatioPosOverNegDx->SetName("profRatioPosOverNegDx");
937 profRatioPosOverNegDx->Divide((TH1*) profDxNeg);
938 profRatioPosOverNegDx->GetYaxis()->SetRangeUser(-5.,5.);
939 profRatioPosOverNegDx->GetXaxis()->SetRangeUser(0.,2.);
941 TCanvas *residuals= new TCanvas("residuals","residuals",900,450);
942 residuals->Divide(2,1);
946 hDxPos4profile->GetYaxis()->SetRangeUser(-5.,5.);
947 hDxPos4profile->Draw("colz");
948 profDxPos->SetLineColor(kRed);
949 profDxPos ->Draw("same");
953 hDxNeg4profile->GetYaxis()->SetRangeUser(-5.,5.);
954 hDxNeg4profile->Draw("colz");
955 profDxNeg->SetLineColor(kBlue);
956 profDxNeg->Draw("same");
960 hDxPos4profile->Write();
961 hDxNeg4profile->Write();
964 profRatioPosOverNegDx->Write();
965 //-------------------------------------------------------------
966 /* T0 DETECTOR MONITOR*/
968 TH1F * hT0AC = (TH1F*) timeZeroList->At(0);
969 hT0AC->SetMarkerStyle(8);
970 hT0AC->SetMarkerSize(0.7);
971 hT0AC->SetMarkerColor(kRed);
972 hT0AC->SetLineColor(kRed);
973 hT0AC->SetFillColor(kRed);
974 hT0AC->SetFillStyle(1001);
976 hT0AC->GetYaxis()->SetTitle("events");
977 hT0AC->GetYaxis()->SetTitleOffset(1.35);
978 hT0AC->GetXaxis()->SetLabelSize(0.03);
980 TH1F * hT0A = (TH1F*) timeZeroList->At(1);
981 hT0A->SetMarkerStyle(8);
982 hT0A->SetMarkerSize(0.7);
983 hT0A->SetMarkerColor(kBlue);
984 hT0A->SetLineColor(kBlue);
985 hT0A->SetFillColor(kBlue);
986 hT0A->SetFillStyle(1001);
988 hT0A->GetYaxis()->SetTitle("events");
989 hT0A->GetYaxis()->SetTitleOffset(1.35);
990 hT0A->GetXaxis()->SetLabelSize(0.03);
992 TH1F * hT0C = (TH1F*) timeZeroList->At(2);
993 hT0C->SetMarkerStyle(8);
994 hT0C->SetMarkerSize(0.7);
995 hT0C->SetMarkerColor(kGreen);
996 hT0C->SetLineColor(kGreen);
997 hT0C->SetFillColor(kGreen);
998 hT0C->SetFillStyle(1001);
1000 hT0C->GetYaxis()->SetTitle("events");
1001 hT0C->GetYaxis()->SetTitleOffset(1.35);
1002 hT0C->GetXaxis()->SetLabelSize(0.03);
1004 TLegend *lT0 = new TLegend(0.7125881,0.6052519,0.979435,0.7408306,NULL,"brNDC");
1005 lT0->SetTextSize(0.041);
1006 lT0->AddEntry(hT0AC, "T0 A&C","L");
1007 lT0->AddEntry(hT0A, "T0 A","L");
1008 lT0->AddEntry(hT0C, "T0 C","L");
1009 lT0->SetFillColor(kWhite);
1010 lT0->SetShadowColor(0);
1012 TH1F * hT0res = (TH1F*) timeZeroList->At(3);
1013 hT0res->GetXaxis()->SetLabelSize(0.03);
1015 TCanvas *cT0detector= new TCanvas("cT0detector","T0 detector",900,450);
1016 cT0detector->Divide(2,1);
1021 hT0AC->SetTitle("timeZero measured by T0 detector");
1022 hT0A ->Draw("BARsame");
1023 hT0C ->Draw("BARsame");
1031 // cTrackProperties->cd(3);
1037 TH1F * hT0fillRes = (TH1F*) timeZeroList->At(8);
1038 hT0fillRes->GetXaxis()->SetLabelSize(0.03);
1045 hT0fillRes->Write();
1049 //-------------------------------------------------------------
1050 /*MATCHING EFFICIENCY MONITOR*/
1052 //TH1F * hMatchingVsP =new TH1F("hMatchingVsP","Matching probability vs. P; P(GeV/c); matching probability", 50, 0., 5. );
1054 TH1F * hMatchingVsPt =new TH1F("hMatchingVsPt","Matching probability vs. Pt; Pt(GeV/c); matching probability", 50, 0., 5. );
1056 TH1F * hMatchingVsEta =new TH1F("hMatchingVsEta","Matching probability vs. #\Eta; #\Eta; matching probability", 20, -1., 1.);
1058 TH1F * hMatchingVsPhi =new TH1F("hMatchingVsPhi","Matching probability vs. Phi; Phi(rad); matching probability", 628, 0., 6.28);
1060 /*/matching as function of p
1061 TH1F * hDenom=(TH1F*)generalList->At(9);
1063 hMatchingVsP=(TH1F*) generalList->At(5);
1064 hMatchingVsP->Rebin(5);
1066 hMatchingVsP->Divide(hDenom);
1067 hMatchingVsP->GetYaxis()->SetTitle("matching efficiency");
1068 hMatchingVsP->SetTitle("TOF matching efficiency as function of momentum");
1071 //matching as function of pT
1074 TH1F * hDenom=(TH1F*)generalList->At(10);
1076 hMatchingVsPt=(TH1F*) generalList->At(6);
1077 hMatchingVsPt->Rebin(5);
1079 hMatchingVsPt->Divide(hDenom);
1080 hMatchingVsPt->GetYaxis()->SetTitle("matching efficiency");
1081 hMatchingVsPt->SetTitle("TOF matching efficiency as function of transverse momentum");
1082 hMatchingVsPt->GetYaxis()->SetRangeUser(0,1.2);
1085 //matching as function of eta
1087 hDenom=(TH1F*)generalList->At(11);
1089 hMatchingVsEta=(TH1F*) generalList->At(7);
1090 hMatchingVsEta->Rebin(5);
1092 hMatchingVsEta->Divide(hDenom);
1093 hMatchingVsEta->GetXaxis()->SetRangeUser(-1,1);
1094 hMatchingVsEta->GetYaxis()->SetTitle("matching efficiency");
1095 hMatchingVsEta->GetYaxis()->SetRangeUser(0,1.2);
1096 hMatchingVsEta->SetTitle("TOF matching efficiency as function of pseudorapidity");
1098 //matching as function of phi
1100 hDenom=(TH1F*)generalList->At(12);
1102 hMatchingVsPhi=(TH1F*) generalList->At(8);
1103 //hMatchingVsPhi->Rebin(5);
1105 hMatchingVsPhi->Divide(hDenom);
1106 hMatchingVsPhi->GetYaxis()->SetTitle("matching efficiency");
1107 hMatchingVsPhi->SetTitle("TOF matching efficiency as function of phi");
1108 hMatchingVsPhi->GetYaxis()->SetRangeUser(0,1.2);
1111 TCanvas *cMatchingPerformance= new TCanvas("cMatchingPerformance","summary of matching performance",700,400);
1112 cMatchingPerformance->Divide(2,2);
1113 cMatchingPerformance->cd(1);
1116 hMatchingVsPt->Draw();
1117 cMatchingPerformance->cd(2);
1120 hMatchingVsEta->Draw();
1121 cMatchingPerformance->cd(3);
1124 hMatchingVsPhi->Draw();
1127 hMatchingVsPt->Write();
1128 hMatchingVsEta->Write();
1129 hMatchingVsPhi->Write();
1131 //----------------------------------------------------
1132 /* PID PERFORMANCE MONITOR */
1134 TH2F * hBetaP=(TH2F*)pidList->At(0);
1135 hBetaP->GetYaxis()->SetRangeUser(0.,1.2);
1136 TH1F * hMass=(TH1F*)pidList->At(1);
1137 //hMass->SetMarkerColor(kBlue);
1138 //hMass->SetLineColor(kBlue);
1139 hMass->SetFillColor(kAzure+10);
1140 hMass->SetFillStyle(1001);
1142 hMass->GetYaxis()->SetTitle("tracks");
1143 hMass->GetYaxis()->SetTitleOffset(1.35);
1144 hMass->GetXaxis()->SetLabelSize(0.03);
1146 TH1F * hPionDiff=(TH1F*)pidList->At(3);
1149 TH2F * hDiffTimePi=(TH2F*)pidList->At(4);
1150 hDiffTimePi->GetYaxis()->SetRangeUser(-2000.,2000.);
1151 //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
1152 sprintf(profilename,"profDiffTimePi");
1154 TProfile * profDiffTimePi = (TProfile*)hDiffTimePi->ProfileX(profilename, 490, 510);
1155 profDiffTimePi->SetLineWidth(2);
1156 profDiffTimePi->SetLineColor(kRed+2);
1158 TH2F * hDiffTimePiTh=(TH2F*)pidList->At(6);
1159 //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
1160 sprintf(profilename,"profDiffTimePiTh");
1161 hDiffTimePiTh->GetYaxis()->SetRangeUser(-2000.,2000.);
1163 TProfile * profDiffTimePiTh = (TProfile*)hDiffTimePiTh->ProfileX(profilename, 490, 510);
1164 profDiffTimePiTh->SetLineWidth(2);
1165 profDiffTimePiTh->SetLineColor(kRed+2);
1167 TH2F * hDiffTimeKa=(TH2F*)pidList->At(9);
1168 //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
1169 sprintf(profilename,"profDiffTimeKa");
1170 hDiffTimeKa->GetYaxis()->SetRangeUser(-2000.,2000.);
1172 TProfile * profDiffTimeKa = (TProfile*)hDiffTimeKa->ProfileX(profilename, 490, 510);
1173 profDiffTimeKa->SetLineWidth(2);
1174 profDiffTimeKa->SetLineColor(kBlue);
1176 TH2F * hDiffTimeKaTh=(TH2F*)pidList->At(11);
1177 //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
1178 sprintf(profilename,"profDiffTimeKaTh");
1179 hDiffTimeKaTh->GetYaxis()->SetRangeUser(-2000.,2000.);
1180 TProfile * profDiffTimeKaTh = (TProfile*)hDiffTimeKaTh->ProfileX(profilename, 490, 510);
1181 profDiffTimeKaTh->SetLineWidth(2);
1182 profDiffTimeKaTh->SetLineColor(kBlue);
1184 TH2F * hDiffTimePro=(TH2F*)pidList->At(14);
1185 //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
1186 sprintf(profilename,"profDiffTimePro");
1187 hDiffTimePro->GetYaxis()->SetRangeUser(-2000.,2000.);
1188 TProfile * profDiffTimePro = (TProfile*)hDiffTimePro->ProfileX(profilename, 490, 510);
1189 profDiffTimePro->SetLineWidth(2);
1190 profDiffTimePro->SetLineColor(kGreen+2);
1192 TH2F * hDiffTimeProTh=(TH2F*)pidList->At(16);
1193 //hDiffTime->GetYaxis()->Rebin(2);//1 bin=10 ps
1194 sprintf(profilename,"profDiffTimeProTh");
1195 hDiffTimeProTh->GetYaxis()->SetRangeUser(-2000.,2000.);
1196 TProfile * profDiffTimeProTh = (TProfile*)hDiffTimeProTh->ProfileX(profilename, 490, 510);
1197 profDiffTimeProTh->SetLineWidth(2);
1198 profDiffTimeProTh->SetLineColor(kGreen+2);
1201 TCanvas *cPidPerformance= new TCanvas("cPidPerformance","summary of pid performance",800,800);
1202 cPidPerformance->Divide(2,1);
1203 cPidPerformance->cd(1);
1207 hBetaP->Draw("colz");
1209 cPidPerformance->cd(2);
1213 hMass->Draw("HIST BAR");
1215 TLegend * lPid=new TLegend(0.75,0.75,0.95,0.95,"PID");
1216 lPid->AddEntry(profDiffTimePi,"#pi^{#pm}","l");
1217 lPid->AddEntry(profDiffTimeKa,"K^{#pm}","l");
1218 lPid->AddEntry(profDiffTimePro,"p^{#pm}","l");
1220 gStyle->SetOptStat(10);
1221 TCanvas *cPidPerformance2= new TCanvas("cPidPerformance2","summary of pid performance - tracking",700,700);
1222 cPidPerformance2->Divide(2,2);
1223 cPidPerformance2->cd(1);
1227 hDiffTimePi->Draw("colz");
1228 // profDiffTimePi->Draw("same");
1230 cPidPerformance2->cd(2);
1234 hDiffTimeKa->Draw("colz");
1235 //profDiffTimeKa->Draw("same");
1236 cPidPerformance2->cd(3);
1238 hDiffTimePro->Draw("colz");
1239 // profDiffTimePro->Draw("same");
1241 // cPidPerformance2->cd(4);
1242 // profDiffTimePi->Draw();
1243 // profDiffTimeKa->Draw("same");
1244 // profDiffTimePro->Draw("same");
1245 // lPid->Draw("same");
1247 TCanvas *cPidPerformanceTh= new TCanvas("cPidPerformanceTh","summary of pid performance - theoretical times",700,700);
1248 cPidPerformanceTh->Divide(2,2);
1249 cPidPerformanceTh->cd(1);
1253 hDiffTimePiTh->Draw("colz");
1254 profDiffTimePiTh->Draw("same");
1255 cPidPerformanceTh->cd(2);
1259 hDiffTimeKaTh->Draw("colz");
1260 profDiffTimeKaTh->Draw("same");
1261 cPidPerformanceTh->cd(3);
1265 hDiffTimeProTh->Draw("colz");
1266 profDiffTimeProTh->Draw("same");
1267 // cPidPerformanceTh->cd(4);
1268 // profDiffTimePiTh->Draw();
1269 // profDiffTimeKaTh->Draw("same");
1270 // profDiffTimeProTh->Draw("same");
1271 // lPid->Draw("same");
1274 TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePi");
1275 TH1F * hKaonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimeKa");
1276 TH1F * hProtonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePro");
1282 hProtonDiff->Write();
1286 hDiffTimePi->Write();
1287 profDiffTimePi->Write();
1288 hDiffTimeKa->Write();
1289 profDiffTimeKa->Write();
1290 hDiffTimePro->Write();
1291 profDiffTimePro->Write();
1293 hDiffTimePiTh->Write();
1294 profDiffTimePiTh->Write();
1295 hDiffTimeKaTh->Write();
1296 profDiffTimeKaTh->Write();
1297 hDiffTimeProTh->Write();
1298 profDiffTimeProTh->Write();
1301 TH2F * hSigmaPi=(TH2F*)pidList->At(7);
1302 sprintf(profilename,"profSigmaPi");
1303 hSigmaPi->GetYaxis()->SetRangeUser(-5.,5.);
1304 TProfile * profSigmaPi = (TProfile*)hSigmaPi->ProfileX(profilename);
1305 profSigmaPi->SetLineWidth(2);
1306 profSigmaPi->SetLineColor(kRed+2);
1308 TH2F * hSigmaKa=(TH2F*)pidList->At(12);
1309 sprintf(profilename,"profSigmaKa");
1310 hSigmaKa->GetYaxis()->SetRangeUser(-5.,5.);
1311 TProfile * profSigmaKa = (TProfile*)hSigmaKa->ProfileX(profilename);
1312 profSigmaKa->SetLineWidth(2);
1313 profSigmaKa->SetLineColor(kBlue);
1315 TH2F * hSigmaPro=(TH2F*)pidList->At(17);
1316 sprintf(profilename,"profSigmaPro");
1317 hSigmaPro->GetYaxis()->SetRangeUser(-5.,5.);
1318 TProfile * profSigmaPro = (TProfile*)hSigmaPro->ProfileX(profilename);
1319 profSigmaPro->SetLineWidth(2);
1320 profSigmaPro->SetLineColor(kGreen+2);
1325 TLegend * lSigmaPid=new TLegend(0.75,0.75,0.95,0.95,"#sigma_{PID}");
1326 lSigmaPid->AddEntry(profSigmaPi,"#pi^{#pm}","l");
1327 lSigmaPid->AddEntry(profSigmaKa,"K^{#pm}","l");
1328 lSigmaPid->AddEntry(profSigmaPro,"p^{#pm}","l");
1330 TCanvas *cPidPerformance3= new TCanvas("cPidPerformance3","summary of pid performance - sigmas",1200,400);
1331 cPidPerformance3->Divide(3,1);
1332 cPidPerformance3->cd(1);
1337 hSigmaPi->Draw("colz");
1338 profSigmaPi->Draw("same");
1340 cPidPerformance3->cd(2);
1344 hSigmaKa->Draw("colz");
1345 profSigmaKa->Draw("same");
1347 cPidPerformance3->cd(3);
1351 hSigmaPro->Draw("colz");
1352 profSigmaPro->Draw("same");
1357 profSigmaPi->Write();
1359 profSigmaKa->Write();
1361 profSigmaPro->Write();
1364 TH2F* hTOFmatchedDzVsStrip = (TH2F*)generalList->FindObject("hTOFmatchedDzVsStrip");
1365 TCanvas* cProfile = new TCanvas("cProfile","cProfile",50,50,750,550);
1366 gStyle->SetOptStat(0);
1367 hTOFmatchedDzVsStrip->Draw("colz");
1368 Int_t binmin = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(-3);
1369 Int_t binmax = hTOFmatchedDzVsStrip->GetYaxis()->FindBin(3);
1370 TProfile* hDzProfile = (TProfile*)hTOFmatchedDzVsStrip->ProfileX("hDzProfile",binmin, binmax);
1371 hDzProfile->SetLineWidth(3);
1372 hDzProfile->Draw("same");
1373 cProfile->SetGridx();
1374 cProfile->SetGridy();
1375 TString plotDir(Form("Plots_run%d",runNumber));
1376 gSystem->Exec(Form("mkdir %s",plotDir.Data()));
1377 cPidPerformance3->Print(Form("%s/PID_sigmas.png",plotDir.Data()));
1378 cPidPerformance->Print(Form("%s/PID.png",plotDir.Data()));
1379 cPidPerformanceTh->Print(Form("%s/PID_thereticalTimes.png",plotDir.Data()));
1380 cPidPerformance2->Print(Form("%s/PID_ExpTimes.png",plotDir.Data()));
1381 cMatchingPerformance->Print(Form("%s/Matching.png",plotDir.Data()));
1382 cT0detector->Print(Form("%s/T0Detector.png",plotDir.Data()));
1383 cTrackProperties->Print(Form("%s/TrackProperties.png",plotDir.Data()));
1384 residuals->Print(Form("%s/Residuals.png",plotDir.Data()));
1385 cProfile->Print(Form("%s/ProfileDZvsStripNumber.png",plotDir.Data()));
1391 //----------------------------------------------------------
1392 char * SetQAtrainOutputName(Int_t run=0,Int_t year=2011,char *period="LHC11a", char* pass="cpass1",Int_t trainId=76){
1395 sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId);