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]);
333 PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
336 //________________________________________________________________________
337 Bool_t AliAnalysisTaskDeltaPt::FillHistograms()
343 // _________________________________
345 const Float_t rcArea = fJetRadius * fJetRadius * TMath::Pi();
350 if (fTracks || fCaloClusters) {
352 for (Int_t i = 0; i < fRCperEvent; i++) {
353 // Simple random cones
357 GetRandomCone(RCpt, RCeta, RCphi, 0);
359 fHistRCPhiEta->Fill(RCeta, RCphi);
360 fHistRhoVSRCPt[fCentBin]->Fill(fRhoVal * rcArea, RCpt);
362 fHistRCPt[fCentBin]->Fill(RCpt);
363 fHistDeltaPtRC[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
368 // Random cones far from leading jet
369 static Int_t sortedJets[9999] = {-1};
370 GetSortedArray(sortedJets, fJets);
372 AliEmcalJet* jet = 0;
374 if (sortedJets[0] >= 0)
375 jet = static_cast<AliEmcalJet*>(fJets->At(sortedJets[0]));
380 GetRandomCone(RCpt, RCeta, RCphi, jet);
383 Float_t dphi = RCphi - jet->Phi();
384 if (dphi > 4.8) dphi -= TMath::Pi() * 2;
385 if (dphi < -1.6) dphi += TMath::Pi() * 2;
386 fHistRCPtExLJVSDPhiLJ->Fill(RCpt, dphi);
388 fHistRCPtExLJ[fCentBin]->Fill(RCpt);
389 fHistDeltaPtRCExLJ[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
395 // Random cones with randomized particles
396 if (fRandTracks || fRandCaloClusters) {
400 GetRandomCone(RCpt, RCeta, RCphi, 0, fRandTracks, fRandCaloClusters);
402 fHistRCPtRand[fCentBin]->Fill(RCpt);
403 fHistDeltaPtRCRand[fCentBin]->Fill(RCpt - rcArea * fRhoVal);
409 // _________________________________
413 AliEmcalJet *embJet = NextEmbeddedJet(0);
415 Int_t countEmbJets = 0;
417 while (embJet != 0) {
418 AliDebug(2,Form("Elaborating embedded jet n. %d", countEmbJets));
421 if (!AcceptJet(embJet)) {
422 AliDebug(2,"Embedded jet not accepted, skipping...");
423 fHistEmbRejectedJetsPhiEta[fCentBin]->Fill(embJet->Eta(), embJet->Phi());
424 fHistEmbRejectedJetsPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt());
426 embJet = NextEmbeddedJet();
430 Double_t maxClusterPt = 0;
431 Double_t maxClusterEta = 0;
432 Double_t maxClusterPhi = 0;
434 Double_t maxTrackPt = 0;
435 Double_t maxTrackEta = 0;
436 Double_t maxTrackPhi = 0;
438 Double_t maxPartPt = 0;
439 Double_t maxPartEta = 0;
440 Double_t maxPartPhi = 0;
442 if (fLeadingHadronType == 1 || fLeadingHadronType == 2) {
443 AliVCluster *cluster = embJet->GetLeadingCluster(fEmbCaloClusters);
445 TLorentzVector nPart;
446 cluster->GetMomentum(nPart, fVertex);
448 maxClusterEta = nPart.Eta();
449 maxClusterPhi = nPart.Phi();
450 maxClusterPt = nPart.Pt();
454 if (fLeadingHadronType == 0 || fLeadingHadronType == 2) {
455 AliVParticle *track = embJet->GetLeadingTrack(fEmbTracks);
457 maxTrackEta = track->Eta();
458 maxTrackPhi = track->Phi();
459 maxTrackPt = track->Pt();
463 if (maxTrackPt > maxClusterPt) {
464 maxPartPt = maxTrackPt;
465 maxPartEta = maxTrackEta;
466 maxPartPhi = maxTrackPhi;
469 maxPartPt = maxClusterPt;
470 maxPartEta = maxClusterEta;
471 maxPartPhi = maxClusterPhi;
474 Double_t distLeading2Jet = TMath::Sqrt((embJet->Eta() - maxPartEta) * (embJet->Eta() - maxPartEta) + (embJet->Phi() - maxPartPhi) * (embJet->Phi() - maxPartPhi));
476 fHistEmbPartPtvsJetPt[fCentBin]->Fill(embJet->MCPt(), embJet->Pt());
477 fHistEmbPartPtvsJetCorrPt[fCentBin]->Fill(embJet->MCPt(), embJet->Pt() - embJet->Area() * fRhoVal);
478 fHistLeadPartPhiEta->Fill(maxPartEta, maxPartPhi);
479 fHistDistLeadPart2JetAxis[fCentBin]->Fill(distLeading2Jet);
481 fHistEmbJetsPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt(), maxPartPt);
482 fHistEmbJetsCorrPtArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - fRhoVal * embJet->Area(), maxPartPt);
483 fHistEmbJetsPhiEta->Fill(embJet->Eta(), embJet->Phi());
484 fHistJetPtvsJetCorrPt[fCentBin]->Fill(embJet->Pt(), embJet->Pt() - fRhoVal * embJet->Area());
486 fHistEmbBkgArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->MCPt());
487 fHistRhoVSEmbBkg[fCentBin]->Fill(fRhoVal * embJet->Area(), embJet->Pt() - embJet->MCPt());
488 fHistDeltaPtEmbArea[fCentBin]->Fill(embJet->Area(), embJet->Pt() - embJet->Area() * fRhoVal - embJet->MCPt());
490 embJet = NextEmbeddedJet();
493 if (countEmbJets==0) {
494 AliDebug(1,"No embedded jets found!");
497 for (Int_t i = 0; i < fEmbeddedTrackNIds; i++) {
498 AliDebug(2,Form("Embedded track %d found!",i));
499 AliVParticle *track2 = static_cast<AliVParticle*>(fEmbTracks->At(fEmbeddedTrackIds[i]));
500 if (!track2) continue;
501 fHistEmbNotFoundPhiEta[fCentBin]->Fill(track2->Eta(), track2->Phi());
502 fHistEmbNotFoundPt[fCentBin]->Fill(track2->Pt());
506 if (fEmbCaloClusters) {
508 for (Int_t i = 0; i < fEmbeddedClusterNIds; i++) {
509 AliDebug(2,Form("Embedded cluster %d found!",i));
510 AliVCluster *cluster2 = static_cast<AliVCluster*>(fEmbCaloClusters->At(fEmbeddedClusterIds[i]));
511 TLorentzVector nPart;
512 cluster2->GetMomentum(nPart, fVertex);
513 fHistEmbNotFoundPhiEta[fCentBin]->Fill(nPart.Eta(), nPart.Phi());
514 fHistEmbNotFoundPt[fCentBin]->Fill(nPart.Pt());
523 //________________________________________________________________________
524 void AliAnalysisTaskDeltaPt::DoEmbTrackLoop()
528 fEmbeddedTrackNIds = 0;
533 Int_t ntracks = fEmbTracks->GetEntriesFast();
535 for (Int_t i = 0; i < ntracks; i++) {
537 AliVParticle* track = static_cast<AliVParticle*>(fEmbTracks->At(i)); // pointer to reconstructed to track
540 AliError(Form("Could not retrieve track %d",i));
544 AliVTrack* vtrack = dynamic_cast<AliVTrack*>(track);
546 if (vtrack && !AcceptTrack(vtrack))
549 if (track->GetLabel() > 0) {
550 fEmbeddedTrackIds[fEmbeddedTrackNIds] = i;
551 fEmbeddedTrackNIds++;
556 //________________________________________________________________________
557 void AliAnalysisTaskDeltaPt::DoEmbClusterLoop()
561 fEmbeddedClusterNIds = 0;
563 if (!fEmbCaloClusters)
566 Int_t nclusters = fEmbCaloClusters->GetEntriesFast();
568 for (Int_t iClusters = 0; iClusters < nclusters; iClusters++) {
569 AliVCluster* cluster = static_cast<AliVCluster*>(fEmbCaloClusters->At(iClusters));
571 AliError(Form("Could not receive cluster %d", iClusters));
575 if (!AcceptCluster(cluster))
578 if (cluster->GetLabel() > 0) {
579 fEmbeddedClusterIds[fEmbeddedClusterNIds] = iClusters;
580 fEmbeddedClusterNIds++;
585 //________________________________________________________________________
586 AliEmcalJet* AliAnalysisTaskDeltaPt::NextEmbeddedJet(Int_t i)
588 // Do the embedded jet loop.
590 static Int_t iJet = 0;
600 TLorentzVector maxClusVect;
602 const Int_t nembjets = fEmbJets->GetEntriesFast();
604 for (; iJet < nembjets; iJet++) {
606 AliEmcalJet* jet = static_cast<AliEmcalJet*>(fEmbJets->At(iJet));
609 AliError(Form("Could not receive jet %d", iJet));
613 if (jet->MCPt() < fMCJetPtThreshold)
622 //________________________________________________________________________
623 void AliAnalysisTaskDeltaPt::GetRandomCone(Float_t &pt, Float_t &eta, Float_t &phi,
624 AliEmcalJet *jet, TClonesArray* tracks, TClonesArray* clusters) const
632 clusters = fCaloClusters;
638 if (!tracks && !clusters)
649 Float_t maxEta = fJetMaxEta;
650 Float_t minEta = fJetMinEta;
651 Float_t maxPhi = fJetMaxPhi;
652 Float_t minPhi = fJetMinPhi;
654 if (maxPhi > TMath::Pi() * 2) maxPhi = TMath::Pi() * 2;
655 if (minPhi < 0) minPhi = 0;
660 eta = gRandom->Rndm() * (maxEta - minEta) + minEta;
661 phi = gRandom->Rndm() * (maxPhi - minPhi) + minPhi;
662 dLJ = TMath::Sqrt((LJeta - eta) * (LJeta - eta) + (LJphi - phi) * (LJphi - phi));
664 } while (dLJ < fMinRC2LJ && repeats < 999);
666 if (repeats == 999) {
667 AliWarning(Form("%s: Could not get random cone!", GetName()));
672 Int_t nclusters = clusters->GetEntriesFast();
673 for (Int_t iClusters = 0; iClusters < nclusters; iClusters++) {
674 AliVCluster* cluster = static_cast<AliVCluster*>(clusters->At(iClusters));
676 AliError(Form("Could not receive cluster %d", iClusters));
680 if (!AcceptCluster(cluster))
683 TLorentzVector nPart;
684 cluster->GetMomentum(nPart, const_cast<Double_t*>(fVertex));
686 Float_t d = TMath::Sqrt((nPart.Eta() - eta) * (nPart.Eta() - eta) + (nPart.Phi() - phi) * (nPart.Phi() - phi));
694 Int_t ntracks = tracks->GetEntriesFast();
695 for(Int_t iTracks = 0; iTracks < ntracks; iTracks++) {
696 AliVTrack* track = static_cast<AliVTrack*>(tracks->At(iTracks));
698 AliError(Form("Could not retrieve track %d",iTracks));
702 if (!AcceptTrack(track))
705 Float_t tracketa = track->Eta();
706 Float_t trackphi = track->Phi();
708 if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi + 2 * TMath::Pi()))
709 trackphi += 2 * TMath::Pi();
710 if (TMath::Abs(trackphi - phi) > TMath::Abs(trackphi - phi - 2 * TMath::Pi()))
711 trackphi -= 2 * TMath::Pi();
713 Float_t d = TMath::Sqrt((tracketa - eta) * (tracketa - eta) + (trackphi - phi) * (trackphi - phi));
720 //________________________________________________________________________
721 void AliAnalysisTaskDeltaPt::ExecOnce()
723 // Initialize the analysis.
725 if (!fEmbJetsName.IsNull() && !fEmbJets) {
726 fEmbJets = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fEmbJetsName));
728 AliError(Form("%s: Could not retrieve embedded jets %s!", GetName(), fEmbJetsName.Data()));
731 else if (!fEmbJets->GetClass()->GetBaseClass("AliEmcalJet")) {
732 AliError(Form("%s: Collection %s does not contain AliEmcalJet objects!", GetName(), fEmbJetsName.Data()));
738 if (!fEmbCaloName.IsNull() && !fEmbCaloClusters) {
739 fEmbCaloClusters = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fEmbCaloName));
740 if (!fEmbCaloClusters) {
741 AliError(Form("%s: Could not retrieve embedded clusters %s!", GetName(), fEmbCaloName.Data()));
744 else if (!fEmbCaloClusters->GetClass()->GetBaseClass("AliVCluster") && !fEmbCaloClusters->GetClass()->GetBaseClass("AliEmcalParticle")) {
745 AliError(Form("%s: Collection %s does not contain AliVCluster nor AliEmcalParticle objects!", GetName(), fEmbCaloName.Data()));
746 fEmbCaloClusters = 0;
751 if (!fEmbTracksName.IsNull() && !fEmbTracks) {
752 fEmbTracks = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fEmbTracksName));
754 AliError(Form("%s: Could not retrieve embedded tracks %s!", GetName(), fEmbTracksName.Data()));
757 else if (!fEmbTracks->GetClass()->GetBaseClass("AliVParticle") && !fEmbTracks->GetClass()->GetBaseClass("AliEmcalParticle")) {
758 AliError(Form("%s: Collection %s does not contain AliVParticle nor AliEmcalParticle objects!", GetName(), fEmbTracksName.Data()));
764 if (!fRandCaloName.IsNull() && !fRandCaloClusters) {
765 fRandCaloClusters = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fRandCaloName));
766 if (!fRandCaloClusters) {
767 AliError(Form("%s: Could not retrieve randomized clusters %s!", GetName(), fRandCaloName.Data()));
770 else if (!fRandCaloClusters->GetClass()->GetBaseClass("AliVCluster") && !fRandCaloClusters->GetClass()->GetBaseClass("AliEmcalParticle")) {
771 AliError(Form("%s: Collection %s does not contain AliVCluster nor AliEmcalParticle objects!", GetName(), fRandCaloName.Data()));
772 fRandCaloClusters = 0;
777 if (!fRandTracksName.IsNull() && !fRandTracks) {
778 fRandTracks = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fRandTracksName));
780 AliError(Form("%s: Could not retrieve randomized tracks %s!", GetName(), fRandTracksName.Data()));
783 else if (!fRandTracks->GetClass()->GetBaseClass("AliVParticle") && !fRandTracks->GetClass()->GetBaseClass("AliEmcalParticle")) {
784 AliError(Form("%s: Collection %s does not contain AliVParticle nor AliEmcalParticle objects!", GetName(), fRandTracksName.Data()));
790 AliAnalysisTaskEmcalJet::ExecOnce();
792 if (fRCperEvent < 0) {
793 Double_t area = (fJetMaxEta - fJetMinEta) * (fJetMaxPhi - fJetMinPhi);
794 Double_t jetArea = TMath::Pi() * fJetRadius * fJetRadius;
795 fRCperEvent = TMath::FloorNint(area / jetArea - 0.5);
796 if (fRCperEvent == 0)
801 fMinRC2LJ = fJetRadius * 1.5;
803 const Float_t maxDist = TMath::Max(fJetMaxPhi - fJetMinPhi, fJetMaxEta - fJetMinEta) / 2;
804 if (fMinRC2LJ > maxDist) {
805 AliWarning(Form("The parameter fMinRC2LJ = %f is too large for the considered acceptance. "
806 "Will use fMinRC2LJ = %f", fMinRC2LJ, maxDist));
811 //________________________________________________________________________
812 void AliAnalysisTaskDeltaPt::Terminate(Option_t *)
814 // Called once at the end of the analysis.