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