AliPhysics  61b3849 (61b3849)
AliAnalysisTaskEmcalJetPerformance.cxx
Go to the documentation of this file.
1 /**********************************************************************************
2 * Copyright (C) 2016, Copyright Holders of the ALICE Collaboration *
3 * All rights reserved. *
4 * *
5 * Redistribution and use in source and binary forms, with or without *
6 * modification, are permitted provided that the following conditions are met: *
7 * * Redistributions of source code must retain the above copyright *
8 * notice, this list of conditions and the following disclaimer. *
9 * * Redistributions in binary form must reproduce the above copyright *
10 * notice, this list of conditions and the following disclaimer in the *
11 * documentation and/or other materials provided with the distribution. *
12 * * Neither the name of the <organization> nor the *
13 * names of its contributors may be used to endorse or promote products *
14 * derived from this software without specific prior written permission. *
15 * *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND *
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED *
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE *
19 * DISCLAIMED. IN NO EVENT SHALL ALICE COLLABORATION BE LIABLE FOR ANY *
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND *
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
26 * *********************************************************************************/
27 
28 #include <vector>
29 
30 #include <TClonesArray.h>
31 #include <TH1F.h>
32 #include <TH2F.h>
33 #include <TH3.h>
34 #include <TList.h>
35 #include <THnSparse.h>
36 #include <TRandom3.h>
37 #include <TGrid.h>
38 #include <TFile.h>
39 
40 #include <AliVCluster.h>
41 #include <AliVParticle.h>
42 #include <AliLog.h>
43 
44 #include "AliAnalysisManager.h"
45 #include <AliVEventHandler.h>
46 #include "AliTLorentzVector.h"
47 #include "AliEmcalJet.h"
48 #include "AliRhoParameter.h"
49 #include "AliJetContainer.h"
50 #include "AliParticleContainer.h"
51 #include "AliClusterContainer.h"
52 #include "AliEMCALGeometry.h"
53 #include "AliOADBContainer.h"
55 #include "AliEMCALTriggerPatchInfo.h"
57 #include "AliMCEvent.h"
58 
60 
64 
70  fPlotJetHistograms(kFALSE),
71  fPlotClusterHistograms(kFALSE),
72  fPlotParticleCompositionHistograms(kFALSE),
73  fComputeBackground(kFALSE),
74  fDoTriggerSimulation(kFALSE),
75  fPlotMatchedJetHistograms(kFALSE),
76  fComputeMBDownscaling(kFALSE),
77  fPlotDCal(kFALSE),
78  fMaxPt(250),
79  fNEtaBins(40),
80  fNPhiBins(200),
81  fNCentHistBins(0),
82  fCentHistBins(0),
83  fNPtHistBins(0),
84  fPtHistBins(0),
85  fNM02HistBins(0),
86  fM02HistBins(0),
87  fNEoverPBins(0),
88  fEoverPBins(0),
89  fTrackMatchingDeltaEtaMax(0.015),
90  fTrackMatchingDeltaPhiMax(0.030),
91  fMBUpscaleFactor(1.),
92  fMedianEMCal(0.),
93  fMedianDCal(0.),
94  fkEMCEJE(kFALSE),
95  fEmbeddingQA(),
96  fMinSharedMomentumFraction(0.5),
97  fMaxMatchedJetDistance(0.3),
98  fUseResponseMaker(kFALSE),
99  fMCJetContainer(nullptr),
100  fUseAliEventCuts(kTRUE),
101  fEventCuts(0),
102  fEventCutList(0),
103  fUseManualEventCuts(kFALSE),
104  fGeneratorLevel(0),
105  fHistManager()
106 {
108 }
109 
116  AliAnalysisTaskEmcalJet(name, kTRUE),
117  fPlotJetHistograms(kFALSE),
118  fPlotClusterHistograms(kFALSE),
120  fComputeBackground(kFALSE),
121  fDoTriggerSimulation(kFALSE),
123  fComputeMBDownscaling(kFALSE),
124  fPlotDCal(kFALSE),
125  fMaxPt(250),
126  fNEtaBins(40),
127  fNPhiBins(200),
128  fNCentHistBins(0),
129  fCentHistBins(0),
130  fNPtHistBins(0),
131  fPtHistBins(0),
132  fNM02HistBins(0),
133  fM02HistBins(0),
134  fNEoverPBins(0),
135  fEoverPBins(0),
138  fMBUpscaleFactor(1.),
139  fMedianEMCal(0.),
140  fMedianDCal(0.),
141  fkEMCEJE(kFALSE),
142  fEmbeddingQA(),
145  fUseResponseMaker(kFALSE),
147  fUseAliEventCuts(kTRUE),
148  fEventCuts(0),
149  fEventCutList(0),
150  fUseManualEventCuts(kFALSE),
151  fGeneratorLevel(0),
152  fHistManager(name)
153 {
155 }
156 
161 {
162 }
163 
168 {
169  fNCentHistBins = 4;
171  fCentHistBins[0] = 0;
172  fCentHistBins[1] = 10;
173  fCentHistBins[2] = 30;
174  fCentHistBins[3] = 50;
175  fCentHistBins[4] = 90;
176 
177  fNPtHistBins = 82;
180  GenerateFixedBinArray(7, 0.3, 1, fPtHistBins+6);
181  GenerateFixedBinArray(10, 1, 3, fPtHistBins+13);
182  GenerateFixedBinArray(14, 3, 10, fPtHistBins+23);
183  GenerateFixedBinArray(10, 10, 20, fPtHistBins+37);
184  GenerateFixedBinArray(15, 20, 50, fPtHistBins+47);
185  GenerateFixedBinArray(20, 50, 150, fPtHistBins+62);
186 
187  fNM02HistBins = 81;
189  GenerateFixedBinArray(35, 0, 0.7, fM02HistBins);
190  GenerateFixedBinArray(6, 0.7, 1., fM02HistBins+35);
191  GenerateFixedBinArray(20, 1., 3., fM02HistBins+41);
192  GenerateFixedBinArray(10, 3., 5., fM02HistBins+61);
193  GenerateFixedBinArray(10, 5., 10., fM02HistBins+71);
194 
195  fNEoverPBins = 47;
197  GenerateFixedBinArray(30, 0, 1.5, fEoverPBins);
198  GenerateFixedBinArray(10, 1.5, 3.5, fEoverPBins+30);
199  GenerateFixedBinArray(7, 3.5, 10.5, fEoverPBins+40);
200 }
201 
207 {
209 
210  // Intialize AliEventCuts
211  if (fUseAliEventCuts) {
212  fEventCutList = new TList();
213  fEventCutList ->SetOwner();
214  fEventCutList ->SetName("EventCutOutput");
215 
216  fEventCuts.OverrideAutomaticTriggerSelection(fOffTrigger);
217  if(fUseManualEventCuts==1)
218  {
219  fEventCuts.SetManualMode();
220  fEventCuts.fMC = false;
221  fEventCuts.SetupLHC15o();
222  fEventCuts.fUseVariablesCorrelationCuts = true;
223  }
224  fEventCuts.AddQAplotsToList(fEventCutList);
225  fOutput->Add(fEventCutList);
226  }
227 
228  // Get the MC particle branch, in case it exists
229  fGeneratorLevel = GetMCParticleContainer("mcparticles");
230 
231  // Get MC jet container, in order to check the jet acceptance criteria
233  for (Int_t i=0; i<2; i++) {
234  auto jetCont = GetJetContainer(i);
235  TString jetContName = jetCont->GetName();
236  if (jetContName.Contains("mcparticles")) {
237  fMCJetContainer = jetCont;
238  }
239  }
240  if (!fMCJetContainer) {
241  Printf("No MC jet container found!");
242  }
243  Printf("mcJetContainer: %s", fMCJetContainer->GetName());
244  }
245 
246  // Allocate histograms
247  if (fPlotJetHistograms) {
249  }
252  }
255  }
256  if (fComputeBackground) {
258  }
259  if (fDoTriggerSimulation) {
261  }
264  }
265 
266  // Initialize embedding QA
268  if (embeddingHelper) {
269  bool res = fEmbeddingQA.Initialize();
270  if (res) {
272  }
273  }
274 
275  TIter next(fHistManager.GetListOfHistograms());
276  TObject* obj = 0;
277  while ((obj = next())) {
278  fOutput->Add(obj);
279  }
280 
281  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
282 }
283 
284 /*
285  * This function allocates the histograms for single jets.
286  * A set of histograms is allocated per each jet container.
287  */
289 {
290  TString histname;
291  TString title;
292 
293  Int_t nPtBins = TMath::CeilNint(fMaxPt/2);
294 
295  AliJetContainer* jets = 0;
296  TIter nextJetColl(&fJetCollArray);
297  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
298 
299  // Jet rejection reason
300  histname = TString::Format("%s/JetHistograms/hJetRejectionReason", jets->GetArrayName().Data());
301  title = histname + ";Centrality (%);Rejection reason;#it{p}_{T,corr} (GeV/#it{c});counts";
302  TH3* hist = fHistManager.CreateTH3(histname.Data(), title.Data(), 10, 0, 100, 32, 0, 32, 50, 0, fMaxPt);
303  SetRejectionReasonLabels(hist->GetYaxis());
304 
305  // Rho vs. Centrality
306  if (!jets->GetRhoName().IsNull()) {
307  histname = TString::Format("%s/JetHistograms/hRhoVsCent", jets->GetArrayName().Data());
308  title = histname + ";Centrality (%);#rho (GeV/#it{c});counts";
309  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 500);
310  }
311 
312  // (Centrality, pT, NEF)
313  Int_t nbinsx = 20; Int_t minx = 0; Int_t maxx = 100;
314  Int_t nbinsy = fMaxPt; Int_t miny = 0; Int_t maxy = fMaxPt;
315  Int_t nbinsz = 50; Int_t minz = 0; Int_t maxz = 1.;
316 
317  histname = TString::Format("%s/JetHistograms/hNEFVsPtEMCal", jets->GetArrayName().Data());
318  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});NEF";
319  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
320 
321  if (fPlotDCal) {
322  histname = TString::Format("%s/JetHistograms/hNEFVsPtDCal", jets->GetArrayName().Data());
323  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});NEF";
324  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
325  }
326 
327  // (Centrality, pT upscaled, calo type)
328  if (fComputeMBDownscaling) {
329  histname = TString::Format("%s/JetHistograms/hPtUpscaledMB", jets->GetArrayName().Data());
330  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});type";
331  fHistManager.CreateTH3(histname.Data(), title.Data(), 20, 0, 100, nPtBins, 0, fMaxPt, 2, -0.5, 1.5, "s");
332  }
333 
334  // pT-leading vs. pT
335  histname = TString::Format("%s/JetHistograms/hPtLeadingVsPt", jets->GetArrayName().Data());
336  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{p}_{T,particle}^{leading} (GeV/#it{c})";
337  fHistManager.CreateTH3(histname.Data(), title.Data(), 10, 0, 100, nPtBins, 0, fMaxPt, fMaxPt, 0, fMaxPt);
338 
339  // A vs. pT
340  histname = TString::Format("%s/JetHistograms/hAreaVsPt", jets->GetArrayName().Data());
341  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{A}_{jet}";
342  fHistManager.CreateTH3(histname.Data(), title.Data(), 10, 0, 100, nPtBins, 0, fMaxPt, 50, 0, 0.5);
343 
344  // (Centrality, pT, z-leading (charged))
345  nbinsx = 20; minx = 0; maxx = 100;
346  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
347  nbinsz = 50; minz = 0; maxz = 1.;
348 
349  histname = TString::Format("%s/JetHistograms/hZLeadingVsPtEMCal", jets->GetArrayName().Data());
350  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}_{leading}";
351  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
352 
353  if (fPlotDCal) {
354  histname = TString::Format("%s/JetHistograms/hZLeadingVsPtDCal", jets->GetArrayName().Data());
355  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}_{leading}";
356  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
357  }
358 
359  // (Centrality, pT, z (charged))
360  nbinsx = 20; minx = 0; maxx = 100;
361  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
362  nbinsz = 50; minz = 0; maxz = 1.;
363 
364  histname = TString::Format("%s/JetHistograms/hZVsPtEMCal", jets->GetArrayName().Data());
365  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}";
366  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
367 
368  if (fPlotDCal) {
369  histname = TString::Format("%s/JetHistograms/hZVsPtDCal", jets->GetArrayName().Data());
370  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}";
371  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
372  }
373 
374  // (Centrality, pT, Nconst)
375  nbinsx = 20; minx = 0; maxx = 100;
376  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
377  nbinsz = 50; minz = 0; maxz = fMaxPt;
378 
379  histname = TString::Format("%s/JetHistograms/hNConstVsPtEMCal", jets->GetArrayName().Data());
380  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});No. of constituents";
381  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
382 
383  if (fPlotDCal) {
384  histname = TString::Format("%s/JetHistograms/hNConstVsPtDCal", jets->GetArrayName().Data());
385  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});No. of constituents";
386  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
387  }
388 
389  // (Centrality, pT) for eta<0 and eta>0
390  nbinsx = 20; minx = 0; maxx = 100;
391  nbinsy = fMaxPt; miny = 0; maxy = fMaxPt;
392 
393  histname = TString::Format("%s/JetHistograms/hEtaPosVsPtEMCal", jets->GetArrayName().Data());
394  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c})";
395  fHistManager.CreateTH2(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy);
396 
397  histname = TString::Format("%s/JetHistograms/hEtaNegVsPtEMCal", jets->GetArrayName().Data());
398  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c})";
399  fHistManager.CreateTH2(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy);
400 
401  // (Centrality, jet pT, Enonlincorr - Ehadcorr)
402  nbinsx = 20; minx = 0; maxx = 100;
403  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
404  nbinsz = nPtBins; minz = 0; maxz = fMaxPt;
405 
406  histname = TString::Format("%s/JetHistograms/hDeltaEHadCorr", jets->GetArrayName().Data());
407  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#sum#it{E}_{nonlincorr} - #it{E}_{hadcorr}";
408  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
409 
410  // (Median patch energy, calo type, jet pT, centrality)
411  if (fDoTriggerSimulation) {
412  histname = TString::Format("%s/JetHistograms/hMedPatchJet", jets->GetArrayName().Data());
413  title = histname + ";#it{E}_{patch,med};type;#it{p}_{T}^{corr} (GeV/#it{c});Centrality (%)";
414  Int_t nbins5[4] = {100, 2, nPtBins, 50};
415  Double_t min5[4] = {0,-0.5, 0, 0};
416  Double_t max5[4] = {50,1.5, fMaxPt, 100};
417  fHistManager.CreateTHnSparse(histname.Data(), title.Data(), 4, nbins5, min5, max5);
418  }
419 
420  }
421 
422  // MB downscale factor histogram
423  if (fComputeMBDownscaling) {
424  histname = "Trigger/hMBDownscaleFactor";
425  title = histname + ";Downscale factor;counts";
426  fHistManager.CreateTH1(histname.Data(), title.Data(), 200, 0, 200);
427  }
428 
429 }
430 
431 /*
432  * This function allocates the histograms for the calorimeter performance study.
433  */
435 {
436  TString histname;
437  TString htitle;
438 
439  const Int_t nRcorrBins = 50;
440  Double_t *RcorrBins = GenerateFixedBinArray(nRcorrBins, 0., 1.);
441  const Int_t nCellBins = 30;
442  Double_t *cellBins = GenerateFixedBinArray(nCellBins, -0.5, 29.5);
443  const Int_t nMatchedTrackBins = 5;
444  Double_t *matchedTrackBins = GenerateFixedBinArray(nMatchedTrackBins, -0.5, 4.5);
445  const Int_t nDeltaEtaBins = 60;
446  Double_t *deltaEtaBins = GenerateFixedBinArray(nDeltaEtaBins, -0.015, 0.015);
447 
450 
451  // Plot M02 distribution (centrality, Eclus nonlincorr, M02)
452  histname = "ClusterHistograms/hM02";
453  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); M02";
455 
456  // Plot Ncell distribution for M02 > 0.4 and 0.1 < M02 < 0.4 (centrality, Eclus nonlincorr, Ncells)
457  histname = "ClusterHistograms/hNcellsM02G04";
458  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); Ncells";
459  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nCellBins, cellBins);
460 
461  histname = "ClusterHistograms/hNcellsM02L04";
462  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); Ncells";
463  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nCellBins, cellBins);
464 
467 
468  // Plot matched track pT for all clusters, M02 > 0.4 clusters, and 0.1 < M02 < 0.4 clusters (centrality, Eclus nonlincorr, trackPsum)
469  histname = "ClusterHistograms/hMatchedTrackPt";
470  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); #Sigma#it{p}_{track} (GeV/c)";
472 
473  histname = "ClusterHistograms/hMatchedTrackPtM02G04";
474  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); #Sigma#it{p}_{track} (GeV/c)";
476 
477  histname = "ClusterHistograms/hMatchedTrackPtM02L04";
478  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); #Sigma#it{p}_{track} (GeV/c)";
480 
481  // Plot number of matched tracks for all clusters, M02 > 0.4 clusters, and 0.1 < M02 < 0.4 clusters (centrality, Eclus nonlincorr, N matches)
482  histname = "ClusterHistograms/hMatchedTrackN";
483  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); N_{tracks}";
484  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nMatchedTrackBins, matchedTrackBins);
485 
486  histname = "ClusterHistograms/hMatchedTrackNM02G04";
487  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); N_{tracks}";
488  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nMatchedTrackBins, matchedTrackBins);
489 
490  histname = "ClusterHistograms/hMatchedTrackNM02L04";
491  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); N_{tracks}";
492  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nMatchedTrackBins, matchedTrackBins);
493 
494  // Plot M02 distribution for clusters with matched tracks (centrality, Eclus nonlincorr, M02)
495  histname = "ClusterHistograms/hM02Matched";
496  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); M02";
498 
499  // Plot M02 distribution for clusters without matched tracks (centrality, Eclus nonlincorr, M02)
500  histname = "ClusterHistograms/hM02Unmatched";
501  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); M02";
503 
504  // Plot clus-track deltaEta of matched tracks (deltaEta, Eclus, M02)
505  histname = "ClusterHistograms/hDeltaEtaCentral";
506  htitle = histname + ";#eta_{track} - #eta_{clus};#it{E}_{clus} (GeV); M02";
507  fHistManager.CreateTH3(histname.Data(), htitle.Data(), nDeltaEtaBins, deltaEtaBins, fNPtHistBins, fPtHistBins, fNM02HistBins, fM02HistBins);
508 
509  histname = "ClusterHistograms/hDeltaEtaPeripheral";
510  htitle = histname + ";#eta_{track} - #eta_{clus};#it{E}_{clus} (GeV); M02";
511  fHistManager.CreateTH3(histname.Data(), htitle.Data(), nDeltaEtaBins, deltaEtaBins, fNPtHistBins, fPtHistBins, fNM02HistBins, fM02HistBins);
512 
515 
516  // Plot E/p vs. M02 for 0-10% and 50-90% (Eclus nonlincorr, Eclus nonlincorr / trackPsum, M02)
517  histname = "ClusterHistograms/hEoverPM02Central";
518  htitle = histname + ";#it{E}_{clus} (GeV); #it{E}_{clus} / #Sigma#it{p}_{track} (GeV); M02";
520 
521  histname = "ClusterHistograms/hEoverPM02Peripheral";
522  htitle = histname + ";#it{E}_{clus} (GeV); #it{E}_{clus} / #Sigma#it{p}_{track} (GeV); M02";
524 
527 
528  // Plot Rcorr distribution (centrality, trackPSum, Rcorr = (Enonlincorr - Ehadcorr) / trackPSum)
529  histname = "ClusterHistograms/hRcorrVsCent";
530  htitle = histname + ";Centrality (%);#Sigma#it{p}_{track} (GeV); R_{corr} = #frac{#DeltaE_{clus}}{#Sigmap_{track}}";
531  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
532 
533  // Plot Rcorr distribution for 0-10% centrality (Eclus nonlincorr, trackPSum, Rcorr)
534  histname = "ClusterHistograms/hRcorr0-10";
535  htitle = histname + ";#it{E}_{clus} (GeV);#Sigma#it{p}_{track} (GeV); R_{corr} = #frac{#DeltaE_{clus}}{#Sigmap_{track}}";
536  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
537 
538  // Plot Rcorr distribution for 50-90% centrality (Eclus nonlincorr, trackPSum, Rcorr)
539  histname = "ClusterHistograms/hRcorr50-90";
540  htitle = histname + ";#it{E}_{clus} (GeV);#Sigma#it{p}_{track} (GeV); R_{corr} = #frac{#DeltaE_{clus}}{#Sigmap_{track}}";
541  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
542 
543  // Plot also Rcorr-clus (centrality, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
544  histname = "ClusterHistograms/hRcorrClusVsCent";
545  htitle = histname + ";Centrality (%);#Sigma#it{p}_{track} (GeV); #frac{#DeltaE_{clus}}{E_{clus}}";
546  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
547 
548  // Rcorr-clus for 0-10% centrality (Eclus nonlincorr, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
549  histname = "ClusterHistograms/hRcorrClus0-10";
550  htitle = histname + ";#it{E}_{clus} (GeV);#Sigma#it{p}_{track} (GeV); #frac{#DeltaE_{clus}}{E_{clus}}";
551  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
552 
553  // Rcorr-clus for 50-90% centrality (Eclus nonlincorr, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
554  histname = "ClusterHistograms/hRcorrClus50-90";
555  htitle = histname + ";#it{E}_{clus} (GeV);#Sigma#it{p}_{track} (GeV); #frac{#DeltaE_{clus}}{E_{clus}}";
556  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
557 
558  // Plot total track multiplicity
559  histname = "ClusterHistograms/hTrackMultiplicity";
560  htitle = histname + ";N_{tracks};Centrality (%)";
561  fHistManager.CreateTH2(histname.Data(), htitle.Data(), 1000, 0, 10000, 20, 0, 100);
562 }
563 
564 /*
565  * This function allocates the histograms for the jet composition study.
566  */
568 {
569  TString histname;
570  TString htitle;
571  Int_t nPtBins = TMath::CeilNint(fMaxPt/2);
572 
573  const Int_t nRejBins = 32;
574  Double_t* rejReasonBins = new Double_t[nRejBins+1];
575  GenerateFixedBinArray(nRejBins, 0, nRejBins, rejReasonBins);
576  const Int_t nContributorTypes = 11;
577  Double_t *contributorTypeBins = GenerateFixedBinArray(nContributorTypes, -0.5, 10.5);
578  const Int_t nParticleTypes = 17;
579  Double_t *particleTypeBins = GenerateFixedBinArray(nParticleTypes, -0.5, 16.5);
580 
581  AliEmcalContainer* cont = 0;
582  TIter nextClusColl(&fClusterCollArray);
583  while ((cont = static_cast<AliEmcalContainer*>(nextClusColl()))) {
584 
585  histname = "ClusterHistogramsMC/hClusterRejectionReasonMC";
586  htitle = histname + ";Rejection reason;#it{E}_{clus} (GeV/)";
587  TH2* histMC2 = fHistManager.CreateTH2(histname.Data(), htitle.Data(), nRejBins, rejReasonBins, fNPtHistBins, fPtHistBins);
588  SetRejectionReasonLabels(histMC2->GetXaxis());
589  }
590 
591  // M02 vs. Energy vs. Particle type
592  histname = "ClusterHistogramsMC/hM02VsParticleTypeCentral";
593  htitle = histname + ";M02;#it{E}_{clus} (GeV); Particle type";
594  TH3* hM02VsParticleTypeCentral = fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNM02HistBins, fM02HistBins, fNPtHistBins, fPtHistBins, nParticleTypes, particleTypeBins);
595  SetParticleTypeLabels(hM02VsParticleTypeCentral->GetZaxis());
596 
597  histname = "ClusterHistogramsMC/hM02VsParticleTypePeripheral";
598  htitle = histname + ";M02;#it{E}_{clus} (GeV); Particle type";
599  TH3* hM02VsParticleTypePeripheral = fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNM02HistBins, fM02HistBins, fNPtHistBins, fPtHistBins, nParticleTypes, particleTypeBins);
600  SetParticleTypeLabels(hM02VsParticleTypePeripheral->GetZaxis());
601 
602  // Plot photon energy in photon-hadron overlap clusters (Centrality, Photon energy, M02)
603  histname = "ClusterHistogramsMC/hPhotonHadronPhotonEnergy";
604  htitle = histname + ";Centrality (%);M02;#it{E}_{photon} (GeV)";
606 
607  // Plot hadron energy in hadron-photon overlap clusters (Centrality, Photon energy, M02)
608  histname = "ClusterHistogramsMC/hHadronPhotonHadronEnergy";
609  htitle = histname + ";Centrality (%);M02;#it{E}_{hadron} (GeV)";
611 
612  if (fPlotJetHistograms) {
613 
614  // M02 vs. Energy vs. Particle type vs. Jet pT, for particles inside jets
615  Int_t dim = 0;
616  TString title[20];
617  Int_t nbins[20] = {0};
618  Double_t min[30] = {0.};
619  Double_t max[30] = {0.};
620  Double_t *binEdges[20] = {0};
621 
622  title[dim] = "M02";
623  nbins[dim] = fNM02HistBins;
624  binEdges[dim] = fM02HistBins;
625  min[dim] = fM02HistBins[0];
626  max[dim] = fM02HistBins[fNM02HistBins];
627  dim++;
628 
629  title[dim] = "#it{E}_{clus} (GeV)";
630  nbins[dim] = fNPtHistBins;
631  binEdges[dim] = fPtHistBins;
632  min[dim] = fPtHistBins[0];
633  max[dim] = fPtHistBins[fNPtHistBins];
634  dim++;
635 
636  title[dim] = "Contributor type";
637  nbins[dim] = nContributorTypes;
638  min[dim] = -0.5;
639  max[dim] = 7.5;
640  binEdges[dim] = contributorTypeBins;
641  dim++;
642 
643  title[dim] = "#it{p}_{T,jet}^{corr}";
644  nbins[dim] = nPtBins;
645  min[dim] = 0;
646  max[dim] = fMaxPt;
647  binEdges[dim] = GenerateFixedBinArray(nbins[dim], min[dim], max[dim]);
648  dim++;
649 
650  TString thnname = "JetPerformanceMC/hM02VsContributorTypeJets";
651  THnSparse* hn = fHistManager.CreateTHnSparse(thnname.Data(), thnname.Data(), dim, nbins, min, max);
652  for (Int_t i = 0; i < dim; i++) {
653  hn->GetAxis(i)->SetTitle(title[i]);
654  hn->SetBinEdges(i, binEdges[i]);
655  }
656 
657  // Particle composition inside each jet -- jet pT vs. particle type vs. particle number vs. particle pT sum
658  // (One entry per jet for each particle type)
659  dim = 0;
660 
661  title[dim] = "#it{p}_{T,jet}^{corr}";
662  nbins[dim] = nPtBins;
663  min[dim] = 0;
664  max[dim] = fMaxPt;
665  binEdges[dim] = GenerateFixedBinArray(nbins[dim], min[dim], max[dim]);
666  dim++;
667 
668  title[dim] = "Contributor type";
669  nbins[dim] = nContributorTypes;
670  min[dim] = -0.5;
671  max[dim] = 7.5;
672  binEdges[dim] = contributorTypeBins;
673  dim++;
674 
675  title[dim] = "N";
676  nbins[dim] = 30;
677  min[dim] = -0.5;
678  max[dim] = 29.5;
679  binEdges[dim] = GenerateFixedBinArray(nbins[dim], min[dim], max[dim]);
680  dim++;
681 
682  title[dim] = "#it{p}_{T,sum} (GeV)";
683  nbins[dim] = fNPtHistBins;
684  binEdges[dim] = fPtHistBins;
685  min[dim] = fPtHistBins[0];
686  max[dim] = fPtHistBins[fNPtHistBins];
687  dim++;
688 
689  thnname = "JetPerformanceMC/hJetComposition";
690  THnSparse* thn = fHistManager.CreateTHnSparse(thnname.Data(), thnname.Data(), dim, nbins, min, max);
691  for (Int_t i = 0; i < dim; i++) {
692  thn->GetAxis(i)->SetTitle(title[i]);
693  thn->SetBinEdges(i, binEdges[i]);
694  }
695 
696  // Hadronic calo energy in each jet
697 
698  // Jet pT vs. Summed energy of hadronic clusters without a matched track
699  histname = "JetPerformance/hHadCaloEnergyUnmatched";
700  htitle = histname + ";#it{p}_{T,jet} (GeV);#it{p}_{T,had} (GeV)";
701  fHistManager.CreateTH2(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins);
702 
703  // Jet pT vs. Summed energy of hadronic clusters with a matched track (before hadronic correction)
704  histname = "JetPerformance/hHadCaloEnergyMatchedNonlincorr";
705  htitle = histname + ";#it{p}_{T,jet} (GeV);#it{p}_{T,had} (GeV)";
706  fHistManager.CreateTH2(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins);
707 
708  // Jet pT vs. Summed energy of hadronic clusters with a matched track (after hadronic correction)
709  histname = "JetPerformance/hHadCaloEnergyMatchedHadCorr";
710  htitle = histname + ";#it{p}_{T,jet} (GeV);#it{p}_{T,had} (GeV)";
711  fHistManager.CreateTH2(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins);
712 
713  }
714 
715 }
716 
717 /*
718  * This function sets axis labels for particle type histograms.
719  */
721 {
722  axis->SetBinLabel(1, "SinglePhoton");
723  axis->SetBinLabel(2, "SingleElectron");
724  axis->SetBinLabel(3, "SingleChargedPion");
725  axis->SetBinLabel(4, "SingleProton");
726  axis->SetBinLabel(5, "SingleAntiProton");
727  axis->SetBinLabel(6, "SingleChargedKaon");
728  axis->SetBinLabel(7, "SingleK0L");
729  axis->SetBinLabel(8, "SingleNeutron");
730  axis->SetBinLabel(9, "SingleAntiNeutron");
731  axis->SetBinLabel(10, "SingleOther");
732  axis->SetBinLabel(11, "PhotonHadron");
733  axis->SetBinLabel(12, "HadronPhoton");
734  axis->SetBinLabel(13, "MergedPi0");
735  axis->SetBinLabel(14, "PhotonPhotonOther");
736  axis->SetBinLabel(15, "HadronHadron");
737  axis->SetBinLabel(16, "TwoContributorsOther");
738  axis->SetBinLabel(17, "MoreThanTwoContributors");
739 }
740 
741 /*
742  * This function allocates background subtraction histograms, if enabled.
743  * A set of histograms is allocated per each jet container.
744  */
746 {
747  TString histname;
748  TString title;
749 
750  AliJetContainer* jets = 0;
751  TIter nextJetColl(&fJetCollArray);
752  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
753 
754  // EMCal
755  histname = TString::Format("%s/BackgroundHistograms/hScaleFactorEMCal", jets->GetArrayName().Data());
756  title = histname + ";Centrality;Scale factor;counts";
757  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 5);
758 
759  histname = TString::Format("%s/BackgroundHistograms/hDeltaPtEMCal", jets->GetArrayName().Data());
760  title = histname + ";Centrality (%);#delta#it{p}_{T} (GeV/#it{c});counts";
761  fHistManager.CreateTH2(histname.Data(), title.Data(), 10, 0, 100, 400, -50, 150);
762 
763  histname = TString::Format("%s/BackgroundHistograms/hScaleFactorEMCalFid", jets->GetArrayName().Data());
764  title = histname + ";Centrality;Scale factor;counts";
765  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 5);
766 
767  // DCal
768  if (fPlotDCal) {
769  histname = TString::Format("%s/BackgroundHistograms/hScaleFactorDCal", jets->GetArrayName().Data());
770  title = histname + ";Centrality;Scale factor;counts";
771  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 5);
772 
773  histname = TString::Format("%s/BackgroundHistograms/hDeltaPtDCal", jets->GetArrayName().Data());
774  title = histname + ";Centrality (%);#delta#it{p}_{T} (GeV/#it{c});counts";
775  fHistManager.CreateTH2(histname.Data(), title.Data(), 10, 0, 100, 400, -50, 150);
776 
777  histname = TString::Format("%s/BackgroundHistograms/hScaleFactorDCalFid", jets->GetArrayName().Data());
778  title = histname + ";Centrality;Scale factor;counts";
779  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 5);
780  }
781 
782  }
783 }
784 
785 /*
786  * This function allocates the histograms for single jets, when the "simulated" trigger has been fired.
787  * A set of histograms is allocated per each jet container.
788  */
790 {
791  TString histname;
792  TString title;
793  Int_t nPtBins = TMath::CeilNint(fMaxPt/2);
794 
795  //----------------------------------------------
796  // Trigger patch histograms
797 
798  // patch eta vs. phi
799  histname = "TriggerSimHistograms/hEtaVsPhi";
800  title = histname + ";#eta_{patch} (rad);#phi_{patch} (rad)";
801  fHistManager.CreateTH2(histname.Data(), title.Data(), 140, -0.7, 0.7, 500, 1., 6.);
802 
803  // N patches
804  histname = "TriggerSimHistograms/hNPatches";
805  title = histname + ";#it{N}_{patches};type";
806  fHistManager.CreateTH2(histname.Data(), title.Data(), 200, 0, 200, 2, -0.5, 1.5);
807 
808  // patch E vs. centrality
809  histname = "TriggerSimHistograms/hPatchE";
810  title = histname + ";Centrality (%);#it{E}_{patch} (GeV)";
811  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, nPtBins, 0, fMaxPt);
812 
813  // patch median vs. Centrality
814  histname = "TriggerSimHistograms/hPatchMedianE";
815  title = histname + ";Centrality (%);#it{E}_{patch,med} (GeV);type";
816  fHistManager.CreateTH3(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 50, 2, -0.5, 1.5);
817 
818  //----------------------------------------------
819  // Jet histograms for "triggered" events
820  AliJetContainer* jets = 0;
821  TIter nextJetColl(&fJetCollArray);
822  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
823 
824  // Jet rejection reason
825  histname = TString::Format("%s/TriggerSimHistograms/hJetRejectionReason", jets->GetArrayName().Data());
826  title = histname + ";Rejection reason;#it{p}_{T,jet} (GeV/#it{c});counts";
827  TH2* hist = fHistManager.CreateTH2(histname.Data(), title.Data(), 32, 0, 32, 50, 0, fMaxPt);
828  SetRejectionReasonLabels(hist->GetXaxis());
829 
830  // Rho vs. Centrality
831  if (!jets->GetRhoName().IsNull()) {
832  histname = TString::Format("%s/TriggerSimHistograms/hRhoVsCent", jets->GetArrayName().Data());
833  title = histname + ";Centrality (%);#rho (GeV/#it{c});counts";
834  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 500);
835  }
836 
837  // (Centrality, pT, NEF)
838  Int_t nbinsx = 20; Int_t minx = 0; Int_t maxx = 100;
839  Int_t nbinsy = nPtBins; Int_t miny = 0; Int_t maxy = fMaxPt;
840  Int_t nbinsz = 50; Int_t minz = 0; Int_t maxz = 1.;
841 
842  histname = TString::Format("%s/TriggerSimHistograms/hNEFVsPtEMCal", jets->GetArrayName().Data());
843  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});NEF";
844  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
845 
846  if (fPlotDCal) {
847  histname = TString::Format("%s/TriggerSimHistograms/hNEFVsPtDCal", jets->GetArrayName().Data());
848  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});NEF";
849  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
850  }
851 
852  // pT-leading vs. pT
853  histname = TString::Format("%s/TriggerSimHistograms/hPtLeadingVsPt", jets->GetArrayName().Data());
854  title = histname + ";#it{p}_{T}^{corr} (GeV/#it{c});#it{p}_{T,particle}^{leading} (GeV/#it{c})";
855  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins, 0, fMaxPt);
856 
857  // A vs. pT
858  histname = TString::Format("%s/TriggerSimHistograms/hAreaVsPt", jets->GetArrayName().Data());
859  title = histname + ";#it{p}_{T}^{corr} (GeV/#it{c});#it{A}_{jet}";
860  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 50, 0, 0.5);
861 
862  // (Centrality, pT, z-leading (charged))
863  nbinsx = 20; minx = 0; maxx = 100;
864  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
865  nbinsz = 50; minz = 0; maxz = 1.;
866 
867  histname = TString::Format("%s/TriggerSimHistograms/hZLeadingVsPtEMCal", jets->GetArrayName().Data());
868  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}_{leading}";
869  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
870 
871  if (fPlotDCal) {
872  histname = TString::Format("%s/TriggerSimHistograms/hZLeadingVsPtDCal", jets->GetArrayName().Data());
873  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}_{leading}";
874  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
875  }
876 
877  // z (charged) vs. pT
878  nbinsx = 20; minx = 0; maxx = 100;
879  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
880  nbinsz = 50; minz = 0; maxz = 1.;
881 
882  histname = TString::Format("%s/TriggerSimHistograms/hZVsPtEMCal", jets->GetArrayName().Data());
883  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}";
884  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
885 
886  if (fPlotDCal) {
887  histname = TString::Format("%s/TriggerSimHistograms/hZVsPtDCal", jets->GetArrayName().Data());
888  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}";
889  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
890  }
891 
892  // (Centrality, pT, Nconst)
893  nbinsx = 20; minx = 0; maxx = 100;
894  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
895  nbinsz = 50; minz = 0; maxz = fMaxPt;
896 
897  histname = TString::Format("%s/TriggerSimHistograms/hNConstVsPtEMCal", jets->GetArrayName().Data());
898  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});No. of constituents";
899  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
900 
901  if (fPlotDCal) {
902  histname = TString::Format("%s/TriggerSimHistograms/hNConstVsPtDCal", jets->GetArrayName().Data());
903  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});No. of constituents";
904  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
905  }
906 
907  }
908 }
909 
910 /*
911  * This function allocates histograms for matched truth-det jets in the case of embedding.
912  * The jet matching information must be previously filled by another task, such as AliJetResponseMaker.
913  */
915 {
916  TString histname;
917  TString title;
918  Int_t nPtBins = TMath::CeilNint(fMaxPt/2);
919 
920  // Response matrix, (centrality, pT-truth, pT-det)
921  Int_t nbinsx = 20; Int_t minx = 0; Int_t maxx = 100;
922  Int_t nbinsy = fMaxPt; Int_t miny = 0; Int_t maxy = fMaxPt;
923  Int_t nbinsz = fMaxPt; Int_t minz = 0; Int_t maxz = fMaxPt;
924 
925  histname = "MatchedJetHistograms/hResponseMatrixEMCal";
926  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});#it{p}_{T,corr}^{det} (GeV/#it{c})";
927  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
928 
929  if (fPlotDCal) {
930  histname = "MatchedJetHistograms/hResponseMatrixDCal";
931  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});#it{p}_{T,corr}^{det} (GeV/#it{c})";
932  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
933  }
934 
935  // JES shift, (centrality, pT-truth, (pT-det - pT-truth) / pT-truth)
936  nbinsx = 20; minx = 0; maxx = 100;
937  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
938  nbinsz = 250; minz = -5.; maxz = 5.;
939 
940  histname = "MatchedJetHistograms/hJESshiftEMCal";
941  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});#frac{#it{p}_{T,corr}^{det} - #it{p}_{T}^{truth}}{#it{p}_{T}^{truth}}";
942  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
943 
944  if (fPlotDCal) {
945  histname = "MatchedJetHistograms/hJESshiftDCal";
946  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});#frac{#it{p}_{T,corr}^{det} - #it{p}_{T}^{truth}}{#it{p}_{T}^{truth}}";
947  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
948  }
949 
950  // NEF of det-level matched jets, (centrality, pT-truth, NEF)
951  nbinsx = 20; minx = 0; maxx = 100;
952  nbinsy = fMaxPt; miny = 0; maxy = fMaxPt;
953  nbinsz = 50; minz = 0; maxz = 1.;
954 
955  histname = "MatchedJetHistograms/hNEFVsPt";
956  title = histname + ";Centrality (%);#it{p}_{T,corr}^{det} (GeV/#it{c});Calo energy fraction";
957  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
958 
959  // z-leading (charged) of det-level matched jets, (centrality, pT-truth, z-leading)
960  nbinsx = 20; minx = 0; maxx = 100;
961  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
962  nbinsz = 50; minz = 0; maxz = 1.;
963 
964  histname = "MatchedJetHistograms/hZLeadingVsPt";
965  title = histname + ";Centrality (%);#it{p}_{T,corr}^{det} (GeV/#it{c});#it{z}_{leading}";
966  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
967 
968  // Matching distance, (centrality, pT-truth, R)
969  nbinsx = 20; minx = 0; maxx = 100;
970  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
971  nbinsz = 50; minz = 0; maxz = 1.;
972 
973  histname = "MatchedJetHistograms/hMatchingDistance";
974  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});R";
975  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
976 
977  histname = "MatchedJetHistograms/hMatchingDistancepp";
978  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});R";
979  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
980 
981  // Jet matching QA (copied from AliAnalysisTaskEmcalJetHCorrelations.cxx)
982  histname = "MatchedJetHistograms/fHistJetMatchingQA";
983  title = histname;
984  std::vector<std::string> binLabels = {"noMatch", "matchedJet", "sharedMomentumFraction", "partLevelMatchedJet", "jetDistance", "passedAllCuts"};
985  auto histMatchedJetCuts = fHistManager.CreateTH1(histname.Data(), title.Data(), binLabels.size(), 0, binLabels.size());
986  // Set label names
987  for (unsigned int i = 1; i <= binLabels.size(); i++) {
988  histMatchedJetCuts->GetXaxis()->SetBinLabel(i, binLabels.at(i-1).c_str());
989  }
990  histMatchedJetCuts->GetYaxis()->SetTitle("Number of jets");
991 
992 }
993 
999 {
1000  // Configure base class to set fTriggerPatchInfo to array of trigger patches, each event
1001  // (Need to call this before base class ExecOnce)
1002  if (fDoTriggerSimulation) {
1003  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
1004  }
1005 
1007 
1008  fNeedEmcalGeom = kTRUE;
1009 
1010  // Check if trigger patches are loaded
1011  if (fDoTriggerSimulation) {
1012  if (fTriggerPatchInfo) {
1013  TString objname(fTriggerPatchInfo->GetClass()->GetName());
1014  TClass cls(objname);
1015  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
1016  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",
1017  GetName(), cls.GetName(), "EmcalTriggers"));
1018  fTriggerPatchInfo = 0;
1019  }
1020  }
1021  if (!fTriggerPatchInfo) {
1022  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
1023  return;
1024  }
1025  }
1026 }
1027 
1032 
1033  // Get the downscaling factors for MB triggers (to be used to calculate trigger efficiency)
1034 
1036 
1037  // Get instance of the downscale factor helper class
1039  downscaleOCDB->SetRun(InputEvent()->GetRunNumber());
1040 
1041  // There are two possible min bias triggers for LHC15o
1042  TString triggerNameMB1 = "CINT7-B-NOPF-CENT";
1043  TString triggerNameMB2 = "CV0L7-B-NOPF-CENT";
1044  TString triggerNameJE = "CINT7EJ1-B-NOPF-CENTNOPMD";
1045 
1046  // Get the downscale factor for whichever MB trigger exists in the given run
1047  std::vector<TString> runtriggers = downscaleOCDB->GetTriggerClasses();
1048  Double_t downscalefactor;
1049  for (auto i : runtriggers) {
1050  if (i.EqualTo(triggerNameMB1) || i.EqualTo(triggerNameMB2)) {
1051  downscalefactor = downscaleOCDB->GetDownscaleFactorForTriggerClass(i.Data());
1052  break;
1053  }
1054  }
1055 
1056  // Store the inverse of the downscale factor, used later to weight the pT spectrum
1057  fMBUpscaleFactor = 1/downscalefactor;
1058 
1059  TString histname = "Trigger/hMBDownscaleFactor";
1060  fHistManager.FillTH1(histname.Data(), fMBUpscaleFactor);
1061 
1062  }
1063 
1064 }
1065 
1070 {
1071  if (fUseAliEventCuts) {
1072  if (!fEventCuts.AcceptEvent(InputEvent()))
1073  {
1074  PostData(1, fOutput);
1075  return kFALSE;
1076  }
1077  }
1078  else {
1080  }
1081  return kTRUE;
1082 }
1083 
1092 {
1093  TString histname;
1094  AliJetContainer* jetCont = 0;
1095  TIter next(&fJetCollArray);
1096  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
1097  TString jetContName = jetCont->GetName();
1098 
1099  // Do a simple trigger simulation (if requested)
1100  if (fDoTriggerSimulation) {
1102  }
1103 
1104  }
1105 
1106  // Compute the full jet background scale factor and delta-pt
1107  if (fComputeBackground) {
1109  }
1110 
1111  // Only fill the embedding qa plots if:
1112  // - We are using the embedding helper
1113  // - The class has been initialized
1114  // - Both jet collections are available
1115  if (fEmbeddingQA.IsInitialized()) {
1117  }
1118 
1119  return kTRUE;
1120 }
1121 
1126 {
1127  TString histname;
1128 
1129  // Check if trigger patches are loaded
1130  if (fTriggerPatchInfo) {
1131  TString objname(fTriggerPatchInfo->GetClass()->GetName());
1132  TClass cls(objname);
1133  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
1134  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",
1135  GetName(), cls.GetName(), "EmcalTriggers"));
1136  fTriggerPatchInfo = 0;
1137  }
1138  }
1139  if (!fTriggerPatchInfo) {
1140  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
1141  return;
1142  }
1143 
1144  // Compute patches in EMCal, DCal (I want offline simple trigger patch, i.e. patch calculated using FEE energy)
1145  std::vector<Double_t> vecEMCal;
1146  std::vector<Double_t> vecDCal;
1147  for(auto p : *fTriggerPatchInfo){
1148  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
1149  if (recpatch) {
1150 
1151  if(!recpatch->IsJetHighSimple()) continue;
1152 
1153  histname = "TriggerSimHistograms/hEtaVsPhi";
1154  fHistManager.FillTH2(histname.Data(), recpatch->GetEtaGeo(), recpatch->GetPhiGeo());
1155 
1156  histname = "TriggerSimHistograms/hPatchE";
1157  fHistManager.FillTH2(histname.Data(), fCent, recpatch->GetPatchE());
1158 
1159  if (recpatch->IsEMCal()) {
1160  vecEMCal.push_back(recpatch->GetPatchE());
1161  } else {
1162  vecDCal.push_back(recpatch->GetPatchE());
1163  }
1164 
1165  }
1166  }
1167 
1168  // Compute the median in each calorimeter
1169  const Int_t nBkgPatchesEMCal = vecEMCal.size(); // 6*8;
1170  const Int_t nBkgPatchesDCal = vecDCal.size(); // 4*5;
1171  fMedianEMCal = TMath::Median(nBkgPatchesEMCal, &vecEMCal[0]); // point to array used internally by vector
1172  fMedianDCal = TMath::Median(nBkgPatchesDCal, &vecDCal[0]);
1173 
1174  histname = "TriggerSimHistograms/hPatchMedianE";
1175  fHistManager.FillTH3(histname.Data(), fCent, fMedianEMCal, kEMCal);
1176  fHistManager.FillTH3(histname.Data(), fCent, fMedianDCal, kDCal);
1177 
1178  histname = "TriggerSimHistograms/hNPatches";
1179  fHistManager.FillTH2(histname.Data(), nBkgPatchesEMCal, kEMCal);
1180  fHistManager.FillTH2(histname.Data(), nBkgPatchesDCal, kDCal);
1181 
1182  // Then compute background subtracted patches, by subtracting from each patch the median patch E from the opposite hemisphere
1183  // If a patch is above threshold, the event is "triggered"
1184  Bool_t fkEMCEJE = kFALSE;
1185  Double_t threshold = 20;
1186  for(auto p : *fTriggerPatchInfo){
1187  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
1188  if (recpatch) {
1189 
1190  if(!recpatch->IsJetHighSimple()) continue;
1191 
1192  if (recpatch->IsEMCal()) {
1193  if ((recpatch->GetPatchE() - fMedianDCal) > threshold) {
1194  fkEMCEJE = kTRUE;
1195  break;
1196  }
1197  } else {
1198  if ((recpatch->GetPatchE() - fMedianEMCal) > threshold) {
1199  fkEMCEJE = kTRUE;
1200  break;
1201  }
1202  }
1203  }
1204  }
1205 
1206  if (fkEMCEJE) {
1208  }
1209 
1210 }
1211 
1219 {
1220 
1221  if (fPlotJetHistograms) {
1223  }
1224  if (fPlotClusterHistograms) {
1226  }
1229  }
1232  }
1233 
1234  return kTRUE;
1235 }
1236 
1242 {
1243  TString histname;
1244  AliJetContainer* jets = 0;
1245  TIter nextJetColl(&fJetCollArray);
1246  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
1247  TString jetContName = jets->GetName();
1248 
1249  Double_t rhoVal = 0;
1250  if (jets->GetRhoParameter()) {
1251  rhoVal = jets->GetRhoVal();
1252  histname = TString::Format("%s/JetHistograms/hRhoVsCent", jets->GetArrayName().Data());
1253  fHistManager.FillTH2(histname.Data(), fCent, rhoVal);
1254  }
1255 
1256  for (auto jet : jets->all()) {
1257 
1258  Float_t ptLeading = jets->GetLeadingHadronPt(jet);
1259  Float_t corrPt = GetJetPt(jet, rhoVal);
1260 
1261  // compute jet acceptance type
1262  Double_t type = GetJetType(jet);
1263  if ( type != kEMCal ) {
1264  if ( type != kDCal || !fPlotDCal ) {
1265  continue;
1266  }
1267  }
1268 
1269  // (Centrality, Area, pT) (fill before area cut)
1270  histname = TString::Format("%s/JetHistograms/hAreaVsPt", jets->GetArrayName().Data());
1271  fHistManager.FillTH3(histname.Data(), fCent, corrPt, jet->Area());
1272 
1273  // (Centrality, pT-leading, pT) (before leading hadron cuts)
1274  histname = TString::Format("%s/JetHistograms/hPtLeadingVsPt", jets->GetArrayName().Data());
1275  fHistManager.FillTH3(histname.Data(), fCent, corrPt, ptLeading);
1276 
1277  // (Centrality, pT, z-leading (charged)) (before leading hadron cuts)
1278  if (type == kEMCal) {
1279  histname = TString::Format("%s/JetHistograms/hZLeadingVsPtEMCal", jets->GetArrayName().Data());
1280  }
1281  else if (type == kDCal) {
1282  histname = TString::Format("%s/JetHistograms/hZLeadingVsPtDCal", jets->GetArrayName().Data());
1283  }
1284  TLorentzVector leadPart;
1285  jets->GetLeadingHadronMomentum(leadPart, jet);
1286  Double_t z = GetParallelFraction(leadPart.Vect(), jet);
1287  if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999; // so that it will contribute to the bin <1
1288  fHistManager.FillTH3(histname, fCent, corrPt, z);
1289 
1290  // Rejection reason
1291  UInt_t rejectionReason = 0;
1292  if (!jets->AcceptJet(jet, rejectionReason)) {
1293  histname = TString::Format("%s/JetHistograms/hJetRejectionReason", jets->GetArrayName().Data());
1294  fHistManager.FillTH3(histname.Data(), fCent, jets->GetRejectionReasonBitPosition(rejectionReason), corrPt);
1295  continue;
1296  }
1297 
1298  // (Centrality, pT, NEF)
1299  if (type == kEMCal) {
1300  histname = TString::Format("%s/JetHistograms/hNEFVsPtEMCal", jets->GetArrayName().Data());
1301  }
1302  else if (type == kDCal) {
1303  histname = TString::Format("%s/JetHistograms/hNEFVsPtDCal", jets->GetArrayName().Data());
1304  }
1305  fHistManager.FillTH3(histname, fCent, corrPt, jet->NEF());
1306 
1307  // (Centrality, pT upscaled, calo type)
1308  if (fComputeMBDownscaling) {
1309  histname = TString::Format("%s/JetHistograms/hPtUpscaledMB", jets->GetArrayName().Data());
1310  fHistManager.FillTH3(histname.Data(), fCent, corrPt, type, fMBUpscaleFactor);
1311  }
1312 
1313  // (Centrality, pT, z (charged))
1314  if (type == kEMCal) {
1315  histname = TString::Format("%s/JetHistograms/hZVsPtEMCal", jets->GetArrayName().Data());
1316  }
1317  else if (type == kDCal) {
1318  histname = TString::Format("%s/JetHistograms/hZVsPtDCal", jets->GetArrayName().Data());
1319  }
1320  const AliVTrack* track;
1321  for (Int_t i=0; i<jet->GetNumberOfTracks(); i++) {
1322  track = static_cast<AliVTrack*>(jet->Track(i));
1323  z = track->Pt() / TMath::Abs(corrPt);
1324  fHistManager.FillTH3(histname, fCent, corrPt, z);
1325  }
1326 
1327  // (Centrality, pT, Nconst)
1328  if (type == kEMCal) {
1329  histname = TString::Format("%s/JetHistograms/hNConstVsPtEMCal", jets->GetArrayName().Data());
1330  }
1331  else if (type == kDCal) {
1332  histname = TString::Format("%s/JetHistograms/hNConstVsPtDCal", jets->GetArrayName().Data());
1333  }
1334  fHistManager.FillTH3(histname, fCent, corrPt, 1.*jet->GetNumberOfConstituents());
1335 
1336  // (Centrality, pT) for eta<0 and eta>0
1337  if (type == kEMCal) {
1338  if (jet->Eta() > 0) {
1339  histname = TString::Format("%s/JetHistograms/hEtaPosVsPtEMCal", jets->GetArrayName().Data());
1340  fHistManager.FillTH2(histname, fCent, corrPt);
1341  }
1342  else if (jet->Eta() < 0) {
1343  histname = TString::Format("%s/JetHistograms/hEtaNegVsPtEMCal", jets->GetArrayName().Data());
1344  fHistManager.FillTH2(histname, fCent, corrPt);
1345  }
1346  }
1347 
1348  // (Centrality, jet pT, Enonlincorr - Ehadcorr)
1349  Double_t deltaEhadcorr = 0;
1350  const AliVCluster* clus = nullptr;
1351  Int_t nClusters = jet->GetNumberOfClusters();
1352  for (Int_t iClus = 0; iClus < nClusters; iClus++) {
1353  clus = jet->Cluster(iClus);
1354  deltaEhadcorr += (clus->GetNonLinCorrEnergy() - clus->GetHadCorrEnergy());
1355  }
1356 
1357  histname = TString::Format("%s/JetHistograms/hDeltaEHadCorr", jets->GetArrayName().Data());
1358  fHistManager.FillTH3(histname, fCent, corrPt, deltaEhadcorr);
1359 
1360 
1361  // (Median patch energy, calo type, jet pT, centrality)
1362  if (fDoTriggerSimulation) {
1363  histname = TString::Format("%s/JetHistograms/hMedPatchJet", jets->GetArrayName().Data());
1364  Double_t x[4] = {fMedianEMCal, kEMCal, corrPt, fCent};
1365  fHistManager.FillTHnSparse(histname, x);
1366  Double_t y[4] = {fMedianDCal, kDCal, corrPt, fCent};
1367  fHistManager.FillTHnSparse(histname, y);
1368  }
1369 
1370  } //jet loop
1371 
1372  }
1373 }
1374 
1375 /*
1376  * This function fills the histograms for the calorimeter performance study.
1377  */
1379 {
1380  TString histname;
1381 
1382  // Loop through clusters
1384  const AliVCluster* clus;
1385  for (auto it : clusters->accepted_momentum()) {
1386 
1387  clus = it.second;
1388  Double_t clusPhi = it.first.Phi_0_2pi();
1389  Double_t clusEta = it.first.Eta();
1390 
1391  // Include only EMCal/DCal clusters
1392  if (!clus->IsEMCAL()) {
1393  continue;
1394  }
1395 
1396  // Compute the sum of matched track momentum, and various track matching / hadronic corretion quantities
1397  Double_t trackPSum = 0;
1398  Int_t nTracksMatched = 0;
1399  const AliVTrack* track = nullptr;
1400  for (Int_t itrack=0; itrack < clus->GetNTracksMatched(); itrack++) {
1401  track = dynamic_cast<AliVTrack*>(clus->GetTrackMatched(itrack));
1402  if (!track) {
1403  continue;
1404  }
1405 
1406  Double_t trackPhi = TVector2::Phi_0_2pi(track->GetTrackPhiOnEMCal());
1407  Double_t trackEta = track->GetTrackEtaOnEMCal();
1408  Double_t deta = TMath::Abs(clusEta - trackEta);
1409  Double_t dphi = TMath::Abs(clusPhi - trackPhi);
1410 
1412  trackPSum += track->P();
1413  nTracksMatched++;
1414  }
1415  }
1416 
1417  Double_t EoverP = 0;
1418  if (trackPSum > 1e-3) {
1419  EoverP = clus->GetNonLinCorrEnergy() / trackPSum;
1420  }
1421 
1422  Double_t deltaE = clus->GetNonLinCorrEnergy() - clus->GetHadCorrEnergy();
1423  Double_t Rcorr = 0;
1424  if (trackPSum > 1e-3) {
1425  Rcorr = deltaE / trackPSum;
1426  }
1427  Double_t RcorrClus = deltaE / clus->GetNonLinCorrEnergy();
1428 
1431 
1432  // Fill M02 distribution (centrality, Eclus nonlincorr, M02)
1433  histname = "ClusterHistograms/hM02";
1434  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetM02());
1435 
1436  // Plot Ncell distribution for M02 > 0.4 or M02 < 0.4 (centrality, Eclus nonlincorr, Ncells)
1437  if (clus->GetM02() > 0.4) {
1438  histname = "ClusterHistograms/hNcellsM02G04";
1439  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetNCells());
1440  }
1441  if (clus->GetM02() > 0.1 && clus->GetM02() < 0.4) {
1442  histname = "ClusterHistograms/hNcellsM02L04";
1443  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetNCells());
1444  }
1445 
1448 
1449  // Plot matched track pT (centrality, Eclus nonlincorr, trackPsum)
1450  histname = "ClusterHistograms/hMatchedTrackPt";
1451  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), trackPSum);
1452 
1453  if (clus->GetM02() > 0.4) {
1454  histname = "ClusterHistograms/hMatchedTrackPtM02G04";
1455  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), trackPSum);
1456  }
1457  if (clus->GetM02() > 0.1 && clus->GetM02() < 0.4) {
1458  histname = "ClusterHistograms/hMatchedTrackPtM02L04";
1459  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), trackPSum);
1460  }
1461 
1462  // Plot number of matched tracks (centrality, Eclus nonlincorr, N matches)
1463  histname = "ClusterHistograms/hMatchedTrackN";
1464  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), nTracksMatched);
1465 
1466  if (clus->GetM02() > 0.4) {
1467  histname = "ClusterHistograms/hMatchedTrackNM02G04";
1468  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), nTracksMatched);
1469  }
1470  if (clus->GetM02() > 0.1 && clus->GetM02() < 0.4) {
1471  histname = "ClusterHistograms/hMatchedTrackNM02L04";
1472  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), nTracksMatched);
1473  }
1474 
1475  // Plot M02 distribution for clusters with matched tracks (centrality, Eclus nonlincorr, M02)
1476  histname = "ClusterHistograms/hM02Matched";
1477  if (nTracksMatched > 0) {
1478  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetM02());
1479  }
1480 
1481  // Plot M02 distribution for clusters without matched tracks (centrality, Eclus nonlincorr, M02)
1482  histname = "ClusterHistograms/hM02Unmatched";
1483  if (nTracksMatched == 0) {
1484  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetM02());
1485  }
1486 
1487  // Plot clus-track deltaEta if there is one matched track (deltaEta, Eclus, M02)
1488  if (nTracksMatched == 1) {
1489 
1490  const AliVTrack* track = dynamic_cast<AliVTrack*>(clus->GetTrackMatched(0));
1491  if (track) {
1492  Double_t trackEta = track->GetTrackEtaOnEMCal();
1493  Double_t deta = trackEta - clusEta;
1494 
1495  if (fCent > 0 && fCent < 10) {
1496  histname = "ClusterHistograms/hDeltaEtaCentral";
1497  fHistManager.FillTH3(histname.Data(), deta, clus->GetNonLinCorrEnergy(), clus->GetM02());
1498  }
1499 
1500  if (fCent > 50 && fCent < 90) {
1501  histname = "ClusterHistograms/hDeltaEtaPeripheral";
1502  fHistManager.FillTH3(histname.Data(), deta, clus->GetNonLinCorrEnergy(), clus->GetM02());
1503  }
1504  }
1505  }
1506 
1509 
1510  // Plot E/p vs. M02 for 0-10% and 50-90% (Eclus nonlincorr, Eclus nonlincorr / trackPsum, M02)
1511  if (fCent > 0 && fCent < 10) {
1512  histname = "ClusterHistograms/hEoverPM02Central";
1513  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), EoverP, clus->GetM02());
1514  }
1515  if (fCent > 50 && fCent < 90) {
1516  histname = "ClusterHistograms/hEoverPM02Peripheral";
1517  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), EoverP, clus->GetM02());
1518  }
1519 
1522 
1523  // Fill Rcorr distribution (centrality, trackPSum, Rcorr = (Enonlincorr - Ehadcorr) / trackPSum)
1524  histname = "ClusterHistograms/hRcorrVsCent";
1525  fHistManager.FillTH3(histname, fCent, trackPSum, Rcorr);
1526 
1527  // Fill Rcorr distribution for 0-10% centrality (Eclus nonlincorr, trackPSum, Rcorr)
1528  if (fCent > 0 && fCent < 10) {
1529  histname = "ClusterHistograms/hRcorr0-10";
1530  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), trackPSum, Rcorr);
1531  }
1532 
1533  // Fill Rcorr distribution for 50-90% centrality (Eclus nonlincorr, trackPSum, Rcorr)
1534  if (fCent > 50 && fCent < 90) {
1535  histname = "ClusterHistograms/hRcorr50-90";
1536  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), trackPSum, Rcorr);
1537  }
1538 
1539  // Fill also Rcorr-clus (centrality, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
1540  histname = "ClusterHistograms/hRcorrClusVsCent";
1541  fHistManager.FillTH3(histname, fCent, trackPSum, RcorrClus);
1542 
1543  // Fill Rcorr-clus for 0-10% centrality (Eclus nonlincorr, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
1544  if (fCent > 0 && fCent < 10) {
1545  histname = "ClusterHistograms/hRcorrClus0-10";
1546  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), trackPSum, RcorrClus);
1547  }
1548 
1549  // Fill Rcorr-clus for 50-90% centrality (Eclus nonlincorr, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
1550  if (fCent > 50 && fCent < 90) {
1551  histname = "ClusterHistograms/hRcorrClus50-90";
1552  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), trackPSum, RcorrClus);
1553  }
1554 
1555  }
1556 
1557  // Fill total track multiplicity
1558  histname = "ClusterHistograms/hTrackMultiplicity";
1559  AliTrackContainer* trackCont = dynamic_cast<AliTrackContainer*>(GetParticleContainer("tracks"));
1560  Int_t nTracks = trackCont->GetNAcceptedTracks();
1561  fHistManager.FillTH2(histname.Data(), nTracks, fCent);
1562 
1563 }
1564 
1565 /*
1566  * This function fills particle composition histograms for the calorimeter performance study in MC.
1567  */
1569 {
1570  // If MC, get the MC event
1571  const AliMCEvent* mcevent = nullptr;
1572  if (fGeneratorLevel) {
1573  mcevent = MCEvent();
1574  }
1575  else {
1576  return;
1577  }
1578 
1579  // Loop through clusters, and plot M02 for each particle type
1581 
1582  // Loop through jets, to fill various histograms
1583  if (fPlotJetHistograms) {
1585  }
1586 
1587 }
1588 
1589 /*
1590  * Loop through clusters, and plot M02 for each particle type
1591  */
1593 {
1594  TString histname;
1596  const AliVCluster* clus;
1597  std::vector<ContributorType> vecContributorTypes;
1598  std::vector<Int_t> vecContributorLabels;
1599  for (auto it : clusters->accepted_momentum()) {
1600 
1601  clus = it.second;
1602 
1603  // Include only EMCal/DCal clusters (reject PHOS clusters)
1604  if (!clus->IsEMCAL()) {
1605  continue;
1606  }
1607 
1608  // Loop through the cluster's contributors in order to classify its type
1609  ParticleType particleType = kNotDefined;
1610  ContributorType contributorType = kUndefined;
1611  const Int_t nLabels = clus->GetNLabels();
1612 
1613  // Create a vector to store the contributor types for PhysicalPrimary particles
1614  vecContributorTypes.clear();
1615  vecContributorLabels.clear();
1616  for (Int_t iLabel=0; iLabel<nLabels; iLabel++) {
1617 
1618  Int_t label = clus->GetLabels()[iLabel];
1619  if (TMath::Abs(label) > 0) { // if the particle has a truth-level match, the label is nonzero
1620  contributorType = GetContributorType(clus, mcevent, label);
1621  if (contributorType != kUndefined) {
1622  vecContributorTypes.push_back(contributorType);
1623  vecContributorLabels.push_back(label);
1624  }
1625  }
1626  }
1627 
1628  Int_t nLabelsPhysPrim = vecContributorTypes.size();
1629 
1630  if (nLabelsPhysPrim == 1) {
1631 
1632  contributorType = vecContributorTypes[0];
1633 
1634  if (contributorType == kPhoton) {
1635  particleType = kSinglePhoton;
1636  }
1637  else if (contributorType == kElectron) {
1638  particleType = kSingleElectron;
1639  }
1640  else if (contributorType == kChargedPion) {
1641  particleType = kSingleChargedPion;
1642  }
1643  else if (contributorType == kProton) {
1644  particleType = kSingleProton;
1645  }
1646  else if (contributorType == kAntiProton) {
1647  particleType = kSingleAntiProton;
1648  }
1649  else if (contributorType == kChargedKaon) {
1650  particleType = kSingleChargedKaon;
1651  }
1652  else if (contributorType == kK0L) {
1653  particleType = kSingleK0L;
1654  }
1655  else if (contributorType == kNeutron) {
1656  particleType = kSingleNeutron;
1657  }
1658  else if (contributorType == kAntiNeutron) {
1659  particleType = kSingleAntiNeutron;
1660  }
1661  else {
1662  particleType = kSingleOther;
1663  }
1664 
1665  }
1666  else if (nLabelsPhysPrim == 2) {
1667 
1668  // Get the contributor particle types
1669  ContributorType contributorType1 = vecContributorTypes[0];
1670  ContributorType contributorType2 = vecContributorTypes[1];
1671 
1672  // Get the fraction of cluster energy from each contributor
1673  //Double_t frac0 = clus->GetClusterMCEdepFraction(0);
1674  Double_t frac1 = clus->GetClusterMCEdepFraction(1);
1675 
1676  // Check whether the leading/subleading contributors are photons/hadrons
1677  Bool_t isHadron1 = IsHadron(contributorType1);
1678  Bool_t isHadron2 = IsHadron(contributorType2);
1679  Bool_t isPhoton1 = contributorType1 == kPhoton;
1680  Bool_t isPhoton2 = contributorType2 == kPhoton;
1681 
1682  if (isHadron1 && isHadron2) {
1683  particleType = kHadronHadron;
1684  }
1685  else if (isPhoton1 && isHadron2) {
1686  particleType = kPhotonHadron;
1687 
1688  // Plot cluster energy when subleading hadron is subtracted
1689  Double_t photonEnergy = clus->GetNonLinCorrEnergy() * (1 - frac1);
1690  histname = "ClusterHistogramsMC/hPhotonHadronPhotonEnergy";
1691  fHistManager.FillTH3(histname.Data(), fCent, clus->GetM02(), photonEnergy);
1692  }
1693  else if (isHadron1 && isPhoton2) {
1694  particleType = kHadronPhoton;
1695 
1696  // Plot cluster energy when subleading hadron is subtracted
1697  Double_t hadronEnergy = clus->GetNonLinCorrEnergy() * (1 - frac1);
1698  histname = "ClusterHistogramsMC/hHadronPhotonHadronEnergy";
1699  fHistManager.FillTH3(histname.Data(), fCent, clus->GetM02(), hadronEnergy);
1700  }
1701  else if (isPhoton1 && isPhoton2) {
1702 
1703  // By default, assume the two photons are not a merged pi0
1704  particleType = kPhotonPhotonOther;
1705 
1706  // Using the vector of accepted contributor labels, check whether the two photons are from the same pi0
1707  AliAODMCParticle *part1 = fGeneratorLevel->GetMCParticleWithLabel(vecContributorLabels[0]);
1708  AliAODMCParticle *part2 = fGeneratorLevel->GetMCParticleWithLabel(vecContributorLabels[1]);
1709  if (part1 && part2) {
1710  Int_t iMother1 = part1->GetMother();
1711  Int_t iMother2 = part2->GetMother();
1712  AliVParticle *mother1 = mcevent->GetTrack(iMother1);
1713  AliVParticle *mother2 = mcevent->GetTrack(iMother2);
1714 
1715  if (mother1 && mother2) {
1716  if ( (mother1->PdgCode() == 111) && (mother2->PdgCode() == 111) ) {
1717  if (iMother1 == iMother2) {
1718  particleType = kMergedPi0;
1719  }
1720  }
1721  }
1722  }
1723  }
1724  else {
1725  particleType = kTwoContributorsOther; // this includes partially contained conversion overlaps
1726  }
1727 
1728  }
1729  else if (nLabelsPhysPrim > 2) {
1730  particleType = kMoreThanTwoContributors;
1731  }
1732 
1733  // (M02, Eclus, part type)
1734  if (fCent > 0 && fCent < 10) {
1735  histname = "ClusterHistogramsMC/hM02VsParticleTypeCentral";
1736  fHistManager.FillTH3(histname, clus->GetM02(), clus->GetNonLinCorrEnergy(), particleType);
1737  }
1738  if (fCent > 50 && fCent < 90) {
1739  histname = "ClusterHistogramsMC/hM02VsParticleTypePeripheral";
1740  fHistManager.FillTH3(histname, clus->GetM02(), clus->GetNonLinCorrEnergy(), particleType);
1741  }
1742 
1743  }
1744 }
1745 
1746 /*
1747  * Loop through jets, to fill particle composition histograms.
1748  */
1750 {
1751  TString histname;
1752 
1753  const AliVCluster* clus;
1754  AliJetContainer* jets = GetJetContainer(0); // there is only a single, det-level jet finder here
1755  for (const auto jet : jets->accepted()) {
1756 
1757  Double_t jetPt = GetJetPt(jet, 0);
1758 
1759  // Keep track of hadronic calo energy in each jet
1760  Double_t hadCaloEnergyUnmatched = 0;
1761  Double_t hadCaloEnergyMatchedNonlincorr = 0;
1762  Double_t hadCaloEnergyMatchedHadCorr = 0;
1763 
1764  // Loop through clusters in each jet, to plot several histograms
1765  Int_t nClusters = jet->GetNumberOfClusters();
1766  for (Int_t iClus = 0; iClus < nClusters; iClus++) {
1767 
1768  clus = jet->Cluster(iClus);
1769 
1770  // Get the particle type of the cluster
1771  ContributorType contributorType = kUndefined;
1772  Int_t label = TMath::Abs(clus->GetLabel());
1773  if (label > 0) {
1774  contributorType = GetContributorType(clus, mcevent, label);
1775  }
1776 
1777  // Plot M02 for each particle type
1778  histname = "JetPerformanceMC/hM02VsContributorTypeJets";
1779  Double_t x[4] = {clus->GetM02(), clus->GetNonLinCorrEnergy(), contributorType, jetPt};
1780  fHistManager.FillTHnSparse(histname, x);
1781 
1782  // If the cluster is a hadron, sum its energy to compute the jet's hadronic calo energy
1783  Bool_t isHadron = IsHadron(contributorType);
1784  if (isHadron) {
1785  Bool_t hasMatchedTrack = (clus->GetNTracksMatched() > 0);
1786  //Bool_t hasMatchedTrack = ((clus->GetNonLinCorrEnergy() - clus->GetHadCorrEnergy()) > 1e-3);
1787  if (hasMatchedTrack) {
1788  hadCaloEnergyMatchedNonlincorr += clus->GetNonLinCorrEnergy();
1789  hadCaloEnergyMatchedHadCorr += clus->GetHadCorrEnergy();
1790  }
1791  else {
1792  hadCaloEnergyUnmatched += clus->GetNonLinCorrEnergy();
1793  }
1794  }
1795 
1796  }
1797 
1798  // Fill hadronic calo energy in each jet
1799 
1800  // (Jet pT, Summed energy of hadronic clusters without a matched track)
1801  histname = "JetPerformance/hHadCaloEnergyUnmatched";
1802  fHistManager.FillTH2(histname, jetPt, hadCaloEnergyUnmatched);
1803 
1804  // (Jet pT vs. Summed energy of hadronic clusters with a matched track (before hadronic correction))
1805  histname = "JetPerformance/hHadCaloEnergyMatchedNonlincorr";
1806  fHistManager.FillTH2(histname, jetPt, hadCaloEnergyMatchedNonlincorr);
1807 
1808  // (Jet pT vs. Summed energy of hadronic clusters with a matched track (after hadronic correction))
1809  histname = "JetPerformance/hHadCaloEnergyMatchedHadCorr";
1810  fHistManager.FillTH2(histname, jetPt, hadCaloEnergyMatchedHadCorr);
1811 
1812  // Loop through particle types, and plot jet composition for each particle type
1813  histname = "JetPerformanceMC/hJetComposition";
1814  for (Int_t type = 0; type < 8; type++) {
1815 
1816  ContributorType contributorType = kUndefined;
1817  Double_t nSum = 0;
1818  Double_t pTsum = 0;
1819 
1820  // Loop through clusters in jet, and add to sum if cluster matches particle type
1821  for (Int_t iClus = 0; iClus < nClusters; iClus++) {
1822 
1823  clus = jet->Cluster(iClus);
1824 
1825  Int_t label = TMath::Abs(clus->GetLabel());
1826  if (label > 0) {
1827  contributorType = GetContributorType(clus, mcevent, label);
1828  }
1829 
1830  if (type == contributorType) {
1831  nSum++;
1832  pTsum += clus->GetNonLinCorrEnergy();
1833  }
1834  }
1835 
1836  // Fill jet composition histogram
1837  Double_t x[4] = {jetPt, 1.*type, nSum, pTsum};
1838  fHistManager.FillTHnSparse(histname, x);
1839 
1840  }
1841  }
1842 }
1843 
1848 {
1849  // Loop over tracks and clusters in order to:
1850  // (1) Compute scale factor for full jets
1851  // (2) Compute delta-pT for full jets, with the random cone method
1852 
1853  // Define the acceptance boundaries for the TPC and EMCal/DCal/PHOS
1854  Double_t etaTPC = 0.9;
1855  Double_t etaEMCal = 0.7;
1856  Double_t etaMinDCal = 0.22;
1857  Double_t phiMinEMCal = fGeom->GetArm1PhiMin() * TMath::DegToRad(); // 80
1858  Double_t phiMaxEMCal = fGeom->GetEMCALPhiMax() * TMath::DegToRad(); // ~188
1859  Double_t phiMinDCal = fGeom->GetDCALPhiMin() * TMath::DegToRad(); // 260
1860  Double_t phiMaxDCal = fGeom->GetDCALPhiMax() * TMath::DegToRad(); // ~327 (1/3 SMs start at 320)
1861 
1862  Double_t accTPC = 2 * etaTPC * 2 * TMath::Pi();
1863  Double_t accEMCal = 2 * etaEMCal * (phiMaxEMCal - phiMinEMCal);
1864  Double_t accDCal = 2 * (etaEMCal - etaMinDCal) * (phiMaxDCal - phiMinDCal);
1865 
1866  // Loop over jet containers
1867  AliJetContainer* jetCont = 0;
1868  TIter nextJetColl(&fJetCollArray);
1869  while ((jetCont = static_cast<AliJetContainer*>(nextJetColl()))) {
1870 
1871  // Define fiducial acceptances, to be used to generate random cones, and for scale factor studies
1872  TRandom3* r = new TRandom3(0);
1873  Double_t jetR = jetCont->GetJetRadius();
1874  Double_t etaEMCalfid = etaEMCal - jetR;
1875  Double_t etaMinDCalfid = etaMinDCal + jetR;
1876  Double_t phiMinEMCalfid = phiMinEMCal + jetR;
1877  Double_t phiMaxEMCalfid = phiMaxEMCal - jetR;
1878  Double_t phiMinDCalfid = phiMinDCal + jetR;
1879  Double_t phiMaxDCalfid = phiMaxDCal - jetR;
1880  Double_t accEMCalfid = 2 * etaEMCalfid * (phiMaxEMCalfid - phiMinEMCalfid);
1881  Double_t accDCalfid = 2 * (etaEMCalfid - etaMinDCalfid) * (phiMaxDCalfid - phiMinDCalfid);
1882  if ( (etaEMCalfid - etaMinDCalfid) < 0) {
1883  accDCalfid = 0;
1884  }
1885 
1886  // Generate EMCal random cone eta-phi
1887  Double_t etaEMCalRC = r->Uniform(-etaEMCalfid, etaEMCalfid);
1888  Double_t phiEMCalRC = r->Uniform(phiMinEMCalfid, phiMaxEMCalfid);
1889 
1890  // Generate DCal random cone eta-phi
1891  Double_t etaDCalRC = r->Uniform(etaMinDCalfid, etaEMCalfid);
1892  Double_t sign = r->Uniform(-1., 1.);
1893  if (sign < 0) {
1894  etaDCalRC = -1*etaDCalRC;
1895  }
1896  Double_t phiDCalRC = r->Uniform(phiMinDCalfid, phiMaxDCalfid);
1897 
1898  // Initialize the various sums to 0
1899  Double_t trackPtSumTPC = 0;
1900  Double_t trackPtSumEMCal = 0;
1901  Double_t trackPtSumEMCalfid = 0;
1902  Double_t trackPtSumDCal = 0;
1903  Double_t trackPtSumDCalfid = 0;
1904  Double_t trackPtSumEMCalRC = 0;
1905  Double_t trackPtSumDCalRC = 0;
1906  Double_t clusPtSumEMCal = 0;
1907  Double_t clusPtSumEMCalfid = 0;
1908  Double_t clusPtSumDCal = 0;
1909  Double_t clusPtSumDCalfid = 0;
1910  Double_t clusPtSumEMCalRC = 0;
1911  Double_t clusPtSumDCalRC = 0;
1912 
1913  // Loop over tracks. Sum the track pT:
1914  // (1) in the entire TPC, (2) in the EMCal, (3) in the EMCal fiducial volume, (4) in the DCal, (5) in the DCal fiducial volume, (6) in the EMCal random cone, (7) in the DCal random cone
1915  // Note: Loops over all det-level track containers. For data there should be only one. For embedding, there should be signal+background tracks.
1916  AliParticleContainer * partCont = 0;
1917  AliTLorentzVector track;
1918  Double_t trackEta;
1919  Double_t trackPhi;
1920  Double_t trackPt;
1921  Double_t deltaR;
1922  TIter nextPartCont(&fParticleCollArray);
1923  while ((partCont = static_cast<AliParticleContainer*>(nextPartCont()))) {
1924 
1925  TString partContName = partCont->GetName();
1926  if (!partContName.CompareTo("tracks")) {
1927 
1928  AliTrackContainer* trackCont = dynamic_cast<AliTrackContainer*>(partCont);
1929  for (auto trackIterator : trackCont->accepted_momentum() ) {
1930 
1931  track.Clear();
1932  track = trackIterator.first;
1933  trackEta = track.Eta();
1934  trackPhi = track.Phi_0_2pi();
1935  trackPt = track.Pt();
1936 
1937  // (1)
1938  if (TMath::Abs(trackEta) < etaTPC) {
1939  trackPtSumTPC += trackPt;
1940  }
1941 
1942  // (2)
1943  if (TMath::Abs(trackEta) < etaEMCal && trackPhi > phiMinEMCal && trackPhi < phiMaxEMCal) {
1944  trackPtSumEMCal += trackPt;
1945  }
1946 
1947  // (3)
1948  if (TMath::Abs(trackEta) < etaEMCalfid && trackPhi > phiMinEMCalfid && trackPhi < phiMaxEMCalfid) {
1949  trackPtSumEMCalfid += trackPt;
1950  }
1951 
1952  // (4)
1953  if (fPlotDCal) {
1954  if (TMath::Abs(trackEta) > etaMinDCal && TMath::Abs(trackEta) < etaEMCal && trackPhi > phiMinDCal && trackPhi < phiMaxDCal) {
1955  trackPtSumDCal += trackPt;
1956  }
1957  }
1958 
1959  // (5)
1960  if (fPlotDCal) {
1961  if (TMath::Abs(trackEta) > etaMinDCalfid && TMath::Abs(trackEta) < etaEMCalfid && trackPhi > phiMinDCalfid && trackPhi < phiMaxDCalfid) {
1962  trackPtSumDCalfid += trackPt;
1963  }
1964  }
1965 
1966  // (6)
1967  deltaR = GetDeltaR(&track, etaEMCalRC, phiEMCalRC);
1968  if (deltaR < jetR) {
1969  trackPtSumEMCalRC += trackPt;
1970  }
1971 
1972  // (7)
1973  if (fPlotDCal) {
1974  deltaR = GetDeltaR(&track, etaDCalRC, phiDCalRC);
1975  if (deltaR < jetR) {
1976  trackPtSumDCalRC += trackPt;
1977  }
1978  }
1979  }
1980  }
1981  }
1982 
1983  // Loop over clusters, if the jet container is for full jets. Sum the cluster ET:
1984  // (1) in the EMCal, (2) in the EMCal fiducial volume, (3) in the DCal, (4), in the DCal fiducial volume, (5) in the EMCal random cone, (6) in the DCal random cone
1985  if (jetCont->GetClusterContainer()) {
1987 
1988  AliTLorentzVector clus;
1989  Double_t clusEta;
1990  Double_t clusPhi;
1991  Double_t clusPt;
1992  for (auto clusIterator : clusCont->accepted_momentum() ) {
1993 
1994  clus.Clear();
1995  clus = clusIterator.first;
1996  clusEta = clus.Eta();
1997  clusPhi = clus.Phi_0_2pi();
1998  clusPt = clus.Pt();
1999 
2000  // (1)
2001  if (TMath::Abs(clusEta) < etaEMCal && clusPhi > phiMinEMCal && clusPhi < phiMaxEMCal) {
2002  clusPtSumEMCal += clusPt;
2003  }
2004 
2005  // (2)
2006  if (TMath::Abs(clusEta) < etaEMCalfid && clusPhi > phiMinEMCalfid && clusPhi < phiMaxEMCalfid) {
2007  clusPtSumEMCalfid += clusPt;
2008  }
2009 
2010  // (3)
2011  if (fPlotDCal) {
2012  if (TMath::Abs(clusEta) > etaMinDCal && TMath::Abs(clusEta) < etaEMCal && clusPhi > phiMinDCal && clusPhi < phiMaxDCal) {
2013  clusPtSumDCal += clusPt;
2014  }
2015  }
2016 
2017  // (4)
2018  if (fPlotDCal) {
2019  if (TMath::Abs(clusEta) > etaMinDCalfid && TMath::Abs(clusEta) < etaEMCalfid && clusPhi > phiMinDCalfid && clusPhi < phiMaxDCalfid) {
2020  clusPtSumDCalfid += clusPt;
2021  }
2022  }
2023 
2024  // (5)
2025  deltaR = GetDeltaR(&clus, etaEMCalRC, phiEMCalRC);
2026  if (deltaR < jetR) {
2027  clusPtSumEMCalRC += clusPt;
2028  }
2029 
2030  // (6)
2031  if (fPlotDCal) {
2032  deltaR = GetDeltaR(&clus, etaDCalRC, phiDCalRC);
2033  if (deltaR < jetR) {
2034  clusPtSumDCalRC += clusPt;
2035  }
2036  }
2037 
2038  }
2039  }
2040 
2041  // Compute the scale factor, as a function of centrality, for (1) EMCal, (2) EMCalfid, (3) DCal, (4) DCalfid
2042  // (1)
2043  Double_t numerator = (trackPtSumEMCal + clusPtSumEMCal) / accEMCal;
2044  Double_t denominator = trackPtSumTPC / accTPC;
2045  Double_t scaleFactor = numerator / denominator;
2046  TString histname = TString::Format("%s/BackgroundHistograms/hScaleFactorEMCal", jetCont->GetArrayName().Data());
2047  fHistManager.FillTH2(histname, fCent, scaleFactor);
2048 
2049  // (2)
2050  if (accEMCalfid > 1e-3) {
2051  numerator = (trackPtSumEMCalfid + clusPtSumEMCalfid) / accEMCalfid;
2052  scaleFactor = numerator / denominator;
2053  histname = TString::Format("%s/BackgroundHistograms/hScaleFactorEMCalFid", jetCont->GetArrayName().Data());
2054  fHistManager.FillTH2(histname, fCent, scaleFactor);
2055  }
2056 
2057  // (3)
2058  if (fPlotDCal) {
2059  numerator = (trackPtSumDCal + clusPtSumDCal) / accDCal;
2060  scaleFactor = numerator / denominator;
2061  histname = TString::Format("%s/BackgroundHistograms/hScaleFactorDCal", jetCont->GetArrayName().Data());
2062  fHistManager.FillTH2(histname, fCent, scaleFactor);
2063  }
2064 
2065  // (4)
2066  if (fPlotDCal) {
2067  if (accDCalfid > 1e-3) {
2068  numerator = (trackPtSumDCalfid + clusPtSumDCalfid) / accDCalfid;
2069  scaleFactor = numerator / denominator;
2070  histname = TString::Format("%s/BackgroundHistograms/hScaleFactorDCalFid", jetCont->GetArrayName().Data());
2071  fHistManager.FillTH2(histname, fCent, scaleFactor);
2072  }
2073  }
2074 
2075  // Compute delta pT, as a function of centrality
2076 
2077  // EMCal
2078  Double_t rho = jetCont->GetRhoVal();
2079  Double_t deltaPt = trackPtSumEMCalRC + clusPtSumEMCalRC - rho * TMath::Pi() * jetR * jetR;
2080  histname = TString::Format("%s/BackgroundHistograms/hDeltaPtEMCal", jetCont->GetArrayName().Data());
2081  fHistManager.FillTH2(histname, fCent, deltaPt);
2082 
2083  // DCal
2084  if (fPlotDCal) {
2085  if (accDCalfid > 1e-3) {
2086  deltaPt = trackPtSumDCalRC + clusPtSumDCalRC - rho * TMath::Pi() * jetR * jetR;
2087  histname = TString::Format("%s/BackgroundHistograms/hDeltaPtDCal", jetCont->GetArrayName().Data());
2088  fHistManager.FillTH2(histname, fCent, deltaPt);
2089  }
2090  }
2091 
2092  delete r;
2093 
2094  }
2095 
2096 }
2097 
2103 {
2104  TString histname;
2105  AliJetContainer* jets = 0;
2106  TIter nextJetColl(&fJetCollArray);
2107  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
2108  TString jetContName = jets->GetName();
2109 
2110  Double_t rhoVal = 0;
2111  if (jets->GetRhoParameter()) {
2112  rhoVal = jets->GetRhoVal();
2113  histname = TString::Format("%s/TriggerSimHistograms/hRhoVsCent", jets->GetArrayName().Data());
2114  fHistManager.FillTH2(histname.Data(), fCent, rhoVal);
2115  }
2116 
2117  for (auto jet : jets->all()) {
2118 
2119  Float_t ptLeading = jets->GetLeadingHadronPt(jet);
2120  Float_t corrPt = GetJetPt(jet, rhoVal);
2121 
2122  // A vs. pT (fill before area cut)
2123  histname = TString::Format("%s/TriggerSimHistograms/hAreaVsPt", jets->GetArrayName().Data());
2124  fHistManager.FillTH2(histname.Data(), corrPt, jet->Area());
2125 
2126  // Rejection reason
2127  UInt_t rejectionReason = 0;
2128  if (!jets->AcceptJet(jet, rejectionReason)) {
2129  histname = TString::Format("%s/TriggerSimHistograms/hJetRejectionReason", jets->GetArrayName().Data());
2130  fHistManager.FillTH2(histname.Data(), jets->GetRejectionReasonBitPosition(rejectionReason), jet->Pt());
2131  continue;
2132  }
2133 
2134  // compute jet acceptance type
2135  Double_t type = GetJetType(jet);
2136  if ( type != kEMCal ) {
2137  if ( type != kDCal || !fPlotDCal ) {
2138  continue;
2139  }
2140  }
2141 
2142  // (Centrality, pT, NEF, calo type)
2143  if (type == kEMCal) {
2144  histname = TString::Format("%s/TriggerSimHistograms/hNEFVsPtEMCal", jets->GetArrayName().Data());
2145  }
2146  else if (type == kDCal) {
2147  histname = TString::Format("%s/TriggerSimHistograms/hNEFVsPtDCal", jets->GetArrayName().Data());
2148  }
2149  fHistManager.FillTH3(histname, fCent, corrPt, jet->NEF());
2150 
2151  // pT-leading vs. pT
2152  histname = TString::Format("%s/TriggerSimHistograms/hPtLeadingVsPt", jets->GetArrayName().Data());
2153  fHistManager.FillTH2(histname.Data(), corrPt, ptLeading);
2154 
2155  // (Centrality, pT, z-leading (charged), calo type)
2156  if (type == kEMCal) {
2157  histname = TString::Format("%s/TriggerSimHistograms/hZLeadingVsPtEMCal", jets->GetArrayName().Data());
2158  }
2159  else if (type == kDCal) {
2160  histname = TString::Format("%s/TriggerSimHistograms/hZLeadingVsPtDCal", jets->GetArrayName().Data());
2161  }
2162  TLorentzVector leadPart;
2163  jets->GetLeadingHadronMomentum(leadPart, jet);
2164  Double_t z = GetParallelFraction(leadPart.Vect(), jet);
2165  if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999; // so that it will contribute to the bin <1
2166  fHistManager.FillTH3(histname, fCent, corrPt, z);
2167 
2168  // (Centrality, pT, z (charged), calo type)
2169  if (type == kEMCal) {
2170  histname = TString::Format("%s/TriggerSimHistograms/hZVsPtEMCal", jets->GetArrayName().Data());
2171  }
2172  else if (type == kDCal) {
2173  histname = TString::Format("%s/TriggerSimHistograms/hZVsPtDCal", jets->GetArrayName().Data());
2174  }
2175  const AliVTrack* track;
2176  for (Int_t i=0; i<jet->GetNumberOfTracks(); i++) {
2177  track = static_cast<AliVTrack*>(jet->Track(i));
2178  z = track->Pt() / TMath::Abs(corrPt);
2179  fHistManager.FillTH3(histname, fCent, corrPt, z);
2180  }
2181 
2182  // (Centrality, pT, Nconst)
2183  if (type == kEMCal) {
2184  histname = TString::Format("%s/TriggerSimHistograms/hNConstVsPtEMCal", jets->GetArrayName().Data());
2185  }
2186  else if (type == kDCal) {
2187  histname = TString::Format("%s/TriggerSimHistograms/hNConstVsPtDCal", jets->GetArrayName().Data());
2188  }
2189  fHistManager.FillTH3(histname, fCent, corrPt, 1.*jet->GetNumberOfConstituents());
2190 
2191  } //jet loop
2192 
2193  }
2194 }
2195 
2201 {
2202  TString histname;
2203  AliJetContainer* jets = 0;
2204  const AliEmcalJet* matchedPartLevelJet = nullptr;
2205  TIter nextJetColl(&fJetCollArray);
2206  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
2207  TString jetContName = jets->GetName();
2208 
2209  // Only loop over jets in the detector-level jet container
2210  if (jetContName.Contains("mcparticles")) {
2211  continue;
2212  }
2213 
2214  Double_t rhoVal = 0;
2215  if (jets->GetRhoParameter()) {
2216  rhoVal = jets->GetRhoVal();
2217  }
2218 
2219  for (auto jet : jets->accepted()) {
2220 
2221  if (fUseResponseMaker) {
2222  // Get the matched part-level jet, based on JetResponseMaker's geometrical criteria
2223  matchedPartLevelJet = jet->MatchedJet();
2224  }
2225  else {
2226  // Get the matched part-level jet, if one exists, subject to fMinSharedMomentumFraction, fMaxMatchedJetDistance criteria
2227  matchedPartLevelJet = GetMatchedPartLevelJet(jets, jet, "MatchedJetHistograms/fHistJetMatchingQA");
2228  }
2229 
2230  // Check that the matched jet exists, and is accepted
2231  if (!matchedPartLevelJet) {
2232  continue;
2233  }
2234  UInt_t rejectionReason = 0;
2235  if (!fMCJetContainer->AcceptJet(matchedPartLevelJet, rejectionReason)) {
2236  continue;
2237  }
2238 
2239  // compute jet acceptance type
2240  Double_t type = GetJetType(jet);
2241  if ( type != kEMCal ) {
2242  if ( type != kDCal || !fPlotDCal ) {
2243  continue;
2244  }
2245  }
2246 
2247  Float_t detPt = GetJetPt(jet, rhoVal);
2248  Float_t truthPt = matchedPartLevelJet->Pt();
2249 
2250  // Fill response matrix (centrality, pT-truth, pT-det)
2251  if (type == kEMCal) {
2252  histname = "MatchedJetHistograms/hResponseMatrixEMCal";
2253  }
2254  else if (type == kDCal) {
2255  histname = "MatchedJetHistograms/hResponseMatrixDCal";
2256  }
2257  fHistManager.FillTH3(histname, fCent, truthPt, detPt);
2258 
2259  // Fill JES shift (centrality, pT-truth, (pT-det - pT-truth) / pT-truth)
2260  if (type == kEMCal) {
2261  histname = "MatchedJetHistograms/hJESshiftEMCal";
2262  }
2263  else if (type == kDCal) {
2264  histname = "MatchedJetHistograms/hJESshiftDCal";
2265  }
2266  fHistManager.FillTH3(histname, fCent, truthPt, (detPt-truthPt)/truthPt );
2267 
2268  // Fill NEF of det-level matched jets (centrality, pT-truth, NEF)
2269  histname = "MatchedJetHistograms/hNEFVsPt";
2270  fHistManager.FillTH3(histname, fCent, truthPt, jet->NEF());
2271 
2272  // Fill z-leading (charged) of det-level matched jets (centrality, pT-truth, z-leading)
2273  histname = "MatchedJetHistograms/hZLeadingVsPt";
2274  TLorentzVector leadPart;
2275  jets->GetLeadingHadronMomentum(leadPart, jet);
2276  Double_t z = GetParallelFraction(leadPart.Vect(), jet);
2277  if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999; // so that it will contribute to the bin <1
2278  fHistManager.FillTH3(histname, fCent, truthPt, z);
2279 
2280  // Fill matching distance between combined jet and pp det-level jet (centrality, pT-truth, R)
2281  histname = "MatchedJetHistograms/hMatchingDistance";
2282  fHistManager.FillTH3(histname, fCent, truthPt, jet->ClosestJetDistance());
2283 
2284  // Fill matching distance between pp det-level jet and pp truth-level jet (centrality, pT-truth, R)
2285  histname = "MatchedJetHistograms/hMatchingDistancepp";
2286  fHistManager.FillTH3(histname, fCent, truthPt, matchedPartLevelJet->ClosestJetDistance());
2287 
2288  } //jet loop
2289  }
2290 }
2291 
2292 /*
2293  * Compute the MC particle type of a given cluster contributor, using the MC particle container
2294  */
2296 {
2297  ContributorType contributorType = kUndefined;
2298 
2299  AliAODMCParticle *part = fGeneratorLevel->GetMCParticleWithLabel(label);
2300  if (part) {
2301 
2302  TString histname = "ClusterHistogramsMC/hClusterRejectionReasonMC";
2303  UInt_t rejectionReason = 0;
2304  if (!fGeneratorLevel->AcceptMCParticle(part, rejectionReason)) {
2305  fHistManager.FillTH2(histname, fGeneratorLevel->GetRejectionReasonBitPosition(rejectionReason), clus->GetNonLinCorrEnergy());
2306  return contributorType;
2307  }
2308 
2309  if (part->GetGeneratorIndex() == 0) { // generator index in cocktail
2310 
2311  // select charged pions, protons, kaons, electrons, muons
2312  Int_t pdg = part->PdgCode();
2313 
2314  if (pdg == 22) { // gamma 22
2315  contributorType = kPhoton;
2316  }
2317  else if (TMath::Abs(pdg) == 211) { // pi+ 211 (abs value ensures both particles and antiparticles are included)
2318  contributorType = kChargedPion;
2319  }
2320  else if (pdg == 2212) { // proton 2212
2321  contributorType = kProton;
2322  }
2323  else if (pdg == -2212) {
2324  contributorType = kAntiProton;
2325  }
2326  else if (TMath::Abs(pdg) == 321) { // K+ 321
2327  contributorType = kChargedKaon;
2328  }
2329  else if (pdg == 130) { // K0L 130
2330  contributorType = kK0L;
2331  }
2332  else if (pdg == 2112) { // neutron 2112
2333  contributorType = kNeutron;
2334  }
2335  else if (pdg == -2112) {
2336  contributorType = kAntiNeutron;
2337  }
2338  else if (TMath::Abs(pdg) == 11) { // e- 11
2339  contributorType = kElectron;
2340  }
2341  else if (TMath::Abs(pdg) == 13) { // mu- 13
2342  contributorType = kMuon;
2343  }
2344  else {
2345  contributorType = kOther;
2346  }
2347  }
2348  }
2349  return contributorType;
2350 }
2351 
2356 {
2357  Double_t deltaPhi = TMath::Abs(part->Phi_0_2pi() - phiRef);
2358  Double_t deltaEta = TMath::Abs(part->Eta() - etaRef);
2359  Double_t deltaR = TMath::Sqrt( deltaPhi*deltaPhi + deltaEta*deltaEta );
2360  return deltaR;
2361 }
2362 
2367 {
2368  UInt_t jetType = jet->GetJetAcceptanceType();
2369  Double_t type = -1;
2370  if (jetType & AliEmcalJet::kEMCAL) {
2371  type = kEMCal;
2372  }
2373  else if (jetType & AliEmcalJet::kDCALonly) {
2374  type = kDCal;
2375  }
2376 
2377  return type;
2378 }
2379 
2384 {
2385  Double_t pT = jet->Pt() - rho * jet->Area();
2386  return pT;
2387 }
2388 
2393 {
2394  return (contributor == kChargedPion) || (contributor == kProton) || (contributor == kAntiProton) || (contributor == kChargedKaon) || (contributor == kK0L) || (contributor == kNeutron) || (contributor == kAntiNeutron);
2395 }
2396 
2416 const AliEmcalJet* AliAnalysisTaskEmcalJetPerformance::GetMatchedPartLevelJet(const AliJetContainer * jets, const AliEmcalJet * jet, const std::string & histName)
2417 {
2418  bool returnValue = false;
2419  const AliEmcalJet* partLevelJet = nullptr;
2420 
2421  // First, check if combined jet has a pp det-level match assigned
2422  if (jet->ClosestJet()) {
2423  fHistManager.FillTH1(histName.c_str(), "matchedJet");
2424  returnValue = true;
2425  AliDebugStream(4) << "Jet is matched!\nJet: " << jet->toString() << "\n";
2426 
2427  // Check shared momentum fraction
2428  // We explicitly want to use indices instead of geometric matching
2429  double sharedFraction = jets->GetFractionSharedPt(jet, nullptr);
2430  if (sharedFraction < fMinSharedMomentumFraction) {
2431  AliDebugStream(4) << "Jet rejected due to shared momentum fraction of " << sharedFraction << ", which is smaller than the min momentum fraction of " << fMinSharedMomentumFraction << "\n";
2432  returnValue = false;
2433  }
2434  else {
2435  AliDebugStream(4) << "Passed shared momentum fraction with value of " << sharedFraction << "\n";
2436  fHistManager.FillTH1(histName.c_str(), "sharedMomentumFraction");
2437  }
2438 
2439  // Check that the combined jet has a particle-level match
2440  AliEmcalJet * detLevelJet = jet->ClosestJet();
2441  partLevelJet = detLevelJet->ClosestJet();
2442  if (!partLevelJet) {
2443  AliDebugStream(4) << "Jet rejected due to no matching part level jet.\n";
2444  returnValue = false;
2445  }
2446  else {
2447  AliDebugStream(4) << "Det level jet has a required match to a part level jet.\n" << "Part level jet: " << partLevelJet->toString() << "\n";
2448  fHistManager.FillTH1(histName.c_str(), "partLevelMatchedJet");
2449  }
2450 
2451  // Check the matching distance between the combined and pp det-level jets, if a value has been set
2452  if (fMaxMatchedJetDistance > 0) {
2453  double matchedJetDistance = jet->ClosestJetDistance();
2454  if (matchedJetDistance > fMaxMatchedJetDistance) {
2455  AliDebugStream(4) << "Jet rejected due to matching distance of " << matchedJetDistance << ", which is larger than the max distance of " << fMaxMatchedJetDistance << "\n";
2456  returnValue = false;
2457  }
2458  else {
2459  AliDebugStream(4) << "Jet passed distance cut with distance of " << matchedJetDistance << "\n";
2460  fHistManager.FillTH1(histName.c_str(), "jetDistance");
2461  }
2462  }
2463 
2464  // Record all cuts passed
2465  if (returnValue == true) {
2466  fHistManager.FillTH1(histName.c_str(), "passedAllCuts");
2467  }
2468  }
2469  else {
2470  AliDebugStream(5) << "Rejected jet because it was not matched to a external event jet.\n";
2471  fHistManager.FillTH1(histName.c_str(), "noMatch");
2472  returnValue = false;
2473  }
2474 
2475  if (returnValue) {
2476  return partLevelJet;
2477  }
2478  return 0;
2479 }
2480 
2485  const char *ntracks,
2486  const char *nclusters,
2487  const char *nGenLev,
2488  const Double_t minTrPt,
2489  const Double_t minClPt,
2490  const char *suffix)
2491 {
2492  // Get the pointer to the existing analysis manager via the static access method.
2493  //==============================================================================
2494  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
2495  if (!mgr)
2496  {
2497  ::Error("AddTaskEmcalJetPerformance", "No analysis manager to connect to.");
2498  return 0;
2499  }
2500 
2501  // Check the analysis type using the event handlers connected to the analysis manager.
2502  //==============================================================================
2503  AliVEventHandler* handler = mgr->GetInputEventHandler();
2504  if (!handler)
2505  {
2506  ::Error("AddTaskEmcalJetPerformance", "This task requires an input event handler");
2507  return 0;
2508  }
2509 
2510  enum EDataType_t {
2511  kUnknown,
2512  kESD,
2513  kAOD
2514  };
2515 
2516  EDataType_t dataType = kUnknown;
2517 
2518  if (handler->InheritsFrom("AliESDInputHandler")) {
2519  dataType = kESD;
2520  }
2521  else if (handler->InheritsFrom("AliAODInputHandler")) {
2522  dataType = kAOD;
2523  }
2524 
2525  //-------------------------------------------------------
2526  // Init the task and do settings
2527  //-------------------------------------------------------
2528 
2529  TString trackName(ntracks);
2530  TString clusName(nclusters);
2531 
2532  if (trackName == "usedefault") {
2533  if (dataType == kESD) {
2534  trackName = "Tracks";
2535  }
2536  else if (dataType == kAOD) {
2537  trackName = "tracks";
2538  }
2539  else {
2540  trackName = "";
2541  }
2542  }
2543 
2544  if (clusName == "usedefault") {
2545  if (dataType == kESD) {
2546  clusName = "CaloClusters";
2547  }
2548  else if (dataType == kAOD) {
2549  clusName = "caloClusters";
2550  }
2551  else {
2552  clusName = "";
2553  }
2554  }
2555 
2556  TString name("AliAnalysisTaskEmcalJetPerformance");
2557  if (!trackName.IsNull()) {
2558  name += "_";
2559  name += trackName;
2560  }
2561  if (!clusName.IsNull()) {
2562  name += "_";
2563  name += clusName;
2564  }
2565  if (strcmp(suffix,"") != 0) {
2566  name += "_";
2567  name += suffix;
2568  }
2569 
2571  // Configure jet performance task
2573 
2575  // Create track and cluster containers with the standard cuts
2576 
2577  AliParticleContainer* partCont = 0;
2578  if (trackName == "mcparticles") {
2579  AliMCParticleContainer* mcpartCont = new AliMCParticleContainer(trackName);
2580  partCont = mcpartCont;
2581  }
2582  else if (trackName == "tracks" || trackName == "Tracks") {
2583  AliTrackContainer* trackCont = new AliTrackContainer(trackName);
2584  partCont = trackCont;
2585  }
2586  if (partCont) partCont->SetParticlePtCut(minTrPt);
2587  if (partCont) task->AdoptParticleContainer(partCont);
2588 
2589  // Add the generator-level container, if specified
2590  if (nGenLev && strcmp(nGenLev,"")!=0) {
2591  AliMCParticleContainer* mcpartCont = task->AddMCParticleContainer(nGenLev);
2592  mcpartCont->SelectPhysicalPrimaries(kTRUE);
2593  mcpartCont->SetParticlePtCut(0);
2594  }
2595 
2596  // Add the cluster container
2597  AliClusterContainer* clusCont = 0;
2598  if (!clusName.IsNull()) {
2599  clusCont = new AliClusterContainer(clusName);
2600  clusCont->SetClusECut(0.);
2601  clusCont->SetClusPtCut(0.);
2602  }
2603  if (clusCont) task->AdoptClusterContainer(clusCont);
2604 
2605  //-------------------------------------------------------
2606  // Final settings, pass to manager and set the containers
2607  //-------------------------------------------------------
2608 
2609  mgr->AddTask(task);
2610 
2611  // Create containers for input/output
2612  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
2613  TString contname(name);
2614  contname += "_histos";
2615  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
2616  TList::Class(),AliAnalysisManager::kOutputContainer,
2617  Form("%s", AliAnalysisManager::GetCommonFileName()));
2618  mgr->ConnectInput (task, 0, cinput1 );
2619  mgr->ConnectOutput (task, 1, coutput1 );
2620 
2621  return task;
2622 }
2623 
Int_t pdg
static AliAnalysisTaskEmcalJetPerformance * AddTaskEmcalJetPerformance(const char *ntracks="usedefault", const char *nclusters="usedefault", const char *nGenLev="mcparticles", const Double_t minTrPt=0.15, const Double_t minClPt=0.30, const char *suffix="")
Double_t Area() const
Definition: AliEmcalJet.h:130
TObjArray fClusterCollArray
cluster collection array
void SetParticlePtCut(Double_t cut)
Double_t GetRhoVal() const
const TString & GetRhoName() const
double Double_t
Definition: External.C:58
TList * fEventCutList
! Output list for event cut histograms
Double_t GetJetPt(const AliEmcalJet *jet, Double_t rho)
const char * title
Definition: MakeQAPdf.C:27
AliEmcalJet * ClosestJet() const
Definition: AliEmcalJet.h:327
Bool_t fUseAliEventCuts
Flag to use AliEventCuts (otherwise AliAnalysisTaskEmcal will be used)
AliJetContainer * GetJetContainer(Int_t i=0) const
Definition: External.C:244
Double_t ClosestJetDistance() const
Definition: AliEmcalJet.h:328
UInt_t fOffTrigger
offline trigger for event selection
void AdoptParticleContainer(AliParticleContainer *cont)
const AliClusterIterableMomentumContainer accepted_momentum() const
Int_t nbinsy
void FillParticleCompositionJetHistograms(const AliMCEvent *mcevent)
Container with name, TClonesArray and cuts for particles.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
AliEmcalJet * MatchedJet() const
Definition: AliEmcalJet.h:331
Declaration of class AliTLorentzVector.
static AliEmcalDownscaleFactorsOCDB * Instance()
AliClusterContainer * GetClusterContainer() const
void FillTH3(const char *hname, double x, double y, double z, double weight=1., Option_t *opt="")
Fill a 3D histogram within the container.
Declaration of class AliAnalysisTaskEmcalEmbeddingHelper.
AliMCParticleContainer * fGeneratorLevel
! generator level container
virtual Bool_t AcceptJet(Int_t i, UInt_t &rejectionReason) const
Double_t GetDownscaleFactorForTriggerClass(const TString &trigger) const
TString part
use mixed event to constrain combinatorial background
Definition: InvMassFit.C:52
Container for particles within the EMCAL framework.
void SetCaloTriggerPatchInfoName(const char *n)
Bool_t fPlotClusterHistograms
Set whether to plot cluster histograms.
Double_t GetDeltaR(const AliTLorentzVector *part, Double_t etaRef, Double_t phiRef)
void AdoptClusterContainer(AliClusterContainer *cont)
TObjArray fParticleCollArray
particle/track collection array
virtual Bool_t AcceptMCParticle(const AliAODMCParticle *vp, UInt_t &rejectionReason) const
bool AddQAPlotsToList(TList *list)
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Get particle container attached to this task.
const Int_t nPtBins
Bool_t fComputeMBDownscaling
Set whether to compute and plot MB downscaling factors.
void GetLeadingHadronMomentum(TLorentzVector &mom, const AliEmcalJet *jet) const
AliEmcalEmbeddingQA fEmbeddingQA
! QA hists for embedding (will only be added if embedding)
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
bool IsInitialized() const
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Create a new TH2 within the container.
int Int_t
Definition: External.C:63
AliJetContainer * fMCJetContainer
!Pointer to jet container of truth-level jets
Double_t fTrackMatchingDeltaEtaMax
Maximum delta-eta to consider a track to be matched to a cluster.
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
Double_t GetLeadingHadronPt(const AliEmcalJet *jet) const
float Float_t
Definition: External.C:68
AliEMCALGeometry * fGeom
!emcal geometry
UInt_t GetJetAcceptanceType() const
Definition: AliEmcalJet.h:367
Double_t Phi_0_2pi() const
EMCal acceptance.
Definition: AliEmcalJet.h:69
Implementation of task to embed external events.
TString toString() const
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
Double_t fTrackMatchingDeltaPhiMax
Maximum delta-phi to consider a track to be matched to a cluster.
Photon+Photon (not from same pi0) are the only contributors.
Bool_t fUseManualEventCuts
Flag to use manual event cuts.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
Double_t fCent
!event centrality
Photon (direct or decay) is the only contributor.
Two particles from merged pi0 are the only contributors.
Bool_t fPlotJetHistograms
Set whether to enable inclusive jet histograms.
Int_t fNEoverPBins
! number of variable E/p bins
AliMCParticleContainer * AddMCParticleContainer(const char *n)
Create new container for MC particles and attach it to the task.
static Double_t GetParallelFraction(AliVParticle *part1, AliVParticle *part2)
Calculates the fraction of momentum z of part 1 w.r.t. part 2 in the direction of part 2...
void FillTH1(const char *hname, double x, double weight=1., Option_t *opt="")
Fill a 1D histogram within the container.
AliEventCuts fEventCuts
event selection utility
Bool_t fPlotMatchedJetHistograms
Set whether to plot matched jet histograms (must run ResponseMaker first)
TObjArray fJetCollArray
jet collection array
Bool_t fkEMCEJE
! flag telling whether the event is "triggered" or not in "simulation"
AliRhoParameter * GetRhoParameter()
const AliEmcalJet * GetMatchedPartLevelJet(const AliJetContainer *jets, const AliEmcalJet *jet, const std::string &histName)
Double_t Pt() const
Definition: AliEmcalJet.h:109
Photon+Hadron are the only contributors, with Photon leading.
Int_t nbinsx
virtual Bool_t IsEventSelected()
Performing event selection.
Bool_t fUseResponseMaker
Flag to use Response Maker rather than JetTagger.
Bool_t IsHadron(const ContributorType contributor)
static Double_t * GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
Bool_t fComputeBackground
Set whether to enable study of background.
Float_t GetJetRadius() const
Double_t fMinSharedMomentumFraction
Minimum shared momentum (pp det-level track pT in combined jet) / (pp det-level track pT) ...
AliEmcalList * fOutput
!output list
ContributorType GetContributorType(const AliVCluster *clus, const AliMCEvent *mcevent, Int_t label)
Handler for downscale factors for various triggers obtained from the OCDB.
AliMCParticleContainer * GetMCParticleContainer(Int_t i=0) const
Int_t fNPtHistBins
! number of variable pt bins
Definition: External.C:220
Bool_t fPlotParticleCompositionHistograms
Set whether to plot jet composition histograms.
void SelectPhysicalPrimaries(Bool_t s)
TClonesArray * fTriggerPatchInfo
!trigger patch info array
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
Int_t fNM02HistBins
! number of variable M02 bins
Double_t fMBUpscaleFactor
! inverse of downscale factor, for MB trigger
Double_t GetFractionSharedPt(const AliEmcalJet *jet, AliParticleContainer *cont2=0x0) const
const AliTrackIterableMomentumContainer accepted_momentum() const
Int_t GetRunNumber(TString)
Definition: PlotMuonQA.C:2235
void SetClusPtCut(Double_t cut)
void SetRejectionReasonLabels(TAxis *axis)
void UserCreateOutputObjects()
Main initialization function on the worker.
Bool_t fDoTriggerSimulation
Set whether to perform a simple trigger simulation.
const Int_t nbins
const AliJetIterableContainer accepted() const
bool Bool_t
Definition: External.C:53
EDataType_t
Switch for the data type.
DCal acceptance – spans ONLY DCal (no PHOS or gap)
Definition: AliEmcalJet.h:73
void SetClusECut(Double_t cut)
Double_t fMedianDCal
! median patch energy in DCal, per event
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Create a new THnSparse within the container.
Double_t fMedianEMCal
! median patch energy in EMCal, per event
Container structure for EMCAL clusters.
Container for MC-true particles within the EMCAL framework.
virtual AliAODMCParticle * GetMCParticleWithLabel(Int_t lab) const
Bool_t fNeedEmcalGeom
whether or not the task needs the emcal geometry
Container for jet within the EMCAL jet framework.
Hadron+Photon are the only contributors, with Hadron leading.
void FillParticleCompositionClusterHistograms(const AliMCEvent *mcevent)
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="")
Create a new TH2 within the container.
Bool_t fPlotDCal
Set whether to enable several DCal-specific histograms.
Double_t fMaxMatchedJetDistance
Maximum distance between two matched jets.
const AliJetIterableContainer all() const
static const AliAnalysisTaskEmcalEmbeddingHelper * GetInstance()