]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFQADataMaker.cxx
o remove warning
[u/mrichter/AliRoot.git] / TOF / AliTOFQADataMaker.cxx
index 3b2a4b94a3ab5ac0a0ad5ec07deb6f0e49da632a..94297678370a913031e47dc1542a9c1c71406301 100644 (file)
  * about the suitability of this software for any purpose. It is          *
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
-/*
-  Produces the data needed to calculate the TOF quality assurance. 
-  QA objects are 1 & 2 Dimensional histograms.
-  author: S.Arcelli
-*/
+
+///////////////////////////////////////////////////////////////////////
+//                                                                   //
+//  Produces the data needed to calculate the TOF quality assurance. //
+//  QA objects are 1 & 2 Dimensional histograms.                     //
+//  author: S.Arcelli                                                //
+//                                                                   //
+///////////////////////////////////////////////////////////////////////
 
 #include <TClonesArray.h>
 #include <TFile.h> 
@@ -30,6 +33,7 @@
 #include "AliTOFSDigit.h"
 #include "AliTOFhitT0.h"
 #include "AliTOFQADataMaker.h"
+#include "AliQAChecker.h"
 #include "AliRawReader.h"
 #include "AliTOFRawStream.h"
 #include "AliTOFrawData.h"
@@ -39,7 +43,8 @@ ClassImp(AliTOFQADataMaker)
            
 //____________________________________________________________________________ 
   AliTOFQADataMaker::AliTOFQADataMaker() : 
-  AliQADataMaker(AliQA::GetDetName(AliQA::kTOF), "TOF Quality Assurance Data Maker")
+  AliQADataMaker(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker"),
+    fTOFRawStream(AliTOFRawStream())
 {
   //
   // ctor
@@ -48,7 +53,8 @@ ClassImp(AliTOFQADataMaker)
 
 //____________________________________________________________________________ 
 AliTOFQADataMaker::AliTOFQADataMaker(const AliTOFQADataMaker& qadm) :
-  AliQADataMaker()
+  AliQADataMaker(),
+  fTOFRawStream(AliTOFRawStream(qadm.fTOFRawStream))
 {
   //
   //copy ctor 
@@ -74,21 +80,32 @@ void AliTOFQADataMaker::InitHits()
   //
   // create Hits histograms in Hits subdir
   //
-  TH1F * h0 = new TH1F("hTOFHits",    "Number of TOF Hits ",301, -1.02, 5.) ; 
+
+  Bool_t expert = kFALSE;
+
+  TH1F * h0 = new TH1F("hTOFHits",    "Number of TOF Hits ",301, -1.02, 5.) ;
   h0->Sumw2() ;
-  Add2HitsList(h0, 0) ;
+  h0->GetXaxis()->SetTitle("TOF hit number [10 power]");
+  Add2HitsList(h0, 0, expert) ;
 
-  TH1F * h1  = new TH1F("hTOFHitsTime", "Hits Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  TH1F * h1  = new TH1F("hTOFHitsTime", "Hits Time Spectrum in TOF (ns)", 2000, 0., 200) ;
   h1->Sumw2() ;
-  Add2HitsList(h1, 1) ;
+  h1->GetXaxis()->SetTitle("Simulated TOF time [ns]");
+  Add2HitsList(h1, 1, expert) ;
 
-  TH1F * h2  = new TH1F("hTOFHitsLength", "Length Spectrum in TOF (cm)", 500, 0., 500) ; 
+  TH1F * h2  = new TH1F("hTOFHitsLength", "Length Spectrum in TOF (cm)", 500, 0., 500) ;
   h2->Sumw2() ;
-  Add2HitsList(h2, 2) ;
+  h2->GetXaxis()->SetTitle("Track length from primary vertex till hit TOF pad [cm]");
+  Add2HitsList(h2, 2, expert) ;
 
-  TH2F * h3  = new TH2F("hTOFHitsClusMap","Hits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; 
+  TH2F * h3  = new TH2F("hTOFHitsClusMap","Hits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
   h3->Sumw2() ;
-  Add2HitsList(h3, 3) ;
+  h3->GetXaxis()->SetTitle("2*strip+padz (eta)");
+  h3->GetYaxis()->SetTitle("48*sector+padx (phi)");
+  h3->GetYaxis()->SetTitleOffset(1.15);
+  Add2HitsList(h3, 3, expert) ;
+  //
+  ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -97,21 +114,33 @@ void AliTOFQADataMaker::InitDigits()
   //
   // create Digits histograms in Digits subdir
   //
-  TH1F * h0 = new TH1F("hTOFDigits",    "Number of TOF Digits ",301, -1.02, 5.) ;   h0->Sumw2() ;
-  Add2DigitsList(h0, 0) ;
 
-  TH1F * h1  = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  Bool_t expert = kFALSE;
+
+  TH1F * h0 = new TH1F("hTOFDigits",    "Number of TOF Digits ",301, -1.02, 5.) ;
+  h0->Sumw2() ;
+  h0->GetXaxis()->SetTitle("TOF digit number [10 power]");
+  Add2DigitsList(h0, 0, expert) ;
+
+  TH1F * h1  = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns)", 2000, 0., 200) ;
   h1->Sumw2() ;
-  Add2DigitsList(h1, 1) ;
+  h1->GetXaxis()->SetTitle("Digitized TOF time [ns]");
+  Add2DigitsList(h1, 1, expert) ;
 
-  TH1F * h2  = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns)", 500, 0., 50) ; 
+  TH1F * h2  = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns)", 500, 0., 50) ;
   h2->Sumw2() ;
-  Add2DigitsList(h2, 2) ;
+  h2->GetXaxis()->SetTitle("Digitized TOT [ns]");
+  h2->GetYaxis()->SetTitle("Digitized TOF time [ns]");
+  Add2DigitsList(h2, 2, expert) ;
 
-  TH2F * h3  = new TH2F("hTOFDigitsClusMap","Digits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; 
+  TH2F * h3  = new TH2F("hTOFDigitsClusMap","Digits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
   h3->Sumw2() ;
-  Add2DigitsList(h3, 3) ;
-
+  h3->GetXaxis()->SetTitle("2*strip+padz (eta)");
+  h3->GetYaxis()->SetTitle("48*sector+padx (phi)");
+  h3->GetYaxis()->SetTitleOffset(1.15);
+  Add2DigitsList(h3, 3, expert) ;
+  //
+  ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -120,17 +149,27 @@ void AliTOFQADataMaker::InitSDigits()
   //
   // create SDigits histograms in SDigits subdir
   //
-  TH1F * h0 = new TH1F("hTOFSDigits",    "Number of TOF SDigits ",301, -1.02, 5.) ;   h0->Sumw2() ;
-  Add2SDigitsList(h0, 0) ;
 
-  TH1F * h1  = new TH1F("hTOFSDigitsTime", "SDigits Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  Bool_t expert = kFALSE;
+
+  TH1F * h0 = new TH1F("hTOFSDigits",    "Number of TOF SDigits ",301, -1.02, 5.) ;
+  h0->Sumw2() ;
+  h0->GetXaxis()->SetTitle("TOF sdigit number [10 power]");
+  Add2SDigitsList(h0, 0, expert) ;
+
+  TH1F * h1  = new TH1F("hTOFSDigitsTime", "SDigits Time Spectrum in TOF (ns)", 2000, 0., 200) ;
   h1->Sumw2() ;
-  Add2SDigitsList(h1, 1) ;
+  h1->GetXaxis()->SetTitle("SDigitized TOF time [ns]");
+  Add2SDigitsList(h1, 1, expert) ;
 
-  TH2F * h2  = new TH2F("hTOFSDigitsClusMap","SDigits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; 
+  TH2F * h2  = new TH2F("hTOFSDigitsClusMap","SDigits vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
   h2->Sumw2() ;
-  Add2SDigitsList(h2, 2) ;
-
+  h2->GetXaxis()->SetTitle("2*strip+padz (eta)");
+  h2->GetYaxis()->SetTitle("48*sector+padx (phi)");
+  h2->GetYaxis()->SetTitleOffset(1.15);
+  Add2SDigitsList(h2, 2, expert) ;
+  //
+  ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -139,21 +178,33 @@ void AliTOFQADataMaker::InitRaws()
   //
   // create Raws histograms in Raws subdir
   //
-  TH1F * h0 = new TH1F("hTOFRaws",    "Number of TOF Raws ",301, -1.02, 5.) ;   h0->Sumw2() ;
-  Add2RawsList(h0, 0) ;
 
-  TH1F * h1  = new TH1F("hTOFRawsTime", "Raws Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  Bool_t expert = kFALSE;
+
+  TH1F * h0 = new TH1F("hTOFRaws",    "Number of TOF Raws ",301, -1.02, 5.) ;
+  h0->Sumw2() ;
+  h0->GetXaxis()->SetTitle("TOF raw number [10 power]");
+  Add2RawsList(h0, 0, expert) ;
+
+  TH1F * h1  = new TH1F("hTOFRawsTime", "Raws Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
   h1->Sumw2() ;
-  Add2RawsList(h1, 1) ;
+  h1->GetXaxis()->SetTitle("Measured TOF time [ns]");
+  Add2RawsList(h1, 1, expert) ;
 
-  TH1F * h2  = new TH1F("hTOFRawsToT", "Raws ToT Spectrum in TOF (ns)", 500, 0., 50) ; 
+  TH1F * h2  = new TH1F("hTOFRawsToT", "Raws ToT Spectrum in TOF (ns)", 500, 0., 50) ;
   h2->Sumw2() ;
-  Add2RawsList(h2, 2) ;
+  h2->GetXaxis()->SetTitle("Measured TOT [ns]");
+  h2->GetYaxis()->SetTitle("Measured TOF time [ns]");
+  Add2RawsList(h2, 2, expert) ;
 
-  TH2F * h3  = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; 
+  TH2F * h3  = new TH2F("hTOFRawsClusMap","Raws vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ;
   h3->Sumw2() ;
-  Add2RawsList(h3, 3) ;
-
+  h3->GetXaxis()->SetTitle("2*strip+padz (eta)");
+  h3->GetYaxis()->SetTitle("48*sector+padx (phi)");
+  h3->GetYaxis()->SetTitleOffset(1.15);
+  Add2RawsList(h3, 3, expert) ;
+  //
+  ClonePerTrigClass(AliQAv1::kRAWS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -162,25 +213,38 @@ void AliTOFQADataMaker::InitRecPoints()
   //
   // create RecPoints histograms in RecPoints subdir
   //
-  TH1F * h0 = new TH1F("hTOFRecPoints",    "Number of TOF RecPoints ",301, -1.02, 5.) ;   h0->Sumw2() ;
-  Add2RecPointsList(h0, 0) ;
 
-  TH1F * h1  = new TH1F("hTOFRecPointsTime", "RecPoints Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  Bool_t expert = kFALSE;
+
+  TH1F * h0 = new TH1F("hTOFRecPoints",    "Number of TOF RecPoints ",301, -1.02, 5.) ;
+  h0->Sumw2() ;
+  h0->GetXaxis()->SetTitle("TOF recPoint number [10 power]");
+  Add2RecPointsList(h0, 0, expert) ;
+
+  TH1F * h1  = new TH1F("hTOFRecPointsTime", "RecPoints Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
   h1->Sumw2() ;
-  Add2RecPointsList(h1, 1) ;
+  h1->GetXaxis()->SetTitle("Calibrated TOF time [ns]");
+  Add2RecPointsList(h1, 1, expert) ;
 
-  TH1F * h2  = new TH1F("hTOFRecPointsRawTime", "RecPoints raw Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  TH1F * h2  = new TH1F("hTOFRecPointsRawTime", "RecPoints raw Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
   h2->Sumw2() ;
-  Add2RecPointsList(h2, 2) ;
+  h2->GetXaxis()->SetTitle("Measured TOT [ns]");
+  h2->GetYaxis()->SetTitle("Measured TOF time [ns]");
+  Add2RecPointsList(h2, 2, expert) ;
 
-  TH1F * h3  = new TH1F("hTOFRecPointsToT", "RecPoints ToT Spectrum in TOF (ns)", 500, 0., 50) ; 
+  TH1F * h3  = new TH1F("hTOFRecPointsToT", "RecPoints ToT Spectrum in TOF (ns)", 500, 0., 50) ;
   h3->Sumw2() ;
-  Add2RecPointsList(h3, 3) ;
+  h3->GetXaxis()->SetTitle("Measured TOT [ns]");
+  Add2RecPointsList(h3, 3, expert) ;
 
-  TH2F * h4  = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF eta-phi",183, -0.5, 182.5,865,-0.5,864.5) ; 
+  TH2F * h4  = new TH2F("hTOFRecPointsClusMap","RecPoints vs TOF phi-eta",183, -0.5, 182.5,865,-0.5,864.5) ;
   h4->Sumw2() ;
-  Add2RecPointsList(h4, 4) ;
-
+  h4->GetXaxis()->SetTitle("2*strip+padz (eta)");
+  h4->GetYaxis()->SetTitle("48*sector+padx (phi)");
+  h4->GetYaxis()->SetTitleOffset(1.15);
+  Add2RecPointsList(h4, 4, expert) ;
+  //
+  ClonePerTrigClass(AliQAv1::kRECPOINTS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -189,25 +253,35 @@ void AliTOFQADataMaker::InitESDs()
   //
   //create ESDs histograms in ESDs subdir
   //
-  TH1F * h0 = new TH1F("hTOFESDs",    "Number of matched TOF tracks over ESDs",       250, -1., 4.) ;  
+
+  Bool_t expert = kFALSE;
+
+  TH1F * h0 = new TH1F("hTOFESDs",    "Number of matched TOF tracks over ESDs",       250, -1., 4.) ;
   h0->Sumw2() ; 
-  Add2ESDsList(h0, 0) ;
+  h0->GetXaxis()->SetTitle("Number of TOF matched ESD tracks [10 power]");
+  Add2ESDsList(h0, 0, expert) ;
 
-  TH1F * h1  = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  TH1F * h1  = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
   h1->Sumw2() ;
-  Add2ESDsList(h1, 1) ;
+  h1->GetXaxis()->SetTitle("Calibrated TOF time [ns]");
+  Add2ESDsList(h1, 1, expert) ;
 
-  TH1F * h2  = new TH1F("hTOFESDsRawTime", "raw Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  TH1F * h2  = new TH1F("hTOFESDsRawTime", "raw Time Spectrum in TOF (ns)", 20000, 0., 2000) ;
   h2->Sumw2() ;
-  Add2ESDsList(h2, 2) ;
+  h2->GetXaxis()->SetTitle("Measured TOF time [ns]");
+  Add2ESDsList(h2, 2, expert) ;
 
-  TH1F * h3  = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns)", 500, 0., 50) ; 
+  TH1F * h3  = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns)", 500, 0., 50) ;
   h3->Sumw2() ;
-  Add2ESDsList(h3, 3) ;
+  h3->GetXaxis()->SetTitle("Measured TOT [ns]");
+  Add2ESDsList(h3, 3, expert) ;
 
-  TH1F * h4 = new TH1F("hTOFESDsPID",    "Fraction of matched TOF tracks with good PID glag", 100, 0., 1.) ;  
-  h4->Sumw2() ; 
-  Add2ESDsList(h4, 4) ;
+  TH1F * h4 = new TH1F("hTOFESDsPID",    "Fraction of matched TOF tracks with good PID flag", 101, 0., 101.) ;
+  h4->Sumw2() ;
+  h4->GetXaxis()->SetTitle("Fraction of TOF matched ESD tracks with good flag [%]");
+  Add2ESDsList(h4, 4, expert) ;
+  //
+  ClonePerTrigClass(AliQAv1::kESDS); // this should be the last line
 }
 
 
@@ -222,15 +296,17 @@ void AliTOFQADataMaker::MakeHits(TClonesArray * hits)
   Int_t out[5];
 
   Int_t nentries=hits->GetEntriesFast();
-  if(nentries==0)nentries=-1;
-  GetHitsData(0)->Fill(TMath::Log10(nentries)) ; 
-
+  if(nentries<=0) {
+    FillHitsData(0,-1.) ; 
+  } else{
+    FillHitsData(0,TMath::Log10(nentries)) ; 
+  }
   TIter next(hits) ; 
   AliTOFhitT0 * hit ; 
   while ( (hit = dynamic_cast<AliTOFhitT0 *>(next())) ) {
 
-    GetHitsData(1)->Fill( hit->GetTof()*1.E9) ;//in ns
-    GetHitsData(2)->Fill( hit->GetLen()) ;//in cm
+    FillHitsData(1, hit->GetTof()*1.E9) ;//in ns
+    FillHitsData(2, hit->GetLen()) ;//in cm
   
     in[0] = hit->GetSector();
     in[1] = hit->GetPlate();
@@ -238,7 +314,7 @@ void AliTOFQADataMaker::MakeHits(TClonesArray * hits)
     in[3]= hit->GetPadx();
     in[4]= hit->GetPadz();
     GetMapIndeces(in,out);
-    GetHitsData(3)->Fill( out[0],out[1]) ;//hit map
+    FillHitsData(3, out[0],out[1]) ;//hit map
   }
 
 }
@@ -278,7 +354,10 @@ void AliTOFQADataMaker::MakeHits(TTree * hitTree)
   dummy->Delete();
   delete dummy;
   MakeHits(hits) ; 
-
+  //
+  IncEvCountCycleHits();
+  IncEvCountTotalHits();
+  //
 }
 
 //____________________________________________________________________________
@@ -293,14 +372,18 @@ void AliTOFQADataMaker::MakeDigits(TClonesArray * digits)
   Int_t out[5];
 
   Int_t nentries=digits->GetEntriesFast();
-  if(nentries==0)nentries=-1;
-  GetDigitsData(0)->Fill(TMath::Log10(nentries)) ; 
+  if(nentries<=0){
+    FillDigitsData(0,-1.) ; 
+  }else{
+    FillDigitsData(0, TMath::Log10(nentries)) ; 
+  } 
+
   TIter next(digits) ; 
   AliTOFdigit * digit ; 
   while ( (digit = dynamic_cast<AliTOFdigit *>(next())) ) {
     
-    GetDigitsData(1)->Fill( digit->GetTdc()*tdc2ns) ;//in ns
-    GetDigitsData(2)->Fill( digit->GetToT()*tot2ns) ;//in ns
+    FillDigitsData(1, digit->GetTdc()*tdc2ns) ;//in ns
+    FillDigitsData(2, digit->GetToT()*tot2ns) ;//in ns
 
     in[0] = digit->GetSector();
     in[1] = digit->GetPlate();
@@ -308,7 +391,7 @@ void AliTOFQADataMaker::MakeDigits(TClonesArray * digits)
     in[3] = digit->GetPadx();
     in[4]= digit->GetPadz();
     GetMapIndeces(in,out);
-    GetDigitsData(3)->Fill( out[0],out[1]) ;//digit map
+    FillDigitsData(3, out[0],out[1]) ;//digit map
   }
 
 }
@@ -330,6 +413,10 @@ void AliTOFQADataMaker::MakeDigits(TTree * digitTree)
   branch->SetAddress(&digits) ;
   branch->GetEntry(0) ; 
   MakeDigits(digits) ; 
+  //
+  IncEvCountCycleDigits();
+  IncEvCountTotalDigits();
+  //
 }
 
 //____________________________________________________________________________
@@ -344,15 +431,18 @@ void AliTOFQADataMaker::MakeSDigits(TClonesArray * sdigits)
   Int_t out[5];
 
   Int_t nentries=sdigits->GetEntriesFast();
-  if(nentries==0)nentries=-1;
-  GetSDigitsData(0)->Fill(TMath::Log10(nentries)) ; 
+  if(nentries<=0){
+    FillSDigitsData(0,-1.) ; 
+  }else{
+    FillSDigitsData(0,TMath::Log10(nentries)) ; 
+  } 
 
   TIter next(sdigits) ; 
   AliTOFSDigit * sdigit ; 
   while ( (sdigit = dynamic_cast<AliTOFSDigit *>(next())) ) {
     
     for(Int_t i=0;i<sdigit->GetNDigits();i++){
-      GetSDigitsData(1)->Fill( sdigit->GetTdc(i)*tdc2ns) ;//in ns
+      FillSDigitsData(1, sdigit->GetTdc(i)*tdc2ns) ;//in ns
     }
 
     in[0] = sdigit->GetSector();
@@ -361,7 +451,7 @@ void AliTOFQADataMaker::MakeSDigits(TClonesArray * sdigits)
     in[3] = sdigit->GetPadx();
     in[4]= sdigit->GetPadz();
     GetMapIndeces(in,out);
-    GetSDigitsData(2)->Fill( out[0],out[1]) ;//sdigit map
+    FillSDigitsData(2, out[0],out[1]) ;//sdigit map
   }
 }
 
@@ -381,6 +471,10 @@ void AliTOFQADataMaker::MakeSDigits(TTree * sdigitTree)
   branch->SetAddress(&sdigits) ;
   branch->GetEntry(0) ; 
   MakeSDigits(sdigits) ; 
+  //
+  IncEvCountCycleSDigits();
+  IncEvCountTotalSDigits();
+  //
 }
 
 //____________________________________________________________________________
@@ -399,27 +493,29 @@ void AliTOFQADataMaker::MakeRaws(AliRawReader* rawReader)
   Int_t out[5];
 
   TClonesArray * clonesRawData;
-  AliTOFRawStream tofInput(rawReader);
+  //AliTOFRawStream tofInput(rawReader);
+  fTOFRawStream.SetRawReader(rawReader);
   for (Int_t iDDL = 0; iDDL < AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); iDDL++){
     rawReader->Reset();
-    tofInput.LoadRawData(iDDL);
-    clonesRawData = (TClonesArray*)tofInput.GetRawData();
+    fTOFRawStream.LoadRawData(iDDL);
+    clonesRawData = (TClonesArray*)fTOFRawStream.GetRawData();
     for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
       AliTOFrawData *tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
-      if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
+      //if (!tofRawDatum->GetTOT() || !tofRawDatum->GetTOF()) continue;
+      if (!tofRawDatum->GetTOF()) continue;
       ntof++;
-      GetRawsData(1)->Fill( tofRawDatum->GetTOF()*tdc2ns) ;//in ns
-      GetRawsData(2)->Fill( tofRawDatum->GetTOT()*tot2ns) ;//in ns
-
-      tofInput.EquipmentId2VolumeId(iDDL, 
-                                   tofRawDatum->GetTRM(), 
-                                   tofRawDatum->GetTRMchain(),
-                                   tofRawDatum->GetTDC(), 
-                                   tofRawDatum->GetTDCchannel(), 
-                                   in);
+      FillRawsData(1, tofRawDatum->GetTOF()*tdc2ns) ;//in ns
+      FillRawsData(2, tofRawDatum->GetTOT()*tot2ns) ;//in ns
+
+      fTOFRawStream.EquipmentId2VolumeId(iDDL, 
+                                        tofRawDatum->GetTRM(), 
+                                        tofRawDatum->GetTRMchain(),
+                                        tofRawDatum->GetTDC(), 
+                                        tofRawDatum->GetTDCchannel(), 
+                                        in);
     
       GetMapIndeces(in,out);
-      GetRawsData(3)->Fill( out[0],out[1]) ;//raw map
+      FillRawsData(3, out[0],out[1]) ;//raw map
       
     } // while loop
     
@@ -427,10 +523,18 @@ void AliTOFQADataMaker::MakeRaws(AliRawReader* rawReader)
     
   } // DDL Loop
   
-  Int_t nentries=ntof;
-  if(nentries==0)nentries=-1;
-  GetRawsData(0)->Fill(TMath::Log10(nentries)) ; 
+  fTOFRawStream.Clear();
 
+  Int_t nentries=ntof;
+  if(nentries<=0){
+    FillRawsData(0,-1.) ; 
+  }else{
+    FillRawsData(0,TMath::Log10(nentries)) ; 
+  }
+  //
+  IncEvCountCycleRaws();
+  IncEvCountTotalRaws();
+  //
 }
 
 //____________________________________________________________________________
@@ -452,33 +556,39 @@ void AliTOFQADataMaker::MakeRecPoints(TTree * clustersTree)
     return;
   }
 
-  TObjArray * clusters = new TObjArray(100) ;
+  TClonesArray dummy("AliTOFcluster",10000), *clusters=&dummy;
   branch->SetAddress(&clusters);
-  clustersTree->GetEvent(0);
 
+  // Import the tree
+  clustersTree->GetEvent(0);  
+  
   Int_t nentries=clusters->GetEntriesFast();
-  if(nentries==0)nentries=-1;
-  GetRecPointsData(0)->Fill(TMath::Log10(nentries)) ; 
-
+  if(nentries<=0){
+    FillRecPointsData(0,-1.) ; 
+  }else{
+    FillRecPointsData(0,TMath::Log10(nentries)) ; 
+  } 
   TIter next(clusters) ; 
   AliTOFcluster * c ; 
   while ( (c = dynamic_cast<AliTOFcluster *>(next())) ) {
-    GetRecPointsData(1)->Fill(c->GetTDC()*tdc2ns);
-    GetRecPointsData(2)->Fill(c->GetTDCRAW()*tdc2ns);
-    GetRecPointsData(3)->Fill(c->GetToT()*tot2ns);
-
+    FillRecPointsData(1,c->GetTDC()*tdc2ns);
+    FillRecPointsData(2,c->GetTDCRAW()*tdc2ns);
+    FillRecPointsData(3,c->GetToT()*tot2ns);
+    
     in[0] = c->GetDetInd(0);
     in[1] = c->GetDetInd(1);
     in[2] = c->GetDetInd(2);
     in[3] = c->GetDetInd(4); //X and Z indeces inverted in RecPoints
     in[4] = c->GetDetInd(3); //X and Z indeces inverted in RecPoints
-
+    
     GetMapIndeces(in,out);
-    GetRecPointsData(4)->Fill(out[0],out[1]);
-
+    FillRecPointsData(4,out[0],out[1]);
   }
-  clusters->Delete();
-  delete clusters;
+  //
+  IncEvCountCycleRecPoints();
+  IncEvCountTotalRecPoints();
+  //
 }
 
 //____________________________________________________________________________
@@ -497,9 +607,9 @@ void AliTOFQADataMaker::MakeESDs(AliESDEvent * esd)
     Double_t tofToT=track->GetTOFsignalToT(); //in ns
     if(!(tofTime>0))continue;
     ntof++;
-    GetESDsData(1)->Fill(tofTime);
-    GetESDsData(2)->Fill(tofTimeRaw); 
-    GetESDsData(3)->Fill(tofToT);
+    FillESDsData(1,tofTime);
+    FillESDsData(2,tofTimeRaw); 
+    FillESDsData(3,tofToT);
     //check how many tracks where ESD PID is ok 
     UInt_t status=track->GetStatus();
     if (((status&AliESDtrack::kESDpid)==0) || 
@@ -508,10 +618,19 @@ void AliTOFQADataMaker::MakeESDs(AliESDEvent * esd)
   }
   
   Int_t nentries=ntof;
-  if(nentries==0)nentries=-1;
-  GetESDsData(0)->Fill(TMath::Log10(nentries)) ;
-  if(ntof>0)GetESDsData(4)->Fill(ntofpid/ntof) ;
+  if(nentries<=0){
+    FillESDsData(0,-1.) ;
+  }else{
+    FillESDsData(0,TMath::Log10(nentries)) ;
+  }
 
+  Float_t ratio = 0.;
+  if(ntof>0) ratio=(Float_t)ntofpid/(Float_t)ntof*100.;
+  FillESDsData(4,ratio) ;
+  //
+  IncEvCountCycleESDs();
+  IncEvCountTotalESDs();
+  //
 }
 
 //____________________________________________________________________________ 
@@ -522,6 +641,14 @@ void AliTOFQADataMaker::StartOfDetectorCycle()
   //to be implemented  
 }
 
+//____________________________________________________________________________ 
+void AliTOFQADataMaker::EndOfDetectorCycle(AliQAv1::TASKINDEX task, TObjArray * list)
+{
+  //Detector specific actions at end of cycle
+  // do the QA checking
+
+  AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;  
+}
 //____________________________________________________________________________
 void AliTOFQADataMaker::GetMapIndeces(Int_t* in , Int_t* out)
 {