Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4AdjointSimMessenger Class Reference

#include <G4AdjointSimMessenger.hh>

+ Inheritance diagram for G4AdjointSimMessenger:

Public Member Functions

 G4AdjointSimMessenger (G4AdjointSimManager *)
 
 ~G4AdjointSimMessenger ()
 
void SetNewValue (G4UIcommand *, G4String)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
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)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 

Detailed Description

Definition at line 123 of file G4AdjointSimMessenger.hh.

Constructor & Destructor Documentation

◆ G4AdjointSimMessenger()

G4AdjointSimMessenger::G4AdjointSimMessenger ( G4AdjointSimManager pAdjointRunManager)

Definition at line 51 of file G4AdjointSimMessenger.cc.

52 : theAdjointRunManager(pAdjointRunManager)
53{
54 AdjointSimDir = new G4UIdirectory("/adjoint/");
55 AdjointSimDir->SetGuidance("Control of the adjoint or reverse monte carlo simulation");
56
57 //Start and adjoint Run
58 //---------------------
59
60 beamOnCmd = new G4UIcommand("/adjoint/start_run",this);
61 beamOnCmd->SetGuidance("Start an adjoint Run.");
62 beamOnCmd->SetGuidance("Default number of events to be processed is 1.");
64 G4UIparameter* p1 = new G4UIparameter("numberOfEvent",'i',true);
65 p1->SetDefaultValue(1);
66 p1->SetParameterRange("numberOfEvent >= 0");
67 beamOnCmd->SetParameter(p1);
68
69 //Commands to define parameters relative to the external source
70 //------------------------------------------------------------
71
72 G4UIparameter* pos_x_par = new G4UIparameter("X",'d',true);
73
74 G4UIparameter* pos_y_par = new G4UIparameter("Y",'d',true);
75
76 G4UIparameter* pos_z_par = new G4UIparameter("Z",'d',true);
77
78 G4UIparameter* radius_par = new G4UIparameter("R",'d',true);
79
80 radius_par->SetParameterRange("R >= 0");
81
82 G4UIparameter* unit_par = new G4UIparameter("unit",'s',true);
83
84 DefineSpherExtSourceCmd = new G4UIcommand("/adjoint/DefineSphericalExtSource",this);
85 DefineSpherExtSourceCmd->SetGuidance("Define a spherical external source.");
86 DefineSpherExtSourceCmd->SetParameter(pos_x_par);
87 DefineSpherExtSourceCmd->SetParameter(pos_y_par);
88 DefineSpherExtSourceCmd->SetParameter(pos_z_par);
89 DefineSpherExtSourceCmd->SetParameter(radius_par);
90 DefineSpherExtSourceCmd->SetParameter(unit_par);
91
92 G4UIparameter* phys_vol_name_par = new G4UIparameter("phys_vol_name",'s',true);
93
94 DefineSpherExtSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalExtSourceCenteredOnAVolume",this);
95 DefineSpherExtSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical external source with the center located at the center of a physical volume");
96 DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
97 DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
98 DefineSpherExtSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
99
100 DefineExtSourceOnAVolumeExtSurfaceCmd= new G4UIcmdWithAString("/adjoint/DefineExtSourceOnExtSurfaceOfAVolume",this);
101 DefineExtSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the external source on the external surface of a physical volume");
102 DefineExtSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false);
103
104 setExtSourceEMaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetExtSourceEmax",this);
105 setExtSourceEMaxCmd->SetGuidance("Set the maximum energy of the external source");
106 setExtSourceEMaxCmd->SetParameterName("Emax",false);
107 setExtSourceEMaxCmd->SetUnitCategory("Energy");
108 setExtSourceEMaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
109
110 //Commands to define the adjoint source
111 //------------------------------------------------------------
112
113 DefineSpherAdjSourceCmd = new G4UIcommand("/adjoint/DefineSphericalAdjSource",this);
114 DefineSpherAdjSourceCmd->SetGuidance("Define a spherical adjoint source.");
115 DefineSpherAdjSourceCmd->SetParameter(pos_x_par);
116 DefineSpherAdjSourceCmd->SetParameter(pos_y_par);
117 DefineSpherAdjSourceCmd->SetParameter(pos_z_par);
118 DefineSpherAdjSourceCmd->SetParameter(radius_par);
119 DefineSpherAdjSourceCmd->SetParameter(unit_par);
120
121 DefineSpherAdjSourceCenteredOnAVolumeCmd= new G4UIcommand("/adjoint/DefineSphericalAdjSourceCenteredOnAVolume",this);
122 DefineSpherAdjSourceCenteredOnAVolumeCmd->SetGuidance("Define a spherical adjoint source with the center located at the center of a physical volume");
123 DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(phys_vol_name_par);
124 DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(radius_par);
125 DefineSpherAdjSourceCenteredOnAVolumeCmd->SetParameter(unit_par);
126
127 DefineAdjSourceOnAVolumeExtSurfaceCmd= new G4UIcmdWithAString("/adjoint/DefineAdjSourceOnExtSurfaceOfAVolume",this);
128 DefineAdjSourceOnAVolumeExtSurfaceCmd->SetGuidance("Set the adjoint source on the external surface of physical volume");
129 DefineAdjSourceOnAVolumeExtSurfaceCmd->SetParameterName("phys_vol_name",false);
130
131 setAdjSourceEminCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmin",this);
132 setAdjSourceEminCmd->SetGuidance("Set the minimum energy of the adjoint source");
133 setAdjSourceEminCmd->SetParameterName("Emin",false);
134 setAdjSourceEminCmd->SetUnitCategory("Energy");
135 setAdjSourceEminCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
136
137 setAdjSourceEmaxCmd = new G4UIcmdWithADoubleAndUnit("/adjoint/SetAdjSourceEmax",this);
138 setAdjSourceEmaxCmd->SetGuidance("Set the maximum energy of the adjoint source");
139 setAdjSourceEmaxCmd->SetParameterName("Emax",false);
140 setAdjSourceEmaxCmd->SetUnitCategory("Energy");
141 setAdjSourceEmaxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
142
143 ConsiderParticleAsPrimaryCmd = new G4UIcmdWithAString("/adjoint/ConsiderAsPrimary",this);
144 ConsiderParticleAsPrimaryCmd->SetGuidance("Set the selected particle as primary");
145 ConsiderParticleAsPrimaryCmd->SetParameterName("particle",false);
146 ConsiderParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
147
148 NeglectParticleAsPrimaryCmd= new G4UIcmdWithAString("/adjoint/NeglectAsPrimary",this);
149 NeglectParticleAsPrimaryCmd->SetGuidance("Remove the selected particle from the lits of primaries");
150 NeglectParticleAsPrimaryCmd->SetParameterName("particle",false);
151 NeglectParticleAsPrimaryCmd->SetCandidates("e- gamma proton ion");
152}
@ G4State_Idle
@ G4State_PreInit
void SetUnitCategory(const char *unitCategory)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetCandidates(const char *candidateList)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:147
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:219
void SetDefaultValue(const char *theDefaultValue)
void SetParameterRange(const char *theRange)

◆ ~G4AdjointSimMessenger()

G4AdjointSimMessenger::~G4AdjointSimMessenger ( )

Definition at line 157 of file G4AdjointSimMessenger.cc.

158{
159 delete beamOnCmd;
160}

Member Function Documentation

◆ SetNewValue()

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

Reimplemented from G4UImessenger.

Definition at line 165 of file G4AdjointSimMessenger.cc.

166{
167 if( command==beamOnCmd )
168 {
169 G4int nev;
170 const char* nv = (const char*)newValue;
171 std::istringstream is(nv);
172 is >> nev ;
173 theAdjointRunManager->RunAdjointSimulation(nev);
174 }
175 else if ( command==DefineSpherExtSourceCmd){
176
177 G4double x,y,z,r;
178 G4String unit;
179 const char* nv = (const char*)newValue;
180 std::istringstream is(nv);
181 is >> x>>y>>z>>r>>unit;
182
187 theAdjointRunManager->DefineSphericalExtSource(r,G4ThreeVector(x,y,z));
188 }
189 else if ( command==DefineSpherExtSourceCenteredOnAVolumeCmd){
190
191 G4double r;
192 G4String vol_name, unit;
193 const char* nv = (const char*)newValue;
194 std::istringstream is(nv);
195 is >>vol_name>>r>>unit;
197 theAdjointRunManager->DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
198 }
199 else if ( command==DefineExtSourceOnAVolumeExtSurfaceCmd){
200 theAdjointRunManager->DefineExtSourceOnTheExtSurfaceOfAVolume(newValue);
201 }
202 else if ( command== setExtSourceEMaxCmd){
203
204 theAdjointRunManager->SetExtSourceEmax(setExtSourceEMaxCmd->GetNewDoubleValue(newValue));
205 }
206 else if ( command==DefineSpherAdjSourceCmd){
207
208 G4double x,y,z,r;
209 G4String unit;
210 const char* nv = (const char*)newValue;
211 std::istringstream is(nv);
212 is >> x>>y>>z>>r>>unit;
213
218 theAdjointRunManager->DefineSphericalAdjointSource(r,G4ThreeVector(x,y,z));
219 }
220 else if ( command==DefineSpherAdjSourceCenteredOnAVolumeCmd){
221
222 G4double r;
223 G4String vol_name, unit;
224 const char* nv = (const char*)newValue;
225 std::istringstream is(nv);
226 is >>vol_name>>r>>unit;
228 theAdjointRunManager->DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(r,vol_name);
229 }
230 else if ( command==DefineAdjSourceOnAVolumeExtSurfaceCmd){
231
232 theAdjointRunManager->DefineAdjointSourceOnTheExtSurfaceOfAVolume(newValue);
233 }
234 else if ( command== setAdjSourceEminCmd){
235
236 theAdjointRunManager->SetAdjointSourceEmin(setAdjSourceEminCmd->GetNewDoubleValue(newValue));
237 }
238 else if ( command== setAdjSourceEmaxCmd){
239
240 theAdjointRunManager->SetAdjointSourceEmax(setAdjSourceEmaxCmd->GetNewDoubleValue(newValue));
241 }
242 else if ( command==ConsiderParticleAsPrimaryCmd){
243
244 theAdjointRunManager->ConsiderParticleAsPrimary(newValue);
245 }
246 else if ( command==NeglectParticleAsPrimaryCmd){
247
248 theAdjointRunManager->NeglectParticleAsPrimary(newValue);
249 }
250}
CLHEP::Hep3Vector G4ThreeVector
double G4double
Definition: G4Types.hh:64
int G4int
Definition: G4Types.hh:66
G4bool DefineAdjointSourceOnTheExtSurfaceOfAVolume(const G4String &volume_name)
G4bool DefineExtSourceOnTheExtSurfaceOfAVolume(const G4String &volume_name)
void RunAdjointSimulation(G4int nb_evt)
G4bool DefineSphericalExtSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
void ConsiderParticleAsPrimary(const G4String &particle_name)
void SetExtSourceEmax(G4double Emax)
void SetAdjointSourceEmax(G4double Emax)
void SetAdjointSourceEmin(G4double Emin)
void NeglectParticleAsPrimary(const G4String &particle_name)
G4bool DefineSphericalAdjointSourceWithCentreAtTheCentreOfAVolume(G4double radius, const G4String &volume_name)
G4bool DefineSphericalExtSource(G4double radius, G4ThreeVector pos)
G4bool DefineSphericalAdjointSource(G4double radius, G4ThreeVector pos)
static G4double GetNewDoubleValue(const char *paramString)
static G4double GetValueOf(const G4String &)

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