AliPhysics  323987d (323987d)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalJetSample.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 
78 
79  TIter next(fHistManager.GetListOfHistograms());
80  TObject* obj = 0;
81  while ((obj = next())) {
82  fOutput->Add(obj);
83  }
84 
85  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
86 }
87 
88 /*
89  * This function allocates the histograms for basic EMCal cluster QA.
90  * A set of histograms (energy, eta, phi, number of cluster) is allocated
91  * per each cluster container and per each centrality bin.
92  */
94 {
95  TString histname;
96  TString histtitle;
97  TString groupname;
98  AliClusterContainer* clusCont = 0;
99  TIter next(&fClusterCollArray);
100  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
101  groupname = clusCont->GetName();
102  fHistManager.CreateHistoGroup(groupname);
103  for (Int_t cent = 0; cent < fNcentBins; cent++) {
104  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), cent);
105  histtitle = TString::Format("%s;#it{E}_{cluster} (GeV);counts", histname.Data());
106  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
107 
108  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), cent);
109  histtitle = TString::Format("%s;#it{E}_{cluster}^{exotic} (GeV);counts", histname.Data());
110  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
111 
112  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), cent);
113  histtitle = TString::Format("%s;#it{E}_{cluster}^{non-lin.corr.} (GeV);counts", histname.Data());
114  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
115 
116  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), cent);
117  histtitle = TString::Format("%s;#it{E}_{cluster}^{had.corr.} (GeV);counts", histname.Data());
118  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
119 
120  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), cent);
121  histtitle = TString::Format("%s;#it{#phi}_{custer};counts", histname.Data());
122  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
123 
124  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), cent);
125  histtitle = TString::Format("%s;#it{#eta}_{custer};counts", histname.Data());
126  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
127 
128  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), cent);
129  histtitle = TString::Format("%s;number of clusters;events", histname.Data());
130  if (fForceBeamType != kpp) {
131  fHistManager.CreateTH1(histname, histtitle, 500, 0, 3000);
132  }
133  else {
134  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
135  }
136  }
137  }
138 }
139 
140 /*
141  * This function allocates the histograms for basic EMCal QA.
142  * One 2D histogram with the cell energy spectra and the number of cells
143  * per event is allocated per each centrality bin.
144  */
146 {
147  TString histname;
148  TString histtitle;
149  TString groupname(fCaloCellsName);
150 
151  fHistManager.CreateHistoGroup(groupname);
152  for (Int_t cent = 0; cent < fNcentBins; cent++) {
153  histname = TString::Format("%s/histCellEnergy_%d", groupname.Data(), cent);
154  histtitle = TString::Format("%s;#it{E}_{cell} (GeV);counts", histname.Data());
155  fHistManager.CreateTH1(histname, histtitle, 300, 0, 150);
156 
157  histname = TString::Format("%s/histNCells_%d", groupname.Data(), cent);
158  histtitle = TString::Format("%s;number of cells;events", histname.Data());
159  if (fForceBeamType != kpp) {
160  fHistManager.CreateTH1(histname, histtitle, 500, 0, 6000);
161  }
162  else {
163  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
164  }
165  }
166 }
167 
168 /*
169  * This function allocates the histograms for basic tracking QA.
170  * A set of histograms (pT, eta, phi, difference between kinematic properties
171  * at the vertex and at the EMCal surface, number of tracks) is allocated
172  * per each particle container and per each centrality bin.
173  */
175 {
176  TString histname;
177  TString histtitle;
178  TString groupname;
179  AliParticleContainer* partCont = 0;
180  TIter next(&fParticleCollArray);
181  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
182  groupname = partCont->GetName();
183  fHistManager.CreateHistoGroup(groupname);
184  for (Int_t cent = 0; cent < fNcentBins; cent++) {
185  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), cent);
186  histtitle = TString::Format("%s;#it{p}_{T,track} (GeV/#it{c});counts", histname.Data());
187  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
188 
189  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), cent);
190  histtitle = TString::Format("%s;#it{#phi}_{track};counts", histname.Data());
191  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
192 
193  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), cent);
194  histtitle = TString::Format("%s;#it{#eta}_{track};counts", histname.Data());
195  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
196 
197  if (TClass(partCont->GetClassName()).InheritsFrom("AliVTrack")) {
198  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), cent);
199  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#eta}_{track}^{vertex} - #it{#eta}_{track}^{EMCal};counts", histname.Data());
200  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 50, -0.5, 0.5);
201 
202  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), cent);
203  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#phi}_{track}^{vertex} - #it{#phi}_{track}^{EMCal};counts", histname.Data());
204  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 200, -2, 2);
205 
206  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), cent);
207  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());
208  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, -fMaxBinPt/2, fMaxBinPt/2);
209 
210  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), cent);
211  histtitle = TString::Format("%s;#it{P}_{track} (GeV/#it{c});#it{E}_{cluster} / #it{P}_{track} #it{c};counts", histname.Data());
212  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, 0, 4);
213  }
214 
215  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), cent);
216  histtitle = TString::Format("%s;number of tracks;events", histname.Data());
217  if (fForceBeamType != kpp) {
218  fHistManager.CreateTH1(histname, histtitle, 500, 0, 5000);
219  }
220  else {
221  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
222  }
223  }
224  }
225 }
226 
227 /*
228  * This function allocates the histograms for basic jet QA.
229  * A set of histograms (pT, eta, phi, area, number of jets, corrected pT) is allocated
230  * per each jet container and per each centrality bin.
231  */
233 {
234  TString histname;
235  TString histtitle;
236  TString groupname;
237  AliJetContainer* jetCont = 0;
238  TIter next(&fJetCollArray);
239  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
240  groupname = jetCont->GetName();
241  fHistManager.CreateHistoGroup(groupname);
242  for (Int_t cent = 0; cent < fNcentBins; cent++) {
243  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), cent);
244  histtitle = TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
245  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
246 
247  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), cent);
248  histtitle = TString::Format("%s;#it{A}_{jet};counts", histname.Data());
249  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, 3);
250 
251  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), cent);
252  histtitle = TString::Format("%s;#it{#phi}_{jet};counts", histname.Data());
253  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
254 
255  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), cent);
256  histtitle = TString::Format("%s;#it{#eta}_{jet};counts", histname.Data());
257  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
258 
259  histname = TString::Format("%s/histNJets_%d", groupname.Data(), cent);
260  histtitle = TString::Format("%s;number of jets;events", histname.Data());
261  if (fForceBeamType != kpp) {
262  fHistManager.CreateTH1(histname, histtitle, 500, 0, 500);
263  }
264  else {
265  fHistManager.CreateTH1(histname, histtitle, 100, 0, 100);
266  }
267 
268  if (!jetCont->GetRhoName().IsNull()) {
269  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), cent);
270  histtitle = TString::Format("%s;#it{p}_{T,jet}^{corr} (GeV/#it{c});counts", histname.Data());
271  fHistManager.CreateTH1(histname, histtitle, fNbins, -fMaxBinPt / 2, fMaxBinPt / 2);
272  }
273  }
274  }
275 }
276 
284 {
285  DoJetLoop();
286  DoTrackLoop();
287  DoClusterLoop();
288  DoCellLoop();
289 
290  return kTRUE;
291 }
292 
298 {
299  TString histname;
300  TString groupname;
301  AliJetContainer* jetCont = 0;
302  TIter next(&fJetCollArray);
303  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
304  groupname = jetCont->GetName();
305  UInt_t count = 0;
306  for(auto jet : jetCont->accepted()) {
307  if (!jet) continue;
308  count++;
309 
310  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), fCentBin);
311  fHistManager.FillTH1(histname, jet->Pt());
312 
313  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), fCentBin);
314  fHistManager.FillTH1(histname, jet->Area());
315 
316  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), fCentBin);
317  fHistManager.FillTH1(histname, jet->Phi());
318 
319  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), fCentBin);
320  fHistManager.FillTH1(histname, jet->Eta());
321 
322  if (jetCont->GetRhoParameter()) {
323  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), fCentBin);
324  fHistManager.FillTH1(histname, jet->Pt() - jetCont->GetRhoVal() * jet->Area());
325  }
326  }
327  histname = TString::Format("%s/histNJets_%d", groupname.Data(), fCentBin);
328  fHistManager.FillTH1(histname, count);
329  }
330 }
331 
337 {
339 
340  TString histname;
341  TString groupname;
342  AliParticleContainer* partCont = 0;
343  TIter next(&fParticleCollArray);
344  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
345  groupname = partCont->GetName();
346  UInt_t count = 0;
347  for(auto part : partCont->accepted()) {
348  if (!part) continue;
349  count++;
350 
351  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), fCentBin);
352  fHistManager.FillTH1(histname, part->Pt());
353 
354  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), fCentBin);
355  fHistManager.FillTH1(histname, part->Phi());
356 
357  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), fCentBin);
358  fHistManager.FillTH1(histname, part->Eta());
359 
360  if (partCont->GetLoadedClass()->InheritsFrom("AliVTrack")) {
361  const AliVTrack* track = static_cast<const AliVTrack*>(part);
362 
363  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), fCentBin);
364  fHistManager.FillTH1(histname, track->Pt(), track->Eta() - track->GetTrackEtaOnEMCal());
365 
366  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), fCentBin);
367  fHistManager.FillTH1(histname, track->Pt(), track->Phi() - track->GetTrackPhiOnEMCal());
368 
369  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), fCentBin);
370  fHistManager.FillTH1(histname, track->Pt(), track->Pt() - track->GetTrackPtOnEMCal());
371 
372  if (clusCont) {
373  Int_t iCluster = track->GetEMCALcluster();
374  if (iCluster >= 0) {
375  AliVCluster* cluster = clusCont->GetAcceptCluster(iCluster);
376  if (cluster) {
377  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), fCentBin);
378  fHistManager.FillTH2(histname, track->P(), cluster->GetNonLinCorrEnergy() / track->P());
379  }
380  }
381  }
382  }
383  }
384 
385  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), fCentBin);
386  fHistManager.FillTH1(histname, count);
387  }
388 }
389 
395 {
396  TString histname;
397  TString groupname;
398  AliClusterContainer* clusCont = 0;
399  TIter next(&fClusterCollArray);
400  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
401  groupname = clusCont->GetName();
402 
403  for(auto cluster : clusCont->all()) {
404  if (!cluster) continue;
405 
406  if (cluster->GetIsExotic()) {
407  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), fCentBin);
408  fHistManager.FillTH1(histname, cluster->E());
409  }
410  }
411 
412  UInt_t count = 0;
413  for(auto cluster : clusCont->accepted()) {
414  if (!cluster) continue;
415  count++;
416 
417  AliTLorentzVector nPart;
418  cluster->GetMomentum(nPart, fVertex);
419 
420  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), fCentBin);
421  fHistManager.FillTH1(histname, cluster->E());
422 
423  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), fCentBin);
424  fHistManager.FillTH1(histname, cluster->GetNonLinCorrEnergy());
425 
426  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), fCentBin);
427  fHistManager.FillTH1(histname, cluster->GetHadCorrEnergy());
428 
429  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), fCentBin);
430  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
431 
432  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), fCentBin);
433  fHistManager.FillTH1(histname, nPart.Eta());
434  }
435 
436  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), fCentBin);
437  fHistManager.FillTH1(histname, count);
438  }
439 }
440 
446 {
447  if (!fCaloCells) return;
448 
449  TString histname;
450 
451  const Short_t ncells = fCaloCells->GetNumberOfCells();
452 
453  histname = TString::Format("%s/histNCells_%d", fCaloCellsName.Data(), fCentBin);
454  fHistManager.FillTH1(histname, ncells);
455 
456  histname = TString::Format("%s/histCellEnergy_%d", fCaloCellsName.Data(), fCentBin);
457  for (Short_t pos = 0; pos < ncells; pos++) {
458  Double_t amp = fCaloCells->GetAmplitude(pos);
459 
460  fHistManager.FillTH1(histname, amp);
461  }
462 }
463 
469 {
471 }
472 
481 {
482  return kTRUE;
483 }
484 
489 {
490 }
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
Declaration of class AliAnalysisTaskEmcalJetSample.
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
Implementation of a sample jet analysis task.
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
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
THistManager fHistManager
Histogram manager.
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