55 theMicroRoughnessTable =
nullptr;
56 maxMicroRoughnessTable =
nullptr;
57 theMicroRoughnessTransTable =
nullptr;
58 maxMicroRoughnessTransTable =
nullptr;
60 theta_i_min = 0. * degree;
61 theta_i_max = 90. * degree;
69 theta_i_step = (theta_i_max - theta_i_min) / (no_theta_i - 1);
70 E_step = (Emax - Emin) / (noE - 1);
75 AngCut = 0.01 * degree;
80 delete theMicroRoughnessTable;
81 delete maxMicroRoughnessTable;
82 delete theMicroRoughnessTransTable;
83 delete maxMicroRoughnessTransTable;
90 return theMicroRoughnessTransTable;
95 G4double* pmaxMicroRoughnessTransTable)
97 theMicroRoughnessTable = pMicroRoughnessTable;
98 maxMicroRoughnessTable = pmaxMicroRoughnessTable;
99 theMicroRoughnessTransTable = pMicroRoughnessTransTable;
100 maxMicroRoughnessTransTable = pmaxMicroRoughnessTransTable;
123 if (Nthetadim * NEdim > 0) {
124 delete theMicroRoughnessTable;
125 theMicroRoughnessTable =
new G4double[Nthetadim * NEdim];
126 delete maxMicroRoughnessTable;
127 maxMicroRoughnessTable =
new G4double[Nthetadim * NEdim];
128 delete theMicroRoughnessTransTable;
129 theMicroRoughnessTransTable =
new G4double[Nthetadim * NEdim];
130 delete maxMicroRoughnessTransTable;
131 maxMicroRoughnessTransTable =
new G4double[Nthetadim * NEdim];
164 theta_i_step = (theta_i_max - theta_i_min) / (no_theta_i - 1);
167 E_step = (Emax - Emin) / (noE - 1);
175 std::ofstream dateir(
"MRrefl.dat", std::ios::out);
176 std::ofstream dateit(
"MRtrans.dat", std::ios::out);
180 for (theta_i = theta_i_min; theta_i <= theta_i_max + 1e-6; theta_i += theta_i_step) {
182 for (E = Emin; E <= Emax; E += E_step) {
184 fermipot, theta_i, AngNoTheta, AngNoPhi, b2, w2, maxMicroRoughnessTable + counter, AngCut);
186 *(theMicroRoughnessTransTable + counter) =
188 AngNoPhi, b2, w2, maxMicroRoughnessTransTable + counter, AngCut);
190 dateir << *(theMicroRoughnessTable + counter) <<
G4endl;
191 dateit << *(theMicroRoughnessTransTable + counter) <<
G4endl;
202 std::ofstream dateic(
"MRcheck.dat", std::ios::out);
203 std::ofstream dateimr(
"MRmaxrefl.dat", std::ios::out);
204 std::ofstream dateimt(
"MRmaxtrans.dat", std::ios::out);
206 for (theta_i = theta_i_min; theta_i <= theta_i_max + 1e-6; theta_i += theta_i_step) {
207 for (E = Emin; E <= Emax; E += E_step) {
224 if (theMicroRoughnessTable ==
nullptr) {
225 G4cout <<
"Do not have theMicroRoughnessTable" <<
G4endl;
231 if (theta_i < theta_i_min || theta_i > theta_i_max || Energy < Emin || Energy > Emax) {
238 auto theta_i_pos =
G4int((theta_i - theta_i_min) / theta_i_step + 0.5);
239 auto E_pos =
G4int((Energy - Emin) / E_step + 0.5);
243 return *(theMicroRoughnessTable + E_pos + theta_i_pos * (noE - 1));
248 if (theMicroRoughnessTransTable ==
nullptr) {
255 if (theta_i < theta_i_min || theta_i > theta_i_max || Energy < Emin || Energy > Emax) {
262 auto theta_i_pos =
G4int((theta_i - theta_i_min) / theta_i_step + 0.5);
263 auto E_pos =
G4int((Energy - Emin) / E_step + 0.5);
268 return *(theMicroRoughnessTransTable + E_pos + theta_i_pos * (noE - 1));
273 if (maxMicroRoughnessTable ==
nullptr) {
280 if (theta_i < theta_i_min || theta_i > theta_i_max || Energy < Emin || Energy > Emax) {
287 auto theta_i_pos =
G4int((theta_i - theta_i_min) / theta_i_step + 0.5);
288 auto E_pos =
G4int((Energy - Emin) / E_step + 0.5);
293 return *(maxMicroRoughnessTable + E_pos + theta_i_pos * noE);
299 if (maxMicroRoughnessTable !=
nullptr) {
300 if (theta_i < theta_i_min || theta_i > theta_i_max || Energy < Emin || Energy > Emax) {
306 auto theta_i_pos =
G4int((theta_i - theta_i_min) / theta_i_step + 0.5);
307 auto E_pos =
G4int((Energy - Emin) / E_step + 0.5);
312 *(maxMicroRoughnessTable + E_pos + theta_i_pos * noE) = value;
319 if (maxMicroRoughnessTransTable ==
nullptr) {
326 if (theta_i < theta_i_min || theta_i > theta_i_max || Energy < Emin || Energy > Emax) {
333 auto theta_i_pos =
G4int((theta_i - theta_i_min) / theta_i_step + 0.5);
334 auto E_pos =
G4int((Energy - Emin) / E_step + 0.5);
339 return *(maxMicroRoughnessTransTable + E_pos + theta_i_pos * noE);
345 if (maxMicroRoughnessTransTable !=
nullptr) {
346 if (theta_i < theta_i_min || theta_i > theta_i_max || Energy < Emin || Energy > Emax) {
352 auto theta_i_pos =
G4int((theta_i - theta_i_min) / theta_i_step + 0.5);
353 auto E_pos =
G4int((Energy - Emin) / E_step + 0.5);
358 *(maxMicroRoughnessTransTable + E_pos + theta_i_pos * noE) = value;
367 Energy, fermipot, theta_i, theta_o, phi_o, b, w, AngCut);
374 Energy, fermipot, theta_i, theta_o, phi_o, b, w, AngCut);
379 G4double k = std::sqrt(2 * neutron_mass_c2 * E / hbarc_squared);
380 G4double k_l = std::sqrt(2 * neutron_mass_c2 * VFermi / hbarc_squared);
383 return 2 * b * k * std::cos(theta_i) < 1 && 2 * b * k_l < 1;
389 G4double k2 = 2 * neutron_mass_c2 * E / hbarc_squared;
390 G4double k_l2 = 2 * neutron_mass_c2 * VFermi / hbarc_squared;
392 if (E * (std::cos(theta_i) * std::cos(theta_i)) < VFermi) {
399 return 2 * b * std::sqrt(kS2) * std::cos(theta_i) < 1 && 2 * b * std::sqrt(k_l2) < 1;
G4GLOB_DLL std::ostream G4cout
void AddConstProperty(const G4String &key, G4double propertyValue, G4bool createNewKey=false)
G4bool ConstPropertyExists(const G4String &key) const
G4double GetConstProperty(const G4String &key) const
void RemoveConstProperty(const G4String &key)
G4double GetMRMaxTransProbability(G4double, G4double)
void SetMicroRoughnessParameters(G4double, G4double, G4int, G4int, G4double, G4double, G4double, G4double, G4int, G4int, G4double)
G4double GetMRProbability(G4double, G4double, G4double, G4double, G4double)
G4bool ConditionsValid(G4double E, G4double VFermi, G4double theta_i)
void LoadMicroRoughnessTables(G4double *, G4double *, G4double *, G4double *)
G4bool TransConditionsValid(G4double E, G4double VFermi, G4double theta_i)
void SetMRMaxProbability(G4double, G4double, G4double)
G4UCNMaterialPropertiesTable()
G4double * GetMicroRoughnessTable()
void SetMRMaxTransProbability(G4double, G4double, G4double)
G4double GetMRIntTransProbability(G4double, G4double)
void ComputeMicroRoughnessTables()
G4double GetMRMaxProbability(G4double, G4double)
G4double GetMRTransProbability(G4double, G4double, G4double, G4double, G4double)
G4double GetMRIntProbability(G4double, G4double)
~G4UCNMaterialPropertiesTable() override
void InitMicroRoughnessTables()
G4double * GetMicroRoughnessTransTable()
G4double ProbIplus(G4double, G4double, G4double, G4double, G4double, G4double, G4double, G4double) const
G4double IntIminus(G4double, G4double, G4double, G4int, G4int, G4double, G4double, G4double *, G4double) const
static G4UCNMicroRoughnessHelper * GetInstance()
G4double ProbIminus(G4double, G4double, G4double, G4double, G4double, G4double, G4double, G4double) const
G4double IntIplus(G4double, G4double, G4double, G4int, G4int, G4double, G4double, G4double *, G4double) const