101{
105
108
110
111
112
113
114
115
116
117
118
119
121
122 fFirstStepInMassVolume =
fNewTrack || fMassGeometryLimitedStep ;
124
125#ifdef G4DEBUG_TRANSPORT
126 G4cout <<
" CoupledTransport::AlongStep GPIL: "
129 << " mass= " << fFirstStepInMassVolume << " ( geom= "
130 << fMassGeometryLimitedStep << " ) "
132#endif
133
134
136
137
138
144
145#ifdef G4DEBUG_TRANSPORT
147 {
148 G4cout <<
"G4CoupledTransportation::AlongStepGPIL> called in volume "
150 }
151#endif
152
153
154
155
156
157
160 startFullSafety= 0.0;
161
162
163
164 if( MagSqShift <
sqr(fPreviousFullSafety) )
165 {
166 G4double mag_shift= std::sqrt(MagSqShift);
167 startFullSafety = std::max( (fPreviousFullSafety - mag_shift), 0.0);
168
169
170
171
172
173
174 }
175
176
177
181
182 fMassGeometryLimitedStep = false ;
184
185
186
187
188
189
190
192 G4bool fieldExertsForce = false ;
193
194 const G4Field* ptrField=
nullptr;
195
197 G4bool eligibleEM = (particleCharge != 0.0)
200
201 if( (fieldMgr!=nullptr) && (eligibleEM||eligibleGrav) )
202 {
203
204
206
207
208
209
210
212
213 if( ptrField != nullptr)
214 {
215 fieldExertsForce = eligibleEM
217 }
218 }
220
221 if( fieldExertsForce )
222 {
224
226 magneticMoment,
228 if( equationOfMotion )
229 {
230 equationOfMotion->SetChargeMomentumMass( chargeState,
231 momentumMagnitude,
232 restMass );
233 }
234#ifdef G4DEBUG_TRANSPORT
235 else
236 {
237 G4cerr <<
" ERROR in G4CoupledTransportation> "
238 <<
"Cannot find valid Equation of motion: " <<
G4endl;
239 <<
" Unable to pass Charge, Momentum and Mass " <<
G4endl;
240 }
241#endif
242 }
243
249 restMass,
250 particleCharge,
251 polarizationVec,
253 0.0,
256
259
260 fMassGeometryLimitedStep = false ;
262 if( currentMinimumStep > 0 )
263 {
265
266
267
268 lengthAlongCurve = fPathFinder->
ComputeStep( aFieldTrack,
269 currentMinimumStep,
271 stepNo,
272 newMassSafety,
273 limitedStep,
274 endTrackState,
275 currentVolume ) ;
276
278
279
281 {
282 fMassGeometryLimitedStep = true ;
283 }
284
286
287#ifdef G4DEBUG_TRANSPORT
289 {
290 std::ostringstream message;
291 message <<
" ERROR in determining geometries limiting the step" <<
G4endl;
292 message << " Limiting: mass=" << fMassGeometryLimitedStep
294 message << "Incompatible conditions - by which geometries was it limited ?";
295 G4Exception(
"G4CoupledTransportation::AlongStepGetPhysicalInteractionLength()",
297 }
298#endif
299
300 geometryStepLength = std::min( lengthAlongCurve, currentMinimumStep);
301
302
303
306
307
309 fPreviousMassSafety = newMassSafety ;
310 fPreviousFullSafety = newFullSafety ;
311
312
313#ifdef G4DEBUG_TRANSPORT
315 {
316 G4cout <<
"G4Transport:CompStep> "
317 << " called the pathfinder for a new step at " << startPosition
318 <<
" and obtained step = " << lengthAlongCurve <<
G4endl;
319 G4cout <<
" New safety (preStep) = " << newMassSafety <<
G4endl;
320 }
321#endif
322
323
324 startFullSafety = newFullSafety ;
325
326
329 }
330 else
331 {
332 geometryStepLength = lengthAlongCurve= 0.0 ;
334
335
338
340
341 endTrackState= aFieldTrack;
342 }
343
344
345 if( !fieldExertsForce )
346 {
350 }
351 else
352 {
354
355#ifdef G4DEBUG_TRANSPORT
357 {
358 G4cout <<
" G4CT::CS End Position = "
360 G4cout <<
" G4CT::CS End Direction = "
362 }
363#endif
365 {
366
367
368
371
372
373
374
375 }
376 else
377 {
378
379
380
382
383#ifdef G4VERBOSE
384
385
388
389 G4double absEdiff = std::fabs(startEnergy- endEnergy);
390 if( (
verboseLevel > 1) && ( absEdiff > perThousand * endEnergy) )
391 {
393 }
394#endif
395
396
397
399 }
400 }
401
404
405
406
407 safetyProposal= startFullSafety;
408
409
410
411
413 && ( particleCharge != 0.0 ) )
414
415 {
418
419
420
421
422
423
425
426
429
430
431 fPreviousMassSafety = endMassSafety ;
432 fPreviousFullSafety = endFullSafety;
434
435
436
438
439
440
441#ifdef G4DEBUG_TRANSPORT
443 G4cout <<
"***CoupledTransportation::AlongStepGPIL ** " <<
G4endl ;
445 << " give safety values: Mass= " << endMassSafety
446 <<
" All= " << endFullSafety <<
G4endl ;
448 <<
" to obtain pseudo-safety= " << safetyProposal <<
G4endl ;
450 }
451 else
452 {
454 G4cout <<
"***CoupledTransportation::AlongStepGPIL ** " <<
G4endl ;
455 G4cout <<
" Quick Safety estimate at endpoint "
457 << " gives safety endpoint value = "
459 << " using start-point value " << startFullSafety
462#endif
463 }
464
465 proposedSafetyForStart= safetyProposal;
467
468 return geometryStepLength ;
469}
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cerr
void ReportInexactEnergy(G4double startEnergy, G4double endEnergy)
const G4ThreeVector & GetMomentumDirection() const
G4double GetCharge() const
G4ParticleDefinition * GetDefinition() const
G4double GetMagneticMoment() const
G4double GetTotalMomentum() const
G4bool DoesFieldChangeEnergy() const
virtual void ConfigureForTrack(const G4Track *)
const G4Field * GetDetectorField() const
G4bool IsGravityActive() const
G4double GetPDGMagneticMoment() const
G4double GetPDGSpin() const
G4double ComputeSafety(const G4ThreeVector &globalPoint)
unsigned int GetNumberGeometriesLimitingStep() const
G4double ObtainSafety(G4int navId, G4ThreeVector &globalCenterPoint)
G4double ComputeStep(const G4FieldTrack &pFieldTrack, G4double pCurrentProposedStepLength, G4int navigatorId, G4int stepNo, G4double &pNewSafety, ELimited &limitedStep, G4FieldTrack &EndState, G4VPhysicalVolume *currentVolume)
G4double GetCurrentSafety() const
G4FieldManager * FindAndSetFieldManager(G4VPhysicalVolume *pCurrentPhysVol)
G4FieldManager * GetCurrentFieldManager()
G4bool IsParticleLooping() const
G4EquationOfMotion * GetCurrentEquationOfMotion()
void SetCurrentSafety(G4double val, const G4ThreeVector &pos)
G4VPhysicalVolume * GetVolume() const
const G4ThreeVector & GetPosition() const
G4double GetGlobalTime() const
G4int GetCurrentStepNumber() const
const G4DynamicParticle * GetDynamicParticle() const
const G4ThreeVector & GetMomentumDirection() const
G4double GetKineticEnergy() const
const G4ThreeVector & GetPolarization() const
static constexpr G4int kMassNavigatorId
G4ThreeVector fPreviousSftOrigin
G4ThreeVector fTransportEndSpin
G4double fTransportEndKineticEnergy
G4PropagatorInField * fFieldPropagator
G4ThreeVector fTransportEndPosition
G4bool fEndGlobalTimeComputed
G4ParticleChangeForTransport fParticleChange
G4double fEndPointDistance
static G4bool fUseGravity
G4bool fGeometryLimitedStep
static G4bool fUseMagneticMoment
G4bool fParticleIsLooping
G4ThreeVector fTransportEndMomentumDir
G4SafetyHelper * fpSafetyHelper
G4double fCandidateEndGlobalTime
G4bool fFirstStepInVolume
void ProposeTrueStepLength(G4double truePathLength)
const G4String & GetName() const