QwGeant4
QweakSimLeadGlassMessenger.cc
Go to the documentation of this file.
1 
2 // QweakSimLeadGlassMessenger.cc
3 // Fang Guo
4 // 2012/07/31
5 
6 /////// --------------------------------------------------------------------
7 
9 
10 //--- user includes
11 #include "QweakSimLeadGlass.hh"
13 
14 
15 
16 /////// --------------------------------------------------------------------
17 
19 :myLeadGlass(theLeadGlass)
20 {
21 
22  LeadGlassDir = new G4UIdirectory("/LeadGlass/");
23  LeadGlassDir -> SetGuidance("Lead Glass Detector control.");
24 
25  //--- Material
26 
27  LeadGlass_SetMaterial_Cmd = new G4UIcmdWithAString("/LeadGlass/SetMaterial",this);
28  LeadGlass_SetMaterial_Cmd -> SetGuidance("Select Material of the LeadGlass.");
29  LeadGlass_SetMaterial_Cmd -> SetParameterName("choice",false);
30  LeadGlass_SetMaterial_Cmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
31 
32  //--- Position
33 
34  LeadGlass_SetCenterPositionInX_Cmd = new G4UIcmdWithADoubleAndUnit("/LeadGlass/SetCenterPositionInX",this);
35  LeadGlass_SetCenterPositionInX_Cmd -> SetGuidance("Set the X position of the LeadGlass");
36  LeadGlass_SetCenterPositionInX_Cmd -> SetParameterName("Size",true);
37  LeadGlass_SetCenterPositionInX_Cmd -> SetUnitCategory("Length");
38  LeadGlass_SetCenterPositionInX_Cmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
39 
40  LeadGlass_SetCenterPositionInY_Cmd = new G4UIcmdWithADoubleAndUnit("/LeadGlass/SetCenterPositionInY",this);
41  LeadGlass_SetCenterPositionInY_Cmd -> SetGuidance("Set the Y position of the LeadGlass");
42  LeadGlass_SetCenterPositionInY_Cmd -> SetParameterName("Size",true);
43  LeadGlass_SetCenterPositionInY_Cmd -> SetUnitCategory("Length");
44  LeadGlass_SetCenterPositionInY_Cmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
45 
46  LeadGlass_SetCenterPositionInZ_Cmd = new G4UIcmdWithADoubleAndUnit("/LeadGlass/SetCenterPositionInZ",this);
47  LeadGlass_SetCenterPositionInZ_Cmd -> SetGuidance("Set the Z position of the LeadGlass");
48  LeadGlass_SetCenterPositionInZ_Cmd -> SetParameterName("Size",true);
49  LeadGlass_SetCenterPositionInZ_Cmd -> SetUnitCategory("Length");
50  LeadGlass_SetCenterPositionInZ_Cmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
51 
52  //--- Rotation
53 
54  LeadGlass_SetTiltAngleInX_Cmd = new G4UIcmdWithADoubleAndUnit("/LeadGlass/SetTiltAngleInX",this);
55  LeadGlass_SetTiltAngleInX_Cmd -> SetGuidance("Set the X tilting angle of the LeadGlass");
56  LeadGlass_SetTiltAngleInX_Cmd -> SetParameterName("Angle",true);
57  LeadGlass_SetTiltAngleInX_Cmd -> SetDefaultUnit("degree");
58  LeadGlass_SetTiltAngleInX_Cmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
59 
60  LeadGlass_SetTiltAngleInY_Cmd = new G4UIcmdWithADoubleAndUnit("/LeadGlass/SetTiltAngleInY",this);
61  LeadGlass_SetTiltAngleInY_Cmd -> SetGuidance("Set the Y tilting angle of the LeadGlass");
62  LeadGlass_SetTiltAngleInY_Cmd -> SetParameterName("Angle",true);
63  LeadGlass_SetTiltAngleInY_Cmd -> SetDefaultUnit("degree");
64  LeadGlass_SetTiltAngleInY_Cmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
65 
66  LeadGlass_SetTiltAngleInZ_Cmd = new G4UIcmdWithADoubleAndUnit("/LeadGlass/SetTiltAngleInZ",this);
67  LeadGlass_SetTiltAngleInZ_Cmd -> SetGuidance("Set the Z tilting angle of the LeadGlass");
68  LeadGlass_SetTiltAngleInZ_Cmd -> SetParameterName("Angle",true);
69  LeadGlass_SetTiltAngleInZ_Cmd -> SetDefaultUnit("degree");
70  LeadGlass_SetTiltAngleInZ_Cmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
71 
72  //--- Enable
73 
74  LeadGlass_SetEnabled_Cmd = new G4UIcmdWithoutParameter("/LeadGlass/Enable",this);
75  LeadGlass_SetEnabled_Cmd -> SetGuidance("Enables the LeadGlass");
76  LeadGlass_SetEnabled_Cmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
77 
78  //--- Disable
79 
80  LeadGlass_SetDisabled_Cmd = new G4UIcmdWithoutParameter("/LeadGlass/Disable",this);
81  LeadGlass_SetDisabled_Cmd -> SetGuidance("Disables the LeadGlass");
82  LeadGlass_SetDisabled_Cmd -> AvailableForStates(G4State_PreInit, G4State_Idle);
83 
84 }
85 
86 
87 
88 /////// --------------------------------------------------------------------
89 
91 {
93 
97 
100 
101  if (LeadGlassDir) delete LeadGlassDir;
102 
103 }
104 
105 
106 
107 /////// --------------------------------------------------------------------
108 
109 void QweakSimLeadGlassMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
110 {
111  G4cout << "=== Calling QweakSimLeadGlassMessenger::SetNewValue() " << newValue << G4endl;
112 
113  //--- Set New Material
114 
115  if (command == LeadGlass_SetMaterial_Cmd)
116  {
117  G4cout << "=== Messenger: Setting LeadGlass Material to " << newValue << G4endl;
118  myLeadGlass -> SetLeadGlass_Material(newValue);
119  }
120 
121  //--- Set New Position
122 
123  if (command == LeadGlass_SetCenterPositionInX_Cmd)
124  {
125  G4cout << "=== Messenger: Setting LeadGlass X position to " << newValue << G4endl;
126  myLeadGlass -> SetLeadGlass_CenterPositionInX(LeadGlass_SetCenterPositionInX_Cmd -> GetNewDoubleValue(newValue));
127  }
128 
129  if (command == LeadGlass_SetCenterPositionInY_Cmd)
130  {
131  G4cout << "=== Messenger: Setting LeadGlass Y position to " << newValue << G4endl;
132  myLeadGlass -> SetLeadGlass_CenterPositionInY(LeadGlass_SetCenterPositionInY_Cmd -> GetNewDoubleValue(newValue));
133  }
134 
135  if (command == LeadGlass_SetCenterPositionInZ_Cmd)
136  {
137  G4cout << "=== Messenger: Setting LeadGlass Z position to " << newValue << G4endl;
138  myLeadGlass -> SetLeadGlass_CenterPositionInZ(LeadGlass_SetCenterPositionInZ_Cmd -> GetNewDoubleValue(newValue));
139  }
140 
141  //--- Set New Tilting Anngle
142 
143  if (command == LeadGlass_SetTiltAngleInX_Cmd)
144  {
145  G4cout << "=== Messenger: Setting LeadGlass X tilting angle to " << newValue << G4endl;
146  myLeadGlass -> SetLeadGlass_TiltAngleInX(LeadGlass_SetTiltAngleInX_Cmd -> GetNewDoubleValue(newValue));
147  }
148 
149  if (command == LeadGlass_SetTiltAngleInY_Cmd)
150  {
151  G4cout << "=== Messenger: Setting LeadGlass Y tilting angle to " << newValue << G4endl;
152  myLeadGlass -> SetLeadGlass_TiltAngleInY(LeadGlass_SetTiltAngleInY_Cmd -> GetNewDoubleValue(newValue));
153  }
154 
155  if (command == LeadGlass_SetTiltAngleInZ_Cmd)
156  {
157  G4cout << "=== Messenger: Setting LeadGlass Z tilting angle to " << newValue << G4endl;
158  myLeadGlass -> SetLeadGlass_TiltAngleInZ(LeadGlass_SetTiltAngleInZ_Cmd -> GetNewDoubleValue(newValue));
159  }
160 
161  //--- Enable
162 
163  if (command == LeadGlass_SetEnabled_Cmd)
164  {
165  G4cout << "=== Messenger: ENABLE the LeadGlass" << G4endl;
166  myLeadGlass -> SetLeadGlass_Enabled();
167  }
168 
169  //----Disable
170 
171  if (command == LeadGlass_SetDisabled_Cmd)
172  {
173  G4cout << "=== Messenger: DISABLE the LeadGlass" << G4endl;
174  myLeadGlass -> SetLeadGlass_Disabled();
175  }
176 
177  G4cout << "=== Leaving QweakSimLeadGlassMessenger::SetNewValue() " << newValue << G4endl;
178 }
179 
180 
181 
182 /////// --------------------------------------------------------------------
183 
G4UIcmdWithADoubleAndUnit * LeadGlass_SetCenterPositionInY_Cmd
G4UIcmdWithADoubleAndUnit * LeadGlass_SetCenterPositionInX_Cmd
G4UIcmdWithADoubleAndUnit * LeadGlass_SetTiltAngleInY_Cmd
G4UIcmdWithADoubleAndUnit * LeadGlass_SetTiltAngleInZ_Cmd
void SetNewValue(G4UIcommand *, G4String)
G4UIcmdWithADoubleAndUnit * LeadGlass_SetCenterPositionInZ_Cmd
G4UIcmdWithoutParameter * LeadGlass_SetEnabled_Cmd
G4UIcmdWithADoubleAndUnit * LeadGlass_SetTiltAngleInX_Cmd
G4UIcmdWithoutParameter * LeadGlass_SetDisabled_Cmd
QweakSimLeadGlassMessenger(QweakSimLeadGlass *)
G4UIcmdWithAString * LeadGlass_SetMaterial_Cmd