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)
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
G4double GetConstProperty(const char *key) const
const G4ThreeVector * GetPolarization() const
G4OpMieHG(const G4String &processName="OpMieHG", G4ProcessType type=fOptical)
const G4ThreeVector & GetMomentumDirection() const
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)
double dot(const Hep3Vector &) const
Hep3Vector & rotateUz(const Hep3Vector &)
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4ParticleChange aParticleChange
virtual void Initialize(const G4Track &)
const G4ThreeVector * GetMomentumDirection() const
static constexpr double twopi
const G4String & GetProcessName() const
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
G4Material * GetMaterial() const
const G4ThreeVector & GetPolarization() const
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
void SetProcessSubType(G4int)
G4GLOB_DLL std::ostream G4cout
G4MaterialPropertyVector * GetProperty(const char *key, G4bool warning=false)
static constexpr double pi
G4double GetTotalEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const