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 | // * * |
---|
28 | // * RemSimAstronautDecorator.cc * |
---|
29 | // * * |
---|
30 | // ********************************** |
---|
31 | // |
---|
32 | // $Id: RemSimAstronautDecorator.cc,v 1.7 2006/06/29 16:23:33 gunter Exp $ |
---|
33 | // |
---|
34 | // Author:Susanna Guatelli, guatelli@ge.infn.it |
---|
35 | |
---|
36 | #include "RemSimVGeometryComponent.hh" |
---|
37 | #include "RemSimMaterial.hh" |
---|
38 | #include "G4Material.hh" |
---|
39 | #include "G4MaterialTable.hh" |
---|
40 | #include "RemSimAstronautDecorator.hh" |
---|
41 | #include "RemSimDecorator.hh" |
---|
42 | #include "G4Box.hh" |
---|
43 | #include "G4LogicalVolume.hh" |
---|
44 | #include "G4VPhysicalVolume.hh" |
---|
45 | #include "G4PVPlacement.hh" |
---|
46 | #include "G4VisAttributes.hh" |
---|
47 | #include "RemSimSensitiveDetector.hh" |
---|
48 | #include "RemSimROGeometry.hh" |
---|
49 | #include "G4SDManager.hh" |
---|
50 | #include "G4RunManager.hh" |
---|
51 | #include "G4UserLimits.hh" |
---|
52 | #include "RemSimMoonHabitat.hh" |
---|
53 | |
---|
54 | RemSimAstronautDecorator::RemSimAstronautDecorator(RemSimVGeometryComponent* comp, G4bool moon) |
---|
55 | : RemSimDecorator(comp), phantom(0), phantomLog(0), phantomPhys(0) |
---|
56 | { |
---|
57 | flag = moon; |
---|
58 | sensitiveDetector = 0; |
---|
59 | } |
---|
60 | RemSimAstronautDecorator::~RemSimAstronautDecorator() |
---|
61 | { |
---|
62 | } |
---|
63 | void RemSimAstronautDecorator::ConstructComponent(G4VPhysicalVolume* motherVolume) |
---|
64 | { |
---|
65 | RemSimDecorator::ConstructComponent(motherVolume); |
---|
66 | ConstructAstronaut(motherVolume); |
---|
67 | } |
---|
68 | |
---|
69 | void RemSimAstronautDecorator::DestroyComponent() |
---|
70 | { |
---|
71 | |
---|
72 | } |
---|
73 | |
---|
74 | void RemSimAstronautDecorator::ConstructAstronaut(G4VPhysicalVolume* motherVolume) |
---|
75 | { |
---|
76 | // Astronaut definition: Box of water |
---|
77 | // The Astronaut is the sensitive detector |
---|
78 | |
---|
79 | RemSimMaterial* pMaterial = new RemSimMaterial(); |
---|
80 | |
---|
81 | G4Material* water = pMaterial -> GetMaterial("Water"); |
---|
82 | delete pMaterial; |
---|
83 | |
---|
84 | // Phantom sizes |
---|
85 | G4double phantomX = 3. *m; |
---|
86 | G4double phantomY = 3. *m; |
---|
87 | G4double phantomZ = 30. *cm; |
---|
88 | |
---|
89 | |
---|
90 | phantom = new G4Box("phantom",phantomX/2.,phantomY/2.,phantomZ/2.); |
---|
91 | |
---|
92 | phantomLog = new G4LogicalVolume(phantom, |
---|
93 | water, |
---|
94 | "phantom", |
---|
95 | 0,0,0); |
---|
96 | G4double translation1 = 0.; |
---|
97 | if (flag == true) |
---|
98 | { |
---|
99 | G4double thickShelter = 4.5 *m; |
---|
100 | translation1 = 0.5*m + thickShelter/2.; |
---|
101 | } |
---|
102 | |
---|
103 | phantomPhys = new G4PVPlacement(0, |
---|
104 | G4ThreeVector(0.,0.,translation1), |
---|
105 | "phantom",phantomLog, |
---|
106 | motherVolume,false,0); |
---|
107 | |
---|
108 | // Visualisation attributes |
---|
109 | G4Colour lblue (0.0, 0.0,.75); |
---|
110 | G4VisAttributes* phantomVisAtt = new G4VisAttributes(lblue); |
---|
111 | phantomVisAtt -> SetVisibility(true); |
---|
112 | phantomVisAtt -> SetForceSolid(true); |
---|
113 | phantomLog -> SetVisAttributes(phantomVisAtt); |
---|
114 | |
---|
115 | //Sensitive Detector |
---|
116 | G4SDManager* SDman = G4SDManager::GetSDMpointer(); |
---|
117 | |
---|
118 | G4String sensitiveDetectorName = "AstronautSD"; |
---|
119 | |
---|
120 | |
---|
121 | sensitiveDetector = new RemSimSensitiveDetector(sensitiveDetectorName); |
---|
122 | G4int VoxelNbAlongZ = 30; |
---|
123 | |
---|
124 | G4double translation = 0; |
---|
125 | |
---|
126 | if (flag == true) |
---|
127 | { |
---|
128 | G4double thickShelter = 4.5 *m; |
---|
129 | translation = 0.5*m + thickShelter/2.; |
---|
130 | } |
---|
131 | |
---|
132 | RemSimROGeometry* ROGeometry = new RemSimROGeometry(phantomX, |
---|
133 | phantomY, |
---|
134 | phantomZ, |
---|
135 | VoxelNbAlongZ, |
---|
136 | translation); |
---|
137 | ROGeometry -> BuildROGeometry(); |
---|
138 | sensitiveDetector -> SetROgeometry(ROGeometry); |
---|
139 | SDman->AddNewDetector(sensitiveDetector); |
---|
140 | phantomLog -> SetSensitiveDetector(sensitiveDetector); |
---|
141 | |
---|
142 | // Set max step allowd to particles in the phantom |
---|
143 | phantomLog -> SetUserLimits(new G4UserLimits(0.1*cm)); |
---|
144 | } |
---|
145 | |
---|
146 | void RemSimAstronautDecorator::ChangeThickness(G4double) |
---|
147 | { |
---|
148 | G4cout << "It is not possible to change the sizes of the Astronaut" |
---|
149 | << G4endl; |
---|
150 | } |
---|
151 | |
---|
152 | void RemSimAstronautDecorator::PrintDetectorParameters() |
---|
153 | { |
---|
154 | G4cout << "-----------------------------------------------------------------------" |
---|
155 | << G4endl |
---|
156 | << "the astronaut is a box whose thickness is: " << G4endl |
---|
157 | << ((phantom -> GetZHalfLength())*2.)/cm |
---|
158 | << " cm along the Z axis" |
---|
159 | << G4endl |
---|
160 | << "material of the astronaut: " |
---|
161 | << phantomLog -> GetMaterial() -> GetName() <<G4endl |
---|
162 | << G4endl; |
---|
163 | } |
---|
164 | |
---|