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