AliPhysics  c923f52 (c923f52)
 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 
72  SetMakeGeneralHistograms(kTRUE);
73 }
74 
75 //________________________________________________________________________
77  AliAnalysisTaskEmcalLight(name, kTRUE),
78  fCellEnergyCut(0.05),
79  fParticleLevel(kFALSE),
80  fIsMC(kFALSE),
81  fCentMethod2(""),
82  fCentMethod3(""),
83  fDoV0QA(0),
84  fDoEPQA(0),
85  fDoLeadingObjectPosition(0),
86  fMaxCellsInCluster(50),
87  fPtBinWidth(0.5),
88  fMaxPt(150),
89  fSeparateEMCalDCal(kTRUE),
90  fIsEmbedded(kFALSE),
91  fCent2(0),
92  fCent3(0),
93  fVZERO(0),
94  fV0ATotMult(0),
95  fV0CTotMult(0),
96  fNTotTracks(0),
97  fLeadingTrack(),
98  fHistManager(name)
99 {
100  // Standard
101 
102  memset(fNTotClusters, 0, sizeof(Int_t)*2);
103 
105 }
106 
107 //________________________________________________________________________
109 {
110  // Destructor
111 }
112 
113 //________________________________________________________________________
115 {
116  // Create histograms
117 
119 
120  AliEmcalContainer* cont = 0;
121 
122  TString histname;
123  TString title;
124 
125  Int_t nPtBins = TMath::CeilNint(fMaxPt / fPtBinWidth);
126 
127  TIter nextPartColl(&fParticleCollArray);
128  while ((cont = static_cast<AliEmcalContainer*>(nextPartColl()))) {
129  fHistManager.CreateHistoGroup(cont->GetArrayName());
130  if (!fParticleLevel && fIsMC) {
131  for (Int_t i = 0; i < fNcentBins; i++) {
132  histname = TString::Format("%s/fHistTrNegativeLabels_%d", cont->GetArrayName().Data(), i);
133  title = histname + ";% of negative labels;counts";
134  fHistManager.CreateTH1(histname.Data(), title.Data(), 500, 0, 1);
135 
136  histname = TString::Format("%s/fHistTrZeroLabels_%d", cont->GetArrayName().Data(), i);
137  title = histname + ";% of zero labels;counts";
138  fHistManager.CreateTH1(histname.Data(), title.Data(), 500, 0, 1);
139  }
140  }
141 
142  Int_t nlabels = 4;
143  if (fParticleLevel) nlabels = 1;
144 
145  for (Int_t i = 0; i < fNcentBins; i++) {
146  histname = TString::Format("%s/fHistRejectionReason_%d", cont->GetArrayName().Data(), i);
147  title = histname + ";Rejection reason;#it{p}_{T,track} (GeV/#it{c});counts";
148  TH2* hist = fHistManager.CreateTH2(histname.Data(), title.Data(), 32, 0, 32, 40, 0, 100);
149  SetRejectionReasonLabels(hist->GetXaxis());
150 
151  for (Int_t j = 0; j < nlabels; j++) {
152  histname = TString::Format("%s/fHistTrPhiEtaPt_%d_%d", cont->GetArrayName().Data(), i, j);
153  title = histname + ";#eta;#phi;#it{p}_{T} (GeV/#it{c})";
154  fHistManager.CreateTH3(histname.Data(), title.Data(), 100, -1, 1, 100, 0, TMath::TwoPi(), nPtBins, 0, fMaxPt);
155  }
156 
157  if (!fParticleLevel) {
158  if (fIsMC) {
159  histname = TString::Format("%s/fHistTrPhiEtaZeroLab_%d", cont->GetArrayName().Data(), i);
160  title = histname + ";#eta;#phi;counts";
161  fHistManager.CreateTH2(histname.Data(), title.Data(), 100, -1, 1, 100, 0, TMath::TwoPi());
162 
163  histname = TString::Format("%s/fHistTrPtZeroLab_%d", cont->GetArrayName().Data(), i);
164  title = histname + ";#it{p}_{T} (GeV/#it{c});counts";
165  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
166  }
167 
168  histname = TString::Format("%s/fHistTrEmcPhiEta_%d", cont->GetArrayName().Data(), i);
169  title = histname + ";#eta;#phi;counts";
170  fHistManager.CreateTH2(histname.Data(), title.Data(), 100, -1, 1, 100, 0, TMath::TwoPi());
171 
172  histname = TString::Format("%s/fHistTrEmcPt_%d", cont->GetArrayName().Data(), i);
173  title = histname + ";#it{p}_{T} (GeV/#it{c});counts";
174  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
175 
176  histname = TString::Format("%s/fHistTrPhiEtaNonProp_%d", cont->GetArrayName().Data(), i);
177  title = histname + ";#eta;#phi;counts";
178  fHistManager.CreateTH2(histname.Data(), title.Data(), 100, -1, 1, 100, 0, TMath::TwoPi());
179 
180  histname = TString::Format("%s/fHistTrPtNonProp_%d", cont->GetArrayName().Data(), i);
181  title = histname + ";#it{p}_{T} (GeV/#it{c});counts";
182  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
183 
184  histname = TString::Format("%s/fHistDeltaEtaPt_%d", cont->GetArrayName().Data(), i);
185  title = histname + ";#it{p}_{T} (GeV/#it{c});#delta#eta;counts";
186  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 50, -0.5, 0.5);
187 
188  histname = TString::Format("%s/fHistDeltaPhiPt_%d", cont->GetArrayName().Data(), i);
189  title = histname + ";#it{p}_{T} (GeV/#it{c});#delta#phi;counts";
190  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 200, -2, 2);
191 
192  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", cont->GetArrayName().Data(), i);
193  title = histname + ";#it{p}_{T} (GeV/#it{c});#delta#it{p}_{T} (GeV/#it{c});counts";
194  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins, -fMaxPt/2, fMaxPt/2);
195  }
196  }
197  }
198 
199  TIter nextClusColl(&fClusterCollArray);
200  while ((cont = static_cast<AliEmcalContainer*>(nextClusColl()))) {
201  fHistManager.CreateHistoGroup(cont->GetArrayName());
202  for (Int_t i = 0; i < fNcentBins; i++) {
203  fHistManager.CreateHistoGroup("BySM", cont->GetArrayName());
204 
205  const Int_t nSM = 20;
206 
207  for (Int_t sm = 0; sm < nSM; sm++) {
208  histname = TString::Format("%s/BySM/fHistClusEnergy_SM%d_%d", cont->GetArrayName().Data(), sm, i);
209  title = histname + ";#it{E}_{cluster} (GeV);counts";
210  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
211  }
212 
213  histname = TString::Format("%s/fHistRejectionReason_%d", cont->GetArrayName().Data(), i);
214  title = histname + ";Rejection reason;#it{E}_{cluster} (GeV);counts";
215  TH2* hist = fHistManager.CreateTH2(histname.Data(), title.Data(), 32, 0, 32, 40, 0, 100);
216  SetRejectionReasonLabels(hist->GetXaxis());
217 
218  histname = TString::Format("%s/fHistClusPosition_%d", cont->GetArrayName().Data(), i);
219  title = histname + ";#it{x} (cm);#it{y} (cm);#it{z} (cm)";
220  fHistManager.CreateTH3(histname.Data(), title.Data(), 50, -500, 500, 50, -500, 500, 50, -500, 500);
221 
222  histname = TString::Format("%s/fHistClusPhiEtaEnergy_%d", cont->GetArrayName().Data(), i);
223  title = histname + ";#eta;#phi;#it{E}_{cluster} (GeV)";
224  fHistManager.CreateTH3(histname.Data(), title.Data(), 50, -1, 1, 50, 0, TMath::TwoPi(), nPtBins, 0, fMaxPt);
225 
226  if (fForceBeamType != kpp) {
227  histname = TString::Format("%s/fHistClusDeltaPhiEPEnergy_%d", cont->GetArrayName().Data(), i);
228  title = histname + ";#it{E}_{cluster} (GeV);#phi_{cluster} - #psi_{EP};counts";
229  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 100, 0, TMath::Pi());
230  }
231 
232  if (fIsEmbedded) {
233  histname = TString::Format("%s/fHistClusMCEnergyFraction_%d", cont->GetArrayName().Data(), i);
234  title = histname + ";MC fraction;counts";
235  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, 1.2);
236  }
237 
238  histname = TString::Format("%s/fHistClusTimeEnergy_%d", cont->GetArrayName().Data(), i);
239  title = histname + ";#it{E}_{cluster} (GeV);time (s);counts";
240  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins, -1e-6, 1e-6);
241 
243  while (nbins > nPtBins) nbins /= 2;
244  histname = TString::Format("%s/fHistNCellsEnergy_%d", cont->GetArrayName().Data(), i);
245  title = histname + ";#it{E}_{cluster} (GeV);#it{N}_{cells};counts";
246  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nbins, -0.5, fMaxCellsInCluster-0.5);
247 
248  histname = TString::Format("%s/fHistFcrossEnergy_%d", cont->GetArrayName().Data(), i);
249  title = histname + ";#it{E}_{cluster} (GeV);#it{F}_{cross};counts";
250  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 200, -3.5, 1.5);
251 
252  histname = TString::Format("%s/fHistClusEnergy_%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  histname = TString::Format("%s/fHistClusNonLinCorrEnergy_%d", cont->GetArrayName().Data(), i);
257  title = histname + ";#it{E}_{cluster} (GeV);counts";
258  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
259 
260  histname = TString::Format("%s/fHistClusHadCorrEnergy_%d", cont->GetArrayName().Data(), i);
261  title = histname + ";#it{E}_{cluster} (GeV);counts";
262  fHistManager.CreateTH1(histname.Data(), title.Data(), nPtBins, 0, fMaxPt);
263  }
264  }
265 
266  if (!fCaloCellsName.IsNull()) {
268  for (Int_t i = 0; i < fNcentBins; i++) {
269  histname = TString::Format("%s/fHistCellsAbsIdEnergy_%d", fCaloCellsName.Data(), i);
270  title = histname + ";cell abs. Id;#it{E}_{cell} (GeV);counts";
271  fHistManager.CreateTH2(histname.Data(), title.Data(), 20000,0,20000,(Int_t)(nPtBins / 2), 0, fMaxPt / 2);
272  }
273  }
274 
275  Int_t dim = 0;
276  TString axistitle[40];
277  Int_t nbins[40] = {0};
278  Double_t min[40] = {0};
279  Double_t max[40] = {0};
280 
282  axistitle[dim] = "Centrality %";
283  nbins[dim] = 101;
284  min[dim] = 0;
285  max[dim] = 101;
286  dim++;
287 
288  if (!fCentMethod2.IsNull()) {
289  axistitle[dim] = Form("Centrality %s %%", fCentMethod2.Data());
290  nbins[dim] = 101;
291  min[dim] = 0;
292  max[dim] = 101;
293  dim++;
294  }
295 
296  if (!fCentMethod3.IsNull()) {
297  axistitle[dim] = Form("Centrality %s %%", fCentMethod3.Data());
298  nbins[dim] = 101;
299  min[dim] = 0;
300  max[dim] = 101;
301  dim++;
302  }
303 
304  if (fDoV0QA==1) {
305  axistitle[dim] = "V0A total multiplicity";
306  nbins[dim] = 200;
307  min[dim] = 0;
308  max[dim] = 20000;
309  dim++;
310 
311  axistitle[dim] = "V0C total multiplicity";
312  nbins[dim] = 200;
313  min[dim] = 0;
314  max[dim] = 20000;
315  dim++;
316  }
317  else if (fDoV0QA==2) {
318  axistitle[dim] = "V0A+V0C total multiplicity";
319  nbins[dim] = 300;
320  min[dim] = 0;
321  max[dim] = 30000;
322  dim++;
323  }
324 
325  if (fDoEPQA) {
326  axistitle[dim] = "#psi_{EP}";
327  nbins[dim] = 200;
328  min[dim] = -TMath::Pi();
329  max[dim] = TMath::Pi();
330  dim++;
331  }
332  }
333 
334  if (fParticleCollArray.GetEntriesFast()>0) {
335  axistitle[dim] = "No. of tracks";
337  nbins[dim] = 3000;
338  min[dim] = -0.5;
339  max[dim] = 6000-0.5;
340  }
341  else {
342  nbins[dim] = 200;
343  min[dim] = 0;
344  max[dim] = 200;
345  }
346  dim++;
347 
348  axistitle[dim] = "#it{p}_{T,track}^{leading} (GeV/c)";
349  nbins[dim] = nPtBins;
350  min[dim] = 0;
351  max[dim] = fMaxPt;
352  dim++;
353 
355  axistitle[dim] = "#eta_{track}^{leading}";
356  nbins[dim] = 100;
357  min[dim] = -1;
358  max[dim] = 1;
359  dim++;
360 
361  axistitle[dim] = "#phi_{track}^{leading}";
362  nbins[dim] = 100;
363  min[dim] = 0;
364  max[dim] = TMath::TwoPi();
365  dim++;
366  }
367  }
368 
369  if (fClusterCollArray.GetEntriesFast()>0) {
370  axistitle[dim] = "No. of clusters";
371 
373  nbins[dim] = 2000;
374  min[dim] = -0.5;
375  max[dim] = 4000-0.5;
376  }
377  else {
378  nbins[dim] = 200;
379  min[dim] = 0;
380  max[dim] = 200;
381  }
382  dim++;
383 
384  if (fSeparateEMCalDCal) {
385  axistitle[dim] = "#it{E}_{EMCal cluster}^{leading} (GeV)";
386  nbins[dim] = nPtBins;
387  min[dim] = 0;
388  max[dim] = fMaxPt;
389  dim++;
390 
391  axistitle[dim] = "#it{E}_{DCal cluster}^{leading} (GeV)";
392  nbins[dim] = nPtBins;
393  min[dim] = 0;
394  max[dim] = fMaxPt;
395  dim++;
396 
398  axistitle[dim] = "#eta_{EMCal cluster}^{leading}";
399  nbins[dim] = 100;
400  min[dim] = -1;
401  max[dim] = 1;
402  dim++;
403 
404  axistitle[dim] = "#phi_{EMCal cluster}^{leading}";
405  nbins[dim] = 100;
406  min[dim] = 0;
407  max[dim] = TMath::TwoPi();
408  dim++;
409 
410  axistitle[dim] = "#eta_{DCal cluster}^{leading}";
411  nbins[dim] = 100;
412  min[dim] = -1;
413  max[dim] = 1;
414  dim++;
415 
416  axistitle[dim] = "#phi_{DCal cluster}^{leading}";
417  nbins[dim] = 100;
418  min[dim] = 0;
419  max[dim] = TMath::TwoPi();
420  dim++;
421  }
422  }
423  else {
424  axistitle[dim] = "#it{E}_{cluster}^{leading} (GeV)";
425  nbins[dim] = nPtBins;
426  min[dim] = 0;
427  max[dim] = fMaxPt;
428  dim++;
429 
431  axistitle[dim] = "#eta_{cluster}^{leading}";
432  nbins[dim] = 100;
433  min[dim] = -1;
434  max[dim] = 1;
435  dim++;
436 
437  axistitle[dim] = "#phi_{cluster}^{leading}";
438  nbins[dim] = 100;
439  min[dim] = 0;
440  max[dim] = TMath::TwoPi();
441  dim++;
442  }
443  }
444  }
445 
446  if (!fCaloCellsName.IsNull()) {
447  axistitle[dim] = "No. of cells";
448 
450  nbins[dim] = 5000;
451  min[dim] = -0.5;
452  max[dim] = 10000-0.5;
453  }
454  else {
455  nbins[dim] = 500;
456  min[dim] = -0.5;
457  max[dim] = 500-0.5;
458  }
459 
460  dim++;
461  }
462 
463  THnSparse* hn = fHistManager.CreateTHnSparse("fHistEventQA","fHistEventQA",dim,nbins,min,max);
464  for (Int_t i = 0; i < dim; i++)
465  hn->GetAxis(i)->SetTitle(axistitle[i]);
466 
468 
469  PostData(1, fOutput); // Post data for ALL output slots >0 here, to get at least an empty histogram
470 }
471 
472 //________________________________________________________________________
474 {
475  if (fClusterCollArray.GetEntriesFast() == 0 && fCaloCellsName.IsNull()) {
476  fNeedEmcalGeom = kFALSE;
477  }
478  else {
479  fNeedEmcalGeom = kTRUE;
480  }
481 
483 
484  if (fDoV0QA) {
485  fVZERO = InputEvent()->GetVZEROData();
486  if (!fVZERO) {
487  AliError("AliVVZERO not available");
488  }
489  }
490 }
491 
492 //________________________________________________________________________
494 {
495  // Retrieve event objects.
496 
498 
499  if (!fCentMethod2.IsNull() || !fCentMethod3.IsNull()) {
500  if (fBeamType == kAA || fBeamType == kpA ) {
501  AliCentrality *aliCent = InputEvent()->GetCentrality();
502  if (aliCent) {
503  if (!fCentMethod2.IsNull())
504  fCent2 = aliCent->GetCentralityPercentile(fCentMethod2);
505  if (!fCentMethod3.IsNull())
506  fCent3 = aliCent->GetCentralityPercentile(fCentMethod3);
507  }
508  }
509  }
510 
511  if (fVZERO) {
512  fV0ATotMult = AliESDUtils::GetCorrV0A(fVZERO->GetMTotV0A(),fVertex[2]);
513  fV0CTotMult = AliESDUtils::GetCorrV0C(fVZERO->GetMTotV0C(),fVertex[2]);
514  }
515 
516  return kTRUE;
517 }
518 
519 //________________________________________________________________________
521 {
522  // Fill histograms.
523 
524  EventQA_t eventQA;
525 
526  DoTrackLoop();
527  AliDebug(2,Form("%d tracks found in the event", fNTotTracks));
528  eventQA.fMaxTrack = fLeadingTrack;
529 
530  DoClusterLoop();
531  AliDebug(2,Form("%d clusters found in EMCal and %d in DCal", fNTotClusters[0], fNTotClusters[1]));
532  for (Int_t i = 0; i < 2; i++) {
533  eventQA.fMaxCluster[i] = fLeadingCluster[i];
534  }
535 
536  if (fCaloCells) {
537  eventQA.fNCells = DoCellLoop();
538  AliDebug(2,Form("%d cells found in the event", eventQA.fNCells));
539  }
540 
541  eventQA.fCent = fCent;
542  eventQA.fCent2 = fCent2;
543  eventQA.fCent3 = fCent3;
544  eventQA.fV0A = fV0ATotMult;
545  eventQA.fV0C = fV0CTotMult;
546  eventQA.fEP = fEPV0;
547  eventQA.fNTracks = fNTotTracks;
548  eventQA.fNClusters[0] = fNTotClusters[0];
549  eventQA.fNClusters[1] = fNTotClusters[1];
550 
551  FillEventQAHisto(eventQA);
552 
553  return kTRUE;
554 }
555 
556 //________________________________________________________________________
558 {
559  Double_t contents[40]={0};
560 
561  Int_t globalNclusters = eventQA.fNClusters[0] + eventQA.fNClusters[1];
562 
563  AliTLorentzVector globalMaxCluster = eventQA.fMaxCluster[0].E() > eventQA.fMaxCluster[1].E() ?
564  eventQA.fMaxCluster[0] : eventQA.fMaxCluster[1];
565 
566  THnSparse* histEventQA = static_cast<THnSparse*>(fHistManager.FindObject("fHistEventQA"));
567 
568  for (Int_t i = 0; i < histEventQA->GetNdimensions(); i++) {
569  TString title(histEventQA->GetAxis(i)->GetTitle());
570  if (title=="Centrality %")
571  contents[i] = eventQA.fCent;
572  else if (title==Form("Centrality %s %%", fCentMethod2.Data()))
573  contents[i] = eventQA.fCent2;
574  else if (title==Form("Centrality %s %%", fCentMethod3.Data()))
575  contents[i] = eventQA.fCent3;
576  else if (title=="V0A total multiplicity")
577  contents[i] = eventQA.fV0A;
578  else if (title=="V0C total multiplicity")
579  contents[i] = eventQA.fV0C;
580  else if (title=="V0A+V0C total multiplicity")
581  contents[i] = eventQA.fV0A+eventQA.fV0C;
582  else if (title=="#psi_{RP}")
583  contents[i] = eventQA.fEP;
584  else if (title=="No. of tracks")
585  contents[i] = eventQA.fNTracks;
586  else if (title=="No. of clusters")
587  contents[i] = globalNclusters;
588  else if (title=="No. of cells")
589  contents[i] = eventQA.fNCells;
590  else if (title=="#it{p}_{T,track}^{leading} (GeV/c)")
591  contents[i] = eventQA.fMaxTrack.Pt();
592  else if (title=="#eta_{track}^{leading}")
593  contents[i] = eventQA.fMaxTrack.Eta();
594  else if (title=="#phi_{track}^{leading}")
595  contents[i] = eventQA.fMaxTrack.Phi_0_2pi();
596  else if (title=="#it{E}_{cluster}^{leading} (GeV)")
597  contents[i] = globalMaxCluster.E();
598  else if (title=="#eta_{cluster}^{leading}")
599  contents[i] = globalMaxCluster.Eta();
600  else if (title=="#phi_{cluster}^{leading}")
601  contents[i] = globalMaxCluster.Phi();
602  else if (title=="#it{E}_{EMCal cluster}^{leading} (GeV)")
603  contents[i] = eventQA.fMaxCluster[0].E();
604  else if (title=="#eta_{EMCal cluster}^{leading}")
605  contents[i] = eventQA.fMaxCluster[0].Phi_0_2pi();
606  else if (title=="#phi_{EMCal cluster}^{leading}")
607  contents[i] = eventQA.fMaxCluster[0].Eta();
608  else if (title=="#it{E}_{DCal cluster}^{leading} (GeV)")
609  contents[i] = eventQA.fMaxCluster[1].E();
610  else if (title=="#phi_{DCal cluster}^{leading}")
611  contents[i] = eventQA.fMaxCluster[1].Phi_0_2pi();
612  else if (title=="#eta_{DCal cluster}^{leading}")
613  contents[i] = eventQA.fMaxCluster[1].Eta();
614  else
615  AliWarning(Form("Unable to fill dimension %s!",title.Data()));
616  }
617 
618  histEventQA->Fill(contents);
619 }
620 
621 //________________________________________________________________________
623 {
624  // Do cell loop.
625 
626  if (!fCaloCells) return 0;
627 
628  TString histname = TString::Format("%s/fHistCellsAbsIdEnergy_%d", fCaloCellsName.Data(), fCentBin);
629 
630  const Int_t ncells = fCaloCells->GetNumberOfCells();
631  Int_t nAccCells = 0;
632 
633  for (Int_t pos = 0; pos < ncells; pos++) {
634  Float_t amp = fCaloCells->GetAmplitude(pos);
635  Int_t absId = fCaloCells->GetCellNumber(pos);
636 
637  if (amp < fCellEnergyCut) continue;
638 
639  fHistManager.FillTH2(histname, absId,amp);
640  nAccCells++;
641  }
642 
643  return nAccCells;
644 }
645 
646 //________________________________________________________________________
647 Double_t AliAnalysisTaskEmcalJetQA::GetFcross(AliVCluster *cluster, AliVCaloCells *cells)
648 {
649  Int_t AbsIdseed = -1;
650  Double_t Eseed = 0;
651  for (Int_t i = 0; i < cluster->GetNCells(); i++) {
652  if (cells->GetCellAmplitude(cluster->GetCellAbsId(i)) > Eseed) {
653  Eseed = cells->GetCellAmplitude(cluster->GetCellAbsId(i));
654  AbsIdseed = cluster->GetCellAbsId(i);
655  }
656  }
657 
658  if (Eseed < 1e-9)
659  return 100;
660 
661  Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
662  fGeom->GetCellIndex(AbsIdseed,imod,iTower,iIphi,iIeta);
663  fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi,iIeta,iphi,ieta);
664 
665  //Get close cells index and energy, not in corners
666 
667  Int_t absID1 = -1;
668  Int_t absID2 = -1;
669 
670  if (iphi < AliEMCALGeoParams::fgkEMCALRows-1) absID1 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
671  if (iphi > 0) absID2 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
672 
673  // In case of cell in eta = 0 border, depending on SM shift the cross cell index
674 
675  Int_t absID3 = -1;
676  Int_t absID4 = -1;
677 
678  if (ieta == AliEMCALGeoParams::fgkEMCALCols-1 && !(imod%2)) {
679  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod+1, iphi, 0);
680  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
681  }
682  else if (ieta == 0 && imod%2) {
683  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
684  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod-1, iphi, AliEMCALGeoParams::fgkEMCALCols-1);
685  }
686  else {
687  if (ieta < AliEMCALGeoParams::fgkEMCALCols-1)
688  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
689  if (ieta > 0)
690  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
691  }
692 
693  Double_t ecell1 = cells->GetCellAmplitude(absID1);
694  Double_t ecell2 = cells->GetCellAmplitude(absID2);
695  Double_t ecell3 = cells->GetCellAmplitude(absID3);
696  Double_t ecell4 = cells->GetCellAmplitude(absID4);
697 
698  Double_t Ecross = ecell1 + ecell2 + ecell3 + ecell4;
699 
700  Double_t Fcross = 1 - Ecross/Eseed;
701 
702  return Fcross;
703 }
704 
705 //________________________________________________________________________
707 {
708  // Do cluster loop.
709 
710  TString histname;
711 
712  memset(fNTotClusters, 0, sizeof(Int_t)*2);
713  for (Int_t i = 0; i < 2; i++) fLeadingCluster[i].SetPxPyPzE(0,0,0,0);
714 
715  AliClusterContainer* clusters = 0;
716  TIter nextClusColl(&fClusterCollArray);
717  while ((clusters = static_cast<AliClusterContainer*>(nextClusColl()))) {
718  // Cluster loop
720  for (AliClusterIterableMomentumContainer::iterator it = itcont.begin(); it != itcont.end(); it++) {
721 
722  UInt_t rejectionReason = 0;
723  if (!clusters->AcceptCluster(it.current_index(), rejectionReason)) {
724  histname = TString::Format("%s/fHistRejectionReason_%d", clusters->GetArrayName().Data(), fCentBin);
725  fHistManager.FillTH2(histname, clusters->GetRejectionReasonBitPosition(rejectionReason), it->first.E());
726  continue;
727  }
728 
729  Float_t pos[3]={0};
730  it->second->GetPosition(pos);
731  histname = TString::Format("%s/fHistClusPosition_%d", clusters->GetArrayName().Data(), fCentBin);
732  fHistManager.FillTH3(histname, pos[0], pos[1], pos[2]);
733 
734  Double_t phi = it->first.Phi_0_2pi();
735 
736  Int_t isDcal = Int_t(phi > fgkEMCalDCalPhiDivide);
737 
738  histname = TString::Format("%s/fHistClusPhiEtaEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
739  fHistManager.FillTH3(histname, it->first.Eta(), it->first.Phi_0_2pi(), it->first.E());
740 
741  if (fLeadingCluster[isDcal].E() < it->first.E()) fLeadingCluster[isDcal] = it->first;
742 
743  histname = TString::Format("%s/fHistClusDeltaPhiEPEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
744  if (fHistManager.FindObject(histname)) {
745  Double_t ep = it->first.Phi_0_2pi() - fEPV0;
746  while (ep < 0) ep += TMath::Pi();
747  while (ep >= TMath::Pi()) ep -= TMath::Pi();
748  fHistManager.FillTH2(histname, it->first.E(), ep);
749  }
750 
751  histname = TString::Format("%s/fHistNCellsEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
752  fHistManager.FillTH2(histname, it->first.E(), it->second->GetNCells());
753 
754  histname = TString::Format("%s/fHistClusTimeEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
755  fHistManager.FillTH2(histname, it->first.E(), it->second->GetTOF());
756 
757  if (fCaloCells) {
758  histname = TString::Format("%s/fHistFcrossEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
759  fHistManager.FillTH2(histname, it->first.E(), GetFcross(it->second, fCaloCells));
760  }
761 
762  histname = TString::Format("%s/fHistClusMCEnergyFraction_%d", clusters->GetArrayName().Data(), fCentBin);
763  if (fHistManager.FindObject(histname)) {
764  fHistManager.FillTH1(histname, it->second->GetMCEnergyFraction());
765  }
766 
767  histname = TString::Format("%s/fHistClusEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
768  fHistManager.FillTH1(histname, it->second->E());
769 
770  if (it->second->GetNonLinCorrEnergy() > 0.) {
771  histname = TString::Format("%s/fHistClusNonLinCorrEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
772  fHistManager.FillTH1(histname, it->second->GetNonLinCorrEnergy());
773  }
774 
775  if (it->second->GetHadCorrEnergy() > 0.) {
776  histname = TString::Format("%s/fHistClusHadCorrEnergy_%d", clusters->GetArrayName().Data(), fCentBin);
777  fHistManager.FillTH1(histname, it->second->GetHadCorrEnergy());
778  }
779 
780  Int_t sm = fGeom->GetSuperModuleNumber(it->second->GetCellAbsId(0));
781  if (sm >=0 && sm < 20) {
782  histname = TString::Format("%s/BySM/fHistClusEnergy_SM%d_%d", clusters->GetArrayName().Data(), sm, fCentBin);
783  fHistManager.FillTH1(histname, it->second->E());
784  }
785  else {
786  AliError(Form("Supermodule %d does not exist!", sm));
787  }
788 
789  fNTotClusters[isDcal]++;
790  }
791  }
792 }
793 
794 //________________________________________________________________________
796 {
797  // Do track loop.
798 
799  Int_t neg = 0;
800  Int_t zero = 0;
801 
802  fNTotTracks = 0;
803  fLeadingTrack.SetPxPyPzE(0,0,0,0);
804 
805  TString histname;
806 
807  AliParticleContainer* particles = 0;
808  TIter nextPartColl(&fParticleCollArray);
809 
810  while ((particles = static_cast<AliParticleContainer*>(nextPartColl()))) {
812  for (AliParticleIterableMomentumContainer::iterator it = itcont.begin(); it != itcont.end(); it++) {
813 
814  UInt_t rejectionReason = 0;
815  if (!particles->AcceptParticle(it.current_index(), rejectionReason)) {
816  histname = TString::Format("%s/fHistRejectionReason_%d", particles->GetArrayName().Data(), fCentBin);
817  fHistManager.FillTH2(histname, particles->GetRejectionReasonBitPosition(rejectionReason), it->first.Pt());
818  continue;
819  }
820 
821  fNTotTracks++;
822 
823  if (fLeadingTrack.Pt() < it->first.Pt()) fLeadingTrack = it->first;
824 
825  if (fParticleLevel) {
826  histname = TString::Format("%s/fHistTrPhiEtaPt_%d", particles->GetArrayName().Data(), fCentBin);
827  fHistManager.FillTH2(histname, it->first.Eta(), it->first.Phi_0_2pi(),it->first.Pt());
828  }
829  else {
830  if (it->second->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, it->first.Eta(), it->first.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, it->first.Pt());
841  }
842  }
843 
844  if (it->second->GetLabel() < 0) neg++;
845 
846  Int_t type = 0;
847  AliTrackContainer* tracks = dynamic_cast<AliTrackContainer*>(particles);
848  if (tracks) {
849  // Track type (hybrid)
851  type = tracks->GetTrackType(it.current_index());
852  }
853  }
854 
855  // Track propagation to EMCal surface
856  AliVTrack* vtrack = dynamic_cast<AliVTrack*>(it->second);
857  if (vtrack) {
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, it->first.Eta(), it->first.Phi_0_2pi());
862  }
863  histname = TString::Format("%s/fHistTrPtNonProp_%d", particles->GetArrayName().Data(), fCentBin);
864  if (fHistManager.FindObject(histname)) {
865  fHistManager.FillTH1(histname, it->first.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, it->first.Pt(), it->first.Eta() - vtrack->GetTrackEtaOnEMCal());
880 
881  histname = TString::Format("%s/fHistDeltaPhiPt_%d", particles->GetArrayName().Data(), fCentBin);
882  if (fHistManager.FindObject(histname))
883  fHistManager.FillTH2(histname, it->first.Pt(), it->first.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, it->first.Pt(), it->first.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, it->first.Eta(), it->first.Phi_0_2pi(), it->first.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 }
Int_t fNcentBins
how many centrality bins
AliEMCALGeometry * fGeom
!emcal geometry
Float_t fMaxPt
Histogram pt limit.
EBeamType_t fBeamType
!event beam type
double Double_t
Definition: External.C:58
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.
AliTLorentzVector fLeadingCluster[2]
!Leading cluster in current event (EMCal/DCal)
TString fCentMethod3
Centrality method 3.
Int_t fNTotTracks
!Total number of accepted tracks in current event
Double_t fEPV0
!event plane V0
bidirectional stl iterator over the EMCAL iterable container
TObjArray fParticleCollArray
particle/track collection array
Container with name, TClonesArray and cuts for particles.
Double_t GetFcross(AliVCluster *cluster, AliVCaloCells *cells)
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
void FillTH3(const char *hname, double x, double y, double z, double weight=1., Option_t *opt="")
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 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
THashList * CreateHistoGroup(const char *groupname, const char *parent="/")
EBeamType_t fForceBeamType
forced beam type
THistManager fHistManager
Histogram manager.
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
TObject * FindObject(const char *name) const
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
float Float_t
Definition: External.C:68
Int_t fDoV0QA
Add V0 QA histograms.
Base task in the EMCAL framework (lighter version of AliAnalysisTaskEmcal)
Double_t Phi_0_2pi() const
Double_t fVertex[3]
!event vertex
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
TString fCentMethod2
Centrality method 2.
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
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Int_t fDoEPQA
Add event plane QA histograms.
const AliClusterIterableMomentumContainer all_momentum() const
Char_t GetTrackType(const AliVTrack *track) const
Definition: External.C:220
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
bool Bool_t
Definition: External.C:53
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
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
const AliParticleIterableMomentumContainer all_momentum() const
Double_t fCent
!event centrality
ClassImp(AliAnalysisTaskEmcalJetQA) AliAnalysisTaskEmcalJetQA
TH3 * CreateTH3(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, int nbinsz, double zmin, double zmax, Option_t *opt="")
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry