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