Loading...
Searching...
No Matches
G03DetectorConstruction.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/// \file persistency/gdml/G03/src/G03DetectorConstruction.cc
27/// \brief Implementation of the G03DetectorConstruction class
28//
29//
30//
31// Class G03DetectorConstruction implementation
32//
33// ----------------------------------------------------------------------------
34
36
37// Geant4 includes
38//
39#include "globals.hh"
40#include "G4Material.hh"
41#include "G4VPhysicalVolume.hh"
42
43// Messenger
44//
46
47// Color extension include for reading
48//
49#include "G03ColorReader.hh"
50
51// Color extension include for writing
52//
53#include "G03ColorWriter.hh"
54
55#include "G4SystemOfUnits.hh"
56
57//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
58
61 fAir(0), fAluminum(0), fPb(0), fXenon(0),
62 fReader(0), fWriter(0), fParser(0),
63 fDetectorMessenger(0)
64{
65 fReadFile = "color_extension.gdml";
66 fWriteFile = "color_extension_test.gdml";
68
70
74}
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
77
85
86//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
87
89{
90 // Reading of Geometry from GDML
91
92 G4VPhysicalVolume* fWorldPhysVol;
93
94 fParser->Read(fReadFile,false);
95 //
96 // 2nd Boolean argument "Validate" set to false.
97 // Disabling Schema validation for reading extended GDML file.
98
99 // Prints the material information
100 //
101 G4cout << *(G4Material::GetMaterialTable() ) << G4endl;
102
103 // Giving World Physical Volume from GDML Parser
104 //
105 fWorldPhysVol = fParser->GetWorldVolume();
106
107 if(fWritingChoice!=0)
108 {
109 fParser->Write(fWriteFile, fWorldPhysVol, true,
110 "./SimpleExtensionSchema/SimpleExtension.xsd");
111 }
112
113 return fWorldPhysVol;
114}
115
116//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
117
119{
120 G4double a; // atomic mass
121 G4double z; // atomic number
122 G4double density,temperature,pressure;
123 G4double fractionmass;
124 G4String name, symbol;
125 G4int ncomponents;
126
127 // Elements needed for the materials
128
129 a = 14.01*g/mole;
130 G4Element* elN = new G4Element(name="Nitrogen", symbol="N", z=7., a);
131
132 a = 16.00*g/mole;
133 G4Element* elO = new G4Element(name="Oxygen", symbol="O", z=8., a);
134
135 a = 26.98*g/mole;
136 G4Element* elAl = new G4Element(name="Aluminum", symbol="Al", z=13., a);
137
138 // Print the Element information
139 //
140 G4cout << *(G4Element::GetElementTable()) << G4endl;
141
142 // Air
143 //
144 density = 1.29*mg/cm3;
145 fAir = new G4Material(name="Air", density, ncomponents=2);
146 fAir->AddElement(elN, fractionmass=0.7);
147 fAir->AddElement(elO, fractionmass=0.3);
148
149 // Aluminum
150 //
151 density = 2.70*g/cm3;
152 fAluminum = new G4Material(name="Aluminum", density, ncomponents=1);
153 fAluminum->AddElement(elAl, fractionmass=1.0);
154
155 // Lead
156 //
157 fPb = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
158
159 // Xenon gas
160 //
161 fXenon = new G4Material("XenonGas", z=54., a=131.29*g/mole,
162 density= 5.458*mg/cm3, kStateGas,
163 temperature= 293.15*kelvin, pressure= 1*atmosphere);
164
165 // Prints the material information
166 //
167 G4cout << *(G4Material::GetMaterialTable() ) << G4endl;
168}
169
170//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
171
173{
174 fReadFile=fname;
176}
177
178//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
179
181{
182 fWriteFile=fname;
184}
std::vector< ExP01TrackerHit * > a
Definition of the G03ColorReader class.
Definition of the G03ColorWriter class.
Definition of the G03DetectorConstruction class.
Definition of the G03DetectorMessenger class.
GDML reader for the color attributes.
GDML writer for the color attributes.
G03DetectorMessenger * fDetectorMessenger
virtual G4VPhysicalVolume * Construct()
G4GDMLWriteStructure * fWriter
void SetWriteFile(const G4String &fname)
void SetReadFile(const G4String &fname)
Detector messenger for the GDML extensions example.

Applications | User Support | Publications | Collaboration