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