25 #include "StMessMgr.h"
26 #include "StGlauberUtilities.h"
30 namespace GlauberUtilities {
33 Double_t WoodsSaxon(Double_t* x, Double_t* par)
35 const Double_t r = x[0] ;
36 const Double_t R = par[0] ;
37 const Double_t d = par[1] ;
39 return r*r/(1.0+TMath::Exp((r-R)/d)) ;
44 Double_t WoodsSaxon2D(Double_t* x, Double_t* par)
46 const Double_t r = x[0] ;
47 const Double_t cosTheta = x[1] ;
48 const Double_t R0 = par[0] ;
49 const Double_t d = par[1] ;
50 const Double_t beta2 = par[2] ;
51 const Double_t beta4 = par[3] ;
52 const Double_t beta6 = 0.0 ;
54 const Double_t cosTheta2 = cosTheta * cosTheta ;
55 const Double_t cosTheta4 = cosTheta2 * cosTheta2 ;
58 const Double_t Y20 = TMath::Sqrt(5.0/TMath::Pi()) / 4.0 * (3.0 * cosTheta2 - 1.0 ) ;
59 const Double_t Y40 = TMath::Sqrt(1.0/TMath::Pi()) * 3.0 / 16.0 * (35.0*cosTheta4 - 30.0*cosTheta2 + 3.0);
61 const Double_t Y60 = 0.0 ;
63 const Double_t R = R0 * (1.0 + beta2 * Y20 + beta4 * Y40 + beta6 * Y60 ) ;
65 return r*r/(1.0+TMath::Exp((r-R)/d)) ;
70 Double_t StepFunction(Double_t* x, Double_t* par)
75 Double_t position = TMath::Sqrt(dx*dx + dy*dy + dz*dz);
76 Double_t sigma = par[0] ;
78 const Double_t pi = TMath::Pi() ;
79 const Double_t r2 = sigma/pi ;
80 const Double_t r = TMath::Sqrt(r2);
83 const Double_t V = 4.0*pi*r2*r/3.0 ;
84 return (r - position < 0.0) ? 0.0 : 1.0/V ;
89 Double_t Gaussian(Double_t* x, Double_t* par)
94 Double_t r = TMath::Sqrt(dx*dx + dy*dy + dz*dz) ;
95 Double_t sigma2 = par[0]*par[0] ;
96 const Double_t norm = 2.0*TMath::Pi()*sigma2 ;
98 return 1.0/TMath::Power(norm, 3.0/2.0) * TMath::Exp(-0.5*r*r/sigma2);
103 const UShort_t StGlauberUtilities::mDebugLevel = 20 ;
118 StGlauberUtilities::StGlauberUtilities()
120 LOG_INFO <<
"StGlauberUtilities Initialize StGlauberUtilities" << endm;
123 mRandom =
new TRandom3() ;
125 LOG_INFO <<
"StGlauberUtilities Set random number seed = " << mRandom->GetSeed() << endm;
128 mImpactParameter =
new TF1(
"mImpactParameter",
"x", 0, 20.0);
129 LOG_INFO <<
"StGlauberUtilities Set impact parameter distributions: "
130 << mImpactParameter->GetXmin()
132 << mImpactParameter->GetXmax()
140 StGlauberUtilities::~StGlauberUtilities()
149 if(!mImpactParameter){
150 Error(
"StGlauberUtilities::GetImpactParameter",
"cannot find impact parameter distribution (TF1). abort");
153 const Double_t b = mImpactParameter->GetRandom() ;
156 LOG_INFO <<
"StGlauberUtilities::GetImpactParameter Generate random b = "
167 return mImpactParameter->GetXmax() ;
175 const Double_t theta = TMath::ACos(mRandom->Rndm()*2.0-1.0);
178 LOG_INFO <<
"StGlauberUtilities::GetTheta Generate random theta = " << theta << endm;
188 const Double_t phi = mRandom->Rndm()*TMath::Pi()*2.0 - TMath::Pi() ;
191 LOG_INFO <<
"StGlauberUtilities::GetPhi Generate random phi = " << phi << endm;
201 return mRandom->Rndm() ;
207 return mRandom->Uniform(0,2);
214 LOG_INFO <<
"StGlauberUtilities::SetDebug Set debug level = " << mDebug << endm;
Double_t GetTheta() const
Get theta (polar angle)
Double_t GetMaximumImpactParameter() const
Get maximum impact parameter.
Double_t GetImpactParameter() const
Default destructor.
Double_t GetUniform() const
Get uniform distribution in 0 < x < 1.
void SetDebug(const UInt_t debug)
Set debug level.
Double_t GetUniform2() const
Double_t GetPhi() const
Get phi (azimuthal angle)