Geant4 VMC Version 6.6
Loading...
Searching...
No Matches
TG4ModelConfigurationMessenger.cxx
Go to the documentation of this file.
1//------------------------------------------------
2// The Geant4 Virtual Monte Carlo package
3// Copyright (C) 2007 - 2015 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
18#include <G4UIcmdWithAString.hh>
19#include <G4UIdirectory.hh>
20
21#include <locale>
22
23//
24// utility methods
25//
26
27namespace
28{
29
30//______________________________________________________________________________
31G4String GetDirectoryName(const G4String& baseName)
32{
33 std::string name(baseName);
34 // convert first letter to lower case
35 std::locale loc;
36 name.replace(0, 1, 1, std::tolower(name[0], loc));
37 return "/mcPhysics/" + name + "/";
38}
39
40} // namespace
41
42//
43// ctors, dtor
44//
45
46//______________________________________________________________________________
48 TG4ModelConfigurationManager* manager, const G4String& availableModels)
49 : G4UImessenger(),
50 fModelConfigurationManager(manager),
51 fSelectedModel(),
52 fDirectory(0),
53 fSetModelCmd(0),
54 fSetParticlesCmd(0),
55 fSetRegionsCmd(0)
56{
58
59 G4String physicsName = fModelConfigurationManager->GetName();
60
61 // Create directory with a name according to modelConfiguration name
62 G4String dirName = GetDirectoryName(physicsName);
63 fDirectory = new G4UIdirectory(dirName);
64 G4String guidance = physicsName + " physics commands.";
65 fDirectory->SetGuidance(guidance);
66
67 // setModel command
68 G4String commandName = dirName + "setModel";
69 fSetModelCmd = new G4UIcmdWithAString(commandName, this);
70 guidance = "Define an extra " + physicsName;
71 fSetModelCmd->SetGuidance(guidance);
72 fSetModelCmd->SetParameterName("Model", false);
73 if (availableModels.size()) fSetModelCmd->SetCandidates(availableModels);
74 fSetModelCmd->AvailableForStates(G4State_PreInit);
75
76 // setEmModel command = the same as setModel
77 // deprecated - kept for backward compatibility
78 commandName = dirName + "setEmModel";
79 fSetEmModelCmd = new G4UIcmdWithAString(commandName, this);
80 guidance = "The same as setModel, kept for backward compatibility.";
81 fSetEmModelCmd->SetGuidance(guidance);
82 fSetEmModelCmd->SetParameterName("EmModel", false);
83 if (availableModels.size()) fSetEmModelCmd->SetCandidates(availableModels);
84 fSetEmModelCmd->AvailableForStates(G4State_PreInit);
85
86 // setParticles command
87 commandName = dirName + "setParticles";
88 fSetParticlesCmd = new G4UIcmdWithAString(commandName, this);
89 guidance = "Set particles for the selected extra " + physicsName + "\n" +
90 "(all = select all particles which the model is applicable.)";
91 fSetParticlesCmd->SetGuidance(guidance.c_str());
92 fSetParticlesCmd->SetParameterName("Particles", false);
93 fSetParticlesCmd->AvailableForStates(G4State_PreInit);
94
95 // setRegions command
96 commandName = dirName + "setRegions";
97 fSetRegionsCmd = new G4UIcmdWithAString(commandName, this);
98 guidance = "Set tracking media names (regions) for the selected extra " +
99 physicsName + "\n" +
100 "("
101 " = the model will be applied to the default world region.";
102 fSetRegionsCmd->SetGuidance(guidance);
103 fSetRegionsCmd->SetParameterName("Regions", false);
104 fSetRegionsCmd->AvailableForStates(G4State_PreInit);
105
106 // setOneRegion command
107 commandName = dirName + "setOneRegion";
108 fSetOneRegionCmd = new G4UIcmdWithAString(commandName, this);
109 guidance = "Set one tracking medium name (regions) for the selected extra " +
110 physicsName + "\n" +
111 "("
112 " = the model will be applied to the default world region.";
113 fSetOneRegionCmd->SetGuidance(guidance);
114 fSetOneRegionCmd->SetParameterName("Region", false);
115 fSetOneRegionCmd->AvailableForStates(G4State_PreInit);
116}
117
118//______________________________________________________________________________
129
130//
131// public methods
132//
133
134//______________________________________________________________________________
136 G4UIcommand* command, G4String newValue)
137{
139
140 if (command == fSetModelCmd || command == fSetEmModelCmd) {
141 fSelectedModel = newValue;
143 }
144 else if (command == fSetParticlesCmd) {
146 }
147 else if (command == fSetRegionsCmd) {
149 }
150 else if (command == fSetOneRegionCmd) {
152 }
153}
Definition of the TG4ModelConfigurationManager class.
Definition of the TG4ModelConfigurationMessenger class.
The model configuration vector with suitable setters and a messenger.
void SetModelRegions(const G4String &modelName, const G4String &regionsMedia)
void SetModel(const G4String &modelName)
void SetModelParticles(const G4String &modelName, const G4String &particles)
void SetOneModelRegion(const G4String &modelName, const G4String &regionMedium)
G4UIcmdWithAString * fSetModelCmd
setModel command
virtual void SetNewValue(G4UIcommand *command, G4String string)
G4UIcmdWithAString * fSetParticlesCmd
setParticles command
TG4ModelConfigurationMessenger()
Not implemented.
TG4ModelConfigurationManager * fModelConfigurationManager
associated class
G4UIcmdWithAString * fSetRegionsCmd
setRegions command
G4UIcmdWithAString * fSetEmModelCmd
setEmModel command (deprecated)
G4UIdirectory * fDirectory
command directory
G4UIcmdWithAString * fSetOneRegionCmd
setRegion command