]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGCF/Correlations/Base/AliUEHistograms.cxx
Triggered Balance Function analysis (multidimensions)
[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"
32#include "TH2F.h"
33#include "TH1F.h"
34#include "TH3F.h"
35#include "TMath.h"
b0d56b29 36#include "TLorentzVector.h"
a75aacd6 37
38ClassImp(AliUEHistograms)
39
bf58cbde 40const Int_t AliUEHistograms::fgkUEHists = 3;
41
e0331fd9 42AliUEHistograms::AliUEHistograms(const char* name, const char* histograms) :
43 TNamed(name, name),
a75aacd6 44 fNumberDensitypT(0),
45 fSumpT(0),
46 fNumberDensityPhi(0),
47 fCorrelationpT(0),
48 fCorrelationEta(0),
49 fCorrelationPhi(0),
50 fCorrelationR(0),
51 fCorrelationLeading2Phi(0),
52 fCorrelationMultiplicity(0),
5e053cad 53 fYields(0),
a75aacd6 54 fEventCount(0),
55 fEventCountDifferential(0),
bf58cbde 56 fVertexContributors(0),
c7245604 57 fCentralityDistribution(0),
447d47d8 58 fCentralityCorrelation(0),
2a910c25 59 fITSClusterMap(0),
85bfac17 60 fSelectCharge(0),
d38fa455 61 fTriggerRestrictEta(-1),
00b6f3c6 62 fEtaOrdering(kFALSE),
b0d56b29 63 fCutConversions(kFALSE),
64 fCutResonances(kFALSE),
9da2f080 65 fOnlyOneEtaSide(0),
85bfac17 66 fRunNumber(0)
a75aacd6 67{
68 // Constructor
bf58cbde 69 //
70 // the string histograms defines which histograms are created:
71 // 1 = NumberDensitypT
72 // 2 = SumpT
73 // 3 = NumberDensityPhi
74 // 4 = NumberDensityPhiCentrality (other multiplicity for Pb)
75
0ffdaf17 76 AliLog::SetClassDebugLevel("AliCFContainer", -1);
77 AliLog::SetClassDebugLevel("AliCFGridSparse", -3);
78
670e1d49 79 fTwoTrackDistancePt[0] = 0;
80 fTwoTrackDistancePt[1] = 0;
1bba939a 81
bf58cbde 82 TString histogramsStr(histograms);
83
84 if (histogramsStr.Contains("1"))
85 fNumberDensitypT = new AliUEHist("NumberDensitypT");
86 if (histogramsStr.Contains("2"))
87 fSumpT = new AliUEHist("SumpT");
a75aacd6 88
bf58cbde 89 if (histogramsStr.Contains("3"))
90 fNumberDensityPhi = new AliUEHist("NumberDensityPhi");
0ffdaf17 91 else if (histogramsStr.Contains("4R"))
bf58cbde 92 fNumberDensityPhi = new AliUEHist("NumberDensityPhiCentrality");
0ffdaf17 93 else if (histogramsStr.Contains("4"))
94 fNumberDensityPhi = new AliUEHist("NumberDensityPhiCentralityTTR");
95 else if (histogramsStr.Contains("5R"))
44af28f9 96 fNumberDensityPhi = new AliUEHist("NumberDensityPhiCentralityVtx");
0ffdaf17 97 else if (histogramsStr.Contains("5"))
98 fNumberDensityPhi = new AliUEHist("NumberDensityPhiCentralityVtxTTR");
a75aacd6 99
100 // do not add this hists to the directory
101 Bool_t oldStatus = TH1::AddDirectoryStatus();
102 TH1::AddDirectory(kFALSE);
103
44af28f9 104 if (!histogramsStr.Contains("4") && !histogramsStr.Contains("5"))
c7245604 105 {
106 fCorrelationpT = new TH2F("fCorrelationpT", ";p_{T,lead} (MC);p_{T,lead} (RECO)", 200, 0, 50, 200, 0, 50);
2a910c25 107 fCorrelationEta = new TH2F("fCorrelationEta", ";#eta_{lead} (MC);#eta_{T,lead} (RECO)", 200, -1, 1, 200, -1, 1);
a4a4d54e 108 fCorrelationPhi = new TH2F("fCorrelationPhi", ";#varphi_{lead} (MC);#varphi_{T,lead} (RECO)", 200, 0, TMath::TwoPi(), 200, 0, TMath::TwoPi());
c7245604 109 }
110 else
111 {
2a910c25 112 fCorrelationpT = new TH2F("fCorrelationpT", ";Centrality;p_{T} (RECO)", 100, 0, 100.001, 200, 0, 50);
9da2f080 113 fCorrelationEta = new TH2F("fCorrelationEta", ";Centrality;#eta (RECO)", 100, 0, 100.001, 200, -5, 5);
a4a4d54e 114 fCorrelationPhi = new TH2F("fCorrelationPhi", ";Centrality;#varphi (RECO)", 100, 0, 100.001, 200, 0, TMath::TwoPi());
c7245604 115 }
116
a75aacd6 117 fCorrelationR = new TH2F("fCorrelationR", ";R;p_{T,lead} (MC)", 200, 0, 2, 200, 0, 50);
a4a4d54e 118 fCorrelationLeading2Phi = new TH2F("fCorrelationLeading2Phi", ";#Delta #varphi;p_{T,lead} (MC)", 200, -TMath::Pi(), TMath::Pi(), 200, 0, 50);
a75aacd6 119 fCorrelationMultiplicity = new TH2F("fCorrelationMultiplicity", ";MC tracks;Reco tracks", 100, -0.5, 99.5, 100, -0.5, 99.5);
5e053cad 120 fYields = new TH3F("fYields", ";centrality;pT;eta", 100, 0, 100, 40, 0, 20, 20, -1, 1);
121
44af28f9 122 if (!histogramsStr.Contains("4") && !histogramsStr.Contains("5"))
2a910c25 123 {
124 fEventCount = new TH2F("fEventCount", ";step;event type;count", AliUEHist::fgkCFSteps+2, -2.5, -0.5 + AliUEHist::fgkCFSteps, 3, -0.5, 2.5);
125 fEventCount->GetYaxis()->SetBinLabel(1, "ND");
126 fEventCount->GetYaxis()->SetBinLabel(2, "SD");
127 fEventCount->GetYaxis()->SetBinLabel(3, "DD");
128 }
129 else
130 {
131 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());
132 }
a75aacd6 133
134 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);
135 fEventCountDifferential->GetZaxis()->SetBinLabel(1, "ND");
136 fEventCountDifferential->GetZaxis()->SetBinLabel(2, "SD");
137 fEventCountDifferential->GetZaxis()->SetBinLabel(3, "DD");
138
139 fVertexContributors = new TH1F("fVertexContributors", ";contributors;count", 100, -0.5, 99.5);
140
664d6288 141 if (fNumberDensityPhi)
447d47d8 142 {
143 fCentralityDistribution = new TH1F("fCentralityDistribution", ";centrality;count", fNumberDensityPhi->GetEventHist()->GetNBins(1), fNumberDensityPhi->GetEventHist()->GetAxis(1, 0)->GetXbins()->GetArray());
5e053cad 144 fCentralityCorrelation = new TH2F("fCentralityCorrelation", ";centrality;multiplicity", 101, 0, 101, 200, 0, 4000);
447d47d8 145 }
bf58cbde 146
2a910c25 147 fITSClusterMap = new TH3F("fITSClusterMap", "; its cluster map; centrality; pT", 256, -0.5, 255.5, 20, 0, 100.001, 100, 0, 20);
148
a75aacd6 149 TH1::AddDirectory(oldStatus);
150}
151
d1c75d06 152//_____________________________________________________________________________
153AliUEHistograms::AliUEHistograms(const AliUEHistograms &c) :
e0331fd9 154 TNamed(fName, fTitle),
d1c75d06 155 fNumberDensitypT(0),
156 fSumpT(0),
157 fNumberDensityPhi(0),
158 fCorrelationpT(0),
159 fCorrelationEta(0),
160 fCorrelationPhi(0),
161 fCorrelationR(0),
162 fCorrelationLeading2Phi(0),
163 fCorrelationMultiplicity(0),
5e053cad 164 fYields(0),
d1c75d06 165 fEventCount(0),
166 fEventCountDifferential(0),
bf58cbde 167 fVertexContributors(0),
c7245604 168 fCentralityDistribution(0),
447d47d8 169 fCentralityCorrelation(0),
2a910c25 170 fITSClusterMap(0),
85bfac17 171 fSelectCharge(0),
d38fa455 172 fTriggerRestrictEta(-1),
00b6f3c6 173 fEtaOrdering(kFALSE),
b0d56b29 174 fCutConversions(kFALSE),
175 fCutResonances(kFALSE),
9da2f080 176 fOnlyOneEtaSide(0),
85bfac17 177 fRunNumber(0)
d1c75d06 178{
179 //
180 // AliUEHistograms copy constructor
181 //
182
670e1d49 183 fTwoTrackDistancePt[0] = 0;
184 fTwoTrackDistancePt[1] = 0;
1bba939a 185
d1c75d06 186 ((AliUEHistograms &) c).Copy(*this);
187}
188
a75aacd6 189//____________________________________________________________________
190AliUEHistograms::~AliUEHistograms()
191{
192 // Destructor
193
b0d56b29 194 DeleteContainers();
195}
196
197void AliUEHistograms::DeleteContainers()
198{
a75aacd6 199 if (fNumberDensitypT)
200 {
201 delete fNumberDensitypT;
202 fNumberDensitypT = 0;
203 }
204
205 if (fSumpT)
206 {
207 delete fSumpT;
208 fSumpT = 0;
209 }
210
211 if (fNumberDensityPhi)
212 {
213 delete fNumberDensityPhi;
214 fNumberDensityPhi = 0;
215 }
216
217 if (fCorrelationpT)
218 {
219 delete fCorrelationpT;
220 fCorrelationpT = 0;
221 }
222
223 if (fCorrelationEta)
224 {
225 delete fCorrelationEta;
226 fCorrelationEta = 0;
227 }
228
229 if (fCorrelationPhi)
230 {
231 delete fCorrelationPhi;
232 fCorrelationPhi = 0;
233 }
234
235 if (fCorrelationR)
236 {
237 delete fCorrelationR;
238 fCorrelationR = 0;
239 }
240
241 if (fCorrelationLeading2Phi)
242 {
243 delete fCorrelationLeading2Phi;
244 fCorrelationLeading2Phi = 0;
245 }
246
247 if (fCorrelationMultiplicity)
248 {
249 delete fCorrelationMultiplicity;
250 fCorrelationMultiplicity = 0;
251 }
252
5e053cad 253 if (fYields)
254 {
255 delete fYields;
256 fYields = 0;
257 }
258
a75aacd6 259 if (fEventCount)
260 {
261 delete fEventCount;
262 fEventCount = 0;
263 }
264
265 if (fEventCountDifferential)
266 {
267 delete fEventCountDifferential;
268 fEventCountDifferential = 0;
269 }
270
271 if (fVertexContributors)
272 {
273 delete fVertexContributors;
274 fVertexContributors = 0;
275 }
bf58cbde 276
277 if (fCentralityDistribution)
278 {
279 delete fCentralityDistribution;
280 fCentralityDistribution = 0;
281 }
2a910c25 282
447d47d8 283 if (fCentralityCorrelation)
284 {
285 delete fCentralityCorrelation;
286 fCentralityCorrelation = 0;
287 }
288
2a910c25 289 if (fITSClusterMap)
290 {
291 delete fITSClusterMap;
292 fITSClusterMap = 0;
293 }
1bba939a 294
295 for (Int_t i=0; i<2; i++)
670e1d49 296 if (fTwoTrackDistancePt[i])
1bba939a 297 {
670e1d49 298 delete fTwoTrackDistancePt[i];
299 fTwoTrackDistancePt[i] = 0;
1bba939a 300 }
a75aacd6 301}
302
ada1a03f 303AliUEHist* AliUEHistograms::GetUEHist(Int_t id)
304{
305 // returns AliUEHist object, useful for loops
306
307 switch (id)
308 {
309 case 0: return fNumberDensitypT; break;
310 case 1: return fSumpT; break;
311 case 2: return fNumberDensityPhi; break;
312 }
313
314 return 0;
315}
316
a75aacd6 317//____________________________________________________________________
318Int_t AliUEHistograms::CountParticles(TList* list, Float_t ptMin)
319{
320 // counts the number of particles in the list with a pT above ptMin
321 // TODO eta cut needed here?
322
323 Int_t count = 0;
324 for (Int_t j=0; j<list->GetEntries(); j++)
325 if (((AliVParticle*) list->At(j))->Pt() > ptMin)
326 count++;
327
328 return count;
329}
330
331//____________________________________________________________________
85bfac17 332void AliUEHistograms::Fill(Int_t eventType, Float_t zVtx, AliUEHist::CFStep step, AliVParticle* leading, TList* toward, TList* away, TList* min, TList* max)
a75aacd6 333{
334 // fills the UE event histograms
335 //
336 // 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
337
338 // if leading is not set, just fill event statistics
339 if (leading)
340 {
341 Int_t multiplicity = 0;
342
343 // TODO configurable?
344 Float_t ptMin = 0.15;
345 if (leading->Pt() > ptMin)
346 multiplicity++;
347
348 multiplicity += CountParticles(toward, ptMin);
349 multiplicity += CountParticles(away, ptMin);
350 multiplicity += CountParticles(min, ptMin);
351 multiplicity += CountParticles(max, ptMin);
352
85bfac17 353 FillRegion(AliUEHist::kToward, zVtx, step, leading, toward, multiplicity);
354 FillRegion(AliUEHist::kAway, zVtx, step, leading, away, multiplicity);
355 FillRegion(AliUEHist::kMin, zVtx, step, leading, min, multiplicity);
356 FillRegion(AliUEHist::kMax, zVtx, step, leading, max, multiplicity);
b1831bcb 357
85bfac17 358 Double_t vars[3];
a75aacd6 359 vars[0] = leading->Pt();
360 vars[1] = multiplicity;
85bfac17 361 vars[2] = zVtx;
bf58cbde 362 for (Int_t i=0; i<fgkUEHists; i++)
363 if (GetUEHist(i))
364 GetUEHist(i)->GetEventHist()->Fill(vars, step);
a75aacd6 365
366 fEventCountDifferential->Fill(leading->Pt(), step, eventType);
367 }
368
369 FillEvent(eventType, step);
370}
371
372//____________________________________________________________________
85bfac17 373void AliUEHistograms::FillRegion(AliUEHist::Region region, Float_t zVtx, AliUEHist::CFStep step, AliVParticle* leading, TList* list, Int_t multiplicity)
a75aacd6 374{
375 // loops over AliVParticles in list and fills the given region at the given step
376 //
377 // See also Fill(...)
378
379 for (Int_t i=0; i<list->GetEntries(); i++)
380 {
381 AliVParticle* particle = (AliVParticle*) list->At(i);
382
85bfac17 383 Double_t vars[6];
a75aacd6 384 vars[0] = particle->Eta();
385 vars[1] = particle->Pt();
386 vars[2] = leading->Pt();
387 vars[3] = multiplicity;
388 vars[4] = leading->Phi() - particle->Phi();
2ac8dc5c 389 if (vars[4] > 1.5 * TMath::Pi())
390 vars[4] -= TMath::TwoPi();
391 if (vars[4] < -0.5 * TMath::Pi())
392 vars[4] += TMath::TwoPi();
85bfac17 393 vars[5] = zVtx;
394
bf58cbde 395 if (fNumberDensitypT)
396 fNumberDensitypT->GetTrackHist(region)->Fill(vars, step);
397
398 if (fSumpT)
399 fSumpT->GetTrackHist(region)->Fill(vars, step, particle->Pt());
a75aacd6 400
401 // fill all in toward region (is anyway as function of delta phi!)
bf58cbde 402 if (fNumberDensityPhi)
403 fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->Fill(vars, step);
a75aacd6 404 }
405}
406
407//____________________________________________________________________
408void AliUEHistograms::Fill(AliVParticle* leadingMC, AliVParticle* leadingReco)
409{
410 // fills the correlation histograms
411
412 if (leadingMC)
413 {
414 fCorrelationpT->Fill(leadingMC->Pt(), leadingReco->Pt());
415 if (leadingMC->Pt() > 0.5)
416 {
417 fCorrelationEta->Fill(leadingMC->Eta(), leadingReco->Eta());
418 fCorrelationPhi->Fill(leadingMC->Phi(), leadingReco->Phi());
419 }
420
421 Float_t phiDiff = leadingMC->Phi() - leadingReco->Phi();
422 if (phiDiff > TMath::Pi())
423 phiDiff -= TMath::TwoPi();
424 if (phiDiff < -TMath::Pi())
425 phiDiff += TMath::TwoPi();
426
427 Float_t etaDiff = leadingMC->Eta() - leadingReco->Eta();
428
429 fCorrelationR->Fill(TMath::Sqrt(phiDiff * phiDiff + etaDiff * etaDiff), leadingMC->Pt());
430 fCorrelationLeading2Phi->Fill(phiDiff, leadingMC->Pt());
431 }
432 else
433 {
434 fCorrelationpT->Fill(1.0, leadingReco->Pt());
435 if (leadingReco->Pt() > 0.5)
436 {
437 fCorrelationEta->Fill(0.0, leadingReco->Eta());
438 fCorrelationPhi->Fill(0.0, leadingReco->Phi());
439 }
440 }
441}
bf58cbde 442
443//____________________________________________________________________
d4b3dbfc 444void 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)
bf58cbde 445{
446 // fills the fNumberDensityPhi histogram
447 //
448 // this function need a list of AliVParticles which contain the particles/tracks to be filled
e0331fd9 449 //
450 // if mixed is non-0, mixed events are filled, the trigger particle is from particles, the associated from mixed
c05ff6be 451 // if weight < 0, then the pt of the associated particle is filled as weight
452
453 Bool_t fillpT = kFALSE;
454 if (weight < 0)
455 fillpT = kTRUE;
bf58cbde 456
7fd35fdd 457 if (twoTrackEfficiencyCut && !fTwoTrackDistancePt[0])
458 {
5e053cad 459 // do not add this hists to the directory
460 Bool_t oldStatus = TH1::AddDirectoryStatus();
461 TH1::AddDirectory(kFALSE);
462
7fd35fdd 463 fTwoTrackDistancePt[0] = new TH3F("fTwoTrackDistancePt[0]", ";#Delta#eta;#Delta#varphi^{*}_{min};#Delta p_{T}", 100, -0.05, 0.05, 100, -0.05, 0.05, 20, 0, 10);
464 fTwoTrackDistancePt[1] = (TH3F*) fTwoTrackDistancePt[0]->Clone("fTwoTrackDistancePt[1]");
5e053cad 465
466 TH1::AddDirectory(oldStatus);
7fd35fdd 467 }
468
eed401dc 469 // Eta() is extremely time consuming, therefore cache it for the inner loop here:
470 TObjArray* input = (mixed) ? mixed : particles;
471 TArrayF eta(input->GetEntriesFast());
472 for (Int_t i=0; i<input->GetEntriesFast(); i++)
473 eta[i] = ((AliVParticle*) input->At(i))->Eta();
474
bf58cbde 475 // if particles is not set, just fill event statistics
476 if (particles)
477 {
eed401dc 478 Int_t jMax = particles->GetEntriesFast();
479 if (mixed)
480 jMax = mixed->GetEntriesFast();
481
482 for (Int_t i=0; i<particles->GetEntriesFast(); i++)
bf58cbde 483 {
484 AliVParticle* triggerParticle = (AliVParticle*) particles->At(i);
eed401dc 485
486 // some optimization
487 Float_t triggerEta = triggerParticle->Eta();
9da2f080 488
489 if (fTriggerRestrictEta > 0 && TMath::Abs(triggerEta) > fTriggerRestrictEta)
490 continue;
491
492 if (fOnlyOneEtaSide != 0)
493 {
494 if (fOnlyOneEtaSide * triggerEta < 0)
495 continue;
496 }
497
c7245604 498 if (!mixed)
499 {
500 // QA
501 fCorrelationpT->Fill(centrality, triggerParticle->Pt());
eed401dc 502 fCorrelationEta->Fill(centrality, triggerEta);
c7245604 503 fCorrelationPhi->Fill(centrality, triggerParticle->Phi());
5e053cad 504 fYields->Fill(centrality, triggerParticle->Pt(), triggerEta);
85bfac17 505/* if (dynamic_cast<AliAODTrack*>(triggerParticle))
506 fITSClusterMap->Fill(((AliAODTrack*) triggerParticle)->GetITSClusterMap(), centrality, triggerParticle->Pt());*/
c7245604 507 }
508
e0331fd9 509 for (Int_t j=0; j<jMax; j++)
bf58cbde 510 {
e0331fd9 511 if (!mixed && i == j)
bf58cbde 512 continue;
513
e0331fd9 514 AliVParticle* particle = 0;
515 if (!mixed)
516 particle = (AliVParticle*) particles->At(j);
517 else
518 particle = (AliVParticle*) mixed->At(j);
bf58cbde 519
2a910c25 520 // 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)
521 if (mixed && triggerParticle == particle)
522 continue;
523
c7245604 524 if (particle->Pt() > triggerParticle->Pt())
525 continue;
526
527 if (fSelectCharge > 0)
528 {
529 // skip like sign
530 if (fSelectCharge == 1 && particle->Charge() * triggerParticle->Charge() > 0)
531 continue;
532
533 // skip unlike sign
534 if (fSelectCharge == 2 && particle->Charge() * triggerParticle->Charge() < 0)
535 continue;
536 }
537
00b6f3c6 538 if (fEtaOrdering)
539 {
540 if (triggerEta < 0 && eta[j] < triggerEta)
541 continue;
542 if (triggerEta > 0 && eta[j] > triggerEta)
543 continue;
544 }
545
b0d56b29 546 // conversions
547 if (fCutConversions && particle->Charge() * triggerParticle->Charge() < 0)
548 {
549 Float_t mass = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.510e-3);
550
551 if (mass < 0.04*0.04)
552 continue;
553 }
554
555 // K0s, rhos
556 if (fCutResonances && particle->Charge() * triggerParticle->Charge() < 0)
557 {
558 Float_t mass = GetInvMassSquared(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), particle->Pt(), eta[j], particle->Phi(), 0.1396);
559
560 if ((mass > 0.49*0.49 && mass < 0.51*0.51) || (mass > 0.765*0.765 && mass < 0.785*0.785))
561 continue;
562 }
04af8d15 563
564 if (twoTrackEfficiencyCut)
565 {
7fd35fdd 566 // the variables & cuthave been developed by the HBT group
567 // see e.g. https://indico.cern.ch/materialDisplay.py?contribId=36&sessionId=6&materialId=slides&confId=142700
568
04af8d15 569 Float_t phi1 = triggerParticle->Phi();
570 Float_t pt1 = triggerParticle->Pt();
571 Float_t charge1 = triggerParticle->Charge();
572
573 Float_t phi2 = particle->Phi();
574 Float_t pt2 = particle->Pt();
575 Float_t charge2 = particle->Charge();
576
577 Float_t deta = triggerEta - eta[j];
578
579 // optimization
d4b3dbfc 580 if (TMath::Abs(deta) < twoTrackEfficiencyCutValue * 2.5)
04af8d15 581 {
7fd35fdd 582 // check first boundaries to see if is worth to loop and find the minimum
583 Float_t dphistar1 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 0.8, bSign);
584 Float_t dphistar2 = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, 2.5, bSign);
585
d4b3dbfc 586 const Float_t kLimit = twoTrackEfficiencyCutValue * 3;
04af8d15 587
7fd35fdd 588 Float_t dphistarminabs = 1e5;
589 Float_t dphistarmin = 1e5;
590 if (TMath::Abs(dphistar1) < kLimit || TMath::Abs(dphistar2) < kLimit || dphistar1 * dphistar2 < 0)
04af8d15 591 {
7fd35fdd 592 for (Double_t rad=0.8; rad<2.51; rad+=0.01)
593 {
594 Float_t dphistar = GetDPhiStar(phi1, pt1, charge1, phi2, pt2, charge2, rad, bSign);
595
596 Float_t dphistarabs = TMath::Abs(dphistar);
597
598 if (dphistarabs < dphistarminabs)
599 {
600 dphistarmin = dphistar;
601 dphistarminabs = dphistarabs;
602 }
603 }
604
605 fTwoTrackDistancePt[0]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));
04af8d15 606
d4b3dbfc 607 if (dphistarminabs < twoTrackEfficiencyCutValue && TMath::Abs(deta) < twoTrackEfficiencyCutValue)
04af8d15 608 {
7fd35fdd 609// 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);
610 continue;
04af8d15 611 }
7fd35fdd 612
613 fTwoTrackDistancePt[1]->Fill(deta, dphistarmin, TMath::Abs(pt1 - pt2));
04af8d15 614 }
04af8d15 615 }
616 }
b0d56b29 617
85bfac17 618 Double_t vars[6];
eed401dc 619 vars[0] = triggerEta - eta[j];
bf58cbde 620 vars[1] = particle->Pt();
621 vars[2] = triggerParticle->Pt();
622 vars[3] = centrality;
623 vars[4] = triggerParticle->Phi() - particle->Phi();
624 if (vars[4] > 1.5 * TMath::Pi())
625 vars[4] -= TMath::TwoPi();
626 if (vars[4] < -0.5 * TMath::Pi())
627 vars[4] += TMath::TwoPi();
85bfac17 628 vars[5] = zVtx;
c05ff6be 629
630 if (fillpT)
631 weight = particle->Pt();
bf58cbde 632
c7245604 633 // fill all in toward region and do not use the other regions
634 fNumberDensityPhi->GetTrackHist(AliUEHist::kToward)->Fill(vars, step, weight);
d38fa455 635
636// Printf("%.2f %.2f --> %.2f", triggerEta, eta[j], vars[0]);
c7245604 637 }
bf58cbde 638
c7245604 639 if (firstTime)
640 {
641 // once per trigger particle
85bfac17 642 Double_t vars[3];
c7245604 643 vars[0] = triggerParticle->Pt();
644 vars[1] = centrality;
85bfac17 645 vars[2] = zVtx;
c7245604 646 fNumberDensityPhi->GetEventHist()->Fill(vars, step);
c7245604 647 }
bf58cbde 648 }
649 }
650
651 fCentralityDistribution->Fill(centrality);
447d47d8 652 fCentralityCorrelation->Fill(centrality, particles->GetEntriesFast());
2a910c25 653 FillEvent(centrality, step);
bf58cbde 654}
a75aacd6 655
b1831bcb 656//____________________________________________________________________
c7245604 657void AliUEHistograms::FillTrackingEfficiency(TObjArray* mc, TObjArray* recoPrim, TObjArray* recoAll, Int_t particleType, Double_t centrality)
b1831bcb 658{
659 // fills the tracking efficiency objects
660 //
661 // mc: all primary MC particles
662 // recoPrim: reconstructed primaries (again MC particles)
663 // recoAll: reconstructed (again MC particles)
664 // particleType is: 0 for pion, 1 for kaon, 2 for proton, 3 for others
665
666 for (Int_t step=0; step<3; step++)
667 {
668 TObjArray* list = mc;
669 if (step == 1)
670 list = recoPrim;
671 else if (step == 2)
672 list = recoAll;
673
eed401dc 674 for (Int_t i=0; i<list->GetEntriesFast(); i++)
b1831bcb 675 {
676 AliVParticle* particle = (AliVParticle*) list->At(i);
c7245604 677 Double_t vars[4];
b1831bcb 678 vars[0] = particle->Eta();
679 vars[1] = particle->Pt();
680 vars[2] = particleType;
c7245604 681 vars[3] = centrality;
b1831bcb 682
bf58cbde 683 for (Int_t j=0; j<fgkUEHists; j++)
684 if (GetUEHist(j))
685 GetUEHist(j)->GetTrackHistEfficiency()->Fill(vars, step);
b1831bcb 686 }
687 }
688}
689
a75aacd6 690//____________________________________________________________________
691void AliUEHistograms::FillEvent(Int_t eventType, Int_t step)
692{
693 // fills the number of events at the given step and the given enty type
694 //
695 // WARNING: This function is called from Fill, so only call it for steps where Fill is not called
696
697 fEventCount->Fill(step, eventType);
698}
699
2a910c25 700//____________________________________________________________________
701void AliUEHistograms::FillEvent(Double_t centrality, Int_t step)
702{
703 // fills the number of events at the given step and the given centrality
704 //
705 // WARNING: This function is called from Fill, so only call it for steps where Fill is not called
706
707 fEventCount->Fill(step, centrality);
708}
709
a75aacd6 710//____________________________________________________________________
711void AliUEHistograms::SetEtaRange(Float_t etaMin, Float_t etaMax)
712{
713 // sets eta min and max for all contained AliUEHist classes
714
bf58cbde 715 for (Int_t i=0; i<fgkUEHists; i++)
716 if (GetUEHist(i))
717 GetUEHist(i)->SetEtaRange(etaMin, etaMax);
a75aacd6 718}
719
720//____________________________________________________________________
721void AliUEHistograms::SetPtRange(Float_t ptMin, Float_t ptMax)
722{
723 // sets pT min and max for all contained AliUEHist classes
724
bf58cbde 725 for (Int_t i=0; i<fgkUEHists; i++)
726 if (GetUEHist(i))
727 GetUEHist(i)->SetPtRange(ptMin, ptMax);
a75aacd6 728}
729
85bfac17 730//____________________________________________________________________
731void AliUEHistograms::SetZVtxRange(Float_t min, Float_t max)
732{
733 // sets pT min and max for all contained AliUEHist classes
734
735 for (Int_t i=0; i<fgkUEHists; i++)
736 if (GetUEHist(i))
737 GetUEHist(i)->SetZVtxRange(min, max);
738}
739
144bd037 740//____________________________________________________________________
741void AliUEHistograms::SetContaminationEnhancement(TH1F* hist)
742{
743 // sets the contamination enhancement histogram in all contained AliUEHist classes
744
bf58cbde 745 for (Int_t i=0; i<fgkUEHists; i++)
746 if (GetUEHist(i))
747 GetUEHist(i)->SetContaminationEnhancement(hist);
144bd037 748}
749
a75aacd6 750//____________________________________________________________________
751void AliUEHistograms::SetCombineMinMax(Bool_t flag)
752{
753 // sets pT min and max for all contained AliUEHist classes
754
bf58cbde 755 for (Int_t i=0; i<fgkUEHists; i++)
756 if (GetUEHist(i))
757 GetUEHist(i)->SetCombineMinMax(flag);
a75aacd6 758}
759
760//____________________________________________________________________
761void AliUEHistograms::Correct(AliUEHistograms* corrections)
762{
763 // corrects the contained histograms by calling AliUEHist::Correct
764
bf58cbde 765 for (Int_t i=0; i<fgkUEHists; i++)
766 if (GetUEHist(i))
767 GetUEHist(i)->Correct(corrections->GetUEHist(i));
a75aacd6 768}
769
770//____________________________________________________________________
771AliUEHistograms &AliUEHistograms::operator=(const AliUEHistograms &c)
772{
773 // assigment operator
774
b0d56b29 775 DeleteContainers();
776
a75aacd6 777 if (this != &c)
778 ((AliUEHistograms &) c).Copy(*this);
779
780 return *this;
781}
782
783//____________________________________________________________________
784void AliUEHistograms::Copy(TObject& c) const
785{
786 // copy function
787
788 AliUEHistograms& target = (AliUEHistograms &) c;
789
790 if (fNumberDensitypT)
791 target.fNumberDensitypT = dynamic_cast<AliUEHist*> (fNumberDensitypT->Clone());
792
793 if (fSumpT)
794 target.fSumpT = dynamic_cast<AliUEHist*> (fSumpT->Clone());
795
796 if (fNumberDensityPhi)
797 target.fNumberDensityPhi = dynamic_cast<AliUEHist*> (fNumberDensityPhi->Clone());
798
799 if (fCorrelationpT)
800 target.fCorrelationpT = dynamic_cast<TH2F*> (fCorrelationpT->Clone());
801
802 if (fCorrelationEta)
803 target.fCorrelationEta = dynamic_cast<TH2F*> (fCorrelationEta->Clone());
804
805 if (fCorrelationPhi)
806 target.fCorrelationPhi = dynamic_cast<TH2F*> (fCorrelationPhi->Clone());
807
808 if (fCorrelationR)
809 target.fCorrelationR = dynamic_cast<TH2F*> (fCorrelationR->Clone());
810
811 if (fCorrelationLeading2Phi)
812 target.fCorrelationLeading2Phi = dynamic_cast<TH2F*> (fCorrelationLeading2Phi->Clone());
813
814 if (fCorrelationMultiplicity)
815 target.fCorrelationMultiplicity = dynamic_cast<TH2F*> (fCorrelationMultiplicity->Clone());
816
5e053cad 817 if (fYields)
818 target.fYields = dynamic_cast<TH3F*> (fYields->Clone());
819
a75aacd6 820 if (fEventCount)
821 target.fEventCount = dynamic_cast<TH2F*> (fEventCount->Clone());
822
823 if (fEventCountDifferential)
824 target.fEventCountDifferential = dynamic_cast<TH3F*> (fEventCountDifferential->Clone());
825
826 if (fVertexContributors)
827 target.fVertexContributors = dynamic_cast<TH1F*> (fVertexContributors->Clone());
bf58cbde 828
829 if (fCentralityDistribution)
830 target.fCentralityDistribution = dynamic_cast<TH1F*> (fCentralityDistribution->Clone());
c7245604 831
447d47d8 832 if (fCentralityCorrelation)
833 target.fCentralityCorrelation = dynamic_cast<TH2F*> (fCentralityCorrelation->Clone());
834
2a910c25 835 if (fITSClusterMap)
836 target.fITSClusterMap = dynamic_cast<TH3F*> (fITSClusterMap->Clone());
837
1bba939a 838 for (Int_t i=0; i<2; i++)
670e1d49 839 if (fTwoTrackDistancePt[i])
840 target.fTwoTrackDistancePt[i] = dynamic_cast<TH3F*> (fTwoTrackDistancePt[i]->Clone());
1bba939a 841
c7245604 842 target.fSelectCharge = fSelectCharge;
d38fa455 843 target.fTriggerRestrictEta = fTriggerRestrictEta;
00b6f3c6 844 target.fEtaOrdering = fEtaOrdering;
b0d56b29 845 target.fCutConversions = fCutConversions;
846 target.fCutResonances = fCutResonances;
9da2f080 847 target.fOnlyOneEtaSide = fOnlyOneEtaSide;
85bfac17 848 target.fRunNumber = fRunNumber;
a75aacd6 849}
850
851//____________________________________________________________________
852Long64_t AliUEHistograms::Merge(TCollection* list)
853{
854 // Merge a list of AliUEHistograms objects with this (needed for
855 // PROOF).
856 // Returns the number of merged objects (including this).
857
858 if (!list)
859 return 0;
860
861 if (list->IsEmpty())
862 return 1;
863
864 TIterator* iter = list->MakeIterator();
865 TObject* obj;
866
867 // collections of objects
5e053cad 868 const Int_t kMaxLists = 18;
a75aacd6 869 TList* lists[kMaxLists];
870
871 for (Int_t i=0; i<kMaxLists; i++)
872 lists[i] = new TList;
873
874 Int_t count = 0;
875 while ((obj = iter->Next())) {
876
877 AliUEHistograms* entry = dynamic_cast<AliUEHistograms*> (obj);
878 if (entry == 0)
879 continue;
880
bf58cbde 881 if (entry->fNumberDensitypT)
882 lists[0]->Add(entry->fNumberDensitypT);
883 if (entry->fSumpT)
884 lists[1]->Add(entry->fSumpT);
885 if (entry->fNumberDensityPhi)
886 lists[2]->Add(entry->fNumberDensityPhi);
a75aacd6 887 lists[3]->Add(entry->fCorrelationpT);
888 lists[4]->Add(entry->fCorrelationEta);
889 lists[5]->Add(entry->fCorrelationPhi);
890 lists[6]->Add(entry->fCorrelationR);
891 lists[7]->Add(entry->fCorrelationLeading2Phi);
892 lists[8]->Add(entry->fCorrelationMultiplicity);
893 lists[9]->Add(entry->fEventCount);
894 lists[10]->Add(entry->fEventCountDifferential);
895 lists[11]->Add(entry->fVertexContributors);
bf58cbde 896 lists[12]->Add(entry->fCentralityDistribution);
2a910c25 897 lists[13]->Add(entry->fITSClusterMap);
78d64459 898 if (entry->fTwoTrackDistancePt[0])
670e1d49 899 lists[14]->Add(entry->fTwoTrackDistancePt[0]);
78d64459 900 if (entry->fTwoTrackDistancePt[1])
670e1d49 901 lists[15]->Add(entry->fTwoTrackDistancePt[1]);
78d64459 902 if (entry->fCentralityCorrelation)
447d47d8 903 lists[16]->Add(entry->fCentralityCorrelation);
5e053cad 904 if (entry->fYields)
905 lists[17]->Add(entry->fYields);
a75aacd6 906 count++;
907 }
908
bf58cbde 909 if (fNumberDensitypT)
910 fNumberDensitypT->Merge(lists[0]);
911 if (fSumpT)
912 fSumpT->Merge(lists[1]);
913 if (fNumberDensityPhi)
914 fNumberDensityPhi->Merge(lists[2]);
a75aacd6 915 fCorrelationpT->Merge(lists[3]);
916 fCorrelationEta->Merge(lists[4]);
917 fCorrelationPhi->Merge(lists[5]);
918 fCorrelationR->Merge(lists[6]);
919 fCorrelationLeading2Phi->Merge(lists[7]);
920 fCorrelationMultiplicity->Merge(lists[8]);
921 fEventCount->Merge(lists[9]);
922 fEventCountDifferential->Merge(lists[10]);
923 fVertexContributors->Merge(lists[11]);
bf58cbde 924 fCentralityDistribution->Merge(lists[12]);
2a910c25 925 fITSClusterMap->Merge(lists[13]);
0ffdaf17 926 if (fTwoTrackDistancePt[0] && lists[14]->GetEntries() > 0)
670e1d49 927 fTwoTrackDistancePt[0]->Merge(lists[14]);
0ffdaf17 928 if (fTwoTrackDistancePt[1] && lists[15]->GetEntries() > 0)
670e1d49 929 fTwoTrackDistancePt[1]->Merge(lists[15]);
447d47d8 930 if (fCentralityCorrelation)
931 fCentralityCorrelation->Merge(lists[16]);
5e053cad 932 if (fYields && lists[17]->GetEntries() > 0)
933 fYields->Merge(lists[17]);
a75aacd6 934
935 for (Int_t i=0; i<kMaxLists; i++)
936 delete lists[i];
937
938 return count+1;
939}
b1831bcb 940
941void AliUEHistograms::CopyReconstructedData(AliUEHistograms* from)
942{
943 // copies those histograms extracted from ESD to this object
944
bf58cbde 945 for (Int_t i=0; i<fgkUEHists; i++)
946 if (GetUEHist(i))
947 GetUEHist(i)->CopyReconstructedData(from->GetUEHist(i));
b1831bcb 948}
6f803f6c 949
0ffdaf17 950void AliUEHistograms::DeepCopy(AliUEHistograms* from)
951{
952 // copies the entries of this object's members from the object <from> to this object
953
954 for (Int_t i=0; i<fgkUEHists; i++)
955 if (GetUEHist(i) && from->GetUEHist(i))
956 GetUEHist(i)->DeepCopy(from->GetUEHist(i));
957}
958
2a910c25 959void AliUEHistograms::ExtendTrackingEfficiency(Bool_t verbose)
6f803f6c 960{
961 // delegates to AliUEHists
962
bf58cbde 963 for (Int_t i=0; i<fgkUEHists; i++)
964 if (GetUEHist(i))
2a910c25 965 GetUEHist(i)->ExtendTrackingEfficiency(verbose);
6f803f6c 966}
967
c7245604 968void AliUEHistograms::Scale(Double_t factor)
969{
970 // scales all contained histograms by the given factor
971
972 for (Int_t i=0; i<fgkUEHists; i++)
973 if (GetUEHist(i))
974 GetUEHist(i)->Scale(factor);
975
976 TList list;
977 list.Add(fCorrelationpT);
978 list.Add(fCorrelationEta);
979 list.Add(fCorrelationPhi);
980 list.Add(fCorrelationR);
981 list.Add(fCorrelationLeading2Phi);
982 list.Add(fCorrelationMultiplicity);
5e053cad 983 list.Add(fYields);
c7245604 984 list.Add(fEventCount);
985 list.Add(fEventCountDifferential);
986 list.Add(fVertexContributors);
987 list.Add(fCentralityDistribution);
447d47d8 988 list.Add(fCentralityCorrelation);
2a910c25 989 list.Add(fITSClusterMap);
670e1d49 990 list.Add(fTwoTrackDistancePt[0]);
991 list.Add(fTwoTrackDistancePt[1]);
c7245604 992
993 for (Int_t i=0; i<list.GetEntries(); i++)
994 ((TH1*) list.At(i))->Scale(factor);
995}
996
997void AliUEHistograms::Reset()
998{
999 // delegates to AliUEHists
1000
1001 for (Int_t i=0; i<fgkUEHists; i++)
1002 if (GetUEHist(i))
1003 GetUEHist(i)->Reset();
1004}
1bba939a 1005
b0d56b29 1006Float_t AliUEHistograms::GetInvMassSquared(Float_t pt1, Float_t eta1, Float_t phi1, Float_t pt2, Float_t eta2, Float_t phi2, Float_t m0)
1007{
1008 // calculate inv mass squared
1009 // same can be achieved, but with more computing time with
1010 /*TLorentzVector photon, p1, p2;
1011 p1.SetPtEtaPhiM(triggerParticle->Pt(), triggerEta, triggerParticle->Phi(), 0.510e-3);
1012 p2.SetPtEtaPhiM(particle->Pt(), eta[j], particle->Phi(), 0.510e-3);
1013 photon = p1+p2;
1014 photon.M()*/
1015
1016 Float_t tantheta1 = 1e10;
1017
1018 if (eta1 < -1e-10 || eta1 > 1e-10)
1019 tantheta1 = 2 * TMath::Exp(-eta1) / ( 1 - TMath::Exp(-2*eta1));
1020
1021 Float_t tantheta2 = 1e10;
1022 if (eta2 < -1e-10 || eta2 > 1e-10)
1023 tantheta2 = 2 * TMath::Exp(-eta2) / ( 1 - TMath::Exp(-2*eta2));
1024
1025 Float_t e1squ = m0 * m0 + pt1 * pt1 * (1.0 + 1.0 / tantheta1 / tantheta1);
1026 Float_t e2squ = m0 * m0 + pt2 * pt2 * (1.0 + 1.0 / tantheta2 / tantheta2);
1027
1028 Float_t mass2 = 2 * m0 * m0 + 2 * ( TMath::Sqrt(e1squ * e2squ) - ( pt1 * pt2 * ( TMath::Cos(phi1 - phi2) + 1.0 / tantheta1 / tantheta2 ) ) );
1029
1030 return mass2;
1031}