Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4GMocrenMessenger Class Reference

#include <G4GMocrenMessenger.hh>

Inheritance diagram for G4GMocrenMessenger:
G4UImessenger

Public Member Functions

 G4GMocrenMessenger ()
 
virtual ~G4GMocrenMessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
virtual G4String getEventNumberSuffix ()
 
virtual G4bool appendGeometry ()
 
virtual G4bool addPointAttributes ()
 
virtual G4bool useSolids ()
 
virtual G4bool writeInvisibles ()
 
virtual G4String getVolumeName ()
 
virtual std::vector< G4StringgetHitNames ()
 
virtual G4String getScoringMeshName ()
 
virtual std::vector< G4StringgetHitScorerNames ()
 
virtual void list ()
 
virtual void getNoVoxels (G4int &nx, G4int &ny, G4int &nz) const
 
virtual G4bool getDrawVolumeGrid ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
G4bool operator== (const G4UImessenger &messenger) const
 

Additional Inherited Members

- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (G4String s)
 
G4double StoD (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
 
G4String baseDirName
 

Detailed Description

Definition at line 46 of file G4GMocrenMessenger.hh.

Constructor & Destructor Documentation

G4GMocrenMessenger::G4GMocrenMessenger ( )

Definition at line 41 of file G4GMocrenMessenger.cc.

References G4UIcommand::AvailableForStates(), G4State_Idle, G4UIcmdWithAString::SetDefaultValue(), G4UIcmdWithABool::SetDefaultValue(), G4UIparameter::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithAString::SetParameterName(), G4UIcmdWithABool::SetParameterName(), and G4UIparameter::SetParameterRange().

42  : suffix (""), geometry(true), solids(true), invisibles(true),
43  kgMocrenVolumeName("gMocrenVolume"),
44  kgMocrenScoringMeshName("gMocrenScoringMesh"),
45  kDrawVolumeGrid(false) {
46 
47  kgMocrenDirectory = new G4UIdirectory("/vis/gMocren/");
48  kgMocrenDirectory->SetGuidance("gMocren commands.");
49 
50  setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/gMocren/setEventNumberSuffix", this);
51  setEventNumberSuffixCommand->SetGuidance("Write separate event files, appended with given suffix.");
52  setEventNumberSuffixCommand->SetGuidance("Define the suffix with a pattern such as '-0000'.");
53  setEventNumberSuffixCommand->SetParameterName("suffix",false);
54  setEventNumberSuffixCommand->SetDefaultValue("");
55  setEventNumberSuffixCommand->AvailableForStates(G4State_Idle);
56 
57  appendGeometryCommand = new G4UIcmdWithABool("/vis/gMocren/appendGeometry", this);
58  appendGeometryCommand->SetGuidance("Appends copy of geometry to every event.");
59  appendGeometryCommand->SetParameterName("flag",false);
60  appendGeometryCommand->SetDefaultValue(true);
61  appendGeometryCommand->AvailableForStates(G4State_Idle);
62 
63  addPointAttributesCommand = new G4UIcmdWithABool("/vis/gMocren/addPointAttributes", this);
64  addPointAttributesCommand->SetGuidance("Adds point attributes to the points of trajectories.");
65  addPointAttributesCommand->SetParameterName("flag",false);
66  addPointAttributesCommand->SetDefaultValue(false);
67  addPointAttributesCommand->AvailableForStates(G4State_Idle);
68 
69  useSolidsCommand = new G4UIcmdWithABool("/vis/gMocren/useSolids", this);
70  useSolidsCommand->SetGuidance("Use GMocren Solids, rather than Geant4 Primitives.");
71  useSolidsCommand->SetParameterName("flag",false);
72  useSolidsCommand->SetDefaultValue(true);
73  useSolidsCommand->AvailableForStates(G4State_Idle);
74 
75  /* Not Enabled Yet
76  writeInvisiblesCommand = new G4UIcmdWithABool("/vis/gMocren/writeInvisibles", this);
77  writeInvisiblesCommand->SetGuidance("Write invisible objects.");
78  writeInvisiblesCommand->SetParameterName("flag",false);
79  writeInvisiblesCommand->SetDefaultValue(true);
80  writeInvisiblesCommand->AvailableForStates(G4State_Idle);
81  */
82 
83  kSetgMocrenVolumeNameCommand = new G4UIcmdWithAString("/vis/gMocren/setVolumeName", this);
84  kSetgMocrenVolumeNameCommand->SetGuidance("detector name for a volume data in gMocren data.");
85  kSetgMocrenVolumeNameCommand->SetParameterName("kgMocrenVolumeName",false);
86  kSetgMocrenVolumeNameCommand->SetDefaultValue("gMocrenVolume");
87  kSetgMocrenVolumeNameCommand->AvailableForStates(G4State_Idle);
88 
89  kAddgMocrenHitNameCommand = new G4UIcmdWithAString("/vis/gMocren/addHitName", this);
90  kAddgMocrenHitNameCommand->SetGuidance("hit name for a dose distribution in gMocren data.");
91  kAddgMocrenHitNameCommand->SetParameterName("kgMocrenHitName",false);
92  kAddgMocrenHitNameCommand->AvailableForStates(G4State_Idle);
93 
94  kResetgMocrenHitNameCommand = new G4UIcmdWithoutParameter("/vis/gMocren/resetHitNames", this);
95  kResetgMocrenHitNameCommand->SetGuidance("reset all hit names.");
96  kResetgMocrenHitNameCommand->AvailableForStates(G4State_Idle);
97 
98  kSetgMocrenScoringMeshNameCommand = new G4UIcmdWithAString("/vis/gMocren/setScoringMeshName", this);
99  kSetgMocrenScoringMeshNameCommand->SetGuidance("scoring mesh name for a dose distribution in gMocren data.");
100  kSetgMocrenScoringMeshNameCommand->SetParameterName("kgMocrenScoringMeshName",false);
101  kSetgMocrenScoringMeshNameCommand->SetDefaultValue("gMocrenScoringMesh");
102  kSetgMocrenScoringMeshNameCommand->AvailableForStates(G4State_Idle);
103 
104  kAddgMocrenHitScorerNameCommand = new G4UIcmdWithAString("/vis/gMocren/addHitScorerName", this);
105  kAddgMocrenHitScorerNameCommand->SetGuidance("hit scorer name for a dose distribution in gMocren data.");
106  kAddgMocrenHitScorerNameCommand->SetParameterName("kgMocrenHitScorerNames",false);
107  kAddgMocrenHitScorerNameCommand->AvailableForStates(G4State_Idle);
108 
109  kResetgMocrenHitScorerNameCommand = new G4UIcmdWithoutParameter("/vis/gMocren/resetHitScorerName", this);
110  kResetgMocrenHitScorerNameCommand->SetGuidance("reset all hit scorer names.");
111  kResetgMocrenHitScorerNameCommand->AvailableForStates(G4State_Idle);
112 
113  kSetgMocrenNoVoxelsCommand = new G4UIcommand("/vis/gMocren/setNumberOfVoxels", this);
114  kSetgMocrenNoVoxelsCommand->SetGuidance("set number of voxels.");
115  kSetgMocrenNoVoxelsCommand->AvailableForStates(G4State_Idle);
116  G4UIparameter * param = new G4UIparameter("nX", 'i', false);
117  param->SetDefaultValue("1");
118  param->SetParameterRange("nX>0");
119  kSetgMocrenNoVoxelsCommand->SetParameter(param);
120  param = new G4UIparameter("nY", 'i', false);
121  param->SetDefaultValue("1");
122  param->SetParameterRange("nY>0");
123  kSetgMocrenNoVoxelsCommand->SetParameter(param);
124  param = new G4UIparameter("nZ", 'i', false);
125  param->SetDefaultValue("1");
126  param->SetParameterRange("nZ>0");
127  kSetgMocrenNoVoxelsCommand->SetParameter(param);
128 
129  kListgMocrenCommand = new G4UIcmdWithoutParameter("/vis/gMocren/list", this);
130  kListgMocrenCommand->SetGuidance("list gMocren command parameters.");
131  kListgMocrenCommand->AvailableForStates(G4State_Idle);
132 
133  kDrawVolumeGridCommand = new G4UIcmdWithABool("/vis/gMocren/drawVolumeGrid", this);
134  kDrawVolumeGridCommand->SetGuidance("Add grid of the volume.");
135  kDrawVolumeGridCommand->SetParameterName("kDrawVolumeGrid",false);
136  kDrawVolumeGridCommand->SetDefaultValue(false);
137  kDrawVolumeGridCommand->AvailableForStates(G4State_Idle);
138 
139 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetParameterRange(const char *theRange)
void SetDefaultValue(const char *theDefaultValue)
void SetDefaultValue(G4bool defVal)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
void SetDefaultValue(const char *defVal)
G4GMocrenMessenger::~G4GMocrenMessenger ( )
virtual

Definition at line 141 of file G4GMocrenMessenger.cc.

141  {
142  delete setEventNumberSuffixCommand;
143  delete appendGeometryCommand;
144  delete addPointAttributesCommand;
145  delete useSolidsCommand;
146  // delete writeInvisiblesCommand;
147  delete kSetgMocrenVolumeNameCommand;
148  delete kAddgMocrenHitNameCommand;
149  delete kResetgMocrenHitNameCommand;
150  //
151  delete kSetgMocrenScoringMeshNameCommand;
152  delete kAddgMocrenHitScorerNameCommand;
153  delete kResetgMocrenHitScorerNameCommand;
154  //
155  delete kSetgMocrenNoVoxelsCommand;
156  //
157  delete kgMocrenDirectory;
158  //
159  delete kDrawVolumeGridCommand;
160 }

Member Function Documentation

G4bool G4GMocrenMessenger::addPointAttributes ( )
virtual

Definition at line 243 of file G4GMocrenMessenger.cc.

243  {
244  return pointAttributes;
245 }
G4bool G4GMocrenMessenger::appendGeometry ( )
virtual

Definition at line 239 of file G4GMocrenMessenger.cc.

239  {
240  return geometry;
241 }
G4String G4GMocrenMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 162 of file G4GMocrenMessenger.cc.

References G4UIcommand::ConvertToString().

162  {
163  if (command==setEventNumberSuffixCommand) {
164  return suffix;
165  } else if (command==appendGeometryCommand) {
166  return appendGeometryCommand->ConvertToString(geometry);
167  } else if (command==addPointAttributesCommand) {
168  return addPointAttributesCommand->ConvertToString(pointAttributes);
169  } else if (command==useSolidsCommand) {
170  return useSolidsCommand->ConvertToString(solids);
171  // } else if (command==writeInvisiblesCommand) {
172  // return writeInvisiblesCommand->ConvertToString(invisibles);
173  } else if (command == kSetgMocrenVolumeNameCommand) {
174  return kgMocrenVolumeName;
175  } else if (command == kAddgMocrenHitNameCommand) {
176  G4String strval;
177  std::vector<G4String>::iterator itr = kgMocrenHitNames.begin();
178  for(; itr != kgMocrenHitNames.end(); itr++) {
179  strval += *itr;
180  strval += " ";
181  }
182  return strval;
183  } else if (command == kSetgMocrenScoringMeshNameCommand) {
184  return kgMocrenScoringMeshName;
185  } else if (command == kAddgMocrenHitScorerNameCommand) {
186  G4String strval;
187  std::vector<G4String>::iterator itr = kgMocrenHitScorerNames.begin();
188  for(; itr != kgMocrenHitScorerNames.end(); itr++) {
189  strval += *itr;
190  strval += " ";
191  }
192  return strval;
193  } else if (command==kDrawVolumeGridCommand) {
194  return kDrawVolumeGridCommand->ConvertToString(kDrawVolumeGrid);
195  } else {
196  return "";
197  }
198 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
virtual G4bool G4GMocrenMessenger::getDrawVolumeGrid ( )
inlinevirtual

Definition at line 66 of file G4GMocrenMessenger.hh.

Referenced by G4GMocrenFileSceneHandler::AddSolid().

66 {return kDrawVolumeGrid;}
G4String G4GMocrenMessenger::getEventNumberSuffix ( )
virtual

Definition at line 235 of file G4GMocrenMessenger.cc.

235  {
236  return suffix;
237 }
std::vector< G4String > G4GMocrenMessenger::getHitNames ( )
virtual

Definition at line 259 of file G4GMocrenMessenger.cc.

Referenced by G4GMocrenFileSceneHandler::AddCompound().

259  {
260  return kgMocrenHitNames;
261 }
std::vector< G4String > G4GMocrenMessenger::getHitScorerNames ( )
virtual

Definition at line 267 of file G4GMocrenMessenger.cc.

Referenced by G4GMocrenFileSceneHandler::AddCompound().

267  {
268  return kgMocrenHitScorerNames;
269 }
void G4GMocrenMessenger::getNoVoxels ( G4int nx,
G4int ny,
G4int nz 
) const
virtual

Definition at line 298 of file G4GMocrenMessenger.cc.

298  {
299  nx = kgMocrenNoVoxels[0];
300  ny = kgMocrenNoVoxels[1];
301  nz = kgMocrenNoVoxels[2];
302 }
G4String G4GMocrenMessenger::getScoringMeshName ( )
virtual

Definition at line 263 of file G4GMocrenMessenger.cc.

263  {
264  return kgMocrenScoringMeshName;
265 }
G4String G4GMocrenMessenger::getVolumeName ( )
virtual

Definition at line 255 of file G4GMocrenMessenger.cc.

Referenced by G4GMocrenFileSceneHandler::AddSolid().

255  {
256  return kgMocrenVolumeName;
257 }
void G4GMocrenMessenger::list ( )
virtual

Definition at line 271 of file G4GMocrenMessenger.cc.

References G4cout, and G4endl.

Referenced by SetNewValue().

271  {
272  G4cout << " Current valuess of gMocren command parameters:" << G4endl;
273  //
274  G4cout << " volume name: " << kgMocrenVolumeName << G4endl;
275  //
276  G4cout << " hit names: ";
277  if(kgMocrenHitNames.size() > 0) {
278  std::vector<G4String>::iterator itr = kgMocrenHitNames.begin();
279  for(; itr != kgMocrenHitNames.end(); itr++)
280  G4cout << *itr << " " << G4endl;
281  } else {
282  G4cout << G4endl;
283  }
284  //
285  G4cout << " scoring mesh name: " << kgMocrenScoringMeshName << G4endl;
286  //
287  G4cout << " scorer names: ";
288  if(kgMocrenHitScorerNames.size() > 0) {
289  std::vector<G4String>::iterator itr = kgMocrenHitScorerNames.begin();
290  for(; itr != kgMocrenHitScorerNames.end(); itr++)
291  G4cout << *itr << " " << G4endl;
292  } else {
293  G4cout << G4endl;
294  }
295  G4cout << G4endl;
296 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
void G4GMocrenMessenger::SetNewValue ( G4UIcommand command,
G4String  newValue 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 200 of file G4GMocrenMessenger.cc.

References G4UIcmdWithABool::GetNewBoolValue(), list(), and G4UImessenger::StoI().

200  {
201  if (command==setEventNumberSuffixCommand) {
202  suffix = newValue;
203  } else if (command==appendGeometryCommand) {
204  geometry = appendGeometryCommand->GetNewBoolValue(newValue);
205  } else if (command==addPointAttributesCommand) {
206  pointAttributes = addPointAttributesCommand->GetNewBoolValue(newValue);
207  } else if (command==useSolidsCommand) {
208  solids = useSolidsCommand->GetNewBoolValue(newValue);
209  // } else if (command==writeInvisiblesCommand) {
210  // invisibles = writeInvisiblesCommand->GetNewBoolValue(newValue);
211  } else if (command == kSetgMocrenVolumeNameCommand) {
212  kgMocrenVolumeName = newValue;
213  } else if (command == kAddgMocrenHitNameCommand) {
214  kgMocrenHitNames.push_back(newValue);
215  } else if (command == kResetgMocrenHitNameCommand) {
216  kgMocrenHitNames.clear();
217  } else if (command == kSetgMocrenScoringMeshNameCommand) {
218  kgMocrenScoringMeshName = newValue;
219  } else if (command == kAddgMocrenHitScorerNameCommand) {
220  kgMocrenHitScorerNames.push_back(newValue);
221  } else if (command == kResetgMocrenHitScorerNameCommand) {
222  kgMocrenHitScorerNames.clear();
223  } else if (command == kListgMocrenCommand) {
224  list();
225  } else if (command == kSetgMocrenNoVoxelsCommand) {
226  G4Tokenizer next(newValue);
227  for(int i = 0; i < 3; i++) {
228  kgMocrenNoVoxels[i] = StoI(next());
229  }
230  } else if (command==kDrawVolumeGridCommand) {
231  kDrawVolumeGrid = kDrawVolumeGridCommand->GetNewBoolValue(newValue);
232  }
233 }
static G4bool GetNewBoolValue(const char *paramString)
G4int StoI(G4String s)
G4bool G4GMocrenMessenger::useSolids ( )
virtual

Definition at line 247 of file G4GMocrenMessenger.cc.

247  {
248  return solids;
249 }
G4bool G4GMocrenMessenger::writeInvisibles ( )
virtual

Definition at line 251 of file G4GMocrenMessenger.cc.

251  {
252  return invisibles;
253 }

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