AliPhysics  58f3d52 (58f3d52)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliAnalysisTaskChargedJetsPA.cxx
Go to the documentation of this file.
1 #ifndef ALIANALYSISTASKSE_H
2 #include <Riostream.h>
3 #include <TROOT.h>
4 #include <TFile.h>
5 #include <TChain.h>
6 #include <TTree.h>
7 #include <TKey.h>
8 #include <TProfile.h>
9 #include <TProfile2D.h>
10 #include <TH1F.h>
11 #include <TH2F.h>
12 #include <TCanvas.h>
13 #include <TList.h>
14 #include <TClonesArray.h>
15 #include <TObject.h>
16 #include <TMath.h>
17 #include <TSystem.h>
18 #include <TInterpreter.h>
19 #include <TH1.h>
20 #include "AliAnalysisTask.h"
21 #include "AliCentrality.h"
22 #include "AliStack.h"
23 #include "AliESDEvent.h"
24 #include "AliESDInputHandler.h"
25 #include "AliAODEvent.h"
26 #include "AliAODHandler.h"
27 #include "AliAnalysisManager.h"
28 #include "AliAnalysisTaskSE.h"
29 #endif
30 
31 #include "AliAnalysisDataContainer.h"
32 #include <THn.h>
33 #include "TFormula.h"
34 #include "AliESDtrackCuts.h"
35 #include <time.h>
36 #include <TRandom3.h>
37 #include "AliGenPythiaEventHeader.h"
38 #include "AliAODMCHeader.h"
39 #include "AliMCEvent.h"
40 #include "AliLog.h"
41 #include <AliEmcalJet.h>
42 #include <AliPicoTrack.h>
43 #include "AliVEventHandler.h"
44 #include "AliVParticle.h"
45 #include "AliAODMCParticle.h"
46 #include "AliAnalysisUtils.h"
47 #include "AliRhoParameter.h"
48 #include "TVector3.h"
49 
51 using std::min;
52 using std::cout;
53 using std::endl;
54 
56 
57 //TODO: FillHistogram can be done better with virtual TH1(?)
59 
60 // ######################################################################################## DEFINE HISTOGRAMS
62 {
63  #ifdef DEBUGMODE
64  AliInfo("Creating histograms.");
65  #endif
66 
67  SetCurrentOutputList(0);
68 
69  TH1* tmpHisto = AddHistogram1D<TH1D>("hVertexAcceptance", "Accepted vertices for different conditions", "", 4, 0, 4, "stage","N^{Events}/cut");
70  tmpHisto->GetXaxis()->SetBinLabel(1, "Triggered all");
71  tmpHisto->GetXaxis()->SetBinLabel(2, "Triggered w/ vertex");
72  tmpHisto->GetXaxis()->SetBinLabel(3, "Pile-up corrected all");
73  tmpHisto->GetXaxis()->SetBinLabel(4, "Pile-up corrected w vertex");
74 
75  TH2* tmpHisto2D = AddHistogram2D<TH2D>("hCentrality", Form("Accepted events in centrality (%s)", fCentralityType.Data()), "COLZ", 102, 0., 102., 4, 0,4,"Centrality","Cut stage","dN^{Events}");
76  tmpHisto2D->GetYaxis()->SetBinLabel(1, "Before cuts");
77  tmpHisto2D->GetYaxis()->SetBinLabel(2, "After pile up");
78  tmpHisto2D->GetYaxis()->SetBinLabel(3, "After vertex demand");
79  tmpHisto2D->GetYaxis()->SetBinLabel(4, "After vertex cuts");
80 
81  tmpHisto = AddHistogram1D<TH1D>("hTrackAcceptance", "Accepted tracks (0 = before cuts, 1 = after eta, 2 = after pT)", "", 3, 0, 3, "stage","N^{Tracks}/cut");
82  tmpHisto->GetXaxis()->SetBinLabel(1, "Before cuts");
83  tmpHisto->GetXaxis()->SetBinLabel(2, "After eta");
84  tmpHisto->GetXaxis()->SetBinLabel(3, "After p_{T}");
85 
86  tmpHisto = AddHistogram1D<TH1D>("hJetAcceptance", "Accepted jets (0 = before cuts, 1 = after eta, 2 = after pT, 3 = after area)", "", 4, 0, 4, "stage","N^{Jets}/cut");
87  tmpHisto->GetXaxis()->SetBinLabel(1, "Before cuts");
88  tmpHisto->GetXaxis()->SetBinLabel(2, "After eta");
89  tmpHisto->GetXaxis()->SetBinLabel(3, "After p_{T}");
90  tmpHisto->GetXaxis()->SetBinLabel(4, "After area");
91 
92  tmpHisto2D = AddHistogram2D<TH2D>("hJetPtCutStages", "Jets p_{T} distribution", "", 500, -50., 200., 4, 0, 4, "p_{T} (GeV/c)","Cut stage","dN^{Jets}/dp_{T}");
93  tmpHisto2D->GetYaxis()->SetBinLabel(1, "Before cuts");
94  tmpHisto2D->GetYaxis()->SetBinLabel(2, "After eta");
95  tmpHisto2D->GetYaxis()->SetBinLabel(3, "After p_{T}");
96  tmpHisto2D->GetYaxis()->SetBinLabel(4, "After area");
97 
98  AddHistogram1D<TH1D>("hVertexX", "X distribution of the vertex", "", 2000, -1., 1., "#Delta x(cm)","dN^{Events}/dx");
99  AddHistogram1D<TH1D>("hVertexY", "Y distribution of the vertex", "", 2000, -1., 1., "#Delta y(cm)","dN^{Events}/dy");
100  AddHistogram2D<TH2D>("hVertexXY", "XY distribution of the vertex", "COLZ", 500, -1., 1., 500, -1., 1.,"#Delta x(cm)", "#Delta y(cm)","dN^{Events}/dxdy");
101  AddHistogram1D<TH1D>("hVertexZ", "Z distribution of the vertex (after std. vertex cut)", "", 200, -20., 20., "#Delta z(cm)","dN^{Events}/dz");
102  AddHistogram1D<TH1D>("hVertexR", "R distribution of the vertex", "", 100, 0., 1., "#Delta r(cm)","dN^{Events}/dr");
103  AddHistogram1D<TH1D>("hCentralityV0M", "Centrality distribution V0M", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
104  AddHistogram1D<TH1D>("hCentralityCL1", "Centrality distribution CL1", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
105  AddHistogram1D<TH1D>("hCentralityV0A", "Centrality distribution V0A", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
106  AddHistogram1D<TH1D>("hCentralityV0C", "Centrality distribution V0C", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
107  AddHistogram1D<TH1D>("hCentralityZNA", "Centrality distribution ZNA", "", fNumberOfCentralityBins, 0., 100., "Centrality","dN^{Events}");
108 
109  if(fDoJetAnalysis)
110  {
111  // Background corrected jet spectra
112  AddHistogram2D<TH2D>("hJetPtNoBgrdSubtracted", "Jets p_{T} distribution, no bgrd. subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
113  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedExternal", "Jets p_{T} distribution, external bgrd. subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
114  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedPP", "Jets p_{T} distribution, pp background subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
115  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedExternal_Phi1", "Jets p_{T} distribution, external background (Improved CMS) subtracted (1st part of azimuth)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
116  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedExternal_Phi2", "Jets p_{T} distribution, external background (Improved CMS) subtracted (2nd part of azimuth)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
117  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedKTImprovedCMS", "Jets p_{T} distribution, KT background (Improved CMS) subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
118  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedKTImprovedCMS_Biased_10GeV", "Jets p_{T} distribution, KT background (Improved CMS) subtracted, leading track bias 10 GeV", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
119  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedKTImprovedCMS_Biased_5GeV", "Jets p_{T} distribution, KT background (Improved CMS) subtracted, leading track bias 5 GeV", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
120  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedKTImprovedCMS_Biased_2GeV", "Jets p_{T} distribution, KT background (Improved CMS) subtracted, leading track bias 2 GeV", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
121  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedTR", "Jets p_{T} distribution, TR background (Cone R=0.6 around jets excluded) subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
122  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedKTPbPb", "Jets p_{T} distribution, KT background (PbPb w/o ghosts) subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
123  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedKTPbPbWithGhosts", "Jets p_{T} distribution, KT background (PbPb w/ ghosts) subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
124  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedKTCMS", "Jets p_{T} distribution, KT background (CMS) subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
125  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedKTMean", "Jets p_{T} distribution, KT background (Mean) subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
126  AddHistogram2D<TH2D>("hJetPtBgrdSubtractedKTTrackLike", "Jets p_{T} distribution, KT background (track-like) subtracted", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Jets}/dp_{T}");
127 
128  AddHistogram2D<TProfile2D>("hJetPtSubtractedRhoExternal", "Mean subtracted KT (External) background from jets", "COLZ", 600, 0, 150, fNumberOfCentralityBins, 0, 100, "Jet p_{T}", "Centrality", "#rho mean");
129  AddHistogram2D<TProfile2D>("hJetPtSubtractedRhoKTImprovedCMS", "Mean subtracted KT (CMS w/o signal) background from jets", "COLZ", 600, 0, 150, fNumberOfCentralityBins, 0, 100, "Jet p_{T}", "Centrality", "#rho mean");
130  AddHistogram2D<TProfile2D>("hJetPtSubtractedRhoPP", "Mean subtracted KT (pp from Michal) background from jets", "COLZ", 600, 0, 150, fNumberOfCentralityBins, 0, 100, "Jet p_{T}", "Centrality", "#rho mean");
131 
132  // Jet QA plots
133  AddHistogram2D<TH2D>("hJetConstituentPt0GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 0 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
134  AddHistogram2D<TH2D>("hJetConstituentPt1GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 1 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
135  AddHistogram2D<TH2D>("hJetConstituentPt2GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 2 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
136  AddHistogram2D<TH2D>("hJetConstituentPt3GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 3 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
137  AddHistogram2D<TH2D>("hJetConstituentPt4GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 4 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
138  AddHistogram2D<TH2D>("hJetConstituentPt5GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 5 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
139  AddHistogram2D<TH2D>("hJetConstituentPt7GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 7 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
140  AddHistogram2D<TH2D>("hJetConstituentPt10GeV", "Jet constituents p_{T} distribution (p_{T,jet} > 10 GeV)", "", 500, -50., 200., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
141  AddHistogram2D<TH2D>("hJetConstituentPtVsJetPt", "Jet constituents p_{T} distribution", "", 500, -50., 200., 200, 0, 200, "#it{p}_{T} (GeV/c)","#it{p}_{T}^{jet} (GeV/c)","dN^{Tracks}/dp_{T}");
142  AddHistogram1D<TH1D>("hJetCountAll", "Number of Jets", "", 200, 0., 200., "N jets","dN^{Events}/dN^{Jets}");
143  AddHistogram1D<TH1D>("hJetCountAccepted", "Number of accepted Jets", "", 200, 0., 200., "N jets","dN^{Events}/dN^{Jets}");
144  AddHistogram2D<TH2D>("hJetCount", "Correlation jets/accepted jets", "", 200, 0., 200., 200, 0., 200., "N jets","N jets accepted", "d^{2}N^{Events}/dN^{Jets dN^{Jets, acc}}");
145  AddHistogram1D<TH1D>("hLeadingJetPt", "Leading jet p_{T}", "", 500, -50., 200., "p_{T} (GeV/c)","dN^{Jets}/dp_{T}");
146  AddHistogram1D<TH1D>("hSecondLeadingJetPt", "Second leading jet p_{T}", "", 500, -50., 200., "p_{T} (GeV/c)","dN^{Jets}/dp_{T}");
147  AddHistogram1D<TH1D>("hCorrectedLeadingJetPt", "Corrected leading jet p_{T}", "", 500, -50., 200., "p_{T} (GeV/c)","dN^{Jets}/dp_{T}");
148  AddHistogram1D<TH1D>("hCorrectedSecondLeadingJetPt", "Corrected second leading jet p_{T}", "", 500, -50., 200., "p_{T} (GeV/c)","dN^{Jets}/dp_{T}");
149  AddHistogram1D<TH1D>("hJetDeltaPhi", "Jets combinatorial #Delta #phi", "", 250, 0., TMath::Pi(), "#Delta #phi","dN^{Jets}/d(#Delta #phi)");
150  AddHistogram1D<TH1D>("hLeadingJetDeltaPhi", "1st and 2nd leading jet #Delta #phi", "", 250, 0., TMath::Pi(), "#Delta #phi","dN^{Jets}/d(#Delta #phi)");
151 
152  // Background distributions
153 
154  AddHistogram2D<TH2D>("hKTBackgroundExternal", "KT background density (External task)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
155  AddHistogram2D<TH2D>("hKTBackgroundExternalVsPt", "KT background density (External task)", "LEGO2", 400, 0., 40., 200, 0, 200, "#rho (GeV/c)","Raw jet p_{T}", "dN^{Events}/d#rho");
156  AddHistogram2D<TH2D>("hKTBackgroundExternal20GeV", "KT background density (External task, jet p_{T} > 20 GeV)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
157  AddHistogram2D<TH2D>("hKTBackgroundImprovedCMS", "KT background density (Improved CMS approach)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
158  AddHistogram2D<TH2D>("hPPBackground", "PP background density (Michals approach)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
159  AddHistogram2D<TH2D>("hKTBackgroundPbPb", "KT background density (PbPb approach, no ghosts)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
160  AddHistogram2D<TH2D>("hKTBackgroundPbPbWithGhosts", "KT background density (PbPb approach w/ ghosts)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
161  AddHistogram2D<TH2D>("hKTBackgroundCMS", "KT background density (CMS approach)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
162  AddHistogram2D<TH2D>("hKTBackgroundMean", "KT background density (Mean approach)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
163  AddHistogram2D<TH2D>("hKTBackgroundTrackLike", "KT background density (Track-like approach)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
164  AddHistogram2D<TH2D>("hTRBackgroundNoExcl", "TR background density (No signal excluded)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
165  AddHistogram2D<TH2D>("hTRBackgroundCone02", "TR background density (Cones R=0.2 around signal jets excluded)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
166  AddHistogram2D<TH2D>("hTRBackgroundCone04", "TR background density (Cones R=0.4 around signal jets excluded)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
167  AddHistogram2D<TH2D>("hTRBackgroundCone06", "TR background density (Cones R=0.6 around signal jets excluded)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
168  AddHistogram2D<TH2D>("hTRBackgroundCone08", "TR background density (Cones R=0.8 around signal jets excluded)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
169  AddHistogram2D<TH2D>("hTRBackgroundExact", "TR background density (signal jets exactly excluded)", "LEGO2", 400, 0., 40., fNumberOfCentralityBins, 0, 100, "#rho (GeV/c)","Centrality", "dN^{Events}/d#rho");
170 
171  // Delta pt distributions
172  AddHistogram2D<TH2D>("hDeltaPtPP", "Background fluctuations #delta p_{T} (PP approach)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
173  AddHistogram2D<TH2D>("hDeltaPtExternalBgrd", "Background fluctuations #delta p_{T} (KT, External)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
174  AddHistogram2D<TH2D>("hDeltaPtExternalBgrdVsPt", "Background fluctuations #delta p_{T} (KT, External, in p_{T} bins)", "", 1801, -40.0, 80.0, 200, 0, 200, "#delta p_{T} (GeV/c)","Raw jet p_{T}","dN^{Jets}/d#delta p_{T}");
175  AddHistogram2D<TH2D>("hDeltaPtExternalBgrdPartialExclusion", "Background fluctuations #delta p_{T} (KT, External, partial jet exclusion)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
176  AddHistogram2D<TH2D>("hDeltaPtKTImprovedCMS", "Background fluctuations #delta p_{T} (KT, Improved CMS-like)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
177  AddHistogram2D<TH2D>("hDeltaPtNoBackground", "Background fluctuations #delta p_{T} (No background)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
178  AddHistogram2D<TH2D>("hDeltaPtKTPbPb", "Background fluctuations #delta p_{T} (KT, PbPb w/o ghosts)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
179  AddHistogram2D<TH2D>("hDeltaPtKTPbPbWithGhosts", "Background fluctuations #delta p_{T} (KT, PbPb w/ ghosts)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
180  AddHistogram2D<TH2D>("hDeltaPtKTCMS", "Background fluctuations #delta p_{T} (KT, CMS-like)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
181  AddHistogram2D<TH2D>("hDeltaPtKTMean", "Background fluctuations #delta p_{T} (KT, Mean)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
182  AddHistogram2D<TH2D>("hDeltaPtKTTrackLike", "Background fluctuations #delta p_{T} (KT, track-like)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
183  AddHistogram2D<TH2D>("hDeltaPtTR", "Background fluctuations #delta p_{T} (TR, cone R=0.6)", "", 1801, -40.0, 80.0, fNumberOfCentralityBins, 0, 100, "#delta p_{T} (GeV/c)","Centrality","dN^{Jets}/d#delta p_{T}");
184 
185  // Track QA plots
186  AddHistogram2D<TH2D>("hTrackCountAcc", "Number of tracks in acceptance vs. centrality", "LEGO2", 750, 0., 750., fNumberOfCentralityBins, 0, 100, "N tracks","Centrality", "dN^{Events}/dN^{Tracks}");
187  AddHistogram2D<TH2D>("hTrackPt", "Tracks p_{T} distribution", "", 1000, 0., 250., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)", "Centrality", "dN^{Tracks}/dp_{T}");
188  AddHistogram2D<TH2D>("hTrackPtNegEta", "Tracks p_{T} distribution (negative #eta)", "", 1000, 0., 250., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
189  AddHistogram2D<TH2D>("hTrackPtPosEta", "Tracks p_{T} distribution (positive #eta)", "", 1000, 0., 250., fNumberOfCentralityBins, 0, 100, "p_{T} (GeV/c)","Centrality","dN^{Tracks}/dp_{T}");
190  AddHistogram1D<TH1D>("hTrackCharge", "Charge", "", 11, -5, 5, "Charge (e)","dN^{Tracks}/dq");
191  AddHistogram1D<TH1D>("hTrackPhi", "Track #phi distribution", "", 360, 0, TMath::TwoPi(), "#phi","dN^{Tracks}/d#phi");
192  AddHistogram2D<TH2D>("hTrackPhiEta", "Track angular distribution", "LEGO2", 100, 0., 2*TMath::Pi(),100, -2.5, 2.5, "#phi","#eta","dN^{Tracks}/(d#phi d#eta)");
193  AddHistogram2D<TH2D>("hTrackPtPhiEta", "Track p_{T} angular distribution", "LEGO2", 100, 0., 2*TMath::Pi(),100, -2.5, 2.5, "#phi","#eta","dp_{T}^{Tracks}/(d#phi d#eta)");
194  AddHistogram2D<TH2D>("hTrackPhiPtCut", "Track #phi distribution for different pT cuts", "LEGO2", 360, 0, TMath::TwoPi(), 20, 0, 20, "#phi", "p_{T} lower cut", "dN^{Tracks}/d#phi dp_{T}");
195  AddHistogram2D<TH2D>("hTrackPhiTrackType", "Track #phi distribution for different track types", "LEGO2", 360, 0, TMath::TwoPi(), 3, 0, 3, "#phi", "Label", "dN^{Tracks}/d#phi");
196  AddHistogram2D<TH2D>("hTrackPtTrackType", "Track p_{T} distribution for different track types", "LEGO2", 1000, 0., 250., 3, 0, 3, "p_{T} (GeV/c)", "Label", "dN^{Tracks}/dp_{T}");
197  AddHistogram2D<TH2D>("hTrackEta", "Track #eta distribution", "COLZ", 180, fMinEta, fMaxEta, fNumberOfCentralityBins, 0., 100., "#eta", "Centrality", "dN^{Tracks}/d#eta");
198 
199  // Jet QA plots
200  AddHistogram1D<TH1D>("hRawJetArea", "Jets area distribution w/o area cut", "", 200, 0., 2., "Area","dN^{Jets}/dA");
201  AddHistogram2D<TH2D>("hJetArea", "Jets area distribution", "COLZ", 200, 0., 2., 500, -50., 200, "Area","Jet p_{T}","dN^{Jets}/dA");
202  AddHistogram2D<TH2D>("hRawJetPhiEta", "Raw Jets angular distribution w/o #eta cut", "LEGO2", 360, 0., 2*TMath::Pi(),100, -1.0, 1.0, "#phi","#eta","dN^{Jets}/(d#phi d#eta)");
203  AddHistogram2D<TH2D>("hJetEta", "Jets #eta distribution", "COLZ", 180, fMinEta, fMaxEta, fNumberOfCentralityBins, 0., 100., "#eta", "Centrality", "dN^{Jets}/d#eta");
204  AddHistogram2D<TH2D>("hJetEta2GeVTracks", "Jets #eta distribution, track p_{T} > 2 GeV", "COLZ", 180, fMinEta, fMaxEta, fNumberOfCentralityBins, 0., 100., "#eta", "Centrality", "dN^{Jets}/d#eta");
205  AddHistogram2D<TH2D>("hJetEta4GeVTracks", "Jets #eta distribution, track p_{T} > 4 GeV", "COLZ", 180, fMinEta, fMaxEta, fNumberOfCentralityBins, 0., 100., "#eta", "Centrality", "dN^{Jets}/d#eta");
206  AddHistogram2D<TH2D>("hJetPhiEta", "Jets angular distribution", "LEGO2", 360, 0., 2*TMath::Pi(),100, -1.0, 1.0, "#phi","#eta","dN^{Jets}/(d#phi d#eta)");
207  AddHistogram2D<TH2D>("hJetPtPhiEta", "Jets p_{T} angular distribution", "LEGO2", 360, 0., 2*TMath::Pi(),100, -1.0, 1.0, "#phi","#eta","dp_{T}^{Jets}/(d#phi d#eta)");
208  AddHistogram2D<TH2D>("hJetPtVsConstituentCount", "Jets number of constituents vs. jet p_{T}", "COLZ", 400, 0., 200., 100, 0., 100., "p_{T}","N^{Tracks}","dN^{Jets}/(dp_{T} dN^{tracks})");
209 
210  // ######## Jet constituent analysis
211 
212  if(fAnalyzeJetConstituents)
213  {
214  {
215  // jet pt, const pT, const count, RC const count, PC const count
216  Int_t bins [5] = { 30, 50, 30, 30, 30};
217  Double_t minEdges[5] = { 0, 0.1, 0, 0, 0};
218  Double_t maxEdges[5] = { 150, 150, 30, 30, 30};
219  TString axisName[5] = {"jet p_{T}","Constituent p_{T}", "Constituent count","RC constituent count","PC constituent count"};
220  TString axisTitle[5] = {"jet p_{T}","Constituent p_{T}", "Constituent count","RC constituent count","PC constituent count"};
221  THnF * histJetConstituents = new THnF("hJetConstituents", "Jet constituent count/p_{T} in jet, RC, and PC", 5, bins, minEdges, maxEdges);
222  BinLogAxis(histJetConstituents,1);
223  for (Int_t iaxis=0; iaxis<5;iaxis++){
224  histJetConstituents->GetAxis(iaxis)->SetName(axisName[iaxis]);
225  histJetConstituents->GetAxis(iaxis)->SetTitle(axisTitle[iaxis]);
226  }
227  fCurrentOutputList->Add(histJetConstituents);
228  }
229 
230  {
231  // jet pt, const pt, const count distance
232  Int_t bins [4] = { 30, 50, 30, 50};
233  Double_t minEdges[4] = { 0, 0.1, 0, 0};
234  Double_t maxEdges[4] = { 150, 150, 30, 0.5};
235  TString axisName[4] = {"jet p_{T}","Constituent p_{T}","Constituent count","Distance from jet axis"};
236  TString axisTitle[4] = {"jet p_{T}","Constituent p_{T}","Constituent count","Distance from jet axis"};
237  THnF * histJetConstituentDistance = new THnF("hJetConstituentDistance", "Jet constituent distance vs. jet and constituent p_{T}", 4, bins, minEdges, maxEdges);
238  BinLogAxis(histJetConstituentDistance,1);
239  for (Int_t iaxis=0; iaxis<4;iaxis++){
240  histJetConstituentDistance->GetAxis(iaxis)->SetName(axisName[iaxis]);
241  histJetConstituentDistance->GetAxis(iaxis)->SetTitle(axisTitle[iaxis]);
242  }
243  fCurrentOutputList->Add(histJetConstituentDistance);
244  }
245  }
246 
247  // ######## Jet profiles
248  if(fAnalyzeJetProfile)
249  {
250  SetCurrentOutputList(1);
251  AddHistogram2D<TH2D>("hJetProfile10GeV", "Jet profile, cone p_{T}/jet p_{T} vs. jet radius, jet p_{T} > 10 GeV", "", 12, 0, 0.6,200, 0., 2., "Cone radius","dN^{Jets}/dR", "Ratio");
252  AddHistogram2D<TH2D>("hJetProfile20GeV", "Jet profile, cone p_{T}/jet p_{T} vs. jet radius, jet p_{T} > 20 GeV", "", 12, 0, 0.6,200, 0., 2., "Cone radius","dN^{Jets}/dR", "Ratio");
253  AddHistogram2D<TH2D>("hJetProfile30GeV", "Jet profile, cone p_{T}/jet p_{T} vs. jet radius, jet p_{T} > 30 GeV", "", 12, 0, 0.6,200, 0., 2., "Cone radius","dN^{Jets}/dR", "Ratio");
254  AddHistogram2D<TH2D>("hJetProfile40GeV", "Jet profile, cone p_{T}/jet p_{T} vs. jet radius, jet p_{T} > 40 GeV", "", 12, 0, 0.6,200, 0., 2., "Cone radius","dN^{Jets}/dR", "Ratio");
255  AddHistogram2D<TH2D>("hJetProfile50GeV", "Jet profile, cone p_{T}/jet p_{T} vs. jet radius, jet p_{T} > 50 GeV", "", 12, 0, 0.6,200, 0., 2., "Cone radius","dN^{Jets}/dR", "Ratio");
256  AddHistogram2D<TH2D>("hJetProfile60GeV", "Jet profile, cone p_{T}/jet p_{T} vs. jet radius, jet p_{T} > 60 GeV", "", 12, 0, 0.6,200, 0., 2., "Cone radius","dN^{Jets}/dR", "Ratio");
257  AddHistogram2D<TH2D>("hJetProfile70GeV", "Jet profile, cone p_{T}/jet p_{T} vs. jet radius, jet p_{T} > 70 GeV", "", 12, 0, 0.6,200, 0., 2., "Cone radius","dN^{Jets}/dR", "Ratio");
258  SetCurrentOutputList(0);
259  }
260  }
261  // ######## Jet track cuts
262  if(fAnalyzeTrackcuts)
263  {
264  SetCurrentOutputList(2);
265 
266  AddCutHistogram("hCutsNumberClusters", "Trackcut histogram: Number of clusters", "Number of clusters", 40, 20, 160);
267  AddCutHistogram("hCutsChi2TPC", "Trackcut histogram: #chi^{2} per TPC cluster", "#chi^{2}", 40, 0, 8);
268  AddCutHistogram("hCutsChi2ITS", "Trackcut histogram: #chi^{2} per ITS cluster", "#chi^{2}", 25, 0., 50);
269  AddCutHistogram("hCutsChi2Constrained", "Trackcut histogram: #chi^{2} for global constrained tracks", "#chi^{2}", 60, 0, 60);
270  AddCutHistogram("hCutsDCAXY", "Trackcut histogram: Max. DCA xy for prim. vertex", "DCA xy", 20, 0, 4);
271  AddCutHistogram("hCutsDCAZ", "Trackcut histogram: Max. DCA z for prim. vertex", "DCA z", 20, 0, 4);
272  AddCutHistogram("hCutsSPDHit", "Trackcut histogram: Hit in SPD layer", "Hit or not", 2, -0.5, 1.5);
273  AddCutHistogram("hCutsNumberCrossedRows", "Trackcut histogram: Number of crossed rows", "Number of crossed rows", 40, 20, 160);
274  AddCutHistogram("hCutsNumberCrossedRowsOverFindableClusters", "Trackcut histogram: Number of crossed rows over findable clusters", "Number of crossed rows over findable clusters", 26, 0.4, 1.8);
275  AddCutHistogram("hCutsSharedTPC", "Trackcut histogram: Shared TPC clusters", "Shared fraction", 40, 0, 1);
276  AddCutHistogram("hCutsTPCRefit", "Trackcut histogram: TPC refit", "Has TPC refit", 2, -0.5, 1.5);
277  AddCutHistogram("hCutsAcceptKinks", "Trackcut histogram: Kink in track", "Kink in track", 2, -0.5, 1.5);
278  AddCutHistogram("hCutsTPCLength", "Trackcut histogram: TPC length", "TPC length", 40, 0, 170);
279  AddCutHistogram("hCutsTrackConstrained", "Trackcut histogram: Tracks constrained to vertex", "Track is constrained", 2, -0.5, 1.5);
280  AddCutHistogram("hCutsTPCITSMatching", "Trackcut histogram: TPC-ITS matching", "Track is matched", 2, -0.5, 1.5);
281  AddCutHistogram("hCutsClustersPtDependence", "Trackcut histogram: pT dependence for number of clusters/crossed rows cut.", "Value at 20 GeV: 90, 100, 110, or 120", 4, -0.5, 3.5);
282 
283  const int nbPt=100;
284  const double ptMax=50;
285  AddHistogram2D<TH2D>("hCutsITSTPC_NMatch", "Number matches", "", nbPt,0,ptMax,kMaxMatch+1,-0.5,kMaxMatch+0.5, "p_{T}","N matches");
286  AddHistogram2D<TH2D>("hCutsITSTPC_BestMatch", "Best match chi2", "", nbPt,0,ptMax,2*int(TMath::Max(1.1,kMaxChi2)),0,kMaxChi2, "p_{T}","chi2");
287  AddHistogram2D<TH2D>("hCutsITSTPC_BestMatch_cuts", "Best match chi2", "", nbPt,0,ptMax,2*int(TMath::Max(1.1,kMaxChi2)),0,kMaxChi2, "p_{T}","chi2");
288  AddHistogram2D<TH2D>("hCutsITSTPC_AllMatch", "All matches chi2", "", nbPt,0,ptMax,2*int(TMath::Max(1.1,kMaxChi2)),0,kMaxChi2, "p_{T}","chi2");
289  AddHistogram2D<TH2D>("hCutsITSTPC_AllMatchGlo", "All matches chi2", "", nbPt,0,ptMax,2*int(TMath::Max(1.1,kMaxChi2)),0,kMaxChi2, "p_{T}","chi2");
290  AddHistogram2D<TH2D>("hCutsITSTPC_PtCorr_ITSTPC", "PtCorr", "", nbPt,0,ptMax,nbPt,0,ptMax, "p_{T}","p_{T}");
291  AddHistogram2D<TH2D>("hCutsITSTPC_dPtRel_ITSTPC", "dPt/pt", "", nbPt,0,ptMax,2*nbPt+1,-0.4*ptMax,0.4*ptMax, "p_{T}","1/pt");
292  AddHistogram2D<TH2D>("hCutsITSTPC_dInvPtRel_ITSTPC", "pt*dPt^{-1}", "", nbPt,0,ptMax,2*nbPt+1,-0.4*ptMax,0.4*ptMax, "p_{T}","1/pt");
293 
294  AddHistogram2D<TH2D>("hCutsITSTPC_NMatchBg", "Number matches", "", nbPt,0,ptMax,kMaxMatch+1,-0.5,kMaxMatch+0.5, "p_{T}","N matches");
295  AddHistogram2D<TH2D>("hCutsITSTPC_BestMatchBg", "Best match chi2", "", nbPt,0,ptMax,2*int(TMath::Max(1.1,kMaxChi2)),0,kMaxChi2, "p_{T}","chi2");
296  AddHistogram2D<TH2D>("hCutsITSTPC_BestMatchBg_cuts", "Best match chi2", "", nbPt,0,ptMax,2*int(TMath::Max(1.1,kMaxChi2)),0,kMaxChi2, "p_{T}","chi2");
297  AddHistogram2D<TH2D>("hCutsITSTPC_AllMatchBg", "All matches chi2", "", nbPt,0,ptMax,2*int(TMath::Max(1.1,kMaxChi2)),0,kMaxChi2, "p_{T}","chi2");
298  AddHistogram2D<TH2D>("hCutsITSTPC_AllMatchGloBg", "All matches chi2", "", nbPt,0,ptMax,2*int(TMath::Max(1.1,kMaxChi2)),0,kMaxChi2, "p_{T}","chi2");
299  AddHistogram2D<TH2D>("hCutsITSTPC_PtCorrBg_ITSTPC", "PtCorr", "", nbPt,0,ptMax,nbPt,0,ptMax, "p_{T}","p_{T}");
300  AddHistogram2D<TH2D>("hCutsITSTPC_dPtRelBg_ITSTPC", "dPt/pt", "", nbPt,0,ptMax,2*nbPt+1,-0.4*ptMax,0.4*ptMax, "p_{T}","1/pt");
301  AddHistogram2D<TH2D>("hCutsITSTPC_dInvPtRelBg_ITSTPC", "pt*dPt^{-1}", "", nbPt,0,ptMax,2*nbPt+1,-0.4*ptMax,0.4*ptMax, "p_{T}","1/pt");
302 
303  SetCurrentOutputList(0);
304  }
305 
306  PostData(1, fOutputLists[0]);
307  if(fAnalyzeJetProfile)
308  PostData(2, fOutputLists[1]);
309  if(fAnalyzeTrackcuts)
310  {
311  if(fAnalyzeJetProfile)
312  PostData(3, fOutputLists[2]);
313  else
314  PostData(2, fOutputLists[1]);
315  }
316 
317 }
318 
319 //________________________________________________________________________
320 AliAnalysisTaskChargedJetsPA::AliAnalysisTaskChargedJetsPA(const char *name, const char* trackArrayName, const char* jetArrayName, const char* backgroundJetArrayName, Bool_t analyzeJetProfile, Bool_t analyzeTrackcuts) : AliAnalysisTaskSE(name), fOutputLists(), fCurrentOutputList(0), fDoJetAnalysis(1), fAnalyzeJetProfile(0), fAnalyzeTrackcuts(0), fAnalyzeJetConstituents(1), fParticleLevel(0), fUseDefaultVertexCut(1), fUsePileUpCut(1), fSetCentralityToOne(0), fNoExternalBackground(0), fBackgroundForJetProfile(0), fPartialAnalysisNParts(1), fPartialAnalysisIndex(0), fJetArray(0), fTrackArray(0), fBackgroundJetArray(0), fJetArrayName(), fTrackArrayName(), fBackgroundJetArrayName(), fRhoTaskName(), fRandConeRadius(0.4), fRandConeNumber(10), fSignalJetRadius(0.4), fBackgroundJetRadius(0.4), fNumberExcludedJets(-1), fMinEta(-0.9), fMaxEta(0.9), fMinJetEta(-0.5), fMaxJetEta(0.5), fMinTrackPt(0.150), fMinJetPt(5.0), fMinJetArea(0.5), fMinBackgroundJetPt(0.0), fMinNCrossedRows(70), fUsePtDepCrossedRowsCut(0), fNumberOfCentralityBins(20), fCentralityType("V0A"), fMatchTr(), fMatchChi(), fPrimaryVertex(0), fFirstLeadingJet(0), fSecondLeadingJet(0), fFirstLeadingKTJet(0), fSecondLeadingKTJet(0), fNumberSignalJets(0), fNumberSignalJetsAbove5GeV(0), fRandom(0), fHelperClass(0), fInitialized(0), fTaskInstanceCounter(0), fIsDEBUG(0), fIsPA(1), fNoTerminate(1), fEventCounter(0), fTempExcludedRCs(0), fTempAllRCs(1), fTempOverlapCounter(0), fTempMeanExclusionProbability(0), fHybridESDtrackCuts(0), fHybridESDtrackCuts_variedPtDep(0), fHybridESDtrackCuts_variedPtDep2(0)
321 {
322  #ifdef DEBUGMODE
323  AliInfo("Calling constructor.");
324  #endif
325 
326  // Every instance of this task gets his own number
327  static Int_t instance = 0;
328  fTaskInstanceCounter = instance;
329  instance++;
330 
331  fAnalyzeJetProfile = analyzeJetProfile;
332  fAnalyzeTrackcuts = analyzeTrackcuts;
333 
334  // Save the observables array names
335  fTrackArrayName = trackArrayName;
336  fJetArrayName = jetArrayName;
337  fBackgroundJetArrayName = backgroundJetArrayName;
338 
339  if (fTrackArrayName.Contains("MCParticles") || fTrackArrayName.Contains("mcparticles"))
340  fParticleLevel = kTRUE;
341 
342  DefineOutput(1, TList::Class());
344  DefineOutput(2, TList::Class());
346  {
348  DefineOutput(3, TList::Class());
349  else
350  DefineOutput(2, TList::Class());
351  }
352 
353  #ifdef DEBUGMODE
354  AliInfo("Constructor done.");
355  #endif
356 }
357 
358 //________________________________________________________________________
360 {
361  AliESDtrackCuts* commonTrackCuts = new AliESDtrackCuts;
362  commonTrackCuts->SetMaxChi2PerClusterTPC(4);
363  commonTrackCuts->SetMaxChi2PerClusterITS(36);
364  commonTrackCuts->SetAcceptKinkDaughters(kFALSE);
365  commonTrackCuts->SetRequireTPCRefit(kTRUE);
366  commonTrackCuts->SetRequireITSRefit(kTRUE);
367  commonTrackCuts->SetRequireSigmaToVertex(kFALSE);
368  commonTrackCuts->SetMaxDCAToVertexXY(2.4);
369  commonTrackCuts->SetMaxDCAToVertexZ(3.2);
370  commonTrackCuts->SetDCAToVertex2D(kTRUE);
371  commonTrackCuts->SetMaxFractionSharedTPCClusters(0.4);
372  commonTrackCuts->SetMaxChi2TPCConstrainedGlobal(36);
373  commonTrackCuts->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kAny);
374 
375  AliESDtrackCuts* fTrackCutsPA_global = NULL;
376  AliESDtrackCuts* fTrackCutsPA_complementary = NULL;
377  AliESDtrackCuts* fTrackCutsPP_global = NULL;
378  AliESDtrackCuts* fTrackCutsPP_complementary = NULL;
379  AliESDtrackCuts* fTrackCutsPP_global_variedPtDep = NULL;
380  AliESDtrackCuts* fTrackCutsPP_complementary_variedPtDep = NULL;
381  AliESDtrackCuts* fTrackCutsPP_global_variedPtDep2 = NULL;
382  AliESDtrackCuts* fTrackCutsPP_complementary_variedPtDep2 = NULL;
383 
384  //pPb
385  fTrackCutsPA_global = static_cast<AliESDtrackCuts*>(commonTrackCuts->Clone("fTrackCutsPA_global"));
386  fTrackCutsPA_global->SetMinNCrossedRowsTPC(fMinNCrossedRows);
387  fTrackCutsPA_global->SetMinRatioCrossedRowsOverFindableClustersTPC(0.8);
388  fTrackCutsPA_complementary = static_cast<AliESDtrackCuts*>(fTrackCutsPA_global->Clone("fTrackCutsPA_complementary"));
389  fTrackCutsPA_complementary->SetRequireITSRefit(kFALSE);
390  fTrackCutsPA_complementary->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
391 
392  //pp
393  fTrackCutsPP_global = static_cast<AliESDtrackCuts*>(commonTrackCuts->Clone("fTrackCutsPP_global"));
394  TFormula *f1NClustersTPCLinearPtDep = new TFormula("f1NClustersTPCLinearPtDep","70.+30./20.*x");
395  fTrackCutsPP_global->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep,20.);
396  fTrackCutsPP_global->SetMinNClustersTPC(70);
397  fTrackCutsPP_global->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
398  fTrackCutsPP_global->SetEtaRange(-0.9,0.9);
399  fTrackCutsPP_global->SetPtRange(0.15, 1e15);
400  fTrackCutsPP_complementary = static_cast<AliESDtrackCuts*>(fTrackCutsPP_global->Clone("fTrackCutsPP_complementary"));
401  fTrackCutsPP_complementary->SetRequireITSRefit(kFALSE);
402  fTrackCutsPP_complementary->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
403 
404  //pp, different pT dependence of number clusters cut, No. I
405 
406  fTrackCutsPP_global_variedPtDep = static_cast<AliESDtrackCuts*>(commonTrackCuts->Clone("fTrackCutsPP_global_variedPtDep"));
407  TFormula *f1NClustersTPCLinearPtDep2 = new TFormula("f1NClustersTPCLinearPtDep2","70.+15./20.*x");
408  fTrackCutsPP_global_variedPtDep->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep2,20.);
409  fTrackCutsPP_global_variedPtDep->SetMinNClustersTPC(70);
410  fTrackCutsPP_global_variedPtDep->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
411  fTrackCutsPP_global_variedPtDep->SetEtaRange(-0.9,0.9);
412  fTrackCutsPP_global_variedPtDep->SetPtRange(0.15, 1e15);
413  fTrackCutsPP_complementary_variedPtDep = static_cast<AliESDtrackCuts*>(fTrackCutsPP_global_variedPtDep->Clone("fTrackCutsPP_complementary_variedPtDep"));
414  fTrackCutsPP_complementary_variedPtDep->SetRequireITSRefit(kFALSE);
415  fTrackCutsPP_complementary_variedPtDep->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
416 
417  //pp, different pT dependence of number clusters cut, No. II
418 
419  fTrackCutsPP_global_variedPtDep2 = static_cast<AliESDtrackCuts*>(commonTrackCuts->Clone("fTrackCutsPP_global_variedPtDep2"));
420  TFormula *f1NClustersTPCLinearPtDep3 = new TFormula("f1NClustersTPCLinearPtDep3","70.+45./20.*x");
421  fTrackCutsPP_global_variedPtDep2->SetMinNClustersTPCPtDep(f1NClustersTPCLinearPtDep3,20.);
422  fTrackCutsPP_global_variedPtDep2->SetMinNClustersTPC(70);
423  fTrackCutsPP_global_variedPtDep2->SetRequireTPCStandAlone(kTRUE); //cut on NClustersTPC and chi2TPC Iter1
424  fTrackCutsPP_global_variedPtDep2->SetEtaRange(-0.9,0.9);
425  fTrackCutsPP_global_variedPtDep2->SetPtRange(0.15, 1e15);
426  fTrackCutsPP_complementary_variedPtDep2 = static_cast<AliESDtrackCuts*>(fTrackCutsPP_global_variedPtDep2->Clone("fTrackCutsPP_complementary_variedPtDep2"));
427  fTrackCutsPP_complementary_variedPtDep2->SetRequireITSRefit(kFALSE);
428  fTrackCutsPP_complementary_variedPtDep2->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
429 
431  if(fIsPA)
432  {
433  fHybridESDtrackCuts->SetMainCuts(fTrackCutsPA_global);
434  fHybridESDtrackCuts->SetAdditionalCuts(fTrackCutsPA_complementary);
435  }
436  else
437  {
440 
441  fHybridESDtrackCuts->SetMainCuts(fTrackCutsPP_global);
442  fHybridESDtrackCuts->SetAdditionalCuts(fTrackCutsPP_complementary);
443  fHybridESDtrackCuts_variedPtDep->SetMainCuts(fTrackCutsPP_global_variedPtDep);
444  fHybridESDtrackCuts_variedPtDep->SetAdditionalCuts(fTrackCutsPP_complementary_variedPtDep);
445  fHybridESDtrackCuts_variedPtDep2->SetMainCuts(fTrackCutsPP_global_variedPtDep2);
446  fHybridESDtrackCuts_variedPtDep2->SetAdditionalCuts(fTrackCutsPP_complementary_variedPtDep2);
447  }
448 
449  delete commonTrackCuts;
450 }
451 
452 //________________________________________________________________________
454 {
455 
456  AliESDEvent* fESD = dynamic_cast<AliESDEvent*>( InputEvent() );
457  if (!fESD)
458  {
459  AliError("For cut analysis, ESDs must be processed!");
460  return;
461  }
462 
464 
465  Float_t dca[2], cov[3]; // dca_xy, dca_z, sigma_xy, sigma_xy_z, sigma_z for the vertex cut
466  for (Int_t i=0;i < fESD->GetNumberOfTracks(); i++)
467  {
468  AliESDtrack* track = fESD->GetTrack(i);
469 
470  // Basics kinematic variables
471  Double_t pT = track->Pt();
472  Double_t eta = track->Eta();
473  Double_t phi = track->Phi();
474 
475  // Number of clusters
476  Double_t nclsITS = track->GetITSclusters(0);
477 
478  // Crossed rows
479  Double_t ncrTPC = track->GetTPCCrossedRows();
480  Double_t nCRoverFC = 0;
481  if(track->GetTPCNclsF())
482  nCRoverFC = track->GetTPCCrossedRows()/track->GetTPCNclsF();
483 
484  // Chi2 of tracks
485  Double_t chi2ITS = 999.;
486  if (nclsITS)
487  chi2ITS = track->GetITSchi2()/nclsITS;
488  Double_t chi2TPC = 999.;
489  Double_t chi2TPCConstrained = track->GetChi2TPCConstrainedVsGlobal(static_cast<const AliESDVertex*>(fPrimaryVertex));
490 
491  // Misc
492  Double_t SharedTPCClusters = 999.;
493  Double_t nClustersTPC = 0;
494 
495  if(fHybridESDtrackCuts->GetMainCuts()->GetRequireTPCStandAlone())
496  {
497  nClustersTPC = track->GetTPCNclsIter1();
498  if(nClustersTPC)
499  chi2TPC = track->GetTPCchi2Iter1()/nClustersTPC;
500  }
501  else
502  {
503  nClustersTPC = track->GetTPCclusters(0);
504  if(nClustersTPC)
505  chi2TPC = track->GetTPCchi2()/nClustersTPC;
506  }
507 
508  if(nClustersTPC)
509  SharedTPCClusters = static_cast<Double_t>(track->GetTPCnclsS())/static_cast<Double_t>(nClustersTPC);
510 
511 
512  Double_t tpcLength = 0.;
513  if (track->GetInnerParam() && track->GetESDEvent()) {
514  tpcLength = track->GetLengthInActiveZone(1, 1.8, 220, track->GetESDEvent()->GetMagneticField());
515  }
516  track->GetImpactParameters(dca, cov);
517 
518  // Basic kinematic cuts
519  if((pT<0.15) || (TMath::Abs(eta)>0.9))
520  continue;
521 
522  Int_t trackType = 0;
523 
524  // ################################################################
525  // ################################################################
526 
527  if(fIsPA)
528  {
529  trackType = fHybridESDtrackCuts->AcceptTrack(track);
530  Double_t tmpThreshold90 = 70. + 20./20. * pT;
531  Double_t tmpThreshold100 = 70. + 30./20. * pT;
532  Double_t tmpThreshold110 = 70. + 40./20. * pT;
533  Double_t tmpThreshold120 = 70. + 50./20. * pT;
534 
535  if(pT>20.)
536  {
537  tmpThreshold90 = 70. + 20.;
538  tmpThreshold100 = 70. + 30.;
539  tmpThreshold110 = 70. + 40.;
540  tmpThreshold120 = 70. + 50.;
541  }
542 
543  if (trackType)
544  {
545  if(ncrTPC>=tmpThreshold90)
546  FillCutHistogram("hCutsClustersPtDependence", 0, pT, eta, phi, trackType-1);
547  if(ncrTPC>=tmpThreshold100)
548  FillCutHistogram("hCutsClustersPtDependence", 1, pT, eta, phi, trackType-1);
549  if(ncrTPC>=tmpThreshold110)
550  FillCutHistogram("hCutsClustersPtDependence", 2, pT, eta, phi, trackType-1);
551  if(ncrTPC>=tmpThreshold120)
552  FillCutHistogram("hCutsClustersPtDependence", 3, pT, eta, phi, trackType-1);
553  }
554 
555  if(fUsePtDepCrossedRowsCut && (ncrTPC<tmpThreshold100)) // pT dep crossed rows cut is not fulfilled
556  continue; // next track
557  }
558  else
559  {
560  trackType = fHybridESDtrackCuts_variedPtDep->AcceptTrack(track);
561  if (trackType)
562  FillCutHistogram("hCutsClustersPtDependence", 0, pT, eta, phi, trackType-1);
563 
564  trackType = fHybridESDtrackCuts->AcceptTrack(track);
565  if (trackType)
566  FillCutHistogram("hCutsClustersPtDependence", 1, pT, eta, phi, trackType-1);
567 
568  trackType = fHybridESDtrackCuts_variedPtDep2->AcceptTrack(track);
569  if (trackType)
570  FillCutHistogram("hCutsClustersPtDependence", 2, pT, eta, phi, trackType-1);
571  }
572 
573  // ################################################################
574  // ################################################################
575  Int_t minNclsTPC = fHybridESDtrackCuts->GetMainCuts()->GetMinNClusterTPC();
576  Int_t minNclsTPC_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMinNClusterTPC();
577  fHybridESDtrackCuts->GetMainCuts()->SetMinNClustersTPC(0);
578  fHybridESDtrackCuts->GetAdditionalCuts()->SetMinNClustersTPC(0);
579 
580  trackType = fHybridESDtrackCuts->AcceptTrack(track);
581  if (trackType)
582  FillCutHistogram("hCutsNumberClusters", nClustersTPC, pT, eta, phi, trackType-1);
583 
584  fHybridESDtrackCuts->GetMainCuts()->SetMinNClustersTPC(minNclsTPC);
585  fHybridESDtrackCuts->GetAdditionalCuts()->SetMinNClustersTPC(minNclsTPC_Additional);
586  // ################################################################
587  // ################################################################
588  Float_t maxChi2 = fHybridESDtrackCuts->GetMainCuts()->GetMaxChi2PerClusterTPC();
589  Float_t maxChi2_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMaxChi2PerClusterTPC();
590  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2PerClusterTPC(999.);
591  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2PerClusterTPC(999.);
592 
593  trackType = fHybridESDtrackCuts->AcceptTrack(track);
594  if (trackType)
595  FillCutHistogram("hCutsChi2TPC", chi2TPC, pT, eta, phi, trackType-1);
596 
597  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2PerClusterTPC(maxChi2);
598  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2PerClusterTPC(maxChi2_Additional);
599 
600  // ################################################################
601  // ################################################################
602  Float_t maxChi2TPCConstrained = fHybridESDtrackCuts->GetMainCuts()->GetMaxChi2TPCConstrainedGlobal();
603  Float_t maxChi2TPCConstrained_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMaxChi2TPCConstrainedGlobal();
604  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2TPCConstrainedGlobal(999.);
605  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2TPCConstrainedGlobal(999.);
606 
607  trackType = fHybridESDtrackCuts->AcceptTrack(track);
608  if (trackType)
609  FillCutHistogram("hCutsChi2Constrained", chi2TPCConstrained, pT, eta, phi, trackType-1);
610 
611  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2TPCConstrainedGlobal(maxChi2TPCConstrained);
612  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2TPCConstrainedGlobal(maxChi2TPCConstrained_Additional);
613 
614  // ################################################################
615  // ################################################################
616  Float_t maxDcaZ = fHybridESDtrackCuts->GetMainCuts()->GetMaxDCAToVertexZ();
617  Float_t maxDcaZ_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMaxDCAToVertexZ();
618  fHybridESDtrackCuts->GetMainCuts()->SetMaxDCAToVertexZ(999.);
619  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxDCAToVertexZ(999.);
620 
621  trackType = fHybridESDtrackCuts->AcceptTrack(track);
622  if (trackType)
623  FillCutHistogram("hCutsDCAZ", TMath::Abs(dca[1]), pT, eta, phi, trackType-1);
624 
625  fHybridESDtrackCuts->GetMainCuts()->SetMaxDCAToVertexZ(maxDcaZ);
626  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxDCAToVertexZ(maxDcaZ_Additional);
627 
628  // ################################################################
629  // ################################################################
630  Float_t maxDcaXY = fHybridESDtrackCuts->GetMainCuts()->GetMaxDCAToVertexXY();
631  Float_t maxDcaXY_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMaxDCAToVertexXY();
632  fHybridESDtrackCuts->GetMainCuts()->SetMaxDCAToVertexXY(999.);
633  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxDCAToVertexXY(999.);
634 
635  trackType = fHybridESDtrackCuts->AcceptTrack(track);
636  if (trackType)
637  FillCutHistogram("hCutsDCAXY", TMath::Abs(dca[0]), pT, eta, phi, trackType-1);
638 
639  fHybridESDtrackCuts->GetMainCuts()->SetMaxDCAToVertexXY(maxDcaXY);
640  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxDCAToVertexXY(maxDcaXY_Additional);
641 
642  // ################################################################
643  // ################################################################
644  AliESDtrackCuts::ITSClusterRequirement clusterReq = fHybridESDtrackCuts->GetMainCuts()->GetClusterRequirementITS(AliESDtrackCuts::kSPD);
645  AliESDtrackCuts::ITSClusterRequirement clusterReq_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetClusterRequirementITS(AliESDtrackCuts::kSPD);
646  fHybridESDtrackCuts->GetMainCuts()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
647  fHybridESDtrackCuts->GetAdditionalCuts()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, AliESDtrackCuts::kOff);
648 
649  Int_t hasPoint = 0;
650  if (track->HasPointOnITSLayer(0) || track->HasPointOnITSLayer(1)) hasPoint = 1;
651  trackType = fHybridESDtrackCuts->AcceptTrack(track);
652  if (trackType)
653  FillCutHistogram("hCutsSPDHit", hasPoint, pT, eta, phi, trackType-1);
654 
655  fHybridESDtrackCuts->GetMainCuts()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, clusterReq);
656  fHybridESDtrackCuts->GetAdditionalCuts()->SetClusterRequirementITS(AliESDtrackCuts::kSPD, clusterReq_Additional);
657 
658  // ################################################################
659  // ################################################################
660  Float_t minNcrTPC = fHybridESDtrackCuts->GetMainCuts()->GetMinNCrossedRowsTPC();
661  Float_t minNcrTPC_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMinNCrossedRowsTPC();
662  fHybridESDtrackCuts->GetMainCuts()->SetMinNCrossedRowsTPC(0);
663  fHybridESDtrackCuts->GetAdditionalCuts()->SetMinNCrossedRowsTPC(0);
664 
665  trackType = fHybridESDtrackCuts->AcceptTrack(track);
666  if (trackType)
667  FillCutHistogram("hCutsNumberCrossedRows", ncrTPC, pT, eta, phi, trackType-1);
668 
669  fHybridESDtrackCuts->GetMainCuts()->SetMinNCrossedRowsTPC(minNcrTPC);
670  fHybridESDtrackCuts->GetAdditionalCuts()->SetMinNCrossedRowsTPC(minNcrTPC_Additional);
671 
672  // ################################################################
673  // ################################################################
674  Float_t minCRoverFC = fHybridESDtrackCuts->GetMainCuts()->GetMinRatioCrossedRowsOverFindableClustersTPC();
675  Float_t minCRoverFC_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMinRatioCrossedRowsOverFindableClustersTPC();
676  fHybridESDtrackCuts->GetMainCuts()->SetMinRatioCrossedRowsOverFindableClustersTPC(0.);
677  fHybridESDtrackCuts->GetAdditionalCuts()->SetMinRatioCrossedRowsOverFindableClustersTPC(0.);
678 
679  trackType = fHybridESDtrackCuts->AcceptTrack(track);
680  if (trackType)
681  FillCutHistogram("hCutsNumberCrossedRowsOverFindableClusters", nCRoverFC, pT, eta, phi, trackType-1);
682 
683  fHybridESDtrackCuts->GetMainCuts()->SetMinRatioCrossedRowsOverFindableClustersTPC(minCRoverFC);
684  fHybridESDtrackCuts->GetAdditionalCuts()->SetMinRatioCrossedRowsOverFindableClustersTPC(minCRoverFC_Additional);
685 
686  // ################################################################
687  // ################################################################
688  Float_t maxSharedTPC = fHybridESDtrackCuts->GetMainCuts()->GetMaxFractionSharedTPCClusters();
689  Float_t maxSharedTPC_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMaxFractionSharedTPCClusters();
690  fHybridESDtrackCuts->GetMainCuts()->SetMaxFractionSharedTPCClusters(999.);
691  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxFractionSharedTPCClusters(999.);
692 
693  trackType = fHybridESDtrackCuts->AcceptTrack(track);
694  if (trackType)
695  FillCutHistogram("hCutsSharedTPC", SharedTPCClusters, pT, eta, phi, trackType-1);
696 
697  fHybridESDtrackCuts->GetMainCuts()->SetMaxFractionSharedTPCClusters(maxSharedTPC);
698  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxFractionSharedTPCClusters(maxSharedTPC_Additional);
699 
700  // ################################################################
701  // ################################################################
702  Bool_t reqTPCRefit = fHybridESDtrackCuts->GetMainCuts()->GetRequireTPCRefit();
703  Bool_t reqTPCRefit_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetRequireTPCRefit();
704 
705  fHybridESDtrackCuts->GetMainCuts()->SetRequireTPCRefit(1);
706  fHybridESDtrackCuts->GetAdditionalCuts()->SetRequireTPCRefit(1);
707  trackType = fHybridESDtrackCuts->AcceptTrack(track);
708  if (trackType)
709  FillCutHistogram("hCutsTPCRefit", 1, pT, eta, phi, trackType-1);
710  else // track is not accepted as global hybrid with TPC refit requirement
711  {
712  fHybridESDtrackCuts->GetMainCuts()->SetRequireTPCRefit(0);
713  fHybridESDtrackCuts->GetAdditionalCuts()->SetRequireTPCRefit(0);
714  trackType = fHybridESDtrackCuts->AcceptTrack(track);
715  if (trackType)
716  FillCutHistogram("hCutsTPCRefit", 0, pT, eta, phi, trackType-1);
717  }
718  fHybridESDtrackCuts->GetMainCuts()->SetRequireTPCRefit(reqTPCRefit);
719  fHybridESDtrackCuts->GetAdditionalCuts()->SetRequireTPCRefit(reqTPCRefit_Additional);
720 
721  // ################################################################
722  // ################################################################
723  Bool_t accKinks = fHybridESDtrackCuts->GetMainCuts()->GetAcceptKinkDaughters();
724  Bool_t accKinks_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetAcceptKinkDaughters();
725 
726  fHybridESDtrackCuts->GetMainCuts()->SetAcceptKinkDaughters(0);
727  fHybridESDtrackCuts->GetAdditionalCuts()->SetAcceptKinkDaughters(0);
728  trackType = fHybridESDtrackCuts->AcceptTrack(track);
729  if (trackType) // A passing track has no kinks
730  FillCutHistogram("hCutsAcceptKinks", 0, pT, eta, phi, trackType-1);
731  else
732  {
733  fHybridESDtrackCuts->GetMainCuts()->SetAcceptKinkDaughters(1);
734  fHybridESDtrackCuts->GetAdditionalCuts()->SetAcceptKinkDaughters(1);
735  trackType = fHybridESDtrackCuts->AcceptTrack(track);
736  if (trackType) // A passing track has kinks
737  FillCutHistogram("hCutsAcceptKinks", 1, pT, eta, phi, trackType-1);
738  }
739  fHybridESDtrackCuts->GetMainCuts()->SetAcceptKinkDaughters(accKinks);
740  fHybridESDtrackCuts->GetAdditionalCuts()->SetAcceptKinkDaughters(accKinks_Additional);
741 
742  // ################################################################
743  // ################################################################
744  Float_t maxChi2ITS = fHybridESDtrackCuts->GetMainCuts()->GetMaxChi2PerClusterITS();
745  Float_t maxChi2ITS_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMaxChi2PerClusterITS();
746  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2PerClusterITS(999.);
747  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2PerClusterITS(999.);
748 
749  trackType = fHybridESDtrackCuts->AcceptTrack(track);
750  if (trackType)
751  FillCutHistogram("hCutsChi2ITS", chi2ITS, pT, eta, phi, trackType-1);
752 
753  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2PerClusterITS(maxChi2ITS);
754  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2PerClusterITS(maxChi2ITS_Additional);
755 
756  // ################################################################
757  // ################################################################
758  Float_t minTpcLength = fHybridESDtrackCuts->GetMainCuts()->GetMinLengthActiveVolumeTPC(); // Active length TPC
759  Float_t minTpcLength_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMinLengthActiveVolumeTPC();
760  fHybridESDtrackCuts->GetMainCuts()->SetMinLengthActiveVolumeTPC(0);
761  fHybridESDtrackCuts->GetAdditionalCuts()->SetMinLengthActiveVolumeTPC(0);
762 
763  trackType = fHybridESDtrackCuts->AcceptTrack(track);
764  if (trackType)
765  FillCutHistogram("hCutsTPCLength", tpcLength, pT, eta, phi, trackType-1);
766 
767  fHybridESDtrackCuts->GetMainCuts()->SetMinLengthActiveVolumeTPC(minTpcLength);
768  fHybridESDtrackCuts->GetAdditionalCuts()->SetMinLengthActiveVolumeTPC(minTpcLength_Additional);
769 
770  // ################################################################
771  // ################################################################
772  Bool_t isMatched = kFALSE;
773  Float_t chi2tpc = fHybridESDtrackCuts->GetMainCuts()->GetMaxChi2TPCConstrainedGlobal();
774  Float_t chi2its = fHybridESDtrackCuts->GetMainCuts()->GetMaxChi2PerClusterITS();
775  Float_t chi2tpc_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMaxChi2TPCConstrainedGlobal();
776  Float_t chi2its_Additional = fHybridESDtrackCuts->GetAdditionalCuts()->GetMaxChi2PerClusterITS();
777 
778  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2TPCConstrainedGlobal(99999.);
779  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2PerClusterITS(999999.);
780  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2TPCConstrainedGlobal(99999.);
781  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2PerClusterITS(999999.);
782 
783  trackType = fHybridESDtrackCuts->AcceptTrack(track);
784  if (trackType)
785  FillCutHistogram("hCutsTPCITSMatching", isMatched, pT, eta, phi, trackType-1);
786 
787  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2TPCConstrainedGlobal(chi2tpc);
788  fHybridESDtrackCuts->GetMainCuts()->SetMaxChi2PerClusterITS(chi2its);
789  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2TPCConstrainedGlobal(chi2tpc_Additional);
790  fHybridESDtrackCuts->GetAdditionalCuts()->SetMaxChi2PerClusterITS(chi2its_Additional);
791 
792  isMatched=kTRUE;
793  trackType = fHybridESDtrackCuts->AcceptTrack(track);
794  if (trackType)
795  FillCutHistogram("hCutsTPCITSMatching", isMatched, pT, eta, phi, trackType-1);
796 
797  // ################################################################
798  // ################################################################
799  if((fHybridESDtrackCuts->GetMainCuts()->GetClusterRequirementITS(AliESDtrackCuts::kSPD) == AliESDtrackCuts::kOff)
800  || (fHybridESDtrackCuts->GetAdditionalCuts() && (fHybridESDtrackCuts->GetAdditionalCuts()->GetClusterRequirementITS(AliESDtrackCuts::kSPD) == AliESDtrackCuts::kOff)))
801  {
802  Bool_t isConstrainedWithITSRefit = static_cast<Bool_t>(track->GetConstrainedParam()) && ((track->GetStatus())&AliESDtrack::kITSrefit);
803  if (trackType)
804  FillCutHistogram("hCutsTrackConstrained", isConstrainedWithITSRefit, pT, eta, phi, trackType-1);
805  }
806 
807  }
808 
811 }
812 
813 //________________________________________________________________________
815 {
816  //
817  // check how many its-sa tracks get matched to TPC
818  //
819  Bool_t fExcludeMomFromChi2ITSTPC = kFALSE; // ITS->TPC : exclude momentum from matching chi2 calculation
820 
821  AliESDEvent* fESD = dynamic_cast<AliESDEvent*>( InputEvent() );
822  if (!fESD)
823  {
824  AliError("For cut analysis, ESDs must be processed!");
825  return;
826  }
827 
828  int ntr = fESD->GetNumberOfTracks();
829  //
830  // initialize histograms
831  //
832  TH2D * hNMatch = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_NMatch");
833  TH2D * hBestMatch = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_BestMatch");
834  TH2D * hBestMatch_cuts = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_BestMatch_cuts");
835  TH2D * hAllMatch = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_AllMatch");
836  TH2D * hAllMatchGlo = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_AllMatchGlo");
837  TH2D * hPtCorr_ITSTPC = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_PtCorr_ITSTPC");
838  TH2D * hdPtRel_ITSTPC = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_dPtRel_ITSTPC");
839  TH2D * hdInvPtRel_ITSTPC = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_dInvPtRel_ITSTPC");
840 
841  //
842  TH2D * hNMatchBg = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_NMatchBg");
843  TH2D * hBestMatchBg = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_BestMatchBg");
844  TH2D * hBestMatchBg_cuts = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_BestMatchBg_cuts");
845  TH2D * hAllMatchBg = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_AllMatchBg");
846  TH2D * hAllMatchGloBg = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_AllMatchGloBg");
847  TH2D * hdPtRelBg_ITSTPC = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_dPtRelBg_ITSTPC");
848  TH2D * hdInvPtRelBg_ITSTPC = (TH2D*) fCurrentOutputList->FindObject("hCutsITSTPC_dInvPtRelBg_ITSTPC");
849 
850  if(!(hNMatch && hBestMatch && hBestMatch_cuts && hAllMatch && hAllMatchGlo && hPtCorr_ITSTPC && hdPtRel_ITSTPC && hdInvPtRel_ITSTPC && hNMatchBg && hBestMatchBg && hBestMatchBg_cuts && hAllMatchBg && hAllMatchGloBg && hdPtRelBg_ITSTPC && hdInvPtRelBg_ITSTPC))
851  {
852  cout << " === ERROR: At least one of the ITSTPC histograms not found! ===\n";
853  cout << Form(" === Details: %p-%p-%p-%p-%p-%p-%p-%p-%p-%p-%p-%p-%p-%p-%p", hNMatch, hBestMatch, hBestMatch_cuts, hAllMatch, hAllMatchGlo, hPtCorr_ITSTPC, hdPtRel_ITSTPC, hdInvPtRel_ITSTPC, hNMatchBg, hBestMatchBg, hBestMatchBg_cuts, hAllMatchBg, hAllMatchGloBg, hdPtRelBg_ITSTPC, hdInvPtRelBg_ITSTPC) << endl;
854  fCurrentOutputList->Print();
855  return;
856  }
857  //
858  for (int it=0;it<ntr;it++) {
859  AliESDtrack* trSA = fESD->GetTrack(it);
860  if (!trSA->IsOn(AliESDtrack::kITSpureSA) || !trSA->IsOn(AliESDtrack::kITSrefit)) continue;
861  double pt = trSA->Pt();
862 
863  // OB - fiducial eta and pt cuts
864  Double_t etaSA = trSA->Eta();
865 
866  if(TMath::Abs(etaSA)>0.8) continue;
867 
868  //
869  Int_t nmatch = 0;
870  for (int i=kMaxMatch;i--;) {fMatchChi[i]=0; fMatchTr[i]=0;}
871  for (int it1=0;it1<ntr;it1++){
872  if (it1==it) continue;
873 
874  AliESDtrack* trESD = fESD->GetTrack(it1);
875  if (!trESD->IsOn(AliESDtrack::kTPCrefit)) continue;
876 
877  Match(trSA,trESD, nmatch, fExcludeMomFromChi2ITSTPC);
878  }
879  //
880 
881  hNMatch->Fill(pt,nmatch);
882 
883  if (nmatch>0){
884  hBestMatch->Fill(pt,fMatchChi[0]);
885  hPtCorr_ITSTPC->Fill(pt,fMatchTr[0]->Pt());
886  hdPtRel_ITSTPC->Fill(pt,(pt-fMatchTr[0]->Pt())/pt);
887  hdInvPtRel_ITSTPC->Fill(pt,pt*( 1/pt - (1/fMatchTr[0]->Pt()) ));
888  }
889 
890  if (nmatch>0 && fHybridESDtrackCuts){
891 
893  hBestMatch_cuts->Fill(pt,fMatchChi[0]);
894  }
895  }
896 
897  //
898  for (int imt=nmatch;imt--;) {
899  hAllMatch->Fill(pt,fMatchChi[imt]);
900  if (fMatchTr[imt]->IsOn(AliESDtrack::kITSrefit)) hAllMatchGlo->Fill(pt,fMatchChi[imt]);
901  }
902  //
903  nmatch = 0;
904  for (int i=kMaxMatch;i--;) {fMatchChi[i]=0; fMatchTr[i]=0;}
905  for (int it1=0;it1<ntr;it1++) {
906  if (it1==it) continue;
907  AliESDtrack* trESD = fESD->GetTrack(it1);
908  if (!trESD->IsOn(AliESDtrack::kTPCrefit)) continue;
909 
910  Match(trSA,trESD, nmatch, fExcludeMomFromChi2ITSTPC, TMath::Pi());
911  }
912  //
913 
914  hNMatchBg->Fill(pt,nmatch);
915 
916  if (nmatch>0){
917  hBestMatchBg->Fill(pt,fMatchChi[0]);
918  hdPtRelBg_ITSTPC->Fill(pt,(pt-fMatchTr[0]->Pt())/pt);
919  hdInvPtRelBg_ITSTPC->Fill(pt,pt*( 1/pt - (1/fMatchTr[0]->Pt()) ));
920  }
921 
922  if (nmatch>0 && fHybridESDtrackCuts){
924  hBestMatchBg_cuts->Fill(pt,fMatchChi[0]);
925  }
926  }
927 
928  for (int imt=nmatch;imt--;) {
929  hAllMatchBg->Fill(pt,fMatchChi[imt]);
930  if (fMatchTr[imt]->IsOn(AliESDtrack::kITSrefit)) hAllMatchGloBg->Fill(pt,fMatchChi[imt]);
931  }
932  //
933  }
934 }
935 
936 //________________________________________________________________________
937 void AliAnalysisTaskChargedJetsPA::Match(AliESDtrack* tr0, AliESDtrack* tr1, Int_t& nmatch, Bool_t excludeMom, Double_t rotate)
938 {
939  //
940  // check if two tracks are matching, possible rotation for combinatoric backgr.
941  //
942  AliESDEvent* fESD = dynamic_cast<AliESDEvent*>( InputEvent() );
943  if (!fESD)
944  {
945  AliError("For cut analysis, ESDs must be processed!");
946  return;
947  }
948 
949  Float_t bField = fESD->GetMagneticField();
950  //
951  const AliExternalTrackParam* trtpc0 = tr1->GetInnerParam();
952  if (!trtpc0) return;
953  AliExternalTrackParam trtpc(*trtpc0);
954  //
955  if (TMath::Abs(rotate)>1e-5) {
956  const double *par = trtpc.GetParameter();
957  const double *cov = trtpc.GetCovariance();
958  double alp = trtpc.GetAlpha() + rotate;
959  trtpc.Set(trtpc.GetX(),alp,par,cov);
960  }
961  //
962  if (!trtpc.Rotate(tr0->GetAlpha())) return;
963  if (!trtpc.PropagateTo(tr0->GetX(),bField)) return;
964  double chi2 = tr0->GetPredictedChi2(&trtpc);
965 
966  //std::cout<<" in Match, nmatch "<<nmatch<<" par[4] before "<<trtpc.GetParameter()[4]<<" chi2 "<<chi2<<endl;
967 
968  // OB chi2 excluding pt
969  if(excludeMom){
970  ((double*)trtpc.GetParameter())[4] = tr0->GetParameter()[4]; // set ITS mom equal TPC mom
971  chi2 = tr0->GetPredictedChi2(&trtpc);
972 
973  //std::cout<<" in Match, nmatch "<<nmatch<<" par[4] after "<<trtpc.GetParameter()[4]<<" tr0 mom "<<tr0->GetParameter()[4]
974  // <<" chi2 "<<chi2<<std::endl;
975  }
976 
977 
978  if (chi2>kMaxChi2) return;
979 
980  // std::cout<<" found good match, tr1 "<<tr1<<" chi2 "<<chi2<<std::endl;
981  // std::cout<<" before: fMatchChi[0] "<<fMatchChi[0]<<" [1] "<<fMatchChi[1]
982  // <<" [2] "<<fMatchChi[2]<<" [3] "<<fMatchChi[3]
983  // <<" [4] "<<fMatchChi[4]<<std::endl;
984 
985  // std::cout<<" before: fMatchTr[0] "<<fMatchTr[0]<<" [1] "<<fMatchTr[1]
986  // <<" [2] "<<fMatchTr[2]<<" [3] "<<fMatchTr[3]
987  // <<" [4] "<<fMatchTr[4]<<std::endl;
988 
989  //
990  int ins;
991  for (ins=0;ins<nmatch;ins++) if (chi2<fMatchChi[ins]) break;
992  if (ins>=kMaxMatch) return;
993 
994  for (int imv=nmatch;imv>ins;imv--) {
995  if (imv>=kMaxMatch) continue;
996  fMatchTr[imv] = fMatchTr[imv-1];
997  fMatchChi[imv] = fMatchChi[imv-1];
998  }
999  fMatchTr[ins] = tr1;
1000  fMatchChi[ins] = chi2;
1001  nmatch++;
1002  if (nmatch>=kMaxMatch) nmatch = kMaxMatch;
1003  //
1004 }
1005 
1006 //________________________________________________________________________
1008 {
1009  // Get rho from event.
1010  AliRhoParameter *rho = 0;
1011  if (!fRhoTaskName.IsNull()) {
1012  rho = dynamic_cast<AliRhoParameter*>(InputEvent()->FindListObject(fRhoTaskName.Data()));
1013  if (!rho) {
1014  AliWarning(Form("%s: Could not retrieve rho with name %s!", GetName(), fRhoTaskName.Data()));
1015  return 0;
1016  }
1017  }
1018  else
1019  return 0;
1020 
1021  return (rho->GetVal());
1022 }
1023 
1024 //________________________________________________________________________
1026 {
1027  if (!event)
1028  return kFALSE;
1029 
1030  fPrimaryVertex = event->GetPrimaryVertex();
1031 
1032  // ### Create plot for vertex acceptance
1033  fHelperClass->SetMaxVtxZ(10000.);
1034 
1035  // Check vertex existance
1036  Bool_t hasVertex = kFALSE;
1038  {
1039  if(fHelperClass->IsVertexSelected2013pA(event))
1040  hasVertex = kTRUE;
1041  }
1042  else
1043  {
1044  if(!fPrimaryVertex || (fPrimaryVertex->GetNContributors()<2) || (TMath::Sqrt(fPrimaryVertex->GetX()*fPrimaryVertex->GetX() + fPrimaryVertex->GetY()*fPrimaryVertex->GetY()) > 1.0))
1045  hasVertex = kTRUE;
1046  }
1047 
1048  // All triggered events
1049  FillHistogram("hVertexAcceptance", 0.5); // all triggered events all
1050  if(hasVertex)
1051  FillHistogram("hVertexAcceptance", 1.5); // all triggered events w/ vertex
1052 
1053  // Pile-up corrected events
1054  if(!fHelperClass->IsPileUpEvent(event))
1055  {
1056  FillHistogram("hVertexAcceptance", 2.5); // pile-up corr. events all
1057  if(hasVertex)
1058  FillHistogram("hVertexAcceptance", 3.5); // pile-up corr. events w/ vertex
1059  }
1060 
1061  fHelperClass->SetMaxVtxZ(10.);
1062 
1063  // ### Get centrality values
1064  AliCentrality* tmpCentrality = event->GetCentrality();
1065  Double_t centralityPercentile = -1.0;
1066  if (tmpCentrality != NULL)
1067  centralityPercentile = tmpCentrality->GetCentralityPercentile(fCentralityType.Data());
1068  FillHistogram("hCentrality",centralityPercentile);
1069 
1071  centralityPercentile = 1.0;
1072 
1073  if((centralityPercentile < 0.0) || (centralityPercentile > 101.0))
1074  AliWarning(Form("Centrality value not valid (c=%E)",centralityPercentile));
1075 
1076  FillHistogram("hCentrality", centralityPercentile, 0.5); // before any cuts
1077 
1078  // ### CUT STAGE 1: Pile-up events (only holds for pPb)
1079  if(fUsePileUpCut)
1080  if(fHelperClass->IsPileUpEvent(event))
1081  return kFALSE;
1082 
1083  FillHistogram("hCentrality", centralityPercentile, 1.5); // after pileup cut
1084 
1085  // ### CUT STAGE 2: Existence of primary vertex
1086 
1087  if(!hasVertex)
1088  return kFALSE;
1089 
1090  FillHistogram("hVertexZ",fPrimaryVertex->GetZ());
1091  FillHistogram("hCentrality", centralityPercentile, 2.5); // after vertex existance cut
1092 
1093  // ### CUT STAGE 3: Position of primary vertex
1094  if((TMath::Abs(fPrimaryVertex->GetZ()) > 10.0))
1095  return kFALSE;
1096 
1097  FillHistogram("hCentrality", centralityPercentile, 3.5); // after vertex position cut
1098 
1099  return kTRUE;
1100 }
1101 
1102 //________________________________________________________________________
1104 {
1105  FillHistogram("hTrackAcceptance", 0.5);
1106  if (track != 0)
1107  {
1108  if ((track->Eta() < fMaxEta) && (track->Eta() >= fMinEta))
1109  {
1110  FillHistogram("hTrackAcceptance", 1.5);
1111  if (track->Pt() >= fMinTrackPt)
1112  {
1113  FillHistogram("hTrackAcceptance", 2.5);
1114  return kTRUE;
1115  }
1116  }
1117  }
1118  return kFALSE;
1119 }
1120 
1121 //________________________________________________________________________
1123 {
1124  if (jet != 0)
1125  if ((jet->Eta() >= fMinJetEta) && (jet->Eta() < fMaxJetEta))
1126  if (jet->Pt() >= fMinBackgroundJetPt)
1127  return kTRUE;
1128 
1129  return kFALSE;
1130 }
1131 
1132 //________________________________________________________________________
1134 {
1135  Bool_t acceptedWithPtCut = kFALSE;
1136  Bool_t acceptedWithoutPtCut = kFALSE;
1137 
1138  FillHistogram("hJetAcceptance", 0.5);
1139  if (jet != 0)
1140  if ((jet->Eta() >= fMinJetEta) && (jet->Eta() < fMaxJetEta))
1141  {
1142  FillHistogram("hJetAcceptance", 1.5);
1143  if (jet->Pt() >= fMinJetPt) // jet fulfills pt cut
1144  {
1145  FillHistogram("hJetAcceptance", 2.5);
1146  if (jet->Area() >= fMinJetArea)
1147  {
1148  FillHistogram("hJetAcceptance", 3.5);
1149  acceptedWithPtCut = kTRUE;
1150  }
1151  }
1152  else if(!usePtCut) // jet does not fulfill pt cut
1153  {
1154  if (jet->Area() >= fMinJetArea)
1155  acceptedWithoutPtCut = kTRUE;
1156  }
1157  }
1158 
1159  if(usePtCut)
1160  return (acceptedWithPtCut);
1161  else
1162  return (acceptedWithPtCut || acceptedWithoutPtCut);
1163 }
1164 
1165 //________________________________________________________________________
1167 {
1168  #ifdef DEBUGMODE
1169  AliInfo("Starting ExecOnce.");
1170  #endif
1171  fInitialized = kTRUE;
1172 
1173  // Check for track array
1174  if (strcmp(fTrackArrayName.Data(), "") != 0)
1175  {
1176  fTrackArray = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fTrackArrayName.Data()));
1177  if (!fTrackArray)
1178  AliWarning(Form("%s: Could not retrieve tracks %s!", GetName(), fTrackArrayName.Data()));
1179  else
1180  {
1181  TClass *cl = fTrackArray->GetClass();
1182  if (!cl->GetBaseClass("AliVParticle"))
1183  {
1184  AliError(Form("%s: Collection %s does not contain AliVParticle objects!", GetName(), fTrackArrayName.Data()));
1185  fTrackArray = 0;
1186  }
1187  }
1188  }
1189 
1190  // Check for jet array
1191  if (strcmp(fJetArrayName.Data(), "") != 0)
1192  {
1193  fJetArray = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fJetArrayName.Data()));
1194  if (!fJetArray)
1195  AliWarning(Form("%s: Could not retrieve jets %s!", GetName(), fJetArrayName.Data()));
1196  else
1197  {
1198  if (!fJetArray->GetClass()->GetBaseClass("AliEmcalJet"))
1199  {
1200  AliError(Form("%s: Collection %s does not contain AliEmcalJet objects!", GetName(), fJetArrayName.Data()));
1201  fJetArray = 0;
1202  }
1203  }
1204  }
1205 
1206  // Check for background object
1207  if (strcmp(fBackgroundJetArrayName.Data(), "") != 0)
1208  {
1209  fBackgroundJetArray = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fBackgroundJetArrayName.Data()));
1210  if (!fBackgroundJetArray)
1211  AliInfo(Form("%s: Could not retrieve background jets %s!", GetName(), fBackgroundJetArrayName.Data()));
1212  }
1213 
1214  // Initialize helper class (for vertex selection & pile up correction)
1215  fHelperClass = new AliAnalysisUtils();
1216  fHelperClass->SetCutOnZVertexSPD(kFALSE);
1217  // Histogram init
1218  Init();
1219  // Trackcut initialization
1221 
1222  #ifdef DEBUGMODE
1223  AliInfo("ExecOnce done.");
1224  #endif
1225 
1226 }
1227 
1228 //________________________________________________________________________
1230 {
1231  // Reset vars
1232  fFirstLeadingJet = NULL;
1233  fSecondLeadingJet = NULL;
1234  fFirstLeadingKTJet = NULL;
1235  fSecondLeadingKTJet = NULL;
1236 
1237  fNumberSignalJets = 0;
1239 
1240  Int_t jetIDArray[] = {-1, -1};
1241  Float_t maxJetPts[] = {0, 0};
1242  jetIDArray[0] = -1;
1243  jetIDArray[1] = -1;
1244 
1245  Int_t jetIDArrayKT[] = {-1, -1};
1246  Float_t maxJetPtsKT[] = {0, 0};
1247  jetIDArrayKT[0] = -1;
1248  jetIDArrayKT[1] = -1;
1249 
1250  // Find leading signal jets
1251  for (Int_t i = 0; i < fJetArray->GetEntries(); i++)
1252  {
1253  AliEmcalJet* jet = static_cast<AliEmcalJet*>(fJetArray->At(i));
1254  if (!jet)
1255  {
1256  AliError(Form("%s: Could not receive jet %d", GetName(), i));
1257  continue;
1258  }
1259 
1260  if (!IsSignalJetInAcceptance(jet)) continue;
1261 
1262  if (jet->Pt() > maxJetPts[0])
1263  {
1264  maxJetPts[1] = maxJetPts[0];
1265  jetIDArray[1] = jetIDArray[0];
1266  maxJetPts[0] = jet->Pt();
1267  jetIDArray[0] = i;
1268  }
1269  else if (jet->Pt() > maxJetPts[1])
1270  {
1271  maxJetPts[1] = jet->Pt();
1272  jetIDArray[1] = i;
1273  }
1275  if(jet->Pt() >= 5.)
1277  }
1278 
1279  // Find leading background jets
1280  for (Int_t i = 0; i < fBackgroundJetArray->GetEntries(); i++)
1281  {
1282  AliEmcalJet* jet = static_cast<AliEmcalJet*>(fBackgroundJetArray->At(i));
1283  if (!jet)
1284  {
1285  AliError(Form("%s: Could not receive jet %d", GetName(), i));
1286  continue;
1287  }
1288 
1289  if (!IsBackgroundJetInAcceptance(jet)) continue;
1290 
1291  if (jet->Pt() > maxJetPtsKT[0])
1292  {
1293  maxJetPtsKT[1] = maxJetPtsKT[0];
1294  jetIDArrayKT[1] = jetIDArrayKT[0];
1295  maxJetPtsKT[0] = jet->Pt();
1296  jetIDArrayKT[0] = i;
1297  }
1298  else if (jet->Pt() > maxJetPtsKT[1])
1299  {
1300  maxJetPtsKT[1] = jet->Pt();
1301  jetIDArrayKT[1] = i;
1302  }
1303  }
1304 
1305  if (jetIDArray[0] > -1)
1306  fFirstLeadingJet = static_cast<AliEmcalJet*>(fJetArray->At(jetIDArray[0]));
1307  if (jetIDArray[1] > -1)
1308  fSecondLeadingJet = static_cast<AliEmcalJet*>(fJetArray->At(jetIDArray[1]));
1309  if (jetIDArrayKT[0] > -1)
1310  fFirstLeadingKTJet = static_cast<AliEmcalJet*>(fBackgroundJetArray->At(jetIDArrayKT[0]));
1311  if (jetIDArrayKT[1] > -1)
1312  fSecondLeadingKTJet = static_cast<AliEmcalJet*>(fBackgroundJetArray->At(jetIDArrayKT[1]));
1313 }
1314 
1315 //________________________________________________________________________
1317 {
1318  Double_t tmpConePt = 0.0;
1319 
1320  for (Int_t i = 0; i < fTrackArray->GetEntries(); i++)
1321  {
1322  AliVTrack* tmpTrack = static_cast<AliVTrack*>(fTrackArray->At(i));
1323  if (IsTrackInAcceptance(tmpTrack))
1324  if(IsTrackInCone(tmpTrack, eta, phi, radius))
1325  tmpConePt = tmpConePt + tmpTrack->Pt();
1326  }
1327  return tmpConePt;
1328 }
1329 
1330 //________________________________________________________________________
1332 {
1333  Double_t tmpConePt = 0.0;
1334 
1335  for (Int_t i = 0; i < fTrackArray->GetEntries(); i++)
1336  {
1337  AliVTrack* tmpTrack = static_cast<AliVTrack*>(fTrackArray->At(i));
1338  if (IsTrackInAcceptance(tmpTrack))
1339  if(IsTrackInCone(tmpTrack, eta, phi, radius))
1340  tmpConePt = tmpConePt + tmpTrack->Pt();
1341  }
1342  Double_t realConeArea = (1.0*(fMaxEta-fMinEta)) * TMath::TwoPi() * MCGetOverlapCircleRectancle(eta, phi, radius, fMinEta, fMaxEta, 0., TMath::TwoPi());
1343  tmpConePt -= background * realConeArea; // subtract background
1344 
1345  return tmpConePt;
1346 }
1347 
1348 //________________________________________________________________________
1350 {
1351  Int_t tmpConeCount = 0.0;
1352 
1353  for (Int_t i = 0; i < fTrackArray->GetEntries(); i++)
1354  {
1355  AliVTrack* tmpTrack = static_cast<AliVTrack*>(fTrackArray->At(i));
1356  if (IsTrackInAcceptance(tmpTrack))
1357  if(IsTrackInCone(tmpTrack, eta, phi, radius))
1358  tmpConeCount++;
1359  }
1360 
1361  return tmpConeCount;
1362 }
1363 
1364 //________________________________________________________________________
1366 {
1367  // This is to use a full cone in phi even at the edges of phi (2pi -> 0) (0 -> 2pi)
1368  Double_t trackPhi = 0.0;
1369  if (track->Phi() > (TMath::TwoPi() - (radius-phi)))
1370  trackPhi = track->Phi() - TMath::TwoPi();
1371  else if (track->Phi() < (phi+radius - TMath::TwoPi()))
1372  trackPhi = track->Phi() + TMath::TwoPi();
1373  else
1374  trackPhi = track->Phi();
1375 
1376  if ( TMath::Abs(trackPhi-phi)*TMath::Abs(trackPhi-phi) + TMath::Abs(track->Eta()-eta)*TMath::Abs(track->Eta()-eta) <= radius*radius)
1377  return kTRUE;
1378 
1379  return kFALSE;
1380 }
1381 
1382 //________________________________________________________________________
1384 {
1385  for (Int_t i = 0; i < jet->GetNumberOfTracks(); ++i)
1386  {
1387  Int_t jetTrack = jet->TrackAt(i);
1388  if (jetTrack == trackIndex)
1389  return kTRUE;
1390  }
1391  return kFALSE;
1392 }
1393 
1394 //________________________________________________________________________
1396 {
1397  for (Int_t i = 0; i < jet1->GetNumberOfTracks(); ++i)
1398  {
1399  Int_t jet1Track = jet1->TrackAt(i);
1400  for (Int_t j = 0; j < jet2->GetNumberOfTracks(); ++j)
1401  {
1402  Int_t jet2Track = jet2->TrackAt(j);
1403  if (jet1Track == jet2Track)
1404  return kTRUE;
1405  }
1406  }
1407  return kFALSE;
1408 }
1409 
1410 //________________________________________________________________________
1412 {
1413  #ifdef DEBUGMODE
1414  AliInfo("Getting corrected jet spectra.");
1415  #endif
1416 
1417  Double_t correctedPt = -1.0;
1418  // if the passed background is not valid, do not subtract it
1419  if(background < 0)
1420  background = 0;
1421 
1422  // Subtract background
1423  correctedPt = jet->Pt() - background * jet->Area();
1424 
1425  #ifdef DEBUGMODE
1426  AliInfo("Got corrected jet spectra.");
1427  #endif
1428 
1429  return correctedPt;
1430 }
1431 
1432 
1433 
1434 //________________________________________________________________________
1435 Double_t AliAnalysisTaskChargedJetsPA::GetDeltaPt(Double_t rho, Double_t overlappingJetExclusionProbability)
1436 {
1437  #ifdef DEBUGMODE
1438  AliInfo("Getting Delta Pt.");
1439  #endif
1440 
1441  // Define an invalid delta pt
1442  Double_t deltaPt = -10000.0;
1443 
1444  // Define the ratio of excluded RCs over all RCs
1445  Double_t ratioExcludedRCs = static_cast<Double_t>(fTempExcludedRCs)/fTempAllRCs;
1446 
1447  // Define eta range
1448  Double_t etaMin, etaMax;
1449  etaMin = fMinEta+fRandConeRadius;
1450  etaMax = fMaxEta-fRandConeRadius;
1451 
1452  // Define random cone
1453  Bool_t coneValid = kTRUE;
1454  Double_t tmpRandConeEta = etaMin + fRandom->Rndm()*(etaMax-etaMin);
1455  Double_t tmpRandConePhi = fRandom->Rndm()*TMath::TwoPi();
1456 
1457  // Check if a signal jet is overlapping with random cone
1458  if(overlappingJetExclusionProbability)
1459  {
1460  // Calculate the mean exclusion probability
1462  fTempMeanExclusionProbability += overlappingJetExclusionProbability;
1463  // For all jets, check overlap
1464  for (Int_t i = 0; i<fJetArray->GetEntries(); i++)
1465  {
1466  AliEmcalJet* tmpJet = static_cast<AliEmcalJet*>(fJetArray->At(i));
1467  if (!IsSignalJetInAcceptance(tmpJet, kTRUE)) continue;
1468 
1469  // Check overlap
1470  Double_t tmpDeltaPhi = GetDeltaPhi(tmpRandConePhi, tmpJet->Phi());
1471  if ( tmpDeltaPhi*tmpDeltaPhi + (tmpRandConeEta-tmpJet->Eta())*(tmpRandConeEta-tmpJet->Eta()) <= fRandConeRadius*fRandConeRadius )
1472  {
1473  fTempAllRCs++;
1474  // If an overlap is given, discard or accept it according to the exclusion prob.
1475  if(ratioExcludedRCs < fTempMeanExclusionProbability/fTempOverlapCounter) // to few RCs excluded -> exclude this one
1476  {
1477  coneValid = kFALSE;
1478  fTempExcludedRCs++;
1479  }
1480  else // to many RCs excluded -> take this one
1481  coneValid = kTRUE;
1482  }
1483  }
1484  }
1485 
1486 
1487  // Get the cones' pt and calculate delta pt
1488  if (coneValid)
1489  deltaPt = GetConePt(tmpRandConeEta,tmpRandConePhi,fRandConeRadius) - (rho*fRandConeRadius*fRandConeRadius*TMath::Pi());
1490 
1491  #ifdef DEBUGMODE
1492  AliInfo("Got Delta Pt.");
1493  #endif
1494  return deltaPt;
1495 }
1496 
1497 //________________________________________________________________________
1498 void AliAnalysisTaskChargedJetsPA::GetKTBackgroundDensityAll(Int_t numberExcludeLeadingJets, Double_t& rhoPbPb, Double_t& rhoPbPbWithGhosts, Double_t& rhoCMS, Double_t& rhoImprovedCMS, Double_t& rhoMean, Double_t& rhoTrackLike)
1499 {
1500  #ifdef DEBUGMODE
1501  AliInfo("Getting ALL KT background density.");
1502  #endif
1503 
1504  static Double_t tmpRhoPbPb[1024];
1505  static Double_t tmpRhoPbPbWithGhosts[1024];
1506  static Double_t tmpRhoMean[1024];
1507  static Double_t tmpRhoCMS[1024];
1508  static Double_t tmpRhoImprovedCMS[1024];
1509  Double_t tmpCoveredArea = 0.0;
1510  Double_t tmpSummedArea = 0.0;
1511  Double_t tmpPtTrackLike = 0.0;
1512  Double_t tmpAreaTrackLike = 0.0;
1513 
1514  // Setting invalid values
1515  rhoPbPb = 0.0;
1516  rhoPbPbWithGhosts = 0.0;
1517  rhoCMS = 0.0;
1518  rhoImprovedCMS = 0.0;
1519  rhoMean = 0.0;
1520  rhoTrackLike = 0.0;
1521 
1522  Int_t rhoPbPbJetCount = 0;
1523  Int_t rhoPbPbWithGhostsJetCount = 0;
1524  Int_t rhoCMSJetCount = 0;
1525  Int_t rhoImprovedCMSJetCount = 0;
1526  Int_t rhoMeanJetCount = 0;
1527 
1528 
1529  // Exclude UP TO numberExcludeLeadingJets
1530  if(numberExcludeLeadingJets==-1)
1531  numberExcludeLeadingJets = fNumberSignalJets;
1532  if (fNumberSignalJets < numberExcludeLeadingJets)
1533  numberExcludeLeadingJets = fNumberSignalJets;
1534 
1535  for (Int_t i = 0; i < fBackgroundJetArray->GetEntries(); i++)
1536  {
1537  AliEmcalJet* backgroundJet = static_cast<AliEmcalJet*>(fBackgroundJetArray->At(i));
1538 
1539  if (!backgroundJet)
1540  {
1541  AliError(Form("%s: Could not receive jet %d", GetName(), i));
1542  continue;
1543  }
1544 
1545  tmpSummedArea += backgroundJet->Area();
1546  if(backgroundJet->Pt() > 0.150)
1547  tmpCoveredArea += backgroundJet->Area();
1548 
1549  if (!IsBackgroundJetInAcceptance(backgroundJet))
1550  continue;
1551 
1552  // Search for overlap with signal jets
1553  Bool_t isOverlapping = kFALSE;
1554  for(Int_t j=0;j<numberExcludeLeadingJets;j++)
1555  {
1556  AliEmcalJet* signalJet = fFirstLeadingJet;
1557  if(j==1)
1558  signalJet = fSecondLeadingJet;
1559 
1560  if(signalJet->Pt() < 5.0)
1561  continue;
1562 
1563  if(IsJetOverlapping(signalJet, backgroundJet))
1564  {
1565  isOverlapping = kTRUE;
1566  break;
1567  }
1568  }
1569 
1570  Double_t tmpRho = 0.0;
1571  if(backgroundJet->Area())
1572  tmpRho = backgroundJet->Pt() / backgroundJet->Area();
1573 
1574  // PbPb approach (take ghosts into account)
1575  if((backgroundJet != fFirstLeadingKTJet) || (backgroundJet != fSecondLeadingKTJet))
1576  {
1577  tmpRhoPbPbWithGhosts[rhoPbPbWithGhostsJetCount] = tmpRho;
1578  rhoPbPbWithGhostsJetCount++;
1579  }
1580 
1581  if(backgroundJet->Pt() > 0.150)
1582  {
1583  // CMS approach: don't take ghosts into acount
1584  tmpRhoCMS[rhoCMSJetCount] = tmpRho;
1585  rhoCMSJetCount++;
1586 
1587  // Improved CMS approach: like CMS but excluding signal
1588  if((backgroundJet != fFirstLeadingKTJet) || (backgroundJet != fSecondLeadingKTJet))
1589  {
1590  tmpRhoImprovedCMS[rhoImprovedCMSJetCount] = tmpRho;
1591  rhoImprovedCMSJetCount++;
1592  }
1593 
1594  // PbPb w/o ghosts approach (just neglect ghosts)
1595  if((backgroundJet != fFirstLeadingKTJet) || (backgroundJet != fSecondLeadingKTJet))
1596  {
1597  tmpRhoPbPb[rhoPbPbJetCount] = tmpRho;
1598  rhoPbPbJetCount++;
1599  }
1600  }
1601 
1602  // (no overlap with signal jets)
1603  if(!isOverlapping)
1604  {
1605  // Mean approach
1606  tmpRhoMean[rhoMeanJetCount] = tmpRho;
1607  rhoMeanJetCount++;
1608 
1609  // Track like approach approach
1610  tmpPtTrackLike += backgroundJet->Pt();
1611  tmpAreaTrackLike += backgroundJet->Area();
1612  }
1613 
1614  }
1615 
1616  if (tmpAreaTrackLike > 0)
1617  rhoTrackLike = tmpPtTrackLike/tmpAreaTrackLike;
1618  if (rhoPbPbJetCount > 0)
1619  rhoPbPb = TMath::Median(rhoPbPbJetCount, tmpRhoPbPb);
1620  if (rhoPbPbWithGhostsJetCount > 0)
1621  rhoPbPbWithGhosts = TMath::Median(rhoPbPbWithGhostsJetCount, tmpRhoPbPbWithGhosts);
1622  if (rhoCMSJetCount > 0)
1623  rhoCMS = TMath::Median(rhoCMSJetCount, tmpRhoCMS) * tmpCoveredArea/tmpSummedArea;
1624  if (rhoImprovedCMSJetCount > 0)
1625  {
1626  rhoImprovedCMS = TMath::Median(rhoImprovedCMSJetCount, tmpRhoImprovedCMS) * tmpCoveredArea/tmpSummedArea;
1627  }
1628  if (rhoMeanJetCount > 0)
1629  rhoMean = TMath::Mean(rhoMeanJetCount, tmpRhoMean);
1630 
1631  #ifdef DEBUGMODE
1632  AliInfo("Got ALL KT background density.");
1633  #endif
1634 }
1635 
1636 //________________________________________________________________________
1637 void AliAnalysisTaskChargedJetsPA::GetTRBackgroundDensity(Int_t numberExcludeLeadingJets, Double_t& rhoNoExclusion, Double_t& rhoConeExclusion02, Double_t& rhoConeExclusion04, Double_t& rhoConeExclusion06, Double_t& rhoConeExclusion08, Double_t& rhoExactExclusion)
1638 {
1639  #ifdef DEBUGMODE
1640  AliInfo("Getting TR background density.");
1641  #endif
1642 
1643  Double_t summedTracksPtCone04 = 0.0;
1644  Double_t summedTracksPtCone02 = 0.0;
1645  Double_t summedTracksPtCone06 = 0.0;
1646  Double_t summedTracksPtCone08 = 0.0;
1647  Double_t summedTracksPtWithinJets = 0.0;
1648  Double_t summedTracksPt = 0.0;
1649 
1650  // Setting invalid values
1651  rhoNoExclusion = 0.0;
1652  rhoConeExclusion02 = 0.0;
1653  rhoConeExclusion04 = 0.0;
1654  rhoConeExclusion06 = 0.0;
1655  rhoConeExclusion08 = 0.0;
1656  rhoExactExclusion = 0.0;
1657 
1658  // Exclude UP TO numberExcludeLeadingJets
1659  if(numberExcludeLeadingJets==-1)
1660  numberExcludeLeadingJets = fNumberSignalJetsAbove5GeV;
1661  if (fNumberSignalJets < numberExcludeLeadingJets)
1662  numberExcludeLeadingJets = fNumberSignalJetsAbove5GeV;
1663  if(numberExcludeLeadingJets>2)
1664  {
1665  AliWarning(Form("Warning: GetTRBackgroundDensity() can only exclude up to 2 leading jets! Demanded %i", numberExcludeLeadingJets) );
1666  numberExcludeLeadingJets = 2;
1667  }
1668 
1669  for (Int_t i = 0; i < fTrackArray->GetEntries(); i++)
1670  {
1671  AliVTrack* tmpTrack = static_cast<AliVTrack*>(fTrackArray->At(i));
1672  Bool_t trackWithinJet = kFALSE; Bool_t trackWithin02Cone = kFALSE; Bool_t trackWithin04Cone = kFALSE; Bool_t trackWithin06Cone = kFALSE; Bool_t trackWithin08Cone = kFALSE;
1673 
1674  if (IsTrackInAcceptance(tmpTrack))
1675  {
1676  // Check if tracks overlaps with jet
1677  for(Int_t j=0;j<numberExcludeLeadingJets;j++)
1678  {
1679  AliEmcalJet* signalJet = fFirstLeadingJet;
1680  if(j==1)
1681  signalJet = fSecondLeadingJet;
1682 
1683  if(signalJet->Pt() < 5.0)
1684  continue;
1685 
1686  // Exact jet exclusion
1687  if (IsTrackInJet(signalJet, i))
1688  trackWithinJet = kTRUE;
1689 
1690  // Cone exclusions
1691  if (IsTrackInCone(tmpTrack, signalJet->Eta(), signalJet->Phi(), 0.2))
1692  {
1693  trackWithin02Cone = kTRUE;
1694  trackWithin04Cone = kTRUE;
1695  trackWithin06Cone = kTRUE;
1696  trackWithin08Cone = kTRUE;
1697  break;
1698  }
1699  else if (IsTrackInCone(tmpTrack, signalJet->Eta(), signalJet->Phi(), 0.4))
1700  {
1701  trackWithin04Cone = kTRUE;
1702  trackWithin06Cone = kTRUE;
1703  trackWithin08Cone = kTRUE;
1704  }
1705  else if (IsTrackInCone(tmpTrack, signalJet->Eta(), signalJet->Phi(), 0.6))
1706  {
1707  trackWithin06Cone = kTRUE;
1708  trackWithin08Cone = kTRUE;
1709  }
1710  else if (IsTrackInCone(tmpTrack, signalJet->Eta(), signalJet->Phi(), 0.8))
1711  {
1712  trackWithin08Cone = kTRUE;
1713  }
1714  }
1715 
1716  if(!trackWithin08Cone)
1717  {
1718  summedTracksPtCone08 += tmpTrack->Pt();
1719  }
1720  if(!trackWithin06Cone)
1721  {
1722  summedTracksPtCone06 += tmpTrack->Pt();
1723  }
1724  if(!trackWithin04Cone)
1725  {
1726  summedTracksPtCone04 += tmpTrack->Pt();
1727  }
1728  if(!trackWithin02Cone)
1729  {
1730  summedTracksPtCone02 += tmpTrack->Pt();
1731  }
1732  if(!trackWithinJet)
1733  {
1734  summedTracksPtWithinJets += tmpTrack->Pt();
1735  }
1736  summedTracksPt += tmpTrack->Pt();
1737 
1738  }
1739  }
1740 
1741  // Calculate the correct area where the tracks were taking from
1742 
1743  Double_t tmpFullTPCArea = (1.0*(fMaxEta-fMinEta)) * TMath::TwoPi();
1744  Double_t tmpAreaCone02 = tmpFullTPCArea;
1745  Double_t tmpAreaCone04 = tmpFullTPCArea;
1746  Double_t tmpAreaCone06 = tmpFullTPCArea;
1747  Double_t tmpAreaCone08 = tmpFullTPCArea;
1748  Double_t tmpAreaWithinJets = tmpFullTPCArea;
1749  std::vector<Double_t> tmpEtas(fNumberSignalJetsAbove5GeV);
1750  std::vector<Double_t> tmpPhis(fNumberSignalJetsAbove5GeV);
1751 
1752  Int_t iSignal = 0;
1753  for(Int_t i=0;i<numberExcludeLeadingJets;i++)
1754  {
1755  AliEmcalJet* signalJet = fFirstLeadingJet;
1756  if(i==1)
1757  signalJet = fSecondLeadingJet;
1758 
1759  if(signalJet->Pt() < 5.0)
1760  continue;
1761 
1762  tmpEtas[iSignal] = signalJet->Eta();
1763  tmpPhis[iSignal] = signalJet->Phi();
1764  tmpAreaWithinJets -= signalJet->Area();
1765 
1766  iSignal++;
1767  }
1768 
1769  tmpAreaCone02 -= tmpFullTPCArea * MCGetOverlapMultipleCirclesRectancle(fNumberSignalJetsAbove5GeV, tmpEtas, tmpPhis, 0.2, fMinEta, fMaxEta, 0., TMath::TwoPi());
1770  tmpAreaCone04 -= tmpFullTPCArea * MCGetOverlapMultipleCirclesRectancle(fNumberSignalJetsAbove5GeV, tmpEtas, tmpPhis, 0.4, fMinEta, fMaxEta, 0., TMath::TwoPi());
1771  tmpAreaCone06 -= tmpFullTPCArea * MCGetOverlapMultipleCirclesRectancle(fNumberSignalJetsAbove5GeV, tmpEtas, tmpPhis, 0.6, fMinEta, fMaxEta, 0., TMath::TwoPi());
1772  tmpAreaCone08 -= tmpFullTPCArea * MCGetOverlapMultipleCirclesRectancle(fNumberSignalJetsAbove5GeV, tmpEtas, tmpPhis, 0.8, fMinEta, fMaxEta, 0., TMath::TwoPi());
1773 
1774  rhoConeExclusion02 = summedTracksPtCone02/tmpAreaCone02;
1775  rhoConeExclusion04 = summedTracksPtCone04/tmpAreaCone04;
1776  rhoConeExclusion06 = summedTracksPtCone06/tmpAreaCone06;
1777  rhoConeExclusion08 = summedTracksPtCone08/tmpAreaCone08;
1778  rhoExactExclusion = summedTracksPtWithinJets/tmpAreaWithinJets;
1779  rhoNoExclusion = summedTracksPt/tmpFullTPCArea;
1780 
1781 
1782  #ifdef DEBUGMODE
1783  AliInfo("Got TR background density.");
1784  #endif
1785 }
1786 
1787 //________________________________________________________________________
1789 {
1790  // This is the background that was used for the pp 7 TeV ALICE paper
1791  // The background is estimated using the leading jet
1792 
1793  background = 0;
1794 
1795  AliEmcalJet* jet = NULL;
1796  if(fFirstLeadingJet)
1797  jet = fFirstLeadingJet;
1798  else
1799  return;
1800 
1801  Double_t jetMom[3] = { jet->Px(), jet->Py(), jet->Pz() };
1802  TVector3 jet3mom1(jetMom);
1803  TVector3 jet3mom2(jetMom);
1804 
1805  jet3mom1.RotateZ(TMath::Pi());
1806  jet3mom2.RotateZ(-TMath::Pi());
1807 
1808  for (int i = 0; i < fTrackArray->GetEntries(); i++)
1809  {
1810  AliVTrack* track = static_cast<AliVTrack*>(fTrackArray->At(i));
1811  if (!IsTrackInAcceptance(track))
1812  continue;
1813 
1814  Double_t trackMom[3] = { track->Px(), track->Py(), track->Pz() };
1815  TVector3 track3mom(trackMom);
1816 
1817  Double_t dR1 = jet3mom1.DeltaR(track3mom);
1818  Double_t dR2 = jet3mom2.DeltaR(track3mom);
1819 
1820  if (dR1 <= fSignalJetRadius || dR2 <= fSignalJetRadius)
1821  background += track3mom.Pt();
1822  }
1823 
1824  background /= (2 * TMath::Pi() * fSignalJetRadius * fSignalJetRadius);
1825 }
1826 
1827 //________________________________________________________________________
1829 {
1830  #ifdef DEBUGMODE
1831  AliInfo("Starting Calculate().");
1832  #endif
1833 
1835  fEventCounter++;
1836 
1837  // This is to take only every Nth event
1839  return;
1840 
1841  if(!IsEventInAcceptance(event))
1842  return;
1843 
1844  #ifdef DEBUGMODE
1845  AliInfo("Calculate()::Init done.");
1846  #endif
1847 
1849 
1850  if(fAnalyzeTrackcuts)
1852 
1854 
1855  // Get centrality
1856  AliCentrality* tmpCentrality = event->GetCentrality();
1857  Double_t centralityPercentile = -1.0;
1858  Double_t centralityPercentileCL1 = 0.0;
1859  Double_t centralityPercentileV0A = 0.0;
1860  Double_t centralityPercentileV0C = 0.0;
1861  Double_t centralityPercentileV0M = 0.0;
1862  Double_t centralityPercentileZNA = 0.0;
1863  if (tmpCentrality != NULL)
1864  {
1865  centralityPercentile = tmpCentrality->GetCentralityPercentile(fCentralityType.Data());
1866  centralityPercentileCL1 = tmpCentrality->GetCentralityPercentile("CL1");
1867  centralityPercentileV0A = tmpCentrality->GetCentralityPercentile("V0A");
1868  centralityPercentileV0C = tmpCentrality->GetCentralityPercentile("V0C");
1869  centralityPercentileV0M = tmpCentrality->GetCentralityPercentile("V0M");
1870  centralityPercentileZNA = tmpCentrality->GetCentralityPercentile("ZNA");
1871  }
1872 
1874  centralityPercentile = 1.0;
1875 
1877 
1878  FillHistogram("hVertexX",fPrimaryVertex->GetX());
1879  FillHistogram("hVertexY",fPrimaryVertex->GetY());
1880  FillHistogram("hVertexXY",fPrimaryVertex->GetX(), fPrimaryVertex->GetY());
1881  FillHistogram("hVertexR",TMath::Sqrt(fPrimaryVertex->GetX()*fPrimaryVertex->GetX() + fPrimaryVertex->GetY()*fPrimaryVertex->GetY()));
1882  FillHistogram("hCentralityCL1",centralityPercentileCL1);
1883  FillHistogram("hCentralityV0M",centralityPercentileV0M);
1884  FillHistogram("hCentralityV0A",centralityPercentileV0A);
1885  FillHistogram("hCentralityV0C",centralityPercentileV0C);
1886  FillHistogram("hCentralityZNA",centralityPercentileZNA);
1887 
1888  if(!fDoJetAnalysis)
1889  return;
1890 
1891  GetLeadingJets();
1892 
1893 
1894 /*
1895  //DEBUG
1896  if(fFirstLeadingJet->Pt()>=80.)
1897  {
1898  const char* fname = CurrentFileName();
1899  TObjString* tmpStr = new TObjString(Form("jet pT=%3.3f, fname=%s, entry=%i", fFirstLeadingJet->Pt(), fname, AliAnalysisManager::GetAnalysisManager()->GetCurrentEntry()));
1900  fCurrentOutputList->Add(tmpStr);
1901  }
1902  //DEBUG
1903 */
1904 
1905  // ##################### Calculate background densities
1906  Double_t backgroundKTImprovedCMS = -1.0;
1907  Double_t backgroundExternal = -1.0;
1908  Double_t backgroundKTPbPb = -1.0;
1909  Double_t backgroundKTPbPbWithGhosts = -1.0;
1910  Double_t backgroundKTCMS = -1.0;
1911  Double_t backgroundKTMean = -1.0;
1912  Double_t backgroundKTTrackLike = -1.0;
1913  Double_t backgroundTRNoExcl = -1.0;
1914  Double_t backgroundTRCone02 = -1.0;
1915  Double_t backgroundTRCone04 = -1.0;
1916  Double_t backgroundTRCone06 = -1.0;
1917  Double_t backgroundTRCone08 = -1.0;
1918  Double_t backgroundTRExact = -1.0;
1919  Double_t backgroundPP = -1.0;
1920  Double_t backgroundJetProfile = -1.0;
1921 
1922  // Get background estimates
1923  GetKTBackgroundDensityAll (fNumberExcludedJets, backgroundKTPbPb, backgroundKTPbPbWithGhosts, backgroundKTCMS, backgroundKTImprovedCMS, backgroundKTMean, backgroundKTTrackLike);
1924  GetTRBackgroundDensity (fNumberExcludedJets, backgroundTRNoExcl, backgroundTRCone02, backgroundTRCone04, backgroundTRCone06, backgroundTRCone08, backgroundTRExact);
1925  GetPPBackgroundDensity(backgroundPP);
1926 
1927  backgroundExternal = GetExternalRho();
1929  backgroundExternal = 0;
1930 
1932  backgroundJetProfile = backgroundExternal;
1933  else if(fBackgroundForJetProfile==1)
1934  backgroundJetProfile = backgroundKTImprovedCMS;
1935  else if(fBackgroundForJetProfile==2)
1936  backgroundJetProfile = backgroundKTCMS;
1937  else if(fBackgroundForJetProfile==3)
1938  backgroundJetProfile = backgroundPP;
1939  else if(fBackgroundForJetProfile==4)
1940  backgroundJetProfile = backgroundTRCone06;
1941  else if(fBackgroundForJetProfile==5)
1942  backgroundJetProfile = 0;
1943 
1944  #ifdef DEBUGMODE
1945  AliInfo("Calculate()::Centrality&SignalJets&Background-Calculation done.");
1946  #endif
1947 
1948  // ##################### Fill event QA histograms
1949 
1950  Int_t trackCountAcc = 0;
1951  Int_t nTracks = fTrackArray->GetEntries();
1952  for (Int_t i = 0; i < nTracks; i++)
1953  {
1954  AliVTrack* track = static_cast<AliVTrack*>(fTrackArray->At(i));
1955 
1956  if (track != 0)
1957  if (track->Pt() >= fMinTrackPt)
1958  {
1959  FillHistogram("hTrackPhiEta", track->Phi(),track->Eta(), 1);
1960  FillHistogram("hTrackPtPhiEta", track->Phi(),track->Eta(), track->Pt());
1961  }
1962 
1963  if (IsTrackInAcceptance(track))
1964  {
1965  FillHistogram("hTrackPt", track->Pt(), centralityPercentile);
1966 
1967  if(track->Eta() >= 0)
1968  FillHistogram("hTrackPtPosEta", track->Pt(), centralityPercentile);
1969  else
1970  FillHistogram("hTrackPtNegEta", track->Pt(), centralityPercentile);
1971 
1972  FillHistogram("hTrackEta", track->Eta(), centralityPercentile);
1973  FillHistogram("hTrackPhi", track->Phi());
1974 
1975  if(static_cast<AliPicoTrack*>(track))
1976  {
1977  FillHistogram("hTrackPhiTrackType", track->Phi(), (static_cast<AliPicoTrack*>(track))->GetTrackType());
1978  FillHistogram("hTrackPtTrackType", track->Pt(), (static_cast<AliPicoTrack*>(track))->GetTrackType());
1979  }
1980 
1981  for(Int_t j=0;j<20;j++)
1982  if(track->Pt() > j)
1983  FillHistogram("hTrackPhiPtCut", track->Phi(), track->Pt());
1984 
1985  FillHistogram("hTrackCharge", track->Charge());
1986  trackCountAcc++;
1987  }
1988  }
1989  FillHistogram("hTrackCountAcc", trackCountAcc, centralityPercentile);
1990 
1991  #ifdef DEBUGMODE
1992  AliInfo("Calculate()::QA done.");
1993  #endif
1994 
1995  // ##################### Fill jet histograms
1996 
1997  FillHistogram("hJetCountAll", fJetArray->GetEntries());
1998  FillHistogram("hJetCountAccepted", fNumberSignalJets);
1999  FillHistogram("hJetCount", fJetArray->GetEntries(), fNumberSignalJets);
2000  if (fFirstLeadingJet)
2001  {
2002  FillHistogram("hLeadingJetPt", fFirstLeadingJet->Pt());
2003  FillHistogram("hCorrectedLeadingJetPt", GetCorrectedJetPt(fFirstLeadingJet,backgroundExternal));
2004  }
2005  if (fSecondLeadingJet)
2006  {
2007  FillHistogram("hSecondLeadingJetPt", fSecondLeadingJet->Pt());
2008  FillHistogram("hCorrectedSecondLeadingJetPt", GetCorrectedJetPt(fSecondLeadingJet,backgroundExternal));
2009  }
2010 
2011  for (Int_t i = 0; i<fJetArray->GetEntries(); i++)
2012  {
2013  AliEmcalJet* tmpJet = static_cast<AliEmcalJet*>(fJetArray->At(i));
2014  if (!tmpJet)
2015  continue;
2016 
2017  // ### JETS BEFORE ANY CUTS
2018  if (tmpJet->Area() >= fMinJetArea)
2019  FillHistogram("hRawJetPhiEta", tmpJet->Phi(), tmpJet->Eta());
2020  if ((tmpJet->Eta() >= fMinJetEta) && (tmpJet->Eta() < fMaxJetEta))
2021  FillHistogram("hRawJetArea", tmpJet->Area());
2022 
2023  FillHistogram("hJetPtCutStages", tmpJet->Pt(), 0.5);
2024  if ((tmpJet->Eta() >= fMinJetEta) && (tmpJet->Eta() < fMaxJetEta))
2025  {
2026  FillHistogram("hJetPtCutStages", tmpJet->Pt(), 1.5);
2027  if (tmpJet->Pt() >= fMinJetPt)
2028  {
2029  FillHistogram("hJetPtCutStages", tmpJet->Pt(), 2.5);
2030  if (tmpJet->Area() >= fMinJetArea)
2031  {
2032  FillHistogram("hJetPtCutStages", tmpJet->Pt(), 3.5);
2033  }
2034  }
2035  }
2036 
2037  // ### JETS AFTER CUTS
2038  if(IsSignalJetInAcceptance(tmpJet))
2039  {
2040  // Background corrected jet spectra
2041  FillHistogram("hJetPtNoBgrdSubtracted", GetCorrectedJetPt(tmpJet, 0.0), centralityPercentile);
2042  FillHistogram("hJetPtBgrdSubtractedExternal", GetCorrectedJetPt(tmpJet, backgroundExternal), centralityPercentile);
2043  FillHistogram("hJetPtBgrdSubtractedKTImprovedCMS", GetCorrectedJetPt(tmpJet, backgroundKTImprovedCMS), centralityPercentile);
2044  FillHistogram("hJetPtBgrdSubtractedPP", GetCorrectedJetPt(tmpJet, backgroundPP), centralityPercentile);
2045  if(tmpJet->Phi() >= TMath::Pi())
2046  FillHistogram("hJetPtBgrdSubtractedExternal_Phi2", GetCorrectedJetPt(tmpJet, backgroundExternal), centralityPercentile);
2047  else
2048  FillHistogram("hJetPtBgrdSubtractedExternal_Phi1", GetCorrectedJetPt(tmpJet, backgroundExternal), centralityPercentile);
2049  FillHistogram("hJetPtBgrdSubtractedTR", GetCorrectedJetPt(tmpJet, backgroundTRCone06), centralityPercentile);
2050  FillHistogram("hJetPtBgrdSubtractedKTPbPb", GetCorrectedJetPt(tmpJet, backgroundKTPbPb), centralityPercentile);
2051  FillHistogram("hJetPtBgrdSubtractedKTPbPbWithGhosts", GetCorrectedJetPt(tmpJet, backgroundKTPbPbWithGhosts), centralityPercentile);
2052  FillHistogram("hJetPtBgrdSubtractedKTCMS", GetCorrectedJetPt(tmpJet, backgroundKTCMS), centralityPercentile);
2053  FillHistogram("hJetPtBgrdSubtractedKTMean", GetCorrectedJetPt(tmpJet, backgroundKTMean), centralityPercentile);
2054  FillHistogram("hJetPtBgrdSubtractedKTTrackLike", GetCorrectedJetPt(tmpJet, backgroundKTTrackLike), centralityPercentile);
2055 
2056  FillHistogram("hJetPtSubtractedRhoExternal", tmpJet->Pt(), centralityPercentile, tmpJet->Pt() - GetCorrectedJetPt(tmpJet, backgroundExternal));
2057  FillHistogram("hJetPtSubtractedRhoKTImprovedCMS", tmpJet->Pt(), centralityPercentile, tmpJet->Pt() - GetCorrectedJetPt(tmpJet, backgroundKTImprovedCMS));
2058  FillHistogram("hJetPtSubtractedRhoPP", tmpJet->Pt(), centralityPercentile, tmpJet->Pt() - GetCorrectedJetPt(tmpJet, backgroundPP));
2059  for(Int_t j=0; j<fRandConeNumber; j++)
2060  FillHistogram("hDeltaPtExternalBgrdVsPt", GetDeltaPt(backgroundExternal), GetCorrectedJetPt(tmpJet, backgroundExternal));
2061  FillHistogram("hKTBackgroundExternalVsPt", backgroundExternal, GetCorrectedJetPt(tmpJet, backgroundExternal));
2062 
2063  // ###### CONSTITUENT ANALYSIS
2064 
2066  {
2067  THnF* tmpConstituentHist = static_cast<THnF*>(fCurrentOutputList->FindObject("hJetConstituents"));
2068  THnF* tmpConstituentDistanceHist = static_cast<THnF*>(fCurrentOutputList->FindObject("hJetConstituentDistance"));
2069 
2070  for(Int_t j=0; j<tmpJet->GetNumberOfTracks(); j++)
2071  {
2072  AliVParticle* tmpTrack = tmpJet->TrackAt(j, fTrackArray);
2073  // Define random cone
2074  Double_t tmpRandConeEta = fMinJetEta + fRandom->Rndm()*TMath::Abs(fMaxJetEta-fMinJetEta);
2075  Double_t tmpRandConePhi = fRandom->Rndm()*TMath::TwoPi();
2076 
2077  Double_t tmpPConeEta = tmpJet->Eta();
2078  Double_t tmpPConePhi = tmpJet->Phi() + TMath::Pi();
2079 
2080  if(tmpPConePhi>=TMath::TwoPi())
2081  tmpPConePhi = tmpPConePhi - TMath::TwoPi();
2082 
2083  Double_t tmpRCcount = GetConeConstituentCount(tmpRandConeEta, tmpRandConePhi, fSignalJetRadius);
2084  Double_t tmpPCcount = GetConeConstituentCount(tmpPConeEta, tmpPConePhi, fSignalJetRadius);
2085 
2086  Double_t tmpDistance = TMath::Sqrt( (tmpJet->Eta()-tmpTrack->Eta())*(tmpJet->Eta()-tmpTrack->Eta())
2087  + (tmpJet->Phi()-tmpTrack->Phi())*(tmpJet->Phi()-tmpTrack->Phi()) ); // distance between jet axis and track
2088 
2089  Double_t tmpVec1[5] = {tmpJet->Pt(), tmpTrack->Pt(), static_cast<Double_t>(tmpJet->GetNumberOfTracks()), tmpRCcount, tmpPCcount};
2090  Double_t tmpVec2[4] = {tmpJet->Pt(), tmpTrack->Pt(), static_cast<Double_t>(tmpJet->GetNumberOfTracks()), tmpDistance};
2091 
2092 
2093  tmpConstituentHist->Fill(tmpVec1);
2094  tmpConstituentDistanceHist->Fill(tmpVec2);
2095 
2096  FillHistogram("hJetConstituentPtVsJetPt", tmpTrack->Pt(), tmpJet->Pt());
2097  }
2098  }
2099 
2100  FillHistogram("hJetPtVsConstituentCount", tmpJet->Pt(),tmpJet->GetNumberOfTracks());
2101 
2102  // Leading track biased jets
2103  Double_t leadingTrackPt = 0.0;
2104  for(Int_t j=0; j<tmpJet->GetNumberOfTracks(); j++)
2105  {
2106  if(tmpJet->TrackAt(j, fTrackArray)->Pt() > leadingTrackPt)
2107  leadingTrackPt = tmpJet->TrackAt(j, fTrackArray)->Pt();
2108  }
2109 
2110  if(leadingTrackPt >= 10)
2111  FillHistogram("hJetPtBgrdSubtractedKTImprovedCMS_Biased_10GeV", GetCorrectedJetPt(tmpJet, backgroundKTImprovedCMS), centralityPercentile);
2112  else if(leadingTrackPt >= 5)
2113  FillHistogram("hJetPtBgrdSubtractedKTImprovedCMS_Biased_5GeV", GetCorrectedJetPt(tmpJet, backgroundKTImprovedCMS), centralityPercentile);
2114  else if(leadingTrackPt >= 2)
2115  FillHistogram("hJetPtBgrdSubtractedKTImprovedCMS_Biased_2GeV", GetCorrectedJetPt(tmpJet, backgroundKTImprovedCMS), centralityPercentile);
2116 
2117 
2118  // Fill jet constituent histograms
2119  for(Int_t j=0; j<tmpJet->GetNumberOfTracks(); j++)
2120  {
2121  FillHistogram("hJetConstituentPt0GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
2122  if(tmpJet->Pt() >= 1.0)
2123  FillHistogram("hJetConstituentPt1GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
2124  if(tmpJet->Pt() >= 2.0)
2125  FillHistogram("hJetConstituentPt2GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
2126  if(tmpJet->Pt() >= 3.0)
2127  FillHistogram("hJetConstituentPt3GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
2128  if(tmpJet->Pt() >= 4.0)
2129  FillHistogram("hJetConstituentPt4GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
2130  if(tmpJet->Pt() >= 5.0)
2131  FillHistogram("hJetConstituentPt5GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
2132  if(tmpJet->Pt() >= 7.0)
2133  FillHistogram("hJetConstituentPt7GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
2134  if(tmpJet->Pt() >= 10.0)
2135  FillHistogram("hJetConstituentPt10GeV", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
2136  }
2137 
2138  if(tmpJet->Pt() >= 5.0)
2139  {
2140  Double_t lowestTrackPt = 1e99;
2141  Double_t highestTrackPt = 0.0;
2142  for(Int_t j=0; j<tmpJet->GetNumberOfTracks(); j++)
2143  {
2144 // FillHistogram("hJetConstituentPt", tmpJet->TrackAt(j, fTrackArray)->Pt(), centralityPercentile);
2145  // Find the lowest pT of a track in the jet
2146  if (tmpJet->TrackAt(j, fTrackArray)->Pt() < lowestTrackPt)
2147  lowestTrackPt = tmpJet->TrackAt(j, fTrackArray)->Pt();
2148  if (tmpJet->TrackAt(j, fTrackArray)->Pt() > highestTrackPt)
2149  highestTrackPt = tmpJet->TrackAt(j, fTrackArray)->Pt();
2150  }
2151  FillHistogram("hJetArea", tmpJet->Area(), tmpJet->Pt());
2152  // Signal jet vs. signal jet - "Combinatorial"
2153  for (Int_t j = 0; j<fJetArray->GetEntries(); j++)
2154  {
2155  AliEmcalJet* tmpJet2 = static_cast<AliEmcalJet*>(fJetArray->At(j));
2156  if (!tmpJet2)
2157  continue;
2158  if(tmpJet2->Pt() >= 5.0)
2159  FillHistogram("hJetDeltaPhi", GetDeltaPhi(tmpJet->Phi(), tmpJet2->Phi()));
2160  }
2161 
2162  FillHistogram("hJetPhiEta", tmpJet->Phi(),tmpJet->Eta());
2163  FillHistogram("hJetPtPhiEta", tmpJet->Phi(),tmpJet->Eta(),tmpJet->Pt());
2164  FillHistogram("hJetEta", tmpJet->Eta(), centralityPercentile);
2165 
2166  if(lowestTrackPt>=2.0)
2167  FillHistogram("hJetEta2GeVTracks", tmpJet->Eta(), centralityPercentile);
2168  if(lowestTrackPt>=4.0)
2169  FillHistogram("hJetEta4GeVTracks", tmpJet->Eta(), centralityPercentile);
2170  }
2171  }
2172  } // end of jet loop
2173 
2174  if(fAnalyzeJetProfile)
2175  CreateJetProfilePlots(backgroundJetProfile);
2176 
2177  #ifdef DEBUGMODE
2178  AliInfo("Calculate()::Jets done.");
2179  #endif
2180 
2181  // ##################### Fill background plots
2182 
2183  FillHistogram("hKTBackgroundExternal", backgroundExternal, centralityPercentile);
2184  if(fFirstLeadingJet && (fFirstLeadingJet->Pt()>=20.))
2185  FillHistogram("hKTBackgroundExternal20GeV", backgroundExternal, centralityPercentile);
2186 
2187  FillHistogram("hKTBackgroundImprovedCMS", backgroundKTImprovedCMS, centralityPercentile);
2188  FillHistogram("hPPBackground", backgroundPP, centralityPercentile);
2189  FillHistogram("hKTBackgroundPbPb", backgroundKTPbPb, centralityPercentile);
2190  FillHistogram("hKTBackgroundPbPbWithGhosts", backgroundKTPbPbWithGhosts, centralityPercentile);
2191  FillHistogram("hKTBackgroundCMS", backgroundKTCMS, centralityPercentile);
2192  FillHistogram("hKTBackgroundMean", backgroundKTMean, centralityPercentile);
2193  FillHistogram("hKTBackgroundTrackLike", backgroundKTTrackLike, centralityPercentile);
2194  FillHistogram("hTRBackgroundNoExcl", backgroundTRNoExcl, centralityPercentile);
2195  FillHistogram("hTRBackgroundCone02", backgroundTRCone02, centralityPercentile);
2196  FillHistogram("hTRBackgroundCone04", backgroundTRCone04, centralityPercentile);
2197  FillHistogram("hTRBackgroundCone06", backgroundTRCone06, centralityPercentile);
2198  FillHistogram("hTRBackgroundCone08", backgroundTRCone08, centralityPercentile);
2199  FillHistogram("hTRBackgroundExact", backgroundTRExact, centralityPercentile);
2200 
2201  // Calculate the delta pt
2202  for(Int_t i=0; i<fRandConeNumber; i++)
2203  {
2204  Double_t tmpRatio =1./10.;
2205  if(fNumberSignalJets)
2206  tmpRatio =1./fNumberSignalJets;
2207 
2208  Double_t tmpDeltaPtNoBackground = GetDeltaPt(0.0);
2209  Double_t tmpDeltaPtExternalBgrd = GetDeltaPt(backgroundExternal);
2210  Double_t tmpDeltaPtExternalBgrdPartialExclusion = GetDeltaPt(backgroundExternal, tmpRatio);
2211  Double_t tmpDeltaPtPP = GetDeltaPt(backgroundPP);
2212  Double_t tmpDeltaPtKTImprovedCMS = GetDeltaPt(backgroundKTImprovedCMS);
2213 
2214  Double_t tmpDeltaPtKTPbPb = 0;
2215  Double_t tmpDeltaPtKTPbPbWithGhosts = 0;
2216  Double_t tmpDeltaPtKTCMS = 0;
2217  Double_t tmpDeltaPtKTMean = 0;
2218  Double_t tmpDeltaPtKTTrackLike = 0;
2219  Double_t tmpDeltaPtTR = 0;
2220 
2221  tmpDeltaPtKTPbPb = GetDeltaPt(backgroundKTPbPb);
2222  tmpDeltaPtKTPbPbWithGhosts = GetDeltaPt(backgroundKTPbPbWithGhosts);
2223  tmpDeltaPtKTCMS = GetDeltaPt(backgroundKTCMS);
2224  tmpDeltaPtKTMean = GetDeltaPt(backgroundKTMean);
2225  tmpDeltaPtKTTrackLike = GetDeltaPt(backgroundKTTrackLike);
2226  tmpDeltaPtTR = GetDeltaPt(backgroundTRCone06);
2227 
2228 
2229  // If valid, fill the delta pt histograms
2230 
2231  if(tmpDeltaPtExternalBgrd > -10000.0)
2232  FillHistogram("hDeltaPtExternalBgrd", tmpDeltaPtExternalBgrd, centralityPercentile);
2233  if(tmpDeltaPtKTImprovedCMS > -10000.0)
2234  FillHistogram("hDeltaPtKTImprovedCMS", tmpDeltaPtKTImprovedCMS, centralityPercentile);
2235  if(tmpDeltaPtExternalBgrdPartialExclusion > -10000.0)
2236  FillHistogram("hDeltaPtExternalBgrdPartialExclusion", tmpDeltaPtExternalBgrdPartialExclusion, centralityPercentile);
2237  if(tmpDeltaPtPP > -10000.0)
2238  FillHistogram("hDeltaPtPP", tmpDeltaPtPP, centralityPercentile);
2239 
2240  if(tmpDeltaPtNoBackground > -10000.0)
2241  FillHistogram("hDeltaPtNoBackground", tmpDeltaPtNoBackground, centralityPercentile);
2242 
2243  if(tmpDeltaPtKTPbPb > -10000.0)
2244  FillHistogram("hDeltaPtKTPbPb", tmpDeltaPtKTPbPb, centralityPercentile);
2245  if(tmpDeltaPtKTPbPbWithGhosts > -10000.0)
2246  FillHistogram("hDeltaPtKTPbPbWithGhosts", tmpDeltaPtKTPbPbWithGhosts, centralityPercentile);
2247  if(tmpDeltaPtKTCMS > -10000.0)
2248  FillHistogram("hDeltaPtKTCMS", tmpDeltaPtKTCMS, centralityPercentile);
2249  if(tmpDeltaPtKTMean > -10000.0)
2250  FillHistogram("hDeltaPtKTMean", tmpDeltaPtKTMean, centralityPercentile);
2251  if(tmpDeltaPtKTTrackLike > -10000.0)
2252  FillHistogram("hDeltaPtKTTrackLike", tmpDeltaPtKTTrackLike, centralityPercentile);
2253  if(tmpDeltaPtTR > -10000.0)
2254  FillHistogram("hDeltaPtTR", tmpDeltaPtTR, centralityPercentile);
2255  }
2256 
2257  #ifdef DEBUGMODE
2258  AliInfo("Calculate()::Background done.");
2259  #endif
2260 
2261  #ifdef DEBUGMODE
2262  AliInfo("Calculate() done.");
2263  #endif
2264 }
2265 
2266 //________________________________________________________________________
2268 {
2269  return kTRUE;
2270 }
2271 
2272 //________________________________________________________________________
2274 {
2275  for (Int_t i = 0; i<fJetArray->GetEntries(); i++)
2276  {
2277  AliEmcalJet* tmpJet = static_cast<AliEmcalJet*>(fJetArray->At(i));
2278  if (!tmpJet)
2279  continue;
2280  if(!IsSignalJetInAcceptance(tmpJet))
2281  continue;
2282 
2284  // Jet profile analysis
2285  if(TMath::Abs(tmpJet->Eta()) <= 0.3)
2286  {
2287  if(tmpJet->Pt()>=70.0)
2288  {
2289  FillHistogram("hJetProfile70GeV", 0.05-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.05, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2290  FillHistogram("hJetProfile70GeV", 0.10-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.10, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2291  FillHistogram("hJetProfile70GeV", 0.15-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.15, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2292  FillHistogram("hJetProfile70GeV", 0.20-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.20, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2293  FillHistogram("hJetProfile70GeV", 0.25-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.25, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2294  FillHistogram("hJetProfile70GeV", 0.30-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.30, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2295  FillHistogram("hJetProfile70GeV", 0.35-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.35, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2296  FillHistogram("hJetProfile70GeV", 0.40-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.40, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2297  FillHistogram("hJetProfile70GeV", 0.45-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.45, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2298  FillHistogram("hJetProfile70GeV", 0.50-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.50, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2299  FillHistogram("hJetProfile70GeV", 0.55-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.55, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2300  FillHistogram("hJetProfile70GeV", 0.60-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.60, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2301  }
2302  else if(GetCorrectedJetPt(tmpJet, bgrd)>=60.0)
2303  {
2304  FillHistogram("hJetProfile60GeV", 0.05-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.05, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2305  FillHistogram("hJetProfile60GeV", 0.10-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.10, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2306  FillHistogram("hJetProfile60GeV", 0.15-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.15, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2307  FillHistogram("hJetProfile60GeV", 0.20-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.20, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2308  FillHistogram("hJetProfile60GeV", 0.25-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.25, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2309  FillHistogram("hJetProfile60GeV", 0.30-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.30, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2310  FillHistogram("hJetProfile60GeV", 0.35-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.35, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2311  FillHistogram("hJetProfile60GeV", 0.40-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.40, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2312  FillHistogram("hJetProfile60GeV", 0.45-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.45, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2313  FillHistogram("hJetProfile60GeV", 0.50-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.50, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2314  FillHistogram("hJetProfile60GeV", 0.55-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.55, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2315  FillHistogram("hJetProfile60GeV", 0.60-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.60, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2316  }
2317  else if(GetCorrectedJetPt(tmpJet, bgrd)>=50.0)
2318  {
2319  FillHistogram("hJetProfile50GeV", 0.05-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.05, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2320  FillHistogram("hJetProfile50GeV", 0.10-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.10, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2321  FillHistogram("hJetProfile50GeV", 0.15-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.15, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2322  FillHistogram("hJetProfile50GeV", 0.20-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.20, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2323  FillHistogram("hJetProfile50GeV", 0.25-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.25, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2324  FillHistogram("hJetProfile50GeV", 0.30-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.30, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2325  FillHistogram("hJetProfile50GeV", 0.35-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.35, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2326  FillHistogram("hJetProfile50GeV", 0.40-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.40, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2327  FillHistogram("hJetProfile50GeV", 0.45-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.45, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2328  FillHistogram("hJetProfile50GeV", 0.50-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.50, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2329  FillHistogram("hJetProfile50GeV", 0.55-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.55, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2330  FillHistogram("hJetProfile50GeV", 0.60-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.60, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2331  }
2332  else if(GetCorrectedJetPt(tmpJet, bgrd)>=40.0)
2333  {
2334  FillHistogram("hJetProfile40GeV", 0.05-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.05, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2335  FillHistogram("hJetProfile40GeV", 0.10-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.10, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2336  FillHistogram("hJetProfile40GeV", 0.15-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.15, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2337  FillHistogram("hJetProfile40GeV", 0.20-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.20, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2338  FillHistogram("hJetProfile40GeV", 0.25-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.25, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2339  FillHistogram("hJetProfile40GeV", 0.30-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.30, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2340  FillHistogram("hJetProfile40GeV", 0.35-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.35, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2341  FillHistogram("hJetProfile40GeV", 0.40-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.40, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2342  FillHistogram("hJetProfile40GeV", 0.45-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.45, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2343  FillHistogram("hJetProfile40GeV", 0.50-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.50, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2344  FillHistogram("hJetProfile40GeV", 0.55-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.55, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2345  FillHistogram("hJetProfile40GeV", 0.60-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.60, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2346  }
2347  else if(GetCorrectedJetPt(tmpJet, bgrd)>=30.0)
2348  {
2349  FillHistogram("hJetProfile30GeV", 0.05-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.05, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2350  FillHistogram("hJetProfile30GeV", 0.10-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.10, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2351  FillHistogram("hJetProfile30GeV", 0.15-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.15, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2352  FillHistogram("hJetProfile30GeV", 0.20-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.20, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2353  FillHistogram("hJetProfile30GeV", 0.25-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.25, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2354  FillHistogram("hJetProfile30GeV", 0.30-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.30, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2355  FillHistogram("hJetProfile30GeV", 0.35-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.35, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2356  FillHistogram("hJetProfile30GeV", 0.40-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.40, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2357  FillHistogram("hJetProfile30GeV", 0.45-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.45, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2358  FillHistogram("hJetProfile30GeV", 0.50-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.50, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2359  FillHistogram("hJetProfile30GeV", 0.55-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.55, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2360  FillHistogram("hJetProfile30GeV", 0.60-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.60, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2361  }
2362  else if(GetCorrectedJetPt(tmpJet, bgrd)>=20.0)
2363  {
2364  FillHistogram("hJetProfile20GeV", 0.05-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.05, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2365  FillHistogram("hJetProfile20GeV", 0.10-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.10, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2366  FillHistogram("hJetProfile20GeV", 0.15-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.15, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2367  FillHistogram("hJetProfile20GeV", 0.20-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.20, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2368  FillHistogram("hJetProfile20GeV", 0.25-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.25, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2369  FillHistogram("hJetProfile20GeV", 0.30-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.30, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2370  FillHistogram("hJetProfile20GeV", 0.35-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.35, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2371  FillHistogram("hJetProfile20GeV", 0.40-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.40, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2372  FillHistogram("hJetProfile20GeV", 0.45-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.45, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2373  FillHistogram("hJetProfile20GeV", 0.50-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.50, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2374  FillHistogram("hJetProfile20GeV", 0.55-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.55, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2375  FillHistogram("hJetProfile20GeV", 0.60-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.60, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2376  }
2377  else if(GetCorrectedJetPt(tmpJet, bgrd)>=10.0)
2378  {
2379  FillHistogram("hJetProfile10GeV", 0.05-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.05, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2380  FillHistogram("hJetProfile10GeV", 0.10-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.10, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2381  FillHistogram("hJetProfile10GeV", 0.15-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.15, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2382  FillHistogram("hJetProfile10GeV", 0.20-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.20, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2383  FillHistogram("hJetProfile10GeV", 0.25-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.25, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2384  FillHistogram("hJetProfile10GeV", 0.30-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.30, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2385  FillHistogram("hJetProfile10GeV", 0.35-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.35, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2386  FillHistogram("hJetProfile10GeV", 0.40-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.40, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2387  FillHistogram("hJetProfile10GeV", 0.45-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.45, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2388  FillHistogram("hJetProfile10GeV", 0.50-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.50, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2389  FillHistogram("hJetProfile10GeV", 0.55-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.55, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2390  FillHistogram("hJetProfile10GeV", 0.60-0.05/2, (GetCorrectedConePt(tmpJet->Eta(), tmpJet->Phi(), 0.60, bgrd))/GetCorrectedJetPt(tmpJet, bgrd));
2391  }
2392  }
2394  }
2395 }
2396 
2397 //________________________________________________________________________
2399  {return 2.*atan(exp(-arg));}
2400 //________________________________________________________________________
2402 {
2403  if ((arg > TMath::Pi()) || (arg < 0.0))
2404  {
2405  AliError(Form("ThetaToEta got wrong input! (%f)", arg));
2406  return 0.0;
2407  }
2408  return -log(tan(arg/2.));
2409 }
2410 //________________________________________________________________________
2412  {return min(TMath::Abs(phi1-phi2),TMath::TwoPi() - TMath::Abs(phi1-phi2));}
2413 
2414 //________________________________________________________________________
2416 {
2417  const Int_t kTests = 1000;
2418  Int_t hits = 0;
2419  TRandom3 randomGen(0);
2420 
2421  // Loop over kTests-many tests
2422  for (Int_t i=0; i<kTests; i++)
2423  {
2424  //Choose random position in rectangle for the tester
2425  Double_t tmpTestX = randomGen.Uniform(rPosXmin, rPosXmax);
2426  Double_t tmpTestY = randomGen.Uniform(rPosYmin, rPosYmax);
2427 
2428  //Check, if tester is in circle. If yes, increment circle counter.
2429  Double_t tmpDistance = TMath::Sqrt( (tmpTestX - cPosX)*(tmpTestX - cPosX) + (tmpTestY - cPosY)*(tmpTestY - cPosY) );
2430  if(tmpDistance < cRadius)
2431  hits++;
2432  }
2433 
2434  // return ratio
2435  return (static_cast<Double_t>(hits)/static_cast<Double_t>(kTests));
2436 }
2437 
2438 //________________________________________________________________________
2439 Double_t AliAnalysisTaskChargedJetsPA::MCGetOverlapMultipleCirclesRectancle(Int_t numCircles, std::vector<Double_t> cPosX, std::vector<Double_t> cPosY, Double_t cRadius, Double_t rPosXmin, Double_t rPosXmax, Double_t rPosYmin, Double_t rPosYmax)
2440 {
2441 
2442  const Int_t kTests = 1000;
2443  Int_t hits = 0;
2444  TRandom3 randomGen(0);
2445 
2446  // Loop over kTests-many tests
2447  for (Int_t i=0; i<kTests; i++)
2448  {
2449  //Choose random position in rectangle for the tester
2450  Double_t tmpTestX = randomGen.Uniform(rPosXmin, rPosXmax);
2451  Double_t tmpTestY = randomGen.Uniform(rPosYmin, rPosYmax);
2452 
2453  //Check, if tester is in one of the circles. If yes, increment circle counter.
2454  for(Int_t j=0; j<numCircles; j++)
2455  {
2456  Double_t tmpDistance = TMath::Sqrt( (tmpTestX - cPosX[j])*(tmpTestX - cPosX[j]) + (tmpTestY - cPosY[j])*(tmpTestY - cPosY[j]) );
2457  if(tmpDistance < cRadius)
2458  {
2459  hits++;
2460  break;
2461  }
2462  }
2463  }
2464 
2465  // return ratio
2466  return (static_cast<Double_t>(hits)/static_cast<Double_t>(kTests));
2467 
2468 }
2469 
2470 //________________________________________________________________________
2472 {
2473  TH1* tmpHist = static_cast<TH1*>(fCurrentOutputList->FindObject(GetHistoName(key)));
2474  if(!tmpHist)
2475  {
2476  AliError(Form("Cannot find histogram <%s> ",key)) ;
2477  return;
2478  }
2479 
2480  tmpHist->Fill(x);
2481 }
2482 
2483 //________________________________________________________________________
2485 {
2486  TH1* tmpHist = static_cast<TH1*>(fCurrentOutputList->FindObject(GetHistoName(key)));
2487  if(!tmpHist)
2488  {
2489  AliError(Form("Cannot find histogram <%s> ",key));
2490  return;
2491  }
2492 
2493  if (tmpHist->IsA()->GetBaseClass("TH1"))
2494  static_cast<TH1*>(tmpHist)->Fill(x,y); // Fill x with y
2495  else if (tmpHist->IsA()->GetBaseClass("TH2"))
2496  static_cast<TH2*>(tmpHist)->Fill(x,y); // Fill x,y with 1
2497 }
2498 
2499 //________________________________________________________________________
2501 {
2502  TH2* tmpHist = static_cast<TH2*>(fCurrentOutputList->FindObject(GetHistoName(key)));
2503  if(!tmpHist)
2504  {
2505  AliError(Form("Cannot find histogram <%s> ",key));
2506  return;
2507  }
2508 
2509  tmpHist->Fill(x,y,add);
2510 }
2511 
2512 //________________________________________________________________________
2513 inline void AliAnalysisTaskChargedJetsPA::FillCutHistogram(const char * key, Double_t cut, Double_t pT, Double_t eta, Double_t phi, Int_t isAdditionalTrack)
2514 {
2515  THnF* tmpHist = static_cast<THnF*>(fCurrentOutputList->FindObject(GetHistoName(key)));
2516  if(!tmpHist)
2517  {
2518  AliError(Form("Cannot find histogram <%s> ",key));
2519  return;
2520  }
2521 
2522  Double_t tmpVec[5] = {cut, pT, eta, phi, static_cast<Double_t>(isAdditionalTrack)};
2523  tmpHist->Fill(tmpVec);
2524 }
2525 
2526 //________________________________________________________________________
2527 template <class T> T* AliAnalysisTaskChargedJetsPA::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)
2528 {
2529  T* tmpHist = new T(GetHistoName(name), GetHistoName(title), xBins, xMin, xMax);
2530 
2531  tmpHist->GetXaxis()->SetTitle(xTitle);
2532  tmpHist->GetYaxis()->SetTitle(yTitle);
2533  tmpHist->SetOption(options);
2534  tmpHist->SetMarkerStyle(kFullCircle);
2535  tmpHist->Sumw2();
2536 
2537  fCurrentOutputList->Add(tmpHist);
2538 
2539  return tmpHist;
2540 }
2541 
2542 //________________________________________________________________________
2543 template <class T> T* AliAnalysisTaskChargedJetsPA::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)
2544 {
2545  T* tmpHist = new T(GetHistoName(name), GetHistoName(title), xBins, xMin, xMax, yBins, yMin, yMax);
2546  tmpHist->GetXaxis()->SetTitle(xTitle);
2547  tmpHist->GetYaxis()->SetTitle(yTitle);
2548  tmpHist->GetZaxis()->SetTitle(zTitle);
2549  tmpHist->SetOption(options);
2550  tmpHist->SetMarkerStyle(kFullCircle);
2551  tmpHist->Sumw2();
2552 
2553  fCurrentOutputList->Add(tmpHist);
2554 
2555  return tmpHist;
2556 }
2557 
2558 //________________________________________________________________________
2559 THnF* AliAnalysisTaskChargedJetsPA::AddCutHistogram(const char* name, const char* title, const char* cutName, Int_t nBins, Double_t xMin, Double_t xMax)
2560 {
2561  // Cut, pT, eta, phi, type
2562  Int_t bins [5] = { nBins, 100, 20, 18, 2};
2563  Double_t minEdges[5] = { xMin, 0.1, -1, 0, -0.5};
2564  Double_t maxEdges[5] = { xMax, 40, +1, 2*TMath::Pi(), 1.5};
2565 
2566  TString axisName[5] = {cutName,"#it{p}_{T}","#eta","#phi","Track type"};
2567  TString axisTitle[5] = {cutName,"#it{p}_{T}","#eta","#phi","Track type"};
2568 
2569  THnF * histo = new THnF(name, title, 5, bins, minEdges, maxEdges);
2570  BinLogAxis(histo, 1);
2571 
2572  for (Int_t iaxis=0; iaxis<5;iaxis++){
2573  histo->GetAxis(iaxis)->SetName(axisName[iaxis]);
2574  histo->GetAxis(iaxis)->SetTitle(axisTitle[iaxis]);
2575  }
2576 
2577  fCurrentOutputList->Add(histo);
2578  return histo;
2579 }
2580 
2581 //________________________________________________________________________
2582 void AliAnalysisTaskChargedJetsPA::BinLogAxis(const THn *h, Int_t axisNumber)
2583 {
2584  // Method for the correct logarithmic binning of histograms
2585  TAxis *axis = h->GetAxis(axisNumber);
2586  int bins = axis->GetNbins();
2587 
2588  Double_t from = axis->GetXmin();
2589  Double_t to = axis->GetXmax();
2590  Double_t *newBins = new Double_t[bins + 1];
2591 
2592  newBins[0] = from;
2593  Double_t factor = pow(to/from, 1./bins);
2594 
2595  for (int i = 1; i <= bins; i++) {
2596  newBins[i] = factor * newBins[i-1];
2597  }
2598  axis->Set(bins, newBins);
2599  delete [] newBins;
2600 }
2601 
2602 //________________________________________________________________________
2604 {
2605  if(fNoTerminate)
2606  return;
2607 
2608  fOutputLists[0] = dynamic_cast<TList*> (GetOutputData(1)); // >1 refers to output slots
2609  PostData(1, fOutputLists[0]);
2610 
2611  if(fAnalyzeJetProfile)
2612  {
2613  fOutputLists[1] = dynamic_cast<TList*> (GetOutputData(2)); // >1 refers to output slots
2614  PostData(2, fOutputLists[1]);
2615  }
2616  if(fAnalyzeTrackcuts)
2617  {
2618  if(fAnalyzeJetProfile)
2619  {
2620  fOutputLists[2] = dynamic_cast<TList*> (GetOutputData(3)); // >1 refers to output slots
2621  PostData(3, fOutputLists[2]);
2622  }
2623  else
2624  {
2625  fOutputLists[1] = dynamic_cast<TList*> (GetOutputData(2)); // >1 refers to output slots
2626  PostData(2, fOutputLists[1]);
2627  }
2628  }
2629 }
2630 
2631 //________________________________________________________________________
2633 {
2634  // Destructor. Clean-up the output list, but not the histograms that are put inside
2635  // (the list is owner and will clean-up these histograms). Protect in PROOF case.
2636 
2637  if(fNoTerminate)
2638  return;
2639 
2640  delete fHybridESDtrackCuts;
2642 
2643  for(Int_t i=0; i<static_cast<Int_t>(fOutputLists.size()); i++)
2644  if (fOutputLists[i] && !AliAnalysisManager::GetAnalysisManager()->IsProofMode())
2645  delete fOutputLists[i];
2646 
2647 }
2648 
2649 //________________________________________________________________________
2651 {
2652  // called once to create user defined output objects like histograms, plots etc.
2653  // and to put it on the output list.
2654  // Note: Saving to file with e.g. OpenFile(0) is must be before creating other objects.
2655 
2656  fRandom = new TRandom3(0);
2657 
2658 
2659  Int_t tmpListCount = 1;
2660  if(fAnalyzeJetProfile)
2661  tmpListCount++;
2662  if(fAnalyzeTrackcuts)
2663  tmpListCount++;
2664 
2665  fOutputLists.resize(tmpListCount);
2666  for(Int_t i=0; i<tmpListCount; i++)
2667  {
2668  fOutputLists[i] = new TList();
2669  fOutputLists[i]->SetOwner(); // otherwise it produces leaks in merging
2670  PostData(i+1, fOutputLists[i]);
2671  }
2672 }
2673 
2674 //________________________________________________________________________
2676 {
2677  #ifdef DEBUGMODE
2678  AliInfo("UserExec() started.");
2679  #endif
2680 
2681  if (!InputEvent())
2682  {
2683  AliError("??? Event pointer == 0 ???");
2684  return;
2685  }
2686 
2687  if (!fInitialized)
2688  ExecOnce(); // Get tracks, jets, background from arrays if not already given + Init Histos
2689 
2690  Calculate(InputEvent());
2691 
2692  PostData(1, fOutputLists[0]);
2693  if(fAnalyzeJetProfile)
2694  PostData(2, fOutputLists[1]);
2695  if(fAnalyzeTrackcuts)
2696  {
2697  if(fAnalyzeJetProfile)
2698  PostData(3, fOutputLists[2]);
2699  else
2700  PostData(2, fOutputLists[1]);
2701  }
2702 
2703 }
Double_t Area() const
Definition: AliEmcalJet.h:130
Bool_t fDoJetAnalysis
Currently selected list where the histograms will be saved to.
Double_t GetDeltaPt(Double_t rho, Double_t overlappingJetExclusionProbability=0)
AliEmcalJet * fFirstLeadingKTJet
next to leading jet in event
double Double_t
Definition: External.C:58
void GetKTBackgroundDensityAll(Int_t numberExcludeLeadingJets, Double_t &rhoPbPb, Double_t &rhoPbPbWithGhosts, Double_t &rhoCMS, Double_t &rhoImprovedCMS, Double_t &rhoMean, Double_t &rhoTrackLike)
const char * title
Definition: MakeQAPdf.C:27
virtual void UserExec(Option_t *option)
Double_t Eta() const
Definition: AliEmcalJet.h:121
AliAnalysisUtils * fHelperClass
A random number.
Double_t Py() const
Definition: AliEmcalJet.h:107
Double_t Phi() const
Definition: AliEmcalJet.h:117
TString fJetArrayName
object containing background jets
Bool_t IsSignalJetInAcceptance(AliEmcalJet *jet, Bool_t usePtCut=kFALSE)
Bool_t IsJetOverlapping(AliEmcalJet *jet1, AliEmcalJet *jet2)
void GetTRBackgroundDensity(Int_t numberExcludeLeadingJets, Double_t &rhoNoExclusion, Double_t &rhoConeExclusion02, Double_t &rhoConeExclusion04, Double_t &rhoConeExclusion06, Double_t &rhoConeExclusion08, Double_t &rhoExactExclusion)
Bool_t IsTrackInJet(AliEmcalJet *jet, Int_t trackIndex)
Bool_t IsTrackInCone(AliVTrack *track, Double_t eta, Double_t phi, Double_t radius)
Bool_t IsTrackInAcceptance(AliVParticle *track)
AliESDtrackCuts * GetAdditionalCuts()
Int_t TrackAt(Int_t idx) const
Definition: AliEmcalJet.h:160
Double_t GetCorrectedConePt(Double_t eta, Double_t phi, Double_t radius, Double_t background)
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")
UShort_t GetNumberOfTracks() const
Definition: AliEmcalJet.h:139
UShort_t T(UShort_t m, UShort_t t)
Definition: RingBits.C:60
Double_t Px() const
Definition: AliEmcalJet.h:106
void GetPPBackgroundDensity(Double_t &background)
void SetAdditionalCuts(AliESDtrackCuts *trackCuts)
THnF * AddCutHistogram(const char *name, const char *title, const char *cutName, Int_t nBins, Double_t xMin, Double_t xMax)
int Int_t
Definition: External.C:63
float Float_t
Definition: External.C:68
Double_t GetConePt(Double_t eta, Double_t phi, Double_t radius)
Double_t MCGetOverlapMultipleCirclesRectancle(Int_t numCircles, std::vector< Double_t > cPosX, std::vector< Double_t > cPosY, Double_t cRadius, Double_t rPosXmin, Double_t rPosXmax, Double_t rPosYmin, Double_t rPosYmax)
void FillCutHistogram(const char *key, Double_t cut, Double_t pT, Double_t eta, Double_t phi, Int_t isAdditionalTrack)
Definition: External.C:228
void BinLogAxis(const THn *h, Int_t axisNumber)
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")
Double_t fMatchChi[kMaxMatch]
Helper variables track matching.
AliEmcalJet * fSecondLeadingJet
leading jet in event
Int_t fNumberSignalJets
next to leading kT jet in event
AliEmcalJet * fFirstLeadingJet
Vertex found per event.
Bool_t fInitialized
Vertex selection helper.
const AliVVertex * fPrimaryVertex
Helper variables track matching.
void Match(AliESDtrack *tr0, AliESDtrack *tr1, Int_t &nmatch, Bool_t excludeMom=kFALSE, Double_t rotate=0)
void SetMainCuts(AliESDtrackCuts *trackCuts)
Double_t MCGetOverlapCircleRectancle(Double_t cPosX, Double_t cPosY, Double_t cRadius, Double_t rPosXmin, Double_t rPosXmax, Double_t rPosYmin, Double_t rPosYmax)
Double_t Pt() const
Definition: AliEmcalJet.h:109
Int_t GetConeConstituentCount(Double_t eta, Double_t phi, Double_t radius)
Double_t GetCorrectedJetPt(AliEmcalJet *jet, Double_t background)
TClonesArray * fTrackArray
object containing the jets
Double_t GetDeltaPhi(Double_t phi1, Double_t phi2)
Definition: External.C:220
Int_t AcceptTrack(const AliESDtrack *esdTrack)
AliESDHybridTrackcuts * fHybridESDtrackCuts_variedPtDep
these trackcuts are applied
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
Double_t Pz() const
Definition: AliEmcalJet.h:108
const char Option_t
Definition: External.C:48
AliESDHybridTrackcuts * fHybridESDtrackCuts_variedPtDep2
these trackcuts are applied
bool Bool_t
Definition: External.C:53
Double_t ptMax
void FillHistogram(const char *key, Double_t x)
const char * GetHistoName(const char *name)
AliEmcalJet * fSecondLeadingKTJet
leading kT jet in event
TClonesArray * fBackgroundJetArray
object containing the tracks
Definition: External.C:196
Bool_t IsBackgroundJetInAcceptance(AliEmcalJet *jet)