]>
Commit | Line | Data |
---|---|---|
7549c451 | 1 | // $Id$ |
2949a2ec | 2 | // |
3 | // Emcal jet response matrix maker task. | |
4 | // | |
5 | // Author: S. Aiola | |
6 | ||
7 | #include "AliJetResponseMaker.h" | |
8 | ||
2949a2ec | 9 | #include <TClonesArray.h> |
10 | #include <TH1F.h> | |
11 | #include <TH2F.h> | |
b16bb001 | 12 | #include <TH3F.h> |
2949a2ec | 13 | #include <TLorentzVector.h> |
14 | ||
2949a2ec | 15 | #include "AliVCluster.h" |
16 | #include "AliVTrack.h" | |
17 | #include "AliEmcalJet.h" | |
1ee1b5b8 | 18 | #include "AliGenPythiaEventHeader.h" |
b16bb001 | 19 | #include "AliLog.h" |
2949a2ec | 20 | #include "AliMCEvent.h" |
21 | ||
22 | ClassImp(AliJetResponseMaker) | |
23 | ||
24 | //________________________________________________________________________ | |
25 | AliJetResponseMaker::AliJetResponseMaker() : | |
e44e8726 | 26 | AliAnalysisTaskEmcalJet("AliJetResponseMaker", kTRUE), |
7549c451 | 27 | fMCTracksName("MCParticles"), |
28 | fMCJetsName("MCJets"), | |
99c67c1b | 29 | fMaxDistance(0.25), |
1ee1b5b8 | 30 | fDoWeighting(kFALSE), |
4643d2e8 | 31 | fEventWeightHist(kFALSE), |
91bee8bc | 32 | fMCFiducial(kFALSE), |
33 | fMCminEta(0), | |
34 | fMCmaxEta(0), | |
35 | fMCminPhi(0), | |
36 | fMCmaxPhi(0), | |
4643d2e8 | 37 | fSelectPtHardBin(-999), |
aa4d701c | 38 | fDoMatching(kTRUE), |
1ee1b5b8 | 39 | fPythiaHeader(0), |
40 | fEventWeight(0), | |
41 | fPtHardBin(0), | |
42 | fNTrials(0), | |
7549c451 | 43 | fMCTracks(0), |
2949a2ec | 44 | fMCJets(0), |
1ee1b5b8 | 45 | fHistNTrials(0), |
1ee1b5b8 | 46 | fHistEvents(0), |
b16bb001 | 47 | fHistMCJetsPhiEta(0), |
48 | fHistMCJetsPtArea(0), | |
49 | fHistMCJetsPhiEtaFiducial(0), | |
50 | fHistMCJetsPtAreaFiducial(0), | |
2949a2ec | 51 | fHistMCJetsNEFvsPt(0), |
52 | fHistMCJetsZvsPt(0), | |
b16bb001 | 53 | fHistJetsPhiEta(0), |
54 | fHistJetsPtArea(0), | |
55 | fHistJetsCorrPtArea(0), | |
2949a2ec | 56 | fHistJetsNEFvsPt(0), |
1b76c28f | 57 | fHistJetsZvsPt(0), |
b16bb001 | 58 | fHistMatchingLevelMCPt(0), |
59 | fHistClosestDeltaEtaPhiMCPt(0), | |
60 | fHistClosestDeltaPtMCPt(0), | |
61 | fHistClosestDeltaCorrPtMCPt(0), | |
62 | fHistNonMatchedMCJetsPtArea(0), | |
63 | fHistNonMatchedJetsPtArea(0), | |
64 | fHistNonMatchedJetsCorrPtArea(0), | |
2bddb6ae | 65 | fHistPartvsDetecPt(0), |
b16bb001 | 66 | fHistPartvsDetecCorrPt(0), |
67 | fHistMissedMCJetsPtArea(0) | |
2949a2ec | 68 | { |
69 | // Default constructor. | |
4643d2e8 | 70 | |
71 | for (Int_t i = 0; i < 11; i++) { | |
72 | fHistEventWeight[i] = 0; | |
73 | } | |
a487deae | 74 | |
75 | SetMakeGeneralHistograms(kTRUE); | |
2949a2ec | 76 | } |
77 | ||
78 | //________________________________________________________________________ | |
79 | AliJetResponseMaker::AliJetResponseMaker(const char *name) : | |
e44e8726 | 80 | AliAnalysisTaskEmcalJet(name, kTRUE), |
7549c451 | 81 | fMCTracksName("MCParticles"), |
82 | fMCJetsName("MCJets"), | |
99c67c1b | 83 | fMaxDistance(0.25), |
1ee1b5b8 | 84 | fDoWeighting(kFALSE), |
4643d2e8 | 85 | fEventWeightHist(kFALSE), |
91bee8bc | 86 | fMCFiducial(kFALSE), |
87 | fMCminEta(0), | |
88 | fMCmaxEta(0), | |
89 | fMCminPhi(0), | |
90 | fMCmaxPhi(0), | |
4643d2e8 | 91 | fSelectPtHardBin(-999), |
aa4d701c | 92 | fDoMatching(kTRUE), |
1ee1b5b8 | 93 | fPythiaHeader(0), |
94 | fEventWeight(0), | |
95 | fPtHardBin(0), | |
96 | fNTrials(0), | |
7549c451 | 97 | fMCTracks(0), |
2949a2ec | 98 | fMCJets(0), |
1ee1b5b8 | 99 | fHistNTrials(0), |
1ee1b5b8 | 100 | fHistEvents(0), |
b16bb001 | 101 | fHistMCJetsPhiEta(0), |
102 | fHistMCJetsPtArea(0), | |
103 | fHistMCJetsPhiEtaFiducial(0), | |
104 | fHistMCJetsPtAreaFiducial(0), | |
2949a2ec | 105 | fHistMCJetsNEFvsPt(0), |
106 | fHistMCJetsZvsPt(0), | |
b16bb001 | 107 | fHistJetsPhiEta(0), |
108 | fHistJetsPtArea(0), | |
109 | fHistJetsCorrPtArea(0), | |
2949a2ec | 110 | fHistJetsNEFvsPt(0), |
1b76c28f | 111 | fHistJetsZvsPt(0), |
b16bb001 | 112 | fHistMatchingLevelMCPt(0), |
113 | fHistClosestDeltaEtaPhiMCPt(0), | |
114 | fHistClosestDeltaPtMCPt(0), | |
115 | fHistClosestDeltaCorrPtMCPt(0), | |
116 | fHistNonMatchedMCJetsPtArea(0), | |
117 | fHistNonMatchedJetsPtArea(0), | |
118 | fHistNonMatchedJetsCorrPtArea(0), | |
2bddb6ae | 119 | fHistPartvsDetecPt(0), |
b16bb001 | 120 | fHistPartvsDetecCorrPt(0), |
121 | fHistMissedMCJetsPtArea(0) | |
2949a2ec | 122 | { |
123 | // Standard constructor. | |
4643d2e8 | 124 | |
125 | for (Int_t i = 0; i < 11; i++) { | |
126 | fHistEventWeight[i] = 0; | |
127 | } | |
a487deae | 128 | |
129 | SetMakeGeneralHistograms(kTRUE); | |
2949a2ec | 130 | } |
131 | ||
132 | //________________________________________________________________________ | |
133 | AliJetResponseMaker::~AliJetResponseMaker() | |
134 | { | |
135 | // Destructor | |
136 | } | |
137 | ||
138 | //________________________________________________________________________ | |
139 | void AliJetResponseMaker::UserCreateOutputObjects() | |
140 | { | |
141 | // Create user objects. | |
142 | ||
a487deae | 143 | AliAnalysisTaskEmcalJet::UserCreateOutputObjects(); |
2949a2ec | 144 | |
1ee1b5b8 | 145 | const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234}; |
146 | const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000}; | |
147 | ||
148 | fHistNTrials = new TH1F("fHistNTrials", "fHistNTrials", 11, 0, 11); | |
149 | fHistNTrials->GetXaxis()->SetTitle("p_{T} hard bin"); | |
150 | fHistNTrials->GetYaxis()->SetTitle("trials"); | |
151 | fOutput->Add(fHistNTrials); | |
152 | ||
1ee1b5b8 | 153 | fHistEvents = new TH1F("fHistEvents", "fHistEvents", 11, 0, 11); |
154 | fHistEvents->GetXaxis()->SetTitle("p_{T} hard bin"); | |
155 | fHistEvents->GetYaxis()->SetTitle("total events"); | |
156 | fOutput->Add(fHistEvents); | |
157 | ||
4643d2e8 | 158 | if (fEventWeightHist) { |
159 | for (Int_t i = 0; i < 11; i++) { | |
160 | TString name(Form("fHistEventWeight_%d", i+1)); | |
161 | fHistEventWeight[i] = new TH1F(name, name, 10, 0, 10); | |
162 | fOutput->Add(fHistEventWeight[i]); | |
163 | } | |
164 | } | |
165 | ||
1ee1b5b8 | 166 | for (Int_t i = 1; i < 12; i++) { |
167 | fHistNTrials->GetXaxis()->SetBinLabel(i, Form("%d-%d",ptHardLo[i-1],ptHardHi[i-1])); | |
1ee1b5b8 | 168 | fHistEvents->GetXaxis()->SetBinLabel(i, Form("%d-%d",ptHardLo[i-1],ptHardHi[i-1])); |
169 | } | |
170 | ||
b16bb001 | 171 | fHistJetsPhiEta = new TH2F("fHistJetsPhiEta", "fHistJetsPhiEta", 20, -2, 2, 32, 0, 6.4); |
172 | fHistJetsPhiEta->GetXaxis()->SetTitle("#eta"); | |
173 | fHistJetsPhiEta->GetYaxis()->SetTitle("#phi"); | |
174 | fOutput->Add(fHistJetsPhiEta); | |
7549c451 | 175 | |
b16bb001 | 176 | fHistJetsPtArea = new TH2F("fHistJetsPtArea", "fHistJetsPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); |
177 | fHistJetsPtArea->GetXaxis()->SetTitle("area"); | |
178 | fHistJetsPtArea->GetYaxis()->SetTitle("p_{T}^{rec} (GeV/c)"); | |
179 | fHistJetsPtArea->GetZaxis()->SetTitle("counts"); | |
180 | fOutput->Add(fHistJetsPtArea); | |
181 | ||
182 | fHistJetsCorrPtArea = new TH2F("fHistJetsCorrPtArea", "fHistJetsCorrPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, (Int_t)(1.5*fNbins), -fMaxBinPt/2, fMaxBinPt); | |
183 | fHistJetsCorrPtArea->GetXaxis()->SetTitle("area"); | |
184 | fHistJetsCorrPtArea->GetYaxis()->SetTitle("p_{T}^{corr} (GeV/c)"); | |
185 | fHistJetsCorrPtArea->GetZaxis()->SetTitle("counts"); | |
186 | fOutput->Add(fHistJetsCorrPtArea); | |
2949a2ec | 187 | |
6fd5039f | 188 | fHistJetsZvsPt = new TH2F("fHistJetsZvsPt", "fHistJetsZvsPt", fNbins, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt); |
2949a2ec | 189 | fHistJetsZvsPt->GetXaxis()->SetTitle("Z"); |
b16bb001 | 190 | fHistJetsZvsPt->GetYaxis()->SetTitle("p_{T}^{rec} (GeV/c)"); |
2949a2ec | 191 | fOutput->Add(fHistJetsZvsPt); |
192 | ||
cd588263 | 193 | fHistJetsNEFvsPt = new TH2F("fHistJetsNEFvsPt", "fHistJetsNEFvsPt", fNbins, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt); |
194 | fHistJetsNEFvsPt->GetXaxis()->SetTitle("NEF"); | |
b16bb001 | 195 | fHistJetsNEFvsPt->GetYaxis()->SetTitle("p_{T}^{rec} (GeV/c)"); |
cd588263 | 196 | fOutput->Add(fHistJetsNEFvsPt); |
7549c451 | 197 | |
b16bb001 | 198 | fHistMCJetsPhiEta = new TH2F("fHistMCJetsPhiEta", "fHistMCJetsPhiEta", 20, -2, 2, 32, 0, 6.4); |
199 | fHistMCJetsPhiEta->GetXaxis()->SetTitle("#eta"); | |
200 | fHistMCJetsPhiEta->GetYaxis()->SetTitle("#phi"); | |
201 | fOutput->Add(fHistMCJetsPhiEta); | |
7549c451 | 202 | |
b16bb001 | 203 | fHistMCJetsPtArea = new TH2F("fHistMCJetsPtArea", "fHistMCJetsPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); |
204 | fHistMCJetsPtArea->GetXaxis()->SetTitle("area"); | |
205 | fHistMCJetsPtArea->GetYaxis()->SetTitle("p_{T}^{gen} (GeV/c)"); | |
206 | fHistMCJetsPtArea->GetZaxis()->SetTitle("counts"); | |
207 | fOutput->Add(fHistMCJetsPtArea); | |
208 | ||
209 | fHistMCJetsPhiEtaFiducial = new TH2F("fHistMCJetsPhiEtaFiducial", "fHistMCJetsPhiEtaFiducial", 20, -2, 2, 32, 0, 6.4); | |
210 | fHistMCJetsPhiEtaFiducial->GetXaxis()->SetTitle("#eta"); | |
211 | fHistMCJetsPhiEtaFiducial->GetYaxis()->SetTitle("#phi"); | |
212 | fOutput->Add(fHistMCJetsPhiEtaFiducial); | |
87203fd3 | 213 | |
b16bb001 | 214 | fHistMCJetsPtAreaFiducial = new TH2F("fHistMCJetsPtAreaFiducial", "fHistMCJetsPtAreaFiducial", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); |
215 | fHistMCJetsPtAreaFiducial->GetXaxis()->SetTitle("area"); | |
216 | fHistMCJetsPtAreaFiducial->GetYaxis()->SetTitle("p_{T}^{gen} (GeV/c)"); | |
217 | fHistMCJetsPtAreaFiducial->GetZaxis()->SetTitle("counts"); | |
218 | fOutput->Add(fHistMCJetsPtAreaFiducial); | |
7549c451 | 219 | |
6fd5039f | 220 | fHistMCJetsZvsPt = new TH2F("fHistMCJetsZvsPt", "fHistMCJetsZvsPt", fNbins, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt); |
7549c451 | 221 | fHistMCJetsZvsPt->GetXaxis()->SetTitle("Z"); |
b16bb001 | 222 | fHistMCJetsZvsPt->GetYaxis()->SetTitle("p_{T}^{gen} (GeV/c)"); |
7549c451 | 223 | fOutput->Add(fHistMCJetsZvsPt); |
cd588263 | 224 | |
225 | fHistMCJetsNEFvsPt = new TH2F("fHistMCJetsNEFvsPt", "fHistMCJetsNEFvsPt", fNbins, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt); | |
226 | fHistMCJetsNEFvsPt->GetXaxis()->SetTitle("NEF"); | |
b16bb001 | 227 | fHistMCJetsNEFvsPt->GetYaxis()->SetTitle("p_{T}^{gen} (GeV/c)"); |
cd588263 | 228 | fOutput->Add(fHistMCJetsNEFvsPt); |
7549c451 | 229 | |
b16bb001 | 230 | fHistMatchingLevelMCPt = new TH2F("fHistMatchingLevelMCPt", "fHistMatchingLevelMCPt", fNbins, 0, 1.2, fNbins, fMinBinPt, fMaxBinPt); |
231 | fHistMatchingLevelMCPt->GetXaxis()->SetTitle("Matching level"); | |
232 | fHistMatchingLevelMCPt->GetYaxis()->SetTitle("p_{T}^{gen} (GeV/c)"); | |
233 | fOutput->Add(fHistMatchingLevelMCPt); | |
234 | ||
235 | fHistClosestDeltaEtaPhiMCPt = new TH3F("fHistClosestDeltaEtaPhiMCPt", "fHistClosestDeltaEtaPhiMCPt", TMath::CeilNint(fJetMaxEta - fJetMinEta) * 20, fJetMinEta * 2, fJetMaxEta * 2, 64, -1.6, 4.8, fNbins, fMinBinPt, fMaxBinPt); | |
236 | fHistClosestDeltaEtaPhiMCPt->GetXaxis()->SetTitle("#Delta#eta"); | |
237 | fHistClosestDeltaEtaPhiMCPt->GetYaxis()->SetTitle("#Delta#phi"); | |
238 | fHistClosestDeltaEtaPhiMCPt->GetZaxis()->SetTitle("p_{T}^{gen}"); | |
239 | fOutput->Add(fHistClosestDeltaEtaPhiMCPt); | |
240 | ||
241 | fHistClosestDeltaPtMCPt = new TH2F("fHistClosestDeltaPtMCPt", "fHistClosestDeltaPtMCPt", fNbins, fMinBinPt, fMaxBinPt, (Int_t)(fNbins*1.5), -fMaxBinPt / 2, fMaxBinPt); | |
242 | fHistClosestDeltaPtMCPt->GetXaxis()->SetTitle("p_{T}^{gen}"); | |
243 | fHistClosestDeltaPtMCPt->GetYaxis()->SetTitle("#Deltap_{T}^{rec} (GeV/c)"); | |
244 | fHistClosestDeltaPtMCPt->GetZaxis()->SetTitle("counts"); | |
245 | fOutput->Add(fHistClosestDeltaPtMCPt); | |
246 | ||
247 | fHistClosestDeltaCorrPtMCPt = new TH2F("fHistClosestDeltaCorrPtMCPt", "fHistClosestDeltaCorrPtMCPt", fNbins, fMinBinPt, fMaxBinPt, (Int_t)(fNbins*1.5), -fMaxBinPt / 2, fMaxBinPt); | |
248 | fHistClosestDeltaCorrPtMCPt->GetXaxis()->SetTitle("p_{T}^{gen}"); | |
249 | fHistClosestDeltaCorrPtMCPt->GetYaxis()->SetTitle("#Deltap_{T}^{corr} (GeV/c)"); | |
250 | fHistClosestDeltaCorrPtMCPt->GetZaxis()->SetTitle("counts"); | |
251 | fOutput->Add(fHistClosestDeltaCorrPtMCPt); | |
252 | ||
253 | fHistNonMatchedMCJetsPtArea = new TH2F("fHistNonMatchedMCJetsPtArea", "fHistNonMatchedMCJetsPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); | |
254 | fHistNonMatchedMCJetsPtArea->GetXaxis()->SetTitle("area"); | |
255 | fHistNonMatchedMCJetsPtArea->GetYaxis()->SetTitle("p_{T}^{gen} (GeV/c)"); | |
256 | fHistNonMatchedMCJetsPtArea->GetZaxis()->SetTitle("counts"); | |
257 | fOutput->Add(fHistNonMatchedMCJetsPtArea); | |
258 | ||
259 | fHistNonMatchedJetsPtArea = new TH2F("fHistNonMatchedJetsPtArea", "fHistNonMatchedJetsPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); | |
260 | fHistNonMatchedJetsPtArea->GetXaxis()->SetTitle("area"); | |
261 | fHistNonMatchedJetsPtArea->GetYaxis()->SetTitle("p_{T}^{rec} (GeV/c)"); | |
262 | fHistNonMatchedJetsPtArea->GetZaxis()->SetTitle("counts"); | |
263 | fOutput->Add(fHistNonMatchedJetsPtArea); | |
264 | ||
265 | fHistNonMatchedJetsCorrPtArea = new TH2F("fHistNonMatchedJetsCorrPtArea", "fHistNonMatchedJetsCorrPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, (Int_t)(1.5*fNbins), -fMaxBinPt/2, fMaxBinPt); | |
266 | fHistNonMatchedJetsCorrPtArea->GetXaxis()->SetTitle("area"); | |
267 | fHistNonMatchedJetsCorrPtArea->GetYaxis()->SetTitle("p_{T}^{corr} (GeV/c)"); | |
268 | fHistNonMatchedJetsCorrPtArea->GetZaxis()->SetTitle("counts"); | |
269 | fOutput->Add(fHistNonMatchedJetsCorrPtArea); | |
99c67c1b | 270 | |
6fd5039f | 271 | fHistPartvsDetecPt = new TH2F("fHistPartvsDetecPt", "fHistPartvsDetecPt", fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt); |
99c67c1b | 272 | fHistPartvsDetecPt->GetXaxis()->SetTitle("p_{T}^{rec}"); |
273 | fHistPartvsDetecPt->GetYaxis()->SetTitle("p_{T}^{gen}"); | |
1b76c28f | 274 | fOutput->Add(fHistPartvsDetecPt); |
275 | ||
b16bb001 | 276 | fHistPartvsDetecCorrPt = new TH2F("fHistPartvsDetecCorrPt", "fHistPartvsDetecCorrPt", (Int_t)(1.5*fNbins), -fMaxBinPt/2, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt); |
277 | fHistPartvsDetecCorrPt->GetXaxis()->SetTitle("p_{T}^{corr}"); | |
278 | fHistPartvsDetecCorrPt->GetYaxis()->SetTitle("p_{T}^{gen}"); | |
279 | fOutput->Add(fHistPartvsDetecCorrPt); | |
280 | ||
281 | fHistMissedMCJetsPtArea = new TH2F("fHistMissedMCJetsPtArea", "fHistMissedMCJetsPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); | |
282 | fHistMissedMCJetsPtArea->GetXaxis()->SetTitle("area"); | |
283 | fHistMissedMCJetsPtArea->GetYaxis()->SetTitle("p_{T} (GeV/c)"); | |
284 | fHistMissedMCJetsPtArea->GetZaxis()->SetTitle("counts"); | |
285 | fOutput->Add(fHistMissedMCJetsPtArea); | |
2bddb6ae | 286 | |
99c67c1b | 287 | PostData(1, fOutput); // Post data for ALL output slots > 0 here, to get at least an empty histogram |
2949a2ec | 288 | } |
289 | ||
ceefbfbc | 290 | //________________________________________________________________________ |
a487deae | 291 | Bool_t AliJetResponseMaker::AcceptJet(AliEmcalJet *jet) const |
ceefbfbc | 292 | { |
293 | // Return true if jet is accepted. | |
294 | ||
295 | if (jet->Pt() <= fJetPtCut) | |
296 | return kFALSE; | |
297 | if (jet->Area() <= fJetAreaCut) | |
298 | return kFALSE; | |
65bb5510 | 299 | |
300 | return kTRUE; | |
ceefbfbc | 301 | } |
302 | ||
b3ccdfe2 | 303 | //________________________________________________________________________ |
304 | void AliJetResponseMaker::ExecOnce() | |
305 | { | |
306 | // Execute once. | |
307 | ||
308 | if (!fMCJetsName.IsNull() && !fMCJets) { | |
309 | fMCJets = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fMCJetsName)); | |
310 | if (!fMCJets) { | |
311 | AliError(Form("%s: Could not retrieve mc jets %s!", GetName(), fMCJetsName.Data())); | |
312 | return; | |
313 | } | |
314 | else if (!fMCJets->GetClass()->GetBaseClass("AliEmcalJet")) { | |
315 | AliError(Form("%s: Collection %s does not contain AliEmcalJet objects!", GetName(), fMCJetsName.Data())); | |
316 | fMCJets = 0; | |
317 | return; | |
318 | } | |
319 | } | |
320 | ||
321 | if (!fMCTracksName.IsNull() && !fMCTracks) { | |
322 | fMCTracks = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fMCTracksName)); | |
323 | if (!fMCTracks) { | |
324 | AliError(Form("%s: Could not retrieve mc tracks %s!", GetName(), fMCTracksName.Data())); | |
325 | return; | |
326 | } | |
327 | else { | |
328 | TClass *cl = fMCTracks->GetClass(); | |
329 | if (!cl->GetBaseClass("AliVParticle") && !cl->GetBaseClass("AliEmcalParticle")) { | |
330 | AliError(Form("%s: Collection %s does not contain AliVParticle nor AliEmcalParticle objects!", GetName(), fMCTracksName.Data())); | |
331 | fMCTracks = 0; | |
332 | return; | |
333 | } | |
334 | } | |
335 | } | |
336 | ||
337 | AliAnalysisTaskEmcalJet::ExecOnce(); | |
91bee8bc | 338 | |
339 | if (fMCFiducial) { | |
a487deae | 340 | fMCminEta = fJetMinEta; |
341 | fMCmaxEta = fJetMaxEta; | |
342 | fMCminPhi = fJetMinPhi; | |
343 | fMCmaxPhi = fJetMaxPhi; | |
91bee8bc | 344 | } |
345 | else { | |
a487deae | 346 | fMCminEta = fJetMinEta - fJetRadius; |
347 | fMCmaxEta = fJetMaxEta + fJetRadius; | |
348 | fMCminPhi = fJetMinPhi - fJetRadius; | |
349 | fMCmaxPhi = fJetMaxPhi + fJetRadius; | |
91bee8bc | 350 | } |
b3ccdfe2 | 351 | } |
352 | ||
4643d2e8 | 353 | //________________________________________________________________________ |
354 | Bool_t AliJetResponseMaker::IsEventSelected() | |
355 | { | |
356 | // Check if event is selected | |
357 | ||
358 | if (fSelectPtHardBin != -999 && fSelectPtHardBin != fPtHardBin) | |
359 | return kFALSE; | |
360 | ||
361 | return AliAnalysisTaskEmcalJet::IsEventSelected(); | |
362 | } | |
363 | ||
b3ccdfe2 | 364 | //________________________________________________________________________ |
365 | Bool_t AliJetResponseMaker::RetrieveEventObjects() | |
366 | { | |
367 | // Retrieve event objects. | |
368 | ||
369 | if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects()) | |
370 | return kFALSE; | |
371 | ||
372 | fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent()->GenEventHeader()); | |
373 | ||
374 | if (!fPythiaHeader) | |
375 | return kFALSE; | |
376 | ||
377 | if (fDoWeighting) | |
378 | fEventWeight = fPythiaHeader->EventWeight(); | |
379 | else | |
380 | fEventWeight = 1; | |
381 | ||
382 | const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234}; | |
383 | const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000}; | |
384 | ||
385 | Double_t pthard = fPythiaHeader->GetPtHard(); | |
91bee8bc | 386 | |
9f52c61f | 387 | for (fPtHardBin = 0; fPtHardBin < 11; fPtHardBin++) { |
b3ccdfe2 | 388 | if (pthard >= ptHardLo[fPtHardBin] && pthard < ptHardHi[fPtHardBin]) |
389 | break; | |
390 | } | |
b3ccdfe2 | 391 | |
392 | fNTrials = fPythiaHeader->Trials(); | |
393 | ||
394 | return kTRUE; | |
395 | } | |
396 | ||
397 | //________________________________________________________________________ | |
398 | Bool_t AliJetResponseMaker::Run() | |
399 | { | |
400 | // Find the closest jets | |
401 | ||
aa4d701c | 402 | if (!fDoMatching) |
403 | return kTRUE; | |
404 | ||
b3ccdfe2 | 405 | DoJetLoop(fJets, fMCJets, kFALSE); |
406 | DoJetLoop(fMCJets, fJets, kTRUE); | |
407 | ||
aa4d701c | 408 | const Int_t nMCJets = fMCJets->GetEntriesFast(); |
409 | ||
410 | for (Int_t i = 0; i < nMCJets; i++) { | |
411 | ||
412 | AliEmcalJet* jet = static_cast<AliEmcalJet*>(fMCJets->At(i)); | |
413 | ||
414 | if (!jet) { | |
415 | AliError(Form("Could not receive jet %d", i)); | |
416 | continue; | |
417 | } | |
418 | ||
419 | if (!AcceptJet(jet)) | |
420 | continue; | |
421 | ||
422 | if (jet->Eta() < fMCminEta || jet->Eta() > fMCmaxEta || jet->Phi() < fMCminPhi || jet->Phi() > fMCmaxPhi) | |
423 | continue; | |
424 | ||
425 | if (jet->Pt() > fMaxBinPt) | |
426 | continue; | |
427 | ||
428 | if (jet->ClosestJet() && jet->ClosestJet()->ClosestJet() == jet && | |
429 | jet->ClosestJetDistance() < fMaxDistance) { // Matched jet found | |
430 | jet->SetMatchedToClosest(); | |
431 | jet->ClosestJet()->SetMatchedToClosest(); | |
432 | } | |
433 | } | |
434 | ||
b3ccdfe2 | 435 | return kTRUE; |
436 | } | |
437 | ||
2949a2ec | 438 | //________________________________________________________________________ |
44476be7 | 439 | void AliJetResponseMaker::DoJetLoop(TClonesArray *jets1, TClonesArray *jets2, Bool_t mc) |
2949a2ec | 440 | { |
44476be7 | 441 | // Do the jet loop. |
1ee1b5b8 | 442 | |
44476be7 | 443 | Int_t nJets1 = jets1->GetEntriesFast(); |
444 | Int_t nJets2 = jets2->GetEntriesFast(); | |
1ee1b5b8 | 445 | |
44476be7 | 446 | for (Int_t i = 0; i < nJets1; i++) { |
1ee1b5b8 | 447 | |
44476be7 | 448 | AliEmcalJet* jet1 = static_cast<AliEmcalJet*>(jets1->At(i)); |
2949a2ec | 449 | |
44476be7 | 450 | if (!jet1) { |
451 | AliError(Form("Could not receive jet %d", i)); | |
452 | continue; | |
453 | } | |
454 | ||
ceefbfbc | 455 | if (!AcceptJet(jet1)) |
44476be7 | 456 | continue; |
457 | ||
ceefbfbc | 458 | if (!mc) { |
a487deae | 459 | if (jet1->Eta() < fJetMinEta || jet1->Eta() > fJetMaxEta || jet1->Phi() < fJetMinPhi || jet1->Phi() > fJetMaxPhi) |
ceefbfbc | 460 | continue; |
461 | } | |
462 | else { | |
91bee8bc | 463 | if (jet1->Eta() < fMCminEta || jet1->Eta() > fMCmaxEta || jet1->Phi() < fMCminPhi || jet1->Phi() > fMCmaxPhi) |
ceefbfbc | 464 | continue; |
465 | } | |
466 | ||
44476be7 | 467 | for (Int_t j = 0; j < nJets2; j++) { |
468 | ||
469 | AliEmcalJet* jet2 = static_cast<AliEmcalJet*>(jets2->At(j)); | |
470 | ||
471 | if (!jet2) { | |
472 | AliError(Form("Could not receive jet %d", j)); | |
473 | continue; | |
474 | } | |
475 | ||
ceefbfbc | 476 | if (!AcceptJet(jet2)) |
44476be7 | 477 | continue; |
ceefbfbc | 478 | |
479 | if (mc) { | |
a487deae | 480 | if (jet2->Eta() < fJetMinEta || jet2->Eta() > fJetMaxEta || jet2->Phi() < fJetMinPhi || jet2->Phi() > fJetMaxPhi) |
ceefbfbc | 481 | continue; |
482 | } | |
483 | else { | |
91bee8bc | 484 | if (jet1->Eta() < fMCminEta || jet1->Eta() > fMCmaxEta || jet1->Phi() < fMCminPhi || jet1->Phi() > fMCmaxPhi) |
ceefbfbc | 485 | continue; |
486 | } | |
44476be7 | 487 | |
488 | Double_t deta = jet2->Eta() - jet1->Eta(); | |
489 | Double_t dphi = jet2->Phi() - jet1->Phi(); | |
490 | Double_t d = TMath::Sqrt(deta * deta + dphi * dphi); | |
491 | ||
492 | if (d < jet1->ClosestJetDistance()) { | |
493 | jet1->SetSecondClosestJet(jet1->ClosestJet(), jet1->ClosestJetDistance()); | |
494 | jet1->SetClosestJet(jet2, d); | |
495 | } | |
496 | else if (d < jet1->SecondClosestJetDistance()) { | |
497 | jet1->SetSecondClosestJet(jet2, d); | |
498 | } | |
499 | } | |
500 | } | |
1ee1b5b8 | 501 | } |
502 | ||
1ee1b5b8 | 503 | //________________________________________________________________________ |
504 | Bool_t AliJetResponseMaker::FillHistograms() | |
505 | { | |
506 | // Fill histograms. | |
507 | ||
4643d2e8 | 508 | fHistEvents->SetBinContent(fPtHardBin + 1, fHistEvents->GetBinContent(fPtHardBin + 1) + 1); |
509 | fHistNTrials->SetBinContent(fPtHardBin + 1, fHistNTrials->GetBinContent(fPtHardBin + 1) + fNTrials); | |
510 | if (fEventWeightHist) | |
511 | fHistEventWeight[fPtHardBin]->Fill(fPythiaHeader->EventWeight()); | |
4643d2e8 | 512 | |
2bddb6ae | 513 | const Int_t nMCJets = fMCJets->GetEntriesFast(); |
2949a2ec | 514 | |
2bddb6ae | 515 | for (Int_t i = 0; i < nMCJets; i++) { |
2949a2ec | 516 | |
e44e8726 | 517 | AliEmcalJet* jet = static_cast<AliEmcalJet*>(fMCJets->At(i)); |
2949a2ec | 518 | |
519 | if (!jet) { | |
1b76c28f | 520 | AliError(Form("Could not receive jet %d", i)); |
2949a2ec | 521 | continue; |
522 | } | |
523 | ||
ceefbfbc | 524 | if (!AcceptJet(jet)) |
525 | continue; | |
526 | ||
91bee8bc | 527 | if (jet->Eta() < fMCminEta || jet->Eta() > fMCmaxEta || jet->Phi() < fMCminPhi || jet->Phi() > fMCmaxPhi) |
2bddb6ae | 528 | continue; |
529 | ||
530 | if (jet->Pt() > fMaxBinPt) | |
2949a2ec | 531 | continue; |
532 | ||
aa4d701c | 533 | if (jet->MatchedJet()) { |
534 | ||
535 | if (!AcceptBiasJet(jet->MatchedJet()) || | |
536 | jet->MatchedJet()->MaxTrackPt() > fMaxTrackPt || jet->MatchedJet()->MaxClusterPt() > fMaxClusterPt || | |
537 | jet->MatchedJet()->Pt() > fMaxBinPt) { | |
b16bb001 | 538 | fHistMissedMCJetsPtArea->Fill(jet->Area(), jet->Pt(), fEventWeight); |
2bddb6ae | 539 | } |
540 | else { | |
b16bb001 | 541 | fHistMatchingLevelMCPt->Fill(jet->ClosestJetDistance(), jet->Pt(), fEventWeight); |
1ee1b5b8 | 542 | |
2bddb6ae | 543 | Double_t deta = jet->MatchedJet()->Eta() - jet->Eta(); |
2bddb6ae | 544 | Double_t dphi = jet->MatchedJet()->Phi() - jet->Phi(); |
b16bb001 | 545 | fHistClosestDeltaEtaPhiMCPt->Fill(deta, dphi, jet->Pt(), fEventWeight); |
1ee1b5b8 | 546 | |
2bddb6ae | 547 | Double_t dpt = jet->MatchedJet()->Pt() - jet->Pt(); |
b16bb001 | 548 | fHistClosestDeltaPtMCPt->Fill(jet->Pt(), dpt, fEventWeight); |
549 | fHistClosestDeltaCorrPtMCPt->Fill(jet->Pt(), dpt - fRhoVal * jet->MatchedJet()->Area(), fEventWeight); | |
1ee1b5b8 | 550 | |
551 | fHistPartvsDetecPt->Fill(jet->MatchedJet()->Pt(), jet->Pt(), fEventWeight); | |
b16bb001 | 552 | fHistPartvsDetecCorrPt->Fill(jet->MatchedJet()->Pt() - fRhoVal * jet->MatchedJet()->Area(), jet->Pt(), fEventWeight); |
2bddb6ae | 553 | } |
2949a2ec | 554 | } |
99c67c1b | 555 | else { |
b16bb001 | 556 | fHistNonMatchedMCJetsPtArea->Fill(jet->Area(), jet->Pt(), fEventWeight); |
557 | fHistMissedMCJetsPtArea->Fill(jet->Area(), jet->Pt(), fEventWeight); | |
99c67c1b | 558 | } |
2949a2ec | 559 | |
b16bb001 | 560 | fHistMCJetsPtArea->Fill(jet->Area(), jet->Pt(), fEventWeight); |
561 | fHistMCJetsPhiEta->Fill(jet->Eta(), jet->Phi(), fEventWeight); | |
2949a2ec | 562 | |
cd588263 | 563 | fHistMCJetsNEFvsPt->Fill(jet->NEF(), jet->Pt(), fEventWeight); |
564 | ||
2949a2ec | 565 | for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) { |
2bddb6ae | 566 | AliVParticle *track = jet->TrackAt(it, fMCTracks); |
2949a2ec | 567 | if (track) |
1ee1b5b8 | 568 | fHistMCJetsZvsPt->Fill(track->Pt() / jet->Pt(), jet->Pt(), fEventWeight); |
1b76c28f | 569 | } |
ceefbfbc | 570 | |
571 | if (!AcceptBiasJet(jet)) | |
572 | continue; | |
a487deae | 573 | if (jet->Eta() < fJetMinEta || jet->Eta() > fJetMaxEta || jet->Phi() < fJetMinPhi || jet->Phi() > fJetMaxPhi) |
ceefbfbc | 574 | continue; |
575 | ||
b16bb001 | 576 | fHistMCJetsPtAreaFiducial->Fill(jet->Area(), jet->Pt(), fEventWeight); |
577 | fHistMCJetsPhiEtaFiducial->Fill(jet->Eta(), jet->Phi(), fEventWeight); | |
1b76c28f | 578 | } |
579 | ||
2bddb6ae | 580 | const Int_t nJets = fJets->GetEntriesFast(); |
1b76c28f | 581 | |
2bddb6ae | 582 | for (Int_t i = 0; i < nJets; i++) { |
1b76c28f | 583 | |
e44e8726 | 584 | AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJets->At(i)); |
1b76c28f | 585 | |
586 | if (!jet) { | |
587 | AliError(Form("Could not receive mc jet %d", i)); | |
2949a2ec | 588 | continue; |
1b76c28f | 589 | } |
99c67c1b | 590 | |
2bddb6ae | 591 | if (!AcceptJet(jet)) |
1b76c28f | 592 | continue; |
91bee8bc | 593 | if (!AcceptBiasJet(jet)) |
594 | continue; | |
595 | if (jet->MaxTrackPt() > fMaxTrackPt || jet->MaxClusterPt() > fMaxClusterPt) | |
596 | continue; | |
a487deae | 597 | if (jet->Eta() < fJetMinEta || jet->Eta() > fJetMaxEta || jet->Phi() < fJetMinPhi || jet->Phi() > fJetMaxPhi) |
91bee8bc | 598 | continue; |
2949a2ec | 599 | |
99c67c1b | 600 | if (!jet->MatchedJet()) { |
b16bb001 | 601 | fHistNonMatchedJetsPtArea->Fill(jet->Area(), jet->Pt(), fEventWeight); |
602 | fHistNonMatchedJetsCorrPtArea->Fill(jet->Area(), jet->Pt() - fRhoVal * jet->Area(), fEventWeight); | |
99c67c1b | 603 | } |
1b76c28f | 604 | |
b16bb001 | 605 | fHistJetsPtArea->Fill(jet->Area(), jet->Pt(), fEventWeight); |
606 | fHistJetsCorrPtArea->Fill(jet->Area(), jet->Pt() - fRhoVal * jet->Area(), fEventWeight); | |
1b76c28f | 607 | |
b16bb001 | 608 | fHistJetsPhiEta->Fill(jet->Eta(), jet->Phi(), fEventWeight); |
1b76c28f | 609 | |
cd588263 | 610 | fHistJetsNEFvsPt->Fill(jet->NEF(), jet->Pt(), fEventWeight); |
1b76c28f | 611 | |
612 | for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) { | |
2bddb6ae | 613 | AliVParticle *track = jet->TrackAt(it, fTracks); |
1b76c28f | 614 | if (track) |
1ee1b5b8 | 615 | fHistJetsZvsPt->Fill(track->Pt() / jet->Pt(), jet->Pt(), fEventWeight); |
2bddb6ae | 616 | } |
617 | ||
618 | for (Int_t ic = 0; ic < jet->GetNumberOfClusters(); ic++) { | |
619 | AliVCluster *cluster = jet->ClusterAt(ic, fCaloClusters); | |
620 | if (cluster) { | |
621 | TLorentzVector nP; | |
622 | cluster->GetMomentum(nP, fVertex); | |
1ee1b5b8 | 623 | fHistJetsZvsPt->Fill(nP.Pt() / jet->Pt(), jet->Pt(), fEventWeight); |
2bddb6ae | 624 | } |
1b76c28f | 625 | } |
626 | } | |
6fd5039f | 627 | |
628 | return kTRUE; | |
1b76c28f | 629 | } |