133 G4cout <<
"Old Momentum Direction: "
135 G4cout <<
"Old Polarization: "
148 G4double SinTheta = std::sqrt(1.-CosTheta*CosTheta);
158 G4double unit_x = SinTheta * CosPhi;
159 G4double unit_y = SinTheta * SinPhi;
161 NewMomentumDirection.
set (unit_x,unit_y,unit_z);
165 OldMomentumDirection = OldMomentumDirection.
unit();
166 NewMomentumDirection.
rotateUz(OldMomentumDirection);
167 NewMomentumDirection = NewMomentumDirection.
unit();
173 G4double constant = -1./NewMomentumDirection.
dot(OldPolarization);
175 NewPolarization = NewMomentumDirection + constant*OldPolarization;
176 NewPolarization = NewPolarization.
unit();
181 if (NewPolarization.
mag() == 0.) {
183 NewPolarization.
set(std::cos(rand),std::sin(rand),0.);
184 NewPolarization.
rotateUz(NewMomentumDirection);
188 if (
G4UniformRand() < 0.5) NewPolarization = -NewPolarization;
192 cosTheta = NewPolarization.
dot(OldPolarization);
199 G4cout <<
"New Polarization: "
200 << NewPolarization <<
G4endl;
201 G4cout <<
"Polarization Change: "
203 G4cout <<
"New Momentum Direction: "
204 << NewMomentumDirection <<
G4endl;
205 G4cout <<
"Momentum Change: "
215 void G4OpRayleigh::BuildThePhysicsTable()
231 for (
G4int i=0 ; i < numOfMaterials; i++)
236 (*theMaterialTable)[i]->GetMaterialPropertiesTable();
238 if(aMaterialPropertiesTable){
243 if(!AttenuationLengthVector){
245 if ((*theMaterialTable)[i]->GetName() ==
"Water")
253 RayleighAttenuationLengthGenerator(aMaterialPropertiesTable);
276 if (aMaterial->
GetName() ==
"Water" && DefaultWater){
281 (*thePhysicsTable)(aMaterial->
GetIndex())->
282 GetValue(thePhotonEnergy, isOutRange);
289 if(aMaterialPropertyTable){
292 if(AttenuationLengthVector){
293 AttenuationLength = AttenuationLengthVector ->
294 Value(thePhotonEnergy);
305 return AttenuationLength;
349 refraction_index = (*Rindex)[i];
351 refsq = refraction_index*refraction_index;
356 G4cout << xlambda <<
" mm\t";
360 c2 = std::pow((2.0 *
pi / xlambda), 4);
361 c3 = std::pow( ( (refsq - 1.0) * (refsq + 2.0) / 3.0 ), 2);
362 c4 = betat * temp * kboltz;
364 Dist = 1.0 / (c1*c2*c3*c4);
369 RayleighScatteringLengths->
370 InsertValues(Rindex->
Energy(i), Dist);
375 return RayleighScatteringLengths;
void set(double x, double y, double z)
G4MaterialPropertyVector * GetProperty(const char *key)
G4double GetTotalEnergy() const
const G4DynamicParticle * GetDynamicParticle() const
double dot(const Hep3Vector &) const
const G4String & GetName() const
static G4MaterialTable * GetMaterialTable()
std::vector< G4Material * > G4MaterialTable
void ProposePolarization(G4double Px, G4double Py, G4double Pz)
const G4ThreeVector * GetMomentumDirection() const
size_t GetVectorLength() const
G4PhysicsTable * thePhysicsTable
G4GLOB_DLL std::ostream G4cout
void BuildPhysicsTable(const G4ParticleDefinition &aParticleType)
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
void SetProcessSubType(G4int)
G4double Energy(size_t index) const
static size_t GetNumberOfMaterials()
const G4String & GetProcessName() const
G4Material * GetMaterial() const
virtual void Initialize(const G4Track &)
G4MaterialPropertiesTable * GetMaterialPropertiesTable() const
G4OpRayleigh(const G4String &processName="OpRayleigh", G4ProcessType type=fOptical)
const G4ThreeVector & GetPolarization() const
G4ParticleChange aParticleChange
void insertAt(size_t, G4PhysicsVector *)
G4double GetMeanFreePath(const G4Track &aTrack, G4double, G4ForceCondition *)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
const G4ThreeVector * GetPolarization() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4VParticleChange * PostStepDoIt(const G4Track &aTrack, const G4Step &aStep)