]>
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" |
2949a2ec | 19 | #include "AliMCEvent.h" |
787a3c4f | 20 | #include "AliLog.h" |
cd6431de | 21 | #include "AliRhoParameter.h" |
2949a2ec | 22 | |
23 | ClassImp(AliJetResponseMaker) | |
24 | ||
25 | //________________________________________________________________________ | |
26 | AliJetResponseMaker::AliJetResponseMaker() : | |
e44e8726 | 27 | AliAnalysisTaskEmcalJet("AliJetResponseMaker", kTRUE), |
cd6431de | 28 | fTracks2Name(""), |
29 | fCalo2Name(""), | |
30 | fJets2Name(""), | |
31 | fRho2Name(""), | |
32 | fPtBiasJet2Track(0), | |
33 | fPtBiasJet2Clus(0), | |
34 | fAreCollections1MC(kFALSE), | |
35 | fAreCollections2MC(kTRUE), | |
36 | fMatching(kNoMatching), | |
7f76e479 | 37 | fMatchingPar1(0), |
38 | fMatchingPar2(0), | |
cd6431de | 39 | fJet2MinEta(-999), |
40 | fJet2MaxEta(-999), | |
41 | fJet2MinPhi(-999), | |
42 | fJet2MaxPhi(-999), | |
4643d2e8 | 43 | fSelectPtHardBin(-999), |
1ee1b5b8 | 44 | fPythiaHeader(0), |
1ee1b5b8 | 45 | fPtHardBin(0), |
46 | fNTrials(0), | |
cd6431de | 47 | fTracks2(0), |
48 | fCaloClusters2(0), | |
49 | fJets2(0), | |
50 | fRho2(0), | |
51 | fRho2Val(0), | |
cfc2ac24 | 52 | fTracks2Map(0), |
1ee1b5b8 | 53 | fHistNTrials(0), |
1ee1b5b8 | 54 | fHistEvents(0), |
cd6431de | 55 | fHistJets1PhiEta(0), |
56 | fHistJets1PtArea(0), | |
57 | fHistJets1CorrPtArea(0), | |
58 | fHistJets2PhiEta(0), | |
59 | fHistJets2PtArea(0), | |
60 | fHistJets2CorrPtArea(0), | |
cfc2ac24 | 61 | fHistJets2PhiEtaAcceptance(0), |
62 | fHistJets2PtAreaAcceptance(0), | |
63 | fHistJets2CorrPtAreaAcceptance(0), | |
cd6431de | 64 | fHistMatchingLevelvsJet2Pt(0), |
cfc2ac24 | 65 | fHistDistancevsCommonEnergy(0), |
66 | fHistDeltaEtaPhivsJet2Pt(0), | |
67 | fHistDeltaPtvsJet2Pt(0), | |
68 | fHistDeltaPtvsMatchingLevel(0), | |
69 | fHistDeltaCorrPtvsJet2Pt(0), | |
70 | fHistDeltaCorrPtvsMatchingLevel(0), | |
cd6431de | 71 | fHistNonMatchedJets1PtArea(0), |
72 | fHistNonMatchedJets2PtArea(0), | |
73 | fHistNonMatchedJets1CorrPtArea(0), | |
74 | fHistNonMatchedJets2CorrPtArea(0), | |
75 | fHistJet1PtvsJet2Pt(0), | |
76 | fHistJet1CorrPtvsJet2CorrPt(0), | |
77 | fHistMissedJets2PtArea(0) | |
2949a2ec | 78 | { |
79 | // Default constructor. | |
4643d2e8 | 80 | |
a487deae | 81 | SetMakeGeneralHistograms(kTRUE); |
2949a2ec | 82 | } |
83 | ||
84 | //________________________________________________________________________ | |
85 | AliJetResponseMaker::AliJetResponseMaker(const char *name) : | |
e44e8726 | 86 | AliAnalysisTaskEmcalJet(name, kTRUE), |
cd6431de | 87 | fTracks2Name("MCParticles"), |
88 | fCalo2Name(""), | |
89 | fJets2Name("MCJets"), | |
90 | fRho2Name(""), | |
91 | fPtBiasJet2Track(0), | |
92 | fPtBiasJet2Clus(0), | |
93 | fAreCollections1MC(kFALSE), | |
94 | fAreCollections2MC(kTRUE), | |
95 | fMatching(kNoMatching), | |
7f76e479 | 96 | fMatchingPar1(0), |
97 | fMatchingPar2(0), | |
cd6431de | 98 | fJet2MinEta(-999), |
99 | fJet2MaxEta(-999), | |
100 | fJet2MinPhi(-999), | |
101 | fJet2MaxPhi(-999), | |
4643d2e8 | 102 | fSelectPtHardBin(-999), |
1ee1b5b8 | 103 | fPythiaHeader(0), |
1ee1b5b8 | 104 | fPtHardBin(0), |
105 | fNTrials(0), | |
cd6431de | 106 | fTracks2(0), |
107 | fCaloClusters2(0), | |
108 | fJets2(0), | |
109 | fRho2(0), | |
110 | fRho2Val(0), | |
cfc2ac24 | 111 | fTracks2Map(0), |
1ee1b5b8 | 112 | fHistNTrials(0), |
1ee1b5b8 | 113 | fHistEvents(0), |
cd6431de | 114 | fHistJets1PhiEta(0), |
115 | fHistJets1PtArea(0), | |
116 | fHistJets1CorrPtArea(0), | |
117 | fHistJets2PhiEta(0), | |
118 | fHistJets2PtArea(0), | |
119 | fHistJets2CorrPtArea(0), | |
cfc2ac24 | 120 | fHistJets2PhiEtaAcceptance(0), |
121 | fHistJets2PtAreaAcceptance(0), | |
122 | fHistJets2CorrPtAreaAcceptance(0), | |
cd6431de | 123 | fHistMatchingLevelvsJet2Pt(0), |
cfc2ac24 | 124 | fHistDistancevsCommonEnergy(0), |
125 | fHistDeltaEtaPhivsJet2Pt(0), | |
126 | fHistDeltaPtvsJet2Pt(0), | |
127 | fHistDeltaPtvsMatchingLevel(0), | |
128 | fHistDeltaCorrPtvsJet2Pt(0), | |
129 | fHistDeltaCorrPtvsMatchingLevel(0), | |
cd6431de | 130 | fHistNonMatchedJets1PtArea(0), |
131 | fHistNonMatchedJets2PtArea(0), | |
132 | fHistNonMatchedJets1CorrPtArea(0), | |
133 | fHistNonMatchedJets2CorrPtArea(0), | |
134 | fHistJet1PtvsJet2Pt(0), | |
135 | fHistJet1CorrPtvsJet2CorrPt(0), | |
136 | fHistMissedJets2PtArea(0) | |
2949a2ec | 137 | { |
138 | // Standard constructor. | |
4643d2e8 | 139 | |
a487deae | 140 | SetMakeGeneralHistograms(kTRUE); |
2949a2ec | 141 | } |
142 | ||
143 | //________________________________________________________________________ | |
144 | AliJetResponseMaker::~AliJetResponseMaker() | |
145 | { | |
146 | // Destructor | |
147 | } | |
148 | ||
149 | //________________________________________________________________________ | |
150 | void AliJetResponseMaker::UserCreateOutputObjects() | |
151 | { | |
152 | // Create user objects. | |
153 | ||
a487deae | 154 | AliAnalysisTaskEmcalJet::UserCreateOutputObjects(); |
2949a2ec | 155 | |
1ee1b5b8 | 156 | const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234}; |
157 | const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000}; | |
158 | ||
159 | fHistNTrials = new TH1F("fHistNTrials", "fHistNTrials", 11, 0, 11); | |
160 | fHistNTrials->GetXaxis()->SetTitle("p_{T} hard bin"); | |
161 | fHistNTrials->GetYaxis()->SetTitle("trials"); | |
162 | fOutput->Add(fHistNTrials); | |
163 | ||
1ee1b5b8 | 164 | fHistEvents = new TH1F("fHistEvents", "fHistEvents", 11, 0, 11); |
165 | fHistEvents->GetXaxis()->SetTitle("p_{T} hard bin"); | |
166 | fHistEvents->GetYaxis()->SetTitle("total events"); | |
167 | fOutput->Add(fHistEvents); | |
168 | ||
169 | for (Int_t i = 1; i < 12; i++) { | |
170 | fHistNTrials->GetXaxis()->SetBinLabel(i, Form("%d-%d",ptHardLo[i-1],ptHardHi[i-1])); | |
1ee1b5b8 | 171 | fHistEvents->GetXaxis()->SetBinLabel(i, Form("%d-%d",ptHardLo[i-1],ptHardHi[i-1])); |
172 | } | |
173 | ||
cfc2ac24 | 174 | fHistJets1PhiEta = new TH2F("fHistJets1PhiEta", "fHistJets1PhiEta", 40, -1, 1, 40, 0, TMath::Pi()*2); |
cd6431de | 175 | fHistJets1PhiEta->GetXaxis()->SetTitle("#eta"); |
176 | fHistJets1PhiEta->GetYaxis()->SetTitle("#phi"); | |
177 | fOutput->Add(fHistJets1PhiEta); | |
2949a2ec | 178 | |
cd6431de | 179 | fHistJets1PtArea = new TH2F("fHistJets1PtArea", "fHistJets1PtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); |
180 | fHistJets1PtArea->GetXaxis()->SetTitle("area"); | |
181 | fHistJets1PtArea->GetYaxis()->SetTitle("p_{T,1} (GeV/c)"); | |
182 | fHistJets1PtArea->GetZaxis()->SetTitle("counts"); | |
183 | fOutput->Add(fHistJets1PtArea); | |
184 | ||
185 | if (!fRhoName.IsNull()) { | |
186 | fHistJets1CorrPtArea = new TH2F("fHistJets1CorrPtArea", "fHistJets1CorrPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
187 | fHistJets1CorrPtArea->GetXaxis()->SetTitle("area"); | |
188 | fHistJets1CorrPtArea->GetYaxis()->SetTitle("p_{T,1}^{corr} (GeV/c)"); | |
189 | fHistJets1CorrPtArea->GetZaxis()->SetTitle("counts"); | |
190 | fOutput->Add(fHistJets1CorrPtArea); | |
191 | } | |
192 | ||
cfc2ac24 | 193 | fHistJets2PhiEta = new TH2F("fHistJets2PhiEta", "fHistJets2PhiEta", 40, -1, 1, 40, 0, TMath::Pi()*2); |
cd6431de | 194 | fHistJets2PhiEta->GetXaxis()->SetTitle("#eta"); |
195 | fHistJets2PhiEta->GetYaxis()->SetTitle("#phi"); | |
196 | fOutput->Add(fHistJets2PhiEta); | |
cfc2ac24 | 197 | |
198 | fHistJets2PhiEtaAcceptance = new TH2F("fHistJets2PhiEtaAcceptance", "fHistJets2PhiEtaAcceptance", 40, -1, 1, 40, 0, TMath::Pi()*2); | |
199 | fHistJets2PhiEtaAcceptance->GetXaxis()->SetTitle("#eta"); | |
200 | fHistJets2PhiEtaAcceptance->GetYaxis()->SetTitle("#phi"); | |
201 | fOutput->Add(fHistJets2PhiEtaAcceptance); | |
7549c451 | 202 | |
cd6431de | 203 | fHistJets2PtArea = new TH2F("fHistJets2PtArea", "fHistJets2PtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); |
204 | fHistJets2PtArea->GetXaxis()->SetTitle("area"); | |
205 | fHistJets2PtArea->GetYaxis()->SetTitle("p_{T,2} (GeV/c)"); | |
206 | fHistJets2PtArea->GetZaxis()->SetTitle("counts"); | |
207 | fOutput->Add(fHistJets2PtArea); | |
208 | ||
cfc2ac24 | 209 | fHistJets2PtAreaAcceptance = new TH2F("fHistJets2PtAreaAcceptance", "fHistJets2PtAreaAcceptance", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); |
210 | fHistJets2PtAreaAcceptance->GetXaxis()->SetTitle("area"); | |
211 | fHistJets2PtAreaAcceptance->GetYaxis()->SetTitle("p_{T,2} (GeV/c)"); | |
212 | fHistJets2PtAreaAcceptance->GetZaxis()->SetTitle("counts"); | |
213 | fOutput->Add(fHistJets2PtAreaAcceptance); | |
214 | ||
cd6431de | 215 | if (!fRho2Name.IsNull()) { |
216 | fHistJets2CorrPtArea = new TH2F("fHistJets2CorrPtArea", "fHistJets2CorrPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
217 | fHistJets2CorrPtArea->GetXaxis()->SetTitle("area"); | |
218 | fHistJets2CorrPtArea->GetYaxis()->SetTitle("p_{T,2}^{corr} (GeV/c)"); | |
219 | fHistJets2CorrPtArea->GetZaxis()->SetTitle("counts"); | |
220 | fOutput->Add(fHistJets2CorrPtArea); | |
cfc2ac24 | 221 | |
222 | fHistJets2CorrPtAreaAcceptance = new TH2F("fHistJets2CorrPtAreaAcceptance", "fHistJets2CorrPtAreaAcceptance", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
223 | fHistJets2CorrPtAreaAcceptance->GetXaxis()->SetTitle("area"); | |
224 | fHistJets2CorrPtAreaAcceptance->GetYaxis()->SetTitle("p_{T,2}^{corr} (GeV/c)"); | |
225 | fHistJets2CorrPtAreaAcceptance->GetZaxis()->SetTitle("counts"); | |
226 | fOutput->Add(fHistJets2CorrPtAreaAcceptance); | |
cd6431de | 227 | } |
228 | ||
229 | fHistMatchingLevelvsJet2Pt = new TH2F("fHistMatchingLevelvsJet2Pt", "fHistMatchingLevelvsJet2Pt", fNbins/2, 0, 1.2, fNbins/2, fMinBinPt, fMaxBinPt); | |
230 | fHistMatchingLevelvsJet2Pt->GetXaxis()->SetTitle("Matching level"); | |
231 | fHistMatchingLevelvsJet2Pt->GetYaxis()->SetTitle("p_{T,2}"); | |
232 | fHistMatchingLevelvsJet2Pt->GetZaxis()->SetTitle("counts"); | |
233 | fOutput->Add(fHistMatchingLevelvsJet2Pt); | |
234 | ||
cfc2ac24 | 235 | fHistDistancevsCommonEnergy = new TH2F("fHistDistancevsCommonEnergy", "fHistDistancevsCommonEnergy", fNbins/2, 0, 1.2, fNbins/2, 0, 1.2); |
236 | fHistDistancevsCommonEnergy->GetXaxis()->SetTitle("Distance"); | |
237 | fHistDistancevsCommonEnergy->GetYaxis()->SetTitle("Common energy (%)"); | |
238 | fHistDistancevsCommonEnergy->GetZaxis()->SetTitle("counts"); | |
239 | fOutput->Add(fHistDistancevsCommonEnergy); | |
240 | ||
241 | fHistDeltaEtaPhivsJet2Pt = new TH3F("fHistDeltaEtaPhivsJet2Pt", "fHistDeltaEtaPhivsJet2Pt", 40, -1, 1, 128, -1.6, 4.8, fNbins/2, fMinBinPt, fMaxBinPt); | |
242 | fHistDeltaEtaPhivsJet2Pt->GetXaxis()->SetTitle("#Delta#eta"); | |
243 | fHistDeltaEtaPhivsJet2Pt->GetYaxis()->SetTitle("#Delta#phi"); | |
244 | fHistDeltaEtaPhivsJet2Pt->GetZaxis()->SetTitle("p_{T,2}"); | |
245 | fOutput->Add(fHistDeltaEtaPhivsJet2Pt); | |
246 | ||
247 | fHistDeltaPtvsJet2Pt = new TH2F("fHistDeltaPtvsJet2Pt", "fHistDeltaPtvsJet2Pt", fNbins/2, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
248 | fHistDeltaPtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}"); | |
249 | fHistDeltaPtvsJet2Pt->GetYaxis()->SetTitle("#deltap_{T} (GeV/c)"); | |
250 | fHistDeltaPtvsJet2Pt->GetZaxis()->SetTitle("counts"); | |
251 | fOutput->Add(fHistDeltaPtvsJet2Pt); | |
252 | ||
253 | fHistDeltaPtvsMatchingLevel = new TH2F("fHistDeltaPtvsMatchingLevel", "fHistDeltaPtvsMatchingLevel", fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
254 | fHistDeltaPtvsMatchingLevel->GetXaxis()->SetTitle("Matching level"); | |
255 | fHistDeltaPtvsMatchingLevel->GetYaxis()->SetTitle("#Deltap_{T} (GeV/c)"); | |
256 | fHistDeltaPtvsMatchingLevel->GetZaxis()->SetTitle("counts"); | |
257 | fOutput->Add(fHistDeltaPtvsMatchingLevel); | |
cd6431de | 258 | |
259 | if (!fRhoName.IsNull() || !fRho2Name.IsNull()) { | |
cfc2ac24 | 260 | fHistDeltaCorrPtvsJet2Pt = new TH2F("fHistDeltaCorrPtvsJet2Pt", "fHistDeltaCorrPtvsJet2Pt", fNbins/2, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt); |
261 | fHistDeltaCorrPtvsJet2Pt->GetXaxis()->SetTitle("p_{T,2}"); | |
262 | fHistDeltaCorrPtvsJet2Pt->GetYaxis()->SetTitle("#Deltap_{T}^{corr} (GeV/c)"); | |
263 | fHistDeltaCorrPtvsJet2Pt->GetZaxis()->SetTitle("counts"); | |
264 | fOutput->Add(fHistDeltaCorrPtvsJet2Pt); | |
265 | ||
266 | fHistDeltaCorrPtvsMatchingLevel = new TH2F("fHistDeltaCorrPtvsMatchingLevel", "fHistDeltaCorrPtvsMatchingLevel", fNbins/2, 0, 1.2, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
267 | fHistDeltaCorrPtvsMatchingLevel->GetXaxis()->SetTitle("Matching level"); | |
268 | fHistDeltaCorrPtvsMatchingLevel->GetYaxis()->SetTitle("#Deltap_{T}^{corr} (GeV/c)"); | |
269 | fHistDeltaCorrPtvsMatchingLevel->GetZaxis()->SetTitle("counts"); | |
787a3c4f | 270 | fOutput->Add(fHistDeltaCorrPtvsMatchingLevel); |
cd6431de | 271 | } |
272 | ||
273 | fHistNonMatchedJets1PtArea = new TH2F("fHistNonMatchedJets1PtArea", "fHistNonMatchedJets1PtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); | |
274 | fHistNonMatchedJets1PtArea->GetXaxis()->SetTitle("area"); | |
275 | fHistNonMatchedJets1PtArea->GetYaxis()->SetTitle("p_{T,1} (GeV/c)"); | |
276 | fHistNonMatchedJets1PtArea->GetZaxis()->SetTitle("counts"); | |
277 | fOutput->Add(fHistNonMatchedJets1PtArea); | |
278 | ||
279 | fHistNonMatchedJets2PtArea = new TH2F("fHistNonMatchedJets2PtArea", "fHistNonMatchedJets2PtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); | |
280 | fHistNonMatchedJets2PtArea->GetXaxis()->SetTitle("area"); | |
281 | fHistNonMatchedJets2PtArea->GetYaxis()->SetTitle("p_{T,2} (GeV/c)"); | |
282 | fHistNonMatchedJets2PtArea->GetZaxis()->SetTitle("counts"); | |
283 | fOutput->Add(fHistNonMatchedJets2PtArea); | |
284 | ||
285 | if (!fRhoName.IsNull()) { | |
286 | fHistNonMatchedJets1CorrPtArea = new TH2F("fHistNonMatchedJets1CorrPtArea", "fHistNonMatchedJets1CorrPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
287 | fHistNonMatchedJets1CorrPtArea->GetXaxis()->SetTitle("area"); | |
288 | fHistNonMatchedJets1CorrPtArea->GetYaxis()->SetTitle("p_{T,1} (GeV/c)"); | |
289 | fHistNonMatchedJets1CorrPtArea->GetZaxis()->SetTitle("counts"); | |
290 | fOutput->Add(fHistNonMatchedJets1CorrPtArea); | |
291 | } | |
292 | ||
293 | if (!fRho2Name.IsNull()) { | |
294 | fHistNonMatchedJets2CorrPtArea = new TH2F("fHistNonMatchedJets2CorrPtArea", "fHistNonMatchedJets2CorrPtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
295 | fHistNonMatchedJets2CorrPtArea->GetXaxis()->SetTitle("area"); | |
296 | fHistNonMatchedJets2CorrPtArea->GetYaxis()->SetTitle("p_{T,2} (GeV/c)"); | |
297 | fHistNonMatchedJets2CorrPtArea->GetZaxis()->SetTitle("counts"); | |
298 | fOutput->Add(fHistNonMatchedJets2CorrPtArea); | |
299 | } | |
300 | ||
301 | fHistJet1PtvsJet2Pt = new TH2F("fHistJet1PtvsJet2Pt", "fHistJet1PtvsJet2Pt", fNbins, fMinBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt); | |
302 | fHistJet1PtvsJet2Pt->GetXaxis()->SetTitle("p_{T,1}"); | |
303 | fHistJet1PtvsJet2Pt->GetYaxis()->SetTitle("p_{T,2}"); | |
304 | fHistJet1PtvsJet2Pt->GetZaxis()->SetTitle("counts"); | |
305 | fOutput->Add(fHistJet1PtvsJet2Pt); | |
306 | ||
307 | if (!fRhoName.IsNull() || !fRho2Name.IsNull()) { | |
308 | if (fRhoName.IsNull()) | |
309 | fHistJet1CorrPtvsJet2CorrPt = new TH2F("fHistJet1CorrPtvsJet2CorrPt", "fHistJet1CorrPtvsJet2CorrPt", fNbins, fMinBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
310 | else if (fRho2Name.IsNull()) | |
311 | fHistJet1CorrPtvsJet2CorrPt = new TH2F("fHistJet1CorrPtvsJet2CorrPt", "fHistJet1CorrPtvsJet2CorrPt", 2*fNbins, -fMaxBinPt, fMaxBinPt, fNbins, fMinBinPt, fMaxBinPt); | |
312 | else | |
313 | fHistJet1CorrPtvsJet2CorrPt = new TH2F("fHistJet1CorrPtvsJet2CorrPt", "fHistJet1CorrPtvsJet2CorrPt", 2*fNbins, -fMaxBinPt, fMaxBinPt, 2*fNbins, -fMaxBinPt, fMaxBinPt); | |
314 | fHistJet1CorrPtvsJet2CorrPt->GetXaxis()->SetTitle("p_{T,1}^{corr}"); | |
315 | fHistJet1CorrPtvsJet2CorrPt->GetYaxis()->SetTitle("p_{T,2}^{corr}"); | |
316 | fHistJet1CorrPtvsJet2CorrPt->GetZaxis()->SetTitle("counts"); | |
317 | fOutput->Add(fHistJet1CorrPtvsJet2CorrPt); | |
318 | } | |
319 | ||
320 | fHistMissedJets2PtArea = new TH2F("fHistMissedJets2PtArea", "fHistMissedJets2PtArea", 40, 0, fJetRadius * fJetRadius * TMath::Pi() * 3, fNbins, fMinBinPt, fMaxBinPt); | |
321 | fHistMissedJets2PtArea->GetXaxis()->SetTitle("area"); | |
322 | fHistMissedJets2PtArea->GetYaxis()->SetTitle("p_{T,2} (GeV/c)"); | |
323 | fHistMissedJets2PtArea->GetZaxis()->SetTitle("counts"); | |
324 | fOutput->Add(fHistMissedJets2PtArea); | |
2bddb6ae | 325 | |
99c67c1b | 326 | PostData(1, fOutput); // Post data for ALL output slots > 0 here, to get at least an empty histogram |
2949a2ec | 327 | } |
328 | ||
ceefbfbc | 329 | //________________________________________________________________________ |
a487deae | 330 | Bool_t AliJetResponseMaker::AcceptJet(AliEmcalJet *jet) const |
ceefbfbc | 331 | { |
332 | // Return true if jet is accepted. | |
333 | ||
334 | if (jet->Pt() <= fJetPtCut) | |
335 | return kFALSE; | |
336 | if (jet->Area() <= fJetAreaCut) | |
337 | return kFALSE; | |
65bb5510 | 338 | |
339 | return kTRUE; | |
ceefbfbc | 340 | } |
341 | ||
cd6431de | 342 | //________________________________________________________________________ |
343 | Bool_t AliJetResponseMaker::AcceptBiasJet2(AliEmcalJet *jet) const | |
344 | { | |
345 | // Accept jet with a bias. | |
346 | ||
347 | if (fLeadingHadronType == 0) { | |
348 | if (jet->MaxTrackPt() < fPtBiasJet2Track) return kFALSE; | |
349 | } | |
350 | else if (fLeadingHadronType == 1) { | |
351 | if (jet->MaxClusterPt() < fPtBiasJet2Clus) return kFALSE; | |
352 | } | |
353 | else { | |
354 | if (jet->MaxTrackPt() < fPtBiasJet2Track && jet->MaxClusterPt() < fPtBiasJet2Clus) return kFALSE; | |
355 | } | |
356 | ||
357 | return kTRUE; | |
358 | } | |
359 | ||
b3ccdfe2 | 360 | //________________________________________________________________________ |
361 | void AliJetResponseMaker::ExecOnce() | |
362 | { | |
363 | // Execute once. | |
364 | ||
cd6431de | 365 | if (!fJets2Name.IsNull() && !fJets2) { |
366 | fJets2 = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fJets2Name)); | |
367 | if (!fJets2) { | |
368 | AliError(Form("%s: Could not retrieve jets2 %s!", GetName(), fJets2Name.Data())); | |
b3ccdfe2 | 369 | return; |
370 | } | |
cd6431de | 371 | else if (!fJets2->GetClass()->GetBaseClass("AliEmcalJet")) { |
372 | AliError(Form("%s: Collection %s does not contain AliEmcalJet objects!", GetName(), fJets2Name.Data())); | |
373 | fJets2 = 0; | |
b3ccdfe2 | 374 | return; |
375 | } | |
376 | } | |
377 | ||
cd6431de | 378 | if (!fTracks2Name.IsNull() && !fTracks2) { |
379 | fTracks2 = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fTracks2Name)); | |
380 | if (!fTracks2) { | |
381 | AliError(Form("%s: Could not retrieve tracks2 %s!", GetName(), fTracks2Name.Data())); | |
b3ccdfe2 | 382 | return; |
383 | } | |
384 | else { | |
cd6431de | 385 | TClass *cl = fTracks2->GetClass(); |
b3ccdfe2 | 386 | if (!cl->GetBaseClass("AliVParticle") && !cl->GetBaseClass("AliEmcalParticle")) { |
cd6431de | 387 | AliError(Form("%s: Collection %s does not contain AliVParticle nor AliEmcalParticle objects!", GetName(), fTracks2Name.Data())); |
388 | fTracks2 = 0; | |
b3ccdfe2 | 389 | return; |
390 | } | |
391 | } | |
cfc2ac24 | 392 | |
393 | if (fAreCollections2MC) { | |
394 | fTracks2Map = dynamic_cast<TH1*>(InputEvent()->FindListObject(fTracks2Name + "_Map")); | |
7f76e479 | 395 | // this is needed to map the MC labels with the indexes of the MC particle collection |
396 | // if teh map is not given, the MC labels are assumed to be consistent with the indexes (which is not the case if AliEmcalMCTrackSelector is used) | |
cfc2ac24 | 397 | if (!fTracks2Map) { |
7f76e479 | 398 | AliWarning(Form("%s: Could not retrieve map for tracks2 %s! Will assume MC labels consistent with indexes...", GetName(), fTracks2Name.Data())); |
399 | fTracks2Map = new TH1I("tracksMap","tracksMap",9999,0,1); | |
400 | for (Int_t i = 0; i < 9999; i++) { | |
401 | fTracks2Map->SetBinContent(i,i); | |
402 | } | |
cfc2ac24 | 403 | } |
404 | } | |
b3ccdfe2 | 405 | } |
406 | ||
cd6431de | 407 | if (!fCalo2Name.IsNull() && !fCaloClusters2) { |
408 | fCaloClusters2 = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fCalo2Name)); | |
409 | if (!fCaloClusters2) { | |
410 | AliError(Form("%s: Could not retrieve clusters %s!", GetName(), fCalo2Name.Data())); | |
411 | return; | |
412 | } else { | |
413 | TClass *cl = fCaloClusters2->GetClass(); | |
414 | if (!cl->GetBaseClass("AliVCluster") && !cl->GetBaseClass("AliEmcalParticle")) { | |
415 | AliError(Form("%s: Collection %s does not contain AliVCluster nor AliEmcalParticle objects!", GetName(), fCalo2Name.Data())); | |
416 | fCaloClusters2 = 0; | |
417 | return; | |
418 | } | |
419 | } | |
91bee8bc | 420 | } |
cd6431de | 421 | |
422 | if (!fRho2Name.IsNull() && !fRho2) { | |
423 | fRho2 = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fRho2Name)); | |
424 | if (!fRho2) { | |
425 | AliError(Form("%s: Could not retrieve rho %s!", GetName(), fRho2Name.Data())); | |
426 | fInitialized = kFALSE; | |
427 | return; | |
428 | } | |
91bee8bc | 429 | } |
cd6431de | 430 | |
431 | if (fJet2MinEta == -999) | |
432 | fJet2MinEta = fJetMinEta - fJetRadius; | |
433 | if (fJet2MaxEta == -999) | |
434 | fJet2MaxEta = fJetMaxEta + fJetRadius; | |
435 | if (fJet2MinPhi == -999) | |
436 | fJet2MinPhi = fJetMinPhi - fJetRadius; | |
437 | if (fJet2MaxPhi == -999) | |
438 | fJet2MaxPhi = fJetMaxPhi + fJetRadius; | |
439 | ||
440 | AliAnalysisTaskEmcalJet::ExecOnce(); | |
b3ccdfe2 | 441 | } |
442 | ||
4643d2e8 | 443 | //________________________________________________________________________ |
444 | Bool_t AliJetResponseMaker::IsEventSelected() | |
445 | { | |
446 | // Check if event is selected | |
447 | ||
448 | if (fSelectPtHardBin != -999 && fSelectPtHardBin != fPtHardBin) | |
449 | return kFALSE; | |
450 | ||
451 | return AliAnalysisTaskEmcalJet::IsEventSelected(); | |
452 | } | |
453 | ||
b3ccdfe2 | 454 | //________________________________________________________________________ |
455 | Bool_t AliJetResponseMaker::RetrieveEventObjects() | |
456 | { | |
457 | // Retrieve event objects. | |
458 | ||
459 | if (!AliAnalysisTaskEmcalJet::RetrieveEventObjects()) | |
460 | return kFALSE; | |
cd6431de | 461 | |
462 | if (fRho2) | |
463 | fRho2Val = fRho2->GetVal(); | |
b3ccdfe2 | 464 | |
b3ccdfe2 | 465 | const Int_t ptHardLo[11] = { 0, 5,11,21,36,57, 84,117,152,191,234}; |
466 | const Int_t ptHardHi[11] = { 5,11,21,36,57,84,117,152,191,234,1000000}; | |
787a3c4f | 467 | |
468 | if (MCEvent()) | |
469 | fPythiaHeader = dynamic_cast<AliGenPythiaEventHeader*>(MCEvent()->GenEventHeader()); | |
470 | ||
471 | if (fPythiaHeader) { | |
472 | Double_t pthard = fPythiaHeader->GetPtHard(); | |
473 | ||
474 | for (fPtHardBin = 0; fPtHardBin < 11; fPtHardBin++) { | |
475 | if (pthard >= ptHardLo[fPtHardBin] && pthard < ptHardHi[fPtHardBin]) | |
476 | break; | |
477 | } | |
478 | ||
479 | fNTrials = fPythiaHeader->Trials(); | |
b3ccdfe2 | 480 | } |
b3ccdfe2 | 481 | |
b3ccdfe2 | 482 | return kTRUE; |
483 | } | |
484 | ||
485 | //________________________________________________________________________ | |
486 | Bool_t AliJetResponseMaker::Run() | |
487 | { | |
488 | // Find the closest jets | |
cfc2ac24 | 489 | |
f660c2d6 | 490 | if (fMatching == kNoMatching) |
aa4d701c | 491 | return kTRUE; |
f660c2d6 | 492 | else |
493 | return DoJetMatching(); | |
cfc2ac24 | 494 | } |
aa4d701c | 495 | |
cfc2ac24 | 496 | //________________________________________________________________________ |
f660c2d6 | 497 | Bool_t AliJetResponseMaker::DoJetMatching() |
cfc2ac24 | 498 | { |
499 | DoJetLoop(kFALSE); | |
cfc2ac24 | 500 | |
f660c2d6 | 501 | const Int_t nJets = fJets->GetEntriesFast(); |
cfc2ac24 | 502 | |
f660c2d6 | 503 | for (Int_t i = 0; i < nJets; i++) { |
cfc2ac24 | 504 | |
505 | AliEmcalJet* jet1 = static_cast<AliEmcalJet*>(fJets->At(i)); | |
506 | ||
507 | if (!jet1) { | |
508 | AliError(Form("Could not receive jet %d", i)); | |
509 | continue; | |
510 | } | |
511 | ||
512 | if (!AcceptJet(jet1)) | |
513 | continue; | |
514 | ||
515 | if (jet1->Eta() < fJetMinEta || jet1->Eta() > fJetMaxEta || jet1->Phi() < fJetMinPhi || jet1->Phi() > fJetMaxPhi) | |
516 | continue; | |
517 | ||
518 | if (jet1->Pt() > fMaxBinPt) | |
519 | continue; | |
520 | ||
f660c2d6 | 521 | if (jet1->ClosestJet() && jet1->ClosestJet()->ClosestJet() == jet1 && |
7f76e479 | 522 | jet1->ClosestJetDistance() < fMatchingPar1 && jet1->ClosestJet()->ClosestJetDistance() < fMatchingPar2) { // Matched jet found |
cfc2ac24 | 523 | jet1->SetMatchedToClosest(fMatching); |
cfc2ac24 | 524 | jet1->ClosestJet()->SetMatchedToClosest(fMatching); |
aa4d701c | 525 | } |
526 | } | |
527 | ||
b3ccdfe2 | 528 | return kTRUE; |
529 | } | |
530 | ||
2949a2ec | 531 | //________________________________________________________________________ |
cfc2ac24 | 532 | void AliJetResponseMaker::DoJetLoop(Bool_t order) |
2949a2ec | 533 | { |
44476be7 | 534 | // Do the jet loop. |
1ee1b5b8 | 535 | |
cfc2ac24 | 536 | TClonesArray *jets1 = 0; |
537 | TClonesArray *jets2 = 0; | |
538 | ||
539 | if (order) { | |
540 | jets1 = fJets2; | |
541 | jets2 = fJets; | |
542 | } | |
543 | else { | |
544 | jets1 = fJets; | |
545 | jets2 = fJets2; | |
546 | } | |
547 | ||
44476be7 | 548 | Int_t nJets1 = jets1->GetEntriesFast(); |
549 | Int_t nJets2 = jets2->GetEntriesFast(); | |
1ee1b5b8 | 550 | |
44476be7 | 551 | for (Int_t i = 0; i < nJets1; i++) { |
1ee1b5b8 | 552 | |
44476be7 | 553 | AliEmcalJet* jet1 = static_cast<AliEmcalJet*>(jets1->At(i)); |
2949a2ec | 554 | |
44476be7 | 555 | if (!jet1) { |
556 | AliError(Form("Could not receive jet %d", i)); | |
557 | continue; | |
558 | } | |
559 | ||
ceefbfbc | 560 | if (!AcceptJet(jet1)) |
44476be7 | 561 | continue; |
562 | ||
cfc2ac24 | 563 | if (order) { |
cd6431de | 564 | if (jet1->Eta() < fJet2MinEta || jet1->Eta() > fJet2MaxEta || jet1->Phi() < fJet2MinPhi || jet1->Phi() > fJet2MaxPhi) |
ceefbfbc | 565 | continue; |
566 | } | |
567 | else { | |
cd6431de | 568 | if (jet1->Eta() < fJetMinEta || jet1->Eta() > fJetMaxEta || jet1->Phi() < fJetMinPhi || jet1->Phi() > fJetMaxPhi) |
ceefbfbc | 569 | continue; |
570 | } | |
571 | ||
44476be7 | 572 | for (Int_t j = 0; j < nJets2; j++) { |
573 | ||
574 | AliEmcalJet* jet2 = static_cast<AliEmcalJet*>(jets2->At(j)); | |
575 | ||
576 | if (!jet2) { | |
577 | AliError(Form("Could not receive jet %d", j)); | |
578 | continue; | |
579 | } | |
580 | ||
ceefbfbc | 581 | if (!AcceptJet(jet2)) |
44476be7 | 582 | continue; |
ceefbfbc | 583 | |
cfc2ac24 | 584 | if (order) { |
a487deae | 585 | if (jet2->Eta() < fJetMinEta || jet2->Eta() > fJetMaxEta || jet2->Phi() < fJetMinPhi || jet2->Phi() > fJetMaxPhi) |
ceefbfbc | 586 | continue; |
587 | } | |
588 | else { | |
cd6431de | 589 | if (jet1->Eta() < fJet2MinEta || jet1->Eta() > fJet2MaxEta || jet1->Phi() < fJet2MinPhi || jet1->Phi() > fJet2MaxPhi) |
ceefbfbc | 590 | continue; |
591 | } | |
cd6431de | 592 | |
7f76e479 | 593 | SetMatchingLevel(jet1, jet2, fMatching); |
44476be7 | 594 | } |
595 | } | |
1ee1b5b8 | 596 | } |
597 | ||
cd6431de | 598 | //________________________________________________________________________ |
7f76e479 | 599 | void AliJetResponseMaker::GetGeometricalMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, Double_t &d) const |
cd6431de | 600 | { |
7f76e479 | 601 | Double_t deta = jet2->Eta() - jet1->Eta(); |
602 | Double_t dphi = jet2->Phi() - jet1->Phi(); | |
603 | d = TMath::Sqrt(deta * deta + dphi * dphi); | |
604 | } | |
cd6431de | 605 | |
7f76e479 | 606 | //________________________________________________________________________ |
607 | void AliJetResponseMaker::GetMCLabelMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, Double_t &d1, Double_t &d2) const | |
608 | { | |
609 | // d1 and d2 represent the matching level: 0 = maximum level of matching, 1 = the two jets are completely unrelated | |
610 | d1 = jet1->Pt(); | |
611 | d2 = jet2->Pt(); | |
612 | Double_t totalPt1 = d1; // the total pt of the reconstructed jet will be cleaned from the background | |
613 | ||
614 | for (Int_t iTrack2 = 0; iTrack2 < jet2->GetNumberOfTracks(); iTrack2++) { | |
615 | Bool_t track2Found = kFALSE; | |
616 | Int_t index2 = jet2->TrackAt(iTrack2); | |
617 | for (Int_t iTrack = 0; iTrack < jet1->GetNumberOfTracks(); iTrack++) { | |
618 | AliVParticle *track = jet1->TrackAt(iTrack,fTracks); | |
619 | if (!track) { | |
620 | AliWarning(Form("Could not find track %d!", iTrack)); | |
621 | continue; | |
622 | } | |
787a3c4f | 623 | Int_t MClabel = TMath::Abs(track->GetLabel()); |
7f76e479 | 624 | Int_t index = -1; |
625 | ||
787a3c4f | 626 | if (MClabel == 0) {// this is not a MC particle; remove it completely |
7f76e479 | 627 | AliDebug(3,Form("Track %d (pT = %f) is not a MC particle (MClabel = %d)!",iTrack,track->Pt(),MClabel)); |
628 | totalPt1 -= track->Pt(); | |
629 | d1 -= track->Pt(); | |
630 | continue; | |
631 | } | |
632 | else if (MClabel < fTracks2Map->GetNbinsX()-2) { | |
633 | index = fTracks2Map->GetBinContent(MClabel); | |
634 | } | |
635 | ||
636 | if (index < 0) { | |
637 | AliDebug(2,Form("Track %d (pT = %f) does not have an associated MC particle (MClabel = %d)!",iTrack,track->Pt(),MClabel)); | |
638 | continue; | |
639 | } | |
640 | ||
641 | if (index2 == index) { // found common particle | |
642 | track2Found = kTRUE; | |
643 | d1 -= track->Pt(); | |
644 | AliVParticle *MCpart = static_cast<AliVParticle*>(fTracks2->At(index2)); | |
645 | AliDebug(3,Form("Track %d (pT = %f, eta = %f, phi = %f) is associated with the MC particle %d (pT = %f, eta = %f, phi = %f)!", | |
646 | iTrack,track->Pt(),track->Eta(),track->Phi(),MClabel,MCpart->Pt(),MCpart->Eta(),MCpart->Phi())); | |
647 | d2 -= MCpart->Pt(); | |
648 | break; | |
649 | } | |
cd6431de | 650 | } |
7f76e479 | 651 | for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) { |
652 | AliVCluster *clus = jet1->ClusterAt(iClus,fCaloClusters); | |
653 | if (!clus) { | |
654 | AliWarning(Form("Could not find cluster %d!", iClus)); | |
655 | continue; | |
656 | } | |
657 | TLorentzVector part; | |
658 | clus->GetMomentum(part, const_cast<Double_t*>(fVertex)); | |
659 | ||
660 | if (fCaloCells) { // if the cell colection is available, look for cells with a matched MC particle | |
661 | for (Int_t iCell = 0; iCell < clus->GetNCells(); iCell++) { | |
662 | Int_t cellId = clus->GetCellAbsId(iCell); | |
663 | Double_t cellFrac = clus->GetCellAmplitudeFraction(iCell); | |
664 | ||
787a3c4f | 665 | Int_t MClabel = TMath::Abs(fCaloCells->GetCellMCLabel(cellId)); |
7f76e479 | 666 | Int_t index = -1; |
667 | ||
787a3c4f | 668 | if (MClabel == 0) {// this is not a MC particle; remove it completely |
7f76e479 | 669 | AliDebug(3,Form("Cell %d (frac = %f) is not a MC particle (MClabel = %d)!",iCell,cellFrac,MClabel)); |
670 | totalPt1 -= part.Pt() * cellFrac; | |
671 | d1 -= part.Pt() * cellFrac; | |
672 | continue; | |
673 | } | |
674 | else if (MClabel < fTracks2Map->GetNbinsX()-2) { | |
675 | index = fTracks2Map->GetBinContent(MClabel); | |
676 | } | |
677 | ||
678 | if (index < 0) { | |
679 | AliDebug(3,Form("Cell %d (frac = %f) does not have an associated MC particle (MClabel = %d)!",iCell,cellFrac,MClabel)); | |
680 | continue; | |
681 | } | |
682 | if (index2 == index) { // found common particle | |
683 | d1 -= part.Pt() * cellFrac; | |
684 | ||
685 | if (!track2Found) {// only if it is not already found among charged tracks (charged particles are most likely already found) | |
686 | AliVParticle *MCpart = static_cast<AliVParticle*>(fTracks2->At(index2)); | |
687 | AliDebug(3,Form("Cell %d belonging to cluster %d (pT = %f, eta = %f, phi = %f) is associated with the MC particle %d (pT = %f, eta = %f, phi = %f)!", | |
688 | iCell,iClus,part.Pt(),part.Eta(),part.Phi(),MClabel,MCpart->Pt(),MCpart->Eta(),MCpart->Phi())); | |
689 | d2 -= MCpart->Pt() * cellFrac; | |
690 | } | |
691 | break; | |
692 | } | |
cfc2ac24 | 693 | } |
694 | } | |
7f76e479 | 695 | else { //otherwise look for the first contributor to the cluster, and if matched to a MC label remove it |
787a3c4f | 696 | Int_t MClabel = TMath::Abs(clus->GetLabel()); |
7f76e479 | 697 | Int_t index = -1; |
698 | ||
787a3c4f | 699 | if (MClabel == 0) {// this is not a MC particle; remove it completely |
7f76e479 | 700 | AliDebug(3,Form("Cluster %d (pT = %f) is not a MC particle (MClabel = %d)!",iClus,part.Pt(),MClabel)); |
701 | totalPt1 -= part.Pt(); | |
702 | d1 -= part.Pt(); | |
cfc2ac24 | 703 | continue; |
704 | } | |
7f76e479 | 705 | else if (MClabel < fTracks2Map->GetNbinsX()-2) { |
706 | index = fTracks2Map->GetBinContent(MClabel); | |
f660c2d6 | 707 | } |
7f76e479 | 708 | |
cfc2ac24 | 709 | if (index < 0) { |
7f76e479 | 710 | AliDebug(3,Form("Cluster %d (pT = %f) does not have an associated MC particle (MClabel = %d)!",iClus,part.Pt(),MClabel)); |
cfc2ac24 | 711 | continue; |
712 | } | |
7f76e479 | 713 | if (index2 == index) { // found common particle |
714 | d1 -= part.Pt(); | |
715 | ||
716 | if (!track2Found) {// only if it is not already found among charged tracks (charged particles are most likely already found) | |
f660c2d6 | 717 | AliVParticle *MCpart = static_cast<AliVParticle*>(fTracks2->At(index2)); |
7f76e479 | 718 | AliDebug(3,Form("Cluster %d (pT = %f, eta = %f, phi = %f) is associated with the MC particle %d (pT = %f, eta = %f, phi = %f)!", |
719 | iClus,part.Pt(),part.Eta(),part.Phi(),MClabel,MCpart->Pt(),MCpart->Eta(),MCpart->Phi())); | |
720 | ||
f660c2d6 | 721 | d2 -= MCpart->Pt(); |
cfc2ac24 | 722 | } |
7f76e479 | 723 | break; |
cfc2ac24 | 724 | } |
725 | } | |
7f76e479 | 726 | } |
727 | } | |
728 | if (d1 <= 0 || totalPt1 < 1) | |
729 | d1 = 0; | |
730 | else | |
731 | d1 /= totalPt1; | |
f660c2d6 | 732 | |
7f76e479 | 733 | if (jet2->Pt() > 0 && d2 > 0) |
734 | d2 /= jet2->Pt(); | |
735 | else | |
736 | d2 = 0; | |
737 | } | |
738 | ||
739 | //________________________________________________________________________ | |
740 | void AliJetResponseMaker::GetSameCollectionsMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, Double_t &d1, Double_t &d2) const | |
741 | { | |
742 | // d1 and d2 represent the matching level: 0 = maximum level of matching, 1 = the two jets are completely unrelated | |
743 | d1 = jet1->Pt(); | |
744 | d2 = jet2->Pt(); | |
745 | ||
746 | if (fTracks && fTracks2) { | |
747 | ||
748 | for (Int_t iTrack2 = 0; iTrack2 < jet2->GetNumberOfTracks(); iTrack2++) { | |
749 | Int_t index2 = jet2->TrackAt(iTrack2); | |
750 | for (Int_t iTrack = 0; iTrack < jet1->GetNumberOfTracks(); iTrack++) { | |
751 | Int_t index = jet1->TrackAt(iTrack); | |
752 | if (index2 == index) { // found common particle | |
753 | AliVParticle *part = static_cast<AliVParticle*>(fTracks->At(index)); | |
754 | if (!part) { | |
755 | AliWarning(Form("Could not find track %d!", index)); | |
f660c2d6 | 756 | continue; |
757 | } | |
7f76e479 | 758 | AliVParticle *part2 = static_cast<AliVParticle*>(fTracks2->At(index2)); |
759 | if (!part2) { | |
760 | AliWarning(Form("Could not find track %d!", index2)); | |
cfc2ac24 | 761 | continue; |
762 | } | |
7f76e479 | 763 | |
764 | d1 -= part->Pt(); | |
765 | d2 -= part2->Pt(); | |
766 | break; | |
cfc2ac24 | 767 | } |
768 | } | |
cfc2ac24 | 769 | } |
7f76e479 | 770 | |
771 | } | |
772 | ||
773 | if (fCaloClusters && fCaloClusters2) { | |
774 | ||
775 | for (Int_t iClus2 = 0; iClus2 < jet2->GetNumberOfClusters(); iClus2++) { | |
776 | Int_t index2 = jet2->ClusterAt(iClus2); | |
777 | for (Int_t iClus = 0; iClus < jet1->GetNumberOfClusters(); iClus++) { | |
778 | Int_t index = jet1->ClusterAt(iClus); | |
779 | AliVCluster *clus = static_cast<AliVCluster*>(fCaloClusters->At(index)); | |
780 | if (!clus) { | |
781 | AliWarning(Form("Could not find cluster %d!", index)); | |
782 | continue; | |
783 | } | |
784 | AliVCluster *clus2 = static_cast<AliVCluster*>(fCaloClusters2->At(index2)); | |
785 | if (!clus2) { | |
786 | AliWarning(Form("Could not find cluster %d!", index2)); | |
787 | continue; | |
788 | } | |
789 | TLorentzVector part, part2; | |
790 | clus->GetMomentum(part, const_cast<Double_t*>(fVertex)); | |
791 | clus2->GetMomentum(part2, const_cast<Double_t*>(fVertex)); | |
792 | ||
793 | d1 -= part.Pt(); | |
794 | d2 -= part2.Pt(); | |
795 | break; | |
796 | } | |
797 | } | |
798 | ||
799 | } | |
800 | ||
801 | if (jet1->Pt() > 0 && d1 > 0) | |
802 | d1 /= jet1->Pt(); | |
803 | else | |
804 | d1 = 0; | |
805 | ||
806 | if (jet2->Pt() > 0 && d2 > 0) | |
807 | d2 /= jet2->Pt(); | |
808 | else | |
809 | d2 = 0; | |
810 | } | |
811 | ||
812 | //________________________________________________________________________ | |
813 | void AliJetResponseMaker::SetMatchingLevel(AliEmcalJet *jet1, AliEmcalJet *jet2, MatchingType matching) | |
814 | { | |
815 | Double_t d1 = -1; | |
816 | Double_t d2 = -1; | |
817 | ||
818 | switch (matching) { | |
819 | case kGeometrical: | |
820 | GetGeometricalMatchingLevel(jet1,jet2,d1); | |
821 | d2 = d1; | |
822 | break; | |
823 | case kMCLabel: // jet1 = detector level and jet2 = particle level! | |
824 | GetMCLabelMatchingLevel(jet1,jet2,d1,d2); | |
825 | break; | |
826 | case kSameCollections: | |
827 | GetSameCollectionsMatchingLevel(jet1,jet2,d1,d2); | |
cd6431de | 828 | break; |
829 | default: | |
830 | ; | |
831 | } | |
f660c2d6 | 832 | |
833 | if (d1 > 0) { | |
834 | ||
835 | if (d1 < jet1->ClosestJetDistance()) { | |
836 | jet1->SetSecondClosestJet(jet1->ClosestJet(), jet1->ClosestJetDistance()); | |
837 | jet1->SetClosestJet(jet2, d1); | |
838 | } | |
839 | else if (d1 < jet1->SecondClosestJetDistance()) { | |
840 | jet1->SetSecondClosestJet(jet2, d1); | |
841 | } | |
842 | } | |
843 | ||
844 | if (d2 > 0) { | |
845 | ||
846 | if (d2 < jet2->ClosestJetDistance()) { | |
847 | jet2->SetSecondClosestJet(jet2->ClosestJet(), jet2->ClosestJetDistance()); | |
848 | jet2->SetClosestJet(jet1, d2); | |
849 | } | |
850 | else if (d2 < jet2->SecondClosestJetDistance()) { | |
851 | jet2->SetSecondClosestJet(jet1, d2); | |
852 | } | |
853 | } | |
cd6431de | 854 | } |
855 | ||
1ee1b5b8 | 856 | //________________________________________________________________________ |
857 | Bool_t AliJetResponseMaker::FillHistograms() | |
858 | { | |
859 | // Fill histograms. | |
860 | ||
4643d2e8 | 861 | fHistEvents->SetBinContent(fPtHardBin + 1, fHistEvents->GetBinContent(fPtHardBin + 1) + 1); |
862 | fHistNTrials->SetBinContent(fPtHardBin + 1, fHistNTrials->GetBinContent(fPtHardBin + 1) + fNTrials); | |
4643d2e8 | 863 | |
cd6431de | 864 | const Int_t nJets2 = fJets2->GetEntriesFast(); |
2949a2ec | 865 | |
cd6431de | 866 | for (Int_t i = 0; i < nJets2; i++) { |
2949a2ec | 867 | |
cd6431de | 868 | AliEmcalJet* jet2 = static_cast<AliEmcalJet*>(fJets2->At(i)); |
2949a2ec | 869 | |
cd6431de | 870 | if (!jet2) { |
871 | AliError(Form("Could not receive jet2 %d", i)); | |
2949a2ec | 872 | continue; |
cfc2ac24 | 873 | } |
874 | ||
875 | if (jet2->Pt() > fMaxBinPt) | |
876 | continue; | |
2949a2ec | 877 | |
cd6431de | 878 | if (!AcceptJet(jet2)) |
879 | continue; | |
880 | ||
cfc2ac24 | 881 | if (AcceptBiasJet(jet2) && |
882 | (jet2->Eta() > fJetMinEta && jet2->Eta() < fJetMaxEta && jet2->Phi() > fJetMinPhi && jet2->Phi() < fJetMaxPhi)) { | |
883 | ||
884 | fHistJets2PtAreaAcceptance->Fill(jet2->Area(), jet2->Pt()); | |
885 | fHistJets2PhiEtaAcceptance->Fill(jet2->Eta(), jet2->Phi()); | |
886 | ||
887 | if (!fRho2Name.IsNull()) | |
888 | fHistJets2CorrPtAreaAcceptance->Fill(jet2->Area(), jet2->Pt() - fRho2Val * jet2->Area()); | |
889 | } | |
890 | ||
cd6431de | 891 | if (!AcceptBiasJet2(jet2)) |
ceefbfbc | 892 | continue; |
893 | ||
cd6431de | 894 | if (jet2->Eta() < fJet2MinEta || jet2->Eta() > fJet2MaxEta || jet2->Phi() < fJet2MinPhi || jet2->Phi() > fJet2MaxPhi) |
2bddb6ae | 895 | continue; |
896 | ||
cfc2ac24 | 897 | fHistJets2PtArea->Fill(jet2->Area(), jet2->Pt()); |
898 | fHistJets2PhiEta->Fill(jet2->Eta(), jet2->Phi()); | |
899 | ||
900 | if (!fRho2Name.IsNull()) | |
901 | fHistJets2CorrPtArea->Fill(jet2->Area(), jet2->Pt() - fRho2Val * jet2->Area()); | |
2949a2ec | 902 | |
cd6431de | 903 | if (jet2->MatchedJet()) { |
aa4d701c | 904 | |
cd6431de | 905 | if (!AcceptBiasJet(jet2->MatchedJet()) || |
906 | jet2->MatchedJet()->MaxTrackPt() > fMaxTrackPt || jet2->MatchedJet()->MaxClusterPt() > fMaxClusterPt || | |
907 | jet2->MatchedJet()->Pt() > fMaxBinPt) { | |
908 | fHistMissedJets2PtArea->Fill(jet2->Area(), jet2->Pt()); | |
2bddb6ae | 909 | } |
910 | else { | |
7f76e479 | 911 | Double_t d1=-1, d2=-1; |
912 | if (jet2->GetMatchingType() == kGeometrical) { | |
913 | ||
914 | if (fAreCollections2MC && !fAreCollections1MC) | |
915 | GetMCLabelMatchingLevel(jet2->MatchedJet(), jet2, d1, d2); | |
916 | else if ((fAreCollections1MC && fAreCollections2MC) || (!fAreCollections1MC && !fAreCollections2MC)) | |
917 | GetSameCollectionsMatchingLevel(jet2->MatchedJet(), jet2, d1, d2); | |
918 | ||
919 | fHistDistancevsCommonEnergy->Fill(jet2->ClosestJetDistance(), d2); | |
920 | } | |
921 | else if (jet2->GetMatchingType() == kMCLabel || jet2->GetMatchingType() == kSameCollections) { | |
922 | GetGeometricalMatchingLevel(jet2->MatchedJet(), jet2, d1); | |
923 | fHistDistancevsCommonEnergy->Fill(d1, jet2->ClosestJetDistance()); | |
924 | } | |
cfc2ac24 | 925 | |
cd6431de | 926 | fHistMatchingLevelvsJet2Pt->Fill(jet2->ClosestJetDistance(), jet2->Pt()); |
927 | ||
928 | Double_t deta = jet2->MatchedJet()->Eta() - jet2->Eta(); | |
929 | Double_t dphi = jet2->MatchedJet()->Phi() - jet2->Phi(); | |
cfc2ac24 | 930 | fHistDeltaEtaPhivsJet2Pt->Fill(deta, dphi, jet2->Pt()); |
cd6431de | 931 | |
932 | Double_t dpt = jet2->MatchedJet()->Pt() - jet2->Pt(); | |
cfc2ac24 | 933 | fHistDeltaPtvsJet2Pt->Fill(jet2->Pt(), dpt); |
934 | fHistDeltaPtvsMatchingLevel->Fill(jet2->ClosestJetDistance(), dpt); | |
cd6431de | 935 | |
936 | fHistJet1PtvsJet2Pt->Fill(jet2->MatchedJet()->Pt(), jet2->Pt()); | |
937 | ||
938 | if (!fRhoName.IsNull() || !fRho2Name.IsNull()) { | |
939 | dpt -= fRhoVal * jet2->MatchedJet()->Area() - fRho2Val * jet2->Area(); | |
cfc2ac24 | 940 | fHistDeltaCorrPtvsJet2Pt->Fill(jet2->Pt(), dpt); |
941 | fHistDeltaCorrPtvsMatchingLevel->Fill(jet2->ClosestJetDistance(), dpt); | |
cd6431de | 942 | fHistJet1CorrPtvsJet2CorrPt->Fill(jet2->MatchedJet()->Pt() - fRhoVal * jet2->MatchedJet()->Area(), jet2->Pt() - fRho2Val * jet2->Area()); |
943 | } | |
2bddb6ae | 944 | } |
2949a2ec | 945 | } |
99c67c1b | 946 | else { |
cd6431de | 947 | fHistNonMatchedJets2PtArea->Fill(jet2->Area(), jet2->Pt()); |
948 | fHistMissedJets2PtArea->Fill(jet2->Area(), jet2->Pt()); | |
2949a2ec | 949 | |
cd6431de | 950 | if (!fRho2Name.IsNull()) |
951 | fHistNonMatchedJets2CorrPtArea->Fill(jet2->Area(), jet2->Pt() - fRhoVal * jet2->Area()); | |
1b76c28f | 952 | } |
953 | } | |
954 | ||
cd6431de | 955 | const Int_t nJets1 = fJets->GetEntriesFast(); |
1b76c28f | 956 | |
cd6431de | 957 | for (Int_t i = 0; i < nJets1; i++) { |
1b76c28f | 958 | |
cd6431de | 959 | AliEmcalJet* jet1 = static_cast<AliEmcalJet*>(fJets->At(i)); |
1b76c28f | 960 | |
cd6431de | 961 | if (!jet1) { |
962 | AliError(Form("Could not receive jet %d", i)); | |
2949a2ec | 963 | continue; |
1b76c28f | 964 | } |
99c67c1b | 965 | |
cd6431de | 966 | if (!AcceptJet(jet1)) |
1b76c28f | 967 | continue; |
cd6431de | 968 | |
969 | if (!AcceptBiasJet(jet1)) | |
91bee8bc | 970 | continue; |
cd6431de | 971 | |
972 | if (jet1->MaxTrackPt() > fMaxTrackPt || jet1->MaxClusterPt() > fMaxClusterPt) | |
91bee8bc | 973 | continue; |
cd6431de | 974 | |
975 | if (jet1->Eta() < fJetMinEta || jet1->Eta() > fJetMaxEta || jet1->Phi() < fJetMinPhi || jet1->Phi() > fJetMaxPhi) | |
91bee8bc | 976 | continue; |
2949a2ec | 977 | |
cd6431de | 978 | if (!jet1->MatchedJet()) { |
979 | fHistNonMatchedJets1PtArea->Fill(jet1->Area(), jet1->Pt()); | |
980 | if (!fRhoName.IsNull()) | |
981 | fHistNonMatchedJets1CorrPtArea->Fill(jet1->Area(), jet1->Pt() - fRhoVal * jet1->Area()); | |
99c67c1b | 982 | } |
1b76c28f | 983 | |
cd6431de | 984 | fHistJets1PtArea->Fill(jet1->Area(), jet1->Pt()); |
985 | fHistJets1PhiEta->Fill(jet1->Eta(), jet1->Phi()); | |
1b76c28f | 986 | |
cd6431de | 987 | if (!fRhoName.IsNull()) |
988 | fHistJets1CorrPtArea->Fill(jet1->Area(), jet1->Pt() - fRhoVal * jet1->Area()); | |
1b76c28f | 989 | } |
6fd5039f | 990 | |
991 | return kTRUE; | |
1b76c28f | 992 | } |