QwGeant4
QweakSimGeometryMessenger.cc
Go to the documentation of this file.
1 //=============================================================================
2 //
3 // ---------------------------
4 // | Doxygen File Information |
5 // ---------------------------
6 //
7 /**
8 
9  \file QweakSimGeometryMessenger.cc
10 
11  $Revision: 1.0 $
12  $Date: 2009/10/12 13:32:26 $
13 
14  \author Wouter Deconinck
15 
16 */
17 //=============================================================================
18 
20 
21 // user includes
22 #include "QweakSimGeometry.hh"
24 
25 // ----------------------------------------------------------------------------
26 
28  : theGeometry(aGeometry)
29 {
30  G4cout << G4endl << "###### Calling QweakSimGeometryMessenger::QweakSimGeometryMessenger() " << G4endl << G4endl;
31 
32  theGeometryDir = new G4UIdirectory( "/GDML/" );
33  theGeometryDir->SetGuidance("GDML geometry control.");
34 
35  theReadCommand = new G4UIcmdWithAString("/GDML/Read", this);
36  theReadCommand->SetGuidance("Read geometry from GDML file with given name");
37  theReadCommand->SetParameterName("FileRead", false);
38  theReadCommand->SetDefaultValue("GMDL/qweak.gdml");
39  theReadCommand->AvailableForStates(G4State_PreInit);
40 
41  theWriteCommand = new G4UIcmdWithAString("/GDML/Write", this);
42  theWriteCommand->SetGuidance("Write geometry to GDML file with given name");
43  theWriteCommand->SetParameterName("FileWrite", false);
44  theWriteCommand->SetDefaultValue("GDML/qweak_out.gdml");
45  theWriteCommand->AvailableForStates(G4State_Idle);
46 
47  theDepthCommand = new G4UIcmdWithAnInteger("/GDML/WriteDepth", this);
48  theDepthCommand->SetGuidance("Split GDML output in automatic modules");
49  theDepthCommand->SetParameterName("WriteDepth", false);
50  theDepthCommand->SetDefaultValue(2);
51  theDepthCommand->AvailableForStates(G4State_Idle);
52 
53  theModuleCommand = new G4UIcmdWithABool("/GDML/WriteModule", this);
54  theModuleCommand->SetGuidance("Split GDML output in user modules");
55  theModuleCommand->SetParameterName("WriteModule", false);
56  theModuleCommand->SetDefaultValue(false);
57  theModuleCommand->AvailableForStates(G4State_Idle);
58 
59  G4cout << G4endl << "###### Leaving QweakSimGeometryMessenger::QweakSimGeometryMessenger() " << G4endl << G4endl;
60 }
61 
62 // ----------------------------------------------------------------------------
63 
65 {
66  G4cout << G4endl << "###### Calling QweakSimGeometryMessenger::~QweakSimGeometryMessenger() " << G4endl << G4endl;
67 
68  if (theReadCommand) delete theReadCommand;
69  if (theWriteCommand) delete theWriteCommand;
70  if (theDepthCommand) delete theDepthCommand;
72  if (theGeometryDir) delete theGeometryDir;
73 
74  G4cout << G4endl << "###### Leaving QweakSimGeometryMessenger::~QweakSimGeometryMessenger() " << G4endl << G4endl;
75 }
76 
77 // ----------------------------------------------------------------------------
78 
79 void QweakSimGeometryMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
80 {
81  if (command == theReadCommand)
82  {
83  theGeometry->SetReadFile(newValue);
84 // theGeometry->Read();
85  }
86  if (command == theWriteCommand)
87  {
88  theGeometry->SetWriteFile(newValue);
89  theGeometry->Write();
90  }
91  if (command == theDepthCommand)
92  {
93  theGeometry->SetWriteModuleDepth(theDepthCommand->GetNewIntValue(newValue));
94  }
95  if (command == theModuleCommand)
96  {
97  theGeometry->SetWriteModuleUser(theModuleCommand->GetNewBoolValue(newValue));
98  }
99 }
void SetWriteModuleUser(const G4bool &flag)
void SetReadFile(const G4String &file)
void SetWriteFile(const G4String &file)
QweakSimGeometryMessenger(QweakSimGeometry *)
void SetNewValue(G4UIcommand *, G4String)
main class of QweakSim. All passive elements are are read from the GDML files.
void SetWriteModuleDepth(const G4int &depth)
G4UIcmdWithAnInteger * theDepthCommand