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