|
||||
File indexing completed on 2025-01-18 09:58:27
0001 // 0002 // ******************************************************************** 0003 // * License and Disclaimer * 0004 // * * 0005 // * The Geant4 software is copyright of the Copyright Holders of * 0006 // * the Geant4 Collaboration. It is provided under the terms and * 0007 // * conditions of the Geant4 Software License, included in the file * 0008 // * LICENSE and available at http://cern.ch/geant4/license . These * 0009 // * include a list of copyright holders. * 0010 // * * 0011 // * Neither the authors of this software system, nor their employing * 0012 // * institutes,nor the agencies providing financial support for this * 0013 // * work make any representation or warranty, express or implied, * 0014 // * regarding this software system or assume any liability for its * 0015 // * use. Please see the license in the file LICENSE and URL above * 0016 // * for the full disclaimer and the limitation of liability. * 0017 // * * 0018 // * This code implementation is the result of the scientific and * 0019 // * technical work of the GEANT4 collaboration. * 0020 // * By using, copying, modifying or distributing the software (or * 0021 // * any work based on the software) you agree to acknowledge its * 0022 // * use in resulting scientific publications, and indicate your * 0023 // * acceptance of all terms of the Geant4 Software license. * 0024 // ******************************************************************** 0025 // 0026 // INCL++ intra-nuclear cascade model 0027 // Alain Boudard, CEA-Saclay, France 0028 // Joseph Cugnon, University of Liege, Belgium 0029 // Jean-Christophe David, CEA-Saclay, France 0030 // Pekka Kaitaniemi, CEA-Saclay, France, and Helsinki Institute of Physics, Finland 0031 // Sylvie Leray, CEA-Saclay, France 0032 // Davide Mancusi, CEA-Saclay, France 0033 // 0034 #define INCLXX_IN_GEANT4_MODE 1 0035 0036 #include "globals.hh" 0037 0038 /* \file G4INCLInteractionAvatar.hh 0039 * \brief Virtual class for interaction avatars. 0040 * 0041 * This class is inherited by decay and collision avatars. The goal is to 0042 * provide a uniform treatment of common physics, such as Pauli blocking, 0043 * enforcement of energy conservation, etc. 0044 * 0045 * \date Mar 1st, 2011 0046 * \author Davide Mancusi 0047 */ 0048 0049 #ifndef G4INCLINTERACTIONAVATAR_HH_ 0050 #define G4INCLINTERACTIONAVATAR_HH_ 0051 0052 #include "G4INCLIAvatar.hh" 0053 #include "G4INCLNucleus.hh" 0054 #include "G4INCLFinalState.hh" 0055 #include "G4INCLRootFinder.hh" 0056 #include "G4INCLKinematicsUtils.hh" 0057 #include "G4INCLAllocationPool.hh" 0058 0059 namespace G4INCL { 0060 0061 class InteractionAvatar : public G4INCL::IAvatar { 0062 public: 0063 InteractionAvatar(G4double, G4INCL::Nucleus*, G4INCL::Particle*); 0064 InteractionAvatar(G4double, G4INCL::Nucleus*, G4INCL::Particle*, G4INCL::Particle*); 0065 virtual ~InteractionAvatar(); 0066 0067 /// \brief Target accuracy in the determination of the local-energy Q-value 0068 static const G4double locEAccuracy; 0069 /// \brief Max number of iterations for the determination of the local-energy Q-value 0070 static const G4int maxIterLocE; 0071 0072 /// \brief Release the memory allocated for the backup particles 0073 static void deleteBackupParticles(); 0074 0075 protected: 0076 virtual G4INCL::IChannel* getChannel() = 0; 0077 0078 G4bool bringParticleInside(Particle * const p); 0079 0080 /** \brief Apply local-energy transformation, if appropriate 0081 * 0082 * \param p particle to apply the transformation to 0083 */ 0084 void preInteractionLocalEnergy(Particle * const p); 0085 0086 /** \brief Store the state of the particles before the interaction 0087 * 0088 * If the interaction cannot be realised for any reason, we will need to 0089 * restore the particle state as it was before. This is done by calling 0090 * the restoreParticles() method. 0091 */ 0092 void preInteractionBlocking(); 0093 0094 void preInteraction(); 0095 void postInteraction(FinalState *); 0096 0097 /** \brief Restore the state of both particles. 0098 * 0099 * The state must first be stored by calling preInteractionBlocking(). 0100 */ 0101 void restoreParticles() const; 0102 0103 /// \brief true if the given avatar should use local energy 0104 G4bool shouldUseLocalEnergy() const; 0105 0106 Nucleus *theNucleus; 0107 Particle *particle1, *particle2; 0108 static G4ThreadLocal Particle *backupParticle1, *backupParticle2; 0109 ThreeVector boostVector; 0110 G4double oldTotalEnergy, oldXSec; 0111 G4bool isPiN; 0112 G4double weight; 0113 0114 private: 0115 /// \brief RootFunctor-derived object for enforcing energy conservation in N-N. 0116 class ViolationEMomentumFunctor : public RootFunctor { 0117 public: 0118 /** \brief Prepare for calling the () operator and scaleParticleMomenta 0119 * 0120 * The constructor sets the private class members. 0121 */ 0122 ViolationEMomentumFunctor(Nucleus * const nucleus, ParticleList const &modAndCre, const G4double totalEnergyBeforeInteraction, ThreeVector const &boost, const G4bool localE); 0123 virtual ~ViolationEMomentumFunctor(); 0124 0125 /** \brief Compute the energy-conservation violation. 0126 * 0127 * \param x scale factor for the particle momenta 0128 * \return the energy-conservation violation 0129 */ 0130 G4double operator()(const G4double x) const; 0131 0132 /// \brief Clean up after root finding 0133 void cleanUp(const G4bool success) const; 0134 0135 private: 0136 /// \brief List of final-state particles. 0137 ParticleList finalParticles; 0138 /// \brief CM particle momenta, as determined by the channel. 0139 std::vector<ThreeVector> particleMomenta; 0140 /// \brief Total energy before the interaction. 0141 G4double initialEnergy; 0142 /// \brief Pointer to the nucleus 0143 Nucleus *theNucleus; 0144 /// \brief Pointer to the boost vector 0145 ThreeVector const &boostVector; 0146 0147 /// \brief True if we should use local energy 0148 const G4bool shouldUseLocalEnergy; 0149 0150 /** \brief Scale the momenta of the modified and created particles. 0151 * 0152 * Set the momenta of the modified and created particles to alpha times 0153 * their original momenta (stored in particleMomenta). You must call 0154 * init() before using this method. 0155 * 0156 * \param alpha scale factor 0157 */ 0158 void scaleParticleMomenta(const G4double alpha) const; 0159 0160 }; 0161 0162 /// \brief RootFunctor-derived object for enforcing energy conservation in delta production 0163 class ViolationEEnergyFunctor : public RootFunctor { 0164 public: 0165 /** \brief Prepare for calling the () operator and setParticleEnergy 0166 * 0167 * The constructor sets the private class members. 0168 */ 0169 ViolationEEnergyFunctor(Nucleus * const nucleus, Particle * const aParticle, const G4double totalEnergyBeforeInteraction, const G4bool localE); 0170 virtual ~ViolationEEnergyFunctor() {} 0171 0172 /** \brief Compute the energy-conservation violation. 0173 * 0174 * \param x scale factor for the particle energy 0175 * \return the energy-conservation violation 0176 */ 0177 G4double operator()(const G4double x) const; 0178 0179 /// \brief Clean up after root finding 0180 void cleanUp(const G4bool success) const; 0181 0182 /** \brief Set the energy of the particle. 0183 * 0184 * \param energy 0185 */ 0186 void setParticleEnergy(const G4double energy) const; 0187 0188 private: 0189 /// \brief Total energy before the interaction. 0190 G4double initialEnergy; 0191 /// \brief Pointer to the nucleus. 0192 Nucleus *theNucleus; 0193 /// \brief The final-state particle. 0194 Particle *theParticle; 0195 /// \brief The initial energy of the particle. 0196 G4double theEnergy; 0197 /// \brief The initial momentum of the particle. 0198 ThreeVector theMomentum; 0199 /** \brief Threshold for the energy of the particle 0200 * 0201 * The particle (a delta) cannot have less than this energy. 0202 */ 0203 G4double energyThreshold; 0204 /// \brief Whether we should use local energy 0205 const G4bool shouldUseLocalEnergy; 0206 }; 0207 0208 RootFunctor *violationEFunctor; 0209 0210 protected: 0211 /** \brief Enforce energy conservation. 0212 * 0213 * Final states generated by the channels might violate energy conservation 0214 * because of different reasons (energy-dependent potentials, local 0215 * energy...). This conservation law must therefore be enforced by hand. We 0216 * do so by rescaling the momenta of the final-state particles in the CM 0217 * frame. If this turns out to be impossible, this method returns false. 0218 * 0219 * \return true if the algorithm succeeded 0220 */ 0221 G4bool enforceEnergyConservation(FinalState * const fs); 0222 0223 ParticleList modified, created, modifiedAndCreated, Destroyed, ModifiedAndDestroyed; 0224 0225 INCL_DECLARE_ALLOCATION_POOL(InteractionAvatar) 0226 }; 0227 0228 } 0229 0230 #endif /* G4INCLINTERACTIONAVATAR_HH_ */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |