81{
82
83
84
85
86
87
88 if ( argc > 7 ) {
90 return 1;
91 }
92
95 G4int randomSeed = 1234;
97 for ( G4int i=1; i<argc; i=i+2 ) {
98 if (
G4String(argv[i]) ==
"-m" ) macro = argv[i+1];
99 else if (
G4String(argv[i]) ==
"-r" ) randomSeed = atoi(argv[i+1]);
100 else if (
G4String(argv[i]) ==
"-p" ) physicsList = argv[i+1];
101 else if (
G4String(argv[i]) ==
"-s" ) startPhase = argv[i+1];
102 else {
104 return 1;
105 }
106 }
107
108
110 if ( ! macro.size() ) {
112 }
113
114
115
117
118
119
120#ifdef G4MULTITHREADED
122#else
125#endif
126
127 G4Random::setTheSeed(randomSeed);
128
129
130
131
133 runManager->SetUserInitialization(detector);
134
135 runManager->SetUserInitialization(
new F04PhysicsList(physicsList));
136
138
139
140
141
142
143
144
146
147
148 visManager->Initialize();
149
150
151
152 G4UImanager* UImanager = G4UImanager::GetUIpointer();
153
154
155
156 if ( macro.size() ) {
157
158 G4String command =
"/control/execute ";
159 UImanager->ApplyCommand(command+macro);
160 }
161 else {
162
163 if ( startPhase == "preinit" ) {
164
165 G4cout << "At the prompt, issue commands to set up detector & field, then:"
166 << G4endl;
167 G4cout << "/run/initialize" << G4endl;
168 G4cout << "Then if you want a viewer:"<< G4endl;
169 G4cout << "/control/execute vis.mac" << G4endl;
170 G4cout << "Then: " << G4endl;
171 G4cout << "/run/beamOn … etc." << G4endl;
172 } else {
173
174 UImanager->ApplyCommand("/control/execute init_vis.mac");
175 }
176 if (ui->IsGUI()) {
177 UImanager->ApplyCommand("/control/execute gui.mac");
178 }
179 ui->SessionStart();
180 delete ui;
181 }
182
183
184
185
186
187
188 delete visManager;
189 delete runManager;
190
191 return 0;
192}
Action initialization class.