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