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 // Utility class to make simple Glauber type calculations
19 // for SYMMETRIC collision geometries (AA):
20 // Impact parameter, production points, reaction plane dependence
22 // The SimulateTrigger method can be used for simple MB and hard-process
23 // (binary scaling) trigger studies.
25 // Some basic quantities can be visualized directly.
27 // The default set-up for PbPb or AUAu collisions can be read from a file
28 // calling Init(1) or Init(2) if you want to read Almonds too.
30 // ***** If you change settings dont forget to call init afterwards, *****
31 // ***** in order to update the formulas with the new parameters. *****
33 // Author: andreas.morsch@cern.ch
34 //=================== Added by A. Dainese 11/02/04 ===========================
35 // Calculate path length for a parton with production point (x0,y0)
36 // and propagation direction (ux=cos(phi0),uy=sin(phi0))
37 // in a collision with impact parameter b and functions that make use
39 //=================== Added by A. Dainese 05/03/04 ===========================
40 // Calculation of line integrals I0 and I1
41 // integral0 = \int_0^ellCut dl*(T_A*T_B)(x0+l*ux,y0+l*uy)
42 // integral1 = \int_0^ellCut dl*l*(T_A*T_B)(x0+l*ux,y0+l*uy)
43 // mostly for use in the Quenching class
44 //=================== Added by C. Loizdes 27/03/04 ===========================
45 // Handling of AuAu collisions
46 // More get/set functions
47 // Comments, units and clearing of code
51 #include "AliFastGlauber.h"
53 #include <Riostream.h>
66 ClassImp(AliFastGlauber)
68 Float_t AliFastGlauber::fgBMax = 0.;
69 TF1* AliFastGlauber::fgWSb = NULL;
70 TF2* AliFastGlauber::fgWSbz = NULL;
71 TF1* AliFastGlauber::fgWSz = NULL;
72 TF1* AliFastGlauber::fgWSta = NULL;
73 TF2* AliFastGlauber::fgWStarfi = NULL;
74 TF2* AliFastGlauber::fgWAlmond = NULL;
75 TF1* AliFastGlauber::fgWStaa = NULL;
76 TF1* AliFastGlauber::fgWSgeo = NULL;
77 TF1* AliFastGlauber::fgWSbinary = NULL;
78 TF1* AliFastGlauber::fgWSN = NULL;
79 TF1* AliFastGlauber::fgWPathLength0 = NULL;
80 TF1* AliFastGlauber::fgWPathLength = NULL;
81 TF1* AliFastGlauber::fgWEnergyDensity = NULL;
82 TF1* AliFastGlauber::fgWIntRadius = NULL;
83 TF2* AliFastGlauber::fgWKParticipants = NULL;
84 TF1* AliFastGlauber::fgWParticipants = NULL;
85 TF2* AliFastGlauber::fgWAlmondCurrent = NULL;
86 TF2* AliFastGlauber::fgWAlmondFixedB[40];
87 const Int_t AliFastGlauber::fgkMCInts = 100000;
88 AliFastGlauber* AliFastGlauber::fgGlauber = NULL;
91 AliFastGlauber::AliFastGlauber():
104 // Default Constructor
107 SetLengthDefinition();
111 AliFastGlauber::AliFastGlauber(const AliFastGlauber & gl)
129 AliFastGlauber* AliFastGlauber::Instance()
131 // Set random number generator
135 fgGlauber = new AliFastGlauber();
140 AliFastGlauber::~AliFastGlauber()
143 for(Int_t k=0; k<40; k++) delete fgWAlmondFixedB[k];
146 void AliFastGlauber::SetAuAuRhic()
148 //Set all parameters for RHIC
149 SetWoodSaxonParametersAu();
150 SetHardCrossSection();
151 SetNNCrossSection(42);
153 SetFileName("$(ALICE_ROOT)/FASTSIM/data/glauberAuAu.root");
156 void AliFastGlauber::SetPbPbLHC()
158 //Set all parameters for LHC
159 SetWoodSaxonParametersPb();
160 SetHardCrossSection();
166 void AliFastGlauber::Init(Int_t mode)
169 // mode = 0; all functions are calculated
170 // mode = 1; overlap function is read from file (for Pb-Pb only)
171 // mode = 2; interaction almond functions are read from file
172 // USE THIS FOR PATH LENGTH CALC.!
182 fgWSb = new TF1("WSb", WSb, 0, fgBMax, 4);
183 fgWSb->SetParameter(0, fWSr0);
184 fgWSb->SetParameter(1, fWSd);
185 fgWSb->SetParameter(2, fWSw);
186 fgWSb->SetParameter(3, fWSn);
188 fgWSbz = new TF2("WSbz", WSbz, 0, fgBMax, 0, fgBMax, 4);
189 fgWSbz->SetParameter(0, fWSr0);
190 fgWSbz->SetParameter(1, fWSd);
191 fgWSbz->SetParameter(2, fWSw);
192 fgWSbz->SetParameter(3, fWSn);
194 fgWSz = new TF1("WSz", WSz, 0, fgBMax, 5);
195 fgWSz->SetParameter(0, fWSr0);
196 fgWSz->SetParameter(1, fWSd);
197 fgWSz->SetParameter(2, fWSw);
198 fgWSz->SetParameter(3, fWSn);
203 fgWSta = new TF1("WSta", WSta, 0., fgBMax, 0);
208 fgWStarfi = new TF2("WStarfi", WStarfi, 0., fgBMax, 0., TMath::Pi(), 1);
209 fgWStarfi->SetParameter(0, 0.);
210 fgWStarfi->SetNpx(200);
211 fgWStarfi->SetNpy(20);
214 // Participants Kernel
216 fgWKParticipants = new TF2("WKParticipants", WKParticipants, 0., fgBMax, 0., TMath::Pi(), 3);
217 fgWKParticipants->SetParameter(0, 0.);
218 fgWKParticipants->SetParameter(1, fSigmaNN);
219 fgWKParticipants->SetParameter(2, fA);
220 fgWKParticipants->SetNpx(200);
221 fgWKParticipants->SetNpy(20);
224 // Overlap and Participants
227 fgWStaa = new TF1("WStaa", WStaa, 0., fgBMax, 1);
228 fgWStaa->SetNpx(100);
229 fgWStaa->SetParameter(0,fA);
230 fgWStaa->SetNpx(100);
231 fgWParticipants = new TF1("WParticipants", WParticipants, 0., fgBMax, 2);
232 fgWParticipants->SetParameter(0, fSigmaNN);
233 fgWParticipants->SetParameter(1, fA);
234 fgWParticipants->SetNpx(100);
236 Info("Init","Reading overlap function from file %s",fName.Data());
237 TFile* f = new TFile(fName.Data());
239 Fatal("Init", "Could not open file %s",fName.Data());
241 fgWStaa = (TF1*) f->Get("WStaa");
242 fgWParticipants = (TF1*) f->Get("WParticipants");
249 fgWEnergyDensity = new TF1("WEnergyDensity", WEnergyDensity, 0., 2. * fWSr0, 1);
250 fgWEnergyDensity->SetParameter(0, fWSr0 + 1.);
253 // Geometrical Cross-Section
255 fgWSgeo = new TF1("WSgeo", WSgeo, 0., fgBMax, 1);
256 fgWSgeo->SetParameter(0,fSigmaNN); //mbarn
257 fgWSgeo->SetNpx(100);
260 // Hard cross section (binary collisions)
262 fgWSbinary = new TF1("WSbinary", WSbinary, 0., fgBMax, 1);
263 fgWSbinary->SetParameter(0, fSigmaHard); //mbarn
264 fgWSbinary->SetNpx(100);
267 // Hard collisions per event
269 fgWSN = new TF1("WSN", WSN, 0., fgBMax, 1);
273 // Almond shaped interaction region
275 fgWAlmond = new TF2("WAlmond", WAlmond, -fgBMax, fgBMax, -fgBMax, fgBMax, 1);
276 fgWAlmond->SetParameter(0, 0.);
277 fgWAlmond->SetNpx(200);
278 fgWAlmond->SetNpy(200);
281 Info("Init","Reading interaction almonds from file: %s",fName.Data());
282 Char_t almondName[100];
283 TFile* ff = new TFile(fName.Data());
284 for(Int_t k=0; k<40; k++) {
285 sprintf(almondName,"WAlmondFixedB%d",k);
286 fgWAlmondCurrent = (TF2*)ff->Get(almondName);
287 fgWAlmondFixedB[k] = fgWAlmondCurrent;
292 fgWIntRadius = new TF1("WIntRadius", WIntRadius, 0., fgBMax, 1);
293 fgWIntRadius->SetParameter(0, 0.);
296 // Path Length as a function of Phi
298 fgWPathLength0 = new TF1("WPathLength0", WPathLength0, -TMath::Pi(), TMath::Pi(), 2);
299 fgWPathLength0->SetParameter(0, 0.);
300 fgWPathLength0->SetParameter(1, 0.); //Pathlength definition
302 fgWPathLength = new TF1("WPathLength", WPathLength, -TMath::Pi(), TMath::Pi(), 3);
303 fgWPathLength->SetParameter(0, 0.); //Impact Parameter
304 fgWPathLength->SetParameter(1, 1000.); //Number of interactions used for average
305 fgWPathLength->SetParameter(2, 0); //Pathlength definition
308 void AliFastGlauber::Reset() const
311 // Reset dynamic allocated formulas
312 // in case init is called twice
314 if(fgWSb) delete fgWSb;
315 if(fgWSbz) delete fgWSbz;
316 if(fgWSz) delete fgWSz;
317 if(fgWSta) delete fgWSta;
318 if(fgWStarfi) delete fgWStarfi;
319 if(fgWAlmond) delete fgWAlmond;
320 if(fgWStaa) delete fgWStaa;
321 if(fgWSgeo) delete fgWSgeo;
322 if(fgWSbinary) delete fgWSbinary;
323 if(fgWSN) delete fgWSN;
324 if(fgWPathLength0) delete fgWPathLength0;
325 if(fgWPathLength) delete fgWPathLength;
326 if(fgWEnergyDensity) delete fgWEnergyDensity;
327 if(fgWIntRadius) delete fgWIntRadius;
328 if(fgWKParticipants) delete fgWKParticipants;
329 if(fgWParticipants) delete fgWParticipants;
332 void AliFastGlauber::DrawWSb() const
335 // Draw Wood-Saxon Nuclear Density Function
337 TCanvas *c1 = new TCanvas("c1","Wood Saxon",400,10,600,700);
339 Double_t max=fgWSb->GetMaximum(0,fgBMax)*1.01;
340 TH2F *h2f=new TH2F("h2fwsb","Wood Saxon: #rho(r) = n (1-#omega(r/r_{0})^2)/(1+exp((r-r_{0})/d)) [fm^{-3}]",2,0,fgBMax,2,0,max);
342 h2f->GetXaxis()->SetTitle("r [fm]");
343 h2f->GetYaxis()->SetNoExponent(kTRUE);
344 h2f->GetYaxis()->SetTitle("#rho [fm^{-3}]");
347 TLegend *l1a = new TLegend(0.45,0.6,.90,0.8);
348 l1a->SetFillStyle(0);
349 l1a->SetBorderSize(0);
351 sprintf(label,"r_{0} = %.2f fm",fWSr0);
352 l1a->AddEntry(fgWSb,label,"");
353 sprintf(label,"d = %.2f fm",fWSd);
354 l1a->AddEntry(fgWSb,label,"");
355 sprintf(label,"n = %.2e fm^{-3}",fWSn);
356 l1a->AddEntry(fgWSb,label,"");
357 sprintf(label,"#omega = %.2f",fWSw);
358 l1a->AddEntry(fgWSb,label,"");
363 void AliFastGlauber::DrawOverlap() const
366 // Draw Overlap Function
368 TCanvas *c2 = new TCanvas("c2","Overlap",400,10,600,700);
370 Double_t max=fgWStaa->GetMaximum(0,fgBMax)*1.01;
371 TH2F *h2f=new TH2F("h2ftaa","Overlap function: T_{AB} [mbarn^{-1}]",2,0,fgBMax,2,0, max);
373 h2f->GetXaxis()->SetTitle("b [fm]");
374 h2f->GetYaxis()->SetTitle("T_{AB} [mbarn^{-1}]");
376 fgWStaa->Draw("same");
379 void AliFastGlauber::DrawParticipants() const
382 // Draw Number of Participants Npart
384 TCanvas *c3 = new TCanvas("c3","Participants",400,10,600,700);
386 Double_t max=fgWParticipants->GetMaximum(0,fgBMax)*1.01;
387 TH2F *h2f=new TH2F("h2fpart","Number of Participants",2,0,fgBMax,2,0,max);
389 h2f->GetXaxis()->SetTitle("b [fm]");
390 h2f->GetYaxis()->SetTitle("N_{part}");
392 fgWParticipants->Draw("same");
393 TLegend *l1a = new TLegend(0.50,0.75,.90,0.9);
394 l1a->SetFillStyle(0);
395 l1a->SetBorderSize(0);
397 sprintf(label,"#sigma^{inel.}_{NN} = %.1f mbarn",fSigmaNN);
398 l1a->AddEntry(fgWParticipants,label,"");
403 void AliFastGlauber::DrawThickness() const
406 // Draw Thickness Function
408 TCanvas *c4 = new TCanvas("c4","Thickness",400,10,600,700);
410 Double_t max=fgWSta->GetMaximum(0,fgBMax)*1.01;
411 TH2F *h2f=new TH2F("h2fta","Thickness function: T_{A} [fm^{-2}]",2,0,fgBMax,2,0,max);
413 h2f->GetXaxis()->SetTitle("b [fm]");
414 h2f->GetYaxis()->SetTitle("T_{A} [fm^{-2}]");
416 fgWSta->Draw("same");
419 void AliFastGlauber::DrawGeo() const
422 // Draw Geometrical Cross-Section
424 TCanvas *c5 = new TCanvas("c5","Geometrical Cross-Section",400,10,600,700);
426 Double_t max=fgWSgeo->GetMaximum(0,fgBMax)*1.01;
427 TH2F *h2f=new TH2F("h2fgeo","Differential Geometrical Cross-Section: d#sigma^{geo}_{AB}/db [fm]",2,0,fgBMax,2,0,max);
429 h2f->GetXaxis()->SetTitle("b [fm]");
430 h2f->GetYaxis()->SetTitle("d#sigma^{geo}_{AB}/db [fm]");
432 fgWSgeo->Draw("same");
433 TLegend *l1a = new TLegend(0.10,0.8,.40,0.9);
434 l1a->SetFillStyle(0);
435 l1a->SetBorderSize(0);
437 sprintf(label,"#sigma_{NN}^{inel.} = %.1f mbarn",fSigmaNN);
438 l1a->AddEntry(fgWSgeo,label,"");
443 void AliFastGlauber::DrawBinary() const
446 // Draw Binary Cross-Section
448 TCanvas *c6 = new TCanvas("c6","Binary Cross-Section",400,10,600,700);
450 Double_t max=fgWSbinary->GetMaximum(0,fgBMax)*1.01;
451 TH2F *h2f=new TH2F("h2fbinary","Differential Binary Cross-Section: #sigma^{hard}_{NN} dT_{AB}/db [fm]",2,0,fgBMax,2,0,max);
453 h2f->GetXaxis()->SetTitle("b [fm]");
454 h2f->GetYaxis()->SetTitle("d#sigma^{hard}_{AB}/db [fm]");
456 fgWSbinary->Draw("same");
457 TLegend *l1a = new TLegend(0.50,0.8,.90,0.9);
458 l1a->SetFillStyle(0);
459 l1a->SetBorderSize(0);
461 sprintf(label,"#sigma_{NN}^{hard} = %.1f mbarn",fSigmaHard);
462 l1a->AddEntry(fgWSb,label,"");
467 void AliFastGlauber::DrawN() const
470 // Draw Binaries per event (Ncoll)
472 TCanvas *c7 = new TCanvas("c7","Binaries per event",400,10,600,700);
474 Double_t max=fgWSN->GetMaximum(0,fgBMax)*1.01;
475 TH2F *h2f=new TH2F("h2fhardcols","Number of hard collisions: T_{AB} #sigma^{hard}_{NN}/#sigma_{AB}^{geo}",2,0,fgBMax,2,0,max);
477 h2f->GetXaxis()->SetTitle("b [fm]");
478 h2f->GetYaxis()->SetTitle("N_{coll}");
481 TLegend *l1a = new TLegend(0.50,0.75,.90,0.9);
482 l1a->SetFillStyle(0);
483 l1a->SetBorderSize(0);
485 sprintf(label,"#sigma^{hard}_{NN} = %.1f mbarn",fSigmaHard);
486 l1a->AddEntry(fgWSN,label,"");
487 sprintf(label,"#sigma^{inel.}_{NN} = %.1f mbarn",fSigmaNN);
488 l1a->AddEntry(fgWSN,label,"");
493 void AliFastGlauber::DrawKernel(Double_t b) const
498 TCanvas *c8 = new TCanvas("c8","Kernel",400,10,600,700);
500 fgWStarfi->SetParameter(0, b);
501 TH2F *h2f=new TH2F("h2fkernel","Kernel of Overlap function: d^{2}T_{AB}/dr/d#phi [fm^{-3}]",2,0,fgBMax,2,0,TMath::Pi());
503 h2f->GetXaxis()->SetTitle("r [fm]");
504 h2f->GetYaxis()->SetTitle("#phi [rad]");
506 fgWStarfi->Draw("same");
507 TLegend *l1a = new TLegend(0.65,0.8,.90,0.9);
508 l1a->SetFillStyle(0);
509 l1a->SetBorderSize(0);
511 sprintf(label,"b = %.1f fm",b);
512 l1a->AddEntry(fgWStarfi,label,"");
517 void AliFastGlauber::DrawAlmond(Double_t b) const
520 // Draw Interaction Almond
522 TCanvas *c9 = new TCanvas("c9","Almond",400,10,600,700);
524 fgWAlmond->SetParameter(0, b);
525 TH2F *h2f=new TH2F("h2falmond","Interaction Almond [fm^{-4}]",2,0,fgBMax,2,0,fgBMax);
527 h2f->GetXaxis()->SetTitle("x [fm]");
528 h2f->GetYaxis()->SetTitle("y [fm]");
530 fgWAlmond->Draw("same");
531 TLegend *l1a = new TLegend(0.65,0.8,.90,0.9);
532 l1a->SetFillStyle(0);
533 l1a->SetBorderSize(0);
535 sprintf(label,"b = %.1f fm",b);
536 l1a->AddEntry(fgWAlmond,label,"");
541 void AliFastGlauber::DrawEnergyDensity() const
544 // Draw energy density
546 TCanvas *c10 = new TCanvas("c10","Energy Density",400, 10, 600, 700);
548 fgWEnergyDensity->SetMinimum(0.);
549 Double_t max=fgWEnergyDensity->GetMaximum(0,fgWEnergyDensity->GetParameter(0))*1.01;
550 TH2F *h2f=new TH2F("h2fenergydens","Energy density",2,0,fgBMax,2,0,max);
552 h2f->GetXaxis()->SetTitle("b [fm]");
553 h2f->GetYaxis()->SetTitle("fm^{-4}");
555 fgWEnergyDensity->Draw("same");
559 void AliFastGlauber::DrawPathLength0(Double_t b, Int_t iopt) const
564 TCanvas *c11 = new TCanvas("c11","Path Length",400,10,600,700);
566 fgWPathLength0->SetParameter(0, b);
567 fgWPathLength0->SetParameter(1, Double_t(iopt));
568 fgWPathLength0->SetMinimum(0.);
569 fgWPathLength0->SetMaximum(10.);
570 TH2F *h2f=new TH2F("h2fpathlength0","Path length",2,-TMath::Pi(), TMath::Pi(),2,0,10.);
572 h2f->GetXaxis()->SetTitle("#phi [rad]");
573 h2f->GetYaxis()->SetTitle("l [fm]");
575 fgWPathLength0->Draw("same");
578 void AliFastGlauber::DrawPathLength(Double_t b , Int_t ni, Int_t iopt) const
583 TCanvas *c12 = new TCanvas("c12","Path Length",400,10,600,700);
585 fgWAlmond->SetParameter(0, b);
586 fgWPathLength->SetParameter(0, b);
587 fgWPathLength->SetParameter(1, Double_t (ni));
588 fgWPathLength->SetParameter(2, Double_t (iopt));
589 fgWPathLength->SetMinimum(0.);
590 fgWPathLength->SetMaximum(10.);
591 TH2F *h2f=new TH2F("h2fpathlength","Path length",2,-TMath::Pi(), TMath::Pi(),2,0,10.);
593 h2f->GetXaxis()->SetTitle("#phi [rad]");
594 h2f->GetYaxis()->SetTitle("l [fm]");
596 fgWPathLength->Draw("same");
599 void AliFastGlauber::DrawIntRadius(Double_t b) const
602 // Draw Interaction Radius
604 TCanvas *c13 = new TCanvas("c13","Interaction Radius",400,10,600,700);
606 fgWIntRadius->SetParameter(0, b);
607 fgWIntRadius->SetMinimum(0);
608 Double_t max=fgWIntRadius->GetMaximum(0,fgBMax)*1.01;
609 TH2F *h2f=new TH2F("h2fintradius","Interaction Density",2,0.,fgBMax,2,0,max);
611 h2f->GetXaxis()->SetTitle("r [fm]");
612 h2f->GetYaxis()->SetTitle("[fm^{-3}]");
614 fgWIntRadius->Draw("same");
617 Double_t AliFastGlauber::WSb(Double_t* x, Double_t* par)
620 // Woods-Saxon Parameterisation
621 // as a function of radius (xx)
623 const Double_t kxx = x[0]; //fm
624 const Double_t kr0 = par[0]; //fm
625 const Double_t kd = par[1]; //fm
626 const Double_t kw = par[2]; //no units
627 const Double_t kn = par[3]; //fm^-3 (used to normalize integral to one)
628 Double_t y = kn * (1.+kw*(kxx/kr0)*(kxx/kr0))/(1.+TMath::Exp((kxx-kr0)/kd));
632 Double_t AliFastGlauber::WSbz(Double_t* x, Double_t* par)
635 // Wood Saxon Parameterisation
636 // as a function of z and b
638 const Double_t kbb = x[0]; //fm
639 const Double_t kzz = x[1]; //fm
640 const Double_t kr0 = par[0]; //fm
641 const Double_t kd = par[1]; //fm
642 const Double_t kw = par[2]; //no units
643 const Double_t kn = par[3]; //fm^-3 (used to normalize integral to one)
644 const Double_t kxx = TMath::Sqrt(kbb*kbb+kzz*kzz);
645 Double_t y = kn * (1.+kw*(kxx/kr0)*(kxx/kr0))/(1.+TMath::Exp((kxx-kr0)/kd));
649 Double_t AliFastGlauber::WSz(Double_t* x, Double_t* par)
652 // Wood Saxon Parameterisation
653 // as a function of z for fixed b
655 const Double_t kzz = x[0]; //fm
656 const Double_t kr0 = par[0]; //fm
657 const Double_t kd = par[1]; //fm
658 const Double_t kw = par[2]; //no units
659 const Double_t kn = par[3]; //fm^-3 (used to normalize integral to one)
660 const Double_t kbb = par[4]; //fm
661 const Double_t kxx = TMath::Sqrt(kbb*kbb+kzz*kzz);
662 Double_t y = kn * (1.+kw*(kxx/kr0)*(kxx/kr0))/(1.+TMath::Exp((kxx-kr0)/kd));
666 Double_t AliFastGlauber::WSta(Double_t* x, Double_t* /*par*/)
669 // Thickness function T_A
670 // as a function of b
672 const Double_t kb = x[0];
673 fgWSz->SetParameter(4, kb);
674 Double_t y = 2. * fgWSz->Integral(0., fgBMax);
678 Double_t AliFastGlauber::WStarfi(Double_t* x, Double_t* par)
681 // Kernel for overlap function: T_A(s)*T_A(s-b)
682 // as a function of r and phi
683 const Double_t kr1 = x[0];
684 const Double_t kphi = x[1];
685 const Double_t kb = par[0];
686 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
687 Double_t y = kr1 * fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
691 Double_t AliFastGlauber::WStaa(Double_t* x, Double_t* par)
695 // T_{AB}=Int d2s T_A(s)*T_B(s-b)
696 // as a function of b
697 // (normalized to fA*fB)
699 const Double_t kb = x[0];
700 const Double_t ka = par[0];
701 fgWStarfi->SetParameter(0, kb);
703 // root integration seems to fail
713 Double_t y = 2. * 208. * 208. * fgWStarfi->IntegralMultiple(2, al, bl, 0.001, err);
714 printf("WStaa: %.5e %.5e %.5e\n", b, y, err);
723 for (Int_t i = 0; i < fgkMCInts; i++)
726 const Double_t kphi = TMath::Pi() * gRandom->Rndm();
727 const Double_t kb1 = fgBMax * gRandom->Rndm();
728 y += fgWStarfi->Eval(kb1, kphi);
730 y *= 2. * TMath::Pi() * fgBMax / fgkMCInts; //fm^-2
731 y *= ka * ka * 0.1; //mbarn^-1
735 Double_t AliFastGlauber::WKParticipants(Double_t* x, Double_t* par)
738 // Kernel for number of participants
739 // as a function of r and phi
741 const Double_t kr1 = x[0];
742 const Double_t kphi = x[1];
743 const Double_t kb = par[0]; //fm
744 const Double_t ksig = par[1]; //mbarn
745 const Double_t ka = par[2]; //mass number
746 const Double_t kr2 = TMath::Sqrt(kr1*kr1 +kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
747 const Double_t kxsi = fgWSta->Eval(kr2) * ksig * 0.1; //no units
749 Double_t y=(1-TMath::Power((1-xsi),aa))
752 Double_t sum = ka * kxsi;
754 for (Int_t i = 1; i <= ka; i++)
757 sum *= (-kxsi) * a / Float_t(i+1);
760 y *= kr1 * fgWSta->Eval(kr1);
764 Double_t AliFastGlauber::WParticipants(Double_t* x, Double_t* par)
767 // Number of Participants as
770 const Double_t kb = x[0];
771 const Double_t ksig = par[0]; //mbarn
772 const Double_t ka = par[1]; //mass number
773 fgWKParticipants->SetParameter(0, kb);
774 fgWKParticipants->SetParameter(1, ksig);
775 fgWKParticipants->SetParameter(2, ka);
781 for (Int_t i = 0; i < fgkMCInts; i++)
783 const Double_t kphi = TMath::Pi() * gRandom->Rndm();
784 const Double_t kb1 = fgBMax * gRandom->Rndm();
785 y += fgWKParticipants->Eval(kb1, kphi);
787 y *= 2. * ka * 2. * TMath::Pi() * fgBMax / fgkMCInts;
791 Double_t AliFastGlauber::WSgeo(Double_t* x, Double_t* par)
794 // Geometrical Cross-Section
795 // as a function of b
797 const Double_t kb = x[0]; //fm
798 const Double_t ksigNN = par[0]; //mbarn
799 const Double_t ktaa = fgWStaa->Eval(kb); //mbarn^-1
800 Double_t y = 2. * TMath::Pi() * kb * (1. - TMath::Exp(- ksigNN * ktaa));
804 Double_t AliFastGlauber::WSbinary(Double_t* x, Double_t* par)
807 // Number of binary hard collisions
808 // as a function of b
810 const Double_t kb = x[0]; //fm
811 const Double_t ksig = par[0]; //mbarn
812 const Double_t ktaa = fgWStaa->Eval(kb); //mbarn^-1
813 Double_t y = 2. * TMath::Pi() * kb * ksig * ktaa;
817 Double_t AliFastGlauber::WSN(Double_t* x, Double_t* /*par*/)
820 // Number of hard processes per event
821 // as a function of b
822 const Double_t kb = x[0];
823 Double_t y = fgWSbinary->Eval(kb)/fgWSgeo->Eval(kb);
827 Double_t AliFastGlauber::WEnergyDensity(Double_t* x, Double_t* par)
830 // Initial energy density
831 // as a function of the impact parameter
833 const Double_t kb = x[0];
834 const Double_t krA = par[0];
836 // Attention: area of transverse reaction zone in hard-sphere approximation !
837 const Double_t krA2=krA*krA;
838 const Double_t kb2=kb*kb;
839 const Double_t ksaa = (TMath::Pi() - 2. * TMath::ASin(kb/ 2./ krA)) * krA2
840 - kb * TMath::Sqrt(krA2 - kb2/ 4.); //fm^2
841 const Double_t ktaa = fgWStaa->Eval(kb); //mbarn^-1
842 Double_t y=ktaa/ksaa*10;
846 Double_t AliFastGlauber::WAlmond(Double_t* x, Double_t* par)
849 // Almond shaped interaction region
850 // as a function of cartesian x,y.
852 const Double_t kb = par[0];
853 const Double_t kxx = x[0] + kb/2.;
854 const Double_t kyy = x[1];
855 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
856 const Double_t kphi = TMath::ATan2(kyy,kxx);
857 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
859 // Interaction probability calculated as product of thicknesses
861 Double_t y = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
865 Double_t AliFastGlauber::WIntRadius(Double_t* x, Double_t* par)
868 // Average interaction density over radius
869 // at which interaction takes place
870 // as a function of radius
872 const Double_t kr = x[0];
873 const Double_t kb = par[0];
874 fgWAlmond->SetParameter(0, kb);
875 // Average over phi in small steps
876 const Double_t kdphi = 2. * TMath::Pi() / 100.;
879 for (Int_t i = 0; i < 100; i++) {
880 const Double_t kxx = kr * TMath::Cos(phi);
881 const Double_t kyy = kr * TMath::Sin(phi);
882 y += fgWAlmond->Eval(kxx,kyy);
885 // Result multiplied by Jacobian (2 pi r)
886 y *= 2. * TMath::Pi() * kr / 100.;
890 Double_t AliFastGlauber::WPathLength0(Double_t* x, Double_t* par)
893 // Path Length as a function of phi
894 // for interaction point fixed at (0,0)
895 // as a function of phi-direction
897 // Phi direction in Almond
898 const Double_t kphi0 = x[0];
899 const Double_t kb = par[0];
900 // Path Length definition
901 const Int_t kiopt = Int_t(par[1]);
903 // Step along radial direction phi
904 const Int_t kNp = 100; // Steps in r
905 const Double_t kDr = fgBMax/kNp;
909 for (Int_t i = 0; i < kNp; i++) {
911 // Transform into target frame
913 const Double_t kxx = r * TMath::Cos(kphi0) + kb / 2.;
914 const Double_t kyy = r * TMath::Sin(kphi0);
915 const Double_t kphi = TMath::ATan2(kyy, kxx);
916 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
917 // Radius in projectile frame
918 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
919 const Double_t ky = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
927 if (!kiopt) { // My length definition (is exact for hard disk)
928 if(w) y= 2. * rw / w;
930 const Double_t knorm=fgWSta->Eval(1e-4);
931 if(knorm) y = TMath::Sqrt(2. * rw * kDr / knorm / knorm);
936 Double_t AliFastGlauber::WPathLength(Double_t* x, Double_t* par)
939 // Path Length as a function of phi
940 // Interaction point from random distribution
941 // as a function of the phi-direction
942 const Double_t kphi0 = x[0];
943 const Double_t kb = par[0];
944 fgWAlmond->SetParameter(0, kb);
945 const Int_t kNpi = Int_t (par[1]); //Number of interactions
946 const Int_t kiopt = Int_t(par[2]); //Path Length definition
951 const Int_t kNp = 100;
952 const Double_t kDr = fgBMax/Double_t(kNp);
953 Double_t l = 0.; // Path length
954 for (Int_t in = 0; in < kNpi; in ++) {
959 fgWAlmond->GetRandom2(x0, y0);
961 const Double_t kr0 = TMath::Sqrt(x0*x0 + y0*y0);
962 const Int_t knps = Int_t ((fgBMax - kr0)/kDr) - 1;
966 for (Int_t i = 0; (i < knps ); i++) {
967 // Transform into target frame
968 const Double_t kxx = x0 + r * TMath::Cos(kphi0) + kb / 2.;
969 const Double_t kyy = y0 + r * TMath::Sin(kphi0);
970 const Double_t kphi = TMath::ATan2(kyy, kxx);
971 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
972 // Radius in projectile frame
973 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
974 const Double_t ky = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
980 // Average over interactions
982 if(w) l += (2. * rw / w);
984 const Double_t knorm=fgWSta->Eval(1e-4);
985 if(knorm) l+= 2. * rw * kDr / knorm / knorm;
992 ret=TMath::Sqrt( l / kNpi);
996 Double_t AliFastGlauber::CrossSection(Double_t b1, Double_t b2) const
999 // Return the geometrical cross-section integrated from b1 to b2
1001 return fgWSgeo->Integral(b1, b2)*10.; //mbarn
1004 Double_t AliFastGlauber::HardCrossSection(Double_t b1, Double_t b2) const
1007 // Return the hard cross-section integrated from b1 to b2
1009 return fgWSbinary->Integral(b1, b2)*10.; //mbarn
1012 Double_t AliFastGlauber::FractionOfHardCrossSection(Double_t b1, Double_t b2) const
1015 // Return fraction of hard cross-section integrated from b1 to b2
1017 return fgWSbinary->Integral(b1, b2)/fgWSbinary->Integral(0., 100.);
1020 Double_t AliFastGlauber::NHard(Double_t b1, Double_t b2) const
1023 // Number of binary hard collisions
1024 // as a function of b (nucl/ex/0302016 eq. 19)
1026 const Double_t kshard=HardCrossSection(b1,b2);
1027 const Double_t ksgeo=CrossSection(b1,b2);
1029 return kshard/ksgeo;
1033 Double_t AliFastGlauber::Binaries(Double_t b) const
1036 // Return number of binary hard collisions normalized to 1 at b=0
1039 return fgWSN->Eval(b)/fgWSN->Eval(1e-4);
1042 Double_t AliFastGlauber::MeanOverlap(Double_t b1, Double_t b2)
1045 // Calculate the mean overlap for impact parameter range b1 .. b2
1051 while (b < b2-0.005) {
1052 Double_t nc = GetNumberOfCollisions(b);
1053 sum += 10. * fgWStaa->Eval(b) * fgWSgeo->Eval(b) * 0.01 / (1. - TMath::Exp(-nc));
1054 sumc += 10. * fgWSgeo->Eval(b) * 0.01;
1057 return (sum / CrossSection(b1, b2));
1061 Double_t AliFastGlauber::MeanNumberOfCollisionsPerEvent(Double_t b1, Double_t b2)
1064 // Calculate the mean number of collisions per event for impact parameter range b1 .. b2
1070 while (b < b2-0.005) {
1071 Double_t nc = GetNumberOfCollisions(b);
1072 sum += nc / (1. - TMath::Exp(-nc)) * 10. * fgWSgeo->Eval(b) * 0.01;
1073 sumc += 10. * fgWSgeo->Eval(b) * 0.01;
1076 return (sum / CrossSection(b1, b2));
1080 Double_t AliFastGlauber::GetNumberOfBinaries(Double_t b) const
1083 // Return number of binary hard collisions at b
1086 return fgWSN->Eval(b);
1089 Double_t AliFastGlauber::Participants(Double_t b) const
1092 // Return the number of participants normalized to 1 at b=0
1095 return (fgWParticipants->Eval(b)/fgWParticipants->Eval(1e-4));
1098 Double_t AliFastGlauber::GetNumberOfParticipants(Double_t b) const
1101 // Return the number of participants for impact parameter b
1104 return (fgWParticipants->Eval(b));
1107 Double_t AliFastGlauber::GetNumberOfCollisions(Double_t b) const
1110 // Return the number of collisions for impact parameter b
1113 return (fgWStaa->Eval(b)*fSigmaNN);
1116 Double_t AliFastGlauber::GetNumberOfCollisionsPerEvent(Double_t b) const
1119 // Return the number of collisions per event (at least one collision)
1120 // for impact parameter b
1122 Double_t n = GetNumberOfCollisions(b);
1124 return (n / (1. - TMath::Exp(- n)));
1130 void AliFastGlauber::SimulateTrigger(Int_t n)
1133 // Simulates Trigger
1135 TH1F* mbtH = new TH1F("mbtH", "MB Trigger b-Distribution", 100, 0., 20.);
1136 TH1F* hdtH = new TH1F("hdtH", "Hard Trigger b-Distribution", 100, 0., 20.);
1137 TH1F* mbmH = new TH1F("mbmH", "MB Trigger Multiplicity Distribution", 100, 0., 8000.);
1138 TH1F* hdmH = new TH1F("hdmH", "Hard Trigger Multiplicity Distribution", 100, 0., 8000.);
1140 mbtH->SetXTitle("b [fm]");
1141 hdtH->SetXTitle("b [fm]");
1142 mbmH->SetXTitle("Multiplicity");
1143 hdmH->SetXTitle("Multiplicity");
1145 TCanvas *c0 = new TCanvas("c0","Trigger Simulation",400,10,600,700);
1147 TCanvas *c1 = new TCanvas("c1","Trigger Simulation",400,10,600,700);
1153 for (Int_t iev = 0; iev < n; iev++)
1156 GetRandom(b, p, mult);
1159 mbmH->Fill(mult, 1.);
1160 hdmH->Fill(mult, p);
1176 void AliFastGlauber::GetRandom(Float_t& b, Float_t& p, Float_t& mult)
1179 // Gives back a random impact parameter, hard trigger probability and multiplicity
1181 b = fgWSgeo->GetRandom();
1182 const Float_t kmu = fgWSN->Eval(b);
1183 p = 1.-TMath::Exp(-kmu);
1184 mult = 6000./fgWSN->Eval(1.) * kmu;
1187 void AliFastGlauber::GetRandom(Int_t& bin, Bool_t& hard)
1190 // Gives back a random impact parameter bin, and hard trigger decission
1192 const Float_t kb = fgWSgeo->GetRandom();
1193 const Float_t kmu = fgWSN->Eval(kb) * fSigmaHard;
1194 const Float_t kp = 1.-TMath::Exp(-kmu);
1197 } else if (kb < 8.6) {
1199 } else if (kb < 11.2) {
1201 } else if (kb < 13.2) {
1203 } else if (kb < 15.0) {
1209 const Float_t kr = gRandom->Rndm();
1210 if (kr < kp) hard = kTRUE;
1213 Double_t AliFastGlauber::GetRandomImpactParameter(Double_t bmin, Double_t bmax)
1216 // Gives back a random impact parameter in the range bmin .. bmax
1219 while(b < bmin || b > bmax)
1220 b = fgWSgeo->GetRandom();
1224 void AliFastGlauber::StoreFunctions() const
1227 // Store in file functions
1229 TFile* ff = new TFile(fName.Data(),"recreate");
1230 fgWStaa->Write("WStaa");
1231 fgWParticipants->Write("WParticipants");
1236 //=================== Added by A. Dainese 11/02/04 ===========================
1238 void AliFastGlauber::StoreAlmonds() const
1242 // 40 almonds for b = (0.25+k*0.5) fm (k=0->39)
1244 Char_t almondName[100];
1245 TFile* ff = new TFile(fName.Data(),"update");
1246 for(Int_t k=0; k<40; k++) {
1247 sprintf(almondName,"WAlmondFixedB%d",k);
1248 Double_t b = 0.25+k*0.5;
1249 Info("StoreAlmonds"," b = %f\n",b);
1250 fgWAlmond->SetParameter(0,b);
1251 fgWAlmond->Write(almondName);
1257 void AliFastGlauber::SetCentralityClass(Double_t xsecFrLow,Double_t xsecFrUp)
1260 // Set limits of centrality class as fractions
1261 // of the geomtrical cross section
1263 if(xsecFrLow>1. || xsecFrUp>1. || xsecFrLow>xsecFrUp) {
1264 Error("SetCentralityClass", "Please set 0 <= xsecFrLow <= xsecFrUp <= 1\n");
1268 Double_t bLow=0.,bUp=0.;
1270 const Double_t knorm=fgWSgeo->Integral(0.,100.);
1271 while(xsecFr<xsecFrLow) {
1272 xsecFr = fgWSgeo->Integral(0.,bLow)/knorm;
1276 while(xsecFr<xsecFrUp) {
1277 xsecFr = fgWSgeo->Integral(0.,bUp)/knorm;
1281 Info("SetCentralityClass", "Centrality class: %4.2f-%4.2f; %4.1f < b < %4.1f fm",
1282 xsecFrLow,xsecFrUp,bLow,bUp);
1283 fgWSbinary->SetRange(bLow,bUp);
1289 void AliFastGlauber::GetRandomBHard(Double_t& b)
1292 // Get random impact parameter according to distribution of
1293 // hard (binary) cross-section, in the range defined by the centrality class
1295 b = fgWSbinary->GetRandom();
1296 Int_t bin = 2*(Int_t)b;
1297 if( (b-(Int_t)b) > 0.5) bin++;
1298 fgWAlmondCurrent = fgWAlmondFixedB[bin];
1302 void AliFastGlauber::GetRandomXY(Double_t& x,Double_t& y)
1305 // Get random position of parton production point according to
1306 // product of thickness functions
1308 fgWAlmondCurrent->GetRandom2(x,y);
1312 void AliFastGlauber::GetRandomPhi(Double_t& phi)
1315 // Get random parton azimuthal propagation direction
1317 phi = 2.*TMath::Pi()*gRandom->Rndm();
1321 Double_t AliFastGlauber::CalculateLength(Double_t b,Double_t x0,Double_t y0,Double_t phi0)
1324 // Calculate path length for a parton with production point (x0,y0)
1325 // and propagation direction (ux=cos(phi0),uy=sin(phi0))
1326 // in a collision with impact parameter b
1329 // number of steps in l
1330 const Int_t kNp = 100;
1331 const Double_t kDl = fgBMax/Double_t(kNp);
1337 // ell = 2 * \int_0^\infty dl*l*(T_A*T_B)(x0+l*ux,y0+l*uy) /
1338 // \int_0^\infty dl*(T_A*T_B)(x0+l*ux,y0+l*uy)
1342 const Double_t kr0 = TMath::Sqrt(x0*x0 + y0*y0);
1343 const Int_t knps = Int_t ((fgBMax - kr0)/kDl) - 1;
1345 Double_t integral1 = 0.;
1346 Double_t integral2 = 0.;
1348 for (Int_t i = 0; i < knps; i++) {
1350 // Transform into target frame
1351 const Double_t kxx = x0 + l * TMath::Cos(phi0) + b / 2.;
1352 const Double_t kyy = y0 + l * TMath::Sin(phi0);
1353 const Double_t kphi = TMath::ATan2(kyy, kxx);
1354 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
1355 // Radius in projectile frame
1356 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + b*b - 2.*kr1*b*TMath::Cos(kphi));
1357 const Double_t kprodTATB = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
1359 integral1 += kprodTATB * l * kDl;
1360 integral2 += kprodTATB * kDl;
1366 ell = (2. * integral1 / integral2);
1368 } else if(fEllDef==2) {
1372 // ell = \int_0^\infty dl*
1373 // \Theta((T_A*T_B)(x0+l*ux,y0+l*uy)-0.5*(T_A*T_B)(0,0))
1377 const Double_t kr0 = TMath::Sqrt(x0*x0 + y0*y0);
1378 const Int_t knps = Int_t ((fgBMax - kr0)/kDl) - 1;
1379 const Double_t kprodTATBHalfMax = 0.5*fgWAlmondCurrent->Eval(0.,0.);
1382 Double_t integral = 0.;
1383 for (Int_t i = 0; i < knps; i++) {
1384 // Transform into target frame
1385 const Double_t kxx = x0 + l * TMath::Cos(phi0) + b / 2.;
1386 const Double_t kyy = y0 + l * TMath::Sin(phi0);
1387 const Double_t kphi = TMath::ATan2(kyy, kxx);
1388 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
1389 // Radius in projectile frame
1390 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + b*b - 2.*kr1*b*TMath::Cos(kphi));
1391 const Double_t kprodTATB = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
1392 if(kprodTATB>kprodTATBHalfMax) integral += kDl;
1395 Double_t ell = integral;
1398 Error("CalculateLength","Wrong length definition setting: %d !\n",fEllDef);
1403 void AliFastGlauber::GetLengthAndPhi(Double_t& ell,Double_t& phi,Double_t b)
1406 // Return length from random b, x0, y0, phi0
1409 Double_t x0,y0,phi0;
1410 if(b<0.) GetRandomBHard(b);
1414 ell = CalculateLength(b,x0,y0,phi0);
1418 void AliFastGlauber::GetLength(Double_t& ell,Double_t b)
1421 // Return length from random b, x0, y0, phi0
1424 GetLengthAndPhi(ell,phi,b);
1428 void AliFastGlauber::GetLengthsBackToBackAndPhi(Double_t& ell1,Double_t& ell2,Double_t &phi,Double_t b)
1431 // Return 2 lengths back to back from random b, x0, y0, phi0
1434 Double_t x0,y0,phi0;
1435 if(b<0.) GetRandomBHard(b);
1438 const Double_t kphi0plusPi = phi0+TMath::Pi();
1440 ell1 = CalculateLength(b,x0,y0,phi0);
1441 ell2 = CalculateLength(b,x0,y0,kphi0plusPi);
1445 void AliFastGlauber::GetLengthsBackToBack(Double_t& ell1,Double_t& ell2,
1449 // Return 2 lengths back to back from random b, x0, y0, phi0
1452 GetLengthsBackToBackAndPhi(ell1,ell2,phi,b);
1456 void AliFastGlauber::GetLengthsForPythia(Int_t n,Double_t* phi,Double_t* ell, Double_t b)
1459 // Returns lenghts for n partons with azimuthal angles phi[n]
1460 // from random b, x0, y0
1463 if(b < 0.) GetRandomBHard(b);
1465 for(Int_t i = 0; i< n; i++) ell[i] = CalculateLength(b,x0,y0,phi[i]);
1469 void AliFastGlauber::PlotBDistr(Int_t n)
1472 // Plot distribution of n impact parameters
1475 TH1F *hB = new TH1F("hB","dN/db",100,0,fgBMax);
1476 hB->SetXTitle("b [fm]");
1477 hB->SetYTitle("dN/db [a.u.]");
1478 hB->SetFillColor(3);
1479 for(Int_t i=0; i<n; i++) {
1483 TCanvas *cB = new TCanvas("cB","Impact parameter distribution",0,0,500,500);
1489 void AliFastGlauber::PlotLengthDistr(Int_t n,Bool_t save,const char *fname)
1492 // Plot length distribution
1495 TH1F *hEll = new TH1F("hEll","Length distribution",64,-0.5,15);
1496 hEll->SetXTitle("Transverse path length, L [fm]");
1497 hEll->SetYTitle("Probability");
1498 hEll->SetFillColor(2);
1499 for(Int_t i=0; i<n; i++) {
1503 hEll->Scale(1/(Double_t)n);
1504 TCanvas *cL = new TCanvas("cL","Length distribution",0,0,500,500);
1509 TFile *f = new TFile(fname,"recreate");
1516 void AliFastGlauber::PlotLengthB2BDistr(Int_t n,Bool_t save,const char *fname)
1519 // Plot lengths back-to-back distributions
1522 TH2F *hElls = new TH2F("hElls","Lengths back-to-back",100,0,15,100,0,15);
1523 hElls->SetXTitle("Transverse path length, L [fm]");
1524 hElls->SetYTitle("Transverse path length, L [fm]");
1525 for(Int_t i=0; i<n; i++) {
1526 GetLengthsBackToBack(ell1,ell2);
1527 hElls->Fill(ell1,ell2);
1529 hElls->Scale(1/(Double_t)n);
1530 TCanvas *cLs = new TCanvas("cLs","Length back-to-back distribution",0,0,500,500);
1531 gStyle->SetPalette(1,0);
1533 hElls->Draw("col,Z");
1535 TFile *f = new TFile(fname,"recreate");
1542 void AliFastGlauber::PlotAlmonds() const
1545 // Plot almonds for some impact parameters
1547 TCanvas *c = new TCanvas("c","Almonds",0,0,500,500);
1548 gStyle->SetPalette(1,0);
1551 fgWAlmondFixedB[0]->Draw("cont1");
1553 fgWAlmondFixedB[10]->Draw("cont1");
1555 fgWAlmondFixedB[20]->Draw("cont1");
1557 fgWAlmondFixedB[30]->Draw("cont1");
1561 //=================== Added by A. Dainese 05/03/04 ===========================
1563 void AliFastGlauber::CalculateI0I1(Double_t& integral0,Double_t& integral1,
1564 Double_t b,Double_t x0,Double_t y0,
1565 Double_t phi0,Double_t ellCut) const
1568 // Calculate integrals:
1569 // integral0 = \int_0^ellCut dl*(T_A*T_B)(x0+l*ux,y0+l*uy)
1570 // integral1 = \int_0^ellCut dl*l*(T_A*T_B)(x0+l*ux,y0+l*uy)
1572 // for a parton with production point (x0,y0)
1573 // and propagation direction (ux=cos(phi0),uy=sin(phi0))
1574 // in a collision with impact parameter b
1577 // number of steps in l
1578 const Int_t kNp = 100;
1579 const Double_t kDl = fgBMax/Double_t(kNp);
1582 const Double_t kr0 = TMath::Sqrt(x0 * x0 + y0 * y0);
1583 const Int_t knps = Int_t ((fgBMax - kr0)/kDl) - 1;
1590 while((i < knps) && (l < ellCut)) {
1591 // Transform into target frame
1592 const Double_t kxx = x0 + l * TMath::Cos(phi0) + b / 2.;
1593 const Double_t kyy = y0 + l * TMath::Sin(phi0);
1594 const Double_t kphi = TMath::ATan2(kyy, kxx);
1595 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
1596 // Radius in projectile frame
1597 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + b*b - 2.*kr1*b*TMath::Cos(kphi));
1598 const Double_t kprodTATB = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
1599 integral0 += kprodTATB * kDl;
1600 integral1 += kprodTATB * l * kDl;
1607 void AliFastGlauber::GetI0I1AndPhi(Double_t& integral0,Double_t& integral1,
1609 Double_t ellCut,Double_t b)
1612 // Return I0 and I1 from random b, x0, y0, phi0
1615 Double_t x0,y0,phi0;
1616 if(b<0.) GetRandomBHard(b);
1620 CalculateI0I1(integral0,integral1,b,x0,y0,phi0,ellCut);
1624 void AliFastGlauber::GetI0I1(Double_t& integral0,Double_t& integral1,
1625 Double_t ellCut,Double_t b)
1628 // Return I0 and I1 from random b, x0, y0, phi0
1631 GetI0I1AndPhi(integral0,integral1,phi,ellCut,b);
1635 void AliFastGlauber::GetI0I1BackToBackAndPhi(Double_t& integral01,Double_t& integral11,
1636 Double_t& integral02,Double_t& integral12,
1638 Double_t ellCut,Double_t b)
1641 // Return 2 pairs of I0 and I1 back to back from random b, x0, y0, phi0
1644 Double_t x0,y0,phi0;
1645 if(b<0.) GetRandomBHard(b);
1649 const Double_t kphi0plusPi = phi0+TMath::Pi();
1650 CalculateI0I1(integral01,integral11,b,x0,y0,phi0,ellCut);
1651 CalculateI0I1(integral02,integral12,b,x0,y0,kphi0plusPi,ellCut);
1655 void AliFastGlauber::GetI0I1BackToBackAndPhiAndXY(Double_t& integral01,Double_t& integral11,
1656 Double_t& integral02,Double_t& integral12,
1657 Double_t& phi,Double_t &x,Double_t &y,
1658 Double_t ellCut,Double_t b)
1661 // Return 2 pairs of I0 and I1 back to back from random b, x0, y0, phi0
1664 Double_t x0,y0,phi0;
1665 if(b<0.) GetRandomBHard(b);
1668 phi = phi0; x=x0; y=y0;
1669 const Double_t kphi0plusPi = phi0+TMath::Pi();
1670 CalculateI0I1(integral01,integral11,b,x0,y0,phi0,ellCut);
1671 CalculateI0I1(integral02,integral12,b,x0,y0,kphi0plusPi,ellCut);
1675 void AliFastGlauber::GetI0I1BackToBack(Double_t& integral01,Double_t& integral11,
1676 Double_t& integral02,Double_t& integral12,
1677 Double_t ellCut,Double_t b)
1680 // Return 2 pairs of I0 and I1 back to back from random b, x0, y0, phi0
1683 GetI0I1BackToBackAndPhi(integral01,integral11,integral02,integral12,
1688 void AliFastGlauber::GetI0I1ForPythia(Int_t n,Double_t* phi,
1689 Double_t* integral0,Double_t* integral1,
1690 Double_t ellCut,Double_t b)
1693 // Returns I0 and I1 pairs for n partons with azimuthal angles phi[n]
1694 // from random b, x0, y0
1697 if(b<0.) GetRandomBHard(b);
1699 for(Int_t i=0; i<n; i++)
1700 CalculateI0I1(integral0[i],integral1[i],b,x0,y0,phi[i],ellCut);
1704 void AliFastGlauber::GetI0I1ForPythiaAndXY(Int_t n,Double_t* phi,
1705 Double_t* integral0,Double_t* integral1,
1706 Double_t &x,Double_t& y,
1707 Double_t ellCut,Double_t b)
1710 // Returns I0 and I1 pairs for n partons with azimuthal angles phi[n]
1711 // from random b, x0, y0 and return x0,y0
1714 if(b<0.) GetRandomBHard(b);
1716 for(Int_t i=0; i<n; i++)
1717 CalculateI0I1(integral0[i],integral1[i],b,x0,y0,phi[i],ellCut);
1723 void AliFastGlauber::PlotI0I1Distr(Int_t n,Double_t ellCut,
1724 Bool_t save,const char *fname)
1727 // Plot I0-I1 distribution
1730 TH2F *hI0I1s = new TH2F("hI0I1s","I_{0} versus I_{1}",1000,0,0.001,1000,0,0.01);
1731 hI0I1s->SetXTitle("I_{0} [fm^{-3}]");
1732 hI0I1s->SetYTitle("I_{1} [fm^{-2}]");
1734 TH1F *hI0 = new TH1F("hI0","I_{0} = #hat{q}L / k",
1736 hI0->SetXTitle("I_{0} [fm^{-3}]");
1737 hI0->SetYTitle("Probability");
1738 hI0->SetFillColor(3);
1739 TH1F *hI1 = new TH1F("hI1","I_{1} = #omega_{c} / k",
1741 hI1->SetXTitle("I_{1} [fm^{-2}]");
1742 hI1->SetYTitle("Probability");
1743 hI1->SetFillColor(4);
1744 TH1F *h2 = new TH1F("h2","2 I_{1}^{2}/I_{0} = R / k",
1746 h2->SetXTitle("2 I_{1}^{2}/I_{0} [fm^{-1}]");
1747 h2->SetYTitle("Probability");
1748 h2->SetFillColor(2);
1749 TH1F *h3 = new TH1F("h3","2 I_{1}/I_{0} = L",
1751 h3->SetXTitle("2 I_{1}/I_{0} [fm]");
1752 h3->SetYTitle("Probability");
1753 h3->SetFillColor(5);
1754 TH1F *h4 = new TH1F("h4","I_{0}^{2}/(2 I_{1}) = #hat{q} / k",
1756 h4->SetXTitle("I_{0}^{2}/(2 I_{1}) [fm^{-4}]");
1757 h4->SetYTitle("Probability");
1758 h4->SetFillColor(7);
1760 for(Int_t i=0; i<n; i++) {
1761 GetI0I1(i0,i1,ellCut);
1762 hI0I1s->Fill(i0,i1);
1765 h2->Fill(2.*i1*i1/i0);
1767 h4->Fill(i0*i0/2./i1);
1769 hI0->Scale(1/(Double_t)n);
1770 hI1->Scale(1/(Double_t)n);
1771 h2->Scale(1/(Double_t)n);
1772 h3->Scale(1/(Double_t)n);
1773 h4->Scale(1/(Double_t)n);
1774 hI0I1s->Scale(1/(Double_t)n);
1776 TCanvas *cI0I1 = new TCanvas("cI0I1","I0 and I1",0,0,900,700);
1789 gStyle->SetPalette(1,0);
1790 hI0I1s->Draw("col,Z");
1793 TFile *f = new TFile(fname,"recreate");
1805 void AliFastGlauber::PlotI0I1B2BDistr(Int_t n,Double_t ellCut,
1806 Bool_t save,const char *fname)
1809 // Plot I0-I1 back-to-back distributions
1811 Double_t i01,i11,i02,i12;
1812 TH2F *hI0s = new TH2F("hI0s","I_{0}'s back-to-back",100,0,100,100,0,100);
1813 hI0s->SetXTitle("I_{0} [fm^{-3}]");
1814 hI0s->SetYTitle("I_{0} [fm^{-3}]");
1815 TH2F *hI1s = new TH2F("hI1s","I_{1}'s back-to-back",100,0,100,100,0,100);
1816 hI1s->SetXTitle("I_{1} [fm^{-2}]");
1817 hI1s->SetYTitle("I_{1} [fm^{-2}]");
1819 for(Int_t i=0; i<n; i++) {
1820 GetI0I1BackToBack(i01,i11,i02,i12,ellCut);
1821 hI0s->Fill(i01,i02);
1822 hI1s->Fill(i11,i12);
1824 hI0s->Scale(1/(Double_t)n);
1825 hI1s->Scale(1/(Double_t)n);
1827 TCanvas *cI0I1s = new TCanvas("cI0I1s","I0 and I1 back-to-back distributions",0,0,800,400);
1828 gStyle->SetPalette(1,0);
1829 cI0I1s->Divide(2,1);
1831 hI0s->Draw("col,Z");
1833 hI1s->Draw("col,Z");
1836 TFile *f = new TFile(fname,"recreate");
1844 AliFastGlauber& AliFastGlauber::operator=(const AliFastGlauber& rhs)
1846 // Assignment operator
1851 void AliFastGlauber::Copy(TObject&) const
1856 Fatal("Copy","Not implemented!\n");