added correction for events with vertex but 0 tracks
[u/mrichter/AliRoot.git] / PWG0 / dNdEta / AlidNdEtaCorrection.cxx
index 261d339..0e54435 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);
 
@@ -388,6 +389,26 @@ Float_t AlidNdEtaCorrection::GetMeasuredFraction(CorrectionType correctionType,
 }
 
 //____________________________________________________________________
+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()
 {
   // this function deletes the measured and generated histograms from the corrections to reduce the amount of data