3 // Jet sample analysis task.
7 #include <TClonesArray.h>
11 #include <TLorentzVector.h>
13 #include "AliVCluster.h"
14 #include "AliVTrack.h"
15 #include "AliEmcalJet.h"
16 #include "AliRhoParameter.h"
19 #include "AliAnalysisTaskEmcalJetSample.h"
21 ClassImp(AliAnalysisTaskEmcalJetSample)
23 //________________________________________________________________________
24 AliAnalysisTaskEmcalJetSample::AliAnalysisTaskEmcalJetSample() :
25 AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetSample", kTRUE)
28 // Default constructor.
30 for (Int_t i = 0; i < 4; i++) {
32 fHistClustersPt[i] = 0;
33 fHistLeadingJetPt[i] = 0;
34 fHistJetsPhiEta[i] = 0;
35 fHistJetsPtArea[i] = 0;
36 fHistJetsPtLeadHad[i] = 0;
37 fHistJetsCorrPtArea[i] = 0;
40 SetMakeGeneralHistograms(kTRUE);
43 //________________________________________________________________________
44 AliAnalysisTaskEmcalJetSample::AliAnalysisTaskEmcalJetSample(const char *name) :
45 AliAnalysisTaskEmcalJet(name, kTRUE)
47 // Standard constructor.
49 for (Int_t i = 0; i < 4; i++) {
51 fHistClustersPt[i] = 0;
52 fHistLeadingJetPt[i] = 0;
53 fHistJetsPhiEta[i] = 0;
54 fHistJetsPtArea[i] = 0;
55 fHistJetsPtLeadHad[i] = 0;
56 fHistJetsCorrPtArea[i] = 0;
59 SetMakeGeneralHistograms(kTRUE);
62 //________________________________________________________________________
63 AliAnalysisTaskEmcalJetSample::~AliAnalysisTaskEmcalJetSample()
68 //________________________________________________________________________
69 void AliAnalysisTaskEmcalJetSample::UserCreateOutputObjects()
71 // Create user output.
73 AliAnalysisTaskEmcalJet::UserCreateOutputObjects();
77 for (Int_t i = 0; i < 4; i++) {
78 if (!fTracksName.IsNull()) {
79 histname = "fHistTracksPt_";
81 fHistTracksPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2);
82 fHistTracksPt[i]->GetXaxis()->SetTitle("p_{T,track} (GeV/c)");
83 fHistTracksPt[i]->GetYaxis()->SetTitle("counts");
84 fOutput->Add(fHistTracksPt[i]);
87 if (!fCaloName.IsNull()) {
88 histname = "fHistClustersPt_";
90 fHistClustersPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2);
91 fHistClustersPt[i]->GetXaxis()->SetTitle("p_{T,clus} (GeV/c)");
92 fHistClustersPt[i]->GetYaxis()->SetTitle("counts");
93 fOutput->Add(fHistClustersPt[i]);
96 if (!fJetsName.IsNull()) {
97 histname = "fHistLeadingJetPt_";
99 fHistLeadingJetPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt);
100 fHistLeadingJetPt[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)");
101 fHistLeadingJetPt[i]->GetYaxis()->SetTitle("counts");
102 fOutput->Add(fHistLeadingJetPt[i]);
104 histname = "fHistJetsPhiEta_";
106 fHistJetsPhiEta[i] = new TH2F(histname.Data(), histname.Data(), 50, -1, 1, 101, 0, TMath::Pi()*2 + TMath::Pi()/200);
107 fHistJetsPhiEta[i]->GetXaxis()->SetTitle("#eta");
108 fHistJetsPhiEta[i]->GetYaxis()->SetTitle("#phi");
109 fOutput->Add(fHistJetsPhiEta[i]);
111 histname = "fHistJetsPtArea_";
113 fHistJetsPtArea[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, 30, 0, 3);
114 fHistJetsPtArea[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)");
115 fHistJetsPtArea[i]->GetYaxis()->SetTitle("area");
116 fOutput->Add(fHistJetsPtArea[i]);
118 histname = "fHistJetsPtLeadHad_";
120 fHistJetsPtLeadHad[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
121 fHistJetsPtLeadHad[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)");
122 fHistJetsPtLeadHad[i]->GetYaxis()->SetTitle("p_{T,lead} (GeV/c)");
123 fHistJetsPtLeadHad[i]->GetZaxis()->SetTitle("counts");
124 fOutput->Add(fHistJetsPtLeadHad[i]);
126 if (!fRhoName.IsNull()) {
127 histname = "fHistJetsCorrPtArea_";
129 fHistJetsCorrPtArea[i] = new TH2F(histname.Data(), histname.Data(), fNbins*2, -fMaxBinPt, fMaxBinPt, 30, 0, 3);
130 fHistJetsCorrPtArea[i]->GetXaxis()->SetTitle("p_{T}^{corr} [GeV/c]");
131 fHistJetsCorrPtArea[i]->GetYaxis()->SetTitle("area");
132 fOutput->Add(fHistJetsCorrPtArea[i]);
136 PostData(1, fOutput); // Post data for ALL output slots > 0 here.
139 //________________________________________________________________________
140 Bool_t AliAnalysisTaskEmcalJetSample::FillHistograms()
145 const Int_t ntracks = fTracks->GetEntriesFast();
147 for (Int_t it = 0; it < ntracks; it++) {
148 AliVTrack *track = static_cast<AliVTrack*>(fTracks->At(it));
151 AliError(Form("Could not receive track %d", it));
155 if (!AcceptTrack(track))
158 fHistTracksPt[fCentBin]->Fill(track->Pt());
163 const Int_t nclusters = fCaloClusters->GetEntriesFast();
165 for (Int_t ic = 0; ic < nclusters; ic++) {
166 AliVCluster *cluster = static_cast<AliVCluster*>(fCaloClusters->At(ic));
169 AliError(Form("Could not receive cluster %d", ic));
173 TLorentzVector nPart;
174 cluster->GetMomentum(nPart, fVertex);
175 fHistClustersPt[fCentBin]->Fill(nPart.Pt());
180 static Int_t sortedJets[9999] = {-1};
181 Bool_t r = GetSortedArray(sortedJets, fJets);
183 if (r && sortedJets[0]>=0) {
184 AliEmcalJet* leadJet = static_cast<AliEmcalJet*>(fJets->At(sortedJets[0]));
186 fHistLeadingJetPt[fCentBin]->Fill(leadJet->Pt());
188 AliError("Could not retrieve leading jet!");
191 const Int_t njets = fJets->GetEntriesFast();
192 for (Int_t ij = 0; ij < njets; ij++) {
194 AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(ij));
196 AliError(Form("Could not receive jet %d", ij));
203 fHistJetsPtArea[fCentBin]->Fill(jet->Pt(), jet->Area());
204 fHistJetsPhiEta[fCentBin]->Fill(jet->Eta(), jet->Phi());
206 Float_t ptLeading = GetLeadingHadronPt(jet);
207 fHistJetsPtLeadHad[fCentBin]->Fill(jet->Pt(), ptLeading);
210 Float_t corrPt = jet->Pt() - fRhoVal * jet->Area();
211 fHistJetsCorrPtArea[fCentBin]->Fill(corrPt, jet->Area());
219 //________________________________________________________________________
220 Bool_t AliAnalysisTaskEmcalJetSample::Run()
222 // Run analysis code here, if needed. It will be executed before FillHistograms().
224 return kTRUE; // If return kFALSE FillHistogram() will NOT be executed.
227 //________________________________________________________________________
228 void AliAnalysisTaskEmcalJetSample::Terminate(Option_t *)
230 // Called once at the end of the analysis.