35 #ifdef G4MULTITHREADED 36 #include "G4MTRunManager.hh" 38 #include "G4RunManager.hh" 41 #include "G4UImanager.hh" 42 #include "Randomize.hh" 44 #include "G4VisExecutive.hh" 45 #include "G4UIExecutive.hh" 48 #include "G4MonopolePhysics.hh" 49 #include "G4PhysListFactory.hh" 50 #include "G4VModularPhysicsList.hh" 51 #include "ActionInitialization.hh" 60 <<
" Usage: " << G4endl
61 <<
" exampleB4a [-m macro ] [-s setupMonopole] [-t nThreads]" << G4endl
62 <<
" Note: " << G4endl
63 <<
" -s should be followed by a composed string, eg. \'1 0 100 GeV\'" << G4endl
64 <<
" -t option is available only for multi-threaded mode." << G4endl
71 int main(
int argc,
char** argv)
82 #ifdef G4MULTITHREADED 85 for ( G4int i=1; i<argc; i=i+2 ) {
86 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
87 else if (
G4String(argv[i]) ==
"-s" ) setupMonopole = argv[i+1];
88 #ifdef G4MULTITHREADED 89 else if (
G4String(argv[i]) ==
"-t" ) {
90 nThreads = G4UIcommand::ConvertToInt(argv[i+1]);
100 G4UIExecutive* ui =
nullptr;
101 if ( ! macro.size() ) {
102 ui =
new G4UIExecutive(argc, argv);
106 CLHEP::HepRandom::setTheEngine(
new CLHEP::MixMaxRng);
109 #ifdef G4MULTITHREADED 110 G4MTRunManager* runManager =
new G4MTRunManager;
111 if ( nThreads > 0 ) {
112 runManager->SetNumberOfThreads(nThreads);
114 G4cout <<
"===== Monopole is started with " 115 << runManager->GetNumberOfThreads() <<
" threads =====" << G4endl;
117 G4RunManager* runManager =
new G4RunManager();
122 G4PhysListFactory factory;
123 G4VModularPhysicsList* phys = factory.GetReferencePhysList(
"FTFP_BERT");
126 G4MonopolePhysics * theMonopole =
new G4MonopolePhysics();
129 G4UImanager* UImanager = G4UImanager::GetUIpointer();
131 if ( setupMonopole.size() ) {
132 UImanager->ApplyCommand(
"/control/verbose 1");
133 UImanager->ApplyCommand(
"/monopole/setup " + setupMonopole);
137 phys->RegisterPhysics(theMonopole);
138 runManager->SetUserInitialization(phys);
141 G4VisManager* visManager =
new G4VisExecutive();
142 visManager->Initialize();
146 runManager->SetUserInitialization(det);
149 runManager->SetUserInitialization(
new ActionInitialization(det));
153 if ( macro.size() ) {
155 G4String command =
"/control/execute ";
156 UImanager->ApplyCommand(command+macro);
160 UImanager->ApplyCommand(
"/control/execute init_vis.mac");
int main(int argc, char **argv)