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