G4INCLInteractionAvatar.hh

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 // INCL++ intra-nuclear cascade model
00027 // Pekka Kaitaniemi, CEA and Helsinki Institute of Physics
00028 // Davide Mancusi, CEA
00029 // Alain Boudard, CEA
00030 // Sylvie Leray, CEA
00031 // Joseph Cugnon, University of Liege
00032 //
00033 #define INCLXX_IN_GEANT4_MODE 1
00034 
00035 #include "globals.hh"
00036 
00037 /* \file G4INCLInteractionAvatar.hh
00038  * \brief Virtual class for interaction avatars.
00039  *
00040  * This class is inherited by decay and collision avatars. The goal is to
00041  * provide a uniform treatment of common physics, such as Pauli blocking,
00042  * enforcement of energy conservation, etc.
00043  *
00044  *  \date Mar 1st, 2011
00045  * \author Davide Mancusi
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 /* G4INCLINTERACTIONAVATAR_HH_ */

Generated on Mon May 27 17:48:35 2013 for Geant4 by  doxygen 1.4.7