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

#include <G4ScoringMessenger.hh>

Inheritance diagram for G4ScoringMessenger:
G4UImessenger

Public Member Functions

 G4ScoringMessenger (G4ScoringManager *SManager)
 
 ~G4ScoringMessenger ()
 
void SetNewValue (G4UIcommand *command, G4String newValues)
 
G4String GetCurrentValue (G4UIcommand *command)
 
- 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
 

Protected Member Functions

void FillTokenVec (G4String newValues, G4TokenVec &token)
 
void MeshBinCommand (G4VScoringMesh *mesh, G4TokenVec &token)
 
- 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)
 

Additional Inherited Members

- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir
 
G4String baseDirName
 

Detailed Description

Definition at line 63 of file G4ScoringMessenger.hh.

Constructor & Destructor Documentation

G4ScoringMessenger::G4ScoringMessenger ( G4ScoringManager SManager)

Definition at line 49 of file G4ScoringMessenger.cc.

References G4UIcmdWithADoubleAndUnit::SetDefaultUnit(), G4UIcmdWith3VectorAndUnit::SetDefaultUnit(), G4UIcmdWithAString::SetDefaultValue(), G4UIparameter::SetDefaultValue(), G4UIcommand::SetGuidance(), G4UIcommand::SetParameter(), G4UIcmdWithAString::SetParameterName(), G4UIcmdWithADoubleAndUnit::SetParameterName(), G4UIcmdWith3VectorAndUnit::SetParameterName(), G4UIparameter::SetParameterRange(), and G4UIcommand::SetRange().

50 :fSMan(SManager)
51 {
52  G4UIparameter* param;
53 
54  scoreDir = new G4UIdirectory("/score/");
55  scoreDir->SetGuidance("Interactive scoring commands.");
56 
57  listCmd = new G4UIcmdWithoutParameter("/score/list",this);
58  listCmd->SetGuidance("List scoring worlds.");
59 
60  dumpCmd = new G4UIcmdWithoutParameter("/score/dump",this);
61  dumpCmd->SetGuidance("Dump results of scorers.");
62 
63  verboseCmd = new G4UIcmdWithAnInteger("/score/verbose",this);
64  verboseCmd->SetGuidance("Verbosity.");
65  verboseCmd->SetGuidance(" 0) errors or warnings,");
66  verboseCmd->SetGuidance(" 1) information with 0)");
67 
68  meshDir = new G4UIdirectory("/score/mesh/");
69  meshDir->SetGuidance(" Mesh processing commands.");
70 
71  meshCreateDir = new G4UIdirectory("/score/create/");
72  meshCreateDir->SetGuidance(" Mesh creation commands.");
73  //
74  // Mesh commands
75  meshBoxCreateCmd = new G4UIcmdWithAString("/score/create/boxMesh",this);
76  meshBoxCreateCmd->SetGuidance("Create scoring box mesh.");
77  meshBoxCreateCmd->SetParameterName("MeshName",false);
78  //
79  meshCylinderCreateCmd = new G4UIcmdWithAString("/score/create/cylinderMesh",this);
80  meshCylinderCreateCmd->SetGuidance("Create scoring mesh.");
81  meshCylinderCreateCmd->SetParameterName("MeshName",false);
82  //
83 // meshSphereCreateCmd = new G4UIcmdWithAString("/score/create/sphereMesh",this);
84 // meshSphereCreateCmd->SetGuidance("Create scoring mesh.");
85 // meshSphereCreateCmd->SetParameterName("MeshName",false);
86  //
87  meshOpnCmd = new G4UIcmdWithAString("/score/open",this);
88  meshOpnCmd->SetGuidance("Open scoring mesh.");
89  meshOpnCmd->SetParameterName("MeshName",false);
90  //
91  meshClsCmd = new G4UIcmdWithoutParameter("/score/close",this);
92  meshClsCmd->SetGuidance("Close scoring mesh.");
93  //
94 // meshActCmd = new G4UIcmdWithABool("/score/mesh/activate",this);
95 // meshActCmd->SetGuidance("Activate scoring mesh.");
96 // meshActCmd->SetParameterName("MeshName",false);
97  //
98  mBoxSizeCmd = new G4UIcmdWith3VectorAndUnit("/score/mesh/boxSize",this);
99  mBoxSizeCmd->SetGuidance("Define size of the scoring mesh.");
100  mBoxSizeCmd->SetGuidance("Dx Dy Dz unit");
101  mBoxSizeCmd->SetParameterName("Di","Dj","Dk",false,false);
102  mBoxSizeCmd->SetRange("Di>0. && Dj>0. && Dk>0.");
103  mBoxSizeCmd->SetDefaultUnit("mm");
104  //
105  mCylinderSizeCmd = new G4UIcommand("/score/mesh/cylinderSize",this);
106  mCylinderSizeCmd->SetGuidance("Define size of the scoring mesh.");
107  mCylinderSizeCmd->SetGuidance("R Dz unit");
108  param = new G4UIparameter("R",'d',false);
109  param->SetParameterRange("R>0");
110  mCylinderSizeCmd->SetParameter(param);
111  param = new G4UIparameter("Dz",'d',false);
112  param->SetParameterRange("Dz>0");
113  mCylinderSizeCmd->SetParameter(param);
114  param = new G4UIparameter("unit",'s',true);
115  param->SetDefaultValue("mm");
116  mCylinderSizeCmd->SetParameter(param);
117  //
118  // Division command
119  mBinCmd = new G4UIcommand("/score/mesh/nBin",this);
120  mBinCmd->SetGuidance("Define segments of the scoring mesh.");
121  mBinCmd->SetGuidance("[usage] /score/mesh/nBin");
122  mBinCmd->SetGuidance(" In case of boxMesh, parameters are given in");
123  mBinCmd->SetGuidance(" Ni :(int) Number of bins i (in x-axis) ");
124  mBinCmd->SetGuidance(" Nj :(int) Number of bins j (in y-axis) ");
125  mBinCmd->SetGuidance(" Nk :(int) Number of bins k (in z-axis) ");
126  mBinCmd->SetGuidance(" In case of cylinderMesh, parameters are given in");
127  mBinCmd->SetGuidance(" Nr :(int) Number of bins in radial axis ");
128  mBinCmd->SetGuidance(" Nz :(int) Number of bins in z axis ");
129  mBinCmd->SetGuidance(" Nphi:(int) Number of bins in phi axis ");
130  //mBinCmd->SetGuidance(" Axis:(int) Axis of division ");
131 // mBinCmd->SetGuidance(" P1..Pn-1 :(double) \"paramter from P1 to Pn-1 for division.\"");
132  param = new G4UIparameter("Ni",'i',false);
133  param->SetDefaultValue("1");
134  param->SetParameterRange("Ni>0");
135  mBinCmd->SetParameter(param);
136  param = new G4UIparameter("Nj",'i',false);
137  param->SetDefaultValue("1");
138  param->SetParameterRange("Nj>0");
139  mBinCmd->SetParameter(param);
140  param = new G4UIparameter("Nk",'i',false);
141  param->SetDefaultValue("1");
142  mBinCmd->SetParameter(param);
143  param->SetParameterRange("Nk>0");
144  //param = new G4UIparameter("Axis",'i',true);
145  //param->SetDefaultValue("3");
146  //mBinCmd->SetParameter(param);
147  //
148  // Placement command
149  mTransDir = new G4UIdirectory("/score/mesh/translate/");
150  mTransDir->SetGuidance("Mesh translation commands.");
151  //
152  mTResetCmd = new G4UIcmdWithoutParameter("/score/mesh/translate/reset",this);
153  mTResetCmd->SetGuidance("Reset translated position of the scoring mesh.");
154  //
155  mTXyzCmd = new G4UIcmdWith3VectorAndUnit("/score/mesh/translate/xyz",this);
156  mTXyzCmd->SetGuidance("Translate the scoring mesh.");
157  mTXyzCmd->SetParameterName("X","Y","Z",false,false);
158  mTXyzCmd->SetDefaultUnit("mm");
159  //
160  mRotDir = new G4UIdirectory("/score/mesh/rotate/");
161  mRotDir->SetGuidance("Mesh rotation commands.");
162  //
163  mRResetCmd = new G4UIcmdWithoutParameter("/score/mesh/rotate/reset",this);
164  mRResetCmd->SetGuidance("Reset rotation angles of the scoring mesh.");
165  //
166  mRotXCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateX",this);
167  mRotXCmd->SetGuidance("Rotate the scoring mesh in X axis.");
168  mRotXCmd->SetParameterName("Rx",false);
169  mRotXCmd->SetDefaultUnit("deg");
170  //
171  mRotYCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateY",this);
172  mRotYCmd->SetGuidance("Rotate the scoring mesh in Y axis.");
173  mRotYCmd->SetParameterName("Ry",false);
174  mRotYCmd->SetDefaultUnit("deg");
175  //
176  mRotZCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateZ",this);
177  mRotZCmd->SetGuidance("Rotate the scoring mesh in Z axis.");
178  mRotZCmd->SetParameterName("Rz",false);
179  mRotZCmd->SetDefaultUnit("deg");
180  //
181 
182  // Draw Scoring result
183  drawCmd = new G4UIcommand("/score/drawProjection",this);
184  drawCmd->SetGuidance("Draw projection(s) of scored quantities.");
185  drawCmd->SetGuidance("Parameter <proj> specified which projection(s) to be drawn.");
186  drawCmd->SetGuidance(" 100 : xy-plane, 010 : yz-plane, 001 : zx-plane -- default 111");
187  drawCmd->SetGuidance(" 100 : N/A, 010 : z_phi-plane, 001 : r_phi-plane -- default 111");
188  param = new G4UIparameter("meshName",'s',false);
189  drawCmd->SetParameter(param);
190  param = new G4UIparameter("psName",'s',false);
191  drawCmd->SetParameter(param);
192  param = new G4UIparameter("colorMapName",'s',true);
193  param->SetDefaultValue("defaultLinearColorMap");
194  drawCmd->SetParameter(param);
195  param = new G4UIparameter("proj",'i',true);
196  param->SetDefaultValue(111);
197  drawCmd->SetParameter(param);
198 
199  // Draw column
200  drawColumnCmd = new G4UIcommand("/score/drawColumn",this);
201  drawColumnCmd->SetGuidance("Draw a cell column.");
202  drawColumnCmd->SetGuidance(" plane = 0 : x-y, 1: y-z, 2: z-x for box mesh");
203  drawColumnCmd->SetGuidance(" 0 : z-phi, 1: r-phi, 2: r-z for cylinder mesh");
204  param = new G4UIparameter("meshName",'s',false);
205  drawColumnCmd->SetParameter(param);
206  param = new G4UIparameter("psName",'s',false);
207  drawColumnCmd->SetParameter(param);
208  param = new G4UIparameter("plane",'i',false);
209  param->SetParameterRange("plane>=0 && plane<=2");
210  drawColumnCmd->SetParameter(param);
211  param = new G4UIparameter("column",'i',false);
212  drawColumnCmd->SetParameter(param);
213  param = new G4UIparameter("colorMapName",'s',true);
214  param->SetDefaultValue("defaultLinearColorMap");
215  drawColumnCmd->SetParameter(param);
216 
217  colorMapDir = new G4UIdirectory("/score/colorMap/");
218  colorMapDir->SetGuidance("Color map commands.");
219 
220  listColorMapCmd = new G4UIcmdWithoutParameter("/score/colorMap/listScoreColorMaps",this);
221  listColorMapCmd->SetGuidance("List registered score color maps.");
222 
223  floatMinMaxCmd = new G4UIcmdWithAString("/score/colorMap/floatMinMax",this);
224  floatMinMaxCmd->SetGuidance("Min/Max of the color map is calculated accorging to the actual scores.");
225  floatMinMaxCmd->SetParameterName("colorMapName",true,false);
226  floatMinMaxCmd->SetDefaultValue("defaultLinearColorMap");
227 
228  colorMapMinMaxCmd = new G4UIcommand("/score/colorMap/setMinMax",this);
229  colorMapMinMaxCmd->SetGuidance("Define min/max value of the color map.");
230  param = new G4UIparameter("colorMapMame",'s',true);
231  param->SetDefaultValue("defaultLinearColorMap");
232  colorMapMinMaxCmd->SetParameter(param);
233  param = new G4UIparameter("minValue",'d',false);
234  colorMapMinMaxCmd->SetParameter(param);
235  param = new G4UIparameter("maxValue",'d',false);
236  colorMapMinMaxCmd->SetParameter(param);
237 
238  /*
239  chartCmd = new G4UIcommand("/score/drawChart",this);
240  chartCmd->SetGuidance("Draw color chart on the screen.");
241  chartCmd->SetGuidance("[usage] /score/drawChart");
242  chartCmd->SetGuidance(" mesh :(String) Mesh name.");
243  chartCmd->SetGuidance(" psname :(String) PS name.");
244  chartCmd->SetGuidance(" On/Off :(boolean) On or Off the color chart.");
245  chartCmd->SetGuidance(" scale :(String) default=linear, or log ");
246  param = new G4UIparameter("meshName",'s',false);
247  chartCmd->SetParameter(param);
248  param = new G4UIparameter("psName",'s',false);
249  chartCmd->SetParameter(param);
250  param = new G4UIparameter("On",'s',true);
251  param->SetDefaultValue("true");
252  chartCmd->SetParameter(param);
253  param = new G4UIparameter("scale",'s',true);
254  param->SetDefaultValue("linear");
255  chartCmd->SetParameter(param);
256  */
257 
258  // Dump a scored quantity
259  dumpQtyToFileCmd = new G4UIcommand("/score/dumpQuantityToFile", this);
260  dumpQtyToFileCmd->SetGuidance("Dump one scored quantity to file.");
261  param = new G4UIparameter("meshName", 's', false);
262  dumpQtyToFileCmd->SetParameter(param);
263  param = new G4UIparameter("psName", 's', false);
264  dumpQtyToFileCmd->SetParameter(param);
265  param = new G4UIparameter("fileName", 's', false);
266  dumpQtyToFileCmd->SetParameter(param);
267  param = new G4UIparameter("option", 's', true);
268  dumpQtyToFileCmd->SetParameter(param);
269 
270  // Dump all scored quantities
271  dumpAllQtsToFileCmd = new G4UIcommand("/score/dumpAllQuantitiesToFile", this);
272  dumpAllQtsToFileCmd->SetGuidance("Dump all quantities of the mesh to file.");
273  param = new G4UIparameter("meshName", 's', false);
274  dumpAllQtsToFileCmd->SetParameter(param);
275  param = new G4UIparameter("fileName", 's', false);
276  dumpAllQtsToFileCmd->SetParameter(param);
277  param = new G4UIparameter("option", 's', true);
278  dumpAllQtsToFileCmd->SetParameter(param);
279 
280 }
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 SetDefaultUnit(const char *defUnit)
void SetDefaultValue(const char *theDefaultValue)
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void SetDefaultValue(const char *defVal)
void SetDefaultUnit(const char *defUnit)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4ScoringMessenger::~G4ScoringMessenger ( )

Definition at line 282 of file G4ScoringMessenger.cc.

283 {
284  delete listCmd;
285  delete verboseCmd;
286  //
287  delete meshCreateDir;
288  delete meshBoxCreateCmd;
289  delete meshCylinderCreateCmd;
290 // delete meshSphereCreateCmd;
291  //
292  delete meshOpnCmd;
293  //
294  delete meshClsCmd;
295 // delete meshActCmd;
296  delete meshDir;
297  //
298  delete mBoxSizeCmd;
299  delete mCylinderSizeCmd;
300 // delete mSphereSizeCmd;
301  //
302  delete mBinCmd;
303  //
304  delete mTResetCmd;
305  delete mTXyzCmd;
306  delete mTransDir;
307  delete mRResetCmd;
308  delete mRotXCmd;
309  delete mRotYCmd;
310  delete mRotZCmd;
311  delete mRotDir;
312  //
313  //delete chartCmd;
314  delete dumpCmd;
315  delete drawCmd;
316  delete drawColumnCmd;
317  delete listColorMapCmd;
318  delete floatMinMaxCmd;
319  delete colorMapMinMaxCmd;
320  delete colorMapDir;
321  delete dumpQtyToFileCmd;
322  delete dumpAllQtsToFileCmd;
323  //
324  delete scoreDir;
325 }

Member Function Documentation

void G4ScoringMessenger::FillTokenVec ( G4String  newValues,
G4TokenVec token 
)
protected

Definition at line 531 of file G4ScoringMessenger.cc.

Referenced by SetNewValue().

531  {
532 
533  G4Tokenizer next(newValues);
534  G4String val;
535  while ( !(val = next()).isNull() ) {
536  token.push_back(val);
537  }
538 }
G4String G4ScoringMessenger::GetCurrentValue ( G4UIcommand command)
virtual

Reimplemented from G4UImessenger.

Definition at line 522 of file G4ScoringMessenger.cc.

References G4UIcommand::ConvertToString(), and G4ScoringManager::GetVerboseLevel().

523 {
524  G4String val;
525  if(command==verboseCmd)
526  { val = verboseCmd->ConvertToString(fSMan->GetVerboseLevel()); }
527 
528  return val;
529 }
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
G4int GetVerboseLevel() const
void G4ScoringMessenger::MeshBinCommand ( G4VScoringMesh mesh,
G4TokenVec token 
)
protected

Definition at line 541 of file G4ScoringMessenger.cc.

References FatalException, G4cout, G4endl, G4Exception(), G4VScoringMesh::SetNumberOfSegments(), and G4UImessenger::StoI().

Referenced by SetNewValue().

541  {
542  G4int Ni = StoI(token[0]);
543  G4int Nj = StoI(token[1]);
544  G4int Nk = StoI(token[2]);
545  G4int nSegment[3];
546 
547  if(dynamic_cast<G4ScoringBox*>(mesh)) {
548  G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringBox" << G4endl;
549  nSegment[0] = Ni;
550  nSegment[1] = Nj;
551  nSegment[2] = Nk;
552  } else if(dynamic_cast<G4ScoringCylinder*>(mesh)) {
553  G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringCylinder" << G4endl;
554  nSegment[0] = Nj;
555  nSegment[1] = Nk;
556  nSegment[2] = Ni;
557  } else {
558  G4Exception("G4ScoringMessenger::MeshBinCommand()", "001", FatalException, "invalid mesh type");
559  return;
560  }
561  //
562  mesh->SetNumberOfSegments(nSegment);
563 }
int G4int
Definition: G4Types.hh:78
G4GLOB_DLL std::ostream G4cout
G4int StoI(G4String s)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
#define G4endl
Definition: G4ios.hh:61
void SetNumberOfSegments(G4int nSegment[3])
void G4ScoringMessenger::SetNewValue ( G4UIcommand command,
G4String  newValues 
)
virtual

Reimplemented from G4UImessenger.

Definition at line 327 of file G4ScoringMessenger.cc.

References boxMesh, G4ScoringManager::CloseCurrentMesh(), cylinderMesh, G4ScoringManager::DrawMesh(), G4ScoringManager::Dump(), G4ScoringManager::DumpAllQuantitiesToFile(), G4ScoringManager::DumpQuantityToFile(), FillTokenVec(), G4ScoringManager::FindMesh(), G4cerr, G4endl, G4UIcommand::GetCommandPath(), G4ScoringManager::GetCurrentMesh(), G4UIcmdWith3VectorAndUnit::GetNew3VectorValue(), G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(), G4UIcmdWithAnInteger::GetNewIntValue(), G4ScoringManager::GetScoreColorMap(), G4VScoringMesh::GetShape(), G4VScoringMesh::GetWorldName(), G4ScoringManager::List(), G4ScoringManager::ListScoreColorMaps(), MeshBinCommand(), G4ScoringManager::RegisterScoringMesh(), G4VScoringMesh::RotateX(), G4VScoringMesh::RotateY(), G4VScoringMesh::RotateZ(), G4VScoringMesh::SetCenterPosition(), G4ScoringManager::SetCurrentMesh(), G4VScoreColorMap::SetFloatingMinMax(), G4VScoreColorMap::SetMinMax(), G4VScoringMesh::SetSize(), G4ScoringManager::SetVerboseLevel(), G4UImessenger::StoD(), G4UImessenger::StoI(), G4UIcommand::ValueOf(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

328 {
329  if(command==listCmd) {
330  fSMan->List();
331  } else if(command==dumpCmd) {
332  fSMan->Dump();
333  } else if(command==drawCmd) {
334  G4Tokenizer next(newVal);
335  G4String meshName = next();
336  G4String psName = next();
337  G4String colorMapName = next();
338  G4int axflg = StoI(next());
339  fSMan->DrawMesh(meshName,psName,colorMapName,axflg);
340  } else if(command==drawColumnCmd) {
341  G4Tokenizer next(newVal);
342  G4String meshName = next();
343  G4String psName = next();
344  G4int iPlane = StoI(next());
345  G4int iColumn = StoI(next());
346  G4String colorMapName = next();
347  fSMan->DrawMesh(meshName,psName,iPlane,iColumn,colorMapName);
348 // } else if(command==chartCmd ){
349 // G4Tokenizer next(newVal);
350 // G4String meshName = next();
351 // G4String psName = next();
352 // //G4bool onFlag = StoB(next());
353 // G4String scaleOption = next();
354 // fSMan->DrawChart(meshName,psName,onFlag,scaleOption);
355 
356  } else if(command==dumpQtyToFileCmd) {
357  G4Tokenizer next(newVal);
358  G4String meshName = next();
359  G4String psName = next();
360  G4String fileName = next();
361  G4String option = next("\n");
362  fSMan->DumpQuantityToFile(meshName, psName, fileName, option);
363  } else if(command==dumpAllQtsToFileCmd) {
364  G4Tokenizer next(newVal);
365  G4String meshName = next();
366  G4String fileName = next();
367  G4String option = next("\n");
368  fSMan->DumpAllQuantitiesToFile(meshName, fileName, option);
369  } else if(command==verboseCmd) {
370  fSMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal));
371  } else if(command==meshBoxCreateCmd) {
372  G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
373  if ( currentmesh ){
374  G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
375  << "] : Mesh <" << currentmesh->GetWorldName()
376  << "> is still open. Close it first. Command ignored." << G4endl;
377  } else {
378 
379  G4VScoringMesh* mesh = fSMan->FindMesh(newVal);
380  if ( !mesh ){
381  mesh = new G4ScoringBox(newVal);
382  fSMan->RegisterScoringMesh(mesh);
383  }else{
384  G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
385  << "] : Scoring mesh <" << newVal
386  << "> already exists. Command ignored." << G4endl;
387  }
388  }
389  } else if(command==meshCylinderCreateCmd) {
390  G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
391  if ( currentmesh ){
392  G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
393  << "] : Mesh <" << currentmesh->GetWorldName()
394  << "> is still open. Close it first. Command ignored." << G4endl;
395  } else {
396 
397  G4VScoringMesh* mesh = fSMan->FindMesh(newVal);
398  if ( !mesh ){
399  mesh = new G4ScoringCylinder(newVal);
400  fSMan->RegisterScoringMesh(mesh);
401  }else{
402  G4cerr << "ERROR[" << meshCylinderCreateCmd->GetCommandPath()
403  << "] : Scoring mesh <" << newVal
404  << "> already exists. Command ignored." << G4endl;
405  }
406  }
407  } else if(command==listColorMapCmd) {
408  fSMan->ListScoreColorMaps();
409  } else if(command==floatMinMaxCmd) {
410  G4VScoreColorMap* colorMap = fSMan->GetScoreColorMap(newVal);
411  if(colorMap)
412  { colorMap->SetFloatingMinMax(true); }
413  else
414  { G4cerr << "ERROR[" << floatMinMaxCmd->GetCommandPath()
415  << "] : color map <" << newVal << "> is not defined. Command ignored."
416  << G4endl;
417  }
418  } else if(command==colorMapMinMaxCmd) {
419  G4Tokenizer next(newVal);
420  G4String mapName = next();
421  G4double minVal = StoD(next());
422  G4double maxVal = StoD(next());
423  G4VScoreColorMap* colorMap = fSMan->GetScoreColorMap(mapName);
424  if(colorMap)
425  { colorMap->SetFloatingMinMax(false);
426  colorMap->SetMinMax(minVal,maxVal); }
427  else
428  { G4cerr << "ERROR[" << colorMapMinMaxCmd->GetCommandPath()
429  << "] : color map <" << newVal << "> is not defined. Command ignored."
430  << G4endl;
431  }
432  } else if(command==meshOpnCmd) {
433  G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
434  if ( currentmesh ){
435  G4cerr << "ERROR[" << meshOpnCmd->GetCommandPath()
436  << "] : Mesh <" << currentmesh->GetWorldName() << "> is still open. Close it first. Command ignored." << G4endl;
437  } else {
438  G4VScoringMesh* mesh = fSMan->FindMesh(newVal);
439  if ( !mesh ){
440  G4cerr << "ERROR[" << meshOpnCmd->GetCommandPath()
441  << "] : Scoring mesh <" << newVal << "> does not exist. Command ignored." << G4endl;
442  } else {
443  fSMan->SetCurrentMesh(mesh);
444  }
445  }
446  } else if(command==meshClsCmd) {
447  fSMan->CloseCurrentMesh();
448  } else {
449  //
450  // Get Current Mesh
451  //
452  G4VScoringMesh* mesh = fSMan->GetCurrentMesh();
453  //
454  // Commands for Current Mesh
455  if ( mesh ){
456  // Tokens
457  G4TokenVec token;
458  FillTokenVec(newVal,token);
459  //
460  // Mesh Geometry
461  //
462 // if(command==meshActCmd) {
463 // mesh->Activate(meshActCmd->GetNewBoolValue(newVal));
464 // } else
465  if(command==mBoxSizeCmd) {
466  MeshShape shape = mesh->GetShape();
467  if ( shape == boxMesh ){
468  G4ThreeVector size = mBoxSizeCmd->GetNew3VectorValue(newVal);
469  G4double vsize[3];
470  vsize[0] = size.x();
471  vsize[1] = size.y();
472  vsize[2] = size.z();
473  mesh->SetSize(vsize);
474  } else {
475  G4cerr << "ERROR[" << mBoxSizeCmd->GetCommandPath()
476  << "] : This mesh is not Box. Command ignored." << G4endl;
477  }
478  }else if(command==mCylinderSizeCmd) {
479  MeshShape shape = mesh->GetShape();
480  if ( shape == cylinderMesh ){
481  G4double vsize[3];
482  vsize[0] = StoD(token[0]);
483  vsize[1] = StoD(token[1]);
484  G4double unt = mCylinderSizeCmd->ValueOf(token[2]);
485  vsize[0] *= unt;
486  vsize[1] *= unt;
487  vsize[2] = 0.0;
488  mesh->SetSize(vsize);
489  } else {
490  G4cerr << "ERROR[" << mBoxSizeCmd->GetCommandPath()
491  << "] : This mesh is not Box. Command ignored." << G4endl;
492  }
493  } else if(command==mBinCmd) {
494  MeshBinCommand(mesh,token);
495  } else if(command==mTResetCmd) {
496  G4double centerPosition[3] ={ 0., 0., 0.};
497  mesh->SetCenterPosition(centerPosition);
498  } else if(command==mTXyzCmd) {
499  G4ThreeVector xyz = mTXyzCmd->GetNew3VectorValue(newVal);
500  G4double centerPosition[3];
501  centerPosition[0] = xyz.x();
502  centerPosition[1] = xyz.y();
503  centerPosition[2] = xyz.z();
504  mesh->SetCenterPosition(centerPosition);
505  } else if(command==mRResetCmd) {
506  } else if(command==mRotXCmd) {
507  G4double value = mRotXCmd->GetNewDoubleValue(newVal);
508  mesh->RotateX(value);
509  } else if(command==mRotYCmd) {
510  G4double value = mRotYCmd->GetNewDoubleValue(newVal);
511  mesh->RotateY(value);
512  } else if(command==mRotZCmd) {
513  G4double value = mRotZCmd->GetNewDoubleValue(newVal);
514  mesh->RotateZ(value);
515  }
516  }else{
517  G4cerr << "ERROR: No mesh is currently open. Open/create a mesh first. Command ignored." << G4endl;
518  }
519  }
520 }
const G4String & GetWorldName() const
std::vector< G4String > G4TokenVec
void Dump() const
void RotateY(G4double delta)
double x() const
static G4int GetNewIntValue(const char *paramString)
void SetSize(G4double size[3])
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void RotateX(G4double delta)
void List() const
static G4double GetNewDoubleValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
double z() const
void DumpAllQuantitiesToFile(const G4String &meshName, const G4String &fileName, const G4String &option="")
void SetMinMax(G4double minVal, G4double maxVal)
MeshShape GetShape() const
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
G4VScoringMesh * FindMesh(const G4String &)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
G4int StoI(G4String s)
void RotateZ(G4double delta)
void DrawMesh(const G4String &meshName, const G4String &psName, const G4String &colorMapName, G4int axflg=111)
G4VScoringMesh * GetCurrentMesh() const
void SetCenterPosition(G4double centerPosition[3])
G4double StoD(G4String s)
void SetCurrentMesh(G4VScoringMesh *scm)
void DumpQuantityToFile(const G4String &meshName, const G4String &psName, const G4String &fileName, const G4String &option="")
static G4double ValueOf(const char *unitName)
Definition: G4UIcommand.cc:294
void MeshBinCommand(G4VScoringMesh *mesh, G4TokenVec &token)
double y() const
void SetFloatingMinMax(G4bool vl=true)
MeshShape
const XML_Char int const XML_Char * value
#define G4endl
Definition: G4ios.hh:61
void FillTokenVec(G4String newValues, G4TokenVec &token)
double G4double
Definition: G4Types.hh:76
void SetVerboseLevel(G4int vl)
void RegisterScoringMesh(G4VScoringMesh *scm)
G4GLOB_DLL std::ostream G4cerr

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