]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFanalyzeDigits.C
o update splines for 12a,b
[u/mrichter/AliRoot.git] / TOF / AliTOFanalyzeDigits.C
index 93690cf21a73382440f28b0995a712cf87705fd6..ac0f682ace146b4f4a32d4ae9bce401e31a77947 100644 (file)
@@ -1,23 +1,29 @@
-Int_t AliTOFanalyzeDigits(Int_t ndump=15, Int_t iEvNum=0)
+Int_t AliTOFanalyzeDigits(Int_t ndump=0, Int_t numberOfEvents=0)
 {
+
+  /////////////////////////////////////////////////////////////////////////
   //
   // Analyzes the TOF digits and fills QA-histograms 
-  // report problems to pierella@bo.infn.it
-  // iEvNum=0 means all events in the file
+  // numberOfEvents=0 means all events in the file
+  //
   // Author: F. Pierella (Bologna University)
   // Updated to the new I/O by: A. De Caro, C. Zampolli
+  //
+  // Report problems to decaro@sa.infn.it
+  //
+  /////////////////////////////////////////////////////////////////////////
 
   Int_t rc = 0;
   
   // adc and tdc
-  TH1F *htdc  = new TH1F("htdc","TDC [bin]",500,0.,15000.);
-  TH1F *hadc   = new TH1F("hadc","ADC [bin]",100,0., 3000.);
+  TH1F *htdc     = new TH1F("htdc","TDC [bin]",500,0.,15000.);
+  TH1F *hadc     = new TH1F("hadc","ADC [bin]",100,0., 3000.);
   // TOF digit volumes
-  TH1F *hsector  = new TH1F("hsector","Sector",20,0.,20.);
-  TH1F *hplate   = new TH1F("hplate","Plate ", 6,0., 6.);
-  TH1F *hstrip   = new TH1F("hstrip","Strip ",25,0.,25.);
-  TH1F *hpadz    = new TH1F("hpadz","Pad along z ",3,0.,3.);
-  TH1F *hpadx    = new TH1F("hpadx","Pad along x",50,0.,50.);
+  TH1F *hsector  = new TH1F("hsector","Sector",18,0.,18.);
+  TH1F *hplate   = new TH1F("hplate","Plate ", 5,0., 5.);
+  TH1F *hstrip   = new TH1F("hstrip","Strip ",20,0.,20.);
+  TH1F *hpadz    = new TH1F("hpadz","Pad along z ",2,0.,2.);
+  TH1F *hpadx    = new TH1F("hpadx","Pad along x",48,0.,48.);
   // ADC-TDC correlation
   TH2F *h2tdcVSadc = new TH2F("h2tdcVSadc","TDC [bin] VS ADC [bin]",100,0.,3000.,500,0.,15000.);
 
@@ -29,12 +35,12 @@ Int_t AliTOFanalyzeDigits(Int_t ndump=15, Int_t iEvNum=0)
 
   if (gAlice) 
     {
-      delete gAlice->GetRunLoader();
+      delete AliRunLoader::Instance();
       delete gAlice;
       gAlice = 0x0;
     }
   
-  AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,"read");
+  AliRunLoader *rl = AliRunLoader::Open("galice.root",AliConfig::GetDefaultEventFolderName(),"read");
   if (!rl)
     {
       cerr<<"Can't load RunLoader from file"<<"!\n";
@@ -62,18 +68,14 @@ Int_t AliTOFanalyzeDigits(Int_t ndump=15, Int_t iEvNum=0)
       return rc;
     }
   
-  cout << "First " << ndump << " Digits found in TOF TreeD branch have:" << endl;
-
- if (iEvNum == 0) 
-    { 
-      rl->LoadHeader();
-      TTree *TE = rl->TreeE();
-      iEvNum = (Int_t)TE->GetEntries();
-    } 
+  if (ndump) cout << "First " << ndump << " Digits found in TOF TreeD branch have: \n";
+
+  rl->LoadHeader();
+  if (numberOfEvents == 0) numberOfEvents = (Int_t)(rl->GetNumberOfEvents());
   
   AliTOFdigit *tofdigit;  
 
-  for (Int_t ievent = 0; ievent < iEvNum; ievent++) {
+  for (Int_t ievent = 0; ievent < numberOfEvents; ievent++) {
     printf ("Processing event %d \n", ievent);
     rl->GetEvent(ievent);
     
@@ -110,13 +112,13 @@ Int_t AliTOFanalyzeDigits(Int_t ndump=15, Int_t iEvNum=0)
          htdc->Fill(tdc);
          hadc->Fill(adc);
          // TOF digit volumes
-         Int_t sector = tofdigit->GetSector(); // range [1-18]
-         Int_t plate  = tofdigit->GetPlate();  // range [1- 5]
-         Int_t strip  = tofdigit->GetStrip();  // range [1-20]
-         Int_t padz   = tofdigit->GetPadz();   // range [1- 2]
-         Int_t padx   = tofdigit->GetPadx();   // range [1-48]
+         Int_t sector = tofdigit->GetSector(); // range [0-17]
+         Int_t plate  = tofdigit->GetPlate();  // range [0- 4]
+         Int_t strip  = tofdigit->GetStrip();  // range [0-19]
+         Int_t padz   = tofdigit->GetPadz();   // range [0- 1]
+         Int_t padx   = tofdigit->GetPadx();   // range [0-47]
          // it is QA, then I perform QA!
-         Bool_t isDigitBad = (sector<1 || sector>18 || plate<1 || plate >5 || padz<1 || padz>2 || padx<1 || padx>48);
+         Bool_t isDigitBad = (sector<0 || sector>17 || plate<0 || plate >4 || padz<0 || padz>1 || padx<0 || padx>47);
          
          if (isDigitBad)
            {
@@ -126,9 +128,9 @@ Int_t AliTOFanalyzeDigits(Int_t ndump=15, Int_t iEvNum=0)
            }
          
          if(k<ndump){
-           cout << k << "-th | " << "Sector " << sector << " | Plate " << plate << " | Strip " << strip << " | PadZ " << padz << " | PadX " << padx << endl;
-           cout << k << "-th | ADC " << adc << " [bin] | TDC " << tdc << " [bin]" << endl;
-           cout << "----------------------------------------------------"<< endl;
+           cout << k << "-th | Sector " << sector << " | Plate " << plate << " | Strip " << strip << " | PadZ " << padz << " | PadX " << padx << endl;
+           cout << k << "-th | ADC " << adc << " [bin] | TDC " << tdc << " [bin] \n";
+           cout << "---------------------------------------------------- \n";
          }
          
          // filling digit volume histos
@@ -143,11 +145,12 @@ Int_t AliTOFanalyzeDigits(Int_t ndump=15, Int_t iEvNum=0)
       }
     
     tofl->UnloadDigits();
-    rl->UnloadHeader();
-    rl->UnloadgAlice();
   
   } // end loop on events
   
+  rl->UnloadHeader();
+  rl->UnloadgAlice();
+
   TFile *fout = new TFile("TOF_digitsQA.root","RECREATE");
   htdc->Write();
   hadc->Write();
@@ -170,7 +173,7 @@ Int_t AliTOFanalyzeDigits(Int_t ndump=15, Int_t iEvNum=0)
 
   if (gAlice) 
     {
-      delete gAlice->GetRunLoader();
+      delete AliRunLoader::Instance();
       delete gAlice;
       gAlice = 0x0;
     }