AliPhysics  1811c8f (1811c8f)
AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 #include <TClonesArray.h>
17 #include <TH1F.h>
18 #include <TF1.h>
19 #include <TH2F.h>
20 #include <TH1.h>
21 #include <TH2.h>
22 #include <TH3.h>
23 #include <THnSparse.h>
24 #include <TList.h>
25 #include <array>
26 #include <iostream>
27 #include <map>
28 #include <vector>
29 #include <TRandom3.h>
30 #include <TClonesArray.h>
31 #include <TGrid.h>
32 #include <THistManager.h>
33 #include <THashList.h>
34 #include <TLinearBinning.h>
35 #include <TObjArray.h>
36 #include <TParameter.h>
37 
38 #include <AliVCluster.h>
39 #include <AliVParticle.h>
40 #include <AliLog.h>
41 
42 #include "AliTLorentzVector.h"
43 #include "AliEmcalJet.h"
44 #include "AliRhoParameter.h"
45 #include "AliJetContainer.h"
46 #include "AliParticleContainer.h"
47 #include "AliClusterContainer.h"
48 #include "AliEMCALGeometry.h"
49 #include "AliVCaloCells.h"
50 #include "AliESDCaloCells.h"
51 #include "AliMCEvent.h"
52 #include "AliMCParticle.h"
53 #include "AliGenEventHeader.h"
54 #include "AliGenPythiaEventHeader.h"
55 
56 
57 #include "AliAnalysisUtils.h"
58 #include "AliESDEvent.h"
59 #include "AliAODEvent.h"
60 #include "AliVEvent.h"
61 #include "AliEMCALTriggerPatchInfo.h"
63 #include "AliInputEventHandler.h"
64 #include "AliLog.h"
65 #include "AliMultSelection.h"
66 #include "AliMultEstimator.h"
67 #include "AliOADBContainer.h"
68 
70 
74 
75 using std::cout;
76 using std::endl;
77 
83 fUseRecalcPatches(false),
84 fHistManager(),
85 fRecevent(),
86 fMCevent(),
87 fGeneratorLevel(0),
88 fMCJetContainer(nullptr),
89 fRecoUtil(0x0), fClusterEResolution(0x0), fVaryTrkPtRes(),
90 fUseSumw2(),
91 fHistNumbJets(),
92 fHistJetPt(),
93 fHistJetJetPatchE(),
94 fHistJetGammaPatchE(),
95 fHistJetJetPatchPt(),
96 fHistJetGammaPatchPt(),
97 fHistTriggerPatchE(),
98 fhnMBJetSpectra(),
99 fhnTrkQA(),
100 fhnClusQA()
101 
102 {
103  //Array Initiation
104  for(int i=0;i<9;i++){
105  fHistEMCalTowerMult[i] = NULL;
106 
107  }
108 }
109 
116 AliAnalysisTaskEmcalJet(name, kTRUE),
117 fUseRecalcPatches(false),
118 fHistManager(name),
119 fRecevent(NULL),
120 fMCevent(NULL),
121 fGeneratorLevel(0),
124 fUseSumw2(0),
125 fHistNumbJets(0),
126 fHistJetPt(0),
132 fhnMBJetSpectra(0x0),
133 fhnTrkQA(0x0),
134 fhnClusQA(0x0)
135 
136 
137 {
138  //Array Initiation
139  for(int i=0;i<=9;i++){
140  fHistEMCalTowerMult[i] = NULL;
141 
142  }
144  SetCaloTriggerPatchInfoName("EmcalTriggers");
145 }
146 
151 {
152 }
153 
159 {
161 
162  TString histName = "";
163  TString histTitle = "";
164  for(int i=0;i<=9;i++){
165  histName = TString::Format("fHistEMCalTowerMult_%d",i);
166  histTitle = TString::Format("%s;N_{tower};Counts",histName.Data());
167  fHistEMCalTowerMult[i] = new TH1F(histName.Data(),histTitle.Data(),400,0,400);
168  fOutput->Add(fHistEMCalTowerMult[i]);
169  }
170 
171  // Get the MC particle branch, in case it exists
172 
173  AliJetContainer* jetMCCont = GetJetContainer();
174  TString jetMCContName = jetMCCont->GetName();
175 
176  fGeneratorLevel = GetMCParticleContainer("mcparticles");
177  if(fGeneratorLevel)
178  {
179  Printf("MCparticleContainer: %s", fGeneratorLevel->GetName());
180  }
181  if(jetMCContName.Contains("mcparticles"))
182  {
183  fMCJetContainer = jetMCCont;
184  }
185 
186 
191  //AllocateParticleHistograms();
192 
193 
194  TIter next(fHistManager.GetListOfHistograms());
195  TObject* obj = 0;
196  while ((obj = next())) {
197  fOutput->Add(obj);
198  }
199  fOutput->Add(fHistNumbJets);
200  fOutput->Add(fHistJetPt);
201 
202 
203  // UInt_t SparseBit = 0;// Bit Code from GetDimParams()
204 
205 
206  //SparseBit = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<10 | 1<<11 | 1<<12 | 1<<13 | 1<<14 | 1<<15 | 1<<16;
207  //fhnMBJetSpectra = NewTHnSparseF("fhnMBJetSpectra", SparseBit);
208  //fhnMBJetSpectra->Sumw2();
209  // fOutput->Add(fhnMBJetSpectra);
210 
211  if(fUseSumw2==0) {
212  // =========== Switch on Sumw2 for all histos ===========
213  for (Int_t i=0; i<fOutput->GetEntries(); ++i) {
214  TH1 *h1 = dynamic_cast<TH1*>(fOutput->At(i));
215  if (h1){
216  h1->Sumw2();
217  continue;
218  }
219  THnSparse *hn = dynamic_cast<THnSparse*>(fOutput->At(i));
220  if(hn)hn->Sumw2();
221  }
222  }
223 
224  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
225 }
226 
227 /*
228  * This function allocates the histograms for basic EMCal cluster QA.
229  * A set of histograms (energy, eta, phi, number of cluster) is allocated
230  * per each cluster container and per each centrality bin.
231  */
233 {
234  TString histname;
235  TString histtitle;
236  TString groupname;
237  Double_t pi = TMath::Pi();
238  AliClusterContainer* clusCont = 0;
239  TIter next(&fClusterCollArray);
240  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
241  groupname = clusCont->GetName();
242  fHistManager.CreateHistoGroup(groupname);
243 
244  histname = TString::Format("%s/fhnClusSparse", groupname.Data());
245  histtitle = histname + ";Multiplicity;#it{E}_{clus}{had.corr.} (GeV);#it{E}_{clus}^{non-lin.corr} (GeV); #it{E}_{clus}^{corr} (GeV);#it{p}_{trk,matched} (GeV/#it{c});E_{clus}^{non-lin.corr}/P_{trk}^{sum};#eta_{clus};#phi_{clus};M02;M20;Dumb}";
246  Int_t nbins10[11] = {300, fNbins,fNbins,fNbins,fNbins,120,24,72,100,100,0};
247  Double_t min10[11] = {0,fMinBinPt,fMinBinPt,fMinBinPt,fMinBinPt,0,-1.2, -0.5*pi,0,0,0};
248  Double_t max10[11] = {300,fMaxBinPt,fMaxBinPt,fMaxBinPt,fMaxBinPt,1.2,1.2,1.5*pi,1,1,0};
249  fHistManager.CreateTHnSparse(histname.Data(), histtitle.Data(), 11, nbins10, min10, max10, "s");
250 
251  for (Int_t cent = 0; cent < fNcentBins; cent++) {
252  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), cent);
253  histtitle = TString::Format("%s;#it{E}_{cluster} (GeV);counts", histname.Data());
254  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2, "s");
255 
256  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), cent);
257  histtitle = TString::Format("%s;#it{E}_{cluster}^{exotic} (GeV);counts", histname.Data());
258  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2, "s");
259 
260  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), cent);
261  histtitle = TString::Format("%s;#it{E}_{cluster}^{non-lin.corr.} (GeV);counts", histname.Data());
262  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2, "s");
263 
264  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), cent);
265  histtitle = TString::Format("%s;#it{E}_{cluster}^{had.corr.} (GeV);counts", histname.Data());
266  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2, "s");
267 
268  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), cent);
269  histtitle = TString::Format("%s;#it{#phi}_{custer};counts", histname.Data());
270  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi(), "s");
271 
272  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), cent);
273  histtitle = TString::Format("%s;#it{#eta}_{custer};counts", histname.Data());
274  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1, "s");
275 
276  histname = TString::Format("%s/fHistFcrossvEonline_%d", groupname.Data(), cent);
277  histtitle = TString::Format("%s;#it{E}_{cluster} (GeV);#it{F}_{cross}", histname.Data());
278  fHistManager.CreateTH2(histname, histtitle, 100, 0, 100, 100, 0, 1.0);
279 
280 
281  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), cent);
282  histtitle = TString::Format("%s;number of clusters;events", histname.Data());
283  if (fForceBeamType != kpp) {
284  fHistManager.CreateTH1(histname, histtitle, 500, 0, 3000, "s");
285  }
286  else {
287  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200, "s");
288  }
289  }
290  }
291 }
292 
293 /*
294  * This function allocate histograms to the particle level MC event
295  * before the particles are propagated through GEANT.
296  * This function also has adaptability for the jet finder.
297  *
298  */
299 
301 {
302  // If MC, get the MC event
303  const AliMCEvent* mcevent = nullptr;
304  if (fGeneratorLevel) {
305  mcevent = MCEvent();
306  }
307  else {
308  return;
309  }
310  TString histname;
311  TString histtitle;
312  TString groupname;
313  Double_t pi = TMath::Pi();
314  AliParticleContainer* MCCont = 0;
315  MCCont = AddMCParticleContainer("mcparticles");
316  groupname = MCCont->GetName();
317  fHistManager.CreateHistoGroup(groupname);
318 
319  for (Int_t cent = 0; cent < fNcentBins; cent++) {
320  histname = TString::Format("%s/fHistParticleLvlpT_%d", groupname.Data(), cent);
321  histtitle = TString::Format("%s;#it{p}_{T} (GeV);counts", histname.Data());
322  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
323  }
324 
325 }
326 
327 /*
328  * This function allocates the histograms for basic EMCal QA.
329  * One 2D histogram with the cell energy spectra and the number of cells
330  * per event is allocated per each centrality bin.
331  */
333 {
334  TString histname;
335  TString histtitle;
336  TString groupname(fCaloCellsName);
337 
338  fHistManager.CreateHistoGroup(groupname);
339  for (Int_t cent = 0; cent < fNcentBins; cent++) {
340  histname = TString::Format("%s/histCellEnergy_%d", groupname.Data(), cent);
341  histtitle = TString::Format("%s;#it{E}_{cell} (GeV);counts", histname.Data());
342  fHistManager.CreateTH1(histname, histtitle, 600, 0, 150, "s");
343 
344  histname = TString::Format("%s/histNCells_%d", groupname.Data(), cent);
345  histtitle = TString::Format("%s;number of cells;events", histname.Data());
346  if (fForceBeamType != kpp) {
347  fHistManager.CreateTH1(histname, histtitle, 500, 0, 6000,"s");
348  }
349  else {
350  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200,"s");
351  }
352  }
353 }
354 
355 /*
356  * This function allocates the histograms for basic tracking QA.
357  * A set of histograms (pT, eta, phi, difference between kinematic properties
358  * at the vertex and at the EMCal surface, number of tracks) is allocated
359  * per each particle container and per each centrality bin.
360  */
362 {
363  TString histname;
364  TString histtitle;
365  TString groupname;
366  Double_t pi = TMath::Pi();
367  AliParticleContainer* partCont = 0;
368  TIter next(&fParticleCollArray);
369  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
370  groupname = partCont->GetName();
371  fHistManager.CreateHistoGroup(groupname);
372 
373  histname = TString::Format("%s/fhnTrkSparse", groupname.Data());
374  histtitle = histname + ";Multiplicity;#it{p}_{T,trk} (GeV/#it{c});#it{p}_{trk} (GeV/#it{c});#eta_{trk};#phi_{trk};TPCnClusters}";
375  Int_t nbins6[6] = {300, fNbins, fNbins,24,72,100};
376  Double_t min6[6] = {0,fMinBinPt,fMinBinPt,-1.2, -0.5*pi,0};
377  Double_t max6[6] = {300,fMaxBinPt,fMaxBinPt,1.2,1.5*pi,100};
378  fHistManager.CreateTHnSparse(histname.Data(), histtitle.Data(), 6, nbins6, min6, max6, "s");
379 
380  for (Int_t cent = 0; cent < fNcentBins; cent++) {
381  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), cent);
382  histtitle = TString::Format("%s;#it{p}_{T,track} (GeV/#it{c});counts", histname.Data());
383  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2, "s");
384 
385  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), cent);
386  histtitle = TString::Format("%s;#it{#phi}_{track};counts", histname.Data());
387  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi(), "s");
388 
389  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), cent);
390  histtitle = TString::Format("%s;#it{#eta}_{track};counts", histname.Data());
391  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1, "s");
392 
393  if (TClass(partCont->GetClassName()).InheritsFrom("AliVTrack")) {
394  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), cent);
395  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#eta}_{track}^{vertex} - #it{#eta}_{track}^{EMCal};counts", histname.Data());
396  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 50, -0.5, 0.5);
397 
398  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), cent);
399  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#phi}_{track}^{vertex} - #it{#phi}_{track}^{EMCal};counts", histname.Data());
400  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 200, -2, 2);
401 
402  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), cent);
403  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{p}_{T,track}^{vertex} - #it{p}_{T,track}^{EMCal} (GeV/#it{c});counts", histname.Data());
404  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, -fMaxBinPt/2, fMaxBinPt/2);
405 
406  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), cent);
407  histtitle = TString::Format("%s;#it{P}_{track} (GeV/#it{c});#it{E}_{cluster} / #it{P}_{track} #it{c};counts", histname.Data());
408  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, 0, 4);
409  }
410 
411  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), cent);
412  histtitle = TString::Format("%s;number of tracks;events", histname.Data());
413  if (fForceBeamType != kpp) {
414  fHistManager.CreateTH1(histname, histtitle, 500, 0, 5000, "s");
415  }
416  else {
417  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200, "s");
418  }
419  }
420  }
421 }
422 
423 /*
424  * This function allocates the histograms for basic jet QA.
425  * A set of histograms (pT, eta, phi, area, number of jets, corrected pT) is allocated
426  * per each jet container and per each centrality bin.
427  */
429 {
430  TString histname;
431  TString histtitle;
432  TString groupname;
433  Double_t pi = TMath::Pi();
434  AliJetContainer* jetCont = 0;
435  TIter next(&fJetCollArray);
436  UInt_t SparseBit = 0;// Bit Code from GetDimParams()
437  SparseBit = 1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<10 | 1<<11 | 1<<12 | 1<<13 | 1<<14 | 1<<15 | 1<<16;
438 
439  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
440  groupname = jetCont->GetName();
441  fHistManager.CreateHistoGroup(groupname);
442 
443  //histname = TString::Format("%s/fhnJetSparse", groupname.Data());
444  //histtitle = histname + TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
445  //fHistManager.CreateTHnSparse(histname.Data(), histtitle.Data());
446 
447 
448  histname = TString::Format("%s/fhnJetSparse", groupname.Data());
449  histtitle = histname + ";Multiplicity;#it{p}_{T,jet}^{uncorr} (GeV/#it{c});#it{p}_{T,leading} (GeV/#it{c};#it{E}_{leading} (GeV);#eta_{jet};#phi_{jet};#it{F}_{cross};#it{z}_{leading};#it{A}_{jet};#it{NEF};#it{N}_{constit};#it{N}_{neu};#it{N}_{chrg}";
450  Int_t nbins13[13] = {300, fNbins, fNbins, fNbins,24,72,20,20,20,20,100,100,100};
451  Double_t min13[13] = {0,fMinBinPt,fMinBinPt,fMinBinPt,-1.2, -0.5*pi,0,0,0,0,0,0,0};
452  Double_t max13[13] = {300,fMaxBinPt, fMaxBinPt, fMaxBinPt,1.2,1.5*pi,1,1,1,1,1,1,1};
453  fHistManager.CreateTHnSparse(histname.Data(), histtitle.Data(), 13, nbins13, min13, max13, "s");
454 
455 
456  for (Int_t cent = 0; cent < fNcentBins; cent++) {
457 
458  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), cent);
459  histtitle = TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
460  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
461 
462  histname = TString::Format("%s/histJetClusterEnergy_%d", groupname.Data(), cent);
463  histtitle = TString::Format("%s;#it{E}_{JetClus} (GeV);counts", histname.Data());
464  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2, "s");
465 
466  histname = TString::Format("%s/histJetTrkPt_%d", groupname.Data(), cent);
467  histtitle = TString::Format("%s;#it{p}_{T,JetTrk} (GeV/#it{c});counts", histname.Data());
468  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
469 
470  histname = TString::Format("%s/histJetNEFvJetPt_%d", groupname.Data(), cent);
471  histtitle = TString::Format("%s;#it{p}_{T,Jet};NEF", histname.Data());
472  fHistManager.CreateTH2(histname, histtitle, 200, 0, 200, 100, 0, 1, "s");
473 
474  histname = TString::Format("%s/histNumbJetConstvJetPt_%d", groupname.Data(), cent);
475  histtitle = TString::Format("%s;#it{p}_{T,Jet};NumberofJetConstit", histname.Data());
476  fHistManager.CreateTH2(histname, histtitle, 200, 0, 200, 20,0,20, "s");
477 
478  histname = TString::Format("%s/histJetFF_%d", groupname.Data(), cent);
479  histtitle = TString::Format("%s;Z=#it{p}_{T,leading} / #it{p}_{T,Jet};counts", histname.Data());
480  fHistManager.CreateTH1(histname, histtitle, 100, 0, 1, "s");
481 
482  histname = TString::Format("%s/histJetZvJetPt_%d", groupname.Data(), cent);
483  histtitle = TString::Format("%s;#it{p}_{T,Jet};Z=#it{p}_{T,Trk} / #it{p}_{T,Jet}", histname.Data());
484  fHistManager.CreateTH2(histname, histtitle, 200, 0, 200, 100,0,1);
485 
486  //histname = TString::Format("%s/histJetNeutralPtvJetPt_%d", groupname.Data(), cent);
487  //histtitle = TString::Format("%s;#it{p}_{T,Jet};#it{p}_{T,NeutralConstituents}", histname.Data());
488  //fHistManager.CreateTH2(histname, histtitle, 200, 0, 200, 200, 0, 200);
489 
490  histname = TString::Format("%s/histFCrossvZleading_%d", groupname.Data(), cent);
491  histtitle = TString::Format("%s;#it{z}_{leading};#it{F}_{Cross}", histname.Data());
492  fHistManager.CreateTH2(histname, histtitle, 100, 0, 1, 100, 0, 1);
493 
494  //Matched Trigger Histos
495  histname = TString::Format("%s/fHistNumbJETrigger_%d", groupname.Data(), cent);
496  histtitle = TString::Format("%s;JE Trigger Normaliztion;counts", histname.Data());
497  fHistManager.CreateTH1(histname, histtitle, 1, 0, 1, "s");
498 
499  histname = TString::Format("%s/fHistNumbGATrigger_%d", groupname.Data(), cent);
500  histtitle = TString::Format("%s;GA Trigger Normaliztion;counts", histname.Data());
501  fHistManager.CreateTH1(histname, histtitle, 1, 0, 1, "s");
502 
503  histname = TString::Format("%s/fHistJetJetPatchE_%d", groupname.Data(), cent);
504  histtitle = TString::Format("%s;#it{E}_{JetGammaPatch} (GeV);counts", histname.Data());
505  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
506 
507  histname = TString::Format("%s/fHistJetGammaPatchE_%d", groupname.Data(), cent);
508  histtitle = TString::Format("%s;#it{E}_{JetGammaPatch} (GeV);counts", histname.Data());
509  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
510 
511  histname = TString::Format("%s/fHistJetJetPatchPt_%d", groupname.Data(), cent);
512  histtitle = TString::Format("%s;#it{p}_{T,JetJetPatch} (GeV/#it{c});counts", histname.Data());
513  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
514 
515  histname = TString::Format("%s/fHistJetGammaPatchPt_%d", groupname.Data(), cent);
516  histtitle = TString::Format("%s;#it{p}_{T,JetGammaPatch} (GeV/#it{c});counts", histname.Data());
517  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
518 
519  histname = TString::Format("%s/fHistTriggerPatchE_%d", groupname.Data(), cent);
520  histtitle = TString::Format("%s;#it{E}_{TriggerPatch} (GeV);counts", histname.Data());
521  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
522 
523  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiJE_%d", groupname.Data(), cent);
524  histtitle = TString::Format("%s;#it{#phi}_{jet} - #it{#phi}_{JE,patch};#it{#eta}_{Jet} - #it{#eta}_{JE,patch};counts", histname.Data());
525  fHistManager.CreateTH2(histname, histtitle, 280, -0.7, 0.7, 280, -0.7, 0.7);
526 
527  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiGA_%d", groupname.Data(), cent);
528  histtitle = TString::Format("%s;#it{#phi}_{jet} - #it{#phi}_{GA,patch};#it{#eta}_{Jet} - #it{#eta}_{GA,patch};counts", histname.Data());
529  fHistManager.CreateTH2(histname, histtitle, 280, -0.7, 0.7, 280, -0.7, 0.7);
530 
531  histname = TString::Format("%s/fHistJetEPatchEJE_%d", groupname.Data(), cent);
532  histtitle = TString::Format("%s;#it{E_{JE,patch}}#it{E_{Jet,UnCorr}};counts", histname.Data());
533  fHistManager.CreateTH2(histname, histtitle, 400, 0, 200, 400, 0, 200);
534 
535  histname = TString::Format("%s/fHistJetEPatchEGA_%d", groupname.Data(), cent);
536  histtitle = TString::Format("%s;#it{E_{GA,patch}};#it{E_{Jet,UnCorr}};counts", histname.Data());
537  fHistManager.CreateTH2(histname, histtitle, 400, 0, 200, 400, 0, 200);
538  // End Matched Trigger Histos
539 
540  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), cent);
541  histtitle = TString::Format("%s;#it{A}_{jet};counts", histname.Data());
542  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, 3);
543 
544  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), cent);
545  histtitle = TString::Format("%s;#it{#phi}_{jet};counts", histname.Data());
546  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi(), "s");
547 
548  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), cent);
549  histtitle = TString::Format("%s;#it{#eta}_{jet};counts", histname.Data());
550  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1, "s");
551 
552  histname = TString::Format("%s/histJetClusterPhi_%d", groupname.Data(), cent);
553  histtitle = TString::Format("%s;#it{#phi}_{JetClus};counts", histname.Data());
554  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi(), "s");
555 
556  histname = TString::Format("%s/histJetClusterEta_%d", groupname.Data(), cent);
557  histtitle = TString::Format("%s;#it{#eta}_{JetClus};counts", histname.Data());
558  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1, "s");
559 
560  histname = TString::Format("%s/histNJets_%d", groupname.Data(), cent);
561  histtitle = TString::Format("%s;number of jets;events", histname.Data());
562  if (fForceBeamType != kpp) {
563  fHistManager.CreateTH1(histname, histtitle, 500, 0, 500, "s");
564  }
565  else {
566  fHistManager.CreateTH1(histname, histtitle, 100, 0, 100, "s");
567  }
568 
569  if (!jetCont->GetRhoName().IsNull()) {
570  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), cent);
571  histtitle = TString::Format("%s;#it{p}_{T,jet}^{corr} (GeV/#it{c});counts", histname.Data());
572  fHistManager.CreateTH1(histname, histtitle, fNbins, -fMaxBinPt / 2, fMaxBinPt / 2);
573  }
574  }
575  }
576 }
577 
585 {
586  DoJetLoop();
587  DoTrackLoop();
588  DoClusterLoop();
589  DoCellLoop();
590  //DoParticleLoop();
591 
592  return kTRUE;
593 }
594 
600 {
601  TString histname;
602  TString groupname;
603  AliJetContainer* jetCont = 0;
604  TIter next(&fJetCollArray);
605 
606  //TClonesArray *triggerpatches = dynamic_cast<TClonesArray *>(InputEvent()->FindListObject("EmcalTriggers"));
607  //if(!triggerpatches)
608  // AliErrorStream() << "Trigger patch container EmcalTriggers not found in task " << GetName() << std::endl;
609 
610  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
611  groupname = jetCont->GetName();
612  UInt_t count = 0;
613  for(auto jet : jetCont->accepted()) {
614  if (!jet) continue;
615  count++;
616 
617  TLorentzVector leadPart;
618  jetCont->GetLeadingHadronMomentum(leadPart, jet);
619  Double_t z = GetParallelFraction(leadPart.Vect(), jet);
620  if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999;
621 
622  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), fCentBin);
623  fHistManager.FillTH1(histname, jet->Pt());
624 
625  histname = TString::Format("%s/histJetClusterEnergy_%d", groupname.Data(), fCentBin);
626  fHistManager.FillTH1(histname, jet->E());
627 
628  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), fCentBin);
629  fHistManager.FillTH1(histname, jet->Area());
630 
631  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), fCentBin);
632  fHistManager.FillTH1(histname, jet->Phi());
633 
634  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), fCentBin);
635  fHistManager.FillTH1(histname, jet->Eta());
636 
637  histname = TString::Format("%s/histJetNEFvJetPt_%d", groupname.Data(), fCentBin);
638  fHistManager.FillTH2(histname,jet->Pt(),jet->NEF() );
639 
640 
641  histname = TString::Format("%s/histNumbJetConstvJetPt_%d", groupname.Data(), fCentBin);
642  fHistManager.FillTH2(histname,jet->Pt(),jet->N());
643 
644  histname = TString::Format("%s/histJetFF_%d", groupname.Data(), fCentBin);
645  fHistManager.FillTH1(histname, z );
646 
647  Double_t MatchedEta = 0.04, MatchedPhi = 0.04;
648  //Look at emcal trigger patches in event and associate with jet
649  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
650 
651  if (fTriggerPatchInfo) {
652  TString objname(fTriggerPatchInfo->GetClass()->GetName());
653  TClass cls(objname);
654  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
655  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
656  fTriggerPatchInfo = 0;
657  }
658  }
659 
660  if (!fTriggerPatchInfo) {
661  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
662  continue;
663  }
664 
665  //AliEMCALTriggerPatchInfo *currentpatch(nullptr);
666  for(auto p : *fTriggerPatchInfo){
667  AliEMCALTriggerPatchInfo *currentpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
668 
669  //Select Single Shower Patch
670  if(currentpatch->IsGammaLowRecalc() || currentpatch->IsGammaLowSimple()){
671  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiGA_%d", groupname.Data(), fCentBin);
672  fHistManager.FillTH2(histname, jet->Phi() - currentpatch->GetPhiGeo(), jet->Eta() - currentpatch->GetEtaGeo());
673  histname = TString::Format("%s/fHistJetEPatchEGA_%d", groupname.Data(), fCentBin);
674  fHistManager.FillTH2(histname,jet->E(),currentpatch->GetPatchE());
675 
676  if(jet->Phi() - currentpatch->GetPhiGeo() <= MatchedPhi && jet->Eta() - currentpatch->GetEtaGeo() <= MatchedEta){
677  histname = TString::Format("%s/fHistNumbGATrigger_%d", groupname.Data(), fCentBin);
678  fHistManager.FillTH1(histname, 0.5);
679  histname = TString::Format("%s/fHistJetGammaPatchE_%d", groupname.Data(), fCentBin);
680  fHistManager.FillTH1(histname, currentpatch->GetPatchE());
681  histname = TString::Format("%s/fHistJetGammaPatchPt_%d", groupname.Data(), fCentBin);
682  fHistManager.FillTH1(histname, jet->Pt());
683  }
684  }
685 
686  //Select Jet Patch
687  if(currentpatch->IsJetLowRecalc() || currentpatch->IsJetLowSimple()){
688  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiJE_%d", groupname.Data(), fCentBin);
689  fHistManager.FillTH2(histname, jet->Phi() - currentpatch->GetPhiGeo(), jet->Eta() - currentpatch->GetEtaGeo());
690  histname = TString::Format("%s/fHistJetEPatchEJE_%d", groupname.Data(), fCentBin);
691  fHistManager.FillTH2(histname,jet->E(),currentpatch->GetPatchE());
692 
693  if(jet->Phi() - currentpatch->GetPhiGeo() <= MatchedPhi && jet->Eta() - currentpatch->GetEtaGeo() <= MatchedEta){
694  histname = TString::Format("%s/fHistNumbJETrigger_%d", groupname.Data(), fCentBin);
695  fHistManager.FillTH1(histname, 0.5);
696  histname = TString::Format("%s/fHistJetJetPatchE_%d", groupname.Data(), fCentBin);
697  fHistManager.FillTH1(histname, currentpatch->GetPatchE());
698  histname = TString::Format("%s/fHistJetJetPatchPt_%d", groupname.Data(), fCentBin);
699  fHistManager.FillTH1(histname, jet->Pt());
700  }
701  }
702 
703  }
704 
705  Double_t Z_part = 0.0;
706 
707  //Look at assoc tracks of a given jet
708  AliParticleContainer* tracks = jetCont->GetParticleContainer();
709  if (tracks) {
710  for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
711  AliVParticle *JetTrk = jet->TrackAt(it, tracks->GetArray());
712  if (JetTrk) {
713  //AliVTrack *Vtrack = dynamic_cast<AliVTrack*>(track);
714  histname = TString::Format("%s/histJetTrkPt_%d", groupname.Data(), fCentBin);
715  fHistManager.FillTH1(histname, JetTrk->Pt());
716 
717  Z_part = GetZ(JetTrk->Px(),JetTrk->Py(),JetTrk->Pz(),jet->Px(),jet->Py(),jet->Pz());
718 
719  histname = TString::Format("%s/histJetZvJetPt_%d", groupname.Data(), fCentBin);
720  fHistManager.FillTH2(histname,jet->Pt(),Z_part);
721 
722  //if(jetContName.Contains("mcparticles")){
723  // fMCJetContainer
724  // Double_t jetPID = 0;
725  // jetPID->PID();
726  // cout<<"PID of trk in Jet: "<<jetPID<<endl;
727  //}
728  }
729  }
730  }
731  //Loop over Clusters in Jet
732  AliClusterContainer* JetCluster = 0;
733  JetCluster = jetCont->GetClusterContainer();
734  if(JetCluster) {
735  for(auto cluster : JetCluster->accepted()) {
736  AliTLorentzVector nPart;
737  cluster->GetMomentum(nPart, fVertex);
738  Double_t JetFCross = GetFcross(cluster, fCaloCells);
739  histname = TString::Format("%s/histJetClusterEnergy_%d", groupname.Data(), fCentBin);
740  fHistManager.FillTH1(histname, cluster->E());
741  histname = TString::Format("%s/histJetClusterPhi_%d", groupname.Data(), fCentBin);
742  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
743  histname = TString::Format("%s/histJetClusterEta_%d", groupname.Data(), fCentBin);
744  fHistManager.FillTH1(histname, nPart.Eta());
745  histname = TString::Format("%s/histFCrossvZleading_%d", groupname.Data(), fCentBin);
746  fHistManager.FillTH2(histname,jet->MaxTrackPt() / jet->Pt(), JetFCross);
747  }
748 
749 
750  }
751 
752  Double_t leadingtrackpT = 0.0;
753  Double_t leadingclusterE = 0.0;
754  Double_t JetFCrossLeading = 0.0;
755  //AliVParticle *leadingParticle = 0x0;
756  AliVCluster *leadingCluster = 0x0;
757 
758 
759  leadingCluster = jet->GetLeadingCluster();
760  if(leadingCluster){
761  leadingclusterE = leadingCluster->E();
762  JetFCrossLeading = GetFcross(leadingCluster, fCaloCells);
763  }
764 
765  AliVParticle* leadingTrk = jet->GetLeadingTrack();
766  if(leadingTrk){
767  leadingtrackpT = leadingTrk->Pt();
768  }
769  AliTrackContainer * Globaltracks = static_cast<AliTrackContainer * >(GetParticleContainer("tracks"));
770  Double_t TrackMultiplicity = Globaltracks->GetNTracks();
771  Double_t Numb = jet->N();
772  Double_t NumbNeu = jet->Nn();
773  Double_t NumbChrg = jet->Nch();
774  Double_t x[13]={TrackMultiplicity,jet->Pt(),leadingtrackpT,leadingclusterE,jet->Eta(),jet->Phi(),JetFCrossLeading,z,jet->Area(),jet->NEF(),Numb,NumbNeu,NumbChrg};
775  histname = TString::Format("%s/fhnJetSparse", groupname.Data());
776  fHistManager.FillTHnSparse(histname, x);
777 
778  if (jetCont->GetRhoParameter()) {
779  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), fCentBin);
780  fHistManager.FillTH1(histname, jet->Pt() - jetCont->GetRhoVal() * jet->Area());
781  }//Background Subtaction in PbPb
782  }// Loop over each jet in a event
783  histname = TString::Format("%s/histNJets_%d", groupname.Data(), fCentBin);
784  fHistManager.FillTH1(histname, count);
785  }
786 }
787 
793 {
795 
796  TString histname;
797  TString groupname;
798  AliParticleContainer* partCont = 0;
799  TIter next(&fParticleCollArray);
800  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
801  groupname = partCont->GetName();
802  UInt_t count = 0;
803  for(auto part : partCont->accepted()) {
804  if (!part) continue;
805  count++;
806 
807  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), fCentBin);
808  fHistManager.FillTH1(histname, part->Pt());
809 
810  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), fCentBin);
811  fHistManager.FillTH1(histname, part->Phi());
812 
813  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), fCentBin);
814  fHistManager.FillTH1(histname, part->Eta());
815 
816  if (partCont->GetLoadedClass()->InheritsFrom("AliVTrack")) {
817  const AliVTrack* track = static_cast<const AliVTrack*>(part);
818 
819  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), fCentBin);
820  fHistManager.FillTH1(histname, track->Pt(), track->Eta() - track->GetTrackEtaOnEMCal());
821 
822  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), fCentBin);
823  fHistManager.FillTH1(histname, track->Pt(), track->Phi() - track->GetTrackPhiOnEMCal());
824 
825  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), fCentBin);
826  fHistManager.FillTH1(histname, track->Pt(), track->Pt() - track->GetTrackPtOnEMCal());
827 
828  Double_t x[6]={0.0,track->Pt(),track->P(),track->Eta(),track->Phi(),0.0};
829  histname = TString::Format("%s/fhnTrkSparse", groupname.Data());
830  fHistManager.FillTHnSparse(histname,x);
831 
832  if (clusCont) {
833  Int_t iCluster = track->GetEMCALcluster();
834  if (iCluster >= 0) {
835  AliVCluster* cluster = clusCont->GetAcceptCluster(iCluster);
836  if (cluster) {
837  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), fCentBin);
838  fHistManager.FillTH2(histname, track->P(), cluster->GetNonLinCorrEnergy() / track->P());
839 
840  }
841  }
842  }
843  }
844  }
845 
846  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), fCentBin);
847  fHistManager.FillTH1(histname, count);
848  }
849 }
850 
856 {
857  Double_t TrkPt = 0.0, EovP = 0.0, TrackMultiplicity =0.0, trkpSum = 0.0;
858  TString histname;
859  TString groupname;
860  AliClusterContainer* clusCont = 0;
861  TIter next(&fClusterCollArray);
862  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
863  groupname = clusCont->GetName();
864 
865  //Cluster Exotics
866  for(auto cluster : clusCont->all()) {
867  if (!cluster) continue;
868 
869  Double_t FCross = GetFcross(cluster, fCaloCells);
870  histname = TString::Format("%s/fHistFcrossvEonline_%d", groupname.Data(), fCentBin);
871  fHistManager.FillTH2(histname, cluster->E(), FCross);
872 
873  if (cluster->GetIsExotic()) {
874  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), fCentBin);
875  fHistManager.FillTH1(histname, cluster->E());
876  }
877  }
878 
879  UInt_t count = 0;
880  for(auto cluster : clusCont->accepted()) {
881  if (!cluster) continue;
882  count++;
883 
884  AliTLorentzVector nPart;
885  cluster->GetMomentum(nPart, fVertex);
886 
887  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), fCentBin);
888  fHistManager.FillTH1(histname, cluster->E());
889 
890  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), fCentBin);
891  fHistManager.FillTH1(histname, cluster->GetNonLinCorrEnergy());
892 
893  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), fCentBin);
894  fHistManager.FillTH1(histname, cluster->GetHadCorrEnergy());
895 
896  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), fCentBin);
897  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
898 
899  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), fCentBin);
900  fHistManager.FillTH1(histname, nPart.Eta());
901 
902  //Int_t nTracksMatched = 0;
903  const AliVTrack* track = 0x0;
904 
905  for (Int_t itrack=0; itrack < cluster->GetNTracksMatched(); itrack++){
906  track = dynamic_cast<AliVTrack*>(cluster->GetTrackMatched(itrack));
907  if(track){
908  TrkPt = track->Pt();
909  trkpSum += track->P();
910  EovP = cluster->GetNonLinCorrEnergy() / trkpSum;
911 
912  }
913  }
914 
915 
916  Double_t x[10]={TrackMultiplicity,cluster->GetHadCorrEnergy(),cluster->GetNonLinCorrEnergy(),cluster->E(),TrkPt,EovP,nPart.Eta(),nPart.Phi_0_2pi(),cluster->GetM02(),cluster->GetM20()};
917  histname = TString::Format("%s/fhnClusSparse", groupname.Data());
918  fHistManager.FillTHnSparse(histname, x);
919 
920 
921 
922 
923  }
924 
925  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), fCentBin);
926  fHistManager.FillTH1(histname, count);
927  }
928 }
929 
935 {
936  if (!fCaloCells) return;
937 
938  TString histname;
939 
940  const Short_t ncells = fCaloCells->GetNumberOfCells();
941 
942  histname = TString::Format("%s/histNCells_%d", fCaloCellsName.Data(), fCentBin);
943  fHistManager.FillTH1(histname, ncells);
944 
945  histname = TString::Format("%s/histCellEnergy_%d", fCaloCellsName.Data(), fCentBin);
946  for (Short_t pos = 0; pos < ncells; pos++) {
947  Double_t amp = fCaloCells->GetAmplitude(pos);
948 
949  fHistManager.FillTH1(histname, amp);
950  }
951 }
952 
959 {
960  TString histname;
961  TString groupname;
962  AliParticleContainer* partMCCont = 0;
963  //TIter next(&fGeneratorLevel);
964  for(auto trk : partMCCont->all()){
965  groupname = partMCCont->GetName();
966  UInt_t count = 0;
967  for(auto part : partMCCont->accepted()) {
968  if (!part) continue;
969 
970  histname = TString::Format("%s/fHistParticleLvlpT_%d", groupname.Data(), fCent);
971  fHistManager.FillTH1(histname, part->Pt());
972  }
973  }
974 
975 
976 }
977 
983 {
984 
986 }
987 
996 {
997  //Int_t runNum = InputEvent()->GetRunNumber();
998 
999  //Bool_t PileUp = AliVEvent::IsPileupFromSPD();
1000 
1001  //Double_t zVertex=fVertex[2];
1002 
1003  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
1004 
1005  if (fTriggerPatchInfo) {
1006  TString objname(fTriggerPatchInfo->GetClass()->GetName());
1007  TClass cls(objname);
1008  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
1009  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
1010  fTriggerPatchInfo = 0;
1011  }
1012  }
1013 
1014  if (!fTriggerPatchInfo) {
1015  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
1016  return kFALSE;
1017  }
1018  for(auto p : *fTriggerPatchInfo){
1019  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
1020  if (recpatch) {
1021  }
1022  }
1023 
1024  fClusterEResolution = new TF1("fClusterEResolution","sqrt([0]^2+[1]^2*x+([2]*x)^2)*0.01");// 2010 EMCal Test Beam Resolution
1025  fClusterEResolution->SetParameters(4.35,9.07,1.63);//Fit to test beam
1026 
1027 
1028 
1029 
1030  IsLEDEvent();
1031 
1032  return kTRUE;
1033 }
1034 
1035 /*
1036 void AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::ExtractMainPatch() {
1037 
1038  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
1039 
1040  if (fTriggerPatchInfo) {
1041  TString objname(fTriggerPatchInfo->GetClass()->GetName());
1042  TClass cls(objname);
1043  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
1044  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
1045  fTriggerPatchInfo = 0;
1046  }
1047  }
1048 
1049  if (!fTriggerPatchInfo) {
1050  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
1051  return;
1052  }
1053  for(auto p : *fTriggerPatchInfo){
1054  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
1055  if (recpatch) {
1056  cout<<"Pstchphi:"<<recpatch->GetPhiCM()<<endl;
1057  }
1058  }
1059  //Find main trigger
1060 
1061  (fTriggerPatchInfo) {
1062  TString objname(fTriggerPatchInfo->GetClass()->GetName());
1063  TClass cls(objname);
1064  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
1065  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
1066  fTriggerPatchInfo = 0;
1067  }
1068  if (!fTriggerPatchInfo) {
1069  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
1070  return;
1071  }
1072  }
1073  //number of patches in event
1074  //Int_t nPatch = fTriggerPatchInfo->GetEntriesFast();
1075  //extract main trigger patch
1076  //Double_t emax = -1.;
1077  //for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1078  // AliEMCALTriggerPatchInfo *patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
1079  // if (!patch) continue;
1080  // cout<<"PstchE:"<<patch->GetPatchE()<<endl;
1081  //}
1082 
1083 }
1084 */
1085 
1090 {
1091  cout<<"*****************************"<<endl;
1092  cout<<"******* Task Finished *******"<<endl;
1093  cout<<"*****************************"<<endl;
1094 }
1095 Double_t AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::GetZ(const Double_t trkPx, const Double_t trkPy, const Double_t trkPz, const Double_t jetPx, const Double_t jetPy, const Double_t jetPz) const
1096 {
1097  //
1098  // Get the z of a constituent inside of a jet
1099  //
1100 
1101  return (trkPx*jetPx+trkPy*jetPy+trkPz*jetPz)/(jetPx*jetPx+jetPy*jetPy+jetPz*jetPz);
1102 }
1104 {
1105  Bool_t isLED = kFALSE;
1106  //
1107  // Check if the event is contaminated by LED signal
1108  //
1109  if (!fCaloCells) return kFALSE;
1110 
1111  TString histname;
1112 
1113  Int_t nCellCount[10] = {0};
1114  const Short_t ncells = fCaloCells->GetNumberOfCells();
1115 
1116 
1117 
1118  for (Short_t pos = 0; pos < ncells; pos++) {
1119  Int_t cellId = fCaloCells->GetCellNumber(pos);
1120  Double_t amp = fCaloCells->GetAmplitude(pos);
1121  Int_t sMod = fGeom->GetSuperModuleNumber(cellId);
1122 
1123  if(amp<0.1) continue;
1124  nCellCount[sMod]++;
1125 
1126  }
1127 
1128  for(Int_t i=0; i<=9; i++){
1129  fHistEMCalTowerMult[i]->Fill(nCellCount[i]);
1130  }
1131 
1132 
1133 
1134  return isLED;
1135 }
1136 
1137 Double_t AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::GetFcross(const AliVCluster *cluster, AliVCaloCells *cells)
1138 {
1139  Int_t AbsIdseed = -1;
1140  Double_t Eseed = 0;
1141  for (Int_t i = 0; i < cluster->GetNCells(); i++) {
1142  if (cells->GetCellAmplitude(cluster->GetCellAbsId(i)) > Eseed) {
1143  Eseed = cells->GetCellAmplitude(cluster->GetCellAbsId(i));
1144  AbsIdseed = cluster->GetCellAbsId(i);
1145  }
1146  }
1147 
1148  if (Eseed < 1e-9) {
1149  return 100;
1150  }
1151 
1152  Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
1153  fGeom->GetCellIndex(AbsIdseed,imod,iTower,iIphi,iIeta);
1154  fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi,iIeta,iphi,ieta);
1155 
1156  //Get close cells index and energy, not in corners
1157 
1158  Int_t absID1 = -1;
1159  Int_t absID2 = -1;
1160 
1161  if (iphi < AliEMCALGeoParams::fgkEMCALRows-1) {
1162  absID1 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
1163  }
1164  if (iphi > 0) {
1165  absID2 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
1166  }
1167 
1168  // In case of cell in eta = 0 border, depending on SM shift the cross cell index
1169 
1170  Int_t absID3 = -1;
1171  Int_t absID4 = -1;
1172 
1173  if (ieta == AliEMCALGeoParams::fgkEMCALCols-1 && !(imod%2)) {
1174  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod+1, iphi, 0);
1175  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
1176  }
1177  else if (ieta == 0 && imod%2) {
1178  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
1179  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod-1, iphi, AliEMCALGeoParams::fgkEMCALCols-1);
1180  }
1181  else {
1182  if (ieta < AliEMCALGeoParams::fgkEMCALCols-1) {
1183  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
1184  }
1185  if (ieta > 0) {
1186  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
1187  }
1188  }
1189 
1190  Double_t ecell1 = cells->GetCellAmplitude(absID1);
1191  Double_t ecell2 = cells->GetCellAmplitude(absID2);
1192  Double_t ecell3 = cells->GetCellAmplitude(absID3);
1193  Double_t ecell4 = cells->GetCellAmplitude(absID4);
1194 
1195  Double_t Ecross = ecell1 + ecell2 + ecell3 + ecell4;
1196 
1197  Double_t Fcross = 1 - Ecross/Eseed;
1198 
1199  return Fcross;
1200 }
1201 
1202 //Double_t AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::GetSmearedTrackPt(AliVTrack *track)
1203 //{
1204  //
1205  // Smear track momentum
1206  //
1207 
1208  //Double_t resolution = track->Pt()*track->Pt()*TMath::Sqrt(track->GetSigma1Pt2());
1209  //Double_t smear = resolution*TMath::Sqrt((1+fVaryTrkPtRes)*(1+fVaryTrkPtRes)-1);
1210  // return fRandomGen->Gaus(0, smear);
1211 
1212 //}
1214 {
1215  Int_t count = 0;
1216  UInt_t tmp = entries;
1217  while(tmp!=0){
1218  count++;
1219  tmp = tmp &~ -tmp; // clear lowest bit
1220  }
1221 
1222  TString hnTitle(name);
1223  const Int_t dim = count;
1224  Int_t nbins[dim];
1225  Double_t xmin[dim];
1226  Double_t xmax[dim];
1227 
1228  Int_t i=0;
1229  Int_t c=0;
1230  while(c<dim && i<32){
1231  if(entries&(1<<i)){
1232 
1233  TString label("");
1234  GetDimParams(i, label, nbins[c], xmin[c], xmax[c]);
1235  hnTitle += Form(";%s",label.Data());
1236  c++;
1237  }
1238 
1239  i++;
1240  }
1241  hnTitle += ";";
1242 
1243  return new THnSparseF(name, hnTitle.Data(), dim, nbins, xmin, xmax);
1244 }
1255 {
1256  const Double_t pi = TMath::Pi();
1257 
1258  switch(iEntry){
1259 
1260  case 0:
1261  label = "V0 centrality (%)";
1262  nbins = 30;
1263  xmin = 0.;
1264  xmax = 100.;
1265  // Adjust for pp, since we are retrieving multiplicity instead
1267  label = "Multiplicity";
1268  xmax = 300.;
1269  }
1270  break;
1271 
1272  case 1:
1273  label = "Jet p_{T}";
1274  nbins = 200;
1275  xmin = 0.;
1276  xmax = 200.;
1277  break;
1278 
1279  case 2:
1280  label = "Track p_{T}";
1281  nbins = 100;
1282  xmin = 0.;
1283  xmax = 100;
1284  break;
1285 
1286  case 3:
1287  label = "Cluster E";
1288  nbins = 100;
1289  xmin = 0.;
1290  xmax = 100;
1291  break;
1292 
1293  case 4:
1294  label = "Jet#eta";
1295  nbins = 24;
1296  xmin = -1.2;
1297  xmax = 1.2;
1298  break;
1299 
1300  case 5:
1301  label = "Jet #phi";
1302  nbins = 72;
1303  xmin = -0.5*pi;
1304  xmax = 1.5*pi;
1305  break;
1306 
1307  case 6:
1308  label = "#it{p}_{T,track}^{leading}";
1309  nbins = 100;
1310  xmin = 0;
1311  xmax = 100;
1312  break;
1313 
1314  case 7:
1315  label = "Matched Trigger Amp";
1316  nbins = 10;
1317  xmin = 0;
1318  xmax = 50;
1319  break;
1320 
1321  case 8:
1322  label = "#Delta#eta";
1323  nbins = 48;
1324  xmin = -1.2;
1325  xmax = 1.2;
1326  break;
1327 
1328  case 9:
1329  label = "#Delta#phi";
1330  nbins = 72;
1331  xmin = 0;
1332  xmax = 2*pi;
1333  break;
1334 
1335  case 10:
1336  label = "F_{cross}";
1337  nbins = 20;
1338  xmin = 0;
1339  xmax = 1;
1340  break;
1341 
1342  case 11:
1343  label = "z_{leading}";
1344  nbins = 20;
1345  xmin = 0;
1346  xmax = 1;
1347  break;
1348 
1349  case 12:
1350  label = "#it{A}_{jet}";
1351  nbins = 20;
1352  xmin = 0;
1353  xmax = 1;
1354  break;
1355 
1356  case 13:
1357  label = "Jet NEF";
1358  nbins = 20;
1359  xmin = 0;
1360  xmax = 1;
1361  break;
1362 
1363  case 14:
1364  label = "Numb Constit";
1365  nbins = 50;
1366  xmin = 0;
1367  xmax = 50;
1368  break;
1369 
1370  case 15:
1371  label = "Numb Chrg Constit";
1372  nbins = 50;
1373  xmin = 0;
1374  xmax = 50;
1375  break;
1376 
1377  case 16:
1378  label = "Numb Neu Constit";
1379  nbins = 50;
1380  xmin = 0;
1381  xmax = 50;
1382  break;
1383  }
1384 }
1385 
THashList * CreateHistoGroup(const char *groupname)
Create a new group of histograms within a parent group.
TObjArray fClusterCollArray
cluster collection array
virtual THnSparse * NewTHnSparseF(const char *name, UInt_t entries)
Double_t GetRhoVal() const
const TString & GetRhoName() const
double Double_t
Definition: External.C:58
Int_t GetNTracks() const
TF1 * fClusterEResolution
! Parameterization of cluster energy resolution from 2010 test beam results a = 4.35 b = 9.07 c = 1.63
AliJetContainer * GetJetContainer(Int_t i=0) const
const AliParticleIterableContainer all() const
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.
Declaration of class AliTLorentzVector.
Double_t GetFcross(const AliVCluster *cluster, AliVCaloCells *cells)
Double_t fMinBinPt
min pt in histograms
AliClusterContainer * GetClusterContainer() const
TCanvas * c
Definition: TestFitELoss.C:172
Int_t fCentBin
!event centrality bin
Declaration of class AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA.
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)
TObjArray fParticleCollArray
particle/track collection array
AliMCParticleContainer * fGeneratorLevel
! generator level container
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Get particle container attached to this task.
const AliClusterIterableContainer all() const
AliParticleContainer * GetParticleContainer() const
void GetLeadingHadronMomentum(TLorentzVector &mom, const AliEmcalJet *jet) const
void FillTHnSparse(const char *name, const double *x, double weight=1., Option_t *opt="")
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
Bool_t fUseRecalcPatches
Switch between offline (FEE) and recalc (L1) patches.
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
AliEMCALGeometry * fGeom
!emcal geometry
Double_t Phi_0_2pi() const
Double_t fVaryTrkPtRes
! Variation of tracking momentum resolution
Implementation of a EMCal spectra task and QA for EMCal triggers.
TH1 * CreateTH1(const char *name, const char *title, int nbins, double xmin, double xmax, Option_t *opt="")
Create a new TH1 within the container.
BeamType fForceBeamType
forced beam type
Int_t fNcentBins
how many centrality bins
AliClusterContainer * GetClusterContainer(Int_t i=0) const
Get cluster container attached to this task.
AliVCluster * GetAcceptCluster(Int_t i) const
const AliClusterIterableContainer accepted() const
Double_t fCent
!event centrality
TString fCaloCellsName
name of calo cell collection
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.
TObjArray fJetCollArray
jet collection array
short Short_t
Definition: External.C:23
AliVCaloCells * fCaloCells
!cells
AliRhoParameter * GetRhoParameter()
AliEmcalList * fOutput
!output list
Double_t fMaxBinPt
max pt in histograms
AliJetContainer * fMCJetContainer
! truth-level jet container
AliMCParticleContainer * GetMCParticleContainer(Int_t i=0) const
Double_t fVertex[3]
!event vertex
void SetMakeGeneralHistograms(Bool_t g)
TClonesArray * fTriggerPatchInfo
!trigger patch info array
Base task in the EMCAL jet framework.
const AliParticleIterableContainer accepted() const
const char Option_t
Definition: External.C:48
void UserCreateOutputObjects()
Main initialization function on the worker.
Double_t GetZ(const Double_t trkPx, const Double_t trkPy, const Double_t trkPz, const Double_t jetPx, const Double_t jetPy, const Double_t jetPz) const
const Double_t pi
const Int_t nbins
const AliJetIterableContainer accepted() const
bool Bool_t
Definition: External.C:53
THnSparse * CreateTHnSparse(const char *name, const char *title, int ndim, const int *nbins, const double *min, const double *max, Option_t *opt="")
Create a new THnSparse within the container.
Container structure for EMCAL clusters.
Container for jet within the EMCAL jet framework.
Definition: External.C:196
Int_t fNbins
no. of pt bins
virtual void GetDimParams(Int_t iEntry, TString &label, Int_t &nbins, Double_t &xmin, Double_t &xmax)