]>
Commit | Line | Data |
---|---|---|
2817d3e2 | 1 | // $Id$ |
2 | // Category: physics | |
3 | // | |
4 | // See the class description in the header file. | |
5 | ||
6 | #include "TG4PhysicsListMessenger.h" | |
7 | #include "TG4PhysicsList.h" | |
8 | #include "TG4Globals.h" | |
9 | ||
10 | #include <G4UIcmdWithABool.hh> | |
11 | ||
12 | TG4PhysicsListMessenger::TG4PhysicsListMessenger(TG4PhysicsList* physicsList) | |
13 | : fPhysicsList(physicsList) | |
14 | { | |
15 | // | |
16 | fSetOpticalCmd | |
17 | = new G4UIcmdWithABool("/g4mc/setOptical", this); | |
18 | fSetOpticalCmd->SetGuidance("Set Cerenkov and optical processes."); | |
19 | fSetOpticalCmd->SetParameterName("OpticalControl", false); | |
20 | fSetOpticalCmd->AvailableForStates(PreInit); | |
21 | ||
22 | fSetHadronCmd | |
23 | = new G4UIcmdWithABool("/g4mc/setHadron", this); | |
24 | fSetHadronCmd->SetGuidance("Set hadron processes."); | |
25 | fSetHadronCmd->SetParameterName("HadronControl", false); | |
26 | fSetHadronCmd->AvailableForStates(PreInit); | |
27 | ||
28 | fSetSpecialCutsCmd | |
29 | = new G4UIcmdWithABool("/g4mc/setSpecialCuts", this); | |
30 | fSetSpecialCutsCmd->SetGuidance("Set special cuts process."); | |
31 | fSetSpecialCutsCmd | |
32 | ->SetGuidance("!! Support for this option is under development."); | |
33 | fSetSpecialCutsCmd->SetParameterName("SpecialCutsControl", false); | |
34 | fSetSpecialCutsCmd->AvailableForStates(PreInit); | |
35 | ||
36 | fSetSpecialFlagsCmd | |
37 | = new G4UIcmdWithABool("/g4mc/setSpecialFlags", this); | |
38 | fSetSpecialFlagsCmd->SetGuidance("Set special flags process."); | |
39 | fSetSpecialFlagsCmd | |
40 | ->SetGuidance("!! Support for this option is under development."); | |
41 | fSetSpecialFlagsCmd->SetParameterName("SpecialFlagsControl", false); | |
42 | fSetSpecialFlagsCmd->AvailableForStates(PreInit); | |
43 | } | |
44 | ||
45 | TG4PhysicsListMessenger::TG4PhysicsListMessenger( | |
46 | const TG4PhysicsListMessenger& right) { | |
47 | // | |
48 | TG4Globals::Exception( | |
49 | "TG4PhysicsListMessenger is protected from copying."); | |
50 | } | |
51 | ||
52 | TG4PhysicsListMessenger::~TG4PhysicsListMessenger() { | |
53 | // | |
54 | delete fSetOpticalCmd; | |
55 | delete fSetHadronCmd; | |
56 | delete fSetSpecialCutsCmd; | |
57 | delete fSetSpecialFlagsCmd; | |
58 | } | |
59 | ||
60 | // operators | |
61 | ||
62 | TG4PhysicsListMessenger& | |
63 | TG4PhysicsListMessenger::operator=(const TG4PhysicsListMessenger& right) | |
64 | { | |
65 | // check assignement to self | |
66 | if (this == &right) return *this; | |
67 | ||
68 | TG4Globals::Exception( | |
69 | "TG4PhysicsListMessenger is protected from assigning."); | |
70 | ||
71 | return *this; | |
72 | } | |
73 | ||
74 | // public methods | |
75 | ||
76 | void TG4PhysicsListMessenger::SetNewValue(G4UIcommand* command, | |
77 | G4String newValues) | |
78 | { | |
79 | // Applies command to the associated object. | |
80 | // --- | |
81 | ||
82 | if (command == fSetOpticalCmd) { | |
83 | fPhysicsList | |
84 | ->SetOptical(fSetOpticalCmd->GetNewBoolValue(newValues)); | |
85 | } | |
86 | else if (command == fSetHadronCmd) { | |
87 | fPhysicsList | |
88 | ->SetHadron(fSetHadronCmd->GetNewBoolValue(newValues)); | |
89 | } | |
90 | else if (command == fSetSpecialCutsCmd) { | |
91 | fPhysicsList | |
92 | ->SetSpecialCuts(fSetSpecialCutsCmd->GetNewBoolValue(newValues)); | |
93 | } | |
94 | else if (command == fSetSpecialFlagsCmd) { | |
95 | fPhysicsList | |
96 | ->SetSpecialFlags(fSetSpecialFlagsCmd->GetNewBoolValue(newValues)); | |
97 | } | |
98 | } |