AliPhysics  1cd79fa (1cd79fa)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 "AliMCAnalysisUtils.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  fMaxPt(200),
78  fNEtaBins(40),
79  fNPhiBins(200),
80  fNCentHistBins(0),
81  fCentHistBins(0),
82  fNPtHistBins(0),
83  fPtHistBins(0),
84  fNM02HistBins(0),
85  fM02HistBins(0),
86  fNEoverPBins(0),
87  fEoverPBins(0),
88  fTrackMatchingDeltaEtaMax(0.015),
89  fTrackMatchingDeltaPhiMax(0.030),
90  fMBUpscaleFactor(1.),
91  fMedianEMCal(0.),
92  fMedianDCal(0.),
93  fkEMCEJE(kFALSE),
94  fEmbeddingQA(),
95  fUseAliEventCuts(kTRUE),
96  fEventCuts(0),
97  fEventCutList(0),
98  fUseManualEventCuts(kFALSE),
99  fGeneratorLevel(0),
100  fHistManager()
101 {
103 }
104 
111  AliAnalysisTaskEmcalJet(name, kTRUE),
112  fPlotJetHistograms(kFALSE),
113  fPlotClusterHistograms(kFALSE),
114  fPlotParticleCompositionHistograms(kFALSE),
115  fComputeBackground(kFALSE),
116  fDoTriggerSimulation(kFALSE),
117  fPlotMatchedJetHistograms(kFALSE),
118  fComputeMBDownscaling(kFALSE),
119  fMaxPt(200),
120  fNEtaBins(40),
121  fNPhiBins(200),
122  fNCentHistBins(0),
123  fCentHistBins(0),
124  fNPtHistBins(0),
125  fPtHistBins(0),
126  fNM02HistBins(0),
127  fM02HistBins(0),
128  fNEoverPBins(0),
129  fEoverPBins(0),
130  fTrackMatchingDeltaEtaMax(0.015),
131  fTrackMatchingDeltaPhiMax(0.030),
132  fMBUpscaleFactor(1.),
133  fMedianEMCal(0.),
134  fMedianDCal(0.),
135  fkEMCEJE(kFALSE),
136  fEmbeddingQA(),
137  fUseAliEventCuts(kTRUE),
138  fEventCuts(0),
139  fEventCutList(0),
140  fUseManualEventCuts(kFALSE),
141  fGeneratorLevel(0),
142  fHistManager(name)
143 {
145 }
146 
151 {
152 }
153 
158 {
159  fNCentHistBins = 4;
161  fCentHistBins[0] = 0;
162  fCentHistBins[1] = 10;
163  fCentHistBins[2] = 30;
164  fCentHistBins[3] = 50;
165  fCentHistBins[4] = 90;
166 
167  fNPtHistBins = 82;
170  GenerateFixedBinArray(7, 0.3, 1, fPtHistBins+6);
171  GenerateFixedBinArray(10, 1, 3, fPtHistBins+13);
172  GenerateFixedBinArray(14, 3, 10, fPtHistBins+23);
173  GenerateFixedBinArray(10, 10, 20, fPtHistBins+37);
174  GenerateFixedBinArray(15, 20, 50, fPtHistBins+47);
175  GenerateFixedBinArray(20, 50, 150, fPtHistBins+62);
176 
177  fNM02HistBins = 81;
179  GenerateFixedBinArray(35, 0, 0.7, fM02HistBins);
180  GenerateFixedBinArray(6, 0.7, 1., fM02HistBins+35);
181  GenerateFixedBinArray(20, 1., 3., fM02HistBins+41);
182  GenerateFixedBinArray(10, 3., 5., fM02HistBins+61);
183  GenerateFixedBinArray(10, 5., 10., fM02HistBins+71);
184 
185  fNEoverPBins = 47;
187  GenerateFixedBinArray(30, 0, 1.5, fEoverPBins);
188  GenerateFixedBinArray(10, 1.5, 3.5, fEoverPBins+30);
189  GenerateFixedBinArray(7, 3.5, 10.5, fEoverPBins+40);
190 }
191 
197 {
199 
200  // Intialize AliEventCuts
201  if (fUseAliEventCuts) {
202  fEventCutList = new TList();
203  fEventCutList ->SetOwner();
204  fEventCutList ->SetName("EventCutOutput");
205 
206  fEventCuts.OverrideAutomaticTriggerSelection(fOffTrigger);
207  if(fUseManualEventCuts==1)
208  {
209  fEventCuts.SetManualMode();
210  // Configure manual settings here
211  // ...
212  }
213  fEventCuts.AddQAplotsToList(fEventCutList);
214  fOutput->Add(fEventCutList);
215  }
216 
217  // Get the MC particle branch, in case it exists
218  fGeneratorLevel = GetMCParticleContainer("mcparticles");
219 
220  // Allocate histograms
221  if (fPlotJetHistograms) {
223  }
226  }
229  }
230  if (fComputeBackground) {
232  }
233  if (fDoTriggerSimulation) {
235  }
238  }
239 
240  // Initialize embedding QA
242  if (embeddingHelper) {
243  bool res = fEmbeddingQA.Initialize();
244  if (res) {
246  }
247  }
248 
249  TIter next(fHistManager.GetListOfHistograms());
250  TObject* obj = 0;
251  while ((obj = next())) {
252  fOutput->Add(obj);
253  }
254 
255  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
256 }
257 
258 /*
259  * This function allocates the histograms for single jets.
260  * A set of histograms is allocated per each jet container.
261  */
263 {
264  TString histname;
265  TString title;
266 
267  Int_t nPtBins = TMath::CeilNint(fMaxPt/2);
268 
269  AliJetContainer* jets = 0;
270  TIter nextJetColl(&fJetCollArray);
271  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
272 
273  // Jet rejection reason
274  histname = TString::Format("%s/JetHistograms/hJetRejectionReason", jets->GetArrayName().Data());
275  title = histname + ";Rejection reason;#it{p}_{T,jet} (GeV/#it{c});counts";
276  TH2* hist = fHistManager.CreateTH2(histname.Data(), title.Data(), 32, 0, 32, 50, 0, fMaxPt);
277  SetRejectionReasonLabels(hist->GetXaxis());
278 
279  // Rho vs. Centrality
280  if (!jets->GetRhoName().IsNull()) {
281  histname = TString::Format("%s/JetHistograms/hRhoVsCent", jets->GetArrayName().Data());
282  title = histname + ";Centrality (%);#rho (GeV/#it{c});counts";
283  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 500);
284  }
285 
286  // (Centrality, pT, NEF)
287  Int_t nbinsx = 20; Int_t minx = 0; Int_t maxx = 100;
288  Int_t nbinsy = nPtBins; Int_t miny = 0; Int_t maxy = fMaxPt;
289  Int_t nbinsz = 50; Int_t minz = 0; Int_t maxz = 1.;
290 
291  histname = TString::Format("%s/JetHistograms/hNEFVsPtEMCal", jets->GetArrayName().Data());
292  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});NEF";
293  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
294 
295  histname = TString::Format("%s/JetHistograms/hNEFVsPtDCal", jets->GetArrayName().Data());
296  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});NEF";
297  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
298 
299  // (Centrality, pT upscaled, calo type)
300  if (fComputeMBDownscaling) {
301  histname = TString::Format("%s/JetHistograms/hPtUpscaledMB", jets->GetArrayName().Data());
302  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});type";
303  fHistManager.CreateTH3(histname.Data(), title.Data(), 20, 0, 100, nPtBins, 0, fMaxPt, 2, -0.5, 1.5, "s");
304  }
305 
306  // pT-leading vs. pT
307  histname = TString::Format("%s/JetHistograms/hPtLeadingVsPt", jets->GetArrayName().Data());
308  title = histname + ";#it{p}_{T}^{corr} (GeV/#it{c});#it{p}_{T,particle}^{leading} (GeV/#it{c})";
309  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins, 0, fMaxPt);
310 
311  // A vs. pT
312  histname = TString::Format("%s/JetHistograms/hAreaVsPt", jets->GetArrayName().Data());
313  title = histname + ";#it{p}_{T}^{corr} (GeV/#it{c});#it{A}_{jet}";
314  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, fMaxPt/3, 0, 0.5);
315 
316  // (Centrality, pT, z-leading (charged))
317  nbinsx = 20; minx = 0; maxx = 100;
318  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
319  nbinsz = 50; minz = 0; maxz = 1.;
320 
321  histname = TString::Format("%s/JetHistograms/hZLeadingVsPtEMCal", jets->GetArrayName().Data());
322  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}_{leading}";
323  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
324 
325  histname = TString::Format("%s/JetHistograms/hZLeadingVsPtDCal", jets->GetArrayName().Data());
326  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}_{leading}";
327  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
328 
329  // (Centrality, pT, z (charged))
330  nbinsx = 20; minx = 0; maxx = 100;
331  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
332  nbinsz = 50; minz = 0; maxz = 1.;
333 
334  histname = TString::Format("%s/JetHistograms/hZVsPtEMCal", jets->GetArrayName().Data());
335  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}";
336  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
337 
338  histname = TString::Format("%s/JetHistograms/hZVsPtDCal", jets->GetArrayName().Data());
339  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}";
340  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
341 
342  // (Centrality, pT, Nconst, calo type)
343  nbinsx = 20; minx = 0; maxx = 100;
344  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
345  nbinsz = 50; minz = 0; maxz = fMaxPt;
346 
347  histname = TString::Format("%s/JetHistograms/hNConstVsPtEMCal", jets->GetArrayName().Data());
348  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});No. of constituents";
349  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
350 
351  histname = TString::Format("%s/JetHistograms/hNConstVsPtDCal", jets->GetArrayName().Data());
352  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});No. of constituents";
353  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
354 
355  // (Centrality, jet pT, Enonlincorr - Ehadcorr)
356  nbinsx = 20; minx = 0; maxx = 100;
357  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
358  nbinsz = nPtBins; minz = 0; maxz = fMaxPt;
359 
360  histname = TString::Format("%s/JetHistograms/hDeltaEHadCorr", jets->GetArrayName().Data());
361  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#sum#it{E}_{nonlincorr} - #it{E}_{hadcorr}";
362  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
363 
364  // (Median patch energy, calo type, jet pT, centrality)
365  if (fDoTriggerSimulation) {
366  histname = TString::Format("%s/JetHistograms/hMedPatchJet", jets->GetArrayName().Data());
367  title = histname + ";#it{E}_{patch,med};type;#it{p}_{T}^{corr} (GeV/#it{c});Centrality (%)";
368  Int_t nbins5[4] = {100, 2, nPtBins, 50};
369  Double_t min5[4] = {0,-0.5, 0, 0};
370  Double_t max5[4] = {50,1.5, fMaxPt, 100};
371  fHistManager.CreateTHnSparse(histname.Data(), title.Data(), 4, nbins5, min5, max5);
372  }
373 
374  }
375 
376  // MB downscale factor histogram
377  if (fComputeMBDownscaling) {
378  histname = "Trigger/hMBDownscaleFactor";
379  title = histname + ";Downscale factor;counts";
380  fHistManager.CreateTH1(histname.Data(), title.Data(), 200, 0, 200);
381  }
382 
383 }
384 
385 /*
386  * This function allocates the histograms for the calorimeter performance study.
387  */
389 {
390  TString histname;
391  TString htitle;
392 
393  const Int_t nRcorrBins = 50;
394  Double_t *RcorrBins = GenerateFixedBinArray(nRcorrBins, 0., 1.);
395  const Int_t nCellBins = 30;
396  Double_t *cellBins = GenerateFixedBinArray(nCellBins, -0.5, 29.5);
397  const Int_t nMatchedTrackBins = 5;
398  Double_t *matchedTrackBins = GenerateFixedBinArray(nMatchedTrackBins, -0.5, 4.5);
399 
402 
403  // Plot M02 distribution (centrality, Eclus nonlincorr, M02)
404  histname = "ClusterHistograms/hM02";
405  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); M02";
407 
408  // Plot Ncell distribution for M02 > 0.4 and 0.1 < M02 < 0.4 (centrality, Eclus nonlincorr, Ncells)
409  histname = "ClusterHistograms/hNcellsM02G04";
410  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); Ncells";
411  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nCellBins, cellBins);
412 
413  histname = "ClusterHistograms/hNcellsM02L04";
414  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); Ncells";
415  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nCellBins, cellBins);
416 
419 
420  // Plot matched track pT for all clusters, M02 > 0.4 clusters, and 0.1 < M02 < 0.4 clusters (centrality, Eclus nonlincorr, trackPsum)
421  histname = "ClusterHistograms/hMatchedTrackPt";
422  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); #Sigma#it{p}_{track} (GeV/c)";
424 
425  histname = "ClusterHistograms/hMatchedTrackPtM02G04";
426  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); #Sigma#it{p}_{track} (GeV/c)";
428 
429  histname = "ClusterHistograms/hMatchedTrackPtM02L04";
430  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); #Sigma#it{p}_{track} (GeV/c)";
432 
433  // Plot number of matched tracks for all clusters, M02 > 0.4 clusters, and 0.1 < M02 < 0.4 clusters (centrality, Eclus nonlincorr, N matches)
434  histname = "ClusterHistograms/hMatchedTrackN";
435  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); N_{tracks}";
436  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nMatchedTrackBins, matchedTrackBins);
437 
438  histname = "ClusterHistograms/hMatchedTrackNM02G04";
439  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); N_{tracks}";
440  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nMatchedTrackBins, matchedTrackBins);
441 
442  histname = "ClusterHistograms/hMatchedTrackNM02L04";
443  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); N_{tracks}";
444  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nMatchedTrackBins, matchedTrackBins);
445 
446  // Plot M02 distribution for clusters with matched tracks (centrality, Eclus nonlincorr, M02)
447  histname = "ClusterHistograms/hM02Matched";
448  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); M02";
450 
451  // Plot M02 distribution for clusters without matched tracks (centrality, Eclus nonlincorr, M02)
452  histname = "ClusterHistograms/hM02Unmatched";
453  htitle = histname + ";Centrality (%);#it{E}_{clus} (GeV); M02";
455 
458 
459  // Plot E/p vs. M02 for 0-10% and 50-90% (Eclus nonlincorr, Eclus nonlincorr / trackPsum, M02)
460  histname = "ClusterHistograms/hEoverPM02Central";
461  htitle = histname + ";#it{E}_{clus} (GeV); #it{E}_{clus} / #Sigma#it{p}_{track} (GeV); M02";
463 
464  histname = "ClusterHistograms/hEoverPM02Peripheral";
465  htitle = histname + ";#it{E}_{clus} (GeV); #it{E}_{clus} / #Sigma#it{p}_{track} (GeV); M02";
467 
470 
471  // Plot Rcorr distribution (centrality, trackPSum, Rcorr = (Enonlincorr - Ehadcorr) / trackPSum)
472  histname = "ClusterHistograms/hRcorrVsCent";
473  htitle = histname + ";Centrality (%);#Sigma#it{p}_{track} (GeV); R_{corr} = #frac{#DeltaE_{clus}}{#Sigmap_{track}}";
474  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
475 
476  // Plot Rcorr distribution for 0-10% centrality (Eclus nonlincorr, trackPSum, Rcorr)
477  histname = "ClusterHistograms/hRcorr0-10";
478  htitle = histname + ";#it{E}_{clus} (GeV);#Sigma#it{p}_{track} (GeV); R_{corr} = #frac{#DeltaE_{clus}}{#Sigmap_{track}}";
479  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
480 
481  // Plot Rcorr distribution for 50-90% centrality (Eclus nonlincorr, trackPSum, Rcorr)
482  histname = "ClusterHistograms/hRcorr50-90";
483  htitle = histname + ";#it{E}_{clus} (GeV);#Sigma#it{p}_{track} (GeV); R_{corr} = #frac{#DeltaE_{clus}}{#Sigmap_{track}}";
484  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
485 
486  // Plot also Rcorr-clus (centrality, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
487  histname = "ClusterHistograms/hRcorrClusVsCent";
488  htitle = histname + ";Centrality (%);#Sigma#it{p}_{track} (GeV); #frac{#DeltaE_{clus}}{E_{clus}}";
489  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNCentHistBins, fCentHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
490 
491  // Rcorr-clus for 0-10% centrality (Eclus nonlincorr, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
492  histname = "ClusterHistograms/hRcorrClus0-10";
493  htitle = histname + ";#it{E}_{clus} (GeV);#Sigma#it{p}_{track} (GeV); #frac{#DeltaE_{clus}}{E_{clus}}";
494  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
495 
496  // Rcorr-clus for 50-90% centrality (Eclus nonlincorr, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
497  histname = "ClusterHistograms/hRcorrClus50-90";
498  htitle = histname + ";#it{E}_{clus} (GeV);#Sigma#it{p}_{track} (GeV); #frac{#DeltaE_{clus}}{E_{clus}}";
499  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins, nRcorrBins, RcorrBins);
500 
501 }
502 
503 /*
504  * This function allocates the histograms for the jet composition study.
505  */
507 {
508  TString histname;
509  TString htitle;
510  Int_t nPtBins = TMath::CeilNint(fMaxPt/2);
511 
512  const Int_t nRejBins = 32;
513  Double_t* rejReasonBins = new Double_t[nRejBins+1];
514  GenerateFixedBinArray(nRejBins, 0, nRejBins, rejReasonBins);
515  const Int_t nParticleTypes = 8;
516  Double_t *particleTypeBins = GenerateFixedBinArray(nParticleTypes, -0.5, 7.5);
517 
518  AliEmcalContainer* cont = 0;
519  TIter nextClusColl(&fClusterCollArray);
520  while ((cont = static_cast<AliEmcalContainer*>(nextClusColl()))) {
521 
522  histname = "JetPerformance/hClusterRejectionReasonMC";
523  htitle = histname + ";Rejection reason;#it{E}_{clus} (GeV/)";
524  TH2* histMC = fHistManager.CreateTH2(histname.Data(), htitle.Data(), nRejBins, rejReasonBins, fNPtHistBins, fPtHistBins);
525  SetRejectionReasonLabels(histMC->GetXaxis());
526  }
527 
528  // M02 vs. Energy vs. Particle type
529  histname = "JetPerformance/hM02VsParticleType";
530  htitle = histname + ";M02;#it{E}_{clus} (GeV); Particle type";
531  fHistManager.CreateTH3(histname.Data(), htitle.Data(), fNM02HistBins, fM02HistBins, fNPtHistBins, fPtHistBins, nParticleTypes, particleTypeBins);
532 
533  // M02 vs. Energy vs. Particle type vs. Jet pT, for particles inside jets
534  Int_t dim = 0;
535  TString title[20];
536  Int_t nbins[20] = {0};
537  Double_t min[30] = {0.};
538  Double_t max[30] = {0.};
539  Double_t *binEdges[20] = {0};
540 
541  title[dim] = "M02";
542  nbins[dim] = fNM02HistBins;
543  binEdges[dim] = fM02HistBins;
544  min[dim] = fM02HistBins[0];
545  max[dim] = fM02HistBins[fNM02HistBins];
546  dim++;
547 
548  title[dim] = "#it{E}_{clus} (GeV)";
549  nbins[dim] = fNPtHistBins;
550  binEdges[dim] = fPtHistBins;
551  min[dim] = fPtHistBins[0];
552  max[dim] = fPtHistBins[fNPtHistBins];
553  dim++;
554 
555  title[dim] = "Particle type";
556  nbins[dim] = nParticleTypes;
557  min[dim] = -0.5;
558  max[dim] = 7.5;
559  binEdges[dim] = particleTypeBins;
560  dim++;
561 
562  title[dim] = "#it{p}_{T,jet}^{corr}";
563  nbins[dim] = nPtBins;
564  min[dim] = 0;
565  max[dim] = fMaxPt;
566  binEdges[dim] = GenerateFixedBinArray(nbins[dim], min[dim], max[dim]);
567  dim++;
568 
569  TString thnname = "JetPerformance/hM02VsParticleTypeJets";
570  THnSparse* hn = fHistManager.CreateTHnSparse(thnname.Data(), thnname.Data(), dim, nbins, min, max);
571  for (Int_t i = 0; i < dim; i++) {
572  hn->GetAxis(i)->SetTitle(title[i]);
573  hn->SetBinEdges(i, binEdges[i]);
574  }
575 
576  // Particle composition inside each jet -- jet pT vs. particle type vs. particle number vs. particle pT sum
577  // (One entry per jet for each particle type)
578  dim = 0;
579 
580  title[dim] = "#it{p}_{T,jet}^{corr}";
581  nbins[dim] = nPtBins;
582  min[dim] = 0;
583  max[dim] = fMaxPt;
584  binEdges[dim] = GenerateFixedBinArray(nbins[dim], min[dim], max[dim]);
585  dim++;
586 
587  title[dim] = "Particle type";
588  nbins[dim] = nParticleTypes;
589  min[dim] = -0.5;
590  max[dim] = 7.5;
591  binEdges[dim] = particleTypeBins;
592  dim++;
593 
594  title[dim] = "N";
595  nbins[dim] = 30;
596  min[dim] = -0.5;
597  max[dim] = 29.5;
598  binEdges[dim] = GenerateFixedBinArray(nbins[dim], min[dim], max[dim]);
599  dim++;
600 
601  title[dim] = "#it{p}_{T,sum} (GeV)";
602  nbins[dim] = fNPtHistBins;
603  binEdges[dim] = fPtHistBins;
604  min[dim] = fPtHistBins[0];
605  max[dim] = fPtHistBins[fNPtHistBins];
606  dim++;
607 
608  thnname = "JetPerformance/hJetComposition";
609  THnSparse* thn = fHistManager.CreateTHnSparse(thnname.Data(), thnname.Data(), dim, nbins, min, max);
610  for (Int_t i = 0; i < dim; i++) {
611  thn->GetAxis(i)->SetTitle(title[i]);
612  thn->SetBinEdges(i, binEdges[i]);
613  }
614 
615  // Hadronic calo energy in each jet
616 
617  // Jet pT vs. Summed energy of hadronic clusters without a matched track
618  histname = "JetPerformance/hHadCaloEnergyUnmatched";
619  htitle = histname + ";#it{p}_{T,jet} (GeV);#it{p}_{T,had} (GeV)";
620  fHistManager.CreateTH2(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins);
621 
622  // Jet pT vs. Summed energy of hadronic clusters with a matched track (before hadronic correction)
623  histname = "JetPerformance/hHadCaloEnergyMatchedNonlincorr";
624  htitle = histname + ";#it{p}_{T,jet} (GeV);#it{p}_{T,had} (GeV)";
625  fHistManager.CreateTH2(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins);
626 
627  // Jet pT vs. Summed energy of hadronic clusters with a matched track (after hadronic correction)
628  histname = "JetPerformance/hHadCaloEnergyMatchedHadCorr";
629  htitle = histname + ";#it{p}_{T,jet} (GeV);#it{p}_{T,had} (GeV)";
630  fHistManager.CreateTH2(histname.Data(), htitle.Data(), fNPtHistBins, fPtHistBins, fNPtHistBins, fPtHistBins);
631 
632 }
633 
634 /*
635  * This function allocates background subtraction histograms, if enabled.
636  * A set of histograms is allocated per each jet container.
637  */
639 {
640  TString histname;
641  TString title;
642 
643  AliJetContainer* jets = 0;
644  TIter nextJetColl(&fJetCollArray);
645  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
646 
647  histname = TString::Format("%s/BackgroundHistograms/hScaleFactorEMCal", jets->GetArrayName().Data());
648  title = histname + ";Centrality;Scale factor;counts";
649  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 5);
650 
651  histname = TString::Format("%s/BackgroundHistograms/hDeltaPtEMCal", jets->GetArrayName().Data());
652  title = histname + ";Centrality (%);#delta#it{p}_{T} (GeV/#it{c});counts";
653  fHistManager.CreateTH2(histname.Data(), title.Data(), 10, 0, 100, 400, -50, 150);
654 
655  }
656 }
657 
658 /*
659  * This function allocates the histograms for single jets, when the "simulated" trigger has been fired.
660  * A set of histograms is allocated per each jet container.
661  */
663 {
664  TString histname;
665  TString title;
666  Int_t nPtBins = TMath::CeilNint(fMaxPt/2);
667 
668  //----------------------------------------------
669  // Trigger patch histograms
670 
671  // patch eta vs. phi
672  histname = "TriggerSimHistograms/hEtaVsPhi";
673  title = histname + ";#eta_{patch} (rad);#phi_{patch} (rad)";
674  fHistManager.CreateTH2(histname.Data(), title.Data(), 140, -0.7, 0.7, 500, 1., 6.);
675 
676  // N patches
677  histname = "TriggerSimHistograms/hNPatches";
678  title = histname + ";#it{N}_{patches};type";
679  fHistManager.CreateTH2(histname.Data(), title.Data(), 200, 0, 200, 2, -0.5, 1.5);
680 
681  // patch E vs. centrality
682  histname = "TriggerSimHistograms/hPatchE";
683  title = histname + ";Centrality (%);#it{E}_{patch} (GeV)";
684  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, nPtBins, 0, fMaxPt);
685 
686  // patch median vs. Centrality
687  histname = "TriggerSimHistograms/hPatchMedianE";
688  title = histname + ";Centrality (%);#it{E}_{patch,med} (GeV);type";
689  fHistManager.CreateTH3(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 50, 2, -0.5, 1.5);
690 
691  //----------------------------------------------
692  // Jet histograms for "triggered" events
693  AliJetContainer* jets = 0;
694  TIter nextJetColl(&fJetCollArray);
695  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
696 
697  // Jet rejection reason
698  histname = TString::Format("%s/TriggerSimHistograms/hJetRejectionReason", jets->GetArrayName().Data());
699  title = histname + ";Rejection reason;#it{p}_{T,jet} (GeV/#it{c});counts";
700  TH2* hist = fHistManager.CreateTH2(histname.Data(), title.Data(), 32, 0, 32, 50, 0, fMaxPt);
701  SetRejectionReasonLabels(hist->GetXaxis());
702 
703  // Rho vs. Centrality
704  if (!jets->GetRhoName().IsNull()) {
705  histname = TString::Format("%s/TriggerSimHistograms/hRhoVsCent", jets->GetArrayName().Data());
706  title = histname + ";Centrality (%);#rho (GeV/#it{c});counts";
707  fHistManager.CreateTH2(histname.Data(), title.Data(), 50, 0, 100, 100, 0, 500);
708  }
709 
710  // (Centrality, pT, NEF)
711  Int_t nbinsx = 20; Int_t minx = 0; Int_t maxx = 100;
712  Int_t nbinsy = nPtBins; Int_t miny = 0; Int_t maxy = fMaxPt;
713  Int_t nbinsz = 50; Int_t minz = 0; Int_t maxz = 1.;
714 
715  histname = TString::Format("%s/TriggerSimHistograms/hNEFVsPtEMCal", jets->GetArrayName().Data());
716  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});NEF";
717  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
718 
719  histname = TString::Format("%s/TriggerSimHistograms/hNEFVsPtDCal", jets->GetArrayName().Data());
720  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});NEF";
721  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
722 
723  // pT-leading vs. pT
724  histname = TString::Format("%s/TriggerSimHistograms/hPtLeadingVsPt", jets->GetArrayName().Data());
725  title = histname + ";#it{p}_{T}^{corr} (GeV/#it{c});#it{p}_{T,particle}^{leading} (GeV/#it{c})";
726  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins, 0, fMaxPt);
727 
728  // A vs. pT
729  histname = TString::Format("%s/TriggerSimHistograms/hAreaVsPt", jets->GetArrayName().Data());
730  title = histname + ";#it{p}_{T}^{corr} (GeV/#it{c});#it{A}_{jet}";
731  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, fMaxPt/3, 0, 0.5);
732 
733  // (Centrality, pT, z-leading (charged))
734  nbinsx = 20; minx = 0; maxx = 100;
735  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
736  nbinsz = 50; minz = 0; maxz = 1.;
737 
738  histname = TString::Format("%s/TriggerSimHistograms/hZLeadingVsPtEMCal", jets->GetArrayName().Data());
739  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}_{leading}";
740  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
741 
742  histname = TString::Format("%s/TriggerSimHistograms/hZLeadingVsPtDCal", jets->GetArrayName().Data());
743  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}_{leading}";
744  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
745 
746  // z (charged) vs. pT
747  nbinsx = 20; minx = 0; maxx = 100;
748  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
749  nbinsz = 50; minz = 0; maxz = 1.;
750 
751  histname = TString::Format("%s/TriggerSimHistograms/hZVsPtEMCal", jets->GetArrayName().Data());
752  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}";
753  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
754 
755  histname = TString::Format("%s/TriggerSimHistograms/hZVsPtDCal", jets->GetArrayName().Data());
756  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});#it{z}";
757  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
758 
759  // (Centrality, pT, Nconst)
760  nbinsx = 20; minx = 0; maxx = 100;
761  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
762  nbinsz = 50; minz = 0; maxz = fMaxPt;
763 
764  histname = TString::Format("%s/TriggerSimHistograms/hNConstVsPtEMCal", jets->GetArrayName().Data());
765  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});No. of constituents";
766  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
767 
768  histname = TString::Format("%s/TriggerSimHistograms/hNConstVsPtDCal", jets->GetArrayName().Data());
769  title = histname + ";Centrality (%);#it{p}_{T}^{corr} (GeV/#it{c});No. of constituents";
770  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
771 
772  }
773 }
774 
775 /*
776  * This function allocates histograms for matched truth-det jets in the case of embedding.
777  * The jet matching information must be previously filled by another task, such as AliJetResponseMaker.
778  */
780 {
781  TString histname;
782  TString title;
783  Int_t nPtBins = TMath::CeilNint(fMaxPt/2);
784 
785  // Response matrix, (centrality, pT-truth, pT-det)
786  Int_t nbinsx = 20; Int_t minx = 0; Int_t maxx = 100;
787  Int_t nbinsy = nPtBins; Int_t miny = 0; Int_t maxy = fMaxPt;
788  Int_t nbinsz = nPtBins; Int_t minz = 0; Int_t maxz = fMaxPt;
789 
790  histname = "MatchedJetHistograms/hResponseMatrixEMCal";
791  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});#it{p}_{T,corr}^{det} (GeV/#it{c})";
792  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
793 
794  histname = "MatchedJetHistograms/hResponseMatrixDCal";
795  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});#it{p}_{T,corr}^{det} (GeV/#it{c})";
796  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
797 
798  // JES shift, (centrality, pT-truth, (pT-det - pT-truth) / pT-truth)
799  nbinsx = 20; minx = 0; maxx = 100;
800  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
801  nbinsz = 250; minz = -5.; maxz = 5.;
802 
803  histname = "MatchedJetHistograms/hJESshiftEMCal";
804  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});#frac{#it{p}_{T,corr}^{det} - #it{p}_{T}^{truth}}{#it{p}_{T}^{truth}}";
805  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
806 
807  histname = "MatchedJetHistograms/hJESshiftDCal";
808  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});#frac{#it{p}_{T,corr}^{det} - #it{p}_{T}^{truth}}{#it{p}_{T}^{truth}}";
809  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
810 
811  // NEF of det-level matched jets, (centrality, pT-truth, NEF)
812  nbinsx = 20; minx = 0; maxx = 100;
813  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
814  nbinsz = 50; minz = 0; maxz = 1.;
815 
816  histname = "MatchedJetHistograms/hNEFVsPt";
817  title = histname + ";Centrality (%);#it{p}_{T,corr}^{det} (GeV/#it{c});Calo energy fraction";
818  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
819 
820  // z-leading (charged) of det-level matched jets, (centrality, pT-truth, z-leading)
821  nbinsx = 20; minx = 0; maxx = 100;
822  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
823  nbinsz = 50; minz = 0; maxz = 1.;
824 
825  histname = "MatchedJetHistograms/hZLeadingVsPt";
826  title = histname + ";Centrality (%);#it{p}_{T,corr}^{det} (GeV/#it{c});#it{z}_{leading}";
827  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
828 
829  // Matching distance, (centrality, pT-truth, R)
830  nbinsx = 20; minx = 0; maxx = 100;
831  nbinsy = nPtBins; miny = 0; maxy = fMaxPt;
832  nbinsz = 50; minz = 0; maxz = 1.;
833 
834  histname = "MatchedJetHistograms/hMatchingDistance";
835  title = histname + ";Centrality (%);#it{p}_{T}^{truth} (GeV/#it{c});R";
836  fHistManager.CreateTH3(histname.Data(), title.Data(), nbinsx, minx, maxx, nbinsy, miny, maxy, nbinsz, minz, maxz);
837 
838 }
839 
845 {
846  // Configure base class to set fTriggerPatchInfo to array of trigger patches, each event
847  // (Need to call this before base class ExecOnce)
848  if (fDoTriggerSimulation) {
849  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
850  }
851 
853 
854  fNeedEmcalGeom = kTRUE;
855 
856  // Check if trigger patches are loaded
857  if (fDoTriggerSimulation) {
858  if (fTriggerPatchInfo) {
859  TString objname(fTriggerPatchInfo->GetClass()->GetName());
860  TClass cls(objname);
861  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
862  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",
863  GetName(), cls.GetName(), "EmcalTriggers"));
864  fTriggerPatchInfo = 0;
865  }
866  }
867  if (!fTriggerPatchInfo) {
868  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
869  return;
870  }
871  }
872 }
873 
878 
879  // Get the downscaling factors for MB triggers (to be used to calculate trigger efficiency)
880 
882 
883  // Get instance of the downscale factor helper class
885  downscaleOCDB->SetRun(InputEvent()->GetRunNumber());
886 
887  // There are two possible min bias triggers for LHC15o
888  TString triggerNameMB1 = "CINT7-B-NOPF-CENT";
889  TString triggerNameMB2 = "CV0L7-B-NOPF-CENT";
890  TString triggerNameJE = "CINT7EJ1-B-NOPF-CENTNOPMD";
891 
892  // Get the downscale factor for whichever MB trigger exists in the given run
893  std::vector<TString> runtriggers = downscaleOCDB->GetTriggerClasses();
894  Double_t downscalefactor;
895  for (auto i : runtriggers) {
896  if (i.EqualTo(triggerNameMB1) || i.EqualTo(triggerNameMB2)) {
897  downscalefactor = downscaleOCDB->GetDownscaleFactorForTriggerClass(i.Data());
898  break;
899  }
900  }
901 
902  // Store the inverse of the downscale factor, used later to weight the pT spectrum
903  fMBUpscaleFactor = 1/downscalefactor;
904 
905  TString histname = "Trigger/hMBDownscaleFactor";
906  fHistManager.FillTH1(histname.Data(), fMBUpscaleFactor);
907 
908  }
909 
910 }
911 
916 {
917  if (fUseAliEventCuts) {
918  if (!fEventCuts.AcceptEvent(InputEvent()))
919  {
920  PostData(1, fOutput);
921  return kFALSE;
922  }
923  }
924  else {
926  }
927  return kTRUE;
928 }
929 
938 {
939  TString histname;
940  AliJetContainer* jetCont = 0;
941  TIter next(&fJetCollArray);
942  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
943  TString jetContName = jetCont->GetName();
944 
945  // Compute the full jet background scale factor and delta-pt
946  if (fComputeBackground) {
948  }
949 
950  // Do a simple trigger simulation (if requested)
951  if (fDoTriggerSimulation) {
953  }
954 
955  }
956 
957  // Only fill the embedding qa plots if:
958  // - We are using the embedding helper
959  // - The class has been initialized
960  // - Both jet collections are available
961  if (fEmbeddingQA.IsInitialized()) {
963  }
964 
965  return kTRUE;
966 }
967 
972 {
973  TString histname;
974 
975  // Check if trigger patches are loaded
976  if (fTriggerPatchInfo) {
977  TString objname(fTriggerPatchInfo->GetClass()->GetName());
978  TClass cls(objname);
979  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
980  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",
981  GetName(), cls.GetName(), "EmcalTriggers"));
982  fTriggerPatchInfo = 0;
983  }
984  }
985  if (!fTriggerPatchInfo) {
986  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
987  return;
988  }
989 
990  // Compute patches in EMCal, DCal (I want offline simple trigger patch, i.e. patch calculated using FEE energy)
991  std::vector<Double_t> vecEMCal;
992  std::vector<Double_t> vecDCal;
993  for(auto p : *fTriggerPatchInfo){
994  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
995  if (recpatch) {
996 
997  if(!recpatch->IsJetHighSimple()) continue;
998 
999  histname = "TriggerSimHistograms/hEtaVsPhi";
1000  fHistManager.FillTH2(histname.Data(), recpatch->GetEtaGeo(), recpatch->GetPhiGeo());
1001 
1002  histname = "TriggerSimHistograms/hPatchE";
1003  fHistManager.FillTH2(histname.Data(), fCent, recpatch->GetPatchE());
1004 
1005  if (recpatch->IsEMCal()) {
1006  vecEMCal.push_back(recpatch->GetPatchE());
1007  } else {
1008  vecDCal.push_back(recpatch->GetPatchE());
1009  }
1010 
1011  }
1012  }
1013 
1014  // Compute the median in each calorimeter
1015  const Int_t nBkgPatchesEMCal = vecEMCal.size(); // 6*8;
1016  const Int_t nBkgPatchesDCal = vecDCal.size(); // 4*5;
1017  fMedianEMCal = TMath::Median(nBkgPatchesEMCal, &vecEMCal[0]); // point to array used internally by vector
1018  fMedianDCal = TMath::Median(nBkgPatchesDCal, &vecDCal[0]);
1019 
1020  histname = "TriggerSimHistograms/hPatchMedianE";
1021  fHistManager.FillTH3(histname.Data(), fCent, fMedianEMCal, kEMCal);
1022  fHistManager.FillTH3(histname.Data(), fCent, fMedianDCal, kDCal);
1023 
1024  histname = "TriggerSimHistograms/hNPatches";
1025  fHistManager.FillTH2(histname.Data(), nBkgPatchesEMCal, kEMCal);
1026  fHistManager.FillTH2(histname.Data(), nBkgPatchesDCal, kDCal);
1027 
1028  // Then compute background subtracted patches, by subtracting from each patch the median patch E from the opposite hemisphere
1029  // If a patch is above threshold, the event is "triggered"
1030  Bool_t fkEMCEJE = kFALSE;
1031  Double_t threshold = 20;
1032  for(auto p : *fTriggerPatchInfo){
1033  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
1034  if (recpatch) {
1035 
1036  if(!recpatch->IsJetHighSimple()) continue;
1037 
1038  if (recpatch->IsEMCal()) {
1039  if ((recpatch->GetPatchE() - fMedianDCal) > threshold) {
1040  fkEMCEJE = kTRUE;
1041  break;
1042  }
1043  } else {
1044  if ((recpatch->GetPatchE() - fMedianEMCal) > threshold) {
1045  fkEMCEJE = kTRUE;
1046  break;
1047  }
1048  }
1049  }
1050  }
1051 
1052  if (fkEMCEJE) {
1054  }
1055 
1056 }
1057 
1065 {
1066 
1067  if (fPlotJetHistograms) {
1069  }
1070  if (fPlotClusterHistograms) {
1072  }
1075  }
1078  }
1079 
1080  return kTRUE;
1081 }
1082 
1088 {
1089  TString histname;
1090  AliJetContainer* jets = 0;
1091  TIter nextJetColl(&fJetCollArray);
1092  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
1093  TString jetContName = jets->GetName();
1094 
1095  Double_t rhoVal = 0;
1096  if (jets->GetRhoParameter()) {
1097  rhoVal = jets->GetRhoVal();
1098  histname = TString::Format("%s/JetHistograms/hRhoVsCent", jets->GetArrayName().Data());
1099  fHistManager.FillTH2(histname.Data(), fCent, rhoVal);
1100  }
1101 
1102  for (auto jet : jets->all()) {
1103 
1104  Float_t ptLeading = jets->GetLeadingHadronPt(jet);
1105  Float_t corrPt = GetJetPt(jet, rhoVal);
1106 
1107  // A vs. pT (fill before area cut)
1108  histname = TString::Format("%s/JetHistograms/hAreaVsPt", jets->GetArrayName().Data());
1109  fHistManager.FillTH2(histname.Data(), corrPt, jet->Area());
1110 
1111 
1112  // Rejection reason
1113  UInt_t rejectionReason = 0;
1114  if (!jets->AcceptJet(jet, rejectionReason)) {
1115  histname = TString::Format("%s/JetHistograms/hJetRejectionReason", jets->GetArrayName().Data());
1116  fHistManager.FillTH2(histname.Data(), jets->GetRejectionReasonBitPosition(rejectionReason), jet->Pt());
1117  continue;
1118  }
1119 
1120  // compute jet acceptance type
1121  Double_t type = GetJetType(jet);
1122  if ( (type != kEMCal) && (type != kDCal) ) {
1123  continue;
1124  }
1125 
1126  // (Centrality, pT, NEF)
1127  if (type == kEMCal) {
1128  histname = TString::Format("%s/JetHistograms/hNEFVsPtEMCal", jets->GetArrayName().Data());
1129  }
1130  else if (type == kDCal) {
1131  histname = TString::Format("%s/JetHistograms/hNEFVsPtDCal", jets->GetArrayName().Data());
1132  }
1133  fHistManager.FillTH3(histname, fCent, corrPt, jet->NEF());
1134 
1135  // (Centrality, pT upscaled, calo type)
1136  if (fComputeMBDownscaling) {
1137  histname = TString::Format("%s/JetHistograms/hPtUpscaledMB", jets->GetArrayName().Data());
1138  fHistManager.FillTH3(histname.Data(), fCent, corrPt, type, fMBUpscaleFactor);
1139  }
1140 
1141  // pT-leading vs. pT
1142  histname = TString::Format("%s/JetHistograms/hPtLeadingVsPt", jets->GetArrayName().Data());
1143  fHistManager.FillTH2(histname.Data(), corrPt, ptLeading);
1144 
1145  // (Centrality, pT, z-leading (charged))
1146  if (type == kEMCal) {
1147  histname = TString::Format("%s/JetHistograms/hZLeadingVsPtEMCal", jets->GetArrayName().Data());
1148  }
1149  else if (type == kDCal) {
1150  histname = TString::Format("%s/JetHistograms/hZLeadingVsPtDCal", jets->GetArrayName().Data());
1151  }
1152  TLorentzVector leadPart;
1153  jets->GetLeadingHadronMomentum(leadPart, jet);
1154  Double_t z = GetParallelFraction(leadPart.Vect(), jet);
1155  if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999; // so that it will contribute to the bin <1
1156  fHistManager.FillTH3(histname, fCent, corrPt, z);
1157 
1158  // (Centrality, pT, z (charged))
1159  if (type == kEMCal) {
1160  histname = TString::Format("%s/JetHistograms/hZVsPtEMCal", jets->GetArrayName().Data());
1161  }
1162  else if (type == kDCal) {
1163  histname = TString::Format("%s/JetHistograms/hZVsPtDCal", jets->GetArrayName().Data());
1164  }
1165  const AliVTrack* track;
1166  for (Int_t i=0; i<jet->GetNumberOfTracks(); i++) {
1167  track = static_cast<AliVTrack*>(jet->Track(i));
1168  z = track->Pt() / TMath::Abs(corrPt);
1169  fHistManager.FillTH3(histname, fCent, corrPt, z);
1170  }
1171 
1172  // (Centrality, pT, Nconst)
1173  if (type == kEMCal) {
1174  histname = TString::Format("%s/JetHistograms/hNConstVsPtEMCal", jets->GetArrayName().Data());
1175  }
1176  else if (type == kDCal) {
1177  histname = TString::Format("%s/JetHistograms/hNConstVsPtDCal", jets->GetArrayName().Data());
1178  }
1179  fHistManager.FillTH3(histname, fCent, corrPt, 1.*jet->GetNumberOfConstituents());
1180 
1181  // (Centrality, jet pT, Enonlincorr - Ehadcorr)
1182  Double_t deltaEhadcorr = 0;
1183  const AliVCluster* clus = nullptr;
1184  Int_t nClusters = jet->GetNumberOfClusters();
1185  for (Int_t iClus = 0; iClus < nClusters; iClus++) {
1186  clus = jet->Cluster(iClus);
1187  deltaEhadcorr += (clus->GetNonLinCorrEnergy() - clus->GetHadCorrEnergy());
1188  }
1189 
1190  histname = TString::Format("%s/JetHistograms/hDeltaEHadCorr", jets->GetArrayName().Data());
1191  fHistManager.FillTH3(histname, fCent, corrPt, deltaEhadcorr);
1192 
1193 
1194  // (Median patch energy, calo type, jet pT, centrality)
1195  if (fDoTriggerSimulation) {
1196  histname = TString::Format("%s/JetHistograms/hMedPatchJet", jets->GetArrayName().Data());
1197  Double_t x[4] = {fMedianEMCal, kEMCal, corrPt, fCent};
1198  fHistManager.FillTHnSparse(histname, x);
1199  Double_t y[4] = {fMedianDCal, kDCal, corrPt, fCent};
1200  fHistManager.FillTHnSparse(histname, y);
1201  }
1202 
1203  } //jet loop
1204 
1205  }
1206 }
1207 
1208 /*
1209  * This function fills the histograms for the calorimeter performance study.
1210  */
1212 {
1213  TString histname;
1214 
1215  // Loop through clusters
1217  const AliVCluster* clus;
1218  for (auto it : clusters->accepted_momentum()) {
1219 
1220  clus = it.second;
1221  Double_t clusPhi = it.first.Phi_0_2pi();
1222  Double_t clusEta = it.first.Eta();
1223 
1224  // Include only EMCal/DCal clusters
1225  if (!clus->IsEMCAL()) {
1226  continue;
1227  }
1228 
1229  // Compute the sum of matched track momentum, and various track matching / hadronic corretion quantities
1230  Double_t trackPSum = 0;
1231  Int_t nTracksMatched = 0;
1232  const AliVTrack* track = nullptr;
1233  for (Int_t itrack=0; itrack < clus->GetNTracksMatched(); itrack++) {
1234  track = dynamic_cast<AliVTrack*>(clus->GetTrackMatched(itrack));
1235  if (!track) {
1236  continue;
1237  }
1238 
1239  Double_t trackPhi = TVector2::Phi_0_2pi(track->GetTrackPhiOnEMCal());
1240  Double_t trackEta = track->GetTrackEtaOnEMCal();
1241  Double_t deta = TMath::Abs(clusPhi - trackPhi);
1242  Double_t dphi = TMath::Abs(clusEta - trackEta);
1243 
1245  trackPSum += track->P();
1246  nTracksMatched++;
1247  }
1248  }
1249 
1250  Double_t EoverP = 0;
1251  if (trackPSum > 1e-3) {
1252  EoverP = clus->GetNonLinCorrEnergy() / trackPSum;
1253  }
1254 
1255  Double_t deltaE = clus->GetNonLinCorrEnergy() - clus->GetHadCorrEnergy();
1256  Double_t Rcorr = 0;
1257  if (trackPSum > 1e-3) {
1258  Rcorr = deltaE / trackPSum;
1259  }
1260  Double_t RcorrClus = deltaE / clus->GetNonLinCorrEnergy();
1261 
1264 
1265  // Fill M02 distribution (centrality, Eclus nonlincorr, M02)
1266  histname = "ClusterHistograms/hM02";
1267  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetM02());
1268 
1269  // Plot Ncell distribution for M02 > 0.4 or M02 < 0.4 (centrality, Eclus nonlincorr, Ncells)
1270  if (clus->GetM02() > 0.4) {
1271  histname = "ClusterHistograms/hNcellsM02G04";
1272  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetNCells());
1273  }
1274  if (clus->GetM02() > 0.1 && clus->GetM02() < 0.4) {
1275  histname = "ClusterHistograms/hNcellsM02L04";
1276  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetNCells());
1277  }
1278 
1281 
1282  // Plot matched track pT (centrality, Eclus nonlincorr, trackPsum)
1283  histname = "ClusterHistograms/hMatchedTrackPt";
1284  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), trackPSum);
1285 
1286  if (clus->GetM02() > 0.4) {
1287  histname = "ClusterHistograms/hMatchedTrackPtM02G04";
1288  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), trackPSum);
1289  }
1290  if (clus->GetM02() > 0.1 && clus->GetM02() < 0.4) {
1291  histname = "ClusterHistograms/hMatchedTrackPtM02L04";
1292  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), trackPSum);
1293  }
1294 
1295  // Plot number of matched tracks (centrality, Eclus nonlincorr, N matches)
1296  histname = "ClusterHistograms/hMatchedTrackN";
1297  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), nTracksMatched);
1298 
1299  if (clus->GetM02() > 0.4) {
1300  histname = "ClusterHistograms/hMatchedTrackNM02G04";
1301  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), nTracksMatched);
1302  }
1303  if (clus->GetM02() > 0.1 && clus->GetM02() < 0.4) {
1304  histname = "ClusterHistograms/hMatchedTrackNM02L04";
1305  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), nTracksMatched);
1306  }
1307 
1308  // Plot M02 distribution for clusters with matched tracks (centrality, Eclus nonlincorr, M02)
1309  histname = "ClusterHistograms/hM02Matched";
1310  if (nTracksMatched > 0) {
1311  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetM02());
1312  }
1313 
1314  // Plot M02 distribution for clusters without matched tracks (centrality, Eclus nonlincorr, M02)
1315  histname = "ClusterHistograms/hM02Unmatched";
1316  if (nTracksMatched == 0) {
1317  fHistManager.FillTH3(histname, fCent, clus->GetNonLinCorrEnergy(), clus->GetM02());
1318  }
1319 
1322 
1323  // Plot E/p vs. M02 for 0-10% and 50-90% (Eclus nonlincorr, Eclus nonlincorr / trackPsum, M02)
1324  if (fCent < 10) {
1325  histname = "ClusterHistograms/hEoverPM02Central";
1326  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), EoverP, clus->GetM02());
1327  }
1328  if (fCent > 50 && fCent < 90) {
1329  histname = "ClusterHistograms/hEoverPM02Peripheral";
1330  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), EoverP, clus->GetM02());
1331  }
1332 
1335 
1336  // Fill Rcorr distribution (centrality, trackPSum, Rcorr = (Enonlincorr - Ehadcorr) / trackPSum)
1337  histname = "ClusterHistograms/hRcorrVsCent";
1338  fHistManager.FillTH3(histname, fCent, trackPSum, Rcorr);
1339 
1340  // Fill Rcorr distribution for 0-10% centrality (Eclus nonlincorr, trackPSum, Rcorr)
1341  if (fCent > 0 && fCent < 10) {
1342  histname = "ClusterHistograms/hRcorr0-10";
1343  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), trackPSum, Rcorr);
1344  }
1345 
1346  // Fill Rcorr distribution for 50-90% centrality (Eclus nonlincorr, trackPSum, Rcorr)
1347  if (fCent > 50 && fCent < 90) {
1348  histname = "ClusterHistograms/hRcorr50-90";
1349  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), trackPSum, Rcorr);
1350  }
1351 
1352  // Fill also Rcorr-clus (centrality, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
1353  histname = "ClusterHistograms/hRcorrClusVsCent";
1354  fHistManager.FillTH3(histname, fCent, trackPSum, RcorrClus);
1355 
1356  // Fill Rcorr-clus for 0-10% centrality (Eclus nonlincorr, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
1357  if (fCent > 0 && fCent < 10) {
1358  histname = "ClusterHistograms/hRcorrClus0-10";
1359  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), trackPSum, RcorrClus);
1360  }
1361 
1362  // Fill Rcorr-clus for 50-90% centrality (Eclus nonlincorr, trackPSum, Rcorr-clus = (Enonlincorr - Ehadcorr) / Enonlincorr )
1363  if (fCent > 50 && fCent < 90) {
1364  histname = "ClusterHistograms/hRcorrClus50-90";
1365  fHistManager.FillTH3(histname, clus->GetNonLinCorrEnergy(), trackPSum, RcorrClus);
1366  }
1367 
1368  }
1369 
1370 }
1371 
1372 /*
1373  * This function fills the histograms for the calorimeter performance study.
1374  */
1376 {
1377  TString histname;
1378 
1379  // If MC, get the MC event
1380  const AliMCEvent* mcevent = nullptr;
1381  if (fGeneratorLevel) {
1382  mcevent = MCEvent();
1383  }
1384  else {
1385  return;
1386  }
1387 
1388  // Loop through clusters, and plot M02 for each particle type
1390  const AliVCluster* clus;
1391  for (auto it : clusters->accepted_momentum()) {
1392 
1393  clus = it.second;
1394 
1395  // Include only EMCal clusters (reject DCal and PHOS clusters)
1396  if (!clus->IsEMCAL()) {
1397  continue;
1398  }
1399  if (it.first.Phi_0_2pi() > fgkEMCalDCalPhiDivide) {
1400  continue;
1401  }
1402 
1403  // If MC, determine the particle type
1404  // Each detector-level cluster contains an array of labels of each truth-level particle contributing to the cluster
1405  ParticleType particleType1 = kUndefined;
1406 
1407  Int_t label = TMath::Abs(clus->GetLabel()); // returns mc-label of particle that deposited the most energy in the cluster
1408  if (label > 0) { // if the particle has a truth-level match, the label is > 0
1409 
1410  // Method 1: Use AliMCAnalysisUtils to identify all particles
1411  particleType1 = GetParticleType1(clus, mcevent, clusters->GetArray());
1412 
1413  }
1414 
1415  // (M02, Eclus, part type)
1416  histname = "JetPerformance/hM02VsParticleType";
1417  fHistManager.FillTH3(histname, clus->GetM02(), clus->GetNonLinCorrEnergy(), particleType1);
1418 
1419  }
1420 
1421  // Loop through jets, to fill various histograms
1422  AliJetContainer* jets = GetJetContainer(0); // there is only a single, det-level jet finder here
1423  for (const auto jet : jets->accepted()) {
1424 
1425  Double_t jetPt = GetJetPt(jet, 0);
1426 
1427  // Keep track of hadronic calo energy in each jet
1428  Double_t hadCaloEnergyUnmatched = 0;
1429  Double_t hadCaloEnergyMatchedNonlincorr = 0;
1430  Double_t hadCaloEnergyMatchedHadCorr = 0;
1431 
1432  // Loop through clusters in each jet, to plot several histograms
1433  Int_t nClusters = jet->GetNumberOfClusters();
1434  for (Int_t iClus = 0; iClus < nClusters; iClus++) {
1435 
1436  clus = jet->Cluster(iClus);
1437 
1438  // Get the particle type of the cluster
1439  ParticleType particleType1 = kUndefined;
1440  Int_t label = TMath::Abs(clus->GetLabel());
1441  if (label > 0) {
1442  particleType1 = GetParticleType1(clus, mcevent, clusters->GetArray());
1443  }
1444 
1445  // Plot M02 for each particle type
1446  histname = "JetPerformance/hM02VsParticleTypeJets";
1447  Double_t x[4] = {clus->GetM02(), clus->GetNonLinCorrEnergy(), particleType1, jetPt};
1448  fHistManager.FillTHnSparse(histname, x);
1449 
1450  // If the cluster is a hadron, sum its energy to compute the jet's hadronic calo energy
1451  if (particleType1 == kHadron) {
1452  Bool_t hasMatchedTrack = (clus->GetNTracksMatched() > 0);
1453  //Bool_t hasMatchedTrack = ((clus->GetNonLinCorrEnergy() - clus->GetHadCorrEnergy()) > 1e-3);
1454  if (hasMatchedTrack) {
1455  hadCaloEnergyMatchedNonlincorr += clus->GetNonLinCorrEnergy();
1456  hadCaloEnergyMatchedHadCorr += clus->GetHadCorrEnergy();
1457  }
1458  else {
1459  hadCaloEnergyUnmatched += clus->GetNonLinCorrEnergy();
1460  }
1461  }
1462 
1463  }
1464 
1465  // Fill hadronic calo energy in each jet
1466 
1467  // (Jet pT, Summed energy of hadronic clusters without a matched track)
1468  histname = "JetPerformance/hHadCaloEnergyUnmatched";
1469  fHistManager.FillTH2(histname, jetPt, hadCaloEnergyUnmatched);
1470 
1471  // (Jet pT vs. Summed energy of hadronic clusters with a matched track (before hadronic correction))
1472  histname = "JetPerformance/hHadCaloEnergyMatchedNonlincorr";
1473  fHistManager.FillTH2(histname, jetPt, hadCaloEnergyMatchedNonlincorr);
1474 
1475  // (Jet pT vs. Summed energy of hadronic clusters with a matched track (after hadronic correction))
1476  histname = "JetPerformance/hHadCaloEnergyMatchedHadCorr";
1477  fHistManager.FillTH2(histname, jetPt, hadCaloEnergyMatchedHadCorr);
1478 
1479  // Loop through particle types, and plot jet composition for each particle type
1480  histname = "JetPerformance/hJetComposition";
1481  for (Int_t type = 0; type < 8; type++) {
1482 
1483  ParticleType particleType1 = kUndefined;
1484  Double_t nSum = 0;
1485  Double_t pTsum = 0;
1486 
1487  // Loop through clusters in jet, and add to sum if cluster matches particle type
1488  for (Int_t iClus = 0; iClus < nClusters; iClus++) {
1489 
1490  clus = jet->Cluster(iClus);
1491 
1492  Int_t label = TMath::Abs(clus->GetLabel());
1493  if (label > 0) {
1494  particleType1 = GetParticleType1(clus, mcevent, clusters->GetArray());
1495  }
1496 
1497  if (type == particleType1) {
1498  nSum++;
1499  pTsum += clus->GetNonLinCorrEnergy();
1500  }
1501  }
1502 
1503  // Fill jet composition histogram
1504  Double_t x[4] = {jetPt, 1.*type, nSum, pTsum};
1505  fHistManager.FillTHnSparse(histname, x);
1506 
1507  }
1508  }
1509 }
1510 
1515 {
1516  // Loop over tracks and clusters in order to:
1517  // (1) Compute scale factor for full jets
1518  // (2) Compute delta-pT for full jets, with the random cone method
1519 
1520  // Define the acceptance boundaries for the TPC and EMCal/DCal/PHOS
1521  Double_t etaTPC = 0.9;
1522  Double_t etaEMCal = 0.7;
1523  //Double_t etaMinDCal = 0.22;
1524  Double_t phiMinEMCal = fGeom->GetArm1PhiMin() * TMath::DegToRad(); // 80
1525  Double_t phiMaxEMCal = fGeom->GetEMCALPhiMax() * TMath::DegToRad(); // ~188
1526  //Double_t phiMinDCal = fGeom->GetDCALPhiMin() * TMath::DegToRad(); // 260
1527  //Double_t phiMaxDCal = fGeom->GetDCALPhiMax() * TMath::DegToRad(); // ~327 (1/3 SMs start at 320)
1528 
1529  Double_t accTPC = 2 * etaTPC * 2 * TMath::Pi();
1530  Double_t accEMCal = 2 * etaEMCal * (phiMaxEMCal - phiMinEMCal);
1531  //Double_t accDCalRegion = 2 * etaEMCal * (phiMaxDCal - phiMinDCal);
1532 
1533  // Loop over jet containers
1534  AliJetContainer* jetCont = 0;
1535  TIter nextJetColl(&fJetCollArray);
1536  while ((jetCont = static_cast<AliJetContainer*>(nextJetColl()))) {
1537 
1538  // Define fiducial acceptances, to be used to generate random cones
1539  TRandom3* r = new TRandom3(0);
1540  Double_t jetR = jetCont->GetJetRadius();
1541  Double_t etaEMCalfid = etaEMCal - jetR;
1542  Double_t phiMinEMCalfid = phiMinEMCal + jetR;
1543  Double_t phiMaxEMCalfid = phiMaxEMCal - jetR;
1544 
1545  // Generate EMCal random cone eta-phi
1546  Double_t etaEMCalRC = r->Uniform(-etaEMCalfid, etaEMCalfid);
1547  Double_t phiEMCalRC = r->Uniform(phiMinEMCalfid, phiMaxEMCalfid);
1548 
1549  // Initialize the various sums to 0
1550  Double_t trackPtSumTPC = 0;
1551  Double_t trackPtSumEMCal = 0;
1552  Double_t trackPtSumEMCalRC = 0;
1553  Double_t clusESumEMCal = 0;
1554  Double_t clusESumEMCalRC = 0;
1555 
1556  // Define a 2D vector (initialized to 0) to store the sum of track pT, and another for cluster ET
1557  std::vector<std::vector<Double_t>> trackPtSumDCalRC(fNEtaBins, std::vector<Double_t>(fNPhiBins));
1558  std::vector<std::vector<Double_t>> clusESumDCalRC(fNEtaBins, std::vector<Double_t>(fNPhiBins));
1559 
1560  // Loop over tracks. Sum the track pT:
1561  // (1) in the entire TPC, (2) in the EMCal, (3) in the EMCal random cone,
1562  AliTrackContainer* trackCont = dynamic_cast<AliTrackContainer*>(GetParticleContainer("tracks"));
1563  AliTLorentzVector track;
1564  Double_t trackEta;
1565  Double_t trackPhi;
1566  Double_t trackPt;
1567  Double_t deltaR;
1568  for (auto trackIterator : trackCont->accepted_momentum() ) {
1569 
1570  track.Clear();
1571  track = trackIterator.first;
1572  trackEta = track.Eta();
1573  trackPhi = track.Phi_0_2pi();
1574  trackPt = track.Pt();
1575 
1576  // (1)
1577  if (TMath::Abs(trackEta) < etaTPC) {
1578  trackPtSumTPC += trackPt;
1579  }
1580 
1581  // (2)
1582  if (TMath::Abs(trackEta) < etaEMCal && trackPhi > phiMinEMCal && trackPhi < phiMaxEMCal) {
1583  trackPtSumEMCal += trackPt;
1584  }
1585 
1586  // (3)
1587  deltaR = GetDeltaR(&track, etaEMCalRC, phiEMCalRC);
1588  if (deltaR < jetR) {
1589  trackPtSumEMCalRC += trackPt;
1590  }
1591 
1592  }
1593 
1594  // Loop over clusters. Sum the cluster ET:
1595  // (1) in the EMCal, (2) in the EMCal random cone
1597  AliTLorentzVector clus;
1598  Double_t clusEta;
1599  Double_t clusPhi;
1600  Double_t clusE;
1601  for (auto clusIterator : clusCont->accepted_momentum() ) {
1602 
1603  clus.Clear();
1604  clus = clusIterator.first;
1605  clusEta = clus.Eta();
1606  clusPhi = clus.Phi_0_2pi();
1607  clusE = clus.E();
1608 
1609  // (1)
1610  if (TMath::Abs(clusEta) < etaEMCal && clusPhi > phiMinEMCal && clusPhi < phiMaxEMCal) {
1611  clusESumEMCal += clusE;
1612  }
1613 
1614  // (2)
1615  deltaR = GetDeltaR(&clus, etaEMCalRC, phiEMCalRC);
1616  if (deltaR < jetR) {
1617  clusESumEMCalRC += clusE;
1618  }
1619 
1620  }
1621 
1622  // Compute the scale factor for EMCal, as a function of centrality
1623  Double_t numerator = (trackPtSumEMCal + clusESumEMCal) / accEMCal;
1624  Double_t denominator = trackPtSumTPC / accTPC;
1625  Double_t scaleFactor = numerator / denominator;
1626  TString histname = TString::Format("%s/BackgroundHistograms/hScaleFactorEMCal", jetCont->GetArrayName().Data());
1627  fHistManager.FillTH2(histname, fCent, scaleFactor);
1628 
1629  // Compute delta pT for EMCal, as a function of centrality
1630  Double_t rho = jetCont->GetRhoVal();
1631  Double_t deltaPt = trackPtSumEMCalRC + clusESumEMCalRC - rho * TMath::Pi() * jetR * jetR;
1632  histname = TString::Format("%s/BackgroundHistograms/hDeltaPtEMCal", jetCont->GetArrayName().Data());
1633  fHistManager.FillTH2(histname, fCent, deltaPt);
1634 
1635  delete r;
1636 
1637  }
1638 
1639 }
1640 
1646 {
1647  TString histname;
1648  AliJetContainer* jets = 0;
1649  TIter nextJetColl(&fJetCollArray);
1650  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
1651  TString jetContName = jets->GetName();
1652 
1653  Double_t rhoVal = 0;
1654  if (jets->GetRhoParameter()) {
1655  rhoVal = jets->GetRhoVal();
1656  histname = TString::Format("%s/TriggerSimHistograms/hRhoVsCent", jets->GetArrayName().Data());
1657  fHistManager.FillTH2(histname.Data(), fCent, rhoVal);
1658  }
1659 
1660  for (auto jet : jets->all()) {
1661 
1662  Float_t ptLeading = jets->GetLeadingHadronPt(jet);
1663  Float_t corrPt = GetJetPt(jet, rhoVal);
1664 
1665  // A vs. pT (fill before area cut)
1666  histname = TString::Format("%s/TriggerSimHistograms/hAreaVsPt", jets->GetArrayName().Data());
1667  fHistManager.FillTH2(histname.Data(), corrPt, jet->Area());
1668 
1669  // Rejection reason
1670  UInt_t rejectionReason = 0;
1671  if (!jets->AcceptJet(jet, rejectionReason)) {
1672  histname = TString::Format("%s/TriggerSimHistograms/hJetRejectionReason", jets->GetArrayName().Data());
1673  fHistManager.FillTH2(histname.Data(), jets->GetRejectionReasonBitPosition(rejectionReason), jet->Pt());
1674  continue;
1675  }
1676 
1677  // compute jet acceptance type
1678  Double_t type = GetJetType(jet);
1679  if ( (type != kEMCal) && (type != kDCal) ) {
1680  continue;
1681  }
1682 
1683  // (Centrality, pT, NEF, calo type)
1684  if (type == kEMCal) {
1685  histname = TString::Format("%s/TriggerSimHistograms/hNEFVsPtEMCal", jets->GetArrayName().Data());
1686  }
1687  else if (type == kDCal) {
1688  histname = TString::Format("%s/TriggerSimHistograms/hNEFVsPtDCal", jets->GetArrayName().Data());
1689  }
1690  fHistManager.FillTH3(histname, fCent, corrPt, jet->NEF());
1691 
1692  // pT-leading vs. pT
1693  histname = TString::Format("%s/TriggerSimHistograms/hPtLeadingVsPt", jets->GetArrayName().Data());
1694  fHistManager.FillTH2(histname.Data(), corrPt, ptLeading);
1695 
1696  // (Centrality, pT, z-leading (charged), calo type)
1697  if (type == kEMCal) {
1698  histname = TString::Format("%s/TriggerSimHistograms/hZLeadingVsPtEMCal", jets->GetArrayName().Data());
1699  }
1700  else if (type == kDCal) {
1701  histname = TString::Format("%s/TriggerSimHistograms/hZLeadingVsPtDCal", jets->GetArrayName().Data());
1702  }
1703  TLorentzVector leadPart;
1704  jets->GetLeadingHadronMomentum(leadPart, jet);
1705  Double_t z = GetParallelFraction(leadPart.Vect(), jet);
1706  if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999; // so that it will contribute to the bin <1
1707  fHistManager.FillTH3(histname, fCent, corrPt, z);
1708 
1709  // (Centrality, pT, z (charged), calo type)
1710  if (type == kEMCal) {
1711  histname = TString::Format("%s/TriggerSimHistograms/hZVsPtEMCal", jets->GetArrayName().Data());
1712  }
1713  else if (type == kDCal) {
1714  histname = TString::Format("%s/TriggerSimHistograms/hZVsPtDCal", jets->GetArrayName().Data());
1715  }
1716  const AliVTrack* track;
1717  for (Int_t i=0; i<jet->GetNumberOfTracks(); i++) {
1718  track = static_cast<AliVTrack*>(jet->Track(i));
1719  z = track->Pt() / TMath::Abs(corrPt);
1720  fHistManager.FillTH3(histname, fCent, corrPt, z);
1721  }
1722 
1723  // (Centrality, pT, Nconst)
1724  if (type == kEMCal) {
1725  histname = TString::Format("%s/TriggerSimHistograms/hNConstVsPtEMCal", jets->GetArrayName().Data());
1726  }
1727  else if (type == kDCal) {
1728  histname = TString::Format("%s/TriggerSimHistograms/hNConstVsPtDCal", jets->GetArrayName().Data());
1729  }
1730  fHistManager.FillTH3(histname, fCent, corrPt, 1.*jet->GetNumberOfConstituents());
1731 
1732  } //jet loop
1733 
1734  }
1735 }
1736 
1742 {
1743  TString histname;
1744  AliJetContainer* jets = 0;
1745  const AliEmcalJet* matchedJet = nullptr;
1746  TIter nextJetColl(&fJetCollArray);
1747  while ((jets = static_cast<AliJetContainer*>(nextJetColl()))) {
1748  TString jetContName = jets->GetName();
1749 
1750  // Only loop over jets in the detector-level jet container
1751  if (jetContName.Contains("mcparticles")) {
1752  continue;
1753  }
1754 
1755  Double_t rhoVal = 0;
1756  if (jets->GetRhoParameter()) {
1757  rhoVal = jets->GetRhoVal();
1758  }
1759 
1760  for (auto jet : jets->accepted()) {
1761 
1762  // Get the matched jet, if it exists
1763  matchedJet = jet->MatchedJet();
1764  if (!matchedJet) {
1765  continue;
1766  }
1767 
1768  // compute jet acceptance type
1769  Double_t type = GetJetType(jet);
1770  if ( (type != kEMCal) && (type != kDCal) ) {
1771  continue;
1772  }
1773 
1774  Float_t detPt = GetJetPt(jet, rhoVal);
1775  Float_t truthPt = matchedJet->Pt();
1776 
1777  // Fill response matrix (centrality, pT-truth, pT-det)
1778  if (type == kEMCal) {
1779  histname = "MatchedJetHistograms/hResponseMatrixEMCal";
1780  }
1781  else if (type == kDCal) {
1782  histname = "MatchedJetHistograms/hResponseMatrixDCal";
1783  }
1784  fHistManager.FillTH3(histname, fCent, truthPt, detPt);
1785 
1786  // Fill JES shift (centrality, pT-truth, (pT-det - pT-truth) / pT-truth)
1787  if (type == kEMCal) {
1788  histname = "MatchedJetHistograms/hJESshiftEMCal";
1789  }
1790  else if (type == kDCal) {
1791  histname = "MatchedJetHistograms/hJESshiftDCal";
1792  }
1793  fHistManager.FillTH3(histname, fCent, truthPt, (detPt-truthPt)/truthPt );
1794 
1795  // Fill NEF of det-level matched jets (centrality, pT-truth, NEF)
1796  histname = "MatchedJetHistograms/hNEFVsPt";
1797  fHistManager.FillTH3(histname, fCent, truthPt, jet->NEF());
1798 
1799  // Fill z-leading (charged) of det-level matched jets (centrality, pT-truth, z-leading)
1800  histname = "MatchedJetHistograms/hZLeadingVsPt";
1801  TLorentzVector leadPart;
1802  jets->GetLeadingHadronMomentum(leadPart, jet);
1803  Double_t z = GetParallelFraction(leadPart.Vect(), jet);
1804  if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999; // so that it will contribute to the bin <1
1805  fHistManager.FillTH3(histname, fCent, truthPt, z);
1806 
1807  // Fill matching distance (centrality, pT-truth, R)
1808  histname = "MatchedJetHistograms/hMatchingDistance";
1809  fHistManager.FillTH3(histname, fCent, truthPt, jet->ClosestJetDistance());
1810 
1811  } //jet loop
1812  }
1813 }
1814 
1815 /*
1816  * Compute the MC particle type using AliMCAnalysisUtils
1817  */
1818 AliAnalysisTaskEmcalJetPerformance::ParticleType AliAnalysisTaskEmcalJetPerformance::GetParticleType1(const AliVCluster* clus, const AliMCEvent* mcevent, const TClonesArray* clusArray)
1819 {
1820  ParticleType particleType = kUndefined;
1821 
1822  AliMCAnalysisUtils mcUtils;
1823  Int_t tag = mcUtils.CheckOrigin(clus->GetLabels(), clus->GetNLabels(), mcevent, clusArray);
1824 
1825  Bool_t isPhoton = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCPhoton);
1826  Bool_t isPi0 = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0);
1827  Bool_t isConversion = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion);
1828  Bool_t isEta = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCEta);
1829  Bool_t isPion = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCPion);
1830  Bool_t isKaon = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCKaon);
1831  Bool_t isProton = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCProton);
1832  Bool_t isAntiProton = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCAntiProton);
1833  Bool_t isNeutron = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCNeutron);
1834  Bool_t isAntiNeutron = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCAntiNeutron);
1835  Bool_t isElectron = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCElectron);
1836  Bool_t isMuon = mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCMuon);
1837 
1838  if (isPi0) {
1839  if (isConversion) {
1840  particleType = kPi0Conversion;
1841  }
1842  else {
1843  particleType = kPi0;
1844  }
1845  }
1846  else if (isEta) {
1847  particleType = kEta;
1848  }
1849  else if (isPhoton) {
1850  particleType = kPhoton;
1851  }
1852  else if (isPion || isKaon || isProton || isAntiProton || isNeutron || isAntiNeutron) {
1853  particleType = kHadron;
1854  }
1855  else if (isElectron) {
1856  particleType = kElectron;
1857  }
1858  else if (isMuon) {
1859  particleType = kMuon;
1860  }
1861  else {
1862  particleType = kOther;
1863  }
1864  return particleType;
1865 }
1866 
1867 /*
1868  * Compute the MC particle type using the MC particle container (and only AliMCAnalysisUtils to find merged pi0)
1869  */
1871 {
1872  ParticleType particleType = kUndefined;
1873 
1874  AliAODMCParticle *part = fGeneratorLevel->GetMCParticleWithLabel(label);
1875  if (part) {
1876 
1877  TString histname = TString::Format("%s/hClusterRejectionReasonMC", clusters->GetArrayName().Data());
1878  UInt_t rejectionReason = 0;
1879  if (!fGeneratorLevel->AcceptMCParticle(part, rejectionReason)) {
1880  fHistManager.FillTH2(histname, fGeneratorLevel->GetRejectionReasonBitPosition(rejectionReason), clus->GetNonLinCorrEnergy());
1881  return particleType;
1882  }
1883 
1884  if (part->GetGeneratorIndex() == 0) { // generator index in cocktail
1885 
1886  // select charged pions, protons, kaons, electrons, muons
1887  Int_t pdg = TMath::Abs(part->PdgCode()); // abs value ensures both particles and antiparticles are included
1888 
1889  if (pdg == 22) { // gamma 22
1890 
1891  AliMCAnalysisUtils mcUtils;
1892  Int_t tag;
1893  mcUtils.CheckOverlapped2GammaDecay(clus->GetLabels(), clus->GetNLabels(), part->GetMother(), mcevent, tag);
1894 
1895  if (mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCPi0)) {
1896  if (mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCConversion)) {
1897  particleType = kPi0Conversion;
1898  }
1899  else {
1900  particleType = kPi0;
1901  }
1902  }
1903  else if (mcUtils.CheckTagBit(tag, AliMCAnalysisUtils::kMCEta)) {
1904  particleType = kEta;
1905  }
1906  else { // direct photon
1907  particleType = kPhoton;
1908  }
1909 
1910  }
1911  else if (pdg == 211 || 2212 || 321 || 2112) { // pi+ 211, proton 2212, K+ 321, neutron 2112
1912  particleType = kHadron;
1913  }
1914  else if (pdg == 11) { // e- 11
1915  particleType = kElectron;
1916  }
1917  else if (pdg == 13) { // mu- 13
1918  particleType = kMuon;
1919  }
1920  else {
1921  particleType = kOther;
1922  }
1923  }
1924  }
1925  return particleType;
1926 }
1927 
1932 {
1933  Double_t deltaPhi = TMath::Abs(part->Phi_0_2pi() - phiRef);
1934  Double_t deltaEta = TMath::Abs(part->Eta() - etaRef);
1935  Double_t deltaR = TMath::Sqrt( deltaPhi*deltaPhi + deltaEta*deltaEta );
1936  return deltaR;
1937 }
1938 
1943 {
1944  UInt_t jetType = jet->GetJetAcceptanceType();
1945  Double_t type = -1;
1946  if (jetType & AliEmcalJet::kEMCAL) {
1947  type = kEMCal;
1948  }
1949  else if (jetType & AliEmcalJet::kDCALonly) {
1950  type = kDCal;
1951  }
1952 
1953  return type;
1954 }
1955 
1960 {
1961  Double_t pT = jet->Pt() - rho * jet->Area();
1962  return pT;
1963 }
1964 
1969  const char *ntracks,
1970  const char *nclusters,
1971  const char *nGenLev,
1972  const Double_t minTrPt,
1973  const Double_t minClPt,
1974  const char *suffix)
1975 {
1976  // Get the pointer to the existing analysis manager via the static access method.
1977  //==============================================================================
1978  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
1979  if (!mgr)
1980  {
1981  ::Error("AddTaskEmcalJetPerformance", "No analysis manager to connect to.");
1982  return 0;
1983  }
1984 
1985  // Check the analysis type using the event handlers connected to the analysis manager.
1986  //==============================================================================
1987  AliVEventHandler* handler = mgr->GetInputEventHandler();
1988  if (!handler)
1989  {
1990  ::Error("AddTaskEmcalJetPerformance", "This task requires an input event handler");
1991  return 0;
1992  }
1993 
1994  enum EDataType_t {
1995  kUnknown,
1996  kESD,
1997  kAOD
1998  };
1999 
2000  EDataType_t dataType = kUnknown;
2001 
2002  if (handler->InheritsFrom("AliESDInputHandler")) {
2003  dataType = kESD;
2004  }
2005  else if (handler->InheritsFrom("AliAODInputHandler")) {
2006  dataType = kAOD;
2007  }
2008 
2009  //-------------------------------------------------------
2010  // Init the task and do settings
2011  //-------------------------------------------------------
2012 
2013  TString trackName(ntracks);
2014  TString clusName(nclusters);
2015 
2016  if (trackName == "usedefault") {
2017  if (dataType == kESD) {
2018  trackName = "Tracks";
2019  }
2020  else if (dataType == kAOD) {
2021  trackName = "tracks";
2022  }
2023  else {
2024  trackName = "";
2025  }
2026  }
2027 
2028  if (clusName == "usedefault") {
2029  if (dataType == kESD) {
2030  clusName = "CaloClusters";
2031  }
2032  else if (dataType == kAOD) {
2033  clusName = "caloClusters";
2034  }
2035  else {
2036  clusName = "";
2037  }
2038  }
2039 
2040  TString name("AliAnalysisTaskEmcalJetPerformance");
2041  if (!trackName.IsNull()) {
2042  name += "_";
2043  name += trackName;
2044  }
2045  if (!clusName.IsNull()) {
2046  name += "_";
2047  name += clusName;
2048  }
2049  if (strcmp(suffix,"") != 0) {
2050  name += "_";
2051  name += suffix;
2052  }
2053 
2055  // Configure di-jet task
2057 
2059  // Create track and cluster containers with the standard cuts
2060 
2061  AliParticleContainer* partCont = 0;
2062  if (trackName == "mcparticles") {
2063  AliMCParticleContainer* mcpartCont = new AliMCParticleContainer(trackName);
2064  partCont = mcpartCont;
2065  }
2066  else if (trackName == "tracks" || trackName == "Tracks") {
2067  AliTrackContainer* trackCont = new AliTrackContainer(trackName);
2068  partCont = trackCont;
2069  }
2070  if (partCont) partCont->SetParticlePtCut(minTrPt);
2071  if (partCont) task->AdoptParticleContainer(partCont);
2072 
2073  // Add the generator-level container, if specified
2074  if (nGenLev && strcmp(nGenLev,"")!=0) {
2075  AliMCParticleContainer* mcpartCont = task->AddMCParticleContainer(nGenLev);
2076  mcpartCont->SelectPhysicalPrimaries(kTRUE);
2077  mcpartCont->SetParticlePtCut(0);
2078  }
2079 
2080  // Add the cluster container
2081  AliClusterContainer* clusCont = 0;
2082  if (!clusName.IsNull()) {
2083  clusCont = new AliClusterContainer(clusName);
2084  clusCont->SetClusECut(0.);
2085  clusCont->SetClusPtCut(0.);
2086  }
2087  if (clusCont) task->AdoptClusterContainer(clusCont);
2088 
2089  //-------------------------------------------------------
2090  // Final settings, pass to manager and set the containers
2091  //-------------------------------------------------------
2092 
2093  mgr->AddTask(task);
2094 
2095  // Create containers for input/output
2096  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
2097  TString contname(name);
2098  contname += "_histos";
2099  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
2100  TList::Class(),AliAnalysisManager::kOutputContainer,
2101  Form("%s", AliAnalysisManager::GetCommonFileName()));
2102  mgr->ConnectInput (task, 0, cinput1 );
2103  mgr->ConnectOutput (task, 1, coutput1 );
2104 
2105  return task;
2106 }
2107 
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
ParticleType GetParticleType2(const AliVCluster *clus, const AliMCEvent *mcevent, Int_t label, const AliClusterContainer *clusters)
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
Bool_t fUseAliEventCuts
Flag to use AliEventCuts (otherwise AliAnalysisTaskEmcal will be used)
AliJetContainer * GetJetContainer(Int_t i=0) const
UInt_t fOffTrigger
offline trigger for event selection
void AdoptParticleContainer(AliParticleContainer *cont)
static AliEmcalDownscaleFactorsOCDB * Instance()
const AliClusterIterableMomentumContainer accepted_momentum() const
Int_t nbinsy
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.
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
Container for particles within the EMCAL framework.
void SetCaloTriggerPatchInfoName(const char *n)
Bool_t fPlotClusterHistograms
Set whether to plot cluster histograms.
Int_t CheckOrigin(Int_t label, const AliMCEvent *mcevent)
Double_t GetDeltaR(const AliTLorentzVector *part, Double_t etaRef, Double_t phiRef)
void AdoptClusterContainer(AliClusterContainer *cont)
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
ParticleType GetParticleType1(const AliVCluster *clus, const AliMCEvent *mcevent, const TClonesArray *clusArray)
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.
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.
Bool_t fUseManualEventCuts
Flag to use manual event cuts.
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
std::vector< TString > GetTriggerClasses() const
Double_t fCent
!event centrality
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()
void CheckOverlapped2GammaDecay(const Int_t *labels, Int_t nlabels, Int_t mesonIndex, const AliMCEvent *mcevent, Int_t &tag)
Double_t Pt() const
Definition: AliEmcalJet.h:109
Int_t nbinsx
virtual Bool_t IsEventSelected()
Performing event selection.
static Double_t * GenerateFixedBinArray(Int_t n, Double_t min, Double_t max)
Bool_t fComputeBackground
Set whether to enable study of background.
Pi0 (merged pi0) with conversion of one photon (may be only partially contained in cluster) ...
AliEmcalList * fOutput
!output list
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.
Handler for downscale factors for various triggers obtained from the OCDB.
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
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
Class with analysis utils for simulations.
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
Bool_t CheckTagBit(Int_t tag, UInt_t test) const
Container for jet within the EMCAL jet framework.
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.
const AliJetIterableContainer all() const
static const AliAnalysisTaskEmcalEmbeddingHelper * GetInstance()
static Double_t fgkEMCalDCalPhiDivide
phi value used to distinguish between DCal and EMCal