QwGeant4
QweakSimCerenkovDetectorMessenger.cc
Go to the documentation of this file.
1 //=============================================================================
2 //
3 // ---------------------------
4 // | Doxygen File Information |
5 // ---------------------------
6 //
7 /**
8 
9  \file QweakSimCerenkovDetectorMessenger.cc
10 
11  $Revision: 1.2 $
12  $Date: 2005/12/27 19:07:14 $
13 
14  \author Klaus Hans Grimm
15 
16 */
17 //=============================================================================
18 
19 
20 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
21 
23 
24 // user includes
27 
28 // static variables
35 G4UIcmdWithADoubleAndUnit* QweakSimCerenkovDetectorMessenger::TiltingAngleCmd = 0;
36 G4UIcmdWithADoubleAndUnit* QweakSimCerenkovDetectorMessenger::KinkAngleCmd = 0;
37 
38 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40 :myCerenkovDetector(theCerenkovDetector),fOctant(octant)
41 {
42  G4String Dir_name = "/Cerenkov";
43  if (Dir == 0) {
44  Dir = new G4UIdirectory(G4String(Dir_name+"/"));
45  Dir -> SetGuidance("Cerenkov Detector control.");
46  }
47 
48  if (NumberOfDetectorsCmd == 0) {
49  NumberOfDetectorsCmd = new G4UIcmdWithAnInteger(G4String(Dir_name + "/SetNumberOfDetectors"),this);
50  NumberOfDetectorsCmd->SetGuidance("Set the number of detectors");
51  NumberOfDetectorsCmd->SetParameterName("n",false);
52  NumberOfDetectorsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
53  }
54 
55  if (ContainerThicknessCmd == 0) {
56  ContainerThicknessCmd = new G4UIcmdWithADoubleAndUnit(G4String(Dir_name + "/SetThickness"),this);
57  ContainerThicknessCmd->SetGuidance("Set the thickness (length in Z) of the Cherenkov container");
58  ContainerThicknessCmd->SetParameterName("Size",true);
59  ContainerThicknessCmd->SetUnitCategory("Length");
60  ContainerThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
61  }
62 
63  if (TiltingAngleCmd == 0) {
64  TiltingAngleCmd = new G4UIcmdWithADoubleAndUnit(G4String(Dir_name + "/SetTiltingAngle"),this);
65  TiltingAngleCmd->SetGuidance("Set the tilting angle of the Cerenkov Detector");
66  TiltingAngleCmd->SetParameterName("Angle",true);
67  TiltingAngleCmd->SetDefaultUnit("degree");
68  TiltingAngleCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
69  }
70 
71  if (KinkAngleCmd == 0) {
72  KinkAngleCmd = new G4UIcmdWithADoubleAndUnit(G4String(Dir_name + "/SetKinkAngle"),this);
73  KinkAngleCmd->SetGuidance("Set the kink angle for the V-shape ");
74  KinkAngleCmd->SetParameterName("Angle",true);
75  KinkAngleCmd->SetDefaultUnit("degree");
76  KinkAngleCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
77  }
78 
79  if (ContainerMatCmd == 0) {
80  ContainerMatCmd = new G4UIcmdWithAString(G4String(Dir_name + "/SetContainerMaterial"),this);
81  ContainerMatCmd->SetGuidance("Select Material of the Cerenkov Container.");
82  ContainerMatCmd->SetParameterName("choice",false);
83  ContainerMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
84  }
85 
86  if (DetectorMatCmd == 0) {
87  DetectorMatCmd = new G4UIcmdWithAString(G4String(Dir_name + "/SetCerenkovMaterial"),this);
88  DetectorMatCmd->SetGuidance("Select Material of the Cerenkov Detector.");
89  DetectorMatCmd->SetParameterName("choice",false);
90  DetectorMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
91  }
92 
93  if (PreRadiatorMatCmd == 0) {
94  PreRadiatorMatCmd = new G4UIcmdWithAString(G4String(Dir_name + "/SetPreradiatorMaterial"),this);
95  PreRadiatorMatCmd->SetGuidance("Select Material of the Pre-radiator.");
96  PreRadiatorMatCmd->SetParameterName("choice",false);
97  PreRadiatorMatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
98  }
99 
100  //Added Cerenkov octant number to the command list. The messenger is now dependent on the octant number.
101  //K. Bartlett Aug 6, 2012
102 
103  G4String DirPerOctant_name = "/Cerenkov/Cerenkov" + G4UIcommand::ConvertToString(octant+1);
104  DirPerOctant = new G4UIdirectory(G4String(DirPerOctant_name + "/"));
105  DirPerOctant -> SetGuidance("Individual Cerenkov detector control.");
106 
107  ContainerZPositionCmd = new G4UIcmdWithADoubleAndUnit(G4String(DirPerOctant_name + "/SetCenterPositionInZ"),this);
108  ContainerZPositionCmd->SetGuidance("Set the Z position of the Cerenkov container center");
109  ContainerZPositionCmd->SetParameterName("Size",true);
110  ContainerZPositionCmd->SetUnitCategory("Length");
111  ContainerZPositionCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
112 
113  ContainerYPositionCmd = new G4UIcmdWithADoubleAndUnit(G4String(DirPerOctant_name + "/SetCenterPositionInY"),this);
114  ContainerYPositionCmd->SetGuidance("Set the Y position of the Cerenkov container center");
115  ContainerYPositionCmd->SetParameterName("Size",true);
116  ContainerYPositionCmd->SetUnitCategory("Length");
117  ContainerYPositionCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
118 
119  ContainerXPositionCmd = new G4UIcmdWithADoubleAndUnit(G4String(DirPerOctant_name + "/SetCenterPositionInX"),this);
120  ContainerXPositionCmd->SetGuidance("Set the X position of the Cerenkov container center");
121  ContainerXPositionCmd->SetParameterName("Size",true);
122  ContainerXPositionCmd->SetUnitCategory("Length");
123  ContainerXPositionCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
124 
125  ContainerZRotationCmd = new G4UIcmdWithADoubleAndUnit(G4String(DirPerOctant_name + "/SetRotationInZ"),this);
126  ContainerZRotationCmd->SetGuidance("Set the Z rotation of the Cerenkov container");
127  ContainerZRotationCmd->SetParameterName("zrot",true);
128  ContainerZRotationCmd->SetUnitCategory("Angle");
129  ContainerZRotationCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
130 
131  ContainerYRotationCmd = new G4UIcmdWithADoubleAndUnit(G4String(DirPerOctant_name + "/SetRotationInY"),this);
132  ContainerYRotationCmd->SetGuidance("Set the Y rotation of the Cerenkov container");
133  ContainerYRotationCmd->SetParameterName("yrot",true);
134  ContainerYRotationCmd->SetUnitCategory("Angle");
135  ContainerYRotationCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
136 
137  ContainerXRotationCmd = new G4UIcmdWithADoubleAndUnit(G4String(DirPerOctant_name + "/SetRotationInX"),this);
138  ContainerXRotationCmd->SetGuidance("Set the X rotation of the Cerenkov container");
139  ContainerXRotationCmd->SetParameterName("xrot",true);
140  ContainerXRotationCmd->SetUnitCategory("Angle");
141  ContainerXRotationCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
142 
143 }
144 
145 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
146 
148 {
155  if (DirPerOctant) delete DirPerOctant;
156 
157  // Someone could implement all these static pointers as smart pointers so they
158  // get deleted on destruction....
159 // if (NumberOfDetectorsCmd) { delete NumberOfDetectorsCmd; NumberOfDetectorsCmd = 0; }
160 // if (ContainerThicknessCmd) { delete ContainerThicknessCmd; ContainerThicknessCmd = 0; }
161 // if (DetectorMatCmd) { delete DetectorMatCmd; DetectorMatCmd = 0; }
162 // if (PreRadiatorMatCmd) { delete PreRadiatorMatCmd; PreRadiatorMatCmd = 0; }
163 // if (ContainerMatCmd) { delete ContainerMatCmd; ContainerMatCmd = 0; }
164 // if (TiltingAngleCmd) { delete TiltingAngleCmd; TiltingAngleCmd = 0; }
165 // if (KinkAngleCmd) { delete KinkAngleCmd; KinkAngleCmd = 0; }
166 // if (Dir) { delete Dir; Dir = 0; }
167 }
168 
169 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
170 
171 void QweakSimCerenkovDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
172 {
173  G4cout << "#### Calling QweakSimCerenkovDetectorMessenger::SetNewValue() " << newValue << G4endl;
174 
175  if( command == NumberOfDetectorsCmd )
176  {
177  G4cout << "#### Messenger: Setting Number of Detectors to " << newValue << G4endl;
178 
180  }
181 
182  if( command == ContainerThicknessCmd )
183  {
184  G4cout << "#### Messenger: Setting CerenkovDetector Container Thickness to " << newValue << G4endl;
185 
187  }
188 
189  if( command == ContainerXPositionCmd )
190  {
191  G4cout << "#### Messenger: Setting CerenkovDetector Container X position to " << newValue << G4endl;
192 
194  }
195 
196  if( command == ContainerYPositionCmd )
197  {
198  G4cout << "#### Messenger: Setting CerenkovDetector Container Y position to " << newValue << G4endl;
199 
201  }
202 
203  if( command == ContainerZPositionCmd )
204  {
205  G4cout << "#### Messenger: Setting CerenkovDetector Container Z position to " << newValue << G4endl;
206 
208  }
209 
210  if( command == ContainerXRotationCmd )
211  {
212  G4cout << "#### Messenger: Setting CerenkovDetector Container X position to " << newValue << G4endl;
213 
215  }
216 
217  if( command == ContainerYRotationCmd )
218  {
219  G4cout << "#### Messenger: Setting CerenkovDetector Container Y position to " << newValue << G4endl;
220 
222  }
223 
224  if( command == ContainerZRotationCmd )
225  {
226  G4cout << "#### Messenger: Setting CerenkovDetector Container Z position to " << newValue << G4endl;
227 
229  }
230 
231  if( command == ContainerMatCmd )
232  {
233  G4cout << "#### Messenger: Setting CerenkovDetector Container Material to " << newValue << G4endl;
234 
236  }
237 
238  if( command == DetectorMatCmd )
239  {
240  G4cout << "#### Messenger: Setting Cerenkov Detector Material to " << newValue << G4endl;
241 
243  }
244 
245  if( command == PreRadiatorMatCmd )
246  {
247  G4cout << "#### Messenger: Setting PreRadiator Material to " << newValue << G4endl;
248 
250  }
251 
252  if( command == TiltingAngleCmd )
253  {
254  G4cout << "#### Messenger: Setting Cerenkov Detector Tilting Angle to " << newValue << G4endl;
255 
256  myCerenkovDetector->SetCerenkovDetectorTiltAngle(TiltingAngleCmd->GetNewDoubleValue(newValue));
257  }
258 
259  if( command == KinkAngleCmd )
260  {
261  G4cout << "#### Messenger: Setting Cerenkov Detector Kink Angle to " << newValue << G4endl;
262 
263  // myCerenkovDetector->SetKinkAngle(newValue);
264  }
265 
266 
267  G4cout << "#### Leaving QweakSimCerenkovDetector Messenger::SetNewValue() " << newValue << G4endl;
268 }
269 
270 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void SetCerenkovDetectorRotationInZ(G4double zRot, G4int octant)
void SetCerenkovDetectorThickness(G4double thickness)
QweakSimCerenkovDetectorMessenger(QweakSimCerenkovDetector *, G4int octant=1)
void SetCerenkovDetectorRotationInX(G4double xRot, G4int octant)
void SetContainerMaterial(G4String materialName)
void SetCerenkovDetectorMaterial(G4String materialName)
static G4UIcmdWithADoubleAndUnit * TiltingAngleCmd
void SetCerenkovDetectorRotationInY(G4double yRot, G4int octant)
void SetCerenkovDetectorTiltAngle(G4double tiltangle)
static G4UIcmdWithADoubleAndUnit * ContainerThicknessCmd
static G4UIcmdWithADoubleAndUnit * KinkAngleCmd
void SetPreradiatorMaterial(G4String materialName)
void SetCerenkovDetectorCenterPositionInX(G4double xPos, G4int octant)
void SetCerenkovDetectorCenterPositionInZ(G4double zPos, G4int octant)
void SetCerenkovDetectorCenterPositionInY(G4double yPos, G4int octant)