Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -23,26 +23,12 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// G4ParticleMessenger class implementation
//
//
//
//---------------------------------------------------------------
//
// G4ParticleMessenger.cc
//
// Description:
// This is a messenger class to interface to exchange information
// between Particle related classes and UI.
//
// History:
// 13 June 1997, H. Kurashige : The 1st version created.
// 10 Nov. 1997 H. Kurashige : fixed bugs
// 08 Jan. 1998 H. Kurashige : new UIcommnds
// 08 June 1998, H. Kurashige : remove fProcessManagerMessenger
// 25 Nov. 1998, H. Kurashige : add /particle/find
//---------------------------------------------------------------
// Author: H. Kurashige, 13 June 1997 - 1st version created
// --------------------------------------------------------------------
#include "G4ios.hh" // Include from 'system'
#include "G4ios.hh"
#include <iomanip> // Include from 'system'
#include "G4ParticleMessenger.hh"
@@ -56,27 +42,31 @@
#include "G4ParticleDefinition.hh"
#include "G4ParticlePropertyMessenger.hh"
// --------------------------------------------------------------------
G4ParticleMessenger::G4ParticleMessenger(G4ParticleTable* pTable)
{
// get the pointer to ParticleTable
if ( pTable == 0) {
if ( pTable == nullptr)
{
theParticleTable = G4ParticleTable::GetParticleTable();
} else {
}
else
{
theParticleTable = pTable;
}
//Directory /particle/
// Directory /particle/
thisDirectory = new G4UIdirectory("/particle/");
thisDirectory->SetGuidance("Particle control commands.");
//Commnad /particle/select
// Command /particle/select
selectCmd = new G4UIcmdWithAString("/particle/select",this);
selectCmd->SetGuidance("Select particle ");
selectCmd->SetDefaultValue("none");
selectCmd->SetParameterName("particle name", false);
selectCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
//Commnad /particle/list
// Command /particle/list
listCmd = new G4UIcmdWithAString("/particle/list",this);
listCmd->SetGuidance("List name of particles.");
listCmd->SetGuidance(" all(default)/lepton/baryon/meson/nucleus/quarks");
@@ -85,20 +75,20 @@ G4ParticleMessenger::G4ParticleMessenger(G4ParticleTable* pTable)
listCmd->SetCandidates("all lepton baryon meson nucleus quarks");
listCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
//Commnad /particle/find
// Command /particle/find
findCmd = new G4UIcmdWithAnInteger("/particle/find",this);
findCmd->SetGuidance("Find particle by encoding");
findCmd->SetDefaultValue(0);
findCmd->SetParameterName("encoding", false);
findCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
//Commnad /particle/createAllIon
// Command /particle/createAllIon
createAllIonCmd = new G4UIcmdWithoutParameter("/particle/createAllIon",this);
createAllIonCmd->SetGuidance("Create All ions (ground state)");
createAllIonCmd->AvailableForStates(G4State_Idle);
createAllIonCmd->SetToBeBroadcasted(false);
//Commnad /particle/createAllIsomer
// Command /particle/createAllIsomer
createAllIsomerCmd = new G4UIcmdWithoutParameter("/particle/createAllIsomer",this);
createAllIsomerCmd->SetGuidance("Create All isomers");
createAllIsomerCmd->AvailableForStates(G4State_Idle);
@@ -114,13 +104,11 @@ G4ParticleMessenger::G4ParticleMessenger(G4ParticleTable* pTable)
verboseCmd->SetDefaultValue(0);
verboseCmd->SetRange("verbose_level >=0");
currentParticle = 0;
//UI messenger for Particle Properties
// UI messenger for Particle Properties
fParticlePropertyMessenger = new G4ParticlePropertyMessenger(theParticleTable);
}
// --------------------------------------------------------------------
G4ParticleMessenger::~G4ParticleMessenger()
{
delete fParticlePropertyMessenger;
@@ -135,79 +123,97 @@ G4ParticleMessenger::~G4ParticleMessenger()
delete thisDirectory;
}
void G4ParticleMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
// --------------------------------------------------------------------
void G4ParticleMessenger::SetNewValue(G4UIcommand* command, G4String newValues)
{
if( command==listCmd ){
//Commnad /particle/List
if( command==listCmd )
{
// Command /particle/List
G4int counter = 0;
G4ParticleTable::G4PTblDicIterator *piter = theParticleTable->GetIterator();
piter -> reset();
while( (*piter)() ){// Loop checking, 09.08.2015, K.Kurashige
G4ParticleDefinition *particle = piter->value();
if ((newValues=="all") || (newValues==particle->GetParticleType())) {
while( (*piter)() ) // Loop checking, 09.08.2015, K.Kurashige
{
G4ParticleDefinition* particle = piter->value();
if ((newValues=="all") || (newValues==particle->GetParticleType()))
{
G4cout << std::setw(19) << particle->GetParticleName();
if ((counter++)%4 == 3) {
G4cout << G4endl;
} else {
G4cout << ",";
}
if ((counter++)%4 == 3)
{
G4cout << G4endl;
}
else
{
G4cout << ",";
}
}
}
G4cout << G4endl;
if (counter == 0) G4cout << newValues << " is not found " << G4endl;
if (counter == 0) { G4cout << newValues << " is not found " << G4endl; }
//Command /particle/select
// Command /particle/select
// set candidate List
G4String candidates("none");
piter -> reset();
while( (*piter)() ){// Loop checking, 09.08.2015, K.Kurashige
G4ParticleDefinition *particle = piter->value();
while( (*piter)() ) // Loop checking, 09.08.2015, K.Kurashige
{
G4ParticleDefinition* particle = piter->value();
candidates += " " + particle->GetParticleName();
}
selectCmd->SetCandidates((const char *)(candidates));
} else if( command==selectCmd ){
//Commnad /particle/select
currentParticle = theParticleTable->FindParticle(newValues);
if(currentParticle == 0) {
G4cout << "Unknown particle [" << newValues << "]. Command ignored." << G4endl;
}
} else if( command==findCmd ){
//Commnad /particle/find
G4ParticleDefinition* tmp = theParticleTable->FindParticle( findCmd->GetNewIntValue(newValues));
if(tmp == 0) {
G4cout << "Unknown particle [" << newValues << "]. Command ignored." << G4endl;
} else {
}
else if( command==selectCmd )
{
// Command /particle/select
theParticleTable->SelectParticle(newValues);
}
else if( command==findCmd )
{
// Command /particle/find
G4ParticleDefinition* tmp
= theParticleTable->FindParticle( findCmd->GetNewIntValue(newValues));
if(tmp == nullptr)
{
G4cout << "Unknown particle [" << newValues << "]. Command ignored."
<< G4endl;
}
else
{
G4cout << tmp->GetParticleName() << G4endl;
tmp->DumpTable();
}
} else if( command==createAllIonCmd ) {
//Commnad /particle/createAllIon
}
else if( command==createAllIonCmd )
{
// Command /particle/createAllIon
theParticleTable->GetIonTable()->CreateAllIon();
} else if( command==createAllIsomerCmd ) {
//Commnad /particle/createAllIsomer
}
else if( command==createAllIsomerCmd )
{
// Command /particle/createAllIsomer
theParticleTable->GetIonTable()->CreateAllIsomer();
} else if( command==verboseCmd ) {
//Commnad /particle/verbose
}
else if( command==verboseCmd )
{
// Command /particle/verbose
theParticleTable->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues));
}
}
G4String G4ParticleMessenger::GetCurrentValue(G4UIcommand * command)
// --------------------------------------------------------------------
G4String G4ParticleMessenger::GetCurrentValue(G4UIcommand* command)
{
if( command==selectCmd ){
//Command /particle/select
if( command==selectCmd )
{
// Command /particle/select
// set candidate List
G4String candidates("none");
G4ParticleTable::G4PTblDicIterator *piter = theParticleTable->GetIterator();
G4ParticleTable::G4PTblDicIterator* piter = theParticleTable->GetIterator();
piter -> reset();
while( (*piter)() ){// Loop checking, 09.08.2015, K.Kurashige
while( (*piter)() ) // Loop checking, 09.08.2015, K.Kurashige
{
G4ParticleDefinition *particle = piter->value();
candidates += " " + particle->GetParticleName();
}
@@ -215,21 +221,20 @@ G4String G4ParticleMessenger::GetCurrentValue(G4UIcommand * command)
static const G4String noName("none");
// current value
if(currentParticle == 0) {
if(currentParticle == nullptr)
{
// no particle is selected. return null
return noName;
} else {
}
else
{
return currentParticle->GetParticleName();
}
} else if( command==verboseCmd ){
//Commnad /particle/verbose
}
else if( command==verboseCmd )
{
// Command /particle/verbose
return verboseCmd->ConvertToString(theParticleTable->GetVerboseLevel());
}
return "";
}