AliPhysics  251aa1e (251aa1e)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskChargedJetsHadronCF.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: R. Haake. *
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 <algorithm>
17 #include <vector>
18 #include <TClonesArray.h>
19 #include <TF1.h>
20 #include <TH1F.h>
21 #include <TH2F.h>
22 #include <TH3F.h>
23 #include <THn.h>
24 #include <TTree.h>
25 #include <TList.h>
26 #include <TLorentzVector.h>
27 
28 #include "AliEmcalPythiaInfo.h"
29 
30 #include "AliVTrack.h"
31 #include "AliVHeader.h"
32 #include "AliEmcalJet.h"
33 #include "AliRhoParameter.h"
34 #include "AliLog.h"
35 #include "AliJetContainer.h"
36 #include "AliTrackContainer.h"
37 #include "AliAODTrack.h"
38 #include "AliPicoTrack.h"
39 #include "AliVParticle.h"
40 #include "TRandom3.h"
42 
44 
45 //________________________________________________________________________
47 {
48 // dummy destructor
49 }
50 
51 //________________________________________________________________________
53 {
54 // dummy destructor
55 }
56 
57 //________________________________________________________________________
59 {
60 // dummy destructor
61 }
62 
66 //________________________________________________________________________
69  fJetsCont(0),
70  fTracksCont(0),
71  fJetsTree(0),
72  fJetsTreeBuffer(0),
73  fExtractionPercentage(0),
74  fExtractionMinPt(0),
75  fExtractionMaxPt(0),
76  fEventExtractionPercentage(0),
77  fEventExtractionMinJetPt(0),
78  fEventExtractionMaxJetPt(0),
79  fConstPtFilterBit(1024),
80  fNumberOfCentralityBins(10),
81  fJetsOutput(),
82  fTracksOutput(),
83  fJetParticleArrayName("JetsDPhiBasicParticles"),
84  fTrackParticleArrayName(""),
85  fJetEmbeddingArray(),
86  fJetEmbeddingArrayName(""),
87  fJetEmbeddingTrackArrayName(""),
88  fJetEmbeddingMaxDistance(0.3),
89  fJetEmbeddingNumMatchedJets(2),
90  fJetEmbeddingUsePerTrackMCPercentage(kTRUE),
91  fJetEmbeddingUseBgrdForMCPercentage(kFALSE),
92  fJetEmbeddingCuts(),
93  fJetVetoArray(),
94  fJetVetoArrayName(""),
95  fJetVetoMinPt(0),
96  fJetVetoMaxPt(0),
97  fJetVetoJetByJet(0),
98  fMatchedJets(),
99  fRandom(0),
100  fJetOutputMode(0),
101  fPythiaExtractionMode(0),
102  fLeadingJet(0),
103  fSubleadingJet(0),
104  fInitialPartonMatchedJet1(0),
105  fInitialPartonMatchedJet2(0),
106  fAcceptedJets(0),
107  fAcceptedTracks(0)
108 {
109  // Default constructor.
110  SetMakeGeneralHistograms(kTRUE);
111  fRandom = new TRandom3(0);
112 }
113 
114 
115 //________________________________________________________________________
117  AliAnalysisTaskEmcalJet(name, kTRUE),
118  fJetsCont(0),
119  fTracksCont(0),
120  fJetsTree(0),
121  fJetsTreeBuffer(0),
122  fExtractionPercentage(0),
123  fExtractionMinPt(0),
124  fExtractionMaxPt(0),
125  fEventExtractionPercentage(0),
126  fEventExtractionMinJetPt(0),
127  fEventExtractionMaxJetPt(0),
128  fConstPtFilterBit(1024),
129  fNumberOfCentralityBins(10),
130  fJetsOutput(),
131  fTracksOutput(),
132  fJetParticleArrayName("JetsDPhiBasicParticles"),
133  fTrackParticleArrayName(""),
134  fJetEmbeddingArray(),
135  fJetEmbeddingArrayName(""),
136  fJetEmbeddingTrackArrayName(""),
137  fJetEmbeddingMaxDistance(0.3),
138  fJetEmbeddingNumMatchedJets(2),
139  fJetEmbeddingUsePerTrackMCPercentage(kTRUE),
140  fJetEmbeddingUseBgrdForMCPercentage(kFALSE),
141  fJetEmbeddingCuts(),
142  fJetVetoArray(),
143  fJetVetoArrayName(""),
144  fJetVetoMinPt(0),
145  fJetVetoMaxPt(0),
146  fJetVetoJetByJet(0),
147  fMatchedJets(),
148  fRandom(0),
149  fJetOutputMode(0),
150  fPythiaExtractionMode(0),
151  fLeadingJet(0),
152  fSubleadingJet(0),
153  fInitialPartonMatchedJet1(0),
154  fInitialPartonMatchedJet2(0),
155  fAcceptedJets(0),
156  fAcceptedTracks(0)
157 {
158  // Constructor
160  fRandom = new TRandom3(0);
161 }
162 
163 //________________________________________________________________________
165 {
166  // Destructor.
167 }
168 
169 //________________________________________________________________________
171 {
173 
174  // ### Basic container settings
176  if(fJetsCont) { //get particles connected to jets
177  fJetsCont->PrintCuts();
179  } else { //no jets, just analysis tracks
181  }
182  if(fTracksCont) fTracksCont->SetClassName("AliVTrack");
183 
184  // ### Create all histograms
185  fHistEventRejection->GetXaxis()->SetBinLabel(15,"JetVeto");
186 
187  // Track QA plots
188  AddHistogram2D<TH2D>("hTrackPt", "Tracks p_{T} distribution", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)", "Centrality", "dN^{Tracks}/dp_{T}");
189  AddHistogram2D<TH2D>("hTrackPhi", "Track angular distribution in #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Tracks}/(d#phi)");
190  AddHistogram2D<TH2D>("hTrackEta", "Track angular distribution in #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta", "Centrality", "dN^{Tracks}/(d#eta)");
191  AddHistogram2D<TH2D>("hTrackPhiEta", "Track angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Tracks}/d#phi d#eta");
192 
193  AddHistogram2D<TH2D>("hLeadingTrackPt", "Leading tracks p_{T} distribution", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)", "Centrality", "dN^{Tracks}/dp_{T}");
194  AddHistogram2D<TH2D>("hLeadingTrackPhi", "Leading tracks angular distribution in #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Tracks}/(d#phi)");
195  AddHistogram2D<TH2D>("hLeadingTrackEta", "Leading tracks angular distribution in #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta", "Centrality", "dN^{Tracks}/(d#eta)");
196  AddHistogram2D<TH2D>("hLeadingTrackPhiEta", "Track angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Tracks}/d#phi d#eta");
197 
198  AddHistogram2D<TH2D>("hTrackEtaPt", "Track angular distribution in #eta vs. p_{T}", "LEGO2", 100, -2.5, 2.5, 300, 0., 300., "#eta", "p_{T} (GeV/c)", "dN^{Tracks}/(d#eta dp_{T})");
199  AddHistogram2D<TH2D>("hTrackPhiPt", "Track angular distribution in #phi vs. p_{T}", "LEGO2", 180, 0, 2*TMath::Pi(), 300, 0., 300., "#phi", "p_{T} (GeV/c)", "dN^{Tracks}/(d#phi dp_{T})");
200 
201  // Create plots for each embedding cut
202  for(Int_t i = -1; i<static_cast<Int_t>(fJetEmbeddingCuts.size()); i++)
203  {
204  const char* appendix = "";
205  if(i>-1)
206  {
208  appendix = Form("_%s", currentCut.fCutName.Data());
209 
210  // Don't double-add cuts
211  if( static_cast<TH1*>(fOutput->FindObject(Form("hJetPtRaw%s", appendix))) )
212  continue;
213  }
214  // Jet QA plots
215  AddHistogram2D<TH2D>(Form("hJetPtRaw%s", appendix), "Jets p_{T} distribution (no bgrd. corr.)", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
216  AddHistogram2D<TH2D>(Form("hJetPt%s", appendix), "Jets p_{T} distribution (background subtracted)", "", 400, -100., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
217  AddHistogram2D<TH2D>(Form("hJetPhi%s", appendix), "Jet angular distribution #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Jets}/d#phi");
218  AddHistogram2D<TH2D>(Form("hJetEta%s", appendix), "Jet angular distribution #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta","Centrality","dN^{Jets}/d#eta");
219  AddHistogram2D<TH2D>(Form("hJetPhiPt%s", appendix), "Jet angular distribution #phi vs. p_{T}", "LEGO2", 180, 0., 2*TMath::Pi(), 400, -100., 300., "#phi", "p_{T, jet} (GeV/c)", "dN^{Jets}/d#phi dp_{T}");
220  AddHistogram2D<TH2D>(Form("hJetEtaPt%s", appendix), "Jet angular distribution #eta vs. p_{T}", "LEGO2", 100, -2.5, 2.5, 400, -100., 300., "#eta","p_{T, jet} (GeV/c)","dN^{Jets}/d#eta dp_{T}");
221  AddHistogram2D<TH2D>(Form("hJetPhiEta%s", appendix), "Jet angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Jets}/d#phi d#eta");
222  AddHistogram2D<TH2D>(Form("hJetArea%s", appendix), "Jet area", "LEGO2", 200, 0., 2., fNumberOfCentralityBins, 0, 100, "Jet A", "Centrality", "dN^{Jets}/dA");
223  AddHistogram2D<TH2D>(Form("hJetAreaPt%s", appendix), "Jet area vs. p_{T}", "LEGO2", 200, 0., 2., 400, -100., 300., "Jet A", "p_{T, jet} (GeV/c)", "dN^{Jets}/dA dp_{T}");
224  AddHistogram2D<TH2D>(Form("hJetPtLeadingHadron%s", appendix), "Jet leading hadron p_{T} distribution vs. jet p_{T}", "", 300, 0., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T,lead had} (GeV/c)", "dN^{Jets}/dp_{T}dp_{T,had}");
225 
226  // Leading/subleading ...
227  AddHistogram2D<TH2D>(Form("hLeadingJetPtRaw%s", appendix), "Jets p_{T} distribution (no bgrd. corr.)", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
228  AddHistogram2D<TH2D>(Form("hLeadingJetPt%s", appendix), "Jets p_{T} distribution (background subtracted)", "", 400, -100., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
229  AddHistogram2D<TH2D>(Form("hLeadingJetPhi%s", appendix), "Jet angular distribution #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Jets}/d#phi");
230  AddHistogram2D<TH2D>(Form("hLeadingJetEta%s", appendix), "Jet angular distribution #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta","Centrality","dN^{Jets}/d#eta");
231  AddHistogram2D<TH2D>(Form("hLeadingJetPhiPt%s", appendix), "Jet angular distribution #phi vs. p_{T}", "LEGO2", 180, 0., 2*TMath::Pi(), 400, -100., 300., "#phi", "p_{T, jet} (GeV/c)", "dN^{Jets}/d#phi dp_{T}");
232  AddHistogram2D<TH2D>(Form("hLeadingJetEtaPt%s", appendix), "Jet angular distribution #eta vs. p_{T}", "LEGO2", 100, -2.5, 2.5, 400, -100., 300., "#eta","p_{T, jet} (GeV/c)","dN^{Jets}/d#eta dp_{T}");
233  AddHistogram2D<TH2D>(Form("hLeadingJetPhiEta%s", appendix), "Jet angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Jets}/d#phi d#eta");
234  AddHistogram2D<TH2D>(Form("hLeadingJetArea%s", appendix), "Jet area", "LEGO2", 200, 0., 2., fNumberOfCentralityBins, 0, 100, "Jet A", "Centrality", "dN^{Jets}/dA");
235  AddHistogram2D<TH2D>(Form("hLeadingJetAreaPt%s", appendix), "Jet area vs. p_{T}", "LEGO2", 200, 0., 2., 400, -100., 300., "Jet A", "p_{T, jet} (GeV/c)", "dN^{Jets}/dA dp_{T}");
236  AddHistogram2D<TH2D>(Form("hLeadingJetPtLeadingHadron%s", appendix), "Jet leading hadron p_{T} distribution vs. jet p_{T}", "", 300, 0., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T,lead had} (GeV/c)", "dN^{Jets}/dp_{T}dp_{T,had}");
237 
238  AddHistogram2D<TH2D>(Form("hSubleadingJetPtRaw%s", appendix), "Jets p_{T} distribution (no bgrd. corr.)", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
239  AddHistogram2D<TH2D>(Form("hSubleadingJetPt%s", appendix), "Jets p_{T} distribution (background subtracted)", "", 400, -100., 300., fNumberOfCentralityBins, 0, 100, "p_{T, jet} (GeV/c)", "Centrality", "dN^{Jets}/dp_{T}");
240  AddHistogram2D<TH2D>(Form("hSubleadingJetPhi%s", appendix), "Jet angular distribution #phi", "LEGO2", 180, 0., 2*TMath::Pi(), fNumberOfCentralityBins, 0, 100, "#phi", "Centrality", "dN^{Jets}/d#phi");
241  AddHistogram2D<TH2D>(Form("hSubleadingJetEta%s", appendix), "Jet angular distribution #eta", "LEGO2", 100, -2.5, 2.5, fNumberOfCentralityBins, 0, 100, "#eta","Centrality","dN^{Jets}/d#eta");
242  AddHistogram2D<TH2D>(Form("hSubleadingJetPhiPt%s", appendix), "Jet angular distribution #phi vs. p_{T}", "LEGO2", 180, 0., 2*TMath::Pi(), 400, -100., 300., "#phi", "p_{T, jet} (GeV/c)", "dN^{Jets}/d#phi dp_{T}");
243  AddHistogram2D<TH2D>(Form("hSubleadingJetEtaPt%s", appendix), "Jet angular distribution #eta vs. p_{T}", "LEGO2", 100, -2.5, 2.5, 400, -100., 300., "#eta","p_{T, jet} (GeV/c)","dN^{Jets}/d#eta dp_{T}");
244  AddHistogram2D<TH2D>(Form("hSubleadingJetPhiEta%s", appendix), "Jet angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Jets}/d#phi d#eta");
245  AddHistogram2D<TH2D>(Form("hSubleadingJetArea%s", appendix), "Jet area", "LEGO2", 200, 0., 2., fNumberOfCentralityBins, 0, 100, "Jet A", "Centrality", "dN^{Jets}/dA");
246  AddHistogram2D<TH2D>(Form("hSubleadingJetAreaPt%s", appendix), "Jet area vs. p_{T}", "LEGO2", 200, 0., 2., 400, -100., 300., "Jet A", "p_{T, jet} (GeV/c)", "dN^{Jets}/dA dp_{T}");
247  AddHistogram2D<TH2D>(Form("hSubleadingJetPtLeadingHadron%s", appendix), "Jet leading hadron p_{T} distribution vs. jet p_{T}", "", 300, 0., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T,lead had} (GeV/c)", "dN^{Jets}/dp_{T}dp_{T,had}");
248 
249  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent0_100%s", appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted)", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
250  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent0_10%s", appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted), 0-10 centrality", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
251  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent10_30%s", appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted), 10-30 centrality", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
252  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent30_50%s", appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted), 30-50 centrality", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
253  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent50_90%s", appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted), 50-90 centrality", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
254 
255  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent0_100_FilterBit%i%s", fConstPtFilterBit, appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted)", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
256  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent0_10_FilterBit%i%s", fConstPtFilterBit, appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted), 0-10 centrality", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
257  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent10_30_FilterBit%i%s", fConstPtFilterBit, appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted), 10-30 centrality", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
258  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent30_50_FilterBit%i%s", fConstPtFilterBit, appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted), 30-50 centrality", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
259  AddHistogram2D<TH2D>(Form("hJetConstituentPt_Cent50_90_FilterBit%i%s", fConstPtFilterBit, appendix), "Jet constituent p_{T} distribution vs. jet p_T (background subtracted), 50-90 centrality", "", 400, -100., 300., 300, 0., 300., "p_{T, jet} (GeV/c)", "p_{T, track} (GeV/c)", "dN^{Tracks}/d^{2}p_{T}");
260 
261  AddHistogram2D<TH2D>(Form("hJetConstituentCount_Cent0_100%s", appendix), "Jet constituent count vs. jet p_T (background subtracted)", "", 400, -100., 300., 200, 0., 200., "p_{T, jet} (GeV/c)", "Count", "dN^{Jets}/dNdp_{T}");
262  AddHistogram2D<TH2D>(Form("hJetConstituentCount_Cent0_10%s", appendix), "Jet constituent count vs. jet p_T (background subtracted), 0-10 centrality", "", 400, -100., 300., 200, 0., 200., "p_{T, jet} (GeV/c)", "Count", "dN^{Jets}/dNdp_{T}");
263  }
264 
265  // Embedding plots
266  if(fJetOutputMode == 4 || fJetOutputMode == 5)
267  {
268  if(fJetVetoJetByJet)
269  AddHistogram1D<TH1D>("hJetVeto", "Number of vetoed/accepted jets", "e1p", 2, 0., 2., "Accepted/Vetoed", "dN^{Events}/dN^{veto}");
270 
271  for(Int_t i = -1; i<static_cast<Int_t>(fJetEmbeddingCuts.size()); i++)
272  {
273  const char* appendix = "";
274  if(i>-1)
275  {
277  appendix = Form("_%s", currentCut.fCutName.Data());
278 
279  // Don't double-add cuts
280  if( static_cast<TH1*>(fOutput->FindObject(Form("hEmbeddingDeltaR%s", appendix))) )
281  continue;
282  }
283  AddHistogram2D<TH2D>(Form("hEmbeddingDeltaR%s", appendix), "Matched jet #Delta R distribution", "", 200, -50., 150., 100, 0, 1.0, "p_{T, jet} (GeV/c)", "#Delta R", "dN^{Matched}/dp_{T}dR");
284  AddHistogram2D<TH2D>(Form("hEmbeddingDeltaEta%s", appendix), "Matched jet #Delta #eta distribution", "", 200, -50., 150., 100, -1.0, 1.0, "p_{T, jet} (GeV/c)", "#Delta #eta", "dN^{Matched}/dp_{T}d#eta");
285  AddHistogram2D<TH2D>(Form("hEmbeddingDeltaPhi%s", appendix), "Matched jet #Delta #phi distribution", "", 200, -50., 150., 100, -1.0, 1.0, "p_{T, jet} (GeV/c)", "#Delta #phi", "dN^{Matched}/dp_{T}d#phi");
286  AddHistogram1D<TH1D>(Form("hEmbeddingJetPt%s", appendix), "Embedded jets p_{T} distribution", "", 200, -50., 150., "p_{T, jet} (GeV/c)", "dN/dp_{T}");
287  AddHistogram2D<TH2D>(Form("hEmbeddingJetPhiEta%s", appendix), "Embedded jet angular distribution #phi/#eta", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Jets}/d#phi d#eta");
288  }
289 
290  Double_t maxRatio = 1.;
292  maxRatio = 2.;
293  AddHistogram3D<TH3D>("hEmbeddingPtCorr010", "Matched jet p_{T} distributions (0-10% centrality)", "", 150, 0., 150., 150, 0., 150., 100, 0., maxRatio, "p_{T, MC jet} (GeV/c)", "p_{T, emb} (GeV/c)", "% MC");
294  AddHistogram3D<TH3D>("hEmbeddingPtCorr1030", "Matched jet p_{T} distributions (10-30% centrality)", "", 150, 0., 150., 150, 0., 150., 100, 0., maxRatio, "p_{T, MC jet} (GeV/c)", "p_{T, emb} (GeV/c)", "% MC");
295  AddHistogram3D<TH3D>("hEmbeddingPtCorr3050", "Matched jet p_{T} distributions (30-50% centrality)", "", 150, 0., 150., 150, 0., 150., 100, 0., maxRatio, "p_{T, MC jet} (GeV/c)", "p_{T, emb} (GeV/c)", "% MC");
296  AddHistogram3D<TH3D>("hEmbeddingPtCorr5090", "Matched jet p_{T} distributions (50-90% centrality)", "", 150, 0., 150., 150, 0., 150., 100, 0., maxRatio, "p_{T, MC jet} (GeV/c)", "p_{T, emb} (GeV/c)", "% MC");
297 
298  }
299 
300  // Random cone plots, background, ...
301  AddHistogram2D<TH2D>("hRandomConePt", "Random cone p_{T} distribution", "", 400, -100., 300., fNumberOfCentralityBins, 0, 100, "p_{T, cone} (GeV/c)", "Centrality", "dN^{Tracks}/dp_{T}");
302  AddHistogram2D<TH2D>("hRandomConePtCut3GeV", "Random cone p_{T} distribution, cut p_{T} > 3 GeV/c", "", 400, -100., 300., fNumberOfCentralityBins, 0, 100, "p_{T, cone} (GeV/c)", "Centrality", "dN^{Tracks}/dp_{T}");
303  AddHistogram2D<TH2D>("hRandomConeRawPt", "Random cone p_{T} distribution (no bgrd. correction)", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T, cone} (GeV/c)", "Centrality", "dN^{Tracks}/dp_{T}");
304  AddHistogram2D<TH2D>("hRandomConeRawPtCut3GeV", "Random cone p_{T} distribution (no bgrd. correction), cut p_{T} > 3 GeV/c", "", 300, 0., 300., fNumberOfCentralityBins, 0, 100, "p_{T, cone} (GeV/c)", "Centrality", "dN^{Tracks}/dp_{T}");
305 
306  AddHistogram2D<TH2D>("hTrackCount", "Number of tracks in acceptance vs. centrality", "LEGO2", 500, 0., 5000., fNumberOfCentralityBins, 0, 100, "N tracks","Centrality", "dN^{Events}/dN^{Tracks}");
307  AddHistogram2D<TH2D>("hJetCount", "Number of jets in acceptance vs. centrality", "LEGO2", 100, 0., 100., fNumberOfCentralityBins, 0, 100, "N Jets","Centrality", "dN^{Events}/dN^{Jets}");
308  AddHistogram2D<TH2D>("hBackgroundPt", "Background p_{T} distribution", "", 150, 0., 150., fNumberOfCentralityBins, 0, 100, "Background p_{T} (GeV/c)", "Centrality", "dN^{Events}/dp_{T}");
309 
310 
311  for(Int_t i = -1; i<static_cast<Int_t>(fJetEmbeddingCuts.size()); i++)
312  {
313  const char* appendix = "";
314  if(i>-1)
315  {
317  appendix = Form("_%s", currentCut.fCutName.Data());
318 
319  // Don't double-add cuts
320  if( static_cast<TH1*>(fOutput->FindObject(Form("hBackgroundPtJetPt_Cent0_100%s", appendix))) )
321  continue;
322  }
323  AddHistogram2D<TH2D>(Form("hBackgroundPtJetPt_Cent0_100%s", appendix), "Background p_{T} distribution vs. jet p_{T}", "", 150, 0., 150., 400, -100., 300., "Background p_{T} (GeV/c)", "Jet p_{T} (GeV/c)", "dN^{Events}/dp_{T}");
324  AddHistogram2D<TH2D>(Form("hBackgroundPtJetPt_Cent0_10%s", appendix), "Background p_{T} distribution vs. jet p_{T}", "", 150, 0., 150., 400, -100., 300., "Background p_{T} (GeV/c)", "Jet p_{T} (GeV/c)", "dN^{Events}/dp_{T}");
325  AddHistogram2D<TH2D>(Form("hBackgroundPtConstCount_Cent0_100%s", appendix), "Background p_{T} distribution vs. const. count", "", 150, 0., 150., 200, 0., 200., "Background p_{T} (GeV/c)", "Count", "dN^{Events}/dp_{T}");
326  AddHistogram2D<TH2D>(Form("hBackgroundPtConstCount_Cent0_10%s", appendix), "Background p_{T} distribution vs. const. count", "", 150, 0., 150., 200, 0., 200., "Background p_{T} (GeV/c)", "Count", "dN^{Events}/dp_{T}");
327  }
328 
329  PostData(1, fOutput); // Post data for ALL output slots > 0 here.
330 }
331 
332 
333 //________________________________________________________________________
335 
337 
338  // ### Add the jets as basic correlation particles to the event
339  // This output object carries all accepted jets
340  if (!(fInputEvent->FindListObject(Form("%s", fJetParticleArrayName.Data()))))
341  {
342  fJetsOutput.push_back(new TClonesArray("AliPicoTrack"));
343  fJetsOutput.at(0)->SetName(fJetParticleArrayName.Data());
344  fInputEvent->AddObject(fJetsOutput.at(0));
345  }
346  else
347  AliFatal(Form("%s: Object with name %s already in event!", GetName(), Form("%s", fJetParticleArrayName.Data())));
348 
349  // These output objects carry all jets that pass certain cuts
350  if( (fJetOutputMode==4 || fJetOutputMode==5) )
351  {
352  // before, check if all given output names are OK
353  for(Int_t i = 0; i<fJetEmbeddingCuts.size(); i++)
354  if (fInputEvent->FindListObject(Form("%s", fJetEmbeddingCuts.at(i).fOutputName.Data())))
355  AliFatal(Form("%s: Object with name %s already in event!", GetName(), Form("%s", fJetEmbeddingCuts.at(i).fOutputName.Data())));
356 
357  for(Int_t i = 0; i<fJetEmbeddingCuts.size(); i++)
358  {
359  // If the cut demands a new output stream, add it
360  if (!fInputEvent->FindListObject(Form("%s", fJetEmbeddingCuts.at(i).fOutputName.Data())))
361  {
362  fJetsOutput.push_back(new TClonesArray("AliPicoTrack"));
363  fJetsOutput.at(fJetsOutput.size()-1)->SetName(fJetEmbeddingCuts.at(i).fOutputName.Data());
364  fInputEvent->AddObject(fJetsOutput.at(fJetsOutput.size()-1));
365  fJetEmbeddingCuts.at(i).fArrayIndex = fJetsOutput.size()-1;
366 
367  // Set the array indices for all cuts that use this output stream
368  for(Int_t j = 0; j<fJetEmbeddingCuts.size(); j++)
369  {
370  if(fJetEmbeddingCuts.at(j).fArrayIndex != -1)
371  continue;
372  if(fJetEmbeddingCuts.at(j).fOutputName != fJetEmbeddingCuts.at(i).fOutputName)
373  continue;
374  fJetEmbeddingCuts.at(j).fArrayIndex = fJetEmbeddingCuts.at(i).fArrayIndex;
375  }
376  }
377  }
378  }
379 
380  // ##############################################
381  // ##############################################
382 
383  // ### Add the tracks as basic correlation particles to the event (optional)
384  if(fTrackParticleArrayName != "")
385  {
386  if (!(fInputEvent->FindListObject(Form("%s", fTrackParticleArrayName.Data()))))
387  {
388  fTracksOutput = new TClonesArray("AliPicoTrack");
389  fTracksOutput->SetName(fTrackParticleArrayName.Data());
390  fInputEvent->AddObject(fTracksOutput);
391  }
392  else
393  AliFatal(Form("%s: Object with name %s already in event!", GetName(), Form("%s", fTrackParticleArrayName.Data())));
394  }
395 
396  // ### Import jets for embedding (optional)
397  if(fJetEmbeddingArrayName != "")
398  {
399  fJetEmbeddingArray = static_cast<TClonesArray*>(InputEvent()->FindListObject(Form("%s", fJetEmbeddingArrayName.Data())));
400  if(!fJetEmbeddingArray)
401  AliFatal(Form("Importing jets for embedding failed! Array '%s' not found!", fJetEmbeddingArrayName.Data()));
402  }
403  else if(fJetOutputMode==4 || fJetOutputMode==5)
404  AliFatal(Form("fJetEmbeddingArrayName must be set in jet output mode 4 or 5."));
405 
406  // ### Import veto jets for matching (optional)
407  if(fJetVetoArrayName != "")
408  {
409  fJetVetoArray = static_cast<TClonesArray*>(InputEvent()->FindListObject(Form("%s", fJetVetoArrayName.Data())));
410  if(!fJetVetoArray)
411  AliFatal(Form("Importing jets for veto failed! Array '%s' not found!", fJetVetoArrayName.Data()));
412  }
413 
414  // ### Jets tree (optional)
416  {
417  fJetsTree = new TTree("ExtractedJets", "ExtractedJets");
418  fJetsTree->Branch("Jets", "AliBasicJet", &fJetsTreeBuffer, 1000);
419  fOutput->Add(fJetsTree);
420  }
421 
422 
423 }
424 
425 //________________________________________________________________________
427 {
428  if(fJetOutputMode==3) // output leading&subleading jet
429  {
430  if((jet!=fLeadingJet) && (jet!=fSubleadingJet))
431  return kFALSE;
432  }
433  else if(fJetOutputMode==1) // output the leading jet
434  {
435  if(jet!=fLeadingJet)
436  return kFALSE;
437  }
438  else if(fJetOutputMode==2) // output the subleading jet
439  {
440  if(jet!=fSubleadingJet)
441  return kFALSE;
442  }
443  else if(fJetOutputMode==6)
444  {
446  return kFALSE;
447  }
448 
449  if(fJetOutputMode==4) // matching jets only
450  return (std::find(fMatchedJets.begin(), fMatchedJets.end(), jet) != fMatchedJets.end());
451  else if(fJetOutputMode==5) // non-matching jets only
452  return (std::find(fMatchedJets.begin(), fMatchedJets.end(), jet) == fMatchedJets.end());
453 
454  return kTRUE;
455 }
456 
457 //________________________________________________________________________
459 {
460  TString appendix("");
461  if(cutName)
462  appendix = Form("_%s", cutName);
463 
464  // All jets
465  FillHistogram(Form("hJetPtRaw%s", appendix.Data()), jet->Pt(), fCent);
466  FillHistogram(Form("hJetPt%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fCent);
467  FillHistogram(Form("hJetPhi%s", appendix.Data()), jet->Phi(), fCent);
468  FillHistogram(Form("hJetEta%s", appendix.Data()), jet->Eta(), fCent);
469  FillHistogram(Form("hJetEtaPt%s", appendix.Data()), jet->Eta(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
470  FillHistogram(Form("hJetPhiPt%s", appendix.Data()), jet->Phi(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
471  FillHistogram(Form("hJetPhiEta%s", appendix.Data()), jet->Phi(), jet->Eta());
472  FillHistogram(Form("hJetArea%s", appendix.Data()), jet->Area(), fCent);
473  FillHistogram(Form("hJetAreaPt%s", appendix.Data()), jet->Area(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
474  FillHistogram(Form("hJetPtLeadingHadron%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fJetsCont->GetLeadingHadronPt(jet));
475 
476  FillHistogram(Form("hBackgroundPtJetPt_Cent0_100%s", appendix.Data()), fJetsCont->GetRhoVal(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
477  if( (fCent >= 0) && (fCent < 10) )
478  FillHistogram(Form("hBackgroundPtJetPt_Cent0_10%s", appendix.Data()), fJetsCont->GetRhoVal(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
479 
480  // Leading jet plots
481  if(jet==fLeadingJet)
482  {
483  FillHistogram(Form("hLeadingJetPtRaw%s", appendix.Data()), jet->Pt(), fCent);
484  FillHistogram(Form("hLeadingJetPt%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fCent);
485  FillHistogram(Form("hLeadingJetPhi%s", appendix.Data()), jet->Phi(), fCent);
486  FillHistogram(Form("hLeadingJetEta%s", appendix.Data()), jet->Eta(), fCent);
487  FillHistogram(Form("hLeadingJetEtaPt%s", appendix.Data()), jet->Eta(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
488  FillHistogram(Form("hLeadingJetPhiPt%s", appendix.Data()), jet->Phi(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
489  FillHistogram(Form("hLeadingJetPhiEta%s", appendix.Data()), jet->Phi(), jet->Eta());
490  FillHistogram(Form("hLeadingJetArea%s", appendix.Data()), jet->Area(), fCent);
491  FillHistogram(Form("hLeadingJetAreaPt%s", appendix.Data()), jet->Area(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
492  FillHistogram(Form("hLeadingJetPtLeadingHadron%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fJetsCont->GetLeadingHadronPt(jet));
493  }
494 
495  // Subleading jet plot
496  else if(jet==fSubleadingJet)
497  {
498  FillHistogram(Form("hSubleadingJetPtRaw%s", appendix.Data()), jet->Pt(), fCent);
499  FillHistogram(Form("hSubleadingJetPt%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fCent);
500  FillHistogram(Form("hSubleadingJetPhi%s", appendix.Data()), jet->Phi(), fCent);
501  FillHistogram(Form("hSubleadingJetEta%s", appendix.Data()), jet->Eta(), fCent);
502  FillHistogram(Form("hSubleadingJetEtaPt%s", appendix.Data()), jet->Eta(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
503  FillHistogram(Form("hSubleadingJetPhiPt%s", appendix.Data()), jet->Phi(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
504  FillHistogram(Form("hSubleadingJetPhiEta%s", appendix.Data()), jet->Phi(), jet->Eta());
505  FillHistogram(Form("hSubleadingJetArea%s", appendix.Data()), jet->Area(), fCent);
506  FillHistogram(Form("hSubleadingJetAreaPt%s", appendix.Data()), jet->Area(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area());
507  FillHistogram(Form("hSubleadingJetPtLeadingHadron%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), fJetsCont->GetLeadingHadronPt(jet));
508  }
509 
510  // ####### Jet constituent plots
511  for(Int_t i = 0; i < jet->GetNumberOfTracks(); i++)
512  {
513  AliVParticle* constituent = static_cast<AliVParticle*>(jet->TrackAt(i, fTracksCont->GetArray()));
514  if(!constituent)
515  continue;
516 
517  Bool_t filterConditionFulfilled = kFALSE;
518  AliAODTrack* aodTrack = static_cast<AliAODTrack*>(constituent);
519  if (aodTrack)
520  filterConditionFulfilled = aodTrack->TestFilterBit(fConstPtFilterBit);
521 
522  // Fill jet constituent plots
523  FillHistogram(Form("hJetConstituentPt_Cent0_100%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
524  if(filterConditionFulfilled)
525  FillHistogram(Form("hJetConstituentPt_Cent0_100_FilterBit%i%s", fConstPtFilterBit, appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
526  if( (fCent >= 0) && (fCent < 10) )
527  {
528  FillHistogram(Form("hJetConstituentPt_Cent0_10%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
529  if(filterConditionFulfilled)
530  FillHistogram(Form("hJetConstituentPt_Cent0_10_FilterBit%i%s", fConstPtFilterBit, appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
531  }
532  else if( (fCent >= 10) && (fCent < 30) )
533  {
534  FillHistogram(Form("hJetConstituentPt_Cent10_30%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
535  if(filterConditionFulfilled)
536  FillHistogram(Form("hJetConstituentPt_Cent10_30_FilterBit%i%s", fConstPtFilterBit, appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
537  }
538  else if( (fCent >= 30) && (fCent < 50) )
539  {
540  FillHistogram(Form("hJetConstituentPt_Cent30_50%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
541  if(filterConditionFulfilled)
542  FillHistogram(Form("hJetConstituentPt_Cent30_50_FilterBit%i%s", fConstPtFilterBit, appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
543  }
544  else if( (fCent >= 50) && (fCent < 90) )
545  {
546  FillHistogram(Form("hJetConstituentPt_Cent50_90%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
547  if(filterConditionFulfilled)
548  FillHistogram(Form("hJetConstituentPt_Cent50_90_FilterBit%i%s", fConstPtFilterBit, appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), constituent->Pt());
549  }
550  }
551 
552  FillHistogram(Form("hJetConstituentCount_Cent0_100%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), jet->GetNumberOfTracks());
553  if( (fCent >= 0) && (fCent < 10) )
554  FillHistogram(Form("hJetConstituentCount_Cent0_10%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), jet->GetNumberOfTracks());
555 
556  FillHistogram(Form("hBackgroundPtConstCount_Cent0_100%s", appendix.Data()), fJetsCont->GetRhoVal(), jet->GetNumberOfTracks());
557  if( (fCent >= 0) && (fCent < 10) )
558  FillHistogram(Form("hBackgroundPtConstCount_Cent0_10%s", appendix.Data()), fJetsCont->GetRhoVal(), jet->GetNumberOfTracks());
559 
560  // ####### Embedding plots
561  if( (fJetOutputMode == 4) || (fJetOutputMode == 5))
562  {
563  AliEmcalJet* refJet = GetReferenceJet(jet);
564  Double_t deltaEta = (jet->Eta()-refJet->Eta());
565  Double_t deltaPhi = TMath::Min(TMath::Abs(jet->Phi()-refJet->Phi()),TMath::TwoPi() - TMath::Abs(jet->Phi()-refJet->Phi()));
566  if(jet->Phi() < refJet->Phi())
567  deltaPhi = -deltaPhi;
568 
569  Double_t deltaR = TMath::Sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi);
570  FillHistogram(Form("hEmbeddingDeltaR%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), deltaR);
571  FillHistogram(Form("hEmbeddingDeltaEta%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), deltaPhi);
572  FillHistogram(Form("hEmbeddingDeltaPhi%s", appendix.Data()), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), deltaEta);
573  FillHistogram(Form("hEmbeddingJetPt%s", appendix.Data()), refJet->Pt());
574  FillHistogram(Form("hEmbeddingJetPhiEta%s", appendix.Data()), refJet->Phi(), refJet->Eta());
575 
576  // Don't create 3D plots for each cut
577  if(appendix=="")
578  {
579  Double_t trackRatio = 0.;
580  Double_t ptRatio = 0.;
581  GetTrackMCRatios(jet, refJet, trackRatio, ptRatio);
582 
583  if(fCent >= 0 && fCent < 10)
584  {
585  FillHistogram3D("hEmbeddingPtCorr010", refJet->Pt(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), ptRatio);
586  }
587  else if (fCent >= 10 && fCent < 30)
588  {
589  FillHistogram3D("hEmbeddingPtCorr1030", refJet->Pt(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), ptRatio);
590  }
591  else if (fCent >= 30 && fCent < 50)
592  {
593  FillHistogram3D("hEmbeddingPtCorr3050", refJet->Pt(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), ptRatio);
594  }
595  else if (fCent >= 50 && fCent < 90)
596  {
597  FillHistogram3D("hEmbeddingPtCorr5090", refJet->Pt(), jet->Pt() - fJetsCont->GetRhoVal()*jet->Area(), ptRatio);
598  }
599  }
600  }
601 }
602 
603 //________________________________________________________________________
605 {
606  FillHistogram("hTrackPt", track->Pt(), fCent);
607  FillHistogram("hTrackPhi", track->Phi(), fCent);
608  FillHistogram("hTrackEta", track->Eta(), fCent);
609  FillHistogram("hTrackEtaPt", track->Eta(), track->Pt());
610  FillHistogram("hTrackPhiPt", track->Phi(), track->Pt());
611  FillHistogram("hTrackPhiEta", track->Phi(), track->Eta());
612 }
613 
614 //________________________________________________________________________
616 {
617  Double_t tmpPt = jet->Pt() - fJetsCont->GetRhoVal()*jet->Area();
618  new ((*fJetsOutput.at(0))[fAcceptedJets]) AliPicoTrack(tmpPt, jet->Eta(), jet->Phi(), jet->Charge(), 0, 0);
619  fAcceptedJets++;
620 
621  // ############## Fill also output streams for certain cuts
622 
623  // Reset the accepted jet count (we need this number for the array)
624  for(Int_t i = 0; i<fJetEmbeddingCuts.size(); i++)
625  fJetEmbeddingCuts.at(i).fAcceptedJets = 0;
626 
627  // Check if the cuts are passed
628  for(Int_t i = 0; i<fJetEmbeddingCuts.size(); i++)
629  {
631  AliEmcalJet* refJet = GetReferenceJet(jet);
632  Double_t trackRatio = 0.;
633  Double_t ptRatio = 0.;
634  GetTrackMCRatios(jet, refJet, trackRatio, ptRatio);
635 
636  if(!currentCut.IsCutFulfilled(jet->Pt(), refJet->Pt(), fCent, ptRatio))
637  continue;
638 
639  new ((*fJetsOutput.at(currentCut.fArrayIndex))[currentCut.fAcceptedJets]) AliPicoTrack(tmpPt, jet->Eta(), jet->Phi(), jet->Charge(), 0, 0);
640  }
641 
642 }
643 
644 //________________________________________________________________________
646 {
647  if(fTrackParticleArrayName != "")
648  {
649  new ((*fTracksOutput)[fAcceptedTracks]) AliPicoTrack(track->Pt(), track->Eta(), track->Phi(), track->Charge(), 0, 0); // only Pt,Eta,Phi are interesting for correlations;
650  fAcceptedTracks++;
651  }
652 }
653 
654 //________________________________________________________________________
656 {
657  // Check pT threshold
658  if( ((jet->Pt()-jet->Area()*fJetsCont->GetRhoVal()) < fExtractionMinPt) || ((jet->Pt()-jet->Area()*fJetsCont->GetRhoVal()) >= fExtractionMaxPt) )
659  return;
660 
661  // Discard jets statistically
662  if(fRandom->Rndm() >= fExtractionPercentage)
663  return;
664 
665  AliVHeader* eventIDHeader = InputEvent()->GetHeader();
666  Long64_t eventID = 0;
667  if(eventIDHeader)
668  eventID = eventIDHeader->GetEventIdAsLong();
669 
670  // if only the two initial collision partons will be added, get PYTHIA info on them
671  Int_t partid = 0;
672  if(fJetOutputMode==6)
673  {
674  if(!fPythiaInfo)
675  AliError("fPythiaInfo object not available. Is it activated with SetGeneratePythiaInfoObject()?");
676  else if(jet==fInitialPartonMatchedJet1)
677  partid = fPythiaInfo->GetPartonFlag6();
678  else if (jet==fInitialPartonMatchedJet2)
679  partid = fPythiaInfo->GetPartonFlag7();
680 
681  // If fPythiaExtractionMode is set, only extract certain jets
682  if( (fPythiaExtractionMode==1) && not (partid>=1 && partid<=6)) // all quark-jet extraction
683  return;
684  else if( (fPythiaExtractionMode==2) && not (partid==21)) // gluon-jet extraction
685  return;
686  else if( (fPythiaExtractionMode<0) && (fPythiaExtractionMode!=-partid) ) // custom type jet extraction by given a negative number
687  return;
688  }
689 
690  AliBasicJet basicJet(jet->Eta(), jet->Phi(), jet->Pt(), jet->Charge(), fJetsCont->GetJetRadius(), jet->Area(), partid, fJetsCont->GetRhoVal(), InputEvent()->GetMagneticField(), InputEvent()->GetPrimaryVertex()->GetX(), InputEvent()->GetPrimaryVertex()->GetY(), InputEvent()->GetPrimaryVertex()->GetZ(), eventID, fCent);
691 
692  // Add constituents
693  for(Int_t i = 0; i < jet->GetNumberOfTracks(); i++)
694  {
695  AliVParticle* particle = static_cast<AliVParticle*>(jet->TrackAt(i, fTracksCont->GetArray()));
696  if(!particle) continue;
697 
698  AliAODTrack* aodtrack = static_cast<AliAODTrack*>(jet->TrackAt(i, fTracksCont->GetArray()));
699  Int_t constid = 9; // 9 mean unknown
700  if(fJetOutputMode==6)
701  {
702  // Use same convention as PID in AODs
703  if(TMath::Abs(particle->PdgCode()) == 2212) // proton
704  constid = 4;
705  else if (TMath::Abs(particle->PdgCode()) == 211) // pion
706  constid = 2;
707  else if (TMath::Abs(particle->PdgCode()) == 321) // kaon
708  constid = 3;
709  else if (TMath::Abs(particle->PdgCode()) == 11) // electron
710  constid = 0;
711  else if (TMath::Abs(particle->PdgCode()) == 13) // muon
712  constid = 1;
713  }
714  else if (aodtrack)
715  constid = aodtrack->GetMostProbablePID();
716 
717  basicJet.AddJetConstituent(particle->Eta(), particle->Phi(), particle->Pt(), particle->Charge(), constid);
718  }
719  if(std::find(fMatchedJets.begin(), fMatchedJets.end(), jet) != fMatchedJets.end()) // set the true pT from the matched jets (only possible in modes 4 & 7)
720  basicJet.SetTruePt(fMatchedJetsReference[std::find(fMatchedJets.begin(), fMatchedJets.end(), jet)-fMatchedJets.begin()]->Pt());
721 
722  fJetsTreeBuffer = &basicJet;
723  fJetsTree->Fill();
724 }
725 
726 //________________________________________________________________________
728 {
729  // Check jet pT threshold
731  return;
732 
733  // Discard jets statistically
734  if(fRandom->Rndm() >= fEventExtractionPercentage)
735  return;
736 
737  static Int_t numSavedEvents = 0;
738  numSavedEvents++;
739 
740 
741  AddHistogram2D<TH2D>(Form("Event%i", numSavedEvents), "Event display", "COLZ", 180, 0., 2*TMath::Pi(), 100, -2.5, 2.5, "#phi", "#eta", "dN^{Tracks}/d#phi d#eta");
742  fTracksCont->ResetCurrentID();
743  while(AliVTrack *track = static_cast<AliVTrack*>(fTracksCont->GetNextAcceptParticle()))
744  FillHistogram(Form("Event%i", numSavedEvents), track->Phi(), track->Eta(), track->Pt());
745 
746 }
747 
748 //________________________________________________________________________
750 {
752 
753  // ####### Jet loop
754  fAcceptedJets = 0;
755  fJetsCont->ResetCurrentID();
756  while(AliEmcalJet *jet = fJetsCont->GetNextAcceptJet())
757  {
758  if(!IsJetSelected(jet))
759  continue;
760 
761  // ################ Jet plots
762  // Those plots will only be filled for jets that fulfill the condition
763  // e.g. embedded jets passing the cuts etc.
764 
765  FillHistogramsJets(jet, 0);
766 
767  // Plots for each embedding cut
768  for(Int_t i = 0; i<fJetEmbeddingCuts.size(); i++)
769  {
771  AliEmcalJet* refJet = GetReferenceJet(jet);
772  Double_t trackRatio = 0.;
773  Double_t ptRatio = 0.;
774  GetTrackMCRatios(jet, refJet, trackRatio, ptRatio);
775 
776  if(!currentCut.IsCutFulfilled(jet->Pt(), refJet->Pt(), fCent, ptRatio))
777  continue;
778 
779  FillHistogramsJets(jet, currentCut.fCutName.Data());
780  }
781 
782  // Add jet to output array
784  AddJetToTree(jet);
785  AddJetToOutputArray(jet);
786  }
787 
788  // ####### Particle loop
789  // Throw random cone
790  Double_t tmpRandConeEta = fJetsCont->GetJetEtaMin() + fRandom->Rndm()*TMath::Abs(fJetsCont->GetJetEtaMax()-fJetsCont->GetJetEtaMin());
791  Double_t tmpRandConePhi = fRandom->Rndm()*TMath::TwoPi();
792  Double_t tmpRandConePt = 0; // to be determined
793  Double_t tmpRandConePt3GeV = 0; // to be determined
794 
795  fAcceptedTracks = 0;
796  fTracksCont->ResetCurrentID();
797  Int_t trackcount = 0;
798  while(AliVTrack *track = static_cast<AliVTrack*>(fTracksCont->GetNextAcceptParticle()))
799  {
800  // Track plots
801  FillHistogramsTracks(track);
802 
803  if(IsTrackInCone(track, tmpRandConeEta, tmpRandConePhi, fJetsCont->GetJetRadius()))
804  {
805  tmpRandConePt += track->Pt();
806  if (track->Pt() > 3.0)
807  tmpRandConePt3GeV += track->Pt();
808  }
809 
810  // Add track to output array
811  trackcount++;
812  AddTrackToOutputArray(track);
813  }
814 
815  // Add event to output tree
817  AddEventToTree();
818 
819  // ####### Event properties
820  FillHistogram("hRandomConePt", tmpRandConePt - fJetsCont->GetRhoVal()*fJetsCont->GetJetRadius()*fJetsCont->GetJetRadius()*TMath::Pi(), fCent);
821  FillHistogram("hRandomConePtCut3GeV", tmpRandConePt3GeV - fJetsCont->GetRhoVal()*fJetsCont->GetJetRadius()*fJetsCont->GetJetRadius()*TMath::Pi(), fCent);
822  FillHistogram("hRandomConeRawPt", tmpRandConePt, fCent);
823  FillHistogram("hRandomConeRawPtCut3GeV", tmpRandConePt3GeV, fCent);
824 
825  FillHistogram("hBackgroundPt", fJetsCont->GetRhoVal(), fCent);
826  FillHistogram("hJetCount", fAcceptedJets, fCent);
827  FillHistogram("hTrackCount", trackcount, fCent);
828  // NOTE: It is possible to use fTracksCont->GetLeadingParticle() since we do not apply additional track cuts
829  AliVTrack* leadTrack = static_cast<AliVTrack*>(fTracksCont->GetLeadingParticle());
830  if(leadTrack)
831  {
832  FillHistogram("hLeadingTrackPt", leadTrack->Pt(), fCent);
833  FillHistogram("hLeadingTrackPhi", leadTrack->Phi(), fCent);
834  FillHistogram("hLeadingTrackEta", leadTrack->Eta(), fCent);
835  FillHistogram("hLeadingTrackPhiEta", leadTrack->Phi(), leadTrack->Eta());
836  }
837 
838  return kTRUE;
839 }
840 
841 //########################################################################
842 // HELPERS
843 //########################################################################
844 
845 //________________________________________________________________________
847 {
848  if(!fPythiaInfo)
849  AliError("fPythiaInfo object not available. Is it activated with SetGeneratePythiaInfoObject()?");
850 
851  Double_t bestMatchDeltaR1 = 999.;
852  Double_t bestMatchDeltaR2 = 999.;
853 
854  fJetsCont->ResetCurrentID();
855  while(AliEmcalJet *jet = fJetsCont->GetNextAcceptJet())
856  {
857  // Check via geometrical matching if jet is connected to the initial collision
858  Double_t deltaEta1 = TMath::Abs(jet->Eta()-fPythiaInfo->GetPartonEta6());
859  Double_t deltaEta2 = TMath::Abs(jet->Eta()-fPythiaInfo->GetPartonEta7());
860  Double_t deltaPhi1 = TMath::Min(TMath::Abs(jet->Phi()-fPythiaInfo->GetPartonPhi6()),TMath::TwoPi() - TMath::Abs(jet->Phi()-fPythiaInfo->GetPartonPhi6()));
861  Double_t deltaPhi2 = TMath::Min(TMath::Abs(jet->Phi()-fPythiaInfo->GetPartonPhi7()),TMath::TwoPi() - TMath::Abs(jet->Phi()-fPythiaInfo->GetPartonPhi7()));
862 
863  Double_t deltaR1 = TMath::Sqrt(deltaEta1*deltaEta1 + deltaPhi1*deltaPhi1);
864  Double_t deltaR2 = TMath::Sqrt(deltaEta2*deltaEta2 + deltaPhi2*deltaPhi2);
865 
866  if(deltaR1 < bestMatchDeltaR1)
867  {
868  bestMatchDeltaR1 = deltaR1;
870  }
871  if(deltaR2 < bestMatchDeltaR2)
872  {
873  bestMatchDeltaR2 = deltaR2;
875  }
876  }
877 
878  if(bestMatchDeltaR1 > 0.3)
880  if(bestMatchDeltaR2 > 0.3)
882 }
883 
884 //________________________________________________________________________
886 {
887  fMatchedJets.clear();
888  fMatchedJetsReference.clear();
889 
890  // Check for a jet veto here
892  {
893  for(Int_t i=0; i<fJetVetoArray->GetEntries(); i++)
894  {
895  AliEmcalJet* vetoJet = static_cast<AliEmcalJet*>(fJetVetoArray->At(i));
896  UInt_t dummy = 0;
897  if(!fJetsCont->AcceptJet(vetoJet , dummy))
898  continue;
899  // if veto jet found -> return
900  if((vetoJet->Pt() - fJetsCont->GetRhoVal()*vetoJet->Area() >= fJetVetoMinPt) && (vetoJet->Pt() - fJetsCont->GetRhoVal()*vetoJet->Area() < fJetVetoMaxPt))
901  {
902  fHistEventRejection->Fill("JetVeto", 1);
903  return;
904  }
905  }
906  }
907 
908  AliEmcalJet* jetLeading = 0;
909  AliEmcalJet* jetSubLeading = 0;
910  GetLeadingJetsInArray(fJetEmbeddingArray, "rho", jetLeading, jetSubLeading);
911 
912  // ############ Search for all matches with leading/subleading jets
913  for(Int_t i=0; i<fJetEmbeddingNumMatchedJets; i++)
914  {
915  AliEmcalJet* probeJet = 0;
916  if(i==0)
917  probeJet = jetLeading;
918  else if(i==1)
919  probeJet = jetSubLeading;
920 
921  if(!probeJet)
922  continue;
923 
924  AliEmcalJet* matchedJet = 0;
925  AliEmcalJet* matchedJetReference = 0;
926  Double_t bestMatchDeltaR = 999.;
927  fJetsCont->ResetCurrentID();
928  // Loop over all embedded jets to find the best match
929  while(AliEmcalJet* embeddedJet = fJetsCont->GetNextAcceptJet())
930  {
931  Double_t deltaEta = (embeddedJet->Eta()-probeJet->Eta());
932  Double_t deltaPhi = TMath::Min(TMath::Abs(embeddedJet->Phi()-probeJet->Phi()),TMath::TwoPi() - TMath::Abs(embeddedJet->Phi()-probeJet->Phi()));
933  Double_t deltaR = TMath::Sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi);
934 
935  // Cut jets too far away
936  if (deltaR > fJetEmbeddingMaxDistance)
937  continue;
938 
939  // Do not allow jets that are vetoed (optional)
940  if(fJetVetoJetByJet && fJetVetoArray && IsJetVetoed(embeddedJet))
941  continue;
942 
943  // Search for the best match
944  if(deltaR < bestMatchDeltaR)
945  {
946  bestMatchDeltaR = deltaR;
947  matchedJet = embeddedJet;
948  matchedJetReference = probeJet;
949  }
950  }
951  // Put matched jet to a list
952  if(matchedJet && matchedJetReference)
953  {
954  fMatchedJets.push_back(matchedJet);
955  fMatchedJetsReference.push_back(matchedJetReference);
956  }
957  }
958 }
959 
960 //________________________________________________________________________
962 {
963  Int_t tracksFromMC = 0;
964  Int_t tracksTotal = 0;
965  Double_t ptFromMC = 0;
966  Double_t ptTotal = 0;
967 
968  if(fJetEmbeddingUsePerTrackMCPercentage) // Calculate MC track percentage from tracks of the matched jet
969  {
970  for(Int_t j = 0; j < jet->GetNumberOfTracks(); j++)
971  {
972  AliVParticle* constituent = static_cast<AliVParticle*>(jet->TrackAt(j, fTracksCont->GetArray()));
973  if(!constituent)
974  continue;
975 
976  TClonesArray* mcArray = static_cast<TClonesArray*>(InputEvent()->FindListObject(Form("%s", fJetEmbeddingTrackArrayName.Data())));
977  Bool_t foundInMC = kFALSE;
978  for(Int_t k=0; k<mcJet->GetNumberOfTracks(); k++)
979  {
980  AliVParticle* mcConstituent = static_cast<AliVParticle*>(mcJet->TrackAt(k, mcArray));
981  if(!mcConstituent)
982  continue;
983  if(mcConstituent->GetLabel() == constituent->GetLabel())
984  {
985  foundInMC = kTRUE;
986  break;
987  }
988  }
989 
990  if(foundInMC)
991  {
992  tracksFromMC++;
993  ptFromMC += constituent->Pt();
994  }
995  tracksTotal++;
996  ptTotal += constituent->Pt();
997 
998  }
999  }
1000  else // Calculate MC track percentage from all tracks in MC
1001  {
1002  for(Int_t j = 0; j < jet->GetNumberOfTracks(); j++)
1003  {
1004  AliVParticle* constituent = static_cast<AliVParticle*>(jet->TrackAt(j, fTracksCont->GetArray()));
1005  if(!constituent)
1006  continue;
1007 
1008  // Plots on MC percentage in jet
1009  if(constituent->GetLabel() > 10000)
1010  {
1011  tracksFromMC++;
1012  ptFromMC += constituent->Pt();
1013  }
1014  tracksTotal++;
1015  ptTotal += constituent->Pt();
1016  }
1017  }
1018 
1019 
1020  trackRatio = 0.;
1021  if(tracksTotal)
1022  trackRatio = tracksFromMC/((Double_t)tracksTotal);
1023 
1025  ptTotal = jet->Pt() - fJetsCont->GetRhoVal()*jet->Area();
1026 
1027  ptRatio = 0.;
1028  if(ptTotal)
1029  ptRatio = ptFromMC/ptTotal;
1030 
1031 }
1032 
1033 //________________________________________________________________________
1035 {
1036  // Check if this jet can be matched with a veto jet
1037  if(fJetVetoArray && jet)
1038  {
1039  for(Int_t j=0; j<fJetVetoArray->GetEntries(); j++)
1040  {
1041  UInt_t dummy = 0;
1042  AliEmcalJet* vetoJet = static_cast<AliEmcalJet*>(fJetVetoArray->At(j));
1043  // Check if veto jet is accepted and high enough in pT
1044  if(!fJetsCont->AcceptJet(vetoJet , dummy))
1045  continue;
1046  if(!((vetoJet->Pt() - fJetsCont->GetRhoVal()*vetoJet->Area() >= fJetVetoMinPt) && (vetoJet->Pt() - fJetsCont->GetRhoVal()*vetoJet->Area() < fJetVetoMaxPt)))
1047  continue;
1048 
1049  // Check matching distance
1050  Double_t deltaEta = (jet->Eta()-vetoJet->Eta());
1051  Double_t deltaPhi = TMath::Min(TMath::Abs(jet->Phi()-vetoJet->Phi()),TMath::TwoPi() - TMath::Abs(jet->Phi()-vetoJet->Phi()));
1052  Double_t deltaR = TMath::Sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi);
1053 
1054  if (deltaR <= fJetEmbeddingMaxDistance)
1055  {
1056  FillHistogram("hJetVeto", 1.5); // jet vetoed
1057  return kTRUE;
1058  }
1059  }
1060  }
1061  FillHistogram("hJetVeto", 0.5); // jet accepted
1062  return kFALSE;
1063 }
1064 
1065 //________________________________________________________________________
1067 {
1068  // This is to use a full cone in phi even at the edges of phi (2pi -> 0) (0 -> 2pi)
1069  Double_t trackPhi = 0.0;
1070  if (track->Phi() > (TMath::TwoPi() - (radius-phi)))
1071  trackPhi = track->Phi() - TMath::TwoPi();
1072  else if (track->Phi() < (phi+radius - TMath::TwoPi()))
1073  trackPhi = track->Phi() + TMath::TwoPi();
1074  else
1075  trackPhi = track->Phi();
1076 
1077  if ( TMath::Abs(trackPhi-phi)*TMath::Abs(trackPhi-phi) + TMath::Abs(track->Eta()-eta)*TMath::Abs(track->Eta()-eta) <= radius*radius)
1078  return kTRUE;
1079 
1080  return kFALSE;
1081 }
1082 
1083 
1084 //________________________________________________________________________
1086 {
1087  // Calculate leading + subleading jet
1089  if(fJetOutputMode==6)
1091  else if(fJetOutputMode==4 || fJetOutputMode==5)
1092  GetMatchingJets();
1093 }
1094 
1095 //________________________________________________________________________
1096 void AliAnalysisTaskChargedJetsHadronCF::GetLeadingJets(const char* opt, AliEmcalJet*& jetLeading, AliEmcalJet*& jetSubLeading)
1097 {
1098  // Customized from AliJetContainer::GetLeadingJet()
1099  // Get the leading+subleading jet; if opt contains "rho" the sorting is according to pt-A*rho
1100 
1101  TString option(opt);
1102  option.ToLower();
1103 
1104  jetLeading = 0;
1105  jetSubLeading = 0;
1106 
1107  fJetsCont->ResetCurrentID();
1108  Double_t tmpLeadingPt = 0;
1109  Double_t tmpSubleadingPt = 0;
1110 
1111  if (option.Contains("rho")) {
1112  while (AliEmcalJet* jet = fJetsCont->GetNextAcceptJet()) {
1113  if ( (jet->Pt()-jet->Area()*fJetsCont->GetRhoVal()) > tmpLeadingPt )
1114  {
1115  jetSubLeading = jetLeading;
1116  jetLeading = jet;
1117  tmpSubleadingPt = tmpLeadingPt;
1118  tmpLeadingPt = jet->Pt()-jet->Area()*fJetsCont->GetRhoVal();
1119  }
1120  else if ( (jet->Pt()-jet->Area()*fJetsCont->GetRhoVal()) > tmpSubleadingPt )
1121  {
1122  jetSubLeading = jet;
1123  tmpSubleadingPt = jet->Pt()-jet->Area()*fJetsCont->GetRhoVal();
1124  }
1125  }
1126  }
1127  else {
1128  while (AliEmcalJet* jet = fJetsCont->GetNextAcceptJet()) {
1129  if ( (jet->Pt()) > tmpLeadingPt )
1130  {
1131  jetSubLeading = jetLeading;
1132  jetLeading = jet;
1133  tmpSubleadingPt = tmpLeadingPt;
1134  tmpLeadingPt = jet->Pt();
1135  }
1136  else if ( (jet->Pt()) > tmpSubleadingPt )
1137  {
1138  jetSubLeading = jet;
1139  tmpSubleadingPt = jet->Pt();
1140  }
1141  }
1142  }
1143 }
1144 
1145 //________________________________________________________________________
1146 void AliAnalysisTaskChargedJetsHadronCF::GetLeadingJetsInArray(TClonesArray* arr, const char* opt, AliEmcalJet*& jetLeading, AliEmcalJet*& jetSubLeading)
1147 {
1148  // Customized from AliJetContainer::GetLeadingJet()
1149  // Get the leading+subleading jet; if opt contains "rho" the sorting is according to pt-A*rho
1150 
1151  TString option(opt);
1152  option.ToLower();
1153 
1154  jetLeading = 0;
1155  jetSubLeading = 0;
1156  Double_t tmpLeadingPt = -999.;
1157  Double_t tmpSubleadingPt = -999.;
1158 
1159  for(Int_t i=0; i<arr->GetEntries(); i++)
1160  {
1161  AliEmcalJet* jet = static_cast<AliEmcalJet*>(arr->At(i));
1162  UInt_t dummy = 0;
1163  if(!fJetsCont->AcceptJet(jet , dummy))
1164  continue;
1165 
1166  Double_t jetPt = jet->Pt();
1167  if (option.Contains("rho"))
1168  jetPt -= jet->Area()*fJetsCont->GetRhoVal();
1169 
1170  if ( jetPt > tmpLeadingPt )
1171  {
1172  jetSubLeading = jetLeading;
1173  jetLeading = jet;
1174  tmpSubleadingPt = tmpLeadingPt;
1175  tmpLeadingPt = jetPt;
1176  }
1177  else if ( jetPt > tmpSubleadingPt )
1178  {
1179  jetSubLeading = jet;
1180  tmpSubleadingPt = jetPt;
1181  }
1182 
1183  }
1184 }
1185 
1186 
1187 //________________________________________________________________________
1189 {
1190  // Method for the correct logarithmic binning of histograms
1191  TAxis *axis = h->GetAxis(axisNumber);
1192  int bins = axis->GetNbins();
1193 
1194  Double_t from = axis->GetXmin();
1195  Double_t to = axis->GetXmax();
1196  Double_t *newBins = new Double_t[bins + 1];
1197 
1198  newBins[0] = from;
1199  Double_t factor = pow(to/from, 1./bins);
1200 
1201  for (int i = 1; i <= bins; i++) {
1202  newBins[i] = factor * newBins[i-1];
1203  }
1204  axis->Set(bins, newBins);
1205  delete [] newBins;
1206 }
1207 
1208 //________________________________________________________________________
1210 {
1211  std::vector<AliEmcalJet*>::iterator matchedJetFindResult = std::find(fMatchedJets.begin(), fMatchedJets.end(), jet);
1212  if(matchedJetFindResult == fMatchedJets.end())
1213  {
1214  AliError("Checked for a reference jet but it was not found. Check code.");
1215  return 0;
1216  }
1217 
1218  Int_t matchedJetIndex = (matchedJetFindResult - fMatchedJets.begin());
1219  AliEmcalJet* refJet = fMatchedJetsReference[matchedJetIndex];
1220  return refJet;
1221 }
1222 
1223 //________________________________________________________________________
1225 {
1226  TH1* tmpHist = static_cast<TH1*>(fOutput->FindObject(key));
1227  if(!tmpHist)
1228  {
1229  AliError(Form("Cannot find histogram <%s> ",key)) ;
1230  return;
1231  }
1232 
1233  tmpHist->Fill(x);
1234 }
1235 
1236 //________________________________________________________________________
1238 {
1239  TH1* tmpHist = static_cast<TH1*>(fOutput->FindObject(key));
1240  if(!tmpHist)
1241  {
1242  AliError(Form("Cannot find histogram <%s> ",key));
1243  return;
1244  }
1245 
1246  if (tmpHist->IsA()->GetBaseClass("TH1"))
1247  static_cast<TH1*>(tmpHist)->Fill(x,y); // Fill x with y
1248  else if (tmpHist->IsA()->GetBaseClass("TH2"))
1249  static_cast<TH2*>(tmpHist)->Fill(x,y); // Fill x,y with 1
1250 }
1251 
1252 //________________________________________________________________________
1254 {
1255  TH2* tmpHist = static_cast<TH2*>(fOutput->FindObject(key));
1256  if(!tmpHist)
1257  {
1258  AliError(Form("Cannot find histogram <%s> ",key));
1259  return;
1260  }
1261 
1262  tmpHist->Fill(x,y,add);
1263 }
1264 
1265 //________________________________________________________________________
1267 {
1268  TH3* tmpHist = static_cast<TH3*>(fOutput->FindObject(key));
1269  if(!tmpHist)
1270  {
1271  AliError(Form("Cannot find histogram <%s> ",key));
1272  return;
1273  }
1274 
1275  if(add)
1276  tmpHist->Fill(x,y,z,add);
1277  else
1278  tmpHist->Fill(x,y,z);
1279 }
1280 
1281 
1282 //________________________________________________________________________
1283 template <class T> T* AliAnalysisTaskChargedJetsHadronCF::AddHistogram1D(const char* name, const char* title, const char* options, Int_t xBins, Double_t xMin, Double_t xMax, const char* xTitle, const char* yTitle)
1284 {
1285  T* tmpHist = new T(name, title, xBins, xMin, xMax);
1286 
1287  tmpHist->GetXaxis()->SetTitle(xTitle);
1288  tmpHist->GetYaxis()->SetTitle(yTitle);
1289  tmpHist->SetOption(options);
1290  tmpHist->SetMarkerStyle(kFullCircle);
1291  tmpHist->Sumw2();
1292 
1293  fOutput->Add(tmpHist);
1294 
1295  return tmpHist;
1296 }
1297 
1298 //________________________________________________________________________
1299 template <class T> T* AliAnalysisTaskChargedJetsHadronCF::AddHistogram2D(const char* name, const char* title, const char* options, Int_t xBins, Double_t xMin, Double_t xMax, Int_t yBins, Double_t yMin, Double_t yMax, const char* xTitle, const char* yTitle, const char* zTitle)
1300 {
1301  T* tmpHist = new T(name, title, xBins, xMin, xMax, yBins, yMin, yMax);
1302  tmpHist->GetXaxis()->SetTitle(xTitle);
1303  tmpHist->GetYaxis()->SetTitle(yTitle);
1304  tmpHist->GetZaxis()->SetTitle(zTitle);
1305  tmpHist->SetOption(options);
1306  tmpHist->SetMarkerStyle(kFullCircle);
1307  tmpHist->Sumw2();
1308 
1309  fOutput->Add(tmpHist);
1310 
1311  return tmpHist;
1312 }
1313 
1314 //________________________________________________________________________
1315 template <class T> T* AliAnalysisTaskChargedJetsHadronCF::AddHistogram3D(const char* name, const char* title, const char* options, Int_t xBins, Double_t xMin, Double_t xMax, Int_t yBins, Double_t yMin, Double_t yMax, Int_t zBins, Double_t zMin, Double_t zMax, const char* xTitle, const char* yTitle, const char* zTitle)
1316 {
1317  T* tmpHist = new T(name, title, xBins, xMin, xMax, yBins, yMin, yMax, zBins, zMin, zMax);
1318  tmpHist->GetXaxis()->SetTitle(xTitle);
1319  tmpHist->GetYaxis()->SetTitle(yTitle);
1320  tmpHist->GetZaxis()->SetTitle(zTitle);
1321  tmpHist->SetOption(options);
1322  tmpHist->SetMarkerStyle(kFullCircle);
1323  tmpHist->Sumw2();
1324 
1325  fOutput->Add(tmpHist);
1326 
1327  return tmpHist;
1328 }
1329 
1330 //________________________________________________________________________
1332 {
1333  // Called once at the end of the analysis.
1334 }
1335 
Int_t fArrayIndex
array index that holds the output array index
Double_t fEventExtractionMaxJetPt
maximum jet pt of recorded events
Short_t Charge() const
Definition: AliEmcalJet.h:110
Double_t Area() const
Definition: AliEmcalJet.h:117
Double_t GetRhoVal() const
double Double_t
Definition: External.C:58
Bool_t fJetVetoJetByJet
If true, the jet veto will be applied on a jet-by-jet basis.
Double_t GetJetEtaMin() const
T * AddHistogram1D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis")
const char * title
Definition: MakeQAPdf.C:26
void GetLeadingJets(const char *opt, AliEmcalJet *&jetLeading, AliEmcalJet *&jetSubLeading)
Float_t GetPartonEta6() const
AliEmcalPythiaInfo * fPythiaInfo
!event parton info
AliJetContainer * GetJetContainer(Int_t i=0) const
Definition: External.C:244
Float_t GetPartonEta7() const
std::vector< AliChargedJetsHadronCFCuts > fJetEmbeddingCuts
Cuts used in jet embedding.
Double_t Eta() const
Definition: AliEmcalJet.h:108
long long Long64_t
Definition: External.C:43
Double_t Phi() const
Definition: AliEmcalJet.h:104
void * fJetsTreeBuffer
! buffer for one jet (that will be saved to the tree)
Container with name, TClonesArray and cuts for particles.
Support task for (charged) jet-hadron correlations.
Int_t fPythiaExtractionMode
Mode which PYTHIA-jets to extract for fJetOutputMode==6: 0: all, 1: quark-jets, 2: gluon jets...
Double_t GetJetEtaMax() const
Float_t GetPartonPhi7() const
virtual Bool_t AcceptJet(Int_t i, UInt_t &rejectionReason) const
Int_t fJetOutputMode
mode which jets are written to array (0: all accepted, 1: leading, 2: subleading, 3: leading+subleadi...
Double_t fEventExtractionMinJetPt
minimum jet pt of recorded events
std::vector< AliEmcalJet * > fMatchedJetsReference
Jets matched in an event (reference)
Double_t fEventExtractionPercentage
percentage of events that is recorded
std::vector< TClonesArray * > fJetsOutput
! vector of arrays of basic correlation particles attached to the event (jets)
Int_t GetPartonFlag7() const
AliEmcalJet * fSubleadingJet
! subleading jet (calculated event-by-event)
Simple class containing basic information for a jet.
void FillHistogram3D(const char *key, Double_t x, Double_t y, Double_t z, Double_t add=0)
Float_t GetPartonPhi6() const
Container class of cuts for AliAnalysisTaskChargedJetsHadronCF.
UShort_t GetNumberOfTracks() const
Definition: AliEmcalJet.h:126
UShort_t T(UShort_t m, UShort_t t)
Definition: RingBits.C:60
void GetLeadingJetsInArray(TClonesArray *arr, const char *opt, AliEmcalJet *&jetLeading, AliEmcalJet *&jetSubLeading)
TClonesArray * fJetEmbeddingArray
! Array of generated jets imported into task (for embedding)
AliParticleContainer * GetParticleContainer(Int_t i=0) const
Int_t GetPartonFlag6() const
void GetTrackMCRatios(AliEmcalJet *jet, AliEmcalJet *mcJet, Double_t &trackRatio, Double_t &ptRatio)
void AddJetConstituent(Float_t eta, Float_t phi, Float_t pt, Short_t charge, Short_t pid=0)
AliParticleContainer * GetParticleContainer() const
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
TString fJetParticleArrayName
Name of fJetsOutput array (if one uses only one)
Double_t GetLeadingHadronPt(const AliEmcalJet *jet) const
T * AddHistogram3D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, Int_t yBins=100, Double_t yMin=0.0, Double_t yMax=20.0, Int_t zBins=100, Double_t zMin=0.0, Double_t zMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis", const char *zTitle="z axis")
TString fJetEmbeddingArrayName
Name of array used to match jets.
Int_t fNumberOfCentralityBins
Number of centrality bins.
virtual AliVParticle * GetLeadingParticle(const char *opt="")
std::vector< AliEmcalJet * > fMatchedJets
Jets matched in an event (embedded)
TString fJetEmbeddingTrackArrayName
Name of array used to match tracks of jets.
Double_t fExtractionPercentage
percentage that is recorded
Double_t fCent
!event centrality
Double_t fJetVetoMinPt
Min pt cut applied on the fJetVetoArray jets.
Double_t fJetVetoMaxPt
Max pt cut applied on the fJetVetoArray jets.
TString fTrackParticleArrayName
Name of fTracksOutput array.
TClonesArray * fTracksOutput
! Array of basic correlation particles attached to the event (tracks)
AliEmcalJet * fLeadingJet
! leading jet (calculated event-by-event)
Double_t fExtractionMinPt
minimum pt of recorded jets
AliEmcalJet * GetNextAcceptJet()
TTree * fJetsTree
! Jets that will be saved to a tree (optionally)
Double_t Pt() const
Definition: AliEmcalJet.h:96
Bool_t IsTrackInCone(AliVParticle *track, Double_t eta, Double_t phi, Double_t radius)
Bool_t fJetEmbeddingUsePerTrackMCPercentage
When cutting on MC percentage, calculate it per track and not for all MC tracks.
Int_t fAcceptedJets
temporary var that holds how many jets passed
TString fJetVetoArrayName
Name of array used for veto jets.
Float_t GetJetRadius() const
AliEmcalList * fOutput
!output list
Int_t fJetEmbeddingNumMatchedJets
Number of matched leading jets that will be used.
Short_t TrackAt(Int_t idx) const
Definition: AliEmcalJet.h:147
AliEmcalJet * fInitialPartonMatchedJet1
! On PYTHIA data and fJetOutputMode=6, this holds the PDG code of the initial collisions that was mat...
AliEmcalJet * fInitialPartonMatchedJet2
! On PYTHIA data and fJetOutputMode=6, this holds the PDG code of the initial collisions that was mat...
Definition: External.C:220
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
TH1 * fHistEventRejection
!book keep reasons for rejecting event
void SetMakeGeneralHistograms(Bool_t g)
Base task in the EMCAL jet framework.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:44
Bool_t fJetEmbeddingUseBgrdForMCPercentage
When cutting on MC percentage, use bgrd. corr to calculate MC percentage.
Declaration of class AliEmcalPythiaInfo.
const char Option_t
Definition: External.C:48
Double_t fExtractionMaxPt
maximum pt of recorded jets
Bool_t IsCutFulfilled(Double_t pt, Double_t mcPt, Double_t cent, Double_t ptRatio)
virtual AliVParticle * GetNextAcceptParticle()
bool Bool_t
Definition: External.C:53
Double_t fJetEmbeddingMaxDistance
Max distance allowed to accept an embedded jet.
void FillHistogramsJets(AliEmcalJet *jet, const char *cutName)
Int_t fAcceptedJets
! number accepted jets (calculated event-by-event)
T * AddHistogram2D(const char *name="CustomHistogram", const char *title="NO_TITLE", const char *options="", Int_t xBins=100, Double_t xMin=0.0, Double_t xMax=20.0, Int_t yBins=100, Double_t yMin=0.0, Double_t yMax=20.0, const char *xTitle="x axis", const char *yTitle="y axis", const char *zTitle="z axis")
Definition: External.C:196
TClonesArray * fJetVetoArray
! Array of jets imported into task used for veto a matching/embedding
Int_t fAcceptedTracks
! number accepted tracks (calculated event-by-event)
Int_t fConstPtFilterBit
For const pt plot, filter bit.