]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGJE/UserTasks/AliAnalysisTaskJetProtonCorr.cxx
Reduce binning for D+ and Ds correction framework
[u/mrichter/AliRoot.git] / PWGJE / UserTasks / AliAnalysisTaskJetProtonCorr.cxx
CommitLineData
23536a91 1// ROOT
2#include "TFile.h"
3#include "TList.h"
4#include "TH1.h"
5#include "TH2.h"
6#include "TH3.h"
d57e2346 7#include "TF1.h"
23536a91 8#include "TFormula.h"
3082e8ab 9#include "TRandom.h"
23536a91 10
11// analysis framework
12#include "AliAnalysisManager.h"
13#include "AliInputEventHandler.h"
14#include "AliVEvent.h"
ebdf1dbb 15#include "AliVTrack.h"
23536a91 16#include "AliVTrdTrack.h"
17#include "AliVVertex.h"
18#include "AliPIDResponse.h"
19#include "AliEventPoolManager.h"
ebdf1dbb 20#include "AliOADBContainer.h"
21#include "AliTOFPIDParams.h"
22#include "AliAnalysisTaskVnV0.h"
23536a91 23
24// MC stuff
25#include "AliMCEvent.h"
26#include "AliGenPythiaEventHeader.h"
27
28// ESD stuff
29#include "AliESDEvent.h"
30#include "AliESDInputHandler.h"
31#include "AliESDtrack.h"
32#include "AliESDtrackCuts.h"
33#include "AliESDTrdTrack.h"
34#include "AliESDTrdTracklet.h"
35#include "AliESDTrdTrigger.h"
36
37// AOD stuff
38#include "AliAODEvent.h"
39#include "AliAODJet.h"
40#include "AliAODTrack.h"
41
42// jet tasks
43#include "AliAnalysisTaskJetServices.h"
44#include "AliAnalysisHelperJetTasks.h"
45
46#include "AliAnalysisTaskJetProtonCorr.h"
47
3082e8ab 48#include <iostream>
49#include <cmath>
50
23536a91 51AliAnalysisTaskJetProtonCorr::AliAnalysisTaskJetProtonCorr(const char *name) :
52 AliAnalysisTaskSE(name),
53 fMCEvent(0x0),
54 fESDEvent(0x0),
55 fAODEvent(0x0),
ebdf1dbb 56 fRunNumber(-1),
57 fOADBContainerTOF(0x0),
58 fParamsTOF(0x0),
59 fEventplane(0x0),
23536a91 60 fTriggerMask(0),
61 fClassMask(0),
62 fCentrality(100.),
63 fCentralityCheck(100.),
64 fZvtx(0.),
65 fPIDResponse(0x0),
ebdf1dbb 66 fEventPlaneAngle(5.),
67 fEventPlaneAngleCheck(5.),
a4c7ef28 68 fEventPlaneAngle3(5.),
69 fPrimTrackArrayAss(0x0),
70 fPrimTrackArrayTrg(0x0),
71 fPrimConstrainedTrackArray(new TClonesArray("AliESDtrack", 100)),
23536a91 72 fJetArray(0x0),
73 fPoolMgr(),
74 fPool(),
75 fHistCorr(0x0),
d57e2346 76 fErrorMsg(10),
23536a91 77 fOutputList(),
78 fHist(),
79 fShortTaskId("jet_prot_corr"),
3082e8ab 80 fUseStandardCuts(kTRUE),
a4c7ef28 81 fUseEvplaneV0(kFALSE),
82 fCutsPrimTrg(0x0),
83 fCutsPrimTrgConstrain(new AliESDtrackCuts()),
84 fCutsPrimAss(0x0),
3082e8ab 85 fCutsTwoTrackEff(0.02),
d57e2346 86 fAssFilterMask(1 << 10),
87 fTrgJetEtaMax(0.45),
88 fHadEtaMax(0.8),
23536a91 89 fTrgPartPtMin(6.),
90 fTrgPartPtMax(8.),
91 fTrgJetPtMin(50.),
92 fTrgJetPtMax(80.),
d57e2346 93 fTrgJetLeadTrkPtMin(6.),
94 fTrgJetLeadTrkPtMax(100.),
95 fTrgJetAreaMin(0.6 * TMath::Pi() * 0.2*0.2),
23536a91 96 fAssPartPtMin(2.),
3082e8ab 97 fAssPartPtMax(4.),
ebdf1dbb 98 fTrgAngleToEvPlane(TMath::Pi() / 4.),
99 fTrgJetPhiModCent(new TF1("jetphimodcent", "1 + 2 * [0] * cos(2*x)", 0., 2 * TMath::Pi())),
100 fTrgJetPhiModSemi(new TF1("jetphimodsemi", "1 + 2 * [0] * cos(2*x)", 0., 2 * TMath::Pi())),
101 fTrgHadPhiModCent(new TF1("hadphimodcent", "1 + 2 * [0] * cos(2*x)", 0., 2 * TMath::Pi())),
102 fTrgHadPhiModSemi(new TF1("hadphimodsemi", "1 + 2 * [0] * cos(2*x)", 0., 2 * TMath::Pi()))
23536a91 103{
104 // default ctor
105
106 fkCorrTypeName[kCorrHadHad] = "hh";
107 fkCorrTypeName[kCorrHadProt] = "hp";
108 fkCorrTypeName[kCorrJetHad] = "jh";
109 fkCorrTypeName[kCorrJetProt] = "jp";
ebdf1dbb 110 fkCorrTypeName[kCorrRndJetHad] = "rjh";
111 fkCorrTypeName[kCorrRndJetProt] = "rjp";
112 fkCorrTypeName[kCorrRndHadHad] = "rhh";
113 fkCorrTypeName[kCorrRndHadProt] = "rhp";
114 fkCorrTypeName[kCorrRndJetExcHad] = "rjeh";
115 fkCorrTypeName[kCorrRndJetExcProt] = "rjep";
116 fkCorrTypeName[kCorrRndHadExcHad] = "rheh";
117 fkCorrTypeName[kCorrRndHadExcProt] = "rhep";
23536a91 118
119 fkClassName[kClCentral] = "cent";
120 fkClassName[kClSemiCentral] = "semi";
2751fb9a 121 // fkClassName[kClDijet] = "dijet";
23536a91 122
123 fkEvName[kEvSame] = "same";
124 fkEvName[kEvMix] = "mixed";
125
a4c7ef28 126 // track cuts for associates
3082e8ab 127 if (fUseStandardCuts) {
a4c7ef28 128 fCutsPrimAss = AliESDtrackCuts::GetStandardITSTPCTrackCuts2011(kTRUE);
3082e8ab 129 } else {
a4c7ef28 130 fCutsPrimAss = new AliESDtrackCuts();
3082e8ab 131
132 // this is taken from PWGJE track cuts
133 TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
a4c7ef28 134 fCutsPrimAss->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
135 fCutsPrimAss->SetMinNClustersTPC(70);
136 fCutsPrimAss->SetMaxChi2PerClusterTPC(4);
137 fCutsPrimAss->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
138 fCutsPrimAss->SetAcceptKinkDaughters(kFALSE);
139 fCutsPrimAss->SetRequireTPCRefit(kTRUE);
140 fCutsPrimAss->SetMaxFractionSharedTPCClusters(0.4);
3082e8ab 141 // ITS
a4c7ef28 142 fCutsPrimAss->SetRequireITSRefit(kTRUE);
3082e8ab 143 //accept secondaries
a4c7ef28 144 fCutsPrimAss->SetMaxDCAToVertexXY(2.4);
145 fCutsPrimAss->SetMaxDCAToVertexZ(3.2);
146 fCutsPrimAss->SetDCAToVertex2D(kTRUE);
3082e8ab 147 //reject fakes
a4c7ef28 148 fCutsPrimAss->SetMaxChi2PerClusterITS(36);
149 fCutsPrimAss->SetMaxChi2TPCConstrainedGlobal(36);
3082e8ab 150
a4c7ef28 151 fCutsPrimAss->SetRequireSigmaToVertex(kFALSE);
152
153 fCutsPrimAss->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
3082e8ab 154
3082e8ab 155 }
23536a91 156
d57e2346 157 fCutsPrimAss->SetEtaRange(-fHadEtaMax, fHadEtaMax);
a4c7ef28 158 fCutsPrimAss->SetPtRange(0.15, 1E+15);
159
160 // track cuts for triggers
161 fCutsPrimTrg = new AliESDtrackCuts(*fCutsPrimAss);
23536a91 162
a4c7ef28 163 // azimuthal modulation for triggers
d57e2346 164 fTrgJetPhiModCent->SetParameter(0, .10);
165 fTrgJetPhiModSemi->SetParameter(0, .10);
a4c7ef28 166 fTrgHadPhiModCent->SetParameter(0, .04);
167 fTrgHadPhiModSemi->SetParameter(0, .10);
ebdf1dbb 168
23536a91 169 // event mixing pool
3082e8ab 170 Double_t centralityBins[] = {
171 0., 2., 4., 6., 8., 10., // central
172 30., 32., 34., 36., 38., 40., 42., 44., 46., 48., 50., // semi-central
173 90.
174 };
23536a91 175 Int_t nCentralityBins = sizeof(centralityBins)/sizeof(centralityBins[0]);
176
3082e8ab 177 Double_t vertexBins[] = {
178 -10., -8., -6., -4., -2., 0., 2., 4., 6., 8., 10.
179 };
23536a91 180 Int_t nVertexBins = sizeof(vertexBins)/sizeof(vertexBins[0]);
181
182 Double_t psiBins[12];
183 Int_t nPsiBins = sizeof(psiBins)/sizeof(psiBins[0]);
184 for (Int_t iBin = 0; iBin < nPsiBins; ++iBin)
185 psiBins[iBin] = iBin * TMath::Pi()/nPsiBins;
186
2751fb9a 187 const Int_t poolSize = 10; // unused by current event pool implementation
a4c7ef28 188 const Int_t trackDepth = 10000; // number of tracks to maintain in mixing buffer
2751fb9a 189 const Float_t trackDepthFraction = 0.1;
190 const Int_t targetEvents = 1;
191 // for (Int_t iTrg = 0; iTrg < kTrgLast; ++iTrg) {
192 for (Int_t iAss = 0; iAss <= kAssProt; ++iAss) {
193 GetPoolMgr((Ass_t) iAss) =
194 new AliEventPoolManager(poolSize, trackDepth,
23536a91 195 nCentralityBins, centralityBins,
3082e8ab 196 nVertexBins, vertexBins);
197 // nPsiBins, psiBins);
2751fb9a 198 GetPoolMgr((Ass_t) iAss)->SetTargetValues(trackDepth, trackDepthFraction, targetEvents);
23536a91 199 }
2751fb9a 200 // }
23536a91 201
202 fHistCorr = new AliHistCorr*[kEvLast*kCorrLast*kClLast];
203
204 DefineOutput(1, TList::Class());
205}
206
207AliAnalysisTaskJetProtonCorr::~AliAnalysisTaskJetProtonCorr()
208{
209 // dtor
210
211 // delete [] fHistCorr;
212}
213
214void AliAnalysisTaskJetProtonCorr::UserCreateOutputObjects()
215{
216 // create user output objects
217
ebdf1dbb 218 // open OADB file and retrieve the OADB container with TOF parameters
219 TString oadbFileName =
220 TString::Format("%s/COMMON/PID/data/TOFPIDParams.root", AliAnalysisManager::GetOADBPath());
221 TFile *oadbFile = TFile::Open(oadbFileName);
222 if(!oadbFile->IsOpen())
223 AliFatal(Form("Cannot open OADB file %s", oadbFileName.Data()));
224 AliOADBContainer *oadbContainer =
225 (AliOADBContainer*) oadbFile->Get("TOFoadb");
226 if (!oadbContainer)
227 AliFatal("Cannot fetch OADB container for VZERO EP selection");
228 fOADBContainerTOF = new AliOADBContainer(*oadbContainer);
229 oadbFile->Close();
230 delete oadbFile;
231
23536a91 232 // setup list
233 OpenFile(1);
234 fOutputList = new TList();
235 fOutputList->SetOwner();
236
237 // setup histograms
238 TH1 *hist;
239 TH1 *histStat = AddHistogram(ID(kHistStat), "event statistics;;counts",
240 kStatLast-1, .5, kStatLast-.5);
241 histStat->GetXaxis()->SetBinLabel(ID(kStatSeen));
242 histStat->GetXaxis()->SetBinLabel(ID(kStatTrg));
ebdf1dbb 243 histStat->GetXaxis()->SetBinLabel(ID(kStatVtx));
23536a91 244 histStat->GetXaxis()->SetBinLabel(ID(kStatEvCuts));
245 histStat->GetXaxis()->SetBinLabel(ID(kStatUsed));
246 histStat->GetXaxis()->SetBinLabel(ID(kStatCent));
247 histStat->GetXaxis()->SetBinLabel(ID(kStatEvPlane));
248 histStat->GetXaxis()->SetBinLabel(ID(kStatPID));
3082e8ab 249 histStat->GetXaxis()->SetBinLabel(ID(kStatCentral));
250 histStat->GetXaxis()->SetBinLabel(ID(kStatSemiCentral));
23536a91 251
ebdf1dbb 252 AddHistogram(ID(kHistVertexNctb), "number of vertex contributors;N_{ctb};counts",
253 100, 0., 2000.);
254 AddHistogram(ID(kHistVertexZ), "z-position of primary vertex;z (cm);counts",
255 100, -50., 50.);
256
23536a91 257 AddHistogram(ID(kHistCentrality), "centrality;C;counts",
258 110, -5., 105.);
259 hist = AddHistogram(ID(kHistCentralityUsed), "centrality used;C;event class",
260 110, -5., 105.,
261 kClLast, -.5, kClLast-.5);
262 hist->GetYaxis()->SetBinLabel(LAB(kClCentral));
263 hist->GetYaxis()->SetBinLabel(LAB(kClSemiCentral));
2751fb9a 264 // hist->GetYaxis()->SetBinLabel(LAB(kClDijet));
23536a91 265 AddHistogram(ID(kHistCentralityCheck), "centrality check;C;counts",
266 110, -5., 105.);
267 hist = AddHistogram(ID(kHistCentralityCheckUsed), "centrality check used;C;event class",
268 110, -5., 105.,
269 kClLast, -.5, kClLast-.5);
270 hist->GetYaxis()->SetBinLabel(LAB(kClCentral));
271 hist->GetYaxis()->SetBinLabel(LAB(kClSemiCentral));
2751fb9a 272 // hist->GetYaxis()->SetBinLabel(LAB(kClDijet));
ebdf1dbb 273 AddHistogram(ID(kHistCentralityVsMult), "centrality - multiplicity;centrality percentile (%);N_{prim}",
274 100, 0., 100.,
275 100, 0., 2500.);
23536a91 276
3082e8ab 277 AddHistogram(ID(kHistSignalTPC), "TPC dE/dx;p (GeV/c);dE/dx (arb. units)",
278 100, 0., 10., 200, 0., 300.);
279 AddHistogram(ID(kHistSignalTOF), "TOF time of flight;p_{T} (GeV/c);t (ns)",
280 100, 0., 10., 200, 0., 50.);
281 AddHistogram(ID(kHistBetaTOF), "TOF beta;p (GeV/c); #beta",
282 100, 0., 10.,
283 100, 0., 1.);
ebdf1dbb 284
3082e8ab 285 AddHistogram(ID(kHistDeltaTPC), "TPC dE/dx;p (GeV/c);dE/dx (arb. units)",
286 100, 0., 10., 200, -100., 100.);
287 AddHistogram(ID(kHistDeltaTPCSemi), "TPC dE/dx;p (GeV/c);dE/dx (arb. units)",
288 100, 0., 10., 200, -100., 100.);
ebdf1dbb 289 AddHistogram(ID(kHistDeltaTOF), "TOF time of flight;p (GeV/c);t (ns)",
3082e8ab 290 100, 0., 10., 200, -2., 2.);
ebdf1dbb 291 AddHistogram(ID(kHistDeltaTOFSemi), "TOF time of flight;p (GeV/c);t (ns)",
3082e8ab 292 100, 0., 10., 200, -2., 2.);
293
ebdf1dbb 294 // Nsigma templates - central
a4c7ef28 295 AddHistogram(ID(kHistNsigmaTPCe), "TPC N_{#sigma,p} - e hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 296 100, 0., 10.,
297 100, -25., 25.);
a4c7ef28 298 AddHistogram(ID(kHistNsigmaTPCmu), "TPC N_{#sigma,p} - #mu hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 299 100, 0., 10.,
300 100, -25., 25.);
a4c7ef28 301 AddHistogram(ID(kHistNsigmaTPCpi), "TPC N_{#sigma,p} - #pi hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 302 100, 0., 10.,
303 100, -25., 25.);
a4c7ef28 304 AddHistogram(ID(kHistNsigmaTPCk), "TPC N_{#sigma,p} - K hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 305 100, 0., 10.,
306 100, -25., 25.);
a4c7ef28 307 AddHistogram(ID(kHistNsigmaTPCp), "TPC N_{#sigma,p} - p hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 308 100, 0., 10.,
309 100, -25., 25.);
a4c7ef28 310 AddHistogram(ID(kHistNsigmaTPCd), "TPC N_{#sigma,p} - d hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 311 100, 0., 10.,
312 100, -25., 25.);
a4c7ef28 313 AddHistogram(ID(kHistNsigmaTPCe_e), "TPC N_{#sigma,p} - e hypothesis (id. e);p (GeV/c);N_{#sigma,p}",
3082e8ab 314 100, 0., 10.,
315 100, -25., 25.);
316
a4c7ef28 317 AddHistogram(ID(kHistNsigmaTOFe), "TOF N_{#sigma,p} - e hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 318 100, 0., 10.,
ebdf1dbb 319 200, -100., 100.);
a4c7ef28 320 AddHistogram(ID(kHistNsigmaTOFmu), "TOF N_{#sigma,p} - #mu hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 321 100, 0., 10.,
ebdf1dbb 322 200, -100., 100.);
a4c7ef28 323 AddHistogram(ID(kHistNsigmaTOFpi), "TOF N_{#sigma,p} - #pi hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 324 100, 0., 10.,
ebdf1dbb 325 200, -100., 100.);
a4c7ef28 326 AddHistogram(ID(kHistNsigmaTOFk), "TOF N_{#sigma,p} - K hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 327 100, 0., 10.,
ebdf1dbb 328 200, -100., 100.);
a4c7ef28 329 AddHistogram(ID(kHistNsigmaTOFp), "TOF N_{#sigma,p} - p hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 330 100, 0., 10.,
ebdf1dbb 331 200, -100., 100.);
a4c7ef28 332 AddHistogram(ID(kHistNsigmaTOFd), "TOF N_{#sigma,p} - d hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 333 100, 0., 10.,
ebdf1dbb 334 200, -100., 100.);
a4c7ef28 335 AddHistogram(ID(kHistNsigmaTOFmismatch), "TOF N_{#sigma,p} - mismatch;p (GeV/c);N_{#sigma,p}",
3082e8ab 336 100, 0., 10.,
ebdf1dbb 337 200, -100., 100.);
3082e8ab 338
ebdf1dbb 339 // Nsigma templates - semi-central
a4c7ef28 340 AddHistogram(ID(kHistNsigmaTPCeSemi), "TPC N_{#sigma,p} - e hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 341 100, 0., 10.,
342 100, -25., 25.);
a4c7ef28 343 AddHistogram(ID(kHistNsigmaTPCmuSemi), "TPC N_{#sigma,p} - #mu hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 344 100, 0., 10.,
345 100, -25., 25.);
a4c7ef28 346 AddHistogram(ID(kHistNsigmaTPCpiSemi), "TPC N_{#sigma,p} - #pi hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 347 100, 0., 10.,
348 100, -25., 25.);
a4c7ef28 349 AddHistogram(ID(kHistNsigmaTPCkSemi), "TPC N_{#sigma,p} - K hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 350 100, 0., 10.,
351 100, -25., 25.);
a4c7ef28 352 AddHistogram(ID(kHistNsigmaTPCpSemi), "TPC N_{#sigma,p} - p hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 353 100, 0., 10.,
354 100, -25., 25.);
a4c7ef28 355 AddHistogram(ID(kHistNsigmaTPCdSemi), "TPC N_{#sigma,p} - d hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 356 100, 0., 10.,
357 100, -25., 25.);
a4c7ef28 358 AddHistogram(ID(kHistNsigmaTPCe_eSemi), "TPC N_{#sigma,p} - e hypothesis (id. e);p (GeV/c);N_{#sigma,p}",
3082e8ab 359 100, 0., 10.,
360 100, -25., 25.);
361
a4c7ef28 362 AddHistogram(ID(kHistNsigmaTOFeSemi), "TOF N_{#sigma,p} - e hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 363 100, 0., 10.,
ebdf1dbb 364 200, -100., 100.);
a4c7ef28 365 AddHistogram(ID(kHistNsigmaTOFmuSemi), "TOF N_{#sigma,p} - #mu hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 366 100, 0., 10.,
ebdf1dbb 367 200, -100., 100.);
a4c7ef28 368 AddHistogram(ID(kHistNsigmaTOFpiSemi), "TOF N_{#sigma,p} - #pi hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 369 100, 0., 10.,
ebdf1dbb 370 200, -100., 100.);
a4c7ef28 371 AddHistogram(ID(kHistNsigmaTOFkSemi), "TOF N_{#sigma,p} - K hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 372 100, 0., 10.,
ebdf1dbb 373 200, -100., 100.);
a4c7ef28 374 AddHistogram(ID(kHistNsigmaTOFpSemi), "TOF N_{#sigma,p} - p hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 375 100, 0., 10.,
ebdf1dbb 376 200, -100., 100.);
a4c7ef28 377 AddHistogram(ID(kHistNsigmaTOFdSemi), "TOF N_{#sigma,p} - d hypothesis;p (GeV/c);N_{#sigma,p}",
3082e8ab 378 100, 0., 10.,
ebdf1dbb 379 200, -100., 100.);
a4c7ef28 380 AddHistogram(ID(kHistNsigmaTOFmismatchSemi), "TOF N_{#sigma,p} - mismatch;p (GeV/c);N_{#sigma,p}",
3082e8ab 381 100, 0., 10.,
ebdf1dbb 382 200, -100., 100.);
3082e8ab 383
384 // delta templates
385 AddHistogram(ID(kHistDeltaTOFe), "TOF #Delta;p (GeV/c);t (ns)",
386 100, 0., 10., 200, -2., 2.);
387 AddHistogram(ID(kHistDeltaTOFmu), "TOF #Delta;p (GeV/c);t (ns)",
388 100, 0., 10., 200, -2., 2.);
389 AddHistogram(ID(kHistDeltaTOFpi), "TOF #Delta;p (GeV/c);t (ns)",
390 100, 0., 10., 200, -2., 2.);
391 AddHistogram(ID(kHistDeltaTOFk), "TOF #Delta;p (GeV/c);t (ns)",
392 100, 0., 10., 200, -2., 2.);
393 AddHistogram(ID(kHistDeltaTOFp), "TOF #Delta;p (GeV/c);t (ns)",
394 100, 0., 10., 200, -2., 2.);
395 AddHistogram(ID(kHistDeltaTOFd), "TOF #Delta;p (GeV/c);t (ns)",
396 100, 0., 10., 200, -2., 2.);
397
398 AddHistogram(ID(kHistDeltaTOFeSemi), "TOF #Delta;p (GeV/c);t (ns)",
399 100, 0., 10., 200, -2., 2.);
400 AddHistogram(ID(kHistDeltaTOFmuSemi), "TOF #Delta;p (GeV/c);t (ns)",
401 100, 0., 10., 200, -2., 2.);
402 AddHistogram(ID(kHistDeltaTOFpiSemi), "TOF #Delta;p (GeV/c);t (ns)",
403 100, 0., 10., 200, -2., 2.);
404 AddHistogram(ID(kHistDeltaTOFkSemi), "TOF #Delta;p (GeV/c);t (ns)",
405 100, 0., 10., 200, -2., 2.);
406 AddHistogram(ID(kHistDeltaTOFpSemi), "TOF #Delta;p (GeV/c);t (ns)",
407 100, 0., 10., 200, -2., 2.);
408 AddHistogram(ID(kHistDeltaTOFdSemi), "TOF #Delta;p (GeV/c);t (ns)",
409 100, 0., 10., 200, -2., 2.);
410
411 // sigma comparisons
ebdf1dbb 412 // AddHistogram(ID(kHistExpSigmaTOFe), "TOF time of flight;p (GeV/c);t (ns)",
413 // 100, 0., 10., 200, 0., .25);
414 // AddHistogram(ID(kHistExpSigmaTOFmu), "TOF time of flight;p (GeV/c);t (ns)",
415 // 100, 0., 10., 200, 0., .25);
416 // AddHistogram(ID(kHistExpSigmaTOFpi), "TOF time of flight;p (GeV/c);t (ns)",
417 // 100, 0., 10., 200, 0., .25);
418 // AddHistogram(ID(kHistExpSigmaTOFk), "TOF time of flight;p (GeV/c);t (ns)",
419 // 100, 0., 10., 200, 0., .25);
420 // AddHistogram(ID(kHistExpSigmaTOFp), "TOF time of flight;p (GeV/c);t (ns)",
421 // 100, 0., 10., 200, 0., .25);
422 // AddHistogram(ID(kHistExpSigmaTOFd), "TOF time of flight;p (GeV/c);t (ns)",
423 // 100, 0., 10., 200, 0., .25);
424
425 // AddHistogram(ID(kHistExpSigmaTOFeSemi), "TOF time of flight;p (GeV/c);t (ns)",
426 // 100, 0., 10., 200, 0., .25);
427 // AddHistogram(ID(kHistExpSigmaTOFmuSemi), "TOF time of flight;p (GeV/c);t (ns)",
428 // 100, 0., 10., 200, 0., .25);
429 // AddHistogram(ID(kHistExpSigmaTOFpiSemi), "TOF time of flight;p (GeV/c);t (ns)",
430 // 100, 0., 10., 200, 0., .25);
431 // AddHistogram(ID(kHistExpSigmaTOFkSemi), "TOF time of flight;p (GeV/c);t (ns)",
432 // 100, 0., 10., 200, 0., .25);
433 // AddHistogram(ID(kHistExpSigmaTOFpSemi), "TOF time of flight;p (GeV/c);t (ns)",
434 // 100, 0., 10., 200, 0., .25);
435 // AddHistogram(ID(kHistExpSigmaTOFdSemi), "TOF time of flight;p (GeV/c);t (ns)",
436 // 100, 0., 10., 200, 0., .25);
437
438 // AddHistogram(ID(kHistCmpSigmaTOFe), "#sigma comparison;exp #sigma;template #sigma",
439 // 200, 0., .25, 200, 0., .25);
440 // AddHistogram(ID(kHistCmpSigmaTOFmu), "#sigma comparison;exp #sigma;template #sigma",
441 // 200, 0., .25, 200, 0., .25);
442 // AddHistogram(ID(kHistCmpSigmaTOFpi), "#sigma comparison;exp #sigma;template #sigma",
443 // 200, 0., .25, 200, 0., .25);
444 // AddHistogram(ID(kHistCmpSigmaTOFk), "#sigma comparison;exp #sigma;template #sigma",
445 // 200, 0., .25, 200, 0., .25);
446 // AddHistogram(ID(kHistCmpSigmaTOFp), "#sigma comparison;exp #sigma;template #sigma",
447 // 200, 0., .25, 200, 0., .25);
448 // AddHistogram(ID(kHistCmpSigmaTOFd), "#sigma comparison;exp #sigma;template #sigma",
449 // 200, 0., .25, 200, 0., .25);
450
451 // AddHistogram(ID(kHistCmpSigmaTOFeSemi), "#sigma comparison;exp #sigma;template #sigma",
452 // 200, 0., .25, 200, 0., .25);
453 // AddHistogram(ID(kHistCmpSigmaTOFmuSemi), "#sigma comparison;exp #sigma;template #sigma",
454 // 200, 0., .25, 200, 0., .25);
455 // AddHistogram(ID(kHistCmpSigmaTOFpiSemi), "#sigma comparison;exp #sigma;template #sigma",
456 // 200, 0., .25, 200, 0., .25);
457 // AddHistogram(ID(kHistCmpSigmaTOFkSemi), "#sigma comparison;exp #sigma;template #sigma",
458 // 200, 0., .25, 200, 0., .25);
459 // AddHistogram(ID(kHistCmpSigmaTOFpSemi), "#sigma comparison;exp #sigma;template #sigma",
460 // 200, 0., .25, 200, 0., .25);
461 // AddHistogram(ID(kHistCmpSigmaTOFdSemi), "#sigma comparison;exp #sigma;template #sigma",
462 // 200, 0., .25, 200, 0., .25);
3082e8ab 463
464 // Nsigma distributions
a4c7ef28 465 AddHistogram(ID(kHistNsigmaTPCTOF), "N_{#sigma,p} TPC-TOF;p (GeV/c);N_{#sigma,p}^{TPC};N_{#sigma,p}^{TOF}",
3082e8ab 466 100, 0., 10.,
467 100, -25., 25.,
ebdf1dbb 468 200, -100., 100.);
a4c7ef28 469 AddHistogram(ID(kHistNsigmaTPCTOFPt), "N_{#sigma,p} TPC-TOF;p_{T} (GeV/c);N_{#sigma,p}^{TPC};N_{#sigma,p}^{TOF}",
3082e8ab 470 100, 0., 10.,
471 100, -25., 25.,
ebdf1dbb 472 200, -100., 100.);
a4c7ef28 473 AddHistogram(ID(kHistNsigmaTPCTOFUsed), "N_{#sigma,p} TPC-TOF;p (GeV/c);N_{#sigma,p}^{TPC};N_{#sigma,p}^{TOF}",
3082e8ab 474 100, 0., 10.,
475 100, -25., 25.,
ebdf1dbb 476 200, -100., 100.);
a4c7ef28 477 AddHistogram(ID(kHistNsigmaTPCTOFUsedCentral), "N_{#sigma,p} TPC-TOF (central);p (GeV/c);N_{#sigma,p}^{TPC};N_{#sigma,p}^{TOF}",
3082e8ab 478 100, 0., 10.,
479 100, -25., 25.,
ebdf1dbb 480 200, -100., 100.);
a4c7ef28 481 AddHistogram(ID(kHistNsigmaTPCTOFUsedSemiCentral), "N_{#sigma,p} TPC-TOF (semi-central);p (GeV/c);N_{#sigma,p}^{TPC};N_{#sigma,p}^{TOF}",
3082e8ab 482 100, 0., 10.,
483 100, -25., 25.,
ebdf1dbb 484 200, -100., 100.);
a4c7ef28 485 AddHistogram(ID(kHistNsigmaTPCTOFUsedPt), "N_{#sigma,p} TPC-TOF;p_{T} (GeV/c);N_{#sigma,p}^{TPC};N_{#sigma,p}^{TOF}",
3082e8ab 486 50, 0., 10.,
487 100, -25., 25.,
ebdf1dbb 488 200, -100., 100.);
a4c7ef28 489 AddHistogram(ID(kHistNsigmaTPCTOFUsedPtCentral), "N_{#sigma,p} TPC-TOF;p_{T} (GeV/c);N_{#sigma,p}^{TPC};N_{#sigma,p}^{TOF}",
3082e8ab 490 50, 0., 10.,
491 100, -25., 25.,
ebdf1dbb 492 200, -100., 100.);
a4c7ef28 493 AddHistogram(ID(kHistNsigmaTPCTOFUsedPtSemiCentral), "N_{#sigma,p} TPC-TOF;p_{T} (GeV/c);N_{#sigma,p}^{TPC};N_{#sigma,p}^{TOF}",
3082e8ab 494 50, 0., 10.,
495 100, -25., 25.,
ebdf1dbb 496 200, -100., 100.);
3082e8ab 497
498 AddHistogram(ID(kHistEvPlane), "default event plane;#Psi;counts",
23536a91 499 100, -0. * TMath::Pi(), 1. * TMath::Pi());
3082e8ab 500 AddHistogram(ID(kHistEvPlaneUsed), "default event plane;#Psi;counts",
501 100, -0. * TMath::Pi(), 1. * TMath::Pi(),
502 kClLast, -.5, kClLast-.5);
503 AddHistogram(ID(kHistEvPlaneCheck), "backup event plane;#Psi;counts",
504 100, -1. * TMath::Pi(), 1. * TMath::Pi());
505 AddHistogram(ID(kHistEvPlaneCheckUsed), "backup event plane;#Psi;counts",
506 100, -0. * TMath::Pi(), 1. * TMath::Pi(),
507 kClLast, -.5, kClLast-.5);
a4c7ef28 508 AddHistogram(ID(kHistEvPlane3), "3rd order event plane;#Psi;counts",
509 100, -0. * TMath::Pi(), 2./3. * TMath::Pi());
ebdf1dbb 510 AddHistogram(ID(kHistEvPlaneCorr), "default - backup event plane;#Psi_{def};#Psi_{bak};event class",
511 100, -0. * TMath::Pi(), 1. * TMath::Pi(),
512 100, -0. * TMath::Pi(), 1. * TMath::Pi(),
513 kClLast, -.5, kClLast-.5);
514 AddHistogram(ID(kHistEvPlaneCorrNoTrgJets), "event plane w/ and w/o trigger jets;#Psi_{full};#Psi_{notrgjets};event class",
515 100, -0. * TMath::Pi(), 1. * TMath::Pi(),
516 100, -0. * TMath::Pi(), 1. * TMath::Pi(),
517 kClLast, -.5, kClLast-.5);
518 AddHistogram(ID(kHistEvPlaneCorrNoTrgJetsTrgd), "event plane w/ and w/o trigger jets;#Psi_{full};#Psi_{notrgjets};event class",
3082e8ab 519 100, -0. * TMath::Pi(), 1. * TMath::Pi(),
23536a91 520 100, -0. * TMath::Pi(), 1. * TMath::Pi(),
521 kClLast, -.5, kClLast-.5);
522
ebdf1dbb 523 AddHistogram(ID(kHistJetPtCentral), "jet spectrum - central;p_{T}^{jet,ch};counts",
3082e8ab 524 40, 0., 200.);
ebdf1dbb 525 AddHistogram(ID(kHistJetPtSemi), "jet spectrum - semi-peripheral;p_{T}^{jet,ch};counts",
23536a91 526 40, 0., 200.);
527
528 AddHistogram(ID(kHistEtaPhiTrgHad), "trg had;#varphi;#eta",
529 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
530 100, -2., 2.);
531 AddHistogram(ID(kHistEtaPhiTrgJet), "trg jet;#varphi;#eta",
532 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
533 100, -2., 2.);
534 AddHistogram(ID(kHistEtaPhiAssHad), "ass had;#varphi;#eta",
535 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
536 100, -2., 2.);
537 AddHistogram(ID(kHistEtaPhiAssProt), "ass proton;#varphi;#eta",
538 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
539 100, -2., 2.);
540
ebdf1dbb 541 AddHistogram(ID(kHistPhiTrgJetEvPlane), "trg jet;#varphi - #Psi_{ev};centrality",
542 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
21be932f 543 100, 0., 100.);
ebdf1dbb 544 AddHistogram(ID(kHistPhiTrgHadEvPlane), "trg had;#varphi - #Psi_{ev};centrality",
545 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
21be932f 546 100, 0., 100.);
ebdf1dbb 547 AddHistogram(ID(kHistPhiAssHadEvPlane), "ass had;#varphi - #Psi_{ev};centrality",
548 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
21be932f 549 100, 0., 100.);
ebdf1dbb 550 AddHistogram(ID(kHistPhiAssProtEvPlane), "ass prot;#varphi - #Psi_{ev};centrality",
551 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
21be932f 552 100, 0., 100.);
ebdf1dbb 553 AddHistogram(ID(kHistPhiAssHadVsEvPlane), "ass had;#Psi_{ev};#varphi;centrality",
554 100, -0. * TMath::Pi(), 1. * TMath::Pi(),
555 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
21be932f 556 100, 0., 100.);
ebdf1dbb 557
a4c7ef28 558 AddHistogram(ID(kHistPhiTrgJetEvPlane3), "trg jet;#varphi - #Psi_{ev};centrality",
559 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
21be932f 560 100, 0., 100.);
a4c7ef28 561 AddHistogram(ID(kHistPhiTrgHadEvPlane3), "trg had;#varphi - #Psi_{ev};centrality",
562 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
21be932f 563 100, 0., 100.);
a4c7ef28 564 AddHistogram(ID(kHistPhiAssHadEvPlane3), "ass had;#varphi - #Psi_{ev};centrality",
565 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
21be932f 566 100, 0., 100.);
a4c7ef28 567 AddHistogram(ID(kHistPhiAssProtEvPlane3), "ass prot;#varphi - #Psi_{ev};centrality",
568 100, -0. * TMath::Pi(), 2. * TMath::Pi(),
21be932f 569 100, 0., 100.);
a4c7ef28 570
23536a91 571 for (Int_t iCorr = 0; iCorr < kCorrLast; ++iCorr) {
572 for (Int_t iCl = 0; iCl < kClLast; ++iCl) {
573 for (Int_t iEv = 0; iEv < kEvLast; ++iEv) {
2751fb9a 574 // we don't need the mixed event histograms for the embedded excess particles
575 if ((iCorr > kCorrRndHadProt) && (iEv == kEvMix))
576 continue;
577
23536a91 578 GetHistCorr((CorrType_t) iCorr, (Class_t) iCl, (Ev_t) iEv) =
579 new AliHistCorr(Form("corr_%s_%s_%s", fkCorrTypeName[iCorr], fkClassName[iCl], fkEvName[iEv]), fOutputList);
580 }
581 }
582 }
583
584 PostData(1, fOutputList);
585}
586
587Bool_t AliAnalysisTaskJetProtonCorr::Notify()
588{
589 // actions to be taken upon notification about input file change
590
591 return AliAnalysisTaskSE::Notify();
592}
593
ebdf1dbb 594void AliAnalysisTaskJetProtonCorr::SetParamsTOF()
595{
596 fParamsTOF =
597 dynamic_cast<AliTOFPIDParams*> (fOADBContainerTOF->GetObject(fRunNumber, "TOFparams"));
598
599 if (!fParamsTOF)
600 AliError(Form("failed to load TOF parameters for run %i", fRunNumber));
601 else if (fDebug > 2) {
602 printf("loaded TOF parameters for run %i\n",
603 fRunNumber);
604 printf(" intrinsic resolution: %f ps\n",
605 fParamsTOF->GetTOFresolution());
606 printf(" tail fraction: %f\n",
607 fParamsTOF->GetTOFtail());
608 printf(" start time method: %i\n",
609 fParamsTOF->GetStartTimeMethod());
610 printf(" TOF signal parametrization: %f, %f, %f, %f\n",
611 fParamsTOF->GetSigParams(0), fParamsTOF->GetSigParams(1),
612 fParamsTOF->GetSigParams(2), fParamsTOF->GetSigParams(3));
613 printf(" matching loss MC: %f%%\n",
614 fParamsTOF->GetTOFmatchingLossMC());
615 printf(" additional mismatch for MC: %f%%\n",
616 fParamsTOF->GetTOFadditionalMismForMC());
617 printf(" time offset: %f\n",
618 fParamsTOF->GetTOFtimeOffset());
619 }
620}
621
23536a91 622void AliAnalysisTaskJetProtonCorr::UserExec(Option_t * /* option */)
623{
624 // actual work
625
626 // setup pointers to input data (null if unavailable)
627 // mcEvent: MC input
628 // esdEvent: ESD input
629 // outEvent: AOD output
630 // aodEvent: AOD input if available, otherwise AOD output
631
632 fMCEvent = this->MCEvent();
633 fESDEvent = dynamic_cast<AliESDEvent*>(this->InputEvent()); // could also be AOD input
634 AliAODEvent* outEvent = this->AODEvent();
635 fAODEvent = dynamic_cast<AliAODEvent*> (this->InputEvent());
636 if (!fAODEvent)
637 fAODEvent = outEvent;
638
639 if ((fDebug > 0) && fESDEvent)
640 printf("event: %s-%06i\n", CurrentFileName(), fESDEvent->GetEventNumberInFile());
641
642 // record number of sampled events and detect trigger contributions
643 FillH1(kHistStat, kStatSeen);
644 if (!DetectTriggers()) {
645 AliError("Failed to detect the triggers");
646 return;
647 }
648
649 if (!IsTrigger(kTriggerInt))
650 return;
651
652 FillH1(kHistStat, kStatTrg);
653
654 // prepare the event
655 // (make sure it is cleaned up in the end)
656 if (PrepareEvent()) {
657 FillH1(kHistStat, kStatUsed);
658 FillH1(kHistCentrality, fCentrality);
659 FillH1(kHistCentralityCheck, fCentralityCheck);
660
ebdf1dbb 661 FillH1(kHistVertexZ, fZvtx);
662
23536a91 663 // event cuts
664 if (TMath::Abs(fZvtx) > 10.)
665 goto stop;
666 if (GetCentrality() > 90.)
667 goto stop;
668
669 FillH1(kHistStat, kStatEvCuts);
670
671 // event category
672 DetectClasses();
3082e8ab 673 if (IsClass(kClCentral))
674 FillH1(kHistStat, kStatCentral);
675 if (IsClass(kClSemiCentral))
676 FillH1(kHistStat, kStatSemiCentral);
23536a91 677
ebdf1dbb 678 FillH1(kHistEvPlane, fEventPlaneAngle);
679 FillH1(kHistEvPlaneCheck, fEventPlaneAngleCheck);
a4c7ef28 680 FillH1(kHistEvPlane3, fEventPlaneAngle3);
23536a91 681 for (Int_t iClass = 0; iClass < kClLast; ++iClass) {
682 if (IsClass((Class_t) iClass)) {
683 FillH2(kHistCentralityUsed, fCentrality, iClass);
684 FillH2(kHistCentralityCheckUsed, fCentralityCheck, iClass);
ebdf1dbb 685 FillH2(kHistEvPlaneUsed, fEventPlaneAngle, iClass);
686 FillH2(kHistEvPlaneCheckUsed, fEventPlaneAngleCheck, iClass);
687 FillH3(kHistEvPlaneCorr, fEventPlaneAngle, fEventPlaneAngleCheck, iClass);
23536a91 688 }
689 }
690
3082e8ab 691 Bool_t corrEta = fPIDResponse->UseTPCEtaCorrection();
692 Bool_t corrMult = fPIDResponse->UseTPCMultiplicityCorrection();
693
23536a91 694 // select trigger particles and potential associated particles/protons
695 TObjArray trgArray[kTrgLast];
696 TObjArray assArray[kAssLast];
697
3082e8ab 698 TF1 fTOFsignal("fTOFsignal", &AliAnalysisTaskJetProtonCorr::TOFsignal, -2440., 2440., 4);
699 fTOFsignal.SetParameter(0, 1.);
700 fTOFsignal.SetParameter(1, 0.);
ebdf1dbb 701 if (fParamsTOF) {
702 Float_t res = fParamsTOF->GetTOFresolution();
703 Float_t tail = fParamsTOF->GetTOFtail() * res;
704 fTOFsignal.SetParameter(2, res);
705 fTOFsignal.SetParameter(3, tail);
706 }
707 else {
708 fTOFsignal.SetParameter(2, 85.);
709 fTOFsignal.SetParameter(3, 80.);
710 }
3082e8ab 711
a4c7ef28 712 // associate candidates
713 const Int_t nPrimTracksAss = fPrimTrackArrayAss ? fPrimTrackArrayAss->GetEntries() : 0;
714 FillH2(kHistCentralityVsMult, fCentrality, nPrimTracksAss);
715 for (Int_t iTrack = 0; iTrack < nPrimTracksAss; ++iTrack) {
716 AliVTrack *trk = (AliVTrack*) fPrimTrackArrayAss->At(iTrack);
ebdf1dbb 717 FillH2(kHistSignalTPC, trk->P(), trk->GetTPCsignal());
718 // ??? pt or p?
719 FillH2(kHistSignalTOF, trk->P(), trk->GetTOFsignal() * 1.e-3); // ps -> ns
23536a91 720 FillH3(kHistNsigmaTPCTOF,
3082e8ab 721 trk->P(),
722 fPIDResponse->NumberOfSigmasTPC(trk, AliPID::kProton),
723 fPIDResponse->NumberOfSigmasTOF(trk, AliPID::kProton));
724 FillH3(kHistNsigmaTPCTOFPt,
23536a91 725 trk->Pt(),
726 fPIDResponse->NumberOfSigmasTPC(trk, AliPID::kProton),
727 fPIDResponse->NumberOfSigmasTOF(trk, AliPID::kProton));
3082e8ab 728
ebdf1dbb 729 FillH3(kHistPhiAssHadVsEvPlane, fEventPlaneAngle, trk->Phi(), fCentrality);
730 Float_t phiRel = trk->Phi() - fEventPlaneAngle;
731 if (gRandom->Rndm() > .5)
732 phiRel -= TMath::Pi();
733 if (phiRel < 0.)
734 phiRel += 2. * TMath::Pi();
735 if (phiRel < 0.)
736 AliError(Form("phiRel = %f less than zero, from phi = %f, psi = %f",
737 phiRel, trk->Phi(), fEventPlaneAngle));
738 else if (phiRel > 2*TMath::Pi())
739 AliError(Form("phiRel = %f greater than 2pi, from phi = %f, psi = %f",
740 phiRel, trk->Phi(), fEventPlaneAngle));
a4c7ef28 741 Float_t phiRel3 = trk->Phi() - fEventPlaneAngle3;
742 if (phiRel3 < 0.)
743 phiRel3 += 2. * TMath::Pi();
ebdf1dbb 744
23536a91 745 if (AcceptAssoc(trk)) {
746 assArray[kAssHad].Add(trk);
747 FillH1(kHistEtaPhiAssHad, trk->Phi(), trk->Eta());
ebdf1dbb 748 FillH2(kHistPhiAssHadEvPlane, phiRel, fCentrality);
a4c7ef28 749 FillH2(kHistPhiAssHadEvPlane3, phiRel3, fCentrality);
3082e8ab 750 FillH3(kHistNsigmaTPCTOFUsed,
751 trk->P(),
752 fPIDResponse->NumberOfSigmasTPC(trk, AliPID::kProton),
753 fPIDResponse->NumberOfSigmasTOF(trk, AliPID::kProton));
754 FillH3(kHistNsigmaTPCTOFUsedPt,
755 trk->Pt(),
756 fPIDResponse->NumberOfSigmasTPC(trk, AliPID::kProton),
757 fPIDResponse->NumberOfSigmasTOF(trk, AliPID::kProton));
758 if (IsClass(kClCentral)) {
759 FillH3(kHistNsigmaTPCTOFUsedCentral,
760 trk->P(),
761 fPIDResponse->NumberOfSigmasTPC(trk, AliPID::kProton),
762 fPIDResponse->NumberOfSigmasTOF(trk, AliPID::kProton));
763 FillH3(kHistNsigmaTPCTOFUsedPtCentral,
764 trk->Pt(),
765 fPIDResponse->NumberOfSigmasTPC(trk, AliPID::kProton),
766 fPIDResponse->NumberOfSigmasTOF(trk, AliPID::kProton));
767 }
768 if (IsClass(kClSemiCentral)) {
ebdf1dbb 769 if (IsProton(trk))
770 FillH1(kHistEtaPhiAssProt, trk->Phi(), trk->Eta());
3082e8ab 771 FillH3(kHistNsigmaTPCTOFUsedSemiCentral,
772 trk->P(),
773 fPIDResponse->NumberOfSigmasTPC(trk, AliPID::kProton),
774 fPIDResponse->NumberOfSigmasTOF(trk, AliPID::kProton));
775 FillH3(kHistNsigmaTPCTOFUsedPtSemiCentral,
776 trk->Pt(),
777 fPIDResponse->NumberOfSigmasTPC(trk, AliPID::kProton),
778 fPIDResponse->NumberOfSigmasTOF(trk, AliPID::kProton));
779 }
23536a91 780 if (IsProton(trk)) {
781 assArray[kAssProt].Add(trk);
782 FillH1(kHistEtaPhiAssProt, trk->Phi(), trk->Eta());
ebdf1dbb 783 FillH2(kHistPhiAssProtEvPlane, phiRel, fCentrality);
a4c7ef28 784 FillH2(kHistPhiAssProtEvPlane3, phiRel3, fCentrality);
23536a91 785 }
3082e8ab 786
787 // template generation
788 Double_t deltaTPC;
789 fPIDResponse->GetSignalDelta(AliPIDResponse::kTPC, trk, AliPID::kProton, deltaTPC);
3082e8ab 790 if (fPIDResponse->CheckPIDStatus(AliPIDResponse::kTPC, trk) == AliPIDResponse::kDetPidOk) {
791 Double_t expTPC = fPIDResponse->GetTPCResponse().GetExpectedSignal(trk, AliPID::kProton, AliTPCPIDResponse::kdEdxDefault, corrEta, corrMult);
792 Double_t expSigmaTPC = fPIDResponse->GetTPCResponse().GetExpectedSigma(trk, AliPID::kProton, AliTPCPIDResponse::kdEdxDefault, corrEta, corrMult);
793
794 // loop over particles
795 for (Int_t iParticle = 0; iParticle <= AliPID::kDeuteron; ++iParticle) {
796 Double_t expTPCx = fPIDResponse->GetTPCResponse().GetExpectedSignal(trk, AliPID::EParticleType(iParticle), AliTPCPIDResponse::kdEdxDefault, corrEta, corrMult);
797 Double_t expSigmaTPCx = fPIDResponse->GetTPCResponse().GetExpectedSigma(trk, AliPID::EParticleType(iParticle), AliTPCPIDResponse::kdEdxDefault, corrEta, corrMult);
798 Double_t rndTPCx = gRandom->Gaus(expTPCx, expSigmaTPCx);
ebdf1dbb 799
800 if(IsClass(kClCentral)) {
3082e8ab 801 FillH2(kHistNsigmaTPCe, trk->P(), (rndTPCx-expTPC)/expSigmaTPC, 1., iParticle);
ebdf1dbb 802 FillH2(kHistDeltaTPC, trk->P(), deltaTPC);
803 }
804 if(IsClass(kClSemiCentral)) {
3082e8ab 805 FillH2(kHistNsigmaTPCeSemi, trk->P(), (rndTPCx-expTPC)/expSigmaTPC, 1., iParticle);
ebdf1dbb 806 FillH2(kHistDeltaTPCSemi, trk->P(), deltaTPC);
807 }
3082e8ab 808 }
809 }
810
811 Double_t deltaTOF;
812 fPIDResponse->GetSignalDelta(AliPIDResponse::kTOF, trk, AliPID::kProton, deltaTOF);
3082e8ab 813 if (fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF, trk) == AliPIDResponse::kDetPidOk) {
814 AliTOFPIDResponse &tofResponse = fPIDResponse->GetTOFResponse();
815
ebdf1dbb 816 Float_t p = trk->P();
817 if (const AliExternalTrackParam *param = trk->GetInnerParam())
818 p = param->GetP();
3082e8ab 819
820 Double_t expTOF = fPIDResponse->GetTOFResponse().GetExpectedSignal(trk, AliPID::kProton);
821 Double_t expSigmaTOF = fPIDResponse->GetTOFResponse().GetExpectedSigma(p, expTOF, AliPID::kProton);
822 Double_t length = trk->GetIntegratedLength() * 1.e-2; // cm -> m
823 Double_t tof = trk->GetTOFsignal() * 1.e-12; // ps -> s
824 Double_t beta = length / tof / TMath::C();
825
826 FillH2(kHistBetaTOF, p, beta);
827
828 // intrinsic TOF smearing
ebdf1dbb 829 // Double_t signalSigma = TMath::Sqrt(fTOFsignal.Variance(-2000., 2000.));
3082e8ab 830 Double_t signalSmear = fTOFsignal.GetRandom();
831 // t0 smearing
832 Float_t timezeroSigma = tofResponse.GetT0binRes(tofResponse.GetMomBin(p));
833 Double_t timezeroSmear = gRandom->Gaus(0., timezeroSigma);
ebdf1dbb 834 // tracking smearing (default parameters, should be overwritten from OADB)
3082e8ab 835 Double_t fPar[] = { 0.008, 0.008, 0.002, 40.0 };
ebdf1dbb 836 if (fParamsTOF)
837 for (Int_t i = 0; i < 4; ++i)
838 fPar[i] = fParamsTOF->GetSigParams(i);
3082e8ab 839
840 // loop over particles
841 for (Int_t iParticle = 0; iParticle <= AliPID::kDeuteron; ++iParticle) {
842 Double_t expTOFx = fPIDResponse->GetTOFResponse().GetExpectedSignal(trk, AliPID::EParticleType(iParticle));
ebdf1dbb 843 // Double_t cmpSigmaTOFx = fPIDResponse->GetTOFResponse().GetExpectedSigma(p, expTOFx, AliPID::EParticleType(iParticle));
3082e8ab 844
845 // tracking smearing
846 Double_t massx = AliPID::ParticleMassZ(AliPID::EParticleType(iParticle));
847 Double_t dppx = fPar[0] + fPar[1] * p + fPar[2] * massx / p;
848 Double_t expSigmaTOFx = dppx * expTOFx / (1.+ p * p / (massx * massx));
849 Double_t texpSmearx = gRandom->Gaus(0., TMath::Sqrt(expSigmaTOFx * expSigmaTOFx + fPar[3]*fPar[3]/p/p));
ebdf1dbb 850 // Double_t tmpSigmaTOFx = TMath::Sqrt(signalSigma*signalSigma +
851 // timezeroSigma*timezeroSigma +
852 // expSigmaTOFx*expSigmaTOFx + fPar[3]*fPar[3]/p/p);
3082e8ab 853 // printf("sigma comparison %i, %f: %f, %f, %f -> %f vs %f\n",
854 // iParticle, expTOFx,
855 // signalSigma, // signal
856 // timezeroSigma, // timezero
857 // expSigmaTOFx, // tracking
858 // tmpSigmaTOFx, // total
859 // cmpSigmaTOFx); // from PID response
860
861 // TOF signal
862 Double_t rndTOFx = expTOFx + signalSmear + timezeroSmear + texpSmearx;
863
864 if (IsClass(kClCentral)) {
865 FillH2(kHistNsigmaTOFe, trk->P(), (rndTOFx-expTOF)/expSigmaTOF, 1., iParticle);
866 FillH2(kHistDeltaTOFe, trk->P(), (rndTOFx-expTOF) * 1.e-3, 1., iParticle);
ebdf1dbb 867 // FillH2(kHistExpSigmaTOFe, p, cmpSigmaTOFx * 1.e-3, 1., iParticle);
868 // FillH2(kHistCmpSigmaTOFe, cmpSigmaTOFx * 1.e-3, tmpSigmaTOFx * 1.e-3, 1., iParticle);
3082e8ab 869 }
870 if (IsClass(kClSemiCentral)) {
871 FillH2(kHistNsigmaTOFeSemi, trk->P(), (rndTOFx-expTOF)/expSigmaTOF, 1., iParticle);
872 FillH2(kHistDeltaTOFeSemi, trk->P(), (rndTOFx-expTOF) * 1.e-3, 1., iParticle);
ebdf1dbb 873 // FillH2(kHistCmpSigmaTOFeSemi, cmpSigmaTOFx * 1.e-3, tmpSigmaTOFx * 1.e-3, 1., iParticle);
874 // FillH2(kHistExpSigmaTOFeSemi, p, cmpSigmaTOFx * 1.e-3, 1., iParticle);
3082e8ab 875 }
876 }
877
878 Double_t rndTOFmismatch = AliTOFPIDResponse::GetMismatchRandomValue(trk->Eta());
879
880 if(IsClass(kClCentral)) {
d57e2346 881 FillH2(kHistNsigmaTOFmismatch, trk->P(), (rndTOFmismatch - expTOF) / expSigmaTOF);
3082e8ab 882 FillH2(kHistDeltaTOF, trk->P(), deltaTOF * 1.e-3); // ps -> ns
883 }
884 if(IsClass(kClSemiCentral)) {
d57e2346 885 FillH2(kHistNsigmaTOFmismatchSemi, trk->P(), (rndTOFmismatch - expTOF) / expSigmaTOF);
3082e8ab 886 FillH2(kHistDeltaTOFSemi, trk->P(), deltaTOF * 1.e-3); // ps -> ns
887 }
888 }
23536a91 889 }
890 }
891
a4c7ef28 892 const Int_t nPrimTracksTrg = fPrimTrackArrayTrg ? fPrimTrackArrayTrg->GetEntries() : 0;
893 for (Int_t iTrack = 0; iTrack < nPrimTracksTrg; ++iTrack) {
894 AliVTrack *trk = (AliVTrack*) fPrimTrackArrayTrg->At(iTrack);
895 if (AcceptTrigger(trk)) {
896 trgArray[kTrgHad].Add(trk);
897 FillH1(kHistEtaPhiTrgHad, trk->Phi(), trk->Eta());
898 }
899 }
900
23536a91 901 // select trigger jet
ebdf1dbb 902 // and remove them from the Q vector
23536a91 903 Int_t nJets = fJetArray ? fJetArray->GetEntries() : 0;
a4c7ef28 904 const TVector2 *qVectorOrig = fEventplane->GetQVector();
905 TVector2 qVector;
906 if (qVectorOrig)
907 qVector = *qVectorOrig;
ebdf1dbb 908
23536a91 909 for (Int_t iJet = 0; iJet < nJets; ++iJet) {
910 AliAODJet *jet = (AliAODJet*) fJetArray->At(iJet);
ebdf1dbb 911
23536a91 912 if (AcceptTrigger(jet)) {
913 trgArray[kTrgJet].Add(jet);
914 FillH1(kHistEtaPhiTrgJet, jet->Phi(), jet->Eta());
ebdf1dbb 915
a4c7ef28 916 if (qVectorOrig) {
ebdf1dbb 917 Int_t nRefTracks = jet->GetRefTracks()->GetEntriesFast();
918 for (Int_t iTrack = 0; iTrack < nRefTracks; ++iTrack) {
919 AliVTrack *track = (AliVTrack*) jet->GetRefTracks()->At(iTrack);
920
921 if (fEventplane) {
922 TVector2 evplaneContrib(fEventplane->GetQContributionX(track),
923 fEventplane->GetQContributionY(track));
a4c7ef28 924 qVector -= evplaneContrib;
ebdf1dbb 925 }
926 }
927 }
928 }
929 }
a4c7ef28 930 if (qVectorOrig) {
ebdf1dbb 931 for (Int_t iClass = 0; iClass < kClLast; ++iClass) {
932 if (IsClass((Class_t) iClass)) {
a4c7ef28 933 FillH3(kHistEvPlaneCorrNoTrgJets, qVectorOrig->Phi()/2., qVector.Phi()/2., iClass);
ebdf1dbb 934 if (trgArray[kTrgJet].GetEntriesFast() > 0)
a4c7ef28 935 FillH3(kHistEvPlaneCorrNoTrgJetsTrgd, qVectorOrig->Phi()/2., qVector.Phi()/2., iClass);
ebdf1dbb 936 }
23536a91 937 }
938 }
939
ebdf1dbb 940 // invent a trigger jet/hadron and correlated associates
941 Float_t pFraction = assArray[kAssHad].GetEntries() > 0 ?
942 (Float_t) (assArray[kAssProt].GetEntries()) / assArray[kAssHad].GetEntries() :
943 .5;
944 GenerateRandom(&trgArray[kTrgJetRnd], &trgArray[kTrgHadRnd],
945 &assArray[kAssHadJetExc], &assArray[kAssProtJetExc],
946 &assArray[kAssHadHadExc], &assArray[kAssProtHadExc],
947 pFraction);
948
23536a91 949 // correlate, both same and mixed event
950 for (Int_t iClass = 0; iClass < kClLast; ++iClass) {
951 if (IsClass((Class_t) iClass)) {
952 for (Int_t iTrg = 0; iTrg < kTrgLast; ++iTrg) {
ebdf1dbb 953 for (Int_t iAss = 0; iAss <= kAssProt; ++iAss) {
23536a91 954 // same event
955 Correlate((Trg_t) iTrg, (Ass_t) iAss, (Class_t) iClass, kEvSame, &trgArray[iTrg], &assArray[iAss]);
956
957 // mixed event
2751fb9a 958 AliEventPool *pool = GetPool((Ass_t) iAss);
23536a91 959 if (pool && pool->IsReady()) {
2751fb9a 960 AliDebug(1, Form("----- using pool: %i %i %i -----", iClass, iTrg, iAss));
961 const Int_t nEvents = pool->GetCurrentNEvents();
23536a91 962 for (Int_t iEvent = 0; iEvent < nEvents; ++iEvent) {
963 TObjArray *assTracks = pool->GetEvent(iEvent);
964 Correlate((Trg_t) iTrg, (Ass_t) iAss, (Class_t) iClass, kEvMix, &trgArray[iTrg], assTracks, 1./nEvents);
965 }
966 }
23536a91 967 }
2751fb9a 968 }
23536a91 969
2751fb9a 970 // fill event pool for mixing
971 // >= 0: don't require a trigger in the event
972 // >= 1: require a trigger in the event
973 // if (trgArray[iTrg].GetEntries() >= 0) {
974 for (Int_t iAss = 0; iAss <= kAssProt; ++iAss) {
975 AliEventPool *pool = GetPool((Ass_t) iAss);
976 if (pool) {
977 pool->UpdatePool(CloneTracks(&assArray[iAss]));
978 AliDebug(1, Form("----- updating pool: %i -----", iAss));
979 if (fDebug > 0)
980 pool->PrintInfo();
23536a91 981 }
982 }
2751fb9a 983 // }
984
ebdf1dbb 985 // correlate artificial triggers and associates
986 Correlate(kCorrRndJetExcHad, (Class_t) iClass, kEvSame, &trgArray[kTrgJetRnd], &assArray[kAssHadJetExc]);
987 Correlate(kCorrRndJetExcProt, (Class_t) iClass, kEvSame, &trgArray[kTrgJetRnd], &assArray[kAssProtJetExc]);
988 Correlate(kCorrRndHadExcHad, (Class_t) iClass, kEvSame, &trgArray[kTrgHadRnd], &assArray[kAssHadHadExc]);
989 Correlate(kCorrRndHadExcProt, (Class_t) iClass, kEvSame, &trgArray[kTrgHadRnd], &assArray[kAssProtHadExc]);
23536a91 990 }
991 }
ebdf1dbb 992
993 trgArray[kTrgJetRnd].Delete();
994 trgArray[kTrgHadRnd].Clear();
995 assArray[kAssHadJetExc].Delete();
996 assArray[kAssProtJetExc].Clear();
997 assArray[kAssHadHadExc].Delete();
998 assArray[kAssProtHadExc].Clear();
23536a91 999 }
1000
1001 stop:
1002 CleanUpEvent();
1003
1004 PostData(1, fOutputList);
1005}
1006
1007void AliAnalysisTaskJetProtonCorr::Terminate(const Option_t * /* option */)
1008{
1009 // actions at task termination
1010
1011}
1012
3082e8ab 1013void AliAnalysisTaskJetProtonCorr::PrintTask(Option_t *option, Int_t indent) const
1014{
1015 AliAnalysisTaskSE::PrintTask(option, indent);
1016
1017 std::cout << std::setw(indent) << " " << "using jet branch: " << fJetBranchName << std::endl;
1018}
1019
23536a91 1020Bool_t AliAnalysisTaskJetProtonCorr::DetectTriggers()
1021{
1022 fTriggerMask = 0;
1023
ebdf1dbb 1024 AliVEvent::EOfflineTriggerTypes physSel =
1025 (AliVEvent::EOfflineTriggerTypes) ((AliInputEventHandler*) (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->IsEventSelected();
23536a91 1026 TString trgClasses = InputEvent()->GetFiredTriggerClasses();
1027
1028 // physics selection
1029 if (physSel & (AliVEvent::kAnyINT | AliVEvent::kCentral | AliVEvent::kSemiCentral))
1030 MarkTrigger(kTriggerInt);
1031
1032 return kTRUE;
1033}
1034
1035Bool_t AliAnalysisTaskJetProtonCorr::DetectClasses()
1036{
1037 fClassMask = 0;
1038
1039 if (IsCentral())
1040 MarkClass(kClCentral);
1041
1042 if (IsSemiCentral())
1043 MarkClass(kClSemiCentral);
1044
1045 return kTRUE;
1046}
1047
1048Bool_t AliAnalysisTaskJetProtonCorr::PrepareEvent()
1049{
1050 Bool_t eventGood = kTRUE;
1051
ebdf1dbb 1052 // check for run change
1053 if (fRunNumber != InputEvent()->GetRunNumber()) {
1054 fRunNumber = InputEvent()->GetRunNumber();
1055 SetParamsTOF();
1056 }
1057
23536a91 1058 // retrieve z-vertex position
ebdf1dbb 1059 fZvtx = 100.;
23536a91 1060 const AliVVertex *vtx = InputEvent()->GetPrimaryVertex();
ebdf1dbb 1061 if (vtx) {
1062 FillH1(kHistStat, kStatVtx);
1063 FillH1(kHistVertexNctb, vtx->GetNContributors());
1064 if (vtx->GetNContributors() >= 3.)
1065 fZvtx = vtx->GetZ();
1066 }
23536a91 1067
1068 // retrieve centrality
1069 AliCentrality *eventCentrality = InputEvent()->GetCentrality();
1070 if (eventCentrality) {
1071 fCentrality = eventCentrality->GetCentralityPercentile("V0M");
1072 fCentralityCheck = eventCentrality->GetCentralityPercentile("TRK");
1073 if (fCentrality >= 0.) {
1074 FillH1(kHistStat, kStatCent);
1075 } else {
1076 // centrality estimation not reliable
1077 eventGood = kFALSE;
1078 fCentrality = 105.;
1079 }
1080 }
3082e8ab 1081 else
1082 eventGood = kFALSE;
23536a91 1083
1084 // retrieve event plane
ebdf1dbb 1085 fEventplane = InputEvent()->GetEventplane();
1086 if (fEventplane) {
a4c7ef28 1087 fEventPlaneAngle3 = fEventplane->GetEventplane("V0", InputEvent(), 3);
ebdf1dbb 1088
a4c7ef28 1089 if (fUseEvplaneV0) {
1090 fEventPlaneAngle = fEventplane->GetEventplane("V0", InputEvent());
1091 fEventPlaneAngleCheck = fEventplane->GetEventplane("Q");
1092 }
1093 else {
1094 fEventPlaneAngle = fEventplane->GetEventplane("Q");
1095 fEventPlaneAngleCheck = fEventplane->GetEventplane("V0", InputEvent());
1096 // use V0 event plane angle from flow task:
1097 // fEventPlaneAngleCheck = AliAnalysisTaskVnV0::GetPsi2V0A();
1098 // printf("V0A evplane = %f\n", fEventPlaneAngleCheck);
1099 // fEventPlaneAngleCheck = AliAnalysisTaskVnV0::GetPsi2V0C();
1100 // printf("V0C evplane = %f\n", fEventPlaneAngleCheck);
1101 }
1102
1103 // ensure angles to be in [0, ...)
1104 if (fEventPlaneAngle3 < 0)
1105 fEventPlaneAngle3 += 2.*TMath::Pi()/3.;
1106 if (fEventPlaneAngle < 0)
1107 fEventPlaneAngle += TMath::Pi();
ebdf1dbb 1108 if (fEventPlaneAngleCheck < 0)
1109 fEventPlaneAngleCheck += TMath::Pi();
a4c7ef28 1110
1111 FillH1(kHistStat, kStatEvPlane);
23536a91 1112 }
1113 else
1114 eventGood = kFALSE;
1115
1116 // retrieve PID
1117 fPIDResponse = ((AliInputEventHandler*) (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler()))->GetPIDResponse();
1118 if (fPIDResponse)
1119 FillH1(kHistStat, kStatPID);
1120 else
1121 eventGood = kFALSE;
1122
1123 // retrieve primary tracks
1124 if (fESDEvent) {
a4c7ef28 1125 fPrimTrackArrayAss = fCutsPrimAss->GetAcceptedTracks(fESDEvent);
1126 fPrimTrackArrayTrg = fCutsPrimTrg->GetAcceptedTracks(fESDEvent);
1127 if (fCutsPrimTrgConstrain) {
1128 TIter trkIter(fCutsPrimTrgConstrain->GetAcceptedTracks(fESDEvent));
1129 while (AliESDtrack *trk = (AliESDtrack*) trkIter()) {
1130 if (!fCutsPrimTrg->IsSelected(trk)) {
1131 AliESDtrack *track = (AliESDtrack*) fPrimConstrainedTrackArray->ConstructedAt(fPrimConstrainedTrackArray->GetEntriesFast());
1132 if(trk->GetConstrainedParam()) {
1133 track->Set(trk->GetConstrainedParam()->GetX(),
1134 trk->GetConstrainedParam()->GetAlpha(),
1135 trk->GetConstrainedParam()->GetParameter(),
1136 trk->GetConstrainedParam()->GetCovariance());
1137 }
1138 fPrimTrackArrayTrg->Add(track);
1139 }
1140 }
1141 }
23536a91 1142 }
1143 else if (fAODEvent) {
a4c7ef28 1144 // associate candidates
1145 fPrimTrackArrayAss = new TObjArray();
1146 const Int_t nTracksAODAss = fAODEvent->GetNumberOfTracks();
1147 for (Int_t iTrack = 0; iTrack < nTracksAODAss; ++iTrack) {
23536a91 1148 AliAODTrack *trk = fAODEvent->GetTrack(iTrack);
d57e2346 1149 if (trk->TestFilterMask(fAssFilterMask))
a4c7ef28 1150 fPrimTrackArrayAss->Add(trk);
1151 }
1152
1153 // trigger candidates
1154 fPrimTrackArrayTrg = new TObjArray();
1155 const Int_t nTracksAODTrg = fAODEvent->GetNumberOfTracks();
1156 for (Int_t iTrack = 0; iTrack < nTracksAODTrg; ++iTrack) {
1157 AliAODTrack *trk = fAODEvent->GetTrack(iTrack);
1158 if (trk->IsHybridGlobalConstrainedGlobal())
1159 fPrimTrackArrayTrg->Add(trk);
23536a91 1160 }
1161 }
1162 else
1163 eventGood = kFALSE;
1164
1165 // retrieve jet array
1166 if (fAODEvent) {
1167 fJetArray = dynamic_cast<TClonesArray*> (fAODEvent->FindListObject(fJetBranchName));
1168 if (!fJetArray) {
2751fb9a 1169 // still try the output event
1170 if (AODEvent())
1171 fJetArray = dynamic_cast<TClonesArray*> (AODEvent()->FindListObject(fJetBranchName));
1172 if (!fJetArray) {
d57e2346 1173 if (fErrorMsg > 0) {
1174 AliError(Form("no jet branch \"%s\" found, in the AODs are:", fJetBranchName));
1175 --fErrorMsg;
1176 }
2751fb9a 1177 if (fDebug > 0) {
1178 fAODEvent->GetList()->Print();
1179 if (AODEvent())
1180 AODEvent()->GetList()->Print();
1181 }
1182 }
23536a91 1183 }
1184 }
1185
1186 // retrieve event pool for the event category
1187 if (eventGood) {
2751fb9a 1188 for (Int_t iAss = 0; iAss <= kAssProt; ++iAss) {
1189 AliEventPoolManager *mgr = GetPoolMgr((Ass_t) iAss);
1190 GetPool((Ass_t) iAss) =
1191 // mgr ? mgr->GetEventPool(fCentrality, fZvtx, fEventPlaneAngle) : 0x0;
1192 mgr ? mgr->GetEventPool(fCentrality, fZvtx) : 0x0;
23536a91 1193 }
1194 }
1195
1196 return eventGood;
1197}
1198
d57e2346 1199Bool_t AliAnalysisTaskJetProtonCorr::AcceptTrigger(const AliVTrack *trg)
23536a91 1200{
ebdf1dbb 1201 // check pt interval
1202 Bool_t acceptPt =
1203 (trg->Pt() >= fTrgPartPtMin) &&
1204 (trg->Pt() <= fTrgPartPtMax);
1205
1206 // for semi-central events check phi w.r.t. event plane
1207 Bool_t acceptOrientation = IsSemiCentral() ?
1208 AcceptAngleToEvPlane(trg->Phi(), GetEventPlaneAngle()) :
1209 kTRUE;
1210
1211 if (acceptPt) {
1212 Float_t phiRel = trg->Phi() - fEventPlaneAngle;
1213 if (gRandom->Rndm() > .5)
1214 phiRel -= TMath::Pi();
1215 if (phiRel < 0.)
1216 phiRel += 2. * TMath::Pi();
a4c7ef28 1217 Float_t phiRel3 = trg->Phi() - fEventPlaneAngle3;
1218 if (phiRel3 < 0.)
1219 phiRel3 += 2. * TMath::Pi();
ebdf1dbb 1220 FillH2(kHistPhiTrgHadEvPlane, phiRel, fCentrality);
a4c7ef28 1221 FillH2(kHistPhiTrgHadEvPlane3, phiRel3, fCentrality);
23536a91 1222 }
1223
ebdf1dbb 1224 return (acceptPt && acceptOrientation);
23536a91 1225}
1226
d57e2346 1227AliVTrack* AliAnalysisTaskJetProtonCorr::GetLeadingTrack(const AliAODJet *jet) const
23536a91 1228{
3082e8ab 1229 // return leading track within a jet
1230
1231 // check contributing tracks
1232 Int_t nJetTracks = jet->GetRefTracks()->GetEntriesFast();
1233 Int_t iLeadingTrack = -1;
1234 Float_t ptLeadingTrack = 0.;
1235 for (Int_t iTrack=0; iTrack < nJetTracks; ++iTrack) {
1236 AliAODTrack *track = (AliAODTrack*) jet->GetRefTracks()->At(iTrack);
1237 // find the leading track
1238 if (track->Pt() > ptLeadingTrack) {
1239 ptLeadingTrack = track->Pt();
1240 iLeadingTrack = iTrack;
23536a91 1241 }
1242 }
1243
3082e8ab 1244 // retrieve the leading track
1245 return (AliAODTrack*) jet->GetRefTracks()->At(iLeadingTrack);
23536a91 1246}
1247
d57e2346 1248Bool_t AliAnalysisTaskJetProtonCorr::AcceptTrigger(const AliAODJet *trg)
23536a91 1249{
3082e8ab 1250 // restrict eta
d57e2346 1251 if (TMath::Abs(trg->Eta()) > fTrgJetEtaMax)
1252 return kFALSE;
1253
1254 // reject too small jets
1255 if (trg->EffectiveAreaCharged() < fTrgJetAreaMin)
3082e8ab 1256 return kFALSE;
1257
1258 // require hard leading track
ebdf1dbb 1259 // (leading track biased jet sample)
d57e2346 1260 // but reject jets with too high pt constituents
1261 const Float_t ptLeadTrack = GetLeadingTrack(trg)->Pt();
1262 if ((ptLeadTrack < fTrgJetLeadTrkPtMin) ||
1263 (ptLeadTrack > fTrgJetLeadTrkPtMax))
3082e8ab 1264 return kFALSE;
1265
ebdf1dbb 1266 // check for jet orientation w.r.t. event plane
1267 // (constrained only for semi-central events)
1268 Bool_t acceptOrientation = IsSemiCentral() ?
1269 AcceptAngleToEvPlane(trg->Phi(), GetEventPlaneAngle()) :
1270 kTRUE;
d57e2346 1271
ebdf1dbb 1272 // check for jet pt
1273 Bool_t acceptPt =
1274 (trg->Pt() >= fTrgJetPtMin) &&
1275 (trg->Pt() <= fTrgJetPtMax);
1276
1277 if (acceptPt) {
1278 // store the azimuthal distribution relative to the event plane
1279 // for the jets in the pt range of interest
1280 Float_t phiRel = trg->Phi() - fEventPlaneAngle;
1281 if (gRandom->Rndm() > .5)
1282 phiRel -= TMath::Pi();
1283 if (phiRel < 0.)
1284 phiRel += 2. * TMath::Pi();
a4c7ef28 1285 Float_t phiRel3 = trg->Phi() - fEventPlaneAngle3;
1286 if (phiRel3 < 0.)
1287 phiRel3 += 2. * TMath::Pi();
ebdf1dbb 1288 FillH2(kHistPhiTrgJetEvPlane, phiRel, fCentrality);
a4c7ef28 1289 FillH2(kHistPhiTrgJetEvPlane3, phiRel3, fCentrality);
3082e8ab 1290 }
1291
ebdf1dbb 1292 if (acceptOrientation) {
1293 // spectrum for cross checks
1294 if (IsClass(kClCentral))
1295 FillH1(kHistJetPtCentral, trg->Pt());
1296 if (IsClass(kClSemiCentral))
1297 FillH1(kHistJetPtSemi, trg->Pt());
1298 }
3082e8ab 1299
ebdf1dbb 1300 return (acceptPt && acceptOrientation);
3082e8ab 1301}
1302
d57e2346 1303Bool_t AliAnalysisTaskJetProtonCorr::AcceptAssoc(const AliVTrack *trk) const
3082e8ab 1304{
1305 if ((trk->Pt() > fAssPartPtMin) && (trk->Pt() < fAssPartPtMax) &&
1306 (fPIDResponse->CheckPIDStatus(AliPIDResponse::kTPC, trk) == AliPIDResponse::kDetPidOk) &&
1307 (fPIDResponse->CheckPIDStatus(AliPIDResponse::kTOF, trk) == AliPIDResponse::kDetPidOk))
1308 if ((trk->GetTPCsignalN() >= 60.) &&
1309 (trk->GetTPCsignal() >= 10) &&
1310 (TMath::Abs(trk->Eta()) < .9))
1311 return kTRUE;
23536a91 1312
1313 return kFALSE;
1314}
1315
d57e2346 1316Bool_t AliAnalysisTaskJetProtonCorr::IsProton(const AliVTrack *trk) const
23536a91 1317{
1318 Double_t nSigmaProtonTPC = fPIDResponse->NumberOfSigmasTPC(trk, AliPID::kProton);
1319 Double_t nSigmaProtonTOF = fPIDResponse->NumberOfSigmasTOF(trk, AliPID::kProton);
1320
1321 if ((TMath::Abs(nSigmaProtonTPC) <= 2.) && (TMath::Abs(nSigmaProtonTOF) <= 2.)) {
1322 return kTRUE;
1323 }
1324
1325 return kFALSE;
1326}
1327
d57e2346 1328Bool_t AliAnalysisTaskJetProtonCorr::AcceptAngleToEvPlane(Float_t phi, Float_t psi) const
23536a91 1329{
3082e8ab 1330 Float_t deltaPhi = phi - psi;
a4c7ef28 1331 while (deltaPhi < 0.)
1332 deltaPhi += 2 * TMath::Pi();
23536a91 1333
3082e8ab 1334 // map to interval [-pi/2, pi/2)
1335 deltaPhi = std::fmod(deltaPhi + TMath::Pi()/2., TMath::Pi()) - TMath::Pi()/2.;
1336 // printf("delta phi = %f with phi = %f, psi = %f\n", deltaPhi, phi, psi);
23536a91 1337
3082e8ab 1338 if (TMath::Abs(deltaPhi) < fTrgAngleToEvPlane)
1339 return kTRUE;
1340 else
1341 return kFALSE;
1342}
23536a91 1343
3082e8ab 1344Float_t AliAnalysisTaskJetProtonCorr::GetDPhiStar(Float_t phi1, Float_t pt1, Float_t charge1,
1345 Float_t phi2, Float_t pt2, Float_t charge2,
d57e2346 1346 Float_t radius, Float_t bSign) const
3082e8ab 1347{
1348 // calculates dphistar
1349 // from AliUEHistograms
1350
1351 Float_t dphistar = phi1 - phi2
1352 - charge1 * bSign * TMath::ASin(0.075 * radius / pt1)
1353 + charge2 * bSign * TMath::ASin(0.075 * radius / pt2);
1354
1355 static const Double_t kPi = TMath::Pi();
1356
1357 // circularity
1358 if (dphistar > kPi)
1359 dphistar = kPi * 2 - dphistar;
1360 if (dphistar < -kPi)
1361 dphistar = -kPi * 2 - dphistar;
1362 if (dphistar > kPi) // might look funny but is needed
1363 dphistar = kPi * 2 - dphistar;
1364
1365 return dphistar;
1366}
1367
1368
d57e2346 1369Bool_t AliAnalysisTaskJetProtonCorr::AcceptTwoTracks(const AliVParticle *trgPart, const AliVParticle *assPart) const
3082e8ab 1370{
1371 // apply two track pair cut
1372
1373 Float_t phi1 = trgPart->Phi();
1374 Float_t pt1 = trgPart->Pt();
1375 Float_t charge1 = trgPart->Charge();
1376
1377 Float_t phi2 = assPart->Phi();
1378 Float_t pt2 = assPart->Pt();
1379 Float_t charge2 = assPart->Charge();
1380
3082e8ab 1381 Float_t deta = trgPart->Eta() - assPart->Eta();
1382
2751fb9a 1383 Float_t bSign = (InputEvent()->GetMagneticField() > 0) ? 1 : -1;
1384
3082e8ab 1385 // optimization
2751fb9a 1386 if (TMath::Abs(deta) < fCutsTwoTrackEff) {
3082e8ab 1387 // check first boundaries to see if is worth to loop and find the minimum
1388 Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSign);
1389 Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign);
1390
1391 const Float_t kLimit = fCutsTwoTrackEff * 3;
1392
1393 Float_t dphistarminabs = 1e5;
1394 // Float_t dphistarmin = 1e5;
1395 if ((TMath::Abs(dphistar1) < kLimit) ||
1396 (TMath::Abs(dphistar2) < kLimit) ||
1397 (dphistar1 * dphistar2 < 0)) {
1398 for (Double_t rad=0.8; rad<2.51; rad+=0.01) {
2751fb9a 1399 Float_t dphistarabs = TMath::Abs(GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSign));
1400 if (dphistarabs < dphistarminabs)
3082e8ab 1401 dphistarminabs = dphistarabs;
3082e8ab 1402 }
1403
2751fb9a 1404 if (dphistarminabs < fCutsTwoTrackEff)
3082e8ab 1405 return kFALSE;
23536a91 1406 }
1407 }
1408
1409 return kTRUE;
1410}
1411
3082e8ab 1412Bool_t AliAnalysisTaskJetProtonCorr::Correlate(CorrType_t corr, Class_t cl, Ev_t ev,
23536a91 1413 TCollection *trgArray, TCollection *assArray, Float_t weight)
1414{
23536a91 1415 AliHistCorr *histCorr = GetHistCorr(corr, cl, ev);
ebdf1dbb 1416 if (!histCorr) {
1417 AliError(Form("no correlation histograms for corr %i, cl %i, ev %i",
1418 corr, cl, ev));
1419 return kFALSE;
1420 }
23536a91 1421
ebdf1dbb 1422 TIter assIter(assArray);
1423 while (TObject *assObj = assIter()) {
1424 if (dynamic_cast<AliVParticle*> (assObj)) {
1425 AliVParticle *assPart = (AliVParticle*) assObj;
1426 histCorr->Ass(assPart->Phi(), assPart->Eta(), weight);
1427 }
1428 else if (dynamic_cast<TLorentzVector*> (assObj)) {
1429 TLorentzVector *assVec = (TLorentzVector*) assObj;
1430 histCorr->Ass(assVec->Phi(), assVec->Eta(), weight);
1431 }
1432 }
23536a91 1433
ebdf1dbb 1434 TIter trgIter(trgArray);
1435 while (TObject *trgObj = trgIter()) {
1436 if (AliVParticle *trgPart = dynamic_cast<AliVParticle*> (trgObj)) {
1437 // count the trigger
1438 histCorr->Trigger(trgPart->Phi(), trgPart->Eta(), weight);
1439
1440 // loop over associates
1441 assIter.Reset();
1442 while (TObject *assObj = assIter()) {
1443 if (AliVParticle *assPart = dynamic_cast<AliVParticle*> (assObj)) {
1444 if (AcceptTwoTracks(trgPart, assPart))
1445 histCorr->Fill(trgPart, assPart, weight);
1446 }
1447 else if (TLorentzVector *assVec = dynamic_cast<TLorentzVector*> (assObj)) {
1448 AliFatal(Form("got %p, but not implemented", assVec));
1449 }
1450 }
1451 }
1452 else if (TLorentzVector *trgVec = dynamic_cast<TLorentzVector*> (trgObj)) {
1453 // count the trigger
1454 histCorr->Trigger(trgVec->Phi(), trgVec->Eta(), weight);
1455
1456 // loop over associates
1457 assIter.Reset();
1458 while (TObject *assObj = assIter()) {
1459 if (AliVParticle *assPart = dynamic_cast<AliVParticle*> (assObj)) {
1460 histCorr->Fill(trgVec, assPart, weight);
1461 }
1462 else if (TLorentzVector *assVec = dynamic_cast<TLorentzVector*> (assObj)) {
1463 histCorr->Fill(trgVec, assVec, weight);
1464 }
1465 }
23536a91 1466 }
1467 }
1468
1469 return kTRUE;
1470}
1471
3082e8ab 1472Bool_t AliAnalysisTaskJetProtonCorr::Correlate(Trg_t trg, Ass_t ass, Class_t cl, Ev_t ev,
1473 TCollection *trgArray, TCollection *assArray, Float_t weight)
1474{
1475 CorrType_t corr = (CorrType_t) (2 * trg + ass);
1476
1477 return Correlate(corr, cl, ev, trgArray, assArray, weight);
1478}
1479
ebdf1dbb 1480Bool_t AliAnalysisTaskJetProtonCorr::GenerateRandom(TCollection *trgJetArray,
1481 TCollection *trgHadArray,
1482 TCollection *assHadJetArray,
1483 TCollection *assProtJetArray,
1484 TCollection *assHadHadArray,
1485 TCollection *assProtHadArray,
1486 Float_t pFraction)
1487{
1488 // generate random direction
1489
1490 Float_t meanNoPart = 10;
1491 Int_t nPart = gRandom->Poisson(meanNoPart);
1492
1493 Float_t trgJetEta = gRandom->Uniform(-.5, .5);
1494 Float_t trgJetPhi = 0.;
1495 if (IsClass(kClSemiCentral)) {
1496 do {
1497 trgJetPhi = fTrgJetPhiModSemi->GetRandom();
1498 } while (!AcceptAngleToEvPlane(trgJetPhi, 0));
ebdf1dbb 1499 }
1500 else {
1501 trgJetPhi = fTrgJetPhiModCent->GetRandom();
1502 }
d57e2346 1503 trgJetPhi += fEventPlaneAngle;
1504 if (trgJetPhi < 0.)
1505 trgJetPhi += 2. * TMath::Pi();
1506 else if (trgJetPhi > 2. * TMath::Pi())
1507 trgJetPhi -= 2. * TMath::Pi();
ebdf1dbb 1508
1509 // generate one trigger particle
1510 TLorentzVector *trgJet = new TLorentzVector();
1511 trgJet->SetPtEtaPhiM(50., trgJetEta, trgJetPhi, .14);
1512 trgJetArray->Add(trgJet);
1513
1514 // generate direction for away side
1515 Float_t trgJetEtaAway = gRandom->Uniform(-.9, .9);
1516 Float_t trgJetPhiAway = trgJetPhi + TMath::Pi() + gRandom->Gaus(0., .2);
1517
1518 // generate associated particles
1519 // with proton/hadron ratio observed in this event
1520 for (Int_t iPart = 0; iPart < nPart; ++iPart) {
1521 Float_t deltaEta, deltaPhi;
1522 const Float_t r = .8;
1523 do {
1524 deltaEta = gRandom->Uniform(-r, r);
1525 deltaPhi = gRandom->Uniform(-r, r);
1526 } while ((deltaEta * deltaEta + deltaPhi * deltaPhi) > (r * r));
1527
1528 TLorentzVector *assPart = new TLorentzVector();
1529 Float_t eta = trgJetEtaAway + deltaEta;
1530 Float_t phi = trgJetPhiAway + deltaPhi;
1531 if (eta > .9) {
1532 delete assPart;
1533 continue;
1534 }
1535 if (phi < 0.)
1536 phi += 2. * TMath::Pi();
1537 else if (phi > 2. * TMath::Pi())
1538 phi -= 2. * TMath::Pi();
1539 assPart->SetPtEtaPhiM(3., eta, phi, .14);
1540 assHadJetArray->Add(assPart);
1541 if (gRandom->Uniform() < pFraction)
1542 assProtJetArray->Add(assPart);
1543 }
1544
1545 // trigger hadron
1546 Float_t trgHadEta = gRandom->Uniform(-.9, .9);
1547 Float_t trgHadPhi = 0.;
1548 if (IsClass(kClSemiCentral)) {
1549 do {
1550 trgHadPhi = fTrgHadPhiModSemi->GetRandom();
1551 } while (!AcceptAngleToEvPlane(trgHadPhi, 0));
ebdf1dbb 1552 }
1553 else {
1554 trgHadPhi = fTrgHadPhiModCent->GetRandom();
1555 }
d57e2346 1556 trgHadPhi += fEventPlaneAngle;
1557 if (trgHadPhi < 0.)
1558 trgHadPhi += 2. * TMath::Pi();
1559 else if (trgHadPhi > 2. * TMath::Pi())
1560 trgHadPhi -= 2. * TMath::Pi();
ebdf1dbb 1561
1562 // generate one trigger particle
1563 TLorentzVector *trgHad = new TLorentzVector();
1564 trgHad->SetPtEtaPhiM(50., trgHadEta, trgHadPhi, .14);
1565 trgHadArray->Add(trgHad);
1566
1567 // generate direction for away side
1568 Float_t trgHadEtaAway = gRandom->Uniform(-.9, .9);
1569 Float_t trgHadPhiAway = trgHadPhi + TMath::Pi() + gRandom->Gaus(0., .2);
1570
1571 // generate associated particles
1572 // with proton/hadron ratio observed in this event
1573 for (Int_t iPart = 0; iPart < nPart; ++iPart) {
1574 Float_t deltaEta, deltaPhi;
1575 const Float_t r = .8;
1576 do {
1577 deltaEta = gRandom->Uniform(-r, r);
1578 deltaPhi = gRandom->Uniform(-r, r);
1579 } while ((deltaEta * deltaEta + deltaPhi * deltaPhi) > (r * r));
1580
1581 TLorentzVector *assPart = new TLorentzVector();
1582 Float_t eta = trgHadEtaAway + deltaEta;
1583 Float_t phi = trgHadPhiAway + deltaPhi;
1584 if (eta > .9) {
1585 delete assPart;
1586 continue;
1587 }
1588 if (phi < 0.)
1589 phi += 2. * TMath::Pi();
1590 else if (phi > 2. * TMath::Pi())
1591 phi -= 2. * TMath::Pi();
1592 assPart->SetPtEtaPhiM(3., eta, phi, .14);
1593 assHadHadArray->Add(assPart);
1594 if (gRandom->Uniform() < pFraction)
1595 assProtHadArray->Add(assPart);
1596 }
1597
1598 return kTRUE;
1599}
1600
23536a91 1601Bool_t AliAnalysisTaskJetProtonCorr::CleanUpEvent()
1602{
1603 if (fAODEvent) {
a4c7ef28 1604 delete fPrimTrackArrayAss;
1605 fPrimTrackArrayAss = 0x0;
1606 delete fPrimTrackArrayTrg;
1607 fPrimTrackArrayTrg = 0x0;
23536a91 1608 }
1609
a4c7ef28 1610 fPrimConstrainedTrackArray->Delete();
1611
23536a91 1612 return kTRUE;
1613}
1614
1615TObjArray* AliAnalysisTaskJetProtonCorr::CloneTracks(TObjArray* tracks) const
1616{
1617 TObjArray* tracksClone = new TObjArray;
1618 tracksClone->SetOwner(kTRUE);
1619
1620 Int_t nTracks = tracks->GetEntriesFast();
1621 for (Int_t i = 0; i < nTracks; i++) {
1622 // tracksClone->Add(new AliDPhiBasicParticle(particle->Eta(), particle->Phi(), particle->Pt(), particle->Charge()));
1623
1624 // WARNING: TObject::Clone() is very!!! expensive, unusable
1625 // tracksClone->Add(particle->Clone());
1626
1627 if (AliESDtrack* esdTrack = dynamic_cast<AliESDtrack*> (tracks->At(i)))
1628 tracksClone->Add(new AliESDtrack(*esdTrack));
1629 else if (AliAODTrack* aodTrack = dynamic_cast<AliAODTrack*> (tracks->At(i)))
1630 tracksClone->Add(new AliAODTrack(*aodTrack));
1631 }
1632
1633 return tracksClone;
1634}
1635
1636AliAnalysisTaskJetProtonCorr::AliHistCorr::AliHistCorr(TString name, TList *outputList) :
1637 TNamed(name, name),
1638 fOutputList(outputList),
1639 fHistStat(0x0),
1640 fHistCorrPhi(0x0),
1641 fHistCorrPhi2(0x0),
ebdf1dbb 1642 fHistCorrEtaPhi(0x0),
1643 fHistCorrAvgEtaPhi(0x0),
1644 fHistCorrTrgEtaPhi(0x0),
1645 fHistCorrAssEtaPhi(0x0)
23536a91 1646{
1647 // ctor
1648
1649 fHistStat = new TH1F(Form("%s_stat", name.Data()), "statistics",
1650 1, .5, 1.5);
1651
1652 fHistCorrPhi = new TH1F(Form("%s_phi", name.Data()), ";#Delta #phi",
1653 100, -2.*TMath::Pi(), 2.*TMath::Pi());
2751fb9a 1654 fHistCorrPhi->Sumw2();
23536a91 1655 fHistCorrPhi2 = new TH2F(Form("%s_phi2", name.Data()), ";#phi_{trg};#phi_{ass}",
1656 100, 0.*TMath::Pi(), 2.*TMath::Pi(),
1657 100, 0.*TMath::Pi(), 2.*TMath::Pi());
2751fb9a 1658 fHistCorrPhi2->Sumw2();
23536a91 1659 fHistCorrEtaPhi = new TH2F(Form("%s_etaphi", name.Data()), ";#Delta#phi;#Delta#eta",
1660 100, -1., 2*TMath::Pi()-1.,
1661 100, -2., 2.);
2751fb9a 1662 fHistCorrEtaPhi->Sumw2();
ebdf1dbb 1663 fHistCorrAvgEtaPhi = new TH2F(Form("%s_avgetaphi", name.Data()), ";#Delta#phi;avg #eta",
1664 100, -1., 2*TMath::Pi()-1.,
1665 100, -2., 2.);
2751fb9a 1666 fHistCorrAvgEtaPhi->Sumw2();
ebdf1dbb 1667 fHistCorrTrgEtaPhi = new TH2F(Form("%s_trg_etaphi", name.Data()), ";#varphi;#eta",
1668 100, 0., 2*TMath::Pi(),
1669 100, -1., 1.);
2751fb9a 1670 fHistCorrTrgEtaPhi->Sumw2();
ebdf1dbb 1671 fHistCorrAssEtaPhi = new TH2F(Form("%s_ass_etaphi", name.Data()), ";#varphi;#eta",
1672 100, 0., 2*TMath::Pi(),
1673 100, -1., 1.);
2751fb9a 1674 fHistCorrAssEtaPhi->Sumw2();
23536a91 1675
1676 fOutputList->Add(fHistStat);
1677 fOutputList->Add(fHistCorrPhi);
1678 fOutputList->Add(fHistCorrPhi2);
1679 fOutputList->Add(fHistCorrEtaPhi);
ebdf1dbb 1680 fOutputList->Add(fHistCorrAvgEtaPhi);
1681 fOutputList->Add(fHistCorrTrgEtaPhi);
1682 fOutputList->Add(fHistCorrAssEtaPhi);
23536a91 1683}
1684
1685AliAnalysisTaskJetProtonCorr::AliHistCorr::~AliHistCorr()
1686{
1687 // dtor
1688}
1689
1690void AliAnalysisTaskJetProtonCorr::AliHistCorr::Fill(AliVParticle *trgPart, AliVParticle *assPart, Float_t weight)
1691{
2751fb9a 1692 // fill correlation histograms from trigger particle and associate particle
1693
23536a91 1694 Float_t deltaEta = assPart->Eta() - trgPart->Eta();
ebdf1dbb 1695 Float_t avgEta = (assPart->Eta() + trgPart->Eta()) / 2.;
23536a91 1696 Float_t deltaPhi = assPart->Phi() - trgPart->Phi();
1697 if (deltaPhi > (2.*TMath::Pi()-1.))
1698 deltaPhi -= 2. * TMath::Pi();
1699 else if (deltaPhi < -1.)
1700 deltaPhi += 2. * TMath::Pi();
23536a91 1701
2751fb9a 1702 fHistCorrPhi->Fill(deltaPhi, weight);
23536a91 1703 fHistCorrPhi2->Fill(trgPart->Phi(), assPart->Phi(), weight);
1704 fHistCorrEtaPhi->Fill(deltaPhi, deltaEta, weight);
ebdf1dbb 1705 fHistCorrAvgEtaPhi->Fill(deltaPhi, avgEta, weight);
1706}
1707
1708void AliAnalysisTaskJetProtonCorr::AliHistCorr::Fill(TLorentzVector *trgPart, AliVParticle *assPart, Float_t weight)
1709{
2751fb9a 1710 // fill correlation histograms from trigger direction and associate particle
1711
ebdf1dbb 1712 Float_t deltaEta = assPart->Eta() - trgPart->Eta();
1713 Float_t avgEta = (assPart->Eta() + trgPart->Eta()) / 2.;
1714 Float_t deltaPhi = assPart->Phi() - trgPart->Phi();
1715 if (deltaPhi > (2.*TMath::Pi()-1.))
1716 deltaPhi -= 2. * TMath::Pi();
1717 else if (deltaPhi < -1.)
1718 deltaPhi += 2. * TMath::Pi();
ebdf1dbb 1719
2751fb9a 1720 fHistCorrPhi->Fill(deltaPhi, weight);
ebdf1dbb 1721 Float_t trgPhi = trgPart->Phi();
1722 if (trgPhi < 0)
1723 trgPhi += 2. * TMath::Pi();
1724 fHistCorrPhi2->Fill(trgPhi, assPart->Phi(), weight);
1725 fHistCorrEtaPhi->Fill(deltaPhi, deltaEta, weight);
1726 fHistCorrAvgEtaPhi->Fill(deltaPhi, avgEta, weight);
1727}
1728
1729void AliAnalysisTaskJetProtonCorr::AliHistCorr::Fill(TLorentzVector *trgPart, TLorentzVector *assPart, Float_t weight)
1730{
2751fb9a 1731 // fill correlation histograms from trigger direction and associate direction
1732
ebdf1dbb 1733 Float_t deltaEta = assPart->Eta() - trgPart->Eta();
1734 Float_t avgEta = (assPart->Eta() + trgPart->Eta()) / 2.;
1735 Float_t deltaPhi = assPart->Phi() - trgPart->Phi();
1736 if (deltaPhi > (2.*TMath::Pi()-1.))
1737 deltaPhi -= 2. * TMath::Pi();
1738 else if (deltaPhi < -1.)
1739 deltaPhi += 2. * TMath::Pi();
ebdf1dbb 1740
2751fb9a 1741 fHistCorrPhi->Fill(deltaPhi, weight);
ebdf1dbb 1742 Float_t trgPhi = trgPart->Phi();
1743 if (trgPhi < 0)
1744 trgPhi += 2. * TMath::Pi();
1745 Float_t assPhi = assPart->Phi();
1746 if (assPhi < 0)
1747 assPhi += 2. * TMath::Pi();
1748 fHistCorrPhi2->Fill(trgPhi, assPhi, weight);
1749 fHistCorrEtaPhi->Fill(deltaPhi, deltaEta, weight);
1750 fHistCorrAvgEtaPhi->Fill(deltaPhi, avgEta, weight);
23536a91 1751}
1752
1753// ----- histogram management -----
1754TH1* AliAnalysisTaskJetProtonCorr::AddHistogram(Hist_t hist, const char *hid, TString title,
1755 Int_t xbins, Float_t xmin, Float_t xmax,
1756 Int_t binType)
1757{
1758 TString hName;
1759 hName.Form("%s_%s", fShortTaskId, hid);
1760 hName.ToLower();
1761 TH1 *h = 0x0;
1762 if (binType == 0)
1763 h = new TH1I(hName.Data(), title,
1764 xbins, xmin, xmax);
1765 else
1766 h = new TH1F(hName.Data(), title,
1767 xbins, xmin, xmax);
1768 GetHistogram(hist) = h;
1769 fOutputList->Add(h);
1770 return h;
1771}
1772
1773TH2* AliAnalysisTaskJetProtonCorr::AddHistogram(Hist_t hist, const char *hid, TString title,
1774 Int_t xbins, Float_t xmin, Float_t xmax,
1775 Int_t ybins, Float_t ymin, Float_t ymax,
1776 Int_t binType)
1777{
1778 TString hName;
1779 hName.Form("%s_%s", fShortTaskId, hid);
1780 hName.ToLower();
1781 TH1 *h = 0x0;
1782 if (binType == 0)
1783 h = GetHistogram(hist) = new TH2I(hName.Data(), title,
1784 xbins, xmin, xmax,
1785 ybins, ymin, ymax);
1786 else
1787 h = GetHistogram(hist) = new TH2F(hName.Data(), title,
1788 xbins, xmin, xmax,
1789 ybins, ymin, ymax);
1790 fOutputList->Add(h);
1791 return (TH2*) h;
1792}
1793
1794TH3* AliAnalysisTaskJetProtonCorr::AddHistogram(Hist_t hist, const char *hid, TString title,
1795 Int_t xbins, Float_t xmin, Float_t xmax,
1796 Int_t ybins, Float_t ymin, Float_t ymax,
1797 Int_t zbins, Float_t zmin, Float_t zmax,
1798 Int_t binType)
1799{
1800 TString hName;
1801 hName.Form("%s_%s", fShortTaskId, hid);
1802 hName.ToLower();
1803 TH1 *h = 0x0;
1804 if (binType == 0)
1805 h = GetHistogram(hist) = new TH3I(hName.Data(), title,
1806 xbins, xmin, xmax,
1807 ybins, ymin, ymax,
1808 zbins, zmin, zmax);
1809 else
1810 h = GetHistogram(hist) = new TH3F(hName.Data(), title,
1811 xbins, xmin, xmax,
1812 ybins, ymin, ymax,
1813 zbins, zmin, zmax);
1814 fOutputList->Add(h);
1815 return (TH3*) h;
1816}