Geant4 9.6.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GDMLMessenger.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// $Id$
28//
29//
30// class G4GDMLMessenger Implementation
31//
32// -------------------------------------------------------------------------
33
34#include "G4GDMLMessenger.hh"
35#include "G4GDMLParser.hh"
36
37#include "globals.hh"
38#include "G4RunManager.hh"
39#include "G4UIdirectory.hh"
40#include "G4UIcmdWithAString.hh"
42#include "G4GeometryManager.hh"
45#include "G4SolidStore.hh"
46
48 : myParser(myPars), topvol(0)
49{
50 persistencyDir = new G4UIdirectory("/persistency/");
51 persistencyDir->SetGuidance("UI commands specific to persistency.");
52
53 gdmlDir = new G4UIdirectory("/persistency/gdml/");
54 gdmlDir->SetGuidance("GDML parser and writer.");
55
56 ReaderCmd = new G4UIcmdWithAString("/persistency/gdml/read",this);
57 ReaderCmd->SetGuidance("Read GDML file.");
58 ReaderCmd->SetParameterName("filename",false);
60
61 TopVolCmd = new G4UIcmdWithAString("/persistency/gdml/topvol",this);
62 TopVolCmd->SetGuidance("Set the top volume for writing the GDML file.");
63 TopVolCmd->SetParameterName("topvol",false);
64
65 WriterCmd = new G4UIcmdWithAString("/persistency/gdml/write",this);
66 WriterCmd->SetGuidance("Write GDML file.");
67 WriterCmd->SetParameterName("filename",false);
69
70 ClearCmd = new G4UIcmdWithoutParameter("/persistency/gdml/clear",this);
71 ClearCmd->SetGuidance("Clear geometry (before reading a new one from GDML).");
73}
74
76{
77 delete ReaderCmd;
78 delete WriterCmd;
79 delete ClearCmd;
80 delete TopVolCmd;
81 delete persistencyDir;
82 delete gdmlDir;
83}
84
86{
87 if( command == ReaderCmd )
88 {
90 myParser->Read(newValue);
92 }
93
94 if( command == TopVolCmd )
95 {
96 topvol = G4LogicalVolumeStore::GetInstance()->GetVolume(newValue);
97 }
98
99 if( command == WriterCmd )
100 {
101 myParser->Write(newValue, topvol);
102 }
103
104 if( command == ClearCmd )
105 {
106 myParser->Clear();
111 }
112}
@ G4State_Idle
@ G4State_PreInit
G4GDMLMessenger(G4GDMLParser *)
void SetNewValue(G4UIcommand *, G4String)
G4VPhysicalVolume * GetWorldVolume(const G4String &setupName="Default") const
void Read(const G4String &filename, G4bool Validate=true)
void Write(const G4String &filename, const G4VPhysicalVolume *pvol=0, G4bool storeReferences=true, const G4String &SchemaLocation=G4GDML_DEFAULT_SCHEMALOCATION)
void OpenGeometry(G4VPhysicalVolume *vol=0)
static G4GeometryManager * GetInstance()
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true) const
static G4LogicalVolumeStore * GetInstance()
static G4RunManager * GetRunManager()
Definition: G4RunManager.cc:62
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
static void Clean()
Definition: G4SolidStore.cc:73
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:156
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:219