]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/Correlations/Base/AliUEHistograms.cxx
Adding muon-muon correlations task (Antonio)
[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),
a75aacd6 55 fEventCount(0),
56 fEventCountDifferential(0),
bf58cbde 57 fVertexContributors(0),
c7245604 58 fCentralityDistribution(0),
447d47d8 59 fCentralityCorrelation(0),
2a910c25 60 fITSClusterMap(0),
f613255f 61 fControlConvResoncances(0),
418b56c5 62 fEfficiencyCorrectionTriggers(0),
63 fEfficiencyCorrectionAssociated(0),
85bfac17 64 fSelectCharge(0),
7a77d480 65 fTriggerSelectCharge(0),
15b0fdd0 66 fAssociatedSelectCharge(0),
d38fa455 67 fTriggerRestrictEta(-1),
00b6f3c6 68 fEtaOrdering(kFALSE),
b0d56b29 69 fCutConversions(kFALSE),
70 fCutResonances(kFALSE),
9da2f080 71 fOnlyOneEtaSide(0),
8a368fc2 72 fWeightPerEvent(kFALSE),
e5df0f3a 73 fRunNumber(0),
74 fMergeCount(1)
a75aacd6 75{
76 // Constructor
bf58cbde 77 //
78 // the string histograms defines which histograms are created:
79 // 1 = NumberDensitypT
80 // 2 = SumpT
81 // 3 = NumberDensityPhi
82 // 4 = NumberDensityPhiCentrality (other multiplicity for Pb)
83
0ffdaf17 84 AliLog::SetClassDebugLevel("AliCFContainer", -1);
85 AliLog::SetClassDebugLevel("AliCFGridSparse", -3);
86
670e1d49 87 fTwoTrackDistancePt[0] = 0;
88 fTwoTrackDistancePt[1] = 0;
1bba939a 89
bf58cbde 90 TString histogramsStr(histograms);
91
3f3f12d9 92 TString defaultBinningStr;
93 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"
94 "p_t_assoc: 0.5, 0.75, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 8.0\n"
95 "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"
96 "p_t_leading_course: 0.5, 1.0, 2.0, 3.0, 4.0, 6.0, 8.0\n"
97 "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"
98 "vertex_eff: -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10\n"
99 ;
100
101 if (histogramsStr.Contains("4") || histogramsStr.Contains("5") || histogramsStr.Contains("6")) // Dphi Corr
102 {
103 if (histogramsStr.Contains("C"))
104 defaultBinningStr += "multiplicity: 0, 20, 40, 60, 80, 100.1\n"; // course
105 else
106 defaultBinningStr += "multiplicity: 0, 1, 2, 3, 4, 5, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100.1\n";
107
108 if (histogramsStr.Contains("5"))
109 defaultBinningStr += "vertex: -7, -5, -3, -1, 1, 3, 5, 7\n";
110 else
111 defaultBinningStr += "vertex: -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10\n";
112
113 if (histogramsStr.Contains("R"))
114 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
115 "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"
116 ;
117 else // for TTR studies
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.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"
119 "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"
120 ;
121 }
122 else // UE
123 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"
124 "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"
125 "vertex: -10, -8, -6, -4, -2, 0, 2, 4, 6, 8, 10\n"
126 ;
127
128 // combine customBinning with defaultBinningStr -> use customBinning where available and otherwise defaultBinningStr
129 TString customBinning(binning);
130 TString binningStr;
131
132 TObjArray* lines = defaultBinningStr.Tokenize("\n");
133 for (Int_t i=0; i<lines->GetEntriesFast(); i++)
134 {
135 TString line(lines->At(i)->GetName());
136 TString tag = line(0, line.Index(":")+1);
137 if (!customBinning.Contains(tag))
138 binningStr += line + "\n";
139 else
140 Printf("Using custom binning for %s", tag.Data());
141 }
142 delete lines;
143 binningStr += customBinning;
144
bf58cbde 145 if (histogramsStr.Contains("1"))
3f3f12d9 146 fNumberDensitypT = new AliUEHist("NumberDensitypT", binningStr);
bf58cbde 147 if (histogramsStr.Contains("2"))
3f3f12d9 148 fSumpT = new AliUEHist("SumpT", binningStr);
a75aacd6 149
bf58cbde 150 if (histogramsStr.Contains("3"))
3f3f12d9 151 fNumberDensityPhi = new AliUEHist("NumberDensityPhi", binningStr);
0ffdaf17 152 else if (histogramsStr.Contains("4"))
3f3f12d9 153 fNumberDensityPhi = new AliUEHist("NumberDensityPhiCentrality", binningStr);
154 else if (histogramsStr.Contains("5") || histogramsStr.Contains("6"))
155 fNumberDensityPhi = new AliUEHist("NumberDensityPhiCentralityVtx", binningStr);
a75aacd6 156
157 // do not add this hists to the directory
158 Bool_t oldStatus = TH1::AddDirectoryStatus();
159 TH1::AddDirectory(kFALSE);
160
f0a25b1d 161 if (!histogramsStr.Contains("4") && !histogramsStr.Contains("5") && !histogramsStr.Contains("6"))
c7245604 162 {
163 fCorrelationpT = new TH2F("fCorrelationpT", ";p_{T,lead} (MC);p_{T,lead} (RECO)", 200, 0, 50, 200, 0, 50);
2a910c25 164 fCorrelationEta = new TH2F("fCorrelationEta", ";#eta_{lead} (MC);#eta_{T,lead} (RECO)", 200, -1, 1, 200, -1, 1);
a4a4d54e 165 fCorrelationPhi = new TH2F("fCorrelationPhi", ";#varphi_{lead} (MC);#varphi_{T,lead} (RECO)", 200, 0, TMath::TwoPi(), 200, 0, TMath::TwoPi());
c7245604 166 }
167 else
168 {
2a910c25 169 fCorrelationpT = new TH2F("fCorrelationpT", ";Centrality;p_{T} (RECO)", 100, 0, 100.001, 200, 0, 50);
9da2f080 170 fCorrelationEta = new TH2F("fCorrelationEta", ";Centrality;#eta (RECO)", 100, 0, 100.001, 200, -5, 5);
a4a4d54e 171 fCorrelationPhi = new TH2F("fCorrelationPhi", ";Centrality;#varphi (RECO)", 100, 0, 100.001, 200, 0, TMath::TwoPi());
c7245604 172 }
173
a75aacd6 174 fCorrelationR = new TH2F("fCorrelationR", ";R;p_{T,lead} (MC)", 200, 0, 2, 200, 0, 50);
a4a4d54e 175 fCorrelationLeading2Phi = new TH2F("fCorrelationLeading2Phi", ";#Delta #varphi;p_{T,lead} (MC)", 200, -TMath::Pi(), TMath::Pi(), 200, 0, 50);
a75aacd6 176 fCorrelationMultiplicity = new TH2F("fCorrelationMultiplicity", ";MC tracks;Reco tracks", 100, -0.5, 99.5, 100, -0.5, 99.5);
a5d12d24 177 fYields = new TH3F("fYields", ";centrality;pT;eta", 100, 0, 100, 40, 0, 20, 100, -1, 1);
5e053cad 178
f0a25b1d 179 if (!histogramsStr.Contains("4") && !histogramsStr.Contains("5") && !histogramsStr.Contains("6"))
2a910c25 180 {
181 fEventCount = new TH2F("fEventCount", ";step;event type;count", AliUEHist::fgkCFSteps+2, -2.5, -0.5 + AliUEHist::fgkCFSteps, 3, -0.5, 2.5);
182 fEventCount->GetYaxis()->SetBinLabel(1, "ND");
183 fEventCount->GetYaxis()->SetBinLabel(2, "SD");
184 fEventCount->GetYaxis()->SetBinLabel(3, "DD");
185 }
186 else
187 {
188 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());
189 }
a75aacd6 190
191 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);
192 fEventCountDifferential->GetZaxis()->SetBinLabel(1, "ND");
193 fEventCountDifferential->GetZaxis()->SetBinLabel(2, "SD");
194 fEventCountDifferential->GetZaxis()->SetBinLabel(3, "DD");
195
196 fVertexContributors = new TH1F("fVertexContributors", ";contributors;count", 100, -0.5, 99.5);
197
664d6288 198 if (fNumberDensityPhi)
447d47d8 199 {
200 fCentralityDistribution = new TH1F("fCentralityDistribution", ";centrality;count", fNumberDensityPhi->GetEventHist()->GetNBins(1), fNumberDensityPhi->GetEventHist()->GetAxis(1, 0)->GetXbins()->GetArray());
5e053cad 201 fCentralityCorrelation = new TH2F("fCentralityCorrelation", ";centrality;multiplicity", 101, 0, 101, 200, 0, 4000);
447d47d8 202 }
bf58cbde 203
2a910c25 204 fITSClusterMap = new TH3F("fITSClusterMap", "; its cluster map; centrality; pT", 256, -0.5, 255.5, 20, 0, 100.001, 100, 0, 20);
205
f613255f 206 fControlConvResoncances = new TH2F("fControlConvResoncances", ";id;delta mass", 3, -0.5, 2.5, 100, -0.1, 0.1);
207
a75aacd6 208 TH1::AddDirectory(oldStatus);
209}
210
d1c75d06 211//_____________________________________________________________________________
212AliUEHistograms::AliUEHistograms(const AliUEHistograms &c) :
e0331fd9 213 TNamed(fName, fTitle),
d1c75d06 214 fNumberDensitypT(0),
215 fSumpT(0),
216 fNumberDensityPhi(0),
217 fCorrelationpT(0),
218 fCorrelationEta(0),
219 fCorrelationPhi(0),
220 fCorrelationR(0),
221 fCorrelationLeading2Phi(0),
222 fCorrelationMultiplicity(0),
5e053cad 223 fYields(0),
d1c75d06 224 fEventCount(0),
225 fEventCountDifferential(0),
bf58cbde 226 fVertexContributors(0),
c7245604 227 fCentralityDistribution(0),
447d47d8 228 fCentralityCorrelation(0),
2a910c25 229 fITSClusterMap(0),
f613255f 230 fControlConvResoncances(0),
418b56c5 231 fEfficiencyCorrectionTriggers(0),
232 fEfficiencyCorrectionAssociated(0),
85bfac17 233 fSelectCharge(0),
7a77d480 234 fTriggerSelectCharge(0),
15b0fdd0 235 fAssociatedSelectCharge(0),
d38fa455 236 fTriggerRestrictEta(-1),
00b6f3c6 237 fEtaOrdering(kFALSE),
b0d56b29 238 fCutConversions(kFALSE),
239 fCutResonances(kFALSE),
9da2f080 240 fOnlyOneEtaSide(0),
8a368fc2 241 fWeightPerEvent(kFALSE),
e5df0f3a 242 fRunNumber(0),
243 fMergeCount(1)
d1c75d06 244{
245 //
246 // AliUEHistograms copy constructor
247 //
248
670e1d49 249 fTwoTrackDistancePt[0] = 0;
250 fTwoTrackDistancePt[1] = 0;
1bba939a 251
d1c75d06 252 ((AliUEHistograms &) c).Copy(*this);
253}
254
a75aacd6 255//____________________________________________________________________
256AliUEHistograms::~AliUEHistograms()
257{
258 // Destructor
259
b0d56b29 260 DeleteContainers();
261}
262
263void AliUEHistograms::DeleteContainers()
264{
a75aacd6 265 if (fNumberDensitypT)
266 {
267 delete fNumberDensitypT;
268 fNumberDensitypT = 0;
269 }
270
271 if (fSumpT)
272 {
273 delete fSumpT;
274 fSumpT = 0;
275 }
276
277 if (fNumberDensityPhi)
278 {
279 delete fNumberDensityPhi;
280 fNumberDensityPhi = 0;
281 }
282
283 if (fCorrelationpT)
284 {
285 delete fCorrelationpT;
286 fCorrelationpT = 0;
287 }
288
289 if (fCorrelationEta)
290 {
291 delete fCorrelationEta;
292 fCorrelationEta = 0;
293 }
294
295 if (fCorrelationPhi)
296 {
297 delete fCorrelationPhi;
298 fCorrelationPhi = 0;
299 }
300
301 if (fCorrelationR)
302 {
303 delete fCorrelationR;
304 fCorrelationR = 0;
305 }
306
307 if (fCorrelationLeading2Phi)
308 {
309 delete fCorrelationLeading2Phi;
310 fCorrelationLeading2Phi = 0;
311 }
312
313 if (fCorrelationMultiplicity)
314 {
315 delete fCorrelationMultiplicity;
316 fCorrelationMultiplicity = 0;
317 }
318
5e053cad 319 if (fYields)
320 {
321 delete fYields;
322 fYields = 0;
323 }
324
a75aacd6 325 if (fEventCount)
326 {
327 delete fEventCount;
328 fEventCount = 0;
329 }
330
331 if (fEventCountDifferential)
332 {
333 delete fEventCountDifferential;
334 fEventCountDifferential = 0;
335 }
336
337 if (fVertexContributors)
338 {
339 delete fVertexContributors;
340 fVertexContributors = 0;
341 }
bf58cbde 342
343 if (fCentralityDistribution)
344 {
345 delete fCentralityDistribution;
346 fCentralityDistribution = 0;
347 }
2a910c25 348
447d47d8 349 if (fCentralityCorrelation)
350 {
351 delete fCentralityCorrelation;
352 fCentralityCorrelation = 0;
353 }
354
2a910c25 355 if (fITSClusterMap)
356 {
357 delete fITSClusterMap;
358 fITSClusterMap = 0;
359 }
13a404ed 360
1bba939a 361 for (Int_t i=0; i<2; i++)
670e1d49 362 if (fTwoTrackDistancePt[i])
1bba939a 363 {
670e1d49 364 delete fTwoTrackDistancePt[i];
365 fTwoTrackDistancePt[i] = 0;
1bba939a 366 }
13a404ed 367
f613255f 368 if (fControlConvResoncances)
369 {
370 delete fControlConvResoncances;
371 fControlConvResoncances = 0;
372 }
373
418b56c5 374 if (fEfficiencyCorrectionTriggers)
13a404ed 375 {
418b56c5 376 delete fEfficiencyCorrectionTriggers;
377 fEfficiencyCorrectionTriggers = 0;
378 }
379
380 if (fEfficiencyCorrectionAssociated)
381 {
382 delete fEfficiencyCorrectionAssociated;
383 fEfficiencyCorrectionAssociated = 0;
13a404ed 384 }
a75aacd6 385}
386
ada1a03f 387AliUEHist* AliUEHistograms::GetUEHist(Int_t id)
388{
389 // returns AliUEHist object, useful for loops
390
391 switch (id)
392 {
393 case 0: return fNumberDensitypT; break;
394 case 1: return fSumpT; break;
395 case 2: return fNumberDensityPhi; break;
396 }
397
398 return 0;
399}
400
a75aacd6 401//____________________________________________________________________
402Int_t AliUEHistograms::CountParticles(TList* list, Float_t ptMin)
403{
404 // counts the number of particles in the list with a pT above ptMin
405 // TODO eta cut needed here?
406
407 Int_t count = 0;
408 for (Int_t j=0; j<list->GetEntries(); j++)
409 if (((AliVParticle*) list->At(j))->Pt() > ptMin)
410 count++;
411
412 return count;
413}
414
415//____________________________________________________________________
85bfac17 416void AliUEHistograms::Fill(Int_t eventType, Float_t zVtx, AliUEHist::CFStep step, AliVParticle* leading, TList* toward, TList* away, TList* min, TList* max)
a75aacd6 417{
418 // fills the UE event histograms
419 //
420 // 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
421
422 // if leading is not set, just fill event statistics
423 if (leading)
424 {
425 Int_t multiplicity = 0;
426
427 // TODO configurable?
428 Float_t ptMin = 0.15;
429 if (leading->Pt() > ptMin)
430 multiplicity++;
431
432 multiplicity += CountParticles(toward, ptMin);
433 multiplicity += CountParticles(away, ptMin);
434 multiplicity += CountParticles(min, ptMin);
435 multiplicity += CountParticles(max, ptMin);
436
85bfac17 437 FillRegion(AliUEHist::kToward, zVtx, step, leading, toward, multiplicity);
438 FillRegion(AliUEHist::kAway, zVtx, step, leading, away, multiplicity);
439 FillRegion(AliUEHist::kMin, zVtx, step, leading, min, multiplicity);
440 FillRegion(AliUEHist::kMax, zVtx, step, leading, max, multiplicity);
b1831bcb 441
85bfac17 442 Double_t vars[3];
a75aacd6 443 vars[0] = leading->Pt();
444 vars[1] = multiplicity;
85bfac17 445 vars[2] = zVtx;
bf58cbde 446 for (Int_t i=0; i<fgkUEHists; i++)
447 if (GetUEHist(i))
448 GetUEHist(i)->GetEventHist()->Fill(vars, step);
a75aacd6 449
450 fEventCountDifferential->Fill(leading->Pt(), step, eventType);
451 }
452
453 FillEvent(eventType, step);
454}
455
456//____________________________________________________________________
85bfac17 457void AliUEHistograms::FillRegion(AliUEHist::Region region, Float_t zVtx, AliUEHist::CFStep step, AliVParticle* leading, TList* list, Int_t multiplicity)
a75aacd6 458{
459 // loops over AliVParticles in list and fills the given region at the given step
460 //
461 // See also Fill(...)
462
463 for (Int_t i=0; i<list->GetEntries(); i++)
464 {
465 AliVParticle* particle = (AliVParticle*) list->At(i);
466
85bfac17 467 Double_t vars[6];
a75aacd6 468 vars[0] = particle->Eta();
469 vars[1] = particle->Pt();
470 vars[2] = leading->Pt();
471 vars[3] = multiplicity;
472 vars[4] = leading->Phi() - particle->Phi();
2ac8dc5c 473 if (vars[4] > 1.5 * TMath::Pi())
474 vars[4] -= TMath::TwoPi();
475 if (vars[4] < -0.5 * TMath::Pi())
476 vars[4] += TMath::TwoPi();
85bfac17 477 vars[5] = zVtx;
478
bf58cbde 479 if (fNumberDensitypT)
480 fNumberDensitypT->GetTrackHist(region)->Fill(vars, step);
481
482 if (fSumpT)
483 fSumpT->GetTrackHist(region)->Fill(vars, step, particle->Pt());
a75aacd6 484
485 // fill all in toward region (is anyway as function of delta phi!)
bf58cbde 486 if (fNumberDensityPhi)
487 fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->Fill(vars, step);
a75aacd6 488 }
489}
490
491//____________________________________________________________________
492void AliUEHistograms::Fill(AliVParticle* leadingMC, AliVParticle* leadingReco)
493{
494 // fills the correlation histograms
495
496 if (leadingMC)
497 {
498 fCorrelationpT->Fill(leadingMC->Pt(), leadingReco->Pt());
499 if (leadingMC->Pt() > 0.5)
500 {
501 fCorrelationEta->Fill(leadingMC->Eta(), leadingReco->Eta());
502 fCorrelationPhi->Fill(leadingMC->Phi(), leadingReco->Phi());
503 }
504
505 Float_t phiDiff = leadingMC->Phi() - leadingReco->Phi();
506 if (phiDiff > TMath::Pi())
507 phiDiff -= TMath::TwoPi();
508 if (phiDiff < -TMath::Pi())
509 phiDiff += TMath::TwoPi();
510
511 Float_t etaDiff = leadingMC->Eta() - leadingReco->Eta();
512
513 fCorrelationR->Fill(TMath::Sqrt(phiDiff * phiDiff + etaDiff * etaDiff), leadingMC->Pt());
514 fCorrelationLeading2Phi->Fill(phiDiff, leadingMC->Pt());
515 }
516 else
517 {
518 fCorrelationpT->Fill(1.0, leadingReco->Pt());
519 if (leadingReco->Pt() > 0.5)
520 {
521 fCorrelationEta->Fill(0.0, leadingReco->Eta());
522 fCorrelationPhi->Fill(0.0, leadingReco->Phi());
523 }
524 }
525}
bf58cbde 526
527//____________________________________________________________________
408d1ac9 528void 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 529{
530 // fills the fNumberDensityPhi histogram
531 //
532 // this function need a list of AliVParticles which contain the particles/tracks to be filled
e0331fd9 533 //
534 // if mixed is non-0, mixed events are filled, the trigger particle is from particles, the associated from mixed
c05ff6be 535 // if weight < 0, then the pt of the associated particle is filled as weight
536
537 Bool_t fillpT = kFALSE;
538 if (weight < 0)
539 fillpT = kTRUE;
bf58cbde 540
7fd35fdd 541 if (twoTrackEfficiencyCut && !fTwoTrackDistancePt[0])
542 {
5e053cad 543 // do not add this hists to the directory
544 Bool_t oldStatus = TH1::AddDirectoryStatus();
545 TH1::AddDirectory(kFALSE);
546
edd964a8 547 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 548 fTwoTrackDistancePt[1] = (TH3F*) fTwoTrackDistancePt[0]->Clone("fTwoTrackDistancePt[1]");
5e053cad 549
550 TH1::AddDirectory(oldStatus);
7fd35fdd 551 }
552
eed401dc 553 // Eta() is extremely time consuming, therefore cache it for the inner loop here:
554 TObjArray* input = (mixed) ? mixed : particles;
555 TArrayF eta(input->GetEntriesFast());
556 for (Int_t i=0; i<input->GetEntriesFast(); i++)
557 eta[i] = ((AliVParticle*) input->At(i))->Eta();
558
bf58cbde 559 // if particles is not set, just fill event statistics
560 if (particles)
561 {
eed401dc 562 Int_t jMax = particles->GetEntriesFast();
563 if (mixed)
564 jMax = mixed->GetEntriesFast();
565
8a368fc2 566 TH1* triggerWeighting = 0;
567 if (fWeightPerEvent)
568 {
569 TAxis* axis = fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->GetGrid(0)->GetGrid()->GetAxis(2);
570 triggerWeighting = new TH1F("triggerWeighting", "", axis->GetNbins(), axis->GetXbins()->GetArray());
571
572 for (Int_t i=0; i<particles->GetEntriesFast(); i++)
573 {
574 AliVParticle* triggerParticle = (AliVParticle*) particles->At(i);
575
576 // some optimization
577 Float_t triggerEta = triggerParticle->Eta();
578
579 if (fTriggerRestrictEta > 0 && TMath::Abs(triggerEta) > fTriggerRestrictEta)
580 continue;
581
582 if (fOnlyOneEtaSide != 0)
583 {
584 if (fOnlyOneEtaSide * triggerEta < 0)
585 continue;
586 }
587
588 if (fTriggerSelectCharge != 0)
589 if (triggerParticle->Charge() * fTriggerSelectCharge < 0)
590 continue;
591
592 triggerWeighting->Fill(triggerParticle->Pt());
593 }
594// new TCanvas; triggerWeighting->Draw();
595 }
596
eed401dc 597 for (Int_t i=0; i<particles->GetEntriesFast(); i++)
bf58cbde 598 {
599 AliVParticle* triggerParticle = (AliVParticle*) particles->At(i);
eed401dc 600
601 // some optimization
602 Float_t triggerEta = triggerParticle->Eta();
9da2f080 603
604 if (fTriggerRestrictEta > 0 && TMath::Abs(triggerEta) > fTriggerRestrictEta)
605 continue;
606
607 if (fOnlyOneEtaSide != 0)
608 {
609 if (fOnlyOneEtaSide * triggerEta < 0)
610 continue;
611 }
7a77d480 612
613 if (fTriggerSelectCharge != 0)
614 if (triggerParticle->Charge() * fTriggerSelectCharge < 0)
615 continue;
15b0fdd0 616
e0331fd9 617 for (Int_t j=0; j<jMax; j++)
bf58cbde 618 {
e0331fd9 619 if (!mixed && i == j)
bf58cbde 620 continue;
621
e0331fd9 622 AliVParticle* particle = 0;
623 if (!mixed)
624 particle = (AliVParticle*) particles->At(j);
625 else
626 particle = (AliVParticle*) mixed->At(j);
bf58cbde 627
2a910c25 628 // check if both particles point to the same element (does not occur for mixed events, but if subsets are mixed within the same event for cross-checks)
629 if (mixed && triggerParticle == particle)
630 continue;
631
c7245604 632 if (particle->Pt() > triggerParticle->Pt())
633 continue;
634
15b0fdd0 635 if (fAssociatedSelectCharge != 0)
636 if (particle->Charge() * fAssociatedSelectCharge < 0)
637 continue;
638
c7245604 639 if (fSelectCharge > 0)
640 {
641 // skip like sign
642 if (fSelectCharge == 1 && particle->Charge() * triggerParticle->Charge() > 0)
643 continue;
644
645 // skip unlike sign
646 if (fSelectCharge == 2 && particle->Charge() * triggerParticle->Charge() < 0)
647 continue;
648 }
649
00b6f3c6 650 if (fEtaOrdering)
651 {
652 if (triggerEta < 0 && eta[j] < triggerEta)
653 continue;
654 if (triggerEta > 0 && eta[j] > triggerEta)
655 continue;
656 }
657
b0d56b29 658 // conversions
659 if (fCutConversions && particle->Charge() * triggerParticle->Charge() < 0)
660 {
f613255f 661 Float_t mass = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.510e-3, 0.510e-3);
662
663 fControlConvResoncances->Fill(0.0, mass);
b0d56b29 664
665 if (mass < 0.04*0.04)
666 continue;
667 }
668
f613255f 669 // K0s
b0d56b29 670 if (fCutResonances && particle->Charge() * triggerParticle->Charge() < 0)
671 {
f613255f 672 Float_t mass = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.1396, 0.1396);
673
674 const Float_t kK0smass = 0.4976;
b0d56b29 675
f613255f 676 fControlConvResoncances->Fill(1, mass - kK0smass*kK0smass);
677
678 if (mass > (kK0smass-0.02)*(kK0smass-0.02) && mass < (kK0smass+0.02)*(kK0smass+0.02))
b0d56b29 679 continue;
680 }
04af8d15 681
f613255f 682 // Lambda
683 if (fCutResonances && particle->Charge() * triggerParticle->Charge() < 0)
684 {
685 Float_t mass1 = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.1396, 0.9383);
686 Float_t mass2 = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.9383, 0.1396);
687
688 const Float_t kLambdaMass = 1.115;
689
690 fControlConvResoncances->Fill(2, mass1 - kLambdaMass*kLambdaMass);
691 fControlConvResoncances->Fill(2, mass2 - kLambdaMass*kLambdaMass);
692
693 if ((mass1 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass1 < (kLambdaMass+0.02)*(kLambdaMass+0.02)) ||
694 (mass2 > (kLambdaMass-0.02)*(kLambdaMass-0.02) && mass2 < (kLambdaMass+0.02)*(kLambdaMass+0.02)))
695 continue;
696 }
697
04af8d15 698 if (twoTrackEfficiencyCut)
699 {
7fd35fdd 700 // the variables & cuthave been developed by the HBT group
701 // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700
702
04af8d15 703 Float_t phi1 = triggerParticle->Phi();
704 Float_t pt1 = triggerParticle->Pt();
705 Float_t charge1 = triggerParticle->Charge();
706
707 Float_t phi2 = particle->Phi();
708 Float_t pt2 = particle->Pt();
709 Float_t charge2 = particle->Charge();
710
711 Float_t deta = triggerEta - eta[j];
712
713 // optimization
edd964a8 714 if (TMath::Abs(deta) < twoTrackEfficiencyCutValue * 2.5 * 3)
04af8d15 715 {
7fd35fdd 716 // check first boundaries to see if is worth to loop and find the minimum
717 Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSign);
718 Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign);
719
d4b3dbfc 720 const Float_t kLimit = twoTrackEfficiencyCutValue * 3;
04af8d15 721
7fd35fdd 722 Float_t dphistarminabs = 1e5;
723 Float_t dphistarmin = 1e5;
724 if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0)
04af8d15 725 {
7fd35fdd 726 for (Double_t rad=0.8; rad<2.51; rad+=0.01)
727 {
728 Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSign);
729
730 Float_t dphistarabs = TMath::Abs(dphistar);
731
732 if (dphistarabs < dphistarminabs)
733 {
734 dphistarmin = dphistar;
735 dphistarminabs = dphistarabs;
736 }
737 }
738
739 fTwoTrackDistancePt[0]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));
04af8d15 740
d4b3dbfc 741 if (dphistarminabs < twoTrackEfficiencyCutValue && TMath::Abs(deta) < twoTrackEfficiencyCutValue)
04af8d15 742 {
7fd35fdd 743// 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);
744 continue;
04af8d15 745 }
7fd35fdd 746
747 fTwoTrackDistancePt[1]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));
04af8d15 748 }
04af8d15 749 }
750 }
b0d56b29 751
85bfac17 752 Double_t vars[6];
eed401dc 753 vars[0] = triggerEta - eta[j];
bf58cbde 754 vars[1] = particle->Pt();
755 vars[2] = triggerParticle->Pt();
756 vars[3] = centrality;
757 vars[4] = triggerParticle->Phi() - particle->Phi();
758 if (vars[4] > 1.5 * TMath::Pi())
759 vars[4] -= TMath::TwoPi();
760 if (vars[4] < -0.5 * TMath::Pi())
761 vars[4] += TMath::TwoPi();
85bfac17 762 vars[5] = zVtx;
c05ff6be 763
764 if (fillpT)
765 weight = particle->Pt();
13a404ed 766
767 Double_t useWeight = weight;
418b56c5 768 if (applyEfficiency)
408d1ac9 769 {
418b56c5 770 if (fEfficiencyCorrectionAssociated)
771 {
772 Int_t effVars[4];
773 // associated particle
774 effVars[0] = fEfficiencyCorrectionAssociated->GetAxis(0)->FindBin(eta[j]);
775 effVars[1] = fEfficiencyCorrectionAssociated->GetAxis(1)->FindBin(vars[1]); //pt
776 effVars[2] = fEfficiencyCorrectionAssociated->GetAxis(2)->FindBin(vars[3]); //centrality
777 effVars[3] = fEfficiencyCorrectionAssociated->GetAxis(3)->FindBin(vars[5]); //zVtx
778
779 // Printf("%d %d %d %d %f", effVars[0], effVars[1], effVars[2], effVars[3], fEfficiencyCorrectionAssociated->GetBinContent(effVars));
defad170 780
418b56c5 781 useWeight *= fEfficiencyCorrectionAssociated->GetBinContent(effVars);
782 }
783 if (fEfficiencyCorrectionTriggers)
d787bf34 784 {
418b56c5 785 Int_t effVars[4];
786
787 effVars[0] = fEfficiencyCorrectionTriggers->GetAxis(0)->FindBin(triggerEta);
788 effVars[1] = fEfficiencyCorrectionTriggers->GetAxis(1)->FindBin(vars[2]); //pt
789 effVars[2] = fEfficiencyCorrectionTriggers->GetAxis(2)->FindBin(vars[3]); //centrality
790 effVars[3] = fEfficiencyCorrectionTriggers->GetAxis(3)->FindBin(vars[5]); //zVtx
791 useWeight *= fEfficiencyCorrectionTriggers->GetBinContent(effVars);
d787bf34 792 }
408d1ac9 793 }
418b56c5 794
8a368fc2 795 if (fWeightPerEvent)
796 {
797 Int_t weightBin = triggerWeighting->GetXaxis()->FindBin(vars[2]);
798// Printf("Using weight %f", triggerWeighting->GetBinContent(weightBin));
799 useWeight /= triggerWeighting->GetBinContent(weightBin);
800 }
bf58cbde 801
c7245604 802 // fill all in toward region and do not use the other regions
418b56c5 803 fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->Fill(vars, step, useWeight);
804
d38fa455 805// Printf("%.2f %.2f --> %.2f", triggerEta, eta[j], vars[0]);
c7245604 806 }
bf58cbde 807
c7245604 808 if (firstTime)
809 {
810 // once per trigger particle
85bfac17 811 Double_t vars[3];
c7245604 812 vars[0] = triggerParticle->Pt();
813 vars[1] = centrality;
85bfac17 814 vars[2] = zVtx;
defad170 815
816 Double_t useWeight = 1;
418b56c5 817 if (fEfficiencyCorrectionTriggers && applyEfficiency)
defad170 818 {
819 Int_t effVars[4];
820
821 // trigger particle
418b56c5 822 effVars[0] = fEfficiencyCorrectionTriggers->GetAxis(0)->FindBin(triggerEta);
823 effVars[1] = fEfficiencyCorrectionTriggers->GetAxis(1)->FindBin(vars[0]); //pt
824 effVars[2] = fEfficiencyCorrectionTriggers->GetAxis(2)->FindBin(vars[1]); //centrality
825 effVars[3] = fEfficiencyCorrectionTriggers->GetAxis(3)->FindBin(vars[2]); //zVtx
826 useWeight *= fEfficiencyCorrectionTriggers->GetBinContent(effVars);
defad170 827 }
20b7a005 828 if (fWeightPerEvent)
829 {
830 // leads effectively to a filling of one entry per filled trigger particle pT bin
831 Int_t weightBin = triggerWeighting->GetXaxis()->FindBin(vars[0]);
832// Printf("Using weight %f", triggerWeighting->GetBinContent(weightBin));
833 useWeight /= triggerWeighting->GetBinContent(weightBin);
834 }
defad170 835
836 fNumberDensityPhi->GetEventHist()->Fill(vars, step, useWeight);
3f3f12d9 837
838 // QA
839 fCorrelationpT->Fill(centrality, triggerParticle->Pt());
840 fCorrelationEta->Fill(centrality, triggerEta);
841 fCorrelationPhi->Fill(centrality, triggerParticle->Phi());
842 fYields->Fill(centrality, triggerParticle->Pt(), triggerEta);
843
844/* if (dynamic_cast<AliAODTrack*>(triggerParticle))
845 fITSClusterMap->Fill(((AliAODTrack*) triggerParticle)->GetITSClusterMap(), centrality, triggerParticle->Pt());*/
c7245604 846 }
bf58cbde 847 }
8a368fc2 848
849 if (triggerWeighting)
850 {
851 delete triggerWeighting;
852 triggerWeighting = 0;
853 }
bf58cbde 854 }
855
856 fCentralityDistribution->Fill(centrality);
447d47d8 857 fCentralityCorrelation->Fill(centrality, particles->GetEntriesFast());
2a910c25 858 FillEvent(centrality, step);
bf58cbde 859}
a75aacd6 860
b1831bcb 861//____________________________________________________________________
408d1ac9 862void AliUEHistograms::FillTrackingEfficiency(TObjArray* mc, TObjArray* recoPrim, TObjArray* recoAll, TObjArray* fake, Int_t particleType, Double_t centrality, Double_t zVtx)
b1831bcb 863{
864 // fills the tracking efficiency objects
865 //
866 // mc: all primary MC particles
867 // recoPrim: reconstructed primaries (again MC particles)
868 // recoAll: reconstructed (again MC particles)
869 // particleType is: 0 for pion, 1 for kaon, 2 for proton, 3 for others
b591fb9c 870
871 for (Int_t step=0; step<4; step++)
b1831bcb 872 {
873 TObjArray* list = mc;
874 if (step == 1)
875 list = recoPrim;
876 else if (step == 2)
877 list = recoAll;
b591fb9c 878 else if (step == 3)
879 list = fake;
880
881 if (!list)
882 continue;
883
eed401dc 884 for (Int_t i=0; i<list->GetEntriesFast(); i++)
b1831bcb 885 {
886 AliVParticle* particle = (AliVParticle*) list->At(i);
408d1ac9 887 Double_t vars[5];
b1831bcb 888 vars[0] = particle->Eta();
889 vars[1] = particle->Pt();
890 vars[2] = particleType;
c7245604 891 vars[3] = centrality;
408d1ac9 892 vars[4] = zVtx;
b1831bcb 893
bf58cbde 894 for (Int_t j=0; j<fgkUEHists; j++)
895 if (GetUEHist(j))
896 GetUEHist(j)->GetTrackHistEfficiency()->Fill(vars, step);
b1831bcb 897 }
898 }
899}
900
b591fb9c 901//____________________________________________________________________
902void AliUEHistograms::FillFakePt(TObjArray* fake, Double_t centrality)
903{
904 TObjArray* tracksReco = (TObjArray*) fake->At(0);
905 TObjArray* tracksMC = (TObjArray*) fake->At(1);
906
b752706a 907 if (tracksReco->GetEntriesFast() != tracksMC->GetEntriesFast())
908 AliFatal(Form("Inconsistent arrays: %d vs %d", tracksReco->GetEntriesFast(), tracksMC->GetEntriesFast()));
909
b591fb9c 910 for (Int_t i=0; i<tracksReco->GetEntriesFast(); i++)
911 {
912 AliVParticle* particle1 = (AliVParticle*) tracksReco->At(i);
913 AliVParticle* particle2 = (AliVParticle*) tracksMC->At(i);
914 Double_t vars[3];
915 vars[0] = particle1->Pt();
916 vars[1] = particle2->Pt();
917 vars[2] = centrality;
918 for (Int_t j=0; j<fgkUEHists; j++)
919 if (GetUEHist(j))
920 GetUEHist(j)->GetMCRecoPtCorrelation()->Fill(vars[0],vars[1],vars[2]);
921 }
922}
923
a75aacd6 924//____________________________________________________________________
925void AliUEHistograms::FillEvent(Int_t eventType, Int_t step)
926{
927 // fills the number of events at the given step and the given enty type
928 //
929 // WARNING: This function is called from Fill, so only call it for steps where Fill is not called
930
931 fEventCount->Fill(step, eventType);
932}
933
2a910c25 934//____________________________________________________________________
935void AliUEHistograms::FillEvent(Double_t centrality, Int_t step)
936{
937 // fills the number of events at the given step and the given centrality
938 //
939 // WARNING: This function is called from Fill, so only call it for steps where Fill is not called
940
941 fEventCount->Fill(step, centrality);
942}
943
a75aacd6 944//____________________________________________________________________
945void AliUEHistograms::SetEtaRange(Float_t etaMin, Float_t etaMax)
946{
947 // sets eta min and max for all contained AliUEHist classes
948
bf58cbde 949 for (Int_t i=0; i<fgkUEHists; i++)
950 if (GetUEHist(i))
951 GetUEHist(i)->SetEtaRange(etaMin, etaMax);
a75aacd6 952}
953
954//____________________________________________________________________
955void AliUEHistograms::SetPtRange(Float_t ptMin, Float_t ptMax)
956{
957 // sets pT min and max for all contained AliUEHist classes
958
bf58cbde 959 for (Int_t i=0; i<fgkUEHists; i++)
960 if (GetUEHist(i))
961 GetUEHist(i)->SetPtRange(ptMin, ptMax);
a75aacd6 962}
963
c824c30e 964//____________________________________________________________________
965void AliUEHistograms::SetPartSpecies(Int_t species)
966{
967 // sets PartSpecie for all contained AliUEHist classes
968
969 for (Int_t i=0; i<fgkUEHists; i++)
970 if (GetUEHist(i))
971 GetUEHist(i)->SetPartSpecies(species);
972}
973
85bfac17 974//____________________________________________________________________
975void AliUEHistograms::SetZVtxRange(Float_t min, Float_t max)
976{
977 // sets pT min and max for all contained AliUEHist classes
978
979 for (Int_t i=0; i<fgkUEHists; i++)
980 if (GetUEHist(i))
981 GetUEHist(i)->SetZVtxRange(min, max);
982}
983
144bd037 984//____________________________________________________________________
985void AliUEHistograms::SetContaminationEnhancement(TH1F* hist)
986{
987 // sets the contamination enhancement histogram in all contained AliUEHist classes
988
bf58cbde 989 for (Int_t i=0; i<fgkUEHists; i++)
990 if (GetUEHist(i))
991 GetUEHist(i)->SetContaminationEnhancement(hist);
144bd037 992}
993
a75aacd6 994//____________________________________________________________________
995void AliUEHistograms::SetCombineMinMax(Bool_t flag)
996{
997 // sets pT min and max for all contained AliUEHist classes
998
bf58cbde 999 for (Int_t i=0; i<fgkUEHists; i++)
1000 if (GetUEHist(i))
1001 GetUEHist(i)->SetCombineMinMax(flag);
a75aacd6 1002}
1003
defad170 1004//____________________________________________________________________
1005void AliUEHistograms::SetTrackEtaCut(Float_t value)
1006{
1007 // sets track eta cut for all contained AliUEHist classes
1008
1009 for (Int_t i=0; i<fgkUEHists; i++)
1010 if (GetUEHist(i))
1011 GetUEHist(i)->SetTrackEtaCut(value);
1012}
1013
20b7a005 1014//____________________________________________________________________
1015void AliUEHistograms::SetWeightPerEvent(Bool_t flag)
1016{
1017 // sets fWeightPerEvent for all contained AliUEHist classes
1018
1019 fWeightPerEvent = flag;
1020
1021 for (Int_t i=0; i<fgkUEHists; i++)
1022 if (GetUEHist(i))
1023 GetUEHist(i)->SetWeightPerEvent(fWeightPerEvent);
1024}
1025
a75aacd6 1026//____________________________________________________________________
1027void AliUEHistograms::Correct(AliUEHistograms* corrections)
1028{
1029 // corrects the contained histograms by calling AliUEHist::Correct
1030
bf58cbde 1031 for (Int_t i=0; i<fgkUEHists; i++)
1032 if (GetUEHist(i))
1033 GetUEHist(i)->Correct(corrections->GetUEHist(i));
a75aacd6 1034}
1035
1036//____________________________________________________________________
1037AliUEHistograms &AliUEHistograms::operator=(const AliUEHistograms &c)
1038{
1039 // assigment operator
1040
b0d56b29 1041 DeleteContainers();
1042
a75aacd6 1043 if (this != &c)
1044 ((AliUEHistograms &) c).Copy(*this);
1045
1046 return *this;
1047}
1048
1049//____________________________________________________________________
1050void AliUEHistograms::Copy(TObject& c) const
1051{
1052 // copy function
1053
1054 AliUEHistograms& target = (AliUEHistograms &) c;
1055
1056 if (fNumberDensitypT)
1057 target.fNumberDensitypT = dynamic_cast<AliUEHist*> (fNumberDensitypT->Clone());
1058
1059 if (fSumpT)
1060 target.fSumpT = dynamic_cast<AliUEHist*> (fSumpT->Clone());
1061
1062 if (fNumberDensityPhi)
1063 target.fNumberDensityPhi = dynamic_cast<AliUEHist*> (fNumberDensityPhi->Clone());
1064
1065 if (fCorrelationpT)
1066 target.fCorrelationpT = dynamic_cast<TH2F*> (fCorrelationpT->Clone());
1067
1068 if (fCorrelationEta)
1069 target.fCorrelationEta = dynamic_cast<TH2F*> (fCorrelationEta->Clone());
1070
1071 if (fCorrelationPhi)
1072 target.fCorrelationPhi = dynamic_cast<TH2F*> (fCorrelationPhi->Clone());
1073
1074 if (fCorrelationR)
1075 target.fCorrelationR = dynamic_cast<TH2F*> (fCorrelationR->Clone());
1076
1077 if (fCorrelationLeading2Phi)
1078 target.fCorrelationLeading2Phi = dynamic_cast<TH2F*> (fCorrelationLeading2Phi->Clone());
1079
1080 if (fCorrelationMultiplicity)
1081 target.fCorrelationMultiplicity = dynamic_cast<TH2F*> (fCorrelationMultiplicity->Clone());
1082
5e053cad 1083 if (fYields)
1084 target.fYields = dynamic_cast<TH3F*> (fYields->Clone());
1085
a75aacd6 1086 if (fEventCount)
1087 target.fEventCount = dynamic_cast<TH2F*> (fEventCount->Clone());
1088
1089 if (fEventCountDifferential)
1090 target.fEventCountDifferential = dynamic_cast<TH3F*> (fEventCountDifferential->Clone());
1091
1092 if (fVertexContributors)
1093 target.fVertexContributors = dynamic_cast<TH1F*> (fVertexContributors->Clone());
bf58cbde 1094
1095 if (fCentralityDistribution)
1096 target.fCentralityDistribution = dynamic_cast<TH1F*> (fCentralityDistribution->Clone());
c7245604 1097
447d47d8 1098 if (fCentralityCorrelation)
1099 target.fCentralityCorrelation = dynamic_cast<TH2F*> (fCentralityCorrelation->Clone());
1100
2a910c25 1101 if (fITSClusterMap)
1102 target.fITSClusterMap = dynamic_cast<TH3F*> (fITSClusterMap->Clone());
13a404ed 1103
f613255f 1104 if (fControlConvResoncances)
1105 target.fControlConvResoncances = dynamic_cast<TH2F*> (fControlConvResoncances->Clone());
1106
1bba939a 1107 for (Int_t i=0; i<2; i++)
670e1d49 1108 if (fTwoTrackDistancePt[i])
1109 target.fTwoTrackDistancePt[i] = dynamic_cast<TH3F*> (fTwoTrackDistancePt[i]->Clone());
1bba939a 1110
418b56c5 1111 if (fEfficiencyCorrectionTriggers)
1112 target.fEfficiencyCorrectionTriggers = dynamic_cast<THnF*> (fEfficiencyCorrectionTriggers->Clone());
1113
1114 if (fEfficiencyCorrectionAssociated)
1115 target.fEfficiencyCorrectionAssociated = dynamic_cast<THnF*> (fEfficiencyCorrectionAssociated->Clone());
13a404ed 1116
c7245604 1117 target.fSelectCharge = fSelectCharge;
7a77d480 1118 target.fTriggerSelectCharge = fTriggerSelectCharge;
15b0fdd0 1119 target.fAssociatedSelectCharge = fAssociatedSelectCharge;
d38fa455 1120 target.fTriggerRestrictEta = fTriggerRestrictEta;
00b6f3c6 1121 target.fEtaOrdering = fEtaOrdering;
b0d56b29 1122 target.fCutConversions = fCutConversions;
1123 target.fCutResonances = fCutResonances;
9da2f080 1124 target.fOnlyOneEtaSide = fOnlyOneEtaSide;
8a368fc2 1125 target.fWeightPerEvent = fWeightPerEvent;
85bfac17 1126 target.fRunNumber = fRunNumber;
e5df0f3a 1127 target.fMergeCount = fMergeCount;
a75aacd6 1128}
1129
1130//____________________________________________________________________
1131Long64_t AliUEHistograms::Merge(TCollection* list)
1132{
1133 // Merge a list of AliUEHistograms objects with this (needed for
1134 // PROOF).
1135 // Returns the number of merged objects (including this).
1136
1137 if (!list)
1138 return 0;
1139
1140 if (list->IsEmpty())
1141 return 1;
1142
1143 TIterator* iter = list->MakeIterator();
1144 TObject* obj;
1145
1146 // collections of objects
f613255f 1147 const Int_t kMaxLists = 19;
a75aacd6 1148 TList* lists[kMaxLists];
1149
1150 for (Int_t i=0; i<kMaxLists; i++)
1151 lists[i] = new TList;
1152
1153 Int_t count = 0;
1154 while ((obj = iter->Next())) {
1155
1156 AliUEHistograms* entry = dynamic_cast<AliUEHistograms*> (obj);
1157 if (entry == 0)
1158 continue;
1159
bf58cbde 1160 if (entry->fNumberDensitypT)
1161 lists[0]->Add(entry->fNumberDensitypT);
1162 if (entry->fSumpT)
1163 lists[1]->Add(entry->fSumpT);
1164 if (entry->fNumberDensityPhi)
1165 lists[2]->Add(entry->fNumberDensityPhi);
a75aacd6 1166 lists[3]->Add(entry->fCorrelationpT);
1167 lists[4]->Add(entry->fCorrelationEta);
1168 lists[5]->Add(entry->fCorrelationPhi);
1169 lists[6]->Add(entry->fCorrelationR);
1170 lists[7]->Add(entry->fCorrelationLeading2Phi);
1171 lists[8]->Add(entry->fCorrelationMultiplicity);
1172 lists[9]->Add(entry->fEventCount);
1173 lists[10]->Add(entry->fEventCountDifferential);
1174 lists[11]->Add(entry->fVertexContributors);
bf58cbde 1175 lists[12]->Add(entry->fCentralityDistribution);
2a910c25 1176 lists[13]->Add(entry->fITSClusterMap);
78d64459 1177 if (entry->fTwoTrackDistancePt[0])
670e1d49 1178 lists[14]->Add(entry->fTwoTrackDistancePt[0]);
78d64459 1179 if (entry->fTwoTrackDistancePt[1])
670e1d49 1180 lists[15]->Add(entry->fTwoTrackDistancePt[1]);
78d64459 1181 if (entry->fCentralityCorrelation)
447d47d8 1182 lists[16]->Add(entry->fCentralityCorrelation);
5e053cad 1183 if (entry->fYields)
1184 lists[17]->Add(entry->fYields);
f613255f 1185 if (entry->fControlConvResoncances)
1186 lists[18]->Add(entry->fControlConvResoncances);
e5df0f3a 1187
1188 fMergeCount += entry->fMergeCount;
1189
a75aacd6 1190 count++;
1191 }
1192
bf58cbde 1193 if (fNumberDensitypT)
1194 fNumberDensitypT->Merge(lists[0]);
1195 if (fSumpT)
1196 fSumpT->Merge(lists[1]);
1197 if (fNumberDensityPhi)
1198 fNumberDensityPhi->Merge(lists[2]);
a75aacd6 1199 fCorrelationpT->Merge(lists[3]);
1200 fCorrelationEta->Merge(lists[4]);
1201 fCorrelationPhi->Merge(lists[5]);
1202 fCorrelationR->Merge(lists[6]);
1203 fCorrelationLeading2Phi->Merge(lists[7]);
1204 fCorrelationMultiplicity->Merge(lists[8]);
1205 fEventCount->Merge(lists[9]);
1206 fEventCountDifferential->Merge(lists[10]);
1207 fVertexContributors->Merge(lists[11]);
bf58cbde 1208 fCentralityDistribution->Merge(lists[12]);
2a910c25 1209 fITSClusterMap->Merge(lists[13]);
0ffdaf17 1210 if (fTwoTrackDistancePt[0] && lists[14]->GetEntries() > 0)
670e1d49 1211 fTwoTrackDistancePt[0]->Merge(lists[14]);
0ffdaf17 1212 if (fTwoTrackDistancePt[1] && lists[15]->GetEntries() > 0)
670e1d49 1213 fTwoTrackDistancePt[1]->Merge(lists[15]);
447d47d8 1214 if (fCentralityCorrelation)
1215 fCentralityCorrelation->Merge(lists[16]);
5e053cad 1216 if (fYields && lists[17]->GetEntries() > 0)
1217 fYields->Merge(lists[17]);
f613255f 1218 if (fControlConvResoncances && lists[18]->GetEntries() > 0)
1219 fControlConvResoncances->Merge(lists[18]);
a75aacd6 1220
1221 for (Int_t i=0; i<kMaxLists; i++)
1222 delete lists[i];
e5df0f3a 1223
a75aacd6 1224 return count+1;
1225}
b1831bcb 1226
1227void AliUEHistograms::CopyReconstructedData(AliUEHistograms* from)
1228{
1229 // copies those histograms extracted from ESD to this object
1230
bf58cbde 1231 for (Int_t i=0; i<fgkUEHists; i++)
1232 if (GetUEHist(i))
1233 GetUEHist(i)->CopyReconstructedData(from->GetUEHist(i));
b1831bcb 1234}
6f803f6c 1235
0ffdaf17 1236void AliUEHistograms::DeepCopy(AliUEHistograms* from)
1237{
1238 // copies the entries of this object's members from the object <from> to this object
1239
1240 for (Int_t i=0; i<fgkUEHists; i++)
1241 if (GetUEHist(i) && from->GetUEHist(i))
1242 GetUEHist(i)->DeepCopy(from->GetUEHist(i));
1243}
1244
2a910c25 1245void AliUEHistograms::ExtendTrackingEfficiency(Bool_t verbose)
6f803f6c 1246{
1247 // delegates to AliUEHists
1248
bf58cbde 1249 for (Int_t i=0; i<fgkUEHists; i++)
1250 if (GetUEHist(i))
2a910c25 1251 GetUEHist(i)->ExtendTrackingEfficiency(verbose);
6f803f6c 1252}
1253
c7245604 1254void AliUEHistograms::Scale(Double_t factor)
1255{
1256 // scales all contained histograms by the given factor
1257
1258 for (Int_t i=0; i<fgkUEHists; i++)
1259 if (GetUEHist(i))
1260 GetUEHist(i)->Scale(factor);
1261
1262 TList list;
1263 list.Add(fCorrelationpT);
1264 list.Add(fCorrelationEta);
1265 list.Add(fCorrelationPhi);
1266 list.Add(fCorrelationR);
1267 list.Add(fCorrelationLeading2Phi);
1268 list.Add(fCorrelationMultiplicity);
5e053cad 1269 list.Add(fYields);
c7245604 1270 list.Add(fEventCount);
1271 list.Add(fEventCountDifferential);
1272 list.Add(fVertexContributors);
1273 list.Add(fCentralityDistribution);
447d47d8 1274 list.Add(fCentralityCorrelation);
2a910c25 1275 list.Add(fITSClusterMap);
670e1d49 1276 list.Add(fTwoTrackDistancePt[0]);
1277 list.Add(fTwoTrackDistancePt[1]);
f613255f 1278 list.Add(fControlConvResoncances);
c7245604 1279
1280 for (Int_t i=0; i<list.GetEntries(); i++)
1281 ((TH1*) list.At(i))->Scale(factor);
1282}
1283
1284void AliUEHistograms::Reset()
1285{
1286 // delegates to AliUEHists
1287
1288 for (Int_t i=0; i<fgkUEHists; i++)
1289 if (GetUEHist(i))
1290 GetUEHist(i)->Reset();
1291}
1bba939a 1292
f613255f 1293Float_t AliUEHistograms::GetInvMassSquared(Float_t pt1, Float_t eta1, Float_t phi1, Float_t pt2, Float_t eta2, Float_t phi2, Float_t m0_1, Float_t m0_2)
b0d56b29 1294{
1295 // calculate inv mass squared
1296 // same can be achieved, but with more computing time with
1297 /*TLorentzVector photon, p1, p2;
1298 p1.SetPtEtaPhiM(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), 0.510e-3);
1299 p2.SetPtEtaPhiM(particle->Pt(), eta[j], particle->Phi(), 0.510e-3);
1300 photon = p1+p2;
1301 photon.M()*/
1302
1303 Float_t tantheta1 = 1e10;
1304
1305 if (eta1 < -1e-10 || eta1 > 1e-10)
1306 tantheta1 = 2 * TMath::Exp(-eta1) / ( 1 - TMath::Exp(-2*eta1));
1307
1308 Float_t tantheta2 = 1e10;
1309 if (eta2 < -1e-10 || eta2 > 1e-10)
1310 tantheta2 = 2 * TMath::Exp(-eta2) / ( 1 - TMath::Exp(-2*eta2));
1311
f613255f 1312 Float_t e1squ = m0_1 * m0_1 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);
1313 Float_t e2squ = m0_2 * m0_2 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);
b0d56b29 1314
f613255f 1315 Float_t mass2 = m0_1 * m0_1 + m0_2 * m0_2 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( pt1 * pt2 * ( TMath::Cos(phi1 - phi2) + 1.0 / tantheta1 / tantheta2 ) ) );
b0d56b29 1316
1317 return mass2;
1318}