Geant4  10.02.p01
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 // Alain Boudard, CEA-Saclay, France
28 // Joseph Cugnon, University of Liege, Belgium
29 // Jean-Christophe David, CEA-Saclay, France
30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland
31 // Sylvie Leray, CEA-Saclay, France
32 // Davide Mancusi, CEA-Saclay, France
33 //
34 #define INCLXX_IN_GEANT4_MODE 1
35 
36 #include "globals.hh"
37 
38 /* \file G4INCLInteractionAvatar.hh
39  * \brief Virtual class for interaction avatars.
40  *
41  * This class is inherited by decay and collision avatars. The goal is to
42  * provide a uniform treatment of common physics, such as Pauli blocking,
43  * enforcement of energy conservation, etc.
44  *
45  * \date Mar 1st, 2011
46  * \author Davide Mancusi
47  */
48 
49 #ifndef G4INCLINTERACTIONAVATAR_HH_
50 #define G4INCLINTERACTIONAVATAR_HH_
51 
52 #include "G4INCLIAvatar.hh"
53 #include "G4INCLNucleus.hh"
54 #include "G4INCLFinalState.hh"
55 #include "G4INCLRootFinder.hh"
56 #include "G4INCLKinematicsUtils.hh"
57 #include "G4INCLAllocationPool.hh"
58 
59 namespace G4INCL {
60 
62  public:
65  virtual ~InteractionAvatar();
66 
68  static const G4double locEAccuracy;
70  static const G4int maxIterLocE;
71 
73  static void deleteBackupParticles();
74 
75  protected:
76  virtual G4INCL::IChannel* getChannel() = 0;
77 
79 
84  void preInteractionLocalEnergy(Particle * const p);
85 
93 
94  void preInteraction();
96 
101  void restoreParticles() const;
102 
105 
112 
113  private:
116  public:
121  ViolationEMomentumFunctor(Nucleus * const nucleus, ParticleList const &modAndCre, const G4double totalEnergyBeforeInteraction, ThreeVector const &boost, const G4bool localE);
122  virtual ~ViolationEMomentumFunctor();
123 
129  G4double operator()(const G4double x) const;
130 
132  void cleanUp(const G4bool success) const;
133 
134  private:
138  std::vector<ThreeVector> particleMomenta;
145 
148 
157  void scaleParticleMomenta(const G4double alpha) const;
158 
159  };
160 
163  public:
168  ViolationEEnergyFunctor(Nucleus * const nucleus, Particle * const aParticle, const G4double totalEnergyBeforeInteraction, const G4bool localE);
170 
176  G4double operator()(const G4double x) const;
177 
179  void cleanUp(const G4bool success) const;
180 
185  void setParticleEnergy(const G4double energy) const;
186 
187  private:
205  };
206 
208 
209  protected:
221 
223 
225  };
226 
227 }
228 
229 #endif /* G4INCLINTERACTIONAVATAR_HH_ */
ViolationEEnergyFunctor(Nucleus *const nucleus, Particle *const aParticle, const G4double totalEnergyBeforeInteraction, const G4bool localE)
Prepare for calling the () operator and setParticleEnergy.
G4double theEnergy
The initial energy of the particle.
static const G4double locEAccuracy
Target accuracy in the determination of the local-energy Q-value.
void cleanUp(const G4bool success) const
Clean up after root finding.
Channel generates a final state of an avatar.
void preInteractionLocalEnergy(Particle *const p)
Apply local-energy transformation, if appropriate.
const G4bool shouldUseLocalEnergy
True if we should use local energy.
G4bool shouldUseLocalEnergy() const
true if the given avatar should use local energy
static const G4int maxIterLocE
Max number of iterations for the determination of the local-energy Q-value.
ParticleList finalParticles
List of final-state particles.
G4double initialEnergy
Total energy before the interaction.
RootFunctor-derived object for enforcing energy conservation in delta production. ...
virtual G4INCL::IChannel * getChannel()=0
Singleton for recycling allocation of instances of a given class.
#define G4ThreadLocal
Definition: tls.hh:89
int G4int
Definition: G4Types.hh:78
static G4ThreadLocal Particle * backupParticle2
InteractionAvatar(G4double, G4INCL::Nucleus *, G4INCL::Particle *)
G4double operator()(const G4double x) const
Compute the energy-conservation violation.
ThreeVector const & boostVector
Pointer to the boost vector.
Final state of an interaction.
static void deleteBackupParticles()
Release the memory allocated for the backup particles.
G4double initialEnergy
Total energy before the interaction.
bool G4bool
Definition: G4Types.hh:79
void setParticleEnergy(const G4double energy) const
Set the energy of the particle.
void preInteractionBlocking()
Store the state of the particles before the interaction.
static G4ThreadLocal Particle * backupParticle1
ViolationEMomentumFunctor(Nucleus *const nucleus, ParticleList const &modAndCre, const G4double totalEnergyBeforeInteraction, ThreeVector const &boost, const G4bool localE)
Prepare for calling the () operator and scaleParticleMomenta.
ThreeVector theMomentum
The initial momentum of the particle.
RootFunctor-derived object for enforcing energy conservation in N-N.
const G4bool shouldUseLocalEnergy
Whether we should use local energy.
G4double energyThreshold
Threshold for the energy of the particle.
G4double energy(const ThreeVector &p, const G4double m)
const G4double x[NPOINTSGL]
INCL_DECLARE_ALLOCATION_POOL(InteractionAvatar)
G4bool enforceEnergyConservation(FinalState *const fs)
Enforce energy conservation.
std::vector< ThreeVector > particleMomenta
CM particle momenta, as determined by the channel.
void restoreParticles() const
Restore the state of both particles.
G4double operator()(const G4double x) const
Compute the energy-conservation violation.
double G4double
Definition: G4Types.hh:76
G4bool bringParticleInside(Particle *const p)
void scaleParticleMomenta(const G4double alpha) const
Scale the momenta of the modified and created particles.
static const G4double alpha
void cleanUp(const G4bool success) const
Clean up after root finding.
Static root-finder algorithm.