Geant4_10
G4EzWorld.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: G4EzWorld.cc 66892 2013-01-17 10:57:59Z gunter $
27 // ====================================================================
28 // G4EzWorld.cc
29 //
30 // 2005 Q
31 // ====================================================================
32 #include "G4EzWorld.hh"
33 #include "G4Element.hh"
34 #include "G4Material.hh"
35 #include "G4Box.hh"
36 #include "G4LogicalVolume.hh"
37 #include "G4PVPlacement.hh"
38 #include "G4VisAttributes.hh"
39 #include "G4RunManager.hh"
40 #include "G4PhysicalConstants.hh"
41 
43 
44 // ====================================================================
45 //
46 // class description
47 //
48 // ====================================================================
49 
53 {
54 }
55 
59 {
60  world= 0;
61 }
62 
63 
66  (G4double dx, G4double dy, G4double dz)
68 {
69  // default matetial is "vacuum"
70  G4Material* vacuum= G4Material::GetMaterial("_Vacuum", false);
71 
72  if(vacuum==0) {
73  G4Element* elN= new G4Element("_N", "", 7., 14.00674*g/mole);
74  G4Element* elO= new G4Element("_O", "", 8., 15.9994*g/mole);
75 
76  vacuum= new G4Material("_Vacuum", universe_mean_density, 2);
77  vacuum-> AddElement(elN, 0.7);
78  vacuum-> AddElement(elO, 0.3);
79  }
80 
81  G4Box* sdworld= new G4Box("world", dx/2., dy/2., dz/2.);
82  G4LogicalVolume* lvworld= new G4LogicalVolume(sdworld, vacuum, "word");
83  G4PVPlacement* aworld= new G4PVPlacement(0, G4ThreeVector(), "world",
84  lvworld, 0, false, 0);
85 
86  // vis. attributes
87  G4VisAttributes* vaworld= new G4VisAttributes(G4Color(1.,1.,1.));
88  vaworld-> SetForceWireframe(true);
89  lvworld-> SetVisAttributes(vaworld);
90 
91  return aworld;
92 
93 }
94 
95 
99 {
100  delete world;
101  world= CreateWorld(dx, dy, dz);
102 
104  runManager-> DefineWorldVolume(world);
105 }
106 
107 
111 {
112  G4Box* box= dynamic_cast<G4Box*>(world-> GetLogicalVolume()-> GetSolid());
113  box-> SetXHalfLength(dx/2.);
114  box-> SetYHalfLength(dy/2.);
115  box-> SetZHalfLength(dz/2.);
116 
118  runManager-> GeometryHasBeenModified();
119 }
120 
121 
125 {
126  world-> GetLogicalVolume()-> SetMaterial(amaterial);
127 }
128 
129 
133 {
134  G4VisAttributes* vaworld= const_cast<G4VisAttributes*>(
135  world-> GetLogicalVolume()-> GetVisAttributes());
136  vaworld-> SetVisibility(qvis);
137 }
138 
CLHEP::Hep3Vector G4ThreeVector
static G4VPhysicalVolume * world
Definition: G4EzWorld.hh:53
static G4Material * GetMaterial(const G4String &name, G4bool warning=true)
Definition: G4Material.cc:578
static void Resize(G4double dx, G4double dy, G4double dz)
Definition: G4EzWorld.cc:109
int universe_mean_density
Definition: hepunit.py:307
Definition: G4Box.hh:63
static void SetVisibility(G4bool qvis)
Definition: G4EzWorld.cc:131
static void SetMaterial(G4Material *amaterial)
Definition: G4EzWorld.cc:123
G4Element * elN
Definition: TRTMaterials.hh:44
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4Element * elO
Definition: TRTMaterials.hh:46
static G4VPhysicalVolume * CreateWorld(G4double dx=1.*m, G4double dy=1.*m, G4double dz=1.*m)
Definition: G4EzWorld.cc:66
bool G4bool
Definition: G4Types.hh:79
G4Colour G4Color
Definition: G4Color.hh:42
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:74
~G4EzWorld()
Definition: G4EzWorld.cc:57
double G4double
Definition: G4Types.hh:76
UBox box
Definition: UPolycone.cc:32
Air AddElement(elN,.7)
static void Reset(G4double dx, G4double dy, G4double dz)
Definition: G4EzWorld.cc:97