|
|
|||
File indexing completed on 2026-09-04 09:12:24
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 /** 0076 * static instance 0077 */ 0078 static InteractionAvatar* Instance(); 0079 0080 void setSrcPartner(Particle *p /*, const ThreeVector m*/); 0081 0082 /** \brief Apply local-energy transformation, if appropriate 0083 * 0084 * \param p particle to apply the transformation to 0085 */ 0086 void preInteractionLocalEnergy(Particle * const p); 0087 0088 ThreeVector getboostVector(){return boostVector;} 0089 0090 void setboostVector(ThreeVector& v){boostVector = v;} 0091 0092 protected: 0093 virtual G4INCL::IChannel* getChannel() = 0; 0094 0095 G4bool bringParticleInside(Particle * const p); 0096 0097 EventInfo theEventInfo; 0098 0099 /** \brief Store the state of the particles before the interaction 0100 * 0101 * If the interaction cannot be realised for any reason, we will need to 0102 * restore the particle state as it was before. This is done by calling 0103 * the restoreParticles() method. 0104 */ 0105 void preInteractionBlocking(); 0106 0107 void preInteraction(); 0108 void postInteraction(FinalState *); 0109 0110 /** \brief Restore the state of both particles. 0111 * 0112 * The state must first be stored by calling preInteractionBlocking(). 0113 */ 0114 void restoreParticles() const; 0115 0116 void restoreSrcPartner(FinalState * fs); 0117 0118 /// \brief true if the given avatar should use local energy 0119 G4bool shouldUseLocalEnergy() const; 0120 0121 Nucleus *theNucleus; 0122 Particle *particle1, *particle2; 0123 static G4ThreadLocal Particle *backupParticle1, *backupParticle2; 0124 ThreeVector boostVector; 0125 G4double oldTotalEnergy, oldXSec; 0126 G4bool isPiN; 0127 G4double weight; 0128 0129 private: 0130 static G4ThreadLocal InteractionAvatar* interactionAvatar; 0131 static G4ThreadLocal Particle *backupPartner; 0132 static ThreeVector mbackupPartner; 0133 0134 /// \brief RootFunctor-derived object for enforcing energy conservation in N-N. 0135 class ViolationEMomentumFunctor : public RootFunctor { 0136 public: 0137 /** \brief Prepare for calling the () operator and scaleParticleMomenta 0138 * 0139 * The constructor sets the private class members. 0140 */ 0141 ViolationEMomentumFunctor(Nucleus * const nucleus, ParticleList const &modAndCre, const G4double totalEnergyBeforeInteraction, ThreeVector const &boost, const G4bool localE); 0142 virtual ~ViolationEMomentumFunctor(); 0143 0144 /** \brief Compute the energy-conservation violation. 0145 * 0146 * \param x scale factor for the particle momenta 0147 * \return the energy-conservation violation 0148 */ 0149 G4double operator()(const G4double x) const; 0150 0151 /// \brief Clean up after root finding 0152 void cleanUp(const G4bool success) const; 0153 0154 private: 0155 /// \brief List of final-state particles. 0156 ParticleList finalParticles; 0157 /// \brief CM particle momenta, as determined by the channel. 0158 std::vector<ThreeVector> particleMomenta; 0159 /// \brief Total energy before the interaction. 0160 G4double initialEnergy; 0161 /// \brief Pointer to the nucleus 0162 Nucleus *theNucleus; 0163 /// \brief Pointer to the boost vector 0164 ThreeVector const &boostVector; 0165 0166 /// \brief True if we should use local energy 0167 const G4bool shouldUseLocalEnergy; 0168 0169 /** \brief Scale the momenta of the modified and created particles. 0170 * 0171 * Set the momenta of the modified and created particles to alpha times 0172 * their original momenta (stored in particleMomenta). You must call 0173 * init() before using this method. 0174 * 0175 * \param alpha scale factor 0176 */ 0177 void scaleParticleMomenta(const G4double alpha) const; 0178 0179 }; 0180 0181 /// \brief RootFunctor-derived object for enforcing energy conservation in delta production 0182 class ViolationEEnergyFunctor : public RootFunctor { 0183 public: 0184 /** \brief Prepare for calling the () operator and setParticleEnergy 0185 * 0186 * The constructor sets the private class members. 0187 */ 0188 ViolationEEnergyFunctor(Nucleus * const nucleus, Particle * const aParticle, const G4double totalEnergyBeforeInteraction, const G4bool localE); 0189 virtual ~ViolationEEnergyFunctor() {} 0190 0191 /** \brief Compute the energy-conservation violation. 0192 * 0193 * \param x scale factor for the particle energy 0194 * \return the energy-conservation violation 0195 */ 0196 G4double operator()(const G4double x) const; 0197 0198 /// \brief Clean up after root finding 0199 void cleanUp(const G4bool success) const; 0200 0201 /** \brief Set the energy of the particle. 0202 * 0203 * \param energy 0204 */ 0205 void setParticleEnergy(const G4double energy) const; 0206 0207 private: 0208 /// \brief Total energy before the interaction. 0209 G4double initialEnergy; 0210 /// \brief Pointer to the nucleus. 0211 Nucleus *theNucleus; 0212 /// \brief The final-state particle. 0213 Particle *theParticle; 0214 /// \brief The initial energy of the particle. 0215 G4double theEnergy; 0216 /// \brief The initial momentum of the particle. 0217 ThreeVector theMomentum; 0218 /** \brief Threshold for the energy of the particle 0219 * 0220 * The particle (a delta) cannot have less than this energy. 0221 */ 0222 G4double energyThreshold; 0223 /// \brief Whether we should use local energy 0224 const G4bool shouldUseLocalEnergy; 0225 }; 0226 0227 RootFunctor *violationEFunctor; 0228 0229 protected: 0230 /** \brief Enforce energy conservation. 0231 * 0232 * Final states generated by the channels might violate energy conservation 0233 * because of different reasons (energy-dependent potentials, local 0234 * energy...). This conservation law must therefore be enforced by hand. We 0235 * do so by rescaling the momenta of the final-state particles in the CM 0236 * frame. If this turns out to be impossible, this method returns false. 0237 * 0238 * \return true if the algorithm succeeded 0239 */ 0240 G4bool enforceEnergyConservation(FinalState * const fs); 0241 0242 ParticleList modified, created, modifiedAndCreated, Destroyed, ModifiedAndDestroyed; 0243 0244 INCL_DECLARE_ALLOCATION_POOL(InteractionAvatar) 0245 }; 0246 0247 } 0248 0249 #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 |
|