Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ScoringMessenger.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: G4ScoringMessenger.cc 78057 2013-12-03 08:31:15Z gcosmo $
28 //
29 // ---------------------------------------------------------------------
30 
31 #include "G4ScoringMessenger.hh"
32 #include "G4ScoringManager.hh"
33 #include "G4VScoringMesh.hh"
34 #include "G4ScoringBox.hh"
35 #include "G4ScoringCylinder.hh"
36 
37 #include "G4UIdirectory.hh"
39 #include "G4UIcmdWithAnInteger.hh"
40 #include "G4UIcmdWithAString.hh"
41 #include "G4UIcmdWithABool.hh"
44 #include "G4UIcommand.hh"
45 #include "G4Tokenizer.hh"
46 #include "G4UnitsTable.hh"
47 #include "G4VScoreColorMap.hh"
48 
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 }
281 
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 }
326 
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 }
521 
523 {
524  G4String val;
525  if(command==verboseCmd)
526  { val = verboseCmd->ConvertToString(fSMan->GetVerboseLevel()); }
527 
528  return val;
529 }
530 
532 
533  G4Tokenizer next(newValues);
534  G4String val;
535  while ( !(val = next()).isNull() ) {
536  token.push_back(val);
537  }
538 }
539 
540 
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 }
564 
565 
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
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 SetParameterRange(const char *theRange)
void SetDefaultUnit(const char *defUnit)
void SetSize(G4double size[3])
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetDefaultValue(const char *theDefaultValue)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:357
void RotateX(G4double delta)
void List() const
static G4double GetNewDoubleValue(const char *paramString)
int G4int
Definition: G4Types.hh:78
void SetParameterName(const char *theNameX, const char *theNameY, const char *theNameZ, G4bool omittable, G4bool currentAsDefault=false)
double z() const
void DumpAllQuantitiesToFile(const G4String &meshName, const G4String &fileName, const G4String &option="")
void SetMinMax(G4double minVal, G4double maxVal)
G4int GetVerboseLevel() const
G4GLOB_DLL std::ostream G4cout
MeshShape GetShape() const
void SetNewValue(G4UIcommand *command, G4String newValues)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
G4VScoreColorMap * GetScoreColorMap(const G4String &mapName)
G4VScoringMesh * FindMesh(const G4String &)
const G4String & GetCommandPath() const
Definition: G4UIcommand.hh:139
G4String GetCurrentValue(G4UIcommand *command)
G4int StoI(G4String s)
void RotateZ(G4double delta)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void DrawMesh(const G4String &meshName, const G4String &psName, const G4String &colorMapName, G4int axflg=111)
G4VScoringMesh * GetCurrentMesh() const
void SetCenterPosition(G4double centerPosition[3])
void SetDefaultValue(const char *defVal)
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 SetDefaultUnit(const char *defUnit)
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
G4ScoringMessenger(G4ScoringManager *SManager)
void SetVerboseLevel(G4int vl)
void RegisterScoringMesh(G4VScoringMesh *scm)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetNumberOfSegments(G4int nSegment[3])
G4GLOB_DLL std::ostream G4cerr