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.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 );