]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisUtils.cxx
prettier logs
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisUtils.cxx
index 71f57da4cfefa35f30fab9dfbcf96c6b9c4462cd..15fef1d74d790c569be83fc2d1e99c70e2a99469 100644 (file)
@@ -9,6 +9,7 @@
 #include <TMatrixDSym.h>
 #include <TMath.h>
 #include "AliVMultiplicity.h"
+#include "AliPPVsMultUtils.h"
 
 #include "AliAnalysisUtils.h"
 
@@ -33,7 +34,8 @@ AliAnalysisUtils::AliAnalysisUtils():TObject(),
   fnSigmaPlpDiamZSPD(5.),
   fUseSPDCutInMultBins(kFALSE),
   fASPDCvsTCut(65.),
-  fBSPDCvsTCut(4.)
+  fBSPDCvsTCut(4.),
+  fPPVsMultUtils(0x0)
 {
   // Default contructor
 }
@@ -112,7 +114,8 @@ Bool_t AliAnalysisUtils::IsFirstEventInChunk(AliVEvent *event)
 
   if(fisAOD){
     AliAODHeader *aodheader = 0x0;
-    aodheader = aod->GetHeader();
+    aodheader = dynamic_cast<AliAODHeader*>(aod->GetHeader());
+    if(!aodheader) AliFatal("Not a standard AOD");
     if(!aodheader){
       AliFatal("AOD header not there ?!");
       return kFALSE;
@@ -214,11 +217,11 @@ Bool_t AliAnalysisUtils::IsOutOfBunchPileUp(AliVEvent *event)
     AliFatal("Event is neither of AOD nor ESD type");
     return kFALSE;
   }
-  Int_t bc2 = (aod)?aod->GetHeader()->GetIRInt2ClosestInteractionMap():esd->GetHeader()->GetIRInt2ClosestInteractionMap();
+  Int_t bc2 = (aod)?((AliVAODHeader*)aod->GetHeader())->GetIRInt2ClosestInteractionMap():esd->GetHeader()->GetIRInt2ClosestInteractionMap();
   if (bc2 != 0)
     return kTRUE;
   
-  Int_t bc1 = (aod)?aod->GetHeader()->GetIRInt1ClosestInteractionMap():esd->GetHeader()->GetIRInt1ClosestInteractionMap();
+  Int_t bc1 = (aod)?((AliVAODHeader*)aod->GetHeader())->GetIRInt1ClosestInteractionMap():esd->GetHeader()->GetIRInt1ClosestInteractionMap();
   if (bc1 != 0)
     return kTRUE;
   
@@ -265,3 +268,13 @@ Double_t AliAnalysisUtils::GetWDist(const AliVVertex* v0, const AliVVertex* v1)
 
 }
 
+//______________________________________________________________________
+Float_t AliAnalysisUtils::GetMultiplicityPercentile(AliVEvent *event, TString lMethod ){
+  if(!fPPVsMultUtils)
+    fPPVsMultUtils=new AliPPVsMultUtils();
+  if( (event->InheritsFrom("AliAODEvent")) || (event->InheritsFrom("AliESDEvent")) ) return fPPVsMultUtils->GetMultiplicityPercentile(event,lMethod);
+  else {
+    AliFatal("Event is neither of AOD nor ESD type"); 
+    return -999.;
+  }
+}