30 #include "B4dDetectorConstruction.hh" 31 #include "B4dActionInitialization.hh" 32 #include "B4Analysis.hh" 34 #ifdef G4MULTITHREADED 35 #include "G4MTRunManager.hh" 37 #include "G4RunManager.hh" 40 #include "G4UImanager.hh" 41 #include "FTFP_BERT.hh" 42 #include "G4VisExecutive.hh" 43 #include "G4UIExecutive.hh" 44 #include "Randomize.hh" 45 #include "G4TScoreNtupleWriter.hh" 51 G4cerr <<
" Usage: " << G4endl;
52 G4cerr <<
" exampleB4d [-m macro ] [-u UIsession] [-t nThreads]" << G4endl;
53 G4cerr <<
" note: -t option is available only for multi-threaded mode." 60 int main(
int argc,
char** argv)
71 #ifdef G4MULTITHREADED 74 for ( G4int i=1; i<argc; i=i+2 ) {
75 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
76 else if (
G4String(argv[i]) ==
"-u" ) session = argv[i+1];
77 #ifdef G4MULTITHREADED 78 else if (
G4String(argv[i]) ==
"-t" ) {
79 nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
90 G4UIExecutive* ui =
nullptr;
91 if ( ! macro.size() ) {
92 ui =
new G4UIExecutive(argc, argv, session);
101 #ifdef G4MULTITHREADED 102 auto runManager =
new G4MTRunManager;
103 if ( nThreads > 0 ) {
104 runManager->SetNumberOfThreads(nThreads);
107 auto runManager =
new G4RunManager;
112 auto detConstruction =
new B4dDetectorConstruction();
113 runManager->SetUserInitialization(detConstruction);
115 auto physicsList =
new FTFP_BERT;
116 runManager->SetUserInitialization(physicsList);
118 auto actionInitialization =
new B4dActionInitialization();
119 runManager->SetUserInitialization(actionInitialization);
122 auto visManager =
new G4VisExecutive;
125 visManager->Initialize();
128 auto UImanager = G4UImanager::GetUIpointer();
132 G4TScoreNtupleWriter<G4AnalysisManager> scoreNtupleWriter;
140 if ( macro.size() ) {
142 G4String command =
"/control/execute ";
143 UImanager->ApplyCommand(command+macro);
147 UImanager->ApplyCommand(
"/control/execute init_vis.mac");
149 UImanager->ApplyCommand(
"/control/execute gui.mac");
static G4UIterminal * session
int main(int argc, char **argv)