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 * 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);
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,avTot);
559 hAvTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
561 hPeakTotVsRun->SetBinContent(irun,peakTot);
562 hPeakTotVsRun->SetBinError(irun+1,peakTotErr);
563 hPeakTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
565 hSpreadTotVsRun->SetBinContent(irun,spreadTot);
566 hSpreadTotVsRun->SetBinError(irun+1,spreadTotErr);
567 hSpreadTotVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
569 hNegTimeRatioVsRun->SetBinContent(irun,negTimeRatio);
570 hNegTimeRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
572 hOrphansRatioVsRun->SetBinContent(irun,orphansRatio);
573 hOrphansRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
575 hMeanLVsRun->SetBinContent(irun,avL);
576 hMeanLVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
578 hNegLRatioVsRun->SetBinContent(irun,negLratio);
579 hNegLRatioVsRun->GetXaxis()->SetBinLabel(irun+1,runlabel);
581 hMatchEffVsRun->SetBinContent(irun,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);
596 hT0fillResVsRun->SetBinContent(irun+1,avT0fillRes);
600 char outfilename[200];
601 sprintf(outfilename, "trend_%s",trendFileName);
602 TFile * fout=new TFile(outfilename,"recreate");
610 //------------------------------------------------------------------------------------
612 Int_t RunESDQApostAnalysis(char *qafilename=NULL, Int_t runNumber=-1, Bool_t IsOnGrid=kFALSE, Bool_t canvasE=kFALSE) {
616 /*access qa PWG1 output files - saved locally or on grid as specified by the second argument */
618 char defaultQAoutput[30]="QAresults.root";
619 TGrid::Connect("alien://");
620 TFile * fin= TFile::Open(qafilename,"r");
621 printf("Opening file %s\n",qafilename);
623 printf("ERROR: QA output not found. Exiting with status -1\n");
626 printf("INFO: QA output file %s open. \n",fin->GetName());
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";
638 TDirectoryFile * tofQAdir=(TDirectoryFile*)fin->Get(tofQAdirName);
640 printf("------------------------------------------------------------------\n");
642 printf("------------------------------------------------------------------\n");
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);
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");
657 if ( (!generalList) && (!timeZeroList) && (!pidList) ){
658 printf("ERROR: no QA available \n");
664 printf("------------------------------------------------------------------\n");
666 printf("------------------------------------------------------------------\n");
668 printf("------------------------------------------------------------------\n");
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);
686 char outfilename[60];
687 sprintf(outfilename,"postQA_%i.root",runNumber);
688 TFile * fout=new TFile(outfilename,"recreate");
690 TH1I* hRunNumber=new TH1I("hRunNumber","hRunNumber;run",1,runNumber,runNumber+1);
691 hRunNumber->Fill(runNumber);
693 //-------------------------------------------------------------
694 /*GENERAL MONITOR - MULTIPLICITY*/
695 TH1F*hMulti= (TH1F*) generalList->At(0);
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());
701 hFractionEventsWhits->Fill(fraction*100.);
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);
713 hTime->GetYaxis()->SetTitle("matched tracks");
714 hTime->GetYaxis()->SetTitleOffset(1.35);
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);
724 hRawTime->GetYaxis()->SetTitle("matched tracks");
725 hRawTime->GetYaxis()->SetTitleOffset(1.35);
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);
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);
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()) ;
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.);
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);
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);
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()) ;
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);
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);
797 TCanvas *cTrackProperties= new TCanvas("cTrackProperties","summary of matched tracks properties",900,900);
798 cTrackProperties->Divide(2,2);
799 cTrackProperties->cd(1);
802 hRawTime ->Draw("BARsame");
804 cTrackProperties->cd(2);
808 cTrackProperties->cd(3);
816 hFractionEventsWhits->Write();
820 hOrphansRatio->Write();
824 TH2F* hDxPos4profile = (TH2F*) generalList->At(14);
825 TH2F* hDxNeg4profile = (TH2F*) generalList->At(13);
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);
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.);
843 TCanvas *residuals= new TCanvas("residuals","residuals",900,450);
844 residuals->Divide(2,1);
846 hDxPos4profile->GetYaxis()->SetRangeUser(-5.,5.);
847 hDxPos4profile->Draw("colz");
848 profDxPos->SetLineColor(kRed);
849 profDxPos ->Draw("same");
851 hDxNeg4profile->GetYaxis()->SetRangeUser(-5.,5.);
852 hDxNeg4profile->Draw("colz");
853 profDxNeg->SetLineColor(kBlue);
854 profDxNeg->Draw("same");
858 hDxPos4profile->Write();
859 hDxNeg4profile->Write();
862 profRatioPosOverNegDx->Write();
863 //-------------------------------------------------------------
864 /* T0 DETECTOR MONITOR*/
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);
874 hT0AC->GetYaxis()->SetTitle("events");
875 hT0AC->GetYaxis()->SetTitleOffset(1.35);
876 hT0AC->GetXaxis()->SetLabelSize(0.03);
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);
886 hT0A->GetYaxis()->SetTitle("events");
887 hT0A->GetYaxis()->SetTitleOffset(1.35);
888 hT0A->GetXaxis()->SetLabelSize(0.03);
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);
898 hT0C->GetYaxis()->SetTitle("events");
899 hT0C->GetYaxis()->SetTitleOffset(1.35);
900 hT0C->GetXaxis()->SetLabelSize(0.03);
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);
910 TH1F * hT0res = (TH1F*) timeZeroList->At(3);
911 hT0res->GetXaxis()->SetLabelSize(0.03);
913 TCanvas *cT0detector= new TCanvas("cT0detector","T0 detector",900,450);
914 cT0detector->Divide(2,1);
917 hT0AC->SetTitle("timeZero measured by T0 detector");
918 hT0A ->Draw("BARsame");
919 hT0C ->Draw("BARsame");
925 // cTrackProperties->cd(3);
931 TH1F * hT0fillRes = (TH1F*) timeZeroList->At(8);
932 hT0fillRes->GetXaxis()->SetLabelSize(0.03);
943 //-------------------------------------------------------------
944 /*MATCHING EFFICIENCY MONITOR*/
946 //TH1F * hMatchingVsP =new TH1F("hMatchingVsP","Matching probability vs. P; P(GeV/c); matching probability", 50, 0., 5. );
948 TH1F * hMatchingVsPt =new TH1F("hMatchingVsPt","Matching probability vs. Pt; Pt(GeV/c); matching probability", 50, 0., 5. );
950 TH1F * hMatchingVsEta =new TH1F("hMatchingVsEta","Matching probability vs. #\Eta; #\Eta; matching probability", 20, -1., 1.);
952 TH1F * hMatchingVsPhi =new TH1F("hMatchingVsPhi","Matching probability vs. Phi; Phi(rad); matching probability", 628, 0., 6.28);
954 /*/matching as function of p
955 TH1F * hDenom=(TH1F*)generalList->At(9);
957 hMatchingVsP=(TH1F*) generalList->At(5);
958 hMatchingVsP->Rebin(5);
960 hMatchingVsP->Divide(hDenom);
961 hMatchingVsP->GetYaxis()->SetTitle("matching efficiency");
962 hMatchingVsP->SetTitle("TOF matching efficiency as function of momentum");
965 //matching as function of pT
968 TH1F * hDenom=(TH1F*)generalList->At(10);
970 hMatchingVsPt=(TH1F*) generalList->At(6);
971 hMatchingVsPt->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);
979 //matching as function of eta
981 hDenom=(TH1F*)generalList->At(11);
983 hMatchingVsEta=(TH1F*) generalList->At(7);
984 hMatchingVsEta->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");
992 //matching as function of phi
994 hDenom=(TH1F*)generalList->At(12);
996 hMatchingVsPhi=(TH1F*) generalList->At(8);
997 //hMatchingVsPhi->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);
1005 TCanvas *cMatchingPerformance= new TCanvas("cMatchingPerformance","summary of matching performance",700,400);
1006 cMatchingPerformance->Divide(2,2);
1007 cMatchingPerformance->cd(1);
1009 hMatchingVsPt->Draw();
1010 cMatchingPerformance->cd(2);
1012 hMatchingVsEta->Draw();
1013 cMatchingPerformance->cd(3);
1015 hMatchingVsPhi->Draw();
1018 hMatchingVsPt->Write();
1019 hMatchingVsEta->Write();
1020 hMatchingVsPhi->Write();
1022 //----------------------------------------------------
1023 /* PID PERFORMANCE MONITOR */
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);
1033 hMass->GetYaxis()->SetTitle("tracks");
1034 hMass->GetYaxis()->SetTitleOffset(1.35);
1035 hMass->GetXaxis()->SetLabelSize(0.03);
1037 TH1F * hPionDiff=(TH1F*)pidList->At(3);
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");
1045 TProfile * profDiffTimePi = (TProfile*)hDiffTimePi->ProfileX(profilename, 490, 510);
1046 profDiffTimePi->SetLineWidth(2);
1047 profDiffTimePi->SetLineColor(kRed+2);
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.);
1054 TProfile * profDiffTimePiTh = (TProfile*)hDiffTimePiTh->ProfileX(profilename, 490, 510);
1055 profDiffTimePiTh->SetLineWidth(2);
1056 profDiffTimePiTh->SetLineColor(kRed+2);
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.);
1063 TProfile * profDiffTimeKa = (TProfile*)hDiffTimeKa->ProfileX(profilename, 490, 510);
1064 profDiffTimeKa->SetLineWidth(2);
1065 profDiffTimeKa->SetLineColor(kBlue);
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);
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);
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);
1092 TCanvas *cPidPerformance= new TCanvas("cPidPerformance","summary of pid performance",800,800);
1093 cPidPerformance->Divide(2,1);
1094 cPidPerformance->cd(1);
1098 hBetaP->Draw("colz");
1100 cPidPerformance->cd(2);
1103 hMass->Draw("HIST BAR");
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");
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);
1115 hDiffTimePi->Draw("colz");
1116 // profDiffTimePi->Draw("same");
1118 cPidPerformance2->cd(2);
1120 hDiffTimeKa->Draw("colz");
1121 //profDiffTimeKa->Draw("same");
1122 cPidPerformance2->cd(3);
1124 hDiffTimePro->Draw("colz");
1125 // profDiffTimePro->Draw("same");
1127 // cPidPerformance2->cd(4);
1128 // profDiffTimePi->Draw();
1129 // profDiffTimeKa->Draw("same");
1130 // profDiffTimePro->Draw("same");
1131 // lPid->Draw("same");
1133 TCanvas *cPidPerformanceTh= new TCanvas("cPidPerformanceTh","summary of pid performance - theoretical times",700,700);
1134 cPidPerformanceTh->Divide(2,2);
1135 cPidPerformanceTh->cd(1);
1137 hDiffTimePiTh->Draw("colz");
1138 profDiffTimePiTh->Draw("same");
1139 cPidPerformanceTh->cd(2);
1141 hDiffTimeKaTh->Draw("colz");
1142 profDiffTimeKaTh->Draw("same");
1143 cPidPerformanceTh->cd(3);
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");
1154 TH1F * hPionDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePi");
1155 TH1F * hKaonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimeKa");
1156 TH1F * hProtonDiff=(TH1F*)pidList->FindObject("hTOFmatchedExpTimePro");
1162 hProtonDiff->Write();
1166 hDiffTimePi->Write();
1167 profDiffTimePi->Write();
1168 hDiffTimeKa->Write();
1169 profDiffTimeKa->Write();
1170 hDiffTimePro->Write();
1171 profDiffTimePro->Write();
1173 hDiffTimePiTh->Write();
1174 profDiffTimePiTh->Write();
1175 hDiffTimeKaTh->Write();
1176 profDiffTimeKaTh->Write();
1177 hDiffTimeProTh->Write();
1178 profDiffTimeProTh->Write();
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);
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);
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);
1204 TCanvas *cPidPerformance= new TCanvas("cPidPerformance","summary of pid performance",800,800);
1205 cPidPerformance->Divide(2,1);
1206 cPidPerformance->cd(1);
1210 hBetaP->Draw("colz");
1212 cPidPerformance->cd(2);
1215 hMass->Draw("HIST BAR");
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");
1222 TCanvas *cPidPerformance3= new TCanvas("cPidPerformance3","summary of pid performance - sigmas",1200,400);
1223 cPidPerformance3->Divide(3,1);
1224 cPidPerformance3->cd(1);
1228 hSigmaPi->Draw("colz");
1229 profSigmaPi->Draw("same");
1231 cPidPerformance3->cd(2);
1234 hSigmaKa->Draw("colz");
1235 profSigmaKa->Draw("same");
1237 cPidPerformance3->cd(3);
1239 hSigmaPro->Draw("colz");
1240 profSigmaPro->Draw("same");
1245 profSigmaPi->Write();
1247 profSigmaKa->Write();
1249 profSigmaPro->Write();
1254 //----------------------------------------------------------
1255 char * SetQAtrainOutputName(Int_t run=0,Int_t year=2011,char *period="LHC11a", char* pass="cpass1",Int_t trainId=76){
1258 sprintf(infile,"alien:///alice/data/%i/%s/000%d/ESDs/%s/QA%i/QAresults.root",year,period,runNumber,pass,trainId);