]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Updates in macros o display SDD QA results + new macros for SDD performance trending...
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Nov 2010 22:22:34 +0000 (22:22 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 4 Nov 2010 22:22:34 +0000 (22:22 +0000)
ITS/macrosSDD/PlotQASDD.C
ITS/macrosSDD/ReadQASDD.C
ITS/macrosSDD/ShowSDDQA.sh
ITS/macrosSDD/TrendQASDD.C [new file with mode: 0644]
ITS/macrosSDD/TrendingSDD.sh [new file with mode: 0755]
ITS/macrosSDD/setQAvar.sh [new file with mode: 0644]

index ec55e5306818e4a51b45281b9f59135495c9cd85..e4a95ea9e2a51500150650e4739245d230f5166f 100644 (file)
@@ -9,34 +9,62 @@
 #include <TObjArray.h>
 #include <TClass.h>
 #include <TKey.h>
-//#include "AliRecoParam.h"
+#include <TFile.h>
+#include <TFileMerger.h>
+#include <TAlienFile.h>
+//#include <TExec.h>
+#include <TSystem.h>
+#include <TGrid.h>
+#include <TGridResult.h>
+#include <Riostream.h>
+#include <TObjArray.h>
+#include <TClass.h>
+#include <TH1F.h>
+#include <TH2D.h>
+#include <TH2F.h>
+#include <TF1.h>
+#include <TStyle.h>
+#include <TCanvas.h>
+#include <TLegend.h>
+#include <TMath.h>
+#include "AliRecoParam.h"
 #endif
 
-enum rawexpert_t{pattern,patternnorm,layer3norm,layer4norm,rawtot};
+enum rawexpert_t{pattern,patternnorm,layer3norm,layer4norm,layer3occ,layer4occ,rawtot};
 enum nonrawexpert_t{layer3,layer4,nonrawtot};
 
-enum rpexpert_t{rlocaldistro,rlayer3norm,rlayer4norm,rmodpattern,rmodpatternnorm,rphilayer3,rphilayer4,rrlayer3,rrlayer4,rtot};
+enum rpexpert_t{rlocaldistro,rlayer3norm,rlayer4norm,rmodpattern,rmodpatternnorm,rphilayer3,rphilayer4,rrlayer3,rrlayer4,occlayer3,occlayer4,recraw2dlayer3,recraw2dlayer4,recrawlayer3,recrawlayer4,dedxlayer3,dedxlayer4,rtot};
 enum rnonexpert_t{rphizlayer3,rphizlayer4,rglobalrz,rglobalxy,rchargelayer3,rchargelayer4,rtimelayer3,rtimelayer4,rlayer3,rlayer4,nrtot};
 
-enum canvsname_t{canvname0,canvname1,canvname2,canvname3,canvname4,canvname5,canvname6,canvname7,canvname8,canvname9,canvname10,canvname11,canvname12};
+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};//
 
-void PlotQASDD(Char_t fileName[100]="File.QA.111333.2010.LHC09b.pass2.root",Char_t eventspecie[25]="LowMultiplicity")
+
+
+void PlotQASDD(Char_t fileName[100]="File.QA.111333.2010.LHC09b.pass2.root",Char_t eventspecie[25]="LowMultiplicity",Bool_t kDoEps=kFALSE)
 {
-  const TString Rawsexpertname[]={"SDDModPattern","SDDModPatternNORM","SDDphizL3NORM","SDDphizL4NORM"};//4
-  const TString Rawsnonexpertname[]={"SDDphizL3","SDDphizL4"};//2
+  const TString Rawsexpertname[]={"SDDModPattern","SDDModPatternNORM","SDDphizL3","SDDphizL4","SDDL3_RelativeOccupancy","SDDL4_RelativeOccupancy"};//6
+  const TString Rawsnonexpertname[]={"SDDphizL3NORM","SDDphizL4NORM"};//2
+
+  const TString RecPointsexpertname[]={"SDDLocalCoordDistrib","SDDModPatternL3RP","SDDModPatternL4RP","SDDModPatternRP","SDDModPatternRPNORM","SDDphidistrib_Layer3","SDDphidistrib_Layer4","SDDrdistrib_Layer3","SDDrdistrib_Layer4","SDDL3_RelativeOccupancy","SDDL4_RelativeOccupancy","SDDL3_Rec2Raw_2D","SDDL4_Rec2Raw_2D","SDDL3_Rec2Raw","SDDL4_Rec2Raw","SDDL3_dedx","SDDL4_dedx"};//17
+  const TString RecPointsnonexpertname[]={"SDDGlobalCoordDistribL3PHIZ","SDDGlobalCoordDistribL4PHIZ","SDDGlobalCoordDistribRZ","SDDGlobalCoordDistribYX","SDDLay3TotCh","SDDLay4TotCh","SDDdrifttime_Layer3","SDDdrifttime_Layer4","SDDModPatternL3RPNORM","SDDModPatternL4RPNORM"};//10
 
-  const TString RecPointsexpertname[]={"SDDLocalCoordDistrib","SDDModPatternL3RPNORM","SDDModPatternL4RPNORM","SDDModPatternRP","SDDModPatternRPNORM","SDDphidistrib_Layer3","SDDphidistrib_Layer4","SDDrdistrib_Layer3","SDDrdistrib_Layer4"};//9
-  const TString RecPointsnonexpertname[]={"SDDGlobalCoordDistribL3PHIZ","SDDGlobalCoordDistribL4PHIZ","SDDGlobalCoordDistribRZ","SDDGlobalCoordDistribYX","SDDLay3TotCh","SDDLay4TotCh","SDDdrifttime_Layer3","SDDdrifttime_Layer4","SDDModPatternL3RP","SDDModPatternL4RP"};//1
+  const TString canvassavedname[]={"RawLayers","Rawpatterns","RawLayersNORM","RawLayersRelOcc","RawLayersRelOccBoth","RecPointsphiz","RecPointsGlobalDistributions","RecPointsCharge","RecPointsDriftTime","RecPointsLocalDistribution","RecPointsLayers","RecPointsLayersNORM","RecPointsLayersPatterns","RecPointsPhiDistribution","RecPointsRDistribution","RecPointsChargeBothLayers","RecPointsDriftTimeBothLayers","RecPointsRelLayersOcc","RecPointsLayersRelOccBoth","RecPointsLayersRecRaw2D","RecPointsLayersRecRaw","RecPointsLayersRecRaw","RecPointsLayersRecRawBoth","RecPointsLayersdedx","RecPointsLayersdedxBoth"};//15
+
+  Char_t trendfile[25]="FileQAtrend.root";
 
-  const TString canvassavedname[]={"RawLayers","Rawpatterns","RawLayersNORM","RecPointsphiz","RecPointsGlobalDistributions","RecPointsCharge","RecPointsDriftTime","RecPointsLocalDistribution","RecPointsLayers","RecPointsLayersNORM","RecPointsLayersPatterns","RecPointsPhiDistribution","RecPointsRDistribution"};//13
 
   gStyle->SetPalette(1);
-  gStyle->SetOptStat(0);
-  TFile mergedfile(fileName);
-  if(mergedfile.GetKey("ITS")==0x0){
-      printf("In this run ITS QA has not been executed.\n\nExit macro \n\n");
+  //  gStyle->SetOptStat("ne");
+  if(gSystem->Exec(Form("ls %s >/dev/null 2>&1", fileName))!=0)
+    {
+      printf(" No file created --- Exit");
       return;
     }
+  TFile mergedfile(fileName);
+  if(mergedfile.GetKey("ITS")==0x0){
+    printf("In this run ITS QA has not been executed.\n\nExit macro \n\n");
+    return;
+  }
   Char_t filepath[100];
   Char_t namecanvas[50];
   TDirectory *directory=NULL;
@@ -45,37 +73,33 @@ void PlotQASDD(Char_t fileName[100]="File.QA.111333.2010.LHC09b.pass2.root",Char
   TH2D *historaw=NULL;
   TH1F *historaw2=NULL;
   TH2F *histodraw=NULL;
-
+  
+  TH1F *histo2save[9];
+  for(Int_t i=0;i<9;i++){histo2save[i]=NULL;}
+  
+  TF1 *f1 = new TF1("f1","1",-100000,100000); // this is the function defined to multiply histograms
+  Char_t layer[10];
+  float fmax=0.;
+  float fmaxold=0.;
+  float fmaxmargin;
+  
+  Int_t cannum=0;
+  Int_t histo2savenumber[9]={4,5,6,7,7,8,3,5,1};
   TCanvas *canvas1 = new TCanvas("canvas1","SDD QA Plot",1000,600);
-//   canvas1->Divide(2,1);
-//   TCanvas *canvas3 = new TCanvas("canvas3","RawLayersNORM",1000,600);
-//   canvas3->Divide(2,1);
-//   TCanvas *canvas2 = new TCanvas("canvas2","Rawpatterns",1000,600);
-//   canvas2->Divide(1,2);
-
-//   TCanvas *canvas4 = new TCanvas("canvas4","RecPointsphiz",1000,600);
-//   canvas4->Divide(2,1);
-//   TCanvas *canvas5 = new TCanvas("canvas5","RecPointsGlobalDistributions",1000,600);
-//   canvas5->Divide(2,1);
-//   TCanvas *canvas6 = new TCanvas("canvas6","RecPointsCharge",1000,600);
-//   canvas6->Divide(1,2);
-//   TCanvas *canvas7 = new TCanvas("canvas7","RecPointsDriftTime",1000,600);
-//   canvas7->Divide(1,2);
-
-//   TCanvas *canvas8 = new TCanvas("canvas8","RecPointsLocalDistribution",1000,600);
-//   TCanvas *canvas9 = new TCanvas("canvas9","RecPointsLayers",1000,600);
-//   canvas9->Divide(2,1);
+  //   TLegend *legend=new TLegend(0.83,0.8,0.97,0.7);
+  TLegend *legend=new TLegend(0.81,0.895,0.95,0.995);
+  Bool_t updatecanvas[2];
+  for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
   
-//   TCanvas *canvas10 = new TCanvas("canvas10","RecPointsLayersNORM",1000,600);
-//   canvas10->Divide(2,1);
-//   TCanvas *canvas11 = new TCanvas("canvas11","RecPointsLayersPatterns",1000,600);
-//   canvas11->Divide(1,2);
-//   TCanvas *canvas12 = new TCanvas("canvas12","RecPointsPhiDistribution",1000,600);
-//   canvas12->Divide(2,1);
-//   TCanvas *canvas13 = new TCanvas("canvas13","RecPointsRDistribution",1000,600);
-//   canvas13->Divide(2,1);
+  // -------------This part is to read the number of chunks that were merged
+  Float_t fChnknmbr=0.;
+  FILE * pChunkNumber = fopen ("ChunkNumber.txt","r");
+  fscanf(pChunkNumber, "%f", &fChnknmbr);
+  fclose (pChunkNumber);
+  gStyle->SetPalette(1);
+  float fCNinv=1./fChnknmbr;
+  //   printf("\n====================>%f\n\n", fCNinv);
   
-
   if(!mergedfile.IsOpen()){return;}else{printf("file is open\n");}
   for(Int_t ispecie=0;ispecie<AliRecoParam::kNSpecies;ispecie++){
     //__________________________________________________________________
@@ -92,307 +116,863 @@ void PlotQASDD(Char_t fileName[100]="File.QA.111333.2010.LHC09b.pass2.root",Char
       printf("1\n");
       canvas1->Clear();
       canvas1->Divide(2,1);
-      Bool_t updatecanvas[2];
+      
       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-      for(Int_t iraws=0;iraws<nonrawtot;iraws++){//non expert raws
-       canvas1->cd(iraws+1);
-
-       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsnonexpertname[iraws].Data());
-       printf("histo name %s ",Rawsnonexpertname[iraws].Data());
+      for(Int_t iraws=2;iraws<4;iraws++){//non expert raws
+       canvas1->cd(iraws-1);
+       
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[iraws].Data());
+       printf("histo name %s ",Rawsexpertname[iraws].Data());
        historaw=(TH2D*)mergedfile.Get(histoname);
        if(historaw){printf("...Found\n");historaw->DrawCopy("colz");}
-       else{updatecanvas[iraws]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
+       else{updatecanvas[iraws-2]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
        historaw=NULL;
       }//end for       
-
+      
       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
        {
          canvas1->Update();
-         sprintf(namecanvas,"%s.eps",canvassavedname[canvname0].Data());
-         canvas1->SaveAs(namecanvas);
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
          canvas1->Print("SDDQAPlot.ps");
        }
       //else{delete canvas1; canvas1=NULL;}
       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-       canvas1->Clear();
-       canvas1->Divide(1,2);
-       printf("2 \n");
-       for(Int_t inraws=0;inraws<2;inraws++){//non expert raws
-         canvas1->cd(inraws+1);
-         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[inraws].Data());
-         printf("histo name %s ",Rawsexpertname[inraws].Data());
-         historaw2=(TH1F*)mergedfile.Get(histoname);
-         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");}
-         historaw2=NULL;
-       }//end for
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+      canvas1->Clear();
+      canvas1->Divide(1,2);
+      printf("2 \n");
+      cannum++;
+      for(Int_t inraws=0;inraws<2;inraws++){//non expert raws
+       canvas1->cd(inraws+1);
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[inraws].Data());
+       printf("histo name %s ",Rawsexpertname[inraws].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       
+       
+       //        -----------------This is the part were I divide between the number of chunks to normalize the histogram----------------
+       
+       
+       if(historaw2)
          {
-           canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname1].Data());
+           printf("...Found\n");
+           if (inraws==1)
+             {
+               historaw2->Multiply(f1,fCNinv);
+               
+             }
+           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");}
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
-         }
-       //else{delete canvas2; canvas2=NULL;}
-     
-       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-       printf("3\n");
-       canvas1->Clear();
-       canvas1->Divide(2,1);
-       for(Int_t iraws=2;iraws<rawtot;iraws++){//non expert raws
-         canvas1->cd(iraws-1);
-         
-         sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[iraws].Data());
-         printf("histo name %s",Rawsexpertname[iraws].Data());
-         historaw=(TH2D*)mergedfile.Get(histoname);
-         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");} 
-         historaw=NULL;
-       }//end for
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas2; canvas2=NULL;}
+      
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      printf("3\n");
+      cannum++;
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      for(Int_t iraws=0;iraws<2;iraws++){//non expert raws
+       canvas1->cd(iraws+1);
+       
+       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsnonexpertname[iraws].Data());
+       printf("histo name %s",Rawsnonexpertname[iraws].Data());
+       historaw=(TH2D*)mergedfile.Get(histoname);
+       if(historaw){
+         printf("...Found\n");
+         historaw->Multiply(f1,fCNinv);
+         historaw->DrawCopy("colz");
+       }
+       else
+         {updatecanvas[iraws]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");} 
+       historaw=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas3; canvas3=NULL;}
+      
+      //--------------------- new plots
+      printf("================= 4\n");
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      cannum++;
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      for(Int_t iraws=4;iraws<rawtot;iraws++){//non expert raws
+       canvas1->cd(iraws-3);
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[iraws].Data());
+       printf("histo name %s",Rawsexpertname[iraws].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       if(historaw2)
          {
-           canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname2].Data());
+           printf("...Found\n");
+           historaw2->DrawCopy();
+         }else
+         {
+           updatecanvas[iraws-4]=kFALSE;
+           printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");
+         } 
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
-         }
-       //else{delete canvas3; canvas3=NULL;}
-      }//end if directory
-
-      //_______________________________________________________________________________
-      //rec point
-      sprintf(filepath,"ITS/RecPoints/%s",AliRecoParam::GetEventSpecieName(ispecie));
-      printf("%s\n",filepath);
-      directory2=(TDirectory*)mergedfile.Get(filepath);
-      if(directory2){
-       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-       canvas1->Clear();
-       canvas1->Divide(2,1);
-       printf("4\n");
-       for(Int_t irp=0;irp<2;irp++){//non expert rec point
-         canvas1->cd(irp+1);
-
-         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irp].Data());
-         printf("histo name %s ",RecPointsnonexpertname[irp].Data());
-         histodraw=(TH2F*)mergedfile.Get(histoname);
-         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");}
-         histodraw=NULL;
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas3; canvas3=NULL;}
+      
+      
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      legend->Clear();
+      printf("14\n");
+      cannum++;
+      for (Int_t i=4;i<rawtot;i++){
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[i].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       if(historaw2){
+         fmax=historaw2->GetMaximum();
+         if (i==4){
+           fmaxold=fmax;}
+         if (i!=4){
+           if(fmaxold<fmax){
+             fmaxold=fmax;
+           }
+         }
        }
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       historaw2=NULL;
+      }
+      fmaxmargin=1.1*fmaxold;
+      for(Int_t irrpp=4;irrpp<rawtot;irrpp++){//non expert raws
+       
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[irrpp].Data());
+       printf("histo name %s",Rawsexpertname[irrpp].Data());
+       sprintf(layer, "layer %d",irrpp-1);
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       gStyle->SetOptStat(0);
+       
+       if(historaw2)
          {
+           printf("...Found\n");
+           historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
+           historaw2->SetTitle("Raw Relative Occupancy");
+           if (irrpp==4) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
+           if (irrpp!=4) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
+           legend->AddEntry(historaw2,layer,"l");
+           legend->Draw();
            canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname3].Data());
+         }
+       else{updatecanvas[irrpp-4]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      
+    }//end if directory
+    
+    
+    
+    //_______________________________________________________________________________
+    //rec point
+    sprintf(filepath,"ITS/RecPoints/%s",AliRecoParam::GetEventSpecieName(ispecie));
+    printf("%s\n",filepath);
+    directory2=(TDirectory*)mergedfile.Get(filepath);
+    if(directory2){
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("4\n");
+      cannum++;
+      for(Int_t irp=0;irp<2;irp++){//non expert rec point
+       canvas1->cd(irp+1);
+       
+       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irp].Data());
+       printf("histo name %s ",RecPointsnonexpertname[irp].Data());
+       histodraw=(TH2F*)mergedfile.Get(histoname);
+       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");}
+       histodraw=NULL;
+      }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
          }
-       //      else{delete canvas4; canvas4=NULL;}
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //       else{delete canvas4; canvas4=NULL;}
+      
+      
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("5\n");
+      cannum++;
+      for(Int_t irrp=2;irrp<4;irrp++){//non expert raws
+       canvas1->cd(irrp-1);
+       
+       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrp].Data());
+       printf("histo name %s",RecPointsnonexpertname[irrp].Data() );
+       histodraw=(TH2F*)mergedfile.Get(histoname);
+       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");}
+       histodraw=NULL;
+      }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas5; canvas5=NULL;}
+      
+      
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(1,2);
+      printf("6\n");
+      cannum++;
+      for(Int_t irrpp=4;irrpp<6;irrpp++){//non expert raws
+       canvas1->cd(irrpp-3);
+       
+       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
+       printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       
+       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");}
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas6; canvas6=NULL;}
+      
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(1,2);
+      printf("7\n");
+      cannum++;
+      for(Int_t irrpp=6;irrpp<8;irrpp++){//non expert raws
+       canvas1->cd(irrpp-5);
+       //        printf("histo name\n");
+       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
+       printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       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");}
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas7; canvas7=NULL;}
+
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      printf("8\n");
+      cannum++;
+      //canvas1->Divide(2,1);
+      sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[rlocaldistro].Data());
+      printf("histo name %s",RecPointsexpertname[rlocaldistro].Data());
+      histodraw=(TH2F*)mergedfile.Get(histoname);
+
+      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");}
+      histodraw=NULL;
+      if(updatecanvas[0]==kTRUE){
+       canvas1->Update();
+       if(kDoEps){
+         sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+         canvas1->SaveAs(namecanvas);
+       }
+       canvas1->Print("SDDQAPlot.ps"); 
+      }
+      //else{delete canvas8; canvas8=NULL;}
        
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("9\n");
+      cannum++;
+      for(Int_t i=1;i<3;i++)
+       {
+         canvas1->cd(i);
 
-       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-       canvas1->Clear();
-       canvas1->Divide(2,1);
-       printf("5\n");
-       for(Int_t irrp=2;irrp<4;irrp++){//non expert raws
-         canvas1->cd(irrp-1);
-         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrp].Data());
-         printf("histo name %s",RecPointsnonexpertname[irrp].Data() );
+         sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+         printf("histo name %s",RecPointsexpertname[i].Data());
          histodraw=(TH2F*)mergedfile.Get(histoname);
-         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");}
+
+         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");}
          histodraw=NULL;
        }
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
-         {
-           canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname4].Data());
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas9; canvas9=NULL;}
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("10\n");
+      cannum++;
+      for(Int_t i=8;i<10;i++)
+       {
+         canvas1->cd(i-7);
+
+         sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[i].Data());
+         histodraw=(TH2F*)mergedfile.Get(histoname);
+         printf("histo name %s",RecPointsnonexpertname[i].Data());
+
+         if(histodraw){
+           printf("...Found\n");histodraw->Multiply(f1,fCNinv);
+           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");}
+         histodraw=NULL;
+       }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
          }
-       //else{delete canvas5; canvas5=NULL;}
-     
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas10; canvas10=NULL;}
 
-       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-       canvas1->Clear();
-       canvas1->Divide(1,2);
-       printf("6\n");
-       for(Int_t irrpp=4;irrpp<6;irrpp++){//non expert raws
-         canvas1->cd(irrpp-3);
-    
-         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
-         printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(1,2);
+      printf("11\n");
+      cannum++;
+      for(Int_t i=3;i<5;i++)
+       {
+         canvas1->cd(i-2);
+
+         sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+         printf("histo name %s",RecPointsexpertname[i].Data());
          historaw2=(TH1F*)mergedfile.Get(histoname);
-         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");}
+
+         if(historaw2)
+           {
+             printf("...Found\n");
+             if (i==4){historaw2->Multiply(f1,fCNinv);}
+             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");}
          historaw2=NULL;
-       }//end for
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
-         {
-           canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname5].Data());
+       }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
          }
-       //else{delete canvas6; canvas6=NULL;}
-       
-       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-       canvas1->Clear();
-       canvas1->Divide(1,2);
-       printf("7\n");
-       for(Int_t irrpp=6;irrpp<8;irrpp++){//non expert raws
-         canvas1->cd(irrpp-5);
-         //      printf("histo name\n");
-         sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
-         printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas11; canvas11=NULL;}
+
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("12\n");
+      cannum++;
+      for(Int_t i=5;i<7;i++)
+       {
+         canvas1->cd(i-4);
+
+         sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+         printf("histo name %s",RecPointsexpertname[i].Data());
          historaw2=(TH1F*)mergedfile.Get(histoname);
-         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");}
+
+         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");}
          historaw2=NULL;
-       }//end for
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
-         {
-           canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname6].Data());
+       }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
          }
-       //else{delete canvas7; canvas7=NULL;}
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //else{delete canvas12; canvas12=NULL;}
 
-       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-       canvas1->Clear();
-       printf("8\n");
-       //canvas1->Divide(2,1);
-       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[rlocaldistro].Data());
-       printf("histo name %s",RecPointsexpertname[rlocaldistro].Data());
-       histodraw=(TH2F*)mergedfile.Get(histoname);
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("13\n");
+      cannum++;
+      for(Int_t i=7;i<9;i++)
+       {
+         canvas1->cd(i-6);
+         sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+         printf("histo name %s",RecPointsexpertname[i].Data());
+         historaw2=(TH1F*)mergedfile.Get(histoname);
 
-       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");}
-       histodraw=NULL;
-       if(updatecanvas[0]==kTRUE){
+         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");}
+         historaw2=NULL;
+       }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
          canvas1->Update();
-         sprintf(namecanvas,"%s.eps",canvassavedname[canvname7].Data());
-         canvas1->SaveAs(namecanvas);
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
          canvas1->Print("SDDQAPlot.ps"); 
        }
-       //else{delete canvas8; canvas8=NULL;}
-       
-       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-       canvas1->Clear();
-       canvas1->Divide(2,1);
-       printf("9\n");
-       for(Int_t i=8;i<10;i++)
-         {
-           canvas1->cd(i-7);
-
-           sprintf(histoname,"ITS/RecPoints/%s/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[i].Data());
-           printf("histo name %s",RecPointsnonexpertname[i].Data());
-           histodraw=(TH2F*)mergedfile.Get(histoname);
+         
 
-           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");}
-           histodraw=NULL;
+      //superimposed
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      legend->Clear();
+      printf("14\n");
+      cannum++;
+      for (Int_t i=4;i<6;i++){
+       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[i].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       if(historaw2){
+         fmax=historaw2->GetMaximum();
+         if (i==4){
+           fmaxold=fmax;}
+         if (i!=4){
+           if(fmaxold<fmax){
+             fmaxold=fmax;
+           }
          }
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       }
+       historaw2=NULL;
+      }
+      fmaxmargin=1.1*fmaxold;
+      for(Int_t irrpp=4;irrpp<6;irrpp++){//non expert raws
+    
+       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
+       printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
+       sprintf(layer, "layer %d",irrpp-1);
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       gStyle->SetOptStat(0);
+         
+       if(historaw2)
          {
+           printf("...Found\n");
+           historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
+           historaw2->SetTitle("Charge");
+           if (irrpp==4) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
+           if (irrpp!=4) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
+           legend->AddEntry(historaw2,layer,"l");
+           legend->Draw();
            canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname8].Data());
+         }
+       else{updatecanvas[irrpp-4]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
-         }
-       //else{delete canvas9; canvas9=NULL;}
-           for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-           canvas1->Clear();
-           canvas1->Divide(2,1);
-           printf("10\n");
-       for(Int_t i=1;i<3;i++)
-         {
-           canvas1->cd(i);
-
-           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
-           histodraw=(TH2F*)mergedfile.Get(histoname);
-           printf("histo name %s",RecPointsexpertname[i].Data());
-
-           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");}
-           histodraw=NULL;
          }
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+         
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      legend->Clear();
+      printf("15\n");
+      cannum++;
+      for (Int_t i=6;i<8;i++){
+       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[i].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       if(historaw2){
+         fmax=historaw2->GetMaximum();
+         if (i==6){
+           fmaxold=fmax;}
+         if (i!=6){
+           if(fmaxold<fmax){
+             fmaxold=fmax;}}}
+       fmaxmargin=1.1*fmaxold;
+      }
+      for(Int_t irrpp=6;irrpp<8;irrpp++){//non expert raws
+    
+       sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[irrpp].Data());
+       printf("histo name %s",RecPointsnonexpertname[irrpp].Data());
+       sprintf(layer, "layer %d",irrpp-3);
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       gStyle->SetOptStat(0);
+         
+       if(historaw2)
          {
+           printf("...Found\n");
+           historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
+           historaw2->SetTitle("Drift Time");
+           if (irrpp==6) {historaw2->SetStats(0); historaw2->SetLineColor(2);historaw2->DrawCopy();}
+           if (irrpp!=6) {historaw2->SetStats(0); historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
+           legend->AddEntry(historaw2,layer,"l");
+           legend->Draw();
            canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname9].Data());
+         }
+       else{updatecanvas[irrpp-6]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
+       printf("%s\n%s\n",historaw2->GetName(),historaw2->GetTitle());
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
          }
-       //else{delete canvas10; canvas10=NULL;}
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
 
-       for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-       canvas1->Clear();
-       canvas1->Divide(1,2);
-       printf("11\n");
-       for(Int_t i=3;i<5;i++)
-         {
-           canvas1->cd(i-2);
+      //------------------------------------------- new plot
 
-           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
-           printf("histo name %s",RecPointsexpertname[i].Data());
-           historaw2=(TH1F*)mergedfile.Get(histoname);
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("13\n");
+      cannum++;
+      for(Int_t i=9;i<11;i++)
+       {
+         canvas1->cd(i-8);
+         sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+         printf("histo name %s",RecPointsexpertname[i].Data());
+         historaw2=(TH1F*)mergedfile.Get(histoname);
 
-           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");}
-           historaw2=NULL;
+         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");}
+         historaw2=NULL;
+       }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+         
+      //------------------------------------
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      legend->Clear();
+      printf("14\n");
+      cannum++;
+      for (Int_t i=9;i<11;i++){
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       if(historaw2){
+         fmax=historaw2->GetMaximum();
+         if (i==4){
+           fmaxold=fmax;}
+         if (i!=4){
+           if(fmaxold<fmax){
+             fmaxold=fmax;
+           }
          }
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       }
+       historaw2=NULL;
+      }
+      fmaxmargin=1.1*fmaxold;
+      for(Int_t irrpp=9;irrpp<11;irrpp++){//non expert raws
+         
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[irrpp].Data());
+       printf("histo name %s",RecPointsexpertname[irrpp].Data());
+       sprintf(layer, "layer %d",irrpp-6);
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       gStyle->SetOptStat(0);
+         
+       if(historaw2)
          {
+           printf("...Found\n");
+           historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
+           historaw2->SetTitle("RecPoint Relative Occupancy");
+           if (irrpp==9) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
+           if (irrpp!=9) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
+           legend->AddEntry(historaw2,layer,"l");
+           legend->Draw();
            canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname10].Data());
+         }
+       else{updatecanvas[irrpp-9]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
          }
-       //else{delete canvas11; canvas11=NULL;}
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+
+
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("13\n");
+      cannum++;
+      for(Int_t i=11;i<13;i++)
+       {
+         canvas1->cd(i-10);
+         sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+         printf("histo name %s",RecPointsexpertname[i].Data());
+         historaw=(TH2D*)mergedfile.Get(histoname);
+
+         if(historaw){printf("...Found\n");historaw->DrawCopy("colz");}else{updatecanvas[i-11]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
+         historaw2=NULL;
+       }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+         
 
-           for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-           canvas1->Clear();
-           canvas1->Divide(2,1);
-           printf("12\n");
-       for(Int_t i=5;i<7;i++)
-         {
-           canvas1->cd(i-4);
 
-           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
-           printf("histo name %s",RecPointsexpertname[i].Data());
-           historaw2=(TH1F*)mergedfile.Get(histoname);
+      //-----------------
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("13\n");
+      cannum++;
+      for(Int_t i=13;i<15;i++)
+       {
+         canvas1->cd(i-12);
+         sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+         printf("histo name %s",RecPointsexpertname[i].Data());
+         historaw2=(TH1F*)mergedfile.Get(histoname);
+
+         if(historaw2){printf("...Found\n");historaw2->DrawCopy();}else{updatecanvas[i-13]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
+         historaw2=NULL;
+       }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      //--------------------------------------------
 
-           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");}
-           historaw2=NULL;
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      legend->Clear();
+      printf("14\n");
+      cannum++;
+      for (Int_t i=13;i<15;i++){
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       if(historaw2){
+         fmax=historaw2->GetMaximum();
+         if (i==13){
+           fmaxold=fmax;}
+         if (i!=13){
+           if(fmaxold<fmax){
+             fmaxold=fmax;
+           }
          }
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       }
+       historaw2=NULL;
+      }
+      fmaxmargin=1.1*fmaxold;
+      for(Int_t irrpp=13;irrpp<15;irrpp++){//non expert raws
+    
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[irrpp].Data());
+       printf("histo name %s",RecPointsexpertname[irrpp].Data());
+       sprintf(layer, "layer %d",irrpp-10);
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       gStyle->SetOptStat(0);
+         
+       if(historaw2)
          {
+           printf("...Found\n");
+           historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
+           historaw2->SetTitle("Rec2Raw Ratio");
+           if (irrpp==13) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
+           if (irrpp!=13) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
+           legend->AddEntry(historaw2,layer,"l");
+           legend->Draw();
            canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname11].Data());
+         }
+       else{updatecanvas[irrpp-13]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
          }
-       //else{delete canvas12; canvas12=NULL;}
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
 
-           for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
-           canvas1->Clear();
-           canvas1->Divide(2,1);
-           printf("13\n");
-       for(Int_t i=7;i<9;i++)
-         {
-           canvas1->cd(i-6);
-           sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
-           printf("histo name %s",RecPointsexpertname[i].Data());
-           historaw2=(TH1F*)mergedfile.Get(histoname);
+         
+      //--------------------------------------
+         
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      canvas1->Divide(2,1);
+      printf("13\n");
+      cannum++;
+      for(Int_t i=15;i<17;i++)
+       {
+         canvas1->cd(i-14);
+         sprintf(histoname,"ITS/RecPoints/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+         printf("histo name %s",RecPointsexpertname[i].Data());
+         historaw2=(TH1F*)mergedfile.Get(histoname);
+               
+         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");}
+         historaw2=NULL;
+       }
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
+           canvas1->SaveAs(namecanvas);
+         }
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+         
 
-           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");}
-           historaw2=NULL;
+      //--------------------------------------------
+
+      for(Int_t i=0;i<2;i++){updatecanvas[i]=kTRUE;}
+      canvas1->Clear();
+      legend->Clear();
+      printf("14\n");
+      cannum++;
+      for (Int_t i=15;i<17;i++){
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[i].Data());
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       if(historaw2){
+         fmax=historaw2->GetMaximum();
+         if (i==15){
+           fmaxold=fmax;}
+         if (i!=15){
+           if(fmaxold<fmax){fmaxold=fmax;}
          }
-       if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       }
+       historaw2=NULL;
+      }
+      fmaxmargin=1.1*fmaxold;
+      for(Int_t irrpp=15;irrpp<17;irrpp++){//non expert raws
+    
+       sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[irrpp].Data());
+       printf("histo name %s",RecPointsexpertname[irrpp].Data());
+       sprintf(layer, "layer %d",irrpp-12);
+       historaw2=(TH1F*)mergedfile.Get(histoname);
+       gStyle->SetOptStat(0);
+         
+       if(historaw2)
          {
+           printf("...Found\n");
+           historaw2->GetYaxis()->SetRangeUser(0,fmaxmargin);
+           historaw2->SetTitle("RecPoint dEdx");
+           if (irrpp==15) {historaw2->SetStats(0);historaw2->SetLineColor(2);historaw2->DrawCopy();}
+           if (irrpp!=15) {historaw2->SetStats(0);historaw2->SetLineColor(4);historaw2->DrawCopy("same");}
+           legend->AddEntry(historaw2,layer,"l");
+           legend->Draw();
            canvas1->Update();
-           sprintf(namecanvas,"%s.eps",canvassavedname[canvname12].Data());
+         }
+       else{updatecanvas[irrpp-15]=kFALSE;printf("...Not Found: the histogram or this QA has been done before the histograms was added to QA\n");}
+       historaw2=NULL;
+      }//end for
+      if(updatecanvas[0]==kTRUE||updatecanvas[1]==kTRUE)
+       {
+         canvas1->Update();
+         if(kDoEps){
+           sprintf(namecanvas,"%s.eps",canvassavedname[cannum].Data());
            canvas1->SaveAs(namecanvas);
-           canvas1->Print("SDDQAPlot.ps"); 
          }
-       canvas1->Print("SDDQAPlot.ps]"); 
-       //else{delete canvas13; canvas13=NULL;} 
-           directory2=NULL;
-      }//end directory
+         canvas1->Print("SDDQAPlot.ps"); 
+       }
+      canvas1->Print("SDDQAPlot.ps]"); 
+
+
+      for(Int_t isave=0;isave<9;isave++){
+       if(isave<4)sprintf(histoname,"%s/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsnonexpertname[histo2savenumber[isave]].Data());
+       if(isave>4&&isave<7)sprintf(histoname,"%s/Expert/%s_%s",filepath,AliRecoParam::GetEventSpecieName(ispecie),RecPointsexpertname[histo2savenumber[isave]].Data());
+       if(isave>7)sprintf(histoname,"ITS/Raws/%s/Expert/%s_%s",AliRecoParam::GetEventSpecieName(ispecie),AliRecoParam::GetEventSpecieName(ispecie),Rawsexpertname[histo2savenumber[isave]].Data());
+       printf("file2save name:\t %s\n",histoname);
+       histo2save[isave]=(TH1F*)mergedfile.Get(histoname);
+      }
+
+      TFile file2savefortrend(trendfile,"recreate");
+      file2savefortrend.cd();
+      for(Int_t iss=0;iss<9;iss++){printf("Saved %d\n",iss); histo2save[iss]->Write();}
+      file2savefortrend.Close();
+       
+      //else{delete canvas13; canvas13=NULL;}  
+      //directory2=NULL;
+    }//end directory
+
+
+
   }//end for   
 
+
+
+
   delete  directory;
   directory=NULL;
   delete directory2;
index b0093f22712713fd18a7935fd23cb7cd09a1641b..ec487abc65e8267408af70f4180b4470412dcf86 100644 (file)
@@ -13,7 +13,9 @@
 void ReadQASDD(Int_t runNb = 101498,Int_t year=2009,Char_t period[10]="LHC09c",Char_t pass[8]="pass1",Char_t filetosearch[50]="Merged.QA.Data.root",Char_t initfileout[50]="File.QA")
 {
 
-  //****************** Connection to alien ***************************************** 
+  //****************** Connection to alien *****************************************
+  gSystem->Load("libNetx.so") ; 
+  gSystem->Load("libRAliEn.so"); 
   TGrid::Connect("alien://",0,0,"t"); 
   //TGrid *gGrid = TGrid::Connect("alien"); 
   if(!gGrid||!gGrid->IsConnected()) {
@@ -42,18 +44,40 @@ void ReadQASDD(Int_t runNb = 101498,Int_t year=2009,Char_t period[10]="LHC09c",C
 
   Int_t mergedFiles = 0;
   Int_t nFiles = gr->GetEntries();
+  if(nFiles>600) nFiles=600; 
   for (Int_t i = 0; i <nFiles ; i++) { 
-    printf("File %i/%i\n",i,nFiles); 
-    sprintf(directory,"%s",gr->GetKey(i,"turl")); 
-    if (merger.AddFile(directory))
-      mergedFiles++;
-  }
-  //printf("Add done\n");
-  if(merger.Merge()==kTRUE){
-    printf("merged %d files\n", mergedFiles);
-    printf("output written on %s\n", fileName);
-    printf("Merge done!\n");
+    printf("File %i/%i\n",i+1,nFiles); 
+    sprintf(directory,"%s",gr->GetKey(i,"turl"));
+    printf("%s\n\n", directory);
+       if(i==0) 
+      {
+       TFile *checkfile=TFile::Open(directory);
+       if(checkfile->GetKey("ITS")==0x0){
+         printf("file: %s \n Run %d, In this run ITS QA has not been executed.-- Exit macro\n",directory, runNb);
+         break;
+         //mergedFiles=-1;
+       }
+       checkfile->Close();
+       delete checkfile;
+       checkfile=NULL;
+      }
+       if (merger.AddFile(directory))
+        mergedFiles++;
   }
+// ------------------------------in this section we create a file that will contain the number of chunks to normalize later
+  if(mergedFiles>0){
+    FILE * pChunkNumber;
+    pChunkNumber = fopen ("ChunkNumber.txt","w+");
+    fprintf (pChunkNumber, "%f\n", mergedFiles);
+    fclose (pChunkNumber);
+    
+    //printf("Add done\n");
+    if(merger.Merge()==kTRUE){
+      printf("merged %d files\n", mergedFiles);
+      printf("output written on %s\n", fileName);
+      printf("Merge done!\n");
+    }
+    else{printf("no files merged\n");return;}
+  } 
   else{printf("no files merged\n");return;}
-
 }
index 09dee57e665fa5bed110897a6728357854a9e744..ec54fd869cd9b2489ba04d97e918438670784558 100755 (executable)
@@ -4,6 +4,9 @@ PERIOD='LHC10a'
 PASS='pass1'
 YEAR='2010'
 ALICE_ITS='$ALICE_ROOT/ITS'
+TMPPLACE='/tmp'
+TMPFOLDER='1'
+EXECFOLDER='$HOME/macroQAshifter'
 echo "Run Number   :[${RUN}]"
 read
 if [ "$REPLY" != "" ]; then
@@ -28,6 +31,22 @@ if [ "$REPLY" != "" ]; then
 export YEAR=$REPLY
 echo "Year    $YEAR"
 fi
+echo "folder with macros     :[${EXECFOLDER}]"
+read
+if [ "$REPLY" != "" ]; then
+export EXECFOLDER=$REPLY
+echo "Folder:    $EXECFOLDER"
+fi
+echo "local or lxplus (1=local 2=lxplus)   :[${TMPFOLDER}]"
+read
+if [ "$REPLY" != "" ]; then
+export TMPFOLDER=$REPLY
+fi
+if [ "$TMPFOLDER" == "1" ]; then
+export TMPPLACE='/tmp'
+else
+export TMPPLACE='/tmp/$USERNAME'
+fi
 if [ ls -l "run$RUN" >/dev/null 2>&1 ]; then
 echo "directory run$RUN exists "
 else
@@ -40,14 +59,16 @@ else
 mkdir $PASS
 cd $PASS
 fi
-time aliroot >>merge.log 2>&1 <<EOI
-.x $ALICE_ITS/ReadQASDD.C($RUN,$YEAR,"${PERIOD}","${PASS}" ); 
+time aliroot -l <<EOI|tee merge.log
+EOF
+.x $EXECFOLDER/ReadQASDD.C($RUN,$YEAR,"${PERIOD}","${PASS}" ); 
 .q
 EOI
-time aliroot  >> plot.log 2>&1 <<EOI
-.x $ALICE_ITS/PlotQASDD.C("File.QA.${YEAR}.${PERIOD}.${PASS}.Run.${RUN}.root");
+time aliroot -l <<EOI|tee plot.log
+.x $EXECFOLDER/PlotQASDD.C("File.QA.${YEAR}.${PERIOD}.${PASS}.Run.${RUN}.root");
+.q
 EOI
-
+rm File.QA.${YEAR}.${PERIOD}.${PASS}.Run.${RUN}.root
 if [ls -l "images" >/dev/null 2>&1 ]; then
 echo "directory images exists"
 else
@@ -61,4 +82,5 @@ gv $i &
 sleep 2
 done
 echo "Plots Done!!"
-
+rm -rf $TMPPLACE/*.root
+cd ../../../
\ No newline at end of file
diff --git a/ITS/macrosSDD/TrendQASDD.C b/ITS/macrosSDD/TrendQASDD.C
new file mode 100644 (file)
index 0000000..44492bd
--- /dev/null
@@ -0,0 +1,262 @@
+#if !defined(__CINT__) || defined(__MAKECINT__)
+#include <TFile.h>
+#include <TFileMerger.h>
+#include <TAlienFile.h>
+//#include <TExec.h>
+#include <TSystem.h>
+#include <TGrid.h>
+#include <TGridResult.h>
+#include <Riostream.h>
+#include <TObjArray.h>
+#include <TClass.h>
+#include <TH1F.h>
+#include <TStyle.h>
+#include <TCanvas.h>
+#include <TLegend.h>
+#include <TMath.h>
+#endif
+void TrendQASDD( Char_t filelist[150]="LHC10b.txt", Char_t filename[20]="FileQAtrend",Char_t pass[7]="pass1",Int_t year=2010, Char_t period[7]="LHC10b", Bool_t kUseOriginalFile=kFALSE , Char_t especiename[50]="LowMultiplicity")
+{
+  Int_t  m;
+  vector<Int_t> n;
+  //Char_t FileName[200];//="/home/msicilia/Desktop/createlists";
+  char FileName[150];
+  Char_t FileName1[150];
+  sprintf(FileName1,"%s",filelist);
+  FILE * pFile;
+  pFile = fopen (FileName1,"r");
+  while (fscanf (pFile,"%d\n",&m)==1){
+    
+    if(kUseOriginalFile)sprintf(FileName,"run%d/%s/File.QA.%d.%s.%s.Run.%d.root",m,pass,year,period,pass,m);
+    else sprintf(FileName, "run%d/%s/%s.root", m,pass,filename);
+    if(gSystem->Exec(Form("ls %s >/dev/null 2>&1", FileName))==0){
+      TFile mergedfile(FileName);
+      if(kUseOriginalFile){
+      if(mergedfile.GetKey("ITS")==0x0){
+       printf("Run %d, In this run ITS QA has not been executed.-- Exit file\n",m);
+       continue;
+      }
+      else {n.push_back(m);} //this is to grow the vector
+      }else {n.push_back(m);}
+    }
+    else{printf("Run %d,: no file %s present -- Continue\n",m, FileName);continue;}
+  }
+  fclose (pFile);
+  
+  Char_t filepath[200];
+  TH1F *histocharge;
+  TH1F *histochargetrend[2];
+  
+  char name[100];
+  char title[100];
+  
+  for(Int_t layer=3;layer<5;layer++)
+    {
+      sprintf(name,"histochargetrend_%d", layer);
+      sprintf(title,"Trend of the Charge of the Layer %d", layer);
+      histochargetrend[layer-3]=new TH1F(name,title,n.size(),0.,(float)n.size());
+    }
+  
+  gStyle->SetOptStat(0);       
+  TCanvas *canvas[6];
+  
+  for(Int_t i=0;i<3;i++)
+    {
+      sprintf(name,"canvas%i",i);
+      canvas[i]=new TCanvas(name,name);
+      canvas[i]->Divide(2,1);
+    }
+  
+  TLegend *legend =new TLegend(0.83,0.8,0.97,0.2);
+  TLegend *legend2=new TLegend(0.83,0.8,0.97,0.2);
+
+  Char_t runnmbr[20];
+  Float_t fmax=0;
+  Float_t fmaxold=0;
+  Float_t fmaxmargin=0;
+
+  Float_t fmaxtime=0;
+  Float_t fmaxoldtime=0;
+  Float_t fmaxmargintime=0;
+
+  Int_t j=0;
+  Int_t hh=0;
+  //Int_t kk=0;
+  char buffer [10];
+
+  printf("%d \n",n.size());
+  
+  for(Int_t layer=3;layer<5;layer++){
+    for (Int_t irun=0; irun<(Int_t)(n.size());irun++)
+      {
+       if(kUseOriginalFile)sprintf(FileName,"run%d/%s/File.QA.%d.%s.%s.Run.%d.root",n[irun],pass,year,period,pass,n[irun]);
+       else sprintf(FileName, "run%d/%s/%s.root", n[irun],pass,filename);
+       
+       TFile mergedfile(FileName);
+       if(kUseOriginalFile){
+       if(mergedfile.GetKey("ITS")==0x0){
+         printf("Run %d, In this run ITS QA has not been executed.-- Exit file\n",n[irun]);
+         continue;
+       }
+       }
+       if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/%s_SDDLay%dTotCh",especiename,especiename,layer);
+       else sprintf(filepath,"%s_SDDLay%dTotCh",especiename,layer);
+       histocharge=(TH1F*)(mergedfile.Get(filepath));   
+       
+       if(histocharge)
+         {
+           sprintf(buffer, "%d", n[irun]);
+           histochargetrend[layer-3]->Fill(buffer,histocharge->GetMean());
+           histochargetrend[layer-3]->SetMinimum(0.);
+           histochargetrend[layer-3]->SetMaximum(250.);
+           histochargetrend[layer-3]->GetXaxis()->SetTitle("# Run");
+           histochargetrend[layer-3]->GetYaxis()->SetTitle("keV");
+           fmax=histocharge->GetMaximum();
+           if (j==0)   { fmaxold=fmax;}
+           if (j!=0) { if(fmaxold<fmax) { fmaxold=fmax;} }
+           j++;
+         }//end if histocharge
+       
+       histocharge=NULL;
+       
+       //drift time
+       
+       if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/%s_SDDdrifttime_Layer%d",especiename,especiename,layer);
+       else sprintf(filepath,"%s_SDDdrifttime_Layer%d",especiename,layer);
+       histocharge=(TH1F*)(mergedfile.Get(filepath));   
+       
+       if(histocharge)
+         {
+           sprintf(buffer, "%d", n[irun]);     
+           fmaxtime=histocharge->GetMaximum();
+           if (j==0)   { fmaxoldtime=fmaxtime;}
+           if (j!=0) { if(fmaxoldtime<fmaxtime) { fmaxoldtime=fmaxtime;} }
+           j++;
+         }//end if histocharge
+       
+       histocharge=NULL;
+       
+      }//end for run
+    fmaxmargin=fmaxold;
+    fmaxmargintime=1.023*fmaxoldtime;
+    printf("Max Y Range is %4.1f time %4.1f\n",fmaxmargin,fmaxmargintime);
+    
+    canvas[0]->SetFillColor(46);
+    canvas[0]->cd(layer-2)->SetFillColor(46);
+    histochargetrend[layer-3]->SetMarkerStyle(20);
+    histochargetrend[layer-3]->SetMarkerSize(1);
+    histochargetrend[layer-3]->SetMarkerColor(kGreen+4);
+    histochargetrend[layer-3]->SetFillColor(42);
+    canvas[0]->cd(layer-2)->SetFrameFillColor(kAzure-9);
+    histochargetrend[layer-3]->SetBarWidth(0.9);
+    histochargetrend[layer-3]->SetBarOffset(0.05);
+    histochargetrend[layer-3]->DrawCopy("P");
+    j=0;
+    hh=0;
+    Int_t color=0;
+    for (Int_t irun=0; irun< (Int_t)(n.size());irun++)
+      {
+       
+       if(kUseOriginalFile) sprintf(FileName, "run%d/%s/File.QA.%d.%s.%s.Run.%d.root", n[irun],pass,year,period,pass,n[irun]);
+       else sprintf(FileName, "run%d/%s/%s.root", n[irun],pass,filename);         
+       
+       TFile mergedfile(FileName);
+       if(kUseOriginalFile){
+       if(mergedfile.GetKey("ITS")==0x0){
+         printf("run %d In this run ITS QA has not been executed.--- Exit file\n",n[irun]);
+         continue;
+       }
+       }       
+       if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/%s_SDDLay%dTotCh",especiename,especiename,layer);
+       else sprintf(filepath,"%s_SDDLay%dTotCh",especiename,layer);    
+       sprintf(runnmbr,"run%d",n[irun]);
+       printf("%s  %s",filepath,runnmbr);      
+       histocharge=(TH1F*)(mergedfile.Get(filepath));  
+       if(histocharge)
+         {         
+           color=2+j;
+           if (color>=12 && color<=27) { color=j+28; }
+           histocharge->SetLineColor(color);
+           if (j==0)
+             { 
+               canvas[1]->cd(layer-2);
+
+               canvas[1]->cd(layer-2)->SetFrameFillColor(kGray+3);
+               histocharge->SetMaximum(fmaxmargin);
+               histocharge->GetYaxis()->SetTitle("");
+               histocharge->DrawNormalized();
+               histocharge->SetMaximum(fmaxmargin);
+               canvas[1]->cd(layer-2)->Update();
+             }    
+           if (j!=0)
+             {
+       
+               canvas[1]->cd(layer-2);
+               histocharge->DrawNormalized("same");
+               canvas[1]->cd(layer-2)->Update();
+             }     
+           if(layer==3)legend->AddEntry(histocharge,runnmbr,"l");
+           canvas[1]->cd(layer-2);
+           legend->Draw();         
+           canvas[1]->Update();
+           j++;
+           printf("...Found\n");
+           
+         }//end if histocharge
+       else{printf("...Not Found....\n");}
+       histocharge=NULL;
+       
+           //======================================================== Drift Time       
+       if(kUseOriginalFile)sprintf(filepath,"ITS/RecPoints/%s/%s_SDDdrifttime_Layer%d",especiename,especiename,layer);
+       else sprintf(filepath,"%s_SDDdrifttime_Layer%d",especiename,layer);     
+       sprintf(runnmbr,"run %d",n[irun]);
+       printf("%s  %s",filepath,runnmbr);      
+       histocharge=(TH1F*)(mergedfile.Get(filepath));  
+       if(histocharge)
+         {         
+           printf("...Found\n");
+           histocharge->SetLineColor(color);
+           if (hh==0)
+             { 
+               canvas[2]->cd(layer-2);
+               canvas[2]->cd(layer-2)->SetFrameFillColor(kGray+3);
+               histocharge->SetMaximum(fmaxmargintime);
+               histocharge->GetYaxis()->SetTitle("");
+               histocharge->DrawNormalized();
+               histocharge->SetMaximum(fmaxmargintime);
+             }    
+           if (hh!=0)
+             {
+               canvas[2]->cd(layer-2);
+               histocharge->DrawNormalized("same");
+             }     
+           if(layer==3)legend2->AddEntry(histocharge,runnmbr,"l");
+           canvas[2]->cd(layer-2);
+           legend2->Draw();        
+           canvas[2]->Update();
+           hh++;
+         }//end if histocharge
+       else{printf("...Not Found....\n");}
+       histocharge=NULL;
+      }//enf for 
+      }//end for layer
+  
+  TFile trendfile(Form("SDDQAtrend%s%s.root",period,pass),"recreate");  
+  trendfile.cd();
+  for(Int_t ican=0;ican<3;ican++)canvas[ican]->Write();
+  trendfile.Close();
+  Char_t psfile[50];
+  sprintf(psfile,"SDDtrend%s%s.ps",period,pass);
+  canvas[0]->Print(Form("%s[",psfile));
+  for(Int_t ifile=0;ifile<3;ifile++){canvas[ifile]->Print(psfile);}
+
+  canvas[2]->Print(Form("%s]",psfile));
+
+  
+  delete histocharge;
+       
+
+
+
+}//end macro
diff --git a/ITS/macrosSDD/TrendingSDD.sh b/ITS/macrosSDD/TrendingSDD.sh
new file mode 100755 (executable)
index 0000000..8eae8f4
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/bash
+
+RUN='123456'
+PERIOD='LHC10b'
+PASS='pass1'
+YEAR='2010'
+ALICE_ITS='$ALICE_ROOT/ITS'
+TMPPLACE='/tmp'
+TMPFOLDER='1'
+EXECFOLDER='$HOME/macroQAshifter'
+FILERUN=LHC10b.txt
+FILEQATREND='FileQAtrend'
+echo "file with the run numbers (Please insert the full path without environment variables)  :[${FILERUN}]"
+read
+if [ "$REPLY" != "" ]; then
+export FILERUN="$REPLY"
+echo "File    $FILERUN"
+fi
+echo "Period        :[${PERIOD}]"
+read
+if [ "$REPLY" != "" ]; then
+export PERIOD=$REPLY
+echo "Period  $PERIOD"
+fi
+echo "Pass           : [${PASS}]"
+read
+if [ "$REPLY" != "" ]; then
+export PASS=$REPLY
+echo "Pass       $PASS "
+fi
+echo "Year      :[${YEAR}]"
+read
+if [ "$REPLY" != "" ]; then
+export YEAR=$REPLY
+echo "Year    $YEAR"
+fi
+echo "local or lxplus (1=local 2=lxplus)   :[${TMPFOLDER}]"
+read
+if [ "$REPLY" != "" ]; then
+export TMPFOLDER=$REPLY
+fi
+if [ "$TMPFOLDER" == "1" ]; then
+export TMPPLACE='/tmp'
+else
+export TMPPLACE='/tmp/$USERNAME'
+fi
+echo "folder with macros     :[${EXECFOLDER}]"
+read
+if [ "$REPLY" != "" ]; then
+export EXECFOLDER=$REPLY
+echo "Folder:    $EXECFOLDER"
+fi
+time aliroot  -l <<EOI | tee trend.log 
+.L $EXECFOLDER/TrendQASDD.C++
+ TrendQASDD("${FILERUN}","FileQAtrend","${PASS}",$YEAR,"${PERIOD}") 
+.q
+EOI
+gv SDDtrend$PERIOD$PASS.ps & 
+echo "Done!!"
diff --git a/ITS/macrosSDD/setQAvar.sh b/ITS/macrosSDD/setQAvar.sh
new file mode 100644 (file)
index 0000000..bd914ce
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+#environment script to launch alice macros on lxplus from a script of Renu Bala (Thanks Renu for the help)
+
+export ALICE_OLD=/afs/cern.ch/alice/library
+
+#AliEn
+export ALIEN=$ALICE_OLD/alien/pro
+export GSHELL_ROOT=$ALIEN/api
+export X509_CERT_DIR=$ALIEN/globus/share/certificates
+
+#ROOT
+source /afs/cern.ch/user/a/alisoft/.alien/packages/VO_ALICE/ROOT/v5-26-00b-6/.alienEnvironment /afs/cern.ch/user/a/alisoft/.alien/packages/VO_ALICE/ROOT/v5-26-00b-6
+source /afs/cern.ch/user/a/alisoft/.alien/packages/VO_ALICE/GEANT3/v1-11-11/.alienEnvironment  /afs/cern.ch/user/a/alisoft/.alien/packages/VO_ALICE/GEANT3/v1-11-11/
+
+#AliRoot
+source /afs/cern.ch/user/a/alisoft/.alien/packages/VO_ALICE/AliRoot/v4-19-18-AN/.alienEnvironment  /afs/cern.ch/user/a/alisoft/.alien/packages/VO_ALICE/AliRoot/v4-19-18-AN
+export PATH=$PATH:$ALIEN/api/bin:$ALIEN/globus/bin
+export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ALIEN/api/lib:$ALIEN/globus/lib
+
+alias launchalien=$GSHELL_ROOT/bin/alien-token-init