45G4double G4XrayReflection::fSurfaceRoughness = 0;
71 if (SinIncidentAngle < 0.9 && theMatProp !=
nullptr)
76 if (
nullptr == RealIndex ||
nullptr == ImagIndex) {
return theReflectivity; }
79 const G4double sin2 = std::pow(SinIncidentAngle, 2);
81 0.5 * (sin2 - 2 * delta + std::sqrt(std::pow(sin2 - 2 * delta, 2) + 4 * beta * beta));
82 const G4double rho = std::sqrt(rho2);
83 const G4double Refl_sigma = (rho2 * std::pow(SinIncidentAngle - rho, 2) + std::pow(beta, 2))
84 / (rho2 * std::pow(SinIncidentAngle + rho, 2) + std::pow(beta, 2));
85 const G4double coscot = std::sqrt(1 - sin2) / SinIncidentAngle;
86 const G4double pi_over_sigma = (rho2 * std::pow(rho - coscot, 2) + std::pow(beta, 2))
87 / (rho2 * std::pow(rho + coscot, 2) + std::pow(beta, 2));
88 const G4double Refl_pi = Refl_sigma * pi_over_sigma;
89 theReflectivity = 0.5 * (Refl_sigma + Refl_pi);
91 if (fSurfaceRoughness > 0) {
92 G4double kiz = SinIncidentAngle * GamEner / CLHEP::hbarc;
93 G4double kjz = SinIncidentAngle * (1 - delta) * GamEner / CLHEP::hbarc;
94 RoughAtten =
G4Exp(-2 * kiz * kjz * fSurfaceRoughness * fSurfaceRoughness);
95 theReflectivity *= RoughAtten;
98 G4cout << std::left << std::setw(12) << __FILE__ <<
" " << __FUNCTION__ <<
" line "
99 << std::right << std::setw(4) << __LINE__ <<
" GamEner=" << GamEner
100 <<
" fSurfaceRoughness=" <<
G4BestUnit(fSurfaceRoughness,
"Length")
101 <<
" RoughAtten=" << RoughAtten <<
" SinIncidentAngle=" << SinIncidentAngle
102 <<
" delta=" << delta <<
" beta=" << beta <<
" Refl_sigma=" << Refl_sigma
103 <<
" Refl_pi=" << Refl_pi <<
" theReflectivity=" << theReflectivity <<
G4endl;
105 return theReflectivity;
115 if (GamEner < 30. * eV || GamEner > 30. * keV)
119 G4cout << std::left << std::setw(12) << __FILE__ <<
" " << __FUNCTION__ <<
" line "
120 << std::right << std::setw(4) << __LINE__ <<
" GamEner=" << GamEner / keV
121 <<
" keV previousStepSize=" << previousStepSize
127 if (fLastVolume && Volume != fLastVolume && aTrack.
GetTrackLength() > 0) {
133 if (density > last_density) {
139 if (valid) fSurfaceNormal = theSurfaceNormal;
148 G4cout << std::left << std::setw(12) << __FILE__ <<
" " << __FUNCTION__ <<
" line "
149 << std::right << std::setw(4) << __LINE__
150 <<
" trigger reflection SinIncidentAngle=" << SinIncidentAngle
151 <<
" at z=" << Position.getZ() / meter <<
" m" <<
G4endl;
153 G4cout << std::left << std::setw(12) << __FILE__ <<
" " << __FUNCTION__ <<
" line "
154 << std::right << std::setw(4) << __LINE__ <<
" volume has changed "
156 <<
" last logical volume material name =" << theLastMat->
GetName()
157 <<
" last density=" << last_density <<
" part/cm3 ? "
159 <<
" logical volume material name =" << theMat->
GetName() <<
" density=" << density
161 <<
" LastSolid_Volume->Inside(Position)=" << LastSolid_Volume->
Inside(Position)
162 <<
" sin(IncidentAngle)=" << SinIncidentAngle <<
" MeanFreePath=" << MeanFreePath
166 fLastVolume = Volume;
176 G4ThreeVector para_part = (PhotDir * fSurfaceNormal) * fSurfaceNormal;
179 G4cout << std::left << std::setw(12) << __FILE__ <<
" " << __FUNCTION__ <<
" line "
180 << std::right << std::setw(4) << __LINE__ <<
" fSurfaceNormal=" << fSurfaceNormal
181 <<
" StepLength=" << aStep.
GetStepLength() <<
" PhotDir=" << PhotDir
182 <<
" photon_reflected=" << photon_reflected <<
" para_part=" << para_part
202 G4cout << std::left << std::setw(12) << __FILE__ <<
" " << __FUNCTION__ <<
" line "
203 << std::right << std::setw(4) << __LINE__
205 <<
" fSurfaceRoughness=" <<
G4BestUnit(fSurfaceRoughness,
"Length") <<
G4endl;
213 out <<
'\n' <<
GetProcessName() <<
": Gamma specular reflection for energies > 30 eV.\n";
219 std::vector<G4double>& f1, std::vector<G4double>& f2)
221 std::transform(ElName.begin(), ElName.end(), ElName.begin(),
224 const G4String InpFname = DataDir + ElName +
".nff";
225 std::ifstream infile(InpFname);
226 if (!infile.is_open()) {
227 G4cout <<
"ReadHenkeXrayReflData " << InpFname <<
" not found" <<
G4endl;
230 std::vector<std::string> VarName(3);
231 infile >> VarName[0] >> VarName[1] >> VarName[2];
233 G4cout <<
"ReadHenkeXrayData variable names " << VarName[0] <<
" " << VarName[1] <<
" "
240 infile >> E_eV_i >> f1_i >> f2_i;
241 if (infile.eof())
break;
242 Ephot.push_back(E_eV_i * eV);
256 for (
auto a_material : *materialTable) {
257 auto N = a_material->GetTotNbOfAtomsPerVolume();
260 G4cout << std::left << std::setw(12) << __FILE__ <<
" " << __FUNCTION__ <<
" line "
261 << std::right << std::setw(4) << __LINE__ <<
" " << a_material->GetName()
262 <<
" NbOfAtomsPerVolume()=" <<
N
263 <<
" NumberOfElements()=" << a_material->GetNumberOfElements() <<
G4endl;
266 if (a_material->GetNumberOfElements() == 1 && a_material->GetDensity() > 1) {
267 G4double factor =
N * CLHEP::classic_electr_radius / CLHEP::twopi;
268 std::vector<G4double> Ephot, f1, f2;
273 G4cout << std::left << std::setw(12) << __FILE__ <<
" " << __FUNCTION__ <<
" line "
274 << std::right << std::setw(4) << __LINE__ <<
" no Henke data found for "
275 << a_material->GetName() <<
" " << theElement->
GetName() <<
G4endl;
278 std::vector<G4double> RealIndex(Ephot.size()), ImagIndex(Ephot.size());
279 for (std::size_t i = 0; i < Ephot.size(); ++i) {
280 G4double lambda = CLHEP::twopi * CLHEP::hbarc / Ephot[i];
281 G4double lambda_sqr = lambda * lambda;
282 RealIndex[i] = fmax(0, factor * lambda_sqr * f1[i]);
283 ImagIndex[i] = factor * lambda_sqr * f2[i];
285 G4cout <<
"Ephot=" << std::setw(10) << Ephot[i] / eV <<
" eV delta=" << std::setw(10)
286 << RealIndex[i] <<
" beta=" << std::setw(10) << ImagIndex[i] <<
G4endl;
289 if(proptab ==
nullptr) {
291 a_material->SetMaterialPropertiesTable(proptab);
293 proptab->
AddProperty(
"REALRINDEX", Ephot, RealIndex);
294 proptab->
AddProperty(
"IMAGINARYRINDEX", Ephot, ImagIndex);
296 G4cout << std::left << std::setw(12) << __FILE__ <<
" " << __FUNCTION__ <<
" line "
297 << std::right << std::setw(4) << __LINE__ <<
" " << a_material->GetName()
298 <<
" " << theElement->
GetName()
299 <<
" reflection data saved in PropertiesTable" <<
G4endl;
309 fSurfaceRoughness = value;
G4double condition(const G4ErrorSymMatrix &m)
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
G4double GetTotalEnergy() const
const G4String & GetName() const
static G4Element * GetElement(const G4String &name, G4bool warning=true)
static G4EmParameters * Instance()
const G4String & GetDirLEDATA() const
static G4Gamma * Definition()
G4VSolid * GetSolid() const
G4Material * GetMaterial() const
const G4String & GetName() const
G4MaterialPropertyVector * AddProperty(const G4String &key, const std::vector< G4double > &photonEnergies, const std::vector< G4double > &propertyValues, G4bool createNewKey=false, G4bool spline=false)
G4MaterialPropertyVector * GetProperty(const char *key) const
G4double GetDensity() const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
static G4MaterialTable * GetMaterialTable()
const G4String & GetName() const
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
void AddSecondary(G4Track *aSecondary)
void Initialize(const G4Track &) override
G4double Value(const G4double energy, std::size_t &lastidx) const
G4double GetStepLength() const
G4VPhysicalVolume * GetVolume() const
const G4ThreeVector & GetPosition() const
G4double GetTrackLength() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetStepLength() const
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
void ProposeTrackStatus(G4TrackStatus status)
G4TrackStatus GetTrackStatus() const
G4LogicalVolume * GetLogicalVolume() const
G4int GetVerboseLevel() const
G4ParticleChange aParticleChange
void SetProcessSubType(G4int)
const G4String & GetProcessName() const
virtual EInside Inside(const G4ThreeVector &p) const =0
void SetSurfaceRoughness(const G4double value)
G4VParticleChange * PostStepDoIt(const G4Track &track, const G4Step &Step) override
void ProcessDescription(std::ostream &) const override
G4bool IsApplicable(const G4ParticleDefinition &) override
G4XrayReflection(const G4String &processName="XrayReflection", G4ProcessType type=fElectromagnetic)
G4int ReadHenkeXrayData(std::string ElName, std::vector< G4double > &Ephot, std::vector< G4double > &f1, std::vector< G4double > &f2)
void SaveHenkeDataAsMaterialProperty()
G4double Reflectivity(const G4double GamEner, const G4double SinIncidentAngle, const G4Material *theMat) const
void BuildPhysicsTable(const G4ParticleDefinition &) override
G4double GetMeanFreePath(const G4Track &track, G4double previousStepSize, G4ForceCondition *condition) override