55 : theAdjointRunManager(pAdjointRunManager)
58 AdjointSimDir->
SetGuidance(
"Control of the adjoint or reverse monte carlo simulation");
63 beamOnCmd =
new G4UIcommand(
"/adjoint/start_run",
this);
65 beamOnCmd->
SetGuidance(
"Default number of events to be processed is 1.");
68 p1->SetDefaultValue(1);
69 p1->SetParameterRange(
"numberOfEvent >= 0");
83 radius_par->SetParameterRange(
"R >= 0");
87 DefineSpherExtSourceCmd =
new G4UIcommand(
"/adjoint/DefineSphericalExtSource",
this);
88 DefineSpherExtSourceCmd->
SetGuidance(
"Define a spherical external source.");
95 auto phys_vol_name_par =
new G4UIparameter(
"phys_vol_name",
's',
true);
97 DefineSpherExtSourceCenteredOnAVolumeCmd =
98 new G4UIcommand(
"/adjoint/DefineSphericalExtSourceCenteredOnAVolume",
this);
99 DefineSpherExtSourceCenteredOnAVolumeCmd->
SetGuidance(
100 "Define a spherical external source with the center located at the center "
103 DefineSpherExtSourceCenteredOnAVolumeCmd->
SetParameter(phys_vol_name_par);
104 DefineSpherExtSourceCenteredOnAVolumeCmd->
SetParameter(radius_par);
105 DefineSpherExtSourceCenteredOnAVolumeCmd->
SetParameter(unit_par);
107 DefineExtSourceOnAVolumeExtSurfaceCmd =
109 DefineExtSourceOnAVolumeExtSurfaceCmd->
SetGuidance(
110 "Set the external source on the external surface of a physical volume");
111 DefineExtSourceOnAVolumeExtSurfaceCmd->
SetParameterName(
"phys_vol_name",
false);
114 setExtSourceEMaxCmd->
SetGuidance(
"Set the maximum energy of the external source");
122 DefineSpherAdjSourceCmd =
new G4UIcommand(
"/adjoint/DefineSphericalAdjSource",
this);
123 DefineSpherAdjSourceCmd->
SetGuidance(
"Define a spherical adjoint source.");
130 DefineSpherAdjSourceCenteredOnAVolumeCmd =
131 new G4UIcommand(
"/adjoint/DefineSphericalAdjSourceCenteredOnAVolume",
this);
132 DefineSpherAdjSourceCenteredOnAVolumeCmd->
SetGuidance(
133 "Define a spherical adjoint source with the center located at the center "
136 DefineSpherAdjSourceCenteredOnAVolumeCmd->
SetParameter(phys_vol_name_par);
137 DefineSpherAdjSourceCenteredOnAVolumeCmd->
SetParameter(radius_par);
138 DefineSpherAdjSourceCenteredOnAVolumeCmd->
SetParameter(unit_par);
140 DefineAdjSourceOnAVolumeExtSurfaceCmd =
142 DefineAdjSourceOnAVolumeExtSurfaceCmd->
SetGuidance(
143 "Set the adjoint source on the external surface of physical volume");
144 DefineAdjSourceOnAVolumeExtSurfaceCmd->
SetParameterName(
"phys_vol_name",
false);
147 setAdjSourceEminCmd->
SetGuidance(
"Set the minimum energy of the adjoint source");
153 setAdjSourceEmaxCmd->
SetGuidance(
"Set the maximum energy of the adjoint source");
158 ConsiderParticleAsPrimaryCmd =
new G4UIcmdWithAString(
"/adjoint/ConsiderAsPrimary",
this);
159 ConsiderParticleAsPrimaryCmd->
SetGuidance(
"Set the selected particle as primary");
161 ConsiderParticleAsPrimaryCmd->
SetCandidates(
"e- gamma proton ion");
163 NeglectParticleAsPrimaryCmd =
new G4UIcmdWithAString(
"/adjoint/NeglectAsPrimary",
this);
165 "Remove the selected particle from the list of primaries");
167 NeglectParticleAsPrimaryCmd->
SetCandidates(
"e- gamma proton ion");
169 setNbOfPrimaryFwdGammasPerEventCmd =
172 "Set the nb of primary fwd gamm generated on the adjoint source");
176 setNbOfPrimaryAdjGammasPerEventCmd =
179 "Set the nb of primary fwd gamm generated on the adjoint source");
183 setNbOfPrimaryAdjElectronsPerEventCmd =
185 setNbOfPrimaryAdjElectronsPerEventCmd->
SetGuidance(
186 "Set the nb of primary fwd gamm generated on the adjoint source");
187 setNbOfPrimaryAdjElectronsPerEventCmd->
SetParameterName(
"Nb_gammas",
false);
195 delete setNbOfPrimaryAdjElectronsPerEventCmd;
196 delete setNbOfPrimaryAdjGammasPerEventCmd;
197 delete setNbOfPrimaryFwdGammasPerEventCmd;
198 delete NeglectParticleAsPrimaryCmd;
199 delete ConsiderParticleAsPrimaryCmd;
200 delete setAdjSourceEmaxCmd;
201 delete setAdjSourceEminCmd;
202 delete DefineAdjSourceOnAVolumeExtSurfaceCmd;
203 delete DefineSpherAdjSourceCenteredOnAVolumeCmd;
204 delete DefineSpherAdjSourceCmd;
205 delete setExtSourceEMaxCmd;
206 delete DefineExtSourceOnAVolumeExtSurfaceCmd;
207 delete DefineSpherExtSourceCenteredOnAVolumeCmd;
208 delete DefineSpherExtSourceCmd;
210 delete AdjointSimDir;
217 if (command ==
nullptr)
return;
218 if (command == beamOnCmd) {
220 const auto nv = (
const char*)newValue;
221 std::istringstream is(nv);
226 else if (command == ConsiderParticleAsPrimaryCmd) {
229 else if (command == NeglectParticleAsPrimaryCmd) {
232 if (command == DefineSpherExtSourceCmd) {
235 const auto nv = (
const char*)newValue;
236 std::istringstream is(nv);
237 is >> x >> y >> z >> r >> unit;
245 else if (command == DefineSpherExtSourceCenteredOnAVolumeCmd) {
248 const auto nv = (
const char*)newValue;
249 std::istringstream is(nv);
250 is >> vol_name >> r >> unit;
254 else if (command == DefineExtSourceOnAVolumeExtSurfaceCmd) {
257 else if (command == setExtSourceEMaxCmd) {
260 else if (command == DefineSpherAdjSourceCmd) {
263 const auto nv = (
const char*)newValue;
264 std::istringstream is(nv);
265 is >> x >> y >> z >> r >> unit;
273 else if (command == DefineSpherAdjSourceCenteredOnAVolumeCmd) {
276 const auto nv = (
const char*)newValue;
277 std::istringstream is(nv);
278 is >> vol_name >> r >> unit;
282 else if (command == DefineAdjSourceOnAVolumeExtSurfaceCmd) {
285 else if (command == setAdjSourceEminCmd) {
288 else if (command == setAdjSourceEmaxCmd) {
291 else if (command == setNbOfPrimaryFwdGammasPerEventCmd) {
295 else if (command == setNbOfPrimaryAdjGammasPerEventCmd) {
299 else if (command == setNbOfPrimaryAdjElectronsPerEventCmd) {