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