]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PMD/AliPMDQADataMakerSim.cxx
macro title as filename
[u/mrichter/AliRoot.git] / PMD / AliPMDQADataMakerSim.cxx
index 81c1918b206a690031e87dab72ecb6cd1a528c4a..b986e44c6eaba0e40fe2aa927422749f80cbb620 100644 (file)
@@ -70,232 +70,240 @@ AliPMDQADataMakerSim& AliPMDQADataMakerSim::operator = (const AliPMDQADataMakerS
 void AliPMDQADataMakerSim::InitHits()
 {
     // create Hits histograms in Hits subdir
-
-    TH1F *h0 = new TH1F("hPreHitsEdep","Hits energy distribution in (keV)PRE(PMD)", 500, 0., 500.); 
-    h0->Sumw2() ;
-    Add2HitsList(h0, 0) ;
-
-    TH1F *h1 = new TH1F("hCpvHitsEdep","Hits energy distribution in (keV)CPV(PMD)", 500, 0., 500.); 
-    h1->Sumw2() ;
-    Add2HitsList(h1, 1) ;
-
-    TH1I *h2 = new TH1I("hPreHitsMult","Hits multiplicity distribution in PRE(PMD)", 500, 0, 3000) ; 
-    h2->Sumw2() ;
-    Add2HitsList(h2, 2) ;
-
-    TH1I *h3 = new TH1I("hCpvHitsMult","Hits multiplicity distribution in PRE(PMD)", 500, 0, 3000) ; 
-    h2->Sumw2() ;
-    Add2HitsList(h3, 3) ;
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  TH1F *h0 = new TH1F("hPreHitsEdep","Hits energy distribution PRE(PMD);Energy [keV];Counts", 500, 0., 500.); 
+  h0->Sumw2() ;
+  Add2HitsList(h0, 0, !expert, image) ;
+  
+  TH1F *h1 = new TH1F("hCpvHitsEdep","Hits energy distribution CPV(PMD);Energy [keV];Counts", 500, 0., 500.); 
+  h1->Sumw2() ;
+  Add2HitsList(h1, 1, !expert, image) ;
+  
+  TH1I *h2 = new TH1I("hPreHitsMult","Hits multiplicity distribution in PRE(PMD);# of Hits;Entries", 500, 0, 3000) ; 
+  h2->Sumw2() ;
+  Add2HitsList(h2, 2, !expert, image) ;
+  
+  TH1I *h3 = new TH1I("hCpvHitsMult","Hits multiplicity distribution in PRE(PMD);# of Hits;Entries", 500, 0, 3000) ; 
+  h2->Sumw2() ;
+  Add2HitsList(h3, 3, !expert, image) ;
+  //
+  ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line
 }
 
 //____________________________________________________________________________ 
 void AliPMDQADataMakerSim::InitSDigits()
 {
     // create SDigits histograms in SDigits subdir
-
-    TH1F *h0 = new TH1F("hPreSDigitsEdep","SDigits energy distribution in(keV) PRE(PMD)", 500, 0., 500.);
-    h0->Sumw2();
-    Add2SDigitsList(h0, 0);
-
-    TH1F *h1 = new TH1F("hCpvSDigitsEdep","SDigits energy distribution in (keV)CPV(PMD)", 500, 0., 500.);
-    h1->Sumw2();
-    Add2SDigitsList(h1, 1);
-
-    TH1I *h2 = new TH1I("hPreSDigitsMult","SDigits multiplicity distribution in PRE(PMD)", 500, 0., 1000.);
-    h2->Sumw2();
-    Add2SDigitsList(h2, 2);
-
-    TH1I *h3 = new TH1I("hCpvSDigitsMult","SDigits multiplicity distribution in CPV(PMD)", 500, 0., 1000.);
-    h3->Sumw2();
-    Add2SDigitsList(h3, 3);
-
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  TH1F *h0 = new TH1F("hPreSDigitsEdep","SDigits energy distribution in(keV) PRE(PMD);Energy [keV];Counts", 500, 0., 500.);
+  h0->Sumw2();
+  Add2SDigitsList(h0, 0, !expert, image);
+  
+  TH1F *h1 = new TH1F("hCpvSDigitsEdep","SDigits energy distribution in (keV)CPV(PMD);Energy [keV];Counts", 500, 0., 500.);
+  h1->Sumw2();
+  Add2SDigitsList(h1, 1, !expert, image);
+  
+  TH1I *h2 = new TH1I("hPreSDigitsMult","SDigits multiplicity distribution in PRE(PMD);# of SDigits;Entries", 500, 0., 1000.);
+  h2->Sumw2();
+  Add2SDigitsList(h2, 2, !expert, image);
+  
+  TH1I *h3 = new TH1I("hCpvSDigitsMult","SDigits multiplicity distribution in CPV(PMD);# of SDigits;Entries", 500, 0., 1000.);
+  h3->Sumw2();
+  Add2SDigitsList(h3, 3, !expert, image);
+  //
+  ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line  
 }
 
 //____________________________________________________________________________
 void AliPMDQADataMakerSim::InitDigits()
 {
     // create Digits histograms in Digits subdir
-
-    TH1F *h0 = new TH1F("hPreDigitsEdep","Digits energy distribution in PRE(PMD)", 100, 0., 2000.);
-    h0->Sumw2();
-    Add2DigitsList(h0, 0);
-
-    TH1F *h1 = new TH1F("hCpvDigitsEdep","Digits energy distribution in CPV(PMD)", 100, 0., 2000.); 
-    h1->Sumw2();
-    Add2DigitsList(h1, 1);
-
-    TH1I *h2 = new TH1I("hPreDigitsMult","Digits multiplicity distribution in PRE(PMD)", 500, 0, 1000) ; 
-    h2->Sumw2();
-    Add2DigitsList(h2, 2);
-
-    TH1I *h3 = new TH1I("hCpvDigitsMult","Digits multiplicity distribution in CPV(PMD)", 500, 0, 1000);
-    h3->Sumw2();
-    Add2DigitsList(h3, 3);
-
+  const Bool_t expert   = kTRUE ; 
+  const Bool_t image    = kTRUE ; 
+  
+  TH1F *h0 = new TH1F("hPreDigitsEdep","Digits energy distribution in PRE(PMD);Amplitude [ADC counts];Counts", 100, 0., 2000.);
+  h0->Sumw2();
+  Add2DigitsList(h0, 0, !expert, image);
+  
+  TH1F *h1 = new TH1F("hCpvDigitsEdep","Digits energy distribution in CPV(PMD);Amplitude [ADC counts];Counts", 100, 0., 2000.); 
+  h1->Sumw2();
+  Add2DigitsList(h1, 1, !expert, image);
+
+  TH1I *h2 = new TH1I("hPreDigitsMult","Digits multiplicity distribution in PRE(PMD);# of Digits;Entries", 500, 0, 1000) ; 
+  h2->Sumw2();
+  Add2DigitsList(h2, 2, !expert, image);
+  
+  TH1I *h3 = new TH1I("hCpvDigitsMult","Digits multiplicity distribution in CPV(PMD);# of Digits;Entries", 500, 0, 1000);
+  h3->Sumw2();
+  Add2DigitsList(h3, 3, !expert, image);
+  //
+  ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line  
 }
 
 //____________________________________________________________________________ 
-void AliPMDQADataMakerSim::MakeHits(TClonesArray *hits)
+void AliPMDQADataMakerSim::MakeHits()
 {
     //make QA data from Hits
 
-    Int_t premul = 0, cpvmul = 0;
-    Float_t edepkev = 0.;
-    TIter next(hits); 
-    AliPMDhit * hit; 
+  Int_t premul = 0, cpvmul = 0;
+  Float_t edepkev = 0.;
+  TIter next(fHitsArray); 
+  AliPMDhit * hit; 
     
-    while ( (hit = dynamic_cast<AliPMDhit *>(next())) )
-      {
-       if (hit->Z() > 361.5)
-         {
-           edepkev = (hit->GetEnergy())/1000.;
-           GetHitsData(0)->Fill(edepkev);
-           premul++;
-         }
-       else if (hit->Z() < 361.5)
-         {
-           edepkev = (hit->GetEnergy())/1000.;
-           GetHitsData(1)->Fill(edepkev);
-           cpvmul++;
-         }
+  while ( (hit = dynamic_cast<AliPMDhit *>(next())) )
+    {
+      if (hit->Z() > 361.5)
+       {
+         edepkev = (hit->GetEnergy())/1000.;
+         FillHitsData(0,edepkev);
+         premul++;
+       }
+      else if (hit->Z() < 361.5)
+       {
+         edepkev = (hit->GetEnergy())/1000.;
+         FillHitsData(1,edepkev);
+         cpvmul++;
+       }
     }
-
-    if(premul <= 0)
+  
+  if(premul <= 0)
     {
-       GetHitsData(2)->Fill(-1.); 
+      FillHitsData(2,-1.); 
     }
-    else
+  else
     {
-       GetHitsData(2)->Fill(premul); 
+      FillHitsData(2,premul); 
     }
-
-    if(cpvmul <= 0)
+  
+  if(cpvmul <= 0)
     {
-       GetHitsData(3)->Fill(-1.); 
+      FillHitsData(3,-1.); 
     }
-    else
+  else
     {
-       GetHitsData(3)->Fill(cpvmul); 
+      FillHitsData(3,cpvmul); 
     }
-
+  
 }
 
 //____________________________________________________________________________
 void AliPMDQADataMakerSim::MakeHits(TTree * hitTree)
 {
-    // make QA data from Hit Tree
-
-    TBranch * branch = hitTree->GetBranch("PMD") ;
-    if ( ! branch )
+  // make QA data from Hit Tree
+  
+  TBranch * branch = hitTree->GetBranch("PMD") ;
+  if ( ! branch )
     {
-       AliWarning("PMD branch in Hit Tree not found") ;
-       return;
+      AliWarning("PMD branch in Hit Tree not found") ;
+      return;
     }
 
-    static TClonesArray statichits("AliPMDhit", 1000);
-    statichits.Clear();
-    TClonesArray *hits = &statichits;
-    static TClonesArray staticdummy("AliPMDhit", 1000);
-    staticdummy.Clear();
-    TClonesArray *dummy = &staticdummy;
-    branch->SetAddress(&dummy);
-    Int_t index = 0 ;  
-
-    for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
-       branch->GetEntry(ientry) ; 
-       for (Int_t ihit = 0 ; ihit < dummy->GetEntries() ; ihit++) {
-           AliPMDhit * hit = dynamic_cast<AliPMDhit *> (dummy->At(ihit)) ; 
-           new((*hits)[index]) AliPMDhit(*hit) ; 
-
-           index++ ;
-       } 
-    }  
-
-    MakeHits(hits);
-
+  if (fHitsArray) 
+    fHitsArray->Clear() ; 
+  else 
+    fHitsArray = new TClonesArray("AliPMDhit", 1000);
+
+  branch->SetAddress(&fHitsArray);
+
+  for (Int_t ientry = 0 ; ientry < branch->GetEntries() ; ientry++) {
+    branch->GetEntry(ientry) ; 
+    MakeHits();
+    fHitsArray->Clear() ; 
+  }    
+  //
+  IncEvCountCycleHits();
+  IncEvCountTotalHits();
+  //
 }
 //____________________________________________________________________________
-void AliPMDQADataMakerSim::MakeSDigits(TClonesArray * sdigits)
+void AliPMDQADataMakerSim::MakeSDigits()
 {
     // makes data from SDigits
 
-    Int_t cpvmul = 0, premul = 0;
-    Float_t edepkev = 0.;
-
-    TIter next(sdigits) ; 
-    AliPMDsdigit * sdigit ; 
-    while ( (sdigit = dynamic_cast<AliPMDsdigit *>(next())) )
+  Int_t cpvmul = 0, premul = 0;
+  Float_t edepkev = 0.;
+  
+  TIter next(fSDigitsArray) ; 
+  AliPMDsdigit * sdigit ; 
+  while ( (sdigit = dynamic_cast<AliPMDsdigit *>(next())) )
     {
-       if(sdigit->GetDetector() == 0)
+      if(sdigit->GetDetector() == 0)
        {
          edepkev = (sdigit->GetCellEdep())/1000.;
-         GetSDigitsData(0)->Fill(edepkev);
+         FillSDigitsData(0,edepkev);
          premul++;
        }
-       if(sdigit->GetDetector() == 1)
+      if(sdigit->GetDetector() == 1)
        {
          edepkev = (sdigit->GetCellEdep())/1000.;
-         GetSDigitsData(1)->Fill(edepkev);
+         FillSDigitsData(1,edepkev);
          cpvmul++;
        }
        
     } 
-    if (premul > 0) GetSDigitsData(2)->Fill(premul);
-    if (cpvmul > 0) GetSDigitsData(3)->Fill(cpvmul);
-    
+  if (premul > 0) FillSDigitsData(2,premul);
+  if (cpvmul > 0) FillSDigitsData(3,cpvmul);
+  
 }
 
 //____________________________________________________________________________
 void AliPMDQADataMakerSim::MakeSDigits(TTree * sdigitTree)
 {
     // makes data from SDigit Tree
-
-    TClonesArray * sdigits = new TClonesArray("AliPMDsdigit", 1000) ; 
+  
+  if (fSDigitsArray) 
+    fSDigitsArray->Clear() ; 
+  else 
+    fSDigitsArray = new TClonesArray("AliPMDsdigit", 1000) ; 
     
-    TBranch * branch = sdigitTree->GetBranch("PMDSDigit") ;
-    branch->SetAddress(&sdigits) ;
-
-    if ( ! branch )
+  TBranch * branch = sdigitTree->GetBranch("PMDSDigit") ;
+  if ( ! branch )
     {
-       AliWarning("PMD branch in SDigit Tree not found") ; 
+      AliWarning("PMD branch in SDigit Tree not found") ; 
     }
-    else
+  else
     {
-       for (Int_t ient = 0; ient < branch->GetEntries(); ient++)
-       {
-           branch->GetEntry(ient) ;
-           MakeSDigits(sdigits) ; 
-       }
+      branch->SetAddress(&fSDigitsArray) ;
+      branch->GetEntry(0) ;
+      MakeSDigits() ; 
     }
+  //
+  IncEvCountCycleSDigits();
+  IncEvCountTotalSDigits();
+  //
 }
 
 //____________________________________________________________________________
-void AliPMDQADataMakerSim::MakeDigits(TClonesArray * digits)
+void AliPMDQADataMakerSim::MakeDigits()
 {
     // makes data from Digits
-    
-    Int_t cpvmul = 0, premul = 0;
 
-    TIter next(digits) ; 
-    AliPMDdigit * digit ; 
-    while ( (digit = dynamic_cast<AliPMDdigit *>(next())) )
+  Int_t cpvmul = 0, premul = 0;
+  
+  TIter next(fDigitsArray) ; 
+  AliPMDdigit * digit ; 
+  while ( (digit = dynamic_cast<AliPMDdigit *>(next())) )
     {
-       if(digit->GetDetector() == 0)
+      if(digit->GetDetector() == 0)
        {
-           GetDigitsData(0)->Fill( digit->GetADC()) ;
-           premul++;
+         FillDigitsData(0, digit->GetADC()) ;
+         premul++;
        }
-       if(digit->GetDetector() == 1)
+      if(digit->GetDetector() == 1)
        {
-           GetDigitsData(1)->Fill( digit->GetADC());
-           cpvmul++;
+         FillDigitsData(1, digit->GetADC());
+         cpvmul++;
        }
     }  
-
-    if (premul > 0) GetDigitsData(2)->Fill(premul);
-    if (cpvmul > 0) GetDigitsData(3)->Fill(cpvmul);
-
-
+  
+  if (premul > 0) FillDigitsData(2,premul);
+  if (cpvmul > 0) FillDigitsData(3,cpvmul);
+  
+  
 }
 
 //____________________________________________________________________________
@@ -303,24 +311,33 @@ void AliPMDQADataMakerSim::MakeDigits(TTree * digitTree)
 {
     // makes data from Digit Tree
 
-    TClonesArray * digits = new TClonesArray("AliPMDdigit", 1000) ; 
-    
-    TBranch * branch = digitTree->GetBranch("PMDDigit") ;
-    branch->SetAddress(&digits) ;
+  if (fDigitsArray) 
+    fDigitsArray->Clear() ; 
+  else 
+    fDigitsArray = new TClonesArray("AliPMDdigit", 1000) ; 
+  
+  TBranch * branch = digitTree->GetBranch("PMDDigit") ;
 
-    if ( ! branch )
+  if ( ! branch )
     {
-       AliWarning("PMD branch in Digit Tree not found") ; 
+      AliWarning("PMD branch in Digit Tree not found") ; 
     }
-    else
+  else
     {
-       for (Int_t ient = 0; ient < branch->GetEntries(); ient++)
+      branch->SetAddress(&fDigitsArray) ;
+      for (Int_t ient = 0; ient < branch->GetEntries(); ient++)
        {
-           branch->GetEntry(ient) ; 
-           MakeDigits(digits) ; 
+         branch->GetEntry(ient) ; 
+         MakeDigits() ; 
+         fDigitsArray->Clear() ; 
+         
        }
-       
+      
     }
+  //
+  IncEvCountCycleDigits();
+  IncEvCountTotalDigits();
+  //
 }