AliPhysics  7f1bdba (7f1bdba)
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),
122 //fMCJetContainer(nullptr),
123 //fRecoUtil(0x0), fClusterEResolution(0x0), fVaryTrkPtRes(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 
300 /*
301 void AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::AllocateParticleHistograms()
302 {
303  // If MC, get the MC event
304  // const AliMCEvent* mcevent = nullptr;
305  //if (fGeneratorLevel) {
306  // mcevent = MCEvent();
307  //}
308  //else {
309  // return;
310  //}
311  TString histname;
312  TString histtitle;
313  TString groupname;
314  Double_t pi = TMath::Pi();
315  //AliParticleContainer* MCCont = 0;
316  //MCCont = AddMCParticleContainer("mcparticles");
317  //groupname = MCCont->GetName();
318  fHistManager.CreateHistoGroup(groupname);
319 
320  for (Int_t cent = 0; cent < fNcentBins; cent++) {
321  histname = TString::Format("%s/fHistParticleLvlpT_%d", groupname.Data(), cent);
322  histtitle = TString::Format("%s;#it{p}_{T} (GeV);counts", histname.Data());
323  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
324  }
325 
326 }
327 */
328 
329 /*
330  * This function allocates the histograms for basic EMCal QA.
331  * One 2D histogram with the cell energy spectra and the number of cells
332  * per event is allocated per each centrality bin.
333  */
335 {
336  TString histname;
337  TString histtitle;
338  TString groupname(fCaloCellsName);
339 
340  fHistManager.CreateHistoGroup(groupname);
341  for (Int_t cent = 0; cent < fNcentBins; cent++) {
342  histname = TString::Format("%s/histCellEnergy_%d", groupname.Data(), cent);
343  histtitle = TString::Format("%s;#it{E}_{cell} (GeV);counts", histname.Data());
344  fHistManager.CreateTH1(histname, histtitle, 600, 0, 150, "s");
345 
346  histname = TString::Format("%s/histNCells_%d", groupname.Data(), cent);
347  histtitle = TString::Format("%s;number of cells;events", histname.Data());
348  if (fForceBeamType != kpp) {
349  fHistManager.CreateTH1(histname, histtitle, 500, 0, 6000,"s");
350  }
351  else {
352  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200,"s");
353  }
354  }
355 }
356 
357 /*
358  * This function allocates the histograms for basic tracking QA.
359  * A set of histograms (pT, eta, phi, difference between kinematic properties
360  * at the vertex and at the EMCal surface, number of tracks) is allocated
361  * per each particle container and per each centrality bin.
362  */
364 {
365  TString histname;
366  TString histtitle;
367  TString groupname;
368  Double_t pi = TMath::Pi();
369  AliParticleContainer* partCont = 0;
370  TIter next(&fParticleCollArray);
371  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
372  groupname = partCont->GetName();
373  fHistManager.CreateHistoGroup(groupname);
374 
375  histname = TString::Format("%s/fhnTrkSparse", groupname.Data());
376  histtitle = histname + ";Multiplicity;#it{p}_{T,trk} (GeV/#it{c});#it{p}_{trk} (GeV/#it{c});#eta_{trk};#phi_{trk};TPCnClusters}";
377  Int_t nbins6[6] = {300, fNbins, fNbins,24,72,100};
378  Double_t min6[6] = {0,fMinBinPt,fMinBinPt,-1.2, -0.5*pi,0};
379  Double_t max6[6] = {300,fMaxBinPt,fMaxBinPt,1.2,1.5*pi,100};
380  fHistManager.CreateTHnSparse(histname.Data(), histtitle.Data(), 6, nbins6, min6, max6, "s");
381 
382  for (Int_t cent = 0; cent < fNcentBins; cent++) {
383  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), cent);
384  histtitle = TString::Format("%s;#it{p}_{T,track} (GeV/#it{c});counts", histname.Data());
385  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2, "s");
386 
387  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), cent);
388  histtitle = TString::Format("%s;#it{#phi}_{track};counts", histname.Data());
389  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi(), "s");
390 
391  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), cent);
392  histtitle = TString::Format("%s;#it{#eta}_{track};counts", histname.Data());
393  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1, "s");
394 
395  if (TClass(partCont->GetClassName()).InheritsFrom("AliVTrack")) {
396  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), cent);
397  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#eta}_{track}^{vertex} - #it{#eta}_{track}^{EMCal};counts", histname.Data());
398  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 50, -0.5, 0.5);
399 
400  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), cent);
401  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#phi}_{track}^{vertex} - #it{#phi}_{track}^{EMCal};counts", histname.Data());
402  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 200, -2, 2);
403 
404  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), cent);
405  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());
406  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, -fMaxBinPt/2, fMaxBinPt/2);
407 
408  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), cent);
409  histtitle = TString::Format("%s;#it{P}_{track} (GeV/#it{c});#it{E}_{cluster} / #it{P}_{track} #it{c};counts", histname.Data());
410  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, 0, 4);
411  }
412 
413  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), cent);
414  histtitle = TString::Format("%s;number of tracks;events", histname.Data());
415  if (fForceBeamType != kpp) {
416  fHistManager.CreateTH1(histname, histtitle, 500, 0, 5000, "s");
417  }
418  else {
419  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200, "s");
420  }
421  }
422  }
423 }
424 
425 /*
426  * This function allocates the histograms for basic jet QA.
427  * A set of histograms (pT, eta, phi, area, number of jets, corrected pT) is allocated
428  * per each jet container and per each centrality bin.
429  */
431 {
432  TString histname;
433  TString histtitle;
434  TString groupname;
435  Double_t pi = TMath::Pi();
436  AliJetContainer* jetCont = 0;
437  TIter next(&fJetCollArray);
438  UInt_t SparseBit = 0;// Bit Code from GetDimParams()
439  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;
440 
441  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
442  groupname = jetCont->GetName();
443  fHistManager.CreateHistoGroup(groupname);
444 
445  //histname = TString::Format("%s/fhnJetSparse", groupname.Data());
446  //histtitle = histname + TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
447  //fHistManager.CreateTHnSparse(histname.Data(), histtitle.Data());
448 
449 
450  histname = TString::Format("%s/fhnJetSparse", groupname.Data());
451  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}";
452  Int_t nbins13[13] = {300, fNbins, fNbins, fNbins,24,72,20,20,20,20,100,100,100};
453  Double_t min13[13] = {0,fMinBinPt,fMinBinPt,fMinBinPt,-1.2, -0.5*pi,0,0,0,0,0,0,0};
454  Double_t max13[13] = {300,fMaxBinPt, fMaxBinPt, fMaxBinPt,1.2,1.5*pi,1,1,1,1,1,1,1};
455  fHistManager.CreateTHnSparse(histname.Data(), histtitle.Data(), 13, nbins13, min13, max13, "s");
456 
457 
458  for (Int_t cent = 0; cent < fNcentBins; cent++) {
459 
460  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), cent);
461  histtitle = TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
462  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
463 
464  histname = TString::Format("%s/histJetClusterEnergy_%d", groupname.Data(), cent);
465  histtitle = TString::Format("%s;#it{E}_{JetClus} (GeV);counts", histname.Data());
466  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2, "s");
467 
468  histname = TString::Format("%s/histJetTrkPt_%d", groupname.Data(), cent);
469  histtitle = TString::Format("%s;#it{p}_{T,JetTrk} (GeV/#it{c});counts", histname.Data());
470  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
471 
472  histname = TString::Format("%s/histJetNEFvJetPt_%d", groupname.Data(), cent);
473  histtitle = TString::Format("%s;#it{p}_{T,Jet};NEF", histname.Data());
474  fHistManager.CreateTH2(histname, histtitle, 200, 0, 200, 100, 0, 1, "s");
475 
476  histname = TString::Format("%s/histNumbJetConstvJetPt_%d", groupname.Data(), cent);
477  histtitle = TString::Format("%s;#it{p}_{T,Jet};NumberofJetConstit", histname.Data());
478  fHistManager.CreateTH2(histname, histtitle, 200, 0, 200, 20,0,20, "s");
479 
480  histname = TString::Format("%s/histJetFF_%d", groupname.Data(), cent);
481  histtitle = TString::Format("%s;Z=#it{p}_{T,leading} / #it{p}_{T,Jet};counts", histname.Data());
482  fHistManager.CreateTH1(histname, histtitle, 100, 0, 1, "s");
483 
484  histname = TString::Format("%s/histJetZvJetPt_%d", groupname.Data(), cent);
485  histtitle = TString::Format("%s;#it{p}_{T,Jet};Z=#it{p}_{T,Trk} / #it{p}_{T,Jet}", histname.Data());
486  fHistManager.CreateTH2(histname, histtitle, 200, 0, 200, 100,0,1);
487 
488  //histname = TString::Format("%s/histJetNeutralPtvJetPt_%d", groupname.Data(), cent);
489  //histtitle = TString::Format("%s;#it{p}_{T,Jet};#it{p}_{T,NeutralConstituents}", histname.Data());
490  //fHistManager.CreateTH2(histname, histtitle, 200, 0, 200, 200, 0, 200);
491 
492  histname = TString::Format("%s/histFCrossvZleading_%d", groupname.Data(), cent);
493  histtitle = TString::Format("%s;#it{z}_{leading};#it{F}_{Cross}", histname.Data());
494  fHistManager.CreateTH2(histname, histtitle, 100, 0, 1, 100, 0, 1);
495 
496  //Matched Trigger Histos
497  histname = TString::Format("%s/fHistNumbJETrigger_%d", groupname.Data(), cent);
498  histtitle = TString::Format("%s;JE Trigger Normaliztion;counts", histname.Data());
499  fHistManager.CreateTH1(histname, histtitle, 1, 0, 1, "s");
500 
501  histname = TString::Format("%s/fHistNumbGATrigger_%d", groupname.Data(), cent);
502  histtitle = TString::Format("%s;GA Trigger Normaliztion;counts", histname.Data());
503  fHistManager.CreateTH1(histname, histtitle, 1, 0, 1, "s");
504 
505  histname = TString::Format("%s/fHistJetJetPatchE_%d", groupname.Data(), cent);
506  histtitle = TString::Format("%s;#it{E}_{JetGammaPatch} (GeV);counts", histname.Data());
507  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
508 
509  histname = TString::Format("%s/fHistJetGammaPatchE_%d", groupname.Data(), cent);
510  histtitle = TString::Format("%s;#it{E}_{JetGammaPatch} (GeV);counts", histname.Data());
511  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
512 
513  histname = TString::Format("%s/fHistJetJetPatchPt_%d", groupname.Data(), cent);
514  histtitle = TString::Format("%s;#it{p}_{T,JetJetPatch} (GeV/#it{c});counts", histname.Data());
515  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
516 
517  histname = TString::Format("%s/fHistJetGammaPatchPt_%d", groupname.Data(), cent);
518  histtitle = TString::Format("%s;#it{p}_{T,JetGammaPatch} (GeV/#it{c});counts", histname.Data());
519  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
520 
521  histname = TString::Format("%s/fHistTriggerPatchE_%d", groupname.Data(), cent);
522  histtitle = TString::Format("%s;#it{E}_{TriggerPatch} (GeV);counts", histname.Data());
523  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt, "s");
524 
525  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiJE_%d", groupname.Data(), cent);
526  histtitle = TString::Format("%s;#it{#phi}_{jet} - #it{#phi}_{JE,patch};#it{#eta}_{Jet} - #it{#eta}_{JE,patch};counts", histname.Data());
527  fHistManager.CreateTH2(histname, histtitle, 280, -0.7, 0.7, 280, -0.7, 0.7);
528 
529  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiGA_%d", groupname.Data(), cent);
530  histtitle = TString::Format("%s;#it{#phi}_{jet} - #it{#phi}_{GA,patch};#it{#eta}_{Jet} - #it{#eta}_{GA,patch};counts", histname.Data());
531  fHistManager.CreateTH2(histname, histtitle, 280, -0.7, 0.7, 280, -0.7, 0.7);
532 
533  histname = TString::Format("%s/fHistJetEPatchEJE_%d", groupname.Data(), cent);
534  histtitle = TString::Format("%s;#it{E_{JE,patch}}#it{E_{Jet,UnCorr}};counts", histname.Data());
535  fHistManager.CreateTH2(histname, histtitle, 400, 0, 200, 400, 0, 200);
536 
537  histname = TString::Format("%s/fHistJetEPatchEGA_%d", groupname.Data(), cent);
538  histtitle = TString::Format("%s;#it{E_{GA,patch}};#it{E_{Jet,UnCorr}};counts", histname.Data());
539  fHistManager.CreateTH2(histname, histtitle, 400, 0, 200, 400, 0, 200);
540  // End Matched Trigger Histos
541 
542  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), cent);
543  histtitle = TString::Format("%s;#it{A}_{jet};counts", histname.Data());
544  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, 3);
545 
546  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), cent);
547  histtitle = TString::Format("%s;#it{#phi}_{jet};counts", histname.Data());
548  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi(), "s");
549 
550  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), cent);
551  histtitle = TString::Format("%s;#it{#eta}_{jet};counts", histname.Data());
552  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1, "s");
553 
554  histname = TString::Format("%s/histJetClusterPhi_%d", groupname.Data(), cent);
555  histtitle = TString::Format("%s;#it{#phi}_{JetClus};counts", histname.Data());
556  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi(), "s");
557 
558  histname = TString::Format("%s/histJetClusterEta_%d", groupname.Data(), cent);
559  histtitle = TString::Format("%s;#it{#eta}_{JetClus};counts", histname.Data());
560  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1, "s");
561 
562  histname = TString::Format("%s/histNJets_%d", groupname.Data(), cent);
563  histtitle = TString::Format("%s;number of jets;events", histname.Data());
564  if (fForceBeamType != kpp) {
565  fHistManager.CreateTH1(histname, histtitle, 500, 0, 500, "s");
566  }
567  else {
568  fHistManager.CreateTH1(histname, histtitle, 100, 0, 100, "s");
569  }
570 
571  if (!jetCont->GetRhoName().IsNull()) {
572  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), cent);
573  histtitle = TString::Format("%s;#it{p}_{T,jet}^{corr} (GeV/#it{c});counts", histname.Data());
574  fHistManager.CreateTH1(histname, histtitle, fNbins, -fMaxBinPt / 2, fMaxBinPt / 2);
575  }
576  }
577  }
578 }
579 
587 {
588  DoJetLoop();
589  DoTrackLoop();
590  DoClusterLoop();
591  DoCellLoop();
592  //DoParticleLoop();
593 
594  return kTRUE;
595 }
596 
602 {
603  TString histname;
604  TString groupname;
605  AliJetContainer* jetCont = 0;
606  TIter next(&fJetCollArray);
607 
608  //TClonesArray *triggerpatches = dynamic_cast<TClonesArray *>(InputEvent()->FindListObject("EmcalTriggers"));
609  //if(!triggerpatches)
610  // AliErrorStream() << "Trigger patch container EmcalTriggers not found in task " << GetName() << std::endl;
611 
612  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
613  groupname = jetCont->GetName();
614  UInt_t count = 0;
615  for(auto jet : jetCont->accepted()) {
616  if (!jet) continue;
617  count++;
618 
619  TLorentzVector leadPart;
620  jetCont->GetLeadingHadronMomentum(leadPart, jet);
621  Double_t z = GetParallelFraction(leadPart.Vect(), jet);
622  if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999;
623 
624  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), fCentBin);
625  fHistManager.FillTH1(histname, jet->Pt());
626 
627  histname = TString::Format("%s/histJetClusterEnergy_%d", groupname.Data(), fCentBin);
628  fHistManager.FillTH1(histname, jet->E());
629 
630  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), fCentBin);
631  fHistManager.FillTH1(histname, jet->Area());
632 
633  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), fCentBin);
634  fHistManager.FillTH1(histname, jet->Phi());
635 
636  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), fCentBin);
637  fHistManager.FillTH1(histname, jet->Eta());
638 
639  histname = TString::Format("%s/histJetNEFvJetPt_%d", groupname.Data(), fCentBin);
640  fHistManager.FillTH2(histname,jet->Pt(),jet->NEF() );
641 
642 
643  histname = TString::Format("%s/histNumbJetConstvJetPt_%d", groupname.Data(), fCentBin);
644  fHistManager.FillTH2(histname,jet->Pt(),jet->N());
645 
646  histname = TString::Format("%s/histJetFF_%d", groupname.Data(), fCentBin);
647  fHistManager.FillTH1(histname, z );
648 
649  Double_t MatchedEta = 0.04, MatchedPhi = 0.04;
650  //Look at emcal trigger patches in event and associate with jet
651  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
652 
653  if (fTriggerPatchInfo) {
654  TString objname(fTriggerPatchInfo->GetClass()->GetName());
655  TClass cls(objname);
656  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
657  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
658  fTriggerPatchInfo = 0;
659  }
660  }
661 
662  if (!fTriggerPatchInfo) {
663  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
664  continue;
665  }
666 
667  //AliEMCALTriggerPatchInfo *currentpatch(nullptr);
668  for(auto p : *fTriggerPatchInfo){
669  AliEMCALTriggerPatchInfo *currentpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
670 
671  //Select Single Shower Patch
672  if(currentpatch->IsGammaLowRecalc() || currentpatch->IsGammaLowSimple()){
673  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiGA_%d", groupname.Data(), fCentBin);
674  fHistManager.FillTH2(histname, jet->Phi() - currentpatch->GetPhiGeo(), jet->Eta() - currentpatch->GetEtaGeo());
675  histname = TString::Format("%s/fHistJetEPatchEGA_%d", groupname.Data(), fCentBin);
676  fHistManager.FillTH2(histname,jet->E(),currentpatch->GetPatchE());
677 
678  if(jet->Phi() - currentpatch->GetPhiGeo() <= MatchedPhi && jet->Eta() - currentpatch->GetEtaGeo() <= MatchedEta){
679  histname = TString::Format("%s/fHistNumbGATrigger_%d", groupname.Data(), fCentBin);
680  fHistManager.FillTH1(histname, 0.5);
681  histname = TString::Format("%s/fHistJetGammaPatchE_%d", groupname.Data(), fCentBin);
682  fHistManager.FillTH1(histname, currentpatch->GetPatchE());
683  histname = TString::Format("%s/fHistJetGammaPatchPt_%d", groupname.Data(), fCentBin);
684  fHistManager.FillTH1(histname, jet->Pt());
685  }
686  }
687 
688  //Select Jet Patch
689  if(currentpatch->IsJetLowRecalc() || currentpatch->IsJetLowSimple()){
690  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiJE_%d", groupname.Data(), fCentBin);
691  fHistManager.FillTH2(histname, jet->Phi() - currentpatch->GetPhiGeo(), jet->Eta() - currentpatch->GetEtaGeo());
692  histname = TString::Format("%s/fHistJetEPatchEJE_%d", groupname.Data(), fCentBin);
693  fHistManager.FillTH2(histname,jet->E(),currentpatch->GetPatchE());
694 
695  if(jet->Phi() - currentpatch->GetPhiGeo() <= MatchedPhi && jet->Eta() - currentpatch->GetEtaGeo() <= MatchedEta){
696  histname = TString::Format("%s/fHistNumbJETrigger_%d", groupname.Data(), fCentBin);
697  fHistManager.FillTH1(histname, 0.5);
698  histname = TString::Format("%s/fHistJetJetPatchE_%d", groupname.Data(), fCentBin);
699  fHistManager.FillTH1(histname, currentpatch->GetPatchE());
700  histname = TString::Format("%s/fHistJetJetPatchPt_%d", groupname.Data(), fCentBin);
701  fHistManager.FillTH1(histname, jet->Pt());
702  }
703  }
704 
705  }
706 
707  Double_t Z_part = 0.0;
708 
709  //Look at assoc tracks of a given jet
710  AliParticleContainer* tracks = jetCont->GetParticleContainer();
711  if (tracks) {
712  for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
713  AliVParticle *JetTrk = jet->TrackAt(it, tracks->GetArray());
714  if (JetTrk) {
715  //AliVTrack *Vtrack = dynamic_cast<AliVTrack*>(track);
716  histname = TString::Format("%s/histJetTrkPt_%d", groupname.Data(), fCentBin);
717  fHistManager.FillTH1(histname, JetTrk->Pt());
718 
719  //Z_part = GetZ(JetTrk->Px(),JetTrk->Py(),JetTrk->Pz(),jet->Px(),jet->Py(),jet->Pz());
720  Z_part = 1.;
721  histname = TString::Format("%s/histJetZvJetPt_%d", groupname.Data(), fCentBin);
722  fHistManager.FillTH2(histname,jet->Pt(),Z_part);
723 
724  //if(jetContName.Contains("mcparticles")){
725  // fMCJetContainer
726  // Double_t jetPID = 0;
727  // jetPID->PID();
728  // cout<<"PID of trk in Jet: "<<jetPID<<endl;
729  //}
730  }
731  }
732  }
733  //Loop over Clusters in Jet
734  AliClusterContainer* JetCluster = 0;
735  JetCluster = jetCont->GetClusterContainer();
736  if(JetCluster) {
737  for(auto cluster : JetCluster->accepted()) {
738  AliTLorentzVector nPart;
739  cluster->GetMomentum(nPart, fVertex);
740  //Double_t JetFCross = GetFcross(cluster, fCaloCells);
741  Double_t JetFCross = 1.;
742  histname = TString::Format("%s/histJetClusterEnergy_%d", groupname.Data(), fCentBin);
743  fHistManager.FillTH1(histname, cluster->E());
744  histname = TString::Format("%s/histJetClusterPhi_%d", groupname.Data(), fCentBin);
745  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
746  histname = TString::Format("%s/histJetClusterEta_%d", groupname.Data(), fCentBin);
747  fHistManager.FillTH1(histname, nPart.Eta());
748  histname = TString::Format("%s/histFCrossvZleading_%d", groupname.Data(), fCentBin);
749  fHistManager.FillTH2(histname,jet->MaxTrackPt() / jet->Pt(), JetFCross);
750  }
751 
752 
753  }
754 
755  Double_t leadingtrackpT = 0.0;
756  Double_t leadingclusterE = 0.0;
757  Double_t JetFCrossLeading = 0.0;
758  //AliVParticle *leadingParticle = 0x0;
759  AliVCluster *leadingCluster = 0x0;
760 
761 
762  leadingCluster = jet->GetLeadingCluster();
763  if(leadingCluster){
764  leadingclusterE = leadingCluster->E();
765  //JetFCrossLeading = GetFcross(leadingCluster, fCaloCells);
766  JetFCrossLeading = 1.;
767  }
768 
769  AliVParticle* leadingTrk = jet->GetLeadingTrack();
770  if(leadingTrk){
771  leadingtrackpT = leadingTrk->Pt();
772  }
773  AliTrackContainer * Globaltracks = static_cast<AliTrackContainer * >(GetParticleContainer("tracks"));
774  Double_t TrackMultiplicity = Globaltracks->GetNTracks();
775  Double_t Numb = jet->N();
776  Double_t NumbNeu = jet->Nn();
777  Double_t NumbChrg = jet->Nch();
778  Double_t x[13]={TrackMultiplicity,jet->Pt(),leadingtrackpT,leadingclusterE,jet->Eta(),jet->Phi(),JetFCrossLeading,z,jet->Area(),jet->NEF(),Numb,NumbNeu,NumbChrg};
779  histname = TString::Format("%s/fhnJetSparse", groupname.Data());
780  fHistManager.FillTHnSparse(histname, x);
781 
782  if (jetCont->GetRhoParameter()) {
783  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), fCentBin);
784  fHistManager.FillTH1(histname, jet->Pt() - jetCont->GetRhoVal() * jet->Area());
785  }//Background Subtaction in PbPb
786  }// Loop over each jet in a event
787  histname = TString::Format("%s/histNJets_%d", groupname.Data(), fCentBin);
788  fHistManager.FillTH1(histname, count);
789  }
790 }
791 
797 {
799 
800  TString histname;
801  TString groupname;
802  AliParticleContainer* partCont = 0;
803  TIter next(&fParticleCollArray);
804  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
805  groupname = partCont->GetName();
806  UInt_t count = 0;
807  for(auto part : partCont->accepted()) {
808  if (!part) continue;
809  count++;
810 
811  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), fCentBin);
812  fHistManager.FillTH1(histname, part->Pt());
813 
814  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), fCentBin);
815  fHistManager.FillTH1(histname, part->Phi());
816 
817  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), fCentBin);
818  fHistManager.FillTH1(histname, part->Eta());
819 
820  if (partCont->GetLoadedClass()->InheritsFrom("AliVTrack")) {
821  const AliVTrack* track = static_cast<const AliVTrack*>(part);
822 
823  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), fCentBin);
824  fHistManager.FillTH1(histname, track->Pt(), track->Eta() - track->GetTrackEtaOnEMCal());
825 
826  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), fCentBin);
827  fHistManager.FillTH1(histname, track->Pt(), track->Phi() - track->GetTrackPhiOnEMCal());
828 
829  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), fCentBin);
830  fHistManager.FillTH1(histname, track->Pt(), track->Pt() - track->GetTrackPtOnEMCal());
831 
832  Double_t x[6]={0.0,track->Pt(),track->P(),track->Eta(),track->Phi(),0.0};
833  histname = TString::Format("%s/fhnTrkSparse", groupname.Data());
834  fHistManager.FillTHnSparse(histname,x);
835 
836  if (clusCont) {
837  Int_t iCluster = track->GetEMCALcluster();
838  if (iCluster >= 0) {
839  AliVCluster* cluster = clusCont->GetAcceptCluster(iCluster);
840  if (cluster) {
841  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), fCentBin);
842  fHistManager.FillTH2(histname, track->P(), cluster->GetNonLinCorrEnergy() / track->P());
843 
844  }
845  }
846  }
847  }
848  }
849 
850  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), fCentBin);
851  fHistManager.FillTH1(histname, count);
852  }
853 }
854 
860 {
861  Double_t TrkPt = 0.0, EovP = 0.0, TrackMultiplicity =0.0, trkpSum = 0.0;
862  TString histname;
863  TString groupname;
864  AliClusterContainer* clusCont = 0;
865  TIter next(&fClusterCollArray);
866  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
867  groupname = clusCont->GetName();
868 
869  //Cluster Exotics
870  for(auto cluster : clusCont->all()) {
871  if (!cluster) continue;
872 
873  //Double_t FCross = GetFcross(cluster, fCaloCells);
874  Double_t FCross = 1.;
875  histname = TString::Format("%s/fHistFcrossvEonline_%d", groupname.Data(), fCentBin);
876  fHistManager.FillTH2(histname, cluster->E(), FCross);
877 
878  if (cluster->GetIsExotic()) {
879  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), fCentBin);
880  fHistManager.FillTH1(histname, cluster->E());
881  }
882  }
883 
884  UInt_t count = 0;
885  for(auto cluster : clusCont->accepted()) {
886  if (!cluster) continue;
887  count++;
888 
889  AliTLorentzVector nPart;
890  cluster->GetMomentum(nPart, fVertex);
891 
892  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), fCentBin);
893  fHistManager.FillTH1(histname, cluster->E());
894 
895  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), fCentBin);
896  fHistManager.FillTH1(histname, cluster->GetNonLinCorrEnergy());
897 
898  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), fCentBin);
899  fHistManager.FillTH1(histname, cluster->GetHadCorrEnergy());
900 
901  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), fCentBin);
902  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
903 
904  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), fCentBin);
905  fHistManager.FillTH1(histname, nPart.Eta());
906 
907  //Int_t nTracksMatched = 0;
908  const AliVTrack* track = 0x0;
909 
910  for (Int_t itrack=0; itrack < cluster->GetNTracksMatched(); itrack++){
911  track = dynamic_cast<AliVTrack*>(cluster->GetTrackMatched(itrack));
912  if(track){
913  TrkPt = track->Pt();
914  trkpSum += track->P();
915  EovP = cluster->GetNonLinCorrEnergy() / trkpSum;
916 
917  }
918  }
919 
920 
921  Double_t x[10]={TrackMultiplicity,cluster->GetHadCorrEnergy(),cluster->GetNonLinCorrEnergy(),cluster->E(),TrkPt,EovP,nPart.Eta(),nPart.Phi_0_2pi(),cluster->GetM02(),cluster->GetM20()};
922  histname = TString::Format("%s/fhnClusSparse", groupname.Data());
923  fHistManager.FillTHnSparse(histname, x);
924 
925 
926 
927 
928  }
929 
930  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), fCentBin);
931  fHistManager.FillTH1(histname, count);
932  }
933 }
934 
940 {
941  if (!fCaloCells) return;
942 
943  TString histname;
944 
945  const Short_t ncells = fCaloCells->GetNumberOfCells();
946 
947  histname = TString::Format("%s/histNCells_%d", fCaloCellsName.Data(), fCentBin);
948  fHistManager.FillTH1(histname, ncells);
949 
950  histname = TString::Format("%s/histCellEnergy_%d", fCaloCellsName.Data(), fCentBin);
951  for (Short_t pos = 0; pos < ncells; pos++) {
952  Double_t amp = fCaloCells->GetAmplitude(pos);
953 
954  fHistManager.FillTH1(histname, amp);
955  }
956 }
957 
964 {
965  TString histname;
966  TString groupname;
967  AliParticleContainer* partMCCont = 0;
968  //TIter next(&fGeneratorLevel);
969  for(auto trk : partMCCont->all()){
970  groupname = partMCCont->GetName();
971  UInt_t count = 0;
972  for(auto part : partMCCont->accepted()) {
973  if (!part) continue;
974 
975  histname = TString::Format("%s/fHistParticleLvlpT_%d", groupname.Data(), fCent);
976  fHistManager.FillTH1(histname, part->Pt());
977  }
978  }
979 
980 
981 }
982 
988 {
989 
991 }
992 
1001 {
1002  //Int_t runNum = InputEvent()->GetRunNumber();
1003 
1004  //Bool_t PileUp = AliVEvent::IsPileupFromSPD();
1005 
1006  //Double_t zVertex=fVertex[2];
1007 
1008  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
1009 
1010  if (fTriggerPatchInfo) {
1011  TString objname(fTriggerPatchInfo->GetClass()->GetName());
1012  TClass cls(objname);
1013  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
1014  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
1015  fTriggerPatchInfo = 0;
1016  }
1017  }
1018 
1019  if (!fTriggerPatchInfo) {
1020  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
1021  return kFALSE;
1022  }
1023  for(auto p : *fTriggerPatchInfo){
1024  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
1025  if (recpatch) {
1026  }
1027  }
1028 
1029  //fClusterEResolution = new TF1("fClusterEResolution","sqrt([0]^2+[1]^2*x+([2]*x)^2)*0.01");// 2010 EMCal Test Beam Resolution
1030  //fClusterEResolution->SetParameters(4.35,9.07,1.63);//Fit to test beam
1031 
1032 
1033 
1034 
1035  //IsLEDEvent();
1036 
1037  return kTRUE;
1038 }
1039 
1040 /*
1041 void AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::ExtractMainPatch() {
1042 
1043  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
1044 
1045  if (fTriggerPatchInfo) {
1046  TString objname(fTriggerPatchInfo->GetClass()->GetName());
1047  TClass cls(objname);
1048  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
1049  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
1050  fTriggerPatchInfo = 0;
1051  }
1052  }
1053 
1054  if (!fTriggerPatchInfo) {
1055  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
1056  return;
1057  }
1058  for(auto p : *fTriggerPatchInfo){
1059  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
1060  if (recpatch) {
1061  cout<<"Pstchphi:"<<recpatch->GetPhiCM()<<endl;
1062  }
1063  }
1064  //Find main trigger
1065 
1066  (fTriggerPatchInfo) {
1067  TString objname(fTriggerPatchInfo->GetClass()->GetName());
1068  TClass cls(objname);
1069  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
1070  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
1071  fTriggerPatchInfo = 0;
1072  }
1073  if (!fTriggerPatchInfo) {
1074  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
1075  return;
1076  }
1077  }
1078  //number of patches in event
1079  //Int_t nPatch = fTriggerPatchInfo->GetEntriesFast();
1080  //extract main trigger patch
1081  //Double_t emax = -1.;
1082  //for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
1083  // AliEMCALTriggerPatchInfo *patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
1084  // if (!patch) continue;
1085  // cout<<"PstchE:"<<patch->GetPatchE()<<endl;
1086  //}
1087 
1088 }
1089 */
1090 
1095 {
1096  cout<<"*****************************"<<endl;
1097  cout<<"******* Task Finished *******"<<endl;
1098  cout<<"*****************************"<<endl;
1099 }
1100 /*
1101 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
1102 {
1103  //
1104  // Get the z of a constituent inside of a jet
1105  //
1106 
1107  return (trkPx*jetPx+trkPy*jetPy+trkPz*jetPz)/(jetPx*jetPx+jetPy*jetPy+jetPz*jetPz);
1108 }
1109  */
1110 /*
1111 Bool_t AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::IsLEDEvent() const
1112 {
1113  Bool_t isLED = kFALSE;
1114  //
1115  // Check if the event is contaminated by LED signal
1116  //
1117  if (!fCaloCells) return kFALSE;
1118 
1119  TString histname;
1120 
1121  Int_t nCellCount[10] = {0};
1122  const Short_t ncells = fCaloCells->GetNumberOfCells();
1123 
1124 
1125 
1126  for (Short_t pos = 0; pos < ncells; pos++) {
1127  Int_t cellId = fCaloCells->GetCellNumber(pos);
1128  Double_t amp = fCaloCells->GetAmplitude(pos);
1129  Int_t sMod = fGeom->GetSuperModuleNumber(cellId);
1130 
1131  if(amp<0.1) continue;
1132  nCellCount[sMod]++;
1133 
1134  }
1135 
1136  for(Int_t i=0; i<=9; i++){
1137  fHistEMCalTowerMult[i]->Fill(nCellCount[i]);
1138  }
1139 
1140 
1141 
1142  return isLED;
1143 }
1144 */
1145 /*
1146 Double_t AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::GetFcross(const AliVCluster *cluster, AliVCaloCells *cells)
1147 {
1148  Int_t AbsIdseed = -1;
1149  Double_t Eseed = 0;
1150  for (Int_t i = 0; i < cluster->GetNCells(); i++) {
1151  if (cells->GetCellAmplitude(cluster->GetCellAbsId(i)) > Eseed) {
1152  Eseed = cells->GetCellAmplitude(cluster->GetCellAbsId(i));
1153  AbsIdseed = cluster->GetCellAbsId(i);
1154  }
1155  }
1156 
1157  if (Eseed < 1e-9) {
1158  return 100;
1159  }
1160 
1161  Int_t imod = -1, iphi =-1, ieta=-1,iTower = -1, iIphi = -1, iIeta = -1;
1162  fGeom->GetCellIndex(AbsIdseed,imod,iTower,iIphi,iIeta);
1163  fGeom->GetCellPhiEtaIndexInSModule(imod,iTower,iIphi,iIeta,iphi,ieta);
1164 
1165  //Get close cells index and energy, not in corners
1166 
1167  Int_t absID1 = -1;
1168  Int_t absID2 = -1;
1169 
1170  if (iphi < AliEMCALGeoParams::fgkEMCALRows-1) {
1171  absID1 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi+1, ieta);
1172  }
1173  if (iphi > 0) {
1174  absID2 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi-1, ieta);
1175  }
1176 
1177  // In case of cell in eta = 0 border, depending on SM shift the cross cell index
1178 
1179  Int_t absID3 = -1;
1180  Int_t absID4 = -1;
1181 
1182  if (ieta == AliEMCALGeoParams::fgkEMCALCols-1 && !(imod%2)) {
1183  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod+1, iphi, 0);
1184  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
1185  }
1186  else if (ieta == 0 && imod%2) {
1187  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
1188  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod-1, iphi, AliEMCALGeoParams::fgkEMCALCols-1);
1189  }
1190  else {
1191  if (ieta < AliEMCALGeoParams::fgkEMCALCols-1) {
1192  absID3 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta+1);
1193  }
1194  if (ieta > 0) {
1195  absID4 = fGeom->GetAbsCellIdFromCellIndexes(imod, iphi, ieta-1);
1196  }
1197  }
1198 
1199  Double_t ecell1 = cells->GetCellAmplitude(absID1);
1200  Double_t ecell2 = cells->GetCellAmplitude(absID2);
1201  Double_t ecell3 = cells->GetCellAmplitude(absID3);
1202  Double_t ecell4 = cells->GetCellAmplitude(absID4);
1203 
1204  Double_t Ecross = ecell1 + ecell2 + ecell3 + ecell4;
1205 
1206  Double_t Fcross = 1 - Ecross/Eseed;
1207 
1208  return Fcross;
1209 }
1210 */
1211 //Double_t AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::GetSmearedTrackPt(AliVTrack *track)
1212 //{
1213  //
1214  // Smear track momentum
1215  //
1216 
1217  //Double_t resolution = track->Pt()*track->Pt()*TMath::Sqrt(track->GetSigma1Pt2());
1218  //Double_t smear = resolution*TMath::Sqrt((1+fVaryTrkPtRes)*(1+fVaryTrkPtRes)-1);
1219  // return fRandomGen->Gaus(0, smear);
1220 
1221 //}
1223 {
1224  Int_t count = 0;
1225  UInt_t tmp = entries;
1226  while(tmp!=0){
1227  count++;
1228  tmp = tmp &~ -tmp; // clear lowest bit
1229  }
1230 
1231  TString hnTitle(name);
1232  const Int_t dim = count;
1233  Int_t nbins[dim];
1234  Double_t xmin[dim];
1235  Double_t xmax[dim];
1236 
1237  Int_t i=0;
1238  Int_t c=0;
1239  while(c<dim && i<32){
1240  if(entries&(1<<i)){
1241 
1242  TString label("");
1243  GetDimParams(i, label, nbins[c], xmin[c], xmax[c]);
1244  hnTitle += Form(";%s",label.Data());
1245  c++;
1246  }
1247 
1248  i++;
1249  }
1250  hnTitle += ";";
1251 
1252  return new THnSparseF(name, hnTitle.Data(), dim, nbins, xmin, xmax);
1253 }
1264 {
1265  const Double_t pi = TMath::Pi();
1266 
1267  switch(iEntry){
1268 
1269  case 0:
1270  label = "V0 centrality (%)";
1271  nbins = 30;
1272  xmin = 0.;
1273  xmax = 100.;
1274  // Adjust for pp, since we are retrieving multiplicity instead
1276  label = "Multiplicity";
1277  xmax = 300.;
1278  }
1279  break;
1280 
1281  case 1:
1282  label = "Jet p_{T}";
1283  nbins = 200;
1284  xmin = 0.;
1285  xmax = 200.;
1286  break;
1287 
1288  case 2:
1289  label = "Track p_{T}";
1290  nbins = 100;
1291  xmin = 0.;
1292  xmax = 100;
1293  break;
1294 
1295  case 3:
1296  label = "Cluster E";
1297  nbins = 100;
1298  xmin = 0.;
1299  xmax = 100;
1300  break;
1301 
1302  case 4:
1303  label = "Jet#eta";
1304  nbins = 24;
1305  xmin = -1.2;
1306  xmax = 1.2;
1307  break;
1308 
1309  case 5:
1310  label = "Jet #phi";
1311  nbins = 72;
1312  xmin = -0.5*pi;
1313  xmax = 1.5*pi;
1314  break;
1315 
1316  case 6:
1317  label = "#it{p}_{T,track}^{leading}";
1318  nbins = 100;
1319  xmin = 0;
1320  xmax = 100;
1321  break;
1322 
1323  case 7:
1324  label = "Matched Trigger Amp";
1325  nbins = 10;
1326  xmin = 0;
1327  xmax = 50;
1328  break;
1329 
1330  case 8:
1331  label = "#Delta#eta";
1332  nbins = 48;
1333  xmin = -1.2;
1334  xmax = 1.2;
1335  break;
1336 
1337  case 9:
1338  label = "#Delta#phi";
1339  nbins = 72;
1340  xmin = 0;
1341  xmax = 2*pi;
1342  break;
1343 
1344  case 10:
1345  label = "F_{cross}";
1346  nbins = 20;
1347  xmin = 0;
1348  xmax = 1;
1349  break;
1350 
1351  case 11:
1352  label = "z_{leading}";
1353  nbins = 20;
1354  xmin = 0;
1355  xmax = 1;
1356  break;
1357 
1358  case 12:
1359  label = "#it{A}_{jet}";
1360  nbins = 20;
1361  xmin = 0;
1362  xmax = 1;
1363  break;
1364 
1365  case 13:
1366  label = "Jet NEF";
1367  nbins = 20;
1368  xmin = 0;
1369  xmax = 1;
1370  break;
1371 
1372  case 14:
1373  label = "Numb Constit";
1374  nbins = 50;
1375  xmin = 0;
1376  xmax = 50;
1377  break;
1378 
1379  case 15:
1380  label = "Numb Chrg Constit";
1381  nbins = 50;
1382  xmin = 0;
1383  xmax = 50;
1384  break;
1385 
1386  case 16:
1387  label = "Numb Neu Constit";
1388  nbins = 50;
1389  xmin = 0;
1390  xmax = 50;
1391  break;
1392  }
1393 }
1394 
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
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 fMinBinPt
min pt in histograms
AliClusterContainer * GetClusterContainer() const
TCanvas * c
Definition: TestFitELoss.C:172
Int_t fCentBin
!event centrality bin
Declaration of class AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA.
Container for particles within the EMCAL framework.
void SetCaloTriggerPatchInfoName(const char *n)
TObjArray fParticleCollArray
particle/track collection array
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
Double_t Phi_0_2pi() const
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
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
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.
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)