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 if (pPostStepPoint) {
225
226 WorkFunctionTable::iterator postStepWF;
228 WorkFunctionTable::iterator preStepWF;
230
231 if (postStepWF == tableWF.end()) {
235 return 0;
236 }
237
238 else if (preStepWF == tableWF.end()) {
242 return 0;
243 }
244
246
247 flag_franchissement_surface = false;
248
249 if (flag_reflexion == true && flag_normal == true) {
251 flag_reflexion = false;
252 flag_normal = false;
253 }
254 }
255 }
257 }
258
259 flag_normal = (theGlobalNormal.
x() == 0.0 && theGlobalNormal.
y() == 0.0);
260
262
264 (pPreStepPoint ->GetPhysicalVolume(),
266
267 if (Surface == nullptr)
268 {
273 if(enteredDaughter)
274 {
277 GetLogicalVolume());
278
279 if(Surface == nullptr)
282 GetLogicalVolume());
283 }
284 else
285 {
288 GetLogicalVolume());
289
290 if(Surface == nullptr)
293 GetLogicalVolume());
294 }
295 }
296
297
300
301 if (thePostPV)
302 {
303 WorkFunctionTable::iterator postStepWF;
305 WorkFunctionTable::iterator preStepWF;
307
308 if (postStepWF == tableWF.end()) {
312 return 0;
313 }
314
315 else if (preStepWF == tableWF.end()) {
319 return 0;
320 }
321
322 else
323 {
324 G4double thresholdNew = postStepWF->second;
325 G4double thresholdOld = preStepWF->second;
326 energyThreshold = thresholdNew - thresholdOld;
327 }
328 }
329
331 thetat= GetIncidentAngle();
332 G4double ekinNormalt=ekint*std::cos(thetat)*std::cos(thetat);
333
334 G4double atet = std::sqrt(ekint/(ekint+energyThreshold))*std::sin(thetat);
335 thetaft = (atet > 1.0) ? pi*0.5 : std::asin(atet);
336
338
339 const G4double waveVectort=std::sqrt(2*9.1093826E-31*1.602176487E-19)/(6.6260755E-34/(2.0*
pi));
340
341
343
344
345 crossingProbability=0;
346
347 G4double kft=waveVectort*std::sqrt(ekint+energyThreshold)*std::cos(thetaft);
348 G4double kit=waveVectort*std::sqrt(ekinNormalt);
349
350 G4double yy = std::sinh(pi*at*(kit-kft))/std::sinh(pi*at*(kit+kft));
351 crossingProbability = 1 - yy*yy;
352
353
354 if((aleat<=crossingProbability)&&(ekint>std::abs(energyThreshold)))
355 {
357 flag_franchissement_surface = true;
358 }
359
360 thetaft=std::abs(thetaft-thetat);
361
365
367 G4double xDirt = std::sqrt(1. - cost*cost);
369
370 G4ThreeVector zPrimeVerst = xDirt*xVerst + yDirt*yVerst + cost*zVerst;
371
373 }
374 else if ((aleat > crossingProbability) && (ekint>std::abs(energyThreshold)))
375 {
376 flag_reflexion = true;
379
380 }
381 else {
382
385 flag_reflexion = true;
386 }
387
389}
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 ProposeVelocity(G4double finalVelocity)
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
virtual void Initialize(const G4Track &)
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