]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Upgrade to the Poisson calculation
authorhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Sep 2011 09:46:46 +0000 (09:46 +0000)
committerhdalsgaa <hdalsgaa@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 13 Sep 2011 09:46:46 +0000 (09:46 +0000)
PWG2/FORWARD/analysis2/AliFMDDensityCalculator.cxx
PWG2/FORWARD/analysis2/AliFMDDensityCalculator.h
PWG2/FORWARD/analysis2/AliForwardMCMultiplicityTask.cxx
PWG2/FORWARD/analysis2/AliForwardMultiplicityTask.cxx
PWG2/FORWARD/analysis2/AliPoissonCalculator.cxx
PWG2/FORWARD/analysis2/AliPoissonCalculator.h

index 52827f82993af4879ab595651d3d4154410a798f..e383506b9f1069780eacfbe7572fce32d047f9c4 100644 (file)
@@ -42,10 +42,11 @@ AliFMDDensityCalculator::AliFMDDensityCalculator()
     fFMD3oMax(0),
     fMaxWeights(0),
     fLowCuts(0),
-    fEtaLumping(5), 
-    fPhiLumping(5),    
+    fEtaLumping(32), 
+    fPhiLumping(4),    
     fDebug(0),
-    fCuts()
+    fCuts(),
+    fUseRunningAverage(false)
 {
   // 
   // Constructor 
@@ -72,10 +73,11 @@ AliFMDDensityCalculator::AliFMDDensityCalculator(const char* title)
     fFMD3oMax(0),
     fMaxWeights(0),
     fLowCuts(0),
-    fEtaLumping(5), 
-    fPhiLumping(5),
+    fEtaLumping(32), 
+    fPhiLumping(4),
     fDebug(0),
-    fCuts()
+    fCuts(),
+    fUseRunningAverage(false)
 {
   // 
   // Constructor 
@@ -140,7 +142,8 @@ AliFMDDensityCalculator::AliFMDDensityCalculator(const
     fEtaLumping(o.fEtaLumping), 
     fPhiLumping(o.fPhiLumping),
     fDebug(o.fDebug),
-    fCuts(o.fCuts)
+    fCuts(o.fCuts),
+    fUseRunningAverage(o.fUseRunningAverage)
 {
   // 
   // Copy constructor 
@@ -193,6 +196,7 @@ AliFMDDensityCalculator::operator=(const AliFMDDensityCalculator& o)
   fEtaLumping         = o.fEtaLumping;
   fPhiLumping         = o.fPhiLumping;
   fCuts               = o.fCuts;
+  fUseRunningAverage  = o.fUseRunningAverage;
 
   fRingHistos.Delete();
   TIter    next(&o.fRingHistos);
@@ -285,7 +289,8 @@ Bool_t
 AliFMDDensityCalculator::Calculate(const AliESDFMD&        fmd,
                                   AliForwardUtil::Histos& hists,
                                   UShort_t                vtxbin, 
-                                  Bool_t                  lowFlux)
+                                  Bool_t                  lowFlux,
+                                  Double_t                 cent)
 {
   // 
   // Do the calculations 
@@ -298,7 +303,9 @@ AliFMDDensityCalculator::Calculate(const AliESDFMD&        fmd,
   // 
   // Return:
   //    true on successs 
-  //
+
+  
+  
   for (UShort_t d=1; d<=3; d++) { 
     UShort_t nr = (d == 1 ? 1 : 2);
     for (UShort_t q=0; q<nr; q++) { 
@@ -312,6 +319,7 @@ AliFMDDensityCalculator::Calculate(const AliESDFMD&        fmd,
        fRingHistos.ls();
        return false;
       }
+      rh->fPoisson.SetObject(d,r,vtxbin,cent);
       rh->fPoisson.Reset(h);
       // rh->ResetPoissonHistos(h, fEtaLumping, fPhiLumping);
       
@@ -325,7 +333,7 @@ AliFMDDensityCalculator::Calculate(const AliESDFMD&        fmd,
          
          if (mult == AliESDFMD::kInvalidMult || mult > 20) {
            // rh->fEmptyStrips->Fill(eta,phi);
-           rh->fPoisson.Fill(eta, phi, false);
+           rh->fPoisson.Fill(t , s, false);
            rh->fEvsM->Fill(mult,0);
            continue;
          }
@@ -352,76 +360,50 @@ AliFMDDensityCalculator::Calculate(const AliESDFMD&        fmd,
 
          Bool_t hit = (n > 0.9 && c > 0);
          if (hit) rh->fELossUsed->Fill(mult);
-         rh->fPoisson.Fill(eta,phi,hit,1./c);
-           // if (n > 0.9 && c > 0) rh->fELossUsed->Fill(mult);
-           // if (n > 0.9 && c > 0) rh->fBasicHits->Fill(eta,phi, 1./c);
-           // else                  rh->fEmptyStrips->Fill(eta,phi);
-           
+         rh->fPoisson.Fill(t,s,hit,1./c);
          h->Fill(eta,phi,n);
          if (!fUsePoisson) rh->fDensity->Fill(eta,phi,n);
        } // for t
       } // for s 
-
-
-      // --- Loop over poisson histograms ----------------------------
+      
+      TH2D* hclone = static_cast<TH2D*>(h->Clone("hclone"));
+      if (!fUsePoisson) hclone->Reset();
+      if ( fUsePoisson) h->Reset();
+      
       TH2D* poisson = rh->fPoisson.Result();
-      for (Int_t ieta = 1; ieta <= h->GetNbinsX(); ieta++) { 
-       for (Int_t iphi = 1; iphi <= h->GetNbinsY(); iphi++) { 
-         Double_t poissonV = poisson->GetBinContent(ieta, iphi);
-         Double_t poissonE = poisson->GetBinError(ieta, iphi);
-         Double_t eLossV   = h->GetBinContent(ieta, iphi);
-         Double_t eta      = h->GetXaxis()->GetBinCenter(ieta);
-         Double_t phi      = h->GetYaxis()->GetBinCenter(iphi);
-
-         rh->fELossVsPoisson->Fill(eLossV, poissonV);
-         if (!fUsePoisson) continue;
-
-         h->SetBinContent(ieta,iphi,poissonV);
-         h->SetBinError(ieta,iphi,poissonE);
+      for (Int_t t=0; t <= poisson->GetNbinsX(); t++) { 
+       for (Int_t s=0; s<= poisson->GetNbinsY(); s++) { 
+         
+         Double_t poissonV = poisson->GetBinContent(t+1,s+1);
+         Double_t  phi  = fmd.Phi(d,r,s,t) / 180 * TMath::Pi();
+         Double_t  eta  = fmd.Eta(d,r,s,t);
+         if (fUsePoisson)
+           h->Fill(eta,phi,poissonV);
+         else
+           hclone->Fill(eta,phi,poissonV);
          rh->fDensity->Fill(eta, phi, poissonV);
-#if 0
-         Double_t eta      = h->GetXaxis()->GetBinCenter(ieta);
-         Double_t phi      = h->GetYaxis()->GetBinCenter(iphi);
-         Int_t    jeta     = rh->fEmptyStrips->GetXaxis()->FindBin(eta);
-         Int_t    jphi     = rh->fEmptyStrips->GetYaxis()->FindBin(phi);
-         Double_t empty    = rh->fEmptyStrips->GetBinContent(jeta, jphi);
-         Double_t total    = rh->fTotalStrips->GetBinContent(jeta, jphi);
-         Double_t hits     = rh->fBasicHits->GetBinContent(ieta,iphi);
-
-         // Mean in region of interest 
-         Double_t poissonM = (total <= 0 || empty <= 0 ? 0 : 
-                              -TMath::Log(empty / total));
-         //Full occupancy should give high correction not zero
-         if(empty < 0.001 && total > 0 ) poissonM = -TMath::Log( 1. / total);
+       }
+      }
+      
+      for (Int_t ieta=1; ieta <= h->GetNbinsX(); ieta++) { 
+       for (Int_t iphi=1; iphi<= h->GetNbinsY(); iphi++) { 
          
-         // Note, that given filled=total-empty, and 
-         //
-         //     m = -log(empty/total)
-         //       = -log(1 - filled/total)
-         // 
-         //     v = m / (1 - exp(-m))
-         //       = -total/filled * (log(total-filled)-log(total))
-         //       = -total / (total-empty) * log(empty/total)
-         //       = total (log(total)-log(empty)) / (total-empty)
-         //  
-         Double_t poissonV = hits;
-         if(poissonM > 0)
-           // Correct for counting statistics and weight by counts 
-           poissonV *= poissonM / (1 - TMath::Exp(-1*poissonM));
-         Double_t poissonE = TMath::Sqrt(hits);
-         if(poissonV > 0) poissonE = TMath::Sqrt(poissonV);
+         Double_t poissonV =  0; //h->GetBinContent(,s+1);
+         Double_t eLossV =  0;
+         if(fUsePoisson) { 
+           poissonV = h->GetBinContent(ieta,iphi);
+           eLossV  = hclone->GetBinContent(ieta,iphi);
+         }
+         else { 
+           poissonV = hclone->GetBinContent(ieta,iphi);
+           eLossV  = h->GetBinContent(ieta,iphi);
+         }
          
          rh->fELossVsPoisson->Fill(eLossV, poissonV);
-         rh->fEmptyVsTotal->Fill(total, empty);
-         if (fUsePoisson) {
-           h->SetBinContent(ieta,iphi,poissonV);
-           h->SetBinError(ieta,iphi,poissonE);
-           rh->fDensity->Fill(eta, phi, poissonV);
-         }
-#endif
        }
       }
-       
+      delete hclone;
+      
     } // for q
   } // for d
   
@@ -849,9 +831,9 @@ AliFMDDensityCalculator::DefineOutput(TList* dir)
   TIter    next(&fRingHistos);
   RingHistos* o = 0;
   while ((o = static_cast<RingHistos*>(next()))) {
-    o->fPoisson.SetEtaLumping(fEtaLumping);
-    o->fPoisson.SetPhiLumping(fPhiLumping);
-    o->fPoisson.Init();
+    // o->fPoisson.SetEtaLumping(fEtaLumping);
+    o->fPoisson.SetUseAverageOverEvents(fUseRunningAverage);
+    o->fPoisson.Init(o->fDet,o->fRing,fEtaLumping, fPhiLumping);
     o->fPoisson.GetOccupancy()->SetFillColor(o->Color());
     o->fPoisson.GetMean()->SetFillColor(o->Color());
     // o->fPoisson.GetOccupancy()->SetFillColor(o->Color());
@@ -1186,7 +1168,7 @@ AliFMDDensityCalculator::RingHistos::ResetPoissonHistos(const TH2D* h,
 void
 AliFMDDensityCalculator::RingHistos::Init(const TAxis& /*eAxis*/)
 {
-  fPoisson.Init();
+  fPoisson.Init(fDet,fRing,-1,-1);
 }
 
 //____________________________________________________________________
index 049d5bc3935f2cfeaac6338c1babfc9d18a21a84..ab3f5961acbe0dc9bb631ce07116cb7b45c600b6 100644 (file)
@@ -106,7 +106,7 @@ public:
    */
   virtual Bool_t Calculate(const AliESDFMD& fmd, 
                           AliForwardUtil::Histos& hists, 
-                          UShort_t vtxBin, Bool_t lowFlux);
+                          UShort_t vtxBin, Bool_t lowFlux, Double_t cent=-1);
   /** 
    * Scale the histograms to the total number of events 
    * 
@@ -126,6 +126,12 @@ public:
    * @param dbg Debug level 
    */
   void SetDebug(Int_t dbg=1) { fDebug = dbg; }
+    /** 
+   * Set to use the running average in Poisson 
+   * 
+   * @param use use or not
+   */
+  void SetUseRunningAverage(Bool_t use) { fUseRunningAverage = use; }
   /** 
    * Maximum particle weight to use 
    * 
@@ -440,6 +446,7 @@ protected:
   Int_t    fPhiLumping;    //  How to lump phi bins for Poisson 
   Int_t    fDebug;         //  Debug level 
   AliFMDMultCuts fCuts; // Cuts
+  Bool_t   fUseRunningAverage; //Use running average for Poisson
 
   ClassDef(AliFMDDensityCalculator,6); // Calculate Nch density 
 };
index 0ea7f56050d0ac70e5fde9a9906a920d5d2a3b71..185feef55080b72e82043d9494666c82af8b0135 100644 (file)
@@ -310,7 +310,7 @@ AliForwardMCMultiplicityTask::UserExec(Option_t*)
   UInt_t   triggers  = 0;
   UShort_t ivz       = 0;
   Double_t vz        = 0;
-  Double_t cent      = 0;
+  Double_t cent      = -1;
   UShort_t nClusters = 0;
   UInt_t   found     = fEventInspector.Process(esd, triggers, lowFlux, 
                                               ivz, vz, cent, nClusters);
@@ -385,7 +385,7 @@ AliForwardMCMultiplicityTask::UserExec(Option_t*)
   fSharingFilter.CompareResults(fESDFMD, fMCESDFMD);
 
   // Calculate the inclusive charged particle density 
-  if (!fDensityCalculator.Calculate(fESDFMD, fHistos, ivz, lowFlux)) { 
+  if (!fDensityCalculator.Calculate(fESDFMD, fHistos, ivz, lowFlux, cent)) { 
     AliWarning("Density calculator failed!");
     return;
   }
index 7cd4e80230ba96e4aba7c008216c098ce4f7662c..ca934d6fb073bf50feabcc3693833303fce9ac03 100644 (file)
@@ -279,7 +279,7 @@ AliForwardMultiplicityTask::UserExec(Option_t*)
   }
 
   // Calculate the inclusive charged particle density 
-  if (!fDensityCalculator.Calculate(fESDFMD, fHistos, ivz, lowFlux)) { 
+  if (!fDensityCalculator.Calculate(fESDFMD, fHistos, ivz, lowFlux, cent)) { 
     // if (!fDensityCalculator.Calculate(*esdFMD, fHistos, ivz, lowFlux)) { 
     AliWarning("Density calculator failed!");
     return;
index ce11b7923f06e0348aa257766dc02d9b81091ec3..502e21dc5100307555fa62fb8954c50153d379c3 100644 (file)
 //____________________________________________________________________
 AliPoissonCalculator::AliPoissonCalculator()
   : TNamed(),
-    fEtaLumping(5), 
-    fPhiLumping(5), 
+    fEtaLumping(32), 
+    fPhiLumping(4), 
     fTotal(0), 
     fEmpty(0), 
     fBasic(0),
     fEmptyVsTotal(0),
     fMean(0), 
     fOcc(0),
-    fCorr(0)
+    fCorr(0),
+    fTotalList(),
+    fEmptyList(),
+    fRunningAverage(false)
 {
   //
   // CTOR
@@ -55,21 +58,28 @@ AliPoissonCalculator::AliPoissonCalculator()
 }
 
 //____________________________________________________________________
-AliPoissonCalculator::AliPoissonCalculator(const char*)
+AliPoissonCalculator::AliPoissonCalculator(const char*/*, UShort_t d, Char_t r*/)
   : TNamed("poissonCalculator", "Calculate N_ch using Poisson stat"),
-    fEtaLumping(5), 
-    fPhiLumping(5), 
+    fEtaLumping(32), 
+    fPhiLumping(4), 
     fTotal(0), 
     fEmpty(0), 
     fBasic(0),
     fEmptyVsTotal(0),
     fMean(0), 
     fOcc(0),
-    fCorr(0)
+    fCorr(0),
+    fTotalList(),
+    fEmptyList(),
+    fRunningAverage(false)
 {
   //
   // CTOR
-  // 
+  //
+  fEmptyList.SetOwner();
+  fTotalList.SetOwner();
+  
+
 }
 //____________________________________________________________________
 AliPoissonCalculator::AliPoissonCalculator(const AliPoissonCalculator& o)
@@ -82,7 +92,10 @@ AliPoissonCalculator::AliPoissonCalculator(const AliPoissonCalculator& o)
     fEmptyVsTotal(0),
     fMean(0), 
     fOcc(0),
-    fCorr(0)
+    fCorr(0),
+    fTotalList(),
+    fEmptyList(),
+    fRunningAverage(o.fRunningAverage)
 {
   Init();
   Reset(o.fBasic);
@@ -113,21 +126,56 @@ AliPoissonCalculator::operator=(const AliPoissonCalculator& o)
   TNamed::operator=(o);
   fEtaLumping = o.fEtaLumping;
   fPhiLumping = o.fPhiLumping;
+  fRunningAverage = o.fRunningAverage;
   CleanUp();
-  Init(-1,-1);
+  Init();
   Reset(o.fBasic);
   return *this;
 }
 
 //____________________________________________________________________
 void
-AliPoissonCalculator::Init(Int_t etaLumping, Int_t phiLumping)
+AliPoissonCalculator::Init(UShort_t d, Char_t r, Int_t etaLumping, Int_t phiLumping)
 {
   // 
   // Initialize 
   // 
   if (etaLumping > 0) SetEtaLumping(etaLumping);
   if (phiLumping > 0) SetPhiLumping(phiLumping);
+  if(d > 0) {
+
+    Int_t    nEtaF   = (r == 'I' ? 512 : 256);
+    Int_t    nEta    = nEtaF / fEtaLumping;
+    Double_t etaMin  = -0.5;
+    Double_t etaMax  = nEtaF-0.5 ;
+    Int_t    nPhiF   = (r == 'I' ? 20 : 40);
+    Int_t    nPhi    = nPhiF / fPhiLumping;
+    Double_t phiMin  = -0.5;
+    Double_t phiMax  = nPhiF - 0.5;
+    
+    fBasic = new TH2D("basic", "Basic number of hits",
+                     nEtaF, etaMin, etaMax, nPhiF, phiMin, phiMax);
+    fBasic->SetDirectory(0);
+    fBasic->SetXTitle("#eta");
+    fBasic->SetYTitle("#varphi [radians]");
+    fBasic->Sumw2();
+    
+    for(Int_t v = 1 ; v < 11; v++)  { //CHC bins
+      for(Int_t centbin = 0 ; centbin < 13; centbin++) {
+       
+       TH2D* hTotal = new TH2D(Form("totalFMD%d%c_vertex%d_cent%d",d,r,v,centbin),"Total number of bins/region",
+                             nEta, etaMin, etaMax, nPhi, phiMin, phiMax);
+       TH2D* hEmpty = new TH2D(Form("emptyFMD%d%c_vertex%d_cent%d",d,r,v,centbin), "Empty number of bins/region",
+                               nEta, etaMin, etaMax, nPhi, phiMin, phiMax);
+       hEmpty->Sumw2();
+       hTotal->Sumw2();
+       fEmptyList.Add(hEmpty);
+       fTotalList.Add(hTotal);
+       
+      }
+    }
+  }
+  //Create diagnostics if void
   if (fEmptyVsTotal) return;
   
   Int_t n = fEtaLumping * fPhiLumping + 1;
@@ -166,8 +214,25 @@ AliPoissonCalculator::Init(Int_t etaLumping, Int_t phiLumping)
   fCorr->SetZTitle("Events");
   fCorr->SetOption("colz");
   fCorr->SetDirectory(0);
+  
+  
+}
+//____________________________________________________________________
+void AliPoissonCalculator::SetObject(UShort_t d, Char_t r, UShort_t v, Double_t cent) {
+  
+  Int_t centbin = 0;
+  if(cent > 0) {
+    if(cent > 0 && cent <5) centbin = 1;
+    if(cent > 5 && cent <10) centbin = 2;
+    else if (cent>10) centbin = (Int_t)(cent/10.) + 2;
+  }
+  
+  fTotal = static_cast<TH2D*>(fTotalList.FindObject(Form("totalFMD%d%c_vertex%d_cent%d",d,r,v,centbin)));
+  fEmpty = static_cast<TH2D*>(fEmptyList.FindObject(Form("emptyFMD%d%c_vertex%d_cent%d",d,r,v,centbin)));
+  
+  return;
+  
 }
-
 //____________________________________________________________________
 void
 AliPoissonCalculator::Output(TList* d)
@@ -188,13 +253,15 @@ AliPoissonCalculator::Reset(const TH2D* base)
   // Reset histogram 
   // 
   if (!base) return;
-  if (fBasic && fTotal && fEmpty) {
+  if (fBasic /* && fTotal && fEmpty*/) {
     fBasic->Reset();
-    fTotal->Reset();
-    fEmpty->Reset();
+    if(!fRunningAverage) {
+      fTotal->Reset();
+      fEmpty->Reset();
+    }
     return;
   }
-  
+  /*  
   Int_t    nEtaF   = base->GetNbinsX();
   Int_t    nEta    = nEtaF / fEtaLumping;
   Double_t etaMin  = base->GetXaxis()->GetXmin();
@@ -203,31 +270,37 @@ AliPoissonCalculator::Reset(const TH2D* base)
   Int_t    nPhi    = nPhiF / fPhiLumping;
   Double_t phiMin  = base->GetYaxis()->GetXmin();
   Double_t phiMax  = base->GetYaxis()->GetXmax();
+  
 
-  fTotal = new TH2D("total", "Total number of bins/region",
-                   nEta, etaMin, etaMax, nPhi, phiMin, phiMax);
-  fEmpty = new TH2D("empty", "Empty number of bins/region",
-                   nEta, etaMin, etaMax, nPhi, phiMin, phiMax);
+  
+  
+  
+  //fTotal = new TH2D("total", "Total number of bins/region",
+  //               nEta, etaMin, etaMax, nPhi, phiMin, phiMax);
+  //fEmpty = new TH2D("empty", "Empty number of bins/region",
+  //nEta, etaMin, etaMax, nPhi, phiMin, phiMax);
   fBasic = new TH2D("basic", "Basic number of hits",
                    nEtaF, etaMin, etaMax, nPhiF, phiMin, phiMax);
-  
-  fTotal->SetDirectory(0);
-  fEmpty->SetDirectory(0);
+    
+  //fTotal->SetDirectory(0);
+  //fEmpty->SetDirectory(0);
   fBasic->SetDirectory(0);
-  fTotal->SetXTitle("#eta");
-  fEmpty->SetXTitle("#eta");
+  //fTotal->SetXTitle("#eta");
+  //fEmpty->SetXTitle("#eta");
   fBasic->SetXTitle("#eta");
-  fTotal->SetYTitle("#varphi [radians]");
-  fEmpty->SetYTitle("#varphi [radians]");
+  //fTotal->SetYTitle("#varphi [radians]");
+  //fEmpty->SetYTitle("#varphi [radians]");
   fBasic->SetYTitle("#varphi [radians]");
-  fTotal->Sumw2();
-  fEmpty->Sumw2();
+  //fTotal->Sumw2();
+  //fEmpty->Sumw2();
   fBasic->Sumw2();
+  */
+
 }
 
 //____________________________________________________________________
 void
-AliPoissonCalculator::Fill(Double_t eta, Double_t phi, Bool_t hit, 
+AliPoissonCalculator::Fill(UShort_t strip, UShort_t sec, Bool_t hit, 
                           Double_t weight)
 {
   // 
@@ -239,9 +312,10 @@ AliPoissonCalculator::Fill(Double_t eta, Double_t phi, Bool_t hit,
   //    hit     True if hit 
   //    weight  Weight if this 
   //
-  fTotal->Fill(eta, phi);
-  if (hit) fBasic->Fill(eta, phi, weight);
-  else     fEmpty->Fill(eta, phi);
+  
+  fTotal->Fill(strip, sec);
+  if (hit) fBasic->Fill(strip, sec, weight);
+  else     fEmpty->Fill(strip, sec);
 }
 
 //____________________________________________________________________
@@ -271,6 +345,9 @@ AliPoissonCalculator::Result()
   // Return:
   //    The result histogram (fBase overwritten)
   //
+  
+  // Double_t total = fEtaLumping * fPhiLumping;
+  
   for (Int_t ieta = 1; ieta <= fBasic->GetNbinsX(); ieta++) { 
     for (Int_t iphi = 1; iphi <= fBasic->GetNbinsY(); iphi++) { 
       Double_t eta      = fBasic->GetXaxis()->GetBinCenter(ieta);
@@ -280,10 +357,10 @@ AliPoissonCalculator::Result()
       Double_t empty    = fEmpty->GetBinContent(jeta, jphi);
       Double_t total    = fTotal->GetBinContent(jeta, jphi);
       Double_t hits     = fBasic->GetBinContent(ieta,iphi);
-
       // Mean in region of interest 
       Double_t poissonM = CalculateMean(empty, total);
       Double_t poissonC = CalculateCorrection(empty, total);
+      
       Double_t poissonV = hits * poissonM * poissonC;
       Double_t poissonE = TMath::Sqrt(poissonV);
       if(poissonV > 0) poissonE = TMath::Sqrt(poissonV);
@@ -300,7 +377,8 @@ AliPoissonCalculator::Result()
       Double_t corr     = CalculateCorrection(empty, total);
       fEmptyVsTotal->Fill(total, empty);
       fMean->Fill(mean);
-      fOcc->Fill(100 * (1 - TMath::PoissonI(0,mean)));
+      fOcc->Fill(100 * (1 - empty/total));
+      //Old fOcc->Fill(100 * (1 - TMath::PoissonI(0,mean)));
       fCorr->Fill(mean, corr);
     }
   }
index 5860a0f690c51e7c2a4644b97ad62b053524aa6a..cf71140c3732dbf328c0b37dac2f8d49cd0aff7f 100644 (file)
@@ -1,10 +1,11 @@
 #ifndef ALIPOISSONCALCULATOR_H
 #define ALIPOISSONCALCULATOR_H
 #include <TNamed.h>
+#include <TList.h>
 class TH2D;
 class TH1D;
 class TBrowser;
-class TList;
+//class TList;
 
 /** 
  * A class to calculate the multiplicity in @f$(\eta,\varphi)@f$ bins
@@ -44,7 +45,7 @@ public:
    * Constructor 
    * 
    */
-  AliPoissonCalculator(const char*);
+  AliPoissonCalculator(const char*/*, UShort_t d, Char_t r*/);
   /** 
    * Copy constructor
    * 
@@ -70,6 +71,12 @@ public:
    * @param n Number of eta bins per region
    */  
   void SetEtaLumping(UShort_t n) { fEtaLumping = n; } //*MENU*
+  /** 
+   * Set the actual object
+   * 
+   * @param v vtxbin
+   */  
+  void SetObject(UShort_t d, Char_t r, UShort_t v, Double_t cent); //*MENU*
   /** 
    * Set the number of phi bins to group into a region
    * 
@@ -82,7 +89,7 @@ public:
    * @param etaLumping If larger than 0, set the eta lumping to this
    * @param phiLumping If larger than 0, set the phi lumping to this
    */
-  void Init(Int_t etaLumping=-1, Int_t phiLumping=-1);
+  void Init(UShort_t d=-1, Char_t r='I',Int_t etaLumping=-1, Int_t phiLumping=-1);
   /** 
    * Output stuff to the passed list
    * 
@@ -103,7 +110,13 @@ public:
    * @param hit     True if hit 
    * @param weight  Weight if this 
    */
-  void Fill(Double_t eta, Double_t phi, Bool_t hit, Double_t weight=1);
+  void Fill(UShort_t strip, UShort_t sec, Bool_t hit, Double_t weight=1);
+  /** 
+   * Take the average occupancy over many events or not
+   * 
+   * @param use use or not
+   */
+  void SetUseAverageOverEvents(Bool_t use)  {fRunningAverage = use;}
   /** 
    * Calculate result and store in @a output
    * 
@@ -191,6 +204,9 @@ protected:
   TH1D*    fMean;         // Mean calculated by poisson method 
   TH1D*    fOcc;          // Histogram of occupancies 
   TH2D*    fCorr;         // Correction as a function of mean 
+  TList    fTotalList;    // List of total hists
+  TList    fEmptyList;    // List of empty hists
+  Bool_t   fRunningAverage; // Whether to take average per event or not
   ClassDef(AliPoissonCalculator,1) // Calculate N_ch using Poisson
 };