Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
source
persistency
gdml
src
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
"
41
#include "
G4UIcmdWithoutParameter.hh
"
42
#include "
G4GeometryManager.hh
"
43
#include "
G4LogicalVolumeStore.hh
"
44
#include "
G4PhysicalVolumeStore.hh
"
45
#include "
G4SolidStore.hh
"
46
47
G4GDMLMessenger::G4GDMLMessenger
(
G4GDMLParser
* myPars)
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
);
59
ReaderCmd->
AvailableForStates
(
G4State_PreInit
,
G4State_Idle
);
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
);
68
WriterCmd->
AvailableForStates
(
G4State_Idle
);
69
70
ClearCmd =
new
G4UIcmdWithoutParameter
(
"/persistency/gdml/clear"
,
this
);
71
ClearCmd->
SetGuidance
(
"Clear geometry (before reading a new one from GDML)."
);
72
ClearCmd->
AvailableForStates
(
G4State_Idle
);
73
}
74
75
G4GDMLMessenger::~G4GDMLMessenger
()
76
{
77
delete
ReaderCmd;
78
delete
WriterCmd;
79
delete
ClearCmd;
80
delete
TopVolCmd;
81
delete
persistencyDir;
82
delete
gdmlDir;
83
}
84
85
void
G4GDMLMessenger::SetNewValue
(
G4UIcommand
* command,
G4String
newValue)
86
{
87
if
( command == ReaderCmd )
88
{
89
G4GeometryManager::GetInstance
()->
OpenGeometry
();
90
myParser->
Read
(newValue);
91
G4RunManager::GetRunManager
()->
DefineWorldVolume
(myParser->
GetWorldVolume
());
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
();
107
G4GeometryManager::GetInstance
()->
OpenGeometry
();
108
G4PhysicalVolumeStore::Clean
();
109
G4LogicalVolumeStore::Clean
();
110
G4SolidStore::Clean
();
111
}
112
}
Generated on Sat May 25 2013 14:33:25 for Geant4 by
1.8.4