132{
134
135
138
141
142 material1 = pPreStepPoint -> GetMaterial();
143 material2 = pPostStepPoint -> GetMaterial();
144
146
148 previousMomentum = oldMomentum;
150
151
154 {
156 flag_franchissement_surface = false;
157 flag_reflexion = false;
159
160 }
162
163
164 if (material1 == material2)
165 {
168
169 }
171 {
177 G4cout <<
" Old Momentum Direction: " << oldMomentum <<
G4endl;
178 }
179
180
182
185 GetNavigatorForTracking();
186
188
190
191
192 if (valid)
193 {
194 theGlobalNormal = -theGlobalNormal;
195 }
196 else
197 {
199 ed << " G4MicroElecSurface/PostStepDoIt(): "
200 << " The Navigator reports that it returned an invalid normal.\n"
204 << " position: " << theGlobalPoint
205 << " direction: " << oldMomentum
207 G4Exception(
"G4MuElecSurf::PostStepDoIt",
"OpBoun01",
209 "Invalid Surface Normal - Geometry must return valid surface normal");
210 return 0;
211 }
212
213
214 if (oldMomentum * theGlobalNormal > 0.0)
215 {
216 theGlobalNormal = -theGlobalNormal;
217 }
218
219
220
222 {
224
225 WorkFunctionTable::iterator postStepWF;
227 WorkFunctionTable::iterator preStepWF;
229
230 if (postStepWF == tableWF.end()) {
234 return 0;
235 }
236
237 else if (preStepWF == tableWF.end()) {
241 return 0;
242 }
243
245
246 flag_franchissement_surface = false;
247
248 if (flag_reflexion == true && flag_normal == true) {
250 flag_reflexion = false;
251 flag_normal = false;
252 }
253 }
255 }
256
257 flag_normal = (theGlobalNormal.
x() == 0.0 && theGlobalNormal.
y() == 0.0);
258
260
262 (pPreStepPoint ->GetPhysicalVolume(),
264
265 if (Surface == nullptr)
266 {
271 if(enteredDaughter)
272 {
275 GetLogicalVolume());
276
277 if(Surface == nullptr)
280 GetLogicalVolume());
281 }
282 else
283 {
286 GetLogicalVolume());
287
288 if(Surface == nullptr)
291 GetLogicalVolume());
292 }
293 }
294
297
298 if (thePostPV)
299 {
300 WorkFunctionTable::iterator postStepWF;
302 WorkFunctionTable::iterator preStepWF;
304
305 if (postStepWF == tableWF.end()) {
309 return 0;
310 }
311 else if (preStepWF == tableWF.end()) {
315 return 0;
316 }
317 else
318 {
319 G4double thresholdNew = postStepWF->second;
320 G4double thresholdOld = preStepWF->second;
321 energyThreshold = thresholdNew - thresholdOld;
322 }
323 }
324
326 thetat= GetIncidentAngle();
327 G4double ekinNormalt=ekint*std::cos(thetat)*std::cos(thetat);
328
329 G4double atet = std::sqrt(ekint/(ekint+energyThreshold))*std::sin(thetat);
330 thetaft = (atet > 1.0) ? pi*0.5 : std::asin(atet);
331
333
334 const G4double waveVectort=std::sqrt(2*9.1093826E-31*1.602176487E-19)/(6.6260755E-34/(2.0*
pi));
335
336
338
339
340 crossingProbability=0;
341
342 G4double kft=waveVectort*std::sqrt(ekint+energyThreshold)*std::cos(thetaft);
343 G4double kit=waveVectort*std::sqrt(ekinNormalt);
344
345 G4double yy = std::sinh(pi*at*(kit-kft))/std::sinh(pi*at*(kit+kft));
346 crossingProbability = 1 - yy*yy;
347
348
349 if((aleat<=crossingProbability)&&(ekint>std::abs(energyThreshold)))
350 {
352 flag_franchissement_surface = true;
353 }
354
355 thetaft=std::abs(thetaft-thetat);
356
360
362 G4double xDirt = std::sqrt(1. - cost*cost);
364
365 G4ThreeVector zPrimeVerst = xDirt*xVerst + yDirt*yVerst + cost*zVerst;
366
368 }
369 else if ((aleat > crossingProbability) && (ekint>std::abs(energyThreshold)))
370 {
371 flag_reflexion = true;
374
375 }
376 else {
377
380 flag_reflexion = true;
381 }
382
384}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
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 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 GetKineticEnergy() const
G4double GetStepLength() const
static G4TransportationManager * GetTransportationManager()
virtual G4VParticleChange * PostStepDoIt(const G4Track &, const G4Step &)
G4LogicalVolume * GetMotherLogical() const
G4LogicalVolume * GetLogicalVolume() const
const G4String & GetName() const
G4ParticleChange aParticleChange