Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/underground_physics/src/DMXDetectorRoom.icc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

  1 //
  2 // ********************************************************************
  3 // * License and Disclaimer                                           *
  4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.                             *
 10 // *                                                                  *
 11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                                                  *
 18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // ********************************************************************
 25 //
 26 //
 27   // Window - AIR + glass ************************************************
 28 
 29   G4double glassThick = 3.0*mm;
 30   G4double sidepanelWidth = 43.*cm;
 31   G4double windowWidth = labWidth - 2.*sidepanelWidth;
 32   G4double windowHeight = labHeight - 112.0*cm;
 33   G4double glassPosY = 0.5*(worldLength - glassThick);
 34   G4double glassPosZ = 0.5*(labHeight - windowHeight);
 35 
 36   G4Box* glass_box = new G4Box
 37   ("glass_box",0.5*windowWidth, 0.5*glassThick, 0.5*windowHeight );
 38   glass_log = new G4LogicalVolume(glass_box, glass_mat, "glass_log");
 39   glass_phys = new G4PVPlacement
 40     (0, G4ThreeVector(0., glassPosY, glassPosZ), "glass_phys", glass_log, 
 41      world_phys, false, 0);
 42 
 43   G4VisAttributes* glass_vat= new G4VisAttributes(blue);
 44   glass_vat->SetVisibility(true);
 45   glass_vat->SetForceSolid(true);
 46   glass_log->SetVisAttributes(glass_vat);
 47 
 48   // hole in wall between glass and "lab": ************************************
 49 
 50   G4double holeThick = wallThick - glassThick;
 51   G4double windowPosY = 0.5*(worldLength - holeThick) - glassThick;
 52   G4double windowPosZ = glassPosZ;
 53 
 54   G4Box* window_box = new G4Box
 55   ("window_box",0.5*windowWidth, 0.5*holeThick, 0.5*windowHeight );
 56   window_log = new G4LogicalVolume(window_box, lab_mat, "window_log");
 57   window_phys = new G4PVPlacement
 58     (0, G4ThreeVector(0., windowPosY, windowPosZ), "window_phys",
 59      window_log, world_phys, false, 0);
 60 
 61   G4VisAttributes* window_vat= new G4VisAttributes(yellow);
 62   //  window_log->SetVisAttributes(G4VisAttributes::GetInvisible());
 63   window_vat->SetVisibility(true);
 64   window_log->SetVisAttributes(window_vat);
 65 
 66 
 67   // Side panels of Window - AIR + Al ****************************************
 68 
 69   G4double panelThick = 5.0*mm;
 70 //  G4double sidepanelWidth = 43.*cm; // defined earlier
 71   G4double sidepanelPosX = 0.5*(labWidth - sidepanelWidth);
 72   G4double sidepanelPosY = 0.5*(worldLength - panelThick);
 73   G4double sidepanelPosZ = glassPosZ;
 74 
 75   G4Box* sidepanel_box = new G4Box
 76   ("sidepanel_box",0.5*sidepanelWidth, 0.5*panelThick, 0.5*windowHeight );
 77   sidepanel_log = new G4LogicalVolume
 78                       (sidepanel_box, panel_mat, "sidepanel_log");
 79   sidepanel_phys = new G4PVPlacement
 80     (0, G4ThreeVector(sidepanelPosX, sidepanelPosY, sidepanelPosZ), 
 81         "sidepanel_phys", sidepanel_log, world_phys, false, 0);
 82 
 83   sidepanel_phys = new G4PVPlacement
 84     (0, G4ThreeVector(-sidepanelPosX, sidepanelPosY, sidepanelPosZ), 
 85         "sidepanel_phys", sidepanel_log, world_phys, false, 1);
 86 
 87   G4VisAttributes* panel_vat= new G4VisAttributes(grey);
 88   panel_vat->SetVisibility(true);
 89   panel_vat->SetForceSolid(true);
 90   sidepanel_log->SetVisAttributes(panel_vat);
 91 
 92   // panel hole in wall between Al and "lab": ******************************
 93 
 94   G4double panelholePosX  = sidepanelPosX;
 95   G4double panelholeThick = wallThick - panelThick;
 96   G4double panelholePosY  = 0.5*(worldLength - panelholeThick) - panelThick;
 97   G4double panelholePosZ  = sidepanelPosZ;
 98 
 99   G4Box* panelhole_box = new G4Box
100   ("panelhole_box",0.5*sidepanelWidth, 0.5*panelholeThick, 0.5*windowHeight );
101   panelhole_log = new G4LogicalVolume
102                        (panelhole_box, lab_mat, "panelhole_log");
103 
104   panelhole_phys = new G4PVPlacement
105     (0, G4ThreeVector(panelholePosX, panelholePosY, panelholePosZ), 
106     "panelhole_phys", panelhole_log, world_phys, false, 0);
107   panelhole_phys = new G4PVPlacement
108     (0, G4ThreeVector(-panelholePosX, panelholePosY, panelholePosZ), 
109     "panelhole_phys", panelhole_log, world_phys, false, 1);
110 
111   panelhole_log->SetVisAttributes(window_vat);
112 
113 
114   // DOOR Window - AIR + glass ************************************************
115 
116   G4double doorwindowWidth = 62.*cm;
117   G4double doorwindowHeight = 84.0*cm;
118   G4double doorglassPosX = 0.5*(labWidth - doorwindowWidth) - sidepanelWidth;
119   G4double doorglassPosY = 0.5*(worldLength - panelThick);
120   G4double doorglassPosZ = glassPosZ - 0.5*(windowHeight+doorwindowHeight);
121 
122   G4Box* doorglass_box = new G4Box
123   ("doorglass_box",0.5*doorwindowWidth, 0.5*panelThick, 0.5*doorwindowHeight );
124   doorglass_log = new G4LogicalVolume
125                       (doorglass_box, panel_mat, "doorglass_log");
126   doorglass_phys = new G4PVPlacement
127     (0, G4ThreeVector(doorglassPosX, doorglassPosY, doorglassPosZ), 
128         "doorglass_phys", doorglass_log, world_phys, false, 0);
129 
130   doorglass_log->SetVisAttributes(panel_vat);
131 
132   // door hole in wall between glass and "lab": ******************************
133 
134   G4double doorwindowPosX = doorglassPosX;
135   G4double doorwindowPosY = 0.5*(worldLength - panelholeThick) - panelThick;
136   G4double doorwindowPosZ = doorglassPosZ;
137 
138   G4Box* doorwindow_box = new G4Box
139   ("doorwindow_box",0.5*doorwindowWidth, 0.5*panelholeThick, 0.5*doorwindowHeight );
140   doorwindow_log = new G4LogicalVolume
141                        (doorwindow_box, lab_mat, "doorwindow_log");
142   doorwindow_phys = new G4PVPlacement
143     (0, G4ThreeVector(doorwindowPosX, doorwindowPosY, doorwindowPosZ), 
144     "doorwindow_phys", doorwindow_log, world_phys, false, 0);
145 
146   doorwindow_log->SetVisAttributes(window_vat);
147 
148 
149   // cupboards: ***************************************************************
150 
151   // cupboard 1:
152   G4double cupboardDepth  = 38.0*cm; //X
153   G4double cupboard1Width  = 91.0*cm; //Y
154   G4double cupboard2Width  = 153.0*cm; //Y
155   G4double cupboardHeight = 91.0*cm; //Z
156   G4double woodThick      = 2.0*cm;
157   G4double insideDepth  = cupboardDepth - 2.*woodThick;
158   G4double inside1Width  = cupboard1Width - 2.*woodThick;
159   G4double inside2Width  = cupboard2Width - 2.*woodThick;
160   G4double insideHeight = cupboardHeight - 2.*woodThick;
161 
162   //nb: cupboard orientation is sideways because they are lined along the wall
163   G4Box* cupboard_box = new G4Box
164    ("cupboard_box", 0.5*cupboardDepth, 0.5*cupboard1Width, 0.5*cupboardHeight);
165   G4Box* inside_box = new G4Box
166     ("inside_box", 0.5*insideDepth, 0.5*inside1Width, 0.5*insideHeight);
167   G4Box* shelf_box  = new G4Box
168     ("shelf_box", 0.5*insideDepth, 0.5*inside1Width, 0.5*woodThick);
169   G4Box* cupdoor_box = new G4Box
170     ("cupdoor_box", 0.5*woodThick+1.0*nanometer, 0.25*inside1Width, 0.5*insideHeight);
171 //    ("cupdoor_box", 0.5*woodThick, 0.25*inside1Width, 0.5*insideHeight);
172 
173   G4RotationMatrix rotMatrixCupboard;
174   rotMatrixCupboard.rotateY(0.0*deg);
175   
176   G4SubtractionSolid* cupboard_frame = new G4SubtractionSolid
177     ("cupboard_frame", cupboard_box, inside_box, G4Transform3D
178      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
179   G4UnionSolid* cupboard_shelf1 = new G4UnionSolid
180     ("cupboard_shelf1", cupboard_frame, shelf_box, G4Transform3D
181      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.30*(insideHeight))));
182   G4UnionSolid* cupboard_shelf2 = new G4UnionSolid
183     ("cupboard_shelf2", cupboard_shelf1, shelf_box, G4Transform3D
184      (rotMatrixCupboard, G4ThreeVector(0.,0.,-0.05*(insideHeight))));
185   G4SubtractionSolid* cupboard_sol = new G4SubtractionSolid
186     ("cupboard_sol", cupboard_shelf2, cupdoor_box, G4Transform3D
187      (rotMatrixCupboard, G4ThreeVector
188       (-0.5*(insideDepth+woodThick),0.25*inside1Width,0.)));
189 
190   cupboard_log = new G4LogicalVolume
191     (cupboard_sol, cupboard_mat, "cupboard_log");
192 
193   G4double cupb_X = 0.5*(labWidth - cupboardDepth);
194   //  G4double cupb_Y = 0.5*(labLength - cupboard1Width) - 2.0*cm;
195   G4double cupb_Y = 0.5*labLength;
196   G4double cupb_Z = 0.5*(labHeight - cupboardHeight) - 25.4*cm;
197 
198   for (G4int i=0; i<5; i++)
199     {
200       cupb_Y -= cupboard1Width+2.0*cm;
201       cupboard_phys = new G4PVPlacement
202   (0, G4ThreeVector(cupb_X, cupb_Y, cupb_Z), "cupboard_phys", 
203    cupboard_log, lab_phys, false, i);
204     }
205 
206   cupb_X  = -(0.5*(labWidth - cupboard1Width) - cupboardDepth - 2.0*cm);
207   G4double cupb_Y2 = -0.5*(labLength - cupboardDepth);
208 
209   G4RotationMatrix rotMatrixWallcupboard;
210   rotMatrixWallcupboard.rotateZ(-90.0*deg);
211 
212   cupboard_phys = new G4PVPlacement
213     (G4Transform3D
214      (rotMatrixWallcupboard,G4ThreeVector(cupb_X, cupb_Y2, cupb_Z)), 
215       "cupboard_phys", cupboard_log, lab_phys, false, 5);
216 
217 
218   G4VisAttributes* cupboard_vat= new G4VisAttributes(yellow);
219   cupboard_vat->SetVisibility(true);
220   cupboard_vat->SetForceSolid(true);
221   cupboard_log->SetVisAttributes(cupboard_vat);
222 
223   // cupboard 2 (bigger/wider) ***********************************************
224 
225   G4Box* cupboard2_box = new G4Box
226   ("cupboard2_box", 0.5*cupboardDepth, 0.5*cupboard2Width, 0.5*cupboardHeight);
227   G4Box* inside2_box = new G4Box
228     ("inside2_box", 0.5*insideDepth, 0.5*inside2Width, 0.5*insideHeight);
229   G4Box* shelf2_box  = new G4Box
230     ("shelf2_box", 0.5*insideDepth, 0.5*inside2Width, 0.5*woodThick);
231   G4Box* cupdoor_box2 = new G4Box
232     ("cupdoor_box2", 0.5*woodThick+1.0*nanometer, 0.25*inside2Width, 0.5*insideHeight);
233 //    ("cupdoor_box2", 0.5*woodThick, 0.25*inside2Width, 0.5*insideHeight);
234 
235   G4SubtractionSolid* cupboard2_frame = new G4SubtractionSolid
236     ("cupboard2_frame", cupboard2_box, inside2_box, G4Transform3D
237      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
238   G4UnionSolid* cupboard2_shelf1 = new G4UnionSolid
239     ("cupboard2_shelf1", cupboard2_frame, shelf2_box, G4Transform3D
240      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.30*(insideHeight))));
241   G4UnionSolid* cupboard2_shelf2 = new G4UnionSolid
242     ("cupboard2_shelf2", cupboard2_shelf1, shelf2_box, G4Transform3D
243      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.10*(insideHeight))));
244   G4SubtractionSolid* cupboard2_sol = new G4SubtractionSolid
245     ("cupboard2_sol", cupboard2_shelf2, cupdoor_box2, G4Transform3D
246      (rotMatrixCupboard, G4ThreeVector
247       (-0.5*(insideDepth+woodThick),0.25*inside2Width,0.)));
248 
249   cupboard2_log = new G4LogicalVolume
250     (cupboard2_sol, cupboard_mat, "cupboard2_log");
251 
252   cupb_X = 0.5*(labWidth - cupboardDepth);
253   //  cupb_Y = -(0.5*(labLength - cupboard2Width) - 2.0*cm);
254   cupb_Y -= 0.5*cupboard1Width + 0.5*cupboard2Width 
255                                + 2.0*cm; //using last cupboard posn on right...
256   //  cupb_Z = 0.5*(labHeight - cupboardHeight) - 25.4*cm;
257 
258   cupboard2_phys = new G4PVPlacement
259     (0,G4ThreeVector(cupb_X, cupb_Y, cupb_Z), 
260       "cupboard2_phys", cupboard2_log, lab_phys, false, 0);
261 
262   cupb_X = -0.5*(labWidth - cupboardDepth);
263   cupb_Y = -(0.5*(labLength - cupboard2Width) - cupboardDepth - 2.0*cm);
264 
265   G4RotationMatrix rotMatrixWallcupboard2;
266   rotMatrixWallcupboard2.rotateZ(-180.0*deg);
267 
268   cupboard2_phys = new G4PVPlacement
269     (G4Transform3D
270      (rotMatrixWallcupboard2,G4ThreeVector(cupb_X, cupb_Y, cupb_Z)), 
271       "cupboard2_phys", cupboard2_log, lab_phys, false, 1);
272 
273 
274   cupboard2_log->SetVisAttributes(cupboard_vat);
275 
276 
277   // NOW add the (wooden) DOOR:
278 
279   G4double doorWidth = 1.67*m;  //X
280   G4double doorThick = 4.0*cm; //Y
281   G4double doorHeight = 2.09*m; //Z
282   G4double doorPosY = -0.5*(worldLength - doorThick);
283   G4double doorPosZ = -0.5*(worldHeight - doorHeight);
284 
285   G4Box* door_box = new G4Box
286   ("door_box",0.5*doorWidth, 0.5*doorThick, 0.5*doorHeight );
287   door_log = new G4LogicalVolume(door_box, door_mat, "door_log");
288   door_phys = new G4PVPlacement
289     (0, G4ThreeVector(0., doorPosY, doorPosZ), "door_phys", door_log, 
290      world_phys, false, 0);
291 
292   G4VisAttributes* door_vat= new G4VisAttributes(brown);
293   door_vat->SetVisibility(true);
294   door_vat->SetForceSolid(true);
295   door_log->SetVisAttributes(door_vat);
296 
297 
298   // hole in wall between door and "lab": ************************************
299 
300   G4double doorholeThick = wallThick - doorThick;
301   G4double doorholePosY = -(0.5*(worldLength - doorholeThick) - doorThick);
302   G4double doorholePosZ = doorPosZ;
303 
304   G4Box* doorhole_box = new G4Box
305   ("doorhole_box",0.5*doorWidth, 0.5*doorholeThick, 0.5*doorHeight );
306   doorhole_log = new G4LogicalVolume(doorhole_box, lab_mat, "doorhole_log");
307   doorhole_phys = new G4PVPlacement
308     (0, G4ThreeVector(0., doorholePosY, doorholePosZ), "doorhole_phys",
309      doorhole_log, world_phys, false, 0);
310 
311   G4VisAttributes* doorhole_vat= new G4VisAttributes(cyan);
312   //  window_log->SetVisAttributes(G4VisAttributes::GetInvisible());
313   doorhole_vat->SetVisibility(true);
314   doorhole_log->SetVisAttributes(doorhole_vat);
315 
316 
317   // desks: *****************************************************************
318   //now add Desks - wood, but have the opportunity for three different woods -
319   // Cupboard, Door and then desks
320 
321   // desk1 - no cupboard underneath - should be bigger subtraction?:
322 
323   G4double desk1Depth  = 57.0*cm; //X
324   G4double desk1Width  = 160.0*cm; //Y
325   G4double desk1Height = 90.5*cm; //Z
326   G4double deskThick      = 3.0*cm;
327   G4double desk1_insideDepth  = desk1Depth - 2.*deskThick;
328   G4double desk1_insideWidth  = desk1Width - 2.*deskThick;
329   G4double desk1_insideHeight = desk1Height - 2.*deskThick;
330 
331   //nb: desk orientation is sideways because they are lined along the wall
332   G4Box* desk1_box = new G4Box
333    ("desk1_box", 0.5*desk1Depth, 0.5*desk1Width, 0.5*desk1Height);
334   G4Box* desk1_inside_box = new G4Box
335     ("desk1_inside_box", 0.5*desk1_insideDepth, 0.5*desk1_insideWidth, 
336      0.5*desk1_insideHeight);
337   G4Box* desk1_door_box = new G4Box
338     ("desk1_door_box", 0.5*deskThick+1.0*nanometer, 0.25*desk1_insideWidth, 
339      0.5*desk1_insideHeight);
340 //    ("desk1_door_box", 0.5*deskThick, 0.25*desk1_insideWidth, 
341 //     0.5*desk1_insideHeight);
342 
343   G4RotationMatrix rotMatrixDesk;
344   rotMatrixDesk.rotateY(0.0*deg);
345   
346   G4SubtractionSolid* desk1_frame = new G4SubtractionSolid
347     ("desk1_frame", desk1_box, desk1_inside_box, G4Transform3D
348      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
349   G4SubtractionSolid* desk1_sol = new G4SubtractionSolid
350     ("desk1_sol", desk1_frame, desk1_door_box, G4Transform3D
351      (rotMatrixCupboard, G4ThreeVector
352       (-0.5*(desk1_insideDepth+deskThick),-0.25*desk1_insideWidth,0.)));
353 
354   desk1_log = new G4LogicalVolume(desk1_sol, desk_mat, "desk1_log");
355 
356   G4double desk_X = 0.5*(labWidth - desk1Depth);
357   G4double desk_Y = -(0.5*(labLength - desk1Width) - 30.0*cm);
358   G4double desk_Z = 0.5*(desk1Height - labHeight);
359 
360   desk1_phys = new G4PVPlacement
361   (0, G4ThreeVector(desk_X, desk_Y, desk_Z), "desk1_phys", 
362    desk1_log, lab_phys, false, 0);
363 
364   G4VisAttributes* desk_vat= new G4VisAttributes(brown);
365   desk_vat->SetVisibility(true);
366   desk_vat->SetForceSolid(true);
367   desk1_log->SetVisAttributes(desk_vat);
368 
369   // *****************
370   // desk2 (drawers):
371 
372   G4double desk2Depth  = 57.0*cm; //X
373   G4double desk2Width = 156.0*cm; //Y
374   G4double desk2Height = desk1Height; //Z
375 
376   G4double desk2_insideDepth  = desk2Depth - 2.*deskThick;
377   G4double desk2_insideWidth  = desk2Width - 2.*deskThick;
378   G4double desk2_insideHeight = desk2Height - 2.*deskThick;
379 
380   //nb: desk orientation is sideways because they are lined along the wall
381   G4Box* desk2_box = new G4Box
382    ("desk2_box", 0.5*desk2Depth, 0.5*desk2Width, 0.5*desk2Height);
383   G4Box* desk2_inside_box = new G4Box
384     ("desk2_inside_box", 0.5*desk2_insideDepth, 0.5*desk2_insideWidth, 
385      0.5*desk2_insideHeight);
386   G4Box* desk2_door_box = new G4Box
387     ("desk2_door_box", 0.5*deskThick+1.0*nanometer, 0.2*desk2_insideWidth, 
388      0.5*desk2_insideHeight);
389 //    ("desk2_door_box", 0.5*deskThick, 0.2*desk2_insideWidth, 
390 //     0.5*desk2_insideHeight);
391 
392   G4SubtractionSolid* desk2_frame = new G4SubtractionSolid
393     ("desk2_frame", desk2_box, desk2_inside_box, G4Transform3D
394      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
395   G4SubtractionSolid* desk2_sol = new G4SubtractionSolid
396     ("desk2_sol", desk2_frame, desk2_door_box, G4Transform3D
397      (rotMatrixCupboard, G4ThreeVector
398       (-0.5*(desk2_insideDepth+deskThick),-0.25*desk2_insideWidth,0.)));
399 
400   desk2_log = new G4LogicalVolume(desk2_sol, desk_mat, "desk2_log");
401 
402   desk_X = 0.5*(labWidth - desk2Depth);
403   desk_Y += 0.5*(desk2Width + desk1Width) + 2.0*cm;
404   desk_Z = 0.5*(desk2Height - labHeight);
405 
406   desk2_phys = new G4PVPlacement
407   (0, G4ThreeVector(desk_X, desk_Y, desk_Z), "desk2_phys", 
408    desk2_log, lab_phys, false, 0);
409 
410   desk2_log->SetVisAttributes(desk_vat);
411 
412   // *****************
413   // desk3 (cupboard underneath):
414 
415   G4double desk3Depth  = 79.0*cm; //X
416   G4double desk3Width = 160.0*cm; //Y
417   G4double desk3Height = desk1Height; //Z
418 
419   G4double desk3_insideDepth  = desk3Depth - 2.*deskThick;
420   G4double desk3_insideWidth  = desk3Width - 2.*deskThick;
421   G4double desk3_insideHeight = desk3Height - 2.*deskThick;
422 
423   //nb: desk orientation is sideways because they are lined along the wall
424   G4Box* desk3_box = new G4Box
425    ("desk3_box", 0.5*desk3Depth, 0.5*desk3Width, 0.5*desk3Height);
426   G4Box* desk3_inside_box = new G4Box
427     ("desk3_inside_box", 0.5*desk3_insideDepth, 0.5*desk3_insideWidth, 
428      0.5*desk3_insideHeight);
429   G4Box* desk3_door_box = new G4Box
430     ("desk3_door_box", 0.5*deskThick+1.0*nanometer, 0.15*desk3_insideWidth, 0.5*desk1_insideHeight);
431 //    ("desk3_door_box", 0.5*deskThick, 0.15*desk3_insideWidth, 
432 //     0.5*desk1_insideHeight);
433 
434   G4SubtractionSolid* desk3_frame = new G4SubtractionSolid
435     ("desk3_frame", desk3_box, desk3_inside_box, G4Transform3D
436      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
437   G4SubtractionSolid* desk3_sol = new G4SubtractionSolid
438     ("desk3_sol", desk3_frame, desk3_door_box, G4Transform3D
439      (rotMatrixCupboard, G4ThreeVector
440       (-0.5*(desk3_insideDepth+deskThick),-0.35*desk3_insideWidth,0.)));
441 
442   desk3_log = new G4LogicalVolume(desk3_sol, desk_mat, "desk3_log");
443 
444   desk_X = 0.5*(labWidth - desk3Depth);
445   desk_Y += 0.5*(desk3Width + desk3Width) + 2.0*cm;
446   desk_Z = 0.5*(desk3Height - labHeight);
447 
448   desk3_phys = new G4PVPlacement
449   (0, G4ThreeVector(desk_X, desk_Y, desk_Z), "desk3_phys", 
450    desk3_log, lab_phys, false, 0);
451 
452   desk3_log->SetVisAttributes(desk_vat);
453 
454 
455   // *****************
456   // wooden radiator trunking - along LHS wall
457 
458   G4double trunkDepth  = 20.0*cm; //X
459   G4double trunkWidth  = labLength; //Y
460   G4double trunkHeight = desk1Height; //Z
461   G4double trunkThick  = 3.0*cm;
462 
463   // not 2.*trunkThick since only 2 sides of box - top and front
464   G4double trunk_insideDepth  = trunkDepth - trunkThick;
465   G4double trunk_insideWidth  = trunkWidth;
466   G4double trunk_insideHeight = trunkHeight - trunkThick;
467 
468   G4Box* trunk_box = new G4Box
469    ("trunk_box", 0.5*trunkDepth, 0.5*trunkWidth, 0.5*trunkHeight);
470   G4Box* trunk_inside_box = new G4Box
471     ("trunk_inside_box", 0.5*trunk_insideDepth, 0.5*trunk_insideWidth, 
472      0.5*trunk_insideHeight);
473 
474   trunk_log = new G4LogicalVolume(trunk_box, desk_mat, "trunk_log");
475   trunk_inside_log = new G4LogicalVolume
476                     (trunk_inside_box, lab_mat, "trunk_inside_log");
477 
478   G4double trunk_X = -0.5*(labWidth - trunkDepth);
479   G4double trunk_Y = 0.0*m;
480   G4double trunk_Z = -0.5*(labHeight - trunkHeight);
481   
482   trunk_phys = new G4PVPlacement
483   (0, G4ThreeVector(trunk_X, trunk_Y, trunk_Z), "trunk_phys", 
484    trunk_log, lab_phys, false, 0);
485 
486   G4double trunkinside_X = -0.5*(trunkDepth - trunk_insideDepth);
487   G4double trunkinside_Y = 0.0*m;
488   G4double trunkinside_Z = -0.5*(trunkHeight - trunk_insideHeight);
489   
490   trunk_inside_phys = new G4PVPlacement
491   (0, G4ThreeVector(trunkinside_X, trunkinside_Y, trunkinside_Z), 
492       "trunk_inside_phys",trunk_inside_log, trunk_phys, false, 0);
493 
494   trunk_log->SetVisAttributes(desk_vat);
495   trunk_inside_log->SetVisAttributes(window_vat);
496 
497   // *****************
498   // desk4,5,6 (actually 4 with multi-place idx) LHS with cupboards underneath:
499 
500   G4double desk4Depth  = 79.0*cm; //X
501   G4double desk4Width  = 79.0*cm; //Y
502   G4double desk4Height = desk1Height; //Z
503 
504   G4double desk4_insideDepth  = desk4Depth - 2.*deskThick;
505   G4double desk4_insideWidth  = desk4Width - 2.*deskThick;
506   G4double desk4_insideHeight = desk4Height - 2.*deskThick;
507 
508   //nb: desk orientation is sideways because they are lined along the wall
509   G4Box* desk4_box = new G4Box
510    ("desk4_box", 0.5*desk4Depth, 0.5*desk4Width, 0.5*desk4Height);
511   G4Box* desk4_inside_box = new G4Box
512     ("desk4_inside_box", 0.5*desk4_insideDepth, 0.5*desk4_insideWidth, 
513      0.5*desk4_insideHeight);
514   G4Box* desk4_door_box = new G4Box
515     ("desk4_door_box", 0.5*deskThick+1.0*nanometer, 0.45*desk4_insideWidth, 
516      0.5*desk4_insideHeight);
517 //    ("desk4_door_box", 0.5*deskThick, 0.45*desk4_insideWidth, 
518 //     0.5*desk4_insideHeight);
519 
520   G4SubtractionSolid* desk4_frame = new G4SubtractionSolid
521     ("desk4_frame", desk4_box, desk4_inside_box, G4Transform3D
522      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
523   G4SubtractionSolid* desk4_sol = new G4SubtractionSolid
524     ("desk4_sol", desk4_frame, desk4_door_box, G4Transform3D
525      (rotMatrixCupboard, G4ThreeVector
526       (0.5*(desk4_insideDepth+deskThick),0.,0.)));
527 
528   desk4_log = new G4LogicalVolume(desk4_sol, desk_mat, "desk4_log");
529 
530   desk_X = -0.5*(labWidth - desk4Depth) + trunkDepth;
531   desk_Y = -(0.5*(labLength - desk4Width) - 5.0*cm);
532   desk_Z = 0.5*(desk4Height - labHeight);
533   
534   G4double crateWidth  = 60.0*cm; //Y
535   G4double crate_Y = 0.;
536 
537   G4RotationMatrix rotMatrixDesk4;
538   rotMatrixDesk4.rotateZ(0.0*deg);
539 
540   for (G4int j=0; j<3; j++)
541     {
542       if( j == 2) 
543         {
544     desk_Y += crateWidth;
545     crate_Y = desk_Y - 0.5*(desk4Width + crateWidth);
546   }
547       desk4_phys = new G4PVPlacement
548   (G4Transform3D(rotMatrixDesk4, G4ThreeVector(desk_X, desk_Y, desk_Z)),
549    "desk4_phys", desk4_log, lab_phys, false, j);
550       desk_Y += desk4Width+2.0*cm;
551     }
552 
553   desk4_log->SetVisAttributes(desk_vat);
554 
555   // *****************
556   // aluminium crate rack:
557 
558   G4double crateDepth  = 64.0*cm; //X
559   //  G4double crateWidth  = 60.0*cm; //Y - moved above...........
560   G4double crateHeight = 128.0*cm; //Z
561   G4double crateThick  = 3.0*cm;
562 
563   G4double crate_insideDepth  = crateDepth - 2.*crateThick;
564   G4double crate_insideWidth  = crateWidth - 2.*crateThick;
565   G4double crate_insideHeight = crateHeight - 2.*crateThick;
566 
567   //nb: crate orientation is sideways because they are lined along the wall
568   G4Box* crate_box = new G4Box
569    ("crate_box", 0.5*crateDepth, 0.5*crateWidth, 0.5*crateHeight);
570   G4Box* crate_inside_box = new G4Box
571     ("crate_inside_box", 0.5*crate_insideDepth, 0.5*crate_insideWidth, 
572      0.5*crate_insideHeight);
573   G4Box* crate_front_box = new G4Box
574     ("crate_front_box", 0.5*crateThick+1.0*nanometer, 0.5*crate_insideWidth, 
575      0.5*crate_insideHeight);
576 
577   G4SubtractionSolid* crate_frame = new G4SubtractionSolid
578     ("crate_frame", crate_box, crate_inside_box, G4Transform3D
579      (rotMatrixCupboard, G4ThreeVector(0.,0.,0.)));
580   G4SubtractionSolid* crate_sol = new G4SubtractionSolid
581     ("crate_sol", crate_frame, crate_front_box, G4Transform3D
582      (rotMatrixCupboard, G4ThreeVector
583       (0.5*(crate_insideDepth+crateThick),0.,0.)));
584 
585   crate_log = new G4LogicalVolume(crate_sol, crate_mat, "crate_log");
586 
587   G4double crate_X = -0.5*(labWidth - crateDepth) + trunkDepth;
588   // crate_Y defined previously (by desk spacing.......)
589   G4double crate_Z = 0.5*(crateHeight - labHeight);
590   
591   crate_phys = new G4PVPlacement
592   (0, G4ThreeVector(crate_X, crate_Y, crate_Z), "crate_phys", 
593    crate_log, lab_phys, false, 0);
594 
595   G4VisAttributes* crate_vat= new G4VisAttributes(grey);
596   crate_vat->SetVisibility(true);
597   crate_vat->SetForceSolid(true);
598   crate_log->SetVisAttributes(crate_vat);
599 
600 // clean room desks: ****************************************************
601 
602 // first oblong desk (type "3"):
603   desk_X = -0.5*(labWidth - desk3Width) + 50.0*cm;
604   desk_Y = 0.5*(labLength - desk3Width - 30.0*cm);
605   desk_Z = 0.5*(desk4Height - labHeight);
606   
607   G4RotationMatrix rotMatrixCleanDesk;
608   rotMatrixCleanDesk.rotateZ(90.0*deg);
609 
610   desk3_phys = new G4PVPlacement
611     (G4Transform3D
612      (rotMatrixCleanDesk,G4ThreeVector(desk_X, desk_Y, desk_Z)), 
613       "desk3_phys", desk3_log, lab_phys, false, 1);
614 
615 // square desk (type "4"):
616 
617   desk_X += 0.5*desk3Width + 0.5*desk4Width; // rotated hence Width
618 
619   rotMatrixCleanDesk.rotateZ(-180.0*deg);
620   desk4_phys = new G4PVPlacement
621     (G4Transform3D
622   (rotMatrixCleanDesk, G4ThreeVector(desk_X, desk_Y, desk_Z)), 
623    "desk4_phys", desk4_log, lab_phys, false, 3);
624 
625 
626