AliPhysics  c923f52 (c923f52)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskJetSubstructure.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 
33 
37 
43  fHistManager()
44 {
45 }
46 
53  AliAnalysisTaskEmcalJet(name, kTRUE),
54  fHistManager(name)
55 {
57 }
58 
63 {
64 }
65 
71 {
73 
79 
80  TIter next(fHistManager.GetListOfHistograms());
81  TObject* obj = 0;
82  while ((obj = next())) {
83  fOutput->Add(obj);
84  }
85 
86  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
87 }
88 
89 /*
90  * This function allocates the histograms for basic EMCal cluster QA.
91  * A set of histograms (energy, eta, phi, number of cluster) is allocated
92  * per each cluster container and per each centrality bin.
93  */
95 {
96  TString histname;
97  TString histtitle;
98  TString groupname;
99  AliClusterContainer* clusCont = 0;
100  TIter next(&fClusterCollArray);
101  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
102  groupname = clusCont->GetName();
103  fHistManager.CreateHistoGroup(groupname);
104  for (Int_t cent = 0; cent < fNcentBins; cent++) {
105  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), cent);
106  histtitle = TString::Format("%s;#it{E}_{cluster} (GeV);counts", histname.Data());
107  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
108 
109  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), cent);
110  histtitle = TString::Format("%s;#it{E}_{cluster}^{exotic} (GeV);counts", histname.Data());
111  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
112 
113  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), cent);
114  histtitle = TString::Format("%s;#it{E}_{cluster}^{non-lin.corr.} (GeV);counts", histname.Data());
115  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
116 
117  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), cent);
118  histtitle = TString::Format("%s;#it{E}_{cluster}^{had.corr.} (GeV);counts", histname.Data());
119  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
120 
121  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), cent);
122  histtitle = TString::Format("%s;#it{#phi}_{custer};counts", histname.Data());
123  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
124 
125  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), cent);
126  histtitle = TString::Format("%s;#it{#eta}_{custer};counts", histname.Data());
127  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
128 
129  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), cent);
130  histtitle = TString::Format("%s;number of clusters;events", histname.Data());
131  if (fForceBeamType != kpp) {
132  fHistManager.CreateTH1(histname, histtitle, 500, 0, 3000);
133  }
134  else {
135  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
136  }
137  }
138  }
139 }
140 
141 /*
142  * This function allocates the histograms for basic EMCal QA.
143  * One 2D histogram with the cell energy spectra and the number of cells
144  * per event is allocated per each centrality bin.
145  */
147 {
148  TString histname;
149  TString histtitle;
150  TString groupname(fCaloCellsName);
151 
152  fHistManager.CreateHistoGroup(groupname);
153  for (Int_t cent = 0; cent < fNcentBins; cent++) {
154  histname = TString::Format("%s/histCellEnergyvsAbsId_%d", groupname.Data(), cent);
155  histtitle = TString::Format("%s;cell abs. ID;#it{E}_{cell} (GeV);counts", histname.Data());
156  fHistManager.CreateTH2(histname, histtitle, 20000, 0, 20000, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
157 
158  histname = TString::Format("%s/histNCells_%d", groupname.Data(), cent);
159  histtitle = TString::Format("%s;number of cells;events", histname.Data());
160  if (fForceBeamType != kpp) {
161  fHistManager.CreateTH1(histname, histtitle, 500, 0, 6000);
162  }
163  else {
164  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
165  }
166  }
167 }
168 
169 
170 /*
171  * This function allocates histograms for the jet substructure analysis
172  */
173 
175 {
176  TString histname;
177  TString histtitle;
178  TString groupname;
179  AliJetContainer* jetCont = 0;
180  TIter next(&fJetCollArray);
181  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
182  groupname = jetCont->GetName();
183  fHistManager.CreateHistoGroup(groupname);
184  for (Int_t cent = 0; cent < fNcentBins; cent++) {
185  histname = TString::Format("%s/histZg_%d", groupname.Data(), cent);
186  histtitle = TString::Format("%s;#it{Z}_{g};counts", histname.Data());
187  fHistManager.CreateTH1(histname, histtitle, 200, 0., .5);
188 
189  histname = TString::Format("%s/histdR_%d", groupname.Data(), cent);
190  histtitle = TString::Format("%s;#it{dR};counts", histname.Data());
191  fHistManager.CreateTH1(histname, histtitle, 200, 0., 1.);
192 
193  }
194  }
195 }
196 
197 
198 /*
199  * This function allocates the histograms for basic tracking QA.
200  * A set of histograms (pT, eta, phi, difference between kinematic properties
201  * at the vertex and at the EMCal surface, number of tracks) is allocated
202  * per each particle container and per each centrality bin.
203  */
205 {
206  TString histname;
207  TString histtitle;
208  TString groupname;
209  AliParticleContainer* partCont = 0;
210  TIter next(&fParticleCollArray);
211  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
212  groupname = partCont->GetName();
213  fHistManager.CreateHistoGroup(groupname);
214  for (Int_t cent = 0; cent < fNcentBins; cent++) {
215  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), cent);
216  histtitle = TString::Format("%s;#it{p}_{T,track} (GeV/#it{c});counts", histname.Data());
217  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
218 
219  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), cent);
220  histtitle = TString::Format("%s;#it{#phi}_{track};counts", histname.Data());
221  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
222 
223  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), cent);
224  histtitle = TString::Format("%s;#it{#eta}_{track};counts", histname.Data());
225  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
226 
227  if (TClass(partCont->GetClassName()).InheritsFrom("AliVTrack")) {
228  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), cent);
229  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#eta}_{track}^{vertex} - #it{#eta}_{track}^{EMCal};counts", histname.Data());
230  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 50, -0.5, 0.5);
231 
232  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), cent);
233  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#phi}_{track}^{vertex} - #it{#phi}_{track}^{EMCal};counts", histname.Data());
234  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 200, -2, 2);
235 
236  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), cent);
237  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());
238  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, -fMaxBinPt/2, fMaxBinPt/2);
239 
240  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), cent);
241  histtitle = TString::Format("%s;#it{P}_{track} (GeV/#it{c});#it{E}_{cluster} / #it{P}_{track} #it{c};counts", histname.Data());
242  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, 0, 4);
243  }
244 
245  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), cent);
246  histtitle = TString::Format("%s;number of tracks;events", histname.Data());
247  if (fForceBeamType != kpp) {
248  fHistManager.CreateTH1(histname, histtitle, 500, 0, 5000);
249  }
250  else {
251  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
252  }
253  }
254  }
255 }
256 
257 /*
258  * This function allocates the histograms for basic jet QA.
259  * A set of histograms (pT, eta, phi, area, number of jets, corrected pT) is allocated
260  * per each jet container and per each centrality bin.
261  */
263 {
264  TString histname;
265  TString histtitle;
266  TString groupname;
267  AliJetContainer* jetCont = 0;
268  TIter next(&fJetCollArray);
269  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
270  groupname = jetCont->GetName();
271  fHistManager.CreateHistoGroup(groupname);
272  for (Int_t cent = 0; cent < fNcentBins; cent++) {
273  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), cent);
274  histtitle = TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
275  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
276 
277  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), cent);
278  histtitle = TString::Format("%s;#it{A}_{jet};counts", histname.Data());
279  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, 3);
280 
281  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), cent);
282  histtitle = TString::Format("%s;#it{#phi}_{jet};counts", histname.Data());
283  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
284 
285  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), cent);
286  histtitle = TString::Format("%s;#it{#eta}_{jet};counts", histname.Data());
287  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
288 
289  histname = TString::Format("%s/histNJets_%d", groupname.Data(), cent);
290  histtitle = TString::Format("%s;number of jets;events", histname.Data());
291  if (fForceBeamType != kpp) {
292  fHistManager.CreateTH1(histname, histtitle, 500, 0, 500);
293  }
294  else {
295  fHistManager.CreateTH1(histname, histtitle, 100, 0, 100);
296  }
297 
298  if (!jetCont->GetRhoName().IsNull()) {
299  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), cent);
300  histtitle = TString::Format("%s;#it{p}_{T,jet}^{corr} (GeV/#it{c});counts", histname.Data());
301  fHistManager.CreateTH1(histname, histtitle, fNbins, -fMaxBinPt / 2, fMaxBinPt / 2);
302  }
303  }
304  }
305 }
306 
314 {
315  DoJetLoop();
317  DoTrackLoop();
318  DoClusterLoop();
319  DoCellLoop();
320 
321  return kTRUE;
322 }
323 
329 {
330  TString histname;
331  TString groupname;
332  AliJetContainer* jetCont = 0;
333  TIter next(&fJetCollArray);
334  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
335  groupname = jetCont->GetName();
336  UInt_t count = 0;
337  for(auto jet : jetCont->accepted()) {
338  if (!jet) continue;
339  count++;
340 
341  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), fCentBin);
342  fHistManager.FillTH1(histname, jet->Pt());
343 
344  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), fCentBin);
345  fHistManager.FillTH1(histname, jet->Area());
346 
347  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), fCentBin);
348  fHistManager.FillTH1(histname, jet->Phi());
349 
350  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), fCentBin);
351  fHistManager.FillTH1(histname, jet->Eta());
352 
353  if (jetCont->GetRhoParameter()) {
354  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), fCentBin);
355  fHistManager.FillTH1(histname, jet->Pt() - jetCont->GetRhoVal() * jet->Area());
356  }
357  }
358  histname = TString::Format("%s/histNJets_%d", groupname.Data(), fCentBin);
359  fHistManager.FillTH1(histname, count);
360  }
361 }
362 
363 
369 {
370  TString histname;
371  TString groupname;
372  AliJetContainer* jetCont = 0;
373  TIter next(&fJetCollArray);
374  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
375  groupname = jetCont->GetName();
376  UInt_t count = 0;
377  for(auto jet : jetCont->accepted()) {
378  if (!jet) continue;
379  count++;
380 
381  histname = TString::Format("%s/histZg_%d", groupname.Data(), fCentBin);
382  fHistManager.FillTH1(histname, jet->GetShapeProperties()->GetSoftDropZg());
383 
384  histname = TString::Format("%s/histdR_%d", groupname.Data(), fCentBin);
385  fHistManager.FillTH1(histname, jet->GetShapeProperties()->GetSoftDropdR());
386 
387  }
388  }
389 }
390 
396 {
398 
399  TString histname;
400  TString groupname;
401  AliParticleContainer* partCont = 0;
402  TIter next(&fParticleCollArray);
403  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
404  groupname = partCont->GetName();
405  UInt_t count = 0;
406  for(auto part : partCont->accepted()) {
407  if (!part) continue;
408  count++;
409 
410  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), fCentBin);
411  fHistManager.FillTH1(histname, part->Pt());
412 
413  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), fCentBin);
414  fHistManager.FillTH1(histname, part->Phi());
415 
416  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), fCentBin);
417  fHistManager.FillTH1(histname, part->Eta());
418 
419  if (partCont->GetLoadedClass()->InheritsFrom("AliVTrack")) {
420  const AliVTrack* track = static_cast<const AliVTrack*>(part);
421 
422  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), fCentBin);
423  fHistManager.FillTH1(histname, track->Pt(), track->Eta() - track->GetTrackEtaOnEMCal());
424 
425  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), fCentBin);
426  fHistManager.FillTH1(histname, track->Pt(), track->Phi() - track->GetTrackPhiOnEMCal());
427 
428  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), fCentBin);
429  fHistManager.FillTH1(histname, track->Pt(), track->Pt() - track->GetTrackPtOnEMCal());
430 
431  if (clusCont) {
432  Int_t iCluster = track->GetEMCALcluster();
433  if (iCluster >= 0) {
434  AliVCluster* cluster = clusCont->GetAcceptCluster(iCluster);
435  if (cluster) {
436  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), fCentBin);
437  fHistManager.FillTH2(histname, track->P(), cluster->GetNonLinCorrEnergy() / track->P());
438  }
439  }
440  }
441  }
442  }
443 
444  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), fCentBin);
445  fHistManager.FillTH1(histname, count);
446  }
447 }
448 
454 {
455  TString histname;
456  TString groupname;
457  AliClusterContainer* clusCont = 0;
458  TIter next(&fClusterCollArray);
459  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
460  groupname = clusCont->GetName();
461 
462  for(auto cluster : clusCont->all()) {
463  if (!cluster) continue;
464 
465  if (cluster->GetIsExotic()) {
466  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), fCentBin);
467  fHistManager.FillTH1(histname, cluster->E());
468  }
469  }
470 
471  UInt_t count = 0;
472  for(auto cluster : clusCont->accepted()) {
473  if (!cluster) continue;
474  count++;
475 
476  AliTLorentzVector nPart;
477  cluster->GetMomentum(nPart, fVertex);
478 
479  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), fCentBin);
480  fHistManager.FillTH1(histname, cluster->E());
481 
482  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), fCentBin);
483  fHistManager.FillTH1(histname, cluster->GetNonLinCorrEnergy());
484 
485  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), fCentBin);
486  fHistManager.FillTH1(histname, cluster->GetHadCorrEnergy());
487 
488  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), fCentBin);
489  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
490 
491  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), fCentBin);
492  fHistManager.FillTH1(histname, nPart.Eta());
493  }
494 
495  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), fCentBin);
496  fHistManager.FillTH1(histname, count);
497  }
498 }
499 
505 {
506  if (!fCaloCells) return;
507 
508  TString histname;
509 
510  const Short_t ncells = fCaloCells->GetNumberOfCells();
511 
512  histname = TString::Format("%s/histNCells_%d", fCaloCellsName.Data(), fCentBin);
513  fHistManager.FillTH1(histname, ncells);
514 
515  histname = TString::Format("%s/histCellEnergyvsAbsId_%d", fCaloCellsName.Data(), fCentBin);
516  for (Short_t pos = 0; pos < ncells; pos++) {
517  Double_t amp = fCaloCells->GetAmplitude(pos);
518  Short_t absId = fCaloCells->GetCellNumber(pos);
519 
520  fHistManager.FillTH2(histname, absId, amp);
521  }
522 }
523 
529 {
531 }
532 
541 {
542  return kTRUE;
543 }
544 
549 {
550 }
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="")
Declaration of class AliTLorentzVector.
Double_t fMinBinPt
min pt in histograms
Declaration of class AliAnalysisTaskJetSubstructure.
Int_t fCentBin
!event centrality bin
Container for particles within the EMCAL framework.
TObjArray fParticleCollArray
particle/track collection array
const AliClusterIterableContainer all() const
THashList * CreateHistoGroup(const char *groupname, const char *parent="/")
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
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()
THistManager fHistManager
Histogram manager.
AliEmcalList * fOutput
!output list
Double_t fMaxBinPt
max pt in histograms
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
ClassImp(AliAnalysisTaskCascadeTester) AliAnalysisTaskCascadeTester