]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/Correlations/Base/AliUEHistograms.cxx
Fix for coverity (AdC)
[u/mrichter/AliRoot.git] / PWGCF / Correlations / Base / AliUEHistograms.cxx
CommitLineData
a75aacd6 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/* $Id: AliUEHistograms.cxx 20164 2007-08-14 15:31:50Z morsch $ */
17
18//
19//
20// encapsulates several AliUEHist objects for a full UE analysis plus additional control histograms
21//
22//
23// Author: Jan Fiete Grosse-Oetringhaus, Sara Vallero
24
25#include "AliUEHistograms.h"
26
27#include "AliCFContainer.h"
28#include "AliVParticle.h"
2a910c25 29#include "AliAODTrack.h"
a75aacd6 30
31#include "TList.h"
8a368fc2 32#include "TCanvas.h"
a75aacd6 33#include "TH2F.h"
34#include "TH1F.h"
35#include "TH3F.h"
36#include "TMath.h"
b0d56b29 37#include "TLorentzVector.h"
a75aacd6 38
39ClassImp(AliUEHistograms)
40
bf58cbde 41const Int_t AliUEHistograms::fgkUEHists = 3;
42
3f3f12d9 43AliUEHistograms::AliUEHistograms(const char* name, const char* histograms, const char* binning) :
e0331fd9 44 TNamed(name, name),
a75aacd6 45 fNumberDensitypT(0),
46 fSumpT(0),
47 fNumberDensityPhi(0),
48 fCorrelationpT(0),
49 fCorrelationEta(0),
50 fCorrelationPhi(0),
51 fCorrelationR(0),
52 fCorrelationLeading2Phi(0),
53 fCorrelationMultiplicity(0),
5e053cad 54 fYields(0),
09357ca8 55 fInvYield2(0),
a75aacd6 56 fEventCount(0),
57 fEventCountDifferential(0),
bf58cbde 58 fVertexContributors(0),
c7245604 59 fCentralityDistribution(0),
447d47d8 60 fCentralityCorrelation(0),
2a910c25 61 fITSClusterMap(0),
f613255f 62 fControlConvResoncances(0),
418b56c5 63 fEfficiencyCorrectionTriggers(0),
64 fEfficiencyCorrectionAssociated(0),
85bfac17 65 fSelectCharge(0),
7a77d480 66 fTriggerSelectCharge(0),
15b0fdd0 67 fAssociatedSelectCharge(0),
d38fa455 68 fTriggerRestrictEta(-1),
00b6f3c6 69 fEtaOrdering(kFALSE),
b0d56b29 70 fCutConversions(kFALSE),
71 fCutResonances(kFALSE),
97270ee2 72 fRejectResonanceDaughters(-1),
9da2f080 73 fOnlyOneEtaSide(0),
8a368fc2 74 fWeightPerEvent(kFALSE),
640b9425 75 fPtOrder(kTRUE),
7e9608f2 76 fTwoTrackCutMinRadius(0.8),
e5df0f3a 77 fRunNumber(0),
78 fMergeCount(1)
a75aacd6 79{
80 // Constructor
bf58cbde 81 //
82 // the string histograms defines which histograms are created:
83 // 1 = NumberDensitypT
84 // 2 = SumpT
85 // 3 = NumberDensityPhi
86 // 4 = NumberDensityPhiCentrality (other multiplicity for Pb)
87
0ffdaf17 88 AliLog::SetClassDebugLevel("AliCFContainer", -1);
89 AliLog::SetClassDebugLevel("AliCFGridSparse", -3);
90
670e1d49 91 fTwoTrackDistancePt[0] = 0;
92 fTwoTrackDistancePt[1] = 0;
1bba939a 93
bf58cbde 94 TString histogramsStr(histograms);
95
3f3f12d9 96 TString defaultBinningStr;
97 defaultBinningStr = "eta: -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0\n"
98 "p_t_assoc: 0.5, 0.75, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 8.0\n"
99 "p_t_leading: 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.0, 10.5, 11.0, 11.5, 12.0, 12.5, 13.0, 13.5, 14.0, 14.5, 15.0, 15.5, 16.0, 16.5, 17.0, 17.5, 18.0, 18.5, 19.0, 19.5, 20.0, 20.5, 21.0, 21.5, 22.0, 22.5, 23.0, 23.5, 24.0, 24.5, 25.0, 25.5, 26.0, 26.5, 27.0, 27.5, 28.0, 28.5, 29.0, 29.5, 30.0, 30.5, 31.0, 31.5, 32.0, 32.5, 33.0, 33.5, 34.0, 34.5, 35.0, 35.5, 36.0, 36.5, 37.0, 37.5, 38.0, 38.5, 39.0, 39.5, 40.0, 40.5, 41.0, 41.5, 42.0, 42.5, 43.0, 43.5, 44.0, 44.5, 45.0, 45.5, 46.0, 46.5, 47.0, 47.5, 48.0, 48.5, 49.0, 49.5, 50.0\n"
100 "p_t_leading_course: 0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0\n"
101 "p_t_eff: 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.25, 1.5, 1.75, 2.0, 2.25, 2.5, 2.75, 3.0, 3.25, 3.5, 3.75, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0\n"
102 "vertex_eff: -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10\n"
103 ;
104
105 if (histogramsStr.Contains("4") || histogramsStr.Contains("5") || histogramsStr.Contains("6")) // Dphi Corr
106 {
107 if (histogramsStr.Contains("C"))
108 defaultBinningStr += "multiplicity: 0, 20, 40, 60, 80, 100.1\n"; // course
109 else
110 defaultBinningStr += "multiplicity: 0, 1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.1\n";
111
112 if (histogramsStr.Contains("5"))
113 defaultBinningStr += "vertex: -7, -5, -3, -1, 1, 3, 5, 7\n";
114 else
115 defaultBinningStr += "vertex: -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10\n";
116
117 if (histogramsStr.Contains("R"))
118 defaultBinningStr += "delta_phi: -1.570796, -1.483530, -1.396263, -1.308997, -1.221730, -1.134464, -1.047198, -0.959931, -0.872665, -0.785398, -0.698132, -0.610865, -0.523599, -0.436332, -0.349066, -0.261799, -0.174533, -0.087266, 0.0, 0.087266, 0.174533, 0.261799, 0.349066, 0.436332, 0.523599, 0.610865, 0.698132, 0.785398, 0.872665, 0.959931, 1.047198, 1.134464, 1.221730, 1.308997, 1.396263, 1.483530, 1.570796, 1.658063, 1.745329, 1.832596, 1.919862, 2.007129, 2.094395, 2.181662, 2.268928, 2.356194, 2.443461, 2.530727, 2.617994, 2.705260, 2.792527, 2.879793, 2.967060, 3.054326, 3.141593, 3.228859, 3.316126, 3.403392, 3.490659, 3.577925, 3.665191, 3.752458, 3.839724, 3.926991, 4.014257, 4.101524, 4.188790, 4.276057, 4.363323, 4.450590, 4.537856, 4.625123, 4.712389\n" // this binning starts at -pi/2 and is modulo 3
119 "delta_eta: -2.4, -2.3, -2.2, -2.1, -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0,2.1, 2.2, 2.3, 2.4\n"
120 ;
121 else // for TTR studies
122 defaultBinningStr += "delta_phi: -1.570796, -1.483530, -1.396263, -1.308997, -1.221730, -1.134464, -1.047198, -0.959931, -0.872665, -0.785398, -0.698132, -0.610865, -0.523599, -0.436332, -0.349066, -0.261799, -0.174533, -0.087266, -0.043633, -0.021817, 0.0, 0.021817, 0.043633, 0.087266, 0.174533, 0.261799, 0.349066, 0.436332, 0.523599, 0.610865, 0.698132, 0.785398, 0.872665, 0.959931, 1.047198, 1.134464, 1.221730, 1.308997, 1.396263, 1.483530, 1.570796, 1.658063, 1.745329, 1.832596, 1.919862, 2.007129, 2.094395, 2.181662, 2.268928, 2.356194, 2.443461, 2.530727, 2.617994, 2.705260, 2.792527, 2.879793, 2.967060, 3.054326, 3.141593, 3.228859, 3.316126, 3.403392, 3.490659, 3.577925, 3.665191, 3.752458, 3.839724, 3.926991, 4.014257, 4.101524, 4.188790, 4.276057, 4.363323, 4.450590, 4.537856, 4.625123, 4.712389\n"
123 "delta_eta: -2.0, -1.9, -1.8, -1.7, -1.6, -1.5, -1.4, -1.3, -1.2, -1.1, -1.0, -0.9, -0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, -0.05, -0.025, 0, 0.025, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2.0\n"
124 ;
125 }
126 else // UE
127 defaultBinningStr += "multiplicity: -0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5, 12.5, 13.5, 200.0\n"
128 "delta_phi: -1.570796, -1.483530, -1.396263, -1.308997, -1.221730, -1.134464, -1.047198, -0.959931, -0.872665, -0.785398, -0.698132, -0.610865, -0.523599, -0.436332, -0.349066, -0.261799, -0.174533, -0.087266, 0.0, 0.087266, 0.174533, 0.261799, 0.349066, 0.436332, 0.523599, 0.610865, 0.698132, 0.785398, 0.872665, 0.959931, 1.047198, 1.134464, 1.221730, 1.308997, 1.396263, 1.483530, 1.570796, 1.658063, 1.745329, 1.832596, 1.919862, 2.007129, 2.094395, 2.181662, 2.268928, 2.356194, 2.443461, 2.530727, 2.617994, 2.705260, 2.792527, 2.879793, 2.967060, 3.054326, 3.141593, 3.228859, 3.316126, 3.403392, 3.490659, 3.577925, 3.665191, 3.752458, 3.839724, 3.926991, 4.014257, 4.101524, 4.188790, 4.276057, 4.363323, 4.450590, 4.537856, 4.625123, 4.712389\n"
129 "vertex: -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10\n"
130 ;
131
132 // combine customBinning with defaultBinningStr -> use customBinning where available and otherwise defaultBinningStr
c9ae910e 133 TString binningStr = AliUEHist::CombineBinning(defaultBinningStr, TString(binning));
3f3f12d9 134
bf58cbde 135 if (histogramsStr.Contains("1"))
3f3f12d9 136 fNumberDensitypT = new AliUEHist("NumberDensitypT", binningStr);
bf58cbde 137 if (histogramsStr.Contains("2"))
3f3f12d9 138 fSumpT = new AliUEHist("SumpT", binningStr);
a75aacd6 139
bf58cbde 140 if (histogramsStr.Contains("3"))
3f3f12d9 141 fNumberDensityPhi = new AliUEHist("NumberDensityPhi", binningStr);
0ffdaf17 142 else if (histogramsStr.Contains("4"))
3f3f12d9 143 fNumberDensityPhi = new AliUEHist("NumberDensityPhiCentrality", binningStr);
144 else if (histogramsStr.Contains("5") || histogramsStr.Contains("6"))
145 fNumberDensityPhi = new AliUEHist("NumberDensityPhiCentralityVtx", binningStr);
a75aacd6 146
147 // do not add this hists to the directory
148 Bool_t oldStatus = TH1::AddDirectoryStatus();
149 TH1::AddDirectory(kFALSE);
150
f0a25b1d 151 if (!histogramsStr.Contains("4") && !histogramsStr.Contains("5") && !histogramsStr.Contains("6"))
c7245604 152 {
153 fCorrelationpT = new TH2F("fCorrelationpT", ";p_{T,lead} (MC);p_{T,lead} (RECO)", 200, 0, 50, 200, 0, 50);
2a910c25 154 fCorrelationEta = new TH2F("fCorrelationEta", ";#eta_{lead} (MC);#eta_{T,lead} (RECO)", 200, -1, 1, 200, -1, 1);
a4a4d54e 155 fCorrelationPhi = new TH2F("fCorrelationPhi", ";#varphi_{lead} (MC);#varphi_{T,lead} (RECO)", 200, 0, TMath::TwoPi(), 200, 0, TMath::TwoPi());
c7245604 156 }
157 else
158 {
2a910c25 159 fCorrelationpT = new TH2F("fCorrelationpT", ";Centrality;p_{T} (RECO)", 100, 0, 100.001, 200, 0, 50);
9da2f080 160 fCorrelationEta = new TH2F("fCorrelationEta", ";Centrality;#eta (RECO)", 100, 0, 100.001, 200, -5, 5);
a4a4d54e 161 fCorrelationPhi = new TH2F("fCorrelationPhi", ";Centrality;#varphi (RECO)", 100, 0, 100.001, 200, 0, TMath::TwoPi());
c7245604 162 }
163
a75aacd6 164 fCorrelationR = new TH2F("fCorrelationR", ";R;p_{T,lead} (MC)", 200, 0, 2, 200, 0, 50);
a4a4d54e 165 fCorrelationLeading2Phi = new TH2F("fCorrelationLeading2Phi", ";#Delta #varphi;p_{T,lead} (MC)", 200, -TMath::Pi(), TMath::Pi(), 200, 0, 50);
a75aacd6 166 fCorrelationMultiplicity = new TH2F("fCorrelationMultiplicity", ";MC tracks;Reco tracks", 100, -0.5, 99.5, 100, -0.5, 99.5);
a5d12d24 167 fYields = new TH3F("fYields", ";centrality;pT;eta", 100, 0, 100, 40, 0, 20, 100, -1, 1);
09357ca8 168 fInvYield2 = new TH2F("fInvYield2", ";centrality;pT;1/pT dNch/dpT", 100, 0, 100, 80, 0, 20);
5e053cad 169
f0a25b1d 170 if (!histogramsStr.Contains("4") && !histogramsStr.Contains("5") && !histogramsStr.Contains("6"))
2a910c25 171 {
172 fEventCount = new TH2F("fEventCount", ";step;event type;count", AliUEHist::fgkCFSteps+2, -2.5, -0.5 + AliUEHist::fgkCFSteps, 3, -0.5, 2.5);
173 fEventCount->GetYaxis()->SetBinLabel(1, "ND");
174 fEventCount->GetYaxis()->SetBinLabel(2, "SD");
175 fEventCount->GetYaxis()->SetBinLabel(3, "DD");
176 }
177 else
178 {
179 fEventCount = new TH2F("fEventCount", ";step;centrality;count", AliUEHist::fgkCFSteps+2, -2.5, -0.5 + AliUEHist::fgkCFSteps, fNumberDensityPhi->GetEventHist()->GetNBins(1), fNumberDensityPhi->GetEventHist()->GetAxis(1, 0)->GetXbins()->GetArray());
180 }
a75aacd6 181
182 fEventCountDifferential = new TH3F("fEventCountDifferential", ";p_{T,lead};step;event type", 100, 0, 50, AliUEHist::fgkCFSteps, -0.5, -0.5 + AliUEHist::fgkCFSteps, 3, -0.5, 2.5);
183 fEventCountDifferential->GetZaxis()->SetBinLabel(1, "ND");
184 fEventCountDifferential->GetZaxis()->SetBinLabel(2, "SD");
185 fEventCountDifferential->GetZaxis()->SetBinLabel(3, "DD");
186
187 fVertexContributors = new TH1F("fVertexContributors", ";contributors;count", 100, -0.5, 99.5);
188
664d6288 189 if (fNumberDensityPhi)
447d47d8 190 {
191 fCentralityDistribution = new TH1F("fCentralityDistribution", ";centrality;count", fNumberDensityPhi->GetEventHist()->GetNBins(1), fNumberDensityPhi->GetEventHist()->GetAxis(1, 0)->GetXbins()->GetArray());
4337a482 192 fCentralityCorrelation = new TH2F("fCentralityCorrelation", ";centrality;multiplicity", 404, 0, 101, 200, 0, 4000);
447d47d8 193 }
bf58cbde 194
2a910c25 195 fITSClusterMap = new TH3F("fITSClusterMap", "; its cluster map; centrality; pT", 256, -0.5, 255.5, 20, 0, 100.001, 100, 0, 20);
196
f613255f 197 fControlConvResoncances = new TH2F("fControlConvResoncances", ";id;delta mass", 3, -0.5, 2.5, 100, -0.1, 0.1);
198
a75aacd6 199 TH1::AddDirectory(oldStatus);
200}
201
d1c75d06 202//_____________________________________________________________________________
203AliUEHistograms::AliUEHistograms(const AliUEHistograms &c) :
e0331fd9 204 TNamed(fName, fTitle),
d1c75d06 205 fNumberDensitypT(0),
206 fSumpT(0),
207 fNumberDensityPhi(0),
208 fCorrelationpT(0),
209 fCorrelationEta(0),
210 fCorrelationPhi(0),
211 fCorrelationR(0),
212 fCorrelationLeading2Phi(0),
213 fCorrelationMultiplicity(0),
5e053cad 214 fYields(0),
09357ca8 215 fInvYield2(0),
d1c75d06 216 fEventCount(0),
217 fEventCountDifferential(0),
bf58cbde 218 fVertexContributors(0),
c7245604 219 fCentralityDistribution(0),
447d47d8 220 fCentralityCorrelation(0),
2a910c25 221 fITSClusterMap(0),
f613255f 222 fControlConvResoncances(0),
418b56c5 223 fEfficiencyCorrectionTriggers(0),
224 fEfficiencyCorrectionAssociated(0),
85bfac17 225 fSelectCharge(0),
7a77d480 226 fTriggerSelectCharge(0),
15b0fdd0 227 fAssociatedSelectCharge(0),
d38fa455 228 fTriggerRestrictEta(-1),
00b6f3c6 229 fEtaOrdering(kFALSE),
b0d56b29 230 fCutConversions(kFALSE),
231 fCutResonances(kFALSE),
97270ee2 232 fRejectResonanceDaughters(-1),
9da2f080 233 fOnlyOneEtaSide(0),
8a368fc2 234 fWeightPerEvent(kFALSE),
640b9425 235 fPtOrder(kTRUE),
7e9608f2 236 fTwoTrackCutMinRadius(0.8),
e5df0f3a 237 fRunNumber(0),
238 fMergeCount(1)
d1c75d06 239{
240 //
241 // AliUEHistograms copy constructor
242 //
243
670e1d49 244 fTwoTrackDistancePt[0] = 0;
245 fTwoTrackDistancePt[1] = 0;
1bba939a 246
d1c75d06 247 ((AliUEHistograms &) c).Copy(*this);
248}
249
a75aacd6 250//____________________________________________________________________
251AliUEHistograms::~AliUEHistograms()
252{
253 // Destructor
254
b0d56b29 255 DeleteContainers();
256}
257
258void AliUEHistograms::DeleteContainers()
259{
a75aacd6 260 if (fNumberDensitypT)
261 {
262 delete fNumberDensitypT;
263 fNumberDensitypT = 0;
264 }
265
266 if (fSumpT)
267 {
268 delete fSumpT;
269 fSumpT = 0;
270 }
271
272 if (fNumberDensityPhi)
273 {
274 delete fNumberDensityPhi;
275 fNumberDensityPhi = 0;
276 }
277
278 if (fCorrelationpT)
279 {
280 delete fCorrelationpT;
281 fCorrelationpT = 0;
282 }
283
284 if (fCorrelationEta)
285 {
286 delete fCorrelationEta;
287 fCorrelationEta = 0;
288 }
289
290 if (fCorrelationPhi)
291 {
292 delete fCorrelationPhi;
293 fCorrelationPhi = 0;
294 }
295
296 if (fCorrelationR)
297 {
298 delete fCorrelationR;
299 fCorrelationR = 0;
300 }
301
302 if (fCorrelationLeading2Phi)
303 {
304 delete fCorrelationLeading2Phi;
305 fCorrelationLeading2Phi = 0;
306 }
307
308 if (fCorrelationMultiplicity)
309 {
310 delete fCorrelationMultiplicity;
311 fCorrelationMultiplicity = 0;
312 }
313
5e053cad 314 if (fYields)
315 {
316 delete fYields;
317 fYields = 0;
318 }
319
09357ca8 320 if (fInvYield2)
f89c31a7 321 {
09357ca8
JFGO
322 delete fInvYield2;
323 fInvYield2 = 0;
f89c31a7
JFGO
324 }
325
a75aacd6 326 if (fEventCount)
327 {
328 delete fEventCount;
329 fEventCount = 0;
330 }
331
332 if (fEventCountDifferential)
333 {
334 delete fEventCountDifferential;
335 fEventCountDifferential = 0;
336 }
337
338 if (fVertexContributors)
339 {
340 delete fVertexContributors;
341 fVertexContributors = 0;
342 }
bf58cbde 343
344 if (fCentralityDistribution)
345 {
346 delete fCentralityDistribution;
347 fCentralityDistribution = 0;
348 }
2a910c25 349
447d47d8 350 if (fCentralityCorrelation)
351 {
352 delete fCentralityCorrelation;
353 fCentralityCorrelation = 0;
354 }
355
2a910c25 356 if (fITSClusterMap)
357 {
358 delete fITSClusterMap;
359 fITSClusterMap = 0;
360 }
13a404ed 361
1bba939a 362 for (Int_t i=0; i<2; i++)
670e1d49 363 if (fTwoTrackDistancePt[i])
1bba939a 364 {
670e1d49 365 delete fTwoTrackDistancePt[i];
366 fTwoTrackDistancePt[i] = 0;
1bba939a 367 }
13a404ed 368
f613255f 369 if (fControlConvResoncances)
370 {
371 delete fControlConvResoncances;
372 fControlConvResoncances = 0;
373 }
374
418b56c5 375 if (fEfficiencyCorrectionTriggers)
13a404ed 376 {
418b56c5 377 delete fEfficiencyCorrectionTriggers;
378 fEfficiencyCorrectionTriggers = 0;
379 }
380
381 if (fEfficiencyCorrectionAssociated)
382 {
383 delete fEfficiencyCorrectionAssociated;
384 fEfficiencyCorrectionAssociated = 0;
13a404ed 385 }
a75aacd6 386}
387
ada1a03f 388AliUEHist* AliUEHistograms::GetUEHist(Int_t id)
389{
390 // returns AliUEHist object, useful for loops
391
392 switch (id)
393 {
394 case 0: return fNumberDensitypT; break;
395 case 1: return fSumpT; break;
396 case 2: return fNumberDensityPhi; break;
397 }
398
399 return 0;
400}
401
a75aacd6 402//____________________________________________________________________
403Int_t AliUEHistograms::CountParticles(TList* list, Float_t ptMin)
404{
405 // counts the number of particles in the list with a pT above ptMin
406 // TODO eta cut needed here?
407
408 Int_t count = 0;
409 for (Int_t j=0; j<list->GetEntries(); j++)
410 if (((AliVParticle*) list->At(j))->Pt() > ptMin)
411 count++;
412
413 return count;
414}
415
416//____________________________________________________________________
85bfac17 417void AliUEHistograms::Fill(Int_t eventType, Float_t zVtx, AliUEHist::CFStep step, AliVParticle* leading, TList* toward, TList* away, TList* min, TList* max)
a75aacd6 418{
419 // fills the UE event histograms
420 //
421 // this function needs the leading (track or jet or ...) and four lists of AliVParticles which contain the particles/tracks to be filled in the four regions
422
423 // if leading is not set, just fill event statistics
424 if (leading)
425 {
426 Int_t multiplicity = 0;
427
428 // TODO configurable?
429 Float_t ptMin = 0.15;
430 if (leading->Pt() > ptMin)
431 multiplicity++;
432
433 multiplicity += CountParticles(toward, ptMin);
434 multiplicity += CountParticles(away, ptMin);
435 multiplicity += CountParticles(min, ptMin);
436 multiplicity += CountParticles(max, ptMin);
437
85bfac17 438 FillRegion(AliUEHist::kToward, zVtx, step, leading, toward, multiplicity);
439 FillRegion(AliUEHist::kAway, zVtx, step, leading, away, multiplicity);
440 FillRegion(AliUEHist::kMin, zVtx, step, leading, min, multiplicity);
441 FillRegion(AliUEHist::kMax, zVtx, step, leading, max, multiplicity);
b1831bcb 442
85bfac17 443 Double_t vars[3];
a75aacd6 444 vars[0] = leading->Pt();
445 vars[1] = multiplicity;
85bfac17 446 vars[2] = zVtx;
bf58cbde 447 for (Int_t i=0; i<fgkUEHists; i++)
448 if (GetUEHist(i))
449 GetUEHist(i)->GetEventHist()->Fill(vars, step);
a75aacd6 450
451 fEventCountDifferential->Fill(leading->Pt(), step, eventType);
452 }
453
454 FillEvent(eventType, step);
455}
456
457//____________________________________________________________________
85bfac17 458void AliUEHistograms::FillRegion(AliUEHist::Region region, Float_t zVtx, AliUEHist::CFStep step, AliVParticle* leading, TList* list, Int_t multiplicity)
a75aacd6 459{
460 // loops over AliVParticles in list and fills the given region at the given step
461 //
462 // See also Fill(...)
463
464 for (Int_t i=0; i<list->GetEntries(); i++)
465 {
466 AliVParticle* particle = (AliVParticle*) list->At(i);
467
85bfac17 468 Double_t vars[6];
a75aacd6 469 vars[0] = particle->Eta();
470 vars[1] = particle->Pt();
471 vars[2] = leading->Pt();
472 vars[3] = multiplicity;
473 vars[4] = leading->Phi() - particle->Phi();
2ac8dc5c 474 if (vars[4] > 1.5 * TMath::Pi())
475 vars[4] -= TMath::TwoPi();
476 if (vars[4] < -0.5 * TMath::Pi())
477 vars[4] += TMath::TwoPi();
85bfac17 478 vars[5] = zVtx;
479
bf58cbde 480 if (fNumberDensitypT)
481 fNumberDensitypT->GetTrackHist(region)->Fill(vars, step);
482
483 if (fSumpT)
484 fSumpT->GetTrackHist(region)->Fill(vars, step, particle->Pt());
a75aacd6 485
486 // fill all in toward region (is anyway as function of delta phi!)
bf58cbde 487 if (fNumberDensityPhi)
488 fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->Fill(vars, step);
a75aacd6 489 }
490}
491
492//____________________________________________________________________
493void AliUEHistograms::Fill(AliVParticle* leadingMC, AliVParticle* leadingReco)
494{
495 // fills the correlation histograms
496
497 if (leadingMC)
498 {
499 fCorrelationpT->Fill(leadingMC->Pt(), leadingReco->Pt());
500 if (leadingMC->Pt() > 0.5)
501 {
502 fCorrelationEta->Fill(leadingMC->Eta(), leadingReco->Eta());
503 fCorrelationPhi->Fill(leadingMC->Phi(), leadingReco->Phi());
504 }
505
506 Float_t phiDiff = leadingMC->Phi() - leadingReco->Phi();
507 if (phiDiff > TMath::Pi())
508 phiDiff -= TMath::TwoPi();
509 if (phiDiff < -TMath::Pi())
510 phiDiff += TMath::TwoPi();
511
512 Float_t etaDiff = leadingMC->Eta() - leadingReco->Eta();
513
514 fCorrelationR->Fill(TMath::Sqrt(phiDiff * phiDiff + etaDiff * etaDiff), leadingMC->Pt());
515 fCorrelationLeading2Phi->Fill(phiDiff, leadingMC->Pt());
516 }
517 else
518 {
519 fCorrelationpT->Fill(1.0, leadingReco->Pt());
520 if (leadingReco->Pt() > 0.5)
521 {
522 fCorrelationEta->Fill(0.0, leadingReco->Eta());
523 fCorrelationPhi->Fill(0.0, leadingReco->Phi());
524 }
525 }
526}
bf58cbde 527
528//____________________________________________________________________
408d1ac9 529void AliUEHistograms::FillCorrelations(Double_t centrality, Float_t zVtx, AliUEHist::CFStep step, TObjArray* particles, TObjArray* mixed, Float_t weight, Bool_t firstTime, Bool_t twoTrackEfficiencyCut, Float_t bSign, Float_t twoTrackEfficiencyCutValue, Bool_t applyEfficiency)
bf58cbde 530{
531 // fills the fNumberDensityPhi histogram
532 //
533 // this function need a list of AliVParticles which contain the particles/tracks to be filled
e0331fd9 534 //
535 // if mixed is non-0, mixed events are filled, the trigger particle is from particles, the associated from mixed
c05ff6be 536 // if weight < 0, then the pt of the associated particle is filled as weight
537
538 Bool_t fillpT = kFALSE;
539 if (weight < 0)
540 fillpT = kTRUE;
bf58cbde 541
7fd35fdd 542 if (twoTrackEfficiencyCut && !fTwoTrackDistancePt[0])
543 {
5e053cad 544 // do not add this hists to the directory
545 Bool_t oldStatus = TH1::AddDirectoryStatus();
546 TH1::AddDirectory(kFALSE);
547
edd964a8 548 fTwoTrackDistancePt[0] = new TH3F("fTwoTrackDistancePt[0]", ";#Delta#eta;#Delta#varphi^{*}_{min};#Delta p_{T}", 100, -0.15, 0.15, 100, -0.05, 0.05, 20, 0, 10);
7fd35fdd 549 fTwoTrackDistancePt[1] = (TH3F*) fTwoTrackDistancePt[0]->Clone("fTwoTrackDistancePt[1]");
5e053cad 550
551 TH1::AddDirectory(oldStatus);
7fd35fdd 552 }
553
eed401dc 554 // Eta() is extremely time consuming, therefore cache it for the inner loop here:
555 TObjArray* input = (mixed) ? mixed : particles;
556 TArrayF eta(input->GetEntriesFast());
557 for (Int_t i=0; i<input->GetEntriesFast(); i++)
e97a861c 558 eta[i] = ((AliVParticle*) input->UncheckedAt(i))->Eta();
eed401dc 559
bf58cbde 560 // if particles is not set, just fill event statistics
561 if (particles)
562 {
eed401dc 563 Int_t jMax = particles->GetEntriesFast();
564 if (mixed)
565 jMax = mixed->GetEntriesFast();
566
8a368fc2 567 TH1* triggerWeighting = 0;
568 if (fWeightPerEvent)
569 {
570 TAxis* axis = fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->GetGrid(0)->GetGrid()->GetAxis(2);
571 triggerWeighting = new TH1F("triggerWeighting", "", axis->GetNbins(), axis->GetXbins()->GetArray());
572
573 for (Int_t i=0; i<particles->GetEntriesFast(); i++)
574 {
e97a861c 575 AliVParticle* triggerParticle = (AliVParticle*) particles->UncheckedAt(i);
8a368fc2 576
577 // some optimization
578 Float_t triggerEta = triggerParticle->Eta();
579
580 if (fTriggerRestrictEta > 0 && TMath::Abs(triggerEta) > fTriggerRestrictEta)
581 continue;
582
583 if (fOnlyOneEtaSide != 0)
584 {
585 if (fOnlyOneEtaSide * triggerEta < 0)
586 continue;
587 }
588
589 if (fTriggerSelectCharge != 0)
590 if (triggerParticle->Charge() * fTriggerSelectCharge < 0)
591 continue;
592
593 triggerWeighting->Fill(triggerParticle->Pt());
594 }
97270ee2 595 }
596
597 // identify K, Lambda candidates and flag those particles
598 // a TObject bit is used for this
599 const UInt_t kResonanceDaughterFlag = 1 << 14;
600 if (fRejectResonanceDaughters > 0)
601 {
602 Double_t resonanceMass = -1;
603 Double_t massDaughter1 = -1;
604 Double_t massDaughter2 = -1;
605 const Double_t interval = 0.02;
606
607 switch (fRejectResonanceDaughters)
608 {
7bb22574 609 case 1: resonanceMass = 1.2; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // method test
97270ee2 610 case 2: resonanceMass = 0.4976; massDaughter1 = 0.1396; massDaughter2 = massDaughter1; break; // k0
611 case 3: resonanceMass = 1.115; massDaughter1 = 0.1396; massDaughter2 = 0.9383; break; // lambda
612 default: AliFatal(Form("Invalid setting %d", fRejectResonanceDaughters));
613 }
614
615 for (Int_t i=0; i<particles->GetEntriesFast(); i++)
616 particles->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);
617 if (mixed)
618 for (Int_t i=0; i<jMax; i++)
619 mixed->UncheckedAt(i)->ResetBit(kResonanceDaughterFlag);
620
621 for (Int_t i=0; i<particles->GetEntriesFast(); i++)
622 {
623 AliVParticle* triggerParticle = (AliVParticle*) particles->UncheckedAt(i);
624
625 for (Int_t j=0; j<jMax; j++)
626 {
627 if (!mixed && i == j)
628 continue;
629
630 AliVParticle* particle = 0;
631 if (!mixed)
632 particle = (AliVParticle*) particles->UncheckedAt(j);
633 else
634 particle = (AliVParticle*) mixed->UncheckedAt(j);
635
636 // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event)
637 if (mixed && triggerParticle->IsEqual(particle))
638 continue;
639
640 if (triggerParticle->Charge() * particle->Charge() > 0)
641 continue;
642
643 Float_t mass = GetInvMassSquaredCheap(triggerParticle->Pt(), triggerParticle->Eta(), triggerParticle->Phi(), particle->Pt(), particle->Eta(), particle->Phi(), massDaughter1, massDaughter2);
644
645 if (TMath::Abs(mass - resonanceMass*resonanceMass) < interval*5)
646 {
647 mass = GetInvMassSquared(triggerParticle->Pt(), triggerParticle->Eta(), triggerParticle->Phi(), particle->Pt(), particle->Eta(), particle->Phi(), massDaughter1, massDaughter2);
648
649 if (mass > (resonanceMass-interval)*(resonanceMass-interval) && mass < (resonanceMass+interval)*(resonanceMass+interval))
650 {
651 triggerParticle->SetBit(kResonanceDaughterFlag);
652 particle->SetBit(kResonanceDaughterFlag);
653
654// Printf("Flagged %d %d %f", i, j, TMath::Sqrt(mass));
655 }
656 }
657 }
658 }
8a368fc2 659 }
660
eed401dc 661 for (Int_t i=0; i<particles->GetEntriesFast(); i++)
bf58cbde 662 {
e97a861c 663 AliVParticle* triggerParticle = (AliVParticle*) particles->UncheckedAt(i);
eed401dc 664
665 // some optimization
666 Float_t triggerEta = triggerParticle->Eta();
9da2f080 667
668 if (fTriggerRestrictEta > 0 && TMath::Abs(triggerEta) > fTriggerRestrictEta)
669 continue;
670
671 if (fOnlyOneEtaSide != 0)
672 {
673 if (fOnlyOneEtaSide * triggerEta < 0)
674 continue;
675 }
7a77d480 676
677 if (fTriggerSelectCharge != 0)
678 if (triggerParticle->Charge() * fTriggerSelectCharge < 0)
679 continue;
15b0fdd0 680
97270ee2 681 if (fRejectResonanceDaughters > 0)
682 if (triggerParticle->TestBit(kResonanceDaughterFlag))
683 {
684// Printf("Skipped i=%d", i);
685 continue;
686 }
687
e0331fd9 688 for (Int_t j=0; j<jMax; j++)
bf58cbde 689 {
e0331fd9 690 if (!mixed && i == j)
bf58cbde 691 continue;
692
e0331fd9 693 AliVParticle* particle = 0;
694 if (!mixed)
e97a861c 695 particle = (AliVParticle*) particles->UncheckedAt(j);
e0331fd9 696 else
e97a861c 697 particle = (AliVParticle*) mixed->UncheckedAt(j);
bf58cbde 698
1d53fb34 699 // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event)
97270ee2 700 if (mixed && triggerParticle->IsEqual(particle))
2a910c25 701 continue;
702
1d53fb34 703 if (fPtOrder)
1d53fb34 704 if (particle->Pt() >= triggerParticle->Pt())
705 continue;
1d53fb34 706
15b0fdd0 707 if (fAssociatedSelectCharge != 0)
708 if (particle->Charge() * fAssociatedSelectCharge < 0)
709 continue;
710
c7245604 711 if (fSelectCharge > 0)
712 {
713 // skip like sign
714 if (fSelectCharge == 1 && particle->Charge() * triggerParticle->Charge() > 0)
715 continue;
716
717 // skip unlike sign
718 if (fSelectCharge == 2 && particle->Charge() * triggerParticle->Charge() < 0)
719 continue;
720 }
721
00b6f3c6 722 if (fEtaOrdering)
723 {
724 if (triggerEta < 0 && eta[j] < triggerEta)
725 continue;
726 if (triggerEta > 0 && eta[j] > triggerEta)
727 continue;
728 }
729
97270ee2 730 if (fRejectResonanceDaughters > 0)
731 if (particle->TestBit(kResonanceDaughterFlag))
732 {
733// Printf("Skipped j=%d", j);
734 continue;
735 }
736
737 // conversions
b0d56b29 738 if (fCutConversions && particle->Charge() * triggerParticle->Charge() < 0)
739 {
e97a861c 740 Float_t mass = GetInvMassSquaredCheap(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.510e-3, 0.510e-3);
f613255f 741
e97a861c 742 if (mass < 0.1)
743 {
744 mass = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.510e-3, 0.510e-3);
745
746 fControlConvResoncances->Fill(0.0, mass);
b0d56b29 747
e97a861c 748 if (mass < 0.04*0.04)
749 continue;
750 }
b0d56b29 751 }
752
f613255f 753 // K0s
b0d56b29 754 if (fCutResonances && particle->Charge() * triggerParticle->Charge() < 0)
755 {
e97a861c 756 Float_t mass = GetInvMassSquaredCheap(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.1396, 0.1396);
f613255f 757
758 const Float_t kK0smass = 0.4976;
b0d56b29 759
e97a861c 760 if (TMath::Abs(mass - kK0smass*kK0smass) < 0.1)
761 {
762 mass = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.1396, 0.1396);
763
764 fControlConvResoncances->Fill(1, mass - kK0smass*kK0smass);
f613255f 765
e97a861c 766 if (mass > (kK0smass-0.02)*(kK0smass-0.02) && mass < (kK0smass+0.02)*(kK0smass+0.02))
767 continue;
768 }
b0d56b29 769 }
04af8d15 770
f613255f 771 // Lambda
772 if (fCutResonances && particle->Charge() * triggerParticle->Charge() < 0)
773 {
e97a861c 774 Float_t mass1 = GetInvMassSquaredCheap(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.1396, 0.9383);
775 Float_t mass2 = GetInvMassSquaredCheap(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.9383, 0.1396);
f613255f 776
777 const Float_t kLambdaMass = 1.115;
778
e97a861c 779 if (TMath::Abs(mass1 - kLambdaMass*kLambdaMass) < 0.1)
780 {
781 mass1 = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.1396, 0.9383);
f613255f 782
e97a861c 783 fControlConvResoncances->Fill(2, mass1 - kLambdaMass*kLambdaMass);
784
785 if (mass1 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass1 < (kLambdaMass+0.02)*(kLambdaMass+0.02))
786 continue;
787 }
788 if (TMath::Abs(mass2 - kLambdaMass*kLambdaMass) < 0.1)
789 {
790 mass2 = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.9383, 0.1396);
791
792 fControlConvResoncances->Fill(2, mass2 - kLambdaMass*kLambdaMass);
793
794 if (mass2 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass2 < (kLambdaMass+0.02)*(kLambdaMass+0.02))
795 continue;
796 }
f613255f 797 }
798
04af8d15 799 if (twoTrackEfficiencyCut)
800 {
7fd35fdd 801 // the variables & cuthave been developed by the HBT group
802 // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700
803
04af8d15 804 Float_t phi1 = triggerParticle->Phi();
805 Float_t pt1 = triggerParticle->Pt();
806 Float_t charge1 = triggerParticle->Charge();
807
808 Float_t phi2 = particle->Phi();
809 Float_t pt2 = particle->Pt();
810 Float_t charge2 = particle->Charge();
811
812 Float_t deta = triggerEta - eta[j];
813
814 // optimization
edd964a8 815 if (TMath::Abs(deta) < twoTrackEfficiencyCutValue * 2.5 * 3)
04af8d15 816 {
7fd35fdd 817 // check first boundaries to see if is worth to loop and find the minimum
7e9608f2 818 Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, fTwoTrackCutMinRadius, bSign);
7fd35fdd 819 Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign);
820
d4b3dbfc 821 const Float_t kLimit = twoTrackEfficiencyCutValue * 3;
04af8d15 822
7fd35fdd 823 Float_t dphistarminabs = 1e5;
824 Float_t dphistarmin = 1e5;
825 if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0)
04af8d15 826 {
7e9608f2 827 for (Double_t rad=fTwoTrackCutMinRadius; rad<2.51; rad+=0.01)
7fd35fdd 828 {
829 Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSign);
830
831 Float_t dphistarabs = TMath::Abs(dphistar);
832
833 if (dphistarabs < dphistarminabs)
834 {
835 dphistarmin = dphistar;
836 dphistarminabs = dphistarabs;
837 }
838 }
839
840 fTwoTrackDistancePt[0]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));
04af8d15 841
d4b3dbfc 842 if (dphistarminabs < twoTrackEfficiencyCutValue && TMath::Abs(deta) < twoTrackEfficiencyCutValue)
04af8d15 843 {
7fd35fdd 844// Printf("Removed track pair %d %d with %f %f %f %f %f %f %f %f %f", i, j, deta, dphistarminabs, phi1, pt1, charge1, phi2, pt2, charge2, bSign);
845 continue;
04af8d15 846 }
7fd35fdd 847
848 fTwoTrackDistancePt[1]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));
04af8d15 849 }
04af8d15 850 }
851 }
b0d56b29 852
85bfac17 853 Double_t vars[6];
eed401dc 854 vars[0] = triggerEta - eta[j];
bf58cbde 855 vars[1] = particle->Pt();
856 vars[2] = triggerParticle->Pt();
857 vars[3] = centrality;
858 vars[4] = triggerParticle->Phi() - particle->Phi();
859 if (vars[4] > 1.5 * TMath::Pi())
860 vars[4] -= TMath::TwoPi();
861 if (vars[4] < -0.5 * TMath::Pi())
862 vars[4] += TMath::TwoPi();
85bfac17 863 vars[5] = zVtx;
c05ff6be 864
865 if (fillpT)
866 weight = particle->Pt();
13a404ed 867
868 Double_t useWeight = weight;
418b56c5 869 if (applyEfficiency)
408d1ac9 870 {
418b56c5 871 if (fEfficiencyCorrectionAssociated)
872 {
873 Int_t effVars[4];
874 // associated particle
875 effVars[0] = fEfficiencyCorrectionAssociated->GetAxis(0)->FindBin(eta[j]);
876 effVars[1] = fEfficiencyCorrectionAssociated->GetAxis(1)->FindBin(vars[1]); //pt
877 effVars[2] = fEfficiencyCorrectionAssociated->GetAxis(2)->FindBin(vars[3]); //centrality
878 effVars[3] = fEfficiencyCorrectionAssociated->GetAxis(3)->FindBin(vars[5]); //zVtx
879
880 // Printf("%d %d %d %d %f", effVars[0], effVars[1], effVars[2], effVars[3], fEfficiencyCorrectionAssociated->GetBinContent(effVars));
defad170 881
418b56c5 882 useWeight *= fEfficiencyCorrectionAssociated->GetBinContent(effVars);
883 }
884 if (fEfficiencyCorrectionTriggers)
d787bf34 885 {
418b56c5 886 Int_t effVars[4];
887
888 effVars[0] = fEfficiencyCorrectionTriggers->GetAxis(0)->FindBin(triggerEta);
889 effVars[1] = fEfficiencyCorrectionTriggers->GetAxis(1)->FindBin(vars[2]); //pt
890 effVars[2] = fEfficiencyCorrectionTriggers->GetAxis(2)->FindBin(vars[3]); //centrality
891 effVars[3] = fEfficiencyCorrectionTriggers->GetAxis(3)->FindBin(vars[5]); //zVtx
892 useWeight *= fEfficiencyCorrectionTriggers->GetBinContent(effVars);
d787bf34 893 }
408d1ac9 894 }
418b56c5 895
8a368fc2 896 if (fWeightPerEvent)
897 {
898 Int_t weightBin = triggerWeighting->GetXaxis()->FindBin(vars[2]);
899// Printf("Using weight %f", triggerWeighting->GetBinContent(weightBin));
900 useWeight /= triggerWeighting->GetBinContent(weightBin);
901 }
bf58cbde 902
c7245604 903 // fill all in toward region and do not use the other regions
418b56c5 904 fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->Fill(vars, step, useWeight);
905
d38fa455 906// Printf("%.2f %.2f --> %.2f", triggerEta, eta[j], vars[0]);
c7245604 907 }
bf58cbde 908
c7245604 909 if (firstTime)
910 {
911 // once per trigger particle
85bfac17 912 Double_t vars[3];
c7245604 913 vars[0] = triggerParticle->Pt();
914 vars[1] = centrality;
85bfac17 915 vars[2] = zVtx;
defad170 916
917 Double_t useWeight = 1;
418b56c5 918 if (fEfficiencyCorrectionTriggers && applyEfficiency)
defad170 919 {
920 Int_t effVars[4];
921
922 // trigger particle
418b56c5 923 effVars[0] = fEfficiencyCorrectionTriggers->GetAxis(0)->FindBin(triggerEta);
924 effVars[1] = fEfficiencyCorrectionTriggers->GetAxis(1)->FindBin(vars[0]); //pt
925 effVars[2] = fEfficiencyCorrectionTriggers->GetAxis(2)->FindBin(vars[1]); //centrality
926 effVars[3] = fEfficiencyCorrectionTriggers->GetAxis(3)->FindBin(vars[2]); //zVtx
927 useWeight *= fEfficiencyCorrectionTriggers->GetBinContent(effVars);
defad170 928 }
f89c31a7
JFGO
929
930 if (TMath::Abs(triggerEta) < 0.8 && triggerParticle->Pt() > 0)
09357ca8 931 fInvYield2->Fill(centrality, triggerParticle->Pt(), useWeight / triggerParticle->Pt());
f89c31a7 932
20b7a005 933 if (fWeightPerEvent)
934 {
935 // leads effectively to a filling of one entry per filled trigger particle pT bin
936 Int_t weightBin = triggerWeighting->GetXaxis()->FindBin(vars[0]);
937// Printf("Using weight %f", triggerWeighting->GetBinContent(weightBin));
938 useWeight /= triggerWeighting->GetBinContent(weightBin);
939 }
defad170 940
941 fNumberDensityPhi->GetEventHist()->Fill(vars, step, useWeight);
3f3f12d9 942
943 // QA
944 fCorrelationpT->Fill(centrality, triggerParticle->Pt());
945 fCorrelationEta->Fill(centrality, triggerEta);
946 fCorrelationPhi->Fill(centrality, triggerParticle->Phi());
947 fYields->Fill(centrality, triggerParticle->Pt(), triggerEta);
f89c31a7 948
3f3f12d9 949/* if (dynamic_cast<AliAODTrack*>(triggerParticle))
950 fITSClusterMap->Fill(((AliAODTrack*) triggerParticle)->GetITSClusterMap(), centrality, triggerParticle->Pt());*/
c7245604 951 }
bf58cbde 952 }
8a368fc2 953
954 if (triggerWeighting)
955 {
956 delete triggerWeighting;
957 triggerWeighting = 0;
958 }
bf58cbde 959 }
960
961 fCentralityDistribution->Fill(centrality);
447d47d8 962 fCentralityCorrelation->Fill(centrality, particles->GetEntriesFast());
2a910c25 963 FillEvent(centrality, step);
bf58cbde 964}
a75aacd6 965
b1831bcb 966//____________________________________________________________________
59375a30 967void AliUEHistograms::FillTrackingEfficiency(TObjArray* mc, TObjArray* recoPrim, TObjArray* recoAll, TObjArray* recoPrimPID, TObjArray* recoAllPID, TObjArray* fake, Int_t particleType, Double_t centrality, Double_t zVtx)
b1831bcb 968{
969 // fills the tracking efficiency objects
970 //
971 // mc: all primary MC particles
972 // recoPrim: reconstructed primaries (again MC particles)
973 // recoAll: reconstructed (again MC particles)
59375a30 974 // recoPrim: reconstructed primaries with checks on PID (again MC particles)
975 // recoAll: reconstructed with checks on PID (again MC particles)
b1831bcb 976 // particleType is: 0 for pion, 1 for kaon, 2 for proton, 3 for others
b591fb9c 977
59375a30 978 for (Int_t step=0; step<6; step++)
b1831bcb 979 {
980 TObjArray* list = mc;
981 if (step == 1)
982 list = recoPrim;
983 else if (step == 2)
984 list = recoAll;
b591fb9c 985 else if (step == 3)
59375a30 986 list = recoPrimPID;
987 else if (step == 4)
988 list = recoAllPID;
989 else if (step == 5)
b591fb9c 990 list = fake;
991
992 if (!list)
993 continue;
994
eed401dc 995 for (Int_t i=0; i<list->GetEntriesFast(); i++)
b1831bcb 996 {
e97a861c 997 AliVParticle* particle = (AliVParticle*) list->UncheckedAt(i);
408d1ac9 998 Double_t vars[5];
b1831bcb 999 vars[0] = particle->Eta();
1000 vars[1] = particle->Pt();
1001 vars[2] = particleType;
c7245604 1002 vars[3] = centrality;
408d1ac9 1003 vars[4] = zVtx;
b1831bcb 1004
bf58cbde 1005 for (Int_t j=0; j<fgkUEHists; j++)
1006 if (GetUEHist(j))
1007 GetUEHist(j)->GetTrackHistEfficiency()->Fill(vars, step);
b1831bcb 1008 }
1009 }
1010}
1011
b591fb9c 1012//____________________________________________________________________
1013void AliUEHistograms::FillFakePt(TObjArray* fake, Double_t centrality)
1014{
1015 TObjArray* tracksReco = (TObjArray*) fake->At(0);
1016 TObjArray* tracksMC = (TObjArray*) fake->At(1);
1017
b752706a 1018 if (tracksReco->GetEntriesFast() != tracksMC->GetEntriesFast())
1019 AliFatal(Form("Inconsistent arrays: %d vs %d", tracksReco->GetEntriesFast(), tracksMC->GetEntriesFast()));
1020
b591fb9c 1021 for (Int_t i=0; i<tracksReco->GetEntriesFast(); i++)
1022 {
1023 AliVParticle* particle1 = (AliVParticle*) tracksReco->At(i);
1024 AliVParticle* particle2 = (AliVParticle*) tracksMC->At(i);
1025 Double_t vars[3];
1026 vars[0] = particle1->Pt();
1027 vars[1] = particle2->Pt();
1028 vars[2] = centrality;
1029 for (Int_t j=0; j<fgkUEHists; j++)
1030 if (GetUEHist(j))
1031 GetUEHist(j)->GetMCRecoPtCorrelation()->Fill(vars[0],vars[1],vars[2]);
1032 }
1033}
1034
a75aacd6 1035//____________________________________________________________________
1036void AliUEHistograms::FillEvent(Int_t eventType, Int_t step)
1037{
1038 // fills the number of events at the given step and the given enty type
1039 //
1040 // WARNING: This function is called from Fill, so only call it for steps where Fill is not called
1041
1042 fEventCount->Fill(step, eventType);
1043}
1044
2a910c25 1045//____________________________________________________________________
1046void AliUEHistograms::FillEvent(Double_t centrality, Int_t step)
1047{
1048 // fills the number of events at the given step and the given centrality
1049 //
1050 // WARNING: This function is called from Fill, so only call it for steps where Fill is not called
1051
1052 fEventCount->Fill(step, centrality);
1053}
1054
a75aacd6 1055//____________________________________________________________________
1056void AliUEHistograms::SetEtaRange(Float_t etaMin, Float_t etaMax)
1057{
1058 // sets eta min and max for all contained AliUEHist classes
1059
bf58cbde 1060 for (Int_t i=0; i<fgkUEHists; i++)
1061 if (GetUEHist(i))
1062 GetUEHist(i)->SetEtaRange(etaMin, etaMax);
a75aacd6 1063}
1064
1065//____________________________________________________________________
1066void AliUEHistograms::SetPtRange(Float_t ptMin, Float_t ptMax)
1067{
1068 // sets pT min and max for all contained AliUEHist classes
1069
bf58cbde 1070 for (Int_t i=0; i<fgkUEHists; i++)
1071 if (GetUEHist(i))
1072 GetUEHist(i)->SetPtRange(ptMin, ptMax);
a75aacd6 1073}
1074
c824c30e 1075//____________________________________________________________________
1076void AliUEHistograms::SetPartSpecies(Int_t species)
1077{
1078 // sets PartSpecie for all contained AliUEHist classes
1079
1080 for (Int_t i=0; i<fgkUEHists; i++)
1081 if (GetUEHist(i))
1082 GetUEHist(i)->SetPartSpecies(species);
1083}
1084
85bfac17 1085//____________________________________________________________________
1086void AliUEHistograms::SetZVtxRange(Float_t min, Float_t max)
1087{
1088 // sets pT min and max for all contained AliUEHist classes
1089
1090 for (Int_t i=0; i<fgkUEHists; i++)
1091 if (GetUEHist(i))
1092 GetUEHist(i)->SetZVtxRange(min, max);
1093}
1094
144bd037 1095//____________________________________________________________________
1096void AliUEHistograms::SetContaminationEnhancement(TH1F* hist)
1097{
1098 // sets the contamination enhancement histogram in all contained AliUEHist classes
1099
bf58cbde 1100 for (Int_t i=0; i<fgkUEHists; i++)
1101 if (GetUEHist(i))
1102 GetUEHist(i)->SetContaminationEnhancement(hist);
144bd037 1103}
1104
a75aacd6 1105//____________________________________________________________________
1106void AliUEHistograms::SetCombineMinMax(Bool_t flag)
1107{
1108 // sets pT min and max for all contained AliUEHist classes
1109
bf58cbde 1110 for (Int_t i=0; i<fgkUEHists; i++)
1111 if (GetUEHist(i))
1112 GetUEHist(i)->SetCombineMinMax(flag);
a75aacd6 1113}
1114
defad170 1115//____________________________________________________________________
1116void AliUEHistograms::SetTrackEtaCut(Float_t value)
1117{
1118 // sets track eta cut for all contained AliUEHist classes
1119
1120 for (Int_t i=0; i<fgkUEHists; i++)
1121 if (GetUEHist(i))
1122 GetUEHist(i)->SetTrackEtaCut(value);
1123}
1124
20b7a005 1125//____________________________________________________________________
1126void AliUEHistograms::SetWeightPerEvent(Bool_t flag)
1127{
1128 // sets fWeightPerEvent for all contained AliUEHist classes
1129
1130 fWeightPerEvent = flag;
1131
1132 for (Int_t i=0; i<fgkUEHists; i++)
1133 if (GetUEHist(i))
1134 GetUEHist(i)->SetWeightPerEvent(fWeightPerEvent);
1135}
1136
a75aacd6 1137//____________________________________________________________________
1138void AliUEHistograms::Correct(AliUEHistograms* corrections)
1139{
1140 // corrects the contained histograms by calling AliUEHist::Correct
1141
bf58cbde 1142 for (Int_t i=0; i<fgkUEHists; i++)
1143 if (GetUEHist(i))
1144 GetUEHist(i)->Correct(corrections->GetUEHist(i));
a75aacd6 1145}
1146
1147//____________________________________________________________________
1148AliUEHistograms &AliUEHistograms::operator=(const AliUEHistograms &c)
1149{
1150 // assigment operator
1151
b0d56b29 1152 DeleteContainers();
1153
a75aacd6 1154 if (this != &c)
1155 ((AliUEHistograms &) c).Copy(*this);
1156
1157 return *this;
1158}
1159
1160//____________________________________________________________________
1161void AliUEHistograms::Copy(TObject& c) const
1162{
1163 // copy function
1164
1165 AliUEHistograms& target = (AliUEHistograms &) c;
1166
1167 if (fNumberDensitypT)
1168 target.fNumberDensitypT = dynamic_cast<AliUEHist*> (fNumberDensitypT->Clone());
1169
1170 if (fSumpT)
1171 target.fSumpT = dynamic_cast<AliUEHist*> (fSumpT->Clone());
1172
1173 if (fNumberDensityPhi)
1174 target.fNumberDensityPhi = dynamic_cast<AliUEHist*> (fNumberDensityPhi->Clone());
1175
1176 if (fCorrelationpT)
1177 target.fCorrelationpT = dynamic_cast<TH2F*> (fCorrelationpT->Clone());
1178
1179 if (fCorrelationEta)
1180 target.fCorrelationEta = dynamic_cast<TH2F*> (fCorrelationEta->Clone());
1181
1182 if (fCorrelationPhi)
1183 target.fCorrelationPhi = dynamic_cast<TH2F*> (fCorrelationPhi->Clone());
1184
1185 if (fCorrelationR)
1186 target.fCorrelationR = dynamic_cast<TH2F*> (fCorrelationR->Clone());
1187
1188 if (fCorrelationLeading2Phi)
1189 target.fCorrelationLeading2Phi = dynamic_cast<TH2F*> (fCorrelationLeading2Phi->Clone());
1190
1191 if (fCorrelationMultiplicity)
1192 target.fCorrelationMultiplicity = dynamic_cast<TH2F*> (fCorrelationMultiplicity->Clone());
1193
5e053cad 1194 if (fYields)
1195 target.fYields = dynamic_cast<TH3F*> (fYields->Clone());
1196
09357ca8
JFGO
1197 if (fInvYield2)
1198 target.fInvYield2 = dynamic_cast<TH2F*> (fInvYield2->Clone());
f89c31a7 1199
a75aacd6 1200 if (fEventCount)
1201 target.fEventCount = dynamic_cast<TH2F*> (fEventCount->Clone());
1202
1203 if (fEventCountDifferential)
1204 target.fEventCountDifferential = dynamic_cast<TH3F*> (fEventCountDifferential->Clone());
1205
1206 if (fVertexContributors)
1207 target.fVertexContributors = dynamic_cast<TH1F*> (fVertexContributors->Clone());
bf58cbde 1208
1209 if (fCentralityDistribution)
1210 target.fCentralityDistribution = dynamic_cast<TH1F*> (fCentralityDistribution->Clone());
c7245604 1211
447d47d8 1212 if (fCentralityCorrelation)
1213 target.fCentralityCorrelation = dynamic_cast<TH2F*> (fCentralityCorrelation->Clone());
1214
2a910c25 1215 if (fITSClusterMap)
1216 target.fITSClusterMap = dynamic_cast<TH3F*> (fITSClusterMap->Clone());
13a404ed 1217
f613255f 1218 if (fControlConvResoncances)
1219 target.fControlConvResoncances = dynamic_cast<TH2F*> (fControlConvResoncances->Clone());
1220
1bba939a 1221 for (Int_t i=0; i<2; i++)
670e1d49 1222 if (fTwoTrackDistancePt[i])
1223 target.fTwoTrackDistancePt[i] = dynamic_cast<TH3F*> (fTwoTrackDistancePt[i]->Clone());
1bba939a 1224
418b56c5 1225 if (fEfficiencyCorrectionTriggers)
1226 target.fEfficiencyCorrectionTriggers = dynamic_cast<THnF*> (fEfficiencyCorrectionTriggers->Clone());
1227
1228 if (fEfficiencyCorrectionAssociated)
1229 target.fEfficiencyCorrectionAssociated = dynamic_cast<THnF*> (fEfficiencyCorrectionAssociated->Clone());
13a404ed 1230
c7245604 1231 target.fSelectCharge = fSelectCharge;
7a77d480 1232 target.fTriggerSelectCharge = fTriggerSelectCharge;
15b0fdd0 1233 target.fAssociatedSelectCharge = fAssociatedSelectCharge;
d38fa455 1234 target.fTriggerRestrictEta = fTriggerRestrictEta;
00b6f3c6 1235 target.fEtaOrdering = fEtaOrdering;
b0d56b29 1236 target.fCutConversions = fCutConversions;
1237 target.fCutResonances = fCutResonances;
9da2f080 1238 target.fOnlyOneEtaSide = fOnlyOneEtaSide;
8a368fc2 1239 target.fWeightPerEvent = fWeightPerEvent;
85bfac17 1240 target.fRunNumber = fRunNumber;
e5df0f3a 1241 target.fMergeCount = fMergeCount;
640b9425 1242 target.fWeightPerEvent = fWeightPerEvent;
1243 target.fPtOrder = fPtOrder;
7e9608f2 1244 target.fTwoTrackCutMinRadius = fTwoTrackCutMinRadius;
a75aacd6 1245}
1246
1247//____________________________________________________________________
1248Long64_t AliUEHistograms::Merge(TCollection* list)
1249{
1250 // Merge a list of AliUEHistograms objects with this (needed for
1251 // PROOF).
1252 // Returns the number of merged objects (including this).
1253
1254 if (!list)
1255 return 0;
1256
1257 if (list->IsEmpty())
1258 return 1;
1259
1260 TIterator* iter = list->MakeIterator();
1261 TObject* obj;
1262
1263 // collections of objects
f89c31a7 1264 const Int_t kMaxLists = 20;
a75aacd6 1265 TList* lists[kMaxLists];
1266
1267 for (Int_t i=0; i<kMaxLists; i++)
1268 lists[i] = new TList;
1269
1270 Int_t count = 0;
1271 while ((obj = iter->Next())) {
1272
1273 AliUEHistograms* entry = dynamic_cast<AliUEHistograms*> (obj);
1274 if (entry == 0)
1275 continue;
1276
bf58cbde 1277 if (entry->fNumberDensitypT)
1278 lists[0]->Add(entry->fNumberDensitypT);
1279 if (entry->fSumpT)
1280 lists[1]->Add(entry->fSumpT);
1281 if (entry->fNumberDensityPhi)
1282 lists[2]->Add(entry->fNumberDensityPhi);
a75aacd6 1283 lists[3]->Add(entry->fCorrelationpT);
1284 lists[4]->Add(entry->fCorrelationEta);
1285 lists[5]->Add(entry->fCorrelationPhi);
1286 lists[6]->Add(entry->fCorrelationR);
1287 lists[7]->Add(entry->fCorrelationLeading2Phi);
1288 lists[8]->Add(entry->fCorrelationMultiplicity);
1289 lists[9]->Add(entry->fEventCount);
1290 lists[10]->Add(entry->fEventCountDifferential);
1291 lists[11]->Add(entry->fVertexContributors);
bf58cbde 1292 lists[12]->Add(entry->fCentralityDistribution);
2a910c25 1293 lists[13]->Add(entry->fITSClusterMap);
78d64459 1294 if (entry->fTwoTrackDistancePt[0])
670e1d49 1295 lists[14]->Add(entry->fTwoTrackDistancePt[0]);
78d64459 1296 if (entry->fTwoTrackDistancePt[1])
670e1d49 1297 lists[15]->Add(entry->fTwoTrackDistancePt[1]);
78d64459 1298 if (entry->fCentralityCorrelation)
447d47d8 1299 lists[16]->Add(entry->fCentralityCorrelation);
5e053cad 1300 if (entry->fYields)
1301 lists[17]->Add(entry->fYields);
09357ca8
JFGO
1302 if (entry->fInvYield2)
1303 lists[18]->Add(entry->fInvYield2);
f613255f 1304 if (entry->fControlConvResoncances)
f89c31a7 1305 lists[19]->Add(entry->fControlConvResoncances);
e5df0f3a 1306
1307 fMergeCount += entry->fMergeCount;
1308
a75aacd6 1309 count++;
1310 }
1311
bf58cbde 1312 if (fNumberDensitypT)
1313 fNumberDensitypT->Merge(lists[0]);
1314 if (fSumpT)
1315 fSumpT->Merge(lists[1]);
1316 if (fNumberDensityPhi)
1317 fNumberDensityPhi->Merge(lists[2]);
a75aacd6 1318 fCorrelationpT->Merge(lists[3]);
1319 fCorrelationEta->Merge(lists[4]);
1320 fCorrelationPhi->Merge(lists[5]);
1321 fCorrelationR->Merge(lists[6]);
1322 fCorrelationLeading2Phi->Merge(lists[7]);
1323 fCorrelationMultiplicity->Merge(lists[8]);
1324 fEventCount->Merge(lists[9]);
1325 fEventCountDifferential->Merge(lists[10]);
1326 fVertexContributors->Merge(lists[11]);
bf58cbde 1327 fCentralityDistribution->Merge(lists[12]);
2a910c25 1328 fITSClusterMap->Merge(lists[13]);
0ffdaf17 1329 if (fTwoTrackDistancePt[0] && lists[14]->GetEntries() > 0)
670e1d49 1330 fTwoTrackDistancePt[0]->Merge(lists[14]);
0ffdaf17 1331 if (fTwoTrackDistancePt[1] && lists[15]->GetEntries() > 0)
670e1d49 1332 fTwoTrackDistancePt[1]->Merge(lists[15]);
447d47d8 1333 if (fCentralityCorrelation)
1334 fCentralityCorrelation->Merge(lists[16]);
5e053cad 1335 if (fYields && lists[17]->GetEntries() > 0)
1336 fYields->Merge(lists[17]);
09357ca8
JFGO
1337 if (fInvYield2 && lists[18]->GetEntries() > 0)
1338 fInvYield2->Merge(lists[18]);
f89c31a7
JFGO
1339 if (fControlConvResoncances && lists[19]->GetEntries() > 0)
1340 fControlConvResoncances->Merge(lists[19]);
a75aacd6 1341
1342 for (Int_t i=0; i<kMaxLists; i++)
1343 delete lists[i];
e5df0f3a 1344
a75aacd6 1345 return count+1;
1346}
b1831bcb 1347
1348void AliUEHistograms::CopyReconstructedData(AliUEHistograms* from)
1349{
1350 // copies those histograms extracted from ESD to this object
1351
bf58cbde 1352 for (Int_t i=0; i<fgkUEHists; i++)
1353 if (GetUEHist(i))
1354 GetUEHist(i)->CopyReconstructedData(from->GetUEHist(i));
b1831bcb 1355}
6f803f6c 1356
0ffdaf17 1357void AliUEHistograms::DeepCopy(AliUEHistograms* from)
1358{
1359 // copies the entries of this object's members from the object <from> to this object
1360
1361 for (Int_t i=0; i<fgkUEHists; i++)
1362 if (GetUEHist(i) && from->GetUEHist(i))
1363 GetUEHist(i)->DeepCopy(from->GetUEHist(i));
1364}
1365
2a910c25 1366void AliUEHistograms::ExtendTrackingEfficiency(Bool_t verbose)
6f803f6c 1367{
1368 // delegates to AliUEHists
1369
bf58cbde 1370 for (Int_t i=0; i<fgkUEHists; i++)
1371 if (GetUEHist(i))
2a910c25 1372 GetUEHist(i)->ExtendTrackingEfficiency(verbose);
6f803f6c 1373}
1374
c7245604 1375void AliUEHistograms::Scale(Double_t factor)
1376{
1377 // scales all contained histograms by the given factor
1378
1379 for (Int_t i=0; i<fgkUEHists; i++)
1380 if (GetUEHist(i))
1381 GetUEHist(i)->Scale(factor);
1382
1383 TList list;
1384 list.Add(fCorrelationpT);
1385 list.Add(fCorrelationEta);
1386 list.Add(fCorrelationPhi);
1387 list.Add(fCorrelationR);
1388 list.Add(fCorrelationLeading2Phi);
1389 list.Add(fCorrelationMultiplicity);
5e053cad 1390 list.Add(fYields);
09357ca8 1391 list.Add(fInvYield2);
c7245604 1392 list.Add(fEventCount);
1393 list.Add(fEventCountDifferential);
1394 list.Add(fVertexContributors);
1395 list.Add(fCentralityDistribution);
447d47d8 1396 list.Add(fCentralityCorrelation);
2a910c25 1397 list.Add(fITSClusterMap);
670e1d49 1398 list.Add(fTwoTrackDistancePt[0]);
1399 list.Add(fTwoTrackDistancePt[1]);
f613255f 1400 list.Add(fControlConvResoncances);
c7245604 1401
1402 for (Int_t i=0; i<list.GetEntries(); i++)
1403 ((TH1*) list.At(i))->Scale(factor);
1404}
1405
1406void AliUEHistograms::Reset()
1407{
1408 // delegates to AliUEHists
1409
1410 for (Int_t i=0; i<fgkUEHists; i++)
1411 if (GetUEHist(i))
1412 GetUEHist(i)->Reset();
1413}