3 // Base class for rho calculation
9 #include "AliESDEvent.h"
11 #include "AliAnalysisManager.h"
12 #include "AliVEventHandler.h"
13 #include "AliCentrality.h"
14 #include "AliEmcalJet.h"
15 #include "AliVCluster.h"
17 #include "AliAnalysisTaskRhoBase.h"
19 ClassImp(AliAnalysisTaskRhoBase)
21 //________________________________________________________________________
22 AliAnalysisTaskRhoBase::AliAnalysisTaskRhoBase() :
32 //________________________________________________________________________
33 AliAnalysisTaskRhoBase::AliAnalysisTaskRhoBase(const char *name) :
34 AliAnalysisTaskSE(name),
43 //________________________________________________________________________
44 void AliAnalysisTaskRhoBase::UserCreateOutputObjects()
46 // Run at beginning of task.
48 AliVEventHandler* handler = AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler();
50 AliError("Input handler not available!");
54 fRho = new TParameter<Double_t>(fRhoName, 0);
57 //________________________________________________________________________
58 Double_t AliAnalysisTaskRhoBase::GetRhoFactor(Double_t cent)
60 // Return rho per centrality.
64 rho = fRhoFunction->Eval(cent);
68 //_____________________________________________________
69 TString AliAnalysisTaskRhoBase::GetBeamType()
71 // Get beam type : pp-AA-pA
72 // ESDs have it directly, AODs get it from hardcoded run number ranges
74 AliVEvent *event = InputEvent();
77 AliError("Couldn't retrieve event!");
83 AliESDEvent *esd = dynamic_cast<AliESDEvent*>(event);
85 const AliESDRun *run = esd->GetESDRun();
86 beamType = run->GetBeamType();
90 Int_t runNumber = event->GetRunNumber();
91 if ((runNumber >= 136851 && runNumber <= 139517) || // LHC10h
92 (runNumber >= 166529 && runNumber <= 170593)) // LHC11h
105 //________________________________________________________________________
106 void AliAnalysisTaskRhoBase::UserExec(Option_t *)
108 // Main loop, called for each event.
110 // add rho to event if not yet there
111 if (!(InputEvent()->FindListObject(fRhoName))) {
112 new(fRho) TParameter<Double_t>(fRhoName, 0);
113 InputEvent()->AddObject(fRho);
119 if (GetBeamType() == "A-A") {
120 AliCentrality *centrality = InputEvent()->GetCentrality();
123 fCent = centrality->GetCentralityPercentile("V0M");
125 fCent = 99; // probably pp data
128 AliWarning(Form("Centrality negative: %f, assuming 99", fCent));
133 Double_t rhochem = GetRhoFactor(fCent);
134 fRho->SetVal(rhochem);
137 //________________________________________________________________________
138 void AliAnalysisTaskRhoBase::Terminate(Option_t *)
140 // Run at the end of the task.