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(), 2);
103 fWPathLength0->SetParameter(0, 0.);
104 // Pathlength definition
105 fWPathLength0->SetParameter(1, 0.);
107 fWPathLength = new TF1("WPathLength", WPathLength, -TMath::Pi(), TMath::Pi(), 3);
109 fWPathLength->SetParameter(0, 0.);
110 // Number of interactions used for average
111 fWPathLength->SetParameter(1, 1000.);
112 // Pathlength definition
113 fWPathLength->SetParameter(2, 0);
115 fWIntRadius = new TF1("WIntRadius", WIntRadius, 0., fbMax, 1);
116 fWIntRadius->SetParameter(0, 0.);
123 fWStaa = new TF1("WStaa", WStaa, 0., fbMax, 0);
126 TFile* f = new TFile("$(ALICE_ROOT)/FASTSIM/data/glauberPbPb.root");
127 fWStaa = (TF1*) f->Get("WStaa");
131 fWEnergyDensity = new TF1("WEnergyDensity", WEnergyDensity, 0., 2. * fWSr0, 1);
132 fWEnergyDensity->SetParameter(0, fWSr0 + 1.);
135 // Geometrical Cross-Section
137 fWSgeo = new TF1("WSgeo", WSgeo, 0., fbMax, 0);
140 // Hard cross section (~ binary collisions)
142 fWSbinary = new TF1("WSbinary", WSbinary, 0., fbMax, 1);
143 fWSbinary->SetParameter(0, fSigmaHard); // mb
144 fWSbinary->SetNpx(100);
146 // Hard collisions per event
148 fWSN = new TF1("WSN", WSN, 0., fbMax, 1);
152 void AliFastGlauber::DrawWSb()
155 // Draw Wood-Saxon Nuclear Density Function
157 TCanvas *c1 = new TCanvas("c1","Wood Saxon",400,10,600,700);
162 void AliFastGlauber::DrawOverlap()
165 // Draw Overlap Function
167 TCanvas *c2 = new TCanvas("c2","Overlap",400,10,600,700);
172 void AliFastGlauber::DrawThickness()
175 // Draw Thickness Function
177 TCanvas *c3 = new TCanvas("c3","Thickness",400,10,600,700);
182 void AliFastGlauber::DrawGeo()
185 // Draw Geometrical Cross-Section
187 TCanvas *c3 = new TCanvas("c3","Geometrical Cross-Section",400,10,600,700);
192 void AliFastGlauber::DrawBinary()
195 // Draw Wood-Saxon Nuclear Density Function
197 TCanvas *c4 = new TCanvas("c4","Binary Cross-Section",400,10,600,700);
202 void AliFastGlauber::DrawN()
205 // Draw Binaries per event
207 TCanvas *c5 = new TCanvas("c5","Binaries per event",400,10,600,700);
212 void AliFastGlauber::DrawKernel(Double_t b)
217 TCanvas *c6 = new TCanvas("c6","Kernel",400,10,600,700);
219 fWStarfi->SetParameter(0, b);
223 void AliFastGlauber::DrawAlmond(Double_t b)
226 // Draw Interaction Almond
228 TCanvas *c7 = new TCanvas("c7","Almond",400,10,600,700);
230 fWAlmond->SetParameter(0, b);
234 void AliFastGlauber::DrawPathLength0(Double_t b, Int_t iopt)
239 TCanvas *c8 = new TCanvas("c8","Path Length",400,10,600,700);
241 fWPathLength0->SetParameter(0, b);
242 fWPathLength0->SetParameter(1, Double_t(iopt));
243 fWPathLength0->SetMinimum(0.);
244 fWPathLength0->SetMaximum(10.);
245 fWPathLength0->Draw();
248 void AliFastGlauber::DrawPathLength(Double_t b , Int_t ni, Int_t iopt)
253 TCanvas *c9 = new TCanvas("c9","Path Length",400,10,600,700);
255 fWAlmond->SetParameter(0, b);
257 fWPathLength->SetParameter(0, b);
258 fWPathLength->SetParameter(1, Double_t (ni));
259 fWPathLength->SetParameter(2, Double_t (iopt));
260 fWPathLength->SetMinimum(0.);
261 fWPathLength->SetMaximum(10.);
262 fWPathLength->Draw();
265 void AliFastGlauber::DrawIntRadius(Double_t b)
268 // Draw Interaction Radius
270 TCanvas *c10 = new TCanvas("c10","Interaction Radius",400,10,600,700);
272 fWIntRadius->SetParameter(0, b);
273 fWIntRadius->SetMinimum(0.);
277 void AliFastGlauber::DrawEnergyDensity()
280 // Draw energy density
282 TCanvas *c11 = new TCanvas("c11","Energy Density",400, 10, 600, 700);
284 fWEnergyDensity->SetMinimum(0.);
285 fWEnergyDensity->Draw();
288 Double_t AliFastGlauber::WSb(Double_t* x, Double_t* par)
291 // Woods-Saxon Parameterisation
292 // as a function of radius
295 Double_t r0 = par[0];
300 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
305 Double_t AliFastGlauber::WSbz(Double_t* x, Double_t* par)
308 // Wood Saxon Parameterisation
309 // as a function of z and b
313 Double_t r0 = par[0];
317 Double_t xx = TMath::Sqrt(bb*bb+zz*zz);
318 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
323 Double_t AliFastGlauber::WSz(Double_t* x, Double_t* par)
326 // Wood Saxon Parameterisation
327 // as a function of z for fixed b
329 Double_t bb = par[4];
331 Double_t r0 = par[0];
335 Double_t xx = TMath::Sqrt(bb*bb+zz*zz);
336 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
341 Double_t AliFastGlauber::WSta(Double_t* x, Double_t* /*par*/)
344 // Thickness function
347 fWSz->SetParameter(4, b);
348 Double_t y = 2. * fWSz->Integral(0., fbMax);
354 Double_t AliFastGlauber::WStarfi(Double_t* x, Double_t* par)
357 // Kernel for overlap function
362 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
363 Double_t y = r1 * fWSta->Eval(r1) * fWSta->Eval(r2);
368 Double_t AliFastGlauber::WAlmond(Double_t* x, Double_t* par)
371 // Almond shaped interaction region
374 Double_t xx = x[0] + b/2.;
376 Double_t r1 = TMath::Sqrt(xx * xx + yy * yy);
377 Double_t phi = TMath::ATan2(yy,xx);
379 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
381 // Interaction probability calculated as product of thicknesses
383 Double_t y = fWSta->Eval(r1) * fWSta->Eval(r2);
387 Double_t AliFastGlauber::WIntRadius(Double_t* x, Double_t* par)
390 // Average radius at which interaction takes place
392 // Radius in the Almond
396 fWAlmond->SetParameter(0, b);
398 Double_t dphi = 2. * TMath::Pi() / 100.;
403 for (Int_t i = 0; i < 100; i++) {
404 Double_t xx = r * TMath::Cos(phi);
405 Double_t yy = r * TMath::Sin(phi);
406 y += fWAlmond->Eval(xx,yy);
409 // Result multiplied by Jacobian (2 pi r)
410 return (2. * TMath::Pi() * y * r / 100.);
413 Double_t AliFastGlauber::WPathLength0(Double_t* x, Double_t* par)
416 // Path Length as a function of phi for interaction point fixed at (0,0)
420 const Int_t np = 100;
421 const Double_t dr = fbMax/Double_t(np);
424 // Path Length definition
425 Int_t iopt = Int_t(par[1]);
427 // Phi direction in Almond
428 Double_t phi0 = x[0];
432 // Step along radial direction phi
433 for (Int_t i = 0; i < np; i++) {
435 // Transform into target frame
437 Double_t xx = r * TMath::Cos(phi0) + b / 2.;
438 Double_t yy = r * TMath::Sin(phi0);
439 Double_t phi = TMath::ATan2(yy, xx);
441 Double_t r1 = TMath::Sqrt(xx * xx + yy * yy);
442 // Radius in projectile frame
443 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
444 Double_t y = fWSta->Eval(r1) * fWSta->Eval(r2);
451 // My length definition (is exact for hard disk)
453 return (2. * rw / w);
455 return TMath::Sqrt(2. * rw * dr / fWSta->Eval(0.01) / fWSta->Eval(0.01));
459 Double_t AliFastGlauber::WPathLength(Double_t* x, Double_t* par)
462 // Path Length as a function of phi
463 // Interaction point from random distribution
468 const Int_t np = 100;
469 const Double_t dr = fbMax/Double_t(np);
470 // Number of interactions
471 const Int_t npi = Int_t (par[1]);
476 // Path Length definition
477 Int_t iopt = Int_t(par[2]);
479 Double_t phi0 = x[0];
481 printf("phi0 %f \n", phi0);
486 for (Int_t in = 0; in < npi; in ++) {
492 fWAlmond->GetRandom2(x0, y0);
494 Double_t r0 = TMath::Sqrt(x0 * x0 + y0 * y0);
495 Int_t nps = Int_t ((fbMax - r0)/dr) - 1;
499 for (Int_t i = 0; (i < nps ); i++) {
501 // Transform into target frame
502 Double_t xx = x0 + r * TMath::Cos(phi0) + b / 2.;
503 Double_t yy = y0 + r * TMath::Sin(phi0);
504 Double_t phi = TMath::ATan2(yy, xx);
505 Double_t r1 = TMath::Sqrt(xx * xx + yy * yy);
506 // Radius in projectile frame
507 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
508 Double_t y = fWSta->Eval(r1) * fWSta->Eval(r2);
514 // Average over interactions
518 l+= 2. * rw * dr / fWSta->Eval(0.01) / fWSta->Eval(0.01);
522 return (l / Double_t(npi));
524 return (TMath::Sqrt(l / Double_t(npi)));
527 Double_t AliFastGlauber::WStaa(Double_t* x, Double_t* /*par*/)
533 fWStarfi->SetParameter(0, b);
543 Double_t y = 2. * fWStarfi->IntegralMultiple(2, al, bl, 0.001, err);
544 printf("WStaa: %f %f %f\n", b, y, err);
550 for (Int_t i = 0; i < 100000; i++)
552 Double_t phi = TMath::Pi() * gRandom->Rndm();
553 Double_t b1 = fbMax * gRandom->Rndm();
554 y += fWStarfi->Eval(b1, phi);
556 y *= 2. * 0.1 * 208. * 208. * TMath::Pi() * fbMax / 100000.;
560 Double_t AliFastGlauber::WSgeo(Double_t* x, Double_t* /*par*/)
563 // Geometrical Cross-Section
566 Double_t taa = fWStaa->Eval(b);
567 const Double_t sigma = 55.6; // mbarn
569 Double_t y = 2. * TMath::Pi() * b * (1. - TMath::Exp(- sigma * taa)); // fm
574 Double_t AliFastGlauber::WSbinary(Double_t* x, Double_t* par)
577 // Number of binary collisions
580 Double_t sigma = par[0];
581 Double_t taa = fWStaa->Eval(b);
583 Double_t y = 2. * TMath::Pi() * b * sigma * taa; // fm
587 Double_t AliFastGlauber::WSN(Double_t* x, Double_t* /*par*/)
590 // Number of hard processes per event
593 Double_t y = fWSbinary->Eval(b)/fWSgeo->Eval(b);
597 Double_t AliFastGlauber::WEnergyDensity(Double_t* x, Double_t* par)
600 // Initial energy density as a function of the impact parameter
603 Double_t rA = par[0];
605 // Attention: area of transverse reaction zone in hard-sphere approximation !
606 Double_t saa = (TMath::Pi() - 2. * TMath::ASin(b/ 2./ rA)) * rA * rA
607 - b * TMath::Sqrt(rA * rA - b * b/ 4.);
608 Double_t taa = fWStaa->Eval(b);
613 void AliFastGlauber::SimulateTrigger(Int_t n)
618 TH1F* mbtH = new TH1F("mbtH", "MB Trigger b-Distribution", 100, 0., 20.);
619 TH1F* hdtH = new TH1F("hdtH", "Hard Trigger b-Distribution", 100, 0., 20.);
620 TH1F* mbmH = new TH1F("mbmH", "MB Trigger Multiplicity Distribution", 100, 0., 8000.);
621 TH1F* hdmH = new TH1F("hdmH", "Hard Trigger Multiplicity Distribution", 100, 0., 8000.);
623 mbtH->SetXTitle("b [fm]");
624 hdtH->SetXTitle("b [fm]");
625 mbmH->SetXTitle("Multiplicity");
626 hdmH->SetXTitle("Multiplicity");
628 TCanvas *c0 = new TCanvas("c0","Trigger Simulation",400,10,600,700);
630 TCanvas *c1 = new TCanvas("c1","Trigger Simulation",400,10,600,700);
636 for (Int_t iev = 0; iev < n; iev++)
639 GetRandom(b, p, mult);
642 mbmH->Fill(mult, 1.);
659 void AliFastGlauber::GetRandom(Float_t& b, Float_t& p, Float_t& mult)
662 // Gives back a random impact parameter, hard trigger probability and multiplicity
664 b = fWSgeo->GetRandom();
665 Float_t mu = fWSN->Eval(b);
666 p = 1.-TMath::Exp(-mu);
667 mult = 6000./fWSN->Eval(1.) * mu;
670 void AliFastGlauber::GetRandom(Int_t& bin, Bool_t& hard)
673 // Gives back a random impact parameter bin, and hard trigger decission
675 Float_t b = fWSgeo->GetRandom();
676 Float_t mu = fWSN->Eval(b) * fSigmaHard;
677 Float_t p = 1.-TMath::Exp(-mu);
680 } else if (b < 8.6) {
682 } else if (b < 11.2) {
684 } else if (b < 13.2) {
686 } else if (b < 15.0) {
694 Float_t r = gRandom->Rndm();
696 if (r < p) hard = kTRUE;
700 Float_t AliFastGlauber::GetRandomImpactParameter(Float_t bmin, Float_t bmax)
703 // Gives back a random impact parameter in the range bmin .. bmax
707 while(b < bmin || b > bmax)
708 b = fWSgeo->GetRandom();
712 Double_t AliFastGlauber::CrossSection(Double_t b1, Double_t b2)
715 // Return cross-section integrated from b1 to b2
718 return fWSgeo->Integral(b1, b2)/100.;
721 Double_t AliFastGlauber::FractionOfHardCrossSection(Double_t b1, Double_t b2)
724 // Return raction of hard cross-section integrated from b1 to b2
727 return fWSbinary->Integral(b1, b2)/fWSbinary->Integral(0., 100.);
731 Double_t AliFastGlauber::Binaries(Double_t b)
734 // Return number of binary collisions normalized to 1 at b=0
737 return fWSN->Eval(b)/fWSN->Eval(0.001);