Improved sim speed at high energies by stopping muons from wiggling in moderator wires
This commit is contained in:
@ -119,6 +119,20 @@ void musrSteppingAction::UserSteppingAction(const G4Step* aStep) {
|
|||||||
myRootOutput->htest3->Fill(E);
|
myRootOutput->htest3->Fill(E);
|
||||||
aTrack->SetTrackStatus(fStopAndKill);
|
aTrack->SetTrackStatus(fStopAndKill);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// put energy to 0 if muon+ energy is too low in the moderator wires (hack for Geant4 11.1, not sure before it seemed to work without. GJ)
|
||||||
|
if(aTrack->GetDynamicParticle()->GetDefinition()->GetParticleName() == "mu+" && aTrack->GetVolume()->GetLogicalVolume()->GetName().find("Wire") != std::string::npos){
|
||||||
|
|
||||||
|
if(preStepPoint->GetKineticEnergy() < 0.001*CLHEP::electronvolt){
|
||||||
|
|
||||||
|
postStepPoint->SetMomentumDirection(G4ThreeVector(0,0,0));
|
||||||
|
postStepPoint->SetKineticEnergy(0.001*CLHEP::electronvolt); //0 doesn't work. This is the minimum.
|
||||||
|
//aTrack->SetTrackStatus(fStopAndKill); //not optimal, no decay here
|
||||||
|
musrErrorMessage::GetInstance()->musrError(WARNING,
|
||||||
|
"musrSteppingAction: Mu+ has hit Wires in Moderator and wont stop 'wiggling'. Got stopped manually.",true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// abort the event if it takes too long to finish (e.g. more than 60 seconds)
|
// abort the event if it takes too long to finish (e.g. more than 60 seconds)
|
||||||
if ((time(0) - realTimeWhenThisEventStarted)>musrParameters::maximumTimePerEvent) {
|
if ((time(0) - realTimeWhenThisEventStarted)>musrParameters::maximumTimePerEvent) {
|
||||||
|
Reference in New Issue
Block a user