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