]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALQADataMakerSim.cxx
coverity
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALQADataMakerSim.cxx
index 27b96552bdf72d03eaa7a1a0d6e5b52ec7301dd7..467471a744735eaaf97177964d92b7843fa1c52c 100644 (file)
@@ -72,6 +72,7 @@ void AliEMCALQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjA
 {
   //Detector specific actions at end of cycle
   // do the QA checking
+  ResetEventTrigClasses(); // reset triggers list to select all histos
   AliQAChecker::Instance()->Run(AliQAv1::kEMCAL, task, list) ;  
 }
 
@@ -88,6 +89,8 @@ void AliEMCALQADataMakerSim::InitHits()
   TH1I * h1  = new TH1I("hEmcalHitsMul", "Hits multiplicity distribution in EMCAL;# of Hits;Entries", 1000, 0, 10000) ; 
   h1->Sumw2() ;
   Add2HitsList(h1, 1, !expert, image) ;
+  //
+  ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -103,6 +106,8 @@ void AliEMCALQADataMakerSim::InitDigits()
   TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL;# of Digits;Entries", 200, 0, 2000) ; 
   h1->Sumw2() ;
   Add2DigitsList(h1, 1, !expert, image) ;
+  //
+  ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
@@ -118,111 +123,95 @@ void AliEMCALQADataMakerSim::InitSDigits()
   TH1I * h1 = new TH1I("hEmcalSDigitsMul", "SDigits multiplicity distribution in EMCAL;# of SDigits;Entries", 500, 0,  5000) ; 
   h1->Sumw2() ;
   Add2SDigitsList(h1, 1, !expert, image) ;
+  //
+  ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line
 }
 
 //____________________________________________________________________________
-void AliEMCALQADataMakerSim::MakeHits(TClonesArray * hits)
+void AliEMCALQADataMakerSim::MakeHits()
 {
   //make QA data from Hits
-
-  
-  // Check id histograms already created for this Event Specie
-  if ( ! GetHitsData(0) )
-    InitHits() ;
-  
-  GetHitsData(1)->Fill(hits->GetEntriesFast()) ; 
-  TIter next(hits) ; 
+  FillHitsData(1,fHitsArray->GetEntriesFast()) ; 
+  TIter next(fHitsArray) ; 
   AliEMCALHit * hit ; 
   while ( (hit = dynamic_cast<AliEMCALHit *>(next())) ) {
-    GetHitsData(0)->Fill( hit->GetEnergy()) ;
+    FillHitsData(0, hit->GetEnergy()) ;
   }
-
 }
 
 //____________________________________________________________________________
 void AliEMCALQADataMakerSim::MakeHits(TTree * hitTree)
 {
   // make QA data from Hit Tree
-  
-  TClonesArray * hits = new TClonesArray("AliEMCALHit", 1000);
+  if (fHitsArray) 
+    fHitsArray->Clear() ; 
+  else
+    fHitsArray = new TClonesArray("AliEMCALHit", 1000);
   
   TBranch * branch = hitTree->GetBranch("EMCAL") ;
-  if ( ! branch ) {
-    AliWarning("EMCAL branch in Hit Tree not found") ; 
-  } else {
-    TClonesArray * tmp =  new TClonesArray("AliEMCALHit", 1000) ;
-    branch->SetAddress(&tmp) ;
-    Int_t index = 0 ;  
-    for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
-      branch->GetEntry(ientry) ; 
-      for (Int_t ihit = 0 ; ihit < tmp->GetEntries() ; ihit++) {
-       AliEMCALHit * hit = dynamic_cast<AliEMCALHit *> (tmp->At(ihit)) ; 
-       new((*hits)[index]) AliEMCALHit(*hit) ; 
-       index++ ;
-      } 
-    }  
-    tmp->Delete() ; 
-    delete tmp ; 
-    MakeHits(hits) ; 
+  if ( ! branch ) { AliWarning("EMCAL branch in Hit Tree not found") ; return;}
+  //
+  branch->SetAddress(&fHitsArray) ;
+  for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
+    branch->GetEntry(ientry) ; 
+    MakeHits() ; 
+    fHitsArray->Clear() ; 
   }
+  IncEvCountCycleHits();
+  IncEvCountTotalHits();
+  //
 }
 
 //____________________________________________________________________________
-void AliEMCALQADataMakerSim::MakeDigits(TClonesArray * digits)
+void AliEMCALQADataMakerSim::MakeDigits()
 {
   // makes data from Digits
 
-  
-  // Check id histograms already created for this Event Specie
-  if ( ! GetDigitsData(0) )
-    InitDigits() ;
-  
-  GetDigitsData(1)->Fill(digits->GetEntriesFast()) ; 
-  TIter next(digits) ; 
+  FillDigitsData(1,fDigitsArray->GetEntriesFast()) ; 
+  TIter next(fDigitsArray) ; 
   AliEMCALDigit * digit ; 
   while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) {
-    GetDigitsData(0)->Fill( digit->GetAmp()) ;
+    FillDigitsData(0, digit->GetAmp()) ;
   }  
-
 }
 
 //____________________________________________________________________________
 void AliEMCALQADataMakerSim::MakeDigits(TTree * digitTree)
 {
   // makes data from Digit Tree
-  TClonesArray * digits = new TClonesArray("AliEMCALDigit", 1000) ; 
+
+  if (fDigitsArray) 
+    fDigitsArray->Clear("C") ; 
+  else
+    fDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ; 
   
   TBranch * branch = digitTree->GetBranch("EMCAL") ;
-  if ( ! branch ) {
-    AliWarning("EMCAL branch in Digit Tree not found") ; 
-  } else {
-    branch->SetAddress(&digits) ;
-    branch->GetEntry(0) ; 
-    MakeDigits(digits) ; 
-  }
-
+  if ( ! branch ) { AliWarning("EMCAL branch in Digit Tree not found") ; return; }
+  //
+  branch->SetAddress(&fDigitsArray) ;
+  branch->GetEntry(0) ; 
+  MakeDigits() ; 
+  //
+  IncEvCountCycleDigits();
+  IncEvCountTotalDigits();
 }
 
 //____________________________________________________________________________
-void AliEMCALQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
+void AliEMCALQADataMakerSim::MakeSDigits()
 {
   // makes data from SDigits
   //Need a copy of the SDigitizer to calibrate the sdigit amplitude to
   //energy in GeV
-  
-  // Check id histograms already created for this Event Specie
-  if ( ! GetSDigitsData(0) )
-    InitSDigits() ;
-  
+
   AliEMCALSDigitizer* sDigitizer = new AliEMCALSDigitizer();
 
-  GetSDigitsData(1)->Fill(sdigits->GetEntriesFast()) ; 
-  TIter next(sdigits) ; 
+  FillSDigitsData(1,fSDigitsArray->GetEntriesFast()) ; 
+  TIter next(fSDigitsArray) ; 
   AliEMCALDigit * sdigit ; 
   while ( (sdigit = dynamic_cast<AliEMCALDigit *>(next())) ) {
-    GetSDigitsData(0)->Fill( sDigitizer->Calibrate(sdigit->GetAmp())) ;
+    FillSDigitsData(0, sDigitizer->Calibrate(sdigit->GetAmp())) ;
   } 
-
   delete sDigitizer;
 }
 
@@ -230,17 +219,21 @@ void AliEMCALQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
 void AliEMCALQADataMakerSim::MakeSDigits(TTree * sdigitTree)
 {
   // makes data from SDigit Tree
-  TClonesArray * sdigits = new TClonesArray("AliEMCALDigit", 1000) ; 
+  if (fSDigitsArray) 
+    fSDigitsArray->Clear("C") ; 
+  else 
+    fSDigitsArray = new TClonesArray("AliEMCALDigit", 1000) ; 
   
   TBranch * branch = sdigitTree->GetBranch("EMCAL") ;
-  if ( ! branch ) {
-    AliWarning("EMCAL branch in SDigit Tree not found") ; 
-  } else {
-    branch->SetAddress(&sdigits) ;
-    branch->GetEntry(0) ;
-    MakeSDigits(sdigits) ; 
-  }
-
+  if ( ! branch ) { AliWarning("EMCAL branch in SDigit Tree not found"); return;}
+  //
+  branch->SetAddress(&fSDigitsArray);
+  branch->GetEntry(0);
+  MakeSDigits(); 
+  //
+  IncEvCountCycleSDigits();
+  IncEvCountTotalSDigits();
+  //
 }
 
 //____________________________________________________________________________