Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -33,7 +33,6 @@
#include "EventAction.hh"
#include "TrackingAction.hh"
#include "SteppingAction.hh"
#include "SteppingVerbose.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -73,10 +72,3 @@ void ActionInitialization::Build() const
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VSteppingVerbose* ActionInitialization::InitializeSteppingVerbose() const
{
return new SteppingVerbose();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -40,6 +40,7 @@
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4RayleighScattering.hh"
#include "G4eMultipleScattering.hh"
#include "G4eIonisation.hh"
@@ -72,8 +73,10 @@ ElectromagneticPhysics::ElectromagneticPhysics(const G4String& name)
G4EmParameters* param = G4EmParameters::Instance();
param->SetDefaults();
param->SetVerbose(0);
param->SetStepFunction(1., 1*mm); //default= 0.1, 100*um
param->SetStepFunctionMuHad(1., 1*mm);
param->SetStepFunction(0.2, 1*mm); //default= 0.1, 100*um
param->SetStepFunctionMuHad(0.2, 1*mm);
param->SetStepFunctionLightIons(0.2, 100*um);
param->SetStepFunctionIons(0.2, 50*um);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -96,7 +99,8 @@ void ElectromagneticPhysics::ConstructProcess()
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
ph->RegisterProcess(new G4RayleighScattering, particle);
ph->RegisterProcess(new G4PhotoElectricEffect, particle);
ph->RegisterProcess(new G4ComptonScattering, particle);
ph->RegisterProcess(new G4GammaConversion, particle);
@@ -37,10 +37,12 @@
// Processes
#include "G4PhotoNuclearProcess.hh"
#include "G4HadronInelasticProcess.hh"
#include "G4LowEGammaNuclearModel.hh"
#include "G4CascadeInterface.hh"
#include "G4PhotoNuclearCrossSection.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -58,7 +60,8 @@ GammaNuclearPhysics::~GammaNuclearPhysics()
void GammaNuclearPhysics::ConstructProcess()
{
G4PhotoNuclearProcess* process = new G4PhotoNuclearProcess();
G4HadronInelasticProcess* process = new G4HadronInelasticProcess( "photonNuclear", G4Gamma::Definition() );
process->AddDataSet( new G4PhotoNuclearCrossSection );
// to not register a model, set Emax=0; eg. Emax1 = 0.
const G4double Emax1 = 200*MeV, Emax2 = 10*GeV;
@@ -0,0 +1,79 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file hadronic/Hadr03/src/GammaNuclearPhysicsLEND.cc
/// \brief Implementation of the GammaNuclearPhysicsLEND class
//
// $Id: GammaNuclearPhysics.cc 66587 2012-12-21 11:06:44Z ihrivnac $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "GammaNuclearPhysicsLEND.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
// Processes
#include "G4HadronInelasticProcess.hh"
#include "G4LENDorBERTModel.hh"
#include "G4LENDCombinedCrossSection.hh"
#include "G4PhotoNuclearCrossSection.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GammaNuclearPhysicsLEND::GammaNuclearPhysicsLEND(const G4String& name)
: G4VPhysicsConstructor(name)
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
GammaNuclearPhysicsLEND::~GammaNuclearPhysicsLEND()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void GammaNuclearPhysicsLEND::ConstructProcess()
{
G4ProcessManager* pManager = G4Gamma::Gamma()->GetProcessManager();
//
G4HadronInelasticProcess* process = new G4HadronInelasticProcess( "photonNuclear", G4Gamma::Definition() );
process->AddDataSet( new G4PhotoNuclearCrossSection );
//
G4LENDorBERTModel* lend = new G4LENDorBERTModel(G4Gamma::Gamma());
lend->SetMaxEnergy(20*MeV);
process->RegisterMe(lend);
//
G4LENDCombinedCrossSection* lendXS =
new G4LENDCombinedCrossSection(G4Gamma::Gamma());
process->AddDataSet(lendXS);
//
pManager->AddDiscreteProcess(process);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -44,12 +44,15 @@
#include "G4IonINCLXXPhysics.hh"
#include "G4StoppingPhysics.hh"
#include "GammaNuclearPhysics.hh"
#include "GammaNuclearPhysicsLEND.hh"
#include "ElectromagneticPhysics.hh"
#include "G4EmStandardPhysics.hh"
#include "G4EmStandardPhysics_option3.hh"
#include "G4DecayPhysics.hh"
#include "G4RadioactiveDecayPhysics.hh"
#include "StepMaxBuilder.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -62,16 +65,15 @@ PhysicsList::PhysicsList()
//add new units
//
new G4UnitDefinition( "millielectronVolt", "meV", "Energy", 1.e-3*eV);
new G4UnitDefinition( "mm2/g", "mm2/g", "Surface/Mass", mm2/g);
new G4UnitDefinition( "um2/mg", "um2/mg","Surface/Mass", um*um/mg);
// Hadron Elastic scattering
RegisterPhysics( new HadronElasticPhysicsHP(verb) );
// Hadron Inelastic Physics
RegisterPhysics( new G4HadronPhysicsFTFP_BERT_HP(verb));
////RegisterPhysics( new G4HadronPhysicsQGSP_BIC_HP(verb));
////RegisterPhysics( new G4HadronPhysicsFTFP_BERT_HP(verb));
RegisterPhysics( new G4HadronPhysicsQGSP_BIC_HP(verb));
////RegisterPhysics( new G4HadronInelasticQBBC(verb));
////RegisterPhysics( new G4HadronPhysicsINCLXX(verb));
@@ -87,6 +89,7 @@ PhysicsList::PhysicsList()
// Gamma-Nuclear Physics
RegisterPhysics( new GammaNuclearPhysics("gamma"));
////RegisterPhysics( new GammaNuclearPhysicsLEND("gamma"));
// EM physics
RegisterPhysics(new ElectromagneticPhysics());
+15 -8
View File
@@ -86,11 +86,11 @@ void Run::CountProcesses(const G4VProcess* process)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::ParticleCount(G4int k, G4String name, G4double Ekin)
void Run::ParticleCount(G4int k, G4String name, G4double Ekin, G4double meanLife)
{
std::map<G4String, ParticleData>::iterator it = fParticleDataMap[k].find(name);
if ( it == fParticleDataMap[k].end()) {
(fParticleDataMap[k])[name] = ParticleData(1, Ekin, Ekin, Ekin);
(fParticleDataMap[k])[name] = ParticleData(1, Ekin, Ekin, Ekin, meanLife);
}
else {
ParticleData& data = it->second;
@@ -100,7 +100,8 @@ void Run::ParticleCount(G4int k, G4String name, G4double Ekin)
G4double emin = data.fEmin;
if (Ekin < emin) data.fEmin = Ekin;
G4double emax = data.fEmax;
if (Ekin > emax) data.fEmax = Ekin;
if (Ekin > emax) data.fEmax = Ekin;
data.fTmean = meanLife;
}
}
@@ -192,7 +193,8 @@ void Run::Merge(const G4Run* run)
= ParticleData(localData.fCount,
localData.fEmean,
localData.fEmin,
localData.fEmax);
localData.fEmax,
localData.fTmean);
}
else {
ParticleData& data = (fParticleDataMap[k])[name];
@@ -201,7 +203,8 @@ void Run::Merge(const G4Run* run)
G4double emin = localData.fEmin;
if (emin < data.fEmin) data.fEmin = emin;
G4double emax = localData.fEmax;
if (emax > data.fEmax) data.fEmax = emax;
if (emax > data.fEmax) data.fEmax = emax;
data.fTmean = localData.fTmean;
}
}
}
@@ -290,13 +293,16 @@ void Run::EndOfRun()
G4int count = data.fCount;
G4double eMean = data.fEmean/count;
G4double eMin = data.fEmin;
G4double eMax = data.fEmax;
G4double eMax = data.fEmax;
G4double meanLife = data.fTmean;
G4cout << " " << std::setw(13) << name << ": " << std::setw(7) << count
<< " Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy")
<< "\t( " << G4BestUnit(eMin, "Energy")
<< " --> " << G4BestUnit(eMax, "Energy")
<< ")" << G4endl;
<< " --> " << G4BestUnit(eMax, "Energy") << ")";
if (meanLife >= 0.)
G4cout << "\tmean life = " << G4BestUnit(meanLife, "Time") << G4endl;
else G4cout << "\tstable" << G4endl;
}
}
//particles emerging from absorbers
@@ -312,6 +318,7 @@ void Run::EndOfRun()
G4double eMean = data.fEmean/count;
G4double eMin = data.fEmin;
G4double eMax = data.fEmax;
///G4double meanLife = data.fTmean;
G4cout << " " << std::setw(13) << name << ": " << std::setw(7) << count
<< " Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy")
@@ -1,160 +0,0 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file SteppingVerbose.cc
/// \brief Implementation of the SteppingVerbose class
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "SteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4ParticleTypes.hh"
#include "G4UnitsTable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingVerbose::SteppingVerbose()
: G4SteppingVerbose()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
SteppingVerbose::~SteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
//Step zero
//
if( verboseLevel > 0 ){
G4cout << std::setw( 5) << "Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< std::setw(10) << fTrack->GetVolume()->GetName()
<< " initStep" << G4endl;
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << std::setw( 5) << "#Step#" << " "
<< std::setw( 6) << "X" << " "
<< std::setw( 6) << "Y" << " "
<< std::setw( 6) << "Z" << " "
<< std::setw( 9) << "KineE" << " "
<< std::setw( 9) << "dEStep" << " "
<< std::setw(10) << "StepLeng"
<< std::setw(10) << "TrakLeng"
<< std::setw(10) << "Volume" << " "
<< std::setw(10) << "Process" << G4endl;
}
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber() << " "
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().x(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().y(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetPosition().z(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetKineticEnergy(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")
<< std::setw(6) << G4BestUnit(fStep->GetStepLength(),"Length")
<< std::setw(6) << G4BestUnit(fTrack->GetTrackLength(),"Length")
<< std::setw(10) << fTrack->GetVolume()->GetName();
const G4VProcess* process
= fStep->GetPostStepPoint()->GetProcessDefinedStep();
G4String procName = " UserLimit";
if (process) procName = process->GetProcessName();
if (fStepStatus == fWorldBoundary) procName = "OutOfWorld";
G4cout << " " << std::setw(10) << procName;
G4cout << G4endl;
if( verboseLevel == 2 ){
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << "\n :----- List of secondaries ----------------"
<< G4endl;
G4cout.precision(4);
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " "
<< std::setw(13)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName()
<< ": energy ="
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< " time ="
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetGlobalTime(),"Time");
G4cout << G4endl;
}
G4cout << " :------------------------------------------\n"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -34,6 +34,7 @@
#include "Run.hh"
#include "HistoManager.hh"
#include "TrackingMessenger.hh"
#include "G4Track.hh"
#include "G4StepStatus.hh"
@@ -42,8 +43,18 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingAction::TrackingAction()
:G4UserTrackingAction()
{ }
:G4UserTrackingAction(), fTrackMessenger(nullptr),
fParticleCount(true)
{
fTrackMessenger = new TrackingMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingAction::~TrackingAction()
{
delete fTrackMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -51,12 +62,16 @@ void TrackingAction::PreUserTrackingAction(const G4Track* track)
{
//count secondary particles
if (track->GetTrackID() == 1) return;
G4int iabs = track->GetTouchableHandle()->GetCopyNumber();
G4String name = track->GetDefinition()->GetParticleName();
G4double energy = track->GetKineticEnergy();
Run* run = static_cast<Run*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
if(iabs > 0) run->ParticleCount(iabs,name,energy);
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
G4int iabs = track->GetTouchableHandle()->GetCopyNumber();
G4String name = track->GetDefinition()->GetParticleName();
G4double meanLife = track->GetDefinition()->GetPDGLifeTime();
G4double energy = track->GetKineticEnergy();
if (fParticleCount && (iabs > 0) && (meanLife != 0.))
run->ParticleCount(iabs,name,energy,meanLife);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -86,9 +101,10 @@ void TrackingAction::PostUserTrackingAction(const G4Track* track)
// count particles
const G4ParticleDefinition* particle = track->GetParticleDefinition();
G4String name = particle->GetParticleName();
G4double energy = track->GetKineticEnergy();
run->ParticleCount(0,name,energy);
G4String name = particle->GetParticleName();
G4double meanLife = particle->GetPDGLifeTime();
G4double energy = track->GetKineticEnergy();
run->ParticleCount(0,name,energy,meanLife);
////G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
}
@@ -0,0 +1,71 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// \file TrackingMessenger.cc
/// \brief Implementation of the TrackingMessenger class
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "TrackingMessenger.hh"
#include "TrackingAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingMessenger::TrackingMessenger(TrackingAction* trackA)
:G4UImessenger(),fTrackingAction(trackA),
fTrackingDir(nullptr),fCountCmd(nullptr)
{
fTrackingDir = new G4UIdirectory("/testhadr/tracking/");
fTrackingDir->SetGuidance("tracking commands");
fCountCmd = new G4UIcmdWithABool("/testhadr/tracking/countParticles",this);
fCountCmd->SetGuidance("count created particles");
fCountCmd->SetParameterName("flag",false);
fCountCmd->SetDefaultValue(true);
fCountCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingMessenger::~TrackingMessenger()
{
delete fCountCmd;
delete fTrackingDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TrackingMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if(command == fCountCmd)
{ fTrackingAction->SetParticleCount(fCountCmd->GetNewBoolValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......