Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
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// Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
28// Davide Mancusi, CEA
29// Alain Boudard, CEA
30// Sylvie Leray, CEA
31// Joseph Cugnon, University of Liege
32//
33// INCL++ revision: v5.1.8
34//
35#define INCLXX_IN_GEANT4_MODE 1
36
37#include "globals.hh"
38
39/** \file G4INCLProjectileRemnant.hh
40 * \brief Class for constructing a projectile-like remnant.
41 *
42 * \date 20 March 2012
43 * \author Davide Mancusi
44 */
45
46#ifndef G4INCLPROJECTILEREMNANT_HH_
47#define G4INCLPROJECTILEREMNANT_HH_
48
49#include "G4INCLCluster.hh"
50#include "G4INCLRandom.hh"
51#include <vector>
52#include <map>
53#include <numeric>
54#include <functional>
55
56namespace G4INCL {
57
58 /// \brief Helper function for ProjectileRemnant::shuffleStoredComponents
60
61 class ProjectileRemnant : public Cluster {
62 // typedefs for the calculation of the projectile excitation energy
63 typedef std::vector<G4double> EnergyLevels;
64 typedef std::map<long, G4double> EnergyLevelMap;
65
66 public:
67 ProjectileRemnant(ParticleSpecies const species, const G4double kineticEnergy)
68 : Cluster(species.theZ, species.theA) {
69
70 // Use the table mass
72
73 // Set the kinematics
74 const G4double projectileMass = getMass();
75 const G4double energy = kineticEnergy + projectileMass;
76 const G4double momentumZ = std::sqrt(energy*energy - projectileMass*projectileMass);
77
78 // Initialise the particles
82
83 // Store the energy levels of the ProjectileRemnant (used to compute its
84 // excitation energy)
86
87 // Boost the whole thing
88 const ThreeVector aBoostVector = ThreeVector(0.0, 0.0, momentumZ / energy);
89 boost(-aBoostVector);
90
91 // Freeze the internal motion of the particles
93
94 // Set as projectile spectator
96 }
97
101 }
102
103 /// \brief Reset the projectile remnant to the state at the beginning of the cascade
104 void reset();
105
106 /** \brief Remove a nucleon from the projectile remnant
107 *
108 * \param p particle to be removed
109 * \param theProjectileCorrection correction to be given to the projectile total energy
110 */
111 void removeParticle(Particle * const p, const G4double theProjectileCorrection);
112
113 /** \brief Add back dynamical spectators to the projectile remnant
114 *
115 * Try to add the dynamical spectators back to the projectile remnant.
116 * Refuse to do so if this leads to a negative projectile excitation
117 * energy.
118 *
119 * Return a list of rejected dynamical spectators.
120 */
122
123 /** \brief Add back dynamical spectators to the projectile remnant
124 *
125 * Try as hard as possible to add back all the dynamical spectators. Don't
126 * add spectators that lead to negative excitation energies. Start by
127 * adding all of them, and repeatedly remove the most troublesome one until
128 * the excitation energy becomes non-negative.
129 *
130 * Return a list of rejected dynamical spectators.
131 */
133
134 /// \brief Clear the stored projectile components and delete the particles
136 for(std::map<long,Particle*>::const_iterator p=storedComponents.begin(); p!=storedComponents.end(); ++p)
137 delete p->second;
139 }
140
141 /// \brief Clear the stored projectile components
143 storedComponents.clear();
144 }
145
146 /// \brief Clear the stored energy levels
148 theInitialEnergyLevels.clear();
149 theGroundStateEnergies.clear();
150 }
151
152 /** \brief Compute the excitation energy
153 *
154 * Compute the excitation energy of the projectile-like remnant as the
155 * difference between the initial and the present configuration. This
156 * follows the algorithm proposed by A. Boudard in INCL4.2-HI, as
157 * implemented in Geant4.
158 *
159 * \return the excitation energy
160 */
161 G4double computeExcitationEnergy(const long exceptID) const;
162
163 EnergyLevels getPresentEnergyLevels(const long exceptID) const {
164 EnergyLevels theEnergyLevels;
165 for(ParticleIter p=particles.begin(); p!=particles.end(); ++p) {
166 if((*p)->getID()!=exceptID) {
167 EnergyLevelMap::const_iterator i = theInitialEnergyLevels.find((*p)->getID());
168// assert(i!=theInitialEnergyLevels.end());
169 theEnergyLevels.push_back(i->second);
170 }
171 }
172// assert(theEnergyLevels.size()==particles.size()-1);
173 return theEnergyLevels;
174 }
175
176 /// \brief Store the projectile components
178 for(ParticleIter p=particles.begin(); p!=particles.end(); ++p) {
179 // Store the particles (needed for forced CN)
180 storedComponents[(*p)->getID()]=new Particle(**p);
181 }
182 }
183
184 /// \brief Get the number of the stored components
186 return storedComponents.size();
187 }
188
189 /// \brief Store the energy levels
191 EnergyLevels energies;
192
193 for(ParticleIter p=particles.begin(); p!=particles.end(); ++p) {
194 const G4double theCMEnergy = (*p)->getEnergy();
195 // Store the CM energy in the EnergyLevels map
196 theInitialEnergyLevels[(*p)->getID()] = theCMEnergy;
197 energies.push_back(theCMEnergy);
198 }
199
200 std::sort(energies.begin(), energies.end());
201// assert(energies.size()==(unsigned int)theA);
202 theGroundStateEnergies.resize(energies.size());
203 // Compute the partial sums of the CM energies -- they are our reference
204 // ground-state energies for any number of nucleons
205 std::partial_sum(energies.begin(), energies.end(), theGroundStateEnergies.begin());
206 }
207
208 private:
209
210 /// \brief Shuffle the list of stored projectile components
211 ParticleList shuffleStoredComponents() {
212 ParticleList pL = getStoredComponents();
213 std::vector<Particle *> theVector(pL.begin(),pL.end());
214 std::random_shuffle(theVector.begin(), theVector.end(), shuffleComponentsHelper);
215 return ParticleList(theVector.begin(),theVector.end());
216 }
217
218 ParticleList getStoredComponents() const {
219 ParticleList pL;
220 for(std::map<long,Particle*>::const_iterator p=storedComponents.begin(); p!=storedComponents.end(); ++p)
221 pL.push_back(p->second);
222 return pL;
223 }
224
225 /// \brief Return the stored momentum of a given projectile component
226 ThreeVector const &getStoredMomentum(Particle const * const p) const {
227 std::map<long,Particle*>::const_iterator i = storedComponents.find(p->getID());
228 if(i==storedComponents.end()) {
229 ERROR("Couldn't find particle " << p->getID() << " in the list of projectile components" << std::endl);
230 return p->getMomentum();
231 } else {
232 return i->second->getMomentum();
233 }
234 }
235
236 /** \brief Add back a nucleon to the projectile remnant
237 *
238 * Try to add a dynamical spectator back to the projectile remnant. Refuse
239 * to do so if this leads to a negative projectile excitation energy.
240 * Return true on success, false on failure.
241 */
242 G4bool addDynamicalSpectator(Particle * const p);
243
244 /// \brief Return the stored energy of a given projectile component
245 /* G4double getStoredEnergy(Particle const * const p) {
246 std::map<long,Particle*>::const_iterator i = initialProjectileComponents.find(p->getID());
247 if(i==initialProjectileComponents.end()) {
248 ERROR("Couldn't find particle " << p->getID() << " in the list of projectile components" << std::endl);
249 return 0.;
250 } else {
251 return i->second->getEnergy();
252 }
253 }*/
254
255 /// \brief Stored projectile components
256 std::map<long, Particle*> storedComponents;
257
258 /// \brief Initial energy levels of the projectile
259 EnergyLevelMap theInitialEnergyLevels;
260
261 /// \brief Ground-state energies for any number of nucleons
262 EnergyLevels theGroundStateEnergies;
263
264 };
265}
266
267#endif // G4INCLPROJECTILEREMNANT_HH_
268
#define ERROR(x)
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
bool G4bool
Definition: G4Types.hh:67
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.
G4double getMass() const
Get the cached particle mass.
void setTableMass()
Set the mass of the Particle to its table mass.
G4double computeExcitationEnergy(const long exceptID) const
Compute the excitation energy.
void removeParticle(Particle *const p, const G4double theProjectileCorrection)
Remove a nucleon from the projectile remnant.
void clearStoredComponents()
Clear the stored projectile components.
G4int getNumberStoredComponents() const
Get the number of the stored components.
ParticleList addMostDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
void storeComponents()
Store the projectile components.
void clearEnergyLevels()
Clear the stored energy levels.
ParticleList addDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
ProjectileRemnant(ParticleSpecies const species, const G4double kineticEnergy)
void deleteStoredComponents()
Clear the stored projectile components and delete the particles.
EnergyLevels getPresentEnergyLevels(const long exceptID) const
void reset()
Reset the projectile remnant to the state at the beginning of the cascade.
void storeEnergyLevels()
Store the energy levels.
std::list< G4INCL::Particle * > ParticleList
G4int shuffleComponentsHelper(G4int range)
Helper function for ProjectileRemnant::shuffleStoredComponents.
std::list< G4INCL::Particle * >::const_iterator ParticleIter