Skip to content
Snippets Groups Projects
Commit cd504e86 authored by Adrien Matta's avatar Adrien Matta :skull_crossbones:
Browse files

* Fixing issue with elastic scattering

        - The elastic process could trigger to daughters particle in
        certain cases
        - This lead to an infinite chain of particle generation stopping
        the programm
        - Beam reaction now test the parent particle have trackID 0
parent e6d17957
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment