Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4ComposedPhysicsMessenger.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2014 Ivana Hrivnacova
4// All rights reserved.
5//
6// For the licensing terms see geant4_vmc/LICENSE.
7// Contact: root-vmc@cern.ch
8//-------------------------------------------------
9
14
17#include "TG4G3PhysicsManager.h"
18#include "TG4GeometryServices.h"
19#include "TG4PhysicsManager.h"
20#include "TG4ProcessMap.h"
21
22#include <G4AnalysisUtilities.hh>
23#include <G4HadronicProcessStore.hh>
24#include <G4ParticleHPManager.hh>
25#include <G4UIcmdWithADouble.hh>
26#include <G4UIcmdWithADoubleAndUnit.hh>
27#include <G4UIcmdWithAString.hh>
28#include <G4UIcmdWithAnInteger.hh>
29#include <G4UIcmdWithoutParameter.hh>
30#include <G4UIdirectory.hh>
31#include <G4UnitsTable.hh>
32
33//______________________________________________________________________________
35 TG4ComposedPhysicsList* physicsList)
36 : G4UImessenger(),
37 fPhysicsList(physicsList),
38 fRangeGammaCutCmd(0),
39 fRangeElectronCutCmd(0),
40 fRangePositronCutCmd(0),
41 fRangeProtonCutCmd(0),
42 fRangeAllCutCmd(0),
43 fSetGammaToMuonsCrossSectionFactorCmd(0),
44 fSetCrossSectionFactorCmd(0),
45 fPrintProcessMapCmd(0),
46 fPrintVolumeLimitsCmd(0),
47 fPrintGlobalCutsCmd(0),
48 fPrintGlobalControlsCmd(0),
49 fG4ParticleHPVerboseCmd(0),
50 fG4HadronicProcessStoreVerboseCmd(0)
51{
53
54 fDirectory = new G4UIdirectory("/mcPhysics/");
55 fDirectory->SetGuidance("TGeant4 physics control commands.");
56
58 new G4UIcmdWithADoubleAndUnit("/mcPhysics/rangeCutForGamma", this);
59 fRangeGammaCutCmd->SetGuidance("Set range cut for gamma");
60 fRangeGammaCutCmd->SetParameterName("GammaCut", false);
61 fRangeGammaCutCmd->SetUnitCategory("Length");
62 fRangeGammaCutCmd->SetRange("GammaCut>0.0");
63 fRangeGammaCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
64
66 new G4UIcmdWithADoubleAndUnit("/mcPhysics/rangeCutForElectron", this);
67 fRangeElectronCutCmd->SetGuidance("Set range cut for electron.");
68 fRangeElectronCutCmd->SetParameterName("ElectronCut", false);
69 fRangeElectronCutCmd->SetUnitCategory("Length");
70 fRangeElectronCutCmd->SetRange("ElectronCut>0.0");
71 fRangeElectronCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
72
74 new G4UIcmdWithADoubleAndUnit("/mcPhysics/rangeCutForPositron", this);
75 fRangePositronCutCmd->SetGuidance("Set range cut for positron.");
76 fRangePositronCutCmd->SetParameterName("PositronCut", false);
77 fRangePositronCutCmd->SetUnitCategory("Length");
78 fRangePositronCutCmd->SetRange("PositronCut>0.0");
79 fRangePositronCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
80
82 new G4UIcmdWithADoubleAndUnit("/mcPhysics/rangeCutForProton", this);
83 fRangeProtonCutCmd->SetGuidance("Set range cut for proton.");
84 fRangeProtonCutCmd->SetParameterName("ProtonCut", false);
85 fRangeProtonCutCmd->SetUnitCategory("Length");
86 fRangeProtonCutCmd->SetRange("ProtonCut>0.0");
87 fRangeProtonCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
88
89 fRangeAllCutCmd = new G4UIcmdWithADoubleAndUnit("/mcPhysics/rangeCuts", this);
90 fRangeAllCutCmd->SetGuidance("Set range cut for all.");
91 fRangeAllCutCmd->SetParameterName("AllCut", false);
92 fRangeAllCutCmd->SetUnitCategory("Length");
93 fRangeAllCutCmd->SetRange("AllCut>0.0");
94 fRangeAllCutCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
95
97
98 fSetGammaToMuonsCrossSectionFactorCmd = new G4UIcmdWithADouble(
99 "/mcPhysics/setGammaToMuonsCrossSectionFactor", this);
100 G4String guidance = "Set gamma to muons cross section factor";
101 fSetGammaToMuonsCrossSectionFactorCmd->SetGuidance(guidance);
103 "GammaToMuonsCrossSectionFactor", false);
104 fSetGammaToMuonsCrossSectionFactorCmd->AvailableForStates(G4State_PreInit);
105
107
109 new G4UIcmdWithoutParameter("/mcPhysics/printAllProcess", this);
110 fPrintAllProcessesCmd->SetGuidance(
111 "Print names for all instantiated processes.");
112 fPrintAllProcessesCmd->AvailableForStates(G4State_Idle);
113
115 new G4UIcmdWithoutParameter("/mcPhysics/dumpAllProcess", this);
116 fDumpAllProcessesCmd->SetGuidance("Dump all instantiated processes.");
117 fDumpAllProcessesCmd->AvailableForStates(G4State_Idle);
118
120 new G4UIcmdWithoutParameter("/mcPhysics/printProcessMap", this);
121 fPrintProcessMapCmd->SetGuidance(
122 "Print mapping of G4 processes to VMC process codes and (G3-like) controls.");
123 fPrintProcessMapCmd->AvailableForStates(G4State_Idle);
124
126 new G4UIcmdWithAString("/mcPhysics/printVolumeLimits", this);
127 fPrintVolumeLimitsCmd->SetGuidance(
128 "Print the limits set for the specified volume.");
129 fPrintVolumeLimitsCmd->SetParameterName("PrintVolumeLimits", false);
130 fPrintVolumeLimitsCmd->AvailableForStates(G4State_Idle);
131
133 new G4UIcmdWithoutParameter("/mcPhysics/printGlobalCuts", this);
134 fPrintGlobalCutsCmd->SetGuidance("Print global VMC (G3-like) cuts.");
135 fPrintGlobalCutsCmd->AvailableForStates(G4State_Idle);
136
138 new G4UIcmdWithoutParameter("/mcPhysics/printGlobalControls", this);
139 fPrintGlobalControlsCmd->SetGuidance(
140 "Print global VMC (G3-like) process controls.");
141 fPrintGlobalControlsCmd->AvailableForStates(G4State_Idle);
142
144 new G4UIcmdWithAnInteger("/mcPhysics/g4ParticleHPVerbose", this);
145 fG4ParticleHPVerboseCmd->SetGuidance("Set G4ParticleHPManager verbose level");
146 fG4ParticleHPVerboseCmd->SetParameterName("ParticleHPVerbose", false);
147 fG4ParticleHPVerboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
148
150 new G4UIcmdWithAnInteger("/mcPhysics/g4HadronicProcessStoreVerbose", this);
152 "Set G4NeutronHPManager verbose level");
153 fG4HadronicProcessStoreVerboseCmd->SetParameterName(
154 "HadronicProcessStoreVerbose", false);
155 fG4HadronicProcessStoreVerboseCmd->AvailableForStates(
156 G4State_PreInit, G4State_Idle);
157
159 new G4UIcmdWithoutParameter("/mcPhysics/useLowLooperThresholds", this);
160 fUseLowLooperThresholdsCmd->SetGuidance(
161 "Set lower thresholds for killing particles looping in magnetic field.");
162 fUseLowLooperThresholdsCmd->AvailableForStates(G4State_PreInit);
163
165 new G4UIcmdWithoutParameter("/mcPhysics/useHighLooperThresholds", this);
166 fUseHighLooperThresholdsCmd->SetGuidance(
167 "Set higher thresholds for killing particles looping in magnetic field.");
168 fUseHighLooperThresholdsCmd->AvailableForStates(G4State_PreInit);
169}
170
171//______________________________________________________________________________
196
197//
198// private methods
199//
200
201//______________________________________________________________________________
203{
205
206 G4UIparameter* minEnergy = new G4UIparameter("minEnergy", 'd', false);
207 minEnergy->SetGuidance("Production cuts table minimum energy.");
208
209 G4UIparameter* minEnergyUnit = new G4UIparameter("minEnergyUnit", 's', false);
210 minEnergyUnit->SetGuidance("Production cuts table min energy unit.");
211
212 G4UIparameter* maxEnergy = new G4UIparameter("maxEnergy", 'd', false);
213 maxEnergy->SetGuidance("Production cuts table maximum energy.");
214
215 G4UIparameter* maxEnergyUnit = new G4UIparameter("maxEnergyUnit", 's', false);
216 maxEnergyUnit->SetGuidance("Production cuts table max energy unit.");
217
219 new G4UIcommand("/mcPhysics/productionCutsTableEnergyRange", this);
221 "Set the production cuts table energy range.");
222 fProductionCutsTableEnergyRangeCmd->SetParameter(minEnergy);
223 fProductionCutsTableEnergyRangeCmd->SetParameter(minEnergyUnit);
224 fProductionCutsTableEnergyRangeCmd->SetParameter(maxEnergy);
225 fProductionCutsTableEnergyRangeCmd->SetParameter(maxEnergyUnit);
226 fProductionCutsTableEnergyRangeCmd->AvailableForStates(G4State_PreInit);
227}
228
229//______________________________________________________________________________
231{
232 auto particleName = new G4UIparameter("particleName", 's', false);
233 particleName->SetGuidance("Particle name.");
234
235 auto processDef = new G4UIparameter("processDef", 's', false);
236 processDef->SetGuidance(
237 "Process name (default) or process type name "
238 "(if the last ommitable parameter is set to true");
239
240 auto factor = new G4UIparameter("factor", 'd', false);
241 factor->SetGuidance("Cross section scale factor.");
242
243 auto isProcessName = new G4UIparameter("isProcessName", 'b', true);
244 isProcessName->SetDefaultValue(true);
245 isProcessName->SetGuidance(
246 "Set false if process is defined by its type name and not by its name.");
247
249 new G4UIcommand("/mcPhysics/setCrossSectionFactor", this);
250 fSetCrossSectionFactorCmd->SetGuidance(
251 "Set the cross section scale factor for a selected particle "
252 "and hadronic process");
253 fSetCrossSectionFactorCmd->SetParameter(particleName);
254 fSetCrossSectionFactorCmd->SetParameter(processDef);
255 fSetCrossSectionFactorCmd->SetParameter(factor);
256 fSetCrossSectionFactorCmd->SetParameter(isProcessName);
257 fSetCrossSectionFactorCmd->AvailableForStates(G4State_PreInit);
258}
259
260//
261// public methods
262//
263
264//______________________________________________________________________________
266 G4UIcommand* command, G4String newValue)
267{
269
270 if (command == fRangeGammaCutCmd) {
271 G4double cut = fRangeGammaCutCmd->GetNewDoubleValue(newValue);
274 }
275 else if (command == fRangeElectronCutCmd) {
276 G4double cut = fRangeElectronCutCmd->GetNewDoubleValue(newValue);
279 }
280 else if (command == fRangePositronCutCmd) {
281 G4double cut = fRangePositronCutCmd->GetNewDoubleValue(newValue);
284 }
285 else if (command == fRangeProtonCutCmd) {
286 G4double cut = fRangeProtonCutCmd->GetNewDoubleValue(newValue);
289 }
290 else if (command == fRangeAllCutCmd) {
291 G4double cut = fRangeAllCutCmd->GetNewDoubleValue(newValue);
300 }
301 else if (command == fProductionCutsTableEnergyRangeCmd) {
302 // tokenize parameters in a vector
303 std::vector<G4String> parameters;
304 G4Analysis::Tokenize(newValue, parameters);
305
306 G4int counter = 0;
307 G4double minEnergy = G4UIcommand::ConvertToDouble(parameters[counter++]);
308 G4double minEUnit = G4UnitDefinition::GetValueOf(parameters[counter++]);
309 G4double maxEnergy = G4UIcommand::ConvertToDouble(parameters[counter++]);
310 G4double maxEUnit = G4UnitDefinition::GetValueOf(parameters[counter++]);
312 minEnergy * minEUnit, maxEnergy * maxEUnit);
313 }
314 else if (command == fSetGammaToMuonsCrossSectionFactorCmd) {
315 G4double value = G4UIcommand::ConvertToDouble(newValue);
317 }
318 else if (command == fSetCrossSectionFactorCmd) {
319 // tokenize parameters in a vector
320 std::vector<G4String> parameters;
321 G4Analysis::Tokenize(newValue, parameters);
322
323 G4int counter = 0;
324 auto particleName = parameters[counter++];;
325 auto processDef = parameters[counter++];
326 auto factor = G4UIcommand::ConvertToDouble(parameters[counter++]);
327 auto isProcessName = G4UIcommand::ConvertToBool(parameters[counter++]);
329 particleName, processDef, factor, isProcessName);
330 }
331 else if (command == fPrintAllProcessesCmd) {
333 }
334 else if (command == fDumpAllProcessesCmd) {
336 }
337 else if (command == fPrintProcessMapCmd) {
339 }
340 else if (command == fPrintVolumeLimitsCmd) {
342 }
343 else if (command == fPrintGlobalCutsCmd) {
345 }
346 else if (command == fPrintGlobalControlsCmd) {
348 }
349 else if (command == fG4ParticleHPVerboseCmd) {
350 G4ParticleHPManager::GetInstance()->SetVerboseLevel(
351 fG4ParticleHPVerboseCmd->GetNewIntValue(newValue));
352 }
353 else if (command == fG4HadronicProcessStoreVerboseCmd) {
354 G4HadronicProcessStore::Instance()->SetVerbose(
355 fG4HadronicProcessStoreVerboseCmd->GetNewIntValue(newValue));
356 }
357 else if (command == fUseLowLooperThresholdsCmd) {
359 }
360 else if (command == fUseHighLooperThresholdsCmd) {
362 }
363}
Definition of the TG4ComposedPhysicsList class.
Definition of the TG4ComposedPhysicsMessenger class.
Definition of the TG4G3PhysicsManager class.
Definition of the TG4GeometryServices class.
Definition of the TG4PhysicsManager class.
Definition of the TG4ProcessMap class.
The Geant4 VMC physics list builder.
void SetGammaToMuonsCrossSectionFactor(G4double value)
void SetLooperThresholdsLevel(G4int level)
void SetProductionCutsTableEnergyRange(G4double min, G4double max)
void SetCrossSectionFactor(const G4String &particleName, const G4String &processDef, G4double value, G4bool isProcessName)
virtual void SetNewValue(G4UIcommand *command, G4String string)
G4UIcmdWithADoubleAndUnit * fRangePositronCutCmd
rangeCutForPositron command
G4UIdirectory * fDirectory
command directory
G4UIcmdWithADouble * fSetGammaToMuonsCrossSectionFactorCmd
setGammaToMuonsCrossSectionFactor
G4UIcmdWithADoubleAndUnit * fRangeElectronCutCmd
rangeCutForElectron command
G4UIcommand * fSetCrossSectionFactorCmd
setCrossSectionFactor
G4UIcmdWithAnInteger * fG4ParticleHPVerboseCmd
g4ParticleHPVerbose command
G4UIcmdWithAString * fPrintVolumeLimitsCmd
printVolumeLimits command
G4UIcmdWithoutParameter * fPrintAllProcessesCmd
printAllProcess command
G4UIcmdWithADoubleAndUnit * fRangeProtonCutCmd
rangeCutForProton command
G4UIcmdWithoutParameter * fPrintProcessMapCmd
printProcessMap command
TG4ComposedPhysicsList * fPhysicsList
associated class
G4UIcmdWithoutParameter * fUseHighLooperThresholdsCmd
useHigherLooperThresholds command
G4UIcmdWithoutParameter * fPrintGlobalControlsCmd
printGeneralControls command
G4UIcmdWithoutParameter * fDumpAllProcessesCmd
dumpAllProcess command
G4UIcmdWithAnInteger * fG4HadronicProcessStoreVerboseCmd
g4HadronicProcessStoreVerbose command
G4UIcommand * fProductionCutsTableEnergyRangeCmd
productionCutsTableEnergyRange command
G4UIcmdWithoutParameter * fUseLowLooperThresholdsCmd
useLowerLooperThresholds command
G4UIcmdWithADoubleAndUnit * fRangeAllCutCmd
rangeCuts command
TG4ComposedPhysicsMessenger()
Not implemented.
G4UIcmdWithoutParameter * fPrintGlobalCutsCmd
printGeneralCuts command
G4UIcmdWithADoubleAndUnit * fRangeGammaCutCmd
rangeCutForGamma command
void Print() const
TG4G3ControlVector * GetControlVector() const
static TG4G3PhysicsManager * Instance()
TG4G3CutVector * GetCutVector() const
static TG4GeometryServices * Instance()
void PrintVolumeLimits(const G4String &volumeName) const
void SetCutForProton(G4double cut)
static TG4PhysicsManager * Instance()
void SetCutForPositron(G4double cut)
void SetCutForElectron(G4double cut)
void SetCutForGamma(G4double cut)
void PrintAll() const
static TG4ProcessMap * Instance()