Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4INCLInteractionAvatar.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 /* \file G4INCLInteractionAvatar.hh
38  * \brief Virtual class for interaction avatars.
39  *
40  * This class is inherited by decay and collision avatars. The goal is to
41  * provide a uniform treatment of common physics, such as Pauli blocking,
42  * enforcement of energy conservation, etc.
43  *
44  * \date Mar 1st, 2011
45  * \author Davide Mancusi
46  */
47 
48 #ifndef G4INCLINTERACTIONAVATAR_HH_
49 #define G4INCLINTERACTIONAVATAR_HH_
50 
51 #include "G4INCLIAvatar.hh"
52 #include "G4INCLNucleus.hh"
53 #include "G4INCLFinalState.hh"
54 #include "G4INCLRootFinder.hh"
55 #include "G4INCLKinematicsUtils.hh"
56 
57 namespace G4INCL {
58 
60  public:
63  virtual ~InteractionAvatar();
64 
66  static const G4double locEAccuracy;
68  static const G4int maxIterLocE;
69 
70  protected:
71  virtual G4INCL::IChannel* getChannel() const = 0;
72 
74 
79  void preInteractionLocalEnergy(Particle * const p);
80 
88 
89  void preInteraction();
91 
96  void restoreParticles() const;
97 
100  if(!theNucleus) return false;
101  LocalEnergyType theLocalEnergyType;
102  if(getType()==DecayAvatarType || isPiN)
103  theLocalEnergyType = theNucleus->getStore()->getConfig()->getLocalEnergyPiType();
104  else
105  theLocalEnergyType = theNucleus->getStore()->getConfig()->getLocalEnergyBBType();
106 
107  const G4bool firstAvatar = (theNucleus->getStore()->getBook()->getAcceptedCollisions() == 0);
108  return ((theLocalEnergyType == FirstCollisionLocalEnergy && firstAvatar) ||
109  theLocalEnergyType == AlwaysLocalEnergy);
110  }
111 
123 
124  private:
126  class ViolationEMomentumFunctor : public RootFunctor {
127  public:
132  ViolationEMomentumFunctor(Nucleus * const nucleus, FinalState const * const finalState, ThreeVector const * const boost, const G4bool localE);
133  virtual ~ViolationEMomentumFunctor() { particleMomenta.clear(); }
134 
140  G4double operator()(const G4double x) const;
141 
143  void cleanUp(const G4bool success) const;
144 
145  private:
147  ParticleList finalParticles;
149  std::list<ThreeVector> particleMomenta;
151  G4double initialEnergy;
155  ThreeVector const *boostVector;
157  G4bool hasLocalEnergy;
159  G4bool hasLocalEnergyDelta;
160 
163 
172  void scaleParticleMomenta(const G4double alpha) const;
173 
174  };
175 
177  class ViolationEEnergyFunctor : public RootFunctor {
178  public:
183  ViolationEEnergyFunctor(Nucleus * const nucleus, FinalState const * const finalState);
184  virtual ~ViolationEEnergyFunctor() {}
185 
191  G4double operator()(const G4double x) const;
192 
194  void cleanUp(const G4bool success) const;
195 
200  void setParticleEnergy(const G4double energy) const;
201 
202  private:
204  G4double initialEnergy;
206  Nucleus *theNucleus;
208  Particle *theParticle;
210  G4double theEnergy;
212  ThreeVector theMomentum;
217  G4double energyThreshold;
218  };
219 
220  RootFunctor *violationEFunctor;
221 
222  protected:
233  G4bool enforceEnergyConservation(FinalState * const fs);
234 
235  };
236 
237 }
238 
239 #endif /* G4INCLINTERACTIONAVATAR_HH_ */