80 return 4*costheta2/(2*costheta2-klk2+2*std::sqrt(costheta2*(costheta2-klk2)));
82 return std::norm(2*std::sqrt(costheta2)/(std::sqrt(costheta2) + std::sqrt(std::complex<G4double>(costheta2 - klk2))));
93 (2*costhetas2+klks2+2*std::sqrt(costhetas2*(costhetas2+klks2)));
107 if ((std::fabs(thetai-thetao)<AngCut) && (std::fabs(phio)<AngCut))
113 G4double sinthetai=std::sin(thetai);
114 G4double sinthetao=std::sin(thetao);
116 (sinthetai*sinthetai+sinthetao*sinthetao-
117 2.*sinthetai*sinthetao*std::cos(phio));
122 return b2*w2/
twopi*std::exp(-mu_squared*w2/2);
139 if ((std::fabs(thetarefract-thetaSo)<AngCut) && (std::fabs(phiSo)<AngCut))
143 G4double sinthetai=std::sin(thetai);
144 G4double sinthetaSo=std::sin(thetaSo);
147 mu_squared=k*k*sinthetai*sinthetai+kS*kS*sinthetaSo*sinthetaSo-
148 2.*k*kS*sinthetai*sinthetaSo*std::cos(phiSo);
153 return b2*w2/
twopi*std::exp(-mu_squared*w2/2);
170 G4double a_max_theta_o, max_theta_o=theta_i, a_max_phi_o, max_phi_o=0.;
182 G4double costheta_i=std::cos(theta_i);
183 G4double costheta_i_squared=costheta_i*costheta_i;
201 for (theta_o=0.*
degree; theta_o<=90.*
degree+1
e-6; theta_o+=ang_steptheta)
203 costheta_o_squared=std::cos(theta_o)*std::cos(theta_o);
207 for (phi_o=-180.*
degree; phi_o<=180.*
degree+1e-6; phi_o+=ang_stepphi)
211 Intens=kl4d4/costheta_i*
S2(costheta_i_squared,klk2)*
212 S2(costheta_o_squared,klk2)*
213 Fmu(k2,theta_i,theta_o,phi_o,b2,w2,AngCut)*std::sin(theta_o);
230 wkeit+=Intens*ang_steptheta*ang_stepphi;
243 while ((ang_stepphi>=AngCut*AngCut) || (ang_steptheta>=AngCut*AngCut))
245 a_max_theta_o=max_theta_o;
246 a_max_phi_o=max_phi_o;
254 for (theta_o=a_max_theta_o-ang_steptheta;
255 theta_o<=a_max_theta_o-ang_steptheta+1e-6;
256 theta_o+=ang_steptheta)
259 costheta_o_squared=std::cos(theta_o)*std::cos(theta_o);
260 for (phi_o=a_max_phi_o-ang_stepphi;
261 phi_o<=a_max_phi_o+ang_stepphi+1e-6;
265 Intens=kl4d4/costheta_i*
S2(costheta_i_squared, klk2)*
266 S2(costheta_o_squared,klk2)*
267 Fmu(k2,theta_i,theta_o,phi_o,b2,w2,AngCut)*std::sin(theta_o);
290 G4double a_max_thetas_o, max_thetas_o = theta_i;
291 G4double a_max_phis_o, max_phis_o = 0.;
297 G4double costheta_i=std::cos(theta_i);
298 G4double costheta_i_squared=costheta_i*costheta_i;
303 if (E < fermipot)
return wkeit;
312 G4double klks2=fermipot/(E-fermipot);
315 G4double ksdk=std::sqrt((E-fermipot)/E);
325 for (thetas_o=0.*
degree; thetas_o<=90.*
degree+1
e-6; thetas_o+=ang_steptheta)
327 costhetas_o_squared=std::cos(thetas_o)*std::cos(thetas_o);
329 for (phis_o=-180.*
degree; phis_o<=180.*
degree+1e-6; phis_o+=ang_stepphi)
332 if (costhetas_o_squared>=-klks2) {
337 if (std::fabs(std::sin(theta_i)/ksdk) <= 1.)
338 thetarefract = std::asin(std::sin(theta_i)/ksdk);
340 IntensS = kl4d4/costheta_i*ksdk*
S2(costheta_i_squared, klk2)*
341 SS2(costhetas_o_squared,klks2)*
342 FmuS(k,kS,theta_i,thetas_o,phis_o,b2,w2,AngCut,thetarefract)*
353 wkeit+=IntensS*ang_steptheta*ang_stepphi;
364 while (ang_stepphi>=AngCut*AngCut || ang_steptheta>=AngCut*AngCut)
366 a_max_thetas_o=max_thetas_o;
367 a_max_phis_o=max_phis_o;
372 for (thetas_o=a_max_thetas_o-ang_steptheta;
373 thetas_o<=a_max_thetas_o-ang_steptheta+1e-6;
374 thetas_o+=ang_steptheta)
376 costhetas_o_squared=std::cos(thetas_o)*std::cos(thetas_o);
377 for (phis_o=a_max_phis_o-ang_stepphi;
378 phis_o<=a_max_phis_o+ang_stepphi+1e-6;
382 if (std::fabs(std::sin(theta_i)/ksdk) <= 1.)
383 thetarefract = std::asin(std::sin(theta_i)/ksdk);
385 IntensS=kl4d4/costheta_i*ksdk*
S2(costheta_i_squared, klk2)*
386 SS2(costhetas_o_squared,klks2)*
387 FmuS(k,kS,theta_i,thetas_o,phis_o,b2,w2,AngCut,thetarefract)*
392 max_thetas_o=thetas_o;
418 G4double costheta_i=std::cos(theta_i);
419 G4double costheta_o=std::cos(theta_o);
423 return kl4d4/costheta_i*
S2(costheta_i*costheta_i, klk2)*
424 S2(costheta_o*costheta_o,klk2)*
444 G4double klks2=fermipot/(E-fermipot);
452 G4double ksdk=std::sqrt((E-fermipot)/E);
460 G4double costheta_i=std::cos(theta_i);
461 G4double costhetas_o=std::cos(thetas_o);
466 if(std::fabs(std::sin(theta_i)/ksdk) <= 1.)thetarefract = std::asin(std::sin(theta_i)/ksdk);
468 return kl4d4/costheta_i*ksdk*
S2(costheta_i*costheta_i, klk2)*
469 SS2(costhetas_o*costhetas_o,klks2)*
470 FmuS(k,kS,theta_i,thetas_o,phis_o,b*b,w*w,AngCut,thetarefract)*
T max(const T t1, const T t2)
brief Return the largest of the two arguments
~G4UCNMicroRoughnessHelper()
G4double IntIplus(G4double, G4double, G4double, G4int, G4int, G4double, G4double, G4double *, G4double) const
static constexpr double neutron_mass_c2
static G4UCNMicroRoughnessHelper * GetInstance()
G4double ProbIminus(G4double, G4double, G4double, G4double, G4double, G4double, G4double, G4double) const
G4double ProbIplus(G4double, G4double, G4double, G4double, G4double, G4double, G4double, G4double) const
static constexpr double twopi
G4double S2(G4double, G4double) const
G4double FmuS(G4double, G4double, G4double, G4double, G4double, G4double, G4double, G4double, G4double) const
G4double Fmu(G4double, G4double, G4double, G4double, G4double, G4double, G4double) const
static constexpr double eV
static G4UCNMicroRoughnessHelper * fpInstance
G4double SS2(G4double, G4double) const
G4UCNMicroRoughnessHelper()
static constexpr double degree
G4GLOB_DLL std::ostream G4cout
G4double IntIminus(G4double, G4double, G4double, G4int, G4int, G4double, G4double, G4double *, G4double) const
static constexpr double hbarc_squared