]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PHOS/AliPHOSQADataMakerSim.cxx
Example macro for merging sets of alignment objects
[u/mrichter/AliRoot.git] / PHOS / AliPHOSQADataMakerSim.cxx
index 4127dbad99cd350b0ebd4f32aa13329d0fc541d1..0935a92eb5ea9605250be627285b4baff4b458ac 100644 (file)
 ClassImp(AliPHOSQADataMakerSim)
            
 //____________________________________________________________________________ 
-  AliPHOSQADataMakerSim::AliPHOSQADataMakerSim() : 
-  AliQADataMakerSim(AliQA::GetDetName(AliQA::kPHOS), "PHOS Quality Assurance Data Maker")
+AliPHOSQADataMakerSim::AliPHOSQADataMakerSim() : 
+  AliQADataMakerSim(AliQA::GetDetName(AliQA::kPHOS), "PHOS Quality Assurance Data Maker"),
+  fHits(0x0)
 {
   // ctor
+  fHits = new TClonesArray("AliPHOSHit", 1000);
 }
 
 //____________________________________________________________________________ 
 AliPHOSQADataMakerSim::AliPHOSQADataMakerSim(const AliPHOSQADataMakerSim& qadm) :
-  AliQADataMakerSim()
+  AliQADataMakerSim(),
+  fHits(0x0)
 {
   //copy ctor 
   SetName((const char*)qadm.GetName()) ; 
   SetTitle((const char*)qadm.GetTitle()); 
+  fHits = new TClonesArray("AliPHOSHit", 1000);
 }
 
 //__________________________________________________________________
@@ -68,7 +72,7 @@ AliPHOSQADataMakerSim& AliPHOSQADataMakerSim::operator = (const AliPHOSQADataMak
 }
  
 //____________________________________________________________________________ 
-void AliPHOSQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray * list)
+void AliPHOSQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX_t task, TObjArray * list)
 {
   //Detector specific actions at end of cycle
   // do the QA checking
@@ -79,77 +83,72 @@ void AliPHOSQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray
 void AliPHOSQADataMakerSim::InitHits()
 {
   // create Hits histograms in Hits subdir
+  Bool_t expert   = kTRUE ; 
   TH1F * h0 = new TH1F("hPhosHits",    "Hits energy distribution in PHOS",       100, 0., 100.) ; 
   h0->Sumw2() ;
-  Add2HitsList(h0, 0) ;
-  TH1I * h1  = new TH1I("hPhosHitsMul", "Hits multiplicity distribution in PHOS", 500, 0., 10000) ; 
+  Add2HitsList(h0, 0, !expert) ;
+  TH1I * h1 = new TH1I("hPhosHitsMul", "Hits multiplicity distribution in PHOS", 500, 0., 10000) ; 
   h1->Sumw2() ;
-  Add2HitsList(h1, 1) ;
+  Add2HitsList(h1, 1, !expert) ;
 }
 
 //____________________________________________________________________________ 
 void AliPHOSQADataMakerSim::InitDigits()
 {
   // create Digits histograms in Digits subdir
-  TH1I * h0 = new TH1I("hPhosDigits",    "Digits amplitude distribution in PHOS",    500, 0, 5000) ; 
+  Bool_t expert   = kTRUE ; 
+  TH1I * h0 = new TH1I("hPhosDigits",    "Digits amplitude distribution in PHOS",    500, 0, 1000) ; 
   h0->Sumw2() ;
-  Add2DigitsList(h0, 0) ;
-  TH1I * h1 = new TH1I("hPhosDigitsMul", "Digits multiplicity distribution in PHOS", 500, 0, 1000) ; 
+  Add2DigitsList(h0, 0, !expert) ;
+  TH1I * h1 = new TH1I("hPhosDigitsMul", "Digits multiplicity distribution in PHOS", 2000, 0, 10000) ; 
   h1->Sumw2() ;
-  Add2DigitsList(h1, 1) ;
+  Add2DigitsList(h1, 1, !expert) ;
 }
 
 //____________________________________________________________________________ 
 void AliPHOSQADataMakerSim::InitSDigits()
 {
   // create SDigits histograms in SDigits subdir
-  TH1F * h0 = new TH1F("hPhosSDigits",    "SDigits energy distribution in PHOS",       100, 0., 100.) ; 
+  Bool_t expert   = kTRUE ; 
+  TH1F * h0 = new TH1F("hPhosSDigits",    "SDigits energy distribution in PHOS",       500, 0., 1000.) ; 
   h0->Sumw2() ;
-  Add2SDigitsList(h0, 0) ;
-  TH1I * h1 = new TH1I("hPhosSDigitsMul", "SDigits multiplicity distribution in PHOS", 500, 0,  10000) ; 
+  Add2SDigitsList(h0, 0, !expert) ;
+  TH1I * h1 = new TH1I("hPhosSDigitsMul", "SDigits multiplicity distribution in PHOS", 500, 0,  1000) ; 
   h1->Sumw2() ;
-  Add2SDigitsList(h1, 1) ;
+  Add2SDigitsList(h1, 1, !expert) ;
 }
 
 //____________________________________________________________________________
-void AliPHOSQADataMakerSim::MakeHits(TClonesArray * hits)
+void AliPHOSQADataMakerSim::MakeHits()
 {
-       //make QA data from Hits
-
-    GetHitsData(1)->Fill(hits->GetEntriesFast()) ; 
-    TIter next(hits) ; 
-    AliPHOSHit * hit ; 
-    while ( (hit = dynamic_cast<AliPHOSHit *>(next())) ) {
-      GetHitsData(0)->Fill( hit->GetEnergy()) ;
-    }
+  //make QA data from Hits
+  
+  TIter next(fHits) ; 
+  AliPHOSHit * hit ; 
+  while ( (hit = dynamic_cast<AliPHOSHit *>(next())) ) {
+    GetHitsData(0)->Fill( hit->GetEnergy()) ;
+  }
 }
 
 //____________________________________________________________________________
 void AliPHOSQADataMakerSim::MakeHits(TTree * hitTree)
 {
-       // make QA data from Hit Tree
-       
-       TClonesArray * hits = new TClonesArray("AliPHOSHit", 1000);
-
-       TBranch * branch = hitTree->GetBranch("PHOS") ;
-       if ( ! branch ) {
-               AliWarning("PHOS branch in Hit Tree not found") ; 
-       } else {
-               TClonesArray * tmp =  new TClonesArray("AliPHOSHit", 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++) {
-                               AliPHOSHit * hit = dynamic_cast<AliPHOSHit *> (tmp->At(ihit)) ; 
-                               new((*hits)[index]) AliPHOSHit(*hit) ; 
-                               index++ ;
-                       } 
-               }       
-               tmp->Delete() ; 
-               delete tmp ; 
-               MakeHits(hits) ; 
-       }
+  // make QA data from Hit Tree
+  
+  TBranch * branch = hitTree->GetBranch("PHOS") ;
+  if ( ! branch ) {
+    AliWarning("PHOS branch in Hit Tree not found") ; 
+  } else {
+    Int_t nHits = 0;
+    branch->SetAddress(&fHits) ;
+    for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
+      branch->GetEntry(ientry) ;
+      nHits += fHits->GetEntriesFast();
+      MakeHits() ; 
+      fHits->Clear();
+    }  
+    GetHitsData(1)->Fill(nHits) ;
+  }
 }
 
 //____________________________________________________________________________