Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -31,22 +31,21 @@
|
||||
#include "B4bActionInitialization.hh"
|
||||
|
||||
#include "G4RunManagerFactory.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4SteppingVerbose.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIExecutive.hh"
|
||||
#include "G4VisExecutive.hh"
|
||||
#include "FTFP_BERT.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
namespace {
|
||||
void PrintUsage() {
|
||||
G4cerr << " Usage: " << G4endl;
|
||||
G4cerr << " exampleB4a [-m macro ] [-u UIsession] [-t nThreads]" << G4endl;
|
||||
G4cerr << " exampleB4a [-m macro ] [-u UIsession] [-t nThreads] [-vDefault]"
|
||||
<< G4endl;
|
||||
G4cerr << " note: -t option is available only for multi-threaded mode."
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -62,9 +61,10 @@ int main(int argc,char** argv)
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
G4String macro;
|
||||
G4String session;
|
||||
G4bool verboseBestUnits = true;
|
||||
#ifdef G4MULTITHREADED
|
||||
G4int nThreads = 0;
|
||||
#endif
|
||||
@@ -76,11 +76,15 @@ int main(int argc,char** argv)
|
||||
nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
|
||||
}
|
||||
#endif
|
||||
else if ( G4String(argv[i]) == "-vDefault" ) {
|
||||
verboseBestUnits = false;
|
||||
--i; // this option is not followed with a parameter
|
||||
}
|
||||
else {
|
||||
PrintUsage();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Detect interactive mode (if no macro provided) and define UI session
|
||||
//
|
||||
@@ -88,19 +92,24 @@ int main(int argc,char** argv)
|
||||
if ( ! macro.size() ) {
|
||||
ui = new G4UIExecutive(argc, argv, session);
|
||||
}
|
||||
|
||||
|
||||
// Optionally: choose a different Random engine...
|
||||
//
|
||||
// G4Random::setTheEngine(new CLHEP::MTwistEngine);
|
||||
|
||||
|
||||
// Use G4SteppingVerboseWithUnits
|
||||
if ( verboseBestUnits ) {
|
||||
G4int precision = 8;
|
||||
G4SteppingVerbose::UseBestUnit(precision);
|
||||
}
|
||||
|
||||
// Construct the default run manager
|
||||
//
|
||||
auto* runManager =
|
||||
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
|
||||
#ifdef G4MULTITHREADED
|
||||
if ( nThreads > 0 ) {
|
||||
if ( nThreads > 0 ) {
|
||||
runManager->SetNumberOfThreads(nThreads);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Set mandatory initialization classes
|
||||
@@ -110,10 +119,10 @@ int main(int argc,char** argv)
|
||||
|
||||
auto physicsList = new FTFP_BERT;
|
||||
runManager->SetUserInitialization(physicsList);
|
||||
|
||||
|
||||
auto actionInitialization = new B4bActionInitialization(detConstruction);
|
||||
runManager->SetUserInitialization(actionInitialization);
|
||||
|
||||
|
||||
// Initialize visualization
|
||||
auto visManager = new G4VisExecutive;
|
||||
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
|
||||
@@ -130,7 +139,7 @@ int main(int argc,char** argv)
|
||||
G4String command = "/control/execute ";
|
||||
UImanager->ApplyCommand(command+macro);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
// interactive mode : define UI session
|
||||
UImanager->ApplyCommand("/control/execute init_vis.mac");
|
||||
if (ui->IsGUI()) {
|
||||
@@ -142,7 +151,7 @@ int main(int argc,char** argv)
|
||||
|
||||
// Job termination
|
||||
// Free the store: user actions, physics_list and detector_description are
|
||||
// owned and deleted by the run manager, so they should not be deleted
|
||||
// owned and deleted by the run manager, so they should not be deleted
|
||||
// in the main() program !
|
||||
|
||||
delete visManager;
|
||||
|
||||
Reference in New Issue
Block a user