71{
72
74 if ( argc == 1 ) {
76 }
77
78
79
81
83
84
85 auto* runManager =
86 G4RunManagerFactory::CreateRunManager(G4RunManagerType::Serial);
87
88
89
90
91
92
93
95
96
97 runManager->SetUserInitialization(detector);
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
123 runManager->SetUserInitialization(physicsList);
124
125
127
128 G4double warningE = 10.0 * CLHEP::keV;
129 G4double importantE = 0.1 * CLHEP::MeV;
130 G4int numTrials = 30;
131
132 G4bool useTransportParams= true;
133
134 if( useTransportParams )
135 {
136 auto transportParams= G4TransportationParameters::Instance();
137 transportParams->SetWarningEnergy( warningE );
138 transportParams->SetImportantEnergy( importantE );
139 transportParams->SetNumberOfTrials( numTrials );
140 G4cout << "field01: Using G4TransportationParameters to set looper parameters." << G4endl;
141 }
142 else
143 {
144
146 runAction->SetWarningEnergy( warningE );
147
148
149
150 runAction->SetImportantEnergy( importantE );
151 runAction->SetNumberOfTrials( numTrials );
152
153
154
155 G4cout << "field01: Using F01RunAction to set looper parameters." << G4endl;
156 runManager->SetUserAction(runAction);
157 }
158
159
160
161
162
163 G4EmParameters::Instance()->SetVerbose(0);
164 G4HadronicParameters::Instance()->SetVerboseLevel(0);
165
166
167
168 runManager->Initialize();
169
170
171
172
174 visManager->Initialize();
175
176
177
178 G4UImanager* UImanager = G4UImanager::GetUIpointer();
179
180 if (!ui)
181 {
182 G4String command =
"/control/execute ";
184 UImanager->ApplyCommand(command+fileName);
185 }
186 else
187 {
188 UImanager->ApplyCommand("/control/execute init_vis.mac");
189 if (ui->IsGUI())
190 UImanager->ApplyCommand("/control/execute gui.mac");
191 ui->SessionStart();
192 delete ui;
193 }
194
195
196
197
198
199 delete visManager;
200 delete runManager;
201
202 return 0;
203}
Action initialization class.