AliPhysics  ff1d528 (ff1d528)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskEmcalJetSpectraQA.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 <TH2F.h>
18 #include <TH3F.h>
19 #include <THnSparse.h>
20 #include <THashList.h>
21 
22 #include <AliAnalysisManager.h>
23 #include <AliVEventHandler.h>
24 
25 #include "AliEmcalJet.h"
26 #include "AliVCluster.h"
27 #include "AliVParticle.h"
28 #include "AliLog.h"
29 #include "AliJetContainer.h"
30 #include "AliClusterContainer.h"
31 #include "AliParticleContainer.h"
32 
34 
35 // Definitions of class AliAnalysisTaskEmcalJetSpectraQA::AliEmcalJetInfo
36 
40  fArea(0),
41  fMCPt(0),
42  fNConstituents(0),
43  fNEF(0),
44  fCent(0),
45  fEP(0),
46  fCorrPt(0),
47  fZ(0),
48  fLeadingPt(0)
49 {
50 }
51 
57  fArea(jet.Area()),
58  fMCPt(jet.MCPt()),
59  fNConstituents(jet.GetNumberOfConstituents()),
60  fNEF(jet.NEF()),
61  fCent(0),
62  fEP(0),
63  fCorrPt(0),
64  fZ(0),
65  fLeadingPt(0)
66 {
67  jet.GetMomentum(*this);
68 }
69 
70 // Definitions of class AliAnalysisTaskEmcalJetSpectraQA
71 
75 
78  AliAnalysisTaskEmcalJetLight("AliAnalysisTaskEmcalJetSpectraQA", kTRUE),
80  fJetEPaxis(kFALSE),
81  fAreaAxis(kTRUE),
82  fPtBinWidth(0.5),
83  fMaxPt(250),
84  fIsEmbedded(kFALSE),
85  fHistManager()
86 
87 {
89 }
90 
95  AliAnalysisTaskEmcalJetLight(name, kTRUE),
96  fHistoType(kTHnSparse),
97  fJetEPaxis(kFALSE),
98  fAreaAxis(kTRUE),
99  fPtBinWidth(0.5),
100  fMaxPt(250),
101  fIsEmbedded(kFALSE),
102  fHistManager(name)
103 {
105 }
106 
111 {
112  AliError("Tree output not implemented. Falling back to THnSparse output");
113  AllocateTHnSparse(jets);
114 }
115 
120 {
121  Double_t jetRadius = jets->GetJetRadius();
122 
123  TString title[30]= {""};
124  Int_t nbins[30] = {0};
125  Double_t min[30] = {0.};
126  Double_t max[30] = {0.};
127  Int_t dim = 0;
128 
129  Int_t nPtBins = TMath::CeilNint(fMaxPt / fPtBinWidth);
130 
131  if (fForceBeamType != kpp) {
132  title[dim] = "Centrality (%)";
133  nbins[dim] = 20;
134  min[dim] = 0;
135  max[dim] = 100;
136  dim++;
137 
138  if (fJetEPaxis) {
139  title[dim] = "#phi_{jet} - #psi_{EP}";
140  nbins[dim] = nPtBins/5;
141  min[dim] = 0;
142  max[dim] = TMath::Pi();
143  dim++;
144  }
145  }
146 
147  title[dim] = "#eta_{jet}";
148  nbins[dim] = nPtBins/10;
149  min[dim] = -1;
150  max[dim] = 1;
151  dim++;
152 
153  title[dim] = "#phi_{jet} (rad)";
154  nbins[dim] = nPtBins/10*3;
155  min[dim] = 0;
156  max[dim] = 2*TMath::Pi();
157  dim++;
158 
159  title[dim] = "#it{p}_{T} (GeV/#it{c})";
160  nbins[dim] = nPtBins;
161  min[dim] = 0;
162  max[dim] = fMaxPt;
163  dim++;
164 
165  if (fIsEmbedded) {
166  title[dim] = "#it{p}_{T}^{MC} (GeV/#it{c})";
167  nbins[dim] = nPtBins;
168  min[dim] = 0;
169  max[dim] = fMaxPt;
170  dim++;
171  }
172 
173  if (fForceBeamType != kpp) {
174  title[dim] = "#it{p}_{T}^{corr} (GeV/#it{c})";
175  nbins[dim] = nPtBins;
176  min[dim] = -fMaxPt/2;
177  max[dim] = fMaxPt/2;
178  dim++;
179  }
180 
181  if (fAreaAxis) {
182  // area resolution is about 0.01 (w/ ghost area 0.005)
183  // for nPtBins = 250 use bin width 0.01
184  title[dim] = "#it{A}_{jet}";
185  nbins[dim] = TMath::CeilNint(2.0*jetRadius*jetRadius*TMath::Pi() / 0.01 * nPtBins / 250);
186  min[dim] = 0;
187  max[dim] = 2.0*jetRadius*jetRadius*TMath::Pi();
188  dim++;
189  }
190 
191  if (fClusterCollArray.size() > 0 && fParticleCollArray.size() > 0) {
192  title[dim] = "NEF";
193  nbins[dim] = nPtBins/5;
194  min[dim] = 0;
195  max[dim] = 1.0;
196  dim++;
197  }
198 
199  title[dim] = "#it{z}_{leading}";
200  nbins[dim] = nPtBins/5;
201  min[dim] = 0;
202  max[dim] = 1.0;
203  dim++;
204 
205  if (fForceBeamType != kpp) {
206  title[dim] = "No. of constituents";
207  nbins[dim] = 125;
208  min[dim] = 0;
209  max[dim] = 250;
210  dim++;
211  }
212  else {
213  title[dim] = "No. of constituents";
214  nbins[dim] = 50;
215  min[dim] = -0.5;
216  max[dim] = 49.5;
217  dim++;
218  }
219 
220  title[dim] = "#it{p}_{T,particle}^{leading} (GeV/#it{c})";
221  nbins[dim] = nPtBins/10*3;
222  min[dim] = 0;
223  max[dim] = 150;
224  dim++;
225 
226  TString histname = TString::Format("%s/fHistJetObservables", jets->GetArrayName().Data());
227  THnSparse* hn = fHistManager.CreateTHnSparse(histname.Data(), histname.Data(), dim, nbins, min, max);
228  for (Int_t i = 0; i < dim; i++) {
229  hn->GetAxis(i)->SetTitle(title[i]);
230  }
231 }
232 
237 {
238  TString histname;
239  TString title;
240 
241  Int_t nPtBins = TMath::CeilNint(fMaxPt / fPtBinWidth);
242 
243  for (Int_t i = 0; i < GetNCentBins(); i++) {
244  histname = TString::Format("%s/fHistJetPtEtaPhi_%d", jets->GetArrayName().Data(), i);
245  title = histname + ";#it{p}_{T} (GeV/#it{c});#eta;#phi (rad)";
246  fHistManager.CreateTH3(histname.Data(), title.Data(), 20, -1, 1, 41, 0, 2*TMath::Pi()*41/40, nPtBins, 0, fMaxPt);
247 
248  histname = TString::Format("%s/fHistJetPtArea_%d", jets->GetArrayName().Data(), i);
249  title = histname + ";#it{p}_{T} (GeV/#it{c});#it{A}_{jet};counts";
250  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 150, 0, 1.5);
251 
252  histname = TString::Format("%s/fHistJetPtEP_%d", jets->GetArrayName().Data(), i);
253  title = histname + ";#it{p}_{T} (GeV/#it{c});#phi_{jet} - #psi_{EP};counts";
254  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 100, 0, TMath::Pi());;
255 
256  histname = TString::Format("%s/fHistJetPtNEF_%d", jets->GetArrayName().Data(), i);
257  title = histname + ";#it{p}_{T} (GeV/#it{c});NEF;counts";
258  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 102, 0, 1.02);
259 
260  histname = TString::Format("%s/fHistJetPtZ_%d", jets->GetArrayName().Data(), i);
261  title = histname + ";#it{p}_{T} (GeV/#it{c});#it{z}_{leading};counts";
262  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 102, 0, 1.02);
263 
264  histname = TString::Format("%s/fHistJetPtLeadingPartPt_%d", jets->GetArrayName().Data(), i);
265  title = histname + ";#it{p}_{T} (GeV/#it{c});#it{p}_{T,particle}^{leading} (GeV/#it{c});counts";
266  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 120, 0, 120);
267 
268  if (!jets->GetRhoName().IsNull()) {
269  histname = TString::Format("%s/fHistJetCorrPtEtaPhi_%d", jets->GetArrayName().Data(), i);
270  title = histname + ";#it{p}_{T,corr} (GeV/#it{c});#eta;#phi (rad)";
271  fHistManager.CreateTH3(histname.Data(), title.Data(), 20, -1, 1, 41, 0, 2*TMath::Pi()*201/200, nPtBins*2, -fMaxPt, fMaxPt);
272 
273  histname = TString::Format("%s/fHistJetCorrPtArea_%d", jets->GetArrayName().Data(), i);
274  title = histname + ";#it{p}_{T,corr} (GeV/#it{c});#it{A}_{jet};counts";
275  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 150, 0, 1.5);
276 
277  histname = TString::Format("%s/fHistJetCorrPtEP_%d", jets->GetArrayName().Data(), i);
278  title = histname + ";#it{p}_{T,corr} (GeV/#it{c});#phi_{jet} - #psi_{EP};counts";
279  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 100, 0, TMath::Pi());;
280 
281  histname = TString::Format("%s/fHistJetCorrPtNEF_%d", jets->GetArrayName().Data(), i);
282  title = histname + ";#it{p}_{T,corr} (GeV/#it{c});NEF;counts";
283  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 102, 0, 1.02);
284 
285  histname = TString::Format("%s/fHistJetCorrPtZ_%d", jets->GetArrayName().Data(), i);
286  title = histname + ";#it{p}_{T,corr} (GeV/#it{c});#it{z}_{leading};counts";
287  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 102, 0, 1.02);
288 
289  histname = TString::Format("%s/fHistJetCorrPtLeadingPartPt_%d", jets->GetArrayName().Data(), i);
290  title = histname + ";#it{p}_{T,corr} (GeV/#it{c});#it{p}_{T,particle}^{leading} (GeV/#it{c});counts";
291  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, 120, 0, 120);
292 
293  histname = TString::Format("%s/fHistJetPtCorrPt_%d", jets->GetArrayName().Data(), i);
294  title = histname + ";#it{p}_{T} (GeV/#it{c});#it{p}_{T,corr} (GeV/#it{c});counts";
295  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins*2, -fMaxPt, fMaxPt);
296 
297  if (fIsEmbedded) {
298  histname = TString::Format("%s/fHistJetMCPtCorrPt_%d", jets->GetArrayName().Data(), i);
299  title = histname + ";#it{p}_{T,MC} (GeV/#it{c});#it{p}_{T,corr} (GeV/#it{c});counts";
300  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins*2, -fMaxPt, fMaxPt);
301  }
302  }
303 
304  if (fIsEmbedded) {
305  histname = TString::Format("%s/fHistJetPtMCPt_%d", jets->GetArrayName().Data(), i);
306  title = histname + ";#it{p}_{T} (GeV/#it{c});#it{p}_{T,MC} (GeV/#it{c});counts";
307  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins, 0, fMaxPt, nPtBins, 0, fMaxPt);
308  }
309  }
310 }
311 
314 {
316 
317  Int_t constituentsNbins = 250;
318  Double_t constituentsMax = 249.5;
319 
320  Int_t nPtBins = TMath::CeilNint(fMaxPt / fPtBinWidth);
321 
322  if (fForceBeamType == kpp) {
323  constituentsNbins = 50;
324  constituentsMax = 49.5;
325  }
326 
327  TString histname;
328  TString title;
329 
330  for (auto cont_it : fJetCollArray) {
331  AliJetContainer* jets = cont_it.second;
332  fHistManager.CreateHistoGroup(jets->GetArrayName());
333 
334  switch (fHistoType) {
335  case kTH2:
336  AllocateTHX(jets);
337  break;
338  case kTHnSparse:
339  AllocateTHnSparse(jets);
340  break;
341  case kTTree:
342  AllocateTTree(jets);
343  break;
344  }
345 
346  TString histname;
347 
348  for (Int_t i = 0; i < GetNCentBins(); i++) {
349  if (jets->GetParticleContainer()) {
350  histname = TString::Format("%s/fHistTracksJetPt_%d", jets->GetArrayName().Data(), i);
351  title = histname + ";#it{p}_{T,track} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c});counts";
352  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins / 2, 0, fMaxPt / 2, nPtBins, 0, fMaxPt);
353 
354  histname = TString::Format("%s/fHistTracksPtDist_%d", jets->GetArrayName().Data(), i);
355  title = histname + ";#it{p}_{T,track} (GeV/#it{c});#it{d};counts";
356  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins / 2, 0, fMaxPt / 2, 100, 0, 5);
357 
358  histname = TString::Format("%s/fHistTracksZJetPtJetConst_%d", jets->GetArrayName().Data(), i);
359  title = histname + ";#it{z}_{track} (GeV/#it{c});#it{d};No. of constituents";
360  fHistManager.CreateTH3(histname.Data(), title.Data(), 120, 0.0, 1.2, nPtBins, 0, fMaxPt, constituentsNbins, -0.5, constituentsMax);
361  }
362 
363  if (jets->GetClusterContainer()) {
364  histname = TString::Format("%s/fHistClustersJetPt_%d", jets->GetArrayName().Data(), i);
365  title = histname + ";#it{p}_{T,cluster} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c});counts";
366  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins / 2, 0, fMaxPt / 2, nPtBins, 0, fMaxPt);
367 
368  histname = TString::Format("%s/fHistClustersPtDist_%d", jets->GetArrayName().Data(), i);
369  title = histname + ";#it{p}_{T,cluster} (GeV/#it{c});#it{d};counts";
370  fHistManager.CreateTH2(histname.Data(), title.Data(), nPtBins / 2, 0, fMaxPt / 2, 100, 0, 5);
371 
372  histname = TString::Format("%s/fHistClustersZJetPtJetConst_%d", jets->GetArrayName().Data(), i);
373  title = histname + ";#it{z}_{cluster} (GeV/#it{c});#it{p}_{T,jet} (GeV/#it{c});No. of constituents";
374  fHistManager.CreateTH3(histname.Data(), title.Data(), 120, 0.0, 1.2, nPtBins, 0, fMaxPt, constituentsNbins, -0.5, constituentsMax);
375  }
376 
377  histname = TString::Format("%s/fHistRejectionReason_%d", jets->GetArrayName().Data(), i);
378  title = histname + ";Rejection reason;#it{p}_{T,jet} (GeV/#it{c});counts";
379  TH2* hist = fHistManager.CreateTH2(histname.Data(), title.Data(), 32, 0, 32, 100, 0, 250);
380  SetRejectionReasonLabels(hist->GetXaxis());
381  }
382 
383  if (!jets->GetRhoName().IsNull()) {
384  histname = TString::Format("%s/fHistRhoVsCent", jets->GetArrayName().Data());
385  title = histname + ";Centrality (%);#rho (GeV/#it{c});counts";
386  fHistManager.CreateTH2(histname.Data(), title.Data(), 101, 0, 101, 100, 0, 500);
387  }
388  }
389 
390  TIter nextElement(fHistManager.GetListOfHistograms());
391  TObject* obj = 0;
392  while ((obj = nextElement())) fOutput->Add(obj);
393  PostData(1, fOutput);
394 }
395 
400 {
401  TString histname;
402 
403  for (auto cont_it : fJetCollArray) {
404  AliJetContainer* jets = cont_it.second;
405  Double_t rhoVal = 0;
406  if (jets->GetRhoParameter()) {
407  rhoVal = jets->GetRhoVal();
408  histname = TString::Format("%s/fHistRhoVsCent", jets->GetArrayName().Data());
409  fHistManager.FillTH2(histname.Data(), fCent, rhoVal);
410  }
411 
412  for (auto jet : jets->accepted()) {
413 
414  UInt_t rejectionReason = 0;
415  if (!jets->AcceptJet(jet, rejectionReason)) {
416  histname = TString::Format("%s/fHistRejectionReason_%d", jets->GetArrayName().Data(), fCentBin);
417  fHistManager.FillTH2(histname.Data(), jets->GetRejectionReasonBitPosition(rejectionReason), jet->Pt());
418  continue;
419  }
420 
421  Float_t ptLeading = jets->GetLeadingHadronPt(jet);
422  Float_t corrPt = jet->Pt() - rhoVal * jet->Area();
423 
424  TLorentzVector leadPart;
425 
426  jets->GetLeadingHadronMomentum(leadPart, jet);
427 
428  // Fill THnSparse
429  Double_t ep = jet->Phi() - fEPV0;
430  while (ep < 0) ep += TMath::Pi();
431  while (ep >= TMath::Pi()) ep -= TMath::Pi();
432 
433  Double_t z = GetParallelFraction(leadPart.Vect(), jet);
434  if (z == 1 || (z > 1 && z - 1 < 1e-3)) z = 0.999; // so that it will contribute to the bin 0.9-1 rather than 1-1.1
435 
436  AliEmcalJetInfo jetInfo(*jet);
437  jetInfo.fCent = fCent;
438  jetInfo.fEP = ep;
439  jetInfo.fCorrPt = corrPt;
440  jetInfo.fZ = z;
441  jetInfo.fLeadingPt = ptLeading;
442 
443  FillJetHisto(jetInfo, jets);
444 
445  AliParticleContainer* tracks = jets->GetParticleContainer();
446  if (tracks) {
447  for (Int_t it = 0; it < jet->GetNumberOfTracks(); it++) {
448  AliVParticle *track = jet->TrackAt(it, tracks->GetArray());
449  if (track) {
450  histname = TString::Format("%s/fHistTracksJetPt_%d", jets->GetArrayName().Data(), fCentBin);
451  fHistManager.FillTH2(histname.Data(), track->Pt(), jet->Pt());
452 
453  Double_t dphi = TVector2::Phi_0_2pi(track->Phi() - jet->Phi());
454  Double_t deta = track->Eta() - jet->Eta();
455  Double_t dist = TMath::Sqrt(deta * deta + dphi * dphi);
456 
457  histname = TString::Format("%s/fHistTracksPtDist_%d", jets->GetArrayName().Data(), fCentBin);
458  fHistManager.FillTH2(histname.Data(), track->Pt(), dist);
459 
460  histname = TString::Format("%s/fHistTracksZJetPtJetConst_%d", jets->GetArrayName().Data(), fCentBin);
461  fHistManager.FillTH3(histname.Data(), GetParallelFraction(track, jet), jet->Pt(), jet->GetNumberOfConstituents());
462  }
463  }
464  }
465 
466  AliClusterContainer* clusters = jets->GetClusterContainer();
467  if (clusters) {
468  for (Int_t ic = 0; ic < jet->GetNumberOfClusters(); ic++) {
469  AliVCluster *cluster = jet->ClusterAt(ic, clusters->GetArray());
470 
471  if (cluster) {
472  TLorentzVector nPart;
473  if (clusters->GetDefaultClusterEnergy() >=0 && clusters->GetDefaultClusterEnergy() < AliVCluster::kLastUserDefEnergy) {
474  cluster->GetMomentum(nPart, fVertex, (AliVCluster::VCluUserDefEnergy_t)clusters->GetDefaultClusterEnergy());
475  }
476  else {
477  cluster->GetMomentum(nPart, fVertex);
478  }
479 
480  histname = TString::Format("%s/fHistClustersJetPt_%d", jets->GetArrayName().Data(), fCentBin);
481  fHistManager.FillTH2(histname.Data(), nPart.Pt(), jet->Pt());
482 
483  Double_t dphi = TVector2::Phi_0_2pi(nPart.Phi() - jet->Phi());
484  Double_t deta = nPart.Eta() - jet->Eta();
485  Double_t dist = TMath::Sqrt(deta * deta + dphi * dphi);
486 
487  histname = TString::Format("%s/fHistClustersPtDist_%d", jets->GetArrayName().Data(), fCentBin);
488  fHistManager.FillTH2(histname.Data(), nPart.Pt(), dist);
489 
490  histname = TString::Format("%s/fHistClustersZJetPtJetConst_%d", jets->GetArrayName().Data(), fCentBin);
491  fHistManager.FillTH3(histname.Data(), GetParallelFraction(nPart.Vect(), jet), jet->Pt(), jet->GetNumberOfConstituents());
492  }
493  }
494  }
495  } //jet loop
496  }
497  return kTRUE;
498 }
499 
505 {
506  TString histname;
507 
508  histname = TString::Format("%s/fHistJetPtEtaPhi_%d", jets->GetArrayName().Data(), fCentBin);
509  fHistManager.FillTH3(histname.Data(), jet.Eta(), jet.Phi_0_2pi(), jet.Pt());
510 
511  histname = TString::Format("%s/fHistJetPtArea_%d", jets->GetArrayName().Data(), fCentBin);
512  fHistManager.FillTH2(histname.Data(), jet.Pt(), jet.fArea);
513 
514  histname = TString::Format("%s/fHistJetPtEP_%d", jets->GetArrayName().Data(), fCentBin);
515  fHistManager.FillTH2(histname.Data(), jet.Pt(), jet.fEP);
516 
517  histname = TString::Format("%s/fHistJetPtNEF_%d", jets->GetArrayName().Data(), fCentBin);
518  fHistManager.FillTH2(histname.Data(), jet.Pt(), jet.fNEF);
519 
520  histname = TString::Format("%s/fHistJetPtZ_%d", jets->GetArrayName().Data(), fCentBin);
521  fHistManager.FillTH2(histname.Data(), jet.Pt(), jet.fZ);
522 
523  histname = TString::Format("%s/fHistJetPtLeadingPartPt_%d", jets->GetArrayName().Data(), fCentBin);
524  fHistManager.FillTH2(histname.Data(), jet.Pt(), jet.fLeadingPt);
525 
526  if (fIsEmbedded) {
527  histname = TString::Format("%s/fHistJetPtMCPt_%d", jets->GetArrayName().Data(), fCentBin);
528  fHistManager.FillTH2(histname.Data(), jet.Pt(), jet.fMCPt);
529  }
530 
531  if (!jets->GetRhoName().IsNull()) {
532  histname = TString::Format("%s/fHistJetCorrPtEtaPhi_%d", jets->GetArrayName().Data(), fCentBin);
533  fHistManager.FillTH3(histname.Data(), jet.Eta(), jet.Phi_0_2pi(), jet.fCorrPt);
534 
535  histname = TString::Format("%s/fHistJetCorrPtArea_%d", jets->GetArrayName().Data(), fCentBin);
536  fHistManager.FillTH2(histname.Data(), jet.fCorrPt, jet.fArea);
537 
538  histname = TString::Format("%s/fHistJetCorrPtEP_%d", jets->GetArrayName().Data(), fCentBin);
539  fHistManager.FillTH2(histname.Data(), jet.fCorrPt, jet.fEP);
540 
541  histname = TString::Format("%s/fHistJetCorrPtNEF_%d", jets->GetArrayName().Data(), fCentBin);
542  fHistManager.FillTH2(histname.Data(), jet.fCorrPt, jet.fNEF);
543 
544  histname = TString::Format("%s/fHistJetCorrPtZ_%d", jets->GetArrayName().Data(), fCentBin);
545  fHistManager.FillTH2(histname.Data(), jet.fCorrPt, jet.fZ);
546 
547  histname = TString::Format("%s/fHistJetCorrPtLeadingPartPt_%d", jets->GetArrayName().Data(), fCentBin);
548  fHistManager.FillTH2(histname.Data(), jet.fCorrPt, jet.fLeadingPt);
549 
550  histname = TString::Format("%s/fHistJetPtCorrPt_%d", jets->GetArrayName().Data(), fCentBin);
551  fHistManager.FillTH2(histname.Data(), jet.Pt(), jet.fCorrPt);
552 
553  if (fIsEmbedded) {
554  histname = TString::Format("%s/fHistJetMCPtCorrPt_%d", jets->GetArrayName().Data(), fCentBin);
555  fHistManager.FillTH2(histname.Data(), jet.fMCPt, jet.fCorrPt);
556  }
557  }
558 }
559 
565 {
566  AliError("Tree output not implemented. Falling back to THnSparse output");
567  FillTHnSparse(jet, jets);
568 }
569 
575 {
576  TString histname;
577  Double_t contents[30]={0};
578 
579  histname = TString::Format("%s/fHistJetObservables", jets->GetArrayName().Data());
580  THnSparse* histJetObservables = static_cast<THnSparse*>(fHistManager.FindObject(histname));
581 
582  if (!histJetObservables) return;
583 
584  for (Int_t i = 0; i < histJetObservables->GetNdimensions(); i++) {
585  TString title(histJetObservables->GetAxis(i)->GetTitle());
586  if (title=="Centrality (%)")
587  contents[i] = jet.fCent;
588  else if (title=="#phi_{jet} - #psi_{EP}")
589  contents[i] = jet.fEP;
590  else if (title=="#eta_{jet}")
591  contents[i] = jet.Eta();
592  else if (title=="#phi_{jet} (rad)")
593  contents[i] = jet.Phi_0_2pi();
594  else if (title=="#it{p}_{T} (GeV/#it{c})")
595  contents[i] = jet.Pt();
596  else if (title=="#it{p}_{T}^{MC} (GeV/#it{c})")
597  contents[i] = jet.fMCPt;
598  else if (title=="#it{p}_{T}^{corr} (GeV/#it{c})")
599  contents[i] = jet.fCorrPt;
600  else if (title=="#it{A}_{jet}")
601  contents[i] = jet.fArea;
602  else if (title=="NEF")
603  contents[i] = jet.fNEF;
604  else if (title=="#it{z}_{leading}")
605  contents[i] = jet.fZ;
606  else if (title=="No. of constituents")
607  contents[i] = jet.fNConstituents;
608  else if (title=="#it{p}_{T,particle}^{leading} (GeV/#it{c})")
609  contents[i] = jet.fLeadingPt;
610  else
611  AliWarning(Form("Unable to fill dimension %s!",title.Data()));
612  }
613 
614  histJetObservables->Fill(contents);
615 }
616 
622 {
623  switch (fHistoType) {
624  case kTH2:
625  FillTHX(jet, jets);
626  break;
627 
628  case kTHnSparse:
629  FillTHnSparse(jet, jets);
630  break;
631 
632  case kTTree:
633  FillTTree(jet, jets);
634  break;
635  }
636 }
637 
647  Double_t trackPtCut, Double_t clusECut, TString suffix)
648 {
649  // Get the pointer to the existing analysis manager via the static access method.
650  AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
651  if (!mgr) {
652  ::Error("AddTaskEmcalJetSpectraQA", "No analysis manager to connect to.");
653  return nullptr;
654  }
655 
656  // Check the analysis type using the event handlers connected to the analysis manager.
657  AliVEventHandler* handler = mgr->GetInputEventHandler();
658  if (!handler) {
659  ::Error("AddTaskEmcalJetSpectraQA", "This task requires an input event handler");
660  return nullptr;
661  }
662 
663  EDataType_t dataType = kUnknownDataType;
664 
665  if (handler->InheritsFrom("AliESDInputHandler")) {
666  dataType = kESD;
667  }
668  else if (handler->InheritsFrom("AliAODInputHandler")) {
669  dataType = kAOD;
670  }
671 
672  // Init the task and do settings
673 
674  if (trackName == "usedefault") {
675  if (dataType == kESD) {
676  trackName = "Tracks";
677  }
678  else if (dataType == kAOD) {
679  trackName = "tracks";
680  }
681  else {
682  trackName = "";
683  }
684  }
685 
686  if (clusName == "usedefault") {
687  if (dataType == kESD) {
688  clusName = "CaloClusters";
689  }
690  else if (dataType == kAOD) {
691  clusName = "caloClusters";
692  }
693  else {
694  clusName = "";
695  }
696  }
697 
698  TString name("AliAnalysisTaskEmcalJetSpectraQA");
699  if (strcmp(suffix,"")) {
700  name += "_";
701  name += suffix;
702  }
703 
705  jetTask->SetVzRange(-10,10);
706  jetTask->SetNeedEmcalGeom(kFALSE);
707  AliParticleContainer *partCont = jetTask->AddParticleContainer(trackName.Data());
708  if (partCont) partCont->SetParticlePtCut(trackPtCut);
709 
710  AliClusterContainer *clusterCont = jetTask->AddClusterContainer(clusName.Data());
711  if (clusterCont) {
712  clusterCont->SetClusECut(0.);
713  clusterCont->SetClusPtCut(0.);
714  clusterCont->SetClusHadCorrEnergyCut(clusECut);
715  clusterCont->SetDefaultClusterEnergy(AliVCluster::kHadCorr);
716  }
717 
718  // Final settings, pass to manager and set the containers
719  mgr->AddTask(jetTask);
720 
721  // Create containers for input/output
722  AliAnalysisDataContainer *cinput1 = mgr->GetCommonInputContainer() ;
723  TString contname(name);
724  contname += "_histos";
725  AliAnalysisDataContainer *coutput1 = mgr->CreateContainer(contname.Data(),
726  TList::Class(),AliAnalysisManager::kOutputContainer,
727  Form("%s", AliAnalysisManager::GetCommonFileName()));
728  mgr->ConnectInput (jetTask, 0, cinput1 );
729  mgr->ConnectOutput (jetTask, 1, coutput1 );
730 
731  return jetTask;
732 }
Declaration of class AliAnalysisTaskEmcalJetSpectraQA.
AliClusterContainer * AddClusterContainer(std::string branchName, std::string contName="")
THashList * CreateHistoGroup(const char *groupname)
Create a new group of histograms within a parent group.
void SetParticlePtCut(Double_t cut)
Double_t GetRhoVal() const
const TString & GetRhoName() const
double Double_t
Definition: External.C:58
EDataType_t
Switch for the data type.
const char * title
Definition: MakeQAPdf.C:26
static AliAnalysisTaskEmcalJetSpectraQA * AddTaskEmcalJetSpectraQA(TString ntracks="usedefault", TString nclusters="usedefault", Double_t trackPtCut=0.15, Double_t clusECut=0.30, TString suffix="")
Double_t fEPV0
!event plane V0
Float_t fPtBinWidth
Histogram pt bin width.
void FillTH2(const char *hname, double x, double y, double weight=1., Option_t *opt="")
Fill a 2D histogram within the container.
virtual void FillTHX(const AliEmcalJetInfo &jetInfo, const AliJetContainer *jets)
virtual void FillTHnSparse(const AliEmcalJetInfo &jetInfo, const AliJetContainer *jets)
AliClusterContainer * GetClusterContainer() const
void FillTH3(const char *hname, double x, double y, double z, double weight=1., Option_t *opt="")
Fill a 3D histogram within the container.
virtual Bool_t AcceptJet(Int_t i, UInt_t &rejectionReason) const
void UserCreateOutputObjects()
Overloads base class method. Creates output objects.
Container for particles within the EMCAL framework.
Int_t GetDefaultClusterEnergy() const
virtual void AllocateTTree(const AliJetContainer *jets)
void GetMomentum(TLorentzVector &vec) const
EBeamType_t fForceBeamType
forced beam type
const Int_t nPtBins
AliParticleContainer * GetParticleContainer() const
void GetLeadingHadronMomentum(TLorentzVector &mom, const AliEmcalJet *jet) const
void FillJetHisto(const AliEmcalJetInfo &jetInfo, const AliJetContainer *jets)
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.
TObject * FindObject(const char *name) const
Find an object inside the container.
int Int_t
Definition: External.C:63
THistManager fHistManager
Histogram manager.
unsigned int UInt_t
Definition: External.C:33
THashList * GetListOfHistograms() const
Get the list of histograms.
Definition: THistManager.h:671
Double_t GetLeadingHadronPt(const AliEmcalJet *jet) const
float Float_t
Definition: External.C:68
Double_t Phi_0_2pi() const
Double_t fVertex[3]
!event vertex
virtual void FillTTree(const AliEmcalJetInfo &jetInfo, const AliJetContainer *jets)
Base task in the EMCAL jet framework (lighter version of AliAnalysisTaskEmcalJet) ...
Int_t fCentBin
!event centrality bin
Bool_t fJetEPaxis
whether a EP-jet axis should be included in the THnSparse
Bool_t fAreaAxis
whether the area axis should be included
AliRhoParameter * GetRhoParameter()
AliParticleContainer * AddParticleContainer(std::string branchName, std::string contName="")
Float_t GetJetRadius() const
Definition: External.C:220
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
std::map< std::string, AliParticleContainer * > fParticleCollArray
particle/track collection array
void SetVzRange(Double_t min, Double_t max)
Bool_t GetMomentum(TLorentzVector &mom, const AliVCluster *vc, Double_t mass) const
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:44
void SetClusPtCut(Double_t cut)
AliAnalysisTaskEmcalJetSpectraQA()
Default constructor for ROOT I/O purposes.
std::map< std::string, AliJetContainer * > fJetCollArray
jet collection array
const Int_t nbins
const AliJetIterableContainer accepted() const
bool Bool_t
Definition: External.C:53
void SetClusECut(Double_t cut)
void SetDefaultClusterEnergy(Int_t d)
std::map< std::string, AliClusterContainer * > fClusterCollArray
cluster collection array
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.
virtual void AllocateTHnSparse(const AliJetContainer *jets)
virtual void AllocateTHX(const AliJetContainer *jets)
Double_t fCent
!event centrality
Container for jet within the EMCAL jet framework.
Implementation of a task to perform QA on jet spectra.
TH3 * CreateTH3(const char *name, const char *title, int nbinsx, double xmin, double xmax, int nbinsy, double ymin, double ymax, int nbinsz, double zmin, double zmax, Option_t *opt="")
Create a new TH2 within the container.
void SetClusHadCorrEnergyCut(Double_t cut)
static Double_t GetParallelFraction(AliVParticle *part1, AliVParticle *part2)