55 : theAdjointRunManager(pAdjointRunManager)
58 AdjointSimDir->SetGuidance(
"Control of the adjoint or reverse monte carlo simulation");
64 beamOnCmd =
new G4UIcommand(
"/adjoint/start_run",
this);
65 beamOnCmd->SetGuidance(
"Start an adjoint Run.");
66 beamOnCmd->SetGuidance(
"Default number of events to be processed is 1.");
69 p1->SetDefaultValue(1);
70 p1->SetParameterRange(
"numberOfEvent >= 0");
71 beamOnCmd->SetParameter(p1);
84 radius_par->SetParameterRange(
"R >= 0");
88 DefineSpherExtSourceCmd =
new G4UIcommand(
"/adjoint/DefineSphericalExtSource",
this);
89 DefineSpherExtSourceCmd->SetGuidance(
"Define a spherical external source.");
90 DefineSpherExtSourceCmd->SetParameter(pos_x_par);
91 DefineSpherExtSourceCmd->SetParameter(pos_y_par);
92 DefineSpherExtSourceCmd->SetParameter(pos_z_par);
93 DefineSpherExtSourceCmd->SetParameter(radius_par);
94 DefineSpherExtSourceCmd->SetParameter(unit_par);
96 auto phys_vol_name_par =
new G4UIparameter(
"phys_vol_name",
's',
true);
98 DefineSpherExtSourceCenteredOnAVolumeCmd =
99 new G4UIcommand(
"/adjoint/DefineSphericalExtSourceCenteredOnAVolume",
this);
100 DefineSpherExtSourceCenteredOnAVolumeCmd->SetGuidance(
101 "Define a spherical external source with the center located at the center "
104 DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
105 DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
106 DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
108 DefineExtSourceOnAVolumeExtSurfaceCmd =
110 DefineExtSourceOnAVolumeExtSurfaceCmd->SetGuidance(
111 "Set the external source on the external surface of a physical volume");
112 DefineExtSourceOnAVolumeExtSurfaceCmd->SetParameterName(
"phys_vol_name",
false);
115 setExtSourceEMaxCmd->SetGuidance(
"Set the maximum energy of the external source");
116 setExtSourceEMaxCmd->SetParameterName(
"Emax",
false);
117 setExtSourceEMaxCmd->SetUnitCategory(
"Energy");
123 DefineSpherAdjSourceCmd =
new G4UIcommand(
"/adjoint/DefineSphericalAdjSource",
this);
124 DefineSpherAdjSourceCmd->SetGuidance(
"Define a spherical adjoint source.");
125 DefineSpherAdjSourceCmd->SetParameter(pos_x_par);
126 DefineSpherAdjSourceCmd->SetParameter(pos_y_par);
127 DefineSpherAdjSourceCmd->SetParameter(pos_z_par);
128 DefineSpherAdjSourceCmd->SetParameter(radius_par);
129 DefineSpherAdjSourceCmd->SetParameter(unit_par);
131 DefineSpherAdjSourceCenteredOnAVolumeCmd =
132 new G4UIcommand(
"/adjoint/DefineSphericalAdjSourceCenteredOnAVolume",
this);
133 DefineSpherAdjSourceCenteredOnAVolumeCmd->SetGuidance(
134 "Define a spherical adjoint source with the center located at the center "
137 DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
138 DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
139 DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
141 DefineAdjSourceOnAVolumeExtSurfaceCmd =
143 DefineAdjSourceOnAVolumeExtSurfaceCmd->SetGuidance(
144 "Set the adjoint source on the external surface of physical volume");
145 DefineAdjSourceOnAVolumeExtSurfaceCmd->SetParameterName(
"phys_vol_name",
false);
148 setAdjSourceEminCmd->SetGuidance(
"Set the minimum energy of the adjoint source");
149 setAdjSourceEminCmd->SetParameterName(
"Emin",
false);
150 setAdjSourceEminCmd->SetUnitCategory(
"Energy");
154 setAdjSourceEmaxCmd->SetGuidance(
"Set the maximum energy of the adjoint source");
155 setAdjSourceEmaxCmd->SetParameterName(
"Emax",
false);
156 setAdjSourceEmaxCmd->SetUnitCategory(
"Energy");
159 ConsiderParticleAsPrimaryCmd =
new G4UIcmdWithAString(
"/adjoint/ConsiderAsPrimary",
this);
160 ConsiderParticleAsPrimaryCmd->SetGuidance(
"Set the selected particle as primary");
161 ConsiderParticleAsPrimaryCmd->SetParameterName(
"particle",
false);
162 ConsiderParticleAsPrimaryCmd->SetCandidates(
"e- gamma proton ion");
164 NeglectParticleAsPrimaryCmd =
new G4UIcmdWithAString(
"/adjoint/NeglectAsPrimary",
this);
165 NeglectParticleAsPrimaryCmd->SetGuidance(
166 "Remove the selected particle from the list of primaries");
167 NeglectParticleAsPrimaryCmd->SetParameterName(
"particle",
false);
168 NeglectParticleAsPrimaryCmd->SetCandidates(
"e- gamma proton ion");
170 setNbOfPrimaryFwdGammasPerEventCmd =
172 setNbOfPrimaryFwdGammasPerEventCmd->SetGuidance(
173 "Set the nb of primary fwd gamm generated on the adjoint source");
174 setNbOfPrimaryFwdGammasPerEventCmd->SetParameterName(
"Nb_gammas",
false);
177 setNbOfPrimaryAdjGammasPerEventCmd =
179 setNbOfPrimaryAdjGammasPerEventCmd->SetGuidance(
180 "Set the nb of primary fwd gamm generated on the adjoint source");
181 setNbOfPrimaryAdjGammasPerEventCmd->SetParameterName(
"Nb_gammas",
false);
184 setNbOfPrimaryAdjElectronsPerEventCmd =
186 setNbOfPrimaryAdjElectronsPerEventCmd->SetGuidance(
187 "Set the nb of primary fwd gamm generated on the adjoint source");
188 setNbOfPrimaryAdjElectronsPerEventCmd->SetParameterName(
"Nb_gammas",
false);
218 if (command ==
nullptr)
return;
219 if (command == beamOnCmd) {
221 const auto nv = (
const char*)newValue;
222 std::istringstream is(nv);
224 theAdjointRunManager->RunAdjointSimulation(nev);
226 else if (command == ConsiderParticleAsPrimaryCmd) {
227 theAdjointRunManager->ConsiderParticleAsPrimary(newValue);
229 else if (command == NeglectParticleAsPrimaryCmd) {
230 theAdjointRunManager->NeglectParticleAsPrimary(newValue);
232 if (command == DefineSpherExtSourceCmd) {
235 const auto nv = (
const char*)newValue;
236 std::istringstream is(nv);
237 is >> x >> y >> z >> r >> unit;
243 theAdjointRunManager->DefineSphericalExtSource(r,
G4ThreeVector(x, y, z));
245 else if (command == DefineSpherExtSourceCenteredOnAVolumeCmd) {
248 const auto nv = (
const char*)newValue;
249 std::istringstream is(nv);
250 is >> vol_name >> r >> unit;
252 theAdjointRunManager->DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(r, vol_name);
254 else if (command == DefineExtSourceOnAVolumeExtSurfaceCmd) {
255 theAdjointRunManager->DefineExtSourceOnTheExtSurfaceOfAVolume(newValue);
257 else if (command == setExtSourceEMaxCmd) {
258 theAdjointRunManager->SetExtSourceEmax(setExtSourceEMaxCmd->GetNewDoubleValue(newValue));
260 else if (command == DefineSpherAdjSourceCmd) {
263 const auto nv = (
const char*)newValue;
264 std::istringstream is(nv);
265 is >> x >> y >> z >> r >> unit;
271 theAdjointRunManager->DefineSphericalAdjointSource(r,
G4ThreeVector(x, y, z));
273 else if (command == DefineSpherAdjSourceCenteredOnAVolumeCmd) {
276 const auto nv = (
const char*)newValue;
277 std::istringstream is(nv);
278 is >> vol_name >> r >> unit;
280 theAdjointRunManager->DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(r, vol_name);
282 else if (command == DefineAdjSourceOnAVolumeExtSurfaceCmd) {
283 theAdjointRunManager->DefineAdjointSourceOnTheExtSurfaceOfAVolume(newValue);
285 else if (command == setAdjSourceEminCmd) {
286 theAdjointRunManager->SetAdjointSourceEmin(setAdjSourceEminCmd->GetNewDoubleValue(newValue));
288 else if (command == setAdjSourceEmaxCmd) {
289 theAdjointRunManager->SetAdjointSourceEmax(setAdjSourceEmaxCmd->GetNewDoubleValue(newValue));
291 else if (command == setNbOfPrimaryFwdGammasPerEventCmd) {
292 theAdjointRunManager->SetNbOfPrimaryFwdGammasPerEvent(
293 setNbOfPrimaryFwdGammasPerEventCmd->GetNewIntValue(newValue));
295 else if (command == setNbOfPrimaryAdjGammasPerEventCmd) {
296 theAdjointRunManager->SetNbAdjointPrimaryGammasPerEvent(
297 setNbOfPrimaryAdjGammasPerEventCmd->GetNewIntValue(newValue));
299 else if (command == setNbOfPrimaryAdjElectronsPerEventCmd) {
300 theAdjointRunManager->SetNbAdjointPrimaryElectronsPerEvent(
301 setNbOfPrimaryAdjElectronsPerEventCmd->GetNewIntValue(newValue));