56 theMicroRoughnessTable =
nullptr;
57 maxMicroRoughnessTable =
nullptr;
58 theMicroRoughnessTransTable =
nullptr;
59 maxMicroRoughnessTransTable =
nullptr;
70 theta_i_step = (theta_i_max-theta_i_min)/(no_theta_i-1);
71 E_step = (Emax-Emin)/(noE-1);
81 if (theMicroRoughnessTable)
delete theMicroRoughnessTable;
82 if (maxMicroRoughnessTable)
delete maxMicroRoughnessTable;
83 if (theMicroRoughnessTransTable)
delete theMicroRoughnessTransTable;
84 if (maxMicroRoughnessTransTable)
delete maxMicroRoughnessTransTable;
89 return theMicroRoughnessTable;
94 return theMicroRoughnessTransTable;
100 G4double* pMicroRoughnessTransTable,
101 G4double* pmaxMicroRoughnessTransTable)
103 theMicroRoughnessTable = pMicroRoughnessTable;
104 maxMicroRoughnessTable = pmaxMicroRoughnessTable;
105 theMicroRoughnessTransTable = pMicroRoughnessTransTable;
106 maxMicroRoughnessTransTable = pmaxMicroRoughnessTransTable;
129 if (Nthetadim*NEdim > 0) {
130 if (theMicroRoughnessTable)
delete theMicroRoughnessTable;
131 theMicroRoughnessTable =
new G4double[Nthetadim*NEdim];
132 if (maxMicroRoughnessTable)
delete maxMicroRoughnessTable;
133 maxMicroRoughnessTable =
new G4double[Nthetadim*NEdim];
134 if (theMicroRoughnessTransTable)
delete theMicroRoughnessTransTable;
135 theMicroRoughnessTransTable =
new G4double[Nthetadim*NEdim];
136 if (maxMicroRoughnessTransTable)
delete maxMicroRoughnessTransTable;
137 maxMicroRoughnessTransTable =
new G4double[Nthetadim*NEdim];
174 theta_i_step = (theta_i_max-theta_i_min)/(no_theta_i-1);
179 E_step = (Emax-Emin)/(noE-1);
190 std::ofstream dateir(
"MRrefl.dat",std::ios::out);
191 std::ofstream dateit(
"MRtrans.dat",std::ios::out);
195 for (theta_i=theta_i_min; theta_i<=theta_i_max+1e-6; theta_i+=theta_i_step) {
197 for (E=Emin; E<=Emax; E+=E_step) {
198 *(theMicroRoughnessTable+counter) =
200 IntIplus(E, fermipot, theta_i, AngNoTheta, AngNoPhi,
201 b2, w2, maxMicroRoughnessTable+counter, AngCut);
203 *(theMicroRoughnessTransTable+counter) =
205 IntIminus(E, fermipot, theta_i, AngNoTheta, AngNoPhi,
206 b2, w2, maxMicroRoughnessTransTable+counter,
209 dateir << *(theMicroRoughnessTable+counter) <<
G4endl;
210 dateit << *(theMicroRoughnessTransTable+counter) <<
G4endl;
223 std::ofstream dateic(
"MRcheck.dat",std::ios::out);
224 std::ofstream dateimr(
"MRmaxrefl.dat",std::ios::out);
225 std::ofstream dateimt(
"MRmaxtrans.dat",std::ios::out);
227 for (theta_i=theta_i_min; theta_i<=theta_i_max+1e-6; theta_i+=theta_i_step) {
228 for (E=Emin; E<=Emax; E+=E_step) {
247 if (!theMicroRoughnessTable) {
262 if (theta_i<theta_i_min || theta_i>theta_i_max || Energy<Emin || Energy>Emax)
268 G4int theta_i_pos =
G4int((theta_i-theta_i_min)/theta_i_step+0.5);
269 G4int E_pos =
G4int((Energy-Emin)/E_step+0.5);
277 return *(theMicroRoughnessTable+E_pos+theta_i_pos*(noE - 1));
283 if (!theMicroRoughnessTransTable)
return 0.;
288 if (theta_i<theta_i_min || theta_i>theta_i_max || Energy<Emin || Energy>Emax)
294 G4int theta_i_pos =
G4int((theta_i-theta_i_min)/theta_i_step+0.5);
295 G4int E_pos =
G4int((Energy-Emin)/E_step+0.5);
300 return *(theMicroRoughnessTransTable+E_pos+theta_i_pos*(noE - 1));
306 if (!maxMicroRoughnessTable)
return 0.;
311 if (theta_i<theta_i_min || theta_i>theta_i_max || Energy<Emin || Energy>Emax)
317 G4int theta_i_pos =
G4int((theta_i-theta_i_min)/theta_i_step+0.5);
318 G4int E_pos =
G4int((Energy-Emin)/E_step+0.5);
323 return *(maxMicroRoughnessTable+E_pos+theta_i_pos*noE);
329 if (maxMicroRoughnessTable) {
331 if (theta_i<theta_i_min || theta_i>theta_i_max ||
332 Energy<Emin || Energy>Emax) {
338 G4int theta_i_pos =
G4int((theta_i-theta_i_min)/theta_i_step+0.5);
339 G4int E_pos =
G4int((Energy-Emin)/E_step+0.5);
344 *(maxMicroRoughnessTable+E_pos+theta_i_pos*noE) = value;
352 if (!maxMicroRoughnessTransTable)
return 0.;
357 if (theta_i<theta_i_min || theta_i>theta_i_max || Energy<Emin || Energy>Emax)
363 G4int theta_i_pos =
G4int((theta_i-theta_i_min)/theta_i_step+0.5);
364 G4int E_pos =
G4int((Energy-Emin)/E_step+0.5);
369 return *(maxMicroRoughnessTransTable+E_pos+theta_i_pos*noE);
375 if (maxMicroRoughnessTransTable) {
377 if (theta_i<theta_i_min || theta_i>theta_i_max ||
378 Energy<Emin || Energy>Emax) {
384 G4int theta_i_pos =
G4int((theta_i-theta_i_min)/theta_i_step+0.5);
385 G4int E_pos =
G4int((Energy-Emin)/E_step+0.5);
390 *(maxMicroRoughnessTransTable+E_pos+theta_i_pos*noE) = value;
401 ProbIplus(Energy, fermipot, theta_i, theta_o, phi_o, b, w, AngCut);
410 ProbIminus(Energy, fermipot,theta_i, theta_o, phi_o, b, w, AngCut);
429 if (2*b*k*std::cos(theta_i) < 1 && 2*b*k_l < 1)
return true;
440 if (E*(std::cos(theta_i)*std::cos(theta_i)) < VFermi)
return false;
449 if (2*b*std::sqrt(kS2)*std::cos(theta_i) < 1 && 2*b*std::sqrt(k_l2) < 1)
return true;
G4double GetMRMaxTransProbability(G4double, G4double)
G4double GetMRProbability(G4double, G4double, G4double, G4double, G4double)
static constexpr double hbarc_squared
virtual ~G4UCNMaterialPropertiesTable()
void SetMRMaxProbability(G4double, G4double, G4double)
void ComputeMicroRoughnessTables()
void InitMicroRoughnessTables()
void LoadMicroRoughnessTables(G4double *, G4double *, G4double *, G4double *)
G4GLOB_DLL std::ostream G4cout
const XML_Char int const XML_Char * value
void RemoveConstProperty(const char *key)
G4double GetMRTransProbability(G4double, G4double, G4double, G4double, G4double)
static constexpr double degree
static constexpr double neutron_mass_c2
static constexpr double eV
static G4UCNMicroRoughnessHelper * GetInstance()
G4bool TransConditionsValid(G4double E, G4double VFermi, G4double theta_i)
void AddConstProperty(const char *key, G4double PropertyValue)
G4bool ConstPropertyExists(const char *key) const
G4double GetMRIntProbability(G4double, G4double)
static constexpr double nm
G4double * GetMicroRoughnessTable()
G4double GetMRIntTransProbability(G4double, G4double)
G4double * GetMicroRoughnessTransTable()
G4UCNMaterialPropertiesTable()
G4bool ConditionsValid(G4double E, G4double VFermi, G4double theta_i)
void SetMicroRoughnessParameters(G4double, G4double, G4int, G4int, G4double, G4double, G4double, G4double, G4int, G4int, G4double)
G4double GetMRMaxProbability(G4double, G4double)
void SetMRMaxTransProbability(G4double, G4double, G4double)
G4double GetConstProperty(const char *key) const