QwGeant4
QweakSimLeadGlass.cc
Go to the documentation of this file.
1 
2 // QweakSimLeadGlass.cc
3 // Fang Guo
4 // 2012/07/31
5 
6 /////// --------------------------------------------------------------------
7 
8 #include "QweakSimLeadGlass.hh"
9 
10 //--- geant4 includes
11 #include "G4RunManager.hh"
12 #include "G4VisAttributes.hh"
13 
14 //--- user includes
15 #include "QweakSimSolids.hh"
16 #include "QweakSimMaterial.hh"
20 
21 
22 
23 /////// --------------------------------------------------------------------
24 
26 {
27  //--- Initialize Pointers
28 
29  LeadGlassMessenger = NULL;
30 
31  pMaterial = NULL;
32 
33  LeadGlass_Solid = NULL;
34  LeadGlass_Logical = NULL;
35  LeadGlass_Physical = NULL;
36 
37  LeadGlass_Material = NULL;
38 
39  LeadGlassSD = NULL;
40 
41  LeadGlass_VisAtt = NULL;
42 
43  //--- Set Initialize Values
44 
45  LeadGlass_FullLength_X = 19.10*cm;
46  LeadGlass_FullLength_Y = 19.10*cm;
47  LeadGlass_FullLength_Z = 30.50*cm;
48 
49  MD7_CenterPosition_X = 0.0*cm;
50  MD7_CenterPosition_Y = -335.17*cm;
51  MD7_CenterPosition_Z = 577.88*cm;
52 
53  LeadGlass_CenterPosition_X = 0.0*cm; //-150.00*cm;
54  LeadGlass_CenterPosition_Y = -315.00*cm; //-300.00*cm;
55  LeadGlass_CenterPosition_Z = 530.00*cm;
56 
57  LeadGlass_TiltAngle_X = 0.00*degree;
58  LeadGlass_TiltAngle_X = 0.00*degree;
59  LeadGlass_TiltAngle_X = 0.00*degree;
60 
62 
64 }
65 
66 
67 
68 /////// --------------------------------------------------------------------
69 
71 {
72  // --- Delete Pointers
73 
75 
76  //if (LeadGlassSD) delete LeadGlassSD;
77 
79 
82  if (LeadGlass_Solid) delete LeadGlass_Solid;
83 
85 }
86 
87 
88 
89 /////// --------------------------------------------------------------------
90 
91 void QweakSimLeadGlass::ConstructComponent(G4VPhysicalVolume* MotherVolume)
92 {
93 
94  //--- Material
95 
96  LeadGlass_Material = pMaterial->GetMaterial("LeadGlass");
97 
98  //--- Define LeadGlass Solid Volume
99 
100  LeadGlass_Solid = new G4Box("LeadGlass_Solid",
101  0.5*LeadGlass_FullLength_X, // X Length
102  0.5*LeadGlass_FullLength_Y, // Y Length
103  0.5*LeadGlass_FullLength_Z); // Z Length
104 
105  //--- Define LeadGlass Logical Volume
106 
107  LeadGlass_Logical = new G4LogicalVolume(LeadGlass_Solid,
109  "LeadGlass_Logical",
110  0,0,0);
111 
112  //--- Define LeadGlass Physical Volume
113 
117 
118  LeadGlass_RotationMatrix = new G4RotationMatrix();
120 
121  LeadGlass_Physical = new G4PVPlacement(LeadGlass_RotationMatrix,
123  "LeadGlass_Phyical",
125  MotherVolume,
126  false,
127  0,
128  pSurfChk);
129 
130  //--- Define Sensitive Detectors to LeadGlass
131 
132  G4SDManager* SDman = G4SDManager::GetSDMpointer();
133 
134  LeadGlassSD = new QweakSimLeadGlass_DetectorSD("LeadGlassSD");
135  SDman -> AddNewDetector(LeadGlassSD);
136  LeadGlass_Logical -> SetSensitiveDetector(LeadGlassSD);
137 
138  //--- Define Visulization Attributes
139 
140  G4Colour blue (0/255., 0/255., 255/255.);
141  LeadGlass_VisAtt = new G4VisAttributes(blue);
142  LeadGlass_VisAtt -> SetVisibility(true);
143  LeadGlass_Logical -> SetVisAttributes(LeadGlass_VisAtt);
144 
145 }
146 
147 
148 
149 /////// --------------------------------------------------------------------
150 
152 {
153 }
154 
155 
156 
157 /////// --------------------------------------------------------------------
158 
159 void QweakSimLeadGlass::SetLeadGlass_Material(G4String materialName)
160 {
161  //--- Set LeadGlass Material
162 
163  G4Material* pttoMaterial = G4Material::GetMaterial(materialName);
164 
165  if (pttoMaterial)
166  {
167  G4cout << "=== Changing LeadGlass material: Look up material " << G4endl;
168  LeadGlass_Logical -> SetMaterial(pttoMaterial);
169  G4cout << "=== Changing LeadGlass material: Now the material is " << materialName << G4endl;
170  }
171  else
172  G4cerr << "=== Error: Changing LeadGlass material FAILED! " << G4endl << G4endl;
173 
174 }
175 
176 
177 
178 /////// --------------------------------------------------------------------
179 
181 {
182  //--- Set LeadGlass X Position
183 
184  G4cout << "=== Calling QweakSimLeadGlass::SetLeadGlass_CenterPositionInX() " << G4endl;
186  LeadGlass_Physical->SetTranslation(G4ThreeVector(LeadGlass_CenterPosition_X,
189  G4cout << "=== Leaving QweakSimLeadGlass::SetLeadGlass_CenterPositionInX() " << G4endl << G4endl;
190 }
191 
192 
193 
194 /////// --------------------------------------------------------------------
195 
197 {
198  //--- Set LeadGlass Y Position
199 
200  G4cout << "=== Calling QweakSimLeadGlass::SetLeadGlass_CenterPositionInY() " << G4endl;
202  LeadGlass_Physical->SetTranslation(G4ThreeVector(LeadGlass_CenterPosition_X,
205  G4cout << "=== Leaving QweakSimLeadGlass::SetLeadGlass_CenterPositionInY() " << G4endl << G4endl;
206 }
207 
208 
209 
210 /////// --------------------------------------------------------------------
211 
213 {
214  //--- Set LeadGlass Z Position
215 
216  G4cout << "=== Calling QweakSimLeadGlass::SetLeadGlass_CenterPositionInZ() " << G4endl;
218  LeadGlass_Physical->SetTranslation(G4ThreeVector(LeadGlass_CenterPosition_X,
221  G4cout << "=== Leaving QweakSimLeadGlass::SetLeadGlass_CenterPositionInZ() " << G4endl << G4endl;
222 }
223 
224 
225 
226 
227 /////// --------------------------------------------------------------------
228 
230 {
231  //--- Set LeadGlass New X Tilting Angle
232 
233  G4cout << G4endl << "=== Calling QweakSimLeadGlass::SetLeadGlass_TiltAngleInX() " << G4endl;
234 
235  //--- rotate back with old angle
238 
239  //--- assign new tilting angle
240  LeadGlass_TiltAngle_X = xTiltAngle;
241 
242  //--- rotate to new angle
245 
246  G4cout << G4endl << "=== Leaving QweakSimLeadGlass::SetLeadGlass_TiltAngleInX() " << G4endl << G4endl;
247 }
248 
249 
250 
251 /////// --------------------------------------------------------------------
252 
254 {
255  //--- Set LeadGlass New Y Tilting Angle
256 
257  G4cout << G4endl << "=== Calling QweakSimLeadGlass::SetLeadGlass_TiltAngleInY() " << G4endl;
258 
259  //--- rotate back with old angle
262 
263  //--- assign new tilting angle
264  LeadGlass_TiltAngle_Y = yTiltAngle;
265 
266  //--- rotate to new angle
269 
270  G4cout << G4endl << "=== Leaving QweakSimLeadGlass::SetLeadGlass_TiltAngleInY() " << G4endl << G4endl;
271 }
272 
273 
274 
275 /////// --------------------------------------------------------------------
276 
278 {
279  //--- Set LeadGlass New Z Tilting Angle
280 
281  G4cout << G4endl << "=== Calling QweakSimLeadGlass::SetLeadGlass_TiltAngleInZ() " << G4endl;
282 
283  //--- rotate back with old angle
286 
287  //--- assign new tilting angle
288  LeadGlass_TiltAngle_Z = zTiltAngle;
289 
290  //--- rotate to new angle
293 
294  G4cout << G4endl << "=== Leaving QweakSimLeadGlass::SetLeadGlass_TiltAngleInZ() " << G4endl << G4endl;
295 }
296 
297 
298 
299 /////// --------------------------------------------------------------------
300 
302 {
303  //--- Enable the LeadGlass
304 
305  G4cout << "=== Calling QweakSimLeadGlass::SetLeadGlass_Enabled() " << G4endl;
306  LeadGlass_VisAtt -> SetVisibility(true);
308  LeadGlass_Physical->SetTranslation(G4ThreeVector(LeadGlass_CenterPosition_X,
311  G4cout << "=== Leaving QweakSimLeadGlass::SetLeadGlass_Enabled() " << G4endl << G4endl;
312 }
313 
314 
315 
316 /////// --------------------------------------------------------------------
317 
319 {
320  //--- Disable the LeadGlass
321 
322  G4cout << "=== Calling QweakSimLeadGlass::SetLeadGlass_Disabled() " << G4endl;
323  LeadGlass_VisAtt -> SetVisibility(true);
324  SetLeadGlass_Material("Air");
325  LeadGlass_Physical->SetTranslation(G4ThreeVector(LeadGlass_CenterPosition_X,
327  LeadGlass_CenterPosition_Z + 400.00*cm));
328  G4cout << "=== Leaving QweakSimLeadGlass::SetLeadGlass_Disabled() " << G4endl << G4endl;
329 }
330 
331 
332 /////// --------------------------------------------------------------------
333 
334 
G4RotationMatrix * LeadGlass_RotationMatrix
G4VSensitiveDetector * LeadGlassSD
G4double LeadGlass_TiltAngle_X
static QweakSimMaterial * GetInstance()
G4VisAttributes * LeadGlass_VisAtt
void SetLeadGlass_TiltAngleInZ(G4double zTiltAngle)
void SetLeadGlass_CenterPositionInY(G4double yPos)
void ConstructComponent(G4VPhysicalVolume *MotherVolume)
void SetLeadGlass_Material(G4String)
G4double LeadGlass_FullLength_Z
G4ThreeVector LeadGlass_CenterPosition
QweakSimLeadGlassMessenger * LeadGlassMessenger
void SetLeadGlass_TiltAngleInX(G4double xTiltAngle)
G4VPhysicalVolume * LeadGlass_Physical
G4double LeadGlass_FullLength_Y
G4Material * GetMaterial(G4String material)
void SetLeadGlass_CenterPositionInX(G4double xPos)
void SetLeadGlass_CenterPositionInZ(G4double zPos)
G4double LeadGlass_CenterPosition_Y
G4double LeadGlass_CenterPosition_Z
G4LogicalVolume * LeadGlass_Logical
G4Material * LeadGlass_Material
static const G4bool pSurfChk
void SetLeadGlass_TiltAngleInY(G4double yTiltAngle)
G4double LeadGlass_FullLength_X
G4double LeadGlass_CenterPosition_X
QweakSimMaterial * pMaterial