AliPhysics  95775ff (95775ff)
 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 #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 fHistManager(),
69 fHistNumbJets(),
70 fHistJetPt()
71 {
72 }
73 
80 AliAnalysisTaskEmcalJet(name, kTRUE),
81 fHistManager(name),
82 fHistNumbJets(0),
83 fHistJetPt(0)
84 {
86 }
87 
92 {
93 }
94 
100 {
102 
107 
108  TIter next(fHistManager.GetListOfHistograms());
109  TObject* obj = 0;
110  while ((obj = next())) {
111  fOutput->Add(obj);
112  }
113  fOutput->Add(fHistNumbJets);
114  fOutput->Add(fHistJetPt);
115 
116  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
117 }
118 
119 /*
120  * This function allocates the histograms for basic EMCal cluster QA.
121  * A set of histograms (energy, eta, phi, number of cluster) is allocated
122  * per each cluster container and per each centrality bin.
123  */
125 {
126  TString histname;
127  TString histtitle;
128  TString groupname;
129  AliClusterContainer* clusCont = 0;
130  TIter next(&fClusterCollArray);
131  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
132  groupname = clusCont->GetName();
133  fHistManager.CreateHistoGroup(groupname);
134  for (Int_t cent = 0; cent < fNcentBins; cent++) {
135  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), cent);
136  histtitle = TString::Format("%s;#it{E}_{cluster} (GeV);counts", histname.Data());
137  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
138 
139  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), cent);
140  histtitle = TString::Format("%s;#it{E}_{cluster}^{exotic} (GeV);counts", histname.Data());
141  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
142 
143  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), cent);
144  histtitle = TString::Format("%s;#it{E}_{cluster}^{non-lin.corr.} (GeV);counts", histname.Data());
145  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
146 
147  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), cent);
148  histtitle = TString::Format("%s;#it{E}_{cluster}^{had.corr.} (GeV);counts", histname.Data());
149  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
150 
151  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), cent);
152  histtitle = TString::Format("%s;#it{#phi}_{custer};counts", histname.Data());
153  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
154 
155  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), cent);
156  histtitle = TString::Format("%s;#it{#eta}_{custer};counts", histname.Data());
157  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
158 
159  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), cent);
160  histtitle = TString::Format("%s;number of clusters;events", histname.Data());
161  if (fForceBeamType != kpp) {
162  fHistManager.CreateTH1(histname, histtitle, 500, 0, 3000);
163  }
164  else {
165  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
166  }
167  }
168  }
169 }
170 
171 /*
172  * This function allocates the histograms for basic EMCal QA.
173  * One 2D histogram with the cell energy spectra and the number of cells
174  * per event is allocated per each centrality bin.
175  */
177 {
178  TString histname;
179  TString histtitle;
180  TString groupname(fCaloCellsName);
181 
182  fHistManager.CreateHistoGroup(groupname);
183  for (Int_t cent = 0; cent < fNcentBins; cent++) {
184  histname = TString::Format("%s/histCellEnergy_%d", groupname.Data(), cent);
185  histtitle = TString::Format("%s;#it{E}_{cell} (GeV);counts", histname.Data());
186  fHistManager.CreateTH1(histname, histtitle, 300, 0, 150);
187 
188  histname = TString::Format("%s/histNCells_%d", groupname.Data(), cent);
189  histtitle = TString::Format("%s;number of cells;events", histname.Data());
190  if (fForceBeamType != kpp) {
191  fHistManager.CreateTH1(histname, histtitle, 500, 0, 6000);
192  }
193  else {
194  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
195  }
196  }
197 }
198 
199 /*
200  * This function allocates the histograms for basic tracking QA.
201  * A set of histograms (pT, eta, phi, difference between kinematic properties
202  * at the vertex and at the EMCal surface, number of tracks) is allocated
203  * per each particle container and per each centrality bin.
204  */
206 {
207  TString histname;
208  TString histtitle;
209  TString groupname;
210  AliParticleContainer* partCont = 0;
211  TIter next(&fParticleCollArray);
212  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
213  groupname = partCont->GetName();
214  fHistManager.CreateHistoGroup(groupname);
215  for (Int_t cent = 0; cent < fNcentBins; cent++) {
216  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), cent);
217  histtitle = TString::Format("%s;#it{p}_{T,track} (GeV/#it{c});counts", histname.Data());
218  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt / 2);
219 
220  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), cent);
221  histtitle = TString::Format("%s;#it{#phi}_{track};counts", histname.Data());
222  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
223 
224  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), cent);
225  histtitle = TString::Format("%s;#it{#eta}_{track};counts", histname.Data());
226  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
227 
228  if (TClass(partCont->GetClassName()).InheritsFrom("AliVTrack")) {
229  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), cent);
230  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#eta}_{track}^{vertex} - #it{#eta}_{track}^{EMCal};counts", histname.Data());
231  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 50, -0.5, 0.5);
232 
233  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), cent);
234  histtitle = TString::Format("%s;#it{p}_{T,track}^{vertex} (GeV/#it{c});#it{#phi}_{track}^{vertex} - #it{#phi}_{track}^{EMCal};counts", histname.Data());
235  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, 200, -2, 2);
236 
237  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), cent);
238  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());
239  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, -fMaxBinPt/2, fMaxBinPt/2);
240 
241  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), cent);
242  histtitle = TString::Format("%s;#it{P}_{track} (GeV/#it{c});#it{E}_{cluster} / #it{P}_{track} #it{c};counts", histname.Data());
243  fHistManager.CreateTH2(histname, histtitle, fNbins / 2, fMinBinPt, fMaxBinPt, fNbins / 2, 0, 4);
244  }
245 
246  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), cent);
247  histtitle = TString::Format("%s;number of tracks;events", histname.Data());
248  if (fForceBeamType != kpp) {
249  fHistManager.CreateTH1(histname, histtitle, 500, 0, 5000);
250  }
251  else {
252  fHistManager.CreateTH1(histname, histtitle, 200, 0, 200);
253  }
254  }
255  }
256 }
257 
258 /*
259  * This function allocates the histograms for basic jet QA.
260  * A set of histograms (pT, eta, phi, area, number of jets, corrected pT) is allocated
261  * per each jet container and per each centrality bin.
262  */
264 {
265  TString histname;
266  TString histtitle;
267  TString groupname;
268  AliJetContainer* jetCont = 0;
269  TIter next(&fJetCollArray);
270  while ((jetCont = static_cast<AliJetContainer*>(next()))) {
271  groupname = jetCont->GetName();
272  fHistManager.CreateHistoGroup(groupname);
273  for (Int_t cent = 0; cent < fNcentBins; cent++) {
274  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), cent);
275  histtitle = TString::Format("%s;#it{p}_{T,jet} (GeV/#it{c});counts", histname.Data());
276  fHistManager.CreateTH1(histname, histtitle, fNbins, fMinBinPt, fMaxBinPt);
277 
278  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), cent);
279  histtitle = TString::Format("%s;#it{A}_{jet};counts", histname.Data());
280  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, 3);
281 
282  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), cent);
283  histtitle = TString::Format("%s;#it{#phi}_{jet};counts", histname.Data());
284  fHistManager.CreateTH1(histname, histtitle, fNbins / 2, 0, TMath::TwoPi());
285 
286  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), cent);
287  histtitle = TString::Format("%s;#it{#eta}_{jet};counts", histname.Data());
288  fHistManager.CreateTH1(histname, histtitle, fNbins / 6, -1, 1);
289 
290  histname = TString::Format("%s/histNJets_%d", groupname.Data(), cent);
291  histtitle = TString::Format("%s;number of jets;events", histname.Data());
292  if (fForceBeamType != kpp) {
293  fHistManager.CreateTH1(histname, histtitle, 500, 0, 500);
294  }
295  else {
296  fHistManager.CreateTH1(histname, histtitle, 100, 0, 100);
297  }
298 
299  if (!jetCont->GetRhoName().IsNull()) {
300  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), cent);
301  histtitle = TString::Format("%s;#it{p}_{T,jet}^{corr} (GeV/#it{c});counts", histname.Data());
302  fHistManager.CreateTH1(histname, histtitle, fNbins, -fMaxBinPt / 2, fMaxBinPt / 2);
303  }
304  }
305  }
306 }
307 
315 {
316  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  cout<<"FOUND JET"<<endl;
341 
342  histname = TString::Format("%s/histJetPt_%d", groupname.Data(), fCentBin);
343  fHistManager.FillTH1(histname, jet->Pt());
344 
345  histname = TString::Format("%s/histJetArea_%d", groupname.Data(), fCentBin);
346  fHistManager.FillTH1(histname, jet->Area());
347 
348  histname = TString::Format("%s/histJetPhi_%d", groupname.Data(), fCentBin);
349  fHistManager.FillTH1(histname, jet->Phi());
350 
351  histname = TString::Format("%s/histJetEta_%d", groupname.Data(), fCentBin);
352  fHistManager.FillTH1(histname, jet->Eta());
353 
354  if (jetCont->GetRhoParameter()) {
355  histname = TString::Format("%s/histJetCorrPt_%d", groupname.Data(), fCentBin);
356  fHistManager.FillTH1(histname, jet->Pt() - jetCont->GetRhoVal() * jet->Area());
357  }
358  }
359  histname = TString::Format("%s/histNJets_%d", groupname.Data(), fCentBin);
360  fHistManager.FillTH1(histname, count);
361  }
362 }
363 
369 {
371 
372  TString histname;
373  TString groupname;
374  AliParticleContainer* partCont = 0;
375  TIter next(&fParticleCollArray);
376  while ((partCont = static_cast<AliParticleContainer*>(next()))) {
377  groupname = partCont->GetName();
378  UInt_t count = 0;
379  for(auto part : partCont->accepted()) {
380  if (!part) continue;
381  count++;
382 
383  histname = TString::Format("%s/histTrackPt_%d", groupname.Data(), fCentBin);
384  fHistManager.FillTH1(histname, part->Pt());
385 
386  histname = TString::Format("%s/histTrackPhi_%d", groupname.Data(), fCentBin);
387  fHistManager.FillTH1(histname, part->Phi());
388 
389  histname = TString::Format("%s/histTrackEta_%d", groupname.Data(), fCentBin);
390  fHistManager.FillTH1(histname, part->Eta());
391 
392  if (partCont->GetLoadedClass()->InheritsFrom("AliVTrack")) {
393  const AliVTrack* track = static_cast<const AliVTrack*>(part);
394 
395  histname = TString::Format("%s/fHistDeltaEtaPt_%d", groupname.Data(), fCentBin);
396  fHistManager.FillTH1(histname, track->Pt(), track->Eta() - track->GetTrackEtaOnEMCal());
397 
398  histname = TString::Format("%s/fHistDeltaPhiPt_%d", groupname.Data(), fCentBin);
399  fHistManager.FillTH1(histname, track->Pt(), track->Phi() - track->GetTrackPhiOnEMCal());
400 
401  histname = TString::Format("%s/fHistDeltaPtvsPt_%d", groupname.Data(), fCentBin);
402  fHistManager.FillTH1(histname, track->Pt(), track->Pt() - track->GetTrackPtOnEMCal());
403 
404  if (clusCont) {
405  Int_t iCluster = track->GetEMCALcluster();
406  if (iCluster >= 0) {
407  AliVCluster* cluster = clusCont->GetAcceptCluster(iCluster);
408  if (cluster) {
409  histname = TString::Format("%s/fHistEoverPvsP_%d", groupname.Data(), fCentBin);
410  fHistManager.FillTH2(histname, track->P(), cluster->GetNonLinCorrEnergy() / track->P());
411  }
412  }
413  }
414  }
415  }
416 
417  histname = TString::Format("%s/histNTracks_%d", groupname.Data(), fCentBin);
418  fHistManager.FillTH1(histname, count);
419  }
420 }
421 
427 {
428  TString histname;
429  TString groupname;
430  AliClusterContainer* clusCont = 0;
431  TIter next(&fClusterCollArray);
432  while ((clusCont = static_cast<AliClusterContainer*>(next()))) {
433  groupname = clusCont->GetName();
434 
435  for(auto cluster : clusCont->all()) {
436  if (!cluster) continue;
437 
438  if (cluster->GetIsExotic()) {
439  histname = TString::Format("%s/histClusterEnergyExotic_%d", groupname.Data(), fCentBin);
440  fHistManager.FillTH1(histname, cluster->E());
441  }
442  }
443 
444  UInt_t count = 0;
445  for(auto cluster : clusCont->accepted()) {
446  if (!cluster) continue;
447  count++;
448 
449  AliTLorentzVector nPart;
450  cluster->GetMomentum(nPart, fVertex);
451 
452  histname = TString::Format("%s/histClusterEnergy_%d", groupname.Data(), fCentBin);
453  fHistManager.FillTH1(histname, cluster->E());
454 
455  histname = TString::Format("%s/histClusterNonLinCorrEnergy_%d", groupname.Data(), fCentBin);
456  fHistManager.FillTH1(histname, cluster->GetNonLinCorrEnergy());
457 
458  histname = TString::Format("%s/histClusterHadCorrEnergy_%d", groupname.Data(), fCentBin);
459  fHistManager.FillTH1(histname, cluster->GetHadCorrEnergy());
460 
461  histname = TString::Format("%s/histClusterPhi_%d", groupname.Data(), fCentBin);
462  fHistManager.FillTH1(histname, nPart.Phi_0_2pi());
463 
464  histname = TString::Format("%s/histClusterEta_%d", groupname.Data(), fCentBin);
465  fHistManager.FillTH1(histname, nPart.Eta());
466  }
467 
468  histname = TString::Format("%s/histNClusters_%d", groupname.Data(), fCentBin);
469  fHistManager.FillTH1(histname, count);
470  }
471 }
472 
478 {
479  if (!fCaloCells) return;
480 
481  TString histname;
482 
483  const Short_t ncells = fCaloCells->GetNumberOfCells();
484 
485  histname = TString::Format("%s/histNCells_%d", fCaloCellsName.Data(), fCentBin);
486  fHistManager.FillTH1(histname, ncells);
487 
488  histname = TString::Format("%s/histCellEnergy_%d", fCaloCellsName.Data(), fCentBin);
489  for (Short_t pos = 0; pos < ncells; pos++) {
490  Double_t amp = fCaloCells->GetAmplitude(pos);
491 
492  fHistManager.FillTH1(histname, amp);
493  }
494 }
495 
501 {
503 }
504 
513 {
514  return kTRUE;
515 }
516 
521 {
522 }
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
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