85 G4cout <<
"MIE Old Momentum Direction: "
87 G4cout <<
"MIE Old Polarization: "
106 Theta = std::acos(2*r*(1+gg)*(1+gg)*(1-gg+gg*r)/((1-gg+2*gg*r)*(1-gg+2*gg*r)) -1);
108 Theta = std::acos(2*r-1.);
112 if (direction==-1) Theta =
pi - Theta;
117 NewMomentumDirection.
set
118 (std::sin(Theta)*std::cos(Phi), std::sin(Theta)*std::sin(Phi), std::cos(Theta));
120 NewMomentumDirection.
rotateUz(OldMomentumDirection);
121 NewMomentumDirection = NewMomentumDirection.
unit();
124 G4double constant = -1./NewMomentumDirection.
dot(OldPolarization);
126 NewPolarization = NewMomentumDirection + constant*OldPolarization;
127 NewPolarization = NewPolarization.
unit();
129 if (NewPolarization.
mag()==0) {
131 NewPolarization.
set(std::cos(r),std::sin(r),0.);
132 NewPolarization.
rotateUz(NewMomentumDirection);
136 if (
G4UniformRand() < 0.5) NewPolarization = -NewPolarization;
143 G4cout <<
"MIE New Polarization: "
144 << NewPolarization <<
G4endl;
145 G4cout <<
"MIE Polarization Change: "
147 G4cout <<
"MIE New Momentum Direction: "
148 << NewMomentumDirection <<
G4endl;
149 G4cout <<
"MIE Momentum Change: "
173 if (aMaterialPropertyTable) {
176 if (AttenuationLengthVector) {
177 AttenuationLength = AttenuationLengthVector ->
178 Value(thePhotonEnergy);
188 return AttenuationLength;
void set(double x, double y, double z)
G4double GetTotalEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
double dot(const Hep3Vector &) const
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
const G4ThreeVector * GetMomentumDirection() const
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
static constexpr double twopi
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
void SetProcessSubType(G4int)
const G4String & GetProcessName() const
G4Material * GetMaterial() const
virtual void Initialize(const G4Track &)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
const G4ThreeVector & GetPolarization() const
G4ParticleChange aParticleChange
static constexpr double pi
G4OpMieHG(const G4String &processName="OpMieHG", G4ProcessType type=fOptical)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
const G4ThreeVector * GetPolarization() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4MaterialPropertyVector * GetProperty(const char *key)
G4double GetConstProperty(const char *key) const