4 // Author: I. Hrivnacova
6 // Class TG4PhysicsMessenger
7 // -------------------------
8 // See the class description in the header file.
10 #include "TG4PhysicsMessenger.h"
11 #include "TG4GeometryServices.h"
12 #include "TG4PhysicsManager.h"
13 #include "TG4G3PhysicsManager.h"
14 #include "TG4G3CutVector.h"
15 #include "TG4G3ControlVector.h"
16 #include "TG4ProcessControlMap.h"
17 #include "TG4ProcessMCMap.h"
19 #include <G4UIdirectory.hh>
20 #include <G4UIcmdWithoutParameter.hh>
21 #include <G4UIcmdWithABool.hh>
22 #include <G4UIcmdWithAString.hh>
24 //_____________________________________________________________________________
25 TG4PhysicsMessenger::TG4PhysicsMessenger(TG4PhysicsManager* physicsManager)
26 : fPhysicsManager(physicsManager)
29 fDirectory = new G4UIdirectory("/tg4Physics/");
30 fDirectory->SetGuidance("TGeant4 physics control commands.");
33 = new G4UIcmdWithABool("/tg4Physics/setEM", this);
34 fSetEMCmd->SetGuidance("Set electromagnetic physics.");
35 fSetEMCmd->SetParameterName("EMControl", false);
36 fSetEMCmd->AvailableForStates(PreInit);
39 = new G4UIcmdWithABool("/tg4Physics/setMuon", this);
40 fSetMuonCmd->SetGuidance("Set muon physics.");
41 fSetMuonCmd->SetParameterName("EMControl", false);
42 fSetMuonCmd->AvailableForStates(PreInit);
45 = new G4UIcmdWithABool("/tg4Physics/setHadron", this);
46 fSetHadronCmd->SetGuidance("Set hadron physics.");
47 fSetHadronCmd->SetParameterName("HadronControl", false);
48 fSetHadronCmd->AvailableForStates(PreInit);
51 = new G4UIcmdWithABool("/tg4Physics/setOptical", this);
52 fSetOpticalCmd->SetGuidance("Set Cerenkov and optical physics.");
53 fSetOpticalCmd->SetParameterName("OpticalControl", false);
54 fSetOpticalCmd->AvailableForStates(PreInit);
57 = new G4UIcmdWithABool("/tg4Physics/setSpecialCuts", this);
58 fSetSpecialCutsCmd->SetGuidance("Set special cuts process.");
60 ->SetGuidance("!! Support for this option is under development.");
61 fSetSpecialCutsCmd->SetParameterName("SpecialCutsControl", false);
62 fSetSpecialCutsCmd->AvailableForStates(PreInit);
64 fSetSpecialControlsCmd
65 = new G4UIcmdWithABool("/tg4Physics/setSpecialControls", this);
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);
73 = new G4UIcmdWithoutParameter("/tg4Physics/setProcessActivation", this);
74 fProcessActivationCmd->SetGuidance("Activate/inactivate physics processes.");
75 fProcessActivationCmd->AvailableForStates(Idle);
78 = new G4UIcmdWithoutParameter("/tg4Physics/printProcessMCMap", this);
80 ->SetGuidance("Prints mapping of G4 processes to G3 controls.");
81 fPrintProcessMCMapCmd->AvailableForStates(Idle);
83 fPrintProcessControlMapCmd
84 = new G4UIcmdWithoutParameter("/tg4Physics/printProcessControlMap", this);
85 fPrintProcessControlMapCmd
86 ->SetGuidance("Prints mapping of G4 processes to G3 controls.");
87 fPrintProcessControlMapCmd->AvailableForStates(Idle);
90 = new G4UIcmdWithAString("/tg4Physics/printVolumeLimits", this);
92 ->SetGuidance("Prints the limits set to the specified volume.");
93 fPrintVolumeLimitsCmd->SetParameterName("PrintVolumeLimits", false);
94 fPrintVolumeLimitsCmd->AvailableForStates(Idle);
97 = new G4UIcmdWithoutParameter("/tg4Physics/printGeneralCuts", this);
99 ->SetGuidance("Prints the general G3 cuts.");
100 fPrintGeneralCutsCmd->AvailableForStates(Idle);
102 fPrintGeneralControlsCmd
103 = new G4UIcmdWithoutParameter("/tg4Physics/printGeneralControls", this);
104 fPrintGeneralControlsCmd
105 ->SetGuidance("Prints the general G3 process controls.");
106 fPrintGeneralControlsCmd->AvailableForStates(Idle);
109 //_____________________________________________________________________________
110 TG4PhysicsMessenger::TG4PhysicsMessenger(){
114 //_____________________________________________________________________________
115 TG4PhysicsMessenger::TG4PhysicsMessenger(const TG4PhysicsMessenger& right) {
117 TG4Globals::Exception("TG4PhysicsMessenger is protected from copying.");
120 //_____________________________________________________________________________
121 TG4PhysicsMessenger::~TG4PhysicsMessenger() {
127 delete fSetHadronCmd;
128 delete fSetOpticalCmd;
129 delete fSetSpecialCutsCmd;
130 delete fSetSpecialControlsCmd;
131 delete fProcessActivationCmd;
132 delete fPrintProcessMCMapCmd;
133 delete fPrintProcessControlMapCmd;
134 delete fPrintVolumeLimitsCmd;
135 delete fPrintGeneralCutsCmd;
136 delete fPrintGeneralControlsCmd;
141 //_____________________________________________________________________________
142 TG4PhysicsMessenger& TG4PhysicsMessenger::operator=(const TG4PhysicsMessenger& right)
144 // check assignement to self
145 if (this == &right) return *this;
147 TG4Globals::Exception("TG4PhysicsMessenger is protected from assigning.");
154 //_____________________________________________________________________________
155 void TG4PhysicsMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
157 // Applies command to the associated object.
160 if (command == fSetEMCmd) {
162 ->SetEMPhysics(fSetEMCmd->GetNewBoolValue(newValue));
164 if (command == fSetMuonCmd) {
166 ->SetMuonPhysics(fSetMuonCmd->GetNewBoolValue(newValue));
168 else if (command == fSetHadronCmd) {
170 ->SetHadronPhysics(fSetHadronCmd->GetNewBoolValue(newValue));
172 else if (command == fSetOpticalCmd) {
174 ->SetOpticalPhysics(fSetOpticalCmd->GetNewBoolValue(newValue));
176 else if (command == fSetSpecialCutsCmd) {
178 ->SetSpecialCutsPhysics(fSetSpecialCutsCmd->GetNewBoolValue(newValue));
180 else if (command == fSetSpecialControlsCmd) {
182 ->SetSpecialControlsPhysics(
183 fSetSpecialControlsCmd->GetNewBoolValue(newValue));
185 else if (command == fProcessActivationCmd) {
186 fPhysicsManager->SetProcessActivation();
188 else if (command == fPrintProcessMCMapCmd) {
189 TG4ProcessMCMap::Instance()->PrintAll();
191 else if (command == fPrintProcessControlMapCmd) {
192 TG4ProcessControlMap::Instance()->PrintAll();
194 else if (command == fPrintVolumeLimitsCmd) {
195 TG4GeometryServices::Instance()->PrintVolumeLimits(newValue);
197 else if (command == fPrintGeneralCutsCmd) {
198 TG4G3PhysicsManager::Instance()->GetCutVector()->Print();
200 else if (command == fPrintGeneralControlsCmd) {
201 TG4G3PhysicsManager::Instance()->GetControlVector()->Print();