224{
225 G4double geometryStepLength(-1.0), newSafety(-1.0) ;
226
227 State(fParticleIsLooping) = false ;
228 State(fEndGlobalTimeComputed) = false ;
229 State(fGeometryLimitedStep) = false ;
230
231
232
233
234
236
237
238
239
241
242
243
245
248
249
250
251
252
253
254
257 if( MagSqShift >=
sqr(
State(fPreviousSafety)) )
258 {
259 currentSafety = 0.0 ;
260 }
261 else
262 {
263 currentSafety =
State(fPreviousSafety) - std::sqrt(MagSqShift) ;
264 }
265
266
267
269
270
271
272
273
274
275
276
278 G4bool fieldExertsForce = false ;
279 if( (particleCharge != 0.0) )
280 {
282 if (fieldMgr != 0)
283 {
284
286
287
288
289
290
292 }
293 }
294
295
296
297
298
299
300 if( !fieldExertsForce )
301 {
304 {
305
306
307 geometryStepLength = currentMinimumStep ;
308 State(fGeometryLimitedStep) = false ;
309 }
310 else
311 {
312
313
315 startMomentumDir,
316 currentMinimumStep,
317 newSafety) ;
318
319
320 State(fPreviousSftOrigin) = startPosition ;
321 State(fPreviousSafety) = newSafety ;
322
323
324
325
326 currentSafety = newSafety ;
327
328 State(fGeometryLimitedStep)= (linearStepLength <= currentMinimumStep);
329 if(
State(fGeometryLimitedStep) )
330 {
331
332 geometryStepLength = linearStepLength ;
333 }
334 else
335 {
336
337 geometryStepLength = currentMinimumStep ;
338 }
339 }
340 State(endpointDistance) = geometryStepLength ;
341
342
343
344 State(fTransportEndPosition) = startPosition+geometryStepLength*startMomentumDir ;
345
346
347
348 State(fTransportEndMomentumDir) = startMomentumDir ;
351 State(fParticleIsLooping) = false ;
352 State(fMomentumChanged) = false ;
353 State(fEndGlobalTimeComputed) = true ;
356
357
358
359
360
361
362 }
363 else
364 {
365
367 exceptionDescription << "ITTransportation does not support external fields.";
368 exceptionDescription << " If you are dealing with a tradiational MC simulation, ";
369 exceptionDescription << "please use G4Transportation.";
370
371 G4Exception(
"G4ITTransportation::AlongStepGetPhysicalInteractionLength",
"NoExternalFieldSupport",
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515 }
516
517
518
519
520 if( currentMinimumStep == 0.0 )
521 {
522 if( currentSafety == 0.0 )
523 {
524 State(fGeometryLimitedStep) = true ;
525
526
527 }
528 }
529
530
531
532
533 if( currentSafety <
State(endpointDistance) )
534 {
535
536
537
538 if( particleCharge != 0.0 )
539 {
540
543 currentSafety = endSafety ;
544 State(fPreviousSftOrigin) =
State(fTransportEndPosition) ;
545 State(fPreviousSafety) = currentSafety ;
547
548
549
550
551 currentSafety +=
State(endpointDistance) ;
552
553#ifdef G4DEBUG_TRANSPORT
555 G4cout <<
"***G4Transportation::AlongStepGPIL ** " <<
G4endl ;
556 G4cout <<
" Called Navigator->ComputeSafety at " <<
State(fTransportEndPosition)
557 <<
" and it returned safety= " << endSafety <<
G4endl ;
558 G4cout <<
" Adding endpoint distance " <<
State(endpointDistance)
559 <<
" to obtain pseudo-safety= " << currentSafety <<
G4endl ;
560#endif
561 }
562 }
563
564
565
566 return geometryStepLength ;
567}
const G4ThreeVector & GetMomentumDirection() const
G4double GetCharge() const
virtual void ConfigureForTrack(const G4Track *)
const G4Field * GetDetectorField() const
virtual G4double ComputeStep(const G4ThreeVector &pGlobalPoint, const G4ThreeVector &pDirection, const G4double pCurrentProposedStepLength, G4double &pNewSafety)
virtual G4double ComputeSafety(const G4ThreeVector &globalpoint, const G4double pProposedMaxLength=DBL_MAX, const G4bool keepState=false)
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
G4double GetVelocity() const
G4VPhysicalVolume * GetVolume() const
const G4ThreeVector & GetPosition() const
const G4DynamicParticle * GetDynamicParticle() const
const G4TouchableHandle & GetTouchableHandle() const
const G4ThreeVector & GetPolarization() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
std::ostringstream G4ExceptionDescription