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 10.5.p1)


  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        << 
 27 //                                                 26 //
 28 // ------------------------------------------- <<  27 /////////////////////////////////////////////////////////////////////////////
 29 //   Class Name:   G4AdjointSimMessenger       <<  28 //      Class Name: G4AdjointCrossSurfChecker
 30 //   Author:       L. Desorgher, 2007-2009     <<  29 //  Author:         L. Desorgher
 31 //   Organisation: SpaceIT GmbH                <<  30 //  Organisation:   SpaceIT GmbH
 32 //   Contract:     ESA contract 21435/08/NL/AT <<  31 //  Contract: ESA contract 21435/08/NL/AT
 33 //   Customer:     ESA/ESTEC                   <<  32 //  Customer:       ESA/ESTEC
 34 // ------------------------------------------- <<  33 /////////////////////////////////////////////////////////////////////////////
 35                                                    34 
 36 #include "G4AdjointSimMessenger.hh"            <<  35 #include <sstream>
 37                                                    36 
 38 #include "G4AdjointSimManager.hh"              <<  37 #include "G4AdjointSimMessenger.hh"
 39 #include "G4RunManager.hh"                         38 #include "G4RunManager.hh"
 40 #include "G4UIcmdWith3VectorAndUnit.hh"        <<  39 #include "G4AdjointSimManager.hh"
                                                   >>  40 #include "G4UIdirectory.hh"
 41 #include "G4UIcmdWithABool.hh"                     41 #include "G4UIcmdWithABool.hh"
 42 #include "G4UIcmdWithADouble.hh"               << 
 43 #include "G4UIcmdWithADoubleAndUnit.hh"        << 
 44 #include "G4UIcmdWithAString.hh"               << 
 45 #include "G4UIcmdWithAnInteger.hh"                 42 #include "G4UIcmdWithAnInteger.hh"
                                                   >>  43 #include "G4UIcmdWithADoubleAndUnit.hh"
                                                   >>  44 #include "G4UIcmdWithADouble.hh"
 46 #include "G4UIcmdWithoutParameter.hh"              45 #include "G4UIcmdWithoutParameter.hh"
 47 #include "G4UIdirectory.hh"                    <<  46 #include "G4UIcmdWithAString.hh"
 48 #include "G4UnitsTable.hh"                         47 #include "G4UnitsTable.hh"
 49                                                <<  48 #include "G4UIcmdWith3VectorAndUnit.hh"
 50 #include <sstream>                             <<  49 /*
 51                                                <<  50 #ifdef G4MULTITHREADED
 52 // ------------------------------------------- <<  51 #include "G4MTAdjointSimManager.hh"
                                                   >>  52 #endif
                                                   >>  53 */
                                                   >>  54 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 53 //                                                 55 //
 54 G4AdjointSimMessenger::G4AdjointSimMessenger(G     56 G4AdjointSimMessenger::G4AdjointSimMessenger(G4AdjointSimManager* pAdjointRunManager)
 55   : theAdjointRunManager(pAdjointRunManager)       57   : theAdjointRunManager(pAdjointRunManager)
 56 {                                              <<  58 /*
                                                   >>  59 #ifdef G4MULTITHREADED
                                                   >>  60    ,theMTAdjointRunManager(0),beamOnCmd(0)
                                                   >>  61 #endif
                                                   >>  62 */
                                                   >>  63 
                                                   >>  64 { 
 57   AdjointSimDir = new G4UIdirectory("/adjoint/     65   AdjointSimDir = new G4UIdirectory("/adjoint/");
 58   AdjointSimDir->SetGuidance("Control of the a     66   AdjointSimDir->SetGuidance("Control of the adjoint or reverse monte carlo simulation");
 59                                                    67 
 60   // Start and adjoint Run                     << 
 61   //---------------------                      << 
 62                                                << 
 63                                                    68 
 64   beamOnCmd = new G4UIcommand("/adjoint/start_ <<  69   //Start and adjoint Run
 65   beamOnCmd->SetGuidance("Start an adjoint Run <<  70   //---------------------
 66   beamOnCmd->SetGuidance("Default number of ev <<  71   //if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM){
 67   beamOnCmd->AvailableForStates(G4State_PreIni <<  72    beamOnCmd = new G4UIcommand("/adjoint/start_run",this);
 68   auto p1 = new G4UIparameter("numberOfEvent", <<  73    beamOnCmd->SetGuidance("Start an adjoint Run.");
 69   p1->SetDefaultValue(1);                      <<  74    beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
 70   p1->SetParameterRange("numberOfEvent >= 0"); <<  75    beamOnCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
 71   beamOnCmd->SetParameter(p1);                 <<  76    G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true);
                                                   >>  77    p1->SetDefaultValue(1);
                                                   >>  78    p1->SetParameterRange("numberOfEvent >= 0");
                                                   >>  79    beamOnCmd->SetParameter(p1);
                                                   >>  80   //}
 72                                                    81 
 73   // Commands to define parameters relative to <<  82   //Commands to define parameters relative to the external source
 74   //------------------------------------------     83   //------------------------------------------------------------
 75                                                <<  84   
 76   auto pos_x_par = new G4UIparameter("X", 'd', <<  85   G4UIparameter* pos_x_par = new G4UIparameter("X",'d',true);
 77                                                <<  86   
 78   auto pos_y_par = new G4UIparameter("Y", 'd', <<  87   G4UIparameter* pos_y_par = new G4UIparameter("Y",'d',true);
 79                                                <<  88   
 80   auto pos_z_par = new G4UIparameter("Z", 'd', <<  89   G4UIparameter* pos_z_par = new G4UIparameter("Z",'d',true); 
 81                                                <<  90   
 82   auto radius_par = new G4UIparameter("R", 'd' <<  91   G4UIparameter* radius_par = new G4UIparameter("R",'d',true);
 83                                                <<  92   
 84   radius_par->SetParameterRange("R >= 0");         93   radius_par->SetParameterRange("R >= 0");
                                                   >>  94   
                                                   >>  95   G4UIparameter* unit_par =  new G4UIparameter("unit",'s',true);
 85                                                    96 
 86   auto unit_par = new G4UIparameter("unit", 's <<  97   DefineSpherExtSourceCmd = new G4UIcommand("/adjoint/DefineSphericalExtSource",this);
 87                                                << 
 88   DefineSpherExtSourceCmd = new G4UIcommand("/ << 
 89   DefineSpherExtSourceCmd->SetGuidance("Define     98   DefineSpherExtSourceCmd->SetGuidance("Define a spherical external source.");
 90   DefineSpherExtSourceCmd->SetParameter(pos_x_     99   DefineSpherExtSourceCmd->SetParameter(pos_x_par);
 91   DefineSpherExtSourceCmd->SetParameter(pos_y_    100   DefineSpherExtSourceCmd->SetParameter(pos_y_par);
 92   DefineSpherExtSourceCmd->SetParameter(pos_z_    101   DefineSpherExtSourceCmd->SetParameter(pos_z_par);
 93   DefineSpherExtSourceCmd->SetParameter(radius    102   DefineSpherExtSourceCmd->SetParameter(radius_par);
 94   DefineSpherExtSourceCmd->SetParameter(unit_p    103   DefineSpherExtSourceCmd->SetParameter(unit_par);
 95                                                   104 
 96   auto phys_vol_name_par = new G4UIparameter(" << 105   G4UIparameter* phys_vol_name_par =  new G4UIparameter("phys_vol_name",'s',true);
 97                                                   106 
 98   DefineSpherExtSourceCenteredOnAVolumeCmd =   << 107   DefineSpherExtSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalExtSourceCenteredOnAVolume",this);
 99     new G4UIcommand("/adjoint/DefineSphericalE << 108   DefineSpherExtSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical external source with the center located at the center of a physical volume");
100   DefineSpherExtSourceCenteredOnAVolumeCmd->Se << 
101     "Define a spherical external source with t << 
102     "of a "                                    << 
103     "physical volume");                        << 
104   DefineSpherExtSourceCenteredOnAVolumeCmd->Se    109   DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
105   DefineSpherExtSourceCenteredOnAVolumeCmd->Se    110   DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
106   DefineSpherExtSourceCenteredOnAVolumeCmd->Se    111   DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
107                                                   112 
108   DefineExtSourceOnAVolumeExtSurfaceCmd =      << 113   DefineExtSourceOnAVolumeExtSurfaceCmd= new G4UIcmdWithAString("/adjoint/DefineExtSourceOnExtSurfaceOfAVolume",this);
109     new G4UIcmdWithAString("/adjoint/DefineExt << 114   DefineExtSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the external source on the external surface of a physical volume");
110   DefineExtSourceOnAVolumeExtSurfaceCmd->SetGu << 115   DefineExtSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false);
111     "Set the external source on the external s << 116   
112   DefineExtSourceOnAVolumeExtSurfaceCmd->SetPa << 117   setExtSourceEMaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetExtSourceEmax",this);
113                                                << 
114   setExtSourceEMaxCmd = new G4UIcmdWithADouble << 
115   setExtSourceEMaxCmd->SetGuidance("Set the ma    118   setExtSourceEMaxCmd->SetGuidance("Set the maximum  energy of the external source");
116   setExtSourceEMaxCmd->SetParameterName("Emax" << 119   setExtSourceEMaxCmd->SetParameterName("Emax",false);
117   setExtSourceEMaxCmd->SetUnitCategory("Energy    120   setExtSourceEMaxCmd->SetUnitCategory("Energy");
118   setExtSourceEMaxCmd->AvailableForStates(G4St << 121   setExtSourceEMaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
119                                                   122 
120   // Commands to define the adjoint source     << 123   //Commands to define the adjoint source
121   //------------------------------------------    124   //------------------------------------------------------------
122                                                   125 
123   DefineSpherAdjSourceCmd = new G4UIcommand("/ << 126   DefineSpherAdjSourceCmd = new G4UIcommand("/adjoint/DefineSphericalAdjSource",this);
124   DefineSpherAdjSourceCmd->SetGuidance("Define    127   DefineSpherAdjSourceCmd->SetGuidance("Define a spherical adjoint source.");
125   DefineSpherAdjSourceCmd->SetParameter(pos_x_    128   DefineSpherAdjSourceCmd->SetParameter(pos_x_par);
126   DefineSpherAdjSourceCmd->SetParameter(pos_y_    129   DefineSpherAdjSourceCmd->SetParameter(pos_y_par);
127   DefineSpherAdjSourceCmd->SetParameter(pos_z_    130   DefineSpherAdjSourceCmd->SetParameter(pos_z_par);
128   DefineSpherAdjSourceCmd->SetParameter(radius    131   DefineSpherAdjSourceCmd->SetParameter(radius_par);
129   DefineSpherAdjSourceCmd->SetParameter(unit_p    132   DefineSpherAdjSourceCmd->SetParameter(unit_par);
130                                                   133 
131   DefineSpherAdjSourceCenteredOnAVolumeCmd =   << 134   DefineSpherAdjSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalAdjSourceCenteredOnAVolume",this);
132     new G4UIcommand("/adjoint/DefineSphericalA << 135   DefineSpherAdjSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical adjoint source with the center located at the center of a physical volume");
133   DefineSpherAdjSourceCenteredOnAVolumeCmd->Se << 
134     "Define a spherical adjoint source with th << 
135     "of a "                                    << 
136     "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= new G4UIcmdWithAString("/adjoint/DefineAdjSourceOnExtSurfaceOfAVolume",this);
142     new G4UIcmdWithAString("/adjoint/DefineAdj << 141   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the adjoint source on the external surface of physical volume");
143   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetGu << 142   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false); 
144     "Set the adjoint source on the external su << 143   
145   DefineAdjSourceOnAVolumeExtSurfaceCmd->SetPa << 144   setAdjSourceEminCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmin",this);
146                                                << 
147   setAdjSourceEminCmd = new G4UIcmdWithADouble << 
148   setAdjSourceEminCmd->SetGuidance("Set the mi    145   setAdjSourceEminCmd->SetGuidance("Set the minimum energy  of the adjoint source");
149   setAdjSourceEminCmd->SetParameterName("Emin" << 146   setAdjSourceEminCmd->SetParameterName("Emin",false);
150   setAdjSourceEminCmd->SetUnitCategory("Energy    147   setAdjSourceEminCmd->SetUnitCategory("Energy");
151   setAdjSourceEminCmd->AvailableForStates(G4St << 148   setAdjSourceEminCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
152                                                << 149   
153   setAdjSourceEmaxCmd = new G4UIcmdWithADouble << 150   setAdjSourceEmaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmax",this);
154   setAdjSourceEmaxCmd->SetGuidance("Set the ma    151   setAdjSourceEmaxCmd->SetGuidance("Set the maximum energy of the adjoint source");
155   setAdjSourceEmaxCmd->SetParameterName("Emax" << 152   setAdjSourceEmaxCmd->SetParameterName("Emax",false);
156   setAdjSourceEmaxCmd->SetUnitCategory("Energy    153   setAdjSourceEmaxCmd->SetUnitCategory("Energy");
157   setAdjSourceEmaxCmd->AvailableForStates(G4St << 154   setAdjSourceEmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
158                                                   155 
159   ConsiderParticleAsPrimaryCmd = new G4UIcmdWi << 156   ConsiderParticleAsPrimaryCmd = new G4UIcmdWithAString("/adjoint/ConsiderAsPrimary",this);
160   ConsiderParticleAsPrimaryCmd->SetGuidance("S    157   ConsiderParticleAsPrimaryCmd->SetGuidance("Set the selected particle as primary");
161   ConsiderParticleAsPrimaryCmd->SetParameterNa << 158   ConsiderParticleAsPrimaryCmd->SetParameterName("particle",false);
162   ConsiderParticleAsPrimaryCmd->SetCandidates(    159   ConsiderParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
163                                                   160 
164   NeglectParticleAsPrimaryCmd = new G4UIcmdWit << 161   NeglectParticleAsPrimaryCmd= new G4UIcmdWithAString("/adjoint/NeglectAsPrimary",this);
165   NeglectParticleAsPrimaryCmd->SetGuidance(    << 162   NeglectParticleAsPrimaryCmd->SetGuidance("Remove the selected particle from the list of primaries");
166     "Remove the selected particle from the lis << 163   NeglectParticleAsPrimaryCmd->SetParameterName("particle",false);
167   NeglectParticleAsPrimaryCmd->SetParameterNam << 
168   NeglectParticleAsPrimaryCmd->SetCandidates("    164   NeglectParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
169                                                   165 
                                                   >> 166 
170   setNbOfPrimaryFwdGammasPerEventCmd =            167   setNbOfPrimaryFwdGammasPerEventCmd =
171     new G4UIcmdWithAnInteger("/adjoint/SetNbOf << 168             new G4UIcmdWithAnInteger("/adjoint/SetNbOfPrimaryFwdGammasPerEvent",this);
172   setNbOfPrimaryFwdGammasPerEventCmd->SetGuida << 169   setNbOfPrimaryFwdGammasPerEventCmd->SetGuidance("Set the nb of primary fwd gamm  generated on the adjoint source");
173     "Set the nb of primary fwd gamm  generated << 170   setNbOfPrimaryFwdGammasPerEventCmd->SetParameterName("Nb_gammas",false);
174   setNbOfPrimaryFwdGammasPerEventCmd->SetParam << 171   setNbOfPrimaryFwdGammasPerEventCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
175   setNbOfPrimaryFwdGammasPerEventCmd->Availabl << 
176                                                   172 
177   setNbOfPrimaryAdjGammasPerEventCmd =            173   setNbOfPrimaryAdjGammasPerEventCmd =
178     new G4UIcmdWithAnInteger("/adjoint/SetNbOf << 174               new G4UIcmdWithAnInteger("/adjoint/SetNbOfPrimaryAdjGammasPerEvent",this);
179   setNbOfPrimaryAdjGammasPerEventCmd->SetGuida << 175   setNbOfPrimaryAdjGammasPerEventCmd->SetGuidance("Set the nb of primary fwd gamm  generated on the adjoint source");
180     "Set the nb of primary fwd gamm  generated << 176   setNbOfPrimaryAdjGammasPerEventCmd->SetParameterName("Nb_gammas",false);
181   setNbOfPrimaryAdjGammasPerEventCmd->SetParam << 177   setNbOfPrimaryAdjGammasPerEventCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
182   setNbOfPrimaryAdjGammasPerEventCmd->Availabl << 
183                                                   178 
184   setNbOfPrimaryAdjElectronsPerEventCmd =         179   setNbOfPrimaryAdjElectronsPerEventCmd =
185     new G4UIcmdWithAnInteger("/adjoint/SetNbOf << 180               new G4UIcmdWithAnInteger("/adjoint/SetNbOfPrimaryAdjElectronsPerEvent",this);
186   setNbOfPrimaryAdjElectronsPerEventCmd->SetGu << 181   setNbOfPrimaryAdjElectronsPerEventCmd->SetGuidance("Set the nb of primary fwd gamm  generated on the adjoint source");
187     "Set the nb of primary fwd gamm  generated << 182   setNbOfPrimaryAdjElectronsPerEventCmd->SetParameterName("Nb_gammas",false);
188   setNbOfPrimaryAdjElectronsPerEventCmd->SetPa << 183   setNbOfPrimaryAdjElectronsPerEventCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
189   setNbOfPrimaryAdjElectronsPerEventCmd->Avail << 184 
                                                   >> 185 
                                                   >> 186 
                                                   >> 187 
190 }                                                 188 }
                                                   >> 189 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                                                   >> 190 //
                                                   >> 191 /*
                                                   >> 192 #ifdef G4MULTITHREADED
                                                   >> 193 G4AdjointSimMessenger::G4AdjointSimMessenger(G4MTAdjointSimManager* pAdjointRunManager)
                                                   >> 194   : theAdjointRunManager(0),theMTAdjointRunManager(pAdjointRunManager),DefineSpherExtSourceCmd(0),
                                                   >> 195     DefineSpherExtSourceCenteredOnAVolumeCmd(0), DefineExtSourceOnAVolumeExtSurfaceCmd(0),
                                                   >> 196     setExtSourceEMaxCmd(0),DefineSpherAdjSourceCmd(0),DefineSpherAdjSourceCenteredOnAVolumeCmd(0),
                                                   >> 197     DefineAdjSourceOnAVolumeExtSurfaceCmd(0),setAdjSourceEminCmd(0),setAdjSourceEmaxCmd(0),
                                                   >> 198     ConsiderParticleAsPrimaryCmd(0),NeglectParticleAsPrimaryCmd(0)
                                                   >> 199 {
                                                   >> 200   AdjointSimDir = new G4UIdirectory("/adjoint/");
                                                   >> 201   AdjointSimDir->SetGuidance("Control of the adjoint or reverse monte carlo simulation");
                                                   >> 202 
                                                   >> 203 
                                                   >> 204   //Start and adjoint Run
                                                   >> 205   //---------------------
                                                   >> 206   beamOnCmd = new G4UIcommand("/adjoint/start_run",this);
                                                   >> 207   beamOnCmd->SetGuidance("Start an adjoint Run.");
                                                   >> 208   beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
                                                   >> 209   beamOnCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
                                                   >> 210   G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true);
                                                   >> 211   p1->SetDefaultValue(1);
                                                   >> 212   p1->SetParameterRange("numberOfEvent >= 0");
                                                   >> 213   beamOnCmd->SetParameter(p1);
191                                                   214 
192 // ------------------------------------------- << 215 
                                                   >> 216   ConsiderParticleAsPrimaryCmd = new G4UIcmdWithAString("/adjoint/ConsiderAsPrimary",this);
                                                   >> 217   ConsiderParticleAsPrimaryCmd->SetGuidance("Set the selected particle as primary");
                                                   >> 218   ConsiderParticleAsPrimaryCmd->SetParameterName("particle",false);
                                                   >> 219   ConsiderParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
                                                   >> 220 
                                                   >> 221   NeglectParticleAsPrimaryCmd= new G4UIcmdWithAString("/adjoint/NeglectAsPrimary",this);
                                                   >> 222   NeglectParticleAsPrimaryCmd->SetGuidance("Remove the selected particle from the lits of primaries");
                                                   >> 223   NeglectParticleAsPrimaryCmd->SetParameterName("particle",false);
                                                   >> 224   NeglectParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
                                                   >> 225 
                                                   >> 226 
                                                   >> 227 }
                                                   >> 228 #endif
                                                   >> 229 */
                                                   >> 230 
                                                   >> 231 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
193 //                                                232 //
                                                   >> 233 
194 G4AdjointSimMessenger::~G4AdjointSimMessenger(    234 G4AdjointSimMessenger::~G4AdjointSimMessenger()
195 {                                                 235 {
196   delete setNbOfPrimaryAdjElectronsPerEventCmd << 236   if (beamOnCmd) delete beamOnCmd;
197   delete setNbOfPrimaryAdjGammasPerEventCmd;   << 
198   delete setNbOfPrimaryFwdGammasPerEventCmd;   << 
199   delete NeglectParticleAsPrimaryCmd;          << 
200   delete ConsiderParticleAsPrimaryCmd;         << 
201   delete setAdjSourceEmaxCmd;                  << 
202   delete setAdjSourceEminCmd;                  << 
203   delete DefineAdjSourceOnAVolumeExtSurfaceCmd << 
204   delete DefineSpherAdjSourceCenteredOnAVolume << 
205   delete DefineSpherAdjSourceCmd;              << 
206   delete setExtSourceEMaxCmd;                  << 
207   delete DefineExtSourceOnAVolumeExtSurfaceCmd << 
208   delete DefineSpherExtSourceCenteredOnAVolume << 
209   delete DefineSpherExtSourceCmd;              << 
210   delete beamOnCmd;                            << 
211   delete AdjointSimDir;                        << 
212 }                                                 237 }
213                                                   238 
214 // ------------------------------------------- << 239 ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
215 //                                                240 //
216 void G4AdjointSimMessenger::SetNewValue(G4UIco << 241 
                                                   >> 242 void G4AdjointSimMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
217 {                                                 243 {
218   if (command == nullptr) return;              << 244   if (!command) return;
219   if (command == beamOnCmd) {                  << 245   if( command==beamOnCmd )
                                                   >> 246   {
220     G4int nev;                                    247     G4int nev;
221     const auto nv = (const char*)newValue;     << 248     const char* nv = (const char*)newValue;
222     std::istringstream is(nv);                    249     std::istringstream is(nv);
223     is >> nev;                                 << 250     is >> nev ;
224     theAdjointRunManager->RunAdjointSimulation << 251     if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM) theAdjointRunManager->RunAdjointSimulation(nev);
225   }                                            << 252 /*
226   else if (command == ConsiderParticleAsPrimar << 253 #ifdef G4MULTITHREADED
227     theAdjointRunManager->ConsiderParticleAsPr << 254     else if (theMTAdjointRunManager) theMTAdjointRunManager->RunAdjointSimulation(nev);
228   }                                            << 255     else if (theAdjointRunManager) theAdjointRunManager->SwitchToAdjointSimulationMode();
229   else if (command == NeglectParticleAsPrimary << 256 #endif
230     theAdjointRunManager->NeglectParticleAsPri << 257 */
231   }                                            << 258     //G4cout<<"G4AdjointSimMessenger::SetNewValue BeamOnCmd out"<<std::endl;
232   if (command == DefineSpherExtSourceCmd) {    << 259   }
233     G4double x, y, z, r;                       << 260   else if ( command==ConsiderParticleAsPrimaryCmd){
                                                   >> 261      theAdjointRunManager->ConsiderParticleAsPrimary(newValue);
                                                   >> 262   }
                                                   >> 263   else if ( command==NeglectParticleAsPrimaryCmd){
                                                   >> 264      theAdjointRunManager->NeglectParticleAsPrimary(newValue);
                                                   >> 265   }
                                                   >> 266 /*
                                                   >> 267 #ifdef G4MULTITHREADED
                                                   >> 268   if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::masterRM) return;
                                                   >> 269 #endif
                                                   >> 270 */
                                                   >> 271   if ( command==DefineSpherExtSourceCmd){
                                                   >> 272     
                                                   >> 273     G4double  x,y,z,r;
234     G4String unit;                                274     G4String unit;
235     const auto nv = (const char*)newValue;     << 275     const char* nv = (const char*)newValue;
236     std::istringstream is(nv);                    276     std::istringstream is(nv);
237     is >> x >> y >> z >> r >> unit;            << 277     is >> x>>y>>z>>r>>unit;
238                                                << 278     
239     x *= G4UnitDefinition::GetValueOf(unit);   << 279     x*=G4UnitDefinition::GetValueOf(unit);
240     y *= G4UnitDefinition::GetValueOf(unit);   << 280     y*=G4UnitDefinition::GetValueOf(unit);
241     z *= G4UnitDefinition::GetValueOf(unit);   << 281     z*=G4UnitDefinition::GetValueOf(unit);
242     r *= G4UnitDefinition::GetValueOf(unit);   << 282     r*=G4UnitDefinition::GetValueOf(unit);
243     theAdjointRunManager->DefineSphericalExtSo << 283     theAdjointRunManager->DefineSphericalExtSource(r,G4ThreeVector(x,y,z));
244   }                                               284   }
245   else if (command == DefineSpherExtSourceCent << 285   else if ( command==DefineSpherExtSourceCenteredOnAVolumeCmd){
                                                   >> 286     
246     G4double r;                                   287     G4double r;
247     G4String vol_name, unit;                      288     G4String vol_name, unit;
248     const auto nv = (const char*)newValue;     << 289     const char* nv = (const char*)newValue;
249     std::istringstream is(nv);                    290     std::istringstream is(nv);
250     is >> vol_name >> r >> unit;               << 291     is >>vol_name>>r>>unit;
251     r *= G4UnitDefinition::GetValueOf(unit);   << 292     r*=G4UnitDefinition::GetValueOf(unit);
252     theAdjointRunManager->DefineSphericalExtSo << 293     theAdjointRunManager->DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
253   }                                            << 294   } 
254   else if (command == DefineExtSourceOnAVolume << 295   else if ( command==DefineExtSourceOnAVolumeExtSurfaceCmd){
255     theAdjointRunManager->DefineExtSourceOnThe    296     theAdjointRunManager->DefineExtSourceOnTheExtSurfaceOfAVolume(newValue);
256   }                                               297   }
257   else if (command == setExtSourceEMaxCmd) {   << 298   else if ( command== setExtSourceEMaxCmd){
                                                   >> 299 
258     theAdjointRunManager->SetExtSourceEmax(set    300     theAdjointRunManager->SetExtSourceEmax(setExtSourceEMaxCmd->GetNewDoubleValue(newValue));
259   }                                               301   }
260   else if (command == DefineSpherAdjSourceCmd) << 302   else if ( command==DefineSpherAdjSourceCmd){
261     G4double x, y, z, r;                       << 303     
                                                   >> 304     G4double  x,y,z,r;
262     G4String unit;                                305     G4String unit;
263     const auto nv = (const char*)newValue;     << 306     const char* nv = (const char*)newValue;
264     std::istringstream is(nv);                    307     std::istringstream is(nv);
265     is >> x >> y >> z >> r >> unit;            << 308     is >> x>>y>>z>>r>>unit;
266                                                << 309     
267     x *= G4UnitDefinition::GetValueOf(unit);   << 310     x*=G4UnitDefinition::GetValueOf(unit);
268     y *= G4UnitDefinition::GetValueOf(unit);   << 311     y*=G4UnitDefinition::GetValueOf(unit);
269     z *= G4UnitDefinition::GetValueOf(unit);   << 312     z*=G4UnitDefinition::GetValueOf(unit);
270     r *= G4UnitDefinition::GetValueOf(unit);   << 313     r*=G4UnitDefinition::GetValueOf(unit);
271     theAdjointRunManager->DefineSphericalAdjoi << 314     theAdjointRunManager->DefineSphericalAdjointSource(r,G4ThreeVector(x,y,z));
272   }                                               315   }
273   else if (command == DefineSpherAdjSourceCent << 316   else if ( command==DefineSpherAdjSourceCenteredOnAVolumeCmd){
                                                   >> 317     
274     G4double r;                                   318     G4double r;
275     G4String vol_name, unit;                      319     G4String vol_name, unit;
276     const auto nv = (const char*)newValue;     << 320     const char* nv = (const char*)newValue;
277     std::istringstream is(nv);                    321     std::istringstream is(nv);
278     is >> vol_name >> r >> unit;               << 322     is >>vol_name>>r>>unit;
279     r *= G4UnitDefinition::GetValueOf(unit);   << 323     r*=G4UnitDefinition::GetValueOf(unit);
280     theAdjointRunManager->DefineSphericalAdjoi << 324     theAdjointRunManager->DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
281   }                                               325   }
282   else if (command == DefineAdjSourceOnAVolume << 326   else if ( command==DefineAdjSourceOnAVolumeExtSurfaceCmd){
                                                   >> 327 
283     theAdjointRunManager->DefineAdjointSourceO    328     theAdjointRunManager->DefineAdjointSourceOnTheExtSurfaceOfAVolume(newValue);
284   }                                               329   }
285   else if (command == setAdjSourceEminCmd) {   << 330   else if ( command== setAdjSourceEminCmd){
                                                   >> 331     
286     theAdjointRunManager->SetAdjointSourceEmin    332     theAdjointRunManager->SetAdjointSourceEmin(setAdjSourceEminCmd->GetNewDoubleValue(newValue));
287   }                                               333   }
288   else if (command == setAdjSourceEmaxCmd) {   << 334   else if ( command== setAdjSourceEmaxCmd){
                                                   >> 335     
289     theAdjointRunManager->SetAdjointSourceEmax    336     theAdjointRunManager->SetAdjointSourceEmax(setAdjSourceEmaxCmd->GetNewDoubleValue(newValue));
290   }                                               337   }
291   else if (command == setNbOfPrimaryFwdGammasP << 338   else if ( command== setNbOfPrimaryFwdGammasPerEventCmd){
292     theAdjointRunManager->SetNbOfPrimaryFwdGam << 339     theAdjointRunManager->SetNbOfPrimaryFwdGammasPerEvent(setNbOfPrimaryFwdGammasPerEventCmd->GetNewIntValue(newValue));
293       setNbOfPrimaryFwdGammasPerEventCmd->GetN << 340   }
294   }                                            << 341   else if ( command== setNbOfPrimaryAdjGammasPerEventCmd){
295   else if (command == setNbOfPrimaryAdjGammasP << 342       theAdjointRunManager->SetNbAdjointPrimaryGammasPerEvent(setNbOfPrimaryAdjGammasPerEventCmd->GetNewIntValue(newValue));
296     theAdjointRunManager->SetNbAdjointPrimaryG << 
297       setNbOfPrimaryAdjGammasPerEventCmd->GetN << 
298   }                                            << 
299   else if (command == setNbOfPrimaryAdjElectro << 
300     theAdjointRunManager->SetNbAdjointPrimaryE << 
301       setNbOfPrimaryAdjElectronsPerEventCmd->G << 
302   }                                               343   }
                                                   >> 344   else if ( command== setNbOfPrimaryAdjElectronsPerEventCmd){
                                                   >> 345       theAdjointRunManager->SetNbAdjointPrimaryElectronsPerEvent(setNbOfPrimaryAdjElectronsPerEventCmd->GetNewIntValue(newValue));
                                                   >> 346   }
                                                   >> 347 
                                                   >> 348 
303 }                                                 349 }
                                                   >> 350 
304                                                   351