52     ParAveT2(0.), ParSigLogT1(0.), ParSigLogT2(0.),
 
   53     ParSigLogA1(0.), ParSigLogA2(0.), ParRho1(0.), ParRho2(0.), ParsAveA2(0.),
 
   54     AveLogAlphah(0.), AveLogTmaxh(0.), SigmaLogAlphah(0.), SigmaLogTmaxh(0.),
 
   55     Rhoh(0.), Alphah(0.), Tmaxh(0.), Betah(0.), AveLogAlpha(0.), AveLogTmax(0.),
 
   56     SigmaLogAlpha(0.), SigmaLogTmax(0.), Rho(0.), 
Alpha(0.), Tmax(0.), Beta(0.)
 
   59   else      { thePar = aPar; owning = 
false; }
 
  100   ParRT1 = thePar->
ParRT1();
 
  101   ParRT2 = thePar->
ParRT2();
 
  102   ParRT3 = thePar->
ParRT3();
 
  103   ParRT4 = thePar->
ParRT4(); 
 
  104   ParRT5 = thePar->
ParRT5();
 
  105   ParRT6 = thePar->
ParRT6();
 
  136   G4cout << 
"/********************************************/ " << 
G4endl;
 
  137   G4cout << 
"  - GFlashSamplingShowerParameterisation::Constructor -  " << 
G4endl;
 
  138   G4cout << 
"/********************************************/ " << 
G4endl;  
 
  145   if(owning) { 
delete thePar; }
 
  159   Ec1      = 2.66 * std::pow((X01 * Z1 / A1),1.1); 
 
  167   Ec2      = 2.66 * std::pow((X02 * Z2 / A2),1.1); 
 
  176   G4cout << 
"/************ ComputeZAX0EFFetc ************/" << 
G4endl;
 
  177   G4cout << 
"  - GFlashSamplingShowerParameterisation::Material -  " << 
G4endl;
 
  182   G4double denominator = (d1*density1 + d2*density2);
 
  183   G4double W1 = (d1*density1) / denominator;
 
  184   G4double W2  = (d2*density2)/denominator;
 
  185   Zeff   = ( W1*Z2 ) + (W2*Z1);    
 
  186   Aeff   = ( W1*A1 ) + (W2*A2);
 
  187   X0eff  =(1/ (( W1 / X01) +( W2 / X02))); 
 
  188   Rhoeff = ( (d1 *density1 ) + (d2 * density2 ))/
G4double (d2  + d1  );
 
  189   Rmeff =  1/  ((((W1*Ec1)/ X01)   +   ((W2* Ec2)/  X02) ) / Es ) ;
 
  190   Eceff =  X0eff *((W1*Ec1)/ X01 + (W2* Ec2)/  X02 );      
 
  192   ehat = (1. / (1+ 0.007*(Z1- Z2)));
 
  196   G4cout << 
"effective quantities Zeff = "<<Zeff<< 
G4endl;
 
  197   G4cout << 
"effective quantities Aeff = "<<Aeff<< 
G4endl;
 
  198   G4cout << 
"effective quantities Rhoeff = "<<Rhoeff/
g *
cm3<<
" g/cm3"  << 
G4endl;
 
  199   G4cout << 
"effective quantities X0eff = "<<X0eff/
cm <<
" cm" << 
G4endl;
 
  201   X0eff = X0eff * Rhoeff;
 
  203   G4cout << 
"effective quantities X0eff = "<<X0eff/
g*
cm2 <<
" g/cm2" << 
G4endl;  
 
  204   X0eff = X0eff /Rhoeff;
 
  205   G4cout << 
"effective quantities RMeff = "<<Rmeff/
cm<<
"  cm" << 
G4endl; 
 
  206   Rmeff = Rmeff* Rhoeff;
 
  207   G4cout << 
"effective quantities RMeff = "<<Rmeff/
g *
cm2<<
" g/cm2" << 
G4endl;  
 
  208   Rmeff = Rmeff/ Rhoeff;
 
  209   G4cout << 
"effective quantities Eceff = "<<Eceff/
MeV<< 
" MeV"<< 
G4endl;  
 
  212   G4cout << 
"/********************************************/ " <<
G4endl; 
 
  220   if ((material1==0) || (material2 ==0))
 
  222     G4Exception(
"GFlashSamplingShowerParameterisation::GenerateLongitudinalProfile()",
 
  226   ComputeLongitudinalParameters(y);  
 
  227   GenerateEnergyProfile(y);
 
  228   GenerateNSpotProfile(y);
 
  234 GFlashSamplingShowerParameterisation::ComputeLongitudinalParameters(
G4double y)
 
  236   AveLogTmaxh  = std::log(std::max(ParAveT1 +std::log(y),0.1));  
 
  237   AveLogAlphah = std::log(std::max(ParAveA1 + (ParAveA2+ParAveA3/Zeff)*std::log(y),.1)); 
 
  239   SigmaLogTmaxh  = std::min(0.5,1.00/( ParSigLogT1 + ParSigLogT2*std::log(y)) );  
 
  240   SigmaLogAlphah = std::min(0.5,1.00/( ParSigLogA1 + ParSigLogA2*std::log(y)));  
 
  241   Rhoh           = ParRho1+ParRho2*std::log(y);
 
  243   AveLogTmax  = std::max(0.1,std::log(std::exp(AveLogTmaxh)
 
  244               + ParsAveT1/Fs + ParsAveT2*(1-ehat)));  
 
  245   AveLogAlpha = std::max(0.1,std::log(std::exp(AveLogAlphah)
 
  248   SigmaLogTmax  = std::min(0.5,1.00/( ParsSigLogT1
 
  249                 + ParsSigLogT2*std::log(y)) );  
 
  250   SigmaLogAlpha = std::min(0.5,1.00/( ParsSigLogA1
 
  251                 + ParsSigLogA2*std::log(y))); 
 
  252   Rho           = ParsRho1+ParsRho2*std::log(y); 
 
  257 void GFlashSamplingShowerParameterisation::GenerateEnergyProfile(
G4double )
 
  259   G4double Correlation1 = std::sqrt((1+Rho)/2);
 
  260   G4double Correlation2 = std::sqrt((1-Rho)/2);
 
  261   G4double Correlation1h = std::sqrt((1+Rhoh)/2);
 
  262   G4double Correlation2h = std::sqrt((1-Rhoh)/2);
 
  263   G4double Random1 = G4RandGauss::shoot();
 
  264   G4double Random2 = G4RandGauss::shoot();
 
  266   Tmax  = std::max(1.,std::exp( AveLogTmax  + SigmaLogTmax  *
 
  267   (Correlation1*Random1 + Correlation2*Random2) ));
 
  268   Alpha = std::max(1.1,std::exp( AveLogAlpha + SigmaLogAlpha *
 
  269   (Correlation1*Random1 - Correlation2*Random2) ));
 
  270   Beta  = (Alpha-1.00)/Tmax;
 
  272   Tmaxh  = std::exp( AveLogTmaxh  + SigmaLogTmaxh  *
 
  273   (Correlation1h*Random1 + Correlation2h*Random2) );  
 
  274   Alphah = std::exp( AveLogAlphah + SigmaLogAlphah *
 
  275   (Correlation1h*Random1 - Correlation2h*Random2) );
 
  276   Betah  = (Alphah-1.00)/Tmaxh;
 
  281 void GFlashSamplingShowerParameterisation::GenerateNSpotProfile(
const G4double y)
 
  283   TNSpot     = Tmaxh *  (ParsSpotT1+ParsSpotT2*Zeff); 
 
  284   TNSpot     = std::max(0.5,Tmaxh * (ParsSpotT1+ParsSpotT2*Zeff));
 
  285   AlphaNSpot = Alphah * (ParsSpotA1+ParsSpotA2*Zeff);     
 
  286   BetaNSpot  = (AlphaNSpot-1.00)/TNSpot;           
 
  287   NSpot      = ParsSpotN1 /SamplingResolution * std::pow(y*Eceff/
GeV,ParsSpotN2 );
 
  297   G4double Resolution     = std::pow(SamplingResolution,2);
 
  304   if(Resolution >0.0 && DEne > 0.00)
 
  310   return DEneFluctuated;
 
  318   G4double LongitudinalStepInX0 = LongitudinalStep / X0eff;
 
  321   float x3 =  
gam(x1,x2);
 
  331   G4double LongitudinalStepInX0 = LongitudinalStep / X0eff; 
 
  332   G4float x1 = BetaNSpot*LongitudinalStepInX0;
 
  356   if(Random1  <WeightCore) 
 
  358     Radius = Rmeff * RadiusCore * std::sqrt( Random2/(1. - Random2) );
 
  362     Radius = Rmeff * RadiusTail * std::sqrt( Random2/(1. - Random2) );
 
  364   Radius =  std::min(Radius,
DBL_MAX);
 
  374   G4double tau = LongitudinalPosition / Tmax/ X0eff     
 
  375                  * (Alpha-1.00) /Alpha
 
  376                  * std::exp(AveLogAlpha)/(std::exp(AveLogAlpha)-1.);  
 
  385   G4double z1 = ParRC1 + ParRC2* std::log(Energy/
GeV);         
 
  387   RadiusCore  =  z1 + z2 * Tau;                                
 
  391   WeightCore   =  p1 * std::exp( (p2-Tau)/p3-  std::exp( (p2-Tau) /p3) ); 
 
  398   RadiusTail   = k1*(std::exp(k3*(Tau-k2))
 
  399                + std::exp(k4*(Tau-k2)) );            
 
  403   RadiusCore   = RadiusCore + ParsRC1*(1-ehat) + ParsRC2/Fs*std::exp(-Tau); 
 
  404   WeightCore   = WeightCore + (1-ehat)
 
  405                             * (ParsWC1+ParsWC2/Fs * std::exp(-std::pow((Tau-1.),2))); 
 
  406   RadiusTail   = RadiusTail + (1-ehat)* ParsRT1+ ParsRT2/Fs *std::exp(-Tau);