1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 #include "AliFastGlauber.h"
28 ClassImp(AliFastGlauber)
30 TF1* AliFastGlauber::fWSb = NULL;
31 TF2* AliFastGlauber::fWSbz = NULL;
32 TF1* AliFastGlauber::fWSz = NULL;
33 TF1* AliFastGlauber::fWSta = NULL;
34 TF2* AliFastGlauber::fWStarfi = NULL;
35 TF2* AliFastGlauber::fWAlmond = NULL;
36 TF1* AliFastGlauber::fWStaa = NULL;
37 TF1* AliFastGlauber::fWSgeo = NULL;
38 TF1* AliFastGlauber::fWSbinary = NULL;
39 TF1* AliFastGlauber::fWSN = NULL;
40 TF1* AliFastGlauber::fWPathLength0 = NULL;
41 TF1* AliFastGlauber::fWPathLength = NULL;
42 TF1* AliFastGlauber::fWEnergyDensity = NULL;
43 TF1* AliFastGlauber::fWIntRadius = NULL;
44 Float_t AliFastGlauber::fbMax = 0.;
46 AliFastGlauber::AliFastGlauber()
48 // Default Constructor
51 SetWoodSaxonParameters(6.624, 0.549, 0.00, 7.69e-4);
52 SetHardCrossSection();
56 void AliFastGlauber::Init(Int_t mode)
62 fWSb = new TF1("WSb", WSb, 0, fbMax, 4);
63 fWSb->SetParameter(0, fWSr0);
64 fWSb->SetParameter(1, fWSd);
65 fWSb->SetParameter(2, fWSw);
66 fWSb->SetParameter(3, fWSn);
68 fWSbz = new TF2("WSbz", WSbz, 0, fbMax, 4);
69 fWSbz->SetParameter(0, fWSr0);
70 fWSbz->SetParameter(1, fWSd);
71 fWSbz->SetParameter(2, fWSw);
72 fWSbz->SetParameter(3, fWSn);
74 fWSz = new TF1("WSz", WSz, 0, fbMax, 5);
75 fWSz->SetParameter(0, fWSr0);
76 fWSz->SetParameter(1, fWSd);
77 fWSz->SetParameter(2, fWSw);
78 fWSz->SetParameter(3, fWSn);
83 fWSta = new TF1("WSta", WSta, 0., fbMax, 0);
88 fWStarfi = new TF2("WStarfi", WStarfi, 0., fbMax, 0., TMath::Pi(), 1);
89 fWStarfi->SetParameter(0, 0.);
90 fWStarfi->SetNpx(200);
93 // Almond shaped interaction region
95 fWAlmond = new TF2("WAlmond", WAlmond, -fbMax, fbMax, -fbMax, fbMax, 1);
96 fWAlmond->SetParameter(0, 0.);
97 fWAlmond->SetNpx(200);
98 fWAlmond->SetNpy(200);
100 // Path Length as a function of Phi
102 fWPathLength0 = new TF1("WPathLength0", WPathLength0, -TMath::Pi(), TMath::Pi(), 1);
103 fWPathLength0->SetParameter(0, 0.);
104 fWPathLength = new TF1("WPathLength", WPathLength, -TMath::Pi(), TMath::Pi(), 2);
106 fWPathLength->SetParameter(0, 0.);
107 // Number of interactions used for average
108 fWPathLength->SetParameter(1, 1000.);
110 fWIntRadius = new TF1("WIntRadius", WIntRadius, 0., fbMax, 1);
111 fWIntRadius->SetParameter(0, 0.);
118 fWStaa = new TF1("WStaa", WStaa, 0., fbMax, 0);
121 TFile* f = new TFile("$(ALICE_ROOT)/FASTSIM/data/glauberPbPb.root");
122 fWStaa = (TF1*) f->Get("WStaa");
126 fWEnergyDensity = new TF1("WEnergyDensity", WEnergyDensity, 0., 2. * fWSr0, 1);
127 fWEnergyDensity->SetParameter(0, fWSr0 + 1.);
130 // Geometrical Cross-Section
132 fWSgeo = new TF1("WSgeo", WSgeo, 0., fbMax, 0);
135 // Hard cross section (~ binary collisions)
137 fWSbinary = new TF1("WSbinary", WSbinary, 0., fbMax, 1);
138 fWSbinary->SetParameter(0, fSigmaHard); // mb
139 fWSbinary->SetNpx(100);
141 // Hard collisions per event
143 fWSN = new TF1("WSN", WSN, 0., fbMax, 1);
147 void AliFastGlauber::DrawWSb()
150 // Draw Wood-Saxon Nuclear Density Function
152 TCanvas *c1 = new TCanvas("c1","Wood Saxon",400,10,600,700);
157 void AliFastGlauber::DrawOverlap()
160 // Draw Overlap Function
162 TCanvas *c2 = new TCanvas("c2","Overlap",400,10,600,700);
167 void AliFastGlauber::DrawThickness()
170 // Draw Thickness Function
172 TCanvas *c3 = new TCanvas("c3","Thickness",400,10,600,700);
177 void AliFastGlauber::DrawGeo()
180 // Draw Geometrical Cross-Section
182 TCanvas *c3 = new TCanvas("c3","Geometrical Cross-Section",400,10,600,700);
187 void AliFastGlauber::DrawBinary()
190 // Draw Wood-Saxon Nuclear Density Function
192 TCanvas *c4 = new TCanvas("c4","Binary Cross-Section",400,10,600,700);
197 void AliFastGlauber::DrawN()
200 // Draw Binaries per event
202 TCanvas *c5 = new TCanvas("c5","Binaries per event",400,10,600,700);
207 void AliFastGlauber::DrawKernel(Double_t b)
212 TCanvas *c6 = new TCanvas("c6","Kernel",400,10,600,700);
214 fWStarfi->SetParameter(0, b);
218 void AliFastGlauber::DrawAlmond(Double_t b)
221 // Draw Interaction Almond
223 TCanvas *c7 = new TCanvas("c7","Almond",400,10,600,700);
225 fWAlmond->SetParameter(0, b);
229 void AliFastGlauber::DrawPathLength0(Double_t b)
234 TCanvas *c8 = new TCanvas("c8","Path Length",400,10,600,700);
236 fWPathLength0->SetParameter(0, b);
237 fWPathLength0->SetMinimum(0.);
238 fWPathLength0->SetMaximum(10.);
239 fWPathLength0->Draw();
242 void AliFastGlauber::DrawPathLength(Double_t b , Int_t ni)
247 TCanvas *c9 = new TCanvas("c9","Path Length",400,10,600,700);
249 fWAlmond->SetParameter(0, b);
251 fWPathLength->SetParameter(0, b);
252 fWPathLength->SetParameter(1, Double_t (ni));
253 fWPathLength->SetMinimum(0.);
254 fWPathLength->SetMaximum(10.);
255 fWPathLength->Draw();
258 void AliFastGlauber::DrawIntRadius(Double_t b)
261 // Draw Interaction Radius
263 TCanvas *c10 = new TCanvas("c10","Interaction Radius",400,10,600,700);
265 fWIntRadius->SetParameter(0, b);
266 fWIntRadius->SetMinimum(0.);
270 void AliFastGlauber::DrawEnergyDensity()
273 // Draw energy density
275 TCanvas *c11 = new TCanvas("c11","Energy Density",400, 10, 600, 700);
277 fWEnergyDensity->SetMinimum(0.);
278 fWEnergyDensity->Draw();
281 Double_t AliFastGlauber::WSb(Double_t* x, Double_t* par)
284 // Woods-Saxon Parameterisation
285 // as a function of radius
288 Double_t r0 = par[0];
293 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
298 Double_t AliFastGlauber::WSbz(Double_t* x, Double_t* par)
301 // Wood Saxon Parameterisation
302 // as a function of z and b
306 Double_t r0 = par[0];
310 Double_t xx = TMath::Sqrt(bb*bb+zz*zz);
311 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
316 Double_t AliFastGlauber::WSz(Double_t* x, Double_t* par)
319 // Wood Saxon Parameterisation
320 // as a function of z for fixed b
322 Double_t bb = par[4];
324 Double_t r0 = par[0];
328 Double_t xx = TMath::Sqrt(bb*bb+zz*zz);
329 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
334 Double_t AliFastGlauber::WSta(Double_t* x, Double_t* /*par*/)
337 // Thickness function
340 fWSz->SetParameter(4, b);
341 Double_t y = 2. * fWSz->Integral(0., fbMax);
347 Double_t AliFastGlauber::WStarfi(Double_t* x, Double_t* par)
350 // Kernel for overlap function
355 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
356 Double_t y = r1 * fWSta->Eval(r1) * fWSta->Eval(r2);
361 Double_t AliFastGlauber::WAlmond(Double_t* x, Double_t* par)
364 // Almond shaped interaction region
367 Double_t xx = x[0] + b/2.;
369 Double_t r1 = TMath::Sqrt(xx * xx + yy * yy);
370 Double_t phi = TMath::ATan2(yy,xx);
372 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
374 // Interaction probability calculated as product of thicknesses
376 Double_t y = fWSta->Eval(r1) * fWSta->Eval(r2);
380 Double_t AliFastGlauber::WIntRadius(Double_t* x, Double_t* par)
383 // Average radius at which interaction takes place
385 // Radius in the Almond
389 fWAlmond->SetParameter(0, b);
391 Double_t dphi = 2. * TMath::Pi() / 100.;
396 for (Int_t i = 0; i < 100; i++) {
397 Double_t xx = r * TMath::Cos(phi);
398 Double_t yy = r * TMath::Sin(phi);
399 y += fWAlmond->Eval(xx,yy);
402 // Result multiplied by Jacobian (2 pi r)
403 return (2. * TMath::Pi() * y * r / 100.);
406 Double_t AliFastGlauber::WPathLength0(Double_t* x, Double_t* par)
409 // Path Length as a function of phi for interaction point fixed at (0,0)
413 const Int_t np = 100;
414 const Double_t dr = fbMax/Double_t(np);
417 // Phi direction in Almond
418 Double_t phi0 = x[0];
422 // Step along radial direction phi
423 for (Int_t i = 0; i < np; i++) {
425 // Transform into target frame
427 Double_t xx = r * TMath::Cos(phi0) + b / 2.;
428 Double_t yy = r * TMath::Sin(phi0);
429 Double_t phi = TMath::ATan2(yy, xx);
431 Double_t r1 = TMath::Sqrt(xx * xx + yy * yy);
432 // Radius in projectile frame
433 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
434 Double_t y = fWSta->Eval(r1) * fWSta->Eval(r2);
441 // My length definition (is exact for hard sphere)
442 return (2. * rw / w);
445 Double_t AliFastGlauber::WPathLength(Double_t* x, Double_t* par)
448 // Path Length as a function of phi
449 // Interaction point from random distribution
454 const Int_t np = 100;
455 const Double_t dr = fbMax/Double_t(np);
456 // Number of interactions
457 const Int_t npi = Int_t (par[1]);
463 Double_t phi0 = x[0];
465 printf("phi0 %f \n", phi0);
470 for (Int_t in = 0; in < npi; in ++) {
476 fWAlmond->GetRandom2(x0, y0);
478 Double_t r0 = TMath::Sqrt(x0 * x0 + y0 * y0);
479 Int_t nps = Int_t ((fbMax - r0)/dr) - 1;
483 for (Int_t i = 0; (i < nps ); i++) {
485 // Transform into target frame
486 Double_t xx = x0 + r * TMath::Cos(phi0) + b / 2.;
487 Double_t yy = y0 + r * TMath::Sin(phi0);
488 Double_t phi = TMath::ATan2(yy, xx);
489 Double_t r1 = TMath::Sqrt(xx * xx + yy * yy);
490 // Radius in projectile frame
491 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
492 Double_t y = fWSta->Eval(r1) * fWSta->Eval(r2);
498 // Average over interactions
501 return (l / Double_t(npi));
504 Double_t AliFastGlauber::WStaa(Double_t* x, Double_t* /*par*/)
510 fWStarfi->SetParameter(0, b);
520 Double_t y = 2. * fWStarfi->IntegralMultiple(2, al, bl, 0.001, err);
521 printf("WStaa: %f %f %f\n", b, y, err);
527 for (Int_t i = 0; i < 100000; i++)
529 Double_t phi = TMath::Pi() * gRandom->Rndm();
530 Double_t b1 = fbMax * gRandom->Rndm();
531 y += fWStarfi->Eval(b1, phi);
533 y *= 2. * 0.1 * 208. * 208. * TMath::Pi() * fbMax / 100000.;
537 Double_t AliFastGlauber::WSgeo(Double_t* x, Double_t* /*par*/)
540 // Geometrical Cross-Section
543 Double_t taa = fWStaa->Eval(b);
544 const Double_t sigma = 55.6; // mbarn
546 Double_t y = 2. * TMath::Pi() * b * (1. - TMath::Exp(- sigma * taa)); // fm
551 Double_t AliFastGlauber::WSbinary(Double_t* x, Double_t* par)
554 // Number of binary collisions
557 Double_t sigma = par[0];
558 Double_t taa = fWStaa->Eval(b);
560 Double_t y = 2. * TMath::Pi() * b * sigma * taa; // fm
564 Double_t AliFastGlauber::WSN(Double_t* x, Double_t* /*par*/)
567 // Number of hard processes per event
570 Double_t y = fWSbinary->Eval(b)/fWSgeo->Eval(b);
574 Double_t AliFastGlauber::WEnergyDensity(Double_t* x, Double_t* par)
577 // Initial energy density as a function of the impact parameter
580 Double_t rA = par[0];
582 Double_t saa = (TMath::Pi() - 2. * TMath::ASin(b/ 2./ rA)) * rA * rA - b * TMath::Sqrt(rA * rA - b * b/ 4.);
583 Double_t taa = fWStaa->Eval(b);
588 void AliFastGlauber::SimulateTrigger(Int_t n)
593 TH1F* mbtH = new TH1F("mbtH", "MB Trigger b-Distribution", 100, 0., 20.);
594 TH1F* hdtH = new TH1F("hdtH", "Hard Trigger b-Distribution", 100, 0., 20.);
595 TH1F* mbmH = new TH1F("mbmH", "MB Trigger Multiplicity Distribution", 100, 0., 8000.);
596 TH1F* hdmH = new TH1F("hdmH", "Hard Trigger Multiplicity Distribution", 100, 0., 8000.);
598 mbtH->SetXTitle("b [fm]");
599 hdtH->SetXTitle("b [fm]");
600 mbmH->SetXTitle("Multiplicity");
601 hdmH->SetXTitle("Multiplicity");
603 TCanvas *c0 = new TCanvas("c0","Trigger Simulation",400,10,600,700);
605 TCanvas *c1 = new TCanvas("c1","Trigger Simulation",400,10,600,700);
611 for (Int_t iev = 0; iev < n; iev++)
614 GetRandom(b, p, mult);
617 mbmH->Fill(mult, 1.);
634 void AliFastGlauber::GetRandom(Float_t& b, Float_t& p, Float_t& mult)
637 // Gives back a random impact parameter, hard trigger probability and multiplicity
639 b = fWSgeo->GetRandom();
640 Float_t mu = fWSN->Eval(b);
641 p = 1.-TMath::Exp(-mu);
642 mult = 6000./fWSN->Eval(1.) * mu;
645 void AliFastGlauber::GetRandom(Int_t& bin, Bool_t& hard)
648 // Gives back a random impact parameter bin, and hard trigger decission
650 Float_t b = fWSgeo->GetRandom();
651 Float_t mu = fWSN->Eval(b) * fSigmaHard;
652 Float_t p = 1.-TMath::Exp(-mu);
655 } else if (b < 8.6) {
657 } else if (b < 11.2) {
659 } else if (b < 13.2) {
661 } else if (b < 15.0) {
669 Float_t r = gRandom->Rndm();
671 if (r < p) hard = kTRUE;
675 Float_t AliFastGlauber::GetRandomImpactParameter(Float_t bmin, Float_t bmax)
678 // Gives back a random impact parameter in the range bmin .. bmax
682 while(b < bmin || b > bmax)
683 b = fWSgeo->GetRandom();
687 Double_t AliFastGlauber::CrossSection(Double_t b1, Double_t b2)
690 // Return cross-section integrated from b1 to b2
693 return fWSgeo->Integral(b1, b2)/100.;
696 Double_t AliFastGlauber::FractionOfHardCrossSection(Double_t b1, Double_t b2)
699 // Return raction of hard cross-section integrated from b1 to b2
702 return fWSbinary->Integral(b1, b2)/fWSbinary->Integral(0., 100.);
706 Double_t AliFastGlauber::Binaries(Double_t b)
709 // Return number of binary collisions normalized to 1 at b=0
712 return fWSN->Eval(b)/fWSN->Eval(0.);