93 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
94 G4int numOfMaterials = G4Material::GetNumberOfMaterials();
99 for(G4int i = 0; i < numOfMaterials; ++i)
104 (*theMaterialTable)[i]->GetMaterialPropertiesTable();
108 G4MaterialPropertyVector* theWLSVector = MPT->GetProperty(
"WLSCOMPONENT");
112 G4double currentIN = (*theWLSVector)[0];
115 G4double currentPM = theWLSVector->Energy(0);
116 G4double currentCII = 0.0;
117 vec->InsertValues(currentPM, currentCII);
118 G4double prevPM = currentPM;
119 G4double prevCII = currentCII;
120 G4double prevIN = currentIN;
122 for(
size_t j = 1; j < theWLSVector->GetVectorLength(); ++j)
124 currentPM = theWLSVector->Energy(j);
125 currentIN = (*theWLSVector)[j];
126 currentCII = 0.5 * (prevIN + currentIN);
127 currentCII = prevCII + (currentPM - prevPM) * currentCII;
128 vec->InsertValues(currentPM, currentCII);
130 prevCII = currentCII;
152 const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
154 G4double sampledEnergy = 3. * eV;
156 for(
size_t j = 0; j < theMaterialTable->size(); ++j)
158 G4Material* fMaterial = (*theMaterialTable)[j];
159 if(fMaterial->GetName() ==
"PMMA")
162 fMaterial->GetMaterialPropertiesTable()->GetProperty(
"WLSCOMPONENT");
167 fMaterial->GetIndex()));
169 G4double CIImax = WLSIntegral->GetMaxValue();
170 G4double CIIvalue = G4UniformRand() * CIImax;
172 sampledEnergy = WLSIntegral->GetEnergy(CIIvalue);
178 G4String cmd =
"/gun/energy " + G4UIcommand::ConvertToString(sampledEnergy / eV) +
" eV";
179 G4UImanager::GetUIpointer()->ApplyCommand(cmd);
185 G4AutoLock l(&gen_mutex);
186 if(
fParticleGun->GetParticleDefinition() == G4OpticalPhoton::Definition())
207 if(
fParticleGun->GetParticleDefinition()->GetParticleName() !=
210 G4cout <<
"-> warning from WLSPrimaryGeneratorAction::SetOptPhotonPolar()"
211 <<
": the ParticleGun is not an opticalphoton" << G4endl;
215 G4ThreeVector normal(1., 0., 0.);
216 G4ThreeVector kphoton =
fParticleGun->GetParticleMomentumDirection();
217 G4ThreeVector product = normal.cross(kphoton);
218 G4double modul2 = product * product;
220 G4ThreeVector e_perpend(0., 0., 1.);
222 e_perpend = (1. / std::sqrt(modul2)) * product;
223 G4ThreeVector e_paralle = e_perpend.cross(kphoton);
225 G4ThreeVector polar =
226 std::cos(angle) * e_paralle + std::sin(angle) * e_perpend;