AliPhysics  a9863a5 (a9863a5)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalJetQA.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 #include <cstring>
17 
18 #include <TClonesArray.h>
19 #include <TH1F.h>
20 #include <TH2F.h>
21 #include <TH3F.h>
22 #include <THnSparse.h>
23 #include <THashList.h>
24 
25 #include "AliParticleContainer.h"
26 #include "AliClusterContainer.h"
27 #include "AliTrackContainer.h"
28 #include "AliCentrality.h"
29 #include "AliVCluster.h"
30 #include "AliVParticle.h"
31 #include "AliVTrack.h"
32 #include "AliLog.h"
33 #include "AliEMCALGeometry.h"
34 #include "AliEMCALGeoParams.h"
35 #include "AliPicoTrack.h"
36 #include "AliVVZERO.h"
37 #include "AliESDUtils.h"
38 
40 
42 
43 //________________________________________________________________________
46  fCellEnergyCut(0.05),
47  fParticleLevel(kFALSE),
48  fIsMC(kFALSE),
49  fCentMethod2(""),
50  fCentMethod3(""),
51  fDoV0QA(0),
52  fDoEPQA(0),
53  fDoLeadingObjectPosition(0),
54  fMaxCellsInCluster(50),
55  fPtBinWidth(0.5),
56  fMaxPt(150),
57  fSeparateEMCalDCal(kTRUE),
58  fIsEmbedded(kFALSE),
59  fCent2(0),
60  fCent3(0),
61  fVZERO(0),
62  fV0ATotMult(0),
63  fV0CTotMult(0),
64  fNTotTracks(0),
65  fLeadingTrack(),
66  fHistManager("AliAnalysisTaskEmcalJetQA")
67 {
68  // Default constructor.
69 
70  memset(fNTotClusters, 0, sizeof(Int_t)*2);
71  memset(fLeadingCluster, 0, sizeof(AliVCluster*)*2);
72 
73  SetMakeGeneralHistograms(kTRUE);
74 }
75 
76 //________________________________________________________________________
78  AliAnalysisTaskEmcalLight(name, kTRUE),
79  fCellEnergyCut(0.05),
80  fParticleLevel(kFALSE),
81  fIsMC(kFALSE),
82  fCentMethod2(""),
83  fCentMethod3(""),
84  fDoV0QA(0),
85  fDoEPQA(0),
86  fDoLeadingObjectPosition(0),
87  fMaxCellsInCluster(50),
88  fPtBinWidth(0.5),
89  fMaxPt(150),
90  fSeparateEMCalDCal(kTRUE),
91  fIsEmbedded(kFALSE),
92  fCent2(0),
93  fCent3(0),
94  fVZERO(0),
95  fV0ATotMult(0),
96  fV0CTotMult(0),
97  fNTotTracks(0),
98  fLeadingTrack(),
99  fHistManager(name)
100 {
101  // Standard
102 
103  memset(fNTotClusters, 0, sizeof(Int_t)*2);
104  memset(fLeadingCluster, 0, sizeof(AliVCluster*)*2);
105 
107 }
108 
109 //________________________________________________________________________
111 {
112  // Destructor
113 }
114 
115 //________________________________________________________________________
117 {
118  // Create histograms
119 
121 
122  AliEmcalContainer* cont = 0;
123 
124  TString histname;
125  TString title;
126 
127  Int_t nPtBins = TMath::CeilNint(fMaxPt / fPtBinWidth);
128 
129  TIter nextPartColl(&fParticleCollArray);
130  while ((cont = static_cast<AliEmcalContainer*>(nextPartColl()))) {
131  fHistManager.CreateHistoGroup(cont->GetArrayName());
132  if (!fParticleLevel && fIsMC) {
133  for (Int_t i = 0; i < fNcentBins; i++) {
134  histname = TString::Format("%s/fHistTrNegativeLabels_%d", cont->GetArrayName().Data(), i);
135  title = histname + ";% of negative labels;counts";
136  fHistManager.CreateTH1(histname.Data(), title.Data(), 500, 0, 1);
137 
138  histname = TString::Format("%s/fHistTrZeroLabels_%d", cont->GetArrayName().Data(), i);
139  title = histname + ";% of zero labels;counts";
140  fHistManager.CreateTH1(histname.Data(), title.Data(), 500, 0, 1);
141  }
142  }
143 
144  Int_t nlabels = 4;
145  if (fParticleLevel) nlabels = 1;
146 
147  for (Int_t i = 0; i < fNcentBins; i++) {
148  histname = TString::Format("%s/fHistRejectionReason_%d", cont->GetArrayName().Data(), i);
149  title = histname + ";Rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
150  TH2* hist = fHistManager.CreateTH2(histname.Data(), title.Data(), 32, 0, 32, 40, 0, 100);
151  SetRejectionReasonLabels(hist->GetXaxis());
152 
153  for (Int_t j = 0; j < nlabels; j++) {
154  histname = TString::Format("%s/fHistTrPhiEtaPt_%d_%d", cont->GetArrayName().Data(), i, j);
155  title = histname + ";#eta;#phi;#it{p}_{T} (GeV/#it{c})";
156  fHistManager.CreateTH3(histname.Data(), title.Data(), 100, -1, 1, 100, 0, TMath::TwoPi(), nPtBins, 0, fMaxPt);
157  }
158 
159  if (!fParticleLevel) {
160  if (fIsMC) {
161  histname = TString::Format("%s/fHistTrPhiEtaZeroLab_%d", cont->GetArrayName().Data(), i);
162  title = histname + ";#eta;#phi;counts";
163  fHistManager.CreateTH2(histname.Data(), title.Data(), 100, -1, 1, 100, 0, TMath::TwoPi());
164 
165  histname = TString::Format("%s/fHistTrPtZeroLab_%d", cont->GetArrayName().Data(), i);
166  title = histname + ";#it{p}_{T} (GeV/#it{c});counts";
167  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
168  }
169 
170  histname = TString::Format("%s/fHistTrEmcPhiEta_%d", cont->GetArrayName().Data(), i);
171  title = histname + ";#eta;#phi;counts";
172  fHistManager.CreateTH2(histname.Data(), title.Data(), 100, -1, 1, 100, 0, TMath::TwoPi());
173 
174  histname = TString::Format("%s/fHistTrEmcPt_%d", cont->GetArrayName().Data(), i);
175  title = histname + ";#it{p}_{T} (GeV/#it{c});counts";
176  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
177 
178  histname = TString::Format("%s/fHistTrPhiEtaNonProp_%d", cont->GetArrayName().Data(), i);
179  title = histname + ";#eta;#phi;counts";
180  fHistManager.CreateTH2(histname.Data(), title.Data(), 100, -1, 1, 100, 0, TMath::TwoPi());
181 
182  histname = TString::Format("%s/fHistTrPtNonProp_%d", cont->GetArrayName().Data(), i);
183  title = histname + ";#it{p}_{T} (GeV/#it{c});counts";
184  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
185 
186  histname = TString::Format("%s/fHistDeltaEtaPt_%d", cont->GetArrayName().Data(), i);
187  title = histname + ";#it{p}_{T} (GeV/#it{c});#delta#eta;counts";
188  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 50, -0.5, 0.5);
189 
190  histname = TString::Format("%s/fHistDeltaPhiPt_%d", cont->GetArrayName().Data(), i);
191  title = histname + ";#it{p}_{T} (GeV/#it{c});#delta#phi;counts";
192  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 200, -2, 2);
193 
194  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", cont->GetArrayName().Data(), i);
195  title = histname + ";#it{p}_{T} (GeV/#it{c});#delta#it{p}_{T} (GeV/#it{c});counts";
196  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins, -fMaxPt/2, fMaxPt/2);
197  }
198  }
199  }
200 
201  TIter nextClusColl(&fClusterCollArray);
202  while ((cont = static_cast<AliEmcalContainer*>(nextClusColl()))) {
203  fHistManager.CreateHistoGroup(cont->GetArrayName());
204  for (Int_t i = 0; i < fNcentBins; i++) {
205  histname = TString::Format("%s/fHistRejectionReason_%d", cont->GetArrayName().Data(), i);
206  title = histname + ";Rejection reason;#it{E}_{cluster} (GeV);counts";
207  TH2* hist = fHistManager.CreateTH2(histname.Data(), title.Data(), 32, 0, 32, 40, 0, 100);
208  SetRejectionReasonLabels(hist->GetXaxis());
209 
210  histname = TString::Format("%s/fHistClusPosition_%d", cont->GetArrayName().Data(), i);
211  title = histname + ";#it{x} (cm);#it{y} (cm);#it{z} (cm)";
212  fHistManager.CreateTH3(histname.Data(), title.Data(), 50, -500, 500, 50, -500, 500, 50, -500, 500);
213 
214  histname = TString::Format("%s/fHistClusPhiEtaEnergy_%d", cont->GetArrayName().Data(), i);
215  title = histname + ";#eta;#phi;#it{E}_{cluster} (GeV)";
216  fHistManager.CreateTH3(histname.Data(), title.Data(), 50, -1, 1, 50, 0, TMath::TwoPi(), nPtBins, 0, fMaxPt);
217 
218  if (fForceBeamType != kpp) {
219  histname = TString::Format("%s/fHistClusDeltaPhiEPEnergy_%d", cont->GetArrayName().Data(), i);
220  title = histname + ";#it{E}_{cluster} (GeV);#phi_{cluster} - #psi_{EP};counts";
221  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 100, 0, TMath::Pi());
222  }
223 
224  if (fIsEmbedded) {
225  histname = TString::Format("%s/fHistClusMCEnergyFraction_%d", cont->GetArrayName().Data(), i);
226  title = histname + ";MC fraction;counts";
227  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, 1.2);
228  }
229 
230  histname = TString::Format("%s/fHistClusTimeEnergy_%d", cont->GetArrayName().Data(), i);
231  title = histname + ";#it{E}_{cluster} (GeV);time (s);counts";
232  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins, -1e-6, 1e-6);
233 
234  Int_t nbins = fMaxCellsInCluster;
235  while (nbins > nPtBins) nbins /= 2;
236  histname = TString::Format("%s/fHistNCellsEnergy_%d", cont->GetArrayName().Data(), i);
237  title = histname + ";#it{E}_{cluster} (GeV);#it{N}_{cells};counts";
238  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nbins, -0.5, fMaxCellsInCluster-0.5);
239 
240  histname = TString::Format("%s/fHistFcrossEnergy_%d", cont->GetArrayName().Data(), i);
241  title = histname + ";#it{E}_{cluster} (GeV);#it{F}_{cross};counts";
242  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 200, -3.5, 1.5);
243 
244  histname = TString::Format("%s/fHistClusEnergy_%d", cont->GetArrayName().Data(), i);
245  title = histname + ";#it{E}_{cluster} (GeV);counts";
246  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
247 
248  histname = TString::Format("%s/fHistClusNonLinCorrEnergy_%d", cont->GetArrayName().Data(), i);
249  title = histname + ";#it{E}_{cluster} (GeV);counts";
250  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
251 
252  histname = TString::Format("%s/fHistClusHadCorrEnergy_%d", cont->GetArrayName().Data(), i);
253  title = histname + ";#it{E}_{cluster} (GeV);counts";
254  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
255  }
256  }
257 
258  if (!fCaloCellsName.IsNull()) {
259  fHistManager.CreateHistoGroup(fCaloCellsName);
260  for (Int_t i = 0; i < fNcentBins; i++) {
261  histname = TString::Format("%s/fHistCellsAbsIdEnergy_%d", fCaloCellsName.Data(), i);
262  title = histname + ";cell abs. Id;#it{E}_{cell} (GeV);counts";
263  fHistManager.CreateTH2(histname.Data(), title.Data(), 20000,0,20000,(Int_t)(nPtBins / 2), 0, fMaxPt / 2);
264  }
265  }
266 
267  Int_t dim = 0;
268  TString axistitle[40];
269  Int_t nbins[40] = {0};
270  Double_t min[40] = {0};
271  Double_t max[40] = {0};
272 
274  axistitle[dim] = "Centrality %";
275  nbins[dim] = 101;
276  min[dim] = 0;
277  max[dim] = 101;
278  dim++;
279 
280  if (!fCentMethod2.IsNull()) {
281  axistitle[dim] = Form("Centrality %s %%", fCentMethod2.Data());
282  nbins[dim] = 101;
283  min[dim] = 0;
284  max[dim] = 101;
285  dim++;
286  }
287 
288  if (!fCentMethod3.IsNull()) {
289  axistitle[dim] = Form("Centrality %s %%", fCentMethod3.Data());
290  nbins[dim] = 101;
291  min[dim] = 0;
292  max[dim] = 101;
293  dim++;
294  }
295 
296  if (fDoV0QA==1) {
297  axistitle[dim] = "V0A total multiplicity";
298  nbins[dim] = 200;
299  min[dim] = 0;
300  max[dim] = 20000;
301  dim++;
302 
303  axistitle[dim] = "V0C total multiplicity";
304  nbins[dim] = 200;
305  min[dim] = 0;
306  max[dim] = 20000;
307  dim++;
308  }
309  else if (fDoV0QA==2) {
310  axistitle[dim] = "V0A+V0C total multiplicity";
311  nbins[dim] = 300;
312  min[dim] = 0;
313  max[dim] = 30000;
314  dim++;
315  }
316 
317  if (fDoEPQA) {
318  axistitle[dim] = "#psi_{EP}";
319  nbins[dim] = 200;
320  min[dim] = -TMath::Pi();
321  max[dim] = TMath::Pi();
322  dim++;
323  }
324  }
325 
326  if (fParticleCollArray.GetEntriesFast()>0) {
327  axistitle[dim] = "No. of tracks";
329  nbins[dim] = 3000;
330  min[dim] = -0.5;
331  max[dim] = 6000-0.5;
332  }
333  else {
334  nbins[dim] = 200;
335  min[dim] = 0;
336  max[dim] = 200;
337  }
338  dim++;
339 
340  axistitle[dim] = "#it{p}_{T,track}^{leading} (GeV/c)";
341  nbins[dim] = nPtBins;
342  min[dim] = 0;
343  max[dim] = fMaxPt;
344  dim++;
345 
347  axistitle[dim] = "#eta_{track}^{leading}";
348  nbins[dim] = 100;
349  min[dim] = -1;
350  max[dim] = 1;
351  dim++;
352 
353  axistitle[dim] = "#phi_{track}^{leading}";
354  nbins[dim] = 100;
355  min[dim] = 0;
356  max[dim] = TMath::TwoPi();
357  dim++;
358  }
359  }
360 
361  if (fClusterCollArray.GetEntriesFast()>0) {
362  axistitle[dim] = "No. of clusters";
363 
365  nbins[dim] = 2000;
366  min[dim] = -0.5;
367  max[dim] = 4000-0.5;
368  }
369  else {
370  nbins[dim] = 200;
371  min[dim] = 0;
372  max[dim] = 200;
373  }
374  dim++;
375 
376  if (fSeparateEMCalDCal) {
377  axistitle[dim] = "#it{E}_{EMCal cluster}^{leading} (GeV)";
378  nbins[dim] = nPtBins;
379  min[dim] = 0;
380  max[dim] = fMaxPt;
381  dim++;
382 
383  axistitle[dim] = "#it{E}_{DCal cluster}^{leading} (GeV)";
384  nbins[dim] = nPtBins;
385  min[dim] = 0;
386  max[dim] = fMaxPt;
387  dim++;
388 
390  axistitle[dim] = "#eta_{EMCal cluster}^{leading}";
391  nbins[dim] = 100;
392  min[dim] = -1;
393  max[dim] = 1;
394  dim++;
395 
396  axistitle[dim] = "#phi_{EMCal cluster}^{leading}";
397  nbins[dim] = 100;
398  min[dim] = 0;
399  max[dim] = TMath::TwoPi();
400  dim++;
401 
402  axistitle[dim] = "#eta_{DCal cluster}^{leading}";
403  nbins[dim] = 100;
404  min[dim] = -1;
405  max[dim] = 1;
406  dim++;
407 
408  axistitle[dim] = "#phi_{DCal cluster}^{leading}";
409  nbins[dim] = 100;
410  min[dim] = 0;
411  max[dim] = TMath::TwoPi();
412  dim++;
413  }
414  }
415  else {
416  axistitle[dim] = "#it{E}_{cluster}^{leading} (GeV)";
417  nbins[dim] = nPtBins;
418  min[dim] = 0;
419  max[dim] = fMaxPt;
420  dim++;
421 
423  axistitle[dim] = "#eta_{cluster}^{leading}";
424  nbins[dim] = 100;
425  min[dim] = -1;
426  max[dim] = 1;
427  dim++;
428 
429  axistitle[dim] = "#phi_{cluster}^{leading}";
430  nbins[dim] = 100;
431  min[dim] = 0;
432  max[dim] = TMath::TwoPi();
433  dim++;
434  }
435  }
436  }
437 
438  if (!fCaloCellsName.IsNull()) {
439  axistitle[dim] = "No. of cells";
440 
442  nbins[dim] = 5000;
443  min[dim] = -0.5;
444  max[dim] = 10000-0.5;
445  }
446  else {
447  nbins[dim] = 500;
448  min[dim] = -0.5;
449  max[dim] = 500-0.5;
450  }
451 
452  dim++;
453  }
454 
455  THnSparse* hn = fHistManager.CreateTHnSparse("fHistEventQA","fHistEventQA",dim,nbins,min,max);
456  for (Int_t i = 0; i < dim; i++)
457  hn->GetAxis(i)->SetTitle(axistitle[i]);
458 
459  fOutput->Add(fHistManager.GetListOfHistograms());
460 
461  PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
462 }
463 
464 //________________________________________________________________________
466 {
467  if (fClusterCollArray.GetEntriesFast() == 0 && fCaloCellsName.IsNull()) {
468  fNeedEmcalGeom = kFALSE;
469  }
470  else {
471  fNeedEmcalGeom = kTRUE;
472  }
473 
475 
476  if (fDoV0QA) {
477  fVZERO = InputEvent()->GetVZEROData();
478  if (!fVZERO) {
479  AliError("AliVVZERO not available");
480  }
481  }
482 }
483 
484 //________________________________________________________________________
486 {
487  // Retrieve event objects.
488 
490 
491  if (!fCentMethod2.IsNull() || !fCentMethod3.IsNull()) {
492  if (fBeamType == kAA || fBeamType == kpA ) {
493  AliCentrality *aliCent = InputEvent()->GetCentrality();
494  if (aliCent) {
495  if (!fCentMethod2.IsNull())
496  fCent2 = aliCent->GetCentralityPercentile(fCentMethod2);
497  if (!fCentMethod3.IsNull())
498  fCent3 = aliCent->GetCentralityPercentile(fCentMethod3);
499  }
500  }
501  }
502 
503  if (fVZERO) {
504  fV0ATotMult = AliESDUtils::GetCorrV0A(fVZERO->GetMTotV0A(),fVertex[2]);
505  fV0CTotMult = AliESDUtils::GetCorrV0C(fVZERO->GetMTotV0C(),fVertex[2]);
506  }
507 
508  return kTRUE;
509 }
510 
511 //________________________________________________________________________
513 {
514  // Fill histograms.
515 
516  EventQA_t eventQA;
517 
518  DoTrackLoop();
519  AliDebug(2,Form("%d tracks found in the event", fNTotTracks));
520  eventQA.fMaxTrack = fLeadingTrack;
521 
522  DoClusterLoop();
523  AliDebug(2,Form("%d clusters found in EMCal and %d in DCal", fNTotClusters[0], fNTotClusters[1]));
524  for (Int_t i = 0; i < 2; i++) {
525  if (!fLeadingCluster[i]) continue;
526  fLeadingCluster[i]->GetMomentum(eventQA.fMaxCluster[i], fVertex);
527  }
528 
529  if (fCaloCells) {
530  eventQA.fNCells = DoCellLoop();
531  AliDebug(2,Form("%d cells found in the event", eventQA.fNCells));
532  }
533 
534  eventQA.fCent = fCent;
535  eventQA.fCent2 = fCent2;
536  eventQA.fCent3 = fCent3;
537  eventQA.fV0A = fV0ATotMult;
538  eventQA.fV0C = fV0CTotMult;
539  eventQA.fEP = fEPV0;
540  eventQA.fNTracks = fNTotTracks;
541  eventQA.fNClusters[0] = fNTotClusters[0];
542  eventQA.fNClusters[1] = fNTotClusters[1];
543 
544  FillEventQAHisto(eventQA);
545 
546  return kTRUE;
547 }
548 
549 //________________________________________________________________________
551 {
552  Double_t contents[40]={0};
553 
554  Int_t globalNclusters = eventQA.fNClusters[0] + eventQA.fNClusters[1];
555 
556  AliTLorentzVector globalMaxCluster = eventQA.fMaxCluster[0].E() > eventQA.fMaxCluster[1].E() ?
557  eventQA.fMaxCluster[0] : eventQA.fMaxCluster[1];
558 
559  THnSparse* histEventQA = static_cast<THnSparse*>(fHistManager.FindObject("fHistEventQA"));
560 
561  for (Int_t i = 0; i < histEventQA->GetNdimensions(); i++) {
562  TString title(histEventQA->GetAxis(i)->GetTitle());
563  if (title=="Centrality %")
564  contents[i] = eventQA.fCent;
565  else if (title==Form("Centrality %s %%", fCentMethod2.Data()))
566  contents[i] = eventQA.fCent2;
567  else if (title==Form("Centrality %s %%", fCentMethod3.Data()))
568  contents[i] = eventQA.fCent3;
569  else if (title=="V0A total multiplicity")
570  contents[i] = eventQA.fV0A;
571  else if (title=="V0C total multiplicity")
572  contents[i] = eventQA.fV0C;
573  else if (title=="V0A+V0C total multiplicity")
574  contents[i] = eventQA.fV0A+eventQA.fV0C;
575  else if (title=="#psi_{RP}")
576  contents[i] = eventQA.fEP;
577  else if (title=="No. of tracks")
578  contents[i] = eventQA.fNTracks;
579  else if (title=="No. of clusters")
580  contents[i] = globalNclusters;
581  else if (title=="No. of cells")
582  contents[i] = eventQA.fNCells;
583  else if (title=="#it{p}_{T,track}^{leading} (GeV/c)")
584  contents[i] = eventQA.fMaxTrack.Pt();
585  else if (title=="#eta_{track}^{leading}")
586  contents[i] = eventQA.fMaxTrack.Eta();
587  else if (title=="#phi_{track}^{leading}")
588  contents[i] = eventQA.fMaxTrack.Phi_0_2pi();
589  else if (title=="#it{E}_{cluster}^{leading} (GeV)")
590  contents[i] = globalMaxCluster.E();
591  else if (title=="#eta_{cluster}^{leading}")
592  contents[i] = globalMaxCluster.Eta();
593  else if (title=="#phi_{cluster}^{leading}")
594  contents[i] = globalMaxCluster.Phi();
595  else if (title=="#it{E}_{EMCal cluster}^{leading} (GeV)")
596  contents[i] = eventQA.fMaxCluster[0].E();
597  else if (title=="#eta_{EMCal cluster}^{leading}")
598  contents[i] = eventQA.fMaxCluster[0].Phi_0_2pi();
599  else if (title=="#phi_{EMCal cluster}^{leading}")
600  contents[i] = eventQA.fMaxCluster[0].Eta();
601  else if (title=="#it{E}_{DCal cluster}^{leading} (GeV)")
602  contents[i] = eventQA.fMaxCluster[1].E();
603  else if (title=="#phi_{DCal cluster}^{leading}")
604  contents[i] = eventQA.fMaxCluster[1].Phi_0_2pi();
605  else if (title=="#eta_{DCal cluster}^{leading}")
606  contents[i] = eventQA.fMaxCluster[1].Eta();
607  else
608  AliWarning(Form("Unable to fill dimension %s!",title.Data()));
609  }
610 
611  histEventQA->Fill(contents);
612 }
613 
614 //________________________________________________________________________
616 {
617  // Do cell loop.
618 
619  if (!fCaloCells) return 0;
620 
621  TString histname = TString::Format("%s/fHistCellsAbsIdEnergy_%d", fCaloCellsName.Data(), fCentBin);
622 
623  const Int_t ncells = fCaloCells->GetNumberOfCells();
624  Int_t nAccCells = 0;
625 
626  for (Int_t pos = 0; pos < ncells; pos++) {
627  Float_t amp = fCaloCells->GetAmplitude(pos);
628  Int_t absId = fCaloCells->GetCellNumber(pos);
629 
630  if (amp < fCellEnergyCut) continue;
631 
632  fHistManager.FillTH2(histname, absId,amp);
633  nAccCells++;
634  }
635 
636  return nAccCells;
637 }
638 
639 //________________________________________________________________________
640 Double_t AliAnalysisTaskEmcalJetQA::GetFcross(AliVCluster *cluster, AliVCaloCells *cells)
641 {
642  Int_t AbsIdseed = -1;
643  Double_t Eseed = 0;
644  for (Int_t i = 0; i < cluster->GetNCells(); i++) {
645  if (cells->GetCellAmplitude(cluster->GetCellAbsId(i)) > Eseed) {
646  Eseed = cells->GetCellAmplitude(cluster->GetCellAbsId(i));
647  AbsIdseed = cluster->GetCellAbsId(i);
648  }
649  }
650 
651  if (Eseed < 1e-9)
652  return 100;
653 
654  Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
655  fGeom->GetCellIndex(AbsIdseed,imod,iTower,iIphi,iIeta);
656  fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi,iIeta,iphi,ieta);
657 
658  //Get close cells index and energy, not in corners
659 
660  Int_t absID1 = -1;
661  Int_t absID2 = -1;
662 
663  if (iphi < AliEMCALGeoParams::fgkEMCALRows-1) absID1 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
664  if (iphi > 0) absID2 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
665 
666  // In case of cell in eta = 0 border, depending on SM shift the cross cell index
667 
668  Int_t absID3 = -1;
669  Int_t absID4 = -1;
670 
671  if (ieta == AliEMCALGeoParams::fgkEMCALCols-1 && !(imod%2)) {
672  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod+1, iphi, 0);
673  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
674  }
675  else if (ieta == 0 && imod%2) {
676  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
677  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod-1, iphi, AliEMCALGeoParams::fgkEMCALCols-1);
678  }
679  else {
680  if (ieta < AliEMCALGeoParams::fgkEMCALCols-1)
681  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
682  if (ieta > 0)
683  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
684  }
685 
686  Double_t ecell1 = cells->GetCellAmplitude(absID1);
687  Double_t ecell2 = cells->GetCellAmplitude(absID2);
688  Double_t ecell3 = cells->GetCellAmplitude(absID3);
689  Double_t ecell4 = cells->GetCellAmplitude(absID4);
690 
691  Double_t Ecross = ecell1 + ecell2 + ecell3 + ecell4;
692 
693  Double_t Fcross = 1 - Ecross/Eseed;
694 
695  return Fcross;
696 }
697 
698 //________________________________________________________________________
700 {
701  // Do cluster loop.
702 
703  TString histname;
704 
705  memset(fNTotClusters, 0, sizeof(Int_t)*2);
706  memset(fLeadingCluster, 0, sizeof(AliVCluster*)*2);
707 
708  AliClusterContainer* clusters = 0;
709  TIter nextClusColl(&fClusterCollArray);
710  while ((clusters = static_cast<AliClusterContainer*>(nextClusColl()))) {
711  // Cluster loop
712  AliVCluster* cluster = 0;
713  clusters->ResetCurrentID();
714  while ((cluster = clusters->GetNextCluster())) {
715  AliTLorentzVector nPart;
716  Double_t energy = 0;
717 
718  if (clusters->GetDefaultClusterEnergy() >= 0 && clusters->GetDefaultClusterEnergy() <= AliVCluster::kLastUserDefEnergy) {
719  energy = cluster->GetUserDefEnergy(clusters->GetDefaultClusterEnergy());
720  cluster->GetMomentum(nPart, fVertex, (AliVCluster::VCluUserDefEnergy_t)clusters->GetDefaultClusterEnergy());
721  }
722  else {
723  energy = cluster->E();
724  cluster->GetMomentum(nPart, fVertex);
725  }
726 
727  if (energy <= 0) continue;
728 
729  UInt_t rejectionReason = 0;
730  if (!clusters->AcceptCluster(clusters->GetCurrentID(), rejectionReason)) {
731  histname = TString::Format("%s/fHistRejectionReason_%d", clusters->GetArrayName().Data(), fCentBin);
732  fHistManager.FillTH2(histname, clusters->GetRejectionReasonBitPosition(rejectionReason), energy);
733  continue;
734  }
735 
736  Float_t pos[3]={0};
737  cluster->GetPosition(pos);
738  histname = TString::Format("%s/fHistClusPosition_%d", clusters->GetArrayName().Data(), fCentBin);
739  fHistManager.FillTH3(histname, pos[0], pos[1], pos[2]);
740 
741  Double_t phi = nPart.Phi_0_2pi();
742 
743  Int_t isDcal = Int_t(phi > fgkEMCalDCalPhiDivide);
744 
745  histname = TString::Format("%s/fHistClusPhiEtaEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
746  fHistManager.FillTH3(histname, nPart.Eta(), phi, energy);
747 
748  if (!fLeadingCluster[isDcal] || fLeadingCluster[isDcal]->E() < cluster->E()) fLeadingCluster[isDcal] = cluster;
749 
750  histname = TString::Format("%s/fHistClusDeltaPhiEPEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
751  if (fHistManager.FindObject(histname)) {
752  Double_t ep = nPart.Phi_0_2pi() - fEPV0;
753  while (ep < 0) ep += TMath::Pi();
754  while (ep >= TMath::Pi()) ep -= TMath::Pi();
755  fHistManager.FillTH2(histname, cluster->E(), ep);
756  }
757 
758  histname = TString::Format("%s/fHistNCellsEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
759  fHistManager.FillTH2(histname, cluster->E(), cluster->GetNCells());
760 
761  histname = TString::Format("%s/fHistClusTimeEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
762  fHistManager.FillTH2(histname, cluster->E(), cluster->GetTOF());
763 
764  if (fCaloCells) {
765  histname = TString::Format("%s/fHistFcrossEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
766  fHistManager.FillTH2(histname, cluster->E(), GetFcross(cluster, fCaloCells));
767  }
768 
769  histname = TString::Format("%s/fHistClusMCEnergyFraction_%d", clusters->GetArrayName().Data(), fCentBin);
770  if (fHistManager.FindObject(histname)) {
771  fHistManager.FillTH1(histname, cluster->GetMCEnergyFraction());
772  }
773 
774  histname = TString::Format("%s/fHistClusEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
775  fHistManager.FillTH1(histname, cluster->E());
776 
777  if (cluster->GetNonLinCorrEnergy() > 0.) {
778  histname = TString::Format("%s/fHistClusNonLinCorrEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
779  fHistManager.FillTH1(histname, cluster->GetNonLinCorrEnergy());
780  }
781 
782  if (cluster->GetHadCorrEnergy() > 0.) {
783  histname = TString::Format("%s/fHistClusHadCorrEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
784  fHistManager.FillTH1(histname, cluster->GetHadCorrEnergy());
785  }
786 
787  fNTotClusters[isDcal]++;
788  }
789  }
790 }
791 
792 //________________________________________________________________________
794 {
795  // Do track loop.
796 
797  Int_t neg = 0;
798  Int_t zero = 0;
799 
800  fNTotTracks = 0;
801  fLeadingTrack.SetPxPyPzE(0,0,0,0);
802 
803  TString histname;
804 
805  AliParticleContainer* particles = 0;
806  TIter nextPartColl(&fParticleCollArray);
807  while ((particles = static_cast<AliParticleContainer*>(nextPartColl()))) {
808  particles->ResetCurrentID();
809  AliVParticle* track = 0;
810  AliTLorentzVector mom;
811  while ((track = particles->GetNextParticle())) {
812  particles->GetMomentum(mom, particles->GetCurrentID());
813 
814  UInt_t rejectionReason = 0;
815  if (!particles->AcceptParticle(particles->GetCurrentID(), rejectionReason)) {
816  histname = TString::Format("%s/fHistRejectionReason_%d", particles->GetArrayName().Data(), fCentBin);
817  fHistManager.FillTH2(histname, particles->GetRejectionReasonBitPosition(rejectionReason), mom.Pt());
818  continue;
819  }
820 
821  fNTotTracks++;
822 
823  if (fLeadingTrack.Pt() < mom.Pt()) fLeadingTrack = mom;
824 
825  if (fParticleLevel) {
826  histname = TString::Format("%s/fHistTrPhiEtaPt_%d", particles->GetArrayName().Data(), fCentBin);
827  fHistManager.FillTH2(histname, mom.Eta(), mom.Phi_0_2pi(), mom.Pt());
828  }
829  else {
830  if (track->GetLabel() == 0) {
831  zero++;
832  histname = TString::Format("%s/fHistTrPhiEtaZeroLab_%d", particles->GetArrayName().Data(), fCentBin);
833  if (fHistManager.FindObject(histname)) {
834 
835  fHistManager.FillTH2(histname, mom.Eta(), mom.Phi_0_2pi());
836 
837  }
838  histname = TString::Format("%s/fHistTrPtZeroLab_%d", particles->GetArrayName().Data(), fCentBin);
839  if (fHistManager.FindObject(histname)) {
840  fHistManager.FillTH1(histname, mom.Pt());
841  }
842  }
843 
844  if (track->GetLabel() < 0) neg++;
845 
846  Int_t type = 0;
847  AliTrackContainer* tracks = dynamic_cast<AliTrackContainer*>(particles);
848 
849  if (tracks) {
850  // Track type (hybrid)
852  type = tracks->GetTrackType(tracks->GetCurrentID());
853  }
854 
855  // Track propagation to EMCal surface
856  AliVTrack* vtrack = static_cast<AliVTrack*>(track);
857 
858  if (vtrack->GetTrackEtaOnEMCal() == -999 || vtrack->GetTrackPhiOnEMCal() == -999) {
859  histname = TString::Format("%s/fHistTrPhiEtaNonProp_%d", particles->GetArrayName().Data(), fCentBin);
860  if (fHistManager.FindObject(histname)) {
861  fHistManager.FillTH2(histname, mom.Eta(), mom.Phi_0_2pi());
862  }
863  histname = TString::Format("%s/fHistTrPtNonProp_%d", particles->GetArrayName().Data(), fCentBin);
864  if (fHistManager.FindObject(histname)) {
865  fHistManager.FillTH1(histname, mom.Pt());
866  }
867  }
868  else {
869  histname = TString::Format("%s/fHistTrEmcPhiEta_%d", particles->GetArrayName().Data(), fCentBin);
870  if (fHistManager.FindObject(histname))
871  fHistManager.FillTH2(histname, vtrack->GetTrackEtaOnEMCal(), vtrack->GetTrackPhiOnEMCal());
872 
873  histname = TString::Format("%s/fHistTrEmcPt_%d", particles->GetArrayName().Data(), fCentBin);
874  if (fHistManager.FindObject(histname))
875  fHistManager.FillTH1(histname, vtrack->GetTrackPtOnEMCal());
876 
877  histname = TString::Format("%s/fHistDeltaEtaPt_%d", particles->GetArrayName().Data(), fCentBin);
878  if (fHistManager.FindObject(histname))
879  fHistManager.FillTH2(histname, mom.Pt(), mom.Eta() - vtrack->GetTrackEtaOnEMCal());
880 
881  histname = TString::Format("%s/fHistDeltaPhiPt_%d", particles->GetArrayName().Data(), fCentBin);
882  if (fHistManager.FindObject(histname))
883  fHistManager.FillTH2(histname, mom.Pt(), mom.Phi_0_2pi() - vtrack->GetTrackPhiOnEMCal());
884 
885  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", particles->GetArrayName().Data(), fCentBin);
886  if (fHistManager.FindObject(histname))
887  fHistManager.FillTH2(histname, mom.Pt(), mom.Pt() - vtrack->GetTrackPtOnEMCal());
888  }
889  }
890 
891  if (type >= 0 && type <= 3) {
892  histname = TString::Format("%s/fHistTrPhiEtaPt_%d_%d", particles->GetArrayName().Data(), fCentBin, type);
893  fHistManager.FillTH3(histname, mom.Eta(), mom.Phi_0_2pi(), mom.Pt());
894  }
895  else {
896  AliWarning(Form("%s: track type %d not recognized!", GetName(), type));
897  }
898  }
899  }
900 
901  histname = TString::Format("%s/fHistTrNegativeLabels_%d", particles->GetArrayName().Data(), fCentBin);
902  if (fHistManager.FindObject(histname))
903  fHistManager.FillTH1(histname, 1. * neg / fNTotTracks);
904 
905  histname = TString::Format("%s/fHistTrZeroLabels_%d", particles->GetArrayName().Data(), fCentBin);
906  if (fHistManager.FindObject(histname))
907  fHistManager.FillTH1(histname, 1. * zero / fNTotTracks);
908  }
909 }
AliVCluster * fLeadingCluster[2]
!Leading cluster in current event (EMCal/DCal)
Int_t fNcentBins
how many centrality bins
AliEMCALGeometry * fGeom
!emcal geometry
Float_t fMaxPt
Histogram pt limit.
EBeamType_t fBeamType
!event beam type
void FillEventQAHisto(const EventQA_t &eventQA)
Double_t fCent3
!Event centrality with method 3
const char * title
Definition: MakeQAPdf.C:26
TObjArray fClusterCollArray
cluster collection array
Bool_t fSeparateEMCalDCal
Separate EMCal from DCal in QA plots.
virtual Bool_t GetMomentum(TLorentzVector &mom, Int_t i) const
TString fCentMethod3
Centrality method 3.
Int_t fNTotTracks
!Total number of accepted tracks in current event
Double_t fEPV0
!event plane V0
TObjArray fParticleCollArray
particle/track collection array
Container with name, TClonesArray and cuts for particles.
Double_t GetFcross(AliVCluster *cluster, AliVCaloCells *cells)
Implementation of a task to perform basic QA on tracks and clusters.
Int_t fDoLeadingObjectPosition
Add axis for leading object position (eta-phi)
Double_t fV0CTotMult
!Event V0C total multiplicity
TString fCaloCellsName
name of calo cell collection
Bool_t fIsEmbedded
Embedded data present.
Container for particles within the EMCAL framework.
Int_t GetDefaultClusterEnergy() const
Int_t fMaxCellsInCluster
Maximum number (approx) of cells in a cluster.
Bool_t fParticleLevel
Set particle level analysis.
static Double_t fgkEMCalDCalPhiDivide
phi value used to distinguish between DCal and EMCal
EBeamType_t fForceBeamType
forced beam type
THistManager fHistManager
Histogram manager.
UShort_t GetRejectionReasonBitPosition(UInt_t rejectionReason) const
Int_t GetCurrentID() const
Int_t fDoV0QA
Add V0 QA histograms.
Base task in the EMCAL framework (lighter version of AliAnalysisTaskEmcal)
Double_t fVertex[3]
!event vertex
TString fCentMethod2
Centrality method 2.
Base class for container structures within the EMCAL framework.
virtual Bool_t AcceptCluster(Int_t i, UInt_t &rejectionReason) const
Declaration of class AliAnalysisTaskEmcalJetQA.
ETrackFilterType_t GetTrackFilterType() const
Int_t fCentBin
!event centrality bin
virtual Bool_t AcceptParticle(const AliVParticle *vp, UInt_t &rejectionReason) const
AliVCluster * GetNextCluster()
energy
Int_t fDoEPQA
Add event plane QA histograms.
const TString & GetArrayName() const
Char_t GetTrackType(const AliVTrack *track) const
Int_t fNTotClusters[2]
!Total number of accepted clusters in current event (DCal/EMCal)
Double_t fCent2
!Event centrality with method 2
Float_t fPtBinWidth
Histogram pt bin width.
Float_t fCellEnergyCut
Energy cell cut.
const Int_t nbins
AliTLorentzVector fLeadingTrack
!Leading track in current event
Double_t fV0ATotMult
!Event V0A total multiplicity
Container structure for EMCAL clusters.
AliVVZERO * fVZERO
!Event V0 object
const Int_t nPtBins
void ResetCurrentID(Int_t i=-1)
Double_t fCent
!event centrality
ClassImp(AliAnalysisTaskEmcalJetQA) AliAnalysisTaskEmcalJetQA
virtual AliVParticle * GetNextParticle()
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry