Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4RPGPionSuppression.cc
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27
28#include <iostream>
29#include <signal.h>
30
32#include "G4SystemOfUnits.hh"
33#include "Randomize.hh"
35
37 : G4RPGReaction() {}
38
39
41ReactionStage(const G4HadProjectile* /*originalIncident*/,
42 G4ReactionProduct& modifiedOriginal,
43 G4bool& incidentHasChanged,
44 const G4DynamicParticle* /*originalTarget*/,
45 G4ReactionProduct& targetParticle,
46 G4bool& targetHasChanged,
47 const G4Nucleus& targetNucleus,
48 G4ReactionProduct& currentParticle,
50 G4int& vecLen,
51 G4bool /*leadFlag*/,
52 G4ReactionProduct& /*leadingStrangeParticle*/)
53{
54 // This code was originally in the fortran code TWOCLU
55 //
56 // Suppress charged pions, for various reasons
57 //
58 G4double mOriginal = modifiedOriginal.GetMass()/GeV;
59 G4double etOriginal = modifiedOriginal.GetTotalEnergy()/GeV;
60 G4double targetMass = targetParticle.GetDefinition()->GetPDGMass()/GeV;
61 G4double cmEnergy = std::sqrt( mOriginal*mOriginal + targetMass*targetMass +
62 2.0*targetMass*etOriginal );
63 G4double eAvailable = cmEnergy - mOriginal - targetMass;
64 for (G4int i = 0; i < vecLen; i++) eAvailable -= vec[i]->GetMass()/GeV;
65
66 const G4double atomicWeight = targetNucleus.GetA_asInt();
67 const G4double atomicNumber = targetNucleus.GetZ_asInt();
68 const G4double pOriginal = modifiedOriginal.GetTotalMomentum()/GeV;
69
75 G4double piMass = aPiPlus->GetPDGMass()/GeV;
76 G4double nucleonMass = aNeutron->GetPDGMass()/GeV;
77
78 const G4bool antiTest =
79 modifiedOriginal.GetDefinition() != G4AntiProton::AntiProton() &&
80 modifiedOriginal.GetDefinition() != G4AntiNeutron::AntiNeutron() &&
81 modifiedOriginal.GetDefinition() != G4AntiLambda::AntiLambda() &&
82 modifiedOriginal.GetDefinition() != G4AntiSigmaPlus::AntiSigmaPlus() &&
83 modifiedOriginal.GetDefinition() != G4AntiSigmaMinus::AntiSigmaMinus() &&
84 modifiedOriginal.GetDefinition() != G4AntiXiZero::AntiXiZero() &&
85 modifiedOriginal.GetDefinition() != G4AntiXiMinus::AntiXiMinus() &&
86 modifiedOriginal.GetDefinition() != G4AntiOmegaMinus::AntiOmegaMinus();
87
88 if( antiTest && (
89 currentParticle.GetDefinition() == aPiPlus ||
90 currentParticle.GetDefinition() == aPiZero ||
91 currentParticle.GetDefinition() == aPiMinus ) &&
92 ( G4UniformRand() <= (10.0-pOriginal)/6.0 ) &&
93 ( G4UniformRand() <= atomicWeight/300.0 ) )
94 {
95 if (eAvailable > nucleonMass - piMass) {
96 if( G4UniformRand() > atomicNumber/atomicWeight )
97 currentParticle.SetDefinitionAndUpdateE( aNeutron );
98 else
99 currentParticle.SetDefinitionAndUpdateE( aProton );
100 incidentHasChanged = true;
101 }
102 }
103
104 if( antiTest && (
105 targetParticle.GetDefinition() == aPiPlus ||
106 targetParticle.GetDefinition() == aPiZero ||
107 targetParticle.GetDefinition() == aPiMinus ) &&
108 ( G4UniformRand() <= (10.0-pOriginal)/6.0 ) &&
109 ( G4UniformRand() <= atomicWeight/300.0 ) )
110 {
111 if (eAvailable > nucleonMass - piMass) {
112 if( G4UniformRand() > atomicNumber/atomicWeight )
113 targetParticle.SetDefinitionAndUpdateE( aNeutron );
114 else
115 targetParticle.SetDefinitionAndUpdateE( aProton );
116 targetHasChanged = true;
117 }
118 }
119
120 for( G4int i=0; i<vecLen; ++i )
121 {
122 if( antiTest && (
123 vec[i]->GetDefinition() == aPiPlus ||
124 vec[i]->GetDefinition() == aPiZero ||
125 vec[i]->GetDefinition() == aPiMinus ) &&
126 ( G4UniformRand() <= (10.0-pOriginal)/6.0 ) &&
127 ( G4UniformRand() <= atomicWeight/300.0 ) )
128 {
129 if (eAvailable > nucleonMass - piMass) {
130 if( G4UniformRand() > atomicNumber/atomicWeight )
131 vec[i]->SetDefinitionAndUpdateE( aNeutron );
132 else
133 vec[i]->SetDefinitionAndUpdateE( aProton );
134 }
135 }
136 }
137
138 return true;
139}
140
141
142 /* end of file */
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4UniformRand()
Definition: Randomize.hh:52
static G4AntiLambda * AntiLambda()
static G4AntiNeutron * AntiNeutron()
static G4AntiOmegaMinus * AntiOmegaMinus()
static G4AntiProton * AntiProton()
Definition: G4AntiProton.cc:92
static G4AntiSigmaMinus * AntiSigmaMinus()
static G4AntiSigmaPlus * AntiSigmaPlus()
static G4AntiXiMinus * AntiXiMinus()
static G4AntiXiZero * AntiXiZero()
static G4Neutron * Neutron()
Definition: G4Neutron.cc:103
G4int GetA_asInt() const
Definition: G4Nucleus.hh:109
G4int GetZ_asInt() const
Definition: G4Nucleus.hh:115
static G4PionMinus * PionMinus()
Definition: G4PionMinus.cc:97
static G4PionPlus * PionPlus()
Definition: G4PionPlus.cc:97
static G4PionZero * PionZero()
Definition: G4PionZero.cc:107
static G4Proton * Proton()
Definition: G4Proton.cc:92
G4bool ReactionStage(const G4HadProjectile *, G4ReactionProduct &, G4bool &, const G4DynamicParticle *, G4ReactionProduct &, G4bool &, const G4Nucleus &, G4ReactionProduct &, G4FastVector< G4ReactionProduct, 256 > &, G4int &, G4bool, G4ReactionProduct &)
G4double GetTotalMomentum() const
const G4ParticleDefinition * GetDefinition() const
G4double GetTotalEnergy() const
void SetDefinitionAndUpdateE(const G4ParticleDefinition *aParticleDefinition)
G4double GetMass() const