138 G4double geometryStepLength;
154 const G4DynamicParticle* pParticle =
track.GetDynamicParticle() ;
155 G4ParticleDefinition* pParticleDef = pParticle->GetDefinition() ;
156 G4ThreeVector startPosition =
track.GetPosition() ;
165 G4double MagSqShift = OriginShift.mag2() ;
168 currentSafety = 0.0 ;
177 G4double particleCharge = pParticle->GetCharge() ;
187 fieldMgr->ConfigureForTrack( &
track );
189 G4Exception(
"QuirkTransportation::AlongStepGetPhysicalInteractionLength",
"QuirkNoFieldMgr", RunMustBeAborted,
"no field manager");
193 Quirk* quirkDef =
dynamic_cast<Quirk*
>(pParticleDef);
195 G4Exception(
"QuirkTransportation::AlongStepGetPhysicalInteractionLength",
"NonQuirk", FatalErrorInArgument,
"QuirkTransportation run on non-quirk particle");
201 fieldMgr->DoesFieldExist() ? fieldMgr->GetDetectorField() : 0
205 G4ChordFinder* oldChordFinder = fieldMgr->GetChordFinder();
206 G4ChordFinder quirkChordFinder(
207 new G4MagInt_Driver(0.0, &quirkStepper, quirkStepper.GetNumberOfVariables())
209 fieldMgr->SetChordFinder(&quirkChordFinder);
211 G4double momentumMagnitude = pParticle->GetTotalMomentum() ;
212 G4ThreeVector EndUnitMomentum ;
213 G4double restMass = pParticleDef->GetPDGMass() ;
215 #if G4VERSION_NUMBER > 1009
217 G4ChargeState chargeState(particleCharge,
218 quirkDef->GetPDGSpin(),
222 G4EquationOfMotion* equationOfMotion = (
m_fieldPropagator->GetChordFinder()->GetIntegrationDriver()->GetStepper())->GetEquationOfMotion();
223 equationOfMotion->SetChargeMomentumMass( chargeState,
232 G4ThreeVector
spin =
track.GetPolarization() ;
233 G4FieldTrack aFieldTrack = G4FieldTrack( startPosition,
234 track.GetMomentumDirection(),
236 track.GetKineticEnergy(),
239 track.GetGlobalTime(),
253 quirkStepper.SetDebug(
dbg);
254 if (
dbg) G4cout <<
"QuirkTransportation: start = " << aFieldTrack.GetPosition() << G4endl;
255 if (
dbg) G4cout <<
"QuirkTransportation: currentMinimumStep = " << currentMinimumStep << G4endl;
256 if (
dbg) G4cout <<
"QuirkTransportation: maxlength = " << quirkStepper.GetMaxLength() << G4endl;
257 currentMinimumStep =
std::min(currentMinimumStep, quirkStepper.GetMaxLength());
258 if (
dbg) G4cout <<
"QuirkTransportation: currentMinimumStep = " << currentMinimumStep << G4endl;
259 if( currentMinimumStep > 0 )
265 track.GetVolume() ) ;
266 if (
dbg) G4cout <<
"QuirkTransportation: moved " << lengthAlongCurve << G4endl;
269 geometryStepLength = lengthAlongCurve ;
271 geometryStepLength = currentMinimumStep ;
278 geometryStepLength = 0.0 ;
281 if (
dbg) G4cout <<
"QuirkTransportation: moved " << aFieldTrack.GetCurveLength() << G4endl;
282 if (
dbg) G4cout <<
"QuirkTransportation: end = " << aFieldTrack.GetPosition() <<
" [" << aFieldTrack.GetProperTimeOfFlight() <<
"]" << G4endl;
291 geometryStepLength = aFieldTrack.GetCurveLength();
304 if( currentMinimumStep == 0.0 )
316 currentSafety = endSafety ;
326 #ifdef G4DEBUG_TRANSPORT
327 G4cout.precision(12) ;
328 G4cout <<
"***QuirkTransportation::AlongStepGPIL ** " << G4endl ;
330 <<
" and it returned safety= " << endSafety << G4endl ;
332 <<
" to obtain pseudo-safety= " << currentSafety << G4endl ;
339 fieldMgr->SetChordFinder(oldChordFinder);
341 return geometryStepLength ;