110 {
111
112
113
114
115
116
117
118
119
120 std::vector< std::pair< G4int, G4ThreeVector > >
proton;
121 std::vector< std::pair< G4int, G4ThreeVector > >
neutron;
122 std::vector< std::pair< G4int, G4ThreeVector > > antiproton;
123 std::vector< std::pair< G4int, G4ThreeVector > > antineutron;
124 for ( unsigned int i = 0; i < result->size(); ++i ) {
125 G4int pdgid = result->operator[](i)->GetDefinition()->GetPDGEncoding();
126 if ( pdgid == 2212 ) {
127 proton.push_back( std::make_pair( i, result->operator[](i)->GetMomentum() ) );
128 result->erase( result->begin() + i );
129 }
130 }
131 for ( unsigned int i = 0; i < result->size(); ++i ) {
132 G4int pdgid = result->operator[](i)->GetDefinition()->GetPDGEncoding();
133 if ( pdgid == 2112 ) {
134 neutron.push_back( std::make_pair( i, result->operator[](i)->GetMomentum() ) );
135 result->erase( result->begin() + i );
136 }
137 }
138 for ( unsigned int i = 0; i < result->size(); ++i ) {
139 G4int pdgid = result->operator[](i)->GetDefinition()->GetPDGEncoding();
140 if ( pdgid == -2212 ) {
141 antiproton.push_back( std::make_pair( i, result->operator[](i)->GetMomentum() ) );
142 result->erase( result->begin() + i );
143 }
144 }
145 for ( unsigned int i = 0; i < result->size(); ++i ) {
146 G4int pdgid = result->operator[](i)->GetDefinition()->GetPDGEncoding();
147 if ( pdgid == -2112 ) {
148 antineutron.push_back( std::make_pair( i, result->operator[](i)->GetMomentum() ) );
149 result->erase( result->begin() + i );
150 }
151 }
152
153 for (
unsigned int i = 0; i <
proton.size(); ++i ) {
154 if (
proton.at(i).first == -1 )
continue;
158 if ( partner1 == -1 ) {
163 G4double totalEnergy = std::sqrt( p1.
mag()*p1.
mag() + massp*massp );
167 result->push_back( finalp );
168 continue;
169 }
171 PushDeuteron( p1, p2, 1, result );
172 neutron.at(partner1).first = -1;
173 }
174
175 for (
unsigned int i = 0; i <
neutron.size(); ++i ) {
176 if (
neutron.at(i).first == -1 )
continue;
182 G4double totalEnergy = std::sqrt( p2.
mag()*p2.
mag() + massn*massn );
186 result->push_back( finaln );
187 }
188
189 for ( unsigned int i = 0; i < antiproton.size(); ++i ) {
190 if ( antiproton.at(i).first == -1 ) continue;
192 int partner1 = FindPartner( p1,
G4Proton::Proton()->GetPDGMass(), antineutron,
194 if ( partner1 == -1 ) {
199 G4double totalEnergy = std::sqrt( p1.
mag()*p1.
mag() + massp*massp );
203 result->push_back( finalpbar );
204 continue;
205 }
207 PushDeuteron( p1, p2, -1, result );
208 antineutron.at(partner1).first = -1;
209 }
210
211 for ( unsigned int i = 0; i < antineutron.size(); ++i ) {
212 if ( antineutron.at(i).first == -1 ) continue;
218 G4double totalEnergy = std::sqrt( p2.
mag()*p2.
mag() + massn*massn );
222 result->push_back( finalnbar );
223 }
224}
static G4Neutron * Neutron()
G4double GetPDGMass() const
G4ParticleDefinition * FindParticle(G4int PDGEncoding)
static G4ParticleTable * GetParticleTable()
G4ParticleDefinition * FindAntiParticle(G4int PDGEncoding)
static G4Proton * Proton()
void SetMomentum(const G4double x, const G4double y, const G4double z)
void SetTotalEnergy(const G4double en)
void SetDefinition(const G4ParticleDefinition *aParticleDefinition)
void SetMass(const G4double mas)