Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/run/src/G4AdjointSimMessenger.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /run/src/G4AdjointSimMessenger.cc (Version 11.3.0) and /run/src/G4AdjointSimMessenger.cc (Version 11.2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 // G4AdjointSimMessenger implementation            26 // G4AdjointSimMessenger implementation
 27 //                                                 27 //
 28 // -------------------------------------------     28 // --------------------------------------------------------------------
 29 //   Class Name:   G4AdjointSimMessenger           29 //   Class Name:   G4AdjointSimMessenger
 30 //   Author:       L. Desorgher, 2007-2009         30 //   Author:       L. Desorgher, 2007-2009
 31 //   Organisation: SpaceIT GmbH                    31 //   Organisation: SpaceIT GmbH
 32 //   Contract:     ESA contract 21435/08/NL/AT     32 //   Contract:     ESA contract 21435/08/NL/AT
 33 //   Customer:     ESA/ESTEC                       33 //   Customer:     ESA/ESTEC
 34 // -------------------------------------------     34 // --------------------------------------------------------------------
 35                                                    35 
 36 #include "G4AdjointSimMessenger.hh"                36 #include "G4AdjointSimMessenger.hh"
 37                                                    37 
 38 #include "G4AdjointSimManager.hh"                  38 #include "G4AdjointSimManager.hh"
 39 #include "G4RunManager.hh"                         39 #include "G4RunManager.hh"
 40 #include "G4UIcmdWith3VectorAndUnit.hh"            40 #include "G4UIcmdWith3VectorAndUnit.hh"
 41 #include "G4UIcmdWithABool.hh"                     41 #include "G4UIcmdWithABool.hh"
 42 #include "G4UIcmdWithADouble.hh"                   42 #include "G4UIcmdWithADouble.hh"
 43 #include "G4UIcmdWithADoubleAndUnit.hh"            43 #include "G4UIcmdWithADoubleAndUnit.hh"
 44 #include "G4UIcmdWithAString.hh"                   44 #include "G4UIcmdWithAString.hh"
 45 #include "G4UIcmdWithAnInteger.hh"                 45 #include "G4UIcmdWithAnInteger.hh"
 46 #include "G4UIcmdWithoutParameter.hh"              46 #include "G4UIcmdWithoutParameter.hh"
 47 #include "G4UIdirectory.hh"                        47 #include "G4UIdirectory.hh"
 48 #include "G4UnitsTable.hh"                         48 #include "G4UnitsTable.hh"
 49                                                    49 
 50 #include <sstream>                                 50 #include <sstream>
 51                                                    51 
 52 // -------------------------------------------     52 // --------------------------------------------------------------------
 53 //                                                 53 //
 54 G4AdjointSimMessenger::G4AdjointSimMessenger(G     54 G4AdjointSimMessenger::G4AdjointSimMessenger(G4AdjointSimManager* pAdjointRunManager)
 55   : theAdjointRunManager(pAdjointRunManager)       55   : theAdjointRunManager(pAdjointRunManager)
 56 {                                                  56 {
 57   AdjointSimDir = new G4UIdirectory("/adjoint/     57   AdjointSimDir = new G4UIdirectory("/adjoint/");
 58   AdjointSimDir->SetGuidance("Control of the a     58   AdjointSimDir->SetGuidance("Control of the adjoint or reverse monte carlo simulation");
 59                                                    59 
 60   // Start and adjoint Run                         60   // Start and adjoint Run
 61   //---------------------                          61   //---------------------
 62                                                    62 
 63                                                << 
 64   beamOnCmd = new G4UIcommand("/adjoint/start_     63   beamOnCmd = new G4UIcommand("/adjoint/start_run", this);
 65   beamOnCmd->SetGuidance("Start an adjoint Run     64   beamOnCmd->SetGuidance("Start an adjoint Run.");
 66   beamOnCmd->SetGuidance("Default number of ev     65   beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
 67   beamOnCmd->AvailableForStates(G4State_PreIni     66   beamOnCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
 68   auto p1 = new G4UIparameter("numberOfEvent",     67   auto p1 = new G4UIparameter("numberOfEvent", 'i', true);
 69   p1->SetDefaultValue(1);                          68   p1->SetDefaultValue(1);
 70   p1->SetParameterRange("numberOfEvent >= 0");     69   p1->SetParameterRange("numberOfEvent >= 0");
 71   beamOnCmd->SetParameter(p1);                     70   beamOnCmd->SetParameter(p1);
 72                                                    71 
 73   // Commands to define parameters relative to     72   // Commands to define parameters relative to the external source
 74   //------------------------------------------     73   //------------------------------------------------------------
 75                                                    74 
 76   auto pos_x_par = new G4UIparameter("X", 'd',     75   auto pos_x_par = new G4UIparameter("X", 'd', true);
 77                                                    76 
 78   auto pos_y_par = new G4UIparameter("Y", 'd',     77   auto pos_y_par = new G4UIparameter("Y", 'd', true);
 79                                                    78 
 80   auto pos_z_par = new G4UIparameter("Z", 'd',     79   auto pos_z_par = new G4UIparameter("Z", 'd', true);
 81                                                    80 
 82   auto radius_par = new G4UIparameter("R", 'd'     81   auto radius_par = new G4UIparameter("R", 'd', true);
 83                                                    82 
 84   radius_par->SetParameterRange("R >= 0");         83   radius_par->SetParameterRange("R >= 0");
 85                                                    84 
 86   auto unit_par = new G4UIparameter("unit", 's     85   auto unit_par = new G4UIparameter("unit", 's', true);
 87                                                    86 
 88   DefineSpherExtSourceCmd = new G4UIcommand("/     87   DefineSpherExtSourceCmd = new G4UIcommand("/adjoint/DefineSphericalExtSource", this);
 89   DefineSpherExtSourceCmd->SetGuidance("Define     88   DefineSpherExtSourceCmd->SetGuidance("Define a spherical external source.");
 90   DefineSpherExtSourceCmd->SetParameter(pos_x_     89   DefineSpherExtSourceCmd->SetParameter(pos_x_par);
 91   DefineSpherExtSourceCmd->SetParameter(pos_y_     90   DefineSpherExtSourceCmd->SetParameter(pos_y_par);
 92   DefineSpherExtSourceCmd->SetParameter(pos_z_     91   DefineSpherExtSourceCmd->SetParameter(pos_z_par);
 93   DefineSpherExtSourceCmd->SetParameter(radius     92   DefineSpherExtSourceCmd->SetParameter(radius_par);
 94   DefineSpherExtSourceCmd->SetParameter(unit_p     93   DefineSpherExtSourceCmd->SetParameter(unit_par);
 95                                                    94 
 96   auto phys_vol_name_par = new G4UIparameter("     95   auto phys_vol_name_par = new G4UIparameter("phys_vol_name", 's', true);
 97                                                    96 
 98   DefineSpherExtSourceCenteredOnAVolumeCmd =       97   DefineSpherExtSourceCenteredOnAVolumeCmd =
 99     new G4UIcommand("/adjoint/DefineSphericalE     98     new G4UIcommand("/adjoint/DefineSphericalExtSourceCenteredOnAVolume", this);
100   DefineSpherExtSourceCenteredOnAVolumeCmd->Se     99   DefineSpherExtSourceCenteredOnAVolumeCmd->SetGuidance(
101     "Define a spherical external source with t    100     "Define a spherical external source with the center located at the center "
102     "of a "                                       101     "of a "
103     "physical volume");                           102     "physical volume");
104   DefineSpherExtSourceCenteredOnAVolumeCmd->Se    103   DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
105   DefineSpherExtSourceCenteredOnAVolumeCmd->Se    104   DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
106   DefineSpherExtSourceCenteredOnAVolumeCmd->Se    105   DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
107                                                   106 
108   DefineExtSourceOnAVolumeExtSurfaceCmd =         107   DefineExtSourceOnAVolumeExtSurfaceCmd =
109     new G4UIcmdWithAString("/adjoint/DefineExt    108     new G4UIcmdWithAString("/adjoint/DefineExtSourceOnExtSurfaceOfAVolume", this);
110   DefineExtSourceOnAVolumeExtSurfaceCmd->SetGu    109   DefineExtSourceOnAVolumeExtSurfaceCmd->SetGuidance(
111     "Set the external source on the external s    110     "Set the external source on the external surface of a physical volume");
112   DefineExtSourceOnAVolumeExtSurfaceCmd->SetPa    111   DefineExtSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name", false);
113                                                   112 
114   setExtSourceEMaxCmd = new G4UIcmdWithADouble    113   setExtSourceEMaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetExtSourceEmax", this);
115   setExtSourceEMaxCmd->SetGuidance("Set the ma    114   setExtSourceEMaxCmd->SetGuidance("Set the maximum  energy of the external source");
116   setExtSourceEMaxCmd->SetParameterName("Emax"    115   setExtSourceEMaxCmd->SetParameterName("Emax", false);
117   setExtSourceEMaxCmd->SetUnitCategory("Energy    116   setExtSourceEMaxCmd->SetUnitCategory("Energy");
118   setExtSourceEMaxCmd->AvailableForStates(G4St    117   setExtSourceEMaxCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
119                                                   118 
120   // Commands to define the adjoint source        119   // Commands to define the adjoint source
121   //------------------------------------------    120   //------------------------------------------------------------
122                                                   121 
123   DefineSpherAdjSourceCmd = new G4UIcommand("/    122   DefineSpherAdjSourceCmd = new G4UIcommand("/adjoint/DefineSphericalAdjSource", this);
124   DefineSpherAdjSourceCmd->SetGuidance("Define    123   DefineSpherAdjSourceCmd->SetGuidance("Define a spherical adjoint source.");
125   DefineSpherAdjSourceCmd->SetParameter(pos_x_    124   DefineSpherAdjSourceCmd->SetParameter(pos_x_par);
126   DefineSpherAdjSourceCmd->SetParameter(pos_y_    125   DefineSpherAdjSourceCmd->SetParameter(pos_y_par);
127   DefineSpherAdjSourceCmd->SetParameter(pos_z_    126   DefineSpherAdjSourceCmd->SetParameter(pos_z_par);
128   DefineSpherAdjSourceCmd->SetParameter(radius    127   DefineSpherAdjSourceCmd->SetParameter(radius_par);
129   DefineSpherAdjSourceCmd->SetParameter(unit_p    128   DefineSpherAdjSourceCmd->SetParameter(unit_par);
130                                                   129 
131   DefineSpherAdjSourceCenteredOnAVolumeCmd =      130   DefineSpherAdjSourceCenteredOnAVolumeCmd =
132     new G4UIcommand("/adjoint/DefineSphericalA    131     new G4UIcommand("/adjoint/DefineSphericalAdjSourceCenteredOnAVolume", this);
133   DefineSpherAdjSourceCenteredOnAVolumeCmd->Se    132   DefineSpherAdjSourceCenteredOnAVolumeCmd->SetGuidance(
134     "Define a spherical adjoint source with th    133     "Define a spherical adjoint source with the center located at the center "
135     "of a "                                       134     "of a "
136     "physical volume");                           135     "physical volume");
137   DefineSpherAdjSourceCenteredOnAVolumeCmd->Se    136   DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
138   DefineSpherAdjSourceCenteredOnAVolumeCmd->Se    137   DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
139   DefineSpherAdjSourceCenteredOnAVolumeCmd->Se    138   DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
140                                                   139 
141   DefineAdjSourceOnAVolumeExtSurfaceCmd =         140   DefineAdjSourceOnAVolumeExtSurfaceCmd =
142     new G4UIcmdWithAString("/adjoint/DefineAdj    141     new G4UIcmdWithAString("/adjoint/DefineAdjSourceOnExtSurfaceOfAVolume", this);
143   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetGu    142   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetGuidance(
144     "Set the adjoint source on the external su    143     "Set the adjoint source on the external surface of physical volume");
145   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetPa    144   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name", false);
146                                                   145 
147   setAdjSourceEminCmd = new G4UIcmdWithADouble    146   setAdjSourceEminCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmin", this);
148   setAdjSourceEminCmd->SetGuidance("Set the mi    147   setAdjSourceEminCmd->SetGuidance("Set the minimum energy  of the adjoint source");
149   setAdjSourceEminCmd->SetParameterName("Emin"    148   setAdjSourceEminCmd->SetParameterName("Emin", false);
150   setAdjSourceEminCmd->SetUnitCategory("Energy    149   setAdjSourceEminCmd->SetUnitCategory("Energy");
151   setAdjSourceEminCmd->AvailableForStates(G4St    150   setAdjSourceEminCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
152                                                   151 
153   setAdjSourceEmaxCmd = new G4UIcmdWithADouble    152   setAdjSourceEmaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmax", this);
154   setAdjSourceEmaxCmd->SetGuidance("Set the ma    153   setAdjSourceEmaxCmd->SetGuidance("Set the maximum energy of the adjoint source");
155   setAdjSourceEmaxCmd->SetParameterName("Emax"    154   setAdjSourceEmaxCmd->SetParameterName("Emax", false);
156   setAdjSourceEmaxCmd->SetUnitCategory("Energy    155   setAdjSourceEmaxCmd->SetUnitCategory("Energy");
157   setAdjSourceEmaxCmd->AvailableForStates(G4St    156   setAdjSourceEmaxCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
158                                                   157 
159   ConsiderParticleAsPrimaryCmd = new G4UIcmdWi    158   ConsiderParticleAsPrimaryCmd = new G4UIcmdWithAString("/adjoint/ConsiderAsPrimary", this);
160   ConsiderParticleAsPrimaryCmd->SetGuidance("S    159   ConsiderParticleAsPrimaryCmd->SetGuidance("Set the selected particle as primary");
161   ConsiderParticleAsPrimaryCmd->SetParameterNa    160   ConsiderParticleAsPrimaryCmd->SetParameterName("particle", false);
162   ConsiderParticleAsPrimaryCmd->SetCandidates(    161   ConsiderParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
163                                                   162 
164   NeglectParticleAsPrimaryCmd = new G4UIcmdWit    163   NeglectParticleAsPrimaryCmd = new G4UIcmdWithAString("/adjoint/NeglectAsPrimary", this);
165   NeglectParticleAsPrimaryCmd->SetGuidance(       164   NeglectParticleAsPrimaryCmd->SetGuidance(
166     "Remove the selected particle from the lis    165     "Remove the selected particle from the list of primaries");
167   NeglectParticleAsPrimaryCmd->SetParameterNam    166   NeglectParticleAsPrimaryCmd->SetParameterName("particle", false);
168   NeglectParticleAsPrimaryCmd->SetCandidates("    167   NeglectParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
169                                                   168 
170   setNbOfPrimaryFwdGammasPerEventCmd =            169   setNbOfPrimaryFwdGammasPerEventCmd =
171     new G4UIcmdWithAnInteger("/adjoint/SetNbOf    170     new G4UIcmdWithAnInteger("/adjoint/SetNbOfPrimaryFwdGammasPerEvent", this);
172   setNbOfPrimaryFwdGammasPerEventCmd->SetGuida    171   setNbOfPrimaryFwdGammasPerEventCmd->SetGuidance(
173     "Set the nb of primary fwd gamm  generated    172     "Set the nb of primary fwd gamm  generated on the adjoint source");
174   setNbOfPrimaryFwdGammasPerEventCmd->SetParam    173   setNbOfPrimaryFwdGammasPerEventCmd->SetParameterName("Nb_gammas", false);
175   setNbOfPrimaryFwdGammasPerEventCmd->Availabl    174   setNbOfPrimaryFwdGammasPerEventCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
176                                                   175 
177   setNbOfPrimaryAdjGammasPerEventCmd =            176   setNbOfPrimaryAdjGammasPerEventCmd =
178     new G4UIcmdWithAnInteger("/adjoint/SetNbOf    177     new G4UIcmdWithAnInteger("/adjoint/SetNbOfPrimaryAdjGammasPerEvent", this);
179   setNbOfPrimaryAdjGammasPerEventCmd->SetGuida    178   setNbOfPrimaryAdjGammasPerEventCmd->SetGuidance(
180     "Set the nb of primary fwd gamm  generated    179     "Set the nb of primary fwd gamm  generated on the adjoint source");
181   setNbOfPrimaryAdjGammasPerEventCmd->SetParam    180   setNbOfPrimaryAdjGammasPerEventCmd->SetParameterName("Nb_gammas", false);
182   setNbOfPrimaryAdjGammasPerEventCmd->Availabl    181   setNbOfPrimaryAdjGammasPerEventCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
183                                                   182 
184   setNbOfPrimaryAdjElectronsPerEventCmd =         183   setNbOfPrimaryAdjElectronsPerEventCmd =
185     new G4UIcmdWithAnInteger("/adjoint/SetNbOf    184     new G4UIcmdWithAnInteger("/adjoint/SetNbOfPrimaryAdjElectronsPerEvent", this);
186   setNbOfPrimaryAdjElectronsPerEventCmd->SetGu    185   setNbOfPrimaryAdjElectronsPerEventCmd->SetGuidance(
187     "Set the nb of primary fwd gamm  generated    186     "Set the nb of primary fwd gamm  generated on the adjoint source");
188   setNbOfPrimaryAdjElectronsPerEventCmd->SetPa    187   setNbOfPrimaryAdjElectronsPerEventCmd->SetParameterName("Nb_gammas", false);
189   setNbOfPrimaryAdjElectronsPerEventCmd->Avail    188   setNbOfPrimaryAdjElectronsPerEventCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
190 }                                                 189 }
191                                                   190 
192 // -------------------------------------------    191 // --------------------------------------------------------------------
193 //                                                192 //
194 G4AdjointSimMessenger::~G4AdjointSimMessenger(    193 G4AdjointSimMessenger::~G4AdjointSimMessenger()
195 {                                                 194 {
196   delete setNbOfPrimaryAdjElectronsPerEventCmd    195   delete setNbOfPrimaryAdjElectronsPerEventCmd;
197   delete setNbOfPrimaryAdjGammasPerEventCmd;      196   delete setNbOfPrimaryAdjGammasPerEventCmd;
198   delete setNbOfPrimaryFwdGammasPerEventCmd;      197   delete setNbOfPrimaryFwdGammasPerEventCmd;
199   delete NeglectParticleAsPrimaryCmd;             198   delete NeglectParticleAsPrimaryCmd;
200   delete ConsiderParticleAsPrimaryCmd;            199   delete ConsiderParticleAsPrimaryCmd;
201   delete setAdjSourceEmaxCmd;                     200   delete setAdjSourceEmaxCmd;
202   delete setAdjSourceEminCmd;                     201   delete setAdjSourceEminCmd;
203   delete DefineAdjSourceOnAVolumeExtSurfaceCmd    202   delete DefineAdjSourceOnAVolumeExtSurfaceCmd;
204   delete DefineSpherAdjSourceCenteredOnAVolume    203   delete DefineSpherAdjSourceCenteredOnAVolumeCmd;
205   delete DefineSpherAdjSourceCmd;                 204   delete DefineSpherAdjSourceCmd;
206   delete setExtSourceEMaxCmd;                     205   delete setExtSourceEMaxCmd;
207   delete DefineExtSourceOnAVolumeExtSurfaceCmd    206   delete DefineExtSourceOnAVolumeExtSurfaceCmd;
208   delete DefineSpherExtSourceCenteredOnAVolume    207   delete DefineSpherExtSourceCenteredOnAVolumeCmd;
209   delete DefineSpherExtSourceCmd;                 208   delete DefineSpherExtSourceCmd;
210   delete beamOnCmd;                               209   delete beamOnCmd;
211   delete AdjointSimDir;                           210   delete AdjointSimDir;
212 }                                                 211 }
213                                                   212 
214 // -------------------------------------------    213 // --------------------------------------------------------------------
215 //                                                214 //
216 void G4AdjointSimMessenger::SetNewValue(G4UIco    215 void G4AdjointSimMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
217 {                                                 216 {
218   if (command == nullptr) return;                 217   if (command == nullptr) return;
219   if (command == beamOnCmd) {                     218   if (command == beamOnCmd) {
220     G4int nev;                                    219     G4int nev;
221     const auto nv = (const char*)newValue;        220     const auto nv = (const char*)newValue;
222     std::istringstream is(nv);                    221     std::istringstream is(nv);
223     is >> nev;                                    222     is >> nev;
224     theAdjointRunManager->RunAdjointSimulation << 223     if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM)
                                                   >> 224       theAdjointRunManager->RunAdjointSimulation(nev);
225   }                                               225   }
226   else if (command == ConsiderParticleAsPrimar    226   else if (command == ConsiderParticleAsPrimaryCmd) {
227     theAdjointRunManager->ConsiderParticleAsPr    227     theAdjointRunManager->ConsiderParticleAsPrimary(newValue);
228   }                                               228   }
229   else if (command == NeglectParticleAsPrimary    229   else if (command == NeglectParticleAsPrimaryCmd) {
230     theAdjointRunManager->NeglectParticleAsPri    230     theAdjointRunManager->NeglectParticleAsPrimary(newValue);
231   }                                               231   }
232   if (command == DefineSpherExtSourceCmd) {       232   if (command == DefineSpherExtSourceCmd) {
233     G4double x, y, z, r;                          233     G4double x, y, z, r;
234     G4String unit;                                234     G4String unit;
235     const auto nv = (const char*)newValue;        235     const auto nv = (const char*)newValue;
236     std::istringstream is(nv);                    236     std::istringstream is(nv);
237     is >> x >> y >> z >> r >> unit;               237     is >> x >> y >> z >> r >> unit;
238                                                   238 
239     x *= G4UnitDefinition::GetValueOf(unit);      239     x *= G4UnitDefinition::GetValueOf(unit);
240     y *= G4UnitDefinition::GetValueOf(unit);      240     y *= G4UnitDefinition::GetValueOf(unit);
241     z *= G4UnitDefinition::GetValueOf(unit);      241     z *= G4UnitDefinition::GetValueOf(unit);
242     r *= G4UnitDefinition::GetValueOf(unit);      242     r *= G4UnitDefinition::GetValueOf(unit);
243     theAdjointRunManager->DefineSphericalExtSo    243     theAdjointRunManager->DefineSphericalExtSource(r, G4ThreeVector(x, y, z));
244   }                                               244   }
245   else if (command == DefineSpherExtSourceCent    245   else if (command == DefineSpherExtSourceCenteredOnAVolumeCmd) {
246     G4double r;                                   246     G4double r;
247     G4String vol_name, unit;                      247     G4String vol_name, unit;
248     const auto nv = (const char*)newValue;        248     const auto nv = (const char*)newValue;
249     std::istringstream is(nv);                    249     std::istringstream is(nv);
250     is >> vol_name >> r >> unit;                  250     is >> vol_name >> r >> unit;
251     r *= G4UnitDefinition::GetValueOf(unit);      251     r *= G4UnitDefinition::GetValueOf(unit);
252     theAdjointRunManager->DefineSphericalExtSo    252     theAdjointRunManager->DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(r, vol_name);
253   }                                               253   }
254   else if (command == DefineExtSourceOnAVolume    254   else if (command == DefineExtSourceOnAVolumeExtSurfaceCmd) {
255     theAdjointRunManager->DefineExtSourceOnThe    255     theAdjointRunManager->DefineExtSourceOnTheExtSurfaceOfAVolume(newValue);
256   }                                               256   }
257   else if (command == setExtSourceEMaxCmd) {      257   else if (command == setExtSourceEMaxCmd) {
258     theAdjointRunManager->SetExtSourceEmax(set    258     theAdjointRunManager->SetExtSourceEmax(setExtSourceEMaxCmd->GetNewDoubleValue(newValue));
259   }                                               259   }
260   else if (command == DefineSpherAdjSourceCmd)    260   else if (command == DefineSpherAdjSourceCmd) {
261     G4double x, y, z, r;                          261     G4double x, y, z, r;
262     G4String unit;                                262     G4String unit;
263     const auto nv = (const char*)newValue;        263     const auto nv = (const char*)newValue;
264     std::istringstream is(nv);                    264     std::istringstream is(nv);
265     is >> x >> y >> z >> r >> unit;               265     is >> x >> y >> z >> r >> unit;
266                                                   266 
267     x *= G4UnitDefinition::GetValueOf(unit);      267     x *= G4UnitDefinition::GetValueOf(unit);
268     y *= G4UnitDefinition::GetValueOf(unit);      268     y *= G4UnitDefinition::GetValueOf(unit);
269     z *= G4UnitDefinition::GetValueOf(unit);      269     z *= G4UnitDefinition::GetValueOf(unit);
270     r *= G4UnitDefinition::GetValueOf(unit);      270     r *= G4UnitDefinition::GetValueOf(unit);
271     theAdjointRunManager->DefineSphericalAdjoi    271     theAdjointRunManager->DefineSphericalAdjointSource(r, G4ThreeVector(x, y, z));
272   }                                               272   }
273   else if (command == DefineSpherAdjSourceCent    273   else if (command == DefineSpherAdjSourceCenteredOnAVolumeCmd) {
274     G4double r;                                   274     G4double r;
275     G4String vol_name, unit;                      275     G4String vol_name, unit;
276     const auto nv = (const char*)newValue;        276     const auto nv = (const char*)newValue;
277     std::istringstream is(nv);                    277     std::istringstream is(nv);
278     is >> vol_name >> r >> unit;                  278     is >> vol_name >> r >> unit;
279     r *= G4UnitDefinition::GetValueOf(unit);      279     r *= G4UnitDefinition::GetValueOf(unit);
280     theAdjointRunManager->DefineSphericalAdjoi    280     theAdjointRunManager->DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(r, vol_name);
281   }                                               281   }
282   else if (command == DefineAdjSourceOnAVolume    282   else if (command == DefineAdjSourceOnAVolumeExtSurfaceCmd) {
283     theAdjointRunManager->DefineAdjointSourceO    283     theAdjointRunManager->DefineAdjointSourceOnTheExtSurfaceOfAVolume(newValue);
284   }                                               284   }
285   else if (command == setAdjSourceEminCmd) {      285   else if (command == setAdjSourceEminCmd) {
286     theAdjointRunManager->SetAdjointSourceEmin    286     theAdjointRunManager->SetAdjointSourceEmin(setAdjSourceEminCmd->GetNewDoubleValue(newValue));
287   }                                               287   }
288   else if (command == setAdjSourceEmaxCmd) {      288   else if (command == setAdjSourceEmaxCmd) {
289     theAdjointRunManager->SetAdjointSourceEmax    289     theAdjointRunManager->SetAdjointSourceEmax(setAdjSourceEmaxCmd->GetNewDoubleValue(newValue));
290   }                                               290   }
291   else if (command == setNbOfPrimaryFwdGammasP    291   else if (command == setNbOfPrimaryFwdGammasPerEventCmd) {
292     theAdjointRunManager->SetNbOfPrimaryFwdGam    292     theAdjointRunManager->SetNbOfPrimaryFwdGammasPerEvent(
293       setNbOfPrimaryFwdGammasPerEventCmd->GetN    293       setNbOfPrimaryFwdGammasPerEventCmd->GetNewIntValue(newValue));
294   }                                               294   }
295   else if (command == setNbOfPrimaryAdjGammasP    295   else if (command == setNbOfPrimaryAdjGammasPerEventCmd) {
296     theAdjointRunManager->SetNbAdjointPrimaryG    296     theAdjointRunManager->SetNbAdjointPrimaryGammasPerEvent(
297       setNbOfPrimaryAdjGammasPerEventCmd->GetN    297       setNbOfPrimaryAdjGammasPerEventCmd->GetNewIntValue(newValue));
298   }                                               298   }
299   else if (command == setNbOfPrimaryAdjElectro    299   else if (command == setNbOfPrimaryAdjElectronsPerEventCmd) {
300     theAdjointRunManager->SetNbAdjointPrimaryE    300     theAdjointRunManager->SetNbAdjointPrimaryElectronsPerEvent(
301       setNbOfPrimaryAdjElectronsPerEventCmd->G    301       setNbOfPrimaryAdjElectronsPerEventCmd->GetNewIntValue(newValue));
302   }                                               302   }
303 }                                                 303 }
304                                                   304