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