Geant4-11
G4INCLProjectileRemnant.hh
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// INCL++ intra-nuclear cascade model
27// Alain Boudard, CEA-Saclay, France
28// Joseph Cugnon, University of Liege, Belgium
29// Jean-Christophe David, CEA-Saclay, France
30// Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31// Sylvie Leray, CEA-Saclay, France
32// Davide Mancusi, CEA-Saclay, France
33//
34#define INCLXX_IN_GEANT4_MODE 1
35
36#include "globals.hh"
37
45#ifndef G4INCLPROJECTILEREMNANT_HH_
46#define G4INCLPROJECTILEREMNANT_HH_
47
48#include "G4INCLCluster.hh"
49#include "G4INCLRandom.hh"
51#include <vector>
52#include <map>
53#include <numeric>
54#include <functional>
55
56namespace G4INCL {
57
58 class ProjectileRemnant : public Cluster {
59 public:
60
61 // typedefs for the calculation of the projectile excitation energy
62 typedef std::vector<G4double> EnergyLevels;
63 typedef std::map<long, G4double> EnergyLevelMap;
64
65 ProjectileRemnant(ParticleSpecies const &species, const G4double kineticEnergy)
66 : Cluster(species.theZ, species.theA, species.theS) {
67
68 // Use the table mass
70
71 // Set the kinematics
72 const G4double projectileMass = getMass();
73 const G4double energy = kineticEnergy + projectileMass;
74 const G4double momentumZ = std::sqrt(energy*energy - projectileMass*projectileMass);
75
76 // Initialise the particles
80
81 // Store the energy levels of the ProjectileRemnant (used to compute its
82 // excitation energy)
84
85 // Boost the whole thing
86 const ThreeVector aBoostVector = ThreeVector(0.0, 0.0, momentumZ / energy);
87 boost(-aBoostVector);
88
89 // Freeze the internal motion of the particles
91
92 // Set as projectile spectator
94 }
95
98 // The ProjectileRemnant owns its particles
101 }
102
104 void reset();
105
111 void removeParticle(Particle * const p, const G4double theProjectileCorrection);
112
122
133
139
142 for(std::map<long,Particle*>::const_iterator p=storedComponents.begin(), e=storedComponents.end(); p!=e; ++p)
143 delete p->second;
145 }
146
149 storedComponents.clear();
150 }
151
156 }
157
167 G4double computeExcitationEnergyExcept(const long exceptID) const;
168
174
177 for(ParticleIter p=particles.begin(), e=particles.end(); p!=e; ++p) {
178 // Store the particles (needed for forced CN)
179 storedComponents[(*p)->getID()]=new Particle(**p);
180 }
181 }
182
185 return storedComponents.size();
186 }
187
190 EnergyLevels energies;
191
192 for(ParticleIter p=particles.begin(), e=particles.end(); p!=e; ++p) {
193 const G4double theCMEnergy = (*p)->getEnergy();
194 // Store the CM energy in the EnergyLevels map
195 theInitialEnergyLevels[(*p)->getID()] = theCMEnergy;
196 energies.push_back(theCMEnergy);
197 }
198
199 std::sort(energies.begin(), energies.end());
200// assert(energies.size()==(unsigned int)theA);
201 theGroundStateEnergies.resize(energies.size());
202 // Compute the partial sums of the CM energies -- they are our reference
203 // ground-state energies for any number of nucleons
204 std::partial_sum(energies.begin(), energies.end(), theGroundStateEnergies.begin());
205 }
206
209 }
210
211 private:
212
221 G4double computeExcitationEnergy(const EnergyLevels &levels) const;
222
223 EnergyLevels getPresentEnergyLevelsExcept(const long exceptID) const;
224
226
230 std::shuffle(pL.begin(), pL.end(), Random::getAdapter());
231 return pL;
232 }
233
235 ParticleList pL;
236 for(std::map<long,Particle*>::const_iterator p=storedComponents.begin(), e=storedComponents.end(); p!=e; ++p)
237 pL.push_back(p->second);
238 return pL;
239 }
240
242 ThreeVector const &getStoredMomentum(Particle const * const p) const {
243 std::map<long,Particle*>::const_iterator i = storedComponents.find(p->getID());
244 if(i==storedComponents.end()) {
245 INCL_ERROR("Couldn't find particle " << p->getID() << " in the list of projectile components" << '\n');
246 return p->getMomentum();
247 } else {
248 return i->second->getMomentum();
249 }
250 }
251
259
261 /* G4double getStoredEnergy(Particle const * const p) {
262 std::map<long,Particle*>::const_iterator i = initialProjectileComponents.find(p->getID());
263 if(i==initialProjectileComponents.end()) {
264 INCL_ERROR("Couldn't find particle " << p->getID() << " in the list of projectile components" << '\n');
265 return 0.;
266 } else {
267 return i->second->getEnergy();
268 }
269 }*/
270
275 std::map<long, Particle*> storedComponents;
276
279
282
284 };
285}
286
287#endif // G4INCLPROJECTILEREMNANT_HH_
288
Singleton for recycling allocation of instances of a given class.
#define INCL_DECLARE_ALLOCATION_POOL(T)
#define INCL_ERROR(x)
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
void boost(const ThreeVector &aBoostVector)
Boost the cluster with the indicated velocity.
void internalBoostToCM()
Boost to the CM of the component particles.
ParticleList particles
virtual void makeProjectileSpectator()
Make all the components projectile spectators, too.
virtual void initializeParticles()
Initialise the NuclearDensity pointer and sample the particles.
void freezeInternalMotion()
Freeze the internal motion of the particles.
void putParticlesOffShell()
Put the cluster components off shell.
const G4INCL::ThreeVector & getMomentum() const
G4double getMass() const
Get the cached particle mass.
void setTableMass()
Set the mass of the Particle to its table mass.
long getID() const
EnergyLevelMap theInitialEnergyLevels
Initial energy levels of the projectile.
ParticleList shuffleStoredComponents()
Shuffle the list of stored projectile components.
ParticleList getStoredComponents() const
void removeParticle(Particle *const p, const G4double theProjectileCorrection)
Remove a nucleon from the projectile remnant.
std::vector< G4double > EnergyLevels
ProjectileRemnant(ParticleSpecies const &species, const G4double kineticEnergy)
void clearStoredComponents()
Clear the stored projectile components.
G4double computeExcitationEnergyWith(const ParticleList &pL) const
Compute the excitation energy if some nucleons are put back.
G4int getNumberStoredComponents() const
Get the number of the stored components.
G4bool addDynamicalSpectator(Particle *const p)
Add back a nucleon to the projectile remnant.
ParticleList addMostDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
ThreeVector const & getStoredMomentum(Particle const *const p) const
Return the stored momentum of a given projectile component.
void storeComponents()
Store the projectile components.
G4double computeExcitationEnergy(const EnergyLevels &levels) const
Compute the excitation energy for a given configuration.
EnergyLevels getPresentEnergyLevelsExcept(const long exceptID) const
ParticleList addAllDynamicalSpectators(ParticleList const &pL)
Add back all dynamical spectators to the projectile remnant.
std::map< long, Particle * > storedComponents
Return the stored energy of a given projectile component.
void clearEnergyLevels()
Clear the stored energy levels.
ParticleList addDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
EnergyLevels getPresentEnergyLevelsWith(const ParticleList &pL) const
std::map< long, G4double > EnergyLevelMap
void deleteStoredComponents()
Clear the stored projectile components and delete the particles.
G4double computeExcitationEnergyExcept(const long exceptID) const
Compute the excitation energy when a nucleon is removed.
EnergyLevels theGroundStateEnergies
Ground-state energies for any number of nucleons.
EnergyLevels const & getGroundStateEnergies() const
void reset()
Reset the projectile remnant to the state at the beginning of the cascade.
void storeEnergyLevels()
Store the energy levels.
G4double energy(const ThreeVector &p, const G4double m)
Adapter const & getAdapter()
ParticleList::const_iterator ParticleIter