diff --git a/NPSimulation/Process/BeamReaction.cc b/NPSimulation/Process/BeamReaction.cc index 07f42fcf5a43f69cea71093467eedfa6b5a1896a..3ace565b8b17d90d997573c35b3e04c19a6d6c44 100644 --- a/NPSimulation/Process/BeamReaction.cc +++ b/NPSimulation/Process/BeamReaction.cc @@ -123,6 +123,11 @@ G4bool NPS::BeamReaction::ModelTrigger(const G4FastTrack& fastTrack) { double out = solid->DistanceToOut(P, -V); double ratio = in / (out + in); + m_Parent_ID = PrimaryTrack->GetParentID(); + // process reserved to the beam + if(m_Parent_ID!=0) + return false; + //cout<< "in:"<<in<<std::scientific<<endl; //cout<< "ou:"<<out<<std::scientific<<endl; //cout<< "ratio:"<<ratio<<std::scientific<<endl; @@ -137,7 +142,7 @@ G4bool NPS::BeamReaction::ModelTrigger(const G4FastTrack& fastTrack) { m_ReactionConditions->Clear(); shoot = true; } - else if ((in-m_StepSize) <= 1E-9) { // last step + else if (((in-m_StepSize) <= 1E-9) && shoot) { // last step //cout<< "LAST"<<endl; return true; } @@ -157,7 +162,9 @@ G4bool NPS::BeamReaction::ModelTrigger(const G4FastTrack& fastTrack) { } else { return false; } - }else if(m_ReactionType=="TwoBodyReaction"){ + } + + else if(m_ReactionType=="TwoBodyReaction"){ if ( shoot && m_Reaction.IsAllowed(PrimaryTrack->GetKineticEnergy()) ) { shoot = false; return true; diff --git a/NPSimulation/Process/BeamReaction.hh b/NPSimulation/Process/BeamReaction.hh index b77c424d8885112d5152c7b1f2bf32b37999e16d..f5c9a41d28ea2248c90d17cb8aee2cadff4c0fb7 100644 --- a/NPSimulation/Process/BeamReaction.hh +++ b/NPSimulation/Process/BeamReaction.hh @@ -52,6 +52,7 @@ namespace NPS{ double m_PreviousLength; bool m_active;// is the process active double m_StepSize; + int m_Parent_ID; private: TReactionConditions* m_ReactionConditions;