source: trunk/source/digits_hits/utils/src/G4ScoringMessenger.cc@ 1351

Last change on this file since 1351 was 1340, checked in by garnier, 15 years ago

update ti head

File size: 21.5 KB
Line 
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,v 1.42 2010/07/26 03:52:33 akimura Exp $
28// GEANT4 tag $Name: $
29//
30// ---------------------------------------------------------------------
31
32#include "G4ScoringMessenger.hh"
33#include "G4ScoringManager.hh"
34#include "G4VScoringMesh.hh"
35#include "G4ScoringBox.hh"
36#include "G4ScoringCylinder.hh"
37
38#include "G4UIdirectory.hh"
39#include "G4UIcmdWithoutParameter.hh"
40#include "G4UIcmdWithAnInteger.hh"
41#include "G4UIcmdWithAString.hh"
42#include "G4UIcmdWithABool.hh"
43#include "G4UIcmdWithADoubleAndUnit.hh"
44#include "G4UIcmdWith3VectorAndUnit.hh"
45#include "G4UIcommand.hh"
46#include "G4Tokenizer.hh"
47#include "G4UnitsTable.hh"
48#include "G4VScoreColorMap.hh"
49
50G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
51:fSMan(SManager)
52{
53 G4UIparameter* param;
54
55 scoreDir = new G4UIdirectory("/score/");
56 scoreDir->SetGuidance("Interactive scoring commands.");
57
58 listCmd = new G4UIcmdWithoutParameter("/score/list",this);
59 listCmd->SetGuidance("List scoring worlds.");
60
61 dumpCmd = new G4UIcmdWithoutParameter("/score/dump",this);
62 dumpCmd->SetGuidance("Dump results of scorers.");
63
64 verboseCmd = new G4UIcmdWithAnInteger("/score/verbose",this);
65 verboseCmd->SetGuidance("Verbosity.");
66 verboseCmd->SetGuidance(" 0) errors or warnings,");
67 verboseCmd->SetGuidance(" 1) information with 0)");
68
69 meshDir = new G4UIdirectory("/score/mesh/");
70 meshDir->SetGuidance(" Mesh processing commands.");
71
72 meshCreateDir = new G4UIdirectory("/score/create/");
73 meshCreateDir->SetGuidance(" Mesh creation commands.");
74 //
75 // Mesh commands
76 meshBoxCreateCmd = new G4UIcmdWithAString("/score/create/boxMesh",this);
77 meshBoxCreateCmd->SetGuidance("Create scoring box mesh.");
78 meshBoxCreateCmd->SetParameterName("MeshName",false);
79 //
80 meshCylinderCreateCmd = new G4UIcmdWithAString("/score/create/cylinderMesh",this);
81 meshCylinderCreateCmd->SetGuidance("Create scoring mesh.");
82 meshCylinderCreateCmd->SetParameterName("MeshName",false);
83 //
84// meshSphereCreateCmd = new G4UIcmdWithAString("/score/create/sphereMesh",this);
85// meshSphereCreateCmd->SetGuidance("Create scoring mesh.");
86// meshSphereCreateCmd->SetParameterName("MeshName",false);
87 //
88 meshOpnCmd = new G4UIcmdWithAString("/score/open",this);
89 meshOpnCmd->SetGuidance("Open scoring mesh.");
90 meshOpnCmd->SetParameterName("MeshName",false);
91 //
92 meshClsCmd = new G4UIcmdWithoutParameter("/score/close",this);
93 meshClsCmd->SetGuidance("Close scoring mesh.");
94 //
95// meshActCmd = new G4UIcmdWithABool("/score/mesh/activate",this);
96// meshActCmd->SetGuidance("Activate scoring mesh.");
97// meshActCmd->SetParameterName("MeshName",false);
98 //
99 mBoxSizeCmd = new G4UIcmdWith3VectorAndUnit("/score/mesh/boxSize",this);
100 mBoxSizeCmd->SetGuidance("Define size of the scoring mesh.");
101 mBoxSizeCmd->SetGuidance("Dx Dy Dz unit");
102 mBoxSizeCmd->SetParameterName("Di","Dj","Dk",false,false);
103 mBoxSizeCmd->SetRange("Di>0. && Dj>0. && Dk>0.");
104 mBoxSizeCmd->SetDefaultUnit("mm");
105 //
106 mCylinderSizeCmd = new G4UIcommand("/score/mesh/cylinderSize",this);
107 mCylinderSizeCmd->SetGuidance("Define size of the scoring mesh.");
108 mCylinderSizeCmd->SetGuidance("R Dz unit");
109 param = new G4UIparameter("R",'d',false);
110 param->SetParameterRange("R>0");
111 mCylinderSizeCmd->SetParameter(param);
112 param = new G4UIparameter("Dz",'d',false);
113 param->SetParameterRange("Dz>0");
114 mCylinderSizeCmd->SetParameter(param);
115 param = new G4UIparameter("unit",'s',true);
116 param->SetDefaultValue("mm");
117 mCylinderSizeCmd->SetParameter(param);
118 //
119 // Division command
120 mBinCmd = new G4UIcommand("/score/mesh/nBin",this);
121 mBinCmd->SetGuidance("Define segments of the scoring mesh.");
122 mBinCmd->SetGuidance("[usage] /score/mesh/nBin");
123 mBinCmd->SetGuidance(" In case of boxMesh, parameters are given in");
124 mBinCmd->SetGuidance(" Ni :(int) Number of bins i (in x-axis) ");
125 mBinCmd->SetGuidance(" Nj :(int) Number of bins j (in y-axis) ");
126 mBinCmd->SetGuidance(" Nk :(int) Number of bins k (in z-axis) ");
127 mBinCmd->SetGuidance(" In case of cylinderMesh, parameters are given in");
128 mBinCmd->SetGuidance(" Nr :(int) Number of bins in radial axis ");
129 mBinCmd->SetGuidance(" Nz :(int) Number of bins in z axis ");
130 mBinCmd->SetGuidance(" Nphi:(int) Number of bins in phi axis ");
131 //mBinCmd->SetGuidance(" Axis:(int) Axis of division ");
132// mBinCmd->SetGuidance(" P1..Pn-1 :(double) \"paramter from P1 to Pn-1 for division.\"");
133 param = new G4UIparameter("Ni",'i',false);
134 param->SetDefaultValue("1");
135 param->SetParameterRange("Ni>0");
136 mBinCmd->SetParameter(param);
137 param = new G4UIparameter("Nj",'i',false);
138 param->SetDefaultValue("1");
139 param->SetParameterRange("Nj>0");
140 mBinCmd->SetParameter(param);
141 param = new G4UIparameter("Nk",'i',false);
142 param->SetDefaultValue("1");
143 mBinCmd->SetParameter(param);
144 param->SetParameterRange("Nk>0");
145 //param = new G4UIparameter("Axis",'i',true);
146 //param->SetDefaultValue("3");
147 //mBinCmd->SetParameter(param);
148 //
149 // Placement command
150 mTransDir = new G4UIdirectory("/score/mesh/translate/");
151 mTransDir->SetGuidance("Mesh translation commands.");
152 //
153 mTResetCmd = new G4UIcmdWithoutParameter("/score/mesh/translate/reset",this);
154 mTResetCmd->SetGuidance("Reset translated position of the scoring mesh.");
155 //
156 mTXyzCmd = new G4UIcmdWith3VectorAndUnit("/score/mesh/translate/xyz",this);
157 mTXyzCmd->SetGuidance("Translate the scoring mesh.");
158 mTXyzCmd->SetParameterName("X","Y","Z",false,false);
159 mTXyzCmd->SetDefaultUnit("mm");
160 //
161 mRotDir = new G4UIdirectory("/score/mesh/rotate/");
162 mRotDir->SetGuidance("Mesh rotation commands.");
163 //
164 mRResetCmd = new G4UIcmdWithoutParameter("/score/mesh/rotate/reset",this);
165 mRResetCmd->SetGuidance("Reset rotation angles of the scoring mesh.");
166 //
167 mRotXCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateX",this);
168 mRotXCmd->SetGuidance("Rotate the scoring mesh in X axis.");
169 mRotXCmd->SetParameterName("Rx",false);
170 mRotXCmd->SetDefaultUnit("deg");
171 //
172 mRotYCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateY",this);
173 mRotYCmd->SetGuidance("Rotate the scoring mesh in Y axis.");
174 mRotYCmd->SetParameterName("Ry",false);
175 mRotYCmd->SetDefaultUnit("deg");
176 //
177 mRotZCmd = new G4UIcmdWithADoubleAndUnit("/score/mesh/rotate/rotateZ",this);
178 mRotZCmd->SetGuidance("Rotate the scoring mesh in Z axis.");
179 mRotZCmd->SetParameterName("Rz",false);
180 mRotZCmd->SetDefaultUnit("deg");
181 //
182
183 // Draw Scoring result
184 drawCmd = new G4UIcommand("/score/drawProjection",this);
185 drawCmd->SetGuidance("Draw projection(s) of scored quantities.");
186 drawCmd->SetGuidance("Parameter <proj> specified which projection(s) to be drawn.");
187 drawCmd->SetGuidance(" 100 : xy-plane, 010 : yz-plane, 001 : zx-plane -- default 111");
188 drawCmd->SetGuidance(" 100 : N/A, 010 : z_phi-plane, 001 : r_phi-plane -- default 111");
189 param = new G4UIparameter("meshName",'s',false);
190 drawCmd->SetParameter(param);
191 param = new G4UIparameter("psName",'s',false);
192 drawCmd->SetParameter(param);
193 param = new G4UIparameter("colorMapName",'s',true);
194 param->SetDefaultValue("defaultLinearColorMap");
195 drawCmd->SetParameter(param);
196 param = new G4UIparameter("proj",'i',true);
197 param->SetDefaultValue(111);
198 drawCmd->SetParameter(param);
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
218 colorMapDir = new G4UIdirectory("/score/colorMap/");
219 colorMapDir->SetGuidance("Color map commands.");
220
221 listColorMapCmd = new G4UIcmdWithoutParameter("/score/colorMap/listScoreColorMaps",this);
222 listColorMapCmd->SetGuidance("List registered score color maps.");
223
224 floatMinMaxCmd = new G4UIcmdWithAString("/score/colorMap/floatMinMax",this);
225 floatMinMaxCmd->SetGuidance("Min/Max of the color map is calculated accorging to the actual scores.");
226 floatMinMaxCmd->SetParameterName("colorMapName",true,false);
227 floatMinMaxCmd->SetDefaultValue("defaultLinearColorMap");
228
229 colorMapMinMaxCmd = new G4UIcommand("/score/colorMap/setMinMax",this);
230 colorMapMinMaxCmd->SetGuidance("Define min/max value of the color map.");
231 param = new G4UIparameter("colorMapMame",'s',true);
232 param->SetDefaultValue("defaultLinearColorMap");
233 colorMapMinMaxCmd->SetParameter(param);
234 param = new G4UIparameter("minValue",'d',false);
235 colorMapMinMaxCmd->SetParameter(param);
236 param = new G4UIparameter("maxValue",'d',false);
237 colorMapMinMaxCmd->SetParameter(param);
238
239 /*
240 chartCmd = new G4UIcommand("/score/drawChart",this);
241 chartCmd->SetGuidance("Draw color chart on the screen.");
242 chartCmd->SetGuidance("[usage] /score/drawChart");
243 chartCmd->SetGuidance(" mesh :(String) Mesh name.");
244 chartCmd->SetGuidance(" psname :(String) PS name.");
245 chartCmd->SetGuidance(" On/Off :(boolean) On or Off the color chart.");
246 chartCmd->SetGuidance(" scale :(String) default=linear, or log ");
247 param = new G4UIparameter("meshName",'s',false);
248 chartCmd->SetParameter(param);
249 param = new G4UIparameter("psName",'s',false);
250 chartCmd->SetParameter(param);
251 param = new G4UIparameter("On",'s',true);
252 param->SetDefaultValue("true");
253 chartCmd->SetParameter(param);
254 param = new G4UIparameter("scale",'s',true);
255 param->SetDefaultValue("linear");
256 chartCmd->SetParameter(param);
257 */
258
259 // Dump a scored quantity
260 dumpQtyToFileCmd = new G4UIcommand("/score/dumpQuantityToFile", this);
261 dumpQtyToFileCmd->SetGuidance("Dump one scored quantity to file.");
262 param = new G4UIparameter("meshName", 's', false);
263 dumpQtyToFileCmd->SetParameter(param);
264 param = new G4UIparameter("psName", 's', false);
265 dumpQtyToFileCmd->SetParameter(param);
266 param = new G4UIparameter("fileName", 's', false);
267 dumpQtyToFileCmd->SetParameter(param);
268 param = new G4UIparameter("option", 's', true);
269 dumpQtyToFileCmd->SetParameter(param);
270
271 // Dump all scored quantities
272 dumpAllQtsToFileCmd = new G4UIcommand("/score/dumpAllQuantitiesToFile", this);
273 dumpAllQtsToFileCmd->SetGuidance("Dump all quantities of the mesh to file.");
274 param = new G4UIparameter("meshName", 's', false);
275 dumpAllQtsToFileCmd->SetParameter(param);
276 param = new G4UIparameter("fileName", 's', false);
277 dumpAllQtsToFileCmd->SetParameter(param);
278 param = new G4UIparameter("option", 's', true);
279 dumpAllQtsToFileCmd->SetParameter(param);
280
281}
282
283G4ScoringMessenger::~G4ScoringMessenger()
284{
285 delete listCmd;
286 delete verboseCmd;
287 //
288 delete meshCreateDir;
289 delete meshBoxCreateCmd;
290 delete meshCylinderCreateCmd;
291// delete meshSphereCreateCmd;
292 //
293 delete meshOpnCmd;
294 //
295 delete meshClsCmd;
296// delete meshActCmd;
297 delete meshDir;
298 //
299 delete mBoxSizeCmd;
300 delete mCylinderSizeCmd;
301// delete mSphereSizeCmd;
302 //
303 delete mBinCmd;
304 //
305 delete mTResetCmd;
306 delete mTXyzCmd;
307 delete mTransDir;
308 delete mRResetCmd;
309 delete mRotXCmd;
310 delete mRotYCmd;
311 delete mRotZCmd;
312 delete mRotDir;
313 //
314 delete chartCmd;
315 delete dumpCmd;
316 delete drawCmd;
317 delete drawColumnCmd;
318 delete listColorMapCmd;
319 delete floatMinMaxCmd;
320 delete colorMapMinMaxCmd;
321 delete colorMapDir;
322 delete dumpQtyToFileCmd;
323 delete dumpAllQtsToFileCmd;
324 //
325 delete scoreDir;
326}
327
328void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
329{
330 if(command==listCmd) {
331 fSMan->List();
332 } else if(command==dumpCmd) {
333 fSMan->Dump();
334 } else if(command==drawCmd) {
335 G4Tokenizer next(newVal);
336 G4String meshName = next();
337 G4String psName = next();
338 G4String colorMapName = next();
339 G4int axflg = StoI(next());
340 fSMan->DrawMesh(meshName,psName,colorMapName,axflg);
341 } else if(command==drawColumnCmd) {
342 G4Tokenizer next(newVal);
343 G4String meshName = next();
344 G4String psName = next();
345 G4int iPlane = StoI(next());
346 G4int iColumn = StoI(next());
347 G4String colorMapName = next();
348 fSMan->DrawMesh(meshName,psName,iPlane,iColumn,colorMapName);
349 } else if(command==chartCmd ){
350 G4Tokenizer next(newVal);
351 G4String meshName = next();
352 G4String psName = next();
353 //G4bool onFlag = StoB(next());
354 G4String scaleOption = next();
355// fSMan->DrawChart(meshName,psName,onFlag,scaleOption);
356
357 } else if(command==dumpQtyToFileCmd) {
358 G4Tokenizer next(newVal);
359 G4String meshName = next();
360 G4String psName = next();
361 G4String fileName = next();
362 G4String option = next("\n");
363 fSMan->DumpQuantityToFile(meshName, psName, fileName, option);
364 } else if(command==dumpAllQtsToFileCmd) {
365 G4Tokenizer next(newVal);
366 G4String meshName = next();
367 G4String fileName = next();
368 G4String option = next("\n");
369 fSMan->DumpAllQuantitiesToFile(meshName, fileName, option);
370 } else if(command==verboseCmd) {
371 fSMan->SetVerboseLevel(verboseCmd->GetNewIntValue(newVal));
372 } else if(command==meshBoxCreateCmd) {
373 G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
374 if ( currentmesh ){
375 G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
376 << "] : Mesh <" << currentmesh->GetWorldName()
377 << "> is still open. Close it first. Command ignored." << G4endl;
378 } else {
379
380 G4VScoringMesh* mesh = fSMan->FindMesh(newVal);
381 if ( !mesh ){
382 mesh = new G4ScoringBox(newVal);
383 fSMan->RegisterScoringMesh(mesh);
384 }else{
385 G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
386 << "] : Scoring mesh <" << newVal
387 << "> already exists. Command ignored." << G4endl;
388 }
389 }
390 } else if(command==meshCylinderCreateCmd) {
391 G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
392 if ( currentmesh ){
393 G4cerr << "ERROR[" << meshBoxCreateCmd->GetCommandPath()
394 << "] : Mesh <" << currentmesh->GetWorldName()
395 << "> is still open. Close it first. Command ignored." << G4endl;
396 } else {
397
398 G4VScoringMesh* mesh = fSMan->FindMesh(newVal);
399 if ( !mesh ){
400 mesh = new G4ScoringCylinder(newVal);
401 fSMan->RegisterScoringMesh(mesh);
402 }else{
403 G4cerr << "ERROR[" << meshCylinderCreateCmd->GetCommandPath()
404 << "] : Scoring mesh <" << newVal
405 << "> already exists. Command ignored." << G4endl;
406 }
407 }
408 } else if(command==listColorMapCmd) {
409 fSMan->ListScoreColorMaps();
410 } else if(command==floatMinMaxCmd) {
411 G4VScoreColorMap* colorMap = fSMan->GetScoreColorMap(newVal);
412 if(colorMap)
413 { colorMap->SetFloatingMinMax(true); }
414 else
415 { G4cerr << "ERROR[" << floatMinMaxCmd->GetCommandPath()
416 << "] : color map <" << newVal << "> is not defined. Command ignored."
417 << G4endl;
418 }
419 } else if(command==colorMapMinMaxCmd) {
420 G4Tokenizer next(newVal);
421 G4String mapName = next();
422 G4double minVal = StoD(next());
423 G4double maxVal = StoD(next());
424 G4VScoreColorMap* colorMap = fSMan->GetScoreColorMap(mapName);
425 if(colorMap)
426 { colorMap->SetFloatingMinMax(false);
427 colorMap->SetMinMax(minVal,maxVal); }
428 else
429 { G4cerr << "ERROR[" << colorMapMinMaxCmd->GetCommandPath()
430 << "] : color map <" << newVal << "> is not defined. Command ignored."
431 << G4endl;
432 }
433 } else if(command==meshOpnCmd) {
434 G4VScoringMesh* currentmesh = fSMan->GetCurrentMesh();
435 if ( currentmesh ){
436 G4cerr << "ERROR[" << meshOpnCmd->GetCommandPath()
437 << "] : Mesh <" << currentmesh->GetWorldName() << "> is still open. Close it first. Command ignored." << G4endl;
438 } else {
439 G4VScoringMesh* mesh = fSMan->FindMesh(newVal);
440 if ( !mesh ){
441 G4cerr << "ERROR[" << meshOpnCmd->GetCommandPath()
442 << "] : Scoring mesh <" << newVal << "> does not exist. Command ignored." << G4endl;
443 } else {
444 fSMan->SetCurrentMesh(mesh);
445 }
446 }
447 } else if(command==meshClsCmd) {
448 fSMan->CloseCurrentMesh();
449 } else {
450 //
451 // Get Current Mesh
452 //
453 G4VScoringMesh* mesh = fSMan->GetCurrentMesh();
454 //
455 // Commands for Current Mesh
456 if ( mesh ){
457 // Tokens
458 G4TokenVec token;
459 FillTokenVec(newVal,token);
460 //
461 // Mesh Geometry
462 //
463// if(command==meshActCmd) {
464// mesh->Activate(meshActCmd->GetNewBoolValue(newVal));
465// } else
466 if(command==mBoxSizeCmd) {
467 MeshShape shape = mesh->GetShape();
468 if ( shape == boxMesh ){
469 G4ThreeVector size = mBoxSizeCmd->GetNew3VectorValue(newVal);
470 G4double vsize[3];
471 vsize[0] = size.x();
472 vsize[1] = size.y();
473 vsize[2] = size.z();
474 mesh->SetSize(vsize);
475 } else {
476 G4cerr << "ERROR[" << mBoxSizeCmd->GetCommandPath()
477 << "] : This mesh is not Box. Command ignored." << G4endl;
478 }
479 }else if(command==mCylinderSizeCmd) {
480 MeshShape shape = mesh->GetShape();
481 if ( shape == cylinderMesh ){
482 G4double vsize[3];
483 vsize[0] = StoD(token[0]);
484 vsize[1] = StoD(token[1]);
485 G4double unt = mCylinderSizeCmd->ValueOf(token[2]);
486 vsize[0] *= unt;
487 vsize[1] *= unt;
488 vsize[2] = 0.0;
489 mesh->SetSize(vsize);
490 } else {
491 G4cerr << "ERROR[" << mBoxSizeCmd->GetCommandPath()
492 << "] : This mesh is not Box. Command ignored." << G4endl;
493 }
494 } else if(command==mBinCmd) {
495 MeshBinCommand(mesh,token);
496 } else if(command==mTResetCmd) {
497 G4double centerPosition[3] ={ 0., 0., 0.};
498 mesh->SetCenterPosition(centerPosition);
499 } else if(command==mTXyzCmd) {
500 G4ThreeVector xyz = mTXyzCmd->GetNew3VectorValue(newVal);
501 G4double centerPosition[3];
502 centerPosition[0] = xyz.x();
503 centerPosition[1] = xyz.y();
504 centerPosition[2] = xyz.z();
505 mesh->SetCenterPosition(centerPosition);
506 } else if(command==mRResetCmd) {
507 } else if(command==mRotXCmd) {
508 G4double value = mRotXCmd->GetNewDoubleValue(newVal);
509 mesh->RotateX(value);
510 } else if(command==mRotYCmd) {
511 G4double value = mRotYCmd->GetNewDoubleValue(newVal);
512 mesh->RotateY(value);
513 } else if(command==mRotZCmd) {
514 G4double value = mRotZCmd->GetNewDoubleValue(newVal);
515 mesh->RotateZ(value);
516 }
517 }else{
518 G4cerr << "ERROR: No mesh is currently open. Open/create a mesh first. Command ignored." << G4endl;
519 }
520 }
521}
522
523G4String G4ScoringMessenger::GetCurrentValue(G4UIcommand * command)
524{
525 G4String val;
526 if(command==verboseCmd)
527 { val = verboseCmd->ConvertToString(fSMan->GetVerboseLevel()); }
528
529 return val;
530}
531
532void G4ScoringMessenger::FillTokenVec(G4String newValues, G4TokenVec& token){
533
534 G4Tokenizer next(newValues);
535 G4String val;
536 while ( !(val = next()).isNull() ) {
537 token.push_back(val);
538 }
539}
540
541
542void G4ScoringMessenger::MeshBinCommand(G4VScoringMesh* mesh,G4TokenVec& token){
543 G4int Ni = StoI(token[0]);
544 G4int Nj = StoI(token[1]);
545 G4int Nk = StoI(token[2]);
546 G4int nSegment[3];
547
548 if(dynamic_cast<G4ScoringBox*>(mesh)) {
549 G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringBox" << G4endl;
550 nSegment[0] = Ni;
551 nSegment[1] = Nj;
552 nSegment[2] = Nk;
553 } else if(dynamic_cast<G4ScoringCylinder*>(mesh)) {
554 G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringCylinder" << G4endl;
555 nSegment[0] = Nj;
556 nSegment[1] = Nk;
557 nSegment[2] = Ni;
558 } else {
559 G4Exception("G4ScoringMessenger::MeshBinCommand()", "001", FatalException, "invalid mesh type");
560 }
561 //
562 mesh->SetNumberOfSegments(nSegment);
563}
564
565
Note: See TracBrowser for help on using the repository browser.