]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/UserTasks/AliAnalysisTaskSAJF.cxx
3fc149de70a655cafaaeef871033e6ae45c5852e
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / UserTasks / AliAnalysisTaskSAJF.cxx
1 // $Id$
2 //
3 // Jet analysis task.
4 //
5 // Author: S.Aiola
6
7 #include <TClonesArray.h>
8 #include <TH1F.h>
9 #include <TH2F.h>
10 #include <TH3F.h>
11 #include <TList.h>
12 #include <TLorentzVector.h>
13
14 #include "AliVCluster.h"
15 #include "AliVParticle.h"
16 #include "AliVTrack.h"
17 #include "AliEmcalJet.h"
18 #include "AliRhoParameter.h"
19 #include "AliLog.h"
20
21 #include "AliAnalysisTaskSAJF.h"
22
23 ClassImp(AliAnalysisTaskSAJF)
24
25 //________________________________________________________________________
26 AliAnalysisTaskSAJF::AliAnalysisTaskSAJF() : 
27   AliAnalysisTaskEmcalJet("AliAnalysisTaskSAJF", kTRUE),
28   fNjetsVsCent(0)
29
30 {
31   // Default constructor.
32
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;
54   }
55
56   SetMakeGeneralHistograms(kTRUE);
57 }
58
59 //________________________________________________________________________
60 AliAnalysisTaskSAJF::AliAnalysisTaskSAJF(const char *name) : 
61   AliAnalysisTaskEmcalJet(name, kTRUE),
62   fNjetsVsCent(0)
63 {
64   // Standard constructor.
65
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;
87   }
88
89   SetMakeGeneralHistograms(kTRUE);
90 }
91
92 //________________________________________________________________________
93 AliAnalysisTaskSAJF::~AliAnalysisTaskSAJF()
94 {
95   // Destructor.
96 }
97
98 //________________________________________________________________________
99 void AliAnalysisTaskSAJF::UserCreateOutputObjects()
100 {
101   // Create user output.
102
103   AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
104
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);
109
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};
112
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);
120
121   TString histname;
122
123   for (Int_t i = 0; i < 4; i++) {
124     histname = "fHistLeadingJetPhiEta_";
125     histname += i;
126     fHistLeadingJetPhiEta[i] = new TH3F(histname.Data(), histname.Data(), 
127                                         50, binsEta, 
128                                         101, binsPhi, 
129                                         nbinsZ, binsZ);
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]);
134
135     histname = "fHistLeadingJetPtArea_";
136     histname += i;
137     fHistLeadingJetPtArea[i] = new TH3F(histname.Data(), histname.Data(), 
138                                         fNbins, binsPt, 
139                                         50, binsArea,
140                                         nbinsZ, binsZ);
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]);
145
146     if (fIsEmbedded) {
147       histname = "fHistLeadingJetMCPtArea_";
148       histname += i;
149       fHistLeadingJetMCPtArea[i] = new TH3F(histname.Data(), histname.Data(), 
150                                             fNbins, binsPt, 
151                                             50, binsArea,
152                                             nbinsZ, binsZ);
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]);
157     }
158
159     if (!fRhoName.IsNull()) {
160       histname = "fHistLeadingJetCorrPtArea_";
161       histname += i;
162       fHistLeadingJetCorrPtArea[i] = new TH3F(histname.Data(), histname.Data(), 
163                                               fNbins * 2, binsCorrPt, 
164                                               50, binsArea,
165                                               nbinsZ, binsZ);
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]);
170       
171       histname = "fHistRhoVSleadJetPt_";
172       histname += i;
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]);
177     }
178
179     histname = "fHistJetPhiEta_";
180     histname += i;
181     fHistJetPhiEta[i] = new TH3F(histname.Data(), histname.Data(), 
182                                  50, binsEta, 
183                                  101, binsPhi, 
184                                  nbinsZ, binsZ);
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]);
189     
190     histname = "fHistJetsPtArea_";
191     histname += i;
192     fHistJetsPtArea[i] = new TH3F(histname.Data(), histname.Data(), 
193                                   fNbins, binsPt, 
194                                   50, binsArea,
195                                   nbinsZ, binsZ);
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]);
200
201     if (!fRhoName.IsNull()) {
202       histname = "fHistJetsCorrPtArea_";
203       histname += i;
204       fHistJetsCorrPtArea[i] = new TH3F(histname.Data(), histname.Data(), 
205                                         fNbins * 2, binsCorrPt, 
206                                         50, binsArea,
207                                         nbinsZ, binsZ);
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]);
212
213       histname = "fHistJetPtvsJetCorrPt_";
214       histname += i;
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]);
222     }
223
224     if (fIsEmbedded) {
225       histname = "fHistJetsMCPtArea_";
226       histname += i;
227       fHistJetsMCPtArea[i] = new TH3F(histname.Data(), histname.Data(), 
228                                       fNbins, binsPt, 
229                                       50, binsArea,
230                                       nbinsZ, binsZ);
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]);
235
236       histname = "fHistJetPtvsJetMCPt_";
237       histname += i;
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]);
245     }
246
247     histname = "fHistJetsZvsPt_";
248     histname += i;
249     fHistJetsZvsPt[i] = new TH3F(histname.Data(), histname.Data(), 
250                                  120, bins120, 
251                                  fNbins, binsPt,
252                                  nbinsZ, binsZ);
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]);
257
258     histname = "fHistJetsNEFvsPt_";
259     histname += i;
260     fHistJetsNEFvsPt[i] = new TH3F(histname.Data(), histname.Data(), 
261                                    120, bins120, 
262                                    fNbins, binsPt,
263                                    nbinsZ, binsZ);
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]);
268     
269     histname = "fHistJetsCEFvsCEFPt_";
270     histname += i;
271     fHistJetsCEFvsCEFPt[i] = new TH3F(histname.Data(), histname.Data(), 
272                                       120, bins120, 
273                                       fNbins, binsPt,
274                                       nbinsZ, binsZ);
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]);
279
280     histname = "fHistConstituents_";
281     histname += i;
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]);
287
288     histname = "fHistTracksJetPt_";
289     histname += i;
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]);
295
296     histname = "fHistTracksPtDist_";
297     histname += i;
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]);
303
304     if (!fCaloName.IsNull()) {
305       histname = "fHistClustersJetPt_";
306       histname += i;
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]);
312
313       histname = "fHistClustersPtDist_";
314       histname += i;
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]);
320     }
321
322     histname = "fHistJetNconstVsPt_";
323     histname += i;
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]);
329   }
330
331   PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
332
333   delete[] binsPt;
334   delete[] binsCorrPt;
335   delete[] binsArea;
336   delete[] binsEta;
337   delete[] binsPhi;
338   delete[] bins120;
339 }
340
341 //________________________________________________________________________
342 Bool_t AliAnalysisTaskSAJF::FillHistograms()
343 {
344   // Fill histograms.
345
346   if (!fJets) {
347     AliError(Form("%s - Jet array not provided, returning...", GetName()));
348     return kFALSE;
349   }
350
351   if (fJets->GetEntriesFast() < 1) // no jets in array, skipping
352     return kTRUE;
353
354   static Int_t sortedJets[9999] = {-1};
355   Bool_t r = GetSortedArray(sortedJets, fJets, fRhoVal);
356   
357   if (!r) // no accepted jets, skipping
358     return kTRUE;
359
360   // OK, event accepted
361
362   for (Int_t i = 0; i < fNLeadingJets && i < fJets->GetEntriesFast(); i++) {
363     AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(sortedJets[i]));
364
365     if (!jet) {
366       AliError(Form("Could not receive jet %d", sortedJets[i]));
367       continue;
368     }  
369
370     if (!AcceptJet(jet))
371       continue;
372
373     Float_t ptLeading = GetLeadingHadronPt(jet);
374
375     fHistLeadingJetPhiEta[fCentBin]->Fill(jet->Eta(), jet->Phi(), ptLeading);
376     fHistLeadingJetPtArea[fCentBin]->Fill(jet->Pt(), jet->Area(), ptLeading);
377
378     if (fIsEmbedded) 
379       fHistLeadingJetMCPtArea[fCentBin]->Fill(jet->MCPt(), jet->Area(), ptLeading);      
380
381     Float_t corrPt = jet->Pt() - fRhoVal * jet->Area();
382
383     if (fHistLeadingJetCorrPtArea[fCentBin])
384       fHistLeadingJetCorrPtArea[fCentBin]->Fill(corrPt, jet->Area(), ptLeading);
385
386     if (i==0 && fHistRhoVSleadJetPt[fCentBin]) 
387       fHistRhoVSleadJetPt[fCentBin]->Fill(fRhoVal, jet->Pt());
388   }
389
390   Int_t njets = DoJetLoop();
391
392   fNjetsVsCent->Fill(fCent, njets);
393
394   return kTRUE;
395 }
396
397 //________________________________________________________________________
398 Int_t AliAnalysisTaskSAJF::DoJetLoop()
399 {
400   // Do the jet loop.
401
402   if (!fJets)
403     return 0;
404
405   const Int_t njets = fJets->GetEntriesFast();
406   Int_t nAccJets = 0;
407
408   TH1F constituents("constituents", "constituents", 
409                     fHistConstituents[0]->GetNbinsX(), fHistConstituents[0]->GetXaxis()->GetXmin(), fHistConstituents[0]->GetXaxis()->GetXmax()); 
410
411   for (Int_t ij = 0; ij < njets; ij++) {
412
413     AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(ij));
414
415     if (!jet) {
416       AliError(Form("Could not receive jet %d", ij));
417       continue;
418     }  
419
420     if (!AcceptJet(jet))
421       continue;
422
423     Float_t corrPt = jet->Pt() - fRhoVal * jet->Area();
424
425     Float_t ptLeading = GetLeadingHadronPt(jet);
426
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);
434
435     if (fIsEmbedded) {
436       fHistJetsMCPtArea[fCentBin]->Fill(jet->MCPt(), jet->Area(), ptLeading);
437       fHistJetPtvsJetMCPt[fCentBin]->Fill(jet->Pt(), jet->MCPt());
438     }
439
440     fHistJetsNEFvsPt[fCentBin]->Fill(jet->NEF(), jet->Pt(), ptLeading);
441     fHistJetsCEFvsCEFPt[fCentBin]->Fill(1-jet->NEF(), (1-jet->NEF())*jet->Pt(), ptLeading);
442
443     if (fTracks) {
444       for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
445         AliVParticle *track = jet->TrackAt(it, fTracks);
446         if (track) {
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);
452         }
453       }
454     }
455
456     if (fCaloClusters) {
457       for (Int_t ic = 0; ic < jet->GetNumberOfClusters(); ic++) {
458         AliVCluster *cluster = jet->ClusterAt(ic, fCaloClusters);
459         
460         if (cluster) {
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);
468         }
469       }
470     }
471
472     for (Int_t i = 1; i <= constituents.GetNbinsX(); i++) {
473       fHistConstituents[fCentBin]->Fill(constituents.GetBinCenter(i), constituents.GetBinContent(i));
474     }
475
476     constituents.Reset();
477     nAccJets++;
478   } //jet loop 
479
480   return nAccJets;
481 }