47 #include "ActionInitialization.hh" 50 #ifdef G4MULTITHREADED 51 #include "G4MTRunManager.hh" 53 #include "G4RunManager.hh" 56 #include "G4GenericPhysicsList.hh" 57 #include "G4VModularPhysicsList.hh" 58 #include "G4UImanager.hh" 59 #include "Randomize.hh" 60 #include "G4VisExecutive.hh" 61 #include "G4UIExecutive.hh" 67 G4cerr <<
" Usage: " << G4endl;
68 G4cerr <<
" factory [-m macro ] [-p physListMacro ] [-u UIsession] [-t nThreads]" << G4endl;
69 G4cerr <<
" note: -t option is available only for multi-threaded mode." << G4endl;
76 int main(
int argc,
char** argv)
89 #ifdef G4MULTITHREADED 92 for ( G4int i=1; i<argc; i=i+2 ) {
93 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
94 else if (
G4String(argv[i]) ==
"-u" ) session = argv[i+1];
95 else if (
G4String(argv[i]) ==
"-p" ) physListMacro = argv[i+1];
96 #ifdef G4MULTITHREADED 97 else if (
G4String(argv[i]) ==
"-t" ) {
98 nofThreads = G4UIcommand::ConvertToInt(argv[i+1]);
109 G4UIExecutive* ui = 0;
110 if ( ! macro.size() ) {
111 ui =
new G4UIExecutive(argc, argv, session);
115 G4Random::setTheEngine(
new CLHEP::RanecuEngine());
118 #ifdef G4MULTITHREADED 119 G4MTRunManager * runManager =
new G4MTRunManager();
120 if ( nofThreads > 0 ) {
121 runManager->SetNumberOfThreads(nofThreads);
124 G4RunManager * runManager =
new G4RunManager();
128 G4UImanager* UImanager = G4UImanager::GetUIpointer();
131 G4VModularPhysicsList* physList =
nullptr;
132 if ( physListMacro.size() ) {
134 physList =
new G4GenericPhysicsList();
135 UImanager->ApplyCommand(
"/control/execute "+physListMacro);
139 std::vector<G4String>* myConstructors =
new std::vector<G4String>;
141 myConstructors->push_back(
"G4EmStandardPhysics");
142 myConstructors->push_back(
"G4EmExtraPhysics");
143 myConstructors->push_back(
"G4DecayPhysics");
144 myConstructors->push_back(
"G4HadronElasticPhysics");
145 myConstructors->push_back(
"G4HadronPhysicsFTFP_BERT");
146 myConstructors->push_back(
"G4StoppingPhysics");
147 myConstructors->push_back(
"G4IonPhysics");
148 myConstructors->push_back(
"G4NeutronTrackingCut");
150 physList =
new G4GenericPhysicsList(myConstructors);
155 runManager->SetUserInitialization(physList);
158 runManager->SetUserInitialization(
new ActionInitialization(
"genericPL"));
161 G4VisManager* visManager =
new G4VisExecutive;
164 visManager->Initialize();
166 if ( macro.size() ) {
168 G4String command =
"/control/execute ";
169 UImanager->ApplyCommand(command+macro);
173 UImanager->ApplyCommand(
"/control/execute init_vis.mac");
static G4UIterminal * session
int main(int argc, char **argv)