]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
2 | // Category: run | |
3 | // | |
7907d67b | 4 | // Author: I. Hrivnacova |
5 | // | |
6 | // Class TG4Messenger | |
7 | // ------------------ | |
2817d3e2 | 8 | // See the class description in the header file. |
9 | ||
10 | #include "TG4Messenger.h" | |
11 | #include "TG4GeometryManager.h" | |
7907d67b | 12 | #include "TG4GeometryServices.h" |
2817d3e2 | 13 | #include "TG4StepManager.h" |
14 | #include "TG4PhysicsManager.h" | |
7907d67b | 15 | #include "TG4G3PhysicsManager.h" |
16 | #include "TG4G3CutVector.h" | |
17 | #include "TG4G3ControlVector.h" | |
18 | #include "TG4ProcessControlMap.h" | |
19 | #include "TG4ProcessMCMap.h" | |
2817d3e2 | 20 | |
21 | #include <G4UIcmdWithoutParameter.hh> | |
5688e846 | 22 | #include <G4UIcmdWithABool.hh> |
7907d67b | 23 | #include <G4UIcmdWithAString.hh> |
2817d3e2 | 24 | |
72095f7c | 25 | //_____________________________________________________________________________ |
2817d3e2 | 26 | TG4Messenger::TG4Messenger(TG4GeometryManager* geometryManager, |
5688e846 | 27 | TG4PhysicsManager* physicsManager, |
28 | TG4StepManager* stepManager) | |
2817d3e2 | 29 | : fGeometryManager(geometryManager), |
30 | fPhysicsManager(physicsManager), | |
31 | fStepManager(stepManager) | |
32 | { | |
33 | // | |
5688e846 | 34 | fSetEMCmd |
35 | = new G4UIcmdWithABool("/g4mc/setEM", this); | |
47f9c13c | 36 | fSetEMCmd->SetGuidance("Set electromagnetic physics."); |
5688e846 | 37 | fSetEMCmd->SetParameterName("EMControl", false); |
38 | fSetEMCmd->AvailableForStates(PreInit); | |
39 | ||
47f9c13c | 40 | fSetMuonCmd |
41 | = new G4UIcmdWithABool("/g4mc/setMuon", this); | |
42 | fSetMuonCmd->SetGuidance("Set muon physics."); | |
43 | fSetMuonCmd->SetParameterName("EMControl", false); | |
44 | fSetMuonCmd->AvailableForStates(PreInit); | |
5688e846 | 45 | |
46 | fSetHadronCmd | |
47 | = new G4UIcmdWithABool("/g4mc/setHadron", this); | |
47f9c13c | 48 | fSetHadronCmd->SetGuidance("Set hadron physics."); |
5688e846 | 49 | fSetHadronCmd->SetParameterName("HadronControl", false); |
50 | fSetHadronCmd->AvailableForStates(PreInit); | |
51 | ||
47f9c13c | 52 | fSetOpticalCmd |
53 | = new G4UIcmdWithABool("/g4mc/setOptical", this); | |
54 | fSetOpticalCmd->SetGuidance("Set Cerenkov and optical physics."); | |
55 | fSetOpticalCmd->SetParameterName("OpticalControl", false); | |
56 | fSetOpticalCmd->AvailableForStates(PreInit); | |
57 | ||
5688e846 | 58 | fSetSpecialCutsCmd |
59 | = new G4UIcmdWithABool("/g4mc/setSpecialCuts", this); | |
60 | fSetSpecialCutsCmd->SetGuidance("Set special cuts process."); | |
61 | fSetSpecialCutsCmd | |
62 | ->SetGuidance("!! Support for this option is under development."); | |
63 | fSetSpecialCutsCmd->SetParameterName("SpecialCutsControl", false); | |
64 | fSetSpecialCutsCmd->AvailableForStates(PreInit); | |
65 | ||
66 | fSetSpecialControlsCmd | |
67 | = new G4UIcmdWithABool("/g4mc/setSpecialControls", this); | |
68 | fSetSpecialControlsCmd->SetGuidance("Set special controls process."); | |
69 | fSetSpecialControlsCmd | |
70 | ->SetGuidance("!! Support for this option is under development."); | |
71 | fSetSpecialControlsCmd->SetParameterName("SpecialFlagsControl", false); | |
72 | fSetSpecialControlsCmd->AvailableForStates(PreInit); | |
73 | ||
2817d3e2 | 74 | fProcessActivationCmd |
75 | = new G4UIcmdWithoutParameter("/g4mc/setProcessActivation", this); | |
76 | fProcessActivationCmd->SetGuidance("Activate/inactivate physics processes."); | |
77 | fProcessActivationCmd->AvailableForStates(Idle); | |
7907d67b | 78 | |
79 | fPrintProcessMCMapCmd | |
80 | = new G4UIcmdWithoutParameter("/g4mc/printProcessMCMap", this); | |
81 | fPrintProcessMCMapCmd | |
82 | ->SetGuidance("Prints mapping of G4 processes to G3 controls."); | |
83 | fPrintProcessMCMapCmd->AvailableForStates(Idle); | |
84 | ||
85 | fPrintProcessControlMapCmd | |
86 | = new G4UIcmdWithoutParameter("/g4mc/printProcessControlMap", this); | |
87 | fPrintProcessControlMapCmd | |
88 | ->SetGuidance("Prints mapping of G4 processes to G3 controls."); | |
89 | fPrintProcessControlMapCmd->AvailableForStates(Idle); | |
90 | ||
91 | fPrintVolumeLimitsCmd | |
92 | = new G4UIcmdWithAString("/g4mc/printVolumeLimits", this); | |
93 | fPrintVolumeLimitsCmd | |
94 | ->SetGuidance("Prints the limits set to the specified volume."); | |
95 | fPrintVolumeLimitsCmd->SetParameterName("PrintVolumeLimits", false); | |
96 | fPrintVolumeLimitsCmd->AvailableForStates(Idle); | |
97 | ||
98 | fPrintGeneralCutsCmd | |
99 | = new G4UIcmdWithoutParameter("/g4mc/printGeneralCuts", this); | |
100 | fPrintGeneralCutsCmd | |
101 | ->SetGuidance("Prints the general G3 cuts."); | |
102 | fPrintGeneralCutsCmd->AvailableForStates(Idle); | |
103 | ||
104 | fPrintGeneralControlsCmd | |
105 | = new G4UIcmdWithoutParameter("/g4mc/printGeneralControls", this); | |
106 | fPrintGeneralControlsCmd | |
107 | ->SetGuidance("Prints the general G3 process controls."); | |
108 | fPrintGeneralControlsCmd->AvailableForStates(Idle); | |
2817d3e2 | 109 | } |
110 | ||
72095f7c | 111 | //_____________________________________________________________________________ |
2817d3e2 | 112 | TG4Messenger::TG4Messenger(){ |
113 | // | |
114 | } | |
115 | ||
72095f7c | 116 | //_____________________________________________________________________________ |
2817d3e2 | 117 | TG4Messenger::TG4Messenger(const TG4Messenger& right) { |
118 | // | |
119 | TG4Globals::Exception("TG4Messenger is protected from copying."); | |
120 | } | |
121 | ||
72095f7c | 122 | //_____________________________________________________________________________ |
2817d3e2 | 123 | TG4Messenger::~TG4Messenger() { |
124 | // | |
5688e846 | 125 | delete fSetEMCmd; |
47f9c13c | 126 | delete fSetMuonCmd; |
5688e846 | 127 | delete fSetHadronCmd; |
47f9c13c | 128 | delete fSetOpticalCmd; |
5688e846 | 129 | delete fSetSpecialCutsCmd; |
130 | delete fSetSpecialControlsCmd; | |
2817d3e2 | 131 | delete fProcessActivationCmd; |
7907d67b | 132 | delete fPrintProcessMCMapCmd; |
133 | delete fPrintProcessControlMapCmd; | |
134 | delete fPrintVolumeLimitsCmd; | |
135 | delete fPrintGeneralCutsCmd; | |
136 | delete fPrintGeneralControlsCmd; | |
2817d3e2 | 137 | } |
138 | ||
139 | // operators | |
140 | ||
72095f7c | 141 | //_____________________________________________________________________________ |
2817d3e2 | 142 | TG4Messenger& TG4Messenger::operator=(const TG4Messenger& right) |
143 | { | |
144 | // check assignement to self | |
145 | if (this == &right) return *this; | |
146 | ||
147 | TG4Globals::Exception("TG4Messenger is protected from assigning."); | |
148 | ||
149 | return *this; | |
150 | } | |
151 | ||
152 | // public methods | |
153 | ||
72095f7c | 154 | //_____________________________________________________________________________ |
2817d3e2 | 155 | void TG4Messenger::SetNewValue(G4UIcommand* command, G4String newValue) |
156 | { | |
157 | // Applies command to the associated object. | |
158 | // --- | |
159 | ||
5688e846 | 160 | if (command == fSetEMCmd) { |
161 | fPhysicsManager | |
47f9c13c | 162 | ->SetEMPhysics(fSetEMCmd->GetNewBoolValue(newValue)); |
5688e846 | 163 | } |
47f9c13c | 164 | if (command == fSetMuonCmd) { |
5688e846 | 165 | fPhysicsManager |
47f9c13c | 166 | ->SetMuonPhysics(fSetMuonCmd->GetNewBoolValue(newValue)); |
5688e846 | 167 | } |
168 | else if (command == fSetHadronCmd) { | |
169 | fPhysicsManager | |
170 | ->SetHadronPhysics(fSetHadronCmd->GetNewBoolValue(newValue)); | |
47f9c13c | 171 | } |
172 | else if (command == fSetOpticalCmd) { | |
173 | fPhysicsManager | |
174 | ->SetOpticalPhysics(fSetOpticalCmd->GetNewBoolValue(newValue)); | |
5688e846 | 175 | } |
176 | else if (command == fSetSpecialCutsCmd) { | |
177 | fPhysicsManager | |
178 | ->SetSpecialCutsPhysics(fSetSpecialCutsCmd->GetNewBoolValue(newValue)); | |
179 | } | |
180 | else if (command == fSetSpecialControlsCmd) { | |
181 | fPhysicsManager | |
182 | ->SetSpecialControlsPhysics( | |
183 | fSetSpecialControlsCmd->GetNewBoolValue(newValue)); | |
184 | } | |
7907d67b | 185 | else if (command == fProcessActivationCmd) { |
2817d3e2 | 186 | fPhysicsManager->SetProcessActivation(); |
187 | } | |
7907d67b | 188 | else if (command == fPrintProcessMCMapCmd) { |
189 | TG4ProcessMCMap::Instance()->PrintAll(); | |
190 | } | |
191 | else if (command == fPrintProcessControlMapCmd) { | |
192 | TG4ProcessControlMap::Instance()->PrintAll(); | |
193 | } | |
194 | else if (command == fPrintVolumeLimitsCmd) { | |
195 | TG4GeometryServices::Instance()->PrintVolumeLimits(newValue); | |
196 | } | |
197 | else if (command == fPrintGeneralCutsCmd) { | |
198 | TG4G3PhysicsManager::Instance()->GetCutVector()->Print(); | |
199 | } | |
200 | else if (command == fPrintGeneralControlsCmd) { | |
201 | TG4G3PhysicsManager::Instance()->GetControlVector()->Print(); | |
202 | } | |
2817d3e2 | 203 | } |