7 #include <TClonesArray.h>
12 #include <TLorentzVector.h>
15 #include "AliVCluster.h"
16 #include "AliVParticle.h"
17 #include "AliVTrack.h"
18 #include "AliEmcalJet.h"
19 #include "AliRhoParameter.h"
22 #include "AliAnalysisTaskDeltaPt.h"
24 ClassImp(AliAnalysisTaskDeltaPt)
26 //________________________________________________________________________
27 AliAnalysisTaskDeltaPt::AliAnalysisTaskDeltaPt() :
28 AliAnalysisTaskEmcalJet("AliAnalysisTaskDeltaPt", kTRUE),
34 fRandTracksName("TracksRandomized"),
35 fRandCaloName("CaloClustersRandomized"),
42 fEmbeddedClusterNIds(0),
43 fEmbeddedTrackNIds(0),
45 fHistRCPtExLJVSDPhiLJ(0),
46 fHistEmbJetsPhiEta(0),
47 fHistLeadPartPhiEta(0)
49 // Default constructor.
51 for (Int_t i = 0; i < 4; i++) {
55 fHistRhoVSRCPt[i] = 0;
56 fHistDeltaPtRC[i] = 0;
57 fHistDeltaPtRCExLJ[i] = 0;
58 fHistDeltaPtRCRand[i] = 0;
59 fHistEmbRejectedJetsPhiEta[i] = 0;
60 fHistEmbRejectedJetsPtArea[i] = 0;
61 fHistEmbNotFoundPt[i] = 0;
62 fHistEmbNotFoundPhiEta[i] = 0;
63 fHistEmbJetsPtArea[i] = 0;
64 fHistEmbJetsCorrPtArea[i] = 0;
65 fHistEmbPartPtvsJetPt[i] = 0;
66 fHistEmbPartPtvsJetCorrPt[i] = 0;
67 fHistJetPtvsJetCorrPt[i] = 0;
68 fHistDistLeadPart2JetAxis[i] = 0;
69 fHistEmbBkgArea[i] = 0;
70 fHistRhoVSEmbBkg[i] = 0;
71 fHistDeltaPtEmbArea[i] = 0;
74 SetMakeGeneralHistograms(kTRUE);
77 //________________________________________________________________________
78 AliAnalysisTaskDeltaPt::AliAnalysisTaskDeltaPt(const char *name) :
79 AliAnalysisTaskEmcalJet(name, kTRUE),
85 fRandTracksName("TracksRandomized"),
86 fRandCaloName("CaloClustersRandomized"),
93 fEmbeddedClusterNIds(0),
94 fEmbeddedTrackNIds(0),
96 fHistRCPtExLJVSDPhiLJ(0),
97 fHistEmbJetsPhiEta(0),
98 fHistLeadPartPhiEta(0)
100 // Standard constructor.
102 for (Int_t i = 0; i < 4; i++) {
104 fHistRCPtExLJ[i] = 0;
105 fHistRCPtRand[i] = 0;
106 fHistRhoVSRCPt[i] = 0;
107 fHistDeltaPtRC[i] = 0;
108 fHistDeltaPtRCExLJ[i] = 0;
109 fHistDeltaPtRCRand[i] = 0;
110 fHistEmbRejectedJetsPhiEta[i] = 0;
111 fHistEmbRejectedJetsPtArea[i] = 0;
112 fHistEmbNotFoundPt[i] = 0;
113 fHistEmbNotFoundPhiEta[i] = 0;
114 fHistEmbJetsPtArea[i] = 0;
115 fHistEmbJetsCorrPtArea[i] = 0;
116 fHistEmbPartPtvsJetPt[i] = 0;
117 fHistEmbPartPtvsJetCorrPt[i] = 0;
118 fHistJetPtvsJetCorrPt[i] = 0;
119 fHistDistLeadPart2JetAxis[i] = 0;
120 fHistEmbBkgArea[i] = 0;
121 fHistRhoVSEmbBkg[i] = 0;
122 fHistDeltaPtEmbArea[i] = 0;
125 SetMakeGeneralHistograms(kTRUE);
128 //________________________________________________________________________
129 AliAnalysisTaskDeltaPt::~AliAnalysisTaskDeltaPt()
134 //________________________________________________________________________
135 void AliAnalysisTaskDeltaPt::UserCreateOutputObjects()
137 // Create user output.
139 AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
141 if (!fTracksName.IsNull() || !fCaloName.IsNull()) {
142 fHistRCPhiEta = new TH2F("fHistRCPhiEta","fHistRCPhiEta", 100, -1, 1, 201, 0, TMath::Pi() * 2.01);
143 fHistRCPhiEta->GetXaxis()->SetTitle("#eta");
144 fHistRCPhiEta->GetYaxis()->SetTitle("#phi");
145 fOutput->Add(fHistRCPhiEta);
147 if (!fJetsName.IsNull()) {
148 fHistRCPtExLJVSDPhiLJ = new TH2F("fHistRCPtExLJVSDPhiLJ","fHistRCPtExLJVSDPhiLJ", fNbins, fMinBinPt, fMaxBinPt, 128, -1.6, 4.8);
149 fHistRCPtExLJVSDPhiLJ->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
150 fHistRCPtExLJVSDPhiLJ->GetYaxis()->SetTitle("#Delta#phi");
151 fOutput->Add(fHistRCPtExLJVSDPhiLJ);
155 if (!fEmbJetsName.IsNull()) {
156 fHistEmbJetsPhiEta = new TH2F("fHistEmbJetsPhiEta","fHistEmbJetsPhiEta", 100, -1, 1, 201, 0, TMath::Pi() * 2.01);
157 fHistEmbJetsPhiEta->GetXaxis()->SetTitle("#eta");
158 fHistEmbJetsPhiEta->GetYaxis()->SetTitle("#phi");
159 fOutput->Add(fHistEmbJetsPhiEta);
161 fHistLeadPartPhiEta = new TH2F("fHistLeadPartPhiEta","fHistLeadPartPhiEta", 100, -1, 1, 201, 0, TMath::Pi() * 2.01);
162 fHistLeadPartPhiEta->GetXaxis()->SetTitle("#eta");
163 fHistLeadPartPhiEta->GetYaxis()->SetTitle("#phi");
164 fOutput->Add(fHistLeadPartPhiEta);
169 const Int_t nbinsZ = 12;
170 Float_t binsZ[nbinsZ+1] = {0,1,2,3,4,5,6,7,8,9,10,20,1000};
172 Float_t *binsPt = GenerateFixedBinArray(fNbins, fMinBinPt, fMaxBinPt);
173 Float_t *binsCorrPt = GenerateFixedBinArray(fNbins*2, -fMaxBinPt, fMaxBinPt);
174 Float_t *binsArea = GenerateFixedBinArray(40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3);
176 for (Int_t i = 0; i < fNcentBins; i++) {
177 if (!fTracksName.IsNull() || !fCaloName.IsNull()) {
178 histname = "fHistRCPt_";
180 fHistRCPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
181 fHistRCPt[i]->GetXaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
182 fHistRCPt[i]->GetYaxis()->SetTitle("counts");
183 fOutput->Add(fHistRCPt[i]);
185 histname = "fHistRhoVSRCPt_";
187 fHistRhoVSRCPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
188 fHistRhoVSRCPt[i]->GetXaxis()->SetTitle("A#rho (GeV/#it{c})");
189 fHistRhoVSRCPt[i]->GetYaxis()->SetTitle("#it{p}_{T} (GeV/#it{c})");
190 fOutput->Add(fHistRhoVSRCPt[i]);
192 histname = "fHistDeltaPtRC_";
194 fHistDeltaPtRC[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
195 fHistDeltaPtRC[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
196 fHistDeltaPtRC[i]->GetYaxis()->SetTitle("counts");
197 fOutput->Add(fHistDeltaPtRC[i]);
199 if (!fJetsName.IsNull()) {
200 histname = "fHistRCPtExLJ_";
202 fHistRCPtExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
203 fHistRCPtExLJ[i]->GetXaxis()->SetTitle("#it{p}_{T}^{RC} (GeV/#it{c})");
204 fHistRCPtExLJ[i]->GetYaxis()->SetTitle("counts");
205 fOutput->Add(fHistRCPtExLJ[i]);
207 histname = "fHistDeltaPtRCExLJ_";
209 fHistDeltaPtRCExLJ[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
210 fHistDeltaPtRCExLJ[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
211 fHistDeltaPtRCExLJ[i]->GetYaxis()->SetTitle("counts");
212 fOutput->Add(fHistDeltaPtRCExLJ[i]);
216 if (!fRandTracksName.IsNull() || !fRandCaloName.IsNull()) {
217 histname = "fHistRCPtRand_";
219 fHistRCPtRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt * 2);
220 fHistRCPtRand[i]->GetXaxis()->SetTitle("#it{p}_{T}^{RC} (GeV/#it{c})");
221 fHistRCPtRand[i]->GetYaxis()->SetTitle("counts");
222 fOutput->Add(fHistRCPtRand[i]);
224 histname = "fHistDeltaPtRCRand_";
226 fHistDeltaPtRCRand[i] = new TH1F(histname.Data(), histname.Data(), fNbins * 2, -fMaxBinPt, fMaxBinPt);
227 fHistDeltaPtRCRand[i]->GetXaxis()->SetTitle("#delta#it{p}_{T}^{RC} (GeV/#it{c})");
228 fHistDeltaPtRCRand[i]->GetYaxis()->SetTitle("counts");
229 fOutput->Add(fHistDeltaPtRCRand[i]);
232 if (!fEmbJetsName.IsNull()) {
233 histname = "fHistEmbJetsPtArea_";
235 fHistEmbJetsPtArea[i] = new TH3F(histname.Data(), histname.Data(), 40, binsArea, fNbins, binsPt, nbinsZ, binsZ);
236 fHistEmbJetsPtArea[i]->GetXaxis()->SetTitle("area");
237 fHistEmbJetsPtArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb,raw} (GeV/#it{c})");
238 fOutput->Add(fHistEmbJetsPtArea[i]);
240 histname = "fHistEmbJetsCorrPtArea_";
242 fHistEmbJetsCorrPtArea[i] = new TH3F(histname.Data(), histname.Data(), 40, binsArea, fNbins * 2, binsCorrPt, nbinsZ, binsZ);
243 fHistEmbJetsCorrPtArea[i]->GetXaxis()->SetTitle("area");
244 fHistEmbJetsCorrPtArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb,corr} (GeV/#it{c})");
245 fOutput->Add(fHistEmbJetsCorrPtArea[i]);
247 histname = "fHistEmbPartPtvsJetPt_";
249 fHistEmbPartPtvsJetPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
250 fHistEmbPartPtvsJetPt[i]->GetXaxis()->SetTitle("#sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
251 fHistEmbPartPtvsJetPt[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} (GeV/#it{c})");
252 fHistEmbPartPtvsJetPt[i]->GetZaxis()->SetTitle("counts");
253 fOutput->Add(fHistEmbPartPtvsJetPt[i]);
255 histname = "fHistEmbPartPtvsJetCorrPt_";
257 fHistEmbPartPtvsJetCorrPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins*2, -fMaxBinPt, fMaxBinPt);
258 fHistEmbPartPtvsJetCorrPt[i]->GetXaxis()->SetTitle("#sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
259 fHistEmbPartPtvsJetCorrPt[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - A#rho (GeV/#it{c})");
260 fHistEmbPartPtvsJetCorrPt[i]->GetZaxis()->SetTitle("counts");
261 fOutput->Add(fHistEmbPartPtvsJetCorrPt[i]);
263 histname = "fHistJetPtvsJetCorrPt_";
265 fHistJetPtvsJetCorrPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins*2, -fMaxBinPt, fMaxBinPt);
266 fHistJetPtvsJetCorrPt[i]->GetXaxis()->SetTitle("#it{p}_{T,jet}^{emb} (GeV/#it{c})");
267 fHistJetPtvsJetCorrPt[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - A#rho (GeV/#it{c})");
268 fHistJetPtvsJetCorrPt[i]->GetZaxis()->SetTitle("counts");
269 fOutput->Add(fHistJetPtvsJetCorrPt[i]);
271 histname = "fHistDistLeadPart2JetAxis_";
273 fHistDistLeadPart2JetAxis[i] = new TH1F(histname.Data(), histname.Data(), 50, 0, 0.5);
274 fHistDistLeadPart2JetAxis[i]->GetXaxis()->SetTitle("distance");
275 fHistDistLeadPart2JetAxis[i]->GetYaxis()->SetTitle("counts");
276 fOutput->Add(fHistDistLeadPart2JetAxis[i]);
278 histname = "fHistEmbNotFoundPhiEta_";
280 fHistEmbNotFoundPhiEta[i] = new TH2F(histname.Data(), histname.Data(), 100, -1, 1, 201, 0, TMath::Pi() * 2.01);
281 fHistEmbNotFoundPhiEta[i]->GetXaxis()->SetTitle("#eta");
282 fHistEmbNotFoundPhiEta[i]->GetYaxis()->SetTitle("#phi");
283 fOutput->Add(fHistEmbNotFoundPhiEta[i]);
285 histname = "fHistEmbNotFoundPt_";
287 fHistEmbNotFoundPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
288 fHistEmbNotFoundPt[i]->GetXaxis()->SetTitle("#it{p}_{T,const}^{emb} (GeV/#it{c})");
289 fHistEmbNotFoundPt[i]->GetYaxis()->SetTitle("counts");
290 fOutput->Add(fHistEmbNotFoundPt[i]);
292 histname = "fHistEmbRejectedJetsPhiEta_";
294 fHistEmbRejectedJetsPhiEta[i] = new TH2F(histname.Data(), histname.Data(), 100, -1, 1, 201, 0, TMath::Pi() * 2.01);
295 fHistEmbRejectedJetsPhiEta[i]->GetXaxis()->SetTitle("#eta");
296 fHistEmbRejectedJetsPhiEta[i]->GetYaxis()->SetTitle("#phi");
297 fOutput->Add(fHistEmbRejectedJetsPhiEta[i]);
299 histname = "fHistEmbRejectedJetsPtArea_";
301 fHistEmbRejectedJetsPtArea[i] = new TH2F(histname.Data(), histname.Data(), 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt);
302 fHistEmbRejectedJetsPtArea[i]->GetXaxis()->SetTitle("area");
303 fHistEmbRejectedJetsPtArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb,raw} (GeV/#it{c})");
304 fOutput->Add(fHistEmbRejectedJetsPtArea[i]);
306 histname = "fHistEmbBkgArea_";
308 fHistEmbBkgArea[i] = new TH2F(histname.Data(), histname.Data(), 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt);
309 fHistEmbBkgArea[i]->GetXaxis()->SetTitle("area");
310 fHistEmbBkgArea[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - #sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
311 fOutput->Add(fHistEmbBkgArea[i]);
313 histname = "fHistRhoVSEmbBkg_";
315 fHistRhoVSEmbBkg[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt);
316 fHistRhoVSEmbBkg[i]->GetXaxis()->SetTitle("A#rho (GeV/#it{c})");
317 fHistRhoVSEmbBkg[i]->GetYaxis()->SetTitle("#it{p}_{T,jet}^{emb} - #sum#it{p}_{T,const}^{emb} (GeV/#it{c})");
318 fOutput->Add(fHistRhoVSEmbBkg[i]);
320 histname = "fHistDeltaPtEmbArea_";
322 fHistDeltaPtEmbArea[i] = new TH2F(histname.Data(), histname.Data(), 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins * 2, -fMaxBinPt, fMaxBinPt);
323 fHistDeltaPtEmbArea[i]->GetXaxis()->SetTitle("area");
324 fHistDeltaPtEmbArea[i]->GetYaxis()->SetTitle("#delta#it{p}_{T}^{emb} (GeV/#it{c})");
325 fOutput->Add(fHistDeltaPtEmbArea[i]);
329 PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
332 //________________________________________________________________________
333 Bool_t AliAnalysisTaskDeltaPt::FillHistograms()
339 // _________________________________
341 const Float_t rcArea = fJetRadius * fJetRadius * TMath::Pi();
346 if (fTracks || fCaloClusters) {
348 for (Int_t i = 0; i < fRCperEvent; i++) {
349 // Simple random cones
353 GetRandomCone(RCpt, RCeta, RCphi, 0);
355 fHistRCPhiEta->Fill(RCeta, RCphi);
356 fHistRhoVSRCPt[fCentBin]->Fill(fRhoVal * rcArea, RCpt);
358 fHistRCPt[fCentBin]->Fill(RCpt);
359 fHistDeltaPtRC[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
364 // Random cones far from leading jet
365 static Int_t sortedJets[9999] = {-1};
366 GetSortedArray(sortedJets, fJets);
368 AliEmcalJet* jet = 0;
370 if (sortedJets[0] >= 0)
371 jet = static_cast<AliEmcalJet*>(fJets->At(sortedJets[0]));
376 GetRandomCone(RCpt, RCeta, RCphi, jet);
379 Float_t dphi = RCphi - jet->Phi();
380 if (dphi > 4.8) dphi -= TMath::Pi() * 2;
381 if (dphi < -1.6) dphi += TMath::Pi() * 2;
382 fHistRCPtExLJVSDPhiLJ->Fill(RCpt, dphi);
384 fHistRCPtExLJ[fCentBin]->Fill(RCpt);
385 fHistDeltaPtRCExLJ[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
391 // Random cones with randomized particles
392 if (fRandTracks || fRandCaloClusters) {
396 GetRandomCone(RCpt, RCeta, RCphi, 0, fRandTracks, fRandCaloClusters);
398 fHistRCPtRand[fCentBin]->Fill(RCpt);
399 fHistDeltaPtRCRand[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
405 // _________________________________
409 AliEmcalJet *embJet = NextEmbeddedJet(0);
411 Int_t countEmbJets = 0;
413 while (embJet != 0) {
414 AliDebug(2,Form("Elaborating embedded jet n. %d", countEmbJets));
417 if (!AcceptJet(embJet)) {
418 AliDebug(2,"Embedded jet not accepted, skipping...");
419 fHistEmbRejectedJetsPhiEta[fCentBin]->Fill(embJet->Eta(), embJet->Phi());
420 fHistEmbRejectedJetsPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt());
422 embJet = NextEmbeddedJet();
426 Double_t maxClusterPt = 0;
427 Double_t maxClusterEta = 0;
428 Double_t maxClusterPhi = 0;
430 Double_t maxTrackPt = 0;
431 Double_t maxTrackEta = 0;
432 Double_t maxTrackPhi = 0;
434 Double_t maxPartPt = 0;
435 Double_t maxPartEta = 0;
436 Double_t maxPartPhi = 0;
438 if (fLeadingHadronType == 1 || fLeadingHadronType == 2) {
439 AliVCluster *cluster = embJet->GetLeadingCluster(fEmbCaloClusters);
441 TLorentzVector nPart;
442 cluster->GetMomentum(nPart, fVertex);
444 maxClusterEta = nPart.Eta();
445 maxClusterPhi = nPart.Phi();
446 maxClusterPt = nPart.Pt();
450 if (fLeadingHadronType == 0 || fLeadingHadronType == 2) {
451 AliVParticle *track = embJet->GetLeadingTrack(fEmbTracks);
453 maxTrackEta = track->Eta();
454 maxTrackPhi = track->Phi();
455 maxTrackPt = track->Pt();
459 if (maxTrackPt > maxClusterPt) {
460 maxPartPt = maxTrackPt;
461 maxPartEta = maxTrackEta;
462 maxPartPhi = maxTrackPhi;
465 maxPartPt = maxClusterPt;
466 maxPartEta = maxClusterEta;
467 maxPartPhi = maxClusterPhi;
470 Double_t distLeading2Jet = TMath::Sqrt((embJet->Eta() - maxPartEta) * (embJet->Eta() - maxPartEta) + (embJet->Phi() - maxPartPhi) * (embJet->Phi() - maxPartPhi));
472 fHistEmbPartPtvsJetPt[fCentBin]->Fill(embJet->MCPt(), embJet->Pt());
473 fHistEmbPartPtvsJetCorrPt[fCentBin]->Fill(embJet->MCPt(), embJet->Pt() - embJet->Area() * fRhoVal);
474 fHistLeadPartPhiEta->Fill(maxPartEta, maxPartPhi);
475 fHistDistLeadPart2JetAxis[fCentBin]->Fill(distLeading2Jet);
477 fHistEmbJetsPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt(), maxPartPt);
478 fHistEmbJetsCorrPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - fRhoVal * embJet->Area(), maxPartPt);
479 fHistEmbJetsPhiEta->Fill(embJet->Eta(), embJet->Phi());
480 fHistJetPtvsJetCorrPt[fCentBin]->Fill(embJet->Pt(), embJet->Pt() - fRhoVal * embJet->Area());
482 fHistEmbBkgArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->MCPt());
483 fHistRhoVSEmbBkg[fCentBin]->Fill(fRhoVal * embJet->Area(), embJet->Pt() - embJet->MCPt());
484 fHistDeltaPtEmbArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->Area() * fRhoVal - embJet->MCPt());
486 embJet = NextEmbeddedJet();
489 if (countEmbJets==0) {
490 AliDebug(1,"No embedded jets found!");
493 for (Int_t i = 0; i < fEmbeddedTrackNIds; i++) {
494 AliDebug(2,Form("Embedded track %d found!",i));
495 AliVParticle *track2 = static_cast<AliVParticle*>(fEmbTracks->At(fEmbeddedTrackIds[i]));
496 if (!track2) continue;
497 fHistEmbNotFoundPhiEta[fCentBin]->Fill(track2->Eta(), track2->Phi());
498 fHistEmbNotFoundPt[fCentBin]->Fill(track2->Pt());
502 if (fEmbCaloClusters) {
504 for (Int_t i = 0; i < fEmbeddedClusterNIds; i++) {
505 AliDebug(2,Form("Embedded cluster %d found!",i));
506 AliVCluster *cluster2 = static_cast<AliVCluster*>(fEmbCaloClusters->At(fEmbeddedClusterIds[i]));
507 TLorentzVector nPart;
508 cluster2->GetMomentum(nPart, fVertex);
509 fHistEmbNotFoundPhiEta[fCentBin]->Fill(nPart.Eta(), nPart.Phi());
510 fHistEmbNotFoundPt[fCentBin]->Fill(nPart.Pt());
519 //________________________________________________________________________
520 void AliAnalysisTaskDeltaPt::DoEmbTrackLoop()
524 fEmbeddedTrackNIds = 0;
529 Int_t ntracks = fEmbTracks->GetEntriesFast();
531 for (Int_t i = 0; i < ntracks; i++) {
533 AliVParticle* track = static_cast<AliVParticle*>(fEmbTracks->At(i)); // pointer to reconstructed to track
536 AliError(Form("Could not retrieve track %d",i));
540 AliVTrack* vtrack = dynamic_cast<AliVTrack*>(track);
542 if (vtrack && !AcceptTrack(vtrack))
545 if (track->GetLabel() > 0) {
546 fEmbeddedTrackIds[fEmbeddedTrackNIds] = i;
547 fEmbeddedTrackNIds++;
552 //________________________________________________________________________
553 void AliAnalysisTaskDeltaPt::DoEmbClusterLoop()
557 fEmbeddedClusterNIds = 0;
559 if (!fEmbCaloClusters)
562 Int_t nclusters = fEmbCaloClusters->GetEntriesFast();
564 for (Int_t iClusters = 0; iClusters < nclusters; iClusters++) {
565 AliVCluster* cluster = static_cast<AliVCluster*>(fEmbCaloClusters->At(iClusters));
567 AliError(Form("Could not receive cluster %d", iClusters));
571 if (!AcceptCluster(cluster))
574 if (cluster->GetLabel() > 0) {
575 fEmbeddedClusterIds[fEmbeddedClusterNIds] = iClusters;
576 fEmbeddedClusterNIds++;
581 //________________________________________________________________________
582 AliEmcalJet* AliAnalysisTaskDeltaPt::NextEmbeddedJet(Int_t i)
584 // Do the embedded jet loop.
586 static Int_t iJet = 0;
596 TLorentzVector maxClusVect;
598 const Int_t nembjets = fEmbJets->GetEntriesFast();
600 for (; iJet < nembjets; iJet++) {
602 AliEmcalJet* jet = static_cast<AliEmcalJet*>(fEmbJets->At(iJet));
605 AliError(Form("Could not receive jet %d", iJet));
609 if (jet->MCPt() < fMCJetPtThreshold)
618 //________________________________________________________________________
619 void AliAnalysisTaskDeltaPt::GetRandomCone(Float_t &pt, Float_t &eta, Float_t &phi,
620 AliEmcalJet *jet, TClonesArray* tracks, TClonesArray* clusters) const
628 clusters = fCaloClusters;
634 if (!tracks && !clusters)
645 Float_t maxEta = fJetMaxEta;
646 Float_t minEta = fJetMinEta;
647 Float_t maxPhi = fJetMaxPhi;
648 Float_t minPhi = fJetMinPhi;
650 if (maxPhi > TMath::Pi() * 2) maxPhi = TMath::Pi() * 2;
651 if (minPhi < 0) minPhi = 0;
656 eta = gRandom->Rndm() * (maxEta - minEta) + minEta;
657 phi = gRandom->Rndm() * (maxPhi - minPhi) + minPhi;
658 dLJ = TMath::Sqrt((LJeta - eta) * (LJeta - eta) + (LJphi - phi) * (LJphi - phi));
660 } while (dLJ < fMinRC2LJ && repeats < 999);
662 if (repeats == 999) {
663 AliWarning(Form("%s: Could not get random cone!", GetName()));
668 Int_t nclusters = clusters->GetEntriesFast();
669 for (Int_t iClusters = 0; iClusters < nclusters; iClusters++) {
670 AliVCluster* cluster = static_cast<AliVCluster*>(clusters->At(iClusters));
672 AliError(Form("Could not receive cluster %d", iClusters));
676 if (!AcceptCluster(cluster))
679 TLorentzVector nPart;
680 cluster->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
682 Float_t d = TMath::Sqrt((nPart.Eta() - eta) * (nPart.Eta() - eta) + (nPart.Phi() - phi) * (nPart.Phi() - phi));
690 Int_t ntracks = tracks->GetEntriesFast();
691 for(Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
692 AliVTrack* track = static_cast<AliVTrack*>(tracks->At(iTracks));
694 AliError(Form("Could not retrieve track %d",iTracks));
698 if (!AcceptTrack(track))
701 Float_t tracketa = track->Eta();
702 Float_t trackphi = track->Phi();
704 if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi + 2 * TMath::Pi()))
705 trackphi += 2 * TMath::Pi();
706 if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi - 2 * TMath::Pi()))
707 trackphi -= 2 * TMath::Pi();
709 Float_t d = TMath::Sqrt((tracketa - eta) * (tracketa - eta) + (trackphi - phi) * (trackphi - phi));
716 //________________________________________________________________________
717 void AliAnalysisTaskDeltaPt::ExecOnce()
719 // Initialize the analysis.
721 if (!fEmbJetsName.IsNull() && !fEmbJets) {
722 fEmbJets = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fEmbJetsName));
724 AliError(Form("%s: Could not retrieve embedded jets %s!", GetName(), fEmbJetsName.Data()));
727 else if (!fEmbJets->GetClass()->GetBaseClass("AliEmcalJet")) {
728 AliError(Form("%s: Collection %s does not contain AliEmcalJet objects!", GetName(), fEmbJetsName.Data()));
734 if (!fEmbCaloName.IsNull() && !fEmbCaloClusters) {
735 fEmbCaloClusters = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fEmbCaloName));
736 if (!fEmbCaloClusters) {
737 AliError(Form("%s: Could not retrieve embedded clusters %s!", GetName(), fEmbCaloName.Data()));
740 else if (!fEmbCaloClusters->GetClass()->GetBaseClass("AliVCluster") && !fEmbCaloClusters->GetClass()->GetBaseClass("AliEmcalParticle")) {
741 AliError(Form("%s: Collection %s does not contain AliVCluster nor AliEmcalParticle objects!", GetName(), fEmbCaloName.Data()));
742 fEmbCaloClusters = 0;
747 if (!fEmbTracksName.IsNull() && !fEmbTracks) {
748 fEmbTracks = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fEmbTracksName));
750 AliError(Form("%s: Could not retrieve embedded tracks %s!", GetName(), fEmbTracksName.Data()));
753 else if (!fEmbTracks->GetClass()->GetBaseClass("AliVParticle") && !fEmbTracks->GetClass()->GetBaseClass("AliEmcalParticle")) {
754 AliError(Form("%s: Collection %s does not contain AliVParticle nor AliEmcalParticle objects!", GetName(), fEmbTracksName.Data()));
760 if (!fRandCaloName.IsNull() && !fRandCaloClusters) {
761 fRandCaloClusters = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fRandCaloName));
762 if (!fRandCaloClusters) {
763 AliError(Form("%s: Could not retrieve randomized clusters %s!", GetName(), fRandCaloName.Data()));
766 else if (!fRandCaloClusters->GetClass()->GetBaseClass("AliVCluster") && !fRandCaloClusters->GetClass()->GetBaseClass("AliEmcalParticle")) {
767 AliError(Form("%s: Collection %s does not contain AliVCluster nor AliEmcalParticle objects!", GetName(), fRandCaloName.Data()));
768 fRandCaloClusters = 0;
773 if (!fRandTracksName.IsNull() && !fRandTracks) {
774 fRandTracks = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fRandTracksName));
776 AliError(Form("%s: Could not retrieve randomized tracks %s!", GetName(), fRandTracksName.Data()));
779 else if (!fRandTracks->GetClass()->GetBaseClass("AliVParticle") && !fRandTracks->GetClass()->GetBaseClass("AliEmcalParticle")) {
780 AliError(Form("%s: Collection %s does not contain AliVParticle nor AliEmcalParticle objects!", GetName(), fRandTracksName.Data()));
786 AliAnalysisTaskEmcalJet::ExecOnce();
788 if (fRCperEvent < 0) {
789 Double_t area = (fJetMaxEta - fJetMinEta) * (fJetMaxPhi - fJetMinPhi);
790 Double_t jetArea = TMath::Pi() * fJetRadius * fJetRadius;
791 fRCperEvent = TMath::FloorNint(area / jetArea - 0.5);
792 if (fRCperEvent == 0)
797 fMinRC2LJ = fJetRadius * 1.5;
799 const Float_t maxDist = TMath::Max(fJetMaxPhi - fJetMinPhi, fJetMaxEta - fJetMinEta) / 2;
800 if (fMinRC2LJ > maxDist) {
801 AliWarning(Form("The parameter fMinRC2LJ = %f is too large for the considered acceptance. "
802 "Will use fMinRC2LJ = %f", fMinRC2LJ, maxDist));
807 //________________________________________________________________________
808 void AliAnalysisTaskDeltaPt::Terminate(Option_t *)
810 // Called once at the end of the analysis.