Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 // INCL++ intra-nuclear cascade model 26 // INCL++ intra-nuclear cascade model 27 // Alain Boudard, CEA-Saclay, France 27 // Alain Boudard, CEA-Saclay, France 28 // Joseph Cugnon, University of Liege, Belgium 28 // Joseph Cugnon, University of Liege, Belgium 29 // Jean-Christophe David, CEA-Saclay, France 29 // Jean-Christophe David, CEA-Saclay, France 30 // Pekka Kaitaniemi, CEA-Saclay, France, and H 30 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland 31 // Sylvie Leray, CEA-Saclay, France 31 // Sylvie Leray, CEA-Saclay, France 32 // Davide Mancusi, CEA-Saclay, France 32 // Davide Mancusi, CEA-Saclay, France 33 // 33 // 34 #define INCLXX_IN_GEANT4_MODE 1 34 #define INCLXX_IN_GEANT4_MODE 1 35 35 36 #include "globals.hh" 36 #include "globals.hh" 37 37 38 /* \file G4INCLInteractionAvatar.hh 38 /* \file G4INCLInteractionAvatar.hh 39 * \brief Virtual class for interaction avatar 39 * \brief Virtual class for interaction avatars. 40 * 40 * 41 * This class is inherited by decay and collis 41 * This class is inherited by decay and collision avatars. The goal is to 42 * provide a uniform treatment of common physi 42 * provide a uniform treatment of common physics, such as Pauli blocking, 43 * enforcement of energy conservation, etc. 43 * enforcement of energy conservation, etc. 44 * 44 * 45 * \date Mar 1st, 2011 45 * \date Mar 1st, 2011 46 * \author Davide Mancusi 46 * \author Davide Mancusi 47 */ 47 */ 48 48 49 #ifndef G4INCLINTERACTIONAVATAR_HH_ 49 #ifndef G4INCLINTERACTIONAVATAR_HH_ 50 #define G4INCLINTERACTIONAVATAR_HH_ 50 #define G4INCLINTERACTIONAVATAR_HH_ 51 51 52 #include "G4INCLIAvatar.hh" 52 #include "G4INCLIAvatar.hh" 53 #include "G4INCLNucleus.hh" 53 #include "G4INCLNucleus.hh" 54 #include "G4INCLFinalState.hh" 54 #include "G4INCLFinalState.hh" 55 #include "G4INCLRootFinder.hh" 55 #include "G4INCLRootFinder.hh" 56 #include "G4INCLKinematicsUtils.hh" 56 #include "G4INCLKinematicsUtils.hh" 57 #include "G4INCLAllocationPool.hh" 57 #include "G4INCLAllocationPool.hh" 58 58 59 namespace G4INCL { 59 namespace G4INCL { 60 60 61 class InteractionAvatar : public G4INCL::IAv 61 class InteractionAvatar : public G4INCL::IAvatar { 62 public: 62 public: 63 InteractionAvatar(G4double, G4INCL::Nucl 63 InteractionAvatar(G4double, G4INCL::Nucleus*, G4INCL::Particle*); 64 InteractionAvatar(G4double, G4INCL::Nucl 64 InteractionAvatar(G4double, G4INCL::Nucleus*, G4INCL::Particle*, G4INCL::Particle*); 65 virtual ~InteractionAvatar(); 65 virtual ~InteractionAvatar(); 66 66 67 /// \brief Target accuracy in the determ 67 /// \brief Target accuracy in the determination of the local-energy Q-value 68 static const G4double locEAccuracy; 68 static const G4double locEAccuracy; 69 /// \brief Max number of iterations for 69 /// \brief Max number of iterations for the determination of the local-energy Q-value 70 static const G4int maxIterLocE; 70 static const G4int maxIterLocE; 71 71 72 /// \brief Release the memory allocated 72 /// \brief Release the memory allocated for the backup particles 73 static void deleteBackupParticles(); 73 static void deleteBackupParticles(); 74 74 75 protected: 75 protected: 76 virtual G4INCL::IChannel* getChannel() = 76 virtual G4INCL::IChannel* getChannel() = 0; 77 77 78 G4bool bringParticleInside(Particle * co 78 G4bool bringParticleInside(Particle * const p); 79 79 80 /** \brief Apply local-energy transforma 80 /** \brief Apply local-energy transformation, if appropriate 81 * 81 * 82 * \param p particle to apply the transf 82 * \param p particle to apply the transformation to 83 */ 83 */ 84 void preInteractionLocalEnergy(Particle 84 void preInteractionLocalEnergy(Particle * const p); 85 85 86 /** \brief Store the state of the partic 86 /** \brief Store the state of the particles before the interaction 87 * 87 * 88 * If the interaction cannot be realised 88 * If the interaction cannot be realised for any reason, we will need to 89 * restore the particle state as it was 89 * restore the particle state as it was before. This is done by calling 90 * the restoreParticles() method. 90 * the restoreParticles() method. 91 */ 91 */ 92 void preInteractionBlocking(); 92 void preInteractionBlocking(); 93 93 94 void preInteraction(); 94 void preInteraction(); 95 void postInteraction(FinalState *); 95 void postInteraction(FinalState *); 96 96 97 /** \brief Restore the state of both par 97 /** \brief Restore the state of both particles. 98 * 98 * 99 * The state must first be stored by cal 99 * The state must first be stored by calling preInteractionBlocking(). 100 */ 100 */ 101 void restoreParticles() const; 101 void restoreParticles() const; 102 102 103 /// \brief true if the given avatar shou 103 /// \brief true if the given avatar should use local energy 104 G4bool shouldUseLocalEnergy() const; 104 G4bool shouldUseLocalEnergy() const; 105 105 106 Nucleus *theNucleus; 106 Nucleus *theNucleus; 107 Particle *particle1, *particle2; 107 Particle *particle1, *particle2; 108 static G4ThreadLocal Particle *backupPar 108 static G4ThreadLocal Particle *backupParticle1, *backupParticle2; 109 ThreeVector boostVector; 109 ThreeVector boostVector; 110 G4double oldTotalEnergy, oldXSec; 110 G4double oldTotalEnergy, oldXSec; 111 G4bool isPiN; 111 G4bool isPiN; 112 G4double weight; << 113 112 114 private: 113 private: 115 /// \brief RootFunctor-derived object fo 114 /// \brief RootFunctor-derived object for enforcing energy conservation in N-N. 116 class ViolationEMomentumFunctor : public 115 class ViolationEMomentumFunctor : public RootFunctor { 117 public: 116 public: 118 /** \brief Prepare for calling the ( 117 /** \brief Prepare for calling the () operator and scaleParticleMomenta 119 * 118 * 120 * The constructor sets the private 119 * The constructor sets the private class members. 121 */ 120 */ 122 ViolationEMomentumFunctor(Nucleus * 121 ViolationEMomentumFunctor(Nucleus * const nucleus, ParticleList const &modAndCre, const G4double totalEnergyBeforeInteraction, ThreeVector const &boost, const G4bool localE); 123 virtual ~ViolationEMomentumFunctor() 122 virtual ~ViolationEMomentumFunctor(); 124 123 125 /** \brief Compute the energy-conser 124 /** \brief Compute the energy-conservation violation. 126 * 125 * 127 * \param x scale factor for the par 126 * \param x scale factor for the particle momenta 128 * \return the energy-conservation v 127 * \return the energy-conservation violation 129 */ 128 */ 130 G4double operator()(const G4double x 129 G4double operator()(const G4double x) const; 131 130 132 /// \brief Clean up after root findi 131 /// \brief Clean up after root finding 133 void cleanUp(const G4bool success) c 132 void cleanUp(const G4bool success) const; 134 133 135 private: 134 private: 136 /// \brief List of final-state parti 135 /// \brief List of final-state particles. 137 ParticleList finalParticles; 136 ParticleList finalParticles; 138 /// \brief CM particle momenta, as d 137 /// \brief CM particle momenta, as determined by the channel. 139 std::vector<ThreeVector> particleMom 138 std::vector<ThreeVector> particleMomenta; 140 /// \brief Total energy before the i 139 /// \brief Total energy before the interaction. 141 G4double initialEnergy; 140 G4double initialEnergy; 142 /// \brief Pointer to the nucleus 141 /// \brief Pointer to the nucleus 143 Nucleus *theNucleus; 142 Nucleus *theNucleus; 144 /// \brief Pointer to the boost vect 143 /// \brief Pointer to the boost vector 145 ThreeVector const &boostVector; 144 ThreeVector const &boostVector; 146 145 147 /// \brief True if we should use loc 146 /// \brief True if we should use local energy 148 const G4bool shouldUseLocalEnergy; 147 const G4bool shouldUseLocalEnergy; 149 148 150 /** \brief Scale the momenta of the 149 /** \brief Scale the momenta of the modified and created particles. 151 * 150 * 152 * Set the momenta of the modified a 151 * Set the momenta of the modified and created particles to alpha times 153 * their original momenta (stored in 152 * their original momenta (stored in particleMomenta). You must call 154 * init() before using this method. 153 * init() before using this method. 155 * 154 * 156 * \param alpha scale factor 155 * \param alpha scale factor 157 */ 156 */ 158 void scaleParticleMomenta(const G4do 157 void scaleParticleMomenta(const G4double alpha) const; 159 158 160 }; 159 }; 161 160 162 /// \brief RootFunctor-derived object fo 161 /// \brief RootFunctor-derived object for enforcing energy conservation in delta production 163 class ViolationEEnergyFunctor : public R 162 class ViolationEEnergyFunctor : public RootFunctor { 164 public: 163 public: 165 /** \brief Prepare for calling the ( 164 /** \brief Prepare for calling the () operator and setParticleEnergy 166 * 165 * 167 * The constructor sets the private 166 * The constructor sets the private class members. 168 */ 167 */ 169 ViolationEEnergyFunctor(Nucleus * co 168 ViolationEEnergyFunctor(Nucleus * const nucleus, Particle * const aParticle, const G4double totalEnergyBeforeInteraction, const G4bool localE); 170 virtual ~ViolationEEnergyFunctor() { 169 virtual ~ViolationEEnergyFunctor() {} 171 170 172 /** \brief Compute the energy-conser 171 /** \brief Compute the energy-conservation violation. 173 * 172 * 174 * \param x scale factor for the par 173 * \param x scale factor for the particle energy 175 * \return the energy-conservation v 174 * \return the energy-conservation violation 176 */ 175 */ 177 G4double operator()(const G4double x 176 G4double operator()(const G4double x) const; 178 177 179 /// \brief Clean up after root findi 178 /// \brief Clean up after root finding 180 void cleanUp(const G4bool success) c 179 void cleanUp(const G4bool success) const; 181 180 182 /** \brief Set the energy of the par 181 /** \brief Set the energy of the particle. 183 * 182 * 184 * \param energy 183 * \param energy 185 */ 184 */ 186 void setParticleEnergy(const G4doubl 185 void setParticleEnergy(const G4double energy) const; 187 186 188 private: 187 private: 189 /// \brief Total energy before the i 188 /// \brief Total energy before the interaction. 190 G4double initialEnergy; 189 G4double initialEnergy; 191 /// \brief Pointer to the nucleus. 190 /// \brief Pointer to the nucleus. 192 Nucleus *theNucleus; 191 Nucleus *theNucleus; 193 /// \brief The final-state particle. 192 /// \brief The final-state particle. 194 Particle *theParticle; 193 Particle *theParticle; 195 /// \brief The initial energy of the 194 /// \brief The initial energy of the particle. 196 G4double theEnergy; 195 G4double theEnergy; 197 /// \brief The initial momentum of t 196 /// \brief The initial momentum of the particle. 198 ThreeVector theMomentum; 197 ThreeVector theMomentum; 199 /** \brief Threshold for the energy 198 /** \brief Threshold for the energy of the particle 200 * 199 * 201 * The particle (a delta) cannot hav 200 * The particle (a delta) cannot have less than this energy. 202 */ 201 */ 203 G4double energyThreshold; 202 G4double energyThreshold; 204 /// \brief Whether we should use loc 203 /// \brief Whether we should use local energy 205 const G4bool shouldUseLocalEnergy; 204 const G4bool shouldUseLocalEnergy; 206 }; 205 }; 207 206 208 RootFunctor *violationEFunctor; 207 RootFunctor *violationEFunctor; 209 208 210 protected: 209 protected: 211 /** \brief Enforce energy conservation. 210 /** \brief Enforce energy conservation. 212 * 211 * 213 * Final states generated by the channel 212 * Final states generated by the channels might violate energy conservation 214 * because of different reasons (energy- 213 * because of different reasons (energy-dependent potentials, local 215 * energy...). This conservation law mus 214 * energy...). This conservation law must therefore be enforced by hand. We 216 * do so by rescaling the momenta of the 215 * do so by rescaling the momenta of the final-state particles in the CM 217 * frame. If this turns out to be imposs 216 * frame. If this turns out to be impossible, this method returns false. 218 * 217 * 219 * \return true if the algorithm succeed 218 * \return true if the algorithm succeeded 220 */ 219 */ 221 G4bool enforceEnergyConservation(FinalSt 220 G4bool enforceEnergyConservation(FinalState * const fs); 222 221 223 ParticleList modified, created, modified << 222 ParticleList modified, created, modifiedAndCreated; 224 223 225 INCL_DECLARE_ALLOCATION_POOL(Interaction 224 INCL_DECLARE_ALLOCATION_POOL(InteractionAvatar) 226 }; 225 }; 227 226 228 } 227 } 229 228 230 #endif /* G4INCLINTERACTIONAVATAR_HH_ */ 229 #endif /* G4INCLINTERACTIONAVATAR_HH_ */ 231 230