Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4INCLCascade.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 
37 #ifndef G4INCLCascade_hh
38 #define G4INCLCascade_hh 1
39 
40 #include "G4INCLParticle.hh"
41 #include "G4INCLNucleus.hh"
43 #include "G4INCLCascadeAction.hh"
44 #include "G4INCLEventInfo.hh"
45 #include "G4INCLGlobalInfo.hh"
46 #include "G4INCLLogger.hh"
47 #include "G4INCLConfig.hh"
48 #include "G4INCLRootFinder.hh"
49 
50 namespace G4INCL {
51  class INCL {
52  public:
53  INCL(Config const * const config);
54 
55  ~INCL();
56 
57  /// \brief Dummy copy constructor to silence Coverity warning
58  INCL(const INCL &rhs);
59 
60  /// \brief Dummy assignment operator to silence Coverity warning
61  INCL &operator=(const INCL &rhs);
62 
63  G4bool prepareReaction(const ParticleSpecies &projectileSpecies, const G4double kineticEnergy, const G4int A, const G4int Z);
64  G4bool initializeTarget(const G4int A, const G4int Z);
65  inline const EventInfo &processEvent() {
66  return processEvent(
67  theConfig->getProjectileSpecies(),
68  theConfig->getProjectileKineticEnergy(),
69  theConfig->getTargetA(),
70  theConfig->getTargetZ()
71  );
72  }
73  const EventInfo &processEvent(
74  ParticleSpecies const &projectileSpecies,
75  const G4double kineticEnergy,
76  const G4int targetA,
77  const G4int targetZ
78  );
79 
80  void finalizeGlobalInfo();
81  const GlobalInfo &getGlobalInfo() const { return theGlobalInfo; }
82 
83  private:
84  IPropagationModel *propagationModel;
85  G4int theA, theZ;
86  G4bool targetInitSuccess;
87  G4double maxImpactParameter;
88  G4double maxUniverseRadius;
89  G4double maxInteractionDistance;
90  G4double fixedImpactParameter;
91  CascadeAction *cascadeAction;
92  Config const * const theConfig;
93  Nucleus *nucleus;
94  G4bool forceTransparent;
95 
96  EventInfo theEventInfo;
97  GlobalInfo theGlobalInfo;
98 
99  /// \brief Remnant size below which cascade stops
100  G4int minRemnantSize;
101 
102  /// \brief Class to adjust remnant recoil
103  class RecoilFunctor : public RootFunctor {
104  public:
105  /** \brief Prepare for calling the () operator and scaleParticleEnergies
106  *
107  * The constructor sets the private class members.
108  */
109  RecoilFunctor(Nucleus * const n, const EventInfo &ei) :
110  RootFunctor(0., 1E6),
111  nucleus(n),
112  outgoingParticles(n->getStore()->getOutgoingParticles()),
113  theEventInfo(ei) {
114  for(ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end(); p!=e; ++p) {
115  particleMomenta.push_back((*p)->getMomentum());
116  particleKineticEnergies.push_back((*p)->getKineticEnergy());
117  }
118  ProjectileRemnant * const aPR = n->getProjectileRemnant();
119  if(aPR && aPR->getA()>0) {
120  particleMomenta.push_back(aPR->getMomentum());
121  particleKineticEnergies.push_back(aPR->getKineticEnergy());
122  outgoingParticles.push_back(aPR);
123  }
124  }
125  virtual ~RecoilFunctor() {}
126 
127  /** \brief Compute the energy-conservation violation.
128  *
129  * \param x scale factor for the particle energies
130  * \return the energy-conservation violation
131  */
132  G4double operator()(const G4double x) const {
133  scaleParticleEnergies(x);
134  return nucleus->getConservationBalance(theEventInfo,true).energy;
135  }
136 
137  /// \brief Clean up after root finding
138  void cleanUp(const G4bool success) const {
139  if(!success)
140  scaleParticleEnergies(1.);
141  }
142 
143  private:
144  /// \brief Pointer to the nucleus
145  Nucleus *nucleus;
146  /// \brief List of final-state particles.
147  ParticleList outgoingParticles;
148  // \brief Reference to the EventInfo object
149  EventInfo const &theEventInfo;
150  /// \brief Initial momenta of the outgoing particles
151  std::list<ThreeVector> particleMomenta;
152  /// \brief Initial kinetic energies of the outgoing particles
153  std::list<G4double> particleKineticEnergies;
154 
155  /** \brief Scale the kinetic energies of the outgoing particles.
156  *
157  * \param rescale scale factor
158  */
159  void scaleParticleEnergies(const G4double rescale) const {
160  // Rescale the energies (and the momenta) of the outgoing particles.
161  ThreeVector pBalance = nucleus->getIncomingMomentum();
162  std::list<ThreeVector>::const_iterator iP = particleMomenta.begin();
163  std::list<G4double>::const_iterator iE = particleKineticEnergies.begin();
164  for( ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP, ++iE)
165  {
166  const G4double mass = (*i)->getMass();
167  const G4double newKineticEnergy = (*iE) * rescale;
168 
169  (*i)->setMomentum(*iP);
170  (*i)->setEnergy(mass + newKineticEnergy);
171  (*i)->adjustMomentumFromEnergy();
172 
173  pBalance -= (*i)->getMomentum();
174  }
175 
176  nucleus->setMomentum(pBalance);
177  const G4double remnantMass = ParticleTable::getTableMass(nucleus->getA(),nucleus->getZ()) + nucleus->getExcitationEnergy();
178  const G4double pRem2 = pBalance.mag2();
179  const G4double recoilEnergy = pRem2/
180  (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
181  nucleus->setEnergy(remnantMass + recoilEnergy);
182  }
183  };
184 
185  /// \brief Class to adjust remnant recoil in the reaction CM system
186  class RecoilCMFunctor : public RootFunctor {
187  public:
188  /** \brief Prepare for calling the () operator and scaleParticleEnergies
189  *
190  * The constructor sets the private class members.
191  */
192  RecoilCMFunctor(Nucleus * const n, const EventInfo &ei) :
193  RootFunctor(0., 1E6),
194  nucleus(n),
195  theIncomingMomentum(nucleus->getIncomingMomentum()),
196  outgoingParticles(n->getStore()->getOutgoingParticles()),
197  theEventInfo(ei) {
198  thePTBoostVector = nucleus->getIncomingMomentum()/nucleus->getInitialEnergy();
199  for(ParticleIter p=outgoingParticles.begin(), e=outgoingParticles.end(); p!=e; ++p) {
200  (*p)->boost(thePTBoostVector);
201  particleCMMomenta.push_back((*p)->getMomentum());
202  }
203  ProjectileRemnant * const aPR = n->getProjectileRemnant();
204  if(aPR && aPR->getA()>0) {
205  aPR->boost(thePTBoostVector);
206  particleCMMomenta.push_back(aPR->getMomentum());
207  outgoingParticles.push_back(aPR);
208  }
209  }
210  virtual ~RecoilCMFunctor() {}
211 
212  /** \brief Compute the energy-conservation violation.
213  *
214  * \param x scale factor for the particle energies
215  * \return the energy-conservation violation
216  */
217  G4double operator()(const G4double x) const {
218  scaleParticleCMMomenta(x);
219  return nucleus->getConservationBalance(theEventInfo,true).energy;
220  }
221 
222  /// \brief Clean up after root finding
223  void cleanUp(const G4bool success) const {
224  if(!success)
225  scaleParticleCMMomenta(1.);
226  }
227 
228  private:
229  /// \brief Pointer to the nucleus
230  Nucleus *nucleus;
231  /// \brief Projectile-target CM boost vector
232  ThreeVector thePTBoostVector;
233  /// \brief Incoming momentum
234  ThreeVector theIncomingMomentum;
235  /// \brief List of final-state particles.
236  ParticleList outgoingParticles;
237  // \brief Reference to the EventInfo object
238  EventInfo const &theEventInfo;
239  /// \brief Initial CM momenta of the outgoing particles
240  std::list<ThreeVector> particleCMMomenta;
241 
242  /** \brief Scale the kinetic energies of the outgoing particles.
243  *
244  * \param rescale scale factor
245  */
246  void scaleParticleCMMomenta(const G4double rescale) const {
247  // Rescale the CM momenta of the outgoing particles.
248  ThreeVector remnantMomentum = theIncomingMomentum;
249  std::list<ThreeVector>::const_iterator iP = particleCMMomenta.begin();
250  for( ParticleIter i = outgoingParticles.begin(), e = outgoingParticles.end(); i!=e; ++i, ++iP)
251  {
252  (*i)->setMomentum(*iP * rescale);
253  (*i)->adjustEnergyFromMomentum();
254  (*i)->boost(-thePTBoostVector);
255 
256  remnantMomentum -= (*i)->getMomentum();
257  }
258 
259  nucleus->setMomentum(remnantMomentum);
260  const G4double remnantMass = ParticleTable::getTableMass(nucleus->getA(),nucleus->getZ()) + nucleus->getExcitationEnergy();
261  const G4double pRem2 = remnantMomentum.mag2();
262  const G4double recoilEnergy = pRem2/
263  (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
264  nucleus->setEnergy(remnantMass + recoilEnergy);
265  }
266  };
267 
268  /** \brief Rescale the energies of the outgoing particles.
269  *
270  * Allow for the remnant recoil energy by rescaling the energy (and
271  * momenta) of the outgoing particles.
272  */
273  void rescaleOutgoingForRecoil();
274 
275 #ifndef INCLXX_IN_GEANT4_MODE
276  /** \brief Run global conservation checks
277  *
278  * Check that energy and momentum are correctly conserved. If not, issue
279  * a warning.
280  *
281  * Also feeds the balance variables in theEventInfo.
282  *
283  * \param afterRecoil whether to take into account nuclear recoil
284  */
285  void globalConservationChecks(G4bool afterRecoil);
286 #endif
287 
288  /** \brief Stopping criterion for the cascade
289  *
290  * Returns true if the cascade should continue, and false if any of the
291  * stopping criteria is satisfied.
292  */
293  G4bool continueCascade();
294 
295  /** \brief Make a projectile pre-fragment out of geometrical spectators
296  *
297  * The projectile pre-fragment is assigned an excitation energy given
298  * by \f$E_\mathrm{sp}-E_\mathrm{i,A}\f$, where \f$E_\mathrm{sp}\f$ is the
299  * sum of the energies of the spectator particles, and \f$E_\mathrm{i,A}\f$
300  * is the sum of the smallest \f$A\f$ particle energies initially present
301  * in the projectile, \f$A\f$ being the mass of the projectile
302  * pre-fragment. This is equivalent to assuming that the excitation
303  * energy is given by the sum of the transitions of all excited
304  * projectile components to the "holes" left by the participants.
305  *
306  * This method can modify the outgoing list and adds a projectile
307  * pre-fragment.
308  *
309  * \return the number of dynamical spectators that were merged back in
310  * the projectile
311  */
312  G4int makeProjectileRemnant();
313 
314  /** \brief Make a compound nucleus
315  *
316  * Selects the projectile components that can actually enter their
317  * potential and puts them into the target nucleus. If the CN excitation
318  * energy turns out to be negative, the event is considered a
319  * transparent. This method modifies theEventInfo and theGlobalInfo.
320  */
321  void makeCompoundNucleus();
322 
323  /// \brief Initialise the cascade
324  G4bool preCascade(ParticleSpecies const projectileSpecies, const G4double kineticEnergy);
325 
326  /// \brief The actual cascade loop
327  void cascade();
328 
329  /// \brief Finalise the cascade and clean up
330  void postCascade();
331 
332  /** \brief Initialise the maximum interaction distance.
333  *
334  * Used in forced CN events.
335  */
336  void initMaxInteractionDistance(ParticleSpecies const &p, const G4double kineticEnergy);
337 
338  /** \brief Initialize the universe radius.
339  *
340  * Used for determining the energy-dependent size of the volume particles
341  * live in.
342  */
343  void initUniverseRadius(ParticleSpecies const &p, const G4double kineticEnergy, const G4int A, const G4int Z);
344 
345  /// \brief Update global counters and other members of theGlobalInfo object
346  void updateGlobalInfo();
347  };
348 }
349 
350 #endif
INCL & operator=(const INCL &rhs)
Dummy assignment operator to silence Coverity warning.
const GlobalInfo & getGlobalInfo() const
G4bool prepareReaction(const ParticleSpecies &projectileSpecies, const G4double kineticEnergy, const G4int A, const G4int Z)
G4int getTargetZ() const
Get the target charge number.
const char * p
Definition: xmltok.h:285
void finalizeGlobalInfo()
int G4int
Definition: G4Types.hh:78
Class containing default actions to be performed at intermediate cascade steps.
UnorderedVector< Particle * > ParticleList
INCL(Config const *const config)
Simple container for output of calculation-wide results.
Simple container for output of event results.
bool G4bool
Definition: G4Types.hh:79
G4int getTargetA() const
Get the target mass number.
const EventInfo & processEvent()
const G4int n
G4bool initializeTarget(const G4int A, const G4int Z)
ParticleSpecies getProjectileSpecies() const
Get the projectile species.
G4ThreadLocal NuclearMassFn getTableMass
Static pointer to the mass function for nuclei.
RootFunctor(const G4double x0, const G4double x1)
ProjectileRemnant * getProjectileRemnant() const
Get the projectile remnant.
double G4double
Definition: G4Types.hh:76
G4double getProjectileKineticEnergy() const
Get the projectile kinetic energy.
ParticleList::const_iterator ParticleIter
Static root-finder algorithm.