]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALQADataMakerSim.cxx
script that allows to 1) merge the QA data available in AliEn and belonging to a...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALQADataMakerSim.cxx
index 855d1a69330da859375f3817690983f6278d93f9..318bd2b3469248c08113ff07957a683f6ee2d361 100644 (file)
@@ -82,10 +82,10 @@ void AliEMCALQADataMakerSim::InitHits()
   const Bool_t expert   = kTRUE ; 
   const Bool_t image    = kTRUE ; 
   
-  TH1F * h0 = new TH1F("hEmcalHits",    "Hits energy distribution in EMCAL",       200, 0., 2.) ; //GeV
+  TH1F * h0 = new TH1F("hEmcalHits",    "Hits energy distribution in EMCAL;Energy [MeV];Counts",       200, 0., 2.) ; //GeV
   h0->Sumw2() ;
   Add2HitsList(h0, 0, !expert, image) ;
-  TH1I * h1  = new TH1I("hEmcalHitsMul", "Hits multiplicity distribution in EMCAL", 1000, 0, 10000) ; 
+  TH1I * h1  = new TH1I("hEmcalHitsMul", "Hits multiplicity distribution in EMCAL;# of Hits;Entries", 1000, 0, 10000) ; 
   h1->Sumw2() ;
   Add2HitsList(h1, 1, !expert, image) ;
 }
@@ -97,10 +97,10 @@ void AliEMCALQADataMakerSim::InitDigits()
   const Bool_t expert   = kTRUE ; 
   const Bool_t image    = kTRUE ; 
   
-  TH1I * h0 = new TH1I("hEmcalDigits",    "Digits amplitude distribution in EMCAL",    500, 0, 500) ; 
+  TH1I * h0 = new TH1I("hEmcalDigits",    "Digits amplitude distribution in EMCAL;Amplitude [ADC counts];Counts",    500, 0, 500) ; 
   h0->Sumw2() ;
   Add2DigitsList(h0, 0, !expert, image) ;
-  TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL", 200, 0, 2000) ; 
+  TH1I * h1 = new TH1I("hEmcalDigitsMul", "Digits multiplicity distribution in EMCAL;# of Digits;Entries", 200, 0, 2000) ; 
   h1->Sumw2() ;
   Add2DigitsList(h1, 1, !expert, image) ;
 }
@@ -112,21 +112,21 @@ void AliEMCALQADataMakerSim::InitSDigits()
   const Bool_t expert   = kTRUE ; 
   const Bool_t image    = kTRUE ; 
   
-  TH1F * h0 = new TH1F("hEmcalSDigits",    "SDigits energy distribution in EMCAL",       200, 0., 20.) ; 
+  TH1F * h0 = new TH1F("hEmcalSDigits",    "SDigits energy distribution in EMCAL;Energy [MeV];Counts",       200, 0., 20.) ; 
   h0->Sumw2() ;
   Add2SDigitsList(h0, 0, !expert, image) ;
-  TH1I * h1 = new TH1I("hEmcalSDigitsMul", "SDigits multiplicity distribution in EMCAL", 500, 0,  5000) ; 
+  TH1I * h1 = new TH1I("hEmcalSDigitsMul", "SDigits multiplicity distribution in EMCAL;# of SDigits;Entries", 500, 0,  5000) ; 
   h1->Sumw2() ;
   Add2SDigitsList(h1, 1, !expert, image) ;
 }
 
 //____________________________________________________________________________
-void AliEMCALQADataMakerSim::MakeHits(TClonesArray * hits)
+void AliEMCALQADataMakerSim::MakeHits()
 {
   //make QA data from Hits
-
-  GetHitsData(1)->Fill(hits->GetEntriesFast()) ; 
-  TIter next(hits) ; 
+  GetHitsData(1)->Fill(fHitsArray->GetEntriesFast()) ; 
+  TIter next(fHitsArray) ; 
   AliEMCALHit * hit ; 
   while ( (hit = dynamic_cast<AliEMCALHit *>(next())) ) {
     GetHitsData(0)->Fill( hit->GetEnergy()) ;
@@ -139,36 +139,31 @@ 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 ;  
+    branch->SetAddress(&fHitsArray) ;
     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) ; 
+      MakeHits() ; 
+      fHitsArray->Clear() ; 
+    }
   }
 }
 
 //____________________________________________________________________________
-void AliEMCALQADataMakerSim::MakeDigits(TClonesArray * digits)
+void AliEMCALQADataMakerSim::MakeDigits()
 {
   // makes data from Digits
-
-  GetDigitsData(1)->Fill(digits->GetEntriesFast()) ; 
-  TIter next(digits) ; 
+  GetDigitsData(1)->Fill(fDigitsArray->GetEntriesFast()) ; 
+  TIter next(fDigitsArray) ; 
   AliEMCALDigit * digit ; 
   while ( (digit = dynamic_cast<AliEMCALDigit *>(next())) ) {
     GetDigitsData(0)->Fill( digit->GetAmp()) ;
@@ -180,29 +175,33 @@ void AliEMCALQADataMakerSim::MakeDigits(TClonesArray * digits)
 void AliEMCALQADataMakerSim::MakeDigits(TTree * digitTree)
 {
   // makes data from Digit Tree
-  TClonesArray * digits = new TClonesArray("AliEMCALDigit", 1000) ; 
+  if (fDigitsArray) 
+    fDigitsArray->Clear() ; 
+  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->SetAddress(&fDigitsArray) ;
     branch->GetEntry(0) ; 
-    MakeDigits(digits) ; 
+    MakeDigits() ; 
   }
 
 }
 
 //____________________________________________________________________________
-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
+
   AliEMCALSDigitizer* sDigitizer = new AliEMCALSDigitizer();
 
-  GetSDigitsData(1)->Fill(sdigits->GetEntriesFast()) ; 
-  TIter next(sdigits) ; 
+  GetSDigitsData(1)->Fill(fSDigitsArray->GetEntriesFast()) ; 
+  TIter next(fSDigitsArray) ; 
   AliEMCALDigit * sdigit ; 
   while ( (sdigit = dynamic_cast<AliEMCALDigit *>(next())) ) {
     GetSDigitsData(0)->Fill( sDigitizer->Calibrate(sdigit->GetAmp())) ;
@@ -215,15 +214,18 @@ 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() ; 
+  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->SetAddress(&fSDigitsArray) ;
     branch->GetEntry(0) ;
-    MakeSDigits(sdigits) ; 
+    MakeSDigits() ; 
   }
 
 }