]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
get beam type
authorloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 May 2012 05:06:44 +0000 (05:06 +0000)
committerloizides <loizides@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 30 May 2012 05:06:44 +0000 (05:06 +0000)
PWGGA/EMCALJetTasks/AliHadCorrTask.cxx
PWGGA/EMCALJetTasks/AliHadCorrTask.h

index c696e16787e092a1df6c341eea9150e96e13b2bc..f3e321f7c3d1181b18b51511f40e05c2ed2f83b2 100644 (file)
 #include <TList.h>
 #include <TLorentzVector.h>
 
+#include "AliAnalysisManager.h"
 #include "AliAODCaloCluster.h"
 #include "AliAODEvent.h"
-#include "AliAnalysisManager.h"
-#include "AliCentrality.h"
+#include "AliESDEvent.h"
 #include "AliESDCaloCluster.h"
-#include "AliESDtrack.h"
+#include "AliCentrality.h"
 #include "AliPicoTrack.h"
 #include "AliVEventHandler.h"
 
@@ -491,6 +491,43 @@ void AliHadCorrTask::UserCreateOutputObjects()
   PostData(1, fOutputList);
 }
 
+//_____________________________________________________
+TString AliHadCorrTask::GetBeamType()
+{
+  // Get beam type : pp-AA-pA
+  // ESDs have it directly, AODs get it from hardcoded run number ranges
+  
+  AliVEvent *event = InputEvent();
+
+  if (!event) { 
+    AliError("Couldn't retrieve event!");
+    return "";
+  }
+
+  TString beamType;
+
+  AliESDEvent *esd = dynamic_cast<AliESDEvent*>(event);
+  if (esd) {
+    const AliESDRun *run = esd->GetESDRun();
+    beamType = run->GetBeamType();
+  }
+  else
+  {
+    Int_t runNumber = event->GetRunNumber();
+    if ((runNumber >= 136851 && runNumber <= 139517) ||  // LHC10h
+       (runNumber >= 166529 && runNumber <= 170593))    // LHC11h
+    {
+      beamType = "A-A";
+    }
+    else 
+    {
+      beamType = "p-p";
+    }
+  }
+
+  return beamType;    
+}
+
 //________________________________________________________________________
 void AliHadCorrTask::UserExec(Option_t *) 
 {
@@ -519,18 +556,20 @@ void AliHadCorrTask::UserExec(Option_t *)
   TList *l = InputEvent()->GetList();
   
   // get centrality 
-  Double_t cent = -1; 
-  AliCentrality *centrality = InputEvent()->GetCentrality() ;
-
-  if (centrality)
-    cent = centrality->GetCentralityPercentile("V0M");
-  else
-    cent=99; // probably pp data
+  Double_t cent = 99; 
   
-  if (cent<0) {
-    AliWarning(Form("Centrality negative: %f, assuming 99", cent));
-    cent = 99;
+  if (GetBeamType() == "A-A") {
+    AliCentrality *centrality = InputEvent()->GetCentrality();
+    
+    if (centrality)
+      cent = centrality->GetCentralityPercentile("V0M");
+    else
+      cent = 99; // probably pp data
+    
+    if (cent < 0) {
+      AliWarning(Form("Centrality negative: %f, assuming 99", cent));
+      cent = 99;
+    }
   }
   
   Int_t centbin = GetCentBin(cent);
index 86168b9da42157b6945169b0b02f809e48a1b6f8..81cf8a14a69780bdad0e61e0ad515d0652255209 100644 (file)
@@ -36,6 +36,7 @@ class AliHadCorrTask : public AliAnalysisTaskSE {
   Double_t     GetEtaSigma(Int_t pbin)    const;
   Double_t     GetPhiMean(Int_t pbin, Int_t centbin)    const;
   Double_t     GetPhiSigma(Int_t pbin, Int_t centbin)    const;
+  TString      GetBeamType();
 
   TString                fTracksName;             // name of track collection
   TString                fCaloName;               // name of calo cluster collection