Loading...
Searching...
No Matches
OpNoviceGDMLDetectorConstruction.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
29
30#include "globals.hh"
31#include "G4GDMLParser.hh"
32#include "G4LogicalVolumeStore.hh"
33#include "G4NistManager.hh"
34#include "G4PhysicalVolumeStore.hh"
35#include "G4RunManager.hh"
36#include "G4VisAttributes.hh"
37
38//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
40 G4String fname)
42{
43 fGdmlFile = fname;
44 // create a messenger for this class
46
47 G4cout << "Building detector from GDML file: " << fname << G4endl << G4endl;
48}
49
50//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
56
57//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59{
60 ReadGDML();
61 G4VPhysicalVolume* worldPhysVol = fParser->GetWorldVolume();
62 if(fDumpGdml)
63 fParser->Write(fDumpGdmlFileName, worldPhysVol);
64 return worldPhysVol;
65}
66
67//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
69
70//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72{
73 fParser = new G4GDMLParser();
74 fParser->Read(fGdmlFile, false);
75 G4VPhysicalVolume* world = fParser->GetWorldVolume();
76 // GDML parser makes world invisible. make it visible again.
77 G4LogicalVolume* pworldLogical = world->GetLogicalVolume();
78 pworldLogical->SetVisAttributes(nullptr);
79 G4cout << world->GetTranslation() << G4endl << G4endl;
80 if(fVerbose)
81 {
82 G4cout << "Found world: " << world->GetName() << G4endl;
83 G4cout << "world LV: " << world->GetLogicalVolume()->GetName() << G4endl;
84 }
85 G4LogicalVolumeStore* pLVStore = G4LogicalVolumeStore::GetInstance();
86 if(fVerbose)
87 {
88 G4cout << "Found " << pLVStore->size() << " logical volumes." << G4endl
89 << G4endl;
90 }
91 G4PhysicalVolumeStore* pPVStore = G4PhysicalVolumeStore::GetInstance();
92 if(fVerbose)
93 {
94 G4cout << "Found " << pPVStore->size() << " physical volumes." << G4endl
95 << G4endl;
96 }
97}
98
99//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
101{
102 G4RunManager::GetRunManager()->DefineWorldVolume(Construct());
103}
104
105//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
107{
108 fDumpGdml = val;
109}
110
111//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
113{
114 return fDumpGdml;
115}
116
117//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119{
120 fVerbose = val;
121}
122
123//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125
126//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
131
132//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
Definition of the OpNoviceDetectorMessenger class.

Applications | User Support | Publications | Collaboration