]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TOF/AliTOFQADataMakerSim.cxx
Changes in QA to be able to process separately different triggers (Ruben)
[u/mrichter/AliRoot.git] / TOF / AliTOFQADataMakerSim.cxx
index 84f54a639f31074eed9d259a8177cedc8bbc351f..ed2a234e425f98b490fd143842f53ad044a1f9ec 100644 (file)
@@ -43,7 +43,7 @@ ClassImp(AliTOFQADataMakerSim)
            
 //____________________________________________________________________________ 
   AliTOFQADataMakerSim::AliTOFQADataMakerSim() : 
-  AliQADataMakerSim(AliQA::GetDetName(AliQA::kTOF), "TOF Quality Assurance Data Maker")
+  AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kTOF), "TOF Quality Assurance Data Maker")
 {
   //
   // ctor
@@ -78,21 +78,28 @@ void AliTOFQADataMakerSim::InitHits()
   //
   // create Hits histograms in Hits subdir
   //
-  TH1F * h0 = new TH1F("hTOFHits",    "Number of TOF Hits ",301, -1.02, 5.) ; 
+
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ;   
+  
+  TH1F * h0 = new TH1F("hTOFHits",    "Number of TOF Hits per event;TOF hit number;Counts ",101, -1., 100.) ; 
   h0->Sumw2() ;
-  Add2HitsList(h0, 0) ;
+  Add2HitsList(h0, 0, !expert, image) ;
 
-  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);Simulated TOF time [ns];Counts", 25000, 0., 610.) ; 
   h1->Sumw2() ;
-  Add2HitsList(h1, 1) ;
+  Add2HitsList(h1, 1, !expert, image) ;
 
-  TH1F * h2  = new TH1F("hTOFHitsLength", "Length Spectrum in TOF (cm)", 500, 0., 500) ; 
+  TH1F * h2  = new TH1F("hTOFHitsLength", "Length Spectrum in TOF (cm);Track length from primary vertex till hit TOF pad [cm];Counts", 700, 0., 700) ; 
   h2->Sumw2() ;
-  Add2HitsList(h2, 2) ;
+  Add2HitsList(h2, 2, !expert, image) ;
 
-  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;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ; 
   h3->Sumw2() ;
-  Add2HitsList(h3, 3) ;
+  h3->GetYaxis()->SetTitleOffset(1.15);
+  Add2HitsList(h3, 3, !expert, image) ;
+  //
+  ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -101,21 +108,28 @@ void AliTOFQADataMakerSim::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) ; 
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  TH1F * h0 = new TH1F("hTOFDigits",    "Number of TOF Digit per event;TOF digit number;Counts ",101, -1., 100.) ;
+  h0->Sumw2() ;
+  Add2DigitsList(h0, 0, !expert, image) ;
+
+  TH1F * h1  = new TH1F("hTOFDigitsTime", "Digits Time Spectrum in TOF (ns);Digitized TOF time [ns];Counts", 25000, 0., 610.) ; 
   h1->Sumw2() ;
-  Add2DigitsList(h1, 1) ;
+  Add2DigitsList(h1, 1, !expert, image) ;
 
-  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);Digitized ToT time [ns];Counts", 1000, 0., 48.8) ; 
   h2->Sumw2() ;
-  Add2DigitsList(h2, 2) ;
+  Add2DigitsList(h2, 2, !expert, image) ;
 
-  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;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ; 
   h3->Sumw2() ;
-  Add2DigitsList(h3, 3) ;
-
+  h3->GetYaxis()->SetTitleOffset(1.15);
+  Add2DigitsList(h3, 3, !expert, image) ;
+  //
+  ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -124,21 +138,28 @@ void AliTOFQADataMakerSim::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) ; 
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  TH1F * h0 = new TH1F("hTOFSDigits",    "Number of TOF SDigits per event;TOF sdigit number;Counts ",101, -1., 100.) ;
+  h0->Sumw2() ;
+  Add2SDigitsList(h0, 0, !expert, image) ;
+
+  TH1F * h1  = new TH1F("hTOFSDigitsTime", "SDigits Time Spectrum in TOF (ns);SDigitized TOF time [ns];Counts", 25000, 0., 610) ; 
   h1->Sumw2() ;
-  Add2SDigitsList(h1, 1) ;
+  Add2SDigitsList(h1, 1, !expert, image) ;
 
-  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;2*strip+padz (eta);48*sector+padx (phi)",183, -0.5, 182.5,865,-0.5,864.5) ; 
   h2->Sumw2() ;
-  Add2SDigitsList(h2, 2) ;
-
+  h2->GetYaxis()->SetTitleOffset(1.15);
+  Add2SDigitsList(h2, 2, !expert, image) ;
+  //
+  ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
 }
 
 //____________________________________________________________________________
-void AliTOFQADataMakerSim::MakeHits(TClonesArray * hits)
+void AliTOFQADataMakerSim::MakeHits()
 {
   //
   //make QA data from Hits
@@ -147,18 +168,18 @@ void AliTOFQADataMakerSim::MakeHits(TClonesArray * hits)
   Int_t in[5];
   Int_t out[5];
 
-  Int_t nentries=hits->GetEntriesFast();
+  Int_t nentries= fHitsArray->GetEntriesFast();
   if(nentries<=0) {
-    GetHitsData(0)->Fill(-1.) ; 
+    FillHitsData(0,-1.) ; 
   } else{
-    GetHitsData(0)->Fill(TMath::Log10(nentries)) ; 
+    FillHitsData(0,nentries) ; 
   }
-  TIter next(hits) ; 
+  TIter next(fHitsArray) ; 
   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();
@@ -166,9 +187,8 @@ void AliTOFQADataMakerSim::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
   }
-
 }
 
 
@@ -180,7 +200,7 @@ void AliTOFQADataMakerSim::MakeHits(TTree * hitTree)
   //
   if(!hitTree){
     AliError("can't get the tree with TOF hits !");
-    return;
+    return; 
   }    
 
   TBranch * branch = hitTree->GetBranch("TOF") ;
@@ -190,51 +210,48 @@ void AliTOFQADataMakerSim::MakeHits(TTree * hitTree)
     return;
   }
 
-  static TClonesArray statichits("AliTOFhitT0", 1000);
-  statichits.Clear();
-  TClonesArray *hits = &statichits;
-  static TClonesArray staticdummy("AliTOFhitT0", 1000);
-  staticdummy.Clear();
-  TClonesArray *dummy = &staticdummy;
-  branch->SetAddress(&dummy);
-  Int_t index = 0 ;  
+  if (fHitsArray) 
+    fHitsArray->Clear() ; 
+  else 
+    fHitsArray = new TClonesArray("AliTOFhitT0", 1000) ;
+  
+  branch->SetAddress(&fHitsArray);
   for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
     branch->GetEntry(ientry) ; 
-    for (Int_t ihit = 0 ; ihit < dummy->GetEntries() ; ihit++) {
-      AliTOFhitT0 * hit = dynamic_cast<AliTOFhitT0 *> (dummy->At(ihit)) ; 
-      new((*hits)[index]) AliTOFhitT0(*hit) ; 
-      index++ ;
-    } 
+    MakeHits() ; 
+    fHitsArray->Clear() ; 
   }    
-
-  MakeHits(hits) ; 
-
+  //
+  IncEvCountCycleHits();
+  IncEvCountTotalHits();
+  //
 }
 
 //____________________________________________________________________________
-void AliTOFQADataMakerSim::MakeDigits(TClonesArray * digits)
+void AliTOFQADataMakerSim::MakeDigits()
 {
   //
   // 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();
+  Int_t nentries=fDigitsArray->GetEntriesFast();
   if(nentries<=0){
-    GetDigitsData(0)->Fill(-1.) ; 
+    FillDigitsData(0,-1.) ; 
   }else{
-    GetDigitsData(0)->Fill(TMath::Log10(nentries)) ; 
+    FillDigitsData(0,nentries) ; 
   } 
 
-  TIter next(digits) ; 
+  TIter next(fDigitsArray) ; 
   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();
@@ -242,7 +259,7 @@ void AliTOFQADataMakerSim::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
   }
 
 }
@@ -254,42 +271,49 @@ void AliTOFQADataMakerSim::MakeDigits(TTree * digitTree)
   //
   // makes data from Digit Tree
   //
-  TClonesArray * digits = new TClonesArray("AliTOFdigit", 1000) ; 
+  if (fDigitsArray) 
+    fDigitsArray->Clear() ; 
+  else 
+    fDigitsArray = 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) ; 
+  branch->SetAddress(&fDigitsArray);
+  branch->GetEntry(0);
+  MakeDigits(); 
+  //
+  IncEvCountCycleDigits();
+  IncEvCountTotalDigits();
+  //
 }
 
 //____________________________________________________________________________
-void AliTOFQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
+void AliTOFQADataMakerSim::MakeSDigits()
 {
   //
   // makes data from SDigits
   //
-
+  
   Double_t tdc2ns=AliTOFGeometry::TdcBinWidth()*1E-3;
   Int_t in[5];
   Int_t out[5];
 
-  Int_t nentries=sdigits->GetEntriesFast();
+  Int_t nentries=fSDigitsArray->GetEntriesFast();
   if(nentries<=0){
-    GetSDigitsData(0)->Fill(-1.) ; 
+    FillSDigitsData(0,-1.) ; 
   }else{
-    GetSDigitsData(0)->Fill(TMath::Log10(nentries)) ; 
+    FillSDigitsData(0,nentries) ; 
   } 
 
-  TIter next(sdigits) ; 
+  TIter next(fSDigitsArray) ; 
   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();
@@ -298,7 +322,7 @@ void AliTOFQADataMakerSim::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
   }
 }
 
@@ -308,16 +332,23 @@ void AliTOFQADataMakerSim::MakeSDigits(TTree * sdigitTree)
   //
   // makes data from SDigit Tree
   //
-  TClonesArray * sdigits = new TClonesArray("AliTOFSDigit", 1000) ; 
+  if (fSDigitsArray) 
+    fSDigitsArray->Clear() ; 
+  else 
+    fSDigitsArray = new TClonesArray("AliTOFSDigit", 1000) ; 
   
   TBranch * branch = sdigitTree->GetBranch("TOF") ;
   if ( ! branch ) {
     AliError("TOF branch in SDigit Tree not found") ; 
     return;
   }
-  branch->SetAddress(&sdigits) ;
-  branch->GetEntry(0) ; 
-  MakeSDigits(sdigits) ; 
+  branch->SetAddress(&fSDigitsArray);
+  branch->GetEntry(0); 
+  MakeSDigits(); 
+  //
+  IncEvCountCycleSDigits();
+  IncEvCountTotalSDigits();  
+  //
 }
 
 //____________________________________________________________________________ 
@@ -329,12 +360,12 @@ void AliTOFQADataMakerSim::StartOfDetectorCycle()
 }
 
 //____________________________________________________________________________ 
-void AliTOFQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
+void AliTOFQADataMakerSim::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) ;  
+  ResetEventTrigClasses();
+  AliQAChecker::Instance()->Run(AliQAv1::kTOF, task, list) ;  
 }
 //____________________________________________________________________________
 void AliTOFQADataMakerSim::GetMapIndeces(Int_t* in , Int_t* out)