Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RemSimDetectorConstruction.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 //
27 // **************************************
28 // * *
29 // * RemSimDetectorConstruction.cc *
30 // * *
31 // **************************************
32 //
33 // $Id$
34 //
35 // Author:Susanna Guatelli, susanna@uow.edu.au
36 //
38 #include "RemSimMaterial.hh"
40 #include "globals.hh"
41 #include "G4SystemOfUnits.hh"
42 #include "G4Material.hh"
43 #include "G4Box.hh"
44 #include "G4Tubs.hh"
45 #include "G4LogicalVolume.hh"
46 #include "G4ThreeVector.hh"
47 #include "G4PVPlacement.hh"
48 #include "G4RunManager.hh"
49 #include "G4Colour.hh"
51 #include "RemSimVehicle1.hh"
52 #include "RemSimMoonHabitat.hh"
53 #include "G4VisAttributes.hh"
54 #include "RemSimDecorator.hh"
58 #include "RemSimRoofDecorator.hh"
59 
61  : experimentalHall_log(0), experimentalHall_phys(0),
62  phantomPhys(0), detectorPhys(0), geometry(0)
63 {
64  pMaterial = new RemSimMaterial();
65 
66  messenger = new RemSimDetectorMessenger(this);
67  decoratorValue ="Nothing";
68  astronautValue ="On";
69  decorator = 0; //pointing to shielding
70  decoratorSPE = 0; //pointing to SPE shelter
71  decorator1 = 0; //pointing to the phantom/astronaut
72  decoratorRoof = 0; //pointing to the roof of the Moon Habitat
73  moon = false; // moon = true: moon configuration selected
74  // moon = false: vehicle configuration selected
75  flag = false; // flag = true : the geometry configuration (vehicle/moon)
76  // has been chosen
77  // flag = false : the geometry configuration (vehicle/moon)
78  // has not been chosen}
79 }
80 
82 {
83  delete decoratorRoof;
84  delete decorator1;
85  delete decoratorSPE;
86  delete decorator;
87  delete messenger;
88  delete geometry;
89  delete pMaterial;
90 }
91 
93 {
94  pMaterial -> DefineMaterials();
95  G4Material* vacuum = pMaterial -> GetMaterial("Galactic");
96 
97  // World definition
98 
99  G4double expHall_x = 30.0*m;
100  G4double expHall_y = 30.0*m;
101  G4double expHall_z = 30.0*m;
102 
103  G4Box* experimentalHall_box
104  = new G4Box("world",expHall_x,expHall_y,expHall_z);
105  experimentalHall_log = new G4LogicalVolume(experimentalHall_box,
106  vacuum,"world",0,0,0);
107 
108  experimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),"world",
109  experimentalHall_log,0,
110  false,0);
111  return experimentalHall_phys;
112 }
113 
115 {
116  if (moon == true)
117  {
118 
119  geometry = new RemSimMoonHabitat();
120  geometry -> ConstructComponent(experimentalHall_phys);
121  decorator1 = new RemSimAstronautDecorator(geometry, moon);
122  decorator1 -> ConstructComponent(experimentalHall_phys);
123  }
124  else
125  {
126  geometry = new RemSimVehicle1();
127  geometry -> ConstructComponent(experimentalHall_phys);
128  decorator1 = new RemSimAstronautDecorator(geometry, moon);
129  decorator1 -> ConstructComponent(experimentalHall_phys);
130  }
131 }
132 
134 {
135  if (moon == false)
136  {
137  decoratorValue = value;
138 
139  if (decoratorValue == "On")
140  {
141  if (decorator == 0)
142  {
143  decorator = new RemSimShieldingDecorator(geometry);
144  decorator -> ConstructComponent(experimentalHall_phys);
145  G4RunManager::GetRunManager() -> DefineWorldVolume(experimentalHall_phys);
146  }
147  else G4cout<<" The shielding alread exists!"<<G4endl;
148  }
149 
150  if (decoratorValue == "Off")
151  {
152  if (decorator != 0)
153  {
154  decorator -> DestroyComponent();
155  G4RunManager::GetRunManager() -> DefineWorldVolume(experimentalHall_phys);
156  decorator = 0;
157  }
158 
159  else G4cout<<" The shielding does not exist!"<<G4endl;
160  }
161  }
162  else G4cout << " The shielding is not available in moon habitat configuration"<<G4endl;
163 }
164 
166 {
167  if (moon == false)
168  {
169  if (value == "On")
170  {
171  if (decoratorSPE == 0)
172  {
173  decoratorSPE = new RemSimShelterSPEDecorator(geometry);
174  decoratorSPE -> ConstructComponent(experimentalHall_phys);
175  G4RunManager::GetRunManager() -> DefineWorldVolume(experimentalHall_phys);
176  }
177  else G4cout<<" The SPE shelter alread exists!"<<G4endl;
178  }
179 
180  if (value == "Off")
181  {
182  if (decoratorSPE != 0)
183  {
184  decoratorSPE -> DestroyComponent();
185  G4RunManager::GetRunManager() -> DefineWorldVolume(experimentalHall_phys);
186  decoratorSPE = 0;
187  }
188 
189  else G4cout<<" The SPE shelter does not exist!"<<G4endl;
190  }
191  }
192  else G4cout<< " It is not possible to select SPE shelter in moon habitat configuration" << G4endl;
193 }
194 
196 {
197  if (moon == true)
198  {
199  if (value == "On")
200  {
201  if (decoratorRoof == 0)
202  {
203  decoratorRoof = new RemSimRoofDecorator(geometry);
204  decoratorRoof -> ConstructComponent(experimentalHall_phys);
205  G4RunManager::GetRunManager() -> DefineWorldVolume(experimentalHall_phys);
206  }
207  else G4cout<<" The roof alread exists!"<<G4endl;
208  }
209 
210  if (value == "Off")
211  {
212  if (decoratorRoof != 0)
213  {
214  decoratorRoof -> DestroyComponent();
215  G4RunManager::GetRunManager() -> DefineWorldVolume(experimentalHall_phys);
216  decoratorRoof = 0;
217  }
218 
219  else G4cout<<" The roof does not exist!"<<G4endl;
220  }
221  }
222  else G4cout<< " It is not possible to select the roof in the vehicle configuration" << G4endl;
223 }
224 
226 {
227  if (moon == false)
228  {
229  if (decorator != 0)
230  {
231  decorator -> ChangeThickness(thick);
232  G4RunManager::GetRunManager() -> DefineWorldVolume(experimentalHall_phys);
233  }
234  else G4cout<<" Define the shielding before!"<< G4endl;
235  }
236 }
237 
239 {
240  if (moon == true)
241  {
242  if (decoratorRoof != 0)
243  {
244  decoratorRoof -> ChangeThickness(thick);
245  G4RunManager::GetRunManager() -> DefineWorldVolume(experimentalHall_phys);
246  }
247  else G4cout<<" Define the roof before!"<< G4endl;
248  }
249 
250  else G4cout<<"The roof can be selected in moon habitat configuration"<<G4endl;
251 }
252 
254 {
255  if (flag == false)
256  {
257  if (value == "vehicle") ConstructVolume();
258 
259  else if (value == "moon")
260  {
261  moon = true;
262  ConstructVolume();
263  }
264  G4RunManager::GetRunManager() -> DefineWorldVolume(experimentalHall_phys);
265  flag = true;
266  }
267  else
268  G4cout<< "The configurations vehicle/moon can not be switched" << G4endl;
269 }
270