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 **************************************************************************/
18 Revision 1.3 2003/04/21 09:35:53 morsch
19 Protection against division by 0 in Binaries().
21 Revision 1.2 2003/04/14 14:23:44 morsch
22 Correction in Binaries().
24 Revision 1.1 2003/04/10 08:48:13 morsch
30 #include "AliFastGlauber.h"
39 ClassImp(AliFastGlauber)
41 TF1* AliFastGlauber::fWSb = NULL;
42 TF2* AliFastGlauber::fWSbz = NULL;
43 TF1* AliFastGlauber::fWSz = NULL;
44 TF1* AliFastGlauber::fWSta = NULL;
45 TF2* AliFastGlauber::fWStarfi = NULL;
46 TF1* AliFastGlauber::fWStaa = NULL;
47 TF1* AliFastGlauber::fWSgeo = NULL;
48 TF1* AliFastGlauber::fWSbinary = NULL;
49 TF1* AliFastGlauber::fWSN = NULL;
50 Float_t AliFastGlauber::fbMax = 0.;
52 AliFastGlauber::AliFastGlauber()
54 // Default Constructor
57 SetWoodSaxonParameters(6.624, 0.549, 0.00, 7.69e-4);
58 SetHardCrossSection();
62 void AliFastGlauber::Init(Int_t mode)
68 fWSb = new TF1("WSb", WSb, 0, fbMax, 4);
69 fWSb->SetParameter(0, fWSr0);
70 fWSb->SetParameter(1, fWSd);
71 fWSb->SetParameter(2, fWSw);
72 fWSb->SetParameter(3, fWSn);
74 fWSbz = new TF2("WSbz", WSbz, 0, fbMax, 4);
75 fWSbz->SetParameter(0, fWSr0);
76 fWSbz->SetParameter(1, fWSd);
77 fWSbz->SetParameter(2, fWSw);
78 fWSbz->SetParameter(3, fWSn);
80 fWSz = new TF1("WSz", WSz, 0, fbMax, 5);
81 fWSz->SetParameter(0, fWSr0);
82 fWSz->SetParameter(1, fWSd);
83 fWSz->SetParameter(2, fWSw);
84 fWSz->SetParameter(3, fWSn);
89 fWSta = new TF1("WSta", WSta, 0., fbMax, 0);
94 fWStarfi = new TF2("WStarfi", WStarfi, 0., fbMax, 0., TMath::Pi(), 1);
95 fWStarfi->SetParameter(0, 0.);
96 fWStarfi->SetNpx(200);
102 fWStaa = new TF1("WStaa", WStaa, 0., fbMax, 0);
105 TFile* f = new TFile("$(ALICE_ROOT)/FASTSIM/data/glauberPbPb.root");
106 fWStaa = (TF1*) f->Get("WStaa");
110 // Geometrical Cross-Section
112 fWSgeo = new TF1("WSgeo", WSgeo, 0., fbMax, 0);
115 // Hard cross section (~ binary collisions)
117 fWSbinary = new TF1("WSbinary", WSbinary, 0., fbMax, 1);
118 fWSbinary->SetParameter(0, fSigmaHard); // mb
119 fWSbinary->SetNpx(100);
121 // Hard collisions per event
123 fWSN = new TF1("WSN", WSN, 0., fbMax, 1);
127 void AliFastGlauber::DrawWSb()
130 // Draw Wood-Saxon Nuclear Density Function
132 TCanvas *c1 = new TCanvas("c1","Wood Saxon",400,10,600,700);
137 void AliFastGlauber::DrawOverlap()
140 // Draw Overlap Function
142 TCanvas *c2 = new TCanvas("c2","Overlap",400,10,600,700);
147 void AliFastGlauber::DrawThickness()
150 // Draw Thickness Function
152 TCanvas *c3 = new TCanvas("c3","Thickness",400,10,600,700);
157 void AliFastGlauber::DrawGeo()
160 // Draw Geometrical Cross-Section
162 TCanvas *c3 = new TCanvas("c3","Geometrical Cross-Section",400,10,600,700);
167 void AliFastGlauber::DrawBinary()
170 // Draw Wood-Saxon Nuclear Density Function
172 TCanvas *c4 = new TCanvas("c4","Binary Cross-Section",400,10,600,700);
177 void AliFastGlauber::DrawN()
180 // Draw Binaries per event
182 TCanvas *c5 = new TCanvas("c5","Binaries per event",400,10,600,700);
187 void AliFastGlauber::DrawKernel()
192 TCanvas *c6 = new TCanvas("c6","Kernel",400,10,600,700);
197 Double_t AliFastGlauber::WSb(Double_t* x, Double_t* par)
200 // Woods-Saxon Parameterisation
201 // as a function of radius
204 Double_t r0 = par[0];
209 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
213 Double_t AliFastGlauber::WSbz(Double_t* x, Double_t* par)
216 // Wood Saxon Parameterisation
217 // as a function of z and b
221 Double_t r0 = par[0];
225 Double_t xx = TMath::Sqrt(bb*bb+zz*zz);
226 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
230 Double_t AliFastGlauber::WSz(Double_t* x, Double_t* par)
233 // Wood Saxon Parameterisation
234 // as a function of z for fixed b
236 Double_t bb = par[4];
238 Double_t r0 = par[0];
242 Double_t xx = TMath::Sqrt(bb*bb+zz*zz);
243 Double_t y = n * (1.+w*(xx/r0)*(xx/r0))/(1.+TMath::Exp((xx-r0)/d));
244 // if (y < 1.e-6) y = 0;
248 Double_t AliFastGlauber::WSta(Double_t* x, Double_t* par)
251 // Thickness function
254 fWSz->SetParameter(4, b);
255 Double_t y = 2. * fWSz->Integral(0., fbMax);
261 Double_t AliFastGlauber::WStarfi(Double_t* x, Double_t* par)
264 // Kernel for overlap function
269 Double_t r2 = TMath::Sqrt(r1 * r1 + b * b - 2. * r1 * b * TMath::Cos(phi));
270 Double_t y = r1 * fWSta->Eval(r1) * fWSta->Eval(r2);
275 Double_t AliFastGlauber::WStaa(Double_t* x, Double_t* par)
281 fWStarfi->SetParameter(0, b);
291 Double_t y = 2. * fWStarfi->IntegralMultiple(2, al, bl, 0.001, err);
292 printf("WStaa: %f %f %f\n", b, y, err);
298 for (Int_t i = 0; i < 100000; i++)
300 Double_t phi = TMath::Pi() * gRandom->Rndm();
301 Double_t b1 = fbMax * gRandom->Rndm();
302 y += fWStarfi->Eval(b1, phi);
304 y *= 2. * 0.1 * 208. * 208. * TMath::Pi() * fbMax / 100000.;
308 Double_t AliFastGlauber::WSgeo(Double_t* x, Double_t* par)
311 // Geometrical Cross-Section
314 Double_t taa = fWStaa->Eval(b);
315 const Double_t sigma = 55.6; // mbarn
317 Double_t y = 2. * TMath::Pi() * b * (1. - TMath::Exp(- sigma * taa)); // fm
322 Double_t AliFastGlauber::WSbinary(Double_t* x, Double_t* par)
325 // Number of binary collisions
328 Double_t sigma = par[0];
329 Double_t taa = fWStaa->Eval(b);
331 Double_t y = 2. * TMath::Pi() * b * sigma * taa; // fm
335 Double_t AliFastGlauber::WSN(Double_t* x, Double_t* par)
338 // Number of hard processes per event
343 y = fWSbinary->Eval(b)/fWSgeo->Eval(b);
345 y = fWSbinary->Eval(1.e-4)/fWSgeo->Eval(1.e-4);
350 void AliFastGlauber::SimulateTrigger(Int_t n)
355 TH1F* mbtH = new TH1F("mbtH", "MB Trigger b-Distribution", 100, 0., 20.);
356 TH1F* hdtH = new TH1F("hdtH", "Hard Trigger b-Distribution", 100, 0., 20.);
357 TH1F* mbmH = new TH1F("mbmH", "MB Trigger Multiplicity Distribution", 100, 0., 8000.);
358 TH1F* hdmH = new TH1F("hdmH", "Hard Trigger Multiplicity Distribution", 100, 0., 8000.);
360 mbtH->SetXTitle("b [fm]");
361 hdtH->SetXTitle("b [fm]");
362 mbmH->SetXTitle("Multiplicity");
363 hdmH->SetXTitle("Multiplicity");
365 TCanvas *c0 = new TCanvas("c0","Trigger Simulation",400,10,600,700);
367 TCanvas *c1 = new TCanvas("c1","Trigger Simulation",400,10,600,700);
373 for (Int_t iev = 0; iev < n; iev++)
376 GetRandom(b, p, mult);
379 mbmH->Fill(mult, 1.);
396 void AliFastGlauber::GetRandom(Float_t& b, Float_t& p, Float_t& mult)
399 // Gives back a random impact parameter, hard trigger probability and multiplicity
401 b = fWSgeo->GetRandom();
402 Float_t mu = fWSN->Eval(b);
403 p = 1.-TMath::Exp(-mu);
404 mult = 6000./fWSN->Eval(0.) * mu;
407 void AliFastGlauber::GetRandom(Int_t& bin, Bool_t& hard)
410 // Gives back a random impact parameter bin, and hard trigger decission
412 Float_t b = fWSgeo->GetRandom();
413 Float_t mu = fWSN->Eval(b) * fSigmaHard;
414 Float_t p = 1.-TMath::Exp(-mu);
417 } else if (b < 8.6) {
419 } else if (b < 11.2) {
421 } else if (b < 13.2) {
429 Float_t r = gRandom->Rndm();
431 if (r < p) hard = kTRUE;
435 Float_t AliFastGlauber::GetRandomImpactParameter(Float_t bmin, Float_t bmax)
438 // Gives back a random impact parameter in the range bmin .. bmax
442 while(b < bmin || b > bmax)
443 b = fWSgeo->GetRandom();
447 Double_t AliFastGlauber::CrossSection(Double_t b1, Double_t b2)
450 // Return cross-section integrated from b1 to b2
453 return fWSgeo->Integral(b1, b2)/100.;
456 Double_t AliFastGlauber::FractionOfHardCrossSection(Double_t b1, Double_t b2)
459 // Return raction of hard cross-section integrated from b1 to b2
462 return fWSbinary->Integral(b1, b2)/fWSbinary->Integral(0., 100.);
466 Double_t AliFastGlauber::Binaries(Double_t b)
469 // Return number of binary collisions normalized to 1 at b=0
472 return fWSN->Eval(b)/fWSN->Eval(0.);