Geant4  10.03.p03
 All Classes 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 94951 2016-01-07 11:58:57Z 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  drawCmd->SetToBeBroadcasted(false);
199 
200  // Draw column
201  drawColumnCmd = new G4UIcommand("/score/drawColumn",this);
202  drawColumnCmd->SetGuidance("Draw a cell column.");
203  drawColumnCmd->SetGuidance(" plane = 0 : x-y, 1: y-z, 2: z-x for box mesh");
204  drawColumnCmd->SetGuidance(" 0 : z-phi, 1: r-phi, 2: r-z for cylinder mesh");
205  param = new G4UIparameter("meshName",'s',false);
206  drawColumnCmd->SetParameter(param);
207  param = new G4UIparameter("psName",'s',false);
208  drawColumnCmd->SetParameter(param);
209  param = new G4UIparameter("plane",'i',false);
210  param->SetParameterRange("plane>=0 && plane<=2");
211  drawColumnCmd->SetParameter(param);
212  param = new G4UIparameter("column",'i',false);
213  drawColumnCmd->SetParameter(param);
214  param = new G4UIparameter("colorMapName",'s',true);
215  param->SetDefaultValue("defaultLinearColorMap");
216  drawColumnCmd->SetParameter(param);
217  drawColumnCmd->SetToBeBroadcasted(false);
218 
219  colorMapDir = new G4UIdirectory("/score/colorMap/");
220  colorMapDir->SetGuidance("Color map commands.");
221 
222  listColorMapCmd = new G4UIcmdWithoutParameter("/score/colorMap/listScoreColorMaps",this);
223  listColorMapCmd->SetGuidance("List registered score color maps.");
224  listColorMapCmd->SetToBeBroadcasted(false);
225 
226  floatMinMaxCmd = new G4UIcmdWithAString("/score/colorMap/floatMinMax",this);
227  floatMinMaxCmd->SetGuidance("Min/Max of the color map is calculated accorging to the actual scores.");
228  floatMinMaxCmd->SetParameterName("colorMapName",true,false);
229  floatMinMaxCmd->SetDefaultValue("defaultLinearColorMap");
230  floatMinMaxCmd->SetToBeBroadcasted(false);
231 
232  colorMapMinMaxCmd = new G4UIcommand("/score/colorMap/setMinMax",this);
233  colorMapMinMaxCmd->SetGuidance("Define min/max value of the color map.");
234  param = new G4UIparameter("colorMapMame",'s',true);
235  param->SetDefaultValue("defaultLinearColorMap");
236  colorMapMinMaxCmd->SetParameter(param);
237  param = new G4UIparameter("minValue",'d',false);
238  colorMapMinMaxCmd->SetParameter(param);
239  param = new G4UIparameter("maxValue",'d',false);
240  colorMapMinMaxCmd->SetParameter(param);
241  colorMapMinMaxCmd->SetToBeBroadcasted(false);
242 
243  /*
244  chartCmd = new G4UIcommand("/score/drawChart",this);
245  chartCmd->SetGuidance("Draw color chart on the screen.");
246  chartCmd->SetGuidance("[usage] /score/drawChart");
247  chartCmd->SetGuidance(" mesh :(String) Mesh name.");
248  chartCmd->SetGuidance(" psname :(String) PS name.");
249  chartCmd->SetGuidance(" On/Off :(boolean) On or Off the color chart.");
250  chartCmd->SetGuidance(" scale :(String) default=linear, or log ");
251  param = new G4UIparameter("meshName",'s',false);
252  chartCmd->SetParameter(param);
253  param = new G4UIparameter("psName",'s',false);
254  chartCmd->SetParameter(param);
255  param = new G4UIparameter("On",'s',true);
256  param->SetDefaultValue("true");
257  chartCmd->SetParameter(param);
258  param = new G4UIparameter("scale",'s',true);
259  param->SetDefaultValue("linear");
260  chartCmd->SetParameter(param);
261  */
262 
263  // Dump a scored quantity
264  dumpQtyToFileCmd = new G4UIcommand("/score/dumpQuantityToFile", this);
265  dumpQtyToFileCmd->SetGuidance("Dump one scored quantity to file.");
266  param = new G4UIparameter("meshName", 's', false);
267  dumpQtyToFileCmd->SetParameter(param);
268  param = new G4UIparameter("psName", 's', false);
269  dumpQtyToFileCmd->SetParameter(param);
270  param = new G4UIparameter("fileName", 's', false);
271  dumpQtyToFileCmd->SetParameter(param);
272  param = new G4UIparameter("option", 's', true);
273  dumpQtyToFileCmd->SetParameter(param);
274  dumpQtyToFileCmd->SetToBeBroadcasted(false);
275 
276  // Dump all scored quantities
277  dumpAllQtsToFileCmd = new G4UIcommand("/score/dumpAllQuantitiesToFile", this);
278  dumpAllQtsToFileCmd->SetGuidance("Dump all quantities of the mesh to file.");
279  param = new G4UIparameter("meshName", 's', false);
280  dumpAllQtsToFileCmd->SetParameter(param);
281  param = new G4UIparameter("fileName", 's', false);
282  dumpAllQtsToFileCmd->SetParameter(param);
283  param = new G4UIparameter("option", 's', true);
284  dumpAllQtsToFileCmd->SetParameter(param);
285  dumpAllQtsToFileCmd->SetToBeBroadcasted(false);
286 
287 }
288 
290 {
291  delete listCmd;
292  delete verboseCmd;
293  //
294  delete meshCreateDir;
295  delete meshBoxCreateCmd;
296  delete meshCylinderCreateCmd;
297 // delete meshSphereCreateCmd;
298  //
299  delete meshOpnCmd;
300  //
301  delete meshClsCmd;
302 // delete meshActCmd;
303  delete meshDir;
304  //
305  delete mBoxSizeCmd;
306  delete mCylinderSizeCmd;
307 // delete mSphereSizeCmd;
308  //
309  delete mBinCmd;
310  //
311  delete mTResetCmd;
312  delete mTXyzCmd;
313  delete mTransDir;
314  delete mRResetCmd;
315  delete mRotXCmd;
316  delete mRotYCmd;
317  delete mRotZCmd;
318  delete mRotDir;
319  //
320  //delete chartCmd;
321  delete dumpCmd;
322  delete drawCmd;
323  delete drawColumnCmd;
324  delete listColorMapCmd;
325  delete floatMinMaxCmd;
326  delete colorMapMinMaxCmd;
327  delete colorMapDir;
328  delete dumpQtyToFileCmd;
329  delete dumpAllQtsToFileCmd;
330  //
331  delete scoreDir;
332 }
333 
335 {
336  if(command==listCmd) {
337  fSMan->List();
338  } else if(command==dumpCmd) {
339  fSMan->Dump();
340  } else if(command==drawCmd) {
341  G4Tokenizer next(newVal);
342  G4String meshName = next();
343  G4String psName = next();
344  G4String colorMapName = next();
345  G4int axflg = StoI(next());
346  fSMan->DrawMesh(meshName,psName,colorMapName,axflg);
347  } else if(command==drawColumnCmd) {
348  G4Tokenizer next(newVal);
349  G4String meshName = next();
350  G4String psName = next();
351  G4int iPlane = StoI(next());
352  G4int iColumn = StoI(next());
353  G4String colorMapName = next();
354  fSMan->DrawMesh(meshName,psName,iPlane,iColumn,colorMapName);
355 // } else if(command==chartCmd ){
356 // G4Tokenizer next(newVal);
357 // G4String meshName = next();
358 // G4String psName = next();
359 // //G4bool onFlag = StoB(next());
360 // G4String scaleOption = next();
361 // fSMan->DrawChart(meshName,psName,onFlag,scaleOption);
362 
363  } else if(command==dumpQtyToFileCmd) {
364  G4Tokenizer next(newVal);
365  G4String meshName = next();
366  G4String psName = next();
367  G4String fileName = next();
368  G4String option = next("\n");
369  fSMan->DumpQuantityToFile(meshName, psName, fileName, option);
370  } else if(command==dumpAllQtsToFileCmd) {
371  G4Tokenizer next(newVal);
372  G4String meshName = next();
373  G4String fileName = next();
374  G4String option = next("\n");
375  fSMan->DumpAllQuantitiesToFile(meshName, fileName, option);
376  } else if(command==verboseCmd) {
377  fSMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal));
378  } else if(command==meshBoxCreateCmd) {
379  G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
380  if ( currentmesh ){
381  G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
382  << "] : Mesh <" << currentmesh->GetWorldName()
383  << "> is still open. Close it first. Command ignored." << G4endl;
384  } else {
385 
386  G4VScoringMesh* mesh = fSMan->FindMesh(newVal);
387  if ( !mesh ){
388  mesh = new G4ScoringBox(newVal);
389  fSMan->RegisterScoringMesh(mesh);
390  }else{
391  G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
392  << "] : Scoring mesh <" << newVal
393  << "> already exists. Command ignored." << G4endl;
394  }
395  }
396  } else if(command==meshCylinderCreateCmd) {
397  G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
398  if ( currentmesh ){
399  G4cerr << "ERROR[" << meshCylinderCreateCmd->GetCommandPath()
400  << "] : Mesh <" << currentmesh->GetWorldName()
401  << "> is still open. Close it first. Command ignored." << G4endl;
402  } else {
403 
404  G4VScoringMesh* mesh = fSMan->FindMesh(newVal);
405  if ( !mesh ){
406  mesh = new G4ScoringCylinder(newVal);
407  fSMan->RegisterScoringMesh(mesh);
408  }else{
409  G4cerr << "ERROR[" << meshCylinderCreateCmd->GetCommandPath()
410  << "] : Scoring mesh <" << newVal
411  << "> already exists. Command ignored." << G4endl;
412  }
413  }
414  } else if(command==listColorMapCmd) {
415  fSMan->ListScoreColorMaps();
416  } else if(command==floatMinMaxCmd) {
417  G4VScoreColorMap* colorMap = fSMan->GetScoreColorMap(newVal);
418  if(colorMap)
419  { colorMap->SetFloatingMinMax(true); }
420  else
421  { G4cerr << "ERROR[" << floatMinMaxCmd->GetCommandPath()
422  << "] : color map <" << newVal << "> is not defined. Command ignored."
423  << G4endl;
424  }
425  } else if(command==colorMapMinMaxCmd) {
426  G4Tokenizer next(newVal);
427  G4String mapName = next();
428  G4double minVal = StoD(next());
429  G4double maxVal = StoD(next());
430  G4VScoreColorMap* colorMap = fSMan->GetScoreColorMap(mapName);
431  if(colorMap)
432  { colorMap->SetFloatingMinMax(false);
433  colorMap->SetMinMax(minVal,maxVal); }
434  else
435  { G4cerr << "ERROR[" << colorMapMinMaxCmd->GetCommandPath()
436  << "] : color map <" << newVal << "> is not defined. Command ignored."
437  << G4endl;
438  }
439  } else if(command==meshOpnCmd) {
440  G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
441  if ( currentmesh ){
442  G4cerr << "ERROR[" << meshOpnCmd->GetCommandPath()
443  << "] : Mesh <" << currentmesh->GetWorldName() << "> is still open. Close it first. Command ignored." << G4endl;
444  } else {
445  G4VScoringMesh* mesh = fSMan->FindMesh(newVal);
446  if ( !mesh ){
447  G4cerr << "ERROR[" << meshOpnCmd->GetCommandPath()
448  << "] : Scoring mesh <" << newVal << "> does not exist. Command ignored." << G4endl;
449  } else {
450  fSMan->SetCurrentMesh(mesh);
451  }
452  }
453  } else if(command==meshClsCmd) {
454  fSMan->CloseCurrentMesh();
455  } else {
456  //
457  // Get Current Mesh
458  //
459  G4VScoringMesh* mesh = fSMan->GetCurrentMesh();
460  //
461  // Commands for Current Mesh
462  if ( mesh ){
463  // Tokens
464  G4TokenVec token;
465  FillTokenVec(newVal,token);
466  //
467  // Mesh Geometry
468  //
469 // if(command==meshActCmd) {
470 // mesh->Activate(meshActCmd->GetNewBoolValue(newVal));
471 // } else
472  if(command==mBoxSizeCmd) {
473  MeshShape shape = mesh->GetShape();
474  if ( shape == boxMesh ){
475  G4ThreeVector size = mBoxSizeCmd->GetNew3VectorValue(newVal);
476  G4double vsize[3];
477  vsize[0] = size.x();
478  vsize[1] = size.y();
479  vsize[2] = size.z();
480  mesh->SetSize(vsize);
481  } else {
482  G4cerr << "ERROR[" << mBoxSizeCmd->GetCommandPath()
483  << "] : This mesh is not Box. Command ignored." << G4endl;
484  }
485  }else if(command==mCylinderSizeCmd) {
486  MeshShape shape = mesh->GetShape();
487  if ( shape == cylinderMesh ){
488  G4double vsize[3];
489  vsize[0] = StoD(token[0]);
490  vsize[1] = StoD(token[1]);
491  G4double unt = mCylinderSizeCmd->ValueOf(token[2]);
492  vsize[0] *= unt;
493  vsize[1] *= unt;
494  vsize[2] = 0.0;
495  mesh->SetSize(vsize);
496  } else {
497  G4cerr << "ERROR[" << mBoxSizeCmd->GetCommandPath()
498  << "] : This mesh is not Box. Command ignored." << G4endl;
499  }
500  } else if(command==mBinCmd) {
501  MeshBinCommand(mesh,token);
502  } else if(command==mTResetCmd) {
503  G4double centerPosition[3] ={ 0., 0., 0.};
504  mesh->SetCenterPosition(centerPosition);
505  } else if(command==mTXyzCmd) {
506  G4ThreeVector xyz = mTXyzCmd->GetNew3VectorValue(newVal);
507  G4double centerPosition[3];
508  centerPosition[0] = xyz.x();
509  centerPosition[1] = xyz.y();
510  centerPosition[2] = xyz.z();
511  mesh->SetCenterPosition(centerPosition);
512  } else if(command==mRResetCmd) {
513  } else if(command==mRotXCmd) {
514  G4double value = mRotXCmd->GetNewDoubleValue(newVal);
515  mesh->RotateX(value);
516  } else if(command==mRotYCmd) {
517  G4double value = mRotYCmd->GetNewDoubleValue(newVal);
518  mesh->RotateY(value);
519  } else if(command==mRotZCmd) {
520  G4double value = mRotZCmd->GetNewDoubleValue(newVal);
521  mesh->RotateZ(value);
522  }
523  }else{
524  G4cerr << "ERROR: No mesh is currently open. Open/create a mesh first. Command ignored." << G4endl;
525  }
526  }
527 }
528 
530 {
531  G4String val;
532  if(command==verboseCmd)
533  { val = verboseCmd->ConvertToString(fSMan->GetVerboseLevel()); }
534 
535  return val;
536 }
537 
539 
540  G4Tokenizer next(newValues);
541  G4String val;
542  while ( !(val = next()).isNull() ) { // Loop checking 12.18.2015 M.Asai
543  token.push_back(val);
544  }
545 }
546 
547 
549  G4int Ni = StoI(token[0]);
550  G4int Nj = StoI(token[1]);
551  G4int Nk = StoI(token[2]);
552  G4int nSegment[3];
553 
554  if(dynamic_cast<G4ScoringBox*>(mesh)) {
555  G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringBox" << G4endl;
556  nSegment[0] = Ni;
557  nSegment[1] = Nj;
558  nSegment[2] = Nk;
559  } else if(dynamic_cast<G4ScoringCylinder*>(mesh)) {
560  G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringCylinder" << G4endl;
561  nSegment[0] = Nj;
562  nSegment[1] = Nk;
563  nSegment[2] = Ni;
564  } else {
565  G4Exception("G4ScoringMessenger::MeshBinCommand()", "001", FatalException, "invalid mesh type");
566  return;
567  }
568  //
569  mesh->SetNumberOfSegments(nSegment);
570 }
571 
572 
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])
void SetToBeBroadcasted(G4bool val)
Definition: G4UIcommand.hh:184
static G4ThreeVector GetNew3VectorValue(const char *paramString)
void SetDefaultValue(const char *theDefaultValue)
static G4String ConvertToString(G4bool boolVal)
Definition: G4UIcommand.cc:372
void RotateX(G4double delta)
void List() const
G4VScoringMesh * FindMesh(G4VHitsCollection *map)
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
const XML_Char int const XML_Char * value
Definition: expat.h:331
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)
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:309
void SetDefaultUnit(const char *defUnit)
void MeshBinCommand(G4VScoringMesh *mesh, G4TokenVec &token)
double y() const
void SetFloatingMinMax(G4bool vl=true)
MeshShape
#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