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 TF1* AliFastGlauber::fWStaa = NULL;
36 TF1* AliFastGlauber::fWSgeo = NULL;
37 TF1* AliFastGlauber::fWSbinary = NULL;
38 TF1* AliFastGlauber::fWSN = NULL;
39 Float_t AliFastGlauber::fbMax = 0.;
41 AliFastGlauber::AliFastGlauber()
43 // Default Constructor
46 SetWoodSaxonParameters(6.624, 0.549, 0.00, 7.69e-4);
47 SetHardCrossSection();
51 void AliFastGlauber::Init(Int_t mode)
57 fWSb = new TF1("WSb", WSb, 0, fbMax, 4);
58 fWSb->SetParameter(0, fWSr0);
59 fWSb->SetParameter(1, fWSd);
60 fWSb->SetParameter(2, fWSw);
61 fWSb->SetParameter(3, fWSn);
63 fWSbz = new TF2("WSbz", WSbz, 0, fbMax, 4);
64 fWSbz->SetParameter(0, fWSr0);
65 fWSbz->SetParameter(1, fWSd);
66 fWSbz->SetParameter(2, fWSw);
67 fWSbz->SetParameter(3, fWSn);
69 fWSz = new TF1("WSz", WSz, 0, fbMax, 5);
70 fWSz->SetParameter(0, fWSr0);
71 fWSz->SetParameter(1, fWSd);
72 fWSz->SetParameter(2, fWSw);
73 fWSz->SetParameter(3, fWSn);
78 fWSta = new TF1("WSta", WSta, 0., fbMax, 0);
83 fWStarfi = new TF2("WStarfi", WStarfi, 0., fbMax, 0., TMath::Pi(), 1);
84 fWStarfi->SetParameter(0, 0.);
85 fWStarfi->SetNpx(200);
91 fWStaa = new TF1("WStaa", WStaa, 0., fbMax, 0);
94 TFile* f = new TFile("$(ALICE_ROOT)/FASTSIM/data/glauberPbPb.root");
95 fWStaa = (TF1*) f->Get("WStaa");
99 // Geometrical Cross-Section
101 fWSgeo = new TF1("WSgeo", WSgeo, 0., fbMax, 0);
104 // Hard cross section (~ binary collisions)
106 fWSbinary = new TF1("WSbinary", WSbinary, 0., fbMax, 1);
107 fWSbinary->SetParameter(0, fSigmaHard); // mb
108 fWSbinary->SetNpx(100);
110 // Hard collisions per event
112 fWSN = new TF1("WSN", WSN, 0., fbMax, 1);
116 void AliFastGlauber::DrawWSb()
119 // Draw Wood-Saxon Nuclear Density Function
121 TCanvas *c1 = new TCanvas("c1","Wood Saxon",400,10,600,700);
126 void AliFastGlauber::DrawOverlap()
129 // Draw Overlap Function
131 TCanvas *c2 = new TCanvas("c2","Overlap",400,10,600,700);
136 void AliFastGlauber::DrawThickness()
139 // Draw Thickness Function
141 TCanvas *c3 = new TCanvas("c3","Thickness",400,10,600,700);
146 void AliFastGlauber::DrawGeo()
149 // Draw Geometrical Cross-Section
151 TCanvas *c3 = new TCanvas("c3","Geometrical Cross-Section",400,10,600,700);
156 void AliFastGlauber::DrawBinary()
159 // Draw Wood-Saxon Nuclear Density Function
161 TCanvas *c4 = new TCanvas("c4","Binary Cross-Section",400,10,600,700);
166 void AliFastGlauber::DrawN()
169 // Draw Binaries per event
171 TCanvas *c5 = new TCanvas("c5","Binaries per event",400,10,600,700);
176 void AliFastGlauber::DrawKernel()
181 TCanvas *c6 = new TCanvas("c6","Kernel",400,10,600,700);
186 Double_t AliFastGlauber::WSb(Double_t* x, Double_t* par)
189 // Woods-Saxon Parameterisation
190 // as a function of radius
193 Double_t r0 = par[0];
198 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
202 Double_t AliFastGlauber::WSbz(Double_t* x, Double_t* par)
205 // Wood Saxon Parameterisation
206 // as a function of z and b
210 Double_t r0 = par[0];
214 Double_t xx = TMath::Sqrt(bb*bb+zz*zz);
215 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
219 Double_t AliFastGlauber::WSz(Double_t* x, Double_t* par)
222 // Wood Saxon Parameterisation
223 // as a function of z for fixed b
225 Double_t bb = par[4];
227 Double_t r0 = par[0];
231 Double_t xx = TMath::Sqrt(bb*bb+zz*zz);
232 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
233 // if (y < 1.e-6) y = 0;
237 Double_t AliFastGlauber::WSta(Double_t* x, Double_t* /*par*/)
240 // Thickness function
243 fWSz->SetParameter(4, b);
244 Double_t y = 2. * fWSz->Integral(0., fbMax);
250 Double_t AliFastGlauber::WStarfi(Double_t* x, Double_t* par)
253 // Kernel for overlap function
258 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
259 Double_t y = r1 * fWSta->Eval(r1) * fWSta->Eval(r2);
264 Double_t AliFastGlauber::WStaa(Double_t* x, Double_t* /*par*/)
270 fWStarfi->SetParameter(0, b);
280 Double_t y = 2. * fWStarfi->IntegralMultiple(2, al, bl, 0.001, err);
281 printf("WStaa: %f %f %f\n", b, y, err);
287 for (Int_t i = 0; i < 100000; i++)
289 Double_t phi = TMath::Pi() * gRandom->Rndm();
290 Double_t b1 = fbMax * gRandom->Rndm();
291 y += fWStarfi->Eval(b1, phi);
293 y *= 2. * 0.1 * 208. * 208. * TMath::Pi() * fbMax / 100000.;
297 Double_t AliFastGlauber::WSgeo(Double_t* x, Double_t* /*par*/)
300 // Geometrical Cross-Section
303 Double_t taa = fWStaa->Eval(b);
304 const Double_t sigma = 55.6; // mbarn
306 Double_t y = 2. * TMath::Pi() * b * (1. - TMath::Exp(- sigma * taa)); // fm
311 Double_t AliFastGlauber::WSbinary(Double_t* x, Double_t* par)
314 // Number of binary collisions
317 Double_t sigma = par[0];
318 Double_t taa = fWStaa->Eval(b);
320 Double_t y = 2. * TMath::Pi() * b * sigma * taa; // fm
324 Double_t AliFastGlauber::WSN(Double_t* x, Double_t* /*par*/)
327 // Number of hard processes per event
330 Double_t y = fWSbinary->Eval(b)/fWSgeo->Eval(b);
334 void AliFastGlauber::SimulateTrigger(Int_t n)
339 TH1F* mbtH = new TH1F("mbtH", "MB Trigger b-Distribution", 100, 0., 20.);
340 TH1F* hdtH = new TH1F("hdtH", "Hard Trigger b-Distribution", 100, 0., 20.);
341 TH1F* mbmH = new TH1F("mbmH", "MB Trigger Multiplicity Distribution", 100, 0., 8000.);
342 TH1F* hdmH = new TH1F("hdmH", "Hard Trigger Multiplicity Distribution", 100, 0., 8000.);
344 mbtH->SetXTitle("b [fm]");
345 hdtH->SetXTitle("b [fm]");
346 mbmH->SetXTitle("Multiplicity");
347 hdmH->SetXTitle("Multiplicity");
349 TCanvas *c0 = new TCanvas("c0","Trigger Simulation",400,10,600,700);
351 TCanvas *c1 = new TCanvas("c1","Trigger Simulation",400,10,600,700);
357 for (Int_t iev = 0; iev < n; iev++)
360 GetRandom(b, p, mult);
363 mbmH->Fill(mult, 1.);
380 void AliFastGlauber::GetRandom(Float_t& b, Float_t& p, Float_t& mult)
383 // Gives back a random impact parameter, hard trigger probability and multiplicity
385 b = fWSgeo->GetRandom();
386 Float_t mu = fWSN->Eval(b);
387 p = 1.-TMath::Exp(-mu);
388 mult = 6000./fWSN->Eval(1.) * mu;
391 void AliFastGlauber::GetRandom(Int_t& bin, Bool_t& hard)
394 // Gives back a random impact parameter bin, and hard trigger decission
396 Float_t b = fWSgeo->GetRandom();
397 Float_t mu = fWSN->Eval(b) * fSigmaHard;
398 Float_t p = 1.-TMath::Exp(-mu);
401 } else if (b < 8.6) {
403 } else if (b < 11.2) {
405 } else if (b < 13.2) {
407 } else if (b < 15.0) {
415 Float_t r = gRandom->Rndm();
417 if (r < p) hard = kTRUE;
421 Float_t AliFastGlauber::GetRandomImpactParameter(Float_t bmin, Float_t bmax)
424 // Gives back a random impact parameter in the range bmin .. bmax
428 while(b < bmin || b > bmax)
429 b = fWSgeo->GetRandom();
433 Double_t AliFastGlauber::CrossSection(Double_t b1, Double_t b2)
436 // Return cross-section integrated from b1 to b2
439 return fWSgeo->Integral(b1, b2)/100.;
442 Double_t AliFastGlauber::FractionOfHardCrossSection(Double_t b1, Double_t b2)
445 // Return raction of hard cross-section integrated from b1 to b2
448 return fWSbinary->Integral(b1, b2)/fWSbinary->Integral(0., 100.);
452 Double_t AliFastGlauber::Binaries(Double_t b)
455 // Return number of binary collisions normalized to 1 at b=0
458 return fWSN->Eval(b)/fWSN->Eval(0.);