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