]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/macrosSDD/PlotQASDD.C
Updates in graphics for MPV
[u/mrichter/AliRoot.git] / ITS / macrosSDD / PlotQASDD.C
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 <TFile.h>
13 #include <TFileMerger.h>
14 #include <TAlienFile.h>
15 //#include <TExec.h>
16 #include <TSystem.h>
17 #include <TGrid.h>
18 #include <TGridResult.h>
19 #include <Riostream.h>
20 #include <TObjArray.h>
21 #include <TClass.h>
22 #include <TH1F.h>
23 #include <TH2D.h>
24 #include <TH2F.h>
25 #include <TF1.h>
26 #include <TStyle.h>
27 #include <TCanvas.h>
28 #include <TLegend.h>
29 #include <TMath.h>
30 #include <TString.h>
31 #include "AliRecoParam.h"
32 #endif
33
34 enum rawexpert_t{pattern,patternnorm,layer3norm,layer4norm,layer3occ,layer4occ,rawcheck,rawtot};
35 enum nonrawexpert_t{layer3,layer4,calibl3,calibl4,nonrawtot};
36
37 enum rpexpert_t{rlocaldistro,rlayer3norm,rlayer4norm,rmodpattern,rmodpatternnorm,rphilayer3,rphilayer4,rrlayer3,rrlayer4,occlayer3,occlayer4,recraw2dlayer3,recraw2dlayer4,recrawlayer3,recrawlayer4,dedxlayer3,dedxlayer4,rlayer3,rlayer4,recpointcheck,rtot};
38 enum rnonexpert_t{rphizlayer3,rphizlayer4,rglobalrz,rglobalxy,rchargelayer3,rchargelayer4,rtimelayer3,rtimelayer4,nrtot};
39
40 enum canvsname_t{canvname0,canvname1,canvname2,canvname3,canvname4,canvname5,canvname6,canvname7,canvname8,canvname9,canvname10,canvname11,canvname12,canvname13,canvname14,canvname15,canvname16,canvname17,canvname18,canvname19,canvname20,canvname21,canvname22,canvname23,canvasname24,canvasname25,canvasname26};//27
41
42
43
44 void PlotQASDD(Char_t fileName[100]="File.QA.111333.2010.LHC09b.pass2.root",Bool_t kDoEps=kFALSE,Char_t eventspecie[25]="LowMultiplicity")
45 {
46   const TString Rawsexpertname[]={"SDDModPattern",//0     1
47                                   "SDDModPatternNORM",//1  //1
48                                   "SDDphizL3NORM",    //2  //0
49                                   "SDDphizL4NORM",    //3  //0
50                                   "SDDL3_RelativeOccupancy", //4     4  5
51                                   "SDDL4_RelativeOccupancy",//5      4  5
52                                   "SDDRawDataCheck"//6              6
53                                   };//tot 7
54   const TString Rawsnonexpertname[]={"SDDphizL3",//0   2         
55                                      "SDDphizL4",//1    2
56                                      "SDDphizCalibL3",//2  //   3
57                                      "SDDphizCalibL4"//3     3
58                                      };//tot 4
59
60   const TString RecPointsexpertname[]={"SDDLocalCoordDistrib",//0    //11
61                                        "SDDModPatternL3RP",//1       //12
62                                        "SDDModPatternL4RP",//2       //12
63                                        "SDDModPatternL3RPNORM",//3   //13
64                                        "SDDModPatternL4RPNORM",//4   //13
65                                        "SDDModPatternRP",//5         //14
66                                        "SDDModPatternRPNORM",//6     //14
67                                        "SDDphidistrib_Layer3",//7    //15
68                                        "SDDphidistrib_Layer4",//8    //15
69                                        "SDDrdistrib_Layer3",//9      //16
70                                        "SDDrdistrib_Layer4",//10     //16
71                                        "SDDL3_RelativeOccupancy",//11 //19  20
72                                        "SDDL4_RelativeOccupancy",//12 //19  20
73                                        "SDDL3_Rec2Raw_2D",       //13 //21
74                                        "SDDL4_Rec2Raw_2D",       //14 //21
75                                        "SDDL3_Rec2Raw",          //15 //22  23 
76                                        "SDDL4_Rec2Raw",          //16 //22  23 
77                                        "SDDL3_dedx",             //17 //24  25
78                                        "SDDL4_dedx",             //18   24  25
79                                        "SDDRecPointCheck"//19           26
80                                        };//tot 20
81
82   const TString RecPointsnonexpertname[]={"SDDGlobalCoordDistribL3PHIZ",//0      7
83                                           "SDDGlobalCoordDistribL4PHIZ",//1      7
84                                           "SDDGlobalCoordDistribRZ",//2          8
85                                           "SDDGlobalCoordDistribYX",//3          8
86                                           "SDDLay3TotCh",           //4          9    17
87                                           "SDDLay4TotCh",           //5          9    17
88                                           "SDDdrifttime_Layer3",    //6          10   18
89                                           "SDDdrifttime_Layer4"//7               10   18
90                                          };//tot 8
91
92   const TString canvassavedname[]={"RawLayersNORM",                 //0
93                                    "Rawpatterns",                   //1
94                                    "RawLayers",                     //2
95                                    "CalibConfiguration",            //3
96                                    "RawLayersRelOcc",               //4
97                                    "RawLayersRelOccBoth",           //5
98                                    "CheckRawdata",                  //6
99                                    "RecPointsphiz",                 //7
100                                    "RecPointsGlobalDistributions",  //8
101                                    "RecPointsCharge",               //9
102                                    "RecPointsDriftTime",            //10
103                                    "RecPointsLocalDistribution",    //11
104                                    "RecPointsLayers",               //12
105                                    "RecPointsLayersNORM",           //13
106                                    "RecPointsLayersPatterns",       //14
107                                    "RecPointsPhiDistribution",      //15
108                                    "RecPointsRDistribution",        //16
109                                    "RecPointsChargeBothLayers",     //17
110                                    "RecPointsDriftTimeBothLayers",  //18
111                                    "RecPointsRelLayersOcc",         //19
112                                    "RecPointsLayersRelOccBoth",     //20
113                                    "RecPointsLayersRecRaw2D",       //21
114                                    "RecPointsLayersRecRaw",         //22
115                                    "RecPointsLayersRecRawBoth",     //23
116                                    "RecPointsLayersdedx",           //24
117                                    "RecPointsLayersdedxBoth",       //25
118                                    "CheckRecPoints"                 //26
119                                   };//tot 27
120
121   Char_t trendfile[25]="FileQAtrend.root";
122
123   TString psfilestart=Form("SDDQAPlot.ps[");
124   TString psfile     =Form("SDDQAPlot.ps");
125   TString psfileend  =Form("SDDQAPlot.ps]");
126
127
128   gStyle->SetTitleFont(62,"");
129   gStyle->SetTitleFontSize(0.025);
130   gStyle->SetPalette(1);
131   //  gStyle->SetOptStat("ne");
132   if(gSystem->Exec(Form("ls %s >/dev/null 2>&1", fileName))!=0)
133     {
134       printf(" No file created --- Exit");
135       return;
136     }
137   TFile mergedfile(fileName);
138   if(mergedfile.GetKey("ITS")==0x0){
139     printf("In this run ITS QA has not been executed.\n\nExit macro \n\n");
140     return;
141   }
142   Char_t filepath[100];
143   Char_t namecanvas[50];
144   TDirectory *directory=NULL;
145   TDirectory *directory2=NULL;
146   Char_t histoname[200];
147   TH2D *historaw=NULL;
148   TH1F *historaw2=NULL;
149   TH2F *histodraw=NULL;
150   
151   //  TH1F *histo2save[9];
152   //for(Int_t i=0;i<9;i++){histo2save[i]=NULL;}
153   
154   TF1 *f1 = new TF1("f1","1",-100000,100000); // this is the function defined to multiply histograms
155   Char_t layer[10];
156   float fmax=0.;
157   float fmaxold=0.;
158   float fmaxmargin;
159   
160   Int_t cannum=0;
161   //Int_t histo2savenumber[9]={4,5,6,7,7,8,3,5,1};
162   TCanvas *canvas1 = new TCanvas("canvas1","SDD QA Plot",1000,600);
163   //   TLegend *legend=new TLegend(0.83,0.8,0.97,0.7);
164   TLegend *legend=new TLegend(0.81,0.895,0.95,0.995);
165   Bool_t updatecanvas[2];
166   for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
167   
168   // -------------This part is to read the number of chunks that were merged
169   Float_t fChnknmbr=0.;
170   FILE * pChunkNumber = fopen ("ChunkNumber.txt","r");
171   if(pChunkNumber){
172   Int_t rv=fscanf(pChunkNumber, "%f", &fChnknmbr);
173   fclose (pChunkNumber);
174   }
175   else fChnknmbr=1.;
176
177   gStyle->SetPalette(1);
178   float fCNinv=1./fChnknmbr;
179   //   printf("\n====================>%f\n\n", fCNinv);
180   
181
182   if(!mergedfile.IsOpen()){return;}else{printf("file is open\n");}
183
184   for(Int_t ispecie=0;ispecie<AliRecoParam::kNSpecies;ispecie++){
185     //__________________________________________________________________
186     //raw data
187     sprintf(filepath,"ITS/Raws/%s",AliRecoParam::GetEventSpecieName(ispecie));
188     printf("%s",filepath);
189     TString especie(filepath);
190     if(!especie.Contains(eventspecie)){printf("...Found and Skipped\n");continue;}
191     canvas1->Print(psfilestart.Data());
192     directory=(TDirectory*)mergedfile.Get(filepath);
193     if(!directory){printf("...Not Found\n ");}//faccio l'istogramma
194     else{
195       
196       printf("...Found: The histograms of this EventSpecie will be displayed\n");
197       printf("0\n");
198       canvas1->Clear();
199       canvas1->Divide(2,1);
200       
201       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
202       for(Int_t iraws=2;iraws<4;iraws++){//non expert raws
203         canvas1->cd(iraws-1);
204         
205         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[iraws].Data());
206         printf("histo name %s ",Rawsexpertname[iraws].Data());
207         historaw=(TH2D*)mergedfile.Get(histoname);
208         if(historaw){printf("...Found\n");        historaw->Multiply(f1,fCNinv);  historaw->DrawCopy("colz");}
209         else
210           {
211             sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[iraws].Data());
212             printf("...Not found\nSecond try for histo name %s ",Rawsexpertname[iraws].Data());
213             historaw=(TH2D*)mergedfile.Get(histoname);
214             if(historaw){printf("...Found\n");    historaw->Multiply(f1,fCNinv);historaw->DrawCopy("colz");} 
215             else
216               {
217                 updatecanvas[iraws-2]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");
218               }
219           }
220         historaw=NULL;
221       }//end for        
222       
223       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
224         {
225           canvas1->Update();
226           if(kDoEps){
227             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
228             canvas1->SaveAs(namecanvas);
229           }
230           canvas1->Print(psfile.Data());
231         }
232       //else{delete canvas1; canvas1=NULL;}
233       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
234       canvas1->Clear();
235       canvas1->Divide(1,2);
236       printf("1\n");
237       cannum++;
238       for(Int_t inraws=0;inraws<2;inraws++){//non expert raws
239         canvas1->cd(inraws+1);
240         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[inraws].Data());
241         printf("histo name %s ",Rawsexpertname[inraws].Data());
242         historaw2=(TH1F*)mergedfile.Get(histoname);     
243         //        -----------------This is the part were I divide between the number of chunks to normalize the histogram----------------
244         
245         
246         if(historaw2)
247           {
248             printf("...Found\n");
249             if (inraws==1)
250               {
251                 historaw2->Multiply(f1,fCNinv);
252                 
253               }
254             historaw2->DrawCopy();
255           }
256         else {updatecanvas[inraws]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
257         historaw2=NULL;
258       }//end for
259       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
260         {
261           canvas1->Update();
262           if(kDoEps){
263             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
264             canvas1->SaveAs(namecanvas);
265           }
266           canvas1->Print(psfile.Data()); 
267         }
268       //else{delete canvas2; canvas2=NULL;}
269       
270       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
271       printf("2\n");
272       cannum++;
273       canvas1->Clear();
274       canvas1->Divide(2,1);
275       for(Int_t iraws=0;iraws<2;iraws++){//non expert raws
276         canvas1->cd(iraws+1);
277         
278         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsnonexpertname[iraws].Data());
279         printf("histo name %s",Rawsnonexpertname[iraws].Data());
280         historaw=(TH2D*)mergedfile.Get(histoname);
281         if(historaw){
282           printf("...Found\n");
283           //      historaw->SetTitleSize(0.02);
284
285           historaw->DrawCopy("colz");
286         }
287         else
288           {
289             sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsnonexpertname[iraws].Data());
290             printf("...Not Found.\n Second Try for histo name %s",Rawsnonexpertname[iraws].Data());
291             historaw=(TH2D*)mergedfile.Get(histoname);
292             if(historaw){
293               printf("...Found\n");
294               //              historaw->SetTitleSize(0.02);
295               historaw->Multiply(f1,fCNinv);
296               historaw->DrawCopy("colz");
297             }
298             else
299               {
300                 updatecanvas[iraws]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");
301               }
302           } 
303         historaw=NULL;
304       }//end for
305       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
306         {
307           canvas1->Update();
308           if(kDoEps){
309             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
310             canvas1->SaveAs(namecanvas);
311           }
312           canvas1->Print(psfile.Data()); 
313         }
314       //else{delete canvas3; canvas3=NULL;}
315       
316       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
317       printf("3\n");
318       cannum++;
319       canvas1->Clear();
320       canvas1->Divide(2,1);
321       for(Int_t iraws=2;iraws<4;iraws++){//non expert raws
322         canvas1->cd(iraws-1);
323         
324         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsnonexpertname[iraws].Data());
325         printf("histo name %s",Rawsnonexpertname[iraws].Data());
326         historaw=(TH2D*)mergedfile.Get(histoname);
327         if(historaw){
328           printf("...Found\n");
329           //      historaw->SetTitleSize(0.02);
330           //      historaw->Multiply(f1,fCNinv);
331           historaw->DrawCopy("colz");
332         }
333         else
334           {
335             updatecanvas[iraws]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");
336           } 
337         historaw=NULL;
338       }//end for
339       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
340         {
341           canvas1->Update();
342           if(kDoEps){
343             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
344             canvas1->SaveAs(namecanvas);
345           }
346           canvas1->Print(psfile.Data()); 
347         }
348
349       //--------------------- new plots
350       printf("================= 4\n");
351       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
352       cannum++;
353       canvas1->Clear();
354       canvas1->Divide(2,1);
355       for(Int_t iraws=4;iraws<rawtot-1;iraws++){//non expert raws
356         canvas1->cd(iraws-3);
357         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[iraws].Data());
358         printf("histo name %s",Rawsexpertname[iraws].Data());
359         historaw2=(TH1F*)mergedfile.Get(histoname);
360         if(historaw2)
361           {
362             printf("...Found\n");
363             historaw2->DrawCopy();
364           }else
365           {
366             updatecanvas[iraws-4]=kFALSE;
367             printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");
368           } 
369         historaw2=NULL;
370       }//end for
371       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
372         {
373           canvas1->Update();
374           if(kDoEps){
375             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
376             canvas1->SaveAs(namecanvas);
377           }
378           canvas1->Print(psfile.Data()); 
379         }
380       //else{delete canvas3; canvas3=NULL;}
381       
382       
383       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
384       canvas1->Clear();
385       legend->Clear();
386       printf("5\n");
387       cannum++;
388       for (Int_t i=4;i<rawtot-1;i++){
389         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[i].Data());
390         historaw2=(TH1F*)mergedfile.Get(histoname);
391         if(historaw2){
392           fmax=historaw2->GetMaximum();
393           if (i==4){
394             fmaxold=fmax;}
395           if (i!=4){
396             if(fmaxold<fmax){
397               fmaxold=fmax;
398             }
399           }
400         }
401         historaw2=NULL;
402       }
403       fmaxmargin=1.1*fmaxold;
404       for(Int_t irrpp=4;irrpp<rawtot-1;irrpp++){//non expert raws
405         
406         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[irrpp].Data());
407         printf("histo name %s",Rawsexpertname[irrpp].Data());
408         sprintf(layer, "layer %d",irrpp-1);
409         historaw2=(TH1F*)mergedfile.Get(histoname);
410         gStyle->SetOptStat(0);
411         
412         if(historaw2)
413           {
414             printf("...Found\n");
415             historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
416             historaw2->SetTitle("Raw Relative Occupancy");
417             if (irrpp==4) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
418             if (irrpp!=4) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
419             legend->AddEntry(historaw2,layer,"l");
420             legend->Draw();
421             canvas1->Update();
422           }
423         else{updatecanvas[irrpp-4]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
424         historaw2=NULL;
425       }//end for
426       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
427         {
428           canvas1->Update();
429           if(kDoEps){
430             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
431             canvas1->SaveAs(namecanvas);
432           }
433           canvas1->Print(psfile.Data()); 
434         }
435       //---------------------------- summary plot ------------------------//
436       printf("6\n");
437       canvas1->Clear();
438       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
439       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[rawtot-1].Data());
440       printf("histo name %s",Rawsexpertname[rawtot-1].Data());
441       cannum++;
442       historaw2=(TH1F*)mergedfile.Get(histoname);
443         if(historaw2)
444           {
445             printf("...Found\n");
446             historaw2->SetStats(0);
447             historaw2->DrawCopy();
448             canvas1->Update();
449           }
450         else{updatecanvas[0]=kFALSE;updatecanvas[1]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
451         historaw2=NULL;
452         if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
453           {
454             canvas1->Update();
455             if(kDoEps){
456               sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
457               canvas1->SaveAs(namecanvas);
458             }
459             canvas1->Print(psfile.Data()); 
460           }
461
462     }//end if directory
463         
464     
465     
466     //_______________________________________________________________________________
467     //rec point
468     sprintf(filepath,"ITS/RecPoints/%s",AliRecoParam::GetEventSpecieName(ispecie));
469     printf("%s\n",filepath);
470     directory2=(TDirectory*)mergedfile.Get(filepath);
471     if(directory2){
472       
473       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
474       canvas1->Clear();
475       canvas1->Divide(2,1);
476       printf("7\n");
477       cannum++;
478       for(Int_t irp=0;irp<2;irp++){//non expert rec point
479         canvas1->cd(irp+1);
480         
481         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irp].Data());
482         printf("histo name %s ",RecPointsnonexpertname[irp].Data());
483         histodraw=(TH2F*)mergedfile.Get(histoname);
484         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");}
485         histodraw=NULL;
486       }
487       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
488         {
489           canvas1->Update();
490           if(kDoEps){
491             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
492             canvas1->SaveAs(namecanvas);
493           }
494           canvas1->Print(psfile.Data()); 
495         }
496       //        else{delete canvas4; canvas4=NULL;}
497       
498       
499       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
500       canvas1->Clear();
501       canvas1->Divide(2,1);
502       printf("8\n");
503       cannum++;
504       for(Int_t irrp=2;irrp<4;irrp++){//non expert raws
505         canvas1->cd(irrp-1);
506         
507         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrp].Data());
508         printf("histo name %s",RecPointsnonexpertname[irrp].Data() );
509         histodraw=(TH2F*)mergedfile.Get(histoname);
510         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");}
511         histodraw=NULL;
512       }
513       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
514         {
515           canvas1->Update();
516           if(kDoEps){
517             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
518             canvas1->SaveAs(namecanvas);
519           }
520           canvas1->Print(psfile.Data()); 
521         }
522       //else{delete canvas5; canvas5=NULL;}
523       
524       
525       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
526       canvas1->Clear();
527       canvas1->Divide(1,2);
528       printf("9\n");
529       cannum++;
530       for(Int_t irrpp=4;irrpp<6;irrpp++){//non expert raws
531         canvas1->cd(irrpp-3);
532         
533         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
534         printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
535         historaw2=(TH1F*)mergedfile.Get(histoname);
536         
537         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");}
538         historaw2=NULL;
539       }//end for
540       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
541         {
542           canvas1->Update();
543           if(kDoEps){
544             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
545             canvas1->SaveAs(namecanvas);
546           }
547           canvas1->Print(psfile.Data()); 
548         }
549       //else{delete canvas6; canvas6=NULL;}
550       
551       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
552       canvas1->Clear();
553       canvas1->Divide(1,2);
554       printf("10\n");
555       cannum++;
556       for(Int_t irrpp=6;irrpp<8;irrpp++){//non expert raws
557         canvas1->cd(irrpp-5);
558         //        printf("histo name\n");
559         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
560         printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
561         historaw2=(TH1F*)mergedfile.Get(histoname);
562         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");}
563         historaw2=NULL;
564       }//end for
565       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
566         {
567           canvas1->Update();
568           if(kDoEps){
569             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
570             canvas1->SaveAs(namecanvas);
571           }
572           canvas1->Print(psfile.Data()); 
573         }
574       //else{delete canvas7; canvas7=NULL;}
575
576       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
577       canvas1->Clear();
578       printf("11\n");
579       cannum++;
580       //canvas1->Divide(2,1);
581       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[rlocaldistro].Data());
582       printf("histo name %s",RecPointsexpertname[rlocaldistro].Data());
583       histodraw=(TH2F*)mergedfile.Get(histoname);
584
585       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");}
586       histodraw=NULL;
587       if(updatecanvas[0]==kTRUE){
588         canvas1->Update();
589         if(kDoEps){
590           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
591           canvas1->SaveAs(namecanvas);
592         }
593         canvas1->Print(psfile.Data()); 
594       }
595       //else{delete canvas8; canvas8=NULL;}
596        
597       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
598       canvas1->Clear();
599       canvas1->Divide(2,1);
600       printf("12\n");
601       cannum++;
602       for(Int_t i=1;i<3;i++)
603         {
604           canvas1->cd(i);
605
606           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
607           printf("histo name %s",RecPointsexpertname[i].Data());
608           histodraw=(TH2F*)mergedfile.Get(histoname);
609
610           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");}
611           histodraw=NULL;
612         }
613       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
614         {
615           canvas1->Update();
616           if(kDoEps){
617             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
618             canvas1->SaveAs(namecanvas);
619           }
620           canvas1->Print(psfile.Data()); 
621         }
622       
623       //else{delete canvas9; canvas9=NULL;}
624       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
625       canvas1->Clear();
626       canvas1->Divide(2,1);
627       printf("13\n");
628       cannum++;
629       for(Int_t i=3;i<5;i++)
630         {
631           canvas1->cd(i-2);
632
633           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
634           histodraw=(TH2F*)mergedfile.Get(histoname);
635           printf("histo name %s",RecPointsexpertname[i].Data());
636
637           if(histodraw){
638             printf("...Found\n");histodraw->Multiply(f1,fCNinv);
639             histodraw->DrawCopy("colz");
640           }else{updatecanvas[i-3]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
641           histodraw=NULL;
642         }
643       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
644         {
645           canvas1->Update();
646           if(kDoEps){
647             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
648             canvas1->SaveAs(namecanvas);
649           }
650           canvas1->Print(psfile.Data()); 
651         }
652
653       
654       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
655       canvas1->Clear();
656       canvas1->Divide(1,2);
657
658       printf("14\n");
659       cannum++;
660       for(Int_t i=5;i<7;i++)
661         {
662           canvas1->cd(i-4);
663
664           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
665           printf("histo name %s",RecPointsexpertname[i].Data());
666           historaw2=(TH1F*)mergedfile.Get(histoname);
667
668           if(historaw2)
669             {
670               printf("...Found\n");
671               if (i==4){historaw2->Multiply(f1,fCNinv);}
672               historaw2->DrawCopy();
673             }
674           else{updatecanvas[i-5]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
675           historaw2=NULL;
676         }
677       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
678         {
679           canvas1->Update();
680           if(kDoEps){
681             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
682             canvas1->SaveAs(namecanvas);
683           }
684           canvas1->Print(psfile.Data()); 
685         }
686
687
688       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
689       canvas1->Clear();
690       canvas1->Divide(2,1);
691       printf("15\n");
692       cannum++;
693       for(Int_t i=7;i<9;i++)
694         {
695           canvas1->cd(i-6);
696
697           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
698           printf("histo name %s",RecPointsexpertname[i].Data());
699           historaw2=(TH1F*)mergedfile.Get(histoname);
700
701           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");}
702           historaw2=NULL;
703         }
704       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
705         {
706           canvas1->Update();
707           if(kDoEps){
708             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
709             canvas1->SaveAs(namecanvas);
710           }
711           canvas1->Print(psfile.Data()); 
712         }
713  
714       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
715       canvas1->Clear();
716       canvas1->Divide(2,1);
717       printf("16\n");
718       cannum++;
719       for(Int_t i=9;i<11;i++)
720         {
721           canvas1->cd(i-8);
722           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
723           printf("histo name %s",RecPointsexpertname[i].Data());
724           historaw2=(TH1F*)mergedfile.Get(histoname);
725
726           if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[i-9]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
727           historaw2=NULL;
728         }
729       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
730         {
731           canvas1->Update();
732           if(kDoEps){
733             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
734             canvas1->SaveAs(namecanvas);
735           }
736           canvas1->Print(psfile.Data()); 
737         }
738           
739
740       //superimposed
741       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
742       canvas1->Clear();
743       legend->Clear();
744       printf("17\n");
745       cannum++;
746       for (Int_t i=4;i<6;i++){
747         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[i].Data());
748         historaw2=(TH1F*)mergedfile.Get(histoname);
749         if(historaw2){
750           fmax=historaw2->GetMaximum();
751           if (i==4){
752             fmaxold=fmax;}
753           if (i!=4){
754             if(fmaxold<fmax){
755               fmaxold=fmax;
756             }
757           }
758         }
759         historaw2=NULL;
760       }
761       fmaxmargin=1.1*fmaxold;
762       for(Int_t irrpp=4;irrpp<6;irrpp++){//non expert raws
763     
764         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
765         printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
766         sprintf(layer, "layer %d",irrpp-1);
767         historaw2=(TH1F*)mergedfile.Get(histoname);
768         gStyle->SetOptStat(0);
769           
770         if(historaw2)
771           {
772             printf("...Found\n");
773             historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
774             historaw2->SetTitle("Charge");
775             historaw2->SetFillColor(0);
776             if (irrpp==4) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
777             if (irrpp!=4) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
778             legend->AddEntry(historaw2,layer,"l");
779             legend->Draw();
780             canvas1->Update();
781           }
782         else{updatecanvas[irrpp-4]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
783         historaw2=NULL;
784       }//end for
785       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
786         {
787           canvas1->Update();
788           if(kDoEps){
789             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
790             canvas1->SaveAs(namecanvas);
791           }
792           canvas1->Print(psfile.Data()); 
793         }
794           
795       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
796       canvas1->Clear();
797       legend->Clear();
798       printf("18\n");
799       cannum++;
800       for (Int_t i=6;i<8;i++){
801         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[i].Data());
802         historaw2=(TH1F*)mergedfile.Get(histoname);
803         if(historaw2){
804           fmax=historaw2->GetMaximum();
805           if (i==6){
806             fmaxold=fmax;}
807           if (i!=6){
808             if(fmaxold<fmax){
809               fmaxold=fmax;}}}
810         fmaxmargin=1.1*fmaxold;
811       }
812       for(Int_t irrpp=6;irrpp<8;irrpp++){//non expert raws
813     
814         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
815         printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
816         sprintf(layer, "layer %d",irrpp-3);
817         historaw2=(TH1F*)mergedfile.Get(histoname);
818         gStyle->SetOptStat(0);
819           
820         if(historaw2)
821           {
822             printf("...Found\n");
823             historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
824             historaw2->SetTitle("Drift Time");
825             historaw2->SetFillColor(0);
826             if (irrpp==6) {historaw2->SetStats(0); historaw2->SetLineColor(2);historaw2->DrawCopy();}
827             if (irrpp!=6) {historaw2->SetStats(0); historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
828             legend->AddEntry(historaw2,layer,"l");
829             legend->Draw();
830             canvas1->Update();
831           }
832         else{updatecanvas[irrpp-6]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
833         printf("%s\n%s\n",historaw2->GetName(),historaw2->GetTitle());
834         historaw2=NULL;
835       }//end for
836       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
837         {
838           canvas1->Update();
839           if(kDoEps){
840             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
841             canvas1->SaveAs(namecanvas);
842           }
843           canvas1->Print(psfile.Data()); 
844         }
845
846       //------------------------------------------- new plot
847
848       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
849       canvas1->Clear();
850       canvas1->Divide(2,1);
851       printf("19\n");
852       cannum++;
853       for(Int_t i=11;i<13;i++)
854         {
855           canvas1->cd(i-10);
856           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
857           printf("histo name %s",RecPointsexpertname[i].Data());
858           historaw2=(TH1F*)mergedfile.Get(histoname);
859
860           if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[i-11]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
861           historaw2=NULL;
862         }
863       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
864         {
865           canvas1->Update();
866           if(kDoEps){
867             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
868             canvas1->SaveAs(namecanvas);
869           }
870           canvas1->Print(psfile.Data()); 
871         }
872           
873       //------------------------------------
874       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
875       canvas1->Clear();
876       legend->Clear();
877       printf("20\n");
878       cannum++;
879       for (Int_t i=11;i<13;i++){
880         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
881         historaw2=(TH1F*)mergedfile.Get(histoname);
882         if(historaw2){
883           fmax=historaw2->GetMaximum();
884           if (i==4){
885             fmaxold=fmax;}
886           if (i!=4){
887             if(fmaxold<fmax){
888               fmaxold=fmax;
889             }
890           }
891         }
892         historaw2=NULL;
893       }
894       fmaxmargin=1.1*fmaxold;
895       for(Int_t irrpp=11;irrpp<13;irrpp++){//non expert raws
896           
897         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[irrpp].Data());
898         printf("histo name %s",RecPointsexpertname[irrpp].Data());
899         sprintf(layer, "layer %d",irrpp-8);
900         historaw2=(TH1F*)mergedfile.Get(histoname);
901         gStyle->SetOptStat(0);
902           
903         if(historaw2)
904           {
905             printf("...Found\n");
906             historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
907             historaw2->SetTitle("RecPoint Relative Occupancy");
908             if (irrpp==11) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
909             if (irrpp!=11) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
910             legend->AddEntry(historaw2,layer,"l");
911             legend->Draw();
912             canvas1->Update();
913           }
914         else{updatecanvas[irrpp-11]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
915         historaw2=NULL;
916       }//end for
917       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
918         {
919           canvas1->Update();
920           if(kDoEps){
921             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
922             canvas1->SaveAs(namecanvas);
923           }
924           canvas1->Print(psfile.Data()); 
925         }
926
927
928       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
929       canvas1->Clear();
930       canvas1->Divide(2,1);
931       printf("21\n");
932       cannum++;
933       for(Int_t i=13;i<15;i++)
934         {
935           canvas1->cd(i-12);
936           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
937           printf("histo name %s",RecPointsexpertname[i].Data());
938           historaw=(TH2D*)mergedfile.Get(histoname);
939
940           if(historaw){printf("...Found\n");  historaw->DrawCopy("colz");}else{updatecanvas[i-13]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
941           historaw=NULL;
942         }
943       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
944         {
945           canvas1->Update();
946           if(kDoEps){
947             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
948             canvas1->SaveAs(namecanvas);
949           }
950           canvas1->Print(psfile.Data()); 
951         }
952           
953
954
955       //-----------------
956       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
957       canvas1->Clear();
958       canvas1->Divide(2,1);
959       printf("22\n");
960       cannum++;
961       for(Int_t i=15;i<17;i++)
962         {
963           canvas1->cd(i-14);
964           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
965           printf("histo name %s",RecPointsexpertname[i].Data());
966           historaw2=(TH1F*)mergedfile.Get(histoname);
967
968           if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[i-15]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
969           historaw2=NULL;
970         }
971       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
972         {
973           canvas1->Update();
974           if(kDoEps){
975             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
976             canvas1->SaveAs(namecanvas);
977           }
978           canvas1->Print(psfile.Data()); 
979         }
980       //--------------------------------------------
981
982       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
983       canvas1->Clear();
984       legend->Clear();
985       printf("23\n");
986       cannum++;
987       for (Int_t i=15;i<17;i++){
988         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
989         historaw2=(TH1F*)mergedfile.Get(histoname);
990         if(historaw2){
991           fmax=historaw2->GetMaximum();
992           if (i==15){
993             fmaxold=fmax;}
994           if (i!=15){
995             if(fmaxold<fmax){
996               fmaxold=fmax;
997             }
998           }
999         }
1000         historaw2=NULL;
1001       }
1002       fmaxmargin=1.1*fmaxold;
1003       for(Int_t irrpp=15;irrpp<17;irrpp++){//non expert raws
1004     
1005         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[irrpp].Data());
1006         printf("histo name %s",RecPointsexpertname[irrpp].Data());
1007         sprintf(layer, "layer %d",irrpp-12);
1008         historaw2=(TH1F*)mergedfile.Get(histoname);
1009         gStyle->SetOptStat(0);
1010           
1011         if(historaw2)
1012           {
1013             printf("...Found\n");
1014             historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
1015             historaw2->SetTitle("Rec2Raw Ratio");
1016             if (irrpp==15) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
1017             if (irrpp!=15) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
1018             legend->AddEntry(historaw2,layer,"l");
1019             legend->Draw();
1020             canvas1->Update();
1021           }
1022         else{updatecanvas[irrpp-15]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
1023         historaw2=NULL;
1024       }//end for
1025       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
1026         {
1027           canvas1->Update();
1028           if(kDoEps){
1029             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
1030             canvas1->SaveAs(namecanvas);
1031           }
1032           canvas1->Print(psfile.Data()); 
1033         }
1034
1035           
1036       //--------------------------------------
1037           
1038       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
1039       canvas1->Clear();
1040       canvas1->Divide(2,1);
1041       printf("24\n");
1042       cannum++;
1043       for(Int_t i=17;i<19;i++)
1044         {
1045           canvas1->cd(i-16);
1046           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
1047           printf("histo name %s",RecPointsexpertname[i].Data());
1048           historaw2=(TH1F*)mergedfile.Get(histoname);
1049                 
1050           if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[i-17]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
1051           historaw2=NULL;
1052         }
1053       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
1054         {
1055           canvas1->Update();
1056           if(kDoEps){
1057             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
1058             canvas1->SaveAs(namecanvas);
1059           }
1060           canvas1->Print(psfile.Data()); 
1061         }
1062           
1063
1064       //--------------------------------------------
1065
1066       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
1067       canvas1->Clear();
1068       legend->Clear();
1069       printf("25\n");
1070       cannum++;
1071       for (Int_t i=17;i<19;i++){
1072         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
1073         historaw2=(TH1F*)mergedfile.Get(histoname);
1074         if(historaw2){
1075           fmax=historaw2->GetMaximum();
1076           if (i==17){
1077             fmaxold=fmax;}
1078           if (i!=17){
1079             if(fmaxold<fmax){fmaxold=fmax;}
1080           }
1081         }
1082         historaw2=NULL;
1083       }
1084       fmaxmargin=1.1*fmaxold;
1085       for(Int_t irrpp=17;irrpp<19;irrpp++){//non expert raws
1086     
1087         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[irrpp].Data());
1088         printf("histo name %s",RecPointsexpertname[irrpp].Data());
1089         sprintf(layer, "layer %d",irrpp-14);
1090         historaw2=(TH1F*)mergedfile.Get(histoname);
1091         gStyle->SetOptStat(0);
1092           
1093         if(historaw2)
1094           {
1095             printf("...Found\n");
1096             historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
1097             historaw2->SetTitle("RecPoint dEdx");
1098             if (irrpp==17) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
1099             if (irrpp!=17) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
1100             legend->AddEntry(historaw2,layer,"l");
1101             legend->Draw();
1102             canvas1->Update();
1103           }
1104         else{updatecanvas[irrpp-15]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
1105         historaw2=NULL;
1106       }//end for
1107       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
1108         {
1109           canvas1->Update();
1110           if(kDoEps){
1111             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
1112             canvas1->SaveAs(namecanvas);
1113           }
1114           canvas1->Print(psfile.Data()); 
1115
1116       //------------------------summary plot ---------------//
1117
1118       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
1119       canvas1->Clear();
1120
1121       printf("26\n");
1122       cannum++;
1123
1124
1125           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[rtot-1].Data());
1126           printf("histo name %s",RecPointsexpertname[rtot-1].Data());
1127           historaw2=(TH1F*)mergedfile.Get(histoname);
1128
1129           if(historaw2)
1130             {
1131               printf("...Found\n");
1132         
1133               historaw2->DrawCopy();
1134             }
1135           else{updatecanvas[0]=kFALSE;updatecanvas[1]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
1136           historaw2=NULL;
1137
1138       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
1139         {
1140           canvas1->Update();
1141           if(kDoEps){
1142             sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
1143             canvas1->SaveAs(namecanvas);
1144           }
1145           canvas1->Print(psfile.Data()); 
1146         }
1147     
1148
1149
1150
1151         }
1152       canvas1->Print(psfileend.Data()); 
1153
1154       TFile file2savefortrend(trendfile,"recreate");
1155       file2savefortrend.cd();
1156       
1157       for(Int_t isave=0;isave<nonrawtot;isave++)
1158         {
1159           sprintf(histoname,"ITS/Raws/%s/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),Rawsnonexpertname[isave].Data());
1160           historaw=(TH2D*)mergedfile.Get(histoname);
1161           historaw->Write();
1162           printf("Saved  %s\n",histoname);
1163           historaw=NULL;
1164         }
1165       
1166       for(Int_t isave1=0;isave1<rawtot;isave1++)
1167         {
1168           sprintf(histoname,"ITS/Raws/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[isave1].Data());
1169           if(isave1==2||isave1==3)
1170             {
1171               historaw=(TH2D*)mergedfile.Get(histoname);
1172               historaw->Write();
1173               historaw=NULL;
1174             }
1175           else
1176             {
1177               historaw2=(TH1F*)mergedfile.Get(histoname);
1178               historaw2->Write();
1179               historaw2=NULL;
1180             }
1181           printf("Saved %s\n",histoname);
1182         }
1183       
1184       for(Int_t isave2=0;isave2<nrtot;isave2++)
1185         {
1186           sprintf(histoname,"ITS/RecPoints/%s/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[isave2].Data());
1187           if(isave2<4||isave2==17||isave2==18)
1188             {
1189               historaw=(TH2D*)mergedfile.Get(histoname);
1190               historaw->Write();
1191               historaw=NULL;
1192             }
1193           else
1194             {
1195               historaw2=(TH1F*)mergedfile.Get(histoname);
1196               historaw2->Write();
1197               historaw2=NULL;
1198             }
1199           printf("Saved %s\n",histoname);
1200         }
1201       for(Int_t isave3=0;isave3<rtot;isave3++)
1202         {
1203           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[isave3].Data());
1204           //printf(histoname,"ITS/RecPoints/%s/Expert/%s_%s \n",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[isave3].Data());
1205           if(isave3<3||isave3==11||isave3==12||isave3==17||isave3==18)
1206             {
1207               histodraw=(TH2F*)mergedfile.Get(histoname);
1208               histodraw->Write();
1209               histodraw=NULL;
1210             }
1211           else
1212             {
1213               historaw2=(TH1F*)mergedfile.Get(histoname);
1214               historaw2->Write();
1215               historaw2=NULL;
1216             }
1217           printf("Saved %s\n",histoname);
1218         }
1219       
1220       //for(Int_t iss=0;iss<9;iss++){printf("Saved %d\n",iss); histo2save[iss]->Write();}
1221       file2savefortrend.Close();
1222         
1223       //else{delete canvas13; canvas13=NULL;}   
1224       //directory2=NULL;
1225
1226
1227
1228
1229     }//end directory
1230
1231
1232
1233   }//end for   
1234
1235
1236
1237
1238   delete  directory;
1239   directory=NULL;
1240   delete directory2;
1241   directory2=NULL;
1242
1243 }//end macro
1244
1245