Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 // 27 // Author: Mathieu Karamitros (kara (AT) cenbg 28 // 29 // History: 30 // ----------- 31 // 32 // ------------------------------------------- 33 #include <G4Scheduler.hh> 34 #include <G4SchedulerMessenger.hh> 35 #include "G4UIdirectory.hh" 36 #include "G4UIcmdWithoutParameter.hh" 37 #include "G4UIcmdWithAnInteger.hh" 38 #include "G4UIcmdWithADoubleAndUnit.hh" 39 #include "G4UIcmdWithABool.hh" 40 #include "G4UIcmdWithAString.hh" 41 #include "G4UIcommand.hh" 42 #include "G4UIparameter.hh" 43 #include "G4ios.hh" 44 45 G4SchedulerMessenger::G4SchedulerMessenger(G4S 46 : fScheduler(stepMgr) 47 { 48 fITDirectory = std::make_unique<G4UIdirector 49 fITDirectory->SetGuidance("Control commands 50 "(dna chemistry ap 51 52 // Set end time 53 fEndTime = std::make_unique<G4UIcmdWithADoub 54 fEndTime->SetGuidance("Set time at which the 55 fEndTime->AvailableForStates(G4State_PreInit 56 fEndTime->SetUnitCategory("Time"); 57 fEndTime->SetDefaultUnit("picosecond"); 58 fEndTime->SetDefaultValue(1); 59 60 // Set time tolerance 61 fTimeTolerance = std::make_unique<G4UIcmdWit 62 fTimeTolerance->SetGuidance( 63 "This command aims at resolving issues rel 64 " floating points. If two time events are 65 "selected tolerance, they are assumed to b 66 fTimeTolerance->AvailableForStates(G4State_P 67 fTimeTolerance->SetUnitCategory("Time"); 68 fTimeTolerance->SetDefaultUnit("picosecond") 69 fTimeTolerance->SetDefaultValue(1); 70 71 // Initialize 72 fInitCmd = std::make_unique<G4UIcmdWithoutPa 73 fInitCmd->SetGuidance("Initialize G4Schedule 74 "for standalone applic 75 fInitCmd->AvailableForStates(G4State_PreInit 76 77 // Set Max Null time Step 78 fMaxNULLTimeSteps = std::make_unique<G4UIcmd 79 fMaxNULLTimeSteps->SetGuidance( 80 "Set maximum allowed zero time steps. Afte 81 "threshold, the simulation is stopped."); 82 fMaxNULLTimeSteps->SetParameterName("numberO 83 fMaxNULLTimeSteps->SetDefaultValue(10000); 84 fMaxNULLTimeSteps->SetRange("numberOfNullTim 85 86 fMaxStepNumber = std::make_unique<G4UIcmdWit 87 fMaxStepNumber->SetGuidance( 88 "Set the maximum number of time steps. Aft 89 "threshold, the simulation is stopped."); 90 fMaxStepNumber->SetParameterName("maximumNum 91 fMaxStepNumber->SetDefaultValue(-1); 92 93 // Beam On 94 fProcessCmd = std::make_unique<G4UIcmdWithou 95 fProcessCmd->SetGuidance( 96 "Process stacked tracks in G4Scheduler. Th 97 "for standalone application only (no physi 98 fProcessCmd->AvailableForStates(G4State_PreI 99 100 // Verbose 101 fVerboseCmd = std::make_unique<G4UIcmdWithAn 102 fVerboseCmd->SetGuidance("Set the Verbose le 103 fVerboseCmd->SetGuidance(" 0 : Silent (defau 104 fVerboseCmd->SetGuidance(" 1 : Display react 105 fVerboseCmd->SetGuidance(" 2 "); 106 fVerboseCmd->SetParameterName("level", true) 107 fVerboseCmd->SetDefaultValue(1); 108 109 fWhyDoYouStop = std::make_unique<G4UIcmdWith 110 fWhyDoYouStop->SetGuidance("Will print infor 111 "stopping the pro 112 113 fUseDefaultTimeSteps = std::make_unique<G4UI 114 fUseDefaultTimeSteps->SetGuidance( 115 "Let the G4 processes decided for the next 116 "time step interval. This command would be 117 "been set and if one will want to track do 118 "NB: This command gets in conflicts with t 119 120 fResetScavenger = std::make_unique<G4UIcmdWi 121 fResetScavenger->SetGuidance( 122 "Reset Scavenger information apres each Be 123 fResetScavenger->SetDefaultValue(true); 124 125 } 126 127 G4SchedulerMessenger::~G4SchedulerMessenger() 128 129 void G4SchedulerMessenger::SetNewValue(G4UIcom 130 { 131 if(command == fProcessCmd.get()) 132 { 133 fScheduler->Process(); 134 } 135 else if(command == fEndTime.get()) 136 { 137 fScheduler->SetEndTime(fEndTime->GetNewDou 138 } 139 else if(command == fTimeTolerance.get()) 140 { 141 fScheduler->SetTimeTolerance(fTimeToleranc 142 } 143 else if(command == fVerboseCmd.get()) 144 { 145 fScheduler->SetVerbose(fVerboseCmd->GetNew 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(newVal 155 } 156 else if(command == fMaxStepNumber.get()) 157 { 158 fScheduler->SetMaxNbSteps(fMaxStepNumber-> 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(ne 168 } 169 else if(command == fResetScavenger.get()) 170 { 171 fScheduler->ResetScavenger(fResetScavenger 172 } 173 } 174 175 G4String G4SchedulerMessenger::GetCurrentValue 176 { 177 G4String cv; 178 179 if(command == fVerboseCmd.get()) 180 { 181 cv = fVerboseCmd->ConvertToString(fSchedul 182 } 183 else if(command == fEndTime.get()) 184 { 185 cv = fEndTime->ConvertToString(fScheduler- 186 } 187 else if(command == fTimeTolerance.get()) 188 { 189 cv = fTimeTolerance->ConvertToString(fSche 190 } 191 else if(command == fInitCmd.get()) 192 { 193 cv = fInitCmd->ConvertToString(fScheduler- 194 } 195 else if(command == fMaxNULLTimeSteps.get()) 196 { 197 cv = 198 fMaxNULLTimeSteps->ConvertToString(fSche 199 } 200 else if(command == fMaxStepNumber.get()) 201 { 202 cv = fMaxStepNumber->ConvertToString(fSche 203 } 204 else if(command == fUseDefaultTimeSteps.get( 205 { 206 cv = fUseDefaultTimeSteps->ConvertToString 207 fScheduler->AreDefaultTimeStepsUsed()); 208 } 209 return cv; 210 } 211