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"
63 #include <Riostream.h>
65 ClassImp(AliFastGlauber)
67 Float_t AliFastGlauber::fgBMax = 0.;
68 TF1* AliFastGlauber::fgWSb = NULL;
69 TF2* AliFastGlauber::fgWSbz = NULL;
70 TF1* AliFastGlauber::fgWSz = NULL;
71 TF1* AliFastGlauber::fgWSta = NULL;
72 TF2* AliFastGlauber::fgWStarfi = NULL;
73 TF2* AliFastGlauber::fgWAlmond = NULL;
74 TF1* AliFastGlauber::fgWStaa = NULL;
75 TF1* AliFastGlauber::fgWSgeo = NULL;
76 TF1* AliFastGlauber::fgWSbinary = NULL;
77 TF1* AliFastGlauber::fgWSN = NULL;
78 TF1* AliFastGlauber::fgWPathLength0 = NULL;
79 TF1* AliFastGlauber::fgWPathLength = NULL;
80 TF1* AliFastGlauber::fgWEnergyDensity = NULL;
81 TF1* AliFastGlauber::fgWIntRadius = NULL;
82 TF2* AliFastGlauber::fgWKParticipants = NULL;
83 TF1* AliFastGlauber::fgWParticipants = NULL;
84 TF2* AliFastGlauber::fgWAlmondCurrent = NULL;
85 TF2* AliFastGlauber::fgWAlmondFixedB[40];
86 const Int_t AliFastGlauber::fgkMCInts = 100000;
87 Int_t AliFastGlauber::fgCounter = 0;
89 AliFastGlauber::AliFastGlauber() : fName()
91 // Default Constructor
94 Error("AliFastGlauber","More than more instance (%d) is not supported, check your code!",fgCounter);
98 SetLengthDefinition();
102 AliFastGlauber::AliFastGlauber(const AliFastGlauber & gl)
109 AliFastGlauber::~AliFastGlauber()
113 for(Int_t k=0; k<40; k++) delete fgWAlmondFixedB[k];
116 void AliFastGlauber::SetAuAuRhic()
118 //Set all parameters for RHIC
119 SetWoodSaxonParametersAu();
120 SetHardCrossSection();
121 SetNNCrossSection(42);
123 SetFileName("$(ALICE_ROOT)/FASTSIM/data/glauberAuAu.root");
126 void AliFastGlauber::SetPbPbLHC()
128 //Set all parameters for LHC
129 SetWoodSaxonParametersPb();
130 SetHardCrossSection();
136 void AliFastGlauber::Init(Int_t mode)
139 // mode = 0; all functions are calculated
140 // mode = 1; overlap function is read from file (for Pb-Pb only)
141 // mode = 2; interaction almond functions are read from file
142 // USE THIS FOR PATH LENGTH CALC.!
152 fgWSb = new TF1("WSb", WSb, 0, fgBMax, 4);
153 fgWSb->SetParameter(0, fWSr0);
154 fgWSb->SetParameter(1, fWSd);
155 fgWSb->SetParameter(2, fWSw);
156 fgWSb->SetParameter(3, fWSn);
158 fgWSbz = new TF2("WSbz", WSbz, 0, fgBMax, 0, fgBMax, 4);
159 fgWSbz->SetParameter(0, fWSr0);
160 fgWSbz->SetParameter(1, fWSd);
161 fgWSbz->SetParameter(2, fWSw);
162 fgWSbz->SetParameter(3, fWSn);
164 fgWSz = new TF1("WSz", WSz, 0, fgBMax, 5);
165 fgWSz->SetParameter(0, fWSr0);
166 fgWSz->SetParameter(1, fWSd);
167 fgWSz->SetParameter(2, fWSw);
168 fgWSz->SetParameter(3, fWSn);
173 fgWSta = new TF1("WSta", WSta, 0., fgBMax, 0);
178 fgWStarfi = new TF2("WStarfi", WStarfi, 0., fgBMax, 0., TMath::Pi(), 1);
179 fgWStarfi->SetParameter(0, 0.);
180 fgWStarfi->SetNpx(200);
181 fgWStarfi->SetNpy(20);
184 // Participants Kernel
186 fgWKParticipants = new TF2("WKParticipants", WKParticipants, 0., fgBMax, 0., TMath::Pi(), 3);
187 fgWKParticipants->SetParameter(0, 0.);
188 fgWKParticipants->SetParameter(1, fSigmaNN);
189 fgWKParticipants->SetParameter(2, fA);
190 fgWKParticipants->SetNpx(200);
191 fgWKParticipants->SetNpy(20);
194 // Overlap and Participants
197 fgWStaa = new TF1("WStaa", WStaa, 0., fgBMax, 1);
198 fgWStaa->SetNpx(100);
199 fgWStaa->SetParameter(0,fA);
200 fgWStaa->SetNpx(100);
201 fgWParticipants = new TF1("WParticipants", WParticipants, 0., fgBMax, 2);
202 fgWParticipants->SetParameter(0, fSigmaNN);
203 fgWParticipants->SetParameter(1, fA);
204 fgWParticipants->SetNpx(100);
206 Info("Init","Reading overlap function from file %s",fName.Data());
207 TFile* f = new TFile(fName.Data());
209 Fatal("Init", "Could not open file %s",fName.Data());
211 fgWStaa = (TF1*) f->Get("WStaa");
212 fgWParticipants = (TF1*) f->Get("WParticipants");
219 fgWEnergyDensity = new TF1("WEnergyDensity", WEnergyDensity, 0., 2. * fWSr0, 1);
220 fgWEnergyDensity->SetParameter(0, fWSr0 + 1.);
223 // Geometrical Cross-Section
225 fgWSgeo = new TF1("WSgeo", WSgeo, 0., fgBMax, 1);
226 fgWSgeo->SetParameter(0,fSigmaNN); //mbarn
227 fgWSgeo->SetNpx(100);
230 // Hard cross section (binary collisions)
232 fgWSbinary = new TF1("WSbinary", WSbinary, 0., fgBMax, 1);
233 fgWSbinary->SetParameter(0, fSigmaHard); //mbarn
234 fgWSbinary->SetNpx(100);
237 // Hard collisions per event
239 fgWSN = new TF1("WSN", WSN, 0., fgBMax, 1);
243 // Almond shaped interaction region
245 fgWAlmond = new TF2("WAlmond", WAlmond, -fgBMax, fgBMax, -fgBMax, fgBMax, 1);
246 fgWAlmond->SetParameter(0, 0.);
247 fgWAlmond->SetNpx(200);
248 fgWAlmond->SetNpy(200);
251 Info("Init","Reading interaction almonds from file: %s",fName.Data());
252 Char_t almondName[100];
253 TFile* ff = new TFile(fName.Data());
254 for(Int_t k=0; k<40; k++) {
255 sprintf(almondName,"WAlmondFixedB%d",k);
256 fgWAlmondCurrent = (TF2*)ff->Get(almondName);
257 fgWAlmondFixedB[k] = fgWAlmondCurrent;
262 fgWIntRadius = new TF1("WIntRadius", WIntRadius, 0., fgBMax, 1);
263 fgWIntRadius->SetParameter(0, 0.);
266 // Path Length as a function of Phi
268 fgWPathLength0 = new TF1("WPathLength0", WPathLength0, -TMath::Pi(), TMath::Pi(), 2);
269 fgWPathLength0->SetParameter(0, 0.);
270 fgWPathLength0->SetParameter(1, 0.); //Pathlength definition
272 fgWPathLength = new TF1("WPathLength", WPathLength, -TMath::Pi(), TMath::Pi(), 3);
273 fgWPathLength->SetParameter(0, 0.); //Impact Parameter
274 fgWPathLength->SetParameter(1, 1000.); //Number of interactions used for average
275 fgWPathLength->SetParameter(2, 0); //Pathlength definition
278 void AliFastGlauber::Reset() const
281 // Reset dynamic allocated formulas
282 // in case init is called twice
284 if(fgWSb) delete fgWSb;
285 if(fgWSbz) delete fgWSbz;
286 if(fgWSz) delete fgWSz;
287 if(fgWSta) delete fgWSta;
288 if(fgWStarfi) delete fgWStarfi;
289 if(fgWAlmond) delete fgWAlmond;
290 if(fgWStaa) delete fgWStaa;
291 if(fgWSgeo) delete fgWSgeo;
292 if(fgWSbinary) delete fgWSbinary;
293 if(fgWSN) delete fgWSN;
294 if(fgWPathLength0) delete fgWPathLength0;
295 if(fgWPathLength) delete fgWPathLength;
296 if(fgWEnergyDensity) delete fgWEnergyDensity;
297 if(fgWIntRadius) delete fgWIntRadius;
298 if(fgWKParticipants) delete fgWKParticipants;
299 if(fgWParticipants) delete fgWParticipants;
302 void AliFastGlauber::DrawWSb() const
305 // Draw Wood-Saxon Nuclear Density Function
307 TCanvas *c1 = new TCanvas("c1","Wood Saxon",400,10,600,700);
309 Double_t max=fgWSb->GetMaximum(0,fgBMax)*1.01;
310 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);
312 h2f->GetXaxis()->SetTitle("r [fm]");
313 h2f->GetYaxis()->SetNoExponent(kTRUE);
314 h2f->GetYaxis()->SetTitle("#rho [fm^{-3}]");
317 TLegend *l1a = new TLegend(0.45,0.6,.90,0.8);
318 l1a->SetFillStyle(0);
319 l1a->SetBorderSize(0);
321 sprintf(label,"r_{0} = %.2f fm",fWSr0);
322 l1a->AddEntry(fgWSb,label,"");
323 sprintf(label,"d = %.2f fm",fWSd);
324 l1a->AddEntry(fgWSb,label,"");
325 sprintf(label,"n = %.2e fm^{-3}",fWSn);
326 l1a->AddEntry(fgWSb,label,"");
327 sprintf(label,"#omega = %.2f",fWSw);
328 l1a->AddEntry(fgWSb,label,"");
333 void AliFastGlauber::DrawOverlap() const
336 // Draw Overlap Function
338 TCanvas *c2 = new TCanvas("c2","Overlap",400,10,600,700);
340 Double_t max=fgWStaa->GetMaximum(0,fgBMax)*1.01;
341 TH2F *h2f=new TH2F("h2ftaa","Overlap function: T_{AB} [mbarn^{-1}]",2,0,fgBMax,2,0, max);
343 h2f->GetXaxis()->SetTitle("b [fm]");
344 h2f->GetYaxis()->SetTitle("T_{AB} [mbarn^{-1}]");
346 fgWStaa->Draw("same");
349 void AliFastGlauber::DrawParticipants() const
352 // Draw Number of Participants Npart
354 TCanvas *c3 = new TCanvas("c3","Participants",400,10,600,700);
356 Double_t max=fgWParticipants->GetMaximum(0,fgBMax)*1.01;
357 TH2F *h2f=new TH2F("h2fpart","Number of Participants",2,0,fgBMax,2,0,max);
359 h2f->GetXaxis()->SetTitle("b [fm]");
360 h2f->GetYaxis()->SetTitle("N_{part}");
362 fgWParticipants->Draw("same");
363 TLegend *l1a = new TLegend(0.50,0.75,.90,0.9);
364 l1a->SetFillStyle(0);
365 l1a->SetBorderSize(0);
367 sprintf(label,"#sigma^{inel.}_{NN} = %.1f mbarn",fSigmaNN);
368 l1a->AddEntry(fgWParticipants,label,"");
373 void AliFastGlauber::DrawThickness() const
376 // Draw Thickness Function
378 TCanvas *c4 = new TCanvas("c4","Thickness",400,10,600,700);
380 Double_t max=fgWSta->GetMaximum(0,fgBMax)*1.01;
381 TH2F *h2f=new TH2F("h2fta","Thickness function: T_{A} [fm^{-2}]",2,0,fgBMax,2,0,max);
383 h2f->GetXaxis()->SetTitle("b [fm]");
384 h2f->GetYaxis()->SetTitle("T_{A} [fm^{-2}]");
386 fgWSta->Draw("same");
389 void AliFastGlauber::DrawGeo() const
392 // Draw Geometrical Cross-Section
394 TCanvas *c5 = new TCanvas("c5","Geometrical Cross-Section",400,10,600,700);
396 Double_t max=fgWSgeo->GetMaximum(0,fgBMax)*1.01;
397 TH2F *h2f=new TH2F("h2fgeo","Differential Geometrical Cross-Section: d#sigma^{geo}_{AB}/db [fm]",2,0,fgBMax,2,0,max);
399 h2f->GetXaxis()->SetTitle("b [fm]");
400 h2f->GetYaxis()->SetTitle("d#sigma^{geo}_{AB}/db [fm]");
402 fgWSgeo->Draw("same");
403 TLegend *l1a = new TLegend(0.10,0.8,.40,0.9);
404 l1a->SetFillStyle(0);
405 l1a->SetBorderSize(0);
407 sprintf(label,"#sigma_{NN}^{inel.} = %.1f mbarn",fSigmaNN);
408 l1a->AddEntry(fgWSgeo,label,"");
413 void AliFastGlauber::DrawBinary() const
416 // Draw Binary Cross-Section
418 TCanvas *c6 = new TCanvas("c6","Binary Cross-Section",400,10,600,700);
420 Double_t max=fgWSbinary->GetMaximum(0,fgBMax)*1.01;
421 TH2F *h2f=new TH2F("h2fbinary","Differential Binary Cross-Section: #sigma^{hard}_{NN} dT_{AB}/db [fm]",2,0,fgBMax,2,0,max);
423 h2f->GetXaxis()->SetTitle("b [fm]");
424 h2f->GetYaxis()->SetTitle("d#sigma^{hard}_{AB}/db [fm]");
426 fgWSbinary->Draw("same");
427 TLegend *l1a = new TLegend(0.50,0.8,.90,0.9);
428 l1a->SetFillStyle(0);
429 l1a->SetBorderSize(0);
431 sprintf(label,"#sigma_{NN}^{hard} = %.1f mbarn",fSigmaHard);
432 l1a->AddEntry(fgWSb,label,"");
437 void AliFastGlauber::DrawN() const
440 // Draw Binaries per event (Ncoll)
442 TCanvas *c7 = new TCanvas("c7","Binaries per event",400,10,600,700);
444 Double_t max=fgWSN->GetMaximum(0,fgBMax)*1.01;
445 TH2F *h2f=new TH2F("h2fhardcols","Number of hard collisions: T_{AB} #sigma^{hard}_{NN}/#sigma_{AB}^{geo}",2,0,fgBMax,2,0,max);
447 h2f->GetXaxis()->SetTitle("b [fm]");
448 h2f->GetYaxis()->SetTitle("N_{coll}");
451 TLegend *l1a = new TLegend(0.50,0.75,.90,0.9);
452 l1a->SetFillStyle(0);
453 l1a->SetBorderSize(0);
455 sprintf(label,"#sigma^{hard}_{NN} = %.1f mbarn",fSigmaHard);
456 l1a->AddEntry(fgWSN,label,"");
457 sprintf(label,"#sigma^{inel.}_{NN} = %.1f mbarn",fSigmaNN);
458 l1a->AddEntry(fgWSN,label,"");
463 void AliFastGlauber::DrawKernel(Double_t b) const
468 TCanvas *c8 = new TCanvas("c8","Kernel",400,10,600,700);
470 fgWStarfi->SetParameter(0, b);
471 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());
473 h2f->GetXaxis()->SetTitle("r [fm]");
474 h2f->GetYaxis()->SetTitle("#phi [rad]");
476 fgWStarfi->Draw("same");
477 TLegend *l1a = new TLegend(0.65,0.8,.90,0.9);
478 l1a->SetFillStyle(0);
479 l1a->SetBorderSize(0);
481 sprintf(label,"b = %.1f fm",b);
482 l1a->AddEntry(fgWStarfi,label,"");
487 void AliFastGlauber::DrawAlmond(Double_t b) const
490 // Draw Interaction Almond
492 TCanvas *c9 = new TCanvas("c9","Almond",400,10,600,700);
494 fgWAlmond->SetParameter(0, b);
495 TH2F *h2f=new TH2F("h2falmond","Interaction Almond [fm^{-4}]",2,0,fgBMax,2,0,fgBMax);
497 h2f->GetXaxis()->SetTitle("x [fm]");
498 h2f->GetYaxis()->SetTitle("y [fm]");
500 fgWAlmond->Draw("same");
501 TLegend *l1a = new TLegend(0.65,0.8,.90,0.9);
502 l1a->SetFillStyle(0);
503 l1a->SetBorderSize(0);
505 sprintf(label,"b = %.1f fm",b);
506 l1a->AddEntry(fgWAlmond,label,"");
511 void AliFastGlauber::DrawEnergyDensity() const
514 // Draw energy density
516 TCanvas *c10 = new TCanvas("c10","Energy Density",400, 10, 600, 700);
518 fgWEnergyDensity->SetMinimum(0.);
519 Double_t max=fgWEnergyDensity->GetMaximum(0,fgWEnergyDensity->GetParameter(0))*1.01;
520 TH2F *h2f=new TH2F("h2fenergydens","Energy density",2,0,fgBMax,2,0,max);
522 h2f->GetXaxis()->SetTitle("b [fm]");
523 h2f->GetYaxis()->SetTitle("fm^{-4}");
525 fgWEnergyDensity->Draw("same");
529 void AliFastGlauber::DrawPathLength0(Double_t b, Int_t iopt) const
534 TCanvas *c11 = new TCanvas("c11","Path Length",400,10,600,700);
536 fgWPathLength0->SetParameter(0, b);
537 fgWPathLength0->SetParameter(1, Double_t(iopt));
538 fgWPathLength0->SetMinimum(0.);
539 fgWPathLength0->SetMaximum(10.);
540 TH2F *h2f=new TH2F("h2fpathlength0","Path length",2,-TMath::Pi(), TMath::Pi(),2,0,10.);
542 h2f->GetXaxis()->SetTitle("#phi [rad]");
543 h2f->GetYaxis()->SetTitle("l [fm]");
545 fgWPathLength0->Draw("same");
548 void AliFastGlauber::DrawPathLength(Double_t b , Int_t ni, Int_t iopt) const
553 TCanvas *c12 = new TCanvas("c12","Path Length",400,10,600,700);
555 fgWAlmond->SetParameter(0, b);
556 fgWPathLength->SetParameter(0, b);
557 fgWPathLength->SetParameter(1, Double_t (ni));
558 fgWPathLength->SetParameter(2, Double_t (iopt));
559 fgWPathLength->SetMinimum(0.);
560 fgWPathLength->SetMaximum(10.);
561 TH2F *h2f=new TH2F("h2fpathlength","Path length",2,-TMath::Pi(), TMath::Pi(),2,0,10.);
563 h2f->GetXaxis()->SetTitle("#phi [rad]");
564 h2f->GetYaxis()->SetTitle("l [fm]");
566 fgWPathLength->Draw("same");
569 void AliFastGlauber::DrawIntRadius(Double_t b) const
572 // Draw Interaction Radius
574 TCanvas *c13 = new TCanvas("c13","Interaction Radius",400,10,600,700);
576 fgWIntRadius->SetParameter(0, b);
577 fgWIntRadius->SetMinimum(0);
578 Double_t max=fgWIntRadius->GetMaximum(0,fgBMax)*1.01;
579 TH2F *h2f=new TH2F("h2fintradius","Interaction Density",2,0.,fgBMax,2,0,max);
581 h2f->GetXaxis()->SetTitle("r [fm]");
582 h2f->GetYaxis()->SetTitle("[fm^{-3}]");
584 fgWIntRadius->Draw("same");
587 Double_t AliFastGlauber::WSb(Double_t* x, Double_t* par)
590 // Woods-Saxon Parameterisation
591 // as a function of radius (xx)
593 const Double_t kxx = x[0]; //fm
594 const Double_t kr0 = par[0]; //fm
595 const Double_t kd = par[1]; //fm
596 const Double_t kw = par[2]; //no units
597 const Double_t kn = par[3]; //fm^-3 (used to normalize integral to one)
598 Double_t y = kn * (1.+kw*(kxx/kr0)*(kxx/kr0))/(1.+TMath::Exp((kxx-kr0)/kd));
602 Double_t AliFastGlauber::WSbz(Double_t* x, Double_t* par)
605 // Wood Saxon Parameterisation
606 // as a function of z and b
608 const Double_t kbb = x[0]; //fm
609 const Double_t kzz = x[1]; //fm
610 const Double_t kr0 = par[0]; //fm
611 const Double_t kd = par[1]; //fm
612 const Double_t kw = par[2]; //no units
613 const Double_t kn = par[3]; //fm^-3 (used to normalize integral to one)
614 const Double_t kxx = TMath::Sqrt(kbb*kbb+kzz*kzz);
615 Double_t y = kn * (1.+kw*(kxx/kr0)*(kxx/kr0))/(1.+TMath::Exp((kxx-kr0)/kd));
619 Double_t AliFastGlauber::WSz(Double_t* x, Double_t* par)
622 // Wood Saxon Parameterisation
623 // as a function of z for fixed b
625 const Double_t kzz = x[0]; //fm
626 const Double_t kr0 = par[0]; //fm
627 const Double_t kd = par[1]; //fm
628 const Double_t kw = par[2]; //no units
629 const Double_t kn = par[3]; //fm^-3 (used to normalize integral to one)
630 const Double_t kbb = par[4]; //fm
631 const Double_t kxx = TMath::Sqrt(kbb*kbb+kzz*kzz);
632 Double_t y = kn * (1.+kw*(kxx/kr0)*(kxx/kr0))/(1.+TMath::Exp((kxx-kr0)/kd));
636 Double_t AliFastGlauber::WSta(Double_t* x, Double_t* /*par*/)
639 // Thickness function T_A
640 // as a function of b
642 const Double_t kb = x[0];
643 fgWSz->SetParameter(4, kb);
644 Double_t y = 2. * fgWSz->Integral(0., fgBMax);
648 Double_t AliFastGlauber::WStarfi(Double_t* x, Double_t* par)
651 // Kernel for overlap function: T_A(s)*T_A(s-b)
652 // as a function of r and phi
653 const Double_t kr1 = x[0];
654 const Double_t kphi = x[1];
655 const Double_t kb = par[0];
656 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
657 Double_t y = kr1 * fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
661 Double_t AliFastGlauber::WStaa(Double_t* x, Double_t* par)
665 // T_{AB}=Int d2s T_A(s)*T_B(s-b)
666 // as a function of b
667 // (normalized to fA*fB)
669 const Double_t kb = x[0];
670 const Double_t ka = par[0];
671 fgWStarfi->SetParameter(0, kb);
673 // root integration seems to fail
683 Double_t y = 2. * 208. * 208. * fgWStarfi->IntegralMultiple(2, al, bl, 0.001, err);
684 printf("WStaa: %.5e %.5e %.5e\n", b, y, err);
693 for (Int_t i = 0; i < fgkMCInts; i++)
696 const Double_t kphi = TMath::Pi() * gRandom->Rndm();
697 const Double_t kb1 = fgBMax * gRandom->Rndm();
698 y += fgWStarfi->Eval(kb1, kphi);
700 y *= 2. * TMath::Pi() * fgBMax / fgkMCInts; //fm^-2
701 y *= ka * ka * 0.1; //mbarn^-1
705 Double_t AliFastGlauber::WKParticipants(Double_t* x, Double_t* par)
708 // Kernel for number of participants
709 // as a function of r and phi
711 const Double_t kr1 = x[0];
712 const Double_t kphi = x[1];
713 const Double_t kb = par[0]; //fm
714 const Double_t ksig = par[1]; //mbarn
715 const Double_t ka = par[2]; //mass number
716 const Double_t kr2 = TMath::Sqrt(kr1*kr1 +kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
717 const Double_t kxsi = fgWSta->Eval(kr2) * ksig * 0.1; //no units
719 Double_t y=(1-TMath::Power((1-xsi),aa))
722 Double_t sum = ka * kxsi;
724 for (Int_t i = 1; i <= ka; i++)
727 sum *= (-kxsi) * a / Float_t(i+1);
730 y *= kr1 * fgWSta->Eval(kr1);
734 Double_t AliFastGlauber::WParticipants(Double_t* x, Double_t* par)
737 // Number of Participants as
740 const Double_t kb = x[0];
741 const Double_t ksig = par[0]; //mbarn
742 const Double_t ka = par[1]; //mass number
743 fgWKParticipants->SetParameter(0, kb);
744 fgWKParticipants->SetParameter(1, ksig);
745 fgWKParticipants->SetParameter(2, ka);
751 for (Int_t i = 0; i < fgkMCInts; i++)
753 const Double_t kphi = TMath::Pi() * gRandom->Rndm();
754 const Double_t kb1 = fgBMax * gRandom->Rndm();
755 y += fgWKParticipants->Eval(kb1, kphi);
757 y *= 2. * ka * 2. * TMath::Pi() * fgBMax / fgkMCInts;
761 Double_t AliFastGlauber::WSgeo(Double_t* x, Double_t* par)
764 // Geometrical Cross-Section
765 // as a function of b
767 const Double_t kb = x[0]; //fm
768 const Double_t ksigNN = par[0]; //mbarn
769 const Double_t ktaa = fgWStaa->Eval(kb); //mbarn^-1
770 Double_t y = 2. * TMath::Pi() * kb * (1. - TMath::Exp(- ksigNN * ktaa));
774 Double_t AliFastGlauber::WSbinary(Double_t* x, Double_t* par)
777 // Number of binary hard collisions
778 // as a function of b
780 const Double_t kb = x[0]; //fm
781 const Double_t ksig = par[0]; //mbarn
782 const Double_t ktaa = fgWStaa->Eval(kb); //mbarn^-1
783 Double_t y = 2. * TMath::Pi() * kb * ksig * ktaa;
787 Double_t AliFastGlauber::WSN(Double_t* x, Double_t* /*par*/)
790 // Number of hard processes per event
791 // as a function of b
792 const Double_t kb = x[0];
793 Double_t y = fgWSbinary->Eval(kb)/fgWSgeo->Eval(kb);
797 Double_t AliFastGlauber::WEnergyDensity(Double_t* x, Double_t* par)
800 // Initial energy density
801 // as a function of the impact parameter
803 const Double_t kb = x[0];
804 const Double_t krA = par[0];
806 // Attention: area of transverse reaction zone in hard-sphere approximation !
807 const Double_t krA2=krA*krA;
808 const Double_t kb2=kb*kb;
809 const Double_t ksaa = (TMath::Pi() - 2. * TMath::ASin(kb/ 2./ krA)) * krA2
810 - kb * TMath::Sqrt(krA2 - kb2/ 4.); //fm^2
811 const Double_t ktaa = fgWStaa->Eval(kb); //mbarn^-1
812 Double_t y=ktaa/ksaa*10;
816 Double_t AliFastGlauber::WAlmond(Double_t* x, Double_t* par)
819 // Almond shaped interaction region
820 // as a function of cartesian x,y.
822 const Double_t kb = par[0];
823 const Double_t kxx = x[0] + kb/2.;
824 const Double_t kyy = x[1];
825 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
826 const Double_t kphi = TMath::ATan2(kyy,kxx);
827 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
829 // Interaction probability calculated as product of thicknesses
831 Double_t y = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
835 Double_t AliFastGlauber::WIntRadius(Double_t* x, Double_t* par)
838 // Average interaction density over radius
839 // at which interaction takes place
840 // as a function of radius
842 const Double_t kr = x[0];
843 const Double_t kb = par[0];
844 fgWAlmond->SetParameter(0, kb);
845 // Average over phi in small steps
846 const Double_t kdphi = 2. * TMath::Pi() / 100.;
849 for (Int_t i = 0; i < 100; i++) {
850 const Double_t kxx = kr * TMath::Cos(phi);
851 const Double_t kyy = kr * TMath::Sin(phi);
852 y += fgWAlmond->Eval(kxx,kyy);
855 // Result multiplied by Jacobian (2 pi r)
856 y *= 2. * TMath::Pi() * kr / 100.;
860 Double_t AliFastGlauber::WPathLength0(Double_t* x, Double_t* par)
863 // Path Length as a function of phi
864 // for interaction point fixed at (0,0)
865 // as a function of phi-direction
867 // Phi direction in Almond
868 const Double_t kphi0 = x[0];
869 const Double_t kb = par[0];
870 // Path Length definition
871 const Int_t kiopt = Int_t(par[1]);
873 // Step along radial direction phi
874 const Int_t kNp = 100; // Steps in r
875 const Double_t kDr = fgBMax/kNp;
879 for (Int_t i = 0; i < kNp; i++) {
881 // Transform into target frame
883 const Double_t kxx = r * TMath::Cos(kphi0) + kb / 2.;
884 const Double_t kyy = r * TMath::Sin(kphi0);
885 const Double_t kphi = TMath::ATan2(kyy, kxx);
886 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
887 // Radius in projectile frame
888 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
889 const Double_t ky = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
897 if (!kiopt) // My length definition (is exact for hard disk)
898 if(w) y= 2. * rw / w;
900 const Double_t knorm=fgWSta->Eval(1e-4);
901 if(knorm) y = TMath::Sqrt(2. * rw * kDr / knorm / knorm);
906 Double_t AliFastGlauber::WPathLength(Double_t* x, Double_t* par)
909 // Path Length as a function of phi
910 // Interaction point from random distribution
911 // as a function of the phi-direction
912 const Double_t kphi0 = x[0];
913 const Double_t kb = par[0];
914 fgWAlmond->SetParameter(0, kb);
915 const Int_t kNpi = Int_t (par[1]); //Number of interactions
916 const Int_t kiopt = Int_t(par[2]); //Path Length definition
921 const Int_t kNp = 100;
922 const Double_t kDr = fgBMax/Double_t(kNp);
923 Double_t l = 0.; // Path length
924 for (Int_t in = 0; in < kNpi; in ++) {
929 fgWAlmond->GetRandom2(x0, y0);
931 const Double_t kr0 = TMath::Sqrt(x0*x0 + y0*y0);
932 const Int_t knps = Int_t ((fgBMax - kr0)/kDr) - 1;
936 for (Int_t i = 0; (i < knps ); i++) {
937 // Transform into target frame
938 const Double_t kxx = x0 + r * TMath::Cos(kphi0) + kb / 2.;
939 const Double_t kyy = y0 + r * TMath::Sin(kphi0);
940 const Double_t kphi = TMath::ATan2(kyy, kxx);
941 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
942 // Radius in projectile frame
943 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + kb*kb - 2.*kr1*kb*TMath::Cos(kphi));
944 const Double_t ky = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
950 // Average over interactions
952 if(w) l += (2. * rw / w);
954 const Double_t knorm=fgWSta->Eval(1e-4);
955 if(knorm) l+= 2. * rw * kDr / knorm / knorm;
962 ret=TMath::Sqrt( l / kNpi);
966 Double_t AliFastGlauber::CrossSection(Double_t b1, Double_t b2) const
969 // Return the geometrical cross-section integrated from b1 to b2
971 return fgWSgeo->Integral(b1, b2)*10.; //mbarn
974 Double_t AliFastGlauber::HardCrossSection(Double_t b1, Double_t b2) const
977 // Return the hard cross-section integrated from b1 to b2
979 return fgWSbinary->Integral(b1, b2)*10.; //mbarn
982 Double_t AliFastGlauber::FractionOfHardCrossSection(Double_t b1, Double_t b2) const
985 // Return fraction of hard cross-section integrated from b1 to b2
987 return fgWSbinary->Integral(b1, b2)/fgWSbinary->Integral(0., 100.);
990 Double_t AliFastGlauber::NHard(Double_t b1, Double_t b2) const
993 // Number of binary hard collisions
994 // as a function of b (nucl/ex/0302016 eq. 19)
996 const Double_t kshard=HardCrossSection(b1,b2);
997 const Double_t ksgeo=CrossSection(b1,b2);
1003 Double_t AliFastGlauber::Binaries(Double_t b) const
1006 // Return number of binary hard collisions normalized to 1 at b=0
1009 return fgWSN->Eval(b)/fgWSN->Eval(1e-4);
1012 Double_t AliFastGlauber::MeanOverlap(Double_t b1, Double_t b2)
1015 // Calculate the mean overlap for impact parameter range b1 .. b2
1021 while (b < b2-0.005) {
1022 Double_t nc = GetNumberOfCollisions(b);
1023 sum += 10. * fgWStaa->Eval(b) * fgWSgeo->Eval(b) * 0.01 / (1. - TMath::Exp(-nc));
1024 sumc += 10. * fgWSgeo->Eval(b) * 0.01;
1027 return (sum / CrossSection(b1, b2));
1031 Double_t AliFastGlauber::MeanNumberOfCollisionsPerEvent(Double_t b1, Double_t b2)
1034 // Calculate the mean number of collisions per event for impact parameter range b1 .. b2
1040 while (b < b2-0.005) {
1041 Double_t nc = GetNumberOfCollisions(b);
1042 sum += nc / (1. - TMath::Exp(-nc)) * 10. * fgWSgeo->Eval(b) * 0.01;
1043 sumc += 10. * fgWSgeo->Eval(b) * 0.01;
1046 return (sum / CrossSection(b1, b2));
1050 Double_t AliFastGlauber::GetNumberOfBinaries(Double_t b) const
1053 // Return number of binary hard collisions at b
1056 return fgWSN->Eval(b);
1059 Double_t AliFastGlauber::Participants(Double_t b) const
1062 // Return the number of participants normalized to 1 at b=0
1065 return (fgWParticipants->Eval(b)/fgWParticipants->Eval(1e-4));
1068 Double_t AliFastGlauber::GetNumberOfParticipants(Double_t b) const
1071 // Return the number of participants for impact parameter b
1074 return (fgWParticipants->Eval(b));
1077 Double_t AliFastGlauber::GetNumberOfCollisions(Double_t b) const
1080 // Return the number of collisions for impact parameter b
1083 return (fgWStaa->Eval(b)*fSigmaNN);
1086 Double_t AliFastGlauber::GetNumberOfCollisionsPerEvent(Double_t b) const
1089 // Return the number of collisions per event (at least one collision)
1090 // for impact parameter b
1092 Double_t n = GetNumberOfCollisions(b);
1094 return (n / (1. - TMath::Exp(- n)));
1100 void AliFastGlauber::SimulateTrigger(Int_t n)
1103 // Simulates Trigger
1105 TH1F* mbtH = new TH1F("mbtH", "MB Trigger b-Distribution", 100, 0., 20.);
1106 TH1F* hdtH = new TH1F("hdtH", "Hard Trigger b-Distribution", 100, 0., 20.);
1107 TH1F* mbmH = new TH1F("mbmH", "MB Trigger Multiplicity Distribution", 100, 0., 8000.);
1108 TH1F* hdmH = new TH1F("hdmH", "Hard Trigger Multiplicity Distribution", 100, 0., 8000.);
1110 mbtH->SetXTitle("b [fm]");
1111 hdtH->SetXTitle("b [fm]");
1112 mbmH->SetXTitle("Multiplicity");
1113 hdmH->SetXTitle("Multiplicity");
1115 TCanvas *c0 = new TCanvas("c0","Trigger Simulation",400,10,600,700);
1117 TCanvas *c1 = new TCanvas("c1","Trigger Simulation",400,10,600,700);
1123 for (Int_t iev = 0; iev < n; iev++)
1126 GetRandom(b, p, mult);
1129 mbmH->Fill(mult, 1.);
1130 hdmH->Fill(mult, p);
1146 void AliFastGlauber::GetRandom(Float_t& b, Float_t& p, Float_t& mult)
1149 // Gives back a random impact parameter, hard trigger probability and multiplicity
1151 b = fgWSgeo->GetRandom();
1152 const Float_t kmu = fgWSN->Eval(b);
1153 p = 1.-TMath::Exp(-kmu);
1154 mult = 6000./fgWSN->Eval(1.) * kmu;
1157 void AliFastGlauber::GetRandom(Int_t& bin, Bool_t& hard)
1160 // Gives back a random impact parameter bin, and hard trigger decission
1162 const Float_t kb = fgWSgeo->GetRandom();
1163 const Float_t kmu = fgWSN->Eval(kb) * fSigmaHard;
1164 const Float_t kp = 1.-TMath::Exp(-kmu);
1167 } else if (kb < 8.6) {
1169 } else if (kb < 11.2) {
1171 } else if (kb < 13.2) {
1173 } else if (kb < 15.0) {
1179 const Float_t kr = gRandom->Rndm();
1180 if (kr < kp) hard = kTRUE;
1183 Double_t AliFastGlauber::GetRandomImpactParameter(Double_t bmin, Double_t bmax)
1186 // Gives back a random impact parameter in the range bmin .. bmax
1189 while(b < bmin || b > bmax)
1190 b = fgWSgeo->GetRandom();
1194 void AliFastGlauber::StoreFunctions() const
1197 // Store in file functions
1199 TFile* ff = new TFile(fName.Data(),"recreate");
1200 fgWStaa->Write("WStaa");
1201 fgWParticipants->Write("WParticipants");
1206 //=================== Added by A. Dainese 11/02/04 ===========================
1208 void AliFastGlauber::StoreAlmonds() const
1212 // 40 almonds for b = (0.25+k*0.5) fm (k=0->39)
1214 Char_t almondName[100];
1215 TFile* ff = new TFile(fName.Data(),"update");
1216 for(Int_t k=0; k<40; k++) {
1217 sprintf(almondName,"WAlmondFixedB%d",k);
1218 Double_t b = 0.25+k*0.5;
1219 Info("StoreAlmonds"," b = %f\n",b);
1220 fgWAlmond->SetParameter(0,b);
1221 fgWAlmond->Write(almondName);
1227 void AliFastGlauber::SetCentralityClass(Double_t xsecFrLow,Double_t xsecFrUp)
1230 // Set limits of centrality class as fractions
1231 // of the geomtrical cross section
1233 if(xsecFrLow>1. || xsecFrUp>1. || xsecFrLow>xsecFrUp) {
1234 Error("SetCentralityClass", "Please set 0 <= xsecFrLow <= xsecFrUp <= 1\n");
1238 Double_t bLow=0.,bUp=0.;
1240 const Double_t knorm=fgWSgeo->Integral(0.,100.);
1241 while(xsecFr<xsecFrLow) {
1242 xsecFr = fgWSgeo->Integral(0.,bLow)/knorm;
1246 while(xsecFr<xsecFrUp) {
1247 xsecFr = fgWSgeo->Integral(0.,bUp)/knorm;
1251 Info("SetCentralityClass", "Centrality class: %4.2f-%4.2f; %4.1f < b < %4.1f fm",
1252 xsecFrLow,xsecFrUp,bLow,bUp);
1253 fgWSbinary->SetRange(bLow,bUp);
1259 void AliFastGlauber::GetRandomBHard(Double_t& b)
1262 // Get random impact parameter according to distribution of
1263 // hard (binary) cross-section, in the range defined by the centrality class
1265 b = fgWSbinary->GetRandom();
1266 Int_t bin = 2*(Int_t)b;
1267 if( (b-(Int_t)b) > 0.5) bin++;
1268 fgWAlmondCurrent = fgWAlmondFixedB[bin];
1272 void AliFastGlauber::GetRandomXY(Double_t& x,Double_t& y)
1275 // Get random position of parton production point according to
1276 // product of thickness functions
1278 fgWAlmondCurrent->GetRandom2(x,y);
1282 void AliFastGlauber::GetRandomPhi(Double_t& phi)
1285 // Get random parton azimuthal propagation direction
1287 phi = 2.*TMath::Pi()*gRandom->Rndm();
1291 Double_t AliFastGlauber::CalculateLength(Double_t b,Double_t x0,Double_t y0,Double_t phi0)
1294 // Calculate path length for a parton with production point (x0,y0)
1295 // and propagation direction (ux=cos(phi0),uy=sin(phi0))
1296 // in a collision with impact parameter b
1299 // number of steps in l
1300 const Int_t kNp = 100;
1301 const Double_t kDl = fgBMax/Double_t(kNp);
1307 // ell = 2 * \int_0^\infty dl*l*(T_A*T_B)(x0+l*ux,y0+l*uy) /
1308 // \int_0^\infty dl*(T_A*T_B)(x0+l*ux,y0+l*uy)
1312 const Double_t kr0 = TMath::Sqrt(x0*x0 + y0*y0);
1313 const Int_t knps = Int_t ((fgBMax - kr0)/kDl) - 1;
1315 Double_t integral1 = 0.;
1316 Double_t integral2 = 0.;
1318 for (Int_t i = 0; i < knps; i++) {
1320 // Transform into target frame
1321 const Double_t kxx = x0 + l * TMath::Cos(phi0) + b / 2.;
1322 const Double_t kyy = y0 + l * TMath::Sin(phi0);
1323 const Double_t kphi = TMath::ATan2(kyy, kxx);
1324 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
1325 // Radius in projectile frame
1326 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + b*b - 2.*kr1*b*TMath::Cos(kphi));
1327 const Double_t kprodTATB = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
1329 integral1 += kprodTATB * l * kDl;
1330 integral2 += kprodTATB * kDl;
1336 ell = (2. * integral1 / integral2);
1338 } else if(fEllDef==2) {
1342 // ell = \int_0^\infty dl*
1343 // \Theta((T_A*T_B)(x0+l*ux,y0+l*uy)-0.5*(T_A*T_B)(0,0))
1347 const Double_t kr0 = TMath::Sqrt(x0*x0 + y0*y0);
1348 const Int_t knps = Int_t ((fgBMax - kr0)/kDl) - 1;
1349 const Double_t kprodTATBHalfMax = 0.5*fgWAlmondCurrent->Eval(0.,0.);
1352 Double_t integral = 0.;
1353 for (Int_t i = 0; i < knps; i++) {
1354 // Transform into target frame
1355 const Double_t kxx = x0 + l * TMath::Cos(phi0) + b / 2.;
1356 const Double_t kyy = y0 + l * TMath::Sin(phi0);
1357 const Double_t kphi = TMath::ATan2(kyy, kxx);
1358 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
1359 // Radius in projectile frame
1360 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + b*b - 2.*kr1*b*TMath::Cos(kphi));
1361 const Double_t kprodTATB = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
1362 if(kprodTATB>kprodTATBHalfMax) integral += kDl;
1365 Double_t ell = integral;
1368 Error("CalculateLength","Wrong length definition setting: %d !\n",fEllDef);
1373 void AliFastGlauber::GetLengthAndPhi(Double_t& ell,Double_t& phi,Double_t b)
1376 // Return length from random b, x0, y0, phi0
1379 Double_t x0,y0,phi0;
1380 if(b<0.) GetRandomBHard(b);
1384 ell = CalculateLength(b,x0,y0,phi0);
1388 void AliFastGlauber::GetLength(Double_t& ell,Double_t b)
1391 // Return length from random b, x0, y0, phi0
1394 GetLengthAndPhi(ell,phi,b);
1398 void AliFastGlauber::GetLengthsBackToBackAndPhi(Double_t& ell1,Double_t& ell2,Double_t &phi,Double_t b)
1401 // Return 2 lengths back to back from random b, x0, y0, phi0
1404 Double_t x0,y0,phi0;
1405 if(b<0.) GetRandomBHard(b);
1408 const Double_t kphi0plusPi = phi0+TMath::Pi();
1410 ell1 = CalculateLength(b,x0,y0,phi0);
1411 ell2 = CalculateLength(b,x0,y0,kphi0plusPi);
1415 void AliFastGlauber::GetLengthsBackToBack(Double_t& ell1,Double_t& ell2,
1419 // Return 2 lengths back to back from random b, x0, y0, phi0
1422 GetLengthsBackToBackAndPhi(ell1,ell2,phi,b);
1426 void AliFastGlauber::GetLengthsForPythia(Int_t n,Double_t* phi,Double_t* ell, Double_t b)
1429 // Returns lenghts for n partons with azimuthal angles phi[n]
1430 // from random b, x0, y0
1433 if(b < 0.) GetRandomBHard(b);
1435 for(Int_t i = 0; i< n; i++) ell[i] = CalculateLength(b,x0,y0,phi[i]);
1439 void AliFastGlauber::PlotBDistr(Int_t n)
1442 // Plot distribution of n impact parameters
1445 TH1F *hB = new TH1F("hB","dN/db",100,0,fgBMax);
1446 hB->SetXTitle("b [fm]");
1447 hB->SetYTitle("dN/db [a.u.]");
1448 hB->SetFillColor(3);
1449 for(Int_t i=0; i<n; i++) {
1453 TCanvas *cB = new TCanvas("cB","Impact parameter distribution",0,0,500,500);
1459 void AliFastGlauber::PlotLengthDistr(Int_t n,Bool_t save,const char *fname)
1462 // Plot length distribution
1465 TH1F *hEll = new TH1F("hEll","Length distribution",64,-0.5,15);
1466 hEll->SetXTitle("Transverse path length, L [fm]");
1467 hEll->SetYTitle("Probability");
1468 hEll->SetFillColor(2);
1469 for(Int_t i=0; i<n; i++) {
1473 hEll->Scale(1/(Double_t)n);
1474 TCanvas *cL = new TCanvas("cL","Length distribution",0,0,500,500);
1479 TFile *f = new TFile(fname,"recreate");
1486 void AliFastGlauber::PlotLengthB2BDistr(Int_t n,Bool_t save,const char *fname)
1489 // Plot lengths back-to-back distributions
1492 TH2F *hElls = new TH2F("hElls","Lengths back-to-back",100,0,15,100,0,15);
1493 hElls->SetXTitle("Transverse path length, L [fm]");
1494 hElls->SetYTitle("Transverse path length, L [fm]");
1495 for(Int_t i=0; i<n; i++) {
1496 GetLengthsBackToBack(ell1,ell2);
1497 hElls->Fill(ell1,ell2);
1499 hElls->Scale(1/(Double_t)n);
1500 TCanvas *cLs = new TCanvas("cLs","Length back-to-back distribution",0,0,500,500);
1501 gStyle->SetPalette(1,0);
1503 hElls->Draw("col,Z");
1505 TFile *f = new TFile(fname,"recreate");
1512 void AliFastGlauber::PlotAlmonds() const
1515 // Plot almonds for some impact parameters
1517 TCanvas *c = new TCanvas("c","Almonds",0,0,500,500);
1518 gStyle->SetPalette(1,0);
1521 fgWAlmondFixedB[0]->Draw("cont1");
1523 fgWAlmondFixedB[10]->Draw("cont1");
1525 fgWAlmondFixedB[20]->Draw("cont1");
1527 fgWAlmondFixedB[30]->Draw("cont1");
1531 //=================== Added by A. Dainese 05/03/04 ===========================
1533 void AliFastGlauber::CalculateI0I1(Double_t& integral0,Double_t& integral1,
1534 Double_t b,Double_t x0,Double_t y0,
1535 Double_t phi0,Double_t ellCut) const
1538 // Calculate integrals:
1539 // integral0 = \int_0^ellCut dl*(T_A*T_B)(x0+l*ux,y0+l*uy)
1540 // integral1 = \int_0^ellCut dl*l*(T_A*T_B)(x0+l*ux,y0+l*uy)
1542 // for a parton with production point (x0,y0)
1543 // and propagation direction (ux=cos(phi0),uy=sin(phi0))
1544 // in a collision with impact parameter b
1547 // number of steps in l
1548 const Int_t kNp = 100;
1549 const Double_t kDl = fgBMax/Double_t(kNp);
1552 const Double_t kr0 = TMath::Sqrt(x0 * x0 + y0 * y0);
1553 const Int_t knps = Int_t ((fgBMax - kr0)/kDl) - 1;
1560 while((i < knps) && (l < ellCut)) {
1561 // Transform into target frame
1562 const Double_t kxx = x0 + l * TMath::Cos(phi0) + b / 2.;
1563 const Double_t kyy = y0 + l * TMath::Sin(phi0);
1564 const Double_t kphi = TMath::ATan2(kyy, kxx);
1565 const Double_t kr1 = TMath::Sqrt(kxx*kxx + kyy*kyy);
1566 // Radius in projectile frame
1567 const Double_t kr2 = TMath::Sqrt(kr1*kr1 + b*b - 2.*kr1*b*TMath::Cos(kphi));
1568 const Double_t kprodTATB = fgWSta->Eval(kr1) * fgWSta->Eval(kr2);
1569 integral0 += kprodTATB * kDl;
1570 integral1 += kprodTATB * l * kDl;
1577 void AliFastGlauber::GetI0I1AndPhi(Double_t& integral0,Double_t& integral1,
1579 Double_t ellCut,Double_t b)
1582 // Return I0 and I1 from random b, x0, y0, phi0
1585 Double_t x0,y0,phi0;
1586 if(b<0.) GetRandomBHard(b);
1590 CalculateI0I1(integral0,integral1,b,x0,y0,phi0,ellCut);
1594 void AliFastGlauber::GetI0I1(Double_t& integral0,Double_t& integral1,
1595 Double_t ellCut,Double_t b)
1598 // Return I0 and I1 from random b, x0, y0, phi0
1601 GetI0I1AndPhi(integral0,integral1,phi,ellCut,b);
1605 void AliFastGlauber::GetI0I1BackToBackAndPhi(Double_t& integral01,Double_t& integral11,
1606 Double_t& integral02,Double_t& integral12,
1608 Double_t ellCut,Double_t b)
1611 // Return 2 pairs of I0 and I1 back to back from random b, x0, y0, phi0
1614 Double_t x0,y0,phi0;
1615 if(b<0.) GetRandomBHard(b);
1619 const Double_t kphi0plusPi = phi0+TMath::Pi();
1620 CalculateI0I1(integral01,integral11,b,x0,y0,phi0,ellCut);
1621 CalculateI0I1(integral02,integral12,b,x0,y0,kphi0plusPi,ellCut);
1625 void AliFastGlauber::GetI0I1BackToBackAndPhiAndXY(Double_t& integral01,Double_t& integral11,
1626 Double_t& integral02,Double_t& integral12,
1627 Double_t& phi,Double_t &x,Double_t &y,
1628 Double_t ellCut,Double_t b)
1631 // Return 2 pairs of I0 and I1 back to back from random b, x0, y0, phi0
1634 Double_t x0,y0,phi0;
1635 if(b<0.) GetRandomBHard(b);
1638 phi = phi0; x=x0; y=y0;
1639 const Double_t kphi0plusPi = phi0+TMath::Pi();
1640 CalculateI0I1(integral01,integral11,b,x0,y0,phi0,ellCut);
1641 CalculateI0I1(integral02,integral12,b,x0,y0,kphi0plusPi,ellCut);
1645 void AliFastGlauber::GetI0I1BackToBack(Double_t& integral01,Double_t& integral11,
1646 Double_t& integral02,Double_t& integral12,
1647 Double_t ellCut,Double_t b)
1650 // Return 2 pairs of I0 and I1 back to back from random b, x0, y0, phi0
1653 GetI0I1BackToBackAndPhi(integral01,integral11,integral02,integral12,
1658 void AliFastGlauber::GetI0I1ForPythia(Int_t n,Double_t* phi,
1659 Double_t* integral0,Double_t* integral1,
1660 Double_t ellCut,Double_t b)
1663 // Returns I0 and I1 pairs for n partons with azimuthal angles phi[n]
1664 // from random b, x0, y0
1667 if(b<0.) GetRandomBHard(b);
1669 for(Int_t i=0; i<n; i++)
1670 CalculateI0I1(integral0[i],integral1[i],b,x0,y0,phi[i],ellCut);
1674 void AliFastGlauber::GetI0I1ForPythiaAndXY(Int_t n,Double_t* phi,
1675 Double_t* integral0,Double_t* integral1,
1676 Double_t &x,Double_t& y,
1677 Double_t ellCut,Double_t b)
1680 // Returns I0 and I1 pairs for n partons with azimuthal angles phi[n]
1681 // from random b, x0, y0 and return x0,y0
1684 if(b<0.) GetRandomBHard(b);
1686 for(Int_t i=0; i<n; i++)
1687 CalculateI0I1(integral0[i],integral1[i],b,x0,y0,phi[i],ellCut);
1693 void AliFastGlauber::PlotI0I1Distr(Int_t n,Double_t ellCut,
1694 Bool_t save,const char *fname)
1697 // Plot I0-I1 distribution
1700 TH2F *hI0I1s = new TH2F("hI0I1s","I_{0} versus I_{1}",1000,0,0.001,1000,0,0.01);
1701 hI0I1s->SetXTitle("I_{0} [fm^{-3}]");
1702 hI0I1s->SetYTitle("I_{1} [fm^{-2}]");
1704 TH1F *hI0 = new TH1F("hI0","I_{0} = #hat{q}L / k",
1706 hI0->SetXTitle("I_{0} [fm^{-3}]");
1707 hI0->SetYTitle("Probability");
1708 hI0->SetFillColor(3);
1709 TH1F *hI1 = new TH1F("hI1","I_{1} = #omega_{c} / k",
1711 hI1->SetXTitle("I_{1} [fm^{-2}]");
1712 hI1->SetYTitle("Probability");
1713 hI1->SetFillColor(4);
1714 TH1F *h2 = new TH1F("h2","2 I_{1}^{2}/I_{0} = R / k",
1716 h2->SetXTitle("2 I_{1}^{2}/I_{0} [fm^{-1}]");
1717 h2->SetYTitle("Probability");
1718 h2->SetFillColor(2);
1719 TH1F *h3 = new TH1F("h3","2 I_{1}/I_{0} = L",
1721 h3->SetXTitle("2 I_{1}/I_{0} [fm]");
1722 h3->SetYTitle("Probability");
1723 h3->SetFillColor(5);
1724 TH1F *h4 = new TH1F("h4","I_{0}^{2}/(2 I_{1}) = #hat{q} / k",
1726 h4->SetXTitle("I_{0}^{2}/(2 I_{1}) [fm^{-4}]");
1727 h4->SetYTitle("Probability");
1728 h4->SetFillColor(7);
1730 for(Int_t i=0; i<n; i++) {
1731 GetI0I1(i0,i1,ellCut);
1732 hI0I1s->Fill(i0,i1);
1735 h2->Fill(2.*i1*i1/i0);
1737 h4->Fill(i0*i0/2./i1);
1739 hI0->Scale(1/(Double_t)n);
1740 hI1->Scale(1/(Double_t)n);
1741 h2->Scale(1/(Double_t)n);
1742 h3->Scale(1/(Double_t)n);
1743 h4->Scale(1/(Double_t)n);
1744 hI0I1s->Scale(1/(Double_t)n);
1746 TCanvas *cI0I1 = new TCanvas("cI0I1","I0 and I1",0,0,900,700);
1759 gStyle->SetPalette(1,0);
1760 hI0I1s->Draw("col,Z");
1763 TFile *f = new TFile(fname,"recreate");
1775 void AliFastGlauber::PlotI0I1B2BDistr(Int_t n,Double_t ellCut,
1776 Bool_t save,const char *fname)
1779 // Plot I0-I1 back-to-back distributions
1781 Double_t i01,i11,i02,i12;
1782 TH2F *hI0s = new TH2F("hI0s","I_{0}'s back-to-back",100,0,100,100,0,100);
1783 hI0s->SetXTitle("I_{0} [fm^{-3}]");
1784 hI0s->SetYTitle("I_{0} [fm^{-3}]");
1785 TH2F *hI1s = new TH2F("hI1s","I_{1}'s back-to-back",100,0,100,100,0,100);
1786 hI1s->SetXTitle("I_{1} [fm^{-2}]");
1787 hI1s->SetYTitle("I_{1} [fm^{-2}]");
1789 for(Int_t i=0; i<n; i++) {
1790 GetI0I1BackToBack(i01,i11,i02,i12,ellCut);
1791 hI0s->Fill(i01,i02);
1792 hI1s->Fill(i11,i12);
1794 hI0s->Scale(1/(Double_t)n);
1795 hI1s->Scale(1/(Double_t)n);
1797 TCanvas *cI0I1s = new TCanvas("cI0I1s","I0 and I1 back-to-back distributions",0,0,800,400);
1798 gStyle->SetPalette(1,0);
1799 cI0I1s->Divide(2,1);
1801 hI0s->Draw("col,Z");
1803 hI1s->Draw("col,Z");
1806 TFile *f = new TFile(fname,"recreate");
1814 AliFastGlauber& AliFastGlauber::operator=(const AliFastGlauber& rhs)
1816 // Assignment operator
1821 void AliFastGlauber::Copy(TObject&) const
1826 Fatal("Copy","Not implemented!\n");