00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #define INCLXX_IN_GEANT4_MODE 1
00034
00035 #include "globals.hh"
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048 #ifndef G4INCLINTERACTIONAVATAR_HH_
00049 #define G4INCLINTERACTIONAVATAR_HH_
00050
00051 #include "G4INCLIAvatar.hh"
00052 #include "G4INCLNucleus.hh"
00053 #include "G4INCLFinalState.hh"
00054 #include "G4INCLRootFinder.hh"
00055 #include "G4INCLKinematicsUtils.hh"
00056
00057 namespace G4INCL {
00058
00059 class InteractionAvatar : public G4INCL::IAvatar {
00060 public:
00061 InteractionAvatar(G4double, G4INCL::Nucleus*, G4INCL::Particle*);
00062 InteractionAvatar(G4double, G4INCL::Nucleus*, G4INCL::Particle*, G4INCL::Particle*);
00063 virtual ~InteractionAvatar();
00064
00066 static const G4double locEAccuracy;
00068 static const G4int maxIterLocE;
00069
00070 protected:
00071 virtual G4INCL::IChannel* getChannel() const = 0;
00072
00073 G4bool bringParticleInside(Particle * const p);
00074
00079 void preInteractionLocalEnergy(Particle * const p);
00080
00087 void preInteractionBlocking();
00088
00089 void preInteraction();
00090 FinalState *postInteraction(FinalState *);
00091
00096 void restoreParticles() const;
00097
00099 G4bool shouldUseLocalEnergy() const {
00100 if(!theNucleus) return false;
00101 LocalEnergyType theLocalEnergyType;
00102 if(getType()==DecayAvatarType || isPiN)
00103 theLocalEnergyType = theNucleus->getStore()->getConfig()->getLocalEnergyPiType();
00104 else
00105 theLocalEnergyType = theNucleus->getStore()->getConfig()->getLocalEnergyBBType();
00106
00107 const G4bool firstAvatar = (theNucleus->getStore()->getBook()->getAcceptedCollisions() == 0);
00108 return ((theLocalEnergyType == FirstCollisionLocalEnergy && firstAvatar) ||
00109 theLocalEnergyType == AlwaysLocalEnergy);
00110 }
00111
00112 G4INCL::Nucleus *theNucleus;
00113 G4INCL::Particle *particle1, *particle2;
00114 ThreeVector boostVector;
00115 ParticleType oldParticle1Type, oldParticle2Type;
00116 G4double oldParticle1Energy, oldParticle2Energy, oldTotalEnergy, oldXSec;
00117 G4double oldParticle1Potential, oldParticle2Potential;
00118 G4double oldParticle1Mass, oldParticle2Mass;
00119 G4double oldParticle1Helicity, oldParticle2Helicity;
00120 ThreeVector oldParticle1Momentum, oldParticle2Momentum;
00121 ThreeVector oldParticle1Position, oldParticle2Position;
00122 G4bool isPiN;
00123
00124 private:
00126 class ViolationEMomentumFunctor : public RootFunctor {
00127 public:
00132 ViolationEMomentumFunctor(Nucleus * const nucleus, FinalState const * const finalState, ThreeVector const * const boost, const G4bool localE);
00133 virtual ~ViolationEMomentumFunctor() { particleMomenta.clear(); }
00134
00140 G4double operator()(const G4double x) const;
00141
00143 void cleanUp(const G4bool success) const;
00144
00145 private:
00147 ParticleList finalParticles;
00149 std::list<ThreeVector> particleMomenta;
00151 G4double initialEnergy;
00153 Nucleus *theNucleus;
00155 ThreeVector const *boostVector;
00157 G4bool hasLocalEnergy;
00159 G4bool hasLocalEnergyDelta;
00160
00162 const G4bool shouldUseLocalEnergy;
00163
00172 void scaleParticleMomenta(const G4double alpha) const;
00173
00174 };
00175
00177 class ViolationEEnergyFunctor : public RootFunctor {
00178 public:
00183 ViolationEEnergyFunctor(Nucleus * const nucleus, FinalState const * const finalState);
00184 virtual ~ViolationEEnergyFunctor() {}
00185
00191 G4double operator()(const G4double x) const;
00192
00194 void cleanUp(const G4bool success) const;
00195
00200 void setParticleEnergy(const G4double energy) const;
00201
00202 private:
00204 G4double initialEnergy;
00206 Nucleus *theNucleus;
00208 Particle *theParticle;
00210 G4double theEnergy;
00212 ThreeVector theMomentum;
00217 G4double energyThreshold;
00218 };
00219
00220 RootFunctor *violationEFunctor;
00221
00222 protected:
00233 G4bool enforceEnergyConservation(FinalState * const fs);
00234
00235 };
00236
00237 }
00238
00239 #endif