3 // Emcal jet response matrix maker task.
7 #include "AliJetResponseMaker.h"
9 #include <TClonesArray.h>
11 #include <THnSparse.h>
12 #include <TLorentzVector.h>
14 #include "AliAnalysisManager.h"
15 #include "AliVCluster.h"
16 #include "AliVTrack.h"
17 #include "AliEmcalJet.h"
19 #include "AliRhoParameter.h"
20 #include "AliNamedArrayI.h"
21 #include "AliJetContainer.h"
22 #include "AliParticleContainer.h"
23 #include "AliClusterContainer.h"
25 ClassImp(AliJetResponseMaker)
27 //________________________________________________________________________
28 AliJetResponseMaker::AliJetResponseMaker() :
29 AliAnalysisTaskEmcalJet("AliJetResponseMaker", kTRUE),
30 fMatching(kNoMatching),
33 fUseCellsToMatch(kFALSE),
37 fDeltaEtaDeltaPhiAxis(0),
43 fHistLeadingJets1PtArea(0),
44 fHistLeadingJets1CorrPtArea(0),
45 fHistLeadingJets2PtArea(0),
46 fHistLeadingJets2CorrPtArea(0),
47 fHistLeadingJets2PtAreaAcceptance(0),
48 fHistLeadingJets2CorrPtAreaAcceptance(0),
51 fHistJets2Acceptance(0),
55 fHistJets1CorrPtArea(0),
57 fHistJets1CEFvsCEFPt(0),
61 fHistJets2CorrPtArea(0),
62 fHistJets2PhiEtaAcceptance(0),
63 fHistJets2PtAreaAcceptance(0),
64 fHistJets2CorrPtAreaAcceptance(0),
66 fHistJets2CEFvsCEFPt(0),
68 fHistCommonEnergy1vsJet1Pt(0),
69 fHistCommonEnergy2vsJet2Pt(0),
70 fHistDistancevsJet1Pt(0),
71 fHistDistancevsJet2Pt(0),
72 fHistDistancevsCommonEnergy1(0),
73 fHistDistancevsCommonEnergy2(0),
74 fHistCommonEnergy1vsCommonEnergy2(0),
75 fHistDeltaEtaDeltaPhi(0),
76 fHistJet2PtOverJet1PtvsJet2Pt(0),
77 fHistJet1PtOverJet2PtvsJet1Pt(0),
78 fHistDeltaPtvsJet1Pt(0),
79 fHistDeltaPtvsJet2Pt(0),
80 fHistDeltaPtOverJet1PtvsJet1Pt(0),
81 fHistDeltaPtOverJet2PtvsJet2Pt(0),
82 fHistDeltaPtvsDistance(0),
83 fHistDeltaPtvsCommonEnergy1(0),
84 fHistDeltaPtvsCommonEnergy2(0),
85 fHistDeltaPtvsArea1(0),
86 fHistDeltaPtvsArea2(0),
87 fHistDeltaPtvsDeltaArea(0),
88 fHistJet1PtvsJet2Pt(0),
89 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt(0),
90 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt(0),
91 fHistDeltaCorrPtvsJet1CorrPt(0),
92 fHistDeltaCorrPtvsJet2CorrPt(0),
93 fHistDeltaCorrPtvsDistance(0),
94 fHistDeltaCorrPtvsCommonEnergy1(0),
95 fHistDeltaCorrPtvsCommonEnergy2(0),
96 fHistDeltaCorrPtvsArea1(0),
97 fHistDeltaCorrPtvsArea2(0),
98 fHistDeltaCorrPtvsDeltaArea(0),
99 fHistJet1CorrPtvsJet2CorrPt(0),
100 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt(0),
101 fHistDeltaMCPtOverJet2PtvsJet2Pt(0),
102 fHistDeltaMCPtvsJet1MCPt(0),
103 fHistDeltaMCPtvsJet2Pt(0),
104 fHistDeltaMCPtvsDistance(0),
105 fHistDeltaMCPtvsCommonEnergy1(0),
106 fHistDeltaMCPtvsCommonEnergy2(0),
107 fHistDeltaMCPtvsArea1(0),
108 fHistDeltaMCPtvsArea2(0),
109 fHistDeltaMCPtvsDeltaArea(0),
110 fHistJet1MCPtvsJet2Pt(0)
112 // Default constructor.
114 SetMakeGeneralHistograms(kTRUE);
117 //________________________________________________________________________
118 AliJetResponseMaker::AliJetResponseMaker(const char *name) :
119 AliAnalysisTaskEmcalJet(name, kTRUE),
120 fMatching(kNoMatching),
123 fUseCellsToMatch(kFALSE),
127 fDeltaEtaDeltaPhiAxis(0),
133 fHistLeadingJets1PtArea(0),
134 fHistLeadingJets1CorrPtArea(0),
135 fHistLeadingJets2PtArea(0),
136 fHistLeadingJets2CorrPtArea(0),
137 fHistLeadingJets2PtAreaAcceptance(0),
138 fHistLeadingJets2CorrPtAreaAcceptance(0),
141 fHistJets2Acceptance(0),
145 fHistJets1CorrPtArea(0),
146 fHistJets1NEFvsPt(0),
147 fHistJets1CEFvsCEFPt(0),
151 fHistJets2CorrPtArea(0),
152 fHistJets2PhiEtaAcceptance(0),
153 fHistJets2PtAreaAcceptance(0),
154 fHistJets2CorrPtAreaAcceptance(0),
155 fHistJets2NEFvsPt(0),
156 fHistJets2CEFvsCEFPt(0),
158 fHistCommonEnergy1vsJet1Pt(0),
159 fHistCommonEnergy2vsJet2Pt(0),
160 fHistDistancevsJet1Pt(0),
161 fHistDistancevsJet2Pt(0),
162 fHistDistancevsCommonEnergy1(0),
163 fHistDistancevsCommonEnergy2(0),
164 fHistCommonEnergy1vsCommonEnergy2(0),
165 fHistDeltaEtaDeltaPhi(0),
166 fHistJet2PtOverJet1PtvsJet2Pt(0),
167 fHistJet1PtOverJet2PtvsJet1Pt(0),
168 fHistDeltaPtvsJet1Pt(0),
169 fHistDeltaPtvsJet2Pt(0),
170 fHistDeltaPtOverJet1PtvsJet1Pt(0),
171 fHistDeltaPtOverJet2PtvsJet2Pt(0),
172 fHistDeltaPtvsDistance(0),
173 fHistDeltaPtvsCommonEnergy1(0),
174 fHistDeltaPtvsCommonEnergy2(0),
175 fHistDeltaPtvsArea1(0),
176 fHistDeltaPtvsArea2(0),
177 fHistDeltaPtvsDeltaArea(0),
178 fHistJet1PtvsJet2Pt(0),
179 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt(0),
180 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt(0),
181 fHistDeltaCorrPtvsJet1CorrPt(0),
182 fHistDeltaCorrPtvsJet2CorrPt(0),
183 fHistDeltaCorrPtvsDistance(0),
184 fHistDeltaCorrPtvsCommonEnergy1(0),
185 fHistDeltaCorrPtvsCommonEnergy2(0),
186 fHistDeltaCorrPtvsArea1(0),
187 fHistDeltaCorrPtvsArea2(0),
188 fHistDeltaCorrPtvsDeltaArea(0),
189 fHistJet1CorrPtvsJet2CorrPt(0),
190 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt(0),
191 fHistDeltaMCPtOverJet2PtvsJet2Pt(0),
192 fHistDeltaMCPtvsJet1MCPt(0),
193 fHistDeltaMCPtvsJet2Pt(0),
194 fHistDeltaMCPtvsDistance(0),
195 fHistDeltaMCPtvsCommonEnergy1(0),
196 fHistDeltaMCPtvsCommonEnergy2(0),
197 fHistDeltaMCPtvsArea1(0),
198 fHistDeltaMCPtvsArea2(0),
199 fHistDeltaMCPtvsDeltaArea(0),
200 fHistJet1MCPtvsJet2Pt(0)
202 // Standard constructor.
204 SetMakeGeneralHistograms(kTRUE);
207 //________________________________________________________________________
208 AliJetResponseMaker::~AliJetResponseMaker()
214 //________________________________________________________________________
215 void AliJetResponseMaker::AllocateTH2()
217 // Allocate TH2 histograms.
219 fHistJets1PhiEta = new TH2F("fHistJets1PhiEta", "fHistJets1PhiEta", 40, -1, 1, 40, 0, TMath::Pi()*2);
220 fHistJets1PhiEta->GetXaxis()->SetTitle("#eta");
221 fHistJets1PhiEta->GetYaxis()->SetTitle("#phi");
222 fOutput->Add(fHistJets1PhiEta);
224 fHistJets1PtArea = new TH2F("fHistJets1PtArea", "fHistJets1PtArea", fNbins/2, 0, 1.5, fNbins, fMinBinPt, fMaxBinPt);
225 fHistJets1PtArea->GetXaxis()->SetTitle("area");
226 fHistJets1PtArea->GetYaxis()->SetTitle("p_{T,1} (GeV/c)");
227 fHistJets1PtArea->GetZaxis()->SetTitle("counts");
228 fOutput->Add(fHistJets1PtArea);
231 fHistJets1CorrPtArea = new TH2F("fHistJets1CorrPtArea", "fHistJets1CorrPtArea",
232 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
233 fHistJets1CorrPtArea->GetXaxis()->SetTitle("area");
234 fHistJets1CorrPtArea->GetYaxis()->SetTitle("p_{T,1}^{corr} (GeV/c)");
235 fHistJets1CorrPtArea->GetZaxis()->SetTitle("counts");
236 fOutput->Add(fHistJets1CorrPtArea);
239 fHistJets1ZvsPt = new TH2F("fHistJets1ZvsPt", "fHistJets1ZvsPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
240 fHistJets1ZvsPt->GetXaxis()->SetTitle("Z");
241 fHistJets1ZvsPt->GetYaxis()->SetTitle("p_{T,1} (GeV/c)");
242 fHistJets1ZvsPt->GetZaxis()->SetTitle("counts");
243 fOutput->Add(fHistJets1ZvsPt);
245 fHistJets1NEFvsPt = new TH2F("fHistJets1NEFvsPt", "fHistJets1NEFvsPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
246 fHistJets1NEFvsPt->GetXaxis()->SetTitle("NEF");
247 fHistJets1NEFvsPt->GetYaxis()->SetTitle("p_{T,1} (GeV/c)");
248 fHistJets1NEFvsPt->GetZaxis()->SetTitle("counts");
249 fOutput->Add(fHistJets1NEFvsPt);
251 fHistJets1CEFvsCEFPt = new TH2F("fHistJets1CEFvsCEFPt", "fHistJets1CEFvsCEFPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
252 fHistJets1CEFvsCEFPt->GetXaxis()->SetTitle("1-NEF");
253 fHistJets1CEFvsCEFPt->GetYaxis()->SetTitle("(1-NEF)*p_{T,1} (GeV/c)");
254 fHistJets1CEFvsCEFPt->GetZaxis()->SetTitle("counts");
255 fOutput->Add(fHistJets1CEFvsCEFPt);
259 fHistJets2PhiEta = new TH2F("fHistJets2PhiEta", "fHistJets2PhiEta", 40, -1, 1, 40, 0, TMath::Pi()*2);
260 fHistJets2PhiEta->GetXaxis()->SetTitle("#eta");
261 fHistJets2PhiEta->GetYaxis()->SetTitle("#phi");
262 fOutput->Add(fHistJets2PhiEta);
264 fHistJets2PtArea = new TH2F("fHistJets2PtArea", "fHistJets2PtArea", fNbins/2, 0, 1.5, fNbins, fMinBinPt, fMaxBinPt);
265 fHistJets2PtArea->GetXaxis()->SetTitle("area");
266 fHistJets2PtArea->GetYaxis()->SetTitle("p_{T,2} (GeV/c)");
267 fHistJets2PtArea->GetZaxis()->SetTitle("counts");
268 fOutput->Add(fHistJets2PtArea);
271 fHistJets2CorrPtArea = new TH2F("fHistJets2CorrPtArea", "fHistJets2CorrPtArea",
272 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
273 fHistJets2CorrPtArea->GetXaxis()->SetTitle("area");
274 fHistJets2CorrPtArea->GetYaxis()->SetTitle("p_{T,2}^{corr} (GeV/c)");
275 fHistJets2CorrPtArea->GetZaxis()->SetTitle("counts");
276 fOutput->Add(fHistJets2CorrPtArea);
279 fHistJets2PhiEtaAcceptance = new TH2F("fHistJets2PhiEtaAcceptance", "fHistJets2PhiEtaAcceptance", 40, -1, 1, 40, 0, TMath::Pi()*2);
280 fHistJets2PhiEtaAcceptance->GetXaxis()->SetTitle("#eta");
281 fHistJets2PhiEtaAcceptance->GetYaxis()->SetTitle("#phi");
282 fOutput->Add(fHistJets2PhiEtaAcceptance);
284 fHistJets2PtAreaAcceptance = new TH2F("fHistJets2PtAreaAcceptance", "fHistJets2PtAreaAcceptance",
285 fNbins/2, 0, 1.5, fNbins, fMinBinPt, fMaxBinPt);
286 fHistJets2PtAreaAcceptance->GetXaxis()->SetTitle("area");
287 fHistJets2PtAreaAcceptance->GetYaxis()->SetTitle("p_{T,2} (GeV/c)");
288 fHistJets2PtAreaAcceptance->GetZaxis()->SetTitle("counts");
289 fOutput->Add(fHistJets2PtAreaAcceptance);
292 fHistJets2CorrPtAreaAcceptance = new TH2F("fHistJets2CorrPtAreaAcceptance", "fHistJets2CorrPtAreaAcceptance",
293 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
294 fHistJets2CorrPtAreaAcceptance->GetXaxis()->SetTitle("area");
295 fHistJets2CorrPtAreaAcceptance->GetYaxis()->SetTitle("p_{T,2}^{corr} (GeV/c)");
296 fHistJets2CorrPtAreaAcceptance->GetZaxis()->SetTitle("counts");
297 fOutput->Add(fHistJets2CorrPtAreaAcceptance);
300 fHistJets2ZvsPt = new TH2F("fHistJets2ZvsPt", "fHistJets2ZvsPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
301 fHistJets2ZvsPt->GetXaxis()->SetTitle("Z");
302 fHistJets2ZvsPt->GetYaxis()->SetTitle("p_{T,2} (GeV/c)");
303 fHistJets2ZvsPt->GetZaxis()->SetTitle("counts");
304 fOutput->Add(fHistJets2ZvsPt);
306 fHistJets2NEFvsPt = new TH2F("fHistJets2NEFvsPt", "fHistJets2NEFvsPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
307 fHistJets2NEFvsPt->GetXaxis()->SetTitle("NEF");
308 fHistJets2NEFvsPt->GetYaxis()->SetTitle("p_{T,2} (GeV/c)");
309 fHistJets2NEFvsPt->GetZaxis()->SetTitle("counts");
310 fOutput->Add(fHistJets2NEFvsPt);
312 fHistJets2CEFvsCEFPt = new TH2F("fHistJets2CEFvsCEFPt", "fHistJets2CEFvsCEFPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
313 fHistJets2CEFvsCEFPt->GetXaxis()->SetTitle("1-NEF");
314 fHistJets2CEFvsCEFPt->GetYaxis()->SetTitle("(1-NEF)*p_{T,2} (GeV/c)");
315 fHistJets2CEFvsCEFPt->GetZaxis()->SetTitle("counts");
316 fOutput->Add(fHistJets2CEFvsCEFPt);
318 // Matching histograms
320 fHistCommonEnergy1vsJet1Pt = new TH2F("fHistCommonEnergy1vsJet1Pt", "fHistCommonEnergy1vsJet1Pt", fNbins/2, 0, 1.2, fNbins/2, fMinBinPt, fMaxBinPt);
321 fHistCommonEnergy1vsJet1Pt->GetXaxis()->SetTitle("Common energy 1 (%)");
322 fHistCommonEnergy1vsJet1Pt->GetYaxis()->SetTitle("p_{T,1}");
323 fHistCommonEnergy1vsJet1Pt->GetZaxis()->SetTitle("counts");
324 fOutput->Add(fHistCommonEnergy1vsJet1Pt);
326 fHistCommonEnergy2vsJet2Pt = new TH2F("fHistCommonEnergy2vsJet2Pt", "fHistCommonEnergy2vsJet2Pt", fNbins/2, 0, 1.2, fNbins/2, fMinBinPt, fMaxBinPt);
327 fHistCommonEnergy2vsJet2Pt->GetXaxis()->SetTitle("Common energy 2 (%)");
328 fHistCommonEnergy2vsJet2Pt->GetYaxis()->SetTitle("p_{T,2}");
329 fHistCommonEnergy2vsJet2Pt->GetZaxis()->SetTitle("counts");
330 fOutput->Add(fHistCommonEnergy2vsJet2Pt);
332 fHistDistancevsJet1Pt = new TH2F("fHistDistancevsJet1Pt", "fHistDistancevsJet1Pt", fNbins/2, 0, 1.2, fNbins/2, fMinBinPt, fMaxBinPt);
333 fHistDistancevsJet1Pt->GetXaxis()->SetTitle("Distance");
334 fHistDistancevsJet1Pt->GetYaxis()->SetTitle("p_{T,1}");
335 fHistDistancevsJet1Pt->GetZaxis()->SetTitle("counts");
336 fOutput->Add(fHistDistancevsJet1Pt);
338 fHistDistancevsJet2Pt = new TH2F("fHistDistancevsJet2Pt", "fHistDistancevsJet2Pt", fNbins/2, 0, 1.2, fNbins/2, fMinBinPt, fMaxBinPt);
339 fHistDistancevsJet2Pt->GetXaxis()->SetTitle("Distance");
340 fHistDistancevsJet2Pt->GetYaxis()->SetTitle("p_{T,2}");
341 fHistDistancevsJet2Pt->GetZaxis()->SetTitle("counts");
342 fOutput->Add(fHistDistancevsJet2Pt);
344 fHistDistancevsCommonEnergy1 = new TH2F("fHistDistancevsCommonEnergy1", "fHistDistancevsCommonEnergy1", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2);
345 fHistDistancevsCommonEnergy1->GetXaxis()->SetTitle("Distance");
346 fHistDistancevsCommonEnergy1->GetYaxis()->SetTitle("Common energy 1 (%)");
347 fHistDistancevsCommonEnergy1->GetZaxis()->SetTitle("counts");
348 fOutput->Add(fHistDistancevsCommonEnergy1);
350 fHistDistancevsCommonEnergy2 = new TH2F("fHistDistancevsCommonEnergy2", "fHistDistancevsCommonEnergy2", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2);
351 fHistDistancevsCommonEnergy2->GetXaxis()->SetTitle("Distance");
352 fHistDistancevsCommonEnergy2->GetYaxis()->SetTitle("Common energy 2 (%)");
353 fHistDistancevsCommonEnergy2->GetZaxis()->SetTitle("counts");
354 fOutput->Add(fHistDistancevsCommonEnergy2);
356 fHistCommonEnergy1vsCommonEnergy2 = new TH2F("fHistCommonEnergy1vsCommonEnergy2", "fHistCommonEnergy1vsCommonEnergy2", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2);
357 fHistCommonEnergy1vsCommonEnergy2->GetXaxis()->SetTitle("Common energy 1 (%)");
358 fHistCommonEnergy1vsCommonEnergy2->GetYaxis()->SetTitle("Common energy 2 (%)");
359 fHistCommonEnergy1vsCommonEnergy2->GetZaxis()->SetTitle("counts");
360 fOutput->Add(fHistCommonEnergy1vsCommonEnergy2);
362 fHistDeltaEtaDeltaPhi = new TH2F("fHistDeltaEtaDeltaPhi", "fHistDeltaEtaDeltaPhi", fNbins/4, -1, 1, fNbins/4, -TMath::Pi()/2, TMath::Pi()*3/2);
363 fHistDeltaEtaDeltaPhi->GetXaxis()->SetTitle("Common energy 1 (%)");
364 fHistDeltaEtaDeltaPhi->GetYaxis()->SetTitle("Common energy 2 (%)");
365 fHistDeltaEtaDeltaPhi->GetZaxis()->SetTitle("counts");
366 fOutput->Add(fHistDeltaEtaDeltaPhi);
368 fHistJet2PtOverJet1PtvsJet2Pt = new TH2F("fHistJet2PtOverJet1PtvsJet2Pt", "fHistJet2PtOverJet1PtvsJet2Pt", fNbins, fMinBinPt, fMaxBinPt, 300, 0, 1.5);
369 fHistJet2PtOverJet1PtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
370 fHistJet2PtOverJet1PtvsJet2Pt->GetYaxis()->SetTitle("p_{T,2} / p_{T,1}");
371 fHistJet2PtOverJet1PtvsJet2Pt->GetZaxis()->SetTitle("counts");
372 fOutput->Add(fHistJet2PtOverJet1PtvsJet2Pt);
374 fHistJet1PtOverJet2PtvsJet1Pt = new TH2F("fHistJet1PtOverJet2PtvsJet1Pt", "fHistJet1PtOverJet2PtvsJet1Pt", fNbins, fMinBinPt, fMaxBinPt, 300, 0, 1.5);
375 fHistJet1PtOverJet2PtvsJet1Pt->GetXaxis()->SetTitle("p_{T,1}");
376 fHistJet1PtOverJet2PtvsJet1Pt->GetYaxis()->SetTitle("p_{T,1} / p_{T,2}");
377 fHistJet1PtOverJet2PtvsJet1Pt->GetZaxis()->SetTitle("counts");
378 fOutput->Add(fHistJet1PtOverJet2PtvsJet1Pt);
380 fHistDeltaPtvsJet1Pt = new TH2F("fHistDeltaPtvsJet1Pt", "fHistDeltaPtvsJet1Pt",
381 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
382 fHistDeltaPtvsJet1Pt->GetXaxis()->SetTitle("p_{T,1}");
383 fHistDeltaPtvsJet1Pt->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
384 fHistDeltaPtvsJet1Pt->GetZaxis()->SetTitle("counts");
385 fOutput->Add(fHistDeltaPtvsJet1Pt);
387 fHistDeltaPtvsJet2Pt = new TH2F("fHistDeltaPtvsJet2Pt", "fHistDeltaPtvsJet2Pt",
388 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
389 fHistDeltaPtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
390 fHistDeltaPtvsJet2Pt->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
391 fHistDeltaPtvsJet2Pt->GetZaxis()->SetTitle("counts");
392 fOutput->Add(fHistDeltaPtvsJet2Pt);
394 fHistDeltaPtOverJet1PtvsJet1Pt = new TH2F("fHistDeltaPtOverJet1PtvsJet1Pt", "fHistDeltaPtOverJet1PtvsJet1Pt",
395 fNbins, fMinBinPt, fMaxBinPt, fNbins, -5, 5);
396 fHistDeltaPtOverJet1PtvsJet1Pt->GetXaxis()->SetTitle("p_{T,1}");
397 fHistDeltaPtOverJet1PtvsJet1Pt->GetYaxis()->SetTitle("#deltap_{T} / p_{T,1}");
398 fHistDeltaPtOverJet1PtvsJet1Pt->GetZaxis()->SetTitle("counts");
399 fOutput->Add(fHistDeltaPtOverJet1PtvsJet1Pt);
401 fHistDeltaPtOverJet2PtvsJet2Pt = new TH2F("fHistDeltaPtOverJet2PtvsJet2Pt", "fHistDeltaPtOverJet2PtvsJet2Pt",
402 fNbins, fMinBinPt, fMaxBinPt, fNbins, -5, 5);
403 fHistDeltaPtOverJet2PtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
404 fHistDeltaPtOverJet2PtvsJet2Pt->GetYaxis()->SetTitle("#deltap_{T} / p_{T,2}");
405 fHistDeltaPtOverJet2PtvsJet2Pt->GetZaxis()->SetTitle("counts");
406 fOutput->Add(fHistDeltaPtOverJet2PtvsJet2Pt);
408 fHistDeltaPtvsDistance = new TH2F("fHistDeltaPtvsDistance", "fHistDeltaPtvsDistance",
409 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
410 fHistDeltaPtvsDistance->GetXaxis()->SetTitle("Distance");
411 fHistDeltaPtvsDistance->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
412 fHistDeltaPtvsDistance->GetZaxis()->SetTitle("counts");
413 fOutput->Add(fHistDeltaPtvsDistance);
415 fHistDeltaPtvsCommonEnergy1 = new TH2F("fHistDeltaPtvsCommonEnergy1", "fHistDeltaPtvsCommonEnergy1",
416 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
417 fHistDeltaPtvsCommonEnergy1->GetXaxis()->SetTitle("Common energy 1 (%)");
418 fHistDeltaPtvsCommonEnergy1->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
419 fHistDeltaPtvsCommonEnergy1->GetZaxis()->SetTitle("counts");
420 fOutput->Add(fHistDeltaPtvsCommonEnergy1);
422 fHistDeltaPtvsCommonEnergy2 = new TH2F("fHistDeltaPtvsCommonEnergy2", "fHistDeltaPtvsCommonEnergy2",
423 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
424 fHistDeltaPtvsCommonEnergy2->GetXaxis()->SetTitle("Common energy 2 (%)");
425 fHistDeltaPtvsCommonEnergy2->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
426 fHistDeltaPtvsCommonEnergy2->GetZaxis()->SetTitle("counts");
427 fOutput->Add(fHistDeltaPtvsCommonEnergy2);
429 fHistDeltaPtvsArea1 = new TH2F("fHistDeltaPtvsArea1", "fHistDeltaPtvsArea1",
430 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
431 fHistDeltaPtvsArea1->GetXaxis()->SetTitle("A_{jet,1}");
432 fHistDeltaPtvsArea1->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
433 fHistDeltaPtvsArea1->GetZaxis()->SetTitle("counts");
434 fOutput->Add(fHistDeltaPtvsArea1);
436 fHistDeltaPtvsArea2 = new TH2F("fHistDeltaPtvsArea2", "fHistDeltaPtvsArea2",
437 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
438 fHistDeltaPtvsArea2->GetXaxis()->SetTitle("A_{jet,2}");
439 fHistDeltaPtvsArea2->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
440 fHistDeltaPtvsArea2->GetZaxis()->SetTitle("counts");
441 fOutput->Add(fHistDeltaPtvsArea2);
443 fHistDeltaPtvsDeltaArea = new TH2F("fHistDeltaPtvsDeltaArea", "fHistDeltaPtvsDeltaArea",
444 fNbins, -1.+1./fNbins, 1.+1./fNbins, 2*fNbins, -fMaxBinPt, fMaxBinPt);
445 fHistDeltaPtvsDeltaArea->GetXaxis()->SetTitle("#deltaA_{jet}");
446 fHistDeltaPtvsDeltaArea->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
447 fHistDeltaPtvsDeltaArea->GetZaxis()->SetTitle("counts");
448 fOutput->Add(fHistDeltaPtvsDeltaArea);
450 fHistJet1PtvsJet2Pt = new TH2F("fHistJet1PtvsJet2Pt", "fHistJet1PtvsJet2Pt", fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
451 fHistJet1PtvsJet2Pt->GetXaxis()->SetTitle("p_{T,1}");
452 fHistJet1PtvsJet2Pt->GetYaxis()->SetTitle("p_{T,2}");
453 fHistJet1PtvsJet2Pt->GetZaxis()->SetTitle("counts");
454 fOutput->Add(fHistJet1PtvsJet2Pt);
456 if (fIsJet1Rho || fIsJet2Rho) {
458 fHistDeltaCorrPtvsJet1CorrPt = new TH2F("fHistDeltaCorrPtvsJet1CorrPt", "fHistDeltaCorrPtvsJet1CorrPt",
459 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
461 fHistDeltaCorrPtvsJet1CorrPt = new TH2F("fHistDeltaCorrPtvsJet1CorrPt", "fHistDeltaCorrPtvsJet1CorrPt",
462 2*fNbins, -fMaxBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
464 fHistDeltaCorrPtvsJet1CorrPt->GetXaxis()->SetTitle("p_{T,1}^{corr}");
465 fHistDeltaCorrPtvsJet1CorrPt->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
466 fHistDeltaCorrPtvsJet1CorrPt->GetZaxis()->SetTitle("counts");
467 fOutput->Add(fHistDeltaCorrPtvsJet1CorrPt);
470 fHistDeltaCorrPtvsJet2CorrPt = new TH2F("fHistDeltaCorrPtvsJet2CorrPt", "fHistDeltaCorrPtvsJet2CorrPt",
471 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
473 fHistDeltaCorrPtvsJet2CorrPt = new TH2F("fHistDeltaCorrPtvsJet2CorrPt", "fHistDeltaCorrPtvsJet2CorrPt",
474 2*fNbins, -fMaxBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
476 fHistDeltaCorrPtvsJet2CorrPt->GetXaxis()->SetTitle("p_{T,2}^{corr}");
477 fHistDeltaCorrPtvsJet2CorrPt->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
478 fHistDeltaCorrPtvsJet2CorrPt->GetZaxis()->SetTitle("counts");
479 fOutput->Add(fHistDeltaCorrPtvsJet2CorrPt);
481 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt = new TH2F("fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt", "fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt",
482 2*fNbins, -fMaxBinPt, fMaxBinPt, fNbins, -5, 5);
483 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt->GetXaxis()->SetTitle("p_{T,1}^{corr}");
484 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt->GetYaxis()->SetTitle("#deltap_{T}^{corr} / p_{T,1}^{corr}");
485 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt->GetZaxis()->SetTitle("counts");
486 fOutput->Add(fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt);
488 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt = new TH2F("fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt", "fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt",
489 2*fNbins, -fMaxBinPt, fMaxBinPt, fNbins, -5, 5);
490 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt->GetXaxis()->SetTitle("p_{T,2}^{corr}");
491 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt->GetYaxis()->SetTitle("#deltap_{T}^{corr} / p_{T,2}^{corr}");
492 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt->GetZaxis()->SetTitle("counts");
493 fOutput->Add(fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt);
495 fHistDeltaCorrPtvsDistance = new TH2F("fHistDeltaCorrPtvsDistance", "fHistDeltaCorrPtvsDistance",
496 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
497 fHistDeltaCorrPtvsDistance->GetXaxis()->SetTitle("Distance");
498 fHistDeltaCorrPtvsDistance->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
499 fHistDeltaCorrPtvsDistance->GetZaxis()->SetTitle("counts");
500 fOutput->Add(fHistDeltaCorrPtvsDistance);
502 fHistDeltaCorrPtvsCommonEnergy1 = new TH2F("fHistDeltaCorrPtvsCommonEnergy1", "fHistDeltaCorrPtvsCommonEnergy1",
503 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
504 fHistDeltaCorrPtvsCommonEnergy1->GetXaxis()->SetTitle("Common energy 1 (%)");
505 fHistDeltaCorrPtvsCommonEnergy1->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
506 fHistDeltaCorrPtvsCommonEnergy1->GetZaxis()->SetTitle("counts");
507 fOutput->Add(fHistDeltaCorrPtvsCommonEnergy1);
509 fHistDeltaCorrPtvsCommonEnergy2 = new TH2F("fHistDeltaCorrPtvsCommonEnergy2", "fHistDeltaCorrPtvsCommonEnergy2",
510 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
511 fHistDeltaCorrPtvsCommonEnergy2->GetXaxis()->SetTitle("Common energy 2 (%)");
512 fHistDeltaCorrPtvsCommonEnergy2->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
513 fHistDeltaCorrPtvsCommonEnergy2->GetZaxis()->SetTitle("counts");
514 fOutput->Add(fHistDeltaCorrPtvsCommonEnergy2);
516 fHistDeltaCorrPtvsArea1 = new TH2F("fHistDeltaCorrPtvsArea1", "fHistDeltaCorrPtvsArea1",
517 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
518 fHistDeltaCorrPtvsArea1->GetXaxis()->SetTitle("A_{jet,1}");
519 fHistDeltaCorrPtvsArea1->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
520 fHistDeltaCorrPtvsArea1->GetZaxis()->SetTitle("counts");
521 fOutput->Add(fHistDeltaCorrPtvsArea1);
523 fHistDeltaCorrPtvsArea2 = new TH2F("fHistDeltaCorrPtvsArea2", "fHistDeltaCorrPtvsArea2",
524 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
525 fHistDeltaCorrPtvsArea2->GetXaxis()->SetTitle("A_{jet,2}");
526 fHistDeltaCorrPtvsArea2->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
527 fHistDeltaCorrPtvsArea2->GetZaxis()->SetTitle("counts");
528 fOutput->Add(fHistDeltaCorrPtvsArea2);
530 fHistDeltaCorrPtvsDeltaArea = new TH2F("fHistDeltaCorrPtvsDeltaArea", "fHistDeltaCorrPtvsDeltaArea",
531 fNbins, -1.+1./fNbins, 1.+1./fNbins, 2*fNbins, -fMaxBinPt, fMaxBinPt);
532 fHistDeltaCorrPtvsDeltaArea->GetXaxis()->SetTitle("#deltaA_{jet}");
533 fHistDeltaCorrPtvsDeltaArea->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
534 fHistDeltaCorrPtvsDeltaArea->GetZaxis()->SetTitle("counts");
535 fOutput->Add(fHistDeltaCorrPtvsDeltaArea);
538 fHistJet1CorrPtvsJet2CorrPt = new TH2F("fHistJet1CorrPtvsJet2CorrPt", "fHistJet1CorrPtvsJet2CorrPt",
539 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
540 else if (!fIsJet2Rho)
541 fHistJet1CorrPtvsJet2CorrPt = new TH2F("fHistJet1CorrPtvsJet2CorrPt", "fHistJet1CorrPtvsJet2CorrPt",
542 2*fNbins, -fMaxBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
544 fHistJet1CorrPtvsJet2CorrPt = new TH2F("fHistJet1CorrPtvsJet2CorrPt", "fHistJet1CorrPtvsJet2CorrPt",
545 2*fNbins, -fMaxBinPt, fMaxBinPt,
546 2*fNbins, -fMaxBinPt, fMaxBinPt);
547 fHistJet1CorrPtvsJet2CorrPt->GetXaxis()->SetTitle("p_{T,1}^{corr}");
548 fHistJet1CorrPtvsJet2CorrPt->GetYaxis()->SetTitle("p_{T,2}^{corr}");
549 fHistJet1CorrPtvsJet2CorrPt->GetZaxis()->SetTitle("counts");
550 fOutput->Add(fHistJet1CorrPtvsJet2CorrPt);
554 fHistDeltaMCPtvsJet1MCPt = new TH2F("fHistDeltaMCPtvsJet1MCPt", "fHistDeltaMCPtvsJet1MCPt",
555 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
556 fHistDeltaMCPtvsJet1MCPt->GetXaxis()->SetTitle("p_{T,1}^{MC}");
557 fHistDeltaMCPtvsJet1MCPt->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
558 fHistDeltaMCPtvsJet1MCPt->GetZaxis()->SetTitle("counts");
559 fOutput->Add(fHistDeltaMCPtvsJet1MCPt);
561 fHistDeltaMCPtvsJet2Pt = new TH2F("fHistDeltaMCPtvsJet2Pt", "fHistDeltaMCPtvsJet2Pt",
562 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
563 fHistDeltaMCPtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
564 fHistDeltaMCPtvsJet2Pt->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
565 fHistDeltaMCPtvsJet2Pt->GetZaxis()->SetTitle("counts");
566 fOutput->Add(fHistDeltaMCPtvsJet2Pt);
568 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt = new TH2F("fHistDeltaMCPtOverJet1MCPtvsJet1MCPt", "fHistDeltaMCPtOverJet1MCPtvsJet1MCPt",
569 fNbins, fMinBinPt, fMaxBinPt, fNbins, -5, 5);
570 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt->GetXaxis()->SetTitle("p_{T,1}^{MC}");
571 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt->GetYaxis()->SetTitle("#deltap_{T} / p_{T,1}^{MC}");
572 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt->GetZaxis()->SetTitle("counts");
573 fOutput->Add(fHistDeltaMCPtOverJet1MCPtvsJet1MCPt);
575 fHistDeltaMCPtOverJet2PtvsJet2Pt = new TH2F("fHistDeltaMCPtOverJet2PtvsJet2Pt", "fHistDeltaMCPtOverJet2PtvsJet2Pt",
576 fNbins, fMinBinPt, fMaxBinPt, fNbins, -5, 5);
577 fHistDeltaMCPtOverJet2PtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
578 fHistDeltaMCPtOverJet2PtvsJet2Pt->GetYaxis()->SetTitle("#deltap_{T} / p_{T,2}");
579 fHistDeltaMCPtOverJet2PtvsJet2Pt->GetZaxis()->SetTitle("counts");
580 fOutput->Add(fHistDeltaMCPtOverJet2PtvsJet2Pt);
582 fHistDeltaMCPtvsDistance = new TH2F("fHistDeltaMCPtvsDistance", "fHistDeltaMCPtvsDistance",
583 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
584 fHistDeltaMCPtvsDistance->GetXaxis()->SetTitle("Distance");
585 fHistDeltaMCPtvsDistance->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
586 fHistDeltaMCPtvsDistance->GetZaxis()->SetTitle("counts");
587 fOutput->Add(fHistDeltaMCPtvsDistance);
589 fHistDeltaMCPtvsCommonEnergy1 = new TH2F("fHistDeltaMCPtvsCommonEnergy1", "fHistDeltaMCPtvsCommonEnergy1",
590 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
591 fHistDeltaMCPtvsCommonEnergy1->GetXaxis()->SetTitle("Common energy 1 (%)");
592 fHistDeltaMCPtvsCommonEnergy1->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
593 fHistDeltaMCPtvsCommonEnergy1->GetZaxis()->SetTitle("counts");
594 fOutput->Add(fHistDeltaMCPtvsCommonEnergy1);
596 fHistDeltaMCPtvsCommonEnergy2 = new TH2F("fHistDeltaMCPtvsCommonEnergy2", "fHistDeltaMCPtvsCommonEnergy2",
597 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
598 fHistDeltaMCPtvsCommonEnergy2->GetXaxis()->SetTitle("Common energy 2 (%)");
599 fHistDeltaMCPtvsCommonEnergy2->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
600 fHistDeltaMCPtvsCommonEnergy2->GetZaxis()->SetTitle("counts");
601 fOutput->Add(fHistDeltaMCPtvsCommonEnergy2);
603 fHistDeltaMCPtvsArea1 = new TH2F("fHistDeltaMCPtvsArea1", "fHistDeltaMCPtvsArea1",
604 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
605 fHistDeltaMCPtvsArea1->GetXaxis()->SetTitle("A_{jet,1}");
606 fHistDeltaMCPtvsArea1->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
607 fHistDeltaMCPtvsArea1->GetZaxis()->SetTitle("counts");
608 fOutput->Add(fHistDeltaMCPtvsArea1);
610 fHistDeltaMCPtvsArea2 = new TH2F("fHistDeltaMCPtvsArea2", "fHistDeltaMCPtvsArea2",
611 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
612 fHistDeltaMCPtvsArea2->GetXaxis()->SetTitle("A_{jet,2}");
613 fHistDeltaMCPtvsArea2->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
614 fHistDeltaMCPtvsArea2->GetZaxis()->SetTitle("counts");
615 fOutput->Add(fHistDeltaMCPtvsArea2);
617 fHistDeltaMCPtvsDeltaArea = new TH2F("fHistDeltaMCPtvsDeltaArea", "fHistDeltaMCPtvsDeltaArea",
618 fNbins, -1.+1./fNbins, 1.+1./fNbins, 2*fNbins, -fMaxBinPt, fMaxBinPt);
619 fHistDeltaMCPtvsDeltaArea->GetXaxis()->SetTitle("#deltaA_{jet}");
620 fHistDeltaMCPtvsDeltaArea->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
621 fHistDeltaMCPtvsDeltaArea->GetZaxis()->SetTitle("counts");
622 fOutput->Add(fHistDeltaMCPtvsDeltaArea);
624 fHistJet1MCPtvsJet2Pt = new TH2F("fHistJet1MCPtvsJet2Pt", "fHistJet1MCPtvsJet2Pt",
625 fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
626 fHistJet1MCPtvsJet2Pt->GetXaxis()->SetTitle("p_{T,1}^{MC}");
627 fHistJet1MCPtvsJet2Pt->GetYaxis()->SetTitle("p_{T,2}");
628 fHistJet1MCPtvsJet2Pt->GetZaxis()->SetTitle("counts");
629 fOutput->Add(fHistJet1MCPtvsJet2Pt);
633 //________________________________________________________________________
634 void AliJetResponseMaker::AllocateTHnSparse()
636 // Allocate THnSparse histograms.
638 TString title[20]= {""};
639 Int_t nbins[20] = {0};
640 Double_t min[20] = {0.};
641 Double_t max[20] = {0.};
645 nbins[dim] = fNbins/4;
647 max[dim] = 2*TMath::Pi()*(1 + 1./(nbins[dim]-1));
651 nbins[dim] = fNbins/4;
656 title[dim] = "p_{T}";
662 title[dim] = "A_{jet}";
663 nbins[dim] = fNbins/4;
669 nbins[dim] = fNbins/4;
675 nbins[dim] = fNbins/4;
680 Int_t dim1 = dim, dim2 = dim;
683 title[dim1] = "p_{T}^{corr}";
684 nbins[dim1] = fNbins*2;
691 title[dim1] = "p_{T}^{MC}";
692 nbins[dim1] = fNbins;
698 fHistJets1 = new THnSparseD("fHistJets1","fHistJets1",dim1,nbins,min,max);
699 for (Int_t i = 0; i < dim1; i++)
700 fHistJets1->GetAxis(i)->SetTitle(title[i]);
701 fOutput->Add(fHistJets1);
704 title[dim2] = "p_{T}^{corr}";
705 nbins[dim2] = fNbins*2;
711 if (fDoJet2Histogram) {
712 fHistJets2 = new THnSparseD("fHistJets2","fHistJets2",dim2,nbins,min,max);
713 for (Int_t i = 0; i < dim2; i++)
714 fHistJets2->GetAxis(i)->SetTitle(title[i]);
715 fOutput->Add(fHistJets2);
718 fHistJets2Acceptance = new THnSparseD("fHistJets2Acceptance","fHistJets2Acceptance",dim2,nbins,min,max);
719 for (Int_t i = 0; i < dim2; i++)
720 fHistJets2Acceptance->GetAxis(i)->SetTitle(title[i]);
721 fOutput->Add(fHistJets2Acceptance);
727 title[dim] = "p_{T,1}";
733 title[dim] = "p_{T,2}";
739 title[dim] = "A_{jet,1}";
740 nbins[dim] = fNbins/4;
745 title[dim] = "A_{jet,2}";
746 nbins[dim] = fNbins/4;
751 title[dim] = "distance";
752 nbins[dim] = fNbins/2;
758 nbins[dim] = fNbins/2;
764 nbins[dim] = fNbins/2;
770 title[dim] = "#deltaA_{jet}";
771 nbins[dim] = fNbins/2;
776 title[dim] = "#deltap_{T}";
777 nbins[dim] = fNbins*2;
783 title[dim] = "p_{T,1}^{corr}";
784 nbins[dim] = fNbins*2;
790 title[dim] = "p_{T,2}^{corr}";
791 nbins[dim] = fNbins*2;
796 if (fDeltaPtAxis && (fIsJet1Rho || fIsJet2Rho)) {
797 title[dim] = "#deltap_{T}^{corr}";
798 nbins[dim] = fNbins*2;
803 if (fDeltaEtaDeltaPhiAxis) {
804 title[dim] = "#delta#eta";
805 nbins[dim] = fNbins/2;
810 title[dim] = "#delta#phi";
811 nbins[dim] = fNbins/2;
812 min[dim] = -TMath::Pi()/2;
813 max[dim] = TMath::Pi()*3/2;
817 title[dim] = "p_{T,1}^{MC}";
824 title[dim] = "#deltap_{T}^{MC}";
825 nbins[dim] = fNbins*2;
833 title[dim] = "NEF_{1}";
834 nbins[dim] = fNbins/4;
839 title[dim] = "NEF_{2}";
840 nbins[dim] = fNbins/4;
847 title[dim] = "Z_{1}";
848 nbins[dim] = fNbins/4;
853 title[dim] = "Z_{2}";
854 nbins[dim] = fNbins/4;
860 fHistMatching = new THnSparseD("fHistMatching","fHistMatching",dim,nbins,min,max);
862 for (Int_t i = 0; i < dim; i++)
863 fHistMatching->GetAxis(i)->SetTitle(title[i]);
865 fOutput->Add(fHistMatching);
868 //________________________________________________________________________
869 void AliJetResponseMaker::UserCreateOutputObjects()
871 // Create user objects.
873 AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
875 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
876 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
878 if (!jets1 || !jets2) return;
880 if (jets1->GetRhoName().IsNull()) fIsJet1Rho = kFALSE;
881 else fIsJet1Rho = kTRUE;
882 if (jets2->GetRhoName().IsNull()) fIsJet2Rho = kFALSE;
883 else fIsJet2Rho = kTRUE;
890 PostData(1, fOutput); // Post data for ALL output slots > 0 here, to get at least an empty histogram
893 //________________________________________________________________________
894 void AliJetResponseMaker::FillJetHisto(Double_t Phi, Double_t Eta, Double_t Pt, Double_t A, Double_t NEF, Double_t Z, Double_t CorrPt, Double_t MCPt, Int_t Set)
897 THnSparse *histo = 0;
903 histo = fHistJets2Acceptance;
908 Double_t contents[20]={0};
910 for (Int_t i = 0; i < histo->GetNdimensions(); i++) {
911 TString title(histo->GetAxis(i)->GetTitle());
914 else if (title=="#eta")
916 else if (title=="p_{T}")
918 else if (title=="A_{jet}")
920 else if (title=="NEF")
924 else if (title=="p_{T}^{corr}")
925 contents[i] = CorrPt;
926 else if (title=="p_{T}^{MC}")
929 AliWarning(Form("Unable to fill dimension %s!",title.Data()));
932 histo->Fill(contents);
936 fHistJets1PtArea->Fill(A, Pt);
937 fHistJets1PhiEta->Fill(Eta, Phi);
938 fHistJets1ZvsPt->Fill(Z, Pt);
939 fHistJets1NEFvsPt->Fill(NEF, Pt);
940 fHistJets1CEFvsCEFPt->Fill(1-NEF, (1-NEF)*Pt);
942 fHistJets1CorrPtArea->Fill(A, CorrPt);
945 fHistJets2PtArea->Fill(A, Pt);
946 fHistJets2PhiEta->Fill(Eta, Phi);
948 fHistJets2CorrPtArea->Fill(A, CorrPt);
951 fHistJets2PtAreaAcceptance->Fill(A, Pt);
952 fHistJets2PhiEtaAcceptance->Fill(Eta, Phi);
953 fHistJets2ZvsPt->Fill(Z, Pt);
954 fHistJets2NEFvsPt->Fill(NEF, Pt);
955 fHistJets2CEFvsCEFPt->Fill(1-NEF, (1-NEF)*Pt);
957 fHistJets2CorrPtAreaAcceptance->Fill(A, CorrPt);
962 //________________________________________________________________________
963 void AliJetResponseMaker::FillMatchingHistos(Double_t Pt1, Double_t Pt2, Double_t Eta1, Double_t Eta2, Double_t Phi1, Double_t Phi2,
964 Double_t A1, Double_t A2, Double_t d, Double_t CE1, Double_t CE2, Double_t CorrPt1, Double_t CorrPt2,
965 Double_t MCPt1, Double_t NEF1, Double_t NEF2, Double_t Z1, Double_t Z2)
968 Double_t contents[20]={0};
970 for (Int_t i = 0; i < fHistMatching->GetNdimensions(); i++) {
971 TString title(fHistMatching->GetAxis(i)->GetTitle());
972 if (title=="p_{T,1}")
974 else if (title=="p_{T,2}")
976 else if (title=="A_{jet,1}")
978 else if (title=="A_{jet,2}")
980 else if (title=="distance")
982 else if (title=="CE1")
984 else if (title=="CE2")
986 else if (title=="#deltaA_{jet}")
988 else if (title=="#deltap_{T}")
989 contents[i] = Pt1-Pt2;
990 else if (title=="#delta#eta")
991 contents[i] = Eta1-Eta2;
992 else if (title=="#delta#phi")
993 contents[i] = Phi1-Phi2;
994 else if (title=="p_{T,1}^{corr}")
995 contents[i] = CorrPt1;
996 else if (title=="p_{T,2}^{corr}")
997 contents[i] = CorrPt2;
998 else if (title=="#deltap_{T}^{corr}")
999 contents[i] = CorrPt1-CorrPt2;
1000 else if (title=="p_{T,1}^{MC}")
1001 contents[i] = MCPt1;
1002 else if (title=="#deltap_{T}^{MC}")
1003 contents[i] = MCPt1-Pt2;
1004 else if (title=="NEF_{1}")
1006 else if (title=="NEF_{2}")
1008 else if (title=="Z_{1}")
1010 else if (title=="Z_{2}")
1013 AliWarning(Form("Unable to fill dimension %s!",title.Data()));
1016 fHistMatching->Fill(contents);
1019 fHistCommonEnergy1vsJet1Pt->Fill(CE1, Pt1);
1020 fHistCommonEnergy2vsJet2Pt->Fill(CE2, Pt2);
1022 fHistDistancevsJet1Pt->Fill(d, Pt1);
1023 fHistDistancevsJet2Pt->Fill(d, Pt2);
1025 fHistDistancevsCommonEnergy1->Fill(d, CE1);
1026 fHistDistancevsCommonEnergy2->Fill(d, CE2);
1027 fHistCommonEnergy1vsCommonEnergy2->Fill(CE1, CE2);
1029 fHistDeltaEtaDeltaPhi->Fill(Eta1-Eta2,Phi1-Phi2);
1031 fHistJet2PtOverJet1PtvsJet2Pt->Fill(Pt2, Pt2 / Pt1);
1032 fHistJet1PtOverJet2PtvsJet1Pt->Fill(Pt1, Pt1 / Pt2);
1034 Double_t dpt = Pt1 - Pt2;
1035 fHistDeltaPtvsJet1Pt->Fill(Pt1, dpt);
1036 fHistDeltaPtvsJet2Pt->Fill(Pt2, dpt);
1037 fHistDeltaPtOverJet1PtvsJet1Pt->Fill(Pt1, dpt/Pt1);
1038 fHistDeltaPtOverJet2PtvsJet2Pt->Fill(Pt2, dpt/Pt2);
1040 fHistDeltaPtvsDistance->Fill(d, dpt);
1041 fHistDeltaPtvsCommonEnergy1->Fill(CE1, dpt);
1042 fHistDeltaPtvsCommonEnergy2->Fill(CE2, dpt);
1044 fHistDeltaPtvsArea1->Fill(A1, dpt);
1045 fHistDeltaPtvsArea2->Fill(A2, dpt);
1047 Double_t darea = A1 - A2;
1048 fHistDeltaPtvsDeltaArea->Fill(darea, dpt);
1050 fHistJet1PtvsJet2Pt->Fill(Pt1, Pt2);
1052 if (fIsJet1Rho || fIsJet2Rho) {
1053 Double_t dcorrpt = CorrPt1 - CorrPt2;
1054 fHistDeltaCorrPtvsJet1CorrPt->Fill(CorrPt1, dcorrpt);
1055 fHistDeltaCorrPtvsJet2CorrPt->Fill(CorrPt2, dcorrpt);
1056 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt->Fill(CorrPt1, dcorrpt/CorrPt1);
1057 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt->Fill(CorrPt2, dcorrpt/CorrPt2);
1058 fHistDeltaCorrPtvsDistance->Fill(d, dcorrpt);
1059 fHistDeltaCorrPtvsCommonEnergy1->Fill(CE1, dcorrpt);
1060 fHistDeltaCorrPtvsCommonEnergy2->Fill(CE2, dcorrpt);
1061 fHistDeltaCorrPtvsArea1->Fill(A1, dcorrpt);
1062 fHistDeltaCorrPtvsArea2->Fill(A2, dcorrpt);
1063 fHistDeltaCorrPtvsDeltaArea->Fill(darea, dcorrpt);
1064 fHistJet1CorrPtvsJet2CorrPt->Fill(CorrPt1, CorrPt2);
1068 Double_t dmcpt = MCPt1 - Pt2;
1069 fHistDeltaMCPtvsJet1MCPt->Fill(MCPt1, dmcpt);
1070 fHistDeltaMCPtvsJet2Pt->Fill(Pt2, dmcpt);
1071 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt->Fill(MCPt1, dmcpt/MCPt1);
1072 fHistDeltaMCPtOverJet2PtvsJet2Pt->Fill(Pt2, dmcpt/Pt2);
1073 fHistDeltaMCPtvsDistance->Fill(d, dmcpt);
1074 fHistDeltaMCPtvsCommonEnergy1->Fill(CE1, dmcpt);
1075 fHistDeltaMCPtvsCommonEnergy2->Fill(CE2, dmcpt);
1076 fHistDeltaMCPtvsArea1->Fill(A1, dmcpt);
1077 fHistDeltaMCPtvsArea2->Fill(A2, dmcpt);
1078 fHistDeltaMCPtvsDeltaArea->Fill(darea, dmcpt);
1079 fHistJet1MCPtvsJet2Pt->Fill(MCPt1, Pt2);
1084 //________________________________________________________________________
1085 void AliJetResponseMaker::ExecOnce()
1089 AliAnalysisTaskEmcalJet::ExecOnce();
1091 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1092 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1094 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return;
1096 if (fMatching == kMCLabel && (!jets2->GetIsParticleLevel() || jets1->GetIsParticleLevel())) {
1097 if (jets1->GetIsParticleLevel() == jets2->GetIsParticleLevel()) {
1098 AliWarning("Changing matching type from MC label to same collection...");
1099 fMatching = kSameCollections;
1102 AliWarning("Changing matching type from MC label to geometrical...");
1103 fMatching = kGeometrical;
1106 else if (fMatching == kSameCollections && jets1->GetIsParticleLevel() != jets2->GetIsParticleLevel()) {
1107 if (jets2->GetIsParticleLevel() && !jets1->GetIsParticleLevel()) {
1108 AliWarning("Changing matching type from same collection to MC label...");
1109 fMatching = kMCLabel;
1112 AliWarning("Changing matching type from same collection to geometrical...");
1113 fMatching = kGeometrical;
1118 //________________________________________________________________________
1119 Bool_t AliJetResponseMaker::Run()
1121 // Find the closest jets
1123 if (fMatching == kNoMatching)
1126 return DoJetMatching();
1129 //________________________________________________________________________
1130 Bool_t AliJetResponseMaker::DoJetMatching()
1132 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1133 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1135 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return kFALSE;
1139 AliEmcalJet* jet1 = 0;
1141 jets1->ResetCurrentID();
1142 while ((jet1 = jets1->GetNextJet())) {
1144 AliEmcalJet *jet2 = jet1->ClosestJet();
1146 if (!jet2) continue;
1147 if (jet2->ClosestJet() != jet1) continue;
1148 if (jet1->ClosestJetDistance() > fMatchingPar1 || jet2->ClosestJetDistance() > fMatchingPar2) continue;
1150 // Matched jet found
1151 jet1->SetMatchedToClosest(fMatching);
1152 jet2->SetMatchedToClosest(fMatching);
1153 AliDebug(2,Form("Found matching: jet1 pt = %f, eta = %f, phi = %f, jet2 pt = %f, eta = %f, phi = %f",
1154 jet1->Pt(), jet1->Eta(), jet1->Phi(),
1155 jet2->Pt(), jet2->Eta(), jet2->Phi()));
1161 //________________________________________________________________________
1162 void AliJetResponseMaker::DoJetLoop()
1166 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1167 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1169 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return;
1171 AliEmcalJet* jet1 = 0;
1172 AliEmcalJet* jet2 = 0;
1174 jets2->ResetCurrentID();
1175 while ((jet2 = jets2->GetNextJet())) jet2->ResetMatching();
1177 jets1->ResetCurrentID();
1178 while ((jet1 = jets1->GetNextJet())) {
1179 jet1->ResetMatching();
1181 if (jet1->MCPt() < fMinJetMCPt) continue;
1183 jets2->ResetCurrentID();
1184 while ((jet2 = jets2->GetNextJet())) {
1185 SetMatchingLevel(jet1, jet2, fMatching);
1190 //________________________________________________________________________
1191 void AliJetResponseMaker::GetGeometricalMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, Double_t &d) const
1193 Double_t deta = jet2->Eta() - jet1->Eta();
1194 Double_t dphi = jet2->Phi() - jet1->Phi();
1195 d = TMath::Sqrt(deta * deta + dphi * dphi);
1198 //________________________________________________________________________
1199 void AliJetResponseMaker::GetMCLabelMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, Double_t &d1, Double_t &d2) const
1201 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1202 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1204 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return;
1206 AliParticleContainer *tracks1 = jets1->GetParticleContainer();
1207 AliClusterContainer *clusters1 = jets1->GetClusterContainer();
1208 AliParticleContainer *tracks2 = jets2->GetParticleContainer();
1210 // d1 and d2 represent the matching level: 0 = maximum level of matching, 1 = the two jets are completely unrelated
1213 Double_t totalPt1 = d1; // the total pt of the reconstructed jet will be cleaned from the background
1215 // remove completely tracks that are not MC particles (label == 0)
1216 if (tracks1 && tracks1->GetArray()) {
1217 for (Int_t iTrack = 0; iTrack < jet1->GetNumberOfTracks(); iTrack++) {
1218 AliVParticle *track = jet1->TrackAt(iTrack,tracks1->GetArray());
1220 AliWarning(Form("Could not find track %d!", iTrack));
1224 Int_t MClabel = TMath::Abs(track->GetLabel());
1225 if (MClabel > fMCLabelShift) MClabel -= fMCLabelShift;
1226 if (MClabel != 0) continue;
1228 // this is not a MC particle; remove it completely
1229 AliDebug(3,Form("Track %d (pT = %f) is not a MC particle (MClabel = %d)!",iTrack,track->Pt(),MClabel));
1230 totalPt1 -= track->Pt();
1235 // remove completely clusters that are not MC particles (label == 0)
1236 if (fUseCellsToMatch && fCaloCells) {
1237 for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) {
1238 AliVCluster *clus = jet1->ClusterAt(iClus,clusters1->GetArray());
1240 AliWarning(Form("Could not find cluster %d!", iClus));
1243 TLorentzVector part;
1244 clus->GetMomentum(part, const_cast<Double_t*>(fVertex));
1246 for (Int_t iCell = 0; iCell < clus->GetNCells(); iCell++) {
1247 Int_t cellId = clus->GetCellAbsId(iCell);
1248 Double_t cellFrac = clus->GetCellAmplitudeFraction(iCell);
1250 Int_t MClabel = TMath::Abs(fCaloCells->GetCellMCLabel(cellId));
1251 if (MClabel > fMCLabelShift) MClabel -= fMCLabelShift;
1252 if (MClabel != 0) continue;
1254 // this is not a MC particle; remove it completely
1255 AliDebug(3,Form("Cell %d (frac = %f) is not a MC particle (MClabel = %d)!",iCell,cellFrac,MClabel));
1256 totalPt1 -= part.Pt() * cellFrac;
1257 d1 -= part.Pt() * cellFrac;
1262 for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) {
1263 AliVCluster *clus = jet1->ClusterAt(iClus,clusters1->GetArray());
1265 AliWarning(Form("Could not find cluster %d!", iClus));
1268 TLorentzVector part;
1269 clus->GetMomentum(part, const_cast<Double_t*>(fVertex));
1271 Int_t MClabel = TMath::Abs(clus->GetLabel());
1272 if (MClabel > fMCLabelShift) MClabel -= fMCLabelShift;
1273 if (MClabel != 0) continue;
1275 // this is not a MC particle; remove it completely
1276 AliDebug(3,Form("Cluster %d (pT = %f) is not a MC particle (MClabel = %d)!",iClus,part.Pt(),MClabel));
1277 totalPt1 -= part.Pt();
1282 for (Int_t iTrack2 = 0; iTrack2 < jet2->GetNumberOfTracks(); iTrack2++) {
1283 Bool_t track2Found = kFALSE;
1284 Int_t index2 = jet2->TrackAt(iTrack2);
1286 // now look for common particles in the track array
1287 for (Int_t iTrack = 0; iTrack < jet1->GetNumberOfTracks(); iTrack++) {
1288 AliVParticle *track = jet1->TrackAt(iTrack,tracks1->GetArray());
1290 AliWarning(Form("Could not find track %d!", iTrack));
1293 Int_t MClabel = TMath::Abs(track->GetLabel());
1294 if (MClabel > fMCLabelShift) MClabel -= fMCLabelShift;
1295 if (MClabel <= 0) continue;
1298 index = tracks2->GetIndexFromLabel(MClabel);
1300 AliDebug(2,Form("Track %d (pT = %f) does not have an associated MC particle (MClabel = %d)!",iTrack,track->Pt(),MClabel));
1304 if (index2 != index) continue;
1306 // found common particle
1310 AliVParticle *MCpart = tracks2->GetParticle(index2);
1311 AliDebug(3,Form("Track %d (pT = %f, eta = %f, phi = %f) is associated with the MC particle %d (pT = %f, eta = %f, phi = %f)!",
1312 iTrack,track->Pt(),track->Eta(),track->Phi(),MClabel,MCpart->Pt(),MCpart->Eta(),MCpart->Phi()));
1316 track2Found = kTRUE;
1319 // now look for common particles in the cluster array
1320 if (fUseCellsToMatch && fCaloCells) { // if the cell colection is available, look for cells with a matched MC particle
1321 for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) {
1322 AliVCluster *clus = jet1->ClusterAt(iClus,fCaloClusters);
1324 AliWarning(Form("Could not find cluster %d!", iClus));
1327 TLorentzVector part;
1328 clus->GetMomentum(part, const_cast<Double_t*>(fVertex));
1330 for (Int_t iCell = 0; iCell < clus->GetNCells(); iCell++) {
1331 Int_t cellId = clus->GetCellAbsId(iCell);
1332 Double_t cellFrac = clus->GetCellAmplitudeFraction(iCell);
1334 Int_t MClabel = TMath::Abs(fCaloCells->GetCellMCLabel(cellId));
1335 if (MClabel > fMCLabelShift) MClabel -= fMCLabelShift;
1336 if (MClabel <= 0) continue;
1339 index1 = tracks2->GetIndexFromLabel(MClabel);
1341 AliDebug(3,Form("Cell %d (frac = %f) does not have an associated MC particle (MClabel = %d)!",iCell,cellFrac,MClabel));
1345 if (index2 != index1) continue;
1347 // found common particle
1348 d1 -= part.Pt() * cellFrac;
1350 if (!track2Found) { // only if it is not already found among charged tracks (charged particles are most likely already found)
1351 AliVParticle *MCpart = tracks2->GetParticle(index2);
1352 AliDebug(3,Form("Cell %d belonging to cluster %d (pT = %f, eta = %f, phi = %f) is associated with the MC particle %d (pT = %f, eta = %f, phi = %f)!",
1353 iCell,iClus,part.Pt(),part.Eta(),part.Phi(),MClabel,MCpart->Pt(),MCpart->Eta(),MCpart->Phi()));
1354 d2 -= MCpart->Pt() * cellFrac;
1357 track2Found = kTRUE;
1361 else { //otherwise look for the first contributor to the cluster, and if matched to a MC label remove it
1362 for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) {
1363 AliVCluster *clus = jet1->ClusterAt(iClus,fCaloClusters);
1365 AliWarning(Form("Could not find cluster %d!", iClus));
1368 TLorentzVector part;
1369 clus->GetMomentum(part, const_cast<Double_t*>(fVertex));
1371 Int_t MClabel = TMath::Abs(clus->GetLabel());
1372 if (MClabel > fMCLabelShift) MClabel -= fMCLabelShift;
1373 if (MClabel <= 0) continue;
1376 index = tracks2->GetIndexFromLabel(MClabel);
1379 AliDebug(3,Form("Cluster %d (pT = %f) does not have an associated MC particle (MClabel = %d)!",iClus,part.Pt(),MClabel));
1383 if (index2 != index) continue;
1385 // found common particle
1388 if (!track2Found) { // only if it is not already found among charged tracks (charged particles are most likely already found)
1389 AliVParticle *MCpart = tracks2->GetParticle(index2);
1390 AliDebug(3,Form("Cluster %d (pT = %f, eta = %f, phi = %f) is associated with the MC particle %d (pT = %f, eta = %f, phi = %f)!",
1391 iClus,part.Pt(),part.Eta(),part.Phi(),MClabel,MCpart->Pt(),MCpart->Eta(),MCpart->Phi()));
1396 track2Found = kTRUE;
1418 //________________________________________________________________________
1419 void AliJetResponseMaker::GetSameCollectionsMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, Double_t &d1, Double_t &d2) const
1421 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1422 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1424 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return;
1426 AliParticleContainer *tracks1 = jets1->GetParticleContainer();
1427 AliClusterContainer *clusters1 = jets1->GetClusterContainer();
1428 AliParticleContainer *tracks2 = jets2->GetParticleContainer();
1429 AliClusterContainer *clusters2 = jets2->GetClusterContainer();
1431 // d1 and d2 represent the matching level: 0 = maximum level of matching, 1 = the two jets are completely unrelated
1435 if (tracks1 && tracks2) {
1437 for (Int_t iTrack2 = 0; iTrack2 < jet2->GetNumberOfTracks(); iTrack2++) {
1438 Int_t index2 = jet2->TrackAt(iTrack2);
1439 for (Int_t iTrack1 = 0; iTrack1 < jet1->GetNumberOfTracks(); iTrack1++) {
1440 Int_t index1 = jet1->TrackAt(iTrack1);
1441 if (index2 == index1) { // found common particle
1442 AliVParticle *part1 = tracks1->GetParticle(index1);
1444 AliWarning(Form("Could not find track %d!", index1));
1447 AliVParticle *part2 = tracks2->GetParticle(index2);
1449 AliWarning(Form("Could not find track %d!", index2));
1462 if (clusters1 && clusters2) {
1464 if (fUseCellsToMatch) {
1465 const Int_t nClus1 = jet1->GetNumberOfClusters();
1467 Int_t ncells1[nClus1];
1468 UShort_t *cellsId1[nClus1];
1469 Double_t *cellsFrac1[nClus1];
1470 Int_t *sortedIndexes1[nClus1];
1471 Double_t ptClus1[nClus1];
1472 for (Int_t iClus1 = 0; iClus1 < nClus1; iClus1++) {
1473 Int_t index1 = jet1->ClusterAt(iClus1);
1474 AliVCluster *clus1 = clusters1->GetCluster(index1);
1476 AliWarning(Form("Could not find cluster %d!", index1));
1477 ncells1[iClus1] = 0;
1478 cellsId1[iClus1] = 0;
1479 cellsFrac1[iClus1] = 0;
1480 sortedIndexes1[iClus1] = 0;
1481 ptClus1[iClus1] = 0;
1484 TLorentzVector part1;
1485 clus1->GetMomentum(part1, const_cast<Double_t*>(fVertex));
1487 ncells1[iClus1] = clus1->GetNCells();
1488 cellsId1[iClus1] = clus1->GetCellsAbsId();
1489 cellsFrac1[iClus1] = clus1->GetCellsAmplitudeFraction();
1490 sortedIndexes1[iClus1] = new Int_t[ncells1[iClus1]];
1491 ptClus1[iClus1] = part1.Pt();
1493 TMath::Sort(ncells1[iClus1], cellsId1[iClus1], sortedIndexes1[iClus1], kFALSE);
1496 const Int_t nClus2 = jet2->GetNumberOfClusters();
1498 const Int_t maxNcells2 = 11520;
1499 Int_t sortedIndexes2[maxNcells2];
1500 for (Int_t iClus2 = 0; iClus2 < nClus2; iClus2++) {
1501 Int_t index2 = jet2->ClusterAt(iClus2);
1502 AliVCluster *clus2 = clusters2->GetCluster(index2);
1504 AliWarning(Form("Could not find cluster %d!", index2));
1507 Int_t ncells2 = clus2->GetNCells();
1508 if (ncells2 >= maxNcells2) {
1509 AliError(Form("Number of cells in the cluster %d >= %d",ncells2,maxNcells2));
1512 UShort_t *cellsId2 = clus2->GetCellsAbsId();
1513 Double_t *cellsFrac2 = clus2->GetCellsAmplitudeFraction();
1515 TLorentzVector part2;
1516 clus2->GetMomentum(part2, const_cast<Double_t*>(fVertex));
1517 Double_t ptClus2 = part2.Pt();
1519 TMath::Sort(ncells2, cellsId2, sortedIndexes2, kFALSE);
1521 for (Int_t iClus1 = 0; iClus1 < nClus1; iClus1++) {
1522 if (sortedIndexes1[iClus1] == 0)
1524 Int_t iCell1 = 0, iCell2 = 0;
1525 while (iCell1 < ncells1[iClus1] && iCell2 < ncells2) {
1526 if (cellsId1[iClus1][sortedIndexes1[iClus1][iCell1]] == cellsId2[sortedIndexes2[iCell2]]) { // found a common cell
1527 d1 -= cellsFrac1[iClus1][sortedIndexes1[iClus1][iCell1]] * ptClus1[iClus1];
1528 d2 -= cellsFrac2[sortedIndexes2[iCell2]] * ptClus2;
1532 else if (cellsId1[iClus1][sortedIndexes1[iClus1][iCell1]] > cellsId2[sortedIndexes2[iCell2]]) {
1543 for (Int_t iClus2 = 0; iClus2 < jet2->GetNumberOfClusters(); iClus2++) {
1544 Int_t index2 = jet2->ClusterAt(iClus2);
1545 for (Int_t iClus1 = 0; iClus1 < jet1->GetNumberOfClusters(); iClus1++) {
1546 Int_t index1 = jet1->ClusterAt(iClus1);
1547 if (index2 == index1) { // found common particle
1548 AliVCluster *clus1 = clusters1->GetCluster(index1);
1550 AliWarning(Form("Could not find cluster %d!", index1));
1553 AliVCluster *clus2 = clusters2->GetCluster(index2);
1555 AliWarning(Form("Could not find cluster %d!", index2));
1558 TLorentzVector part1, part2;
1559 clus1->GetMomentum(part1, const_cast<Double_t*>(fVertex));
1560 clus2->GetMomentum(part2, const_cast<Double_t*>(fVertex));
1588 //________________________________________________________________________
1589 void AliJetResponseMaker::SetMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, MatchingType matching)
1596 GetGeometricalMatchingLevel(jet1,jet2,d1);
1599 case kMCLabel: // jet1 = detector level and jet2 = particle level!
1600 GetMCLabelMatchingLevel(jet1,jet2,d1,d2);
1602 case kSameCollections:
1603 GetSameCollectionsMatchingLevel(jet1,jet2,d1,d2);
1611 if (d1 < jet1->ClosestJetDistance()) {
1612 jet1->SetSecondClosestJet(jet1->ClosestJet(), jet1->ClosestJetDistance());
1613 jet1->SetClosestJet(jet2, d1);
1615 else if (d1 < jet1->SecondClosestJetDistance()) {
1616 jet1->SetSecondClosestJet(jet2, d1);
1622 if (d2 < jet2->ClosestJetDistance()) {
1623 jet2->SetSecondClosestJet(jet2->ClosestJet(), jet2->ClosestJetDistance());
1624 jet2->SetClosestJet(jet1, d2);
1626 else if (d2 < jet2->SecondClosestJetDistance()) {
1627 jet2->SetSecondClosestJet(jet1, d2);
1632 //________________________________________________________________________
1633 Bool_t AliJetResponseMaker::FillHistograms()
1637 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1638 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1640 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return kFALSE;
1642 AliEmcalJet* jet1 = 0;
1643 AliEmcalJet* jet2 = 0;
1645 jets2->ResetCurrentID();
1646 while ((jet2 = jets2->GetNextJet())) {
1647 AliDebug(2,Form("Processing jet (2) %d", jets2->GetCurrentID()));
1649 if (fDoJet2Histogram)
1650 FillJetHisto(jet2->Phi(), jet2->Eta(), jet2->Pt(), jet2->Area(), jet2->NEF(), jet2->MaxPartPt()/jet2->Pt(),
1651 jet2->Pt() - jets2->GetRhoVal() * jet2->Area(), jet2->MCPt(), 2);
1653 if (jets2->AcceptJet(jet2))
1654 FillJetHisto(jet2->Phi(), jet2->Eta(), jet2->Pt(), jet2->Area(), jet2->NEF(), jet2->MaxPartPt()/jet2->Pt(),
1655 jet2->Pt() - jets2->GetRhoVal() * jet2->Area(), jet2->MCPt(), 3);
1657 jet1 = jet2->MatchedJet();
1659 if (!jet1) continue;
1660 if (!jets1->AcceptJet(jet1)) continue;
1661 if (jet1->MCPt() < fMinJetMCPt) continue;
1663 Double_t d=-1, ce1=-1, ce2=-1;
1664 if (jet2->GetMatchingType() == kGeometrical) {
1665 if (jets2->GetIsParticleLevel() && !jets1->GetIsParticleLevel()) // the other way around is not supported
1666 GetMCLabelMatchingLevel(jet1, jet2, ce1, ce2);
1667 else if (jets1->GetIsParticleLevel() == jets2->GetIsParticleLevel())
1668 GetSameCollectionsMatchingLevel(jet1, jet2, ce1, ce2);
1670 d = jet2->ClosestJetDistance();
1672 else if (jet2->GetMatchingType() == kMCLabel || jet2->GetMatchingType() == kSameCollections) {
1673 GetGeometricalMatchingLevel(jet1, jet2, d);
1675 ce1 = jet1->ClosestJetDistance();
1676 ce2 = jet2->ClosestJetDistance();
1679 Double_t corrpt1 = jet1->Pt() - jets1->GetRhoVal() * jet1->Area();
1680 Double_t corrpt2 = jet2->Pt() - jets2->GetRhoVal() * jet2->Area();
1682 FillMatchingHistos(jet1->Pt(), jet2->Pt(), jet1->Eta(), jet2->Eta(), jet1->Phi(), jet2->Phi(),
1683 jet1->Area(), jet2->Area(), d, ce1, ce2, corrpt1, corrpt2, jet1->MCPt(),
1684 jet1->NEF(), jet2->NEF(), jet1->MaxPartPt()/jet1->Pt(), jet2->MaxPartPt()/jet2->Pt());
1687 jets1->ResetCurrentID();
1688 while ((jet1 = jets1->GetNextAcceptJet())) {
1689 if (jet1->MCPt() < fMinJetMCPt) continue;
1690 AliDebug(2,Form("Processing jet (1) %d", jets1->GetCurrentID()));
1692 FillJetHisto(jet1->Phi(), jet1->Eta(), jet1->Pt(), jet1->Area(), jet1->NEF(), jet1->MaxPartPt()/jet1->Pt(),
1693 jet1->Pt() - jets1->GetRhoVal() * jet1->Area(), jet1->MCPt(), 1);