void FastSimModelTracker::DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep) { // Calculate the position of the particle at the end of volume const G4Track* track = aFastTrack.GetPrimaryTrack(); G4ThreeVector spin = track->GetPolarization() ; G4FieldTrack aFieldTrack('t'); G4FieldTrackUpdator::Update(&aFieldTrack,track); G4double retSafety= -1.0; ELimited retStepLimited; G4FieldTrack endTrack('a'); G4double currentMinimumStep= 10*m; // TODO change that to sth connected to particle momentum and geometry G4PathFinder* fPathFinder = G4PathFinder::GetInstance(); fPathFinder->ComputeStep( aFieldTrack, currentMinimumStep, 0, track->GetCurrentStepNumber(), retSafety, retStepLimited, endTrack, track->GetVolume() ); aFastStep.ProposePrimaryTrackFinalPosition( endTrack.GetPosition() ); // Smear particle's momentum according to the tracker resolution G4ThreeVector Psm = track->GetMomentum(); m_smearTool->smearMomentum(Psm); G4ThreeVector DeltaP = track->GetMomentum() - Psm; G4double Ekinorg = track->GetKineticEnergy(); aFastStep.ClearDebugFlag(); // to disable Geant checks on energy aFastStep.ProposePrimaryTrackFinalKineticEnergyAndDirection(Ekinorg+DeltaP.mag(), Psm.unit()); // Keep track of smeared momentum if(track->GetParentID()==0) { ParticleInformation* info = dynamic_cast<ParticleInformation*>(track->GetDynamicParticle()->GetPrimaryParticle()->GetUserInformation()); info->setSmeared(true); info->setEndStatus(1); // how it is defined ???? as in HepMC ? info->setEndMomentum(Psm); info->setVertexPosition( track->GetVertexPosition()); } }
void FastSimModelTracker::DoIt(const G4FastTrack& aFastTrack, G4FastStep& aFastStep) { // Calculate the position of the particle at the end of volume const G4Track* track = aFastTrack.GetPrimaryTrack(); G4ThreeVector spin = track->GetPolarization() ; G4FieldTrack theFieldTrack = G4FieldTrack( track->GetPosition(), track->GetMomentumDirection(), 0.0, track->GetKineticEnergy(), track->GetDynamicParticle()->GetDefinition()->GetPDGMass(), 0.0, track->GetGlobalTime(), // Lab. track->GetProperTime(), // Part. &spin) ; G4double retSafety= -1.0; ELimited retStepLimited; G4FieldTrack endTrack('a'); G4double currentMinimumStep= 10*m; // TODO change that to sth connected to particle momentum and geometry G4PathFinder* fPathFinder = G4PathFinder::GetInstance(); fPathFinder->ComputeStep( theFieldTrack, currentMinimumStep, 0, track->GetCurrentStepNumber(), retSafety, retStepLimited, endTrack, track->GetVolume() ); aFastStep.ProposePrimaryTrackFinalPosition( endTrack.GetPosition() ); // Smear particle's momentum according to the tracker resolution (set in SimpleSmear) G4ThreeVector Psm = track->GetMomentum(); m_smearTool->smearMomentum(Psm); G4ThreeVector DeltaP = track->GetMomentum() - Psm; G4double Ekinorg = track->GetKineticEnergy(); aFastStep.ClearDebugFlag(); // to disable Geant checks on energy aFastStep.ProposePrimaryTrackFinalKineticEnergyAndDirection(Ekinorg+DeltaP.mag(), Psm.unit()); }