]>
Commit | Line | Data |
---|---|---|
0531c107 | 1 | // |
2 | // Jet trigger QA analysis task. | |
3 | // | |
4 | // Author: M.Verweij | |
5 | ||
6 | #include <TClonesArray.h> | |
7 | #include <TH1F.h> | |
8 | #include <TH2F.h> | |
9 | #include <TH3F.h> | |
10 | #include <THnSparse.h> | |
11 | #include <TList.h> | |
12 | #include <TLorentzVector.h> | |
13 | ||
14 | #include "AliVCluster.h" | |
15 | #include "AliVTrack.h" | |
16 | #include "AliEmcalJet.h" | |
17 | #include "AliRhoParameter.h" | |
18 | #include "AliLog.h" | |
19 | #include "AliAnalysisUtils.h" | |
20 | #include "AliEmcalParticle.h" | |
21 | #include "AliAODCaloTrigger.h" | |
22 | #include "AliEMCALGeometry.h" | |
23 | #include "AliVCaloCells.h" | |
9e5eee5d | 24 | #include "AliJetContainer.h" |
25 | #include "AliClusterContainer.h" | |
584095b1 | 26 | #include "AliEmcalTriggerPatchInfo.h" |
27 | #include "AliAODHeader.h" | |
0531c107 | 28 | |
29 | #include "AliAnalysisTaskEmcalJetTriggerQA.h" | |
30 | ||
31 | ClassImp(AliAnalysisTaskEmcalJetTriggerQA) | |
32 | ||
33 | //________________________________________________________________________ | |
34 | AliAnalysisTaskEmcalJetTriggerQA::AliAnalysisTaskEmcalJetTriggerQA() : | |
9239b066 | 35 | AliAnalysisTaskEmcalJet("AliAnalysisTaskEmcalJetTriggerQA", kTRUE), |
0531c107 | 36 | fDebug(kFALSE), |
37 | fUseAnaUtils(kTRUE), | |
38 | fAnalysisUtils(0), | |
0531c107 | 39 | fTriggerClass(""), |
40 | fBitJ1((1<<8)), | |
41 | fBitJ2((1<<11)), | |
9e5eee5d | 42 | fContainerFull(0), |
43 | fContainerCharged(1), | |
0531c107 | 44 | fMaxPatchEnergy(0), |
45 | fTriggerType(-1), | |
46 | fNFastOR(16), | |
47 | fhNEvents(0), | |
48 | fh3PtEtaPhiJetFull(0), | |
49 | fh3PtEtaPhiJetCharged(0), | |
50 | fh2NJetsPtFull(0), | |
51 | fh2NJetsPtCharged(0), | |
52 | fh3PtEtaAreaJetFull(0), | |
53 | fh3PtEtaAreaJetCharged(0), | |
54 | fh2PtNConstituentsCharged(0), | |
55 | fh2PtNConstituents(0), | |
56 | fh2PtMeanPtConstituentsCharged(0), | |
57 | fh2PtMeanPtConstituentsNeutral(0), | |
58 | fh2PtNEF(0), | |
3c709670 | 59 | fh3NEFEtaPhi(0), |
60 | fh2NEFNConstituentsCharged(0), | |
61 | fh2NEFNConstituentsNeutral(0), | |
0531c107 | 62 | fh2Ptz(0), |
3c709670 | 63 | fh2PtzCharged(0), |
0531c107 | 64 | fh2PtLeadJet1VsLeadJet2(0), |
65 | fh3EEtaPhiCluster(0), | |
66 | fh3PtLeadJet1VsPatchEnergy(0), | |
67 | fh3PtLeadJet2VsPatchEnergy(0), | |
584095b1 | 68 | fh3PatchEnergyEtaPhiCenterJ1(0), |
69 | fh3PatchEnergyEtaPhiCenterJ2(0), | |
0714a353 | 70 | fh2CellEnergyVsTime(0), |
71 | fh3EClusELeadingCellVsTime(0) | |
0531c107 | 72 | { |
73 | // Default constructor. | |
74 | ||
0531c107 | 75 | SetMakeGeneralHistograms(kTRUE); |
76 | } | |
77 | ||
78 | //________________________________________________________________________ | |
79 | AliAnalysisTaskEmcalJetTriggerQA::AliAnalysisTaskEmcalJetTriggerQA(const char *name) : | |
9239b066 | 80 | AliAnalysisTaskEmcalJet(name, kTRUE), |
0531c107 | 81 | fDebug(kFALSE), |
82 | fUseAnaUtils(kTRUE), | |
83 | fAnalysisUtils(0), | |
0531c107 | 84 | fTriggerClass(""), |
85 | fBitJ1((1<<8)), | |
86 | fBitJ2((1<<11)), | |
9e5eee5d | 87 | fContainerFull(0), |
88 | fContainerCharged(1), | |
0531c107 | 89 | fMaxPatchEnergy(0), |
90 | fTriggerType(-1), | |
91 | fNFastOR(16), | |
92 | fhNEvents(0), | |
93 | fh3PtEtaPhiJetFull(0), | |
94 | fh3PtEtaPhiJetCharged(0), | |
95 | fh2NJetsPtFull(0), | |
96 | fh2NJetsPtCharged(0), | |
97 | fh3PtEtaAreaJetFull(0), | |
98 | fh3PtEtaAreaJetCharged(0), | |
99 | fh2PtNConstituentsCharged(0), | |
100 | fh2PtNConstituents(0), | |
101 | fh2PtMeanPtConstituentsCharged(0), | |
102 | fh2PtMeanPtConstituentsNeutral(0), | |
103 | fh2PtNEF(0), | |
3c709670 | 104 | fh3NEFEtaPhi(0), |
105 | fh2NEFNConstituentsCharged(0), | |
106 | fh2NEFNConstituentsNeutral(0), | |
0531c107 | 107 | fh2Ptz(0), |
3c709670 | 108 | fh2PtzCharged(0), |
0531c107 | 109 | fh2PtLeadJet1VsLeadJet2(0), |
110 | fh3EEtaPhiCluster(0), | |
111 | fh3PtLeadJet1VsPatchEnergy(0), | |
112 | fh3PtLeadJet2VsPatchEnergy(0), | |
584095b1 | 113 | fh3PatchEnergyEtaPhiCenterJ1(0), |
114 | fh3PatchEnergyEtaPhiCenterJ2(0), | |
0714a353 | 115 | fh2CellEnergyVsTime(0), |
116 | fh3EClusELeadingCellVsTime(0) | |
0531c107 | 117 | { |
118 | // Standard constructor. | |
119 | ||
120 | SetMakeGeneralHistograms(kTRUE); | |
121 | } | |
122 | ||
123 | //________________________________________________________________________ | |
124 | AliAnalysisTaskEmcalJetTriggerQA::~AliAnalysisTaskEmcalJetTriggerQA() | |
125 | { | |
126 | // Destructor. | |
127 | } | |
128 | ||
0714a353 | 129 | //________________________________________________________________________ |
130 | void AliAnalysisTaskEmcalJetTriggerQA::ExecOnce() | |
131 | { | |
132 | // Init the analysis. | |
133 | ||
134 | AliAnalysisTaskEmcalJet::ExecOnce(); | |
0531c107 | 135 | |
136 | // Initialize analysis util class for vertex selection | |
137 | if(fUseAnaUtils) { | |
0714a353 | 138 | if(!fAnalysisUtils) fAnalysisUtils = new AliAnalysisUtils(); |
0531c107 | 139 | fAnalysisUtils->SetMinVtxContr(2); |
140 | fAnalysisUtils->SetMaxVtxZ(10.); | |
141 | } | |
0714a353 | 142 | |
0531c107 | 143 | } |
144 | ||
145 | //________________________________________________________________________ | |
146 | Bool_t AliAnalysisTaskEmcalJetTriggerQA::SelectEvent() { | |
147 | // | |
148 | // Decide if event should be selected for analysis | |
149 | // | |
150 | ||
151 | fhNEvents->Fill(0.5); | |
152 | ||
153 | if(fAnalysisUtils) { | |
154 | if(!fAnalysisUtils->IsVertexSelected2013pA(InputEvent())) | |
155 | return kFALSE; | |
156 | ||
157 | fhNEvents->Fill(2.5); | |
158 | ||
159 | if(fAnalysisUtils->IsPileUpEvent(InputEvent())) | |
160 | return kFALSE; | |
161 | } | |
162 | else{ | |
163 | if(fUseAnaUtils) | |
0714a353 | 164 | AliError("fAnalysisUtils not initialized. Call AliAnalysisTaskEmcalJetTriggerQA::ExecOnce()"); |
0531c107 | 165 | } |
166 | ||
167 | fhNEvents->Fill(3.5); | |
168 | ||
584095b1 | 169 | Bool_t check = kFALSE; |
0531c107 | 170 | if(!fTriggerClass.IsNull()) { |
171 | //Check if requested trigger was fired | |
172 | TString firedTrigClass = InputEvent()->GetFiredTriggerClasses(); | |
584095b1 | 173 | AliEmcalTriggerPatchInfo *patch = GetMainTriggerPatch(); |
174 | ||
175 | // AliAODHeader *aodH = dynamic_cast<AliAODHeader*>(InputEvent()->GetHeader()); | |
176 | // Printf("event nr in ESD: %d ntracks: %d",aodH->GetEventNumberESDFile(), InputEvent()->GetNumberOfTracks()); | |
177 | // Printf("IsJetLow(): %d IsJetHigh(): %d %s",patch->IsJetLow(),patch->IsJetHigh(),firedTrigClass.Data()); | |
178 | // Printf("patch E: %f eta: %f phi: %f", patch->GetPatchE(),patch->GetEtaGeo(),patch->GetPhiGeo()); | |
179 | if(fTriggerClass.Contains("J1")) { //asking for high threshold trigger | |
180 | if(patch->IsJetHigh()) | |
181 | check = kTRUE; | |
182 | } | |
183 | if(fTriggerClass.Contains("J2")) { //asking for low threshold trigger | |
184 | if(patch->IsJetLow() && !patch->IsJetHigh()) | |
185 | check = kTRUE; | |
186 | } | |
187 | ||
188 | if(!check) | |
189 | return kFALSE; | |
190 | ||
0531c107 | 191 | if(!firedTrigClass.Contains(fTriggerClass)) |
192 | return kFALSE; | |
193 | } | |
194 | ||
195 | fhNEvents->Fill(1.5); | |
196 | ||
197 | return kTRUE; | |
198 | ||
199 | } | |
200 | ||
201 | //________________________________________________________________________ | |
202 | void AliAnalysisTaskEmcalJetTriggerQA::FindTriggerPatch() { | |
203 | ||
204 | //Code to get position of trigger | |
205 | ||
584095b1 | 206 | AliEmcalTriggerPatchInfo *patch = GetMainTriggerPatch(); |
207 | if(patch) { | |
208 | fMaxPatchEnergy = patch->GetPatchE(); | |
209 | if(patch->IsJetLow() && !patch->IsJetHigh()) | |
210 | fh3PatchEnergyEtaPhiCenterJ2->Fill(patch->GetPatchE(),patch->GetEtaGeo(),patch->GetPhiGeo()); | |
211 | if(patch->IsJetHigh()) | |
212 | fh3PatchEnergyEtaPhiCenterJ1->Fill(patch->GetPatchE(),patch->GetEtaGeo(),patch->GetPhiGeo()); | |
213 | } | |
0531c107 | 214 | } |
215 | ||
216 | //________________________________________________________________________ | |
217 | void AliAnalysisTaskEmcalJetTriggerQA::LoadExtraBranches() { | |
218 | // | |
9e5eee5d | 219 | // load extra brances |
0531c107 | 220 | // |
221 | ||
0531c107 | 222 | } |
223 | ||
224 | //________________________________________________________________________ | |
225 | void AliAnalysisTaskEmcalJetTriggerQA::UserCreateOutputObjects() | |
226 | { | |
227 | // Create user output. | |
228 | ||
9239b066 | 229 | AliAnalysisTaskEmcalJet::UserCreateOutputObjects(); |
0531c107 | 230 | |
231 | Bool_t oldStatus = TH1::AddDirectoryStatus(); | |
232 | TH1::AddDirectory(kFALSE); | |
233 | ||
234 | fhNEvents = new TH1F("fhNEvents","fhNEvents;selection;N_{evt}",5,0,5); | |
235 | fOutput->Add(fhNEvents); | |
236 | ||
584095b1 | 237 | Int_t fgkNPtBins = 170; |
238 | Float_t kMinPt = -20.; | |
239 | Float_t kMaxPt = 150.; | |
240 | Double_t *binsPt = new Double_t[fgkNPtBins+1]; | |
241 | for(Int_t i=0; i<=fgkNPtBins; i++) binsPt[i]=(Double_t)kMinPt + (kMaxPt-kMinPt)/fgkNPtBins*(Double_t)i ; | |
242 | ||
243 | Int_t fgkNPhiBins = 18*8; | |
244 | Float_t kMinPhi = 0.; | |
245 | Float_t kMaxPhi = 2.*TMath::Pi(); | |
246 | Double_t *binsPhi = new Double_t[fgkNPhiBins+1]; | |
247 | for(Int_t i=0; i<=fgkNPhiBins; i++) binsPhi[i]=(Double_t)kMinPhi + (kMaxPhi-kMinPhi)/fgkNPhiBins*(Double_t)i ; | |
248 | ||
249 | Int_t fgkNEtaBins = 100; | |
250 | Float_t fgkEtaMin = -1.; | |
251 | Float_t fgkEtaMax = 1.; | |
252 | Double_t *binsEta=new Double_t[fgkNEtaBins+1]; | |
253 | for(Int_t i=0; i<=fgkNEtaBins; i++) binsEta[i]=(Double_t)fgkEtaMin + (fgkEtaMax-fgkEtaMin)/fgkNEtaBins*(Double_t)i ; | |
254 | ||
255 | Int_t fgkNAreaBins = 100; | |
256 | Float_t kMinArea = 0.; | |
257 | Float_t kMaxArea = 1.; | |
258 | Double_t *binsArea = new Double_t[fgkNAreaBins+1]; | |
259 | for(Int_t i=0; i<=fgkNAreaBins; i++) binsArea[i]=(Double_t)kMinArea + (kMaxArea-kMinArea)/fgkNAreaBins*(Double_t)i ; | |
260 | ||
261 | Int_t fgkNConstBins = 100; | |
262 | Float_t kMinConst = 0.; | |
263 | Float_t kMaxConst = 100.; | |
264 | Double_t *binsConst = new Double_t[fgkNConstBins+1]; | |
265 | for(Int_t i=0; i<=fgkNConstBins; i++) binsConst[i]=(Double_t)kMinConst + (kMaxConst-kMinConst)/fgkNConstBins*(Double_t)i ; | |
266 | ||
267 | Int_t fgkNMeanPtBins = 200; | |
268 | Float_t kMinMeanPt = 0.; | |
269 | Float_t kMaxMeanPt = 20.; | |
270 | Double_t *binsMeanPt = new Double_t[fgkNMeanPtBins+1]; | |
271 | for(Int_t i=0; i<=fgkNMeanPtBins; i++) binsMeanPt[i]=(Double_t)kMinMeanPt + (kMaxMeanPt-kMinMeanPt)/fgkNMeanPtBins*(Double_t)i ; | |
272 | ||
273 | Int_t fgkNNEFBins = 101; | |
274 | Float_t kMinNEF = 0.; | |
275 | Float_t kMaxNEF = 1.01; | |
276 | Double_t *binsNEF = new Double_t[fgkNNEFBins+1]; | |
277 | for(Int_t i=0; i<=fgkNNEFBins; i++) binsNEF[i]=(Double_t)kMinNEF + (kMaxNEF-kMinNEF)/fgkNNEFBins*(Double_t)i ; | |
278 | ||
279 | Int_t fgkNzBins = 101; | |
280 | Float_t kMinz = 0.; | |
281 | Float_t kMaxz = 1.01; | |
282 | Double_t *binsz = new Double_t[fgkNzBins+1]; | |
283 | for(Int_t i=0; i<=fgkNzBins; i++) binsz[i]=(Double_t)kMinz + (kMaxz-kMinz)/fgkNzBins*(Double_t)i ; | |
284 | ||
285 | Int_t fgkNJetTypeBins = 2; | |
286 | Float_t kMinJetType = -0.5; | |
287 | Float_t kMaxJetType = 1.5; | |
288 | Double_t *binsJetType = new Double_t[fgkNJetTypeBins+1]; | |
289 | for(Int_t i=0; i<=fgkNJetTypeBins; i++) binsJetType[i]=(Double_t)kMinJetType + (kMaxJetType-kMinJetType)/fgkNJetTypeBins*(Double_t)i ; | |
290 | ||
291 | Int_t fgkNTimeBins = 700; | |
292 | Float_t kMinTime = -400.; | |
293 | Float_t kMaxTime = 1000; | |
294 | Double_t *binsTime = new Double_t[fgkNTimeBins+1]; | |
295 | for(Int_t i=0; i<=fgkNTimeBins; i++) binsTime[i]=(Double_t)kMinTime + (kMaxTime-kMinTime)/fgkNTimeBins*(Double_t)i ; | |
296 | ||
297 | Double_t enBinEdges[3][2]; | |
298 | enBinEdges[0][0] = 1.; //10 bins | |
299 | enBinEdges[0][1] = 0.1; | |
300 | enBinEdges[1][0] = 5.; //8 bins | |
301 | enBinEdges[1][1] = 0.5; | |
302 | enBinEdges[2][0] = 100.;//95 bins | |
303 | enBinEdges[2][1] = 1.; | |
304 | ||
305 | const Float_t enmin1 = 0; | |
306 | const Float_t enmax1 = enBinEdges[0][0]; | |
307 | const Float_t enmin2 = enmax1 ; | |
308 | const Float_t enmax2 = enBinEdges[1][0]; | |
309 | const Float_t enmin3 = enmax2 ; | |
310 | const Float_t enmax3 = enBinEdges[2][0];//fgkEnMax; | |
311 | const Int_t nbin11 = (int)((enmax1-enmin1)/enBinEdges[0][1]); | |
312 | const Int_t nbin12 = (int)((enmax2-enmin2)/enBinEdges[1][1])+nbin11; | |
313 | const Int_t nbin13 = (int)((enmax3-enmin3)/enBinEdges[2][1])+nbin12; | |
314 | ||
315 | Int_t fgkNEnBins=nbin13; | |
316 | Double_t *binsEn=new Double_t[fgkNEnBins+1]; | |
317 | for(Int_t i=0; i<=fgkNEnBins; i++) { | |
318 | if(i<=nbin11) binsEn[i]=(Double_t)enmin1 + (enmax1-enmin1)/nbin11*(Double_t)i ; | |
319 | if(i<=nbin12 && i>nbin11) binsEn[i]=(Double_t)enmin2 + (enmax2-enmin2)/(nbin12-nbin11)*((Double_t)i-(Double_t)nbin11) ; | |
320 | if(i<=nbin13 && i>nbin12) binsEn[i]=(Double_t)enmin3 + (enmax3-enmin3)/(nbin13-nbin12)*((Double_t)i-(Double_t)nbin12) ; | |
321 | } | |
322 | ||
323 | ||
324 | fh3PtEtaPhiJetFull = new TH3F("fh3PtEtaPhiJetFull","fh3PtEtaPhiJetFull;#it{p}_{T}^{jet};#eta;#varphi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi); | |
0531c107 | 325 | fOutput->Add(fh3PtEtaPhiJetFull); |
326 | ||
584095b1 | 327 | fh3PtEtaPhiJetCharged = new TH3F("fh3PtEtaPhiJetCharged","fh3PtEtaPhiJetCharged;#it{p}_{T}^{jet};#eta;#varphi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi); |
0531c107 | 328 | fOutput->Add(fh3PtEtaPhiJetCharged); |
329 | ||
584095b1 | 330 | fh2NJetsPtFull = new TH2F("fh2NJetsPtFull","fh2NJetsPtFull;N_{jets};#it{p}_{T}^{jet}",20,-0.5,19.5,fgkNPtBins,binsPt); |
0531c107 | 331 | fOutput->Add(fh2NJetsPtFull); |
332 | ||
584095b1 | 333 | fh2NJetsPtCharged = new TH2F("fh2NJetsPtCharged","fh2NJetsPtCharged;N_{jets};#it{p}_{T}^{jet}",20,-0.5,19.5,fgkNPtBins,binsPt); |
0531c107 | 334 | fOutput->Add(fh2NJetsPtCharged); |
335 | ||
584095b1 | 336 | fh3PtEtaAreaJetFull = new TH3F("fh3PtEtaAreaJetFull","fh3PtEtaAreaJetFull;#it{p}_{T}^{jet};#eta;A",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNAreaBins,binsArea); |
0531c107 | 337 | fOutput->Add(fh3PtEtaAreaJetFull); |
338 | ||
584095b1 | 339 | fh3PtEtaAreaJetCharged = new TH3F("fh3PtEtaAreaJetCharged","fh3PtEtaAreaJetCharged;#it{p}_{T}^{jet};#eta;A",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNAreaBins,binsArea); |
0531c107 | 340 | fOutput->Add(fh3PtEtaAreaJetCharged); |
341 | ||
584095b1 | 342 | fh2PtNConstituentsCharged = new TH2F("fh2PtNConstituentsCharged","fh2PtNConstituentsCharged;#it{p}_{T}^{jet};N_{charged constituents}",fgkNPtBins,binsPt,fgkNConstBins,binsConst); |
0531c107 | 343 | fOutput->Add(fh2PtNConstituentsCharged); |
344 | ||
584095b1 | 345 | fh2PtNConstituents = new TH2F("fh2PtNConstituents","fh2PtNConstituents;#it{p}_{T}^{jet};N_{constituents}",fgkNPtBins,binsPt,fgkNConstBins,binsConst); |
0531c107 | 346 | fOutput->Add(fh2PtNConstituents); |
347 | ||
584095b1 | 348 | fh2PtMeanPtConstituentsCharged = new TH2F("fh2PtMeanPtConstituentsCharged","fh2PtMeanPtConstituentsCharged;#it{p}_{T}^{jet};charged #langle #it{p}_{T} #rangle",fgkNPtBins,binsPt,fgkNMeanPtBins,binsMeanPt); |
0531c107 | 349 | fOutput->Add(fh2PtMeanPtConstituentsCharged); |
350 | ||
584095b1 | 351 | fh2PtMeanPtConstituentsNeutral = new TH2F("fh2PtMeanPtConstituentsNeutral","fh2PtMeanPtConstituentsNeutral;#it{p}_{T}^{jet};neutral langle #it{p}_{T} #rangle",fgkNPtBins,binsPt,fgkNMeanPtBins,binsMeanPt); |
0531c107 | 352 | fOutput->Add(fh2PtMeanPtConstituentsNeutral); |
353 | ||
584095b1 | 354 | fh2PtNEF = new TH2F("fh2PtNEF","fh2PtNEF;#it{p}_{T}^{jet};NEF",fgkNPtBins,binsPt,fgkNNEFBins,binsNEF); |
0531c107 | 355 | fOutput->Add(fh2PtNEF); |
356 | ||
584095b1 | 357 | fh3NEFEtaPhi = new TH3F("fh3NEFEtaPhi","fh3NEFEtaPhi;NEF;#eta;#varphi",fgkNNEFBins,binsNEF,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi); |
3c709670 | 358 | fOutput->Add(fh3NEFEtaPhi); |
359 | ||
584095b1 | 360 | fh2NEFNConstituentsCharged = new TH2F("fh2NEFNConstituentsCharged","fh2NEFNConstituentsCharged;NEF;N_{charged constituents}",fgkNNEFBins,binsNEF,fgkNConstBins,binsConst); |
3c709670 | 361 | fOutput->Add(fh2NEFNConstituentsCharged); |
362 | ||
584095b1 | 363 | fh2NEFNConstituentsNeutral = new TH2F("fh2NEFNConstituentsNeutral","fh2NEFNConstituentsNeutral;NEF;N_{clusters}",fgkNNEFBins,binsNEF,fgkNConstBins,binsConst); |
3c709670 | 364 | fOutput->Add(fh2NEFNConstituentsNeutral); |
365 | ||
584095b1 | 366 | fh2Ptz = new TH2F("fh2Ptz","fh2Ptz;#it{p}_{T}^{jet};z=p_{t,trk}^{proj}/p_{jet}",fgkNPtBins,binsPt,fgkNzBins,binsz); |
0531c107 | 367 | fOutput->Add(fh2Ptz); |
368 | ||
584095b1 | 369 | fh2PtzCharged = new TH2F("fh2PtzCharged","fh2Ptz;#it{p}_{T}^{ch jet};z=p_{t,trk}^{proj}/p_{ch jet}",fgkNPtBins,binsPt,fgkNzBins,binsz); |
3c709670 | 370 | fOutput->Add(fh2PtzCharged); |
371 | ||
584095b1 | 372 | fh2PtLeadJet1VsLeadJet2 = new TH2F("fh2PtLeadJet1VsLeadJet2","fh2PtLeadJet1VsLeadJet2;#it{p}_{T}^{jet 1};#it{p}_{T}^{jet 2}",fgkNPtBins,binsPt,fgkNPtBins,binsPt); |
0531c107 | 373 | fOutput->Add(fh2PtLeadJet1VsLeadJet2); |
374 | ||
584095b1 | 375 | fh3EEtaPhiCluster = new TH3F("fh3EEtaPhiCluster","fh3EEtaPhiCluster;E_{clus};#eta;#phi",fgkNEnBins,binsEn,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi); |
0531c107 | 376 | fOutput->Add(fh3EEtaPhiCluster); |
377 | ||
584095b1 | 378 | fh3PtLeadJet1VsPatchEnergy = new TH3F("fh3PtLeadJet1VsPatchEnergy","fh3PtLeadJet1VsPatchEnergy;#it{p}_{T}^{jet 1};Amplitude_{patch};trig type",fgkNPtBins,binsPt,fgkNPtBins,binsPt,fgkNJetTypeBins,binsJetType); |
0531c107 | 379 | fOutput->Add(fh3PtLeadJet1VsPatchEnergy); |
584095b1 | 380 | fh3PtLeadJet2VsPatchEnergy = new TH3F("fh3PtLeadJet2VsPatchEnergy","fh3PtLeadJet2VsPatchEnergy;#it{p}_{T}^{jet 1};Amplitude_{patch};trig type",fgkNPtBins,binsPt,fgkNPtBins,binsPt,fgkNJetTypeBins,binsJetType); |
0531c107 | 381 | fOutput->Add(fh3PtLeadJet2VsPatchEnergy); |
382 | ||
584095b1 | 383 | fh3PatchEnergyEtaPhiCenterJ1 = new TH3F("fh3PatchEnergyEtaPhiCenterJ1","fh3PatchEnergyEtaPhiCenterJ1;E_{patch};#eta;#phi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi); |
384 | fOutput->Add(fh3PatchEnergyEtaPhiCenterJ1); | |
385 | ||
386 | fh3PatchEnergyEtaPhiCenterJ2 = new TH3F("fh3PatchEnergyEtaPhiCenterJ2","fh3PatchEnergyEtaPhiCenterJ2;E_{patch};#eta;#phi",fgkNPtBins,binsPt,fgkNEtaBins,binsEta,fgkNPhiBins,binsPhi); | |
387 | fOutput->Add(fh3PatchEnergyEtaPhiCenterJ2); | |
0531c107 | 388 | |
584095b1 | 389 | fh2CellEnergyVsTime = new TH2F("fh2CellEnergyVsTime","fh2CellEnergyVsTime;E_{cell};time",fgkNEnBins,binsEn,fgkNTimeBins,binsTime); |
992189ac | 390 | fOutput->Add(fh2CellEnergyVsTime); |
391 | ||
584095b1 | 392 | fh3EClusELeadingCellVsTime = new TH3F("fh3EClusELeadingCellVsTime","fh3EClusELeadingCellVsTime;E_{cluster};E_{leading cell};time_{leading cell}",fgkNEnBins,binsEn,fgkNEnBins,binsEn,fgkNTimeBins,binsTime); |
0714a353 | 393 | fOutput->Add(fh3EClusELeadingCellVsTime); |
394 | ||
0531c107 | 395 | |
396 | // =========== Switch on Sumw2 for all histos =========== | |
397 | for (Int_t i=0; i<fOutput->GetEntries(); ++i) { | |
398 | TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i)); | |
399 | if (h1){ | |
400 | h1->Sumw2(); | |
401 | continue; | |
402 | } | |
403 | TH2 *h2 = dynamic_cast<TH2*>(fOutput->At(i)); | |
404 | if (h2){ | |
405 | h2->Sumw2(); | |
406 | continue; | |
407 | } | |
408 | TH3 *h3 = dynamic_cast<TH3*>(fOutput->At(i)); | |
409 | if (h3){ | |
410 | h3->Sumw2(); | |
411 | continue; | |
412 | } | |
413 | THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i)); | |
414 | if(hn)hn->Sumw2(); | |
415 | } | |
416 | ||
417 | TH1::AddDirectory(oldStatus); | |
418 | ||
419 | PostData(1, fOutput); // Post data for ALL output slots > 0 here. | |
584095b1 | 420 | |
421 | if(binsEn) delete [] binsEn; | |
422 | if(binsPt) delete [] binsPt; | |
423 | if(binsPhi) delete [] binsPhi; | |
424 | if(binsEta) delete [] binsEta; | |
425 | if(binsArea) delete [] binsArea; | |
426 | if(binsConst) delete [] binsConst; | |
427 | if(binsMeanPt) delete [] binsMeanPt; | |
428 | if(binsNEF) delete [] binsNEF; | |
429 | if(binsz) delete [] binsz; | |
430 | if(binsJetType) delete [] binsJetType; | |
431 | if(binsTime) delete [] binsTime; | |
432 | ||
0531c107 | 433 | } |
434 | ||
435 | //________________________________________________________________________ | |
436 | Bool_t AliAnalysisTaskEmcalJetTriggerQA::FillHistograms() | |
437 | { | |
438 | // Fill histograms. | |
9e5eee5d | 439 | |
0714a353 | 440 | AliClusterContainer *clusCont = GetClusterContainer(0); |
9e5eee5d | 441 | if (clusCont) { |
442 | Int_t nclusters = clusCont->GetNClusters(); | |
0714a353 | 443 | TString arrName = clusCont->GetArrayName(); |
0531c107 | 444 | for (Int_t ic = 0; ic < nclusters; ic++) { |
9e5eee5d | 445 | AliVCluster *cluster = static_cast<AliVCluster*>(clusCont->GetCluster(ic)); |
0531c107 | 446 | if (!cluster) { |
0714a353 | 447 | AliDebug(2,Form("Could not receive cluster %d", ic)); |
0531c107 | 448 | continue; |
449 | } | |
9e5eee5d | 450 | if (!cluster->IsEMCAL()) { |
0714a353 | 451 | AliDebug(2,Form("%s: Cluster is not emcal",GetName())); |
9e5eee5d | 452 | continue; |
453 | } | |
0531c107 | 454 | |
455 | TLorentzVector lp; | |
456 | cluster->GetMomentum(lp, const_cast<Double_t*>(fVertex)); | |
457 | ||
458 | //Fill eta,phi,E of clusters here | |
459 | fh3EEtaPhiCluster->Fill(lp.E(),lp.Eta(),lp.Phi()); | |
0714a353 | 460 | |
461 | if(fCaloCells) { | |
462 | Double_t leadCellE = GetEnergyLeadingCell(cluster); | |
463 | Double_t leadCellT = cluster->GetTOF();//fCaloCells->GetCellTime(absId); | |
464 | fh3EClusELeadingCellVsTime->Fill(lp.E(),leadCellE,leadCellT*1e9); | |
465 | } | |
0531c107 | 466 | } |
467 | } | |
468 | ||
992189ac | 469 | if(fCaloCells) { |
470 | const Short_t nCells = fCaloCells->GetNumberOfCells(); | |
471 | ||
472 | for(Int_t iCell=0; iCell<nCells; ++iCell) { | |
473 | Short_t cellId = fCaloCells->GetCellNumber(iCell); | |
474 | Double_t cellE = fCaloCells->GetCellAmplitude(cellId); | |
475 | Double_t cellT = fCaloCells->GetCellTime(cellId); | |
476 | ||
477 | AliDebug(2,Form("cell energy = %f time = %f",cellE,cellT*1e9)); | |
478 | fh2CellEnergyVsTime->Fill(cellE,cellT*1e9); | |
992189ac | 479 | } |
992189ac | 480 | } |
481 | ||
0531c107 | 482 | Double_t ptLeadJet1 = 0.; |
483 | Double_t ptLeadJet2 = 0.; | |
484 | ||
485 | TArrayI *nJetsArr = new TArrayI(fh2NJetsPtFull->GetNbinsY()+1); | |
486 | nJetsArr->Reset(0); | |
487 | nJetsArr->Set(fh2NJetsPtFull->GetNbinsY()+1); | |
488 | ||
9e5eee5d | 489 | if (GetJetContainer(fContainerFull)) { |
490 | const Int_t njets = GetNJets(fContainerFull); | |
0531c107 | 491 | for (Int_t ij = 0; ij < njets; ij++) { |
492 | ||
9e5eee5d | 493 | AliEmcalJet* jet = GetAcceptJetFromArray(ij,fContainerFull); |
494 | if (!jet) | |
495 | continue; //jet not selected | |
496 | ||
0531c107 | 497 | Double_t jetPt = jet->Pt(); |
498 | if(jetPt>ptLeadJet1) ptLeadJet1=jetPt; | |
499 | fh3PtEtaPhiJetFull->Fill(jetPt,jet->Eta(),jet->Phi()); | |
500 | fh3PtEtaAreaJetFull->Fill(jetPt,jet->Eta(),jet->Area()); | |
501 | ||
502 | //count jets above certain pT threshold | |
503 | Int_t ptbin = fh2NJetsPtFull->GetYaxis()->FindBin(jetPt); | |
504 | for(Int_t iptbin = ptbin; iptbin<=fh2NJetsPtFull->GetNbinsY(); iptbin++) | |
505 | nJetsArr->AddAt(nJetsArr->At(iptbin)+1,iptbin); | |
506 | ||
507 | fh2PtNConstituentsCharged->Fill(jetPt,jet->GetNumberOfTracks()); | |
508 | fh2PtNConstituents->Fill(jetPt,jet->GetNumberOfConstituents()); | |
509 | ||
510 | fh2PtNEF->Fill(jetPt,jet->NEF()); | |
3c709670 | 511 | fh3NEFEtaPhi->Fill(jet->NEF(),jet->Eta(),jet->Phi()); |
512 | fh2NEFNConstituentsCharged->Fill(jet->NEF(),jet->GetNumberOfTracks()); | |
513 | fh2NEFNConstituentsNeutral->Fill(jet->NEF(),jet->GetNumberOfClusters()); | |
0531c107 | 514 | |
515 | AliVParticle *vp; | |
516 | Double_t sumPtCh = 0.; | |
517 | for(Int_t icc=0; icc<jet->GetNumberOfTracks(); icc++) { | |
518 | vp = static_cast<AliVParticle*>(jet->TrackAt(icc, fTracks)); | |
519 | if(!vp) continue; | |
520 | fh2Ptz->Fill(jetPt,GetZ(vp,jet)); | |
0531c107 | 521 | sumPtCh+=vp->Pt(); |
0531c107 | 522 | } |
523 | ||
524 | if(jet->GetNumberOfTracks()>0) | |
525 | fh2PtMeanPtConstituentsCharged->Fill(jetPt,sumPtCh/(double)(jet->GetNumberOfTracks()) ); | |
526 | ||
527 | ||
528 | AliVCluster *vc = 0x0; | |
529 | Double_t sumPtNe = 0.; | |
9e5eee5d | 530 | if (clusCont) { |
531 | for(Int_t icc=0; icc<jet->GetNumberOfClusters(); icc++) { | |
532 | vc = static_cast<AliVCluster*>(clusCont->GetCluster(icc)); | |
533 | if(!vc) continue; | |
534 | ||
535 | TLorentzVector lp; | |
536 | vc->GetMomentum(lp, const_cast<Double_t*>(fVertex)); | |
537 | sumPtNe+=lp.Pt(); | |
538 | ||
539 | } | |
0531c107 | 540 | |
9e5eee5d | 541 | if(jet->GetNumberOfClusters()>0) |
542 | fh2PtMeanPtConstituentsNeutral->Fill(jetPt,sumPtNe/(double)(jet->GetNumberOfClusters()) ); | |
0531c107 | 543 | } |
0531c107 | 544 | } //full jet loop |
545 | ||
546 | for(Int_t i=1; i<=fh2NJetsPtFull->GetNbinsY(); i++) { | |
547 | Int_t nJetsInEvent = nJetsArr->At(i); | |
548 | fh2NJetsPtFull->Fill(nJetsInEvent,fh2NJetsPtFull->GetYaxis()->GetBinCenter(i)); | |
549 | } | |
550 | ||
551 | } | |
552 | ||
553 | //Reset array to zero to also count charged jets | |
554 | nJetsArr->Reset(0); | |
555 | ||
556 | //Loop over charged jets | |
9e5eee5d | 557 | if (GetJetContainer(fContainerCharged)) { |
558 | const Int_t njets = GetNJets(fContainerCharged); | |
559 | for (Int_t ij = 0; ij < njets; ij++) { | |
0531c107 | 560 | |
9e5eee5d | 561 | AliEmcalJet* jet = GetAcceptJetFromArray(ij,fContainerCharged); |
562 | if (!jet) | |
563 | continue; //jet not selected | |
0531c107 | 564 | |
0531c107 | 565 | Double_t jetPt = jet->Pt(); |
566 | if(jetPt>ptLeadJet2) ptLeadJet2=jetPt; | |
567 | fh3PtEtaPhiJetCharged->Fill(jetPt,jet->Eta(),jet->Phi()); | |
568 | fh3PtEtaAreaJetCharged->Fill(jetPt,jet->Eta(),jet->Area()); | |
3c709670 | 569 | |
570 | AliVParticle *vp; | |
571 | for(Int_t icc=0; icc<jet->GetNumberOfTracks(); icc++) { | |
572 | vp = static_cast<AliVParticle*>(jet->TrackAt(icc, fTracks)); | |
573 | if(!vp) continue; | |
574 | fh2PtzCharged->Fill(jetPt,GetZ(vp,jet)); | |
575 | } | |
0531c107 | 576 | |
577 | //count jets above certain pT threshold | |
578 | Int_t ptbin = fh2NJetsPtCharged->GetYaxis()->FindBin(jetPt); | |
579 | for(Int_t iptbin = ptbin; iptbin<=fh2NJetsPtCharged->GetNbinsY(); iptbin++) | |
580 | nJetsArr->AddAt(nJetsArr->At(iptbin)+1,iptbin); | |
581 | ||
582 | }//ch jet loop | |
583 | for(Int_t i=1; i<=fh2NJetsPtCharged->GetNbinsY(); i++) { | |
584 | Int_t nJetsInEvent = nJetsArr->At(i); | |
585 | fh2NJetsPtCharged->Fill(nJetsInEvent,fh2NJetsPtCharged->GetYaxis()->GetBinCenter(i)); | |
586 | } | |
587 | } | |
588 | ||
9e5eee5d | 589 | if(GetJetContainer(fContainerFull) && GetJetContainer(fContainerCharged)) { |
0531c107 | 590 | fh2PtLeadJet1VsLeadJet2->Fill(ptLeadJet1,ptLeadJet2); |
591 | } | |
592 | ||
593 | fh3PtLeadJet1VsPatchEnergy->Fill(ptLeadJet1,fMaxPatchEnergy,fTriggerType); | |
594 | fh3PtLeadJet2VsPatchEnergy->Fill(ptLeadJet2,fMaxPatchEnergy,fTriggerType); | |
595 | ||
596 | if(nJetsArr) delete nJetsArr; | |
597 | ||
598 | return kTRUE; | |
599 | } | |
600 | ||
601 | //________________________________________________________________________ | |
602 | Bool_t AliAnalysisTaskEmcalJetTriggerQA::Run() | |
603 | { | |
604 | // Run analysis code here, if needed. It will be executed before FillHistograms(). | |
605 | ||
606 | //Check if event is selected (vertex & pile-up) | |
607 | if(!SelectEvent()) | |
608 | return kFALSE; | |
609 | ||
610 | LoadExtraBranches(); | |
611 | ||
609c7a0d | 612 | if(!fTriggerClass.IsNull()) |
613 | FindTriggerPatch(); | |
0531c107 | 614 | |
615 | return kTRUE; // If return kFALSE FillHistogram() will NOT be executed. | |
616 | } | |
617 | ||
618 | //_______________________________________________________________________ | |
619 | void AliAnalysisTaskEmcalJetTriggerQA::Terminate(Option_t *) | |
620 | { | |
621 | // Called once at the end of the analysis. | |
622 | } | |
623 | //________________________________________________________________________ | |
624 | Double_t AliAnalysisTaskEmcalJetTriggerQA::GetZ(const AliVParticle *trk, const AliEmcalJet *jet) const | |
625 | { | |
626 | // Get Z of constituent trk | |
627 | ||
628 | return GetZ(trk->Px(),trk->Py(),trk->Pz(),jet->Px(),jet->Py(),jet->Pz()); | |
629 | } | |
630 | ||
631 | //________________________________________________________________________ | |
632 | Double_t AliAnalysisTaskEmcalJetTriggerQA::GetZ(const Double_t trkPx, const Double_t trkPy, const Double_t trkPz, const Double_t jetPx, const Double_t jetPy, const Double_t jetPz) const | |
633 | { | |
634 | // | |
635 | // Get the z of a constituent inside of a jet | |
636 | // | |
637 | ||
638 | Double_t pJetSq = jetPx*jetPx+jetPy*jetPy+jetPz*jetPz; | |
639 | ||
640 | if(pJetSq>0.) | |
641 | return (trkPx*jetPx+trkPy*jetPy+trkPz*jetPz)/pJetSq; | |
642 | else { | |
643 | AliWarning(Form("%s: strange, pjet*pjet seems to be zero pJetSq: %f",GetName(), pJetSq)); | |
644 | return 0; | |
645 | } | |
646 | } | |
0714a353 | 647 | |
648 | //________________________________________________________________________ | |
649 | Int_t AliAnalysisTaskEmcalJetTriggerQA::GetLeadingCellId(const AliVCluster *clus) const | |
650 | { | |
651 | //Get energy of leading cell in cluster | |
652 | ||
653 | if(!fCaloCells) | |
654 | return -1; | |
655 | ||
656 | Double_t emax = -1.; | |
657 | Int_t iCellAbsIdMax = -1; | |
658 | Int_t nCells = clus->GetNCells(); | |
659 | for(Int_t i = 0; i<nCells; i++) { | |
660 | Int_t absId = clus->GetCellAbsId(i); | |
661 | Double_t cellE = fCaloCells->GetCellAmplitude(absId); | |
662 | if(cellE>emax) { | |
663 | emax = cellE; | |
664 | iCellAbsIdMax = absId; | |
665 | } | |
666 | } | |
667 | ||
668 | return iCellAbsIdMax; | |
669 | } | |
670 | ||
671 | //________________________________________________________________________ | |
672 | Double_t AliAnalysisTaskEmcalJetTriggerQA::GetEnergyLeadingCell(const AliVCluster *clus) const | |
673 | { | |
674 | //Get energy of leading cell in cluster | |
675 | if(!fCaloCells) | |
676 | return -1.; | |
677 | ||
678 | Int_t absID = GetLeadingCellId(clus); | |
679 | if(absID>-1) | |
680 | return fCaloCells->GetCellAmplitude(absID); | |
681 | else | |
682 | return -1.; | |
683 | ||
684 | } |