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),
42 fHistRejectionReason1(0),
43 fHistRejectionReason2(0),
49 fHistJets1CorrPtArea(0),
51 fHistJets1CEFvsCEFPt(0),
55 fHistJets2CorrPtArea(0),
57 fHistJets2CEFvsCEFPt(0),
59 fHistCommonEnergy1vsJet1Pt(0),
60 fHistCommonEnergy2vsJet2Pt(0),
61 fHistDistancevsJet1Pt(0),
62 fHistDistancevsJet2Pt(0),
63 fHistDistancevsCommonEnergy1(0),
64 fHistDistancevsCommonEnergy2(0),
65 fHistCommonEnergy1vsCommonEnergy2(0),
66 fHistDeltaEtaDeltaPhi(0),
67 fHistJet2PtOverJet1PtvsJet2Pt(0),
68 fHistJet1PtOverJet2PtvsJet1Pt(0),
69 fHistDeltaPtvsJet1Pt(0),
70 fHistDeltaPtvsJet2Pt(0),
71 fHistDeltaPtOverJet1PtvsJet1Pt(0),
72 fHistDeltaPtOverJet2PtvsJet2Pt(0),
73 fHistDeltaPtvsDistance(0),
74 fHistDeltaPtvsCommonEnergy1(0),
75 fHistDeltaPtvsCommonEnergy2(0),
76 fHistDeltaPtvsArea1(0),
77 fHistDeltaPtvsArea2(0),
78 fHistDeltaPtvsDeltaArea(0),
79 fHistJet1PtvsJet2Pt(0),
80 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt(0),
81 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt(0),
82 fHistDeltaCorrPtvsJet1CorrPt(0),
83 fHistDeltaCorrPtvsJet2CorrPt(0),
84 fHistDeltaCorrPtvsDistance(0),
85 fHistDeltaCorrPtvsCommonEnergy1(0),
86 fHistDeltaCorrPtvsCommonEnergy2(0),
87 fHistDeltaCorrPtvsArea1(0),
88 fHistDeltaCorrPtvsArea2(0),
89 fHistDeltaCorrPtvsDeltaArea(0),
90 fHistJet1CorrPtvsJet2CorrPt(0),
91 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt(0),
92 fHistDeltaMCPtOverJet2PtvsJet2Pt(0),
93 fHistDeltaMCPtvsJet1MCPt(0),
94 fHistDeltaMCPtvsJet2Pt(0),
95 fHistDeltaMCPtvsDistance(0),
96 fHistDeltaMCPtvsCommonEnergy1(0),
97 fHistDeltaMCPtvsCommonEnergy2(0),
98 fHistDeltaMCPtvsArea1(0),
99 fHistDeltaMCPtvsArea2(0),
100 fHistDeltaMCPtvsDeltaArea(0),
101 fHistJet1MCPtvsJet2Pt(0)
103 // Default constructor.
105 SetMakeGeneralHistograms(kTRUE);
108 //________________________________________________________________________
109 AliJetResponseMaker::AliJetResponseMaker(const char *name) :
110 AliAnalysisTaskEmcalJet(name, kTRUE),
111 fMatching(kNoMatching),
114 fUseCellsToMatch(kFALSE),
118 fDeltaEtaDeltaPhiAxis(0),
123 fHistRejectionReason1(0),
124 fHistRejectionReason2(0),
130 fHistJets1CorrPtArea(0),
131 fHistJets1NEFvsPt(0),
132 fHistJets1CEFvsCEFPt(0),
136 fHistJets2CorrPtArea(0),
137 fHistJets2NEFvsPt(0),
138 fHistJets2CEFvsCEFPt(0),
140 fHistCommonEnergy1vsJet1Pt(0),
141 fHistCommonEnergy2vsJet2Pt(0),
142 fHistDistancevsJet1Pt(0),
143 fHistDistancevsJet2Pt(0),
144 fHistDistancevsCommonEnergy1(0),
145 fHistDistancevsCommonEnergy2(0),
146 fHistCommonEnergy1vsCommonEnergy2(0),
147 fHistDeltaEtaDeltaPhi(0),
148 fHistJet2PtOverJet1PtvsJet2Pt(0),
149 fHistJet1PtOverJet2PtvsJet1Pt(0),
150 fHistDeltaPtvsJet1Pt(0),
151 fHistDeltaPtvsJet2Pt(0),
152 fHistDeltaPtOverJet1PtvsJet1Pt(0),
153 fHistDeltaPtOverJet2PtvsJet2Pt(0),
154 fHistDeltaPtvsDistance(0),
155 fHistDeltaPtvsCommonEnergy1(0),
156 fHistDeltaPtvsCommonEnergy2(0),
157 fHistDeltaPtvsArea1(0),
158 fHistDeltaPtvsArea2(0),
159 fHistDeltaPtvsDeltaArea(0),
160 fHistJet1PtvsJet2Pt(0),
161 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt(0),
162 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt(0),
163 fHistDeltaCorrPtvsJet1CorrPt(0),
164 fHistDeltaCorrPtvsJet2CorrPt(0),
165 fHistDeltaCorrPtvsDistance(0),
166 fHistDeltaCorrPtvsCommonEnergy1(0),
167 fHistDeltaCorrPtvsCommonEnergy2(0),
168 fHistDeltaCorrPtvsArea1(0),
169 fHistDeltaCorrPtvsArea2(0),
170 fHistDeltaCorrPtvsDeltaArea(0),
171 fHistJet1CorrPtvsJet2CorrPt(0),
172 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt(0),
173 fHistDeltaMCPtOverJet2PtvsJet2Pt(0),
174 fHistDeltaMCPtvsJet1MCPt(0),
175 fHistDeltaMCPtvsJet2Pt(0),
176 fHistDeltaMCPtvsDistance(0),
177 fHistDeltaMCPtvsCommonEnergy1(0),
178 fHistDeltaMCPtvsCommonEnergy2(0),
179 fHistDeltaMCPtvsArea1(0),
180 fHistDeltaMCPtvsArea2(0),
181 fHistDeltaMCPtvsDeltaArea(0),
182 fHistJet1MCPtvsJet2Pt(0)
184 // Standard constructor.
186 SetMakeGeneralHistograms(kTRUE);
189 //________________________________________________________________________
190 AliJetResponseMaker::~AliJetResponseMaker()
196 //________________________________________________________________________
197 void AliJetResponseMaker::AllocateTH2()
199 // Allocate TH2 histograms.
201 fHistJets1PhiEta = new TH2F("fHistJets1PhiEta", "fHistJets1PhiEta", 40, -1, 1, 40, 0, TMath::Pi()*2);
202 fHistJets1PhiEta->GetXaxis()->SetTitle("#eta");
203 fHistJets1PhiEta->GetYaxis()->SetTitle("#phi");
204 fOutput->Add(fHistJets1PhiEta);
206 fHistJets1PtArea = new TH2F("fHistJets1PtArea", "fHistJets1PtArea", fNbins/2, 0, 1.5, fNbins, fMinBinPt, fMaxBinPt);
207 fHistJets1PtArea->GetXaxis()->SetTitle("area");
208 fHistJets1PtArea->GetYaxis()->SetTitle("p_{T,1} (GeV/c)");
209 fHistJets1PtArea->GetZaxis()->SetTitle("counts");
210 fOutput->Add(fHistJets1PtArea);
213 fHistJets1CorrPtArea = new TH2F("fHistJets1CorrPtArea", "fHistJets1CorrPtArea",
214 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
215 fHistJets1CorrPtArea->GetXaxis()->SetTitle("area");
216 fHistJets1CorrPtArea->GetYaxis()->SetTitle("p_{T,1}^{corr} (GeV/c)");
217 fHistJets1CorrPtArea->GetZaxis()->SetTitle("counts");
218 fOutput->Add(fHistJets1CorrPtArea);
221 fHistJets1ZvsPt = new TH2F("fHistJets1ZvsPt", "fHistJets1ZvsPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
222 fHistJets1ZvsPt->GetXaxis()->SetTitle("Z");
223 fHistJets1ZvsPt->GetYaxis()->SetTitle("p_{T,1} (GeV/c)");
224 fHistJets1ZvsPt->GetZaxis()->SetTitle("counts");
225 fOutput->Add(fHistJets1ZvsPt);
227 fHistJets1NEFvsPt = new TH2F("fHistJets1NEFvsPt", "fHistJets1NEFvsPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
228 fHistJets1NEFvsPt->GetXaxis()->SetTitle("NEF");
229 fHistJets1NEFvsPt->GetYaxis()->SetTitle("p_{T,1} (GeV/c)");
230 fHistJets1NEFvsPt->GetZaxis()->SetTitle("counts");
231 fOutput->Add(fHistJets1NEFvsPt);
233 fHistJets1CEFvsCEFPt = new TH2F("fHistJets1CEFvsCEFPt", "fHistJets1CEFvsCEFPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
234 fHistJets1CEFvsCEFPt->GetXaxis()->SetTitle("1-NEF");
235 fHistJets1CEFvsCEFPt->GetYaxis()->SetTitle("(1-NEF)*p_{T,1} (GeV/c)");
236 fHistJets1CEFvsCEFPt->GetZaxis()->SetTitle("counts");
237 fOutput->Add(fHistJets1CEFvsCEFPt);
241 fHistJets2PhiEta = new TH2F("fHistJets2PhiEta", "fHistJets2PhiEta", 40, -1, 1, 40, 0, TMath::Pi()*2);
242 fHistJets2PhiEta->GetXaxis()->SetTitle("#eta");
243 fHistJets2PhiEta->GetYaxis()->SetTitle("#phi");
244 fOutput->Add(fHistJets2PhiEta);
246 fHistJets2PtArea = new TH2F("fHistJets2PtArea", "fHistJets2PtArea", fNbins/2, 0, 1.5, fNbins, fMinBinPt, fMaxBinPt);
247 fHistJets2PtArea->GetXaxis()->SetTitle("area");
248 fHistJets2PtArea->GetYaxis()->SetTitle("p_{T,2} (GeV/c)");
249 fHistJets2PtArea->GetZaxis()->SetTitle("counts");
250 fOutput->Add(fHistJets2PtArea);
253 fHistJets2CorrPtArea = new TH2F("fHistJets2CorrPtArea", "fHistJets2CorrPtArea",
254 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
255 fHistJets2CorrPtArea->GetXaxis()->SetTitle("area");
256 fHistJets2CorrPtArea->GetYaxis()->SetTitle("p_{T,2}^{corr} (GeV/c)");
257 fHistJets2CorrPtArea->GetZaxis()->SetTitle("counts");
258 fOutput->Add(fHistJets2CorrPtArea);
261 fHistJets2ZvsPt = new TH2F("fHistJets2ZvsPt", "fHistJets2ZvsPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
262 fHistJets2ZvsPt->GetXaxis()->SetTitle("Z");
263 fHistJets2ZvsPt->GetYaxis()->SetTitle("p_{T,2} (GeV/c)");
264 fHistJets2ZvsPt->GetZaxis()->SetTitle("counts");
265 fOutput->Add(fHistJets2ZvsPt);
267 fHistJets2NEFvsPt = new TH2F("fHistJets2NEFvsPt", "fHistJets2NEFvsPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
268 fHistJets2NEFvsPt->GetXaxis()->SetTitle("NEF");
269 fHistJets2NEFvsPt->GetYaxis()->SetTitle("p_{T,2} (GeV/c)");
270 fHistJets2NEFvsPt->GetZaxis()->SetTitle("counts");
271 fOutput->Add(fHistJets2NEFvsPt);
273 fHistJets2CEFvsCEFPt = new TH2F("fHistJets2CEFvsCEFPt", "fHistJets2CEFvsCEFPt", 120, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt);
274 fHistJets2CEFvsCEFPt->GetXaxis()->SetTitle("1-NEF");
275 fHistJets2CEFvsCEFPt->GetYaxis()->SetTitle("(1-NEF)*p_{T,2} (GeV/c)");
276 fHistJets2CEFvsCEFPt->GetZaxis()->SetTitle("counts");
277 fOutput->Add(fHistJets2CEFvsCEFPt);
279 // Matching histograms
281 fHistCommonEnergy1vsJet1Pt = new TH2F("fHistCommonEnergy1vsJet1Pt", "fHistCommonEnergy1vsJet1Pt", fNbins/2, 0, 1.2, fNbins/2, fMinBinPt, fMaxBinPt);
282 fHistCommonEnergy1vsJet1Pt->GetXaxis()->SetTitle("Common energy 1 (%)");
283 fHistCommonEnergy1vsJet1Pt->GetYaxis()->SetTitle("p_{T,1}");
284 fHistCommonEnergy1vsJet1Pt->GetZaxis()->SetTitle("counts");
285 fOutput->Add(fHistCommonEnergy1vsJet1Pt);
287 fHistCommonEnergy2vsJet2Pt = new TH2F("fHistCommonEnergy2vsJet2Pt", "fHistCommonEnergy2vsJet2Pt", fNbins/2, 0, 1.2, fNbins/2, fMinBinPt, fMaxBinPt);
288 fHistCommonEnergy2vsJet2Pt->GetXaxis()->SetTitle("Common energy 2 (%)");
289 fHistCommonEnergy2vsJet2Pt->GetYaxis()->SetTitle("p_{T,2}");
290 fHistCommonEnergy2vsJet2Pt->GetZaxis()->SetTitle("counts");
291 fOutput->Add(fHistCommonEnergy2vsJet2Pt);
293 fHistDistancevsJet1Pt = new TH2F("fHistDistancevsJet1Pt", "fHistDistancevsJet1Pt", fNbins/2, 0, 1.2, fNbins/2, fMinBinPt, fMaxBinPt);
294 fHistDistancevsJet1Pt->GetXaxis()->SetTitle("Distance");
295 fHistDistancevsJet1Pt->GetYaxis()->SetTitle("p_{T,1}");
296 fHistDistancevsJet1Pt->GetZaxis()->SetTitle("counts");
297 fOutput->Add(fHistDistancevsJet1Pt);
299 fHistDistancevsJet2Pt = new TH2F("fHistDistancevsJet2Pt", "fHistDistancevsJet2Pt", fNbins/2, 0, 1.2, fNbins/2, fMinBinPt, fMaxBinPt);
300 fHistDistancevsJet2Pt->GetXaxis()->SetTitle("Distance");
301 fHistDistancevsJet2Pt->GetYaxis()->SetTitle("p_{T,2}");
302 fHistDistancevsJet2Pt->GetZaxis()->SetTitle("counts");
303 fOutput->Add(fHistDistancevsJet2Pt);
305 fHistDistancevsCommonEnergy1 = new TH2F("fHistDistancevsCommonEnergy1", "fHistDistancevsCommonEnergy1", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2);
306 fHistDistancevsCommonEnergy1->GetXaxis()->SetTitle("Distance");
307 fHistDistancevsCommonEnergy1->GetYaxis()->SetTitle("Common energy 1 (%)");
308 fHistDistancevsCommonEnergy1->GetZaxis()->SetTitle("counts");
309 fOutput->Add(fHistDistancevsCommonEnergy1);
311 fHistDistancevsCommonEnergy2 = new TH2F("fHistDistancevsCommonEnergy2", "fHistDistancevsCommonEnergy2", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2);
312 fHistDistancevsCommonEnergy2->GetXaxis()->SetTitle("Distance");
313 fHistDistancevsCommonEnergy2->GetYaxis()->SetTitle("Common energy 2 (%)");
314 fHistDistancevsCommonEnergy2->GetZaxis()->SetTitle("counts");
315 fOutput->Add(fHistDistancevsCommonEnergy2);
317 fHistCommonEnergy1vsCommonEnergy2 = new TH2F("fHistCommonEnergy1vsCommonEnergy2", "fHistCommonEnergy1vsCommonEnergy2", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2);
318 fHistCommonEnergy1vsCommonEnergy2->GetXaxis()->SetTitle("Common energy 1 (%)");
319 fHistCommonEnergy1vsCommonEnergy2->GetYaxis()->SetTitle("Common energy 2 (%)");
320 fHistCommonEnergy1vsCommonEnergy2->GetZaxis()->SetTitle("counts");
321 fOutput->Add(fHistCommonEnergy1vsCommonEnergy2);
323 fHistDeltaEtaDeltaPhi = new TH2F("fHistDeltaEtaDeltaPhi", "fHistDeltaEtaDeltaPhi", fNbins/4, -1, 1, fNbins/4, -TMath::Pi()/2, TMath::Pi()*3/2);
324 fHistDeltaEtaDeltaPhi->GetXaxis()->SetTitle("Common energy 1 (%)");
325 fHistDeltaEtaDeltaPhi->GetYaxis()->SetTitle("Common energy 2 (%)");
326 fHistDeltaEtaDeltaPhi->GetZaxis()->SetTitle("counts");
327 fOutput->Add(fHistDeltaEtaDeltaPhi);
329 fHistJet2PtOverJet1PtvsJet2Pt = new TH2F("fHistJet2PtOverJet1PtvsJet2Pt", "fHistJet2PtOverJet1PtvsJet2Pt", fNbins, fMinBinPt, fMaxBinPt, 300, 0, 1.5);
330 fHistJet2PtOverJet1PtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
331 fHistJet2PtOverJet1PtvsJet2Pt->GetYaxis()->SetTitle("p_{T,2} / p_{T,1}");
332 fHistJet2PtOverJet1PtvsJet2Pt->GetZaxis()->SetTitle("counts");
333 fOutput->Add(fHistJet2PtOverJet1PtvsJet2Pt);
335 fHistJet1PtOverJet2PtvsJet1Pt = new TH2F("fHistJet1PtOverJet2PtvsJet1Pt", "fHistJet1PtOverJet2PtvsJet1Pt", fNbins, fMinBinPt, fMaxBinPt, 300, 0, 1.5);
336 fHistJet1PtOverJet2PtvsJet1Pt->GetXaxis()->SetTitle("p_{T,1}");
337 fHistJet1PtOverJet2PtvsJet1Pt->GetYaxis()->SetTitle("p_{T,1} / p_{T,2}");
338 fHistJet1PtOverJet2PtvsJet1Pt->GetZaxis()->SetTitle("counts");
339 fOutput->Add(fHistJet1PtOverJet2PtvsJet1Pt);
341 fHistDeltaPtvsJet1Pt = new TH2F("fHistDeltaPtvsJet1Pt", "fHistDeltaPtvsJet1Pt",
342 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
343 fHistDeltaPtvsJet1Pt->GetXaxis()->SetTitle("p_{T,1}");
344 fHistDeltaPtvsJet1Pt->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
345 fHistDeltaPtvsJet1Pt->GetZaxis()->SetTitle("counts");
346 fOutput->Add(fHistDeltaPtvsJet1Pt);
348 fHistDeltaPtvsJet2Pt = new TH2F("fHistDeltaPtvsJet2Pt", "fHistDeltaPtvsJet2Pt",
349 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
350 fHistDeltaPtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
351 fHistDeltaPtvsJet2Pt->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
352 fHistDeltaPtvsJet2Pt->GetZaxis()->SetTitle("counts");
353 fOutput->Add(fHistDeltaPtvsJet2Pt);
355 fHistDeltaPtOverJet1PtvsJet1Pt = new TH2F("fHistDeltaPtOverJet1PtvsJet1Pt", "fHistDeltaPtOverJet1PtvsJet1Pt",
356 fNbins, fMinBinPt, fMaxBinPt, fNbins, -5, 5);
357 fHistDeltaPtOverJet1PtvsJet1Pt->GetXaxis()->SetTitle("p_{T,1}");
358 fHistDeltaPtOverJet1PtvsJet1Pt->GetYaxis()->SetTitle("#deltap_{T} / p_{T,1}");
359 fHistDeltaPtOverJet1PtvsJet1Pt->GetZaxis()->SetTitle("counts");
360 fOutput->Add(fHistDeltaPtOverJet1PtvsJet1Pt);
362 fHistDeltaPtOverJet2PtvsJet2Pt = new TH2F("fHistDeltaPtOverJet2PtvsJet2Pt", "fHistDeltaPtOverJet2PtvsJet2Pt",
363 fNbins, fMinBinPt, fMaxBinPt, fNbins, -5, 5);
364 fHistDeltaPtOverJet2PtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
365 fHistDeltaPtOverJet2PtvsJet2Pt->GetYaxis()->SetTitle("#deltap_{T} / p_{T,2}");
366 fHistDeltaPtOverJet2PtvsJet2Pt->GetZaxis()->SetTitle("counts");
367 fOutput->Add(fHistDeltaPtOverJet2PtvsJet2Pt);
369 fHistDeltaPtvsDistance = new TH2F("fHistDeltaPtvsDistance", "fHistDeltaPtvsDistance",
370 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
371 fHistDeltaPtvsDistance->GetXaxis()->SetTitle("Distance");
372 fHistDeltaPtvsDistance->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
373 fHistDeltaPtvsDistance->GetZaxis()->SetTitle("counts");
374 fOutput->Add(fHistDeltaPtvsDistance);
376 fHistDeltaPtvsCommonEnergy1 = new TH2F("fHistDeltaPtvsCommonEnergy1", "fHistDeltaPtvsCommonEnergy1",
377 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
378 fHistDeltaPtvsCommonEnergy1->GetXaxis()->SetTitle("Common energy 1 (%)");
379 fHistDeltaPtvsCommonEnergy1->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
380 fHistDeltaPtvsCommonEnergy1->GetZaxis()->SetTitle("counts");
381 fOutput->Add(fHistDeltaPtvsCommonEnergy1);
383 fHistDeltaPtvsCommonEnergy2 = new TH2F("fHistDeltaPtvsCommonEnergy2", "fHistDeltaPtvsCommonEnergy2",
384 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
385 fHistDeltaPtvsCommonEnergy2->GetXaxis()->SetTitle("Common energy 2 (%)");
386 fHistDeltaPtvsCommonEnergy2->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
387 fHistDeltaPtvsCommonEnergy2->GetZaxis()->SetTitle("counts");
388 fOutput->Add(fHistDeltaPtvsCommonEnergy2);
390 fHistDeltaPtvsArea1 = new TH2F("fHistDeltaPtvsArea1", "fHistDeltaPtvsArea1",
391 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
392 fHistDeltaPtvsArea1->GetXaxis()->SetTitle("A_{jet,1}");
393 fHistDeltaPtvsArea1->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
394 fHistDeltaPtvsArea1->GetZaxis()->SetTitle("counts");
395 fOutput->Add(fHistDeltaPtvsArea1);
397 fHistDeltaPtvsArea2 = new TH2F("fHistDeltaPtvsArea2", "fHistDeltaPtvsArea2",
398 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
399 fHistDeltaPtvsArea2->GetXaxis()->SetTitle("A_{jet,2}");
400 fHistDeltaPtvsArea2->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
401 fHistDeltaPtvsArea2->GetZaxis()->SetTitle("counts");
402 fOutput->Add(fHistDeltaPtvsArea2);
404 fHistDeltaPtvsDeltaArea = new TH2F("fHistDeltaPtvsDeltaArea", "fHistDeltaPtvsDeltaArea",
405 fNbins, -1.+1./fNbins, 1.+1./fNbins, 2*fNbins, -fMaxBinPt, fMaxBinPt);
406 fHistDeltaPtvsDeltaArea->GetXaxis()->SetTitle("#deltaA_{jet}");
407 fHistDeltaPtvsDeltaArea->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
408 fHistDeltaPtvsDeltaArea->GetZaxis()->SetTitle("counts");
409 fOutput->Add(fHistDeltaPtvsDeltaArea);
411 fHistJet1PtvsJet2Pt = new TH2F("fHistJet1PtvsJet2Pt", "fHistJet1PtvsJet2Pt", fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
412 fHistJet1PtvsJet2Pt->GetXaxis()->SetTitle("p_{T,1}");
413 fHistJet1PtvsJet2Pt->GetYaxis()->SetTitle("p_{T,2}");
414 fHistJet1PtvsJet2Pt->GetZaxis()->SetTitle("counts");
415 fOutput->Add(fHistJet1PtvsJet2Pt);
417 if (fIsJet1Rho || fIsJet2Rho) {
419 fHistDeltaCorrPtvsJet1CorrPt = new TH2F("fHistDeltaCorrPtvsJet1CorrPt", "fHistDeltaCorrPtvsJet1CorrPt",
420 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
422 fHistDeltaCorrPtvsJet1CorrPt = new TH2F("fHistDeltaCorrPtvsJet1CorrPt", "fHistDeltaCorrPtvsJet1CorrPt",
423 2*fNbins, -fMaxBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
425 fHistDeltaCorrPtvsJet1CorrPt->GetXaxis()->SetTitle("p_{T,1}^{corr}");
426 fHistDeltaCorrPtvsJet1CorrPt->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
427 fHistDeltaCorrPtvsJet1CorrPt->GetZaxis()->SetTitle("counts");
428 fOutput->Add(fHistDeltaCorrPtvsJet1CorrPt);
431 fHistDeltaCorrPtvsJet2CorrPt = new TH2F("fHistDeltaCorrPtvsJet2CorrPt", "fHistDeltaCorrPtvsJet2CorrPt",
432 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
434 fHistDeltaCorrPtvsJet2CorrPt = new TH2F("fHistDeltaCorrPtvsJet2CorrPt", "fHistDeltaCorrPtvsJet2CorrPt",
435 2*fNbins, -fMaxBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
437 fHistDeltaCorrPtvsJet2CorrPt->GetXaxis()->SetTitle("p_{T,2}^{corr}");
438 fHistDeltaCorrPtvsJet2CorrPt->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
439 fHistDeltaCorrPtvsJet2CorrPt->GetZaxis()->SetTitle("counts");
440 fOutput->Add(fHistDeltaCorrPtvsJet2CorrPt);
442 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt = new TH2F("fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt", "fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt",
443 2*fNbins, -fMaxBinPt, fMaxBinPt, fNbins, -5, 5);
444 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt->GetXaxis()->SetTitle("p_{T,1}^{corr}");
445 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt->GetYaxis()->SetTitle("#deltap_{T}^{corr} / p_{T,1}^{corr}");
446 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt->GetZaxis()->SetTitle("counts");
447 fOutput->Add(fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt);
449 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt = new TH2F("fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt", "fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt",
450 2*fNbins, -fMaxBinPt, fMaxBinPt, fNbins, -5, 5);
451 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt->GetXaxis()->SetTitle("p_{T,2}^{corr}");
452 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt->GetYaxis()->SetTitle("#deltap_{T}^{corr} / p_{T,2}^{corr}");
453 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt->GetZaxis()->SetTitle("counts");
454 fOutput->Add(fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt);
456 fHistDeltaCorrPtvsDistance = new TH2F("fHistDeltaCorrPtvsDistance", "fHistDeltaCorrPtvsDistance",
457 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
458 fHistDeltaCorrPtvsDistance->GetXaxis()->SetTitle("Distance");
459 fHistDeltaCorrPtvsDistance->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
460 fHistDeltaCorrPtvsDistance->GetZaxis()->SetTitle("counts");
461 fOutput->Add(fHistDeltaCorrPtvsDistance);
463 fHistDeltaCorrPtvsCommonEnergy1 = new TH2F("fHistDeltaCorrPtvsCommonEnergy1", "fHistDeltaCorrPtvsCommonEnergy1",
464 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
465 fHistDeltaCorrPtvsCommonEnergy1->GetXaxis()->SetTitle("Common energy 1 (%)");
466 fHistDeltaCorrPtvsCommonEnergy1->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
467 fHistDeltaCorrPtvsCommonEnergy1->GetZaxis()->SetTitle("counts");
468 fOutput->Add(fHistDeltaCorrPtvsCommonEnergy1);
470 fHistDeltaCorrPtvsCommonEnergy2 = new TH2F("fHistDeltaCorrPtvsCommonEnergy2", "fHistDeltaCorrPtvsCommonEnergy2",
471 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
472 fHistDeltaCorrPtvsCommonEnergy2->GetXaxis()->SetTitle("Common energy 2 (%)");
473 fHistDeltaCorrPtvsCommonEnergy2->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
474 fHistDeltaCorrPtvsCommonEnergy2->GetZaxis()->SetTitle("counts");
475 fOutput->Add(fHistDeltaCorrPtvsCommonEnergy2);
477 fHistDeltaCorrPtvsArea1 = new TH2F("fHistDeltaCorrPtvsArea1", "fHistDeltaCorrPtvsArea1",
478 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
479 fHistDeltaCorrPtvsArea1->GetXaxis()->SetTitle("A_{jet,1}");
480 fHistDeltaCorrPtvsArea1->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
481 fHistDeltaCorrPtvsArea1->GetZaxis()->SetTitle("counts");
482 fOutput->Add(fHistDeltaCorrPtvsArea1);
484 fHistDeltaCorrPtvsArea2 = new TH2F("fHistDeltaCorrPtvsArea2", "fHistDeltaCorrPtvsArea2",
485 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
486 fHistDeltaCorrPtvsArea2->GetXaxis()->SetTitle("A_{jet,2}");
487 fHistDeltaCorrPtvsArea2->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
488 fHistDeltaCorrPtvsArea2->GetZaxis()->SetTitle("counts");
489 fOutput->Add(fHistDeltaCorrPtvsArea2);
491 fHistDeltaCorrPtvsDeltaArea = new TH2F("fHistDeltaCorrPtvsDeltaArea", "fHistDeltaCorrPtvsDeltaArea",
492 fNbins, -1.+1./fNbins, 1.+1./fNbins, 2*fNbins, -fMaxBinPt, fMaxBinPt);
493 fHistDeltaCorrPtvsDeltaArea->GetXaxis()->SetTitle("#deltaA_{jet}");
494 fHistDeltaCorrPtvsDeltaArea->GetYaxis()->SetTitle("#deltap_{T}^{corr} (GeV/c)");
495 fHistDeltaCorrPtvsDeltaArea->GetZaxis()->SetTitle("counts");
496 fOutput->Add(fHistDeltaCorrPtvsDeltaArea);
499 fHistJet1CorrPtvsJet2CorrPt = new TH2F("fHistJet1CorrPtvsJet2CorrPt", "fHistJet1CorrPtvsJet2CorrPt",
500 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
501 else if (!fIsJet2Rho)
502 fHistJet1CorrPtvsJet2CorrPt = new TH2F("fHistJet1CorrPtvsJet2CorrPt", "fHistJet1CorrPtvsJet2CorrPt",
503 2*fNbins, -fMaxBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
505 fHistJet1CorrPtvsJet2CorrPt = new TH2F("fHistJet1CorrPtvsJet2CorrPt", "fHistJet1CorrPtvsJet2CorrPt",
506 2*fNbins, -fMaxBinPt, fMaxBinPt,
507 2*fNbins, -fMaxBinPt, fMaxBinPt);
508 fHistJet1CorrPtvsJet2CorrPt->GetXaxis()->SetTitle("p_{T,1}^{corr}");
509 fHistJet1CorrPtvsJet2CorrPt->GetYaxis()->SetTitle("p_{T,2}^{corr}");
510 fHistJet1CorrPtvsJet2CorrPt->GetZaxis()->SetTitle("counts");
511 fOutput->Add(fHistJet1CorrPtvsJet2CorrPt);
515 fHistDeltaMCPtvsJet1MCPt = new TH2F("fHistDeltaMCPtvsJet1MCPt", "fHistDeltaMCPtvsJet1MCPt",
516 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
517 fHistDeltaMCPtvsJet1MCPt->GetXaxis()->SetTitle("p_{T,1}^{MC}");
518 fHistDeltaMCPtvsJet1MCPt->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
519 fHistDeltaMCPtvsJet1MCPt->GetZaxis()->SetTitle("counts");
520 fOutput->Add(fHistDeltaMCPtvsJet1MCPt);
522 fHistDeltaMCPtvsJet2Pt = new TH2F("fHistDeltaMCPtvsJet2Pt", "fHistDeltaMCPtvsJet2Pt",
523 fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt);
524 fHistDeltaMCPtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
525 fHistDeltaMCPtvsJet2Pt->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
526 fHistDeltaMCPtvsJet2Pt->GetZaxis()->SetTitle("counts");
527 fOutput->Add(fHistDeltaMCPtvsJet2Pt);
529 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt = new TH2F("fHistDeltaMCPtOverJet1MCPtvsJet1MCPt", "fHistDeltaMCPtOverJet1MCPtvsJet1MCPt",
530 fNbins, fMinBinPt, fMaxBinPt, fNbins, -5, 5);
531 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt->GetXaxis()->SetTitle("p_{T,1}^{MC}");
532 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt->GetYaxis()->SetTitle("#deltap_{T} / p_{T,1}^{MC}");
533 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt->GetZaxis()->SetTitle("counts");
534 fOutput->Add(fHistDeltaMCPtOverJet1MCPtvsJet1MCPt);
536 fHistDeltaMCPtOverJet2PtvsJet2Pt = new TH2F("fHistDeltaMCPtOverJet2PtvsJet2Pt", "fHistDeltaMCPtOverJet2PtvsJet2Pt",
537 fNbins, fMinBinPt, fMaxBinPt, fNbins, -5, 5);
538 fHistDeltaMCPtOverJet2PtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}");
539 fHistDeltaMCPtOverJet2PtvsJet2Pt->GetYaxis()->SetTitle("#deltap_{T} / p_{T,2}");
540 fHistDeltaMCPtOverJet2PtvsJet2Pt->GetZaxis()->SetTitle("counts");
541 fOutput->Add(fHistDeltaMCPtOverJet2PtvsJet2Pt);
543 fHistDeltaMCPtvsDistance = new TH2F("fHistDeltaMCPtvsDistance", "fHistDeltaMCPtvsDistance",
544 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
545 fHistDeltaMCPtvsDistance->GetXaxis()->SetTitle("Distance");
546 fHistDeltaMCPtvsDistance->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
547 fHistDeltaMCPtvsDistance->GetZaxis()->SetTitle("counts");
548 fOutput->Add(fHistDeltaMCPtvsDistance);
550 fHistDeltaMCPtvsCommonEnergy1 = new TH2F("fHistDeltaMCPtvsCommonEnergy1", "fHistDeltaMCPtvsCommonEnergy1",
551 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
552 fHistDeltaMCPtvsCommonEnergy1->GetXaxis()->SetTitle("Common energy 1 (%)");
553 fHistDeltaMCPtvsCommonEnergy1->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
554 fHistDeltaMCPtvsCommonEnergy1->GetZaxis()->SetTitle("counts");
555 fOutput->Add(fHistDeltaMCPtvsCommonEnergy1);
557 fHistDeltaMCPtvsCommonEnergy2 = new TH2F("fHistDeltaMCPtvsCommonEnergy2", "fHistDeltaMCPtvsCommonEnergy2",
558 fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt);
559 fHistDeltaMCPtvsCommonEnergy2->GetXaxis()->SetTitle("Common energy 2 (%)");
560 fHistDeltaMCPtvsCommonEnergy2->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
561 fHistDeltaMCPtvsCommonEnergy2->GetZaxis()->SetTitle("counts");
562 fOutput->Add(fHistDeltaMCPtvsCommonEnergy2);
564 fHistDeltaMCPtvsArea1 = new TH2F("fHistDeltaMCPtvsArea1", "fHistDeltaMCPtvsArea1",
565 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
566 fHistDeltaMCPtvsArea1->GetXaxis()->SetTitle("A_{jet,1}");
567 fHistDeltaMCPtvsArea1->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
568 fHistDeltaMCPtvsArea1->GetZaxis()->SetTitle("counts");
569 fOutput->Add(fHistDeltaMCPtvsArea1);
571 fHistDeltaMCPtvsArea2 = new TH2F("fHistDeltaMCPtvsArea2", "fHistDeltaMCPtvsArea2",
572 fNbins/2, 0, 1.5, 2*fNbins, -fMaxBinPt, fMaxBinPt);
573 fHistDeltaMCPtvsArea2->GetXaxis()->SetTitle("A_{jet,2}");
574 fHistDeltaMCPtvsArea2->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
575 fHistDeltaMCPtvsArea2->GetZaxis()->SetTitle("counts");
576 fOutput->Add(fHistDeltaMCPtvsArea2);
578 fHistDeltaMCPtvsDeltaArea = new TH2F("fHistDeltaMCPtvsDeltaArea", "fHistDeltaMCPtvsDeltaArea",
579 fNbins, -1.+1./fNbins, 1.+1./fNbins, 2*fNbins, -fMaxBinPt, fMaxBinPt);
580 fHistDeltaMCPtvsDeltaArea->GetXaxis()->SetTitle("#deltaA_{jet}");
581 fHistDeltaMCPtvsDeltaArea->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)");
582 fHistDeltaMCPtvsDeltaArea->GetZaxis()->SetTitle("counts");
583 fOutput->Add(fHistDeltaMCPtvsDeltaArea);
585 fHistJet1MCPtvsJet2Pt = new TH2F("fHistJet1MCPtvsJet2Pt", "fHistJet1MCPtvsJet2Pt",
586 fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
587 fHistJet1MCPtvsJet2Pt->GetXaxis()->SetTitle("p_{T,1}^{MC}");
588 fHistJet1MCPtvsJet2Pt->GetYaxis()->SetTitle("p_{T,2}");
589 fHistJet1MCPtvsJet2Pt->GetZaxis()->SetTitle("counts");
590 fOutput->Add(fHistJet1MCPtvsJet2Pt);
594 //________________________________________________________________________
595 void AliJetResponseMaker::AllocateTHnSparse()
597 // Allocate THnSparse histograms.
599 TString title[25]= {""};
600 Int_t nbins[25] = {0};
601 Double_t min[25] = {0.};
602 Double_t max[25] = {0.};
606 nbins[dim] = fNbins/4;
608 max[dim] = 2*TMath::Pi()*(1 + 1./(nbins[dim]-1));
612 nbins[dim] = fNbins/4;
617 title[dim] = "p_{T}";
623 title[dim] = "A_{jet}";
624 nbins[dim] = fNbins/4;
631 nbins[dim] = fNbins/4;
639 nbins[dim] = fNbins/4;
645 title[dim] = "p_{T,particle}^{leading} (GeV/c)";
651 Int_t dim1 = dim, dim2 = dim;
654 title[dim1] = "p_{T}^{corr}";
655 nbins[dim1] = fNbins*2;
662 title[dim1] = "p_{T}^{MC}";
663 nbins[dim1] = fNbins;
669 fHistJets1 = new THnSparseD("fHistJets1","fHistJets1",dim1,nbins,min,max);
670 for (Int_t i = 0; i < dim1; i++)
671 fHistJets1->GetAxis(i)->SetTitle(title[i]);
672 fOutput->Add(fHistJets1);
675 title[dim2] = "p_{T}^{corr}";
676 nbins[dim2] = fNbins*2;
682 fHistJets2 = new THnSparseD("fHistJets2","fHistJets2",dim2,nbins,min,max);
683 for (Int_t i = 0; i < dim2; i++)
684 fHistJets2->GetAxis(i)->SetTitle(title[i]);
685 fOutput->Add(fHistJets2);
691 title[dim] = "p_{T,1}";
697 title[dim] = "p_{T,2}";
703 title[dim] = "A_{jet,1}";
704 nbins[dim] = fNbins/4;
709 title[dim] = "A_{jet,2}";
710 nbins[dim] = fNbins/4;
715 title[dim] = "distance";
716 nbins[dim] = fNbins/2;
722 nbins[dim] = fNbins/2;
728 nbins[dim] = fNbins/2;
733 title[dim] = "p_{T,particle,1}^{leading} (GeV/c)";
739 title[dim] = "p_{T,particle,2}^{leading} (GeV/c)";
746 title[dim] = "#deltaA_{jet}";
747 nbins[dim] = fNbins/2;
752 title[dim] = "#deltap_{T}";
753 nbins[dim] = fNbins*2;
759 title[dim] = "p_{T,1}^{corr}";
760 nbins[dim] = fNbins*2;
766 title[dim] = "p_{T,2}^{corr}";
767 nbins[dim] = fNbins*2;
772 if (fDeltaPtAxis && (fIsJet1Rho || fIsJet2Rho)) {
773 title[dim] = "#deltap_{T}^{corr}";
774 nbins[dim] = fNbins*2;
779 if (fDeltaEtaDeltaPhiAxis) {
780 title[dim] = "#delta#eta";
781 nbins[dim] = fNbins/2;
786 title[dim] = "#delta#phi";
787 nbins[dim] = fNbins/2;
788 min[dim] = -TMath::Pi()/2;
789 max[dim] = TMath::Pi()*3/2;
793 title[dim] = "p_{T,1}^{MC}";
800 title[dim] = "#deltap_{T}^{MC}";
801 nbins[dim] = fNbins*2;
809 title[dim] = "NEF_{1}";
810 nbins[dim] = fNbins/4;
815 title[dim] = "NEF_{2}";
816 nbins[dim] = fNbins/4;
823 title[dim] = "Z_{1}";
824 nbins[dim] = fNbins/4;
829 title[dim] = "Z_{2}";
830 nbins[dim] = fNbins/4;
836 fHistMatching = new THnSparseD("fHistMatching","fHistMatching",dim,nbins,min,max);
838 for (Int_t i = 0; i < dim; i++)
839 fHistMatching->GetAxis(i)->SetTitle(title[i]);
841 fOutput->Add(fHistMatching);
844 //________________________________________________________________________
845 void AliJetResponseMaker::UserCreateOutputObjects()
847 // Create user objects.
849 AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
851 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
852 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
854 if (!jets1 || !jets2) return;
856 if (jets1->GetRhoName().IsNull()) fIsJet1Rho = kFALSE;
857 else fIsJet1Rho = kTRUE;
858 if (jets2->GetRhoName().IsNull()) fIsJet2Rho = kFALSE;
859 else fIsJet2Rho = kTRUE;
861 fHistRejectionReason1 = new TH2F("fHistRejectionReason1", "fHistRejectionReason1", 32, 0, 32, 100, 0, 250);
862 fHistRejectionReason1->GetXaxis()->SetTitle("Rejection reason");
863 fHistRejectionReason1->GetYaxis()->SetTitle("p_{T,jet} (GeV/c)");
864 fHistRejectionReason1->GetZaxis()->SetTitle("counts");
865 SetRejectionReasonLabels(fHistRejectionReason1->GetXaxis());
866 fOutput->Add(fHistRejectionReason1);
868 fHistRejectionReason2 = new TH2F("fHistRejectionReason2", "fHistRejectionReason2", 32, 0, 32, 100, 0, 250);
869 fHistRejectionReason2->GetXaxis()->SetTitle("Rejection reason");
870 fHistRejectionReason2->GetYaxis()->SetTitle("p_{T,jet} (GeV/c)");
871 fHistRejectionReason2->GetZaxis()->SetTitle("counts");
872 SetRejectionReasonLabels(fHistRejectionReason2->GetXaxis());
873 fOutput->Add(fHistRejectionReason2);
880 PostData(1, fOutput); // Post data for ALL output slots > 0 here, to get at least an empty histogram
883 //________________________________________________________________________
884 void AliJetResponseMaker::FillJetHisto(Double_t Phi, Double_t Eta, Double_t Pt, Double_t A, Double_t NEF, Double_t LeadingPt, Double_t CorrPt, Double_t MCPt, Int_t Set)
887 THnSparse *histo = 0;
896 Double_t contents[20]={0};
898 for (Int_t i = 0; i < histo->GetNdimensions(); i++) {
899 TString title(histo->GetAxis(i)->GetTitle());
902 else if (title=="#eta")
904 else if (title=="p_{T}")
906 else if (title=="A_{jet}")
908 else if (title=="NEF")
911 contents[i] = LeadingPt/Pt;
912 else if (title=="p_{T}^{corr}")
913 contents[i] = CorrPt;
914 else if (title=="p_{T}^{MC}")
916 else if (title=="p_{T,particle}^{leading} (GeV/c)")
917 contents[i] = LeadingPt;
919 AliWarning(Form("Unable to fill dimension %s!",title.Data()));
922 histo->Fill(contents);
926 fHistJets1PtArea->Fill(A, Pt);
927 fHistJets1PhiEta->Fill(Eta, Phi);
928 fHistJets1ZvsPt->Fill(LeadingPt/Pt, Pt);
929 fHistJets1NEFvsPt->Fill(NEF, Pt);
930 fHistJets1CEFvsCEFPt->Fill(1-NEF, (1-NEF)*Pt);
932 fHistJets1CorrPtArea->Fill(A, CorrPt);
935 fHistJets2PtArea->Fill(A, Pt);
936 fHistJets2PhiEta->Fill(Eta, Phi);
937 fHistJets2ZvsPt->Fill(LeadingPt/Pt, Pt);
938 fHistJets2NEFvsPt->Fill(NEF, Pt);
939 fHistJets2CEFvsCEFPt->Fill(1-NEF, (1-NEF)*Pt);
941 fHistJets2CorrPtArea->Fill(A, CorrPt);
946 //________________________________________________________________________
947 void AliJetResponseMaker::FillMatchingHistos(Double_t Pt1, Double_t Pt2, Double_t Eta1, Double_t Eta2, Double_t Phi1, Double_t Phi2,
948 Double_t A1, Double_t A2, Double_t d, Double_t CE1, Double_t CE2, Double_t CorrPt1, Double_t CorrPt2,
949 Double_t MCPt1, Double_t NEF1, Double_t NEF2, Double_t LeadingPt1, Double_t LeadingPt2)
952 Double_t contents[20]={0};
954 for (Int_t i = 0; i < fHistMatching->GetNdimensions(); i++) {
955 TString title(fHistMatching->GetAxis(i)->GetTitle());
956 if (title=="p_{T,1}")
958 else if (title=="p_{T,2}")
960 else if (title=="A_{jet,1}")
962 else if (title=="A_{jet,2}")
964 else if (title=="distance")
966 else if (title=="CE1")
968 else if (title=="CE2")
970 else if (title=="#deltaA_{jet}")
972 else if (title=="#deltap_{T}")
973 contents[i] = Pt1-Pt2;
974 else if (title=="#delta#eta")
975 contents[i] = Eta1-Eta2;
976 else if (title=="#delta#phi")
977 contents[i] = Phi1-Phi2;
978 else if (title=="p_{T,1}^{corr}")
979 contents[i] = CorrPt1;
980 else if (title=="p_{T,2}^{corr}")
981 contents[i] = CorrPt2;
982 else if (title=="#deltap_{T}^{corr}")
983 contents[i] = CorrPt1-CorrPt2;
984 else if (title=="p_{T,1}^{MC}")
986 else if (title=="#deltap_{T}^{MC}")
987 contents[i] = MCPt1-Pt2;
988 else if (title=="NEF_{1}")
990 else if (title=="NEF_{2}")
992 else if (title=="Z_{1}")
993 contents[i] = LeadingPt1/Pt1;
994 else if (title=="Z_{2}")
995 contents[i] = LeadingPt2/Pt2;
996 else if (title=="p_{T,particle,1}^{leading} (GeV/c)")
997 contents[i] = LeadingPt1;
998 else if (title=="p_{T,particle,2}^{leading} (GeV/c)")
999 contents[i] = LeadingPt2;
1001 AliWarning(Form("Unable to fill dimension %s!",title.Data()));
1004 fHistMatching->Fill(contents);
1007 fHistCommonEnergy1vsJet1Pt->Fill(CE1, Pt1);
1008 fHistCommonEnergy2vsJet2Pt->Fill(CE2, Pt2);
1010 fHistDistancevsJet1Pt->Fill(d, Pt1);
1011 fHistDistancevsJet2Pt->Fill(d, Pt2);
1013 fHistDistancevsCommonEnergy1->Fill(d, CE1);
1014 fHistDistancevsCommonEnergy2->Fill(d, CE2);
1015 fHistCommonEnergy1vsCommonEnergy2->Fill(CE1, CE2);
1017 fHistDeltaEtaDeltaPhi->Fill(Eta1-Eta2,Phi1-Phi2);
1019 fHistJet2PtOverJet1PtvsJet2Pt->Fill(Pt2, Pt2 / Pt1);
1020 fHistJet1PtOverJet2PtvsJet1Pt->Fill(Pt1, Pt1 / Pt2);
1022 Double_t dpt = Pt1 - Pt2;
1023 fHistDeltaPtvsJet1Pt->Fill(Pt1, dpt);
1024 fHistDeltaPtvsJet2Pt->Fill(Pt2, dpt);
1025 fHistDeltaPtOverJet1PtvsJet1Pt->Fill(Pt1, dpt/Pt1);
1026 fHistDeltaPtOverJet2PtvsJet2Pt->Fill(Pt2, dpt/Pt2);
1028 fHistDeltaPtvsDistance->Fill(d, dpt);
1029 fHistDeltaPtvsCommonEnergy1->Fill(CE1, dpt);
1030 fHistDeltaPtvsCommonEnergy2->Fill(CE2, dpt);
1032 fHistDeltaPtvsArea1->Fill(A1, dpt);
1033 fHistDeltaPtvsArea2->Fill(A2, dpt);
1035 Double_t darea = A1 - A2;
1036 fHistDeltaPtvsDeltaArea->Fill(darea, dpt);
1038 fHistJet1PtvsJet2Pt->Fill(Pt1, Pt2);
1040 if (fIsJet1Rho || fIsJet2Rho) {
1041 Double_t dcorrpt = CorrPt1 - CorrPt2;
1042 fHistDeltaCorrPtvsJet1CorrPt->Fill(CorrPt1, dcorrpt);
1043 fHistDeltaCorrPtvsJet2CorrPt->Fill(CorrPt2, dcorrpt);
1044 fHistDeltaCorrPtOverJet1CorrPtvsJet1CorrPt->Fill(CorrPt1, dcorrpt/CorrPt1);
1045 fHistDeltaCorrPtOverJet2CorrPtvsJet2CorrPt->Fill(CorrPt2, dcorrpt/CorrPt2);
1046 fHistDeltaCorrPtvsDistance->Fill(d, dcorrpt);
1047 fHistDeltaCorrPtvsCommonEnergy1->Fill(CE1, dcorrpt);
1048 fHistDeltaCorrPtvsCommonEnergy2->Fill(CE2, dcorrpt);
1049 fHistDeltaCorrPtvsArea1->Fill(A1, dcorrpt);
1050 fHistDeltaCorrPtvsArea2->Fill(A2, dcorrpt);
1051 fHistDeltaCorrPtvsDeltaArea->Fill(darea, dcorrpt);
1052 fHistJet1CorrPtvsJet2CorrPt->Fill(CorrPt1, CorrPt2);
1056 Double_t dmcpt = MCPt1 - Pt2;
1057 fHistDeltaMCPtvsJet1MCPt->Fill(MCPt1, dmcpt);
1058 fHistDeltaMCPtvsJet2Pt->Fill(Pt2, dmcpt);
1059 fHistDeltaMCPtOverJet1MCPtvsJet1MCPt->Fill(MCPt1, dmcpt/MCPt1);
1060 fHistDeltaMCPtOverJet2PtvsJet2Pt->Fill(Pt2, dmcpt/Pt2);
1061 fHistDeltaMCPtvsDistance->Fill(d, dmcpt);
1062 fHistDeltaMCPtvsCommonEnergy1->Fill(CE1, dmcpt);
1063 fHistDeltaMCPtvsCommonEnergy2->Fill(CE2, dmcpt);
1064 fHistDeltaMCPtvsArea1->Fill(A1, dmcpt);
1065 fHistDeltaMCPtvsArea2->Fill(A2, dmcpt);
1066 fHistDeltaMCPtvsDeltaArea->Fill(darea, dmcpt);
1067 fHistJet1MCPtvsJet2Pt->Fill(MCPt1, Pt2);
1072 //________________________________________________________________________
1073 void AliJetResponseMaker::ExecOnce()
1077 AliAnalysisTaskEmcalJet::ExecOnce();
1079 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1080 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1082 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return;
1084 if (fMatching == kMCLabel && (!jets2->GetIsParticleLevel() || jets1->GetIsParticleLevel())) {
1085 if (jets1->GetIsParticleLevel() == jets2->GetIsParticleLevel()) {
1086 AliWarning("Changing matching type from MC label to same collection...");
1087 fMatching = kSameCollections;
1090 AliWarning("Changing matching type from MC label to geometrical...");
1091 fMatching = kGeometrical;
1094 else if (fMatching == kSameCollections && jets1->GetIsParticleLevel() != jets2->GetIsParticleLevel()) {
1095 if (jets2->GetIsParticleLevel() && !jets1->GetIsParticleLevel()) {
1096 AliWarning("Changing matching type from same collection to MC label...");
1097 fMatching = kMCLabel;
1100 AliWarning("Changing matching type from same collection to geometrical...");
1101 fMatching = kGeometrical;
1106 //________________________________________________________________________
1107 Bool_t AliJetResponseMaker::Run()
1109 // Find the closest jets
1111 if (fMatching == kNoMatching)
1114 return DoJetMatching();
1117 //________________________________________________________________________
1118 Bool_t AliJetResponseMaker::DoJetMatching()
1120 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1121 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1123 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return kFALSE;
1127 AliEmcalJet* jet1 = 0;
1129 jets1->ResetCurrentID();
1130 while ((jet1 = jets1->GetNextJet())) {
1132 AliEmcalJet *jet2 = jet1->ClosestJet();
1134 if (!jet2) continue;
1135 if (jet2->ClosestJet() != jet1) continue;
1136 if (jet1->ClosestJetDistance() > fMatchingPar1 || jet2->ClosestJetDistance() > fMatchingPar2) continue;
1138 // Matched jet found
1139 jet1->SetMatchedToClosest(fMatching);
1140 jet2->SetMatchedToClosest(fMatching);
1141 AliDebug(2,Form("Found matching: jet1 pt = %f, eta = %f, phi = %f, jet2 pt = %f, eta = %f, phi = %f",
1142 jet1->Pt(), jet1->Eta(), jet1->Phi(),
1143 jet2->Pt(), jet2->Eta(), jet2->Phi()));
1149 //________________________________________________________________________
1150 void AliJetResponseMaker::DoJetLoop()
1154 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1155 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1157 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return;
1159 AliEmcalJet* jet1 = 0;
1160 AliEmcalJet* jet2 = 0;
1162 jets2->ResetCurrentID();
1163 while ((jet2 = jets2->GetNextJet())) jet2->ResetMatching();
1165 jets1->ResetCurrentID();
1166 while ((jet1 = jets1->GetNextJet())) {
1167 jet1->ResetMatching();
1169 if (jet1->MCPt() < fMinJetMCPt) continue;
1171 jets2->ResetCurrentID();
1172 while ((jet2 = jets2->GetNextJet())) {
1173 SetMatchingLevel(jet1, jet2, fMatching);
1178 //________________________________________________________________________
1179 void AliJetResponseMaker::GetGeometricalMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, Double_t &d) const
1181 Double_t deta = jet2->Eta() - jet1->Eta();
1182 Double_t dphi = jet2->Phi() - jet1->Phi();
1183 d = TMath::Sqrt(deta * deta + dphi * dphi);
1186 //________________________________________________________________________
1187 void AliJetResponseMaker::GetMCLabelMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, Double_t &d1, Double_t &d2) const
1189 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1190 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1192 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return;
1194 AliParticleContainer *tracks1 = jets1->GetParticleContainer();
1195 AliClusterContainer *clusters1 = jets1->GetClusterContainer();
1196 AliParticleContainer *tracks2 = jets2->GetParticleContainer();
1198 // d1 and d2 represent the matching level: 0 = maximum level of matching, 1 = the two jets are completely unrelated
1201 Double_t totalPt1 = d1; // the total pt of the reconstructed jet will be cleaned from the background
1203 // remove completely tracks that are not MC particles (label == 0)
1204 if (tracks1 && tracks1->GetArray()) {
1205 for (Int_t iTrack = 0; iTrack < jet1->GetNumberOfTracks(); iTrack++) {
1206 AliVParticle *track = jet1->TrackAt(iTrack,tracks1->GetArray());
1208 AliWarning(Form("Could not find track %d!", iTrack));
1212 Int_t MClabel = TMath::Abs(track->GetLabel());
1213 MClabel -= fMCLabelShift;
1214 if (MClabel != 0) continue;
1216 // this is not a MC particle; remove it completely
1217 AliDebug(3,Form("Track %d (pT = %f) is not a MC particle (MClabel = %d)!",iTrack,track->Pt(),MClabel));
1218 totalPt1 -= track->Pt();
1223 // remove completely clusters that are not MC particles (label == 0)
1224 if (fUseCellsToMatch && fCaloCells) {
1225 for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) {
1226 AliVCluster *clus = jet1->ClusterAt(iClus,clusters1->GetArray());
1228 AliWarning(Form("Could not find cluster %d!", iClus));
1231 TLorentzVector part;
1232 clus->GetMomentum(part, const_cast<Double_t*>(fVertex));
1234 for (Int_t iCell = 0; iCell < clus->GetNCells(); iCell++) {
1235 Int_t cellId = clus->GetCellAbsId(iCell);
1236 Double_t cellFrac = clus->GetCellAmplitudeFraction(iCell);
1238 Int_t MClabel = TMath::Abs(fCaloCells->GetCellMCLabel(cellId));
1239 MClabel -= fMCLabelShift;
1240 if (MClabel != 0) continue;
1242 // this is not a MC particle; remove it completely
1243 AliDebug(3,Form("Cell %d (frac = %f) is not a MC particle (MClabel = %d)!",iCell,cellFrac,MClabel));
1244 totalPt1 -= part.Pt() * cellFrac;
1245 d1 -= part.Pt() * cellFrac;
1250 for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) {
1251 AliVCluster *clus = jet1->ClusterAt(iClus,clusters1->GetArray());
1253 AliWarning(Form("Could not find cluster %d!", iClus));
1256 TLorentzVector part;
1257 clus->GetMomentum(part, const_cast<Double_t*>(fVertex));
1259 Int_t MClabel = TMath::Abs(clus->GetLabel());
1260 MClabel -= fMCLabelShift;
1261 if (MClabel != 0) continue;
1263 // this is not a MC particle; remove it completely
1264 AliDebug(3,Form("Cluster %d (pT = %f) is not a MC particle (MClabel = %d)!",iClus,part.Pt(),MClabel));
1265 totalPt1 -= part.Pt();
1270 for (Int_t iTrack2 = 0; iTrack2 < jet2->GetNumberOfTracks(); iTrack2++) {
1271 Bool_t track2Found = kFALSE;
1272 Int_t index2 = jet2->TrackAt(iTrack2);
1274 // now look for common particles in the track array
1275 for (Int_t iTrack = 0; iTrack < jet1->GetNumberOfTracks(); iTrack++) {
1276 AliVParticle *track = jet1->TrackAt(iTrack,tracks1->GetArray());
1278 AliWarning(Form("Could not find track %d!", iTrack));
1281 Int_t MClabel = TMath::Abs(track->GetLabel());
1282 MClabel -= fMCLabelShift;
1283 if (MClabel <= 0) continue;
1286 index = tracks2->GetIndexFromLabel(MClabel);
1288 AliDebug(2,Form("Track %d (pT = %f) does not have an associated MC particle (MClabel = %d)!",iTrack,track->Pt(),MClabel));
1292 if (index2 != index) continue;
1294 // found common particle
1298 AliVParticle *MCpart = tracks2->GetParticle(index2);
1299 AliDebug(3,Form("Track %d (pT = %f, eta = %f, phi = %f) is associated with the MC particle %d (pT = %f, eta = %f, phi = %f)!",
1300 iTrack,track->Pt(),track->Eta(),track->Phi(),MClabel,MCpart->Pt(),MCpart->Eta(),MCpart->Phi()));
1304 track2Found = kTRUE;
1307 // now look for common particles in the cluster array
1308 if (fUseCellsToMatch && fCaloCells) { // if the cell colection is available, look for cells with a matched MC particle
1309 for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) {
1310 AliVCluster *clus = jet1->ClusterAt(iClus,fCaloClusters);
1312 AliWarning(Form("Could not find cluster %d!", iClus));
1315 TLorentzVector part;
1316 clus->GetMomentum(part, const_cast<Double_t*>(fVertex));
1318 for (Int_t iCell = 0; iCell < clus->GetNCells(); iCell++) {
1319 Int_t cellId = clus->GetCellAbsId(iCell);
1320 Double_t cellFrac = clus->GetCellAmplitudeFraction(iCell);
1322 Int_t MClabel = TMath::Abs(fCaloCells->GetCellMCLabel(cellId));
1323 MClabel -= fMCLabelShift;
1324 if (MClabel <= 0) continue;
1327 index1 = tracks2->GetIndexFromLabel(MClabel);
1329 AliDebug(3,Form("Cell %d (frac = %f) does not have an associated MC particle (MClabel = %d)!",iCell,cellFrac,MClabel));
1333 if (index2 != index1) continue;
1335 // found common particle
1336 d1 -= part.Pt() * cellFrac;
1338 if (!track2Found) { // only if it is not already found among charged tracks (charged particles are most likely already found)
1339 AliVParticle *MCpart = tracks2->GetParticle(index2);
1340 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)!",
1341 iCell,iClus,part.Pt(),part.Eta(),part.Phi(),MClabel,MCpart->Pt(),MCpart->Eta(),MCpart->Phi()));
1342 d2 -= MCpart->Pt() * cellFrac;
1345 track2Found = kTRUE;
1349 else { //otherwise look for the first contributor to the cluster, and if matched to a MC label remove it
1350 for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) {
1351 AliVCluster *clus = jet1->ClusterAt(iClus,fCaloClusters);
1353 AliWarning(Form("Could not find cluster %d!", iClus));
1356 TLorentzVector part;
1357 clus->GetMomentum(part, const_cast<Double_t*>(fVertex));
1359 Int_t MClabel = TMath::Abs(clus->GetLabel());
1360 MClabel -= fMCLabelShift;
1361 if (MClabel <= 0) continue;
1364 index = tracks2->GetIndexFromLabel(MClabel);
1367 AliDebug(3,Form("Cluster %d (pT = %f) does not have an associated MC particle (MClabel = %d)!",iClus,part.Pt(),MClabel));
1371 if (index2 != index) continue;
1373 // found common particle
1376 if (!track2Found) { // only if it is not already found among charged tracks (charged particles are most likely already found)
1377 AliVParticle *MCpart = tracks2->GetParticle(index2);
1378 AliDebug(3,Form("Cluster %d (pT = %f, eta = %f, phi = %f) is associated with the MC particle %d (pT = %f, eta = %f, phi = %f)!",
1379 iClus,part.Pt(),part.Eta(),part.Phi(),MClabel,MCpart->Pt(),MCpart->Eta(),MCpart->Phi()));
1384 track2Found = kTRUE;
1406 //________________________________________________________________________
1407 void AliJetResponseMaker::GetSameCollectionsMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, Double_t &d1, Double_t &d2) const
1409 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1410 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1412 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return;
1414 AliParticleContainer *tracks1 = jets1->GetParticleContainer();
1415 AliClusterContainer *clusters1 = jets1->GetClusterContainer();
1416 AliParticleContainer *tracks2 = jets2->GetParticleContainer();
1417 AliClusterContainer *clusters2 = jets2->GetClusterContainer();
1419 // d1 and d2 represent the matching level: 0 = maximum level of matching, 1 = the two jets are completely unrelated
1423 if (tracks1 && tracks2) {
1425 for (Int_t iTrack2 = 0; iTrack2 < jet2->GetNumberOfTracks(); iTrack2++) {
1426 Int_t index2 = jet2->TrackAt(iTrack2);
1427 for (Int_t iTrack1 = 0; iTrack1 < jet1->GetNumberOfTracks(); iTrack1++) {
1428 Int_t index1 = jet1->TrackAt(iTrack1);
1429 if (index2 == index1) { // found common particle
1430 AliVParticle *part1 = tracks1->GetParticle(index1);
1432 AliWarning(Form("Could not find track %d!", index1));
1435 AliVParticle *part2 = tracks2->GetParticle(index2);
1437 AliWarning(Form("Could not find track %d!", index2));
1450 if (clusters1 && clusters2) {
1452 if (fUseCellsToMatch) {
1453 const Int_t nClus1 = jet1->GetNumberOfClusters();
1455 Int_t ncells1[nClus1];
1456 UShort_t *cellsId1[nClus1];
1457 Double_t *cellsFrac1[nClus1];
1458 Int_t *sortedIndexes1[nClus1];
1459 Double_t ptClus1[nClus1];
1460 for (Int_t iClus1 = 0; iClus1 < nClus1; iClus1++) {
1461 Int_t index1 = jet1->ClusterAt(iClus1);
1462 AliVCluster *clus1 = clusters1->GetCluster(index1);
1464 AliWarning(Form("Could not find cluster %d!", index1));
1465 ncells1[iClus1] = 0;
1466 cellsId1[iClus1] = 0;
1467 cellsFrac1[iClus1] = 0;
1468 sortedIndexes1[iClus1] = 0;
1469 ptClus1[iClus1] = 0;
1472 TLorentzVector part1;
1473 clus1->GetMomentum(part1, const_cast<Double_t*>(fVertex));
1475 ncells1[iClus1] = clus1->GetNCells();
1476 cellsId1[iClus1] = clus1->GetCellsAbsId();
1477 cellsFrac1[iClus1] = clus1->GetCellsAmplitudeFraction();
1478 sortedIndexes1[iClus1] = new Int_t[ncells1[iClus1]];
1479 ptClus1[iClus1] = part1.Pt();
1481 TMath::Sort(ncells1[iClus1], cellsId1[iClus1], sortedIndexes1[iClus1], kFALSE);
1484 const Int_t nClus2 = jet2->GetNumberOfClusters();
1486 const Int_t maxNcells2 = 11520;
1487 Int_t sortedIndexes2[maxNcells2];
1488 for (Int_t iClus2 = 0; iClus2 < nClus2; iClus2++) {
1489 Int_t index2 = jet2->ClusterAt(iClus2);
1490 AliVCluster *clus2 = clusters2->GetCluster(index2);
1492 AliWarning(Form("Could not find cluster %d!", index2));
1495 Int_t ncells2 = clus2->GetNCells();
1496 if (ncells2 >= maxNcells2) {
1497 AliError(Form("Number of cells in the cluster %d >= %d",ncells2,maxNcells2));
1500 UShort_t *cellsId2 = clus2->GetCellsAbsId();
1501 Double_t *cellsFrac2 = clus2->GetCellsAmplitudeFraction();
1503 TLorentzVector part2;
1504 clus2->GetMomentum(part2, const_cast<Double_t*>(fVertex));
1505 Double_t ptClus2 = part2.Pt();
1507 TMath::Sort(ncells2, cellsId2, sortedIndexes2, kFALSE);
1509 for (Int_t iClus1 = 0; iClus1 < nClus1; iClus1++) {
1510 if (sortedIndexes1[iClus1] == 0)
1512 Int_t iCell1 = 0, iCell2 = 0;
1513 while (iCell1 < ncells1[iClus1] && iCell2 < ncells2) {
1514 if (cellsId1[iClus1][sortedIndexes1[iClus1][iCell1]] == cellsId2[sortedIndexes2[iCell2]]) { // found a common cell
1515 d1 -= cellsFrac1[iClus1][sortedIndexes1[iClus1][iCell1]] * ptClus1[iClus1];
1516 d2 -= cellsFrac2[sortedIndexes2[iCell2]] * ptClus2;
1520 else if (cellsId1[iClus1][sortedIndexes1[iClus1][iCell1]] > cellsId2[sortedIndexes2[iCell2]]) {
1531 for (Int_t iClus2 = 0; iClus2 < jet2->GetNumberOfClusters(); iClus2++) {
1532 Int_t index2 = jet2->ClusterAt(iClus2);
1533 for (Int_t iClus1 = 0; iClus1 < jet1->GetNumberOfClusters(); iClus1++) {
1534 Int_t index1 = jet1->ClusterAt(iClus1);
1535 if (index2 == index1) { // found common particle
1536 AliVCluster *clus1 = clusters1->GetCluster(index1);
1538 AliWarning(Form("Could not find cluster %d!", index1));
1541 AliVCluster *clus2 = clusters2->GetCluster(index2);
1543 AliWarning(Form("Could not find cluster %d!", index2));
1546 TLorentzVector part1, part2;
1547 clus1->GetMomentum(part1, const_cast<Double_t*>(fVertex));
1548 clus2->GetMomentum(part2, const_cast<Double_t*>(fVertex));
1576 //________________________________________________________________________
1577 void AliJetResponseMaker::SetMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, MatchingType matching)
1584 GetGeometricalMatchingLevel(jet1,jet2,d1);
1587 case kMCLabel: // jet1 = detector level and jet2 = particle level!
1588 GetMCLabelMatchingLevel(jet1,jet2,d1,d2);
1590 case kSameCollections:
1591 GetSameCollectionsMatchingLevel(jet1,jet2,d1,d2);
1599 if (d1 < jet1->ClosestJetDistance()) {
1600 jet1->SetSecondClosestJet(jet1->ClosestJet(), jet1->ClosestJetDistance());
1601 jet1->SetClosestJet(jet2, d1);
1603 else if (d1 < jet1->SecondClosestJetDistance()) {
1604 jet1->SetSecondClosestJet(jet2, d1);
1610 if (d2 < jet2->ClosestJetDistance()) {
1611 jet2->SetSecondClosestJet(jet2->ClosestJet(), jet2->ClosestJetDistance());
1612 jet2->SetClosestJet(jet1, d2);
1614 else if (d2 < jet2->SecondClosestJetDistance()) {
1615 jet2->SetSecondClosestJet(jet1, d2);
1620 //________________________________________________________________________
1621 Bool_t AliJetResponseMaker::FillHistograms()
1625 AliJetContainer *jets1 = static_cast<AliJetContainer*>(fJetCollArray.At(0));
1626 AliJetContainer *jets2 = static_cast<AliJetContainer*>(fJetCollArray.At(1));
1628 if (!jets1 || !jets1->GetArray() || !jets2 || !jets2->GetArray()) return kFALSE;
1630 AliEmcalJet* jet1 = 0;
1631 AliEmcalJet* jet2 = 0;
1633 jets2->ResetCurrentID();
1634 while ((jet2 = jets2->GetNextJet())) {
1636 AliDebug(2,Form("Processing jet (2) %d", jets2->GetCurrentID()));
1638 Double_t ptLeading2 = jets2->GetLeadingHadronPt(jet2);
1639 Double_t corrpt2 = jet2->Pt() - jets2->GetRhoVal() * jet2->Area();
1641 if (jets2->AcceptJet(jet2))
1642 FillJetHisto(jet2->Phi(), jet2->Eta(), jet2->Pt(), jet2->Area(), jet2->NEF(), ptLeading2,
1643 corrpt2, jet2->MCPt(), 2);
1645 fHistRejectionReason2->Fill(jets2->GetRejectionReasonBitPosition(), jet2->Pt());
1647 jet1 = jet2->MatchedJet();
1649 if (!jet1) continue;
1650 if (!jets1->AcceptJet(jet1)) continue;
1651 if (jet1->MCPt() < fMinJetMCPt) continue;
1653 Double_t d=-1, ce1=-1, ce2=-1;
1654 if (jet2->GetMatchingType() == kGeometrical) {
1655 if (jets2->GetIsParticleLevel() && !jets1->GetIsParticleLevel()) // the other way around is not supported
1656 GetMCLabelMatchingLevel(jet1, jet2, ce1, ce2);
1657 else if (jets1->GetIsParticleLevel() == jets2->GetIsParticleLevel())
1658 GetSameCollectionsMatchingLevel(jet1, jet2, ce1, ce2);
1660 d = jet2->ClosestJetDistance();
1662 else if (jet2->GetMatchingType() == kMCLabel || jet2->GetMatchingType() == kSameCollections) {
1663 GetGeometricalMatchingLevel(jet1, jet2, d);
1665 ce1 = jet1->ClosestJetDistance();
1666 ce2 = jet2->ClosestJetDistance();
1669 Double_t ptLeading1 = jets1->GetLeadingHadronPt(jet1);
1670 Double_t corrpt1 = jet1->Pt() - jets1->GetRhoVal() * jet1->Area();
1672 FillMatchingHistos(jet1->Pt(), jet2->Pt(), jet1->Eta(), jet2->Eta(), jet1->Phi(), jet2->Phi(),
1673 jet1->Area(), jet2->Area(), d, ce1, ce2, corrpt1, corrpt2, jet1->MCPt(),
1674 jet1->NEF(), jet2->NEF(), ptLeading1, ptLeading2);
1677 jets1->ResetCurrentID();
1678 while ((jet1 = jets1->GetNextJet())) {
1679 if (!jets1->AcceptJet(jet1)) {
1680 fHistRejectionReason1->Fill(jets1->GetRejectionReasonBitPosition(), jet1->Pt());
1683 if (jet1->MCPt() < fMinJetMCPt) continue;
1684 AliDebug(2,Form("Processing jet (1) %d", jets1->GetCurrentID()));
1686 Double_t ptLeading1 = jets1->GetLeadingHadronPt(jet1);
1687 Double_t corrpt1 = jet1->Pt() - jets1->GetRhoVal() * jet1->Area();
1689 FillJetHisto(jet1->Phi(), jet1->Eta(), jet1->Pt(), jet1->Area(), jet1->NEF(), ptLeading1,
1690 corrpt1, jet1->MCPt(), 1);