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