Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G03DetectorConstruction Class Reference

Detector construction for the GDML extensions example. More...

#include <G03DetectorConstruction.hh>

Inheritance diagram for G03DetectorConstruction:
G4VUserDetectorConstruction

Public Member Functions

 G03DetectorConstruction ()
 
 ~G03DetectorConstruction ()
 
virtual G4VPhysicalVolumeConstruct ()
 
void ListOfMaterials ()
 
void SetReadFile (const G4String &fname)
 
void SetWriteFile (const G4String &fname)
 
- Public Member Functions inherited from G4VUserDetectorConstruction
 G4VUserDetectorConstruction ()
 
virtual ~G4VUserDetectorConstruction ()
 
virtual void ConstructSDandField ()
 
virtual void CloneSD ()
 
virtual void CloneF ()
 
void RegisterParallelWorld (G4VUserParallelWorld *)
 
G4int ConstructParallelGeometries ()
 
void ConstructParallelSD ()
 
G4int GetNumberOfParallelWorld () const
 
G4VUserParallelWorldGetParallelWorld (G4int i) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VUserDetectorConstruction
void SetSensitiveDetector (const G4String &logVolName, G4VSensitiveDetector *aSD, G4bool multi=false)
 
void SetSensitiveDetector (G4LogicalVolume *logVol, G4VSensitiveDetector *aSD)
 

Detailed Description

Detector construction for the GDML extensions example.

Definition at line 50 of file G03DetectorConstruction.hh.

Constructor & Destructor Documentation

G03DetectorConstruction::G03DetectorConstruction ( )

Definition at line 60 of file G03DetectorConstruction.cc.

62  fAir(0), fAluminum(0), fPb(0), fXenon(0),
63  fReader(0), fWriter(0), fParser(0),
64  fDetectorMessenger(0)
65 {
66  fReadFile = "color_extension.gdml";
67  fWriteFile = "color_extension_test.gdml";
68  fWritingChoice = 1;
69 
70  fDetectorMessenger = new G03DetectorMessenger( this );
71 
72  fReader = new G03ColorReader;
73  fWriter = new G03ColorWriter;
74  fParser = new G4GDMLParser(fReader, fWriter);
75 }
GDML reader for the color attributes.
Detector messenger for the GDML extensions example.
GDML writer for the color attributes.
G03DetectorConstruction::~G03DetectorConstruction ( )

Definition at line 79 of file G03DetectorConstruction.cc.

80 {
81  delete fDetectorMessenger;
82  delete fReader;
83  delete fWriter;
84  delete fParser;
85 }

Member Function Documentation

G4VPhysicalVolume * G03DetectorConstruction::Construct ( void  )
virtual

Implements G4VUserDetectorConstruction.

Definition at line 89 of file G03DetectorConstruction.cc.

References G4cout, G4endl, G4Material::GetMaterialTable(), G4GDMLParser::GetWorldVolume(), G4GDMLParser::Read(), and G4GDMLParser::Write().

90 {
91  // Reading of Geometry from GDML
92 
93  G4VPhysicalVolume* fWorldPhysVol;
94 
95  fParser->Read(fReadFile,false);
96  //
97  // 2nd Boolean argument "Validate" set to false.
98  // Disabling Schema validation for reading extended GDML file.
99 
100  // Prints the material information
101  //
103 
104  // Giving World Physical Volume from GDML Parser
105  //
106  fWorldPhysVol = fParser->GetWorldVolume();
107 
108  if(fWritingChoice!=0)
109  {
110  fParser->Write(fWriteFile, fWorldPhysVol, true,
111  "./SimpleExtensionSchema/SimpleExtension.xsd");
112  }
113 
114  return fWorldPhysVol;
115 }
G4VPhysicalVolume * GetWorldVolume(const G4String &setupName="Default") const
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
G4GLOB_DLL std::ostream G4cout
void Write(const G4String &filename, const G4VPhysicalVolume *pvol=0, G4bool storeReferences=true, const G4String &SchemaLocation=G4GDML_DEFAULT_SCHEMALOCATION)
void Read(const G4String &filename, G4bool Validate=true)
#define G4endl
Definition: G4ios.hh:61
void G03DetectorConstruction::ListOfMaterials ( )

Definition at line 119 of file G03DetectorConstruction.cc.

References test::a, G4Material::AddElement(), python.hepunit::atmosphere, python.hepunit::cm3, density, elN, elO, g(), G4cout, G4endl, G4Element::GetElementTable(), G4Material::GetMaterialTable(), python.hepunit::kelvin, kStateGas, python.hepunit::mg, python.hepunit::mole, symbol, and z.

120 {
121  G4double a; // atomic mass
122  G4double z; // atomic number
123  G4double density,temperature,pressure;
124  G4double fractionmass;
126  G4int ncomponents;
127 
128  // Elements needed for the materials
129 
130  a = 14.01*g/mole;
131  G4Element* elN = new G4Element(name="Nitrogen", symbol="N", z=7., a);
132 
133  a = 16.00*g/mole;
134  G4Element* elO = new G4Element(name="Oxygen", symbol="O", z=8., a);
135 
136  a = 26.98*g/mole;
137  G4Element* elAl = new G4Element(name="Aluminum", symbol="Al", z=13., a);
138 
139  // Print the Element information
140  //
142 
143  // Air
144  //
145  density = 1.29*mg/cm3;
146  fAir = new G4Material(name="Air", density, ncomponents=2);
147  fAir->AddElement(elN, fractionmass=0.7);
148  fAir->AddElement(elO, fractionmass=0.3);
149 
150  // Aluminum
151  //
152  density = 2.70*g/cm3;
153  fAluminum = new G4Material(name="Aluminum", density, ncomponents=1);
154  fAluminum->AddElement(elAl, fractionmass=1.0);
155 
156  // Lead
157  //
158  fPb = new G4Material("Lead", z=82., a= 207.19*g/mole, density= 11.35*g/cm3);
159 
160  // Xenon gas
161  //
162  fXenon = new G4Material("XenonGas", z=54., a=131.29*g/mole,
163  density= 5.458*mg/cm3, kStateGas,
164  temperature= 293.15*kelvin, pressure= 1*atmosphere);
165 
166  // Prints the material information
167  //
169 }
G4String symbol
Definition: TRTMaterials.hh:40
G4double z
Definition: TRTMaterials.hh:39
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:564
int atmosphere
Definition: hepunit.py:151
const XML_Char * name
int G4int
Definition: G4Types.hh:78
G4Element * elN
Definition: TRTMaterials.hh:44
G4double density
Definition: TRTMaterials.hh:39
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
G4GLOB_DLL std::ostream G4cout
G4Element * elO
Definition: TRTMaterials.hh:46
#define G4endl
Definition: G4ios.hh:61
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:345
double G4double
Definition: G4Types.hh:76
static G4ElementTable * GetElementTable()
Definition: G4Element.cc:395
void G03DetectorConstruction::SetReadFile ( const G4String fname)

Definition at line 173 of file G03DetectorConstruction.cc.

References test::fname.

Referenced by G03DetectorMessenger::SetNewValue().

174 {
175  fReadFile=fname;
176  fWritingChoice=0;
177 }
void G03DetectorConstruction::SetWriteFile ( const G4String fname)

Definition at line 181 of file G03DetectorConstruction.cc.

References test::fname.

Referenced by G03DetectorMessenger::SetNewValue().

182 {
183  fWriteFile=fname;
184  fWritingChoice=1;
185 }

The documentation for this class was generated from the following files: