163{
164
167
168
171
174
175 material1 = pPreStepPoint -> GetMaterial();
176 material2 = pPostStepPoint -> GetMaterial();
177
179
181
183 previousMomentum = oldMomentum;
185
186
189 {
191 flag_franchissement_surface = false;
192 flag_reflexion = false;
194 }
196
197
198 if (material1 == material2)
199 {
202 }
204 {
210 G4cout <<
" Old Momentum Direction: " << oldMomentum <<
G4endl;
211 }
212
213
215
218
221
222 if (valid)
223 {
224 theGlobalNormal = -theGlobalNormal;
225 }
226 else
227 {
229 ed << " G4MicroElecSurface/PostStepDoIt(): "
230 << " The Navigator reports that it returned an invalid normal"
232 G4Exception(
"G4MuElecSurf::PostStepDoIt",
"OpBoun01",
234 "Invalid Surface Normal - Geometry must return valid surface normal");
235 }
236
237
238 if (oldMomentum * theGlobalNormal > 0.0)
239 {
240 theGlobalNormal = -theGlobalNormal;
241 }
242
244 {
245 if (flag_reflexion == true)
246 {
247 flag_reflexion = false;
249 }
250
252
253 G4double energyThreshold_surface = 0.0*eV;
254
255 WorkFunctionTable::iterator postStepWF;
257 WorkFunctionTable::iterator preStepWF;
259
260 if (postStepWF == tableWF.end())
261 {
262 G4String str = "Material ";
265 return nullptr;
266 }
267 else if (preStepWF == tableWF.end())
268 {
269 G4String str = "Material ";
272 return nullptr;
273 }
274 else
275 {
276 G4double thresholdNew_surface = postStepWF->second;
277 G4double thresholdOld_surface = preStepWF->second;
278 energyThreshold_surface = thresholdNew_surface - thresholdOld_surface;
279 }
280
281 if (flag_franchissement_surface == true)
282 {
284 flag_franchissement_surface = false;
285 }
286 if (flag_reflexion == true && flag_normal == true)
287 {
289 flag_reflexion = false;
290 flag_normal = false;
291 }
293 }
294
297
298 G4LogicalSurface* Surface = nullptr;
299
301 (pPreStepPoint ->GetPhysicalVolume(),
303
304 if (Surface == nullptr)
305 {
308 if(enteredDaughter)
309 {
312
313 if(Surface == nullptr)
316 }
317 else
318 {
321
322 if(Surface == nullptr)
325 }
326 }
327
328
331
332 energyThreshold = 0.0*eV;
334
335 if ((thePrePV)&&(thePostPV))
336 {
337 WorkFunctionTable::iterator postStepWF;
339 WorkFunctionTable::iterator preStepWF;
341
342 if (postStepWF == tableWF.end())
343 {
344 G4String str = "Material ";
347 return nullptr;
348 }
349 else if (preStepWF == tableWF.end())
350 {
351 G4String str = "Material ";
354 return nullptr;
355 }
356 else
357 {
358 G4double thresholdNew = postStepWF->second;
359 G4double thresholdOld = preStepWF->second;
360
361 energyThreshold = thresholdNew - thresholdOld;
362 energyDelta = thresholdOld- thresholdNew;
363 }
364 }
365
367 thetat= GetIncidentAngle();
368 G4double ekinNormalt=ekint*std::cos(thetat)*std::cos(thetat);
369 G4double sin_thetaft = std::sqrt(ekint/(ekint+energyThreshold))*std::sin(thetat);
371
372
373 if (1.0-sin_thetaft*sin_thetaft>0) {
374 cos_thetaft = std::sqrt(1.0-sin_thetaft*sin_thetaft);
375 }
376 else {
377 cos_thetaft = 0.0;
378 }
379
381 G4double waveVectort=std::sqrt(2*9.1093826E-31*1.602176487E-19)/(6.6260755E-34/(2.0*
pi));
382
383
385
386 crossingProbability=0;
387
388 G4double kft=waveVectort*std::sqrt(ekint+energyThreshold)*cos_thetaft;
389 G4double kit=waveVectort*std::sqrt(ekinNormalt);
390
391 crossingProbability=1-(std::pow(std::sinh(pi*at*(kit-kft)), 2.0)/std::pow(std::sinh(pi*at*(kit+kft)), 2.0));
392
393
394 if((aleat<=crossingProbability)&&(ekint> energyDelta))
395 {
398 {
400 flag_franchissement_surface = true;
401 }
402
403
404 cos_thetaft = cos_thetaft*std::cos(thetat)+sin_thetaft*std::sin(thetat);
405
409
410 G4double xDirt = std::sqrt(1. - cos_thetaft*cos_thetaft);
412
413 G4ThreeVector zPrimeVerst=((xDirt*xVerst + yDirt*yVerst + cos_thetaft*zVerst));
414
416 }
417 else if ((aleat > crossingProbability) && (ekint> energyDelta))
418 {
419 flag_reflexion = true;
420 if (flag_normal)
421 {
423 }
424 else
425 {
427 }
428 }
429 else
430 {
431 if (flag_normal)
432 {
434 }
435 else
436 {
438 }
439 flag_reflexion = true;
440 }
442}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
Hep3Vector orthogonal() const
Hep3Vector cross(const Hep3Vector &) const
const G4ThreeVector & GetMomentumDirection() const
G4double GetTotalMomentum() const
static G4LogicalBorderSurface * GetSurface(const G4VPhysicalVolume *vol1, const G4VPhysicalVolume *vol2)
static G4LogicalSkinSurface * GetSurface(const G4LogicalVolume *vol)
G4Material * GetMaterial() const
virtual G4ThreeVector GetGlobalExitNormal(const G4ThreeVector &point, G4bool *valid)
G4StepStatus GetStepStatus() const
G4Material * GetMaterial() const
const G4ThreeVector & GetPosition() const
const G4ThreeVector & GetMomentumDirection() const
G4VPhysicalVolume * GetPhysicalVolume() const
G4double GetKineticEnergy() const
G4StepPoint * GetPreStepPoint() const
G4StepPoint * GetPostStepPoint() const
G4double GetVelocity() const
const G4DynamicParticle * GetDynamicParticle() const
G4double GetStepLength() const
static G4TransportationManager * GetTransportationManager()
G4Navigator * GetNavigatorForTracking() const
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4ParticleChange aParticleChange