]>
Commit | Line | Data |
---|---|---|
8628b70c | 1 | // $Id$ |
9f52c61f | 2 | // |
3 | // Jet sample analysis task. | |
4 | // | |
5 | // Author: S.Aiola | |
6 | ||
7 | #include <TClonesArray.h> | |
8 | #include <TH1F.h> | |
9 | #include <TH2F.h> | |
10 | #include <TList.h> | |
11 | #include <TLorentzVector.h> | |
12 | ||
13 | #include "AliVCluster.h" | |
14 | #include "AliVTrack.h" | |
15 | #include "AliEmcalJet.h" | |
16 | #include "AliRhoParameter.h" | |
17 | #include "AliLog.h" | |
9239b066 | 18 | #include "AliJetContainer.h" |
9f52c61f | 19 | |
20 | #include "AliAnalysisTaskEmcalJetSample.h" | |
21 | ||
22 | ClassImp(AliAnalysisTaskEmcalJetSample) | |
23 | ||
24 | //________________________________________________________________________ | |
25 | AliAnalysisTaskEmcalJetSample::AliAnalysisTaskEmcalJetSample() : | |
26 | AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetSample", kTRUE) | |
27 | ||
28 | { | |
29 | // Default constructor. | |
30 | ||
31 | for (Int_t i = 0; i < 4; i++) { | |
32 | fHistTracksPt[i] = 0; | |
33 | fHistClustersPt[i] = 0; | |
34 | fHistLeadingJetPt[i] = 0; | |
35 | fHistJetsPhiEta[i] = 0; | |
36 | fHistJetsPtArea[i] = 0; | |
37 | fHistJetsPtLeadHad[i] = 0; | |
38 | fHistJetsCorrPtArea[i] = 0; | |
39 | } | |
40 | ||
41 | SetMakeGeneralHistograms(kTRUE); | |
42 | } | |
43 | ||
44 | //________________________________________________________________________ | |
45 | AliAnalysisTaskEmcalJetSample::AliAnalysisTaskEmcalJetSample(const char *name) : | |
46 | AliAnalysisTaskEmcalJet(name, kTRUE) | |
47 | { | |
48 | // Standard constructor. | |
49 | ||
9239b066 | 50 | |
9f52c61f | 51 | for (Int_t i = 0; i < 4; i++) { |
52 | fHistTracksPt[i] = 0; | |
53 | fHistClustersPt[i] = 0; | |
54 | fHistLeadingJetPt[i] = 0; | |
55 | fHistJetsPhiEta[i] = 0; | |
56 | fHistJetsPtArea[i] = 0; | |
57 | fHistJetsPtLeadHad[i] = 0; | |
58 | fHistJetsCorrPtArea[i] = 0; | |
59 | } | |
60 | ||
61 | SetMakeGeneralHistograms(kTRUE); | |
62 | } | |
63 | ||
64 | //________________________________________________________________________ | |
65 | AliAnalysisTaskEmcalJetSample::~AliAnalysisTaskEmcalJetSample() | |
66 | { | |
67 | // Destructor. | |
68 | } | |
69 | ||
70 | //________________________________________________________________________ | |
71 | void AliAnalysisTaskEmcalJetSample::UserCreateOutputObjects() | |
72 | { | |
73 | // Create user output. | |
74 | ||
75 | AliAnalysisTaskEmcalJet::UserCreateOutputObjects(); | |
76 | ||
77 | TString histname; | |
78 | ||
79 | for (Int_t i = 0; i < 4; i++) { | |
9239b066 | 80 | if (fParticleCollArray.GetEntriesFast()>0) { |
9f52c61f | 81 | histname = "fHistTracksPt_"; |
82 | histname += i; | |
83 | fHistTracksPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2); | |
84 | fHistTracksPt[i]->GetXaxis()->SetTitle("p_{T,track} (GeV/c)"); | |
85 | fHistTracksPt[i]->GetYaxis()->SetTitle("counts"); | |
86 | fOutput->Add(fHistTracksPt[i]); | |
87 | } | |
88 | ||
9239b066 | 89 | if (fClusterCollArray.GetEntriesFast()>0) { |
9f52c61f | 90 | histname = "fHistClustersPt_"; |
91 | histname += i; | |
92 | fHistClustersPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins / 2, fMinBinPt, fMaxBinPt / 2); | |
93 | fHistClustersPt[i]->GetXaxis()->SetTitle("p_{T,clus} (GeV/c)"); | |
94 | fHistClustersPt[i]->GetYaxis()->SetTitle("counts"); | |
95 | fOutput->Add(fHistClustersPt[i]); | |
96 | } | |
97 | ||
9239b066 | 98 | if (fJetCollArray.GetEntriesFast()>0) { |
9f52c61f | 99 | histname = "fHistLeadingJetPt_"; |
100 | histname += i; | |
101 | fHistLeadingJetPt[i] = new TH1F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt); | |
102 | fHistLeadingJetPt[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)"); | |
103 | fHistLeadingJetPt[i]->GetYaxis()->SetTitle("counts"); | |
104 | fOutput->Add(fHistLeadingJetPt[i]); | |
105 | ||
106 | histname = "fHistJetsPhiEta_"; | |
107 | histname += i; | |
108 | fHistJetsPhiEta[i] = new TH2F(histname.Data(), histname.Data(), 50, -1, 1, 101, 0, TMath::Pi()*2 + TMath::Pi()/200); | |
109 | fHistJetsPhiEta[i]->GetXaxis()->SetTitle("#eta"); | |
110 | fHistJetsPhiEta[i]->GetYaxis()->SetTitle("#phi"); | |
111 | fOutput->Add(fHistJetsPhiEta[i]); | |
112 | ||
113 | histname = "fHistJetsPtArea_"; | |
114 | histname += i; | |
115 | fHistJetsPtArea[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, 30, 0, 3); | |
116 | fHistJetsPtArea[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)"); | |
117 | fHistJetsPtArea[i]->GetYaxis()->SetTitle("area"); | |
118 | fOutput->Add(fHistJetsPtArea[i]); | |
119 | ||
120 | histname = "fHistJetsPtLeadHad_"; | |
121 | histname += i; | |
122 | fHistJetsPtLeadHad[i] = new TH2F(histname.Data(), histname.Data(), fNbins, fMinBinPt, fMaxBinPt, fNbins / 2, fMinBinPt, fMaxBinPt / 2); | |
123 | fHistJetsPtLeadHad[i]->GetXaxis()->SetTitle("p_{T}^{raw} (GeV/c)"); | |
124 | fHistJetsPtLeadHad[i]->GetYaxis()->SetTitle("p_{T,lead} (GeV/c)"); | |
125 | fHistJetsPtLeadHad[i]->GetZaxis()->SetTitle("counts"); | |
126 | fOutput->Add(fHistJetsPtLeadHad[i]); | |
127 | ||
9239b066 | 128 | if (!(GetJetContainer()->GetRhoName().IsNull())) { |
9f52c61f | 129 | histname = "fHistJetsCorrPtArea_"; |
130 | histname += i; | |
131 | fHistJetsCorrPtArea[i] = new TH2F(histname.Data(), histname.Data(), fNbins*2, -fMaxBinPt, fMaxBinPt, 30, 0, 3); | |
132 | fHistJetsCorrPtArea[i]->GetXaxis()->SetTitle("p_{T}^{corr} [GeV/c]"); | |
133 | fHistJetsCorrPtArea[i]->GetYaxis()->SetTitle("area"); | |
134 | fOutput->Add(fHistJetsCorrPtArea[i]); | |
135 | } | |
136 | } | |
137 | } | |
138 | PostData(1, fOutput); // Post data for ALL output slots > 0 here. | |
139 | } | |
140 | ||
141 | //________________________________________________________________________ | |
142 | Bool_t AliAnalysisTaskEmcalJetSample::FillHistograms() | |
143 | { | |
144 | // Fill histograms. | |
145 | ||
146 | if (fTracks) { | |
147 | const Int_t ntracks = fTracks->GetEntriesFast(); | |
9f52c61f | 148 | for (Int_t it = 0; it < ntracks; it++) { |
149 | AliVTrack *track = static_cast<AliVTrack*>(fTracks->At(it)); | |
150 | ||
151 | if (!track) { | |
152 | AliError(Form("Could not receive track %d", it)); | |
153 | continue; | |
154 | } | |
155 | ||
156 | if (!AcceptTrack(track)) | |
157 | continue; | |
158 | ||
159 | fHistTracksPt[fCentBin]->Fill(track->Pt()); | |
160 | } | |
161 | } | |
162 | ||
163 | if (fCaloClusters) { | |
164 | const Int_t nclusters = fCaloClusters->GetEntriesFast(); | |
165 | ||
166 | for (Int_t ic = 0; ic < nclusters; ic++) { | |
167 | AliVCluster *cluster = static_cast<AliVCluster*>(fCaloClusters->At(ic)); | |
168 | ||
169 | if (!cluster) { | |
170 | AliError(Form("Could not receive cluster %d", ic)); | |
171 | continue; | |
172 | } | |
173 | ||
174 | TLorentzVector nPart; | |
175 | cluster->GetMomentum(nPart, fVertex); | |
176 | fHistClustersPt[fCentBin]->Fill(nPart.Pt()); | |
177 | } | |
178 | } | |
179 | ||
180 | if (fJets) { | |
9239b066 | 181 | |
182 | fJets->Sort(); | |
9f52c61f | 183 | |
184 | const Int_t njets = fJets->GetEntriesFast(); | |
9239b066 | 185 | Bool_t leadJet = kFALSE; |
9f52c61f | 186 | for (Int_t ij = 0; ij < njets; ij++) { |
187 | ||
188 | AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(ij)); | |
189 | if (!jet) { | |
190 | AliError(Form("Could not receive jet %d", ij)); | |
191 | continue; | |
192 | } | |
193 | ||
194 | if (!AcceptJet(jet)) | |
195 | continue; | |
196 | ||
9239b066 | 197 | if (!leadJet) { |
198 | fHistLeadingJetPt[fCentBin]->Fill(jet->Pt()); | |
199 | leadJet = kTRUE; | |
200 | } | |
201 | ||
9f52c61f | 202 | fHistJetsPtArea[fCentBin]->Fill(jet->Pt(), jet->Area()); |
203 | fHistJetsPhiEta[fCentBin]->Fill(jet->Eta(), jet->Phi()); | |
204 | ||
205 | Float_t ptLeading = GetLeadingHadronPt(jet); | |
206 | fHistJetsPtLeadHad[fCentBin]->Fill(jet->Pt(), ptLeading); | |
207 | ||
208 | if (fRho) { | |
209 | Float_t corrPt = jet->Pt() - fRhoVal * jet->Area(); | |
210 | fHistJetsCorrPtArea[fCentBin]->Fill(corrPt, jet->Area()); | |
211 | } | |
212 | } | |
213 | } | |
214 | ||
215 | return kTRUE; | |
216 | } | |
217 | ||
218 | //________________________________________________________________________ | |
219 | Bool_t AliAnalysisTaskEmcalJetSample::Run() | |
220 | { | |
221 | // Run analysis code here, if needed. It will be executed before FillHistograms(). | |
222 | ||
223 | return kTRUE; // If return kFALSE FillHistogram() will NOT be executed. | |
224 | } | |
225 | ||
226 | //________________________________________________________________________ | |
227 | void AliAnalysisTaskEmcalJetSample::Terminate(Option_t *) | |
228 | { | |
229 | // Called once at the end of the analysis. | |
230 | } |