Add method for multiplicity correction
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Mar 2012 11:05:38 +0000 (11:05 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 29 Mar 2012 11:05:38 +0000 (11:05 +0000)
PWGHF/vertexingHF/AliVertexingHFUtils.cxx
PWGHF/vertexingHF/AliVertexingHFUtils.h

index bd9acd8d1c667281a4710977f2ebff22ef962b72..71838036fdca0e09c94a6759dadf6a3979b45419 100644 (file)
@@ -14,6 +14,7 @@
  **************************************************************************/
 
 #include <TMath.h>
+#include <TRandom.h>
 #include "AliAODEvent.h"
 #include "AliAODMCParticle.h"
 #include "AliVertexingHFUtils.h"
@@ -287,3 +288,29 @@ void AliVertexingHFUtils::AveragePt(Float_t& averagePt, Float_t& errorPt,Float_t
   delete hMptSig;
 
 }
+//____________________________________________________________________________
+Double_t AliVertexingHFUtils::GetCorrectedNtracklets(TProfile* estimatorAvg, Double_t uncorrectedNacc, Double_t vtxZ, Double_t refMult) {
+  //
+  // Correct the number of accepted tracklets based on a TProfile Hist
+  //
+  //
+
+  if(TMath::Abs(vtxZ)>10.0){
+    printf("ERROR: Z vertex out of range for correction of multiplicity\n");
+    return uncorrectedNacc;
+  }
+
+  if(!estimatorAvg){
+    printf("ERROR: Missing TProfile for correction of multiplicity\n");
+    return uncorrectedNacc;
+  }
+
+  Double_t localAvg = estimatorAvg->GetBinContent(estimatorAvg->FindBin(vtxZ));
+
+  Double_t deltaM = uncorrectedNacc*(refMult/localAvg - 1);
+
+  Double_t correctedNacc = uncorrectedNacc + (deltaM>0 ? 1 : -1) * gRandom->Poisson(TMath::Abs(deltaM));
+
+  return correctedNacc;
+}
+
index a7061f9eaeeb82df29e834401c18f0fca144cce2..53b2f6993bfa7962ded77acfd16666f10f55358e 100644 (file)
@@ -15,6 +15,7 @@
 ///////////////////////////////////////////////////////////////////
 
 #include "TObject.h"
+#include "TProfile.h"
 #include "TH1F.h"
 #include "TH2F.h"
 #include "TF1.h"
@@ -72,6 +73,7 @@ class AliVertexingHFUtils : public TObject{
   // Functions for computing average pt 
   static void AveragePt(Float_t& averagePt, Float_t& errorPt, Float_t ptmin, Float_t ptmax, TH2F* hMassD, Float_t massFromFit, Float_t sigmaFromFit, TF1* funcB2, Float_t sigmaRangeForSig=2.5, Float_t sigmaRangeForBkg=4.5, Int_t rebin=4);
 
+  static Double_t GetCorrectedNtracklets(TProfile* estimatorAvg, Double_t uncorrectedNacc, Double_t vtxZ, Double_t refMult);
 
  private: