113 {
114
115
116
117
118
119
120
121
122
123 std::vector< std::pair< G4int, G4ThreeVector > >
proton;
124 std::vector< std::pair< G4int, G4ThreeVector > >
neutron;
125 std::vector< std::pair< G4int, G4ThreeVector > > antiproton;
126 std::vector< std::pair< G4int, G4ThreeVector > > antineutron;
127 for ( unsigned int i = 0; i < result->size(); ++i ) {
128 G4int pdgid = result->operator[](i)->GetDefinition()->GetPDGEncoding();
129 if ( pdgid == 2212 ) {
130 proton.push_back( std::make_pair( i, result->operator[](i)->GetMomentum() ) );
131 result->erase( result->begin() + i );
132 }
133 }
134 for ( unsigned int i = 0; i < result->size(); ++i ) {
135 G4int pdgid = result->operator[](i)->GetDefinition()->GetPDGEncoding();
136 if ( pdgid == 2112 ) {
137 neutron.push_back( std::make_pair( i, result->operator[](i)->GetMomentum() ) );
138 result->erase( result->begin() + i );
139 }
140 }
141 for ( unsigned int i = 0; i < result->size(); ++i ) {
142 G4int pdgid = result->operator[](i)->GetDefinition()->GetPDGEncoding();
143 if ( pdgid == -2212 ) {
144 antiproton.push_back( std::make_pair( i, result->operator[](i)->GetMomentum() ) );
145 result->erase( result->begin() + i );
146 }
147 }
148 for ( unsigned int i = 0; i < result->size(); ++i ) {
149 G4int pdgid = result->operator[](i)->GetDefinition()->GetPDGEncoding();
150 if ( pdgid == -2112 ) {
151 antineutron.push_back( std::make_pair( i, result->operator[](i)->GetMomentum() ) );
152 result->erase( result->begin() + i );
153 }
154 }
155
156 for (
unsigned int i = 0; i <
proton.size(); ++i ) {
157 if (
proton.at(i).first == -1 )
continue;
161 if ( partner1 == -1 ) {
166 G4double totalEnergy = std::sqrt( p1.
mag()*p1.
mag() + massp*massp );
170 result->push_back( finalp );
171 continue;
172 }
174 PushDeuteron( p1, p2, 1, result );
175 neutron.at(partner1).first = -1;
176 }
177
178 for (
unsigned int i = 0; i <
neutron.size(); ++i ) {
179 if (
neutron.at(i).first == -1 )
continue;
185 G4double totalEnergy = std::sqrt( p2.
mag()*p2.
mag() + massn*massn );
189 result->push_back( finaln );
190 }
191
192 for ( unsigned int i = 0; i < antiproton.size(); ++i ) {
193 if ( antiproton.at(i).first == -1 ) continue;
195 int partner1 = FindPartner( p1,
G4Proton::Proton()->GetPDGMass(), antineutron,
197 if ( partner1 == -1 ) {
202 G4double totalEnergy = std::sqrt( p1.
mag()*p1.
mag() + massp*massp );
206 result->push_back( finalpbar );
207 continue;
208 }
210 PushDeuteron( p1, p2, -1, result );
211 antineutron.at(partner1).first = -1;
212 }
213
214 for ( unsigned int i = 0; i < antineutron.size(); ++i ) {
215 if ( antineutron.at(i).first == -1 ) continue;
221 G4double totalEnergy = std::sqrt( p2.
mag()*p2.
mag() + massn*massn );
225 result->push_back( finalnbar );
226 }
227}
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)