Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4AdjointSimMessenger Class Reference

#include <G4AdjointSimMessenger.hh>

Inheritance diagram for G4AdjointSimMessenger:
G4UImessenger

Public Member Functions

 G4AdjointSimMessenger (G4AdjointSimManager *)
 
 ~G4AdjointSimMessenger ()
 
void SetNewValue (G4UIcommand *, G4String)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (G4String s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 

Detailed Description

Definition at line 128 of file G4AdjointSimMessenger.hh.

Constructor & Destructor Documentation

G4AdjointSimMessenger::G4AdjointSimMessenger ( G4AdjointSimManager pAdjointRunManager)

Definition at line 57 of file G4AdjointSimMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_Idle, G4State_PreInit, G4UIcmdWithAString::SetCandidates(), G4UIparameter::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithAString::SetParameterName(), G4UIcmdWithADoubleAndUnit::SetParameterName(), G4UIparameter::SetParameterRange(), and G4UIcmdWithADoubleAndUnit::SetUnitCategory().

58  : theAdjointRunManager(pAdjointRunManager)
59 /*
60 #ifdef G4MULTITHREADED
61  ,theMTAdjointRunManager(0),beamOnCmd(0)
62 #endif
63 */
64 
65 {
66  AdjointSimDir = new G4UIdirectory("/adjoint/");
67  AdjointSimDir->SetGuidance("Control of the adjoint or reverse monte carlo simulation");
68 
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.");
77  G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true);
78  p1->SetDefaultValue(1);
79  p1->SetParameterRange("numberOfEvent >= 0");
80  beamOnCmd->SetParameter(p1);
81  //}
82 
83  //Commands to define parameters relative to the external source
84  //------------------------------------------------------------
85 
86  G4UIparameter* pos_x_par = new G4UIparameter("X",'d',true);
87 
88  G4UIparameter* pos_y_par = new G4UIparameter("Y",'d',true);
89 
90  G4UIparameter* pos_z_par = new G4UIparameter("Z",'d',true);
91 
92  G4UIparameter* radius_par = new G4UIparameter("R",'d',true);
93 
94  radius_par->SetParameterRange("R >= 0");
95 
96  G4UIparameter* unit_par = new G4UIparameter("unit",'s',true);
97 
98  DefineSpherExtSourceCmd = new G4UIcommand("/adjoint/DefineSphericalExtSource",this);
99  DefineSpherExtSourceCmd->SetGuidance("Define a spherical external source.");
100  DefineSpherExtSourceCmd->SetParameter(pos_x_par);
101  DefineSpherExtSourceCmd->SetParameter(pos_y_par);
102  DefineSpherExtSourceCmd->SetParameter(pos_z_par);
103  DefineSpherExtSourceCmd->SetParameter(radius_par);
104  DefineSpherExtSourceCmd->SetParameter(unit_par);
105 
106  G4UIparameter* phys_vol_name_par = new G4UIparameter("phys_vol_name",'s',true);
107 
108  DefineSpherExtSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalExtSourceCenteredOnAVolume",this);
109  DefineSpherExtSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical external source with the center located at the center of a physical volume");
110  DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
111  DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
112  DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
113 
114  DefineExtSourceOnAVolumeExtSurfaceCmd= new G4UIcmdWithAString("/adjoint/DefineExtSourceOnExtSurfaceOfAVolume",this);
115  DefineExtSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the external source on the external surface of a physical volume");
116  DefineExtSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false);
117 
118  setExtSourceEMaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetExtSourceEmax",this);
119  setExtSourceEMaxCmd->SetGuidance("Set the maximum energy of the external source");
120  setExtSourceEMaxCmd->SetParameterName("Emax",false);
121  setExtSourceEMaxCmd->SetUnitCategory("Energy");
122  setExtSourceEMaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
123 
124  //Commands to define the adjoint source
125  //------------------------------------------------------------
126 
127  DefineSpherAdjSourceCmd = new G4UIcommand("/adjoint/DefineSphericalAdjSource",this);
128  DefineSpherAdjSourceCmd->SetGuidance("Define a spherical adjoint source.");
129  DefineSpherAdjSourceCmd->SetParameter(pos_x_par);
130  DefineSpherAdjSourceCmd->SetParameter(pos_y_par);
131  DefineSpherAdjSourceCmd->SetParameter(pos_z_par);
132  DefineSpherAdjSourceCmd->SetParameter(radius_par);
133  DefineSpherAdjSourceCmd->SetParameter(unit_par);
134 
135  DefineSpherAdjSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalAdjSourceCenteredOnAVolume",this);
136  DefineSpherAdjSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical adjoint source with the center located at the center of a physical volume");
137  DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
138  DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
139  DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
140 
141  DefineAdjSourceOnAVolumeExtSurfaceCmd= new G4UIcmdWithAString("/adjoint/DefineAdjSourceOnExtSurfaceOfAVolume",this);
142  DefineAdjSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the adjoint source on the external surface of physical volume");
143  DefineAdjSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false);
144 
145  setAdjSourceEminCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmin",this);
146  setAdjSourceEminCmd->SetGuidance("Set the minimum energy of the adjoint source");
147  setAdjSourceEminCmd->SetParameterName("Emin",false);
148  setAdjSourceEminCmd->SetUnitCategory("Energy");
149  setAdjSourceEminCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
150 
151  setAdjSourceEmaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmax",this);
152  setAdjSourceEmaxCmd->SetGuidance("Set the maximum energy of the adjoint source");
153  setAdjSourceEmaxCmd->SetParameterName("Emax",false);
154  setAdjSourceEmaxCmd->SetUnitCategory("Energy");
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 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterRange(const char *theRange)
void SetDefaultValue(const char *theDefaultValue)
void SetUnitCategory(const char *unitCategory)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4AdjointSimMessenger::~G4AdjointSimMessenger ( )

Definition at line 212 of file G4AdjointSimMessenger.cc.

213 {
214  if (beamOnCmd) delete beamOnCmd;
215 }

Member Function Documentation

void G4AdjointSimMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 220 of file G4AdjointSimMessenger.cc.

References G4AdjointSimManager::ConsiderParticleAsPrimary(), G4AdjointSimManager::DefineAdjointSourceOnTheExtSurfaceOfAVolume(), G4AdjointSimManager::DefineExtSourceOnTheExtSurfaceOfAVolume(), G4AdjointSimManager::DefineSphericalAdjointSource(), G4AdjointSimManager::DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(), G4AdjointSimManager::DefineSphericalExtSource(), G4AdjointSimManager::DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(), G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), G4RunManager::GetRunManager(), G4UnitDefinition::GetValueOf(), G4AdjointSimManager::NeglectParticleAsPrimary(), G4AdjointSimManager::RunAdjointSimulation(), G4RunManager::sequentialRM, G4AdjointSimManager::SetAdjointSourceEmax(), G4AdjointSimManager::SetAdjointSourceEmin(), G4AdjointSimManager::SetExtSourceEmax(), test::x, and z.

221 {
222  if (!command) return;
223  if( command==beamOnCmd )
224  {
225  G4int nev;
226  const char* nv = (const char*)newValue;
227  std::istringstream is(nv);
228  is >> nev ;
229  if (G4RunManager::GetRunManager()->GetRunManagerType() == G4RunManager::sequentialRM) theAdjointRunManager->RunAdjointSimulation(nev);
230 /*
231 #ifdef G4MULTITHREADED
232  else if (theMTAdjointRunManager) theMTAdjointRunManager->RunAdjointSimulation(nev);
233  else if (theAdjointRunManager) theAdjointRunManager->SwitchToAdjointSimulationMode();
234 #endif
235 */
236  //G4cout<<"G4AdjointSimMessenger::SetNewValue BeamOnCmd out"<<std::endl;
237  }
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;
252  G4String unit;
253  const char* nv = (const char*)newValue;
254  std::istringstream is(nv);
255  is >> x>>y>>z>>r>>unit;
256 
261  theAdjointRunManager->DefineSphericalExtSource(r,G4ThreeVector(x,y,z));
262  }
263  else if ( command==DefineSpherExtSourceCenteredOnAVolumeCmd){
264 
265  G4double r;
266  G4String vol_name, unit;
267  const char* nv = (const char*)newValue;
268  std::istringstream is(nv);
269  is >>vol_name>>r>>unit;
271  theAdjointRunManager->DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
272  }
273  else if ( command==DefineExtSourceOnAVolumeExtSurfaceCmd){
274  theAdjointRunManager->DefineExtSourceOnTheExtSurfaceOfAVolume(newValue);
275  }
276  else if ( command== setExtSourceEMaxCmd){
277 
278  theAdjointRunManager->SetExtSourceEmax(setExtSourceEMaxCmd->GetNewDoubleValue(newValue));
279  }
280  else if ( command==DefineSpherAdjSourceCmd){
281 
282  G4double x,y,z,r;
283  G4String unit;
284  const char* nv = (const char*)newValue;
285  std::istringstream is(nv);
286  is >> x>>y>>z>>r>>unit;
287 
292  theAdjointRunManager->DefineSphericalAdjointSource(r,G4ThreeVector(x,y,z));
293  }
294  else if ( command==DefineSpherAdjSourceCenteredOnAVolumeCmd){
295 
296  G4double r;
297  G4String vol_name, unit;
298  const char* nv = (const char*)newValue;
299  std::istringstream is(nv);
300  is >>vol_name>>r>>unit;
302  theAdjointRunManager->DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
303  }
304  else if ( command==DefineAdjSourceOnAVolumeExtSurfaceCmd){
305 
306  theAdjointRunManager->DefineAdjointSourceOnTheExtSurfaceOfAVolume(newValue);
307  }
308  else if ( command== setAdjSourceEminCmd){
309 
310  theAdjointRunManager->SetAdjointSourceEmin(setAdjSourceEminCmd->GetNewDoubleValue(newValue));
311  }
312  else if ( command== setAdjSourceEmaxCmd){
313 
314  theAdjointRunManager->SetAdjointSourceEmax(setAdjSourceEmaxCmd->GetNewDoubleValue(newValue));
315  }
316 
317 
318 }
void SetAdjointSourceEmax(G4double Emax)
CLHEP::Hep3Vector G4ThreeVector
G4double z
Definition: TRTMaterials.hh:39
G4bool DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
G4bool DefineSphericalAdjointSource(G4double radius, G4ThreeVector pos)
static G4double GetNewDoubleValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
void SetAdjointSourceEmin(G4double Emin)
static G4double GetValueOf(const G4String &)
G4bool DefineAdjointSourceOnTheExtSurfaceOfAVolume(const G4String &volume_name)
void RunAdjointSimulation(G4int nb_evt)
G4bool DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
G4bool DefineSphericalExtSource(G4double radius, G4ThreeVector pos)
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
void ConsiderParticleAsPrimary(const G4String &particle_name)
G4bool DefineExtSourceOnTheExtSurfaceOfAVolume(const G4String &volume_name)
double G4double
Definition: G4Types.hh:76
void SetExtSourceEmax(G4double Emax)
void NeglectParticleAsPrimary(const G4String &particle_name)

The documentation for this class was generated from the following files: