Geant4_10
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 #define INCLXX_IN_GEANT4_MODE 1
34 
35 #include "globals.hh"
36 
44 #ifndef G4INCLPROJECTILEREMNANT_HH_
45 #define G4INCLPROJECTILEREMNANT_HH_
46 
47 #include "G4INCLCluster.hh"
48 #include "G4INCLRandom.hh"
49 #include <vector>
50 #include <map>
51 #include <numeric>
52 #include <functional>
53 
54 namespace G4INCL {
55 
58 
59  class ProjectileRemnant : public Cluster {
60  public:
61 
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  ProjectileRemnant(ParticleSpecies const species, const G4double kineticEnergy)
67  : Cluster(species.theZ, species.theA) {
68 
69  // Use the table mass
70  setTableMass();
71 
72  // Set the kinematics
73  const G4double projectileMass = getMass();
74  const G4double energy = kineticEnergy + projectileMass;
75  const G4double momentumZ = std::sqrt(energy*energy - projectileMass*projectileMass);
76 
77  // Initialise the particles
81 
82  // Store the energy levels of the ProjectileRemnant (used to compute its
83  // excitation energy)
85 
86  // Boost the whole thing
87  const ThreeVector aBoostVector = ThreeVector(0.0, 0.0, momentumZ / energy);
88  boost(-aBoostVector);
89 
90  // Freeze the internal motion of the particles
92 
93  // Set as projectile spectator
95  }
96 
99  // The ProjectileRemnant owns its particles
100  deleteParticles();
102  }
103 
105  void reset();
106 
112  void removeParticle(Particle * const p, const G4double theProjectileCorrection);
113 
123 
134 
140 
143  for(std::map<long,Particle*>::const_iterator p=storedComponents.begin(), e=storedComponents.end(); p!=e; ++p)
144  delete p->second;
146  }
147 
150  storedComponents.clear();
151  }
152 
155  theInitialEnergyLevels.clear();
156  theGroundStateEnergies.clear();
157  }
158 
168  G4double computeExcitationEnergyExcept(const long exceptID) const;
169 
175 
178  for(ParticleIter p=particles.begin(), e=particles.end(); p!=e; ++p) {
179  // Store the particles (needed for forced CN)
180  storedComponents[(*p)->getID()]=new Particle(**p);
181  }
182  }
183 
186  return storedComponents.size();
187  }
188 
191  EnergyLevels energies;
192 
193  for(ParticleIter p=particles.begin(), e=particles.end(); p!=e; ++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 
209  return theGroundStateEnergies;
210  }
211 
212  private:
213 
222  G4double computeExcitationEnergy(const EnergyLevels &levels) const;
223 
224  EnergyLevels getPresentEnergyLevelsExcept(const long exceptID) const;
225 
226  EnergyLevels getPresentEnergyLevelsWith(const ParticleList &pL) const;
227 
229  ParticleList shuffleStoredComponents() {
230  ParticleList pL = getStoredComponents();
231  std::random_shuffle(pL.begin(), pL.end(), shuffleComponentsHelper);
232  return pL;
233  }
234 
235  ParticleList getStoredComponents() const {
236  ParticleList pL;
237  for(std::map<long,Particle*>::const_iterator p=storedComponents.begin(), e=storedComponents.end(); p!=e; ++p)
238  pL.push_back(p->second);
239  return pL;
240  }
241 
243  ThreeVector const &getStoredMomentum(Particle const * const p) const {
244  std::map<long,Particle*>::const_iterator i = storedComponents.find(p->getID());
245  if(i==storedComponents.end()) {
246  INCL_ERROR("Couldn't find particle " << p->getID() << " in the list of projectile components" << std::endl);
247  return p->getMomentum();
248  } else {
249  return i->second->getMomentum();
250  }
251  }
252 
259  G4bool addDynamicalSpectator(Particle * const p);
260 
262  /* G4double getStoredEnergy(Particle const * const p) {
263  std::map<long,Particle*>::const_iterator i = initialProjectileComponents.find(p->getID());
264  if(i==initialProjectileComponents.end()) {
265  INCL_ERROR("Couldn't find particle " << p->getID() << " in the list of projectile components" << std::endl);
266  return 0.;
267  } else {
268  return i->second->getEnergy();
269  }
270  }*/
271 
276  std::map<long, Particle*> storedComponents;
277 
279  EnergyLevelMap theInitialEnergyLevels;
280 
282  EnergyLevels theGroundStateEnergies;
283 
284  };
285 }
286 
287 #endif // G4INCLPROJECTILEREMNANT_HH_
288 
G4int shuffleComponentsHelper(G4int range)
Helper function for ProjectileRemnant::shuffleStoredComponents.
G4double getMass() const
Get the cached particle mass.
void storeEnergyLevels()
Store the energy levels.
void putParticlesOffShell()
Put the cluster components off shell.
ParticleList addAllDynamicalSpectators(ParticleList pL)
Add back all dynamical spectators to the projectile remnant.
void deleteStoredComponents()
Clear the stored projectile components and delete the particles.
const char * p
Definition: xmltok.h:285
std::map< long, G4double > EnergyLevelMap
#define INCL_ERROR(x)
void storeComponents()
Store the projectile components.
void clearStoredComponents()
Clear the stored projectile components.
void boost(const ThreeVector &aBoostVector)
Boost the cluster with the indicated velocity.
subroutine sort(A, N)
Definition: dpm25nuc7.f:4670
void reset()
Reset the projectile remnant to the state at the beginning of the cascade.
int G4int
Definition: G4Types.hh:78
G4double computeExcitationEnergyWith(const ParticleList &pL) const
Compute the excitation energy if some nucleons are put back.
UnorderedVector< Particle * > ParticleList
double energy
Definition: plottest35.C:25
const G4ParticleDefinition const G4Material *G4double range
bool G4bool
Definition: G4Types.hh:79
virtual void initializeParticles()
Initialise the NuclearDensity pointer and sample the particles.
ParticleList particles
void freezeInternalMotion()
Freeze the internal motion of the particles.
G4double computeExcitationEnergyExcept(const long exceptID) const
Compute the excitation energy when a nucleon is removed.
G4int getNumberStoredComponents() const
Get the number of the stored components.
EnergyLevels const & getGroundStateEnergies() const
ParticleList addDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
void setTableMass()
Set the mass of the Particle to its table mass.
ParticleList addMostDynamicalSpectators(ParticleList pL)
Add back dynamical spectators to the projectile remnant.
void internalBoostToCM()
Boost to the CM of the component particles.
void clearEnergyLevels()
Clear the stored energy levels.
std::vector< G4double > EnergyLevels
void removeParticle(Particle *const p, const G4double theProjectileCorrection)
Remove a nucleon from the projectile remnant.
ProjectileRemnant(ParticleSpecies const species, const G4double kineticEnergy)
virtual void makeProjectileSpectator()
Make all the components projectile spectators, too.
double G4double
Definition: G4Types.hh:76
ParticleList::const_iterator ParticleIter