fixed the tainted variables
[u/mrichter/AliRoot.git] / ITS / PlotQASDD.C
CommitLineData
0bca1a77 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <TFile.h>
3#include <TFileMerger.h>
4#include <TAlienFile.h>
5#include <TSystem.h>
6#include <TGrid.h>
7#include <TGridResult.h>
8#include <Riostream.h>
9#include <TObjArray.h>
10#include <TClass.h>
11#include <TKey.h>
12//#include "AliRecoParam.h"
13#endif
14
15enum rawexpert_t{pattern,patternnorm,layer3norm,layer4norm,rawtot};
16enum nonrawexpert_t{layer3,layer4,nonrawtot};
17
18enum rpexpert_t{rlocaldistro,rlayer3norm,rlayer4norm,rmodpattern,rmodpatternnorm,rphilayer3,rphilayer4,rrlayer3,rrlayer4,rtot};
19enum rnonexpert_t{rphizlayer3,rphizlayer4,rglobalrz,rglobalxy,rchargelayer3,rchargelayer4,rtimelayer3,rtimelayer4,rlayer3,rlayer4,nrtot};
20
21enum canvsname_t{canvname0,canvname1,canvname2,canvname3,canvname4,canvname5,canvname6,canvname7,canvname8,canvname9,canvname10,canvname11,canvname12};
22
23void PlotQASDD(Char_t fileName[100]="File.QA.111333.2010.LHC09b.pass2.root",Char_t eventspecie[25]="LowMultiplicity")
24{
25 const TString Rawsexpertname[]={"SDDModPattern","SDDModPatternNORM","SDDphizL3NORM","SDDphizL4NORM"};//4
26 const TString Rawsnonexpertname[]={"SDDphizL3","SDDphizL4"};//2
27
28 const TString RecPointsexpertname[]={"SDDLocalCoordDistrib","SDDModPatternL3RPNORM","SDDModPatternL4RPNORM","SDDModPatternRP","SDDModPatternRPNORM","SDDphidistrib_Layer3","SDDphidistrib_Layer4","SDDrdistrib_Layer3","SDDrdistrib_Layer4"};//9
29 const TString RecPointsnonexpertname[]={"SDDGlobalCoordDistribL3PHIZ","SDDGlobalCoordDistribL4PHIZ","SDDGlobalCoordDistribRZ","SDDGlobalCoordDistribYX","SDDLay3TotCh","SDDLay4TotCh","SDDdrifttime_Layer3","SDDdrifttime_Layer4","SDDModPatternL3RP","SDDModPatternL4RP"};//1
30
31 const TString canvassavedname[]={"RawLayers","Rawpatterns","RawLayersNORM","RecPointsphiz","RecPointsGlobalDistributions","RecPointsCharge","RecPointsDriftTime","RecPointsLocalDistribution","RecPointsLayers","RecPointsLayersNORM","RecPointsLayersPatterns","RecPointsPhiDistribution","RecPointsRDistribution"};//13
32
33 gStyle->SetPalette(1);
34 gStyle->SetOptStat(0);
35 TFile mergedfile(fileName);
36 if(mergedfile.GetKey("ITS")==0x0){
37 printf("In this run ITS QA has not been executed.\n\nExit macro \n\n");
38 return;
39 }
40 Char_t filepath[100];
41 Char_t namecanvas[50];
42 TDirectory *directory=NULL;
43 TDirectory *directory2=NULL;
44 Char_t histoname[200];
45 TH2D *historaw=NULL;
46 TH1F *historaw2=NULL;
47 TH2F *histodraw=NULL;
48
49 TCanvas *canvas1 = new TCanvas("canvas1","SDD QA Plot",1000,600);
50// canvas1->Divide(2,1);
51// TCanvas *canvas3 = new TCanvas("canvas3","RawLayersNORM",1000,600);
52// canvas3->Divide(2,1);
53// TCanvas *canvas2 = new TCanvas("canvas2","Rawpatterns",1000,600);
54// canvas2->Divide(1,2);
55
56// TCanvas *canvas4 = new TCanvas("canvas4","RecPointsphiz",1000,600);
57// canvas4->Divide(2,1);
58// TCanvas *canvas5 = new TCanvas("canvas5","RecPointsGlobalDistributions",1000,600);
59// canvas5->Divide(2,1);
60// TCanvas *canvas6 = new TCanvas("canvas6","RecPointsCharge",1000,600);
61// canvas6->Divide(1,2);
62// TCanvas *canvas7 = new TCanvas("canvas7","RecPointsDriftTime",1000,600);
63// canvas7->Divide(1,2);
64
65// TCanvas *canvas8 = new TCanvas("canvas8","RecPointsLocalDistribution",1000,600);
66// TCanvas *canvas9 = new TCanvas("canvas9","RecPointsLayers",1000,600);
67// canvas9->Divide(2,1);
68
69// TCanvas *canvas10 = new TCanvas("canvas10","RecPointsLayersNORM",1000,600);
70// canvas10->Divide(2,1);
71// TCanvas *canvas11 = new TCanvas("canvas11","RecPointsLayersPatterns",1000,600);
72// canvas11->Divide(1,2);
73// TCanvas *canvas12 = new TCanvas("canvas12","RecPointsPhiDistribution",1000,600);
74// canvas12->Divide(2,1);
75// TCanvas *canvas13 = new TCanvas("canvas13","RecPointsRDistribution",1000,600);
76// canvas13->Divide(2,1);
77
78
79 if(!mergedfile.IsOpen()){return;}else{printf("file is open\n");}
80 for(Int_t ispecie=0;ispecie<AliRecoParam::kNSpecies;ispecie++){
81 //__________________________________________________________________
82 //raw data
83 sprintf(filepath,"ITS/Raws/%s",AliRecoParam::GetEventSpecieName(ispecie));
84 printf("%s",filepath);
85 TString especie(filepath);
86 if(!especie.Contains(eventspecie)){printf("...Found and Skipped\n");continue;}
87 canvas1->Print("SDDQAPlot.ps[");
88 directory=(TDirectory*)mergedfile.Get(filepath);
89 if(!directory){printf("...Not Found\n ");}//faccio l'istogramma
90 else{
91 printf("...Found: The histograms of this EventSpecie will be displayed\n");
92 printf("1\n");
93 canvas1->Clear();
94 canvas1->Divide(2,1);
95 Bool_t updatecanvas[2];
96 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
97 for(Int_t iraws=0;iraws<nonrawtot;iraws++){//non expert raws
98 canvas1->cd(iraws+1);
99
100 sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsnonexpertname[iraws].Data());
101 printf("histo name %s ",Rawsnonexpertname[iraws].Data());
102 historaw=(TH2D*)mergedfile.Get(histoname);
103 if(historaw){printf("...Found\n");historaw->DrawCopy("colz");}
104 else{updatecanvas[iraws]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
105 historaw=NULL;
106 }//end for
107
108 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
109 {
110 canvas1->Update();
111 sprintf(namecanvas,"%s.eps",canvassavedname[canvname0].Data());
112 canvas1->SaveAs(namecanvas);
113 canvas1->Print("SDDQAPlot.ps");
114 }
115 //else{delete canvas1; canvas1=NULL;}
116 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
117 canvas1->Clear();
118 canvas1->Divide(1,2);
119 printf("2 \n");
120 for(Int_t inraws=0;inraws<2;inraws++){//non expert raws
121 canvas1->cd(inraws+1);
122 sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[inraws].Data());
123 printf("histo name %s ",Rawsexpertname[inraws].Data());
124 historaw2=(TH1F*)mergedfile.Get(histoname);
125 if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[inraws]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
126 historaw2=NULL;
127 }//end for
128 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
129 {
130 canvas1->Update();
131 sprintf(namecanvas,"%s.eps",canvassavedname[canvname1].Data());
132 canvas1->SaveAs(namecanvas);
133 canvas1->Print("SDDQAPlot.ps");
134 }
135 //else{delete canvas2; canvas2=NULL;}
136
137 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
138 printf("3\n");
139 canvas1->Clear();
140 canvas1->Divide(2,1);
141 for(Int_t iraws=2;iraws<rawtot;iraws++){//non expert raws
142 canvas1->cd(iraws-1);
143
144 sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[iraws].Data());
145 printf("histo name %s",Rawsexpertname[iraws].Data());
146 historaw=(TH2D*)mergedfile.Get(histoname);
147 if(historaw){printf("...Found\n");historaw->DrawCopy("colz");}else{updatecanvas[iraws-2]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
148 historaw=NULL;
149 }//end for
150 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
151 {
152 canvas1->Update();
153 sprintf(namecanvas,"%s.eps",canvassavedname[canvname2].Data());
154 canvas1->SaveAs(namecanvas);
155 canvas1->Print("SDDQAPlot.ps");
156 }
157 //else{delete canvas3; canvas3=NULL;}
158 }//end if directory
159
160 //_______________________________________________________________________________
161 //rec point
162 sprintf(filepath,"ITS/RecPoints/%s",AliRecoParam::GetEventSpecieName(ispecie));
163 printf("%s\n",filepath);
164 directory2=(TDirectory*)mergedfile.Get(filepath);
165 if(directory2){
166 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
167 canvas1->Clear();
168 canvas1->Divide(2,1);
169 printf("4\n");
170 for(Int_t irp=0;irp<2;irp++){//non expert rec point
171 canvas1->cd(irp+1);
172
173 sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irp].Data());
174 printf("histo name %s ",RecPointsnonexpertname[irp].Data());
175 histodraw=(TH2F*)mergedfile.Get(histoname);
176 if(histodraw){printf("...Found\n");histodraw->DrawCopy("colz");}else{updatecanvas[irp]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
177 histodraw=NULL;
178 }
179 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
180 {
181 canvas1->Update();
182 sprintf(namecanvas,"%s.eps",canvassavedname[canvname3].Data());
183 canvas1->SaveAs(namecanvas);
184 canvas1->Print("SDDQAPlot.ps");
185 }
186 // else{delete canvas4; canvas4=NULL;}
187
188
189 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
190 canvas1->Clear();
191 canvas1->Divide(2,1);
192 printf("5\n");
193 for(Int_t irrp=2;irrp<4;irrp++){//non expert raws
194 canvas1->cd(irrp-1);
195
196 sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrp].Data());
197 printf("histo name %s",RecPointsnonexpertname[irrp].Data() );
198 histodraw=(TH2F*)mergedfile.Get(histoname);
199 if(histodraw){printf("...Found\n");histodraw->DrawCopy("colz");}else{updatecanvas[irrp-2]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
200 histodraw=NULL;
201 }
202 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
203 {
204 canvas1->Update();
205 sprintf(namecanvas,"%s.eps",canvassavedname[canvname4].Data());
206 canvas1->SaveAs(namecanvas);
207 canvas1->Print("SDDQAPlot.ps");
208 }
209 //else{delete canvas5; canvas5=NULL;}
210
211
212 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
213 canvas1->Clear();
214 canvas1->Divide(1,2);
215 printf("6\n");
216 for(Int_t irrpp=4;irrpp<6;irrpp++){//non expert raws
217 canvas1->cd(irrpp-3);
218
219 sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
220 printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
221 historaw2=(TH1F*)mergedfile.Get(histoname);
222 if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[irrpp-4]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
223 historaw2=NULL;
224 }//end for
225 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
226 {
227 canvas1->Update();
228 sprintf(namecanvas,"%s.eps",canvassavedname[canvname5].Data());
229 canvas1->SaveAs(namecanvas);
230 canvas1->Print("SDDQAPlot.ps");
231 }
232 //else{delete canvas6; canvas6=NULL;}
233
234 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
235 canvas1->Clear();
236 canvas1->Divide(1,2);
237 printf("7\n");
238 for(Int_t irrpp=6;irrpp<8;irrpp++){//non expert raws
239 canvas1->cd(irrpp-5);
240 // printf("histo name\n");
241 sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
242 printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
243 historaw2=(TH1F*)mergedfile.Get(histoname);
244 if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[irrpp-6]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
245 historaw2=NULL;
246 }//end for
247 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
248 {
249 canvas1->Update();
250 sprintf(namecanvas,"%s.eps",canvassavedname[canvname6].Data());
251 canvas1->SaveAs(namecanvas);
252 canvas1->Print("SDDQAPlot.ps");
253 }
254 //else{delete canvas7; canvas7=NULL;}
255
256 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
257 canvas1->Clear();
258 printf("8\n");
259 //canvas1->Divide(2,1);
260 sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[rlocaldistro].Data());
261 printf("histo name %s",RecPointsexpertname[rlocaldistro].Data());
262 histodraw=(TH2F*)mergedfile.Get(histoname);
263
264 if(histodraw){printf("...Found\n");histodraw->DrawCopy("colz");}else{updatecanvas[0]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
265 histodraw=NULL;
266 if(updatecanvas[0]==kTRUE){
267 canvas1->Update();
268 sprintf(namecanvas,"%s.eps",canvassavedname[canvname7].Data());
269 canvas1->SaveAs(namecanvas);
270 canvas1->Print("SDDQAPlot.ps");
271 }
272 //else{delete canvas8; canvas8=NULL;}
273
274 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
275 canvas1->Clear();
276 canvas1->Divide(2,1);
277 printf("9\n");
278 for(Int_t i=8;i<10;i++)
279 {
280 canvas1->cd(i-7);
281
282 sprintf(histoname,"ITS/RecPoints/%s/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[i].Data());
283 printf("histo name %s",RecPointsnonexpertname[i].Data());
284 histodraw=(TH2F*)mergedfile.Get(histoname);
285
286 if(histodraw){printf("...Found\n");histodraw->DrawCopy("colz");}else{updatecanvas[i-8]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
287 histodraw=NULL;
288 }
289 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
290 {
291 canvas1->Update();
292 sprintf(namecanvas,"%s.eps",canvassavedname[canvname8].Data());
293 canvas1->SaveAs(namecanvas);
294 canvas1->Print("SDDQAPlot.ps");
295 }
296 //else{delete canvas9; canvas9=NULL;}
297 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
298 canvas1->Clear();
299 canvas1->Divide(2,1);
300 printf("10\n");
301 for(Int_t i=1;i<3;i++)
302 {
303 canvas1->cd(i);
304
305 sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
306 histodraw=(TH2F*)mergedfile.Get(histoname);
307 printf("histo name %s",RecPointsexpertname[i].Data());
308
309 if(histodraw){printf("...Found\n");histodraw->DrawCopy("colz");}else{updatecanvas[i-1]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
310 histodraw=NULL;
311 }
312 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
313 {
314 canvas1->Update();
315 sprintf(namecanvas,"%s.eps",canvassavedname[canvname9].Data());
316 canvas1->SaveAs(namecanvas);
317 canvas1->Print("SDDQAPlot.ps");
318 }
319 //else{delete canvas10; canvas10=NULL;}
320
321 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
322 canvas1->Clear();
323 canvas1->Divide(1,2);
324 printf("11\n");
325 for(Int_t i=3;i<5;i++)
326 {
327 canvas1->cd(i-2);
328
329 sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
330 printf("histo name %s",RecPointsexpertname[i].Data());
331 historaw2=(TH1F*)mergedfile.Get(histoname);
332
333 if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[i-3]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
334 historaw2=NULL;
335 }
336 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
337 {
338 canvas1->Update();
339 sprintf(namecanvas,"%s.eps",canvassavedname[canvname10].Data());
340 canvas1->SaveAs(namecanvas);
341 canvas1->Print("SDDQAPlot.ps");
342 }
343 //else{delete canvas11; canvas11=NULL;}
344
345 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
346 canvas1->Clear();
347 canvas1->Divide(2,1);
348 printf("12\n");
349 for(Int_t i=5;i<7;i++)
350 {
351 canvas1->cd(i-4);
352
353 sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
354 printf("histo name %s",RecPointsexpertname[i].Data());
355 historaw2=(TH1F*)mergedfile.Get(histoname);
356
357 if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[i-5]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
358 historaw2=NULL;
359 }
360 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
361 {
362 canvas1->Update();
363 sprintf(namecanvas,"%s.eps",canvassavedname[canvname11].Data());
364 canvas1->SaveAs(namecanvas);
365 canvas1->Print("SDDQAPlot.ps");
366 }
367 //else{delete canvas12; canvas12=NULL;}
368
369 for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
370 canvas1->Clear();
371 canvas1->Divide(2,1);
372 printf("13\n");
373 for(Int_t i=7;i<9;i++)
374 {
375 canvas1->cd(i-6);
376 sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
377 printf("histo name %s",RecPointsexpertname[i].Data());
378 historaw2=(TH1F*)mergedfile.Get(histoname);
379
380 if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[i-7]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
381 historaw2=NULL;
382 }
383 if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
384 {
385 canvas1->Update();
386 sprintf(namecanvas,"%s.eps",canvassavedname[canvname12].Data());
387 canvas1->SaveAs(namecanvas);
388 canvas1->Print("SDDQAPlot.ps");
389 }
390 canvas1->Print("SDDQAPlot.ps]");
391 //else{delete canvas13; canvas13=NULL;}
392 directory2=NULL;
393 }//end directory
394 }//end for
395
396 delete directory;
397 directory=NULL;
398 delete directory2;
399 directory2=NULL;
400
401}//end macro
402
403