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

#include <G4SchedulerMessenger.hh>

+ Inheritance diagram for G4SchedulerMessenger:

Public Member Functions

 G4SchedulerMessenger (G4Scheduler *runMgr)
 
 ~G4SchedulerMessenger () override
 
void SetNewValue (G4UIcommand *command, G4String newValues) override
 
G4String GetCurrentValue (G4UIcommand *command) override
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String LtoS (G4long l)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const 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 = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 65 of file G4SchedulerMessenger.hh.

Constructor & Destructor Documentation

◆ G4SchedulerMessenger()

G4SchedulerMessenger::G4SchedulerMessenger ( G4Scheduler * runMgr)
explicit

Definition at line 45 of file G4SchedulerMessenger.cc.

46 : fScheduler(stepMgr)
47{
48 fITDirectory = std::make_unique<G4UIdirectory>("/scheduler/");
49 fITDirectory->SetGuidance("Control commands for the time scheduler "
50 "(dna chemistry applications).");
51
52 // Set end time
53 fEndTime = std::make_unique<G4UIcmdWithADoubleAndUnit>("/scheduler/endTime", this);
54 fEndTime->SetGuidance("Set time at which the simulation must stop.");
55 fEndTime->AvailableForStates(G4State_PreInit, G4State_Idle);
56 fEndTime->SetUnitCategory("Time");
57 fEndTime->SetDefaultUnit("picosecond");
58 fEndTime->SetDefaultValue(1);
59
60 // Set time tolerance
61 fTimeTolerance = std::make_unique<G4UIcmdWithADoubleAndUnit>("/scheduler/timeTolerance", this);
62 fTimeTolerance->SetGuidance(
63 "This command aims at resolving issues related to"
64 " floating points. If two time events are separated by less than the "
65 "selected tolerance, they are assumed to belong to the same time step.");
66 fTimeTolerance->AvailableForStates(G4State_PreInit, G4State_Idle);
67 fTimeTolerance->SetUnitCategory("Time");
68 fTimeTolerance->SetDefaultUnit("picosecond");
69 fTimeTolerance->SetDefaultValue(1);
70
71 // Initialize
72 fInitCmd = std::make_unique<G4UIcmdWithoutParameter>("/scheduler/initialize", this);
73 fInitCmd->SetGuidance("Initialize G4Scheduler. This is done "
74 "for standalone application only (no physics).");
75 fInitCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
76
77 // Set Max Null time Step
78 fMaxNULLTimeSteps = std::make_unique<G4UIcmdWithAnInteger>("/scheduler/maxNullTimeSteps", this);
79 fMaxNULLTimeSteps->SetGuidance(
80 "Set maximum allowed zero time steps. After this "
81 "threshold, the simulation is stopped.");
82 fMaxNULLTimeSteps->SetParameterName("numberOfNullTimeSteps", true);
83 fMaxNULLTimeSteps->SetDefaultValue(10000);
84 fMaxNULLTimeSteps->SetRange("numberOfNullTimeSteps >=0 ");
85
86 fMaxStepNumber = std::make_unique<G4UIcmdWithAnInteger>("/scheduler/maxStepNumber", this);
87 fMaxStepNumber->SetGuidance(
88 "Set the maximum number of time steps. After this "
89 "threshold, the simulation is stopped.");
90 fMaxStepNumber->SetParameterName("maximumNumberOfSteps", true);
91 fMaxStepNumber->SetDefaultValue(-1);
92
93 // Beam On
94 fProcessCmd = std::make_unique<G4UIcmdWithoutParameter>("/scheduler/process", this);
95 fProcessCmd->SetGuidance(
96 "Process stacked tracks in G4Scheduler. This is done "
97 "for standalone application only (no physics).");
98 fProcessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
99
100 // Verbose
101 fVerboseCmd = std::make_unique<G4UIcmdWithAnInteger>("/scheduler/verbose", this);
102 fVerboseCmd->SetGuidance("Set the Verbose level of G4Scheduler.");
103 fVerboseCmd->SetGuidance(" 0 : Silent (default)");
104 fVerboseCmd->SetGuidance(" 1 : Display reactions");
105 fVerboseCmd->SetGuidance(" 2 ");
106 fVerboseCmd->SetParameterName("level", true);
107 fVerboseCmd->SetDefaultValue(1);
108
109 fWhyDoYouStop = std::make_unique<G4UIcmdWithoutParameter>("/scheduler/whyDoYouStop", this);
110 fWhyDoYouStop->SetGuidance("Will print information on why the scheduler is "
111 "stopping the process");
112
113 fUseDefaultTimeSteps = std::make_unique<G4UIcmdWithABool>("/scheduler/useDefaultTimeSteps", this);
114 fUseDefaultTimeSteps->SetGuidance(
115 "Let the G4 processes decided for the next "
116 "time step interval. This command would be interesting if no reaction has "
117 "been set and if one will want to track down Brownian objects. "
118 "NB: This command gets in conflicts with the declaration of time steps.");
119
120 fResetScavenger = std::make_unique<G4UIcmdWithABool>("/scheduler/ResetScavengerForEachBeamOn", this);
121 fResetScavenger->SetGuidance(
122 "Reset Scavenger information apres each BeamOn.");
123 fResetScavenger->SetDefaultValue(true);
124
125}
@ G4State_Idle
@ G4State_PreInit

◆ ~G4SchedulerMessenger()

G4SchedulerMessenger::~G4SchedulerMessenger ( )
overridedefault

Member Function Documentation

◆ GetCurrentValue()

G4String G4SchedulerMessenger::GetCurrentValue ( G4UIcommand * command)
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 175 of file G4SchedulerMessenger.cc.

176{
177 G4String cv;
178
179 if(command == fVerboseCmd.get())
180 {
181 cv = fVerboseCmd->ConvertToString(fScheduler->GetVerbose());
182 }
183 else if(command == fEndTime.get())
184 {
185 cv = fEndTime->ConvertToString(fScheduler->GetEndTime());
186 }
187 else if(command == fTimeTolerance.get())
188 {
189 cv = fTimeTolerance->ConvertToString(fScheduler->GetTimeTolerance());
190 }
191 else if(command == fInitCmd.get())
192 {
193 cv = fInitCmd->ConvertToString(fScheduler->IsInitialized());
194 }
195 else if(command == fMaxNULLTimeSteps.get())
196 {
197 cv =
198 fMaxNULLTimeSteps->ConvertToString(fScheduler->GetMaxZeroTimeAllowed());
199 }
200 else if(command == fMaxStepNumber.get())
201 {
202 cv = fMaxStepNumber->ConvertToString(fScheduler->GetMaxNbSteps());
203 }
204 else if(command == fUseDefaultTimeSteps.get())
205 {
206 cv = fUseDefaultTimeSteps->ConvertToString(
207 fScheduler->AreDefaultTimeStepsUsed());
208 }
209 return cv;
210}
G4double GetEndTime() const override
G4double GetTimeTolerance() const override
G4bool IsInitialized()
G4int GetMaxNbSteps() const override
G4int GetMaxZeroTimeAllowed() const override
G4bool AreDefaultTimeStepsUsed()
G4int GetVerbose() const

◆ SetNewValue()

void G4SchedulerMessenger::SetNewValue ( G4UIcommand * command,
G4String newValues )
overridevirtual

Reimplemented from G4UImessenger.

Definition at line 129 of file G4SchedulerMessenger.cc.

130{
131 if(command == fProcessCmd.get())
132 {
133 fScheduler->Process();
134 }
135 else if(command == fEndTime.get())
136 {
137 fScheduler->SetEndTime(fEndTime->GetNewDoubleValue(newValue));
138 }
139 else if(command == fTimeTolerance.get())
140 {
141 fScheduler->SetTimeTolerance(fTimeTolerance->GetNewDoubleValue(newValue));
142 }
143 else if(command == fVerboseCmd.get())
144 {
145 fScheduler->SetVerbose(fVerboseCmd->GetNewIntValue(newValue));
146 }
147 else if(command == fInitCmd.get())
148 {
149 fScheduler->Initialize();
150 }
151 else if(command == fMaxNULLTimeSteps.get())
152 {
153 fScheduler->SetMaxZeroTimeAllowed(
154 fMaxNULLTimeSteps->GetNewIntValue(newValue));
155 }
156 else if(command == fMaxStepNumber.get())
157 {
158 fScheduler->SetMaxNbSteps(fMaxStepNumber->GetNewIntValue(newValue));
159 }
160 else if(command == fWhyDoYouStop.get())
161 {
162 fScheduler->WhyDoYouStop();
163 }
164 else if(command == fUseDefaultTimeSteps.get())
165 {
166 fScheduler->UseDefaultTimeSteps(
167 fUseDefaultTimeSteps->GetNewBoolValue(newValue));
168 }
169 else if(command == fResetScavenger.get())
170 {
171 fScheduler->ResetScavenger(fResetScavenger->GetNewBoolValue(newValue));
172 }
173}
void SetEndTime(const G4double) override
void SetVerbose(G4int) override
void SetMaxZeroTimeAllowed(G4int) override
void SetMaxNbSteps(G4int) override
void Process() override
void Initialize() override
void SetTimeTolerance(G4double) override
void WhyDoYouStop()
void ResetScavenger(bool)
void UseDefaultTimeSteps(G4bool)

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