]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
0e03cdab | 2 | // Category: physics |
2817d3e2 | 3 | // |
7907d67b | 4 | // Author: I. Hrivnacova |
5 | // | |
0e03cdab | 6 | // Class TG4PhysicsMessenger |
7 | // ------------------------- | |
2817d3e2 | 8 | // See the class description in the header file. |
9 | ||
0e03cdab | 10 | #include "TG4PhysicsMessenger.h" |
7907d67b | 11 | #include "TG4GeometryServices.h" |
2817d3e2 | 12 | #include "TG4PhysicsManager.h" |
7907d67b | 13 | #include "TG4G3PhysicsManager.h" |
14 | #include "TG4G3CutVector.h" | |
15 | #include "TG4G3ControlVector.h" | |
16 | #include "TG4ProcessControlMap.h" | |
17 | #include "TG4ProcessMCMap.h" | |
2817d3e2 | 18 | |
0e03cdab | 19 | #include <G4UIdirectory.hh> |
2817d3e2 | 20 | #include <G4UIcmdWithoutParameter.hh> |
5688e846 | 21 | #include <G4UIcmdWithABool.hh> |
7907d67b | 22 | #include <G4UIcmdWithAString.hh> |
2817d3e2 | 23 | |
72095f7c | 24 | //_____________________________________________________________________________ |
0e03cdab | 25 | TG4PhysicsMessenger::TG4PhysicsMessenger(TG4PhysicsManager* physicsManager) |
26 | : fPhysicsManager(physicsManager) | |
2817d3e2 | 27 | { |
28 | // | |
0e03cdab | 29 | fDirectory = new G4UIdirectory("/tg4Physics/"); |
30 | fDirectory->SetGuidance("TGeant4 physics control commands."); | |
31 | ||
5688e846 | 32 | fSetEMCmd |
0e03cdab | 33 | = new G4UIcmdWithABool("/tg4Physics/setEM", this); |
47f9c13c | 34 | fSetEMCmd->SetGuidance("Set electromagnetic physics."); |
5688e846 | 35 | fSetEMCmd->SetParameterName("EMControl", false); |
36 | fSetEMCmd->AvailableForStates(PreInit); | |
37 | ||
47f9c13c | 38 | fSetMuonCmd |
0e03cdab | 39 | = new G4UIcmdWithABool("/tg4Physics/setMuon", this); |
47f9c13c | 40 | fSetMuonCmd->SetGuidance("Set muon physics."); |
41 | fSetMuonCmd->SetParameterName("EMControl", false); | |
42 | fSetMuonCmd->AvailableForStates(PreInit); | |
5688e846 | 43 | |
44 | fSetHadronCmd | |
0e03cdab | 45 | = new G4UIcmdWithABool("/tg4Physics/setHadron", this); |
47f9c13c | 46 | fSetHadronCmd->SetGuidance("Set hadron physics."); |
5688e846 | 47 | fSetHadronCmd->SetParameterName("HadronControl", false); |
48 | fSetHadronCmd->AvailableForStates(PreInit); | |
49 | ||
47f9c13c | 50 | fSetOpticalCmd |
0e03cdab | 51 | = new G4UIcmdWithABool("/tg4Physics/setOptical", this); |
47f9c13c | 52 | fSetOpticalCmd->SetGuidance("Set Cerenkov and optical physics."); |
53 | fSetOpticalCmd->SetParameterName("OpticalControl", false); | |
54 | fSetOpticalCmd->AvailableForStates(PreInit); | |
55 | ||
5688e846 | 56 | fSetSpecialCutsCmd |
0e03cdab | 57 | = new G4UIcmdWithABool("/tg4Physics/setSpecialCuts", this); |
5688e846 | 58 | fSetSpecialCutsCmd->SetGuidance("Set special cuts process."); |
59 | fSetSpecialCutsCmd | |
60 | ->SetGuidance("!! Support for this option is under development."); | |
61 | fSetSpecialCutsCmd->SetParameterName("SpecialCutsControl", false); | |
62 | fSetSpecialCutsCmd->AvailableForStates(PreInit); | |
63 | ||
64 | fSetSpecialControlsCmd | |
0e03cdab | 65 | = new G4UIcmdWithABool("/tg4Physics/setSpecialControls", this); |
5688e846 | 66 | fSetSpecialControlsCmd->SetGuidance("Set special controls process."); |
67 | fSetSpecialControlsCmd | |
68 | ->SetGuidance("!! Support for this option is under development."); | |
69 | fSetSpecialControlsCmd->SetParameterName("SpecialFlagsControl", false); | |
70 | fSetSpecialControlsCmd->AvailableForStates(PreInit); | |
71 | ||
2817d3e2 | 72 | fProcessActivationCmd |
0e03cdab | 73 | = new G4UIcmdWithoutParameter("/tg4Physics/setProcessActivation", this); |
2817d3e2 | 74 | fProcessActivationCmd->SetGuidance("Activate/inactivate physics processes."); |
75 | fProcessActivationCmd->AvailableForStates(Idle); | |
7907d67b | 76 | |
77 | fPrintProcessMCMapCmd | |
0e03cdab | 78 | = new G4UIcmdWithoutParameter("/tg4Physics/printProcessMCMap", this); |
7907d67b | 79 | fPrintProcessMCMapCmd |
80 | ->SetGuidance("Prints mapping of G4 processes to G3 controls."); | |
81 | fPrintProcessMCMapCmd->AvailableForStates(Idle); | |
82 | ||
83 | fPrintProcessControlMapCmd | |
0e03cdab | 84 | = new G4UIcmdWithoutParameter("/tg4Physics/printProcessControlMap", this); |
7907d67b | 85 | fPrintProcessControlMapCmd |
86 | ->SetGuidance("Prints mapping of G4 processes to G3 controls."); | |
87 | fPrintProcessControlMapCmd->AvailableForStates(Idle); | |
88 | ||
89 | fPrintVolumeLimitsCmd | |
0e03cdab | 90 | = new G4UIcmdWithAString("/tg4Physics/printVolumeLimits", this); |
7907d67b | 91 | fPrintVolumeLimitsCmd |
92 | ->SetGuidance("Prints the limits set to the specified volume."); | |
93 | fPrintVolumeLimitsCmd->SetParameterName("PrintVolumeLimits", false); | |
94 | fPrintVolumeLimitsCmd->AvailableForStates(Idle); | |
95 | ||
96 | fPrintGeneralCutsCmd | |
0e03cdab | 97 | = new G4UIcmdWithoutParameter("/tg4Physics/printGeneralCuts", this); |
7907d67b | 98 | fPrintGeneralCutsCmd |
99 | ->SetGuidance("Prints the general G3 cuts."); | |
100 | fPrintGeneralCutsCmd->AvailableForStates(Idle); | |
101 | ||
102 | fPrintGeneralControlsCmd | |
0e03cdab | 103 | = new G4UIcmdWithoutParameter("/tg4Physics/printGeneralControls", this); |
7907d67b | 104 | fPrintGeneralControlsCmd |
105 | ->SetGuidance("Prints the general G3 process controls."); | |
106 | fPrintGeneralControlsCmd->AvailableForStates(Idle); | |
2817d3e2 | 107 | } |
108 | ||
72095f7c | 109 | //_____________________________________________________________________________ |
0e03cdab | 110 | TG4PhysicsMessenger::TG4PhysicsMessenger(){ |
2817d3e2 | 111 | // |
112 | } | |
113 | ||
72095f7c | 114 | //_____________________________________________________________________________ |
0e03cdab | 115 | TG4PhysicsMessenger::TG4PhysicsMessenger(const TG4PhysicsMessenger& right) { |
2817d3e2 | 116 | // |
0e03cdab | 117 | TG4Globals::Exception("TG4PhysicsMessenger is protected from copying."); |
2817d3e2 | 118 | } |
119 | ||
72095f7c | 120 | //_____________________________________________________________________________ |
0e03cdab | 121 | TG4PhysicsMessenger::~TG4PhysicsMessenger() { |
2817d3e2 | 122 | // |
0e03cdab | 123 | |
124 | delete fDirectory; | |
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 | //_____________________________________________________________________________ |
0e03cdab | 142 | TG4PhysicsMessenger& TG4PhysicsMessenger::operator=(const TG4PhysicsMessenger& right) |
2817d3e2 | 143 | { |
144 | // check assignement to self | |
145 | if (this == &right) return *this; | |
146 | ||
0e03cdab | 147 | TG4Globals::Exception("TG4PhysicsMessenger is protected from assigning."); |
2817d3e2 | 148 | |
149 | return *this; | |
150 | } | |
151 | ||
152 | // public methods | |
153 | ||
72095f7c | 154 | //_____________________________________________________________________________ |
0e03cdab | 155 | void TG4PhysicsMessenger::SetNewValue(G4UIcommand* command, G4String newValue) |
2817d3e2 | 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 | } |