AliPhysics  97344c9 (97344c9)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
21 #include <AliVCluster.h>
22 #include <AliVParticle.h>
23 #include <AliLog.h>
24 
25 #include "AliTLorentzVector.h"
26 #include "AliEmcalJet.h"
27 #include "AliRhoParameter.h"
28 #include "AliJetContainer.h"
29 #include "AliParticleContainer.h"
30 #include "AliClusterContainer.h"
31 #include "AliEmcalTriggerMaker.h"
33 
35 
39 
45  fHistManager()
46 {
47 }
48 
55  AliAnalysisTaskEmcalJet(name, kTRUE),
56  fHistManager(name)
57 {
59 }
60 
65 {
66 }
67 
73 {
75 
80 
81  TIter next(fHistManager.GetListOfHistograms());
82  TObject* obj = 0;
83  while ((obj = next())) {
84  fOutput->Add(obj);
85  }
86 
87  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
88 }
89 
90 /*
91  * This function allocates the histograms for basic EMCal cluster QA.
92  * A set of histograms (energy, eta, phi, number of cluster) is allocated
93  * per each cluster container and per each centrality bin.
94  */
96 {
97  TString histname;
98  TString histtitle;
99  TString groupname;
100  AliClusterContainer* clusCont = 0;
101  TIter next(&fClusterCollArray);
102  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
103  groupname = clusCont->GetName();
104  fHistManager.CreateHistoGroup(groupname);
105  for (Int_t cent = 0; cent < fNcentBins; cent++) {
106  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), cent);
107  histtitle = TString::Format("%s;#it{E}_{cluster} (GeV);counts", histname.Data());
108  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
109 
110  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), cent);
111  histtitle = TString::Format("%s;#it{E}_{cluster}^{exotic} (GeV);counts", histname.Data());
112  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
113 
114  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), cent);
115  histtitle = TString::Format("%s;#it{E}_{cluster}^{non-lin.corr.} (GeV);counts", histname.Data());
116  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
117 
118  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), cent);
119  histtitle = TString::Format("%s;#it{E}_{cluster}^{had.corr.} (GeV);counts", histname.Data());
120  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
121 
122  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), cent);
123  histtitle = TString::Format("%s;#it{#phi}_{custer};counts", histname.Data());
124  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
125 
126  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), cent);
127  histtitle = TString::Format("%s;#it{#eta}_{custer};counts", histname.Data());
128  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
129 
130  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), cent);
131  histtitle = TString::Format("%s;number of clusters;events", histname.Data());
132  if (fForceBeamType != kpp) {
133  fHistManager.CreateTH1(histname, histtitle, 500, 0, 3000);
134  }
135  else {
136  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
137  }
138  }
139  }
140 }
141 
142 /*
143  * This function allocates the histograms for basic EMCal QA.
144  * One 2D histogram with the cell energy spectra and the number of cells
145  * per event is allocated per each centrality bin.
146  */
148 {
149  TString histname;
150  TString histtitle;
151  TString groupname(fCaloCellsName);
152 
153  fHistManager.CreateHistoGroup(groupname);
154  for (Int_t cent = 0; cent < fNcentBins; cent++) {
155  histname = TString::Format("%s/histCellEnergy_%d", groupname.Data(), cent);
156  histtitle = TString::Format("%s;#it{E}_{cell} (GeV);counts", histname.Data());
157  fHistManager.CreateTH1(histname, histtitle, 300, 0, 150);
158 
159  histname = TString::Format("%s/histNCells_%d", groupname.Data(), cent);
160  histtitle = TString::Format("%s;number of cells;events", histname.Data());
161  if (fForceBeamType != kpp) {
162  fHistManager.CreateTH1(histname, histtitle, 500, 0, 6000);
163  }
164  else {
165  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
166  }
167  }
168 }
169 
170 /*
171  * This function allocates the histograms for basic tracking QA.
172  * A set of histograms (pT, eta, phi, difference between kinematic properties
173  * at the vertex and at the EMCal surface, number of tracks) is allocated
174  * per each particle container and per each centrality bin.
175  */
177 {
178  TString histname;
179  TString histtitle;
180  TString groupname;
181  AliParticleContainer* partCont = 0;
182  TIter next(&fParticleCollArray);
183  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
184  groupname = partCont->GetName();
185  fHistManager.CreateHistoGroup(groupname);
186  for (Int_t cent = 0; cent < fNcentBins; cent++) {
187  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), cent);
188  histtitle = TString::Format("%s;#it{p}_{T,track} (GeV/#it{c});counts", histname.Data());
189  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
190 
191  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), cent);
192  histtitle = TString::Format("%s;#it{#phi}_{track};counts", histname.Data());
193  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
194 
195  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), cent);
196  histtitle = TString::Format("%s;#it{#eta}_{track};counts", histname.Data());
197  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
198 
199  if (TClass(partCont->GetClassName()).InheritsFrom("AliVTrack")) {
200  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), cent);
201  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#eta}_{track}^{vertex} - #it{#eta}_{track}^{EMCal};counts", histname.Data());
202  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 50, -0.5, 0.5);
203 
204  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), cent);
205  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#phi}_{track}^{vertex} - #it{#phi}_{track}^{EMCal};counts", histname.Data());
206  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 200, -2, 2);
207 
208  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), cent);
209  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());
210  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, -fMaxBinPt/2, fMaxBinPt/2);
211 
212  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), cent);
213  histtitle = TString::Format("%s;#it{P}_{track} (GeV/#it{c});#it{E}_{cluster} / #it{P}_{track} #it{c};counts", histname.Data());
214  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, 0, 4);
215  }
216 
217  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), cent);
218  histtitle = TString::Format("%s;number of tracks;events", histname.Data());
219  if (fForceBeamType != kpp) {
220  fHistManager.CreateTH1(histname, histtitle, 500, 0, 5000);
221  }
222  else {
223  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
224  }
225  }
226  }
227 }
228 
229 /*
230  * This function allocates the histograms for basic jet QA.
231  * A set of histograms (pT, eta, phi, area, number of jets, corrected pT) is allocated
232  * per each jet container and per each centrality bin.
233  */
235 {
236  TString histname;
237  TString histtitle;
238  TString groupname;
239  AliJetContainer* jetCont = 0;
240  TIter next(&fJetCollArray);
241  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
242  groupname = jetCont->GetName();
243  fHistManager.CreateHistoGroup(groupname);
244  for (Int_t cent = 0; cent < fNcentBins; cent++) {
245  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), cent);
246  histtitle = TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
247  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
248 
249  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), cent);
250  histtitle = TString::Format("%s;#it{A}_{jet};counts", histname.Data());
251  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, 3);
252 
253  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), cent);
254  histtitle = TString::Format("%s;#it{#phi}_{jet};counts", histname.Data());
255  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
256 
257  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), cent);
258  histtitle = TString::Format("%s;#it{#eta}_{jet};counts", histname.Data());
259  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
260 
261  histname = TString::Format("%s/histNJets_%d", groupname.Data(), cent);
262  histtitle = TString::Format("%s;number of jets;events", histname.Data());
263  if (fForceBeamType != kpp) {
264  fHistManager.CreateTH1(histname, histtitle, 500, 0, 500);
265  }
266  else {
267  fHistManager.CreateTH1(histname, histtitle, 100, 0, 100);
268  }
269 
270  if (!jetCont->GetRhoName().IsNull()) {
271  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), cent);
272  histtitle = TString::Format("%s;#it{p}_{T,jet}^{corr} (GeV/#it{c});counts", histname.Data());
273  fHistManager.CreateTH1(histname, histtitle, fNbins, -fMaxBinPt / 2, fMaxBinPt / 2);
274  }
275  }
276  }
277 }
278 
286 {
287  DoJetLoop();
288  DoTrackLoop();
289  DoClusterLoop();
290  DoCellLoop();
291 
292  return kTRUE;
293 }
294 
300 {
301  TString histname;
302  TString groupname;
303  AliJetContainer* jetCont = 0;
304  TIter next(&fJetCollArray);
305  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
306  groupname = jetCont->GetName();
307  UInt_t count = 0;
308  for(auto jet : jetCont->accepted()) {
309  if (!jet) continue;
310  count++;
311 
312  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), fCentBin);
313  fHistManager.FillTH1(histname, jet->Pt());
314 
315  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), fCentBin);
316  fHistManager.FillTH1(histname, jet->Area());
317 
318  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), fCentBin);
319  fHistManager.FillTH1(histname, jet->Phi());
320 
321  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), fCentBin);
322  fHistManager.FillTH1(histname, jet->Eta());
323 
324  if (jetCont->GetRhoParameter()) {
325  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), fCentBin);
326  fHistManager.FillTH1(histname, jet->Pt() - jetCont->GetRhoVal() * jet->Area());
327  }
328  }
329  histname = TString::Format("%s/histNJets_%d", groupname.Data(), fCentBin);
330  fHistManager.FillTH1(histname, count);
331  }
332 }
333 
339 {
341 
342  TString histname;
343  TString groupname;
344  AliParticleContainer* partCont = 0;
345  TIter next(&fParticleCollArray);
346  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
347  groupname = partCont->GetName();
348  UInt_t count = 0;
349  for(auto part : partCont->accepted()) {
350  if (!part) continue;
351  count++;
352 
353  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), fCentBin);
354  fHistManager.FillTH1(histname, part->Pt());
355 
356  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), fCentBin);
357  fHistManager.FillTH1(histname, part->Phi());
358 
359  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), fCentBin);
360  fHistManager.FillTH1(histname, part->Eta());
361 
362  if (partCont->GetLoadedClass()->InheritsFrom("AliVTrack")) {
363  const AliVTrack* track = static_cast<const AliVTrack*>(part);
364 
365  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), fCentBin);
366  fHistManager.FillTH1(histname, track->Pt(), track->Eta() - track->GetTrackEtaOnEMCal());
367 
368  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), fCentBin);
369  fHistManager.FillTH1(histname, track->Pt(), track->Phi() - track->GetTrackPhiOnEMCal());
370 
371  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), fCentBin);
372  fHistManager.FillTH1(histname, track->Pt(), track->Pt() - track->GetTrackPtOnEMCal());
373 
374  if (clusCont) {
375  Int_t iCluster = track->GetEMCALcluster();
376  if (iCluster >= 0) {
377  AliVCluster* cluster = clusCont->GetAcceptCluster(iCluster);
378  if (cluster) {
379  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), fCentBin);
380  fHistManager.FillTH2(histname, track->P(), cluster->GetNonLinCorrEnergy() / track->P());
381  }
382  }
383  }
384  }
385  }
386 
387  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), fCentBin);
388  fHistManager.FillTH1(histname, count);
389  }
390 }
391 
397 {
398  TString histname;
399  TString groupname;
400  AliClusterContainer* clusCont = 0;
401  TIter next(&fClusterCollArray);
402  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
403  groupname = clusCont->GetName();
404 
405  for(auto cluster : clusCont->all()) {
406  if (!cluster) continue;
407 
408  if (cluster->GetIsExotic()) {
409  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), fCentBin);
410  fHistManager.FillTH1(histname, cluster->E());
411  }
412  }
413 
414  UInt_t count = 0;
415  for(auto cluster : clusCont->accepted()) {
416  if (!cluster) continue;
417  count++;
418 
419  AliTLorentzVector nPart;
420  cluster->GetMomentum(nPart, fVertex);
421 
422  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), fCentBin);
423  fHistManager.FillTH1(histname, cluster->E());
424 
425  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), fCentBin);
426  fHistManager.FillTH1(histname, cluster->GetNonLinCorrEnergy());
427 
428  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), fCentBin);
429  fHistManager.FillTH1(histname, cluster->GetHadCorrEnergy());
430 
431  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), fCentBin);
432  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
433 
434  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), fCentBin);
435  fHistManager.FillTH1(histname, nPart.Eta());
436  }
437 
438  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), fCentBin);
439  fHistManager.FillTH1(histname, count);
440  }
441 }
442 
448 {
449  if (!fCaloCells) return;
450 
451  TString histname;
452 
453  const Short_t ncells = fCaloCells->GetNumberOfCells();
454 
455  histname = TString::Format("%s/histNCells_%d", fCaloCellsName.Data(), fCentBin);
456  fHistManager.FillTH1(histname, ncells);
457 
458  histname = TString::Format("%s/histCellEnergy_%d", fCaloCellsName.Data(), fCentBin);
459  for (Short_t pos = 0; pos < ncells; pos++) {
460  Double_t amp = fCaloCells->GetAmplitude(pos);
461 
462  fHistManager.FillTH1(histname, amp);
463  }
464 }
465 
471 {
473 }
474 
483 {
484  return kTRUE;
485 }
486 
491 {
492 }
THashList * CreateHistoGroup(const char *groupname)
TObjArray fClusterCollArray
cluster collection array
Double_t GetRhoVal() const
const TString & GetRhoName() const
double Double_t
Definition: External.C:58
Class to make array of trigger patch objects in AOD/ESD events.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Declaration of class AliTLorentzVector.
Double_t fMinBinPt
min pt in histograms
Int_t fCentBin
!event centrality bin
Declaration of class AliAnalysisTaskEmcalJetSpectra8TeVTriggerQA.
Container for particles within the EMCAL framework.
TObjArray fParticleCollArray
particle/track collection array
const AliClusterIterableContainer all() const
TH2 * CreateTH2(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, Option_t *opt="")
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Definition: THistManager.h:504
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="")
BeamType fForceBeamType
forced beam type
Int_t fNcentBins
how many centrality bins
AliClusterContainer * GetClusterContainer(Int_t i=0) const
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="")
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
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
Double_t fVertex[3]
!event vertex
void SetMakeGeneralHistograms(Bool_t g)
Base task in the EMCAL jet framework.
const AliParticleIterableContainer accepted() const
const char Option_t
Definition: External.C:48
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