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......
@@ -76,10 +75,3 @@ void ActionInitialization::Build() const
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VSteppingVerbose* ActionInitialization::InitializeSteppingVerbose() const
{
return new SteppingVerbose();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -232,6 +232,7 @@ void DetectorConstruction::SetMaterial(G4String materialChoice)
void DetectorConstruction::SetRadius(G4double value)
{
fRadius = value;
fWorldSize = 1.1*fRadius;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
@@ -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,9 @@ 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,80 @@
//
// ********************************************************************
// * 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......
@@ -45,9 +45,11 @@
#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"
@@ -61,10 +63,9 @@ 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) );
@@ -88,10 +89,11 @@ PhysicsList::PhysicsList()
// Gamma-Nuclear Physics
RegisterPhysics( new GammaNuclearPhysics("gamma"));
////RegisterPhysics( new GammaNuclearPhysicsLEND("gamma"));
// EM physics
RegisterPhysics(new ElectromagneticPhysics());
////RegisterPhysics(new G4EmStandardPhysics());
////RegisterPhysics(new G4EmStandardPhysics_option3());
// Decay
RegisterPhysics(new G4DecayPhysics());
+50 -33
View File
@@ -77,11 +77,11 @@ void Run::CountProcesses(const G4VProcess* process)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void Run::ParticleCount(G4String name, G4double Ekin)
void Run::ParticleCount(G4String name, G4double Ekin, G4double meanLife)
{
std::map<G4String, ParticleData>::iterator it = fParticleDataMap1.find(name);
if ( it == fParticleDataMap1.end()) {
fParticleDataMap1[name] = ParticleData(1, Ekin, Ekin, Ekin);
fParticleDataMap1[name] = ParticleData(1, Ekin, Ekin, Ekin, meanLife);
}
else {
ParticleData& data = it->second;
@@ -91,7 +91,8 @@ void Run::ParticleCount(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;
}
}
@@ -116,7 +117,7 @@ void Run::ParticleFlux(G4String name, G4double Ekin)
{
std::map<G4String, ParticleData>::iterator it = fParticleDataMap2.find(name);
if ( it == fParticleDataMap2.end()) {
fParticleDataMap2[name] = ParticleData(1, Ekin, Ekin, Ekin);
fParticleDataMap2[name] = ParticleData(1, Ekin, Ekin, Ekin, -1*ns);
}
else {
ParticleData& data = it->second;
@@ -126,7 +127,8 @@ void Run::ParticleFlux(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 = -1*ns;
}
}
@@ -175,7 +177,8 @@ void Run::Merge(const G4Run* run)
= ParticleData(localData.fCount,
localData.fEmean,
localData.fEmin,
localData.fEmax);
localData.fEmax,
localData.fTmean);
}
else {
ParticleData& data = fParticleDataMap1[name];
@@ -184,7 +187,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;
}
}
@@ -200,7 +204,8 @@ void Run::Merge(const G4Run* run)
= ParticleData(localData.fCount,
localData.fEmean,
localData.fEmin,
localData.fEmax);
localData.fEmax,
localData.fTmean);
}
else {
ParticleData& data = fParticleDataMap2[name];
@@ -209,7 +214,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;
}
}
@@ -251,26 +257,6 @@ void Run::EndOfRun()
}
G4cout << G4endl;
//particles count
//
G4cout << "\n List of generated particles:" << G4endl;
std::map<G4String,ParticleData>::iterator itc;
for (itc = fParticleDataMap1.begin(); itc != fParticleDataMap1.end(); itc++) {
G4String name = itc->first;
ParticleData data = itc->second;
G4int count = data.fCount;
G4double eMean = data.fEmean/count;
G4double eMin = data.fEmin;
G4double eMax = data.fEmax;
G4cout << " " << std::setw(13) << name << ": " << std::setw(7) << count
<< " Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy")
<< "\t( " << G4BestUnit(eMin, "Energy")
<< " --> " << G4BestUnit(eMax, "Energy")
<< ")" << G4endl;
}
// compute mean Energy deposited and rms
//
G4int TotNbofEvents = numberOfEvent;
@@ -284,19 +270,50 @@ void Run::EndOfRun()
<< G4BestUnit(rmsEdep, "Energy")
<< G4endl;
// compute mean Energy flow and rms
// compute mean Energy leakage and rms
//
fEnergyFlow /= TotNbofEvents; fEnergyFlow2 /= TotNbofEvents;
G4double rmsEflow = fEnergyFlow2 - fEnergyFlow*fEnergyFlow;
if (rmsEflow>0.) rmsEflow = std::sqrt(rmsEflow);
else rmsEflow = 0.;
G4cout << " Mean energy flow per event = "
G4cout << " Mean energy leakage per event = "
<< G4BestUnit(fEnergyFlow,"Energy") << "; rms = "
<< G4BestUnit(rmsEflow, "Energy")
<< G4endl;
//energy balance
//
G4double Etot = fEnergyDeposit + fEnergyFlow;
G4cout << "\n total energy: Edep + Eleak = " << G4BestUnit(Etot, "Energy")
<< G4endl;
//particles at creation
//
if (fParticleDataMap1.size() > 0) {
G4cout << "\n List of particles at creation:" << G4endl;
std::map<G4String,ParticleData>::iterator itc;
for (itc = fParticleDataMap1.begin(); itc != fParticleDataMap1.end(); itc++) {
G4String name = itc->first;
ParticleData data = itc->second;
G4int count = data.fCount;
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")
<< "\t( " << G4BestUnit(eMin, "Energy")
<< " --> " << G4BestUnit(eMax, "Energy") << ")";
if (meanLife >= 0.)
G4cout << "\tmean life = " << G4BestUnit(meanLife, "Time") << G4endl;
else G4cout << "\tstable" << G4endl;
}
}
//particles flux
//emerging particles
//
G4cout << "\n List of particles emerging from the absorber :" << G4endl;
@@ -314,7 +331,7 @@ void Run::EndOfRun()
<< " Emean = " << std::setw(wid) << G4BestUnit(eMean, "Energy")
<< "\t( " << G4BestUnit(eMin, "Energy")
<< " --> " << G4BestUnit(eMax, "Energy")
<< ") \tEflow/event = " << G4BestUnit(Eflow, "Energy") << G4endl;
<< ") \tEleak/event = " << G4BestUnit(Eflow, "Energy") << G4endl;
}
//normalize histograms
@@ -1,157 +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) {
const std::vector<const G4Track*>* secondary
= fStep->GetSecondaryInCurrentStep();
size_t nbtrk = (*secondary).size();
if (nbtrk) {
G4cout << "\n :----- List of secondaries ----------------" << G4endl;
G4cout.precision(4);
for (size_t lp=0; lp<(*secondary).size(); lp++) {
G4cout << " "
<< std::setw(13)
<< (*secondary)[lp]->GetDefinition()->GetParticleName()
<< ": energy ="
<< std::setw(6)
<< G4BestUnit((*secondary)[lp]->GetKineticEnergy(),"Energy")
<< " time ="
<< std::setw(6)
<< G4BestUnit((*secondary)[lp]->GetGlobalTime(),"Time");
G4cout << G4endl;
}
G4cout << " :------------------------------------------\n" << G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -35,6 +35,7 @@
#include "Run.hh"
#include "EventAction.hh"
#include "HistoManager.hh"
#include "TrackingMessenger.hh"
#include "G4RunManager.hh"
#include "G4Track.hh"
@@ -47,27 +48,41 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingAction::TrackingAction(EventAction* event)
:G4UserTrackingAction(), fEventAction(event)
{ }
:G4UserTrackingAction(), fEventAction(event), fTrackMessenger(nullptr),
fParticleCount(true) , fKillNeutron(false)
{
fTrackMessenger = new TrackingMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingAction::~TrackingAction()
{
delete fTrackMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TrackingAction::PreUserTrackingAction(const G4Track* track)
{
//count secondary particles
if (track->GetTrackID() == 1) return;
G4String name = track->GetDefinition()->GetParticleName();
G4double energy = track->GetKineticEnergy();
if (track->GetTrackID() == 1) return;
Run* run = static_cast<Run*>(
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
run->ParticleCount(name,energy);
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
const G4ParticleDefinition* particle = track->GetParticleDefinition();
G4String name = particle->GetParticleName();
G4double meanLife = particle->GetPDGLifeTime();
G4double energy = track->GetKineticEnergy();
if (fParticleCount && (meanLife != 0.))
run->ParticleCount(name,energy,meanLife);
// histograms: energy at creation
//
G4AnalysisManager* analysis = G4AnalysisManager::Instance();
G4int ih = 0;
const G4ParticleDefinition* particle = track->GetParticleDefinition();
G4String type = particle->GetParticleType();
G4double charge = particle->GetPDGCharge();
if (charge > 3.) ih = 10;
@@ -85,11 +100,11 @@ void TrackingAction::PreUserTrackingAction(const G4Track* track)
if (ih > 0) analysis->FillH1(ih,energy);
//to force only 1 fission : kill secondary neutrons
///if (particle == G4Neutron::Neutron()) {
/// fEventAction->AddEdep(energy);
/// G4Track* aTrack = (G4Track*)track;
/// aTrack->SetTrackStatus(fStopAndKill);
///}
if (fKillNeutron && (particle == G4Neutron::Neutron())) {
fEventAction->AddEdep(energy);
G4Track* aTrack = (G4Track*)track;
aTrack->SetTrackStatus(fStopAndKill);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * 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),fKillCmd(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);
fKillCmd = new G4UIcmdWithABool("/testhadr/tracking/killNeutrons",this);
fKillCmd->SetGuidance("kill secondaries neutrons");
fKillCmd->SetParameterName("flag",false);
fKillCmd->SetDefaultValue(false);
fKillCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
TrackingMessenger::~TrackingMessenger()
{
delete fCountCmd;
delete fKillCmd;
delete fTrackingDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void TrackingMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if(command == fCountCmd)
{ fTrackingAction->SetParticleCount(fCountCmd->GetNewBoolValue(newValue));}
if(command == fKillCmd)
{ fTrackingAction->SetKillNeutrons(fKillCmd->GetNewBoolValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......