138 G4double currentMinimumStep,
139 G4double& currentSafety,
142 G4double geometryStepLength;
158 const G4DynamicParticle* pParticle = track.GetDynamicParticle() ;
159 G4ParticleDefinition* pParticleDef = pParticle->GetDefinition() ;
160 G4ThreeVector startPosition = track.GetPosition() ;
169 G4double MagSqShift = OriginShift.mag2() ;
172 currentSafety = 0.0 ;
181 G4double particleCharge = pParticle->GetCharge() ;
188 G4FieldManager* fieldMgr =
m_fieldPropagator->FindAndSetFieldManager( track.GetVolume() );
191 fieldMgr->ConfigureForTrack( &track );
193 G4Exception(
"QuirkTransportation::AlongStepGetPhysicalInteractionLength",
"QuirkNoFieldMgr", RunMustBeAborted,
"no field manager");
197 Quirk* quirkDef =
dynamic_cast<Quirk*
>(pParticleDef);
199 G4Exception(
"QuirkTransportation::AlongStepGetPhysicalInteractionLength",
"NonQuirk", FatalErrorInArgument,
"QuirkTransportation run on non-quirk particle");
205 fieldMgr->DoesFieldExist() ? fieldMgr->GetDetectorField() : 0
209 G4ChordFinder* oldChordFinder = fieldMgr->GetChordFinder();
210 G4ChordFinder quirkChordFinder(
211 new G4MagInt_Driver(0.0, &quirkStepper, quirkStepper.GetNumberOfVariables())
213 fieldMgr->SetChordFinder(&quirkChordFinder);
215 G4double momentumMagnitude = pParticle->GetTotalMomentum() ;
216 G4ThreeVector EndUnitMomentum ;
217 G4double restMass = pParticleDef->GetPDGMass() ;
219#if G4VERSION_NUMBER > 1009
221 G4ChargeState chargeState(particleCharge,
222 quirkDef->GetPDGSpin(),
226 G4EquationOfMotion* equationOfMotion = (
m_fieldPropagator->GetChordFinder()->GetIntegrationDriver()->GetStepper())->GetEquationOfMotion();
227 equationOfMotion->SetChargeMomentumMass( chargeState,
236 G4ThreeVector
spin = track.GetPolarization() ;
237 G4FieldTrack aFieldTrack = G4FieldTrack( startPosition,
238 track.GetMomentumDirection(),
240 track.GetKineticEnergy(),
243 track.GetGlobalTime(),
258 if (
dbg) G4cout <<
"QuirkTransportation: start = " << aFieldTrack.GetPosition() << G4endl;
259 if (
dbg) G4cout <<
"QuirkTransportation: currentMinimumStep = " << currentMinimumStep << G4endl;
260 if (
dbg) G4cout <<
"QuirkTransportation: maxlength = " << quirkStepper.
GetMaxLength() << G4endl;
261 currentMinimumStep = std::min(currentMinimumStep, quirkStepper.
GetMaxLength());
262 if (
dbg) G4cout <<
"QuirkTransportation: currentMinimumStep = " << currentMinimumStep << G4endl;
263 if( currentMinimumStep > 0 )
269 track.GetVolume() ) ;
270 if (
dbg) G4cout <<
"QuirkTransportation: moved " << lengthAlongCurve << G4endl;
273 geometryStepLength = lengthAlongCurve ;
275 geometryStepLength = currentMinimumStep ;
282 geometryStepLength = 0.0 ;
285 if (
dbg) G4cout <<
"QuirkTransportation: moved " << aFieldTrack.GetCurveLength() << G4endl;
286 if (
dbg) G4cout <<
"QuirkTransportation: end = " << aFieldTrack.GetPosition() <<
" [" << aFieldTrack.GetProperTimeOfFlight() <<
"]" << G4endl;
295 geometryStepLength = aFieldTrack.GetCurveLength();
308 if( currentMinimumStep == 0.0 )
320 currentSafety = endSafety ;
330#ifdef G4DEBUG_TRANSPORT
331 G4cout.precision(12) ;
332 G4cout <<
"***QuirkTransportation::AlongStepGPIL ** " << G4endl ;
334 <<
" and it returned safety= " << endSafety << G4endl ;
336 <<
" to obtain pseudo-safety= " << currentSafety << G4endl ;
343 fieldMgr->SetChordFinder(oldChordFinder);
345 return geometryStepLength ;
467 G4TouchableHandle retCurrentTouchable ;
468 G4bool isLastStep=
false;
487 LocateGlobalPointAndUpdateTouchableHandle( track.GetPosition(),
488 track.GetMomentumDirection(),
497 G4cout <<
"QuirkTransportation: number of steps = " << track.GetCurrentStepNumber() << G4endl;
506#ifdef G4DEBUG_TRANSPORT
510 if( ! (exiting || entering) ) {
511 G4cout <<
" Transport> : Proposed isLastStep= " << isLastStep
530 retCurrentTouchable = track.GetTouchableHandle() ;
533#ifdef G4DEBUG_TRANSPORT
535 G4cout <<
" Transport> Proposed isLastStep= " << isLastStep
536 <<
" Geometry did not limit step. " << G4endl;
542 const G4VPhysicalVolume* pNewVol = retCurrentTouchable->GetVolume() ;
543 G4Material* pNewMaterial = 0 ;
544 G4VSensitiveDetector* pNewSensitiveDetector = 0 ;
548 pNewMaterial= pNewVol->GetLogicalVolume()->GetMaterial();
549 pNewSensitiveDetector= pNewVol->GetLogicalVolume()->GetSensitiveDetector();
558 const G4MaterialCutsCouple* pNewMaterialCutsCouple = 0;
561 pNewMaterialCutsCouple=pNewVol->GetLogicalVolume()->GetMaterialCutsCouple();
564 if( pNewVol!=0 && pNewMaterialCutsCouple!=0 && pNewMaterialCutsCouple->GetMaterial()!=pNewMaterial )
568 pNewMaterialCutsCouple =
569 G4ProductionCutsTable::GetProductionCutsTable()
570 ->GetMaterialCutsCouple(pNewMaterial,
571 pNewMaterialCutsCouple->GetProductionCuts());
573 m_particleChange.SetMaterialCutsCoupleInTouchable( pNewMaterialCutsCouple );