ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4SchedulerMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4SchedulerMessenger.cc
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // Author: Mathieu Karamitros (kara (AT) cenbg . in2p3 . fr)
28 //
29 // History:
30 // -----------
31 //
32 // -------------------------------------------------------------------
33 #include <G4Scheduler.hh>
34 #include <G4SchedulerMessenger.hh>
35 
36 #include "G4UIdirectory.hh"
38 #include "G4UIcmdWithAnInteger.hh"
40 #include "G4UIcmdWithABool.hh"
41 #include "G4UIcommand.hh"
42 #include "G4UIparameter.hh"
43 #include "G4UImanager.hh"
44 #include "G4ios.hh"
45 
47  fScheduler(stepMgr)
48 {
49  fITDirectory = new G4UIdirectory("/scheduler/");
50  fITDirectory->SetGuidance("Control commands for the time scheduler "
51  "(dna chemistry applications).");
52 
53  // Set end time
54  fEndTime = new G4UIcmdWithADoubleAndUnit("/scheduler/endTime", this);
55  fEndTime->SetGuidance("Set time at which the simulation must stop.");
57  fEndTime->SetUnitCategory("Time");
58  fEndTime->SetDefaultUnit("picosecond");
60 
61  // Set time tolerance
62  fTimeTolerance = new G4UIcmdWithADoubleAndUnit("/scheduler/timeTolerance",
63  this);
64  fTimeTolerance->SetGuidance("This command aims at resolving issues related to"
65  " floating points. If two time events are separated by less than the "
66  "selected tolerance, they are assumed to belong to the same time step.");
69  fTimeTolerance->SetDefaultUnit("picosecond");
71 
72  // Initialize
73  fInitCmd = new G4UIcmdWithoutParameter("/scheduler/initialize", this);
74  fInitCmd->SetGuidance("Initialize G4Scheduler. This is done "
75  "for standalone application only (no physics).");
77 
78  // Set Max Null time Step
79  fMaxNULLTimeSteps = new G4UIcmdWithAnInteger("/scheduler/maxNullTimeSteps",
80  this);
81  fMaxNULLTimeSteps->SetGuidance("Set maximum allowed zero time steps. After this "
82  "threshold, the simulation is stopped.");
83  fMaxNULLTimeSteps->SetParameterName("numberOfNullTimeSteps", true);
85  fMaxNULLTimeSteps->SetRange("numberOfNullTimeSteps >=0 ");
86 
87  fMaxStepNumber = new G4UIcmdWithAnInteger("/scheduler/maxStepNumber", this);
88  fMaxStepNumber->SetGuidance("Set the maximum number of time steps. After this "
89  "threshold, the simulation is stopped.");
90  fMaxStepNumber->SetParameterName("maximumNumberOfSteps", true);
92 
93  // Beam On
94  fProcessCmd = new G4UIcmdWithoutParameter("/scheduler/process", this);
95  fProcessCmd->SetGuidance("Process stacked tracks in G4Scheduler. This is done "
96  "for standalone application only (no physics).");
98 
99  // Verbose
100  fVerboseCmd = new G4UIcmdWithAnInteger("/scheduler/verbose", this);
101  fVerboseCmd->SetGuidance("Set the Verbose level of G4Scheduler.");
102  fVerboseCmd->SetGuidance(" 0 : Silent (default)");
103  fVerboseCmd->SetGuidance(" 1 : Display reactions");
104  fVerboseCmd->SetGuidance(" 2 ");
105  fVerboseCmd->SetParameterName("level", true);
107  // fVerboseCmd->SetRange("level >=0 && level <=4");
108 
109  fWhyDoYouStop = new G4UIcmdWithoutParameter("/scheduler/whyDoYouStop",this);
110  fWhyDoYouStop->SetGuidance("Will print information on why the scheduler is "
111  "stopping the process");
112 
113  fUseDefaultTimeSteps = new G4UIcmdWithABool("/scheduler/useDefaultTimeSteps",
114  this);
115  fUseDefaultTimeSteps->SetGuidance("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 
122 {
123  delete fTimeTolerance;
124  delete fITDirectory;
125  delete fInitCmd;
126  delete fEndTime;
127  delete fMaxNULLTimeSteps;
128  delete fMaxStepNumber;
129  delete fProcessCmd;
130  delete fVerboseCmd;
131  delete fWhyDoYouStop;
132  delete fUseDefaultTimeSteps;
133 }
134 
136  G4String newValue)
137 {
138  if (command == fProcessCmd)
139  {
140  fScheduler->Process();
141  }
142  else if (command == fEndTime)
143  {
145  }
146  else if (command == fTimeTolerance)
147  {
149  fTimeTolerance->GetNewDoubleValue(newValue));
150  }
151  else if (command == fVerboseCmd)
152  {
154  }
155  else if (command == fInitCmd)
156  {
158  }
159  else if (command == fMaxNULLTimeSteps)
160  {
162  fMaxNULLTimeSteps->GetNewIntValue(newValue));
163  }
164  else if (command == fMaxStepNumber)
165  {
167  }
168  else if (command == fWhyDoYouStop)
169  {
171  }
172  else if (command == fUseDefaultTimeSteps)
173  {
175  }
176 }
177 
179 {
180  G4String cv;
181 
182  if (command == fVerboseCmd)
183  {
185  }
186  else if (command == fEndTime)
187  {
189  }
190  else if (command == fTimeTolerance)
191  {
193  }
194  else if (command == fInitCmd)
195  {
197  }
198  else if (command == fMaxNULLTimeSteps)
199  {
202  }
203  else if (command == fMaxStepNumber)
204  {
206  }
207  else if (command == fUseDefaultTimeSteps)
208  {
210  }
211 
212  return cv;
213 }
214