7 #include <TClonesArray.h>
12 #include <TLorentzVector.h>
14 #include "AliVCluster.h"
15 #include "AliVParticle.h"
16 #include "AliVTrack.h"
17 #include "AliEmcalJet.h"
18 #include "AliRhoParameter.h"
21 #include "AliAnalysisTaskSAJF.h"
23 ClassImp(AliAnalysisTaskSAJF)
25 //________________________________________________________________________
26 AliAnalysisTaskSAJF::AliAnalysisTaskSAJF() :
27 AliAnalysisTaskEmcalJet("AliAnalysisTaskSAJF", kTRUE),
31 // Default constructor.
33 for (Int_t i = 0; i < 4; i++) {
34 fHistLeadingJetPhiEta[i] = 0;
35 fHistLeadingJetPtArea[i] = 0;
36 fHistLeadingJetCorrPtArea[i] = 0;
37 fHistLeadingJetMCPtArea[i] = 0;
38 fHistRhoVSleadJetPt[i] = 0;
39 fHistJetPhiEta[i] = 0;
40 fHistJetsPtArea[i] = 0;
41 fHistJetsCorrPtArea[i] = 0;
42 fHistJetPtvsJetCorrPt[i] = 0;
43 fHistJetsMCPtArea[i] = 0;
44 fHistJetPtvsJetMCPt[i] = 0;
45 fHistJetsNEFvsPt[i] = 0;
46 fHistJetsCEFvsCEFPt[i] = 0;
47 fHistJetsZvsPt[i] = 0;
48 fHistConstituents[i] = 0;
49 fHistTracksJetPt[i] = 0;
50 fHistClustersJetPt[i] = 0;
51 fHistTracksPtDist[i] = 0;
52 fHistClustersPtDist[i] = 0;
53 fHistJetNconstVsPt[i] = 0;
56 SetMakeGeneralHistograms(kTRUE);
59 //________________________________________________________________________
60 AliAnalysisTaskSAJF::AliAnalysisTaskSAJF(const char *name) :
61 AliAnalysisTaskEmcalJet(name, kTRUE),
64 // Standard constructor.
66 for (Int_t i = 0; i < 4; i++) {
67 fHistLeadingJetPhiEta[i] = 0;
68 fHistLeadingJetPtArea[i] = 0;
69 fHistLeadingJetCorrPtArea[i] = 0;
70 fHistLeadingJetMCPtArea[i] = 0;
71 fHistRhoVSleadJetPt[i] = 0;
72 fHistJetPhiEta[i] = 0;
73 fHistJetsPtArea[i] = 0;
74 fHistJetsCorrPtArea[i] = 0;
75 fHistJetPtvsJetCorrPt[i] = 0;
76 fHistJetsMCPtArea[i] = 0;
77 fHistJetPtvsJetMCPt[i] = 0;
78 fHistJetsNEFvsPt[i] = 0;
79 fHistJetsCEFvsCEFPt[i] = 0;
80 fHistJetsZvsPt[i] = 0;
81 fHistConstituents[i] = 0;
82 fHistTracksJetPt[i] = 0;
83 fHistClustersJetPt[i] = 0;
84 fHistTracksPtDist[i] = 0;
85 fHistClustersPtDist[i] = 0;
86 fHistJetNconstVsPt[i] = 0;
89 SetMakeGeneralHistograms(kTRUE);
92 //________________________________________________________________________
93 AliAnalysisTaskSAJF::~AliAnalysisTaskSAJF()
98 //________________________________________________________________________
99 void AliAnalysisTaskSAJF::UserCreateOutputObjects()
101 // Create user output.
103 AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
105 fNjetsVsCent = new TH2F("fNjetsVsCent","fNjetsVsCent", 100, 0, 100, 150, -0.5, 149.5);
106 fNjetsVsCent->GetXaxis()->SetTitle("Centrality (%)");
107 fNjetsVsCent->GetYaxis()->SetTitle("No. of jets");
108 fOutput->Add(fNjetsVsCent);
110 const Int_t nbinsZ = 12;
111 Float_t binsZ[nbinsZ+1] = {0,1,2,3,4,5,6,7,8,9,10,20,1000};
113 Float_t *binsPt = GenerateFixedBinArray(fNbins, fMinBinPt, fMaxBinPt);
114 Float_t *binsCorrPt = GenerateFixedBinArray(fNbins*2, -fMaxBinPt, fMaxBinPt);
115 Float_t *binsArea = GenerateFixedBinArray(50, 0, 2);
116 Float_t *binsEta = GenerateFixedBinArray(50,-1, 1);
117 Float_t *binsPhi = GenerateFixedBinArray(101, 0, TMath::Pi() * 2.02);
118 Float_t *bins120 = GenerateFixedBinArray(120, 0, 1.2);
119 Float_t *bins150 = GenerateFixedBinArray(150, -0.5, 149.5);
123 for (Int_t i = 0; i < 4; i++) {
124 histname = "fHistLeadingJetPhiEta_";
126 fHistLeadingJetPhiEta[i] = new TH3F(histname.Data(), histname.Data(),
130 fHistLeadingJetPhiEta[i]->GetXaxis()->SetTitle("#eta");
131 fHistLeadingJetPhiEta[i]->GetYaxis()->SetTitle("#phi");
132 fHistLeadingJetPhiEta[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
133 fOutput->Add(fHistLeadingJetPhiEta[i]);
135 histname = "fHistLeadingJetPtArea_";
137 fHistLeadingJetPtArea[i] = new TH3F(histname.Data(), histname.Data(),
141 fHistLeadingJetPtArea[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)");
142 fHistLeadingJetPtArea[i]->GetYaxis()->SetTitle("area");
143 fHistLeadingJetPtArea[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
144 fOutput->Add(fHistLeadingJetPtArea[i]);
147 histname = "fHistLeadingJetMCPtArea_";
149 fHistLeadingJetMCPtArea[i] = new TH3F(histname.Data(), histname.Data(),
153 fHistLeadingJetMCPtArea[i]->GetXaxis()->SetTitle("p_{T,MC} (GeV/c)");
154 fHistLeadingJetMCPtArea[i]->GetYaxis()->SetTitle("area");
155 fHistLeadingJetMCPtArea[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
156 fOutput->Add(fHistLeadingJetMCPtArea[i]);
159 if (!fRhoName.IsNull()) {
160 histname = "fHistLeadingJetCorrPtArea_";
162 fHistLeadingJetCorrPtArea[i] = new TH3F(histname.Data(), histname.Data(),
163 fNbins * 2, binsCorrPt,
166 fHistLeadingJetCorrPtArea[i]->GetXaxis()->SetTitle("p_{T}^{corr} (GeV/c)");
167 fHistLeadingJetCorrPtArea[i]->GetYaxis()->SetTitle("area");
168 fHistLeadingJetCorrPtArea[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
169 fOutput->Add(fHistLeadingJetCorrPtArea[i]);
171 histname = "fHistRhoVSleadJetPt_";
173 fHistRhoVSleadJetPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt*2, fNbins, fMinBinPt, fMaxBinPt);
174 fHistRhoVSleadJetPt[i]->GetXaxis()->SetTitle("#rho * area (GeV/c)");
175 fHistRhoVSleadJetPt[i]->GetYaxis()->SetTitle("Leading jet p_{T} (GeV/c)");
176 fOutput->Add(fHistRhoVSleadJetPt[i]);
179 histname = "fHistJetPhiEta_";
181 fHistJetPhiEta[i] = new TH3F(histname.Data(), histname.Data(),
185 fHistJetPhiEta[i]->GetXaxis()->SetTitle("#eta");
186 fHistJetPhiEta[i]->GetYaxis()->SetTitle("#phi");
187 fHistJetPhiEta[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
188 fOutput->Add(fHistJetPhiEta[i]);
190 histname = "fHistJetsPtArea_";
192 fHistJetsPtArea[i] = new TH3F(histname.Data(), histname.Data(),
196 fHistJetsPtArea[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)");
197 fHistJetsPtArea[i]->GetYaxis()->SetTitle("area");
198 fHistJetsPtArea[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
199 fOutput->Add(fHistJetsPtArea[i]);
201 if (!fRhoName.IsNull()) {
202 histname = "fHistJetsCorrPtArea_";
204 fHistJetsCorrPtArea[i] = new TH3F(histname.Data(), histname.Data(),
205 fNbins * 2, binsCorrPt,
208 fHistJetsCorrPtArea[i]->GetXaxis()->SetTitle("p_{T}^{corr} (GeV/c)");
209 fHistJetsCorrPtArea[i]->GetYaxis()->SetTitle("area");
210 fHistJetsCorrPtArea[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
211 fOutput->Add(fHistJetsCorrPtArea[i]);
213 histname = "fHistJetPtvsJetCorrPt_";
215 fHistJetPtvsJetCorrPt[i] = new TH2F(histname.Data(), histname.Data(),
216 fNbins, fMinBinPt, fMaxBinPt,
217 fNbins * 2, -fMaxBinPt, fMaxBinPt);
218 fHistJetPtvsJetCorrPt[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)");
219 fHistJetPtvsJetCorrPt[i]->GetYaxis()->SetTitle("p_{T}^{corr} (GeV/c)");
220 fHistJetPtvsJetCorrPt[i]->GetZaxis()->SetTitle("counts");
221 fOutput->Add(fHistJetPtvsJetCorrPt[i]);
225 histname = "fHistJetsMCPtArea_";
227 fHistJetsMCPtArea[i] = new TH3F(histname.Data(), histname.Data(),
231 fHistJetsMCPtArea[i]->GetXaxis()->SetTitle("p_{T,MC} (GeV/c)");
232 fHistJetsMCPtArea[i]->GetYaxis()->SetTitle("area");
233 fHistJetsMCPtArea[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
234 fOutput->Add(fHistJetsMCPtArea[i]);
236 histname = "fHistJetPtvsJetMCPt_";
238 fHistJetPtvsJetMCPt[i] = new TH2F(histname.Data(), histname.Data(),
239 fNbins, fMinBinPt, fMaxBinPt,
240 fNbins, fMinBinPt, fMaxBinPt);
241 fHistJetPtvsJetMCPt[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)");
242 fHistJetPtvsJetMCPt[i]->GetYaxis()->SetTitle("p_{T,MC} (GeV/c)");
243 fHistJetPtvsJetMCPt[i]->GetZaxis()->SetTitle("counts");
244 fOutput->Add(fHistJetPtvsJetMCPt[i]);
247 histname = "fHistJetsZvsPt_";
249 fHistJetsZvsPt[i] = new TH3F(histname.Data(), histname.Data(),
253 fHistJetsZvsPt[i]->GetXaxis()->SetTitle("Z");
254 fHistJetsZvsPt[i]->GetYaxis()->SetTitle("p_{T}^{raw} (GeV/c)");
255 fHistJetsZvsPt[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
256 fOutput->Add(fHistJetsZvsPt[i]);
258 histname = "fHistJetsNEFvsPt_";
260 fHistJetsNEFvsPt[i] = new TH3F(histname.Data(), histname.Data(),
264 fHistJetsNEFvsPt[i]->GetXaxis()->SetTitle("NEF");
265 fHistJetsNEFvsPt[i]->GetYaxis()->SetTitle("p_{T}^{raw} (GeV/c)");
266 fHistJetsNEFvsPt[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
267 fOutput->Add(fHistJetsNEFvsPt[i]);
269 histname = "fHistJetsCEFvsCEFPt_";
271 fHistJetsCEFvsCEFPt[i] = new TH3F(histname.Data(), histname.Data(),
275 fHistJetsCEFvsCEFPt[i]->GetXaxis()->SetTitle("1-NEF");
276 fHistJetsCEFvsCEFPt[i]->GetYaxis()->SetTitle("(1-NEF)*p_{T}^{raw} (GeV/c)");
277 fHistJetsCEFvsCEFPt[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
278 fOutput->Add(fHistJetsCEFvsCEFPt[i]);
280 histname = "fHistConstituents_";
282 fHistConstituents[i] = new TH2F(histname.Data(), histname.Data(), 100, 1, 101, 100, -0.5, 99.5);
283 fHistConstituents[i]->GetXaxis()->SetTitle("p_{T,part} (GeV/c)");
284 fHistConstituents[i]->GetYaxis()->SetTitle("no. of particles");
285 fHistConstituents[i]->GetZaxis()->SetTitle("counts");
286 fOutput->Add(fHistConstituents[i]);
288 histname = "fHistTracksJetPt_";
290 fHistTracksJetPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2, fNbins, fMinBinPt, fMaxBinPt);
291 fHistTracksJetPt[i]->GetXaxis()->SetTitle("p_{T,track} (GeV/c)");
292 fHistTracksJetPt[i]->GetYaxis()->SetTitle("p_{T,jet} (GeV/c)");
293 fHistTracksJetPt[i]->GetZaxis()->SetTitle("counts");
294 fOutput->Add(fHistTracksJetPt[i]);
296 histname = "fHistTracksPtDist_";
298 fHistTracksPtDist[i] = new TH2F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2, 100, 0, 5);
299 fHistTracksPtDist[i]->GetXaxis()->SetTitle("p_{T,track} (GeV/c)");
300 fHistTracksPtDist[i]->GetYaxis()->SetTitle("d");
301 fHistTracksPtDist[i]->GetZaxis()->SetTitle("counts");
302 fOutput->Add(fHistTracksPtDist[i]);
304 if (!fCaloName.IsNull()) {
305 histname = "fHistClustersJetPt_";
307 fHistClustersJetPt[i] = new TH2F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2, fNbins, fMinBinPt, fMaxBinPt);
308 fHistClustersJetPt[i]->GetXaxis()->SetTitle("p_{T,clus} (GeV/c)");
309 fHistClustersJetPt[i]->GetYaxis()->SetTitle("p_{T,jet} (GeV/c)");
310 fHistClustersJetPt[i]->GetZaxis()->SetTitle("counts");
311 fOutput->Add(fHistClustersJetPt[i]);
313 histname = "fHistClustersPtDist_";
315 fHistClustersPtDist[i] = new TH2F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2, 100, 0, 5);
316 fHistClustersPtDist[i]->GetXaxis()->SetTitle("p_{T,clus} (GeV/c)");
317 fHistClustersPtDist[i]->GetYaxis()->SetTitle("d");
318 fHistClustersPtDist[i]->GetZaxis()->SetTitle("counts");
319 fOutput->Add(fHistClustersPtDist[i]);
322 histname = "fHistJetNconstVsPt_";
324 fHistJetNconstVsPt[i] = new TH3F(histname.Data(), histname.Data(), 150, bins150, fNbins, binsPt, nbinsZ, binsZ);
325 fHistJetNconstVsPt[i]->GetXaxis()->SetTitle("# of constituents");
326 fHistJetNconstVsPt[i]->GetYaxis()->SetTitle("p_{T,jet} (GeV/c)");
327 fHistJetNconstVsPt[i]->GetZaxis()->SetTitle("p_{T,lead} (GeV/c)");
328 fOutput->Add(fHistJetNconstVsPt[i]);
331 PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
341 //________________________________________________________________________
342 Bool_t AliAnalysisTaskSAJF::FillHistograms()
347 AliError(Form("%s - Jet array not provided, returning...", GetName()));
351 if (fJets->GetEntriesFast() < 1) // no jets in array, skipping
354 static Int_t sortedJets[9999] = {-1};
355 Bool_t r = GetSortedArray(sortedJets, fJets, fRhoVal);
357 if (!r) // no accepted jets, skipping
360 // OK, event accepted
362 for (Int_t i = 0; i < fNLeadingJets && i < fJets->GetEntriesFast(); i++) {
363 AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(sortedJets[i]));
366 AliError(Form("Could not receive jet %d", sortedJets[i]));
373 Float_t ptLeading = GetLeadingHadronPt(jet);
375 fHistLeadingJetPhiEta[fCentBin]->Fill(jet->Eta(), jet->Phi(), ptLeading);
376 fHistLeadingJetPtArea[fCentBin]->Fill(jet->Pt(), jet->Area(), ptLeading);
379 fHistLeadingJetMCPtArea[fCentBin]->Fill(jet->MCPt(), jet->Area(), ptLeading);
381 Float_t corrPt = jet->Pt() - fRhoVal * jet->Area();
383 if (fHistLeadingJetCorrPtArea[fCentBin])
384 fHistLeadingJetCorrPtArea[fCentBin]->Fill(corrPt, jet->Area(), ptLeading);
386 if (i==0 && fHistRhoVSleadJetPt[fCentBin])
387 fHistRhoVSleadJetPt[fCentBin]->Fill(fRhoVal, jet->Pt());
390 Int_t njets = DoJetLoop();
392 fNjetsVsCent->Fill(fCent, njets);
397 //________________________________________________________________________
398 Int_t AliAnalysisTaskSAJF::DoJetLoop()
405 const Int_t njets = fJets->GetEntriesFast();
408 TH1F constituents("constituents", "constituents",
409 fHistConstituents[0]->GetNbinsX(), fHistConstituents[0]->GetXaxis()->GetXmin(), fHistConstituents[0]->GetXaxis()->GetXmax());
411 for (Int_t ij = 0; ij < njets; ij++) {
413 AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(ij));
416 AliError(Form("Could not receive jet %d", ij));
423 Float_t corrPt = jet->Pt() - fRhoVal * jet->Area();
425 Float_t ptLeading = GetLeadingHadronPt(jet);
427 fHistJetPhiEta[fCentBin]->Fill(jet->Eta(), jet->Phi(), ptLeading);
428 fHistJetsPtArea[fCentBin]->Fill(jet->Pt(), jet->Area(), ptLeading);
429 if (fHistJetsCorrPtArea[fCentBin])
430 fHistJetsCorrPtArea[fCentBin]->Fill(corrPt, jet->Area(), ptLeading);
431 if (fHistJetPtvsJetCorrPt[fCentBin])
432 fHistJetPtvsJetCorrPt[fCentBin]->Fill(jet->Pt(), corrPt);
433 fHistJetNconstVsPt[fCentBin]->Fill(jet->GetNumberOfConstituents(), jet->Pt(), ptLeading);
436 fHistJetsMCPtArea[fCentBin]->Fill(jet->MCPt(), jet->Area(), ptLeading);
437 fHistJetPtvsJetMCPt[fCentBin]->Fill(jet->Pt(), jet->MCPt());
440 fHistJetsNEFvsPt[fCentBin]->Fill(jet->NEF(), jet->Pt(), ptLeading);
441 fHistJetsCEFvsCEFPt[fCentBin]->Fill(1-jet->NEF(), (1-jet->NEF())*jet->Pt(), ptLeading);
444 for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
445 AliVParticle *track = jet->TrackAt(it, fTracks);
447 fHistJetsZvsPt[fCentBin]->Fill(track->Pt() / jet->Pt(), jet->Pt(), ptLeading);
448 constituents.Fill(track->Pt());
449 fHistTracksJetPt[fCentBin]->Fill(track->Pt(), jet->Pt());
450 Double_t dist = TMath::Sqrt((track->Eta() - jet->Eta()) * (track->Eta() - jet->Eta()) + (track->Phi() - jet->Phi()) * (track->Phi() - jet->Phi()));
451 fHistTracksPtDist[fCentBin]->Fill(track->Pt(), dist);
457 for (Int_t ic = 0; ic < jet->GetNumberOfClusters(); ic++) {
458 AliVCluster *cluster = jet->ClusterAt(ic, fCaloClusters);
461 TLorentzVector nPart;
462 cluster->GetMomentum(nPart, fVertex);
463 fHistJetsZvsPt[fCentBin]->Fill(nPart.Et() / jet->Pt(), jet->Pt(), ptLeading);
464 constituents.Fill(nPart.Pt());
465 fHistClustersJetPt[fCentBin]->Fill(nPart.Pt(), jet->Pt());
466 Double_t dist = TMath::Sqrt((nPart.Eta() - jet->Eta()) * (nPart.Eta() - jet->Eta()) + (nPart.Phi() - jet->Phi()) * (nPart.Phi() - jet->Phi()));
467 fHistClustersPtDist[fCentBin]->Fill(nPart.Pt(), dist);
472 for (Int_t i = 1; i <= constituents.GetNbinsX(); i++) {
473 fHistConstituents[fCentBin]->Fill(constituents.GetBinCenter(i), constituents.GetBinContent(i));
476 constituents.Reset();