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