]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFQADataMakerRec.cxx
Fixes to remove compilation warnings
[u/mrichter/AliRoot.git] / TOF / AliTOFQADataMakerRec.cxx
index d0dabf91b2a64f8805da9cff1d2bd64aa1b9e5f1..0da99374cd35b45bd22338f39662f97a99186bad 100644 (file)
 #include "AliTOFRawStream.h"
 #include "AliTOFrawData.h"
 #include "AliTOFGeometry.h"
+#include "AliTOFdigit.h"
 
 ClassImp(AliTOFQADataMakerRec)
            
 //____________________________________________________________________________ 
   AliTOFQADataMakerRec::AliTOFQADataMakerRec() : 
-  AliQADataMakerRec(AliQA::GetDetName(AliQA::kTOF), "TOF Quality Assurance Data Maker")
+  AliQADataMakerRec(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker")
 {
   //
   // ctor
@@ -79,23 +80,55 @@ void AliTOFQADataMakerRec::InitRaws()
   // create Raws histograms in Raws subdir
   //
 
-  Bool_t expert = kFALSE;
-
-  TH1F * h0 = new TH1F("hTOFRaws",    "Number of TOF Raws ",301, -1.02, 5.) ;   h0->Sumw2() ;
-  Add2RawsList(h0, 0, expert) ;
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t saveCorr = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  TH1F * h0 = new TH1F("hTOFRaws",    "Number of TOF Raws;TOF raw number [10 power];Counts ",301, -1.02, 5.) ;
+  h0->Sumw2() ;
+  Add2RawsList(h0, 0, !expert, image, !saveCorr) ;
 
-  TH1F * h1  = new TH1F("hTOFRawsTime", "Raws Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  TH1F * h1  = new TH1F("hTOFRawsTime", "Raws Time Spectrum in TOF (ns);Measured TOF time [ns];Counts", 2000, 0., 200) ; 
   h1->Sumw2() ;
-  Add2RawsList(h1, 1, expert) ;
+  Add2RawsList(h1, 1, !expert, image, !saveCorr) ;
 
-  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);Measured TOT time [ns];Counts", 500, 0., 50) ; 
   h2->Sumw2() ;
-  Add2RawsList(h2, 2, expert) ;
+  Add2RawsList(h2, 2, !expert, image, !saveCorr) ;
 
-  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;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ; 
   h3->Sumw2() ;
-  Add2RawsList(h3, 3, expert) ;
+  h3->GetYaxis()->SetTitleOffset(1.15);
+  Add2RawsList(h3, 3, !expert, image, !saveCorr) ;
+
+}
 
+//____________________________________________________________________________ 
+void AliTOFQADataMakerRec::InitDigits()
+{
+  //
+  // create Digits histograms in Digits subdir
+  //
+  
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  TH1F * h0 = new TH1F("hTOFDigits",    "Number of TOF Digits;TOF digit number [10 power];Counts ",301, -1.02, 5.) ;
+  h0->Sumw2() ;
+  Add2DigitsList(h0, 0, !expert, image) ;
+  
+  TH1F * h1  = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns);Digitized TOF time [ns];Counts", 2000, 0., 200) ; 
+  h1->Sumw2() ;
+  Add2DigitsList(h1, 1, !expert, image) ;
+  
+  TH1F * h2  = new TH1F("hTOFDigitsToT", "Digits ToT Spectrum in TOF (ns);Digitized TOF time [ns];Counts", 500, 0., 50) ; 
+  h2->Sumw2() ;
+  Add2DigitsList(h2, 2, !expert, image) ;
+  
+  TH2F * h3  = new TH2F("hTOFDigitsClusMap","Digits vs TOF eta-phi;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ; 
+  h3->Sumw2() ;
+  h3->GetYaxis()->SetTitleOffset(1.15);
+  Add2DigitsList(h3, 3, !expert, image) ;
 }
 
 //____________________________________________________________________________ 
@@ -105,27 +138,29 @@ void AliTOFQADataMakerRec::InitRecPoints()
   // create RecPoints histograms in RecPoints subdir
   //
 
-  Bool_t expert = kFALSE;
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
 
-  TH1F * h0 = new TH1F("hTOFRecPoints",    "Number of TOF RecPoints ",301, -1.02, 5.) ;   h0->Sumw2() ;
-  Add2RecPointsList(h0, 0, expert) ;
+  TH1F * h0 = new TH1F("hTOFRecPoints",    "Number of TOF RecPoints;TOF recPoint number [10 power];Counts",301, -1.02, 5.) ;
+  h0->Sumw2() ;
+  Add2RecPointsList(h0, 0, !expert, image) ;
 
-  TH1F * h1  = new TH1F("hTOFRecPointsTime", "RecPoints Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  TH1F * h1  = new TH1F("hTOFRecPointsTime", "RecPoints Time Spectrum in TOF (ns);Calibrated TOF time [ns];Counts", 2000, 0., 200) ; 
   h1->Sumw2() ;
-  Add2RecPointsList(h1, 1, expert) ;
+  Add2RecPointsList(h1, 1, !expert, image) ;
 
-  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);Measured TOF time [ns];Counts", 2000, 0., 200) ; 
   h2->Sumw2() ;
-  Add2RecPointsList(h2, 2, expert) ;
+  Add2RecPointsList(h2, 2, !expert, image) ;
 
-  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);Measured TOT [ns];Counts", 500, 0., 50) ; 
   h3->Sumw2() ;
-  Add2RecPointsList(h3, 3, expert) ;
+  Add2RecPointsList(h3, 3, !expert, image) ;
 
-  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;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ; 
   h4->Sumw2() ;
-  Add2RecPointsList(h4, 4, expert) ;
-
+  h4->GetYaxis()->SetTitleOffset(1.15);
+  Add2RecPointsList(h4, 4, !expert, image) ;
 }
 
 //____________________________________________________________________________ 
@@ -135,27 +170,27 @@ void AliTOFQADataMakerRec::InitESDs()
   //create ESDs histograms in ESDs subdir
   //
 
-  Bool_t expert = kFALSE;
-
-  TH1F * h0 = new TH1F("hTOFESDs",    "Number of matched TOF tracks over ESDs",       250, -1., 4.) ;  
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  TH1F * h0 = new TH1F("hTOFESDs",    "Number of matched TOF tracks over ESDs;Number of TOF matched ESD tracks [10 power];Counts",       250, -1., 4.) ;  
   h0->Sumw2() ; 
-  Add2ESDsList(h0, 0, expert) ;
+  Add2ESDsList(h0, 0, !expert, image) ;
 
-  TH1F * h1  = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns)", 2000, 0., 200) ; 
+  TH1F * h1  = new TH1F("hTOFESDsTime", "Time Spectrum in TOF (ns);Calibrated TOF time [ns];Counts", 2000, 0., 200) ; 
   h1->Sumw2() ;
-  Add2ESDsList(h1, 1, expert) ;
+  Add2ESDsList(h1, 1, !expert, image) ;
 
-  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);Measured TOF time [ns];Counts", 2000, 0., 200) ; 
   h2->Sumw2() ;
-  Add2ESDsList(h2, 2, expert) ;
+  Add2ESDsList(h2, 2, !expert, image) ;
 
-  TH1F * h3  = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns)", 500, 0., 50) ; 
+  TH1F * h3  = new TH1F("hTOFESDsToT", "ToT Spectrum in TOF (ns);Measured TOF time [ns];Counts", 500, 0., 50) ; 
   h3->Sumw2() ;
-  Add2ESDsList(h3, 3, expert) ;
+  Add2ESDsList(h3, 3, !expert, image) ;
 
-  TH1F * h4 = new TH1F("hTOFESDsPID",    "Fraction of matched TOF tracks with good PID glag", 100, 0., 1.) ;  
+  TH1F * h4 = new TH1F("hTOFESDsPID",    "Fraction of matched TOF tracks with good PID flag (%);Fraction of TOF matched ESD tracks with good flag [%];Counts", 101, 0., 101.) ;  
   h4->Sumw2() ; 
-  Add2ESDsList(h4, 4, expert) ;
+  Add2ESDsList(h4, 4, !expert, image) ;
 }
 
 //____________________________________________________________________________
@@ -164,7 +199,11 @@ void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
   //
   // makes data from Raws
   //
-
+  
+  // Check id histograms already created for this Event Specie
+  if ( ! GetRawsData(0) )
+    InitRaws() ;
+  
   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
   Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
 
@@ -210,6 +249,64 @@ void AliTOFQADataMakerRec::MakeRaws(AliRawReader* rawReader)
   }
 }
 
+//____________________________________________________________________________
+void AliTOFQADataMakerRec::MakeDigits(TClonesArray * digits)
+{
+  //
+  // makes data from Digits
+  //
+  Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
+  Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
+  Int_t in[5];
+  Int_t out[5];
+  
+  Int_t nentries=digits->GetEntriesFast();
+  if(nentries<=0){
+    GetDigitsData(0)->Fill(-1.) ; 
+  }else{
+    GetDigitsData(0)->Fill(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
+      
+      in[0] = digit->GetSector();
+      in[1] = digit->GetPlate();
+      in[2] = digit->GetStrip();
+      in[3] = digit->GetPadx();
+      in[4]= digit->GetPadz();
+      GetMapIndeces(in,out);
+      GetDigitsData(3)->Fill( out[0],out[1]) ;//digit map
+  }
+}
+
+//____________________________________________________________________________
+void AliTOFQADataMakerRec::MakeDigits(TTree * digitTree)
+{
+  //
+  // makes data from Digit Tree
+  //
+  // Check id histograms already created for this Event Specie
+  if ( ! GetDigitsData(0) )
+    InitDigits() ;
+  
+  TClonesArray * digits = new TClonesArray("AliTOFdigit", 1000) ; 
+  
+  TBranch * branch = digitTree->GetBranch("TOF") ;
+  if ( ! branch ) {
+    AliError("TOF branch in Digit Tree not found") ; 
+    return;
+  }
+  branch->SetAddress(&digits) ;
+  branch->GetEntry(0) ; 
+  MakeDigits(digits) ; 
+}
+
 //____________________________________________________________________________
 void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
 {
@@ -217,6 +314,10 @@ void AliTOFQADataMakerRec::MakeRecPoints(TTree * clustersTree)
   // Make data from Clusters
   //
 
+  // Check id histograms already created for this Event Specie
+  if ( ! GetRecPointsData(0) )
+    InitRecPoints() ;
+  
   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
   Double_t tot2ns=AliTOFGeometry::ToTBinWidth()*1E-3;
 
@@ -269,6 +370,10 @@ void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
   //
   // make QA data from ESDs
   //  
+  // Check id histograms already created for this Event Specie
+  if ( ! GetESDsData(0) )
+    InitESDs() ;
+  
   Int_t ntrk = esd->GetNumberOfTracks() ; 
   Int_t ntof=0;
   Int_t ntofpid=0;
@@ -296,8 +401,10 @@ void AliTOFQADataMakerRec::MakeESDs(AliESDEvent * esd)
     GetESDsData(0)->Fill(TMath::Log10(nentries)) ;
   }
 
-  if(ntof>0)GetESDsData(4)->Fill(ntofpid/ntof) ;
-
+  if(ntof>0) {
+    Float_t ratio = (Float_t)ntofpid/(Float_t)ntof*100.;
+    GetESDsData(4)->Fill(ratio) ;
+  }
 }
 
 //____________________________________________________________________________ 
@@ -309,12 +416,11 @@ void AliTOFQADataMakerRec::StartOfDetectorCycle()
 }
 
 //____________________________________________________________________________ 
-void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
+void AliTOFQADataMakerRec::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list)
 {
   //Detector specific actions at end of cycle
   // do the QA checking
-
-  AliQAChecker::Instance()->Run(AliQA::kTOF, task, list) ;  
+  AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;  
 }
 //____________________________________________________________________________
 void AliTOFQADataMakerRec::GetMapIndeces(Int_t* in , Int_t* out)