Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4GDMLMessenger Class Reference

#include <G4GDMLMessenger.hh>

+ Inheritance diagram for G4GDMLMessenger:

Public Member Functions

 G4GDMLMessenger (G4GDMLParser *)
 
 ~G4GDMLMessenger ()
 
void SetNewValue (G4UIcommand *, G4String)
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const G4String &s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 
- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 48 of file G4GDMLMessenger.hh.

Constructor & Destructor Documentation

◆ G4GDMLMessenger()

G4GDMLMessenger::G4GDMLMessenger ( G4GDMLParser myPars)

Definition at line 46 of file G4GDMLMessenger.cc.

47 : myParser(myPars)
48{
49 persistencyDir = new G4UIdirectory("/persistency/");
50 persistencyDir->SetGuidance("UI commands specific to persistency.");
51
52 gdmlDir = new G4UIdirectory("/persistency/gdml/");
53 gdmlDir->SetGuidance("GDML parser and writer.");
54
55 ReaderCmd = new G4UIcmdWithAString("/persistency/gdml/read", this);
56 ReaderCmd->SetGuidance("Read GDML file.");
57 ReaderCmd->SetParameterName("filename", false);
59 ReaderCmd->SetToBeBroadcasted(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 TopVolCmd->SetToBeBroadcasted(false);
65
66 WriterCmd = new G4UIcmdWithAString("/persistency/gdml/write", this);
67 WriterCmd->SetGuidance("Write GDML file.");
68 WriterCmd->SetParameterName("filename", false);
70 WriterCmd->SetToBeBroadcasted(false);
71
72 StripCmd = new G4UIcmdWithABool("/persistency/gdml/strip_pointers", this);
73 StripCmd->SetGuidance("Enable/disable stripping of pointers on names");
74 StripCmd->SetGuidance("when reading a GDML file.");
75 StripCmd->SetParameterName("strip_pointers", true);
76 StripCmd->SetDefaultValue(true);
78 StripCmd->SetToBeBroadcasted(false);
79
80 AppendCmd = new G4UIcmdWithABool("/persistency/gdml/add_pointers", this);
81 AppendCmd->SetGuidance("Enable/disable appending of pointers to names");
82 AppendCmd->SetGuidance("when writing a GDML file.");
83 AppendCmd->SetParameterName("append_pointers", true);
84 AppendCmd->SetDefaultValue(true);
86 AppendCmd->SetToBeBroadcasted(false);
87
88 RegionCmd = new G4UIcmdWithABool("/persistency/gdml/export_regions", this);
89 RegionCmd->SetGuidance("Enable export of geometrical regions");
90 RegionCmd->SetGuidance("for storing production cuts.");
91 RegionCmd->SetParameterName("export_regions", false);
92 RegionCmd->SetDefaultValue(false);
94 RegionCmd->SetToBeBroadcasted(false);
95
96 EcutsCmd = new G4UIcmdWithABool("/persistency/gdml/export_Ecuts", this);
97 EcutsCmd->SetGuidance("Enable export of energy cuts associated");
98 EcutsCmd->SetGuidance("to logical volumes.");
99 EcutsCmd->SetGuidance("NOTE: may increase considerably the size of the");
100 EcutsCmd->SetGuidance(" GDML file! Information is anyhow not used");
101 EcutsCmd->SetGuidance(" for import.");
102 EcutsCmd->SetParameterName("export_Ecuts", false);
103 EcutsCmd->SetDefaultValue(false);
105 EcutsCmd->SetToBeBroadcasted(false);
106
107 SDCmd = new G4UIcmdWithABool("/persistency/gdml/export_SD", this);
108 SDCmd->SetGuidance("Enable export of SD associated");
109 SDCmd->SetGuidance("to logical volumes.");
110 SDCmd->SetParameterName("export_SD", false);
111 SDCmd->SetDefaultValue(false);
113 SDCmd->SetToBeBroadcasted(false);
114
115 ClearCmd = new G4UIcmdWithoutParameter("/persistency/gdml/clear", this);
116 ClearCmd->SetGuidance("Clear geometry (before reading a new one from GDML).");
118 ClearCmd->SetToBeBroadcasted(false);
119}
@ G4State_Idle
@ G4State_PreInit
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:172
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:157
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:287

◆ ~G4GDMLMessenger()

G4GDMLMessenger::~G4GDMLMessenger ( )

Definition at line 122 of file G4GDMLMessenger.cc.

123{
124 delete ReaderCmd;
125 delete WriterCmd;
126 delete ClearCmd;
127 delete TopVolCmd;
128 delete RegionCmd;
129 delete EcutsCmd;
130 delete SDCmd;
131 delete persistencyDir;
132 delete gdmlDir;
133 delete StripCmd;
134 delete AppendCmd;
135}

Member Function Documentation

◆ SetNewValue()

void G4GDMLMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 138 of file G4GDMLMessenger.cc.

139{
140 if(command == StripCmd)
141 {
142 G4bool mode = StripCmd->GetNewBoolValue(newValue);
143 myParser->SetStripFlag(mode);
144 }
145
146 if(command == AppendCmd)
147 {
148 pFlag = AppendCmd->GetNewBoolValue(newValue);
149 myParser->SetAddPointerToName(pFlag);
150 }
151
152 if(command == ReaderCmd)
153 {
155 myParser->Read(newValue);
157 myParser->GetWorldVolume());
159 }
160
161 if(command == RegionCmd)
162 {
163 G4bool mode = RegionCmd->GetNewBoolValue(newValue);
164 myParser->SetRegionExport(mode);
165 }
166
167 if(command == EcutsCmd)
168 {
169 G4bool mode = EcutsCmd->GetNewBoolValue(newValue);
170 myParser->SetEnergyCutsExport(mode);
171 }
172
173 if(command == SDCmd)
174 {
175 G4bool mode = SDCmd->GetNewBoolValue(newValue);
176 myParser->SetSDExport(mode);
177 }
178
179 if(command == TopVolCmd)
180 {
181 topvol = G4LogicalVolumeStore::GetInstance()->GetVolume(newValue);
182 }
183
184 if(command == WriterCmd)
185 {
186 myParser->Write(newValue, topvol, pFlag);
187 }
188
189 if(command == ClearCmd)
190 {
191 myParser->Clear();
193 }
194}
bool G4bool
Definition: G4Types.hh:86
G4VPhysicalVolume * GetWorldVolume(const G4String &setupName="Default") const
void Read(const G4String &filename, G4bool Validate=true)
void SetSDExport(G4bool)
void SetEnergyCutsExport(G4bool)
void SetStripFlag(G4bool)
void SetAddPointerToName(G4bool set)
void Write(const G4String &filename, const G4VPhysicalVolume *pvol=0, G4bool storeReferences=true, const G4String &SchemaLocation=G4GDML_DEFAULT_SCHEMALOCATION)
void SetRegionExport(G4bool)
static G4GeometryManager * GetInstance()
void OpenGeometry(G4VPhysicalVolume *vol=nullptr)
G4LogicalVolume * GetVolume(const G4String &name, G4bool verbose=true, G4bool reverseSearch=false) const
static G4LogicalVolumeStore * GetInstance()
void ReinitializeGeometry(G4bool destroyFirst=false, G4bool prop=true)
static G4RunManager * GetRunManager()
virtual void DefineWorldVolume(G4VPhysicalVolume *worldVol, G4bool topologyIsChanged=true)
void GeometryDirectlyUpdated(G4bool val=true)
static G4bool GetNewBoolValue(const char *paramString)

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