AliPhysics  5364b50 (5364b50)
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 <TList.h>
20 #include <array>
21 #include <iostream>
22 #include <map>
23 #include <vector>
24 #include <TClonesArray.h>
25 #include <TGrid.h>
26 #include <THistManager.h>
27 #include <THashList.h>
28 #include <TLinearBinning.h>
29 #include <TObjArray.h>
30 #include <TParameter.h>
31 
32 #include <AliVCluster.h>
33 #include <AliVParticle.h>
34 #include <AliLog.h>
35 
36 #include "AliTLorentzVector.h"
37 #include "AliEmcalJet.h"
38 #include "AliRhoParameter.h"
39 #include "AliJetContainer.h"
40 #include "AliParticleContainer.h"
41 #include "AliClusterContainer.h"
42 
43 
44 #include "AliAnalysisUtils.h"
45 #include "AliESDEvent.h"
46 #include "AliEMCALTriggerPatchInfo.h"
48 #include "AliInputEventHandler.h"
49 #include "AliLog.h"
50 #include "AliMultSelection.h"
51 #include "AliMultEstimator.h"
52 #include "AliOADBContainer.h"
53 
55 
59 
60 using std::cout;
61 using std::endl;
62 
68 fUseRecalcPatches(false),
69 fHistManager(),
70 fHistNumbJets(),
71 fHistJetPt(),
72 fHistJetJetPatchE(),
73 fHistJetGammaPatchE(),
74 fHistJetJetPatchPt(),
75 fHistJetGammaPatchPt(),
76 fHistTriggerPatchE()
77 {
78 }
79 
86 AliAnalysisTaskEmcalJet(name, kTRUE),
87 fUseRecalcPatches(false),
88 fHistManager(name),
89 fHistNumbJets(0),
90 fHistJetPt(0),
96 {
98  SetCaloTriggerPatchInfoName("EmcalTriggers");
99 }
100 
105 {
106 }
107 
113 {
115 
120 
121  TIter next(fHistManager.GetListOfHistograms());
122  TObject* obj = 0;
123  while ((obj = next())) {
124  fOutput->Add(obj);
125  }
126  fOutput->Add(fHistNumbJets);
127  fOutput->Add(fHistJetPt);
128 
129  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
130 }
131 
132 /*
133  * This function allocates the histograms for basic EMCal cluster QA.
134  * A set of histograms (energy, eta, phi, number of cluster) is allocated
135  * per each cluster container and per each centrality bin.
136  */
138 {
139  TString histname;
140  TString histtitle;
141  TString groupname;
142  AliClusterContainer* clusCont = 0;
143  TIter next(&fClusterCollArray);
144  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
145  groupname = clusCont->GetName();
146  fHistManager.CreateHistoGroup(groupname);
147  for (Int_t cent = 0; cent < fNcentBins; cent++) {
148  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), cent);
149  histtitle = TString::Format("%s;#it{E}_{cluster} (GeV);counts", histname.Data());
150  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
151 
152  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), cent);
153  histtitle = TString::Format("%s;#it{E}_{cluster}^{exotic} (GeV);counts", histname.Data());
154  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
155 
156  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), cent);
157  histtitle = TString::Format("%s;#it{E}_{cluster}^{non-lin.corr.} (GeV);counts", histname.Data());
158  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
159 
160  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), cent);
161  histtitle = TString::Format("%s;#it{E}_{cluster}^{had.corr.} (GeV);counts", histname.Data());
162  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
163 
164  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), cent);
165  histtitle = TString::Format("%s;#it{#phi}_{custer};counts", histname.Data());
166  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
167 
168  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), cent);
169  histtitle = TString::Format("%s;#it{#eta}_{custer};counts", histname.Data());
170  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
171 
172  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), cent);
173  histtitle = TString::Format("%s;number of clusters;events", histname.Data());
174  if (fForceBeamType != kpp) {
175  fHistManager.CreateTH1(histname, histtitle, 500, 0, 3000);
176  }
177  else {
178  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
179  }
180  }
181  }
182 }
183 
184 /*
185  * This function allocates the histograms for basic EMCal QA.
186  * One 2D histogram with the cell energy spectra and the number of cells
187  * per event is allocated per each centrality bin.
188  */
190 {
191  TString histname;
192  TString histtitle;
193  TString groupname(fCaloCellsName);
194 
195  fHistManager.CreateHistoGroup(groupname);
196  for (Int_t cent = 0; cent < fNcentBins; cent++) {
197  histname = TString::Format("%s/histCellEnergy_%d", groupname.Data(), cent);
198  histtitle = TString::Format("%s;#it{E}_{cell} (GeV);counts", histname.Data());
199  fHistManager.CreateTH1(histname, histtitle, 300, 0, 150);
200 
201  histname = TString::Format("%s/histNCells_%d", groupname.Data(), cent);
202  histtitle = TString::Format("%s;number of cells;events", histname.Data());
203  if (fForceBeamType != kpp) {
204  fHistManager.CreateTH1(histname, histtitle, 500, 0, 6000);
205  }
206  else {
207  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
208  }
209  }
210 }
211 
212 /*
213  * This function allocates the histograms for basic tracking QA.
214  * A set of histograms (pT, eta, phi, difference between kinematic properties
215  * at the vertex and at the EMCal surface, number of tracks) is allocated
216  * per each particle container and per each centrality bin.
217  */
219 {
220  TString histname;
221  TString histtitle;
222  TString groupname;
223  AliParticleContainer* partCont = 0;
224  TIter next(&fParticleCollArray);
225  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
226  groupname = partCont->GetName();
227  fHistManager.CreateHistoGroup(groupname);
228  for (Int_t cent = 0; cent < fNcentBins; cent++) {
229  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), cent);
230  histtitle = TString::Format("%s;#it{p}_{T,track} (GeV/#it{c});counts", histname.Data());
231  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
232 
233  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), cent);
234  histtitle = TString::Format("%s;#it{#phi}_{track};counts", histname.Data());
235  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
236 
237  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), cent);
238  histtitle = TString::Format("%s;#it{#eta}_{track};counts", histname.Data());
239  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
240 
241  if (TClass(partCont->GetClassName()).InheritsFrom("AliVTrack")) {
242  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), cent);
243  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#eta}_{track}^{vertex} - #it{#eta}_{track}^{EMCal};counts", histname.Data());
244  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 50, -0.5, 0.5);
245 
246  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), cent);
247  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#phi}_{track}^{vertex} - #it{#phi}_{track}^{EMCal};counts", histname.Data());
248  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 200, -2, 2);
249 
250  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), cent);
251  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());
252  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, -fMaxBinPt/2, fMaxBinPt/2);
253 
254  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), cent);
255  histtitle = TString::Format("%s;#it{P}_{track} (GeV/#it{c});#it{E}_{cluster} / #it{P}_{track} #it{c};counts", histname.Data());
256  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, 0, 4);
257  }
258 
259  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), cent);
260  histtitle = TString::Format("%s;number of tracks;events", histname.Data());
261  if (fForceBeamType != kpp) {
262  fHistManager.CreateTH1(histname, histtitle, 500, 0, 5000);
263  }
264  else {
265  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
266  }
267  }
268  }
269 }
270 
271 /*
272  * This function allocates the histograms for basic jet QA.
273  * A set of histograms (pT, eta, phi, area, number of jets, corrected pT) is allocated
274  * per each jet container and per each centrality bin.
275  */
277 {
278  TString histname;
279  TString histtitle;
280  TString groupname;
281  AliJetContainer* jetCont = 0;
282  TIter next(&fJetCollArray);
283  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
284  groupname = jetCont->GetName();
285  fHistManager.CreateHistoGroup(groupname);
286  for (Int_t cent = 0; cent < fNcentBins; cent++) {
287  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), cent);
288  histtitle = TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
289  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
290 
291  histname = TString::Format("%s/histJetClusterEnergy_%d", groupname.Data(), cent);
292  histtitle = TString::Format("%s;#it{E}_{JetClus} (GeV);counts", histname.Data());
293  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
294 
295  histname = TString::Format("%s/histJetTrkPt_%d", groupname.Data(), cent);
296  histtitle = TString::Format("%s;#it{p}_{T,JetTrk} (GeV/#it{c});counts", histname.Data());
297  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
298 
299  //Matched Trigger Histos
300  histname = TString::Format("%s/fHistJetJetPatchE_%d", groupname.Data(), cent);
301  histtitle = TString::Format("%s;#it{E}_{JetGammaPatch} (GeV);counts", histname.Data());
302  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
303 
304  histname = TString::Format("%s/fHistJetGammaPatchE_%d", groupname.Data(), cent);
305  histtitle = TString::Format("%s;#it{E}_{JetGammaPatch} (GeV);counts", histname.Data());
306  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
307 
308  histname = TString::Format("%s/fHistJetJetPatchPt_%d", groupname.Data(), cent);
309  histtitle = TString::Format("%s;#it{P}_{t,JetJetPatch} (GeV/#it{c});counts", histname.Data());
310  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
311 
312  histname = TString::Format("%s/fHistJetGammaPatchPt_%d", groupname.Data(), cent);
313  histtitle = TString::Format("%s;#it{E}_{JetGammaPatch} (GeV/#it{c});counts", histname.Data());
314  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
315 
316  histname = TString::Format("%s/fHistTriggerPatchE_%d", groupname.Data(), cent);
317  histtitle = TString::Format("%s;#it{E}_{TriggerPatch} (GeV);counts", histname.Data());
318  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
319 
320  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiJE_%d", groupname.Data(), cent);
321  histtitle = TString::Format("%s;#it{#phi}_{jet} - #it{#phi}_{JE,patch};#it{#eta}_{Jet} - #it{#eta}_{JE,patch};counts", histname.Data());
322  fHistManager.CreateTH2(histname, histtitle, 70, -0.7, 0.7, 70, -0.7, 0.7);
323 
324  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiGA_%d", groupname.Data(), cent);
325  histtitle = TString::Format("%s;#it{#phi}_{jet} - #it{#phi}_{GA,patch};#it{#eta}_{Jet} - #it{#eta}_{GA,patch};counts", histname.Data());
326  fHistManager.CreateTH2(histname, histtitle, 70, -0.7, 0.7, 70, -0.7, 0.7);
327 
328  histname = TString::Format("%s/fHistJetEPatchEJE_%d", groupname.Data(), cent);
329  histtitle = TString::Format("%s;#it{E_{JE,patch}}#it{E_{Jet,UnCorr}};counts", histname.Data());
330  fHistManager.CreateTH2(histname, histtitle, 100, 0, 100, 100, 0, 100);
331 
332  histname = TString::Format("%s/fHistJetEPatchEGA_%d", groupname.Data(), cent);
333  histtitle = TString::Format("%s;#it{E_{GA,patch}};#it{E_{Jet,UnCorr}};counts", histname.Data());
334  fHistManager.CreateTH2(histname, histtitle, 100, 0, 100, 100, 0, 100);
335  // End Matched Trigger Histos
336 
337  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), cent);
338  histtitle = TString::Format("%s;#it{A}_{jet};counts", histname.Data());
339  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, 3);
340 
341  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), cent);
342  histtitle = TString::Format("%s;#it{#phi}_{jet};counts", histname.Data());
343  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
344 
345  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), cent);
346  histtitle = TString::Format("%s;#it{#eta}_{jet};counts", histname.Data());
347  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
348 
349  histname = TString::Format("%s/histJetClusterPhi_%d", groupname.Data(), cent);
350  histtitle = TString::Format("%s;#it{#phi}_{JetClus};counts", histname.Data());
351  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
352 
353  histname = TString::Format("%s/histJetClusterEta_%d", groupname.Data(), cent);
354  histtitle = TString::Format("%s;#it{#eta}_{JetClus};counts", histname.Data());
355  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
356 
357  histname = TString::Format("%s/histNJets_%d", groupname.Data(), cent);
358  histtitle = TString::Format("%s;number of jets;events", histname.Data());
359  if (fForceBeamType != kpp) {
360  fHistManager.CreateTH1(histname, histtitle, 500, 0, 500);
361  }
362  else {
363  fHistManager.CreateTH1(histname, histtitle, 100, 0, 100);
364  }
365 
366  if (!jetCont->GetRhoName().IsNull()) {
367  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), cent);
368  histtitle = TString::Format("%s;#it{p}_{T,jet}^{corr} (GeV/#it{c});counts", histname.Data());
369  fHistManager.CreateTH1(histname, histtitle, fNbins, -fMaxBinPt / 2, fMaxBinPt / 2);
370  }
371  }
372  }
373 }
374 
382 {
383  DoJetLoop();
384  //DoTrackLoop();
385  //DoClusterLoop();
386  //DoCellLoop();
387 
388  return kTRUE;
389 }
390 
396 {
397  TString histname;
398  TString groupname;
399  AliJetContainer* jetCont = 0;
400  TIter next(&fJetCollArray);
401 
402  //TClonesArray *triggerpatches = dynamic_cast<TClonesArray *>(InputEvent()->FindListObject("EmcalTriggers"));
403  //if(!triggerpatches)
404  // AliErrorStream() << "Trigger patch container EmcalTriggers not found in task " << GetName() << std::endl;
405 
406  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
407  groupname = jetCont->GetName();
408  UInt_t count = 0;
409  for(auto jet : jetCont->accepted()) {
410  if (!jet) continue;
411  count++;
412 
413  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), fCentBin);
414  fHistManager.FillTH1(histname, jet->Pt());
415 
416  histname = TString::Format("%s/histJetClusterEnergy_%d", groupname.Data(), fCentBin);
417  fHistManager.FillTH1(histname, jet->E());
418 
419  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), fCentBin);
420  fHistManager.FillTH1(histname, jet->Area());
421 
422  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), fCentBin);
423  fHistManager.FillTH1(histname, jet->Phi());
424 
425  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), fCentBin);
426  fHistManager.FillTH1(histname, jet->Eta());
427 
428  Double_t MatchedEta = 0.04, MatchedPhi = 0.04;
429  //Look at emcal trigger patches in event and associate with jet
430  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
431 
432  if (fTriggerPatchInfo) {
433  TString objname(fTriggerPatchInfo->GetClass()->GetName());
434  TClass cls(objname);
435  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
436  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
437  fTriggerPatchInfo = 0;
438  }
439  }
440 
441  if (!fTriggerPatchInfo) {
442  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
443  continue;
444  }
445 
446  AliEMCALTriggerPatchInfo *currentpatch(nullptr);
447  for(auto p : *fTriggerPatchInfo){
448  AliEMCALTriggerPatchInfo *currentpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
449 
450  //Select Single Shower Patch
451  if(currentpatch->IsGammaLowRecalc() || currentpatch->IsGammaLowSimple()){
452  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiGA_%d", groupname.Data(), fCentBin);
453  fHistManager.FillTH2(histname, jet->Phi() - currentpatch->GetPhiGeo(), jet->Eta() - currentpatch->GetEtaGeo());
454  histname = TString::Format("%s/fHistJetEPatchEGA_%d", groupname.Data(), fCentBin);
455  fHistManager.FillTH2(histname,jet->E(),currentpatch->GetPatchE());
456 
457  if(jet->Phi() - currentpatch->GetPhiGeo() <= MatchedPhi && jet->Eta() - currentpatch->GetEtaGeo() <= MatchedEta){
458  histname = TString::Format("%s/fHistJetGammaPatchE_%d", groupname.Data(), fCentBin);
459  fHistManager.FillTH1(histname, currentpatch->GetPatchE());
460  histname = TString::Format("%s/fHistJetGammaPatchPt_%d", groupname.Data(), fCentBin);
461  fHistManager.FillTH1(histname, jet->Pt());
462  //cout<<"Found Matched Gamma PAtch"<<endl;
463  }
464  }
465 
466  //Select Jet Patch
467  if(currentpatch->IsJetLowRecalc() || currentpatch->IsJetLowSimple()){
468  histname = TString::Format("%s/fHistDeltaEtaDeltaPhiJE_%d", groupname.Data(), fCentBin);
469  fHistManager.FillTH2(histname, jet->Phi() - currentpatch->GetPhiGeo(), jet->Eta() - currentpatch->GetEtaGeo());
470  histname = TString::Format("%s/fHistJetEPatchEJE_%d", groupname.Data(), fCentBin);
471  fHistManager.FillTH2(histname,jet->E(),currentpatch->GetPatchE());
472 
473  if(jet->Phi() - currentpatch->GetPhiGeo() <= MatchedPhi && jet->Eta() - currentpatch->GetEtaGeo() <= MatchedEta){
474  histname = TString::Format("%s/fHistJetJetPatchE_%d", groupname.Data(), fCentBin);
475  fHistManager.FillTH1(histname, currentpatch->GetPatchE());
476  histname = TString::Format("%s/fHistJetJetPatchPt_%d", groupname.Data(), fCentBin);
477  fHistManager.FillTH1(histname, jet->Pt());
478  //cout<<"Found Matched Jet PAtch"<<endl;
479  }
480  }
481 
482  }
483 
484  //Look at assoc tracks of a given jet
485  AliParticleContainer* tracks = jetCont->GetParticleContainer();
486  if (tracks) {
487  for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
488  AliVParticle *JetTrk = jet->TrackAt(it, tracks->GetArray());
489  if (JetTrk) {
490  //AliVTrack *Vtrack = dynamic_cast<AliVTrack*>(track);
491  histname = TString::Format("%s/histJetTrkPt_%d", groupname.Data(), fCentBin);
492  fHistManager.FillTH1(histname, JetTrk->Pt());
493  }
494  }
495  }
496  //Loop over Clusters in Jet
497  AliClusterContainer* JetCluster = 0;
498  JetCluster = jetCont->GetClusterContainer();
499  if(JetCluster) {
500  for(auto cluster : JetCluster->accepted()) {
501  AliTLorentzVector nPart;
502  cluster->GetMomentum(nPart, fVertex);
503  histname = TString::Format("%s/histJetClusterEnergy_%d", groupname.Data(), fCentBin);
504  fHistManager.FillTH1(histname, cluster->E());
505  histname = TString::Format("%s/histJetClusterPhi_%d", groupname.Data(), fCentBin);
506  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
507  histname = TString::Format("%s/histJetClusterEta_%d", groupname.Data(), fCentBin);
508  fHistManager.FillTH1(histname, nPart.Eta());
509  }
510  }
511 
512 
513  if (jetCont->GetRhoParameter()) {
514  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), fCentBin);
515  fHistManager.FillTH1(histname, jet->Pt() - jetCont->GetRhoVal() * jet->Area());
516  }//Background Subtaction in PbPb
517  }// Loop over each jet in a event
518  histname = TString::Format("%s/histNJets_%d", groupname.Data(), fCentBin);
519  fHistManager.FillTH1(histname, count);
520  }
521 }
522 
528 {
530 
531  TString histname;
532  TString groupname;
533  AliParticleContainer* partCont = 0;
534  TIter next(&fParticleCollArray);
535  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
536  groupname = partCont->GetName();
537  UInt_t count = 0;
538  for(auto part : partCont->accepted()) {
539  if (!part) continue;
540  count++;
541 
542  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), fCentBin);
543  fHistManager.FillTH1(histname, part->Pt());
544 
545  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), fCentBin);
546  fHistManager.FillTH1(histname, part->Phi());
547 
548  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), fCentBin);
549  fHistManager.FillTH1(histname, part->Eta());
550 
551  if (partCont->GetLoadedClass()->InheritsFrom("AliVTrack")) {
552  const AliVTrack* track = static_cast<const AliVTrack*>(part);
553 
554  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), fCentBin);
555  fHistManager.FillTH1(histname, track->Pt(), track->Eta() - track->GetTrackEtaOnEMCal());
556 
557  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), fCentBin);
558  fHistManager.FillTH1(histname, track->Pt(), track->Phi() - track->GetTrackPhiOnEMCal());
559 
560  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), fCentBin);
561  fHistManager.FillTH1(histname, track->Pt(), track->Pt() - track->GetTrackPtOnEMCal());
562 
563  if (clusCont) {
564  Int_t iCluster = track->GetEMCALcluster();
565  if (iCluster >= 0) {
566  AliVCluster* cluster = clusCont->GetAcceptCluster(iCluster);
567  if (cluster) {
568  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), fCentBin);
569  fHistManager.FillTH2(histname, track->P(), cluster->GetNonLinCorrEnergy() / track->P());
570  }
571  }
572  }
573  }
574  }
575 
576  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), fCentBin);
577  fHistManager.FillTH1(histname, count);
578  }
579 }
580 
586 {
587  TString histname;
588  TString groupname;
589  AliClusterContainer* clusCont = 0;
590  TIter next(&fClusterCollArray);
591  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
592  groupname = clusCont->GetName();
593 
594  for(auto cluster : clusCont->all()) {
595  if (!cluster) continue;
596 
597  if (cluster->GetIsExotic()) {
598  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), fCentBin);
599  fHistManager.FillTH1(histname, cluster->E());
600  }
601  }
602 
603  UInt_t count = 0;
604  for(auto cluster : clusCont->accepted()) {
605  if (!cluster) continue;
606  count++;
607 
608  AliTLorentzVector nPart;
609  cluster->GetMomentum(nPart, fVertex);
610 
611  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), fCentBin);
612  fHistManager.FillTH1(histname, cluster->E());
613 
614  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), fCentBin);
615  fHistManager.FillTH1(histname, cluster->GetNonLinCorrEnergy());
616 
617  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), fCentBin);
618  fHistManager.FillTH1(histname, cluster->GetHadCorrEnergy());
619 
620  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), fCentBin);
621  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
622 
623  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), fCentBin);
624  fHistManager.FillTH1(histname, nPart.Eta());
625  }
626 
627  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), fCentBin);
628  fHistManager.FillTH1(histname, count);
629  }
630 }
631 
637 {
638  if (!fCaloCells) return;
639 
640  TString histname;
641 
642  const Short_t ncells = fCaloCells->GetNumberOfCells();
643 
644  histname = TString::Format("%s/histNCells_%d", fCaloCellsName.Data(), fCentBin);
645  fHistManager.FillTH1(histname, ncells);
646 
647  histname = TString::Format("%s/histCellEnergy_%d", fCaloCellsName.Data(), fCentBin);
648  for (Short_t pos = 0; pos < ncells; pos++) {
649  Double_t amp = fCaloCells->GetAmplitude(pos);
650 
651  fHistManager.FillTH1(histname, amp);
652  }
653 }
654 
660 {
661 
663 }
664 
673 {
674 
675  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
676 
677  if (fTriggerPatchInfo) {
678  TString objname(fTriggerPatchInfo->GetClass()->GetName());
679  TClass cls(objname);
680  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
681  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
682  fTriggerPatchInfo = 0;
683  }
684  }
685 
686  if (!fTriggerPatchInfo) {
687  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
688  return kFALSE;
689  }
690  for(auto p : *fTriggerPatchInfo){
691  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
692  if (recpatch) {
693  // cout<<"PstchE:"<<recpatch->GetPatchE()<<endl;
694  }
695  }
696 
697 
698  return kTRUE;
699 }
700 
701 /*
702 void AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA::ExtractMainPatch() {
703 
704  this->SetCaloTriggerPatchInfoName("EmcalTriggers");
705 
706  if (fTriggerPatchInfo) {
707  TString objname(fTriggerPatchInfo->GetClass()->GetName());
708  TClass cls(objname);
709  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
710  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
711  fTriggerPatchInfo = 0;
712  }
713  }
714 
715  if (!fTriggerPatchInfo) {
716  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
717  return;
718  }
719  for(auto p : *fTriggerPatchInfo){
720  AliEMCALTriggerPatchInfo *recpatch = static_cast<AliEMCALTriggerPatchInfo *>(p);
721  if (recpatch) {
722  cout<<"Pstchphi:"<<recpatch->GetPhiCM()<<endl;
723  }
724  }
725  //Find main trigger
726 
727  (fTriggerPatchInfo) {
728  TString objname(fTriggerPatchInfo->GetClass()->GetName());
729  TClass cls(objname);
730  if (!cls.InheritsFrom("AliEMCALTriggerPatchInfo")) {
731  AliError(Form("%s: Objects of type %s in %s are not inherited from AliEMCALTriggerPatchInfo!",GetName(), cls.GetName(), "EmcalTriggers"));
732  fTriggerPatchInfo = 0;
733  }
734  if (!fTriggerPatchInfo) {
735  AliError(Form("%s: Unable to get trigger patch container with name %s. Aborting", GetName(), "EmcalTriggers"));
736  return;
737  }
738  }
739  //number of patches in event
740  //Int_t nPatch = fTriggerPatchInfo->GetEntriesFast();
741  //extract main trigger patch
742  //Double_t emax = -1.;
743  //for (Int_t iPatch = 0; iPatch < nPatch; iPatch++) {
744  // AliEMCALTriggerPatchInfo *patch = (AliEMCALTriggerPatchInfo*)fTriggerPatchInfo->At( iPatch );
745  // if (!patch) continue;
746  // cout<<"PstchE:"<<patch->GetPatchE()<<endl;
747  //}
748 
749 }
750 */
751 
756 {
757  cout<<"*****************************"<<endl;
758  cout<<"******* Task Finished *******"<<endl;
759  cout<<"*****************************"<<endl;
760 }
761 
THashList * CreateHistoGroup(const char *groupname)
Create a new group of histograms within a parent group.
TObjArray fClusterCollArray
cluster collection array
Double_t GetRhoVal() const
const TString & GetRhoName() const
double Double_t
Definition: External.C:58
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
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
const AliClusterIterableContainer all() const
AliParticleContainer * GetParticleContainer() const
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
Create a new TH2 within the container.
int Int_t
Definition: External.C:63
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
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 AliJetIterableContainer accepted() const
bool Bool_t
Definition: External.C:53
Container structure for EMCAL clusters.
Container for jet within the EMCAL jet framework.
Int_t fNbins
no. of pt bins