Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 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 H 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 avatar 40 * 41 * This class is inherited by decay and collis 42 * provide a uniform treatment of common physi 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 61 class InteractionAvatar : public G4INCL::IAv 62 public: 63 InteractionAvatar(G4double, G4INCL::Nucl 64 InteractionAvatar(G4double, G4INCL::Nucl 65 virtual ~InteractionAvatar(); 66 67 /// \brief Target accuracy in the determ 68 static const G4double locEAccuracy; 69 /// \brief Max number of iterations for 70 static const G4int maxIterLocE; 71 72 /// \brief Release the memory allocated 73 static void deleteBackupParticles(); 74 75 protected: 76 virtual G4INCL::IChannel* getChannel() = 77 78 G4bool bringParticleInside(Particle * co 79 80 /** \brief Apply local-energy transforma 81 * 82 * \param p particle to apply the transf 83 */ 84 void preInteractionLocalEnergy(Particle 85 86 /** \brief Store the state of the partic 87 * 88 * If the interaction cannot be realised 89 * restore the particle state as it was 90 * the restoreParticles() method. 91 */ 92 void preInteractionBlocking(); 93 94 void preInteraction(); 95 void postInteraction(FinalState *); 96 97 /** \brief Restore the state of both par 98 * 99 * The state must first be stored by cal 100 */ 101 void restoreParticles() const; 102 103 /// \brief true if the given avatar shou 104 G4bool shouldUseLocalEnergy() const; 105 106 Nucleus *theNucleus; 107 Particle *particle1, *particle2; 108 static G4ThreadLocal Particle *backupPar 109 ThreeVector boostVector; 110 G4double oldTotalEnergy, oldXSec; 111 G4bool isPiN; 112 G4double weight; 113 114 private: 115 /// \brief RootFunctor-derived object fo 116 class ViolationEMomentumFunctor : public 117 public: 118 /** \brief Prepare for calling the ( 119 * 120 * The constructor sets the private 121 */ 122 ViolationEMomentumFunctor(Nucleus * 123 virtual ~ViolationEMomentumFunctor() 124 125 /** \brief Compute the energy-conser 126 * 127 * \param x scale factor for the par 128 * \return the energy-conservation v 129 */ 130 G4double operator()(const G4double x 131 132 /// \brief Clean up after root findi 133 void cleanUp(const G4bool success) c 134 135 private: 136 /// \brief List of final-state parti 137 ParticleList finalParticles; 138 /// \brief CM particle momenta, as d 139 std::vector<ThreeVector> particleMom 140 /// \brief Total energy before the i 141 G4double initialEnergy; 142 /// \brief Pointer to the nucleus 143 Nucleus *theNucleus; 144 /// \brief Pointer to the boost vect 145 ThreeVector const &boostVector; 146 147 /// \brief True if we should use loc 148 const G4bool shouldUseLocalEnergy; 149 150 /** \brief Scale the momenta of the 151 * 152 * Set the momenta of the modified a 153 * their original momenta (stored in 154 * init() before using this method. 155 * 156 * \param alpha scale factor 157 */ 158 void scaleParticleMomenta(const G4do 159 160 }; 161 162 /// \brief RootFunctor-derived object fo 163 class ViolationEEnergyFunctor : public R 164 public: 165 /** \brief Prepare for calling the ( 166 * 167 * The constructor sets the private 168 */ 169 ViolationEEnergyFunctor(Nucleus * co 170 virtual ~ViolationEEnergyFunctor() { 171 172 /** \brief Compute the energy-conser 173 * 174 * \param x scale factor for the par 175 * \return the energy-conservation v 176 */ 177 G4double operator()(const G4double x 178 179 /// \brief Clean up after root findi 180 void cleanUp(const G4bool success) c 181 182 /** \brief Set the energy of the par 183 * 184 * \param energy 185 */ 186 void setParticleEnergy(const G4doubl 187 188 private: 189 /// \brief Total energy before the i 190 G4double initialEnergy; 191 /// \brief Pointer to the nucleus. 192 Nucleus *theNucleus; 193 /// \brief The final-state particle. 194 Particle *theParticle; 195 /// \brief The initial energy of the 196 G4double theEnergy; 197 /// \brief The initial momentum of t 198 ThreeVector theMomentum; 199 /** \brief Threshold for the energy 200 * 201 * The particle (a delta) cannot hav 202 */ 203 G4double energyThreshold; 204 /// \brief Whether we should use loc 205 const G4bool shouldUseLocalEnergy; 206 }; 207 208 RootFunctor *violationEFunctor; 209 210 protected: 211 /** \brief Enforce energy conservation. 212 * 213 * Final states generated by the channel 214 * because of different reasons (energy- 215 * energy...). This conservation law mus 216 * do so by rescaling the momenta of the 217 * frame. If this turns out to be imposs 218 * 219 * \return true if the algorithm succeed 220 */ 221 G4bool enforceEnergyConservation(FinalSt 222 223 ParticleList modified, created, modified 224 225 INCL_DECLARE_ALLOCATION_POOL(Interaction 226 }; 227 228 } 229 230 #endif /* G4INCLINTERACTIONAVATAR_HH_ */ 231