164{
165
168
169
172
175
176 material1 = pPreStepPoint -> GetMaterial();
177 material2 = pPostStepPoint -> GetMaterial();
178
180
182
184 previousMomentum = oldMomentum;
186
187
188
191 {
193 flag_franchissement_surface = false;
194 flag_reflexion = false;
196 }
198
199
200 if (material1 == material2)
201 {
204 }
206 {
212 G4cout <<
" Old Momentum Direction: " << oldMomentum <<
G4endl;
213 }
214
215
217
220
223
224 if (valid)
225 {
226 theGlobalNormal = -theGlobalNormal;
227 }
228 else
229 {
231 ed << " G4MicroElecSurface/PostStepDoIt(): "
232 << " The Navigator reports that it returned an invalid normal"
234 G4Exception(
"G4MuElecSurf::PostStepDoIt",
"OpBoun01",
236 "Invalid Surface Normal - Geometry must return valid surface normal");
237 }
238
239
240 if (oldMomentum * theGlobalNormal > 0.0)
241 {
242 theGlobalNormal = -theGlobalNormal;
243 }
244
246 {
247 if (flag_reflexion == true)
248 {
249 flag_reflexion = false;
251 }
252
254
255 G4double energyThreshold_surface = 0.0*eV;
256
257 WorkFunctionTable::iterator postStepWF;
259 WorkFunctionTable::iterator preStepWF;
261
262 if (postStepWF == tableWF.end())
263 {
267 return nullptr;
268 }
269 else if (preStepWF == tableWF.end())
270 {
274 return nullptr;
275 }
276 else
277 {
278 G4double thresholdNew_surface = postStepWF->second;
279 G4double thresholdOld_surface = preStepWF->second;
280 energyThreshold_surface = thresholdNew_surface - thresholdOld_surface;
281 }
282
283 if (flag_franchissement_surface == true)
284 {
286 flag_franchissement_surface = false;
287 }
288 if (flag_reflexion == true && flag_normal == true)
289 {
291 flag_reflexion = false;
292 flag_normal = false;
293 }
295 }
296
299
301
303 (pPreStepPoint ->GetPhysicalVolume(),
305
306 if (Surface == nullptr)
307 {
310 if(enteredDaughter)
311 {
314
315 if(Surface == nullptr)
318 }
319 else
320 {
323
324 if(Surface == nullptr)
327 }
328 }
329
330
333
334 energyThreshold = 0.0*eV;
336
337 if ((thePrePV)&&(thePostPV))
338 {
339 WorkFunctionTable::iterator postStepWF;
341 WorkFunctionTable::iterator preStepWF;
343
344 if (postStepWF == tableWF.end())
345 {
349 return nullptr;
350 }
351 else if (preStepWF == tableWF.end())
352 {
356 return nullptr;
357 }
358 else
359 {
360 G4double thresholdNew = postStepWF->second;
361 G4double thresholdOld = preStepWF->second;
362
363 energyThreshold = thresholdNew - thresholdOld;
364 energyDelta = thresholdOld- thresholdNew;
365 }
366 }
367
369 thetat= GetIncidentAngle();
370 G4double ekinNormalt=ekint*std::cos(thetat)*std::cos(thetat);
371
372 thetaft=std::asin(std::sqrt(ekint/(ekint+energyThreshold))*std::sin(thetat));
373 if(std::sqrt(ekint/(ekint+energyThreshold))*std::sin(thetat)>1.0)
374 {
375 thetaft=std::asin(1.0);
376 }
377
379
380 G4double waveVectort=std::sqrt(2*9.1093826E-31*1.602176487E-19)/(6.6260755E-34/(2.0*pi));
381
382
384
385 crossingProbability=0;
386
387 G4double kft=waveVectort*std::sqrt(ekint+energyThreshold)*std::cos(thetaft);
388 G4double kit=waveVectort*std::sqrt(ekinNormalt);
389
390 crossingProbability=1-(std::pow(std::sinh(pi*at*(kit-kft)), 2.0)/std::pow(std::sinh(pi*at*(kit+kft)), 2.0));
391
392
393 if((aleat<=crossingProbability)&&(ekint> energyDelta))
394 {
397 {
399 flag_franchissement_surface = true;
400 }
401
402 thetaft=std::abs(thetaft-thetat);
403
407
408 G4double xDirt = std::sqrt(1. - std::cos(thetaft)*std::cos(thetaft));
410
411 G4ThreeVector zPrimeVerst=((xDirt*xVerst + yDirt*yVerst + std::cos(thetaft)*zVerst));
412
414 }
415 else if ((aleat > crossingProbability) && (ekint> energyDelta))
416 {
417 flag_reflexion = true;
418 if (flag_normal)
419 {
421 }
422 else
423 {
425 }
426 }
427 else
428 {
429 if (flag_normal)
430 {
432 }
433 else
434 {
436 }
437 flag_reflexion = true;
438 }
440}
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)
void Initialize(const G4Track &) override
void ProposeVelocity(G4double finalVelocity)
void ProposeEnergy(G4double finalEnergy)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
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