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