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 76245 2013-11-08 11:14:32Z 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 69 >> 70 //Start and adjoint Run >> 71 //--------------------- >> 72 //if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM){ >> 73 beamOnCmd = new G4UIcommand("/adjoint/start_run",this); >> 74 beamOnCmd->SetGuidance("Start an adjoint Run."); >> 75 beamOnCmd->SetGuidance("Default number of events to be processed is 1."); >> 76 beamOnCmd->AvailableForStates(G4State_PreInit,G4State_Idle); >> 77 G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true); >> 78 p1->SetDefaultValue(1); >> 79 p1->SetParameterRange("numberOfEvent >= 0"); >> 80 beamOnCmd->SetParameter(p1); >> 81 //} 63 82 64 beamOnCmd = new G4UIcommand("/adjoint/start_ << 83 //Commands to define parameters relative to the external source 65 beamOnCmd->SetGuidance("Start an adjoint Run << 66 beamOnCmd->SetGuidance("Default number of ev << 67 beamOnCmd->AvailableForStates(G4State_PreIni << 68 auto p1 = new G4UIparameter("numberOfEvent", << 69 p1->SetDefaultValue(1); << 70 p1->SetParameterRange("numberOfEvent >= 0"); << 71 beamOnCmd->SetParameter(p1); << 72 << 73 // Commands to define parameters relative to << 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); >> 156 >> 157 ConsiderParticleAsPrimaryCmd = new G4UIcmdWithAString("/adjoint/ConsiderAsPrimary",this); >> 158 ConsiderParticleAsPrimaryCmd->SetGuidance("Set the selected particle as primary"); >> 159 ConsiderParticleAsPrimaryCmd->SetParameterName("particle",false); >> 160 ConsiderParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion"); >> 161 >> 162 NeglectParticleAsPrimaryCmd= new G4UIcmdWithAString("/adjoint/NeglectAsPrimary",this); >> 163 NeglectParticleAsPrimaryCmd->SetGuidance("Remove the selected particle from the lits of primaries"); >> 164 NeglectParticleAsPrimaryCmd->SetParameterName("particle",false); >> 165 NeglectParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion"); >> 166 } >> 167 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// >> 168 // >> 169 /* >> 170 #ifdef G4MULTITHREADED >> 171 G4AdjointSimMessenger::G4AdjointSimMessenger(G4MTAdjointSimManager* pAdjointRunManager) >> 172 : theAdjointRunManager(0),theMTAdjointRunManager(pAdjointRunManager),DefineSpherExtSourceCmd(0), >> 173 DefineSpherExtSourceCenteredOnAVolumeCmd(0), DefineExtSourceOnAVolumeExtSurfaceCmd(0), >> 174 setExtSourceEMaxCmd(0),DefineSpherAdjSourceCmd(0),DefineSpherAdjSourceCenteredOnAVolumeCmd(0), >> 175 DefineAdjSourceOnAVolumeExtSurfaceCmd(0),setAdjSourceEminCmd(0),setAdjSourceEmaxCmd(0), >> 176 ConsiderParticleAsPrimaryCmd(0),NeglectParticleAsPrimaryCmd(0) >> 177 { >> 178 AdjointSimDir = new G4UIdirectory("/adjoint/"); >> 179 AdjointSimDir->SetGuidance("Control of the adjoint or reverse monte carlo simulation"); >> 180 >> 181 >> 182 //Start and adjoint Run >> 183 //--------------------- >> 184 beamOnCmd = new G4UIcommand("/adjoint/start_run",this); >> 185 beamOnCmd->SetGuidance("Start an adjoint Run."); >> 186 beamOnCmd->SetGuidance("Default number of events to be processed is 1."); >> 187 beamOnCmd->AvailableForStates(G4State_PreInit,G4State_Idle); >> 188 G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true); >> 189 p1->SetDefaultValue(1); >> 190 p1->SetParameterRange("numberOfEvent >= 0"); >> 191 beamOnCmd->SetParameter(p1); >> 192 158 193 159 ConsiderParticleAsPrimaryCmd = new G4UIcmdWi << 194 ConsiderParticleAsPrimaryCmd = new G4UIcmdWithAString("/adjoint/ConsiderAsPrimary",this); 160 ConsiderParticleAsPrimaryCmd->SetGuidance("S 195 ConsiderParticleAsPrimaryCmd->SetGuidance("Set the selected particle as primary"); 161 ConsiderParticleAsPrimaryCmd->SetParameterNa << 196 ConsiderParticleAsPrimaryCmd->SetParameterName("particle",false); 162 ConsiderParticleAsPrimaryCmd->SetCandidates( 197 ConsiderParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion"); 163 198 164 NeglectParticleAsPrimaryCmd = new G4UIcmdWit << 199 NeglectParticleAsPrimaryCmd= new G4UIcmdWithAString("/adjoint/NeglectAsPrimary",this); 165 NeglectParticleAsPrimaryCmd->SetGuidance( << 200 NeglectParticleAsPrimaryCmd->SetGuidance("Remove the selected particle from the lits of primaries"); 166 "Remove the selected particle from the lis << 201 NeglectParticleAsPrimaryCmd->SetParameterName("particle",false); 167 NeglectParticleAsPrimaryCmd->SetParameterNam << 168 NeglectParticleAsPrimaryCmd->SetCandidates(" 202 NeglectParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion"); 169 203 170 setNbOfPrimaryFwdGammasPerEventCmd = << 204 171 new G4UIcmdWithAnInteger("/adjoint/SetNbOf << 172 setNbOfPrimaryFwdGammasPerEventCmd->SetGuida << 173 "Set the nb of primary fwd gamm generated << 174 setNbOfPrimaryFwdGammasPerEventCmd->SetParam << 175 setNbOfPrimaryFwdGammasPerEventCmd->Availabl << 176 << 177 setNbOfPrimaryAdjGammasPerEventCmd = << 178 new G4UIcmdWithAnInteger("/adjoint/SetNbOf << 179 setNbOfPrimaryAdjGammasPerEventCmd->SetGuida << 180 "Set the nb of primary fwd gamm generated << 181 setNbOfPrimaryAdjGammasPerEventCmd->SetParam << 182 setNbOfPrimaryAdjGammasPerEventCmd->Availabl << 183 << 184 setNbOfPrimaryAdjElectronsPerEventCmd = << 185 new G4UIcmdWithAnInteger("/adjoint/SetNbOf << 186 setNbOfPrimaryAdjElectronsPerEventCmd->SetGu << 187 "Set the nb of primary fwd gamm generated << 188 setNbOfPrimaryAdjElectronsPerEventCmd->SetPa << 189 setNbOfPrimaryAdjElectronsPerEventCmd->Avail << 190 } 205 } >> 206 #endif >> 207 */ 191 208 192 // ------------------------------------------- << 209 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 193 // 210 // >> 211 194 G4AdjointSimMessenger::~G4AdjointSimMessenger( 212 G4AdjointSimMessenger::~G4AdjointSimMessenger() 195 { 213 { 196 delete setNbOfPrimaryAdjElectronsPerEventCmd << 214 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 } 215 } 213 216 214 // ------------------------------------------- << 217 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 215 // 218 // 216 void G4AdjointSimMessenger::SetNewValue(G4UIco << 219 >> 220 void G4AdjointSimMessenger::SetNewValue(G4UIcommand* command,G4String newValue) 217 { 221 { 218 if (command == nullptr) return; << 222 if (!command) return; 219 if (command == beamOnCmd) { << 223 if( command==beamOnCmd ) >> 224 { 220 G4int nev; 225 G4int nev; 221 const auto nv = (const char*)newValue; << 226 const char* nv = (const char*)newValue; 222 std::istringstream is(nv); 227 std::istringstream is(nv); 223 is >> nev; << 228 is >> nev ; 224 theAdjointRunManager->RunAdjointSimulation << 229 if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM) theAdjointRunManager->RunAdjointSimulation(nev); 225 } << 230 /* 226 else if (command == ConsiderParticleAsPrimar << 231 #ifdef G4MULTITHREADED 227 theAdjointRunManager->ConsiderParticleAsPr << 232 else if (theMTAdjointRunManager) theMTAdjointRunManager->RunAdjointSimulation(nev); 228 } << 233 else if (theAdjointRunManager) theAdjointRunManager->SwitchToAdjointSimulationMode(); 229 else if (command == NeglectParticleAsPrimary << 234 #endif 230 theAdjointRunManager->NeglectParticleAsPri << 235 */ 231 } << 236 //G4cout<<"G4AdjointSimMessenger::SetNewValue BeamOnCmd out"<<std::endl; 232 if (command == DefineSpherExtSourceCmd) { << 237 } 233 G4double x, y, z, r; << 238 else if ( command==ConsiderParticleAsPrimaryCmd){ >> 239 theAdjointRunManager->ConsiderParticleAsPrimary(newValue); >> 240 } >> 241 else if ( command==NeglectParticleAsPrimaryCmd){ >> 242 theAdjointRunManager->NeglectParticleAsPrimary(newValue); >> 243 } >> 244 /* >> 245 #ifdef G4MULTITHREADED >> 246 if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::masterRM) return; >> 247 #endif >> 248 */ >> 249 if ( command==DefineSpherExtSourceCmd){ >> 250 >> 251 G4double x,y,z,r; 234 G4String unit; 252 G4String unit; 235 const auto nv = (const char*)newValue; << 253 const char* nv = (const char*)newValue; 236 std::istringstream is(nv); 254 std::istringstream is(nv); 237 is >> x >> y >> z >> r >> unit; << 255 is >> x>>y>>z>>r>>unit; 238 << 256 239 x *= G4UnitDefinition::GetValueOf(unit); << 257 x*=G4UnitDefinition::GetValueOf(unit); 240 y *= G4UnitDefinition::GetValueOf(unit); << 258 y*=G4UnitDefinition::GetValueOf(unit); 241 z *= G4UnitDefinition::GetValueOf(unit); << 259 z*=G4UnitDefinition::GetValueOf(unit); 242 r *= G4UnitDefinition::GetValueOf(unit); << 260 r*=G4UnitDefinition::GetValueOf(unit); 243 theAdjointRunManager->DefineSphericalExtSo << 261 theAdjointRunManager->DefineSphericalExtSource(r,G4ThreeVector(x,y,z)); 244 } 262 } 245 else if (command == DefineSpherExtSourceCent << 263 else if ( command==DefineSpherExtSourceCenteredOnAVolumeCmd){ >> 264 246 G4double r; 265 G4double r; 247 G4String vol_name, unit; 266 G4String vol_name, unit; 248 const auto nv = (const char*)newValue; << 267 const char* nv = (const char*)newValue; 249 std::istringstream is(nv); 268 std::istringstream is(nv); 250 is >> vol_name >> r >> unit; << 269 is >>vol_name>>r>>unit; 251 r *= G4UnitDefinition::GetValueOf(unit); << 270 r*=G4UnitDefinition::GetValueOf(unit); 252 theAdjointRunManager->DefineSphericalExtSo << 271 theAdjointRunManager->DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(r,vol_name); 253 } << 272 } 254 else if (command == DefineExtSourceOnAVolume << 273 else if ( command==DefineExtSourceOnAVolumeExtSurfaceCmd){ 255 theAdjointRunManager->DefineExtSourceOnThe 274 theAdjointRunManager->DefineExtSourceOnTheExtSurfaceOfAVolume(newValue); 256 } 275 } 257 else if (command == setExtSourceEMaxCmd) { << 276 else if ( command== setExtSourceEMaxCmd){ >> 277 258 theAdjointRunManager->SetExtSourceEmax(set 278 theAdjointRunManager->SetExtSourceEmax(setExtSourceEMaxCmd->GetNewDoubleValue(newValue)); 259 } 279 } 260 else if (command == DefineSpherAdjSourceCmd) << 280 else if ( command==DefineSpherAdjSourceCmd){ 261 G4double x, y, z, r; << 281 >> 282 G4double x,y,z,r; 262 G4String unit; 283 G4String unit; 263 const auto nv = (const char*)newValue; << 284 const char* nv = (const char*)newValue; 264 std::istringstream is(nv); 285 std::istringstream is(nv); 265 is >> x >> y >> z >> r >> unit; << 286 is >> x>>y>>z>>r>>unit; 266 << 287 267 x *= G4UnitDefinition::GetValueOf(unit); << 288 x*=G4UnitDefinition::GetValueOf(unit); 268 y *= G4UnitDefinition::GetValueOf(unit); << 289 y*=G4UnitDefinition::GetValueOf(unit); 269 z *= G4UnitDefinition::GetValueOf(unit); << 290 z*=G4UnitDefinition::GetValueOf(unit); 270 r *= G4UnitDefinition::GetValueOf(unit); << 291 r*=G4UnitDefinition::GetValueOf(unit); 271 theAdjointRunManager->DefineSphericalAdjoi << 292 theAdjointRunManager->DefineSphericalAdjointSource(r,G4ThreeVector(x,y,z)); 272 } 293 } 273 else if (command == DefineSpherAdjSourceCent << 294 else if ( command==DefineSpherAdjSourceCenteredOnAVolumeCmd){ >> 295 274 G4double r; 296 G4double r; 275 G4String vol_name, unit; 297 G4String vol_name, unit; 276 const auto nv = (const char*)newValue; << 298 const char* nv = (const char*)newValue; 277 std::istringstream is(nv); 299 std::istringstream is(nv); 278 is >> vol_name >> r >> unit; << 300 is >>vol_name>>r>>unit; 279 r *= G4UnitDefinition::GetValueOf(unit); << 301 r*=G4UnitDefinition::GetValueOf(unit); 280 theAdjointRunManager->DefineSphericalAdjoi << 302 theAdjointRunManager->DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(r,vol_name); 281 } 303 } 282 else if (command == DefineAdjSourceOnAVolume << 304 else if ( command==DefineAdjSourceOnAVolumeExtSurfaceCmd){ >> 305 283 theAdjointRunManager->DefineAdjointSourceO 306 theAdjointRunManager->DefineAdjointSourceOnTheExtSurfaceOfAVolume(newValue); 284 } 307 } 285 else if (command == setAdjSourceEminCmd) { << 308 else if ( command== setAdjSourceEminCmd){ >> 309 286 theAdjointRunManager->SetAdjointSourceEmin 310 theAdjointRunManager->SetAdjointSourceEmin(setAdjSourceEminCmd->GetNewDoubleValue(newValue)); 287 } 311 } 288 else if (command == setAdjSourceEmaxCmd) { << 312 else if ( command== setAdjSourceEmaxCmd){ >> 313 289 theAdjointRunManager->SetAdjointSourceEmax 314 theAdjointRunManager->SetAdjointSourceEmax(setAdjSourceEmaxCmd->GetNewDoubleValue(newValue)); 290 } 315 } 291 else if (command == setNbOfPrimaryFwdGammasP << 316 292 theAdjointRunManager->SetNbOfPrimaryFwdGam << 317 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 } << 303 } 318 } >> 319 304 320