]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWG0/dNdEta/AlidNdEtaCorrection.cxx
added correction for events with vertex but 0 tracks
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / AlidNdEtaCorrection.cxx
index 261d339363107eccd6e36ca1c431aa09856c77a5..0e5443508044d62d2c95f0816eff7a85e6e99fd2 100644 (file)
@@ -354,6 +354,7 @@ Float_t AlidNdEtaCorrection::GetMeasuredFraction(CorrectionType correctionType,
     etaEnd = etaBegin;
   }
 
+  //Printf("AlidNdEtaCorrection::GetMeasuredFraction: Using vtx range of +- 10 cm");
   Int_t vertexBegin = generated->GetXaxis()->FindBin(-9.99);
   Int_t vertexEnd = generated->GetXaxis()->FindBin(9.99);
 
@@ -387,6 +388,26 @@ Float_t AlidNdEtaCorrection::GetMeasuredFraction(CorrectionType correctionType,
   return fraction;
 }
 
+//____________________________________________________________________
+TH1* AlidNdEtaCorrection::GetMeasuredEventFraction(CorrectionType correctionType, Int_t multCut)
+{
+  // calculates the fraction of events above multCut (but including it)
+  //
+  // uses the generated event histogram from the correction passed, e.g. pass GetTrack2ParticleCorrection()
+
+  if (!GetCorrection(correctionType))
+    return 0;
+
+  const TH2F* generated = GetCorrection(correctionType)->GetEventCorrection()->GetGeneratedHistogram();
+
+  TH1* allEvents = generated->ProjectionX(Form("%s_all", generated->GetName()), 1, generated->GetNbinsY());
+  TH1* aboveEvents = generated->ProjectionX(Form("%s_above", generated->GetName()), generated->GetYaxis()->FindBin(multCut), generated->GetNbinsY());
+  
+  aboveEvents->Divide(aboveEvents, allEvents, 1, 1, "B");
+
+  return aboveEvents;  
+}
+
 //____________________________________________________________________
 void AlidNdEtaCorrection::ReduceInformation()
 {