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