106 G4cout <<
"Old Momentum Direction: "
108 G4cout <<
"Old Polarization: "
117 G4double CosTheta, SinTheta, SinPhi, CosPhi, unit_x, unit_y, unit_z;
124 SinTheta = std::sqrt(1.-CosTheta*CosTheta);
130 SinPhi = std::sin(rand);
131 CosPhi = std::cos(rand);
134 unit_x = SinTheta * CosPhi;
135 unit_y = SinTheta * SinPhi;
137 NewMomentumDirection.
set (unit_x,unit_y,unit_z);
141 OldMomentumDirection = OldMomentumDirection.
unit();
142 NewMomentumDirection.
rotateUz(OldMomentumDirection);
143 NewMomentumDirection = NewMomentumDirection.
unit();
149 constant = -NewMomentumDirection.
dot(OldPolarization);
151 NewPolarization = OldPolarization + constant*NewMomentumDirection;
152 NewPolarization = NewPolarization.
unit();
157 if (NewPolarization.
mag() == 0.) {
159 NewPolarization.
set(std::cos(rand),std::sin(rand),0.);
160 NewPolarization.
rotateUz(NewMomentumDirection);
164 if (
G4UniformRand() < 0.5) NewPolarization = -NewPolarization;
168 cosTheta = NewPolarization.
dot(OldPolarization);
176 G4cout <<
"New Polarization: "
177 << NewPolarization <<
G4endl;
178 G4cout <<
"Polarization Change: "
180 G4cout <<
"New Momentum Direction: "
181 << NewMomentumDirection <<
G4endl;
182 G4cout <<
"Momentum Change: "
204 for (
G4int iMaterial = 0; iMaterial < numOfMaterials; ++iMaterial)
210 if (materialProperties) {
230 ((*thePhysicsTable)(material->
GetIndex()));
233 if (rayleigh) rsLength = rayleigh->
Value(photonMomentum);
248 if (material->
GetName() ==
"Water") {
249 betat = 7.658e-23*
m3/
MeV;
260 if (rIndex ==
nullptr)
return nullptr;
271 if (material->
GetName() ==
"Water") {
272 temperature = 283.15*
kelvin;
284 for (
size_t uRIndex = 0; uRIndex < rIndex->
GetVectorLength(); ++uRIndex)
287 const G4double rIndexSquared = (*rIndex)[uRIndex] * (*rIndex)[uRIndex];
291 std::pow(((rIndexSquared-1.0)*(rIndexSquared+2.0 )/3.0),2);
293 const G4double meanFreePath = 1.0 / ( c1 * c2 * c3 );
296 G4cout << energy <<
"MeV\t" << meanFreePath <<
"mm" <<
G4endl;
299 rayleighMeanFreePaths->
InsertValues(energy, meanFreePath);
302 return rayleighMeanFreePaths;