Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RemSimShieldingDecorator.cc
Go to the documentation of this file.
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 // $Id$
27 //
28 // Code developed by: S.Guatelli, susanna@uow.edu.au
29 //
31 #include "RemSimDecorator.hh"
33 #include "RemSimMaterial.hh"
34 
35 #include "G4SystemOfUnits.hh"
36 #include "G4Material.hh"
37 #include "G4MaterialTable.hh"
38 #include "G4Box.hh"
39 #include "G4LogicalVolume.hh"
40 #include "G4VPhysicalVolume.hh"
41 #include "G4PVPlacement.hh"
42 #include "G4VisAttributes.hh"
43 #include "G4RunManager.hh"
44 #include "G4VisAttributes.hh"
45 
47  : RemSimDecorator(comp)
48 {
49  shieldingX = 5.*m;
50  shieldingY = 5.*m;
51  shieldingZ = 10.*cm;
52  translation = -4.4* m;
53  pMaterial = new RemSimMaterial();
54 
55  shieldingVisAtt = 0;
56 }
58 {
59  delete pMaterial;
60 }
62 {
63  pMaterial -> DefineMaterials();
65  ConstructShielding(motherVolume);
66 }
67 
69 {
70  delete shieldingVisAtt;
71  shieldingVisAtt = 0;
72 
73  delete shieldingPhys;
74  shieldingPhys = 0;
75 
76  delete shieldingLog;
77  shieldingLog = 0;
78 
79  delete shielding;
80  shielding = 0;
81 }
82 void RemSimShieldingDecorator::ConstructShielding(G4VPhysicalVolume* motherVolume)
83 {
84  // Geometry definition
85  pMaterial -> DefineMaterials();
86 
87  G4Material* water = pMaterial -> GetMaterial("Water");
88 
89  shielding = new G4Box("shielding",shieldingX/2.,shieldingY/2.,shieldingZ/2.);
90 
91  shieldingLog = new G4LogicalVolume(shielding, water,
92  "shieldingLog",0,0,0);
93 
94  shieldingPhys = new G4PVPlacement(0,
95  G4ThreeVector(0.,0.,translation + shieldingZ/2.),
96  "shieldingPhys", shieldingLog, motherVolume,false,0);
97 
98  //Visualisation attributes
99  G4Colour red (1.0,0.0,0.0);
100  shieldingVisAtt = new G4VisAttributes(red);
101  shieldingVisAtt -> SetVisibility(true);
102  shieldingVisAtt -> SetForceSolid(true);
103  shieldingLog -> SetVisAttributes(shieldingVisAtt);
105 }
106 
108 {
110  shielding -> SetZHalfLength(thick/2.);
111  shieldingPhys -> SetTranslation(G4ThreeVector
112  (0.,0.,translation + thick/2.));
113 }
114 
116 {
117  G4cout << "-----------------------------------------------------------------------"
118  << G4endl
119  << "the shielding is a box whose thickness is: " << G4endl
120  << ((shielding -> GetZHalfLength())*2.)/cm
121  << " cm along the Z axis"
122  << G4endl
123  << "material of the shielding: "
124  << shieldingLog -> GetMaterial() -> GetName() <<G4endl
125  << G4endl;
126 }