Geant4  9.6.p02
 All Classes 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 "G4INCLEventAction.hh"
45 #include "G4INCLAvatarAction.hh"
46 #include "G4INCLEventInfo.hh"
47 #include "G4INCLGlobalInfo.hh"
48 #include "G4INCLLogger.hh"
49 #include "G4INCLConfig.hh"
50 #include "G4INCLRootFinder.hh"
51 
52 namespace G4INCL {
53  class INCL {
54  public:
55  INCL(Config const * const config);
56 
57  ~INCL();
58 
59  G4bool prepareReaction(const ParticleSpecies &projectileSpecies, const G4double kineticEnergy, const G4int A, const G4int Z);
60  G4bool initializeTarget(const G4int A, const G4int Z);
61  inline const EventInfo &processEvent() {
62  return processEvent(
63  theConfig->getProjectileSpecies(),
64  theConfig->getProjectileKineticEnergy(),
65  theConfig->getTargetA(),
66  theConfig->getTargetZ()
67  );
68  }
69  const EventInfo &processEvent(
70  ParticleSpecies const &projectileSpecies,
71  const G4double kineticEnergy,
72  const G4int targetA,
73  const G4int targetZ
74  );
75 
76  void finalizeGlobalInfo();
77  const GlobalInfo &getGlobalInfo() const { return theGlobalInfo; }
78 
79  std::string configToString() { return theConfig->echo(); }
80 
81  private:
82  IPropagationModel *propagationModel;
83  G4int theA, theZ;
84  G4bool targetInitSuccess;
85  G4double maxImpactParameter;
86  G4double maxUniverseRadius;
87  G4double maxInteractionDistance;
88  G4double fixedImpactParameter;
89  EventAction *eventAction;
90  PropagationAction *propagationAction;
91  AvatarAction *avatarAction;
92  Config const * const theConfig;
93  Nucleus *nucleus;
94 
95  EventInfo theEventInfo;
96  GlobalInfo theGlobalInfo;
97 
99  G4int minRemnantSize;
100 
102  class RecoilFunctor : public RootFunctor {
103  public:
108  RecoilFunctor(Nucleus * const n, const EventInfo &ei) :
109  RootFunctor(0., 1E6),
110  nucleus(n),
111  outgoingParticles(n->getStore()->getOutgoingParticles()),
112  theEventInfo(ei) {
113  for(ParticleIter p=outgoingParticles.begin(); p!=outgoingParticles.end(); ++p) {
114  particleMomenta.push_back((*p)->getMomentum());
115  particleKineticEnergies.push_back((*p)->getKineticEnergy());
116  }
117  }
118  virtual ~RecoilFunctor() {}
119 
125  G4double operator()(const G4double x) const {
126  scaleParticleEnergies(x);
127  return nucleus->getConservationBalance(theEventInfo,true).energy;
128  }
129 
131  void cleanUp(const G4bool success) const {
132  if(!success)
133  scaleParticleEnergies(1.);
134  }
135 
136  private:
138  Nucleus *nucleus;
140  ParticleList const &outgoingParticles;
141  // \brief Reference to the EventInfo object
142  EventInfo const &theEventInfo;
144  std::list<ThreeVector> particleMomenta;
146  std::list<G4double> particleKineticEnergies;
147 
152  void scaleParticleEnergies(const G4double rescale) const {
153  // Rescale the energies (and the momenta) of the outgoing particles.
154  ThreeVector pBalance = nucleus->getIncomingMomentum();
155  std::list<ThreeVector>::const_iterator iP = particleMomenta.begin();
156  std::list<G4double>::const_iterator iE = particleKineticEnergies.begin();
157  for( ParticleIter i = outgoingParticles.begin(); i != outgoingParticles.end(); ++i, ++iP, ++iE)
158  {
159  const G4double mass = (*i)->getMass();
160  const G4double newKineticEnergy = (*iE) * rescale;
161 
162  (*i)->setMomentum(*iP);
163  (*i)->setEnergy(mass + newKineticEnergy);
164  (*i)->adjustMomentumFromEnergy();
165 
166  pBalance -= (*i)->getMomentum();
167  }
168 
169  nucleus->setMomentum(pBalance);
170  const G4double remnantMass = ParticleTable::getTableMass(nucleus->getA(),nucleus->getZ()) + nucleus->getExcitationEnergy();
171  const G4double pRem2 = pBalance.mag2();
172  const G4double recoilEnergy = pRem2/
173  (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
174  nucleus->setEnergy(remnantMass + recoilEnergy);
175  }
176  };
177 
179  class RecoilCMFunctor : public RootFunctor {
180  public:
185  RecoilCMFunctor(Nucleus * const n, const EventInfo &ei) :
186  RootFunctor(0., 1E6),
187  nucleus(n),
188  theIncomingMomentum(nucleus->getIncomingMomentum()),
189  outgoingParticles(n->getStore()->getOutgoingParticles()),
190  theEventInfo(ei) {
191  thePTBoostVector = nucleus->getIncomingMomentum()/nucleus->getInitialEnergy();
192  for(ParticleIter p=outgoingParticles.begin(); p!=outgoingParticles.end(); ++p) {
193  (*p)->boost(thePTBoostVector);
194  particleCMMomenta.push_back((*p)->getMomentum());
195  }
196  }
197  virtual ~RecoilCMFunctor() {}
198 
204  G4double operator()(const G4double x) const {
205  scaleParticleCMMomenta(x);
206  return nucleus->getConservationBalance(theEventInfo,true).energy;
207  }
208 
210  void cleanUp(const G4bool success) const {
211  if(!success)
212  scaleParticleCMMomenta(1.);
213  }
214 
215  private:
217  Nucleus *nucleus;
219  ThreeVector thePTBoostVector;
221  ThreeVector theIncomingMomentum;
223  ParticleList const &outgoingParticles;
224  // \brief Reference to the EventInfo object
225  EventInfo const &theEventInfo;
227  std::list<ThreeVector> particleCMMomenta;
228 
233  void scaleParticleCMMomenta(const G4double rescale) const {
234  // Rescale the CM momenta of the outgoing particles.
235  ThreeVector remnantMomentum = theIncomingMomentum;
236  std::list<ThreeVector>::const_iterator iP = particleCMMomenta.begin();
237  for( ParticleIter i = outgoingParticles.begin(); i != outgoingParticles.end(); ++i, ++iP)
238  {
239  (*i)->setMomentum(*iP * rescale);
240  (*i)->adjustEnergyFromMomentum();
241  (*i)->boost(-thePTBoostVector);
242 
243  remnantMomentum -= (*i)->getMomentum();
244  }
245 
246  nucleus->setMomentum(remnantMomentum);
247  const G4double remnantMass = ParticleTable::getTableMass(nucleus->getA(),nucleus->getZ()) + nucleus->getExcitationEnergy();
248  const G4double pRem2 = remnantMomentum.mag2();
249  const G4double recoilEnergy = pRem2/
250  (std::sqrt(pRem2+remnantMass*remnantMass) + remnantMass);
251  nucleus->setEnergy(remnantMass + recoilEnergy);
252  }
253  };
254 
260  void rescaleOutgoingForRecoil();
261 
262 #ifndef INCLXX_IN_GEANT4_MODE
263 
272  void globalConservationChecks(G4bool afterRecoil);
273 #endif
274 
280  G4bool continueCascade();
281 
299  G4int makeProjectileRemnant();
300 
308  void makeCompoundNucleus();
309 
311  G4bool preCascade(ParticleSpecies const projectileSpecies, const G4double kineticEnergy);
312 
314  void cascade();
315 
317  void postCascade();
318 
323  void initMaxInteractionDistance(ParticleSpecies const &p, const G4double kineticEnergy);
324 
330  void initUniverseRadius(ParticleSpecies const &p, const G4double kineticEnergy, const G4int A, const G4int Z);
331  };
332 }
333 
334 #endif