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