Import Geant4 4.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:39:52 +02:00
parent 921d3b1cda
commit 330b82b769
4524 changed files with 178689 additions and 43575 deletions
@@ -21,7 +21,12 @@ CPPFLAGS += -I$(G4BASE)/global/management/include \
-I$(G4BASE)/processes/hadronic/util/include \
-I$(G4BASE)/processes/hadronic/cross_sections/include/ \
-I$(G4BASE)/processes/hadronic/models/generator/util/include \
-I$(G4BASE)/processes/hadronic/models/generator/high_energy/include \
-I$(G4BASE)/processes/hadronic/models/generator/management/include \
-I$(G4BASE)/processes/hadronic/models/generator/quark_gluon_string/include \
-I$(G4BASE)/processes/hadronic/models/generator/string_common/include \
-I$(G4BASE)/processes/hadronic/models/generator/string_fragmentation/include \
-I$(G4BASE)/processes/hadronic/models/generator/diffractive_string/include \
-I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/interface/include \
-I$(G4BASE)/processes/hadronic/models/chiral_inv_phase_space/body/include \
-I$(G4BASE)/particles/management/include \
@@ -20,6 +20,16 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
//
// $Id: G4ElectroNuclearReaction.hh,v 1.13 2002/06/20 08:43:58 jwellisc Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
//
// GEANT4 physics class: G4ElectroNuclearReaction -- header file
// Created: J.P. Wellisch, 12/11/2001
// The last update: J.P. Wellisch, 06-June-02
//
#ifndef G4ElectroNuclearReaction_h
#define G4ElectroNuclearReaction_h
@@ -27,33 +37,52 @@
#include "G4HadronicInteraction.hh"
#include "G4ChiralInvariantPhaseSpace.hh"
#include "G4ElectroNuclearCrossSection.hh"
#include "G4PhotoNuclearCrossSection.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4Gamma.hh"
#include "G4GammaParticipants.hh"
#include "G4QGSModel.hh"
#include "G4TheoFSGenerator.hh"
#include "G4GeneratorPrecompoundInterface.hh"
#include "G4QGSMFragmentation.hh"
#include "G4ExcitedStringDecay.hh"
class G4ElectroNuclearReaction : public G4HadronicInteraction
{
public:
virtual ~G4ElectroNuclearReaction()
virtual ~G4ElectroNuclearReaction(){}
G4ElectroNuclearReaction()
{
theHEModel = new G4TheoFSGenerator;
theCascade = new G4GeneratorPrecompoundInterface;
}
G4VParticleChange * ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus);
private:
G4ChiralInvariantPhaseSpace theModel;
G4ElectroNuclearCrossSection theData;
G4ChiralInvariantPhaseSpace theLEModel;
G4TheoFSGenerator * theHEModel;
G4GeneratorPrecompoundInterface * theCascade;
G4QGSModel< G4GammaParticipants > theStringModel;
G4QGSMFragmentation theFragmentation;
G4ExcitedStringDecay * theStringDecay;
G4ElectroNuclearCrossSection theElectronData;
G4PhotoNuclearCrossSection thePhotonData;
G4ParticleChange theResult;
};
inline
G4VParticleChange * G4ElectroNuclearReaction::
inline G4VParticleChange* G4ElectroNuclearReaction::
ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
{
const G4ParticleDefinition* aD = aTrack.GetDynamicParticle()->GetDefinition();
static const G4double dM=G4Proton::Proton()->GetPDGMass()+G4Neutron::Neutron()->GetPDGMass(); // Mean double nucleon mass = m_n+m_p (@@ no binding)
static const G4double me=G4Electron::Electron()->GetPDGMass(); // electron mass
static const G4double me2=me*me; // squared electron mass
static const G4double dpi=2*M_PI; // 2*pi
const G4DynamicParticle* theElectron=aTrack.GetDynamicParticle();
const G4ParticleDefinition* aD = theElectron->GetDefinition();
if((aD != G4Electron::ElectronDefinition()) && (aD != G4Positron::PositronDefinition()))
{
G4Exception("Called G4ElectroNuclearReaction for particle other than electron or positron");
}
G4Exception("G4ElectroNuclearReaction::ApplyYourself called for neither electron or positron");
theResult.Initialize(aTrack);
@@ -70,28 +99,85 @@ ApplyYourself(const G4Track& aTrack, G4Nucleus& aTargetNucleus)
}
if(0==anElement)
{
G4cout << "G4ElectroNuclearReaction::ApplyYourself - trying to react on an element"<<G4endl;
G4cout << "that is not in the table of elements. Z="<<aTargetNucleus.GetZ()<<G4endl;
G4Exception("Folding with error.");
G4cerr<<"***G4ElectroNuclearReaction::ApplyYourself: element with Z="<<aTargetNucleus.GetZ()<<
" is not in the element table"<<G4endl; // @@ how to retrieve A or N for the isotop?
G4Exception("Anomalous element error.");
}
G4double photonEnergy = 10*GeV;
G4double xSec;
while(photonEnergy>3.*GeV)
{
xSec = theData.GetCrossSection(aTrack.GetDynamicParticle(), anElement);
photonEnergy = theData.GetEffectivePhotonEnergy();
}
if(aTrack.GetDynamicParticle()->GetKineticEnergy() - photonEnergy < 0)
{
G4Exception("G4ElectroNuclearReaction: photonEnergy above electron energy");
}
theResult.SetEnergyChange(aTrack.GetDynamicParticle()->GetKineticEnergy() - photonEnergy);
// Note: high energy gamma nuclear now implemented.
G4ThreeVector photonDirection = aTrack.GetMomentumDirection();
G4DynamicParticle localGamma(G4Gamma::GammaDefinition(), photonDirection, photonEnergy);
G4double xSec = theElectronData.GetCrossSection(theElectron, anElement); // Check cross section
if(xSec<=0.) return &theResult; // DO-NOTHING condition
G4double photonEnergy = theElectronData.GetEquivalentPhotonEnergy();
G4double theElectronKinEnergy=theElectron->GetKineticEnergy();
if( theElectronKinEnergy < photonEnergy )
{
G4cout << "G4ElectroNuclearReaction::ApplyYourself: photonEnergy is very high"<<G4endl;
G4cout << "If this condition appears frequently, please contact Hans-Peter.Wellisch@cern.ch"<<G4endl;
}
G4double photonQ2 = theElectronData.GetEquivalentPhotonQ2(photonEnergy);
G4double W=photonEnergy-photonQ2/dM; // Hadronic energy flow (W-energy) from the virtual photon
if(W<0.) G4Exception("G4ElectroNuclearReaction::ApplyYourself: negative equivalent energy");
G4DynamicParticle* theDynamicPhoton = new
G4DynamicParticle(G4Gamma::GammaDefinition(),
G4ParticleMomentum(1.,0.,0.), photonEnergy*MeV); //->-*
G4double sigNu=thePhotonData.GetCrossSection(theDynamicPhoton, anElement); // |
theDynamicPhoton->SetKineticEnergy(W); // Redefine photon with equivalent energy |
G4double sigK =thePhotonData.GetCrossSection(theDynamicPhoton, anElement); // |
delete theDynamicPhoton; // <-------------------------------------------------------*
G4double rndFraction = theElectronData.GetVirtualFactor(photonEnergy, photonQ2);
if(sigNu*G4UniformRand()>sigK*rndFraction)
{
return &theResult; // DO-NOTHING condition
}
// Scatter an electron and make gamma+A reaction
G4double iniE=theElectronKinEnergy+me; // Initial total energy of electron
G4double finE=iniE-photonEnergy; // Final total energy of electron
theResult.SetEnergyChange(finE-me); // Modifies the KINETIC ENERGY (Why not in the name?)
G4double EEm=iniE*finE-me2; // Just an intermediate value to avoid "2*"
G4double iniP=sqrt(iniE*iniE-me2); // Initial momentum of the electron
G4double finP=sqrt(finE*finE-me2); // Final momentum of the electron
G4double cost=(EEm+EEm-photonQ2)/iniP/finP; // cos(theta) for the electron scattering
if(cost>1.) cost=1.;
if(cost<-1.) cost=-1.;
G4ThreeVector dir=theElectron->GetMomentumDirection(); // Direction of primary electron
G4ThreeVector ort=dir.orthogonal(); // Not normed orthogonal vector (!) (to dir)
G4ThreeVector ortx = ort.unit(); // First unit vector orthogonal to the direction
G4ThreeVector orty = dir.cross(ortx); // Second unit vector orthoganal to the direction
G4double sint=sqrt(1.-cost*cost); // Perpendicular component
G4double phi=dpi*G4UniformRand(); // phi of scattered electron
G4double sinx=sint*sin(phi); // x-component
G4double siny=sint*cos(phi); // y-component
G4ThreeVector findir=cost*dir+sinx*ortx+siny*orty;
theResult.SetMomentumDirectionChange(findir); // new direction for the electron
G4ThreeVector photonMomentum=iniP*dir-finP*findir;
G4DynamicParticle localGamma(G4Gamma::GammaDefinition(), photonEnergy, photonMomentum);
//G4DynamicParticle localGamma(G4Gamma::GammaDefinition(), photonDirection, photonEnergy);
//G4DynamicParticle localGamma(G4Gamma::GammaDefinition(), photonLorentzVector);
G4ThreeVector position(0,0,0);
G4Track localTrack(&localGamma, 0., position);
G4VParticleChange * result = theModel.ApplyYourself(localTrack, aTargetNucleus, &theResult);
G4VParticleChange * result;
if(photonEnergy < 3*GeV)
{
result = theLEModel.ApplyYourself(localTrack, aTargetNucleus, &theResult);
}
else
{
theHEModel->SetTransport(theCascade);
theHEModel->SetHighEnergyGenerator(&theStringModel);
theStringDecay = new G4ExcitedStringDecay(&theFragmentation);
theStringModel.SetFragmentationModel(theStringDecay);
theHEModel->SetMinEnergy(2.5*GeV);
theHEModel->SetMaxEnergy(100*TeV);
G4VParticleChange * aResult = theHEModel->ApplyYourself(localTrack, aTargetNucleus);
theResult.SetNumberOfSecondaries(aResult->GetNumberOfSecondaries());
for(G4int all = 0; all < aResult->GetNumberOfSecondaries(); all++)
{
theResult.AddSecondary(aResult->GetSecondary(all));
}
result = &theResult;
}
return result;
}
@@ -20,6 +20,15 @@
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4GammaNuclearReaction.hh,v 1.8 2002/06/06 10:44:13 jwellisc Exp $
// GEANT4 tag $Name: geant4-04-01 $
//
//
// GEANT4 physics class: G4GammaNuclearReaction -- header file
// Created: J.P. Wellisch, 2000/08/18
// The last update: J.P. Wellisch, Thu Jun 6 2002.
//
#ifndef G4GammaNuclearReaction_h
#define G4GammaNuclearReaction_h
@@ -35,7 +35,7 @@ G4StringChipsInterface::G4StringChipsInterface()
G4cin >> theEnergyLossPerFermi;
#endif
theEnergyLossPerFermi *= GeV;
theEnergyLossPerFermi = 0.5*GeV;
// theEnergyLossPerFermi = 1.*GeV;
}
@@ -283,9 +283,9 @@ Propagate(G4KineticTrackVector* theSecondaries, G4V3DNucleus* theNucleus)
if (particleCount!=0)
{
G4QEnvironment* pan= new G4QEnvironment(projHV, targetPDGCode);
output = pan->Fragment();
G4std::for_each(projHV.begin(), projHV.end(), DeleteQHadron());
projHV.clear();
output = pan->Fragment();
delete pan;
}
else