Import Geant4 5.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:57:27 +02:00
parent 330b82b769
commit 37fff30d2e
5733 changed files with 263867 additions and 74574 deletions
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4EnergyRangeManager.hh,v 1.4 2001/08/01 17:03:23 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4EnergyRangeManager.hh,v 1.5 2002/12/12 19:16:52 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Hadronic Process: Energy Range Manager
// original by H.P. Wellisch
@@ -0,0 +1,41 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4HadLeadBias.hh,v 1.3 2002/12/13 09:06:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// --------------------------------------------------------------------
#ifndef G4HadLeadBias_h
#define G4HadLeadBias_h
#include "G4VLeadingParticleBiasing.hh"
#include "g4std/vector"
#include "G4VParticleChange.hh"
class G4HadLeadBias : public G4VLeadingParticleBiasing
{
public:
virtual G4VParticleChange * Bias(G4VParticleChange * result);
virtual ~G4HadLeadBias() {};
};
#endif
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -82,7 +82,7 @@
G4VParticleChange *PostStepDoIt(
const G4Track &aTrack, const G4Step &aStep )
{
if(0==theLastCrossSection)
if(0==theLastCrossSection&&!getenv("DebugNeutronHP"))
{
G4cerr << "G4HadronInelasticProcess: called for final state, while cross-section was zero"<<G4endl;
G4cerr << " Returning empty particle change...."<<G4endl;
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4HadronicInteraction.hh,v 1.8 2001/11/26 16:28:18 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4HadronicInteraction.hh,v 1.10 2002/12/12 19:16:52 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Hadronic Interaction abstract base class
// This class is the base class for the model classes.
@@ -67,7 +67,9 @@
}
virtual ~G4HadronicInteraction()
{ }
{
G4HadronicInteractionRegistry::RemoveMe(this);
}
private:
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -34,7 +34,7 @@ class G4HadronicInteractionRegistry
~G4HadronicInteractionRegistry();
static void RegisterMe(G4HadronicInteraction * aModel);
static void RemoveMe(G4HadronicInteraction * aModel){};
static void RemoveMe(G4HadronicInteraction * aModel);
protected:
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -51,6 +51,7 @@
#include "g4std/vector"
#include "G4VIsotopeProduction.hh"
#include "G4IsoParticleChange.hh"
#include "G4HadLeadBias.hh"
class G4HadronicProcess : public G4VDiscreteProcess
{
@@ -58,10 +59,16 @@
G4HadronicProcess( const G4String &processName = "Hadronic" ) :
G4VDiscreteProcess( processName )
{ isoIsOnAnyway = 0; }
{
isoIsOnAnyway = 0;
theBias = new G4HadLeadBias();
}
virtual ~G4HadronicProcess()
{ unsigned int i; for(i=0; i<theProductionModels.size(); i++) delete theProductionModels[i]; }
{
unsigned int i; for(i=0; i<theProductionModels.size(); i++) delete theProductionModels[i];
delete theBias;
}
inline void RegisterMe( G4HadronicInteraction *a )
{ GetManagerPointer()->RegisterMe( a ); }
@@ -155,6 +162,8 @@
G4IsoParticleChange theIsoPC;
G4std::vector<G4VIsotopeProduction *> theProductionModels;
G4VLeadingParticleBiasing * theBias;
static G4IsoParticleChange * theIsoResult;
static G4IsoParticleChange * theOldIsoResult;
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4InelasticInteraction.hh,v 1.6 2001/12/07 11:18:38 hpw Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4InelasticInteraction.hh,v 1.7 2002/12/12 19:16:53 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Hadronic Process: Inelastic Interaction
// This class is an abstract base class, since the pure virtual
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -0,0 +1,39 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4VLeadingParticleBiasing.hh,v 1.3 2002/12/13 09:06:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// --------------------------------------------------------------------
#ifndef G4VLeadingParticleBiasing_h
#define G4VLeadingParticleBiasing_h
class G4VParticleChange;
class G4VLeadingParticleBiasing
{
public:
virtual G4VParticleChange * Bias(G4VParticleChange * result) = 0;
};
#endif
@@ -14,15 +14,15 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4EnergyRangeManager.cc,v 1.6 2002/06/07 15:30:53 jwellisc Exp $
// GEANT4 tag $Name: geant4-04-01 $
// $Id: G4EnergyRangeManager.cc,v 1.7 2002/12/12 19:16:53 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
//
// Hadronic Process: Energy Range Manager
// original by H.P. Wellisch
@@ -0,0 +1,164 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
#include "G4HadLeadBias.hh"
#include "G4Gamma.hh"
#include "G4PionZero.hh"
#include "Randomize.hh"
#include "G4ParticleChange.hh"
G4VParticleChange * G4HadLeadBias::Bias(G4VParticleChange * result)
{
G4cerr << "bias enter"<<G4endl;
G4int nMeson(0), nBaryon(0), npi0(0), ngamma(0), nLepton(0);
G4int i(0);
G4int maxE = -1;
G4double emax = 0;
G4ParticleChange * temp;
if(result->GetStatusChange()==fAlive)
{
temp = dynamic_cast<G4ParticleChange *>(result);
if(temp) emax = temp->GetEnergyChange();
}
G4cout << "max energy "<<G4endl;
for(i=0;i<result->GetNumberOfSecondaries();i++)
{
if(result->GetSecondary(i)->GetKineticEnergy()>emax)
{
maxE = i;
emax = result->GetSecondary(i)->GetKineticEnergy();
}
}
G4cout <<"loop1"<<G4endl;
for(i=0; i<result->GetNumberOfSecondaries(); i++)
{
G4Track* aSecTrack = result->GetSecondary(i);
if(i==maxE)
{
}
else if(aSecTrack->GetDefinition()->GetBaryonNumber()!=0)
{
nBaryon++;
}
else if(aSecTrack->GetDefinition()->GetLeptonNumber()!=0)
{
nLepton++;
}
else if(aSecTrack->GetDefinition()==G4Gamma::Gamma())
{
ngamma++;
}
else if(aSecTrack->GetDefinition()==G4PionZero::PionZero())
{
npi0++;
}
else
{
nMeson++;
}
}
G4cout << "BiasDebug 1 = "<<result->GetNumberOfSecondaries()<<" "
<<nMeson<<" "<< nBaryon<<" "<< npi0<<" "<< ngamma<<" "<< nLepton<<G4endl;
G4double mesonWeight = nMeson;
G4double baryonWeight = nBaryon;
G4double gammaWeight = ngamma;
G4double npi0Weight = npi0;
G4double leptonWeight = nLepton;
G4int randomMeson = static_cast<G4int>((nMeson+1)*G4UniformRand());
G4int randomBaryon = static_cast<G4int>((nBaryon+1)*G4UniformRand());
G4int randomGamma = static_cast<G4int>((ngamma+1)*G4UniformRand());
G4int randomPi0 = static_cast<G4int>((npi0+1)*G4UniformRand());
G4int randomLepton = static_cast<G4int>((nLepton+1)*G4UniformRand());
G4std::vector<G4Track*> buffer;
G4int cMeson(0), cBaryon(0), cpi0(0), cgamma(0), cLepton(0);
for(i=0; i<result->GetNumberOfSecondaries(); i++)
{
G4bool aCatch = false;
G4double weight = 1;
G4Track* aSecTrack = result->GetSecondary(i);
if(i==maxE)
{
aCatch = true;
weight = 1;
}
else if(aSecTrack->GetDefinition()->GetBaryonNumber()!=0)
{
if(++cBaryon==randomBaryon)
{
aCatch = true;
weight = baryonWeight;
}
}
else if(aSecTrack->GetDefinition()->GetLeptonNumber()!=0)
{
if(++cLepton==randomLepton)
{
aCatch = true;
weight = leptonWeight;
}
}
else if(aSecTrack->GetDefinition()==G4Gamma::Gamma())
{
if(++cgamma==randomGamma)
{
aCatch = true;
weight = gammaWeight;
}
}
else if(aSecTrack->GetDefinition()==G4PionZero::PionZero())
{
if(++cpi0==randomPi0)
{
aCatch = true;
weight = npi0Weight;
}
}
else
{
if(++cMeson==randomMeson)
{
aCatch = true;
weight = mesonWeight;
}
}
if(aCatch)
{
buffer.push_back(aSecTrack);
aSecTrack->SetWeight(aSecTrack->GetWeight()*weight);
}
else
{
delete aSecTrack;
}
}
result->Clear();
result->SetNumberOfSecondaries(buffer.size());
// G4cerr << "pre"<<G4endl;
for(i=0;i<static_cast<G4int>(buffer.size());i++)
{
result->AddSecondary(buffer[i]);
}
G4cerr << "bias exit"<<G4endl;
return result;
}
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -32,11 +32,18 @@ RegisterMe(G4HadronicInteraction * aModel)
theRegistry.AddModel(aModel);
}
void G4HadronicInteractionRegistry::
RemoveMe(G4HadronicInteraction * aModel)
{
theRegistry.allModels.erase(G4std::find(theRegistry.allModels.begin(), theRegistry.allModels.end(), aModel));
theRegistry.nModels = theRegistry.allModels.size();
}
G4HadronicInteractionRegistry::~G4HadronicInteractionRegistry()
{
for(G4int i=0; i<nModels; i++)
while(allModels.size()!=0)
{
delete allModels[i];
delete allModels.front();
}
}
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -125,6 +125,7 @@
result = DoIsotopeCounting(result, aTrack, targetNucleus);
}
}
if(getenv("LeadingParticleBiasingActivated")) result = theBias->Bias(result);
return result;
}
@@ -14,7 +14,7 @@
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * authors in the GEANT4 collaboration. *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
@@ -207,30 +207,37 @@
// original was an anti-particle and annihilation has taken place
annihilation = true;
G4double ekcor = 1.0;
G4double ek = originalIncident->GetKineticEnergy()/GeV;
const G4double tarmas = originalTarget->GetDefinition()->GetPDGMass()/GeV;
if( ek > 1.0 )ekcor = 1./ek;
G4double ek = originalIncident->GetKineticEnergy();
G4double ekOrg = ek;
const G4double tarmas = originalTarget->GetDefinition()->GetPDGMass();
if( ek > 1.0*GeV )ekcor = 1./(ek/GeV);
const G4double atomicWeight = targetNucleus.GetN();
// ek = 2*tarmas + ek*(1.+ekcor/atomicWeight);
modifiedOriginal.SetKineticEnergy( ek*GeV );
ek = 2*tarmas + ek*(1.+ekcor/atomicWeight);
G4double tkin = targetNucleus.Cinema( ek );
ek += tkin;
ekOrg += tkin;
modifiedOriginal.SetKineticEnergy( ekOrg );
//
// evaporation -- re-calculate black track energies
// this was Done already just before the cascade
//
G4double tkin = targetNucleus.EvaporationEffects( ek*GeV )/GeV;
ek -= tkin;
ek = G4std::max( 0.0001, ek );
modifiedOriginal.SetKineticEnergy( ek*GeV );
G4double amas = originalIncident->GetDefinition()->GetPDGMass()/GeV;
G4double et = ek + amas;
tkin = targetNucleus.EvaporationEffects( ek );
ekOrg -= tkin;
ekOrg = G4std::max( 0.0001*GeV, ekOrg );
modifiedOriginal.SetKineticEnergy( ekOrg );
G4double amas = originalIncident->GetDefinition()->GetPDGMass();
G4double et = ekOrg + amas;
G4double p = sqrt( abs(et*et-amas*amas) );
G4double pp = modifiedOriginal.GetMomentum().mag()/GeV;
G4double pp = modifiedOriginal.GetMomentum().mag();
if( pp > 0.0 )
{
G4ThreeVector momentum = modifiedOriginal.GetMomentum();
modifiedOriginal.SetMomentum( momentum * (p/pp) );
}
if( ek <= 0.0001 )
if( ekOrg <= 0.0001 )
{
modifiedOriginal.SetKineticEnergy( 0.0 );
modifiedOriginal.SetMomentum( 0.0, 0.0, 0.0 );