95 G4int theA, theZ, theS;
102 Config const *
const theConfig;
110 G4int minRemnantSize;
122 outgoingParticles(n->getStore()->getOutgoingParticles()),
124 for(
ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end(); p!=e; ++p) {
125 particleMomenta.push_back((*p)->getMomentum());
126 particleKineticEnergies.push_back((*p)->getKineticEnergy());
129 if(aPR && aPR->getA()>0) {
130 particleMomenta.push_back(aPR->getMomentum());
131 particleKineticEnergies.push_back(aPR->getKineticEnergy());
132 outgoingParticles.push_back(aPR);
135 virtual ~RecoilFunctor() {}
143 scaleParticleEnergies(x);
148 void cleanUp(
const G4bool success)
const {
150 scaleParticleEnergies(1.);
157 ParticleList outgoingParticles;
159 EventInfo
const &theEventInfo;
161 std::list<ThreeVector> particleMomenta;
163 std::list<G4double> particleKineticEnergies;
169 void scaleParticleEnergies(
const G4double rescale)
const {
171 ThreeVector pBalance = nucleus->getIncomingMomentum();
172 std::list<ThreeVector>::const_iterator iP = particleMomenta.begin();
173 std::list<G4double>::const_iterator iE = particleKineticEnergies.begin();
174 for(
ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP, ++iE)
176 const G4double mass = (*i)->getMass();
177 const G4double newKineticEnergy = (*iE) * rescale;
179 (*i)->setMomentum(*iP);
180 (*i)->setEnergy(mass + newKineticEnergy);
181 (*i)->adjustMomentumFromEnergy();
183 pBalance -= (*i)->getMomentum();
186 nucleus->setMomentum(pBalance);
188 const G4double pRem2 = pBalance.mag2();
189 const G4double recoilEnergy = pRem2/
190 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
191 nucleus->setEnergy(remnantMass + recoilEnergy);
196 class RecoilCMFunctor :
public RootFunctor {
202 RecoilCMFunctor(Nucleus *
const n,
const EventInfo &ei) :
205 theIncomingMomentum(nucleus->getIncomingMomentum()),
206 outgoingParticles(
n->getStore()->getOutgoingParticles()),
208 if(theIncomingMomentum.
mag() == 0.){
209 thePTBoostVector = {0., 0., 0.};
213 thePTBoostVector = nucleus->getIncomingMomentum()/(nucleus->getInitialEnergy());
216 for(
ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end(); p!=e; ++p) {
217 (*p)->boost(thePTBoostVector);
218 particleCMMomenta.push_back((*p)->getMomentum());
220 ProjectileRemnant *
const aPR =
n->getProjectileRemnant();
221 if(aPR && aPR->getA()>0) {
222 aPR->boost(thePTBoostVector);
223 particleCMMomenta.push_back(aPR->getMomentum());
224 outgoingParticles.push_back(aPR);
227 virtual ~RecoilCMFunctor() {}
235 scaleParticleCMMomenta(x);
236 return nucleus->getConservationBalance(theEventInfo,
true).energy;
240 void cleanUp(
const G4bool success)
const {
242 scaleParticleCMMomenta(1.);
249 ThreeVector thePTBoostVector;
251 ThreeVector theIncomingMomentum;
253 ParticleList outgoingParticles;
255 EventInfo
const &theEventInfo;
257 std::list<ThreeVector> particleCMMomenta;
263 void scaleParticleCMMomenta(
const G4double rescale)
const {
265 ThreeVector remnantMomentum = theIncomingMomentum;
266 std::list<ThreeVector>::const_iterator iP = particleCMMomenta.begin();
267 for(
ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP)
269 (*i)->setMomentum(*iP * rescale);
270 (*i)->adjustEnergyFromMomentum();
271 (*i)->boost(-thePTBoostVector);
273 remnantMomentum -= (*i)->getMomentum();
276 nucleus->setMomentum(remnantMomentum);
278 const G4double pRem2 = remnantMomentum.mag2();
279 const G4double recoilEnergy = pRem2/
280 (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
281 nucleus->setEnergy(remnantMass + recoilEnergy);
290 void rescaleOutgoingForRecoil();
292#ifndef INCLXX_IN_GEANT4_MODE
302 void globalConservationChecks(
G4bool afterRecoil);
329 G4int makeProjectileRemnant();
338 void makeCompoundNucleus();
341 G4bool preCascade(ParticleSpecies
const &projectileSpecies,
const G4double kineticEnergy);
347 void postCascade(
const ParticleSpecies &projectileSpecies,
const G4double kineticEnergy);
353 void initMaxInteractionDistance(ParticleSpecies
const &p,
const G4double kineticEnergy);
360 void initUniverseRadius(ParticleSpecies
const &p,
const G4double kineticEnergy,
const G4int A,
const G4int Z);
363 void updateGlobalInfo();
366 G4double read_file(std::string filename, std::vector<G4double>& probabilities,
367 std::vector<std::vector<G4String>>& particle_types);
370 G4int findStringNumber(
G4double rdm, std::vector<G4double> yields);
373 void preCascade_pbarH1(ParticleSpecies
const &projectileSpecies,
const G4double kineticEnergy);
376 void preCascade_pbarH2(ParticleSpecies
const &projectileSpecies,
const G4double kineticEnergy);
379 void postCascade_pbarH1(ParticleList
const &outgoingParticles);
382 void postCascade_pbarH2(ParticleList
const &outgoingParticles, ParticleList
const &H2Particles);
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.