ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ScoreQuantityMessenger.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4ScoreQuantityMessenger.cc
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 //
28 // ---------------------------------------------------------------------
29 // Modifications
30 // 08-Oct-2010 T.Aso remove unit of G4PSPassageCellCurrent.
31 // 24-Mar-2011 T.Aso Add StepChecker for debugging.
32 // 24-Mar-2011 T.Aso Size and segmentation for replicated cylinder.
33 // 01-Jun-2012 T.Aso Support weighted/dividedByArea options
34 // in flatCurrent and flatFulx commands.
35 // 27-Mar-2013 T.Aso Unit option in the kineticEnergy filter was
36 // supported.
37 //
38 // ---------------------------------------------------------------------
39 
41 #include "G4ScoringManager.hh"
42 #include "G4VScoringMesh.hh"
43 #include "G4VPrimitiveScorer.hh"
44 
45 #include "G4PSCellCharge3D.hh"
46 #include "G4PSCellFlux3D.hh"
48 #include "G4PSPassageCellFlux3D.hh"
50 #include "G4PSEnergyDeposit3D.hh"
51 #include "G4PSDoseDeposit3D.hh"
53 #include "G4PSNofStep3D.hh"
54 #include "G4PSNofSecondary3D.hh"
55 //
56 #include "G4PSTrackLength3D.hh"
60 #include "G4PSFlatSurfaceFlux3D.hh"
65 #include "G4PSNofCollision3D.hh"
66 #include "G4PSPopulation3D.hh"
67 #include "G4PSTrackCounter3D.hh"
68 #include "G4PSTermination3D.hh"
70 
71 #include "G4PSCellCharge.hh"
72 #include "G4PSCellFlux.hh"
73 #include "G4PSPassageCellFlux.hh"
74 #include "G4PSEnergyDeposit.hh"
75 #include "G4PSDoseDeposit.hh"
76 #include "G4PSNofStep.hh"
77 #include "G4PSNofSecondary.hh"
78 //
79 #include "G4PSTrackLength.hh"
83 #include "G4PSFlatSurfaceFlux.hh"
85 #include "G4PSSphereSurfaceFlux.hh"
88 #include "G4PSNofCollision.hh"
89 #include "G4PSPopulation.hh"
90 #include "G4PSTrackCounter.hh"
91 #include "G4PSTermination.hh"
93 
94 //
95 // For debug purpose
96 #include "G4PSStepChecker3D.hh"
97 
98 #include "G4SDChargedFilter.hh"
99 #include "G4SDNeutralFilter.hh"
101 #include "G4SDParticleFilter.hh"
103 
104 #include "G4UIdirectory.hh"
106 #include "G4UIcmdWithAnInteger.hh"
107 #include "G4UIcmdWithAString.hh"
108 #include "G4UIcmdWithABool.hh"
111 #include "G4UIcommand.hh"
112 #include "G4UIparameter.hh"
113 #include "G4Tokenizer.hh"
114 #include "G4UnitsTable.hh"
115 
117 :fSMan(SManager)
118 {
120  FilterCommands();
121 }
122 
124 {
125  G4UIparameter* param;
126 
127  //
128  // Filter commands
129  filterDir = new G4UIdirectory("/score/filter/");
130  filterDir->SetGuidance(" Scoring filter commands.");
131  //
132  fchargedCmd = new G4UIcmdWithAString("/score/filter/charged",this);
133  fchargedCmd->SetGuidance("Charged particle filter.");
134  fchargedCmd->SetParameterName("fname",false);
135  //
136  fneutralCmd = new G4UIcmdWithAString("/score/filter/neutral",this);
137  fneutralCmd->SetGuidance("Neutral particle filter.");
138  fneutralCmd->SetParameterName("fname",false);
139  //
140  fkinECmd = new G4UIcommand("/score/filter/kineticEnergy",this);
141  fkinECmd->SetGuidance("Kinetic energy filter.");
142  fkinECmd->SetGuidance("[usage] /score/filter/kineticEnergy fname Elow Ehigh unit");
143  fkinECmd->SetGuidance(" fname :(String) Filter Name ");
144  fkinECmd->SetGuidance(" Elow :(Double) Lower edge of kinetic energy");
145  fkinECmd->SetGuidance(" Ehigh :(Double) Higher edge of kinetic energy");
146  fkinECmd->SetGuidance(" unit :(String) unit of given kinetic energy");
147  param = new G4UIparameter("fname",'s',false);
148  fkinECmd->SetParameter(param);
149  param = new G4UIparameter("elow",'d',true);
150  param->SetDefaultValue("0.0");
151  fkinECmd->SetParameter(param);
152  param = new G4UIparameter("ehigh",'d',true);
153  fkinECmd->SetParameter(param);
155  param->SetDefaultValue(smax);
156  param = new G4UIparameter("unit",'s',true);
157  param->SetDefaultUnit("keV");
158  fkinECmd->SetParameter(param);
159  //
160  fparticleCmd = new G4UIcommand("/score/filter/particle",this);
161  fparticleCmd->SetGuidance("Particle filter.");
162  fparticleCmd->SetGuidance("[usage] /score/filter/particle fname p0 .. pn");
163  fparticleCmd->SetGuidance(" fname :(String) Filter Name ");
164  fparticleCmd->SetGuidance(" p0 .. pn :(String) particle names");
165  param = new G4UIparameter("fname",'s',false);
166  fparticleCmd->SetParameter(param);
167  param = new G4UIparameter("particlelist",'s',false);
168  param->SetDefaultValue("");
169  fparticleCmd->SetParameter(param);
170  //
171  //
172  //
173  fparticleKinECmd = new G4UIcommand("/score/filter/particleWithKineticEnergy",this);
174  fparticleKinECmd->SetGuidance("Particle with kinetic energy filter.");
175  fparticleKinECmd->SetGuidance("[usage] /score/filter/particleWithKineticEnergy fname Elow Ehigh unit p0 .. pn");
176  fparticleKinECmd->SetGuidance(" fname :(String) Filter Name ");
177  fparticleKinECmd->SetGuidance(" Elow :(Double) Lower edge of kinetic energy");
178  fparticleKinECmd->SetGuidance(" Ehigh :(Double) Higher edge of kinetic energy");
179  fparticleKinECmd->SetGuidance(" unit :(String) unit of given kinetic energy");
180  fparticleKinECmd->SetGuidance(" p0 .. pn :(String) particle names");
181  param = new G4UIparameter("fname",'s',false);
183  param = new G4UIparameter("elow",'d',false);
184  param->SetDefaultValue("0.0");
186  param = new G4UIparameter("ehigh",'d',true);
187  param->SetDefaultValue(smax);
189  param = new G4UIparameter("unit",'s',true);
190  param->SetDefaultUnit("keV");
192  param = new G4UIparameter("particlelist",'s',false);
193  param->SetDefaultValue("");
195  //
196  //
197 }
198 
200 {
201  delete quantityDir;
202  delete qTouchCmd;
203  delete qGetUnitCmd;
204  delete qSetUnitCmd;
205 
206  //
207  delete qCellChgCmd;
208  delete qCellFluxCmd;
209  delete qPassCellFluxCmd;
210  delete qeDepCmd;
211  delete qdoseDepCmd;
212  delete qnOfStepCmd;
213  delete qnOfSecondaryCmd;
214  //
215  delete qTrackLengthCmd;
216  delete qPassCellCurrCmd;
217  delete qPassTrackLengthCmd;
218  delete qFlatSurfCurrCmd;
219  delete qFlatSurfFluxCmd;
220 // delete qSphereSurfCurrCmd;
221 // delete qSphereSurfFluxCmd;
222 // delete qCylSurfCurrCmd;
223 // delete qCylSurfFluxCmd;
224  delete qNofCollisionCmd;
225  delete qPopulationCmd;
226  delete qTrackCountCmd;
227  delete qTerminationCmd;
228  delete qMinKinEAtGeneCmd;
229  //
230  delete qStepCheckerCmd;
231  //
232  delete filterDir;
233  delete fchargedCmd;
234  delete fneutralCmd;
235  delete fkinECmd;
236  delete fparticleCmd;
237  delete fparticleKinECmd;
238 }
239 
241 {
242  using MeshShape = G4VScoringMesh::MeshShape;
243 
245 
246  //
247  // Get Current Mesh
248  //
250  if(!mesh)
251  {
252  ed << "ERROR : No mesh is currently open. Open/create a mesh first. Command ignored.";
253  command->CommandFailed(ed);
254  return;
255  }
256  // Mesh type
257  auto shape = mesh->GetShape();
258  // Tokens
259  G4TokenVec token;
260  FillTokenVec(newVal,token);
261  //
262  // Commands for Current Mesh
263  if(command==qTouchCmd) {
264  mesh->SetCurrentPrimitiveScorer(newVal);
265  } else if(command == qGetUnitCmd ){
266  G4cout << "Unit: "<< mesh->GetCurrentPSUnit() <<G4endl;
267  } else if(command == qSetUnitCmd ){
268  mesh->SetCurrentPSUnit(newVal);
269  } else if(command== qCellChgCmd) {
270  if ( CheckMeshPS(mesh,token[0],command) ){
271  G4PSCellCharge* ps = nullptr;
272  if(shape==MeshShape::realWorldLogVol)
273  { ps = new G4PSCellCharge(token[0],mesh->GetCopyNumberLevel()); }
274  else
275  { ps = new G4PSCellCharge3D(token[0]); }
276  ps->SetUnit(token[1]);
277  mesh->SetPrimitiveScorer(ps);
278  }
279  } else if(command== qCellFluxCmd) {
280  if ( CheckMeshPS(mesh,token[0],command) ){
281  G4PSCellFlux* ps = nullptr;
282  if( shape==MeshShape::box ) {
283  ps = new G4PSCellFlux3D(token[0]);
284  } else if( shape==MeshShape::cylinder ) {
286  G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
287  pps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
288  G4int nSeg[3];
289  mesh->GetNumberOfSegments(nSeg);
290  pps->SetNumberOfSegments(nSeg);
291  ps = pps;
292  } else if(shape==MeshShape::realWorldLogVol) {
293  ed<<"Cell flux for real world volume is not yet supported. Command ignored.";
294  command->CommandFailed(ed);
295  return;
296  }
297  ps->SetUnit(token[1]);
298  mesh->SetPrimitiveScorer(ps);
299  }
300  } else if(command== qPassCellFluxCmd) {
301  if ( CheckMeshPS(mesh,token[0],command) ){
302  G4PSPassageCellFlux* ps = nullptr;
303  if( shape==MeshShape::box ) {
304  ps = new G4PSPassageCellFlux3D(token[0]);
305  } else if( shape==MeshShape::cylinder ) {
307  G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
308  pps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
309  G4int nSeg[3];
310  mesh->GetNumberOfSegments(nSeg);
311  pps->SetNumberOfSegments(nSeg);
312  ps = pps;
313  } else if(shape==MeshShape::realWorldLogVol) {
314  ed<<"Passing cell flux for real world volume is not yet supported. Command ignored.";
315  command->CommandFailed(ed);
316  return;
317  }
318  ps->SetUnit(token[1]);
319  mesh->SetPrimitiveScorer(ps);
320  }
321  } else if(command==qeDepCmd) {
322  if ( CheckMeshPS(mesh,token[0],command) ){
323  G4PSEnergyDeposit* ps = nullptr;
324  if(shape==MeshShape::realWorldLogVol)
325  { ps =new G4PSEnergyDeposit(token[0],mesh->GetCopyNumberLevel()); }
326  else
327  { ps =new G4PSEnergyDeposit3D(token[0]); }
328  ps->SetUnit(token[1]);
329  mesh->SetPrimitiveScorer(ps);
330  }
331  } else if(command== qdoseDepCmd) {
332  if ( CheckMeshPS(mesh,token[0],command) ){
333  G4PSDoseDeposit* ps = nullptr;
334  if( shape==MeshShape::box ) {
335  ps = new G4PSDoseDeposit3D(token[0]);
336  } else if( shape==MeshShape::cylinder ) {
338  pps->SetUnit(token[1]);
339  G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
340  pps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
341  G4int nSeg[3];
342  mesh->GetNumberOfSegments(nSeg);
343  pps->SetNumberOfSegments(nSeg);
344  ps = pps;
345  } else if(shape==MeshShape::realWorldLogVol) {
346  ps = new G4PSDoseDeposit(token[0],mesh->GetCopyNumberLevel());
347  }
348  ps->SetUnit(token[1]);
349  mesh->SetPrimitiveScorer(ps);
350  }
351  } else if(command== qnOfStepCmd) {
352  if ( CheckMeshPS(mesh,token[0],command) ){
353  G4PSNofStep* ps = nullptr;
354  if(shape==MeshShape::realWorldLogVol)
355  { ps = new G4PSNofStep(token[0],mesh->GetCopyNumberLevel()); }
356  else
357  { ps = new G4PSNofStep3D(token[0]); }
358  ps->SetBoundaryFlag(StoB(token[1]));
359  mesh->SetPrimitiveScorer(ps);
360  }
361  } else if(command== qnOfSecondaryCmd) {
362  if ( CheckMeshPS(mesh,token[0],command) ){
363  G4PSNofSecondary* ps = nullptr;
364  if(shape==MeshShape::realWorldLogVol)
365  { ps = new G4PSNofSecondary(token[0],mesh->GetCopyNumberLevel()); }
366  else
367  { ps = new G4PSNofSecondary3D(token[0]); }
368  mesh->SetPrimitiveScorer(ps);
369  }
370  } else if(command== qTrackLengthCmd) {
371  if ( CheckMeshPS(mesh,token[0],command) ){
372  G4PSTrackLength* ps = nullptr;
373  if(shape==MeshShape::realWorldLogVol)
374  { ps = new G4PSTrackLength(token[0],mesh->GetCopyNumberLevel()); }
375  else
376  { ps = new G4PSTrackLength3D(token[0]); }
377  ps->Weighted(StoB(token[1]));
378  ps->MultiplyKineticEnergy(StoB(token[2]));
379  ps->DivideByVelocity(StoB(token[3]));
380  ps->SetUnit(token[4]);
381  mesh->SetPrimitiveScorer(ps);
382  }
383  } else if(command== qPassCellCurrCmd){
384  if( CheckMeshPS(mesh,token[0],command) ) {
385  G4PSPassageCellCurrent* ps = nullptr;
386  if(shape==MeshShape::realWorldLogVol)
387  { ps = new G4PSPassageCellCurrent(token[0],mesh->GetCopyNumberLevel()); }
388  else
389  { ps = new G4PSPassageCellCurrent3D(token[0]); }
390  ps->Weighted(StoB(token[1]));
391  mesh->SetPrimitiveScorer(ps);
392  }
393  } else if(command== qPassTrackLengthCmd){
394  if( CheckMeshPS(mesh,token[0],command) ) {
395  G4PSPassageTrackLength* ps = nullptr;
396  if(shape==MeshShape::realWorldLogVol)
397  { ps = new G4PSPassageTrackLength(token[0],mesh->GetCopyNumberLevel()); }
398  else
399  { ps = new G4PSPassageTrackLength3D(token[0]); }
400  ps->Weighted(StoB(token[1]));
401  ps->SetUnit(token[2]);
402  mesh->SetPrimitiveScorer(ps);
403  }
404  } else if(command== qFlatSurfCurrCmd){
405  if( CheckMeshPS(mesh,token[0],command)) {
406  G4PSFlatSurfaceCurrent* ps = nullptr;
407  if(shape==MeshShape::realWorldLogVol)
408  { ps = new G4PSFlatSurfaceCurrent(token[0],StoI(token[1]),mesh->GetCopyNumberLevel()); }
409  else
410  { ps = new G4PSFlatSurfaceCurrent3D(token[0],StoI(token[1])); }
411  ps->Weighted(StoB(token[2]));
412  ps->DivideByArea(StoB(token[3]));
413  if ( StoB(token[3]) ){
414  ps->SetUnit(token[4]);
415  }else{
416  ps->SetUnit("");
417  }
418  mesh->SetPrimitiveScorer(ps);
419  }
420  } else if(command== qFlatSurfFluxCmd){
421  if( CheckMeshPS(mesh, token[0],command )) {
422  G4PSFlatSurfaceFlux* ps = nullptr;
423  if(shape==MeshShape::realWorldLogVol)
424  { ps = new G4PSFlatSurfaceFlux(token[0],StoI(token[1]),mesh->GetCopyNumberLevel()); }
425  else
426  { ps = new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1])); }
427  ps->Weighted(StoB(token[2]));
428  ps->DivideByArea(StoB(token[3]));
429  if ( StoB(token[3]) ){
430  ps->SetUnit(token[4]);
431  }else{
432  ps->SetUnit("");
433  }
434  mesh->SetPrimitiveScorer(ps);
435  }
436 // } else if(command== qSphereSurfCurrCmd){
437 // if( CheckMeshPS(mesh, token[0],command )) {
438 // G4PSSphereSurfaceCurrent3D* ps =
439 // new G4PSSphereSurfaceCurrent3D(token[0],StoI(token[1]));
440 // ps->Weighted(StoB(token[2]));
441 // ps->DivideByArea(StoB(token[3]));
442 // if ( StoB(token[3]) ){
443 // ps->SetUnit(token[4]);
444 // }else{
445 // ps->SetUnit("");
446 // }
447 // mesh->SetPrimitiveScorer(ps);
448 // }
449 // } else if(command== qSphereSurfFluxCmd){
450 // if( CheckMeshPS(mesh,token[0],command)) {
451 // G4PSSphereSurfaceFlux3D* ps = new G4PSSphereSurfaceFlux3D(token[0], StoI(token[1]));
452 // ps->Weighted(StoB(token[2]));
453 // ps->DivideByArea(StoB(token[3]));
454 // if ( StoB(token[3]) ){
455 // ps->SetUnit(token[4]);
456 // }else{
457 // ps->SetUnit("");
458 // }
459 // mesh->SetPrimitiveScorer(ps);
460 // }
461 // } else if(command== qCylSurfCurrCmd){
462 // if( CheckMeshPS(mesh, token[0],command ) ) {
463 // G4PSCylinderSurfaceCurrent3D* ps =
464 // new G4PSCylinderSurfaceCurrent3D(token[0],StoI(token[1]));
465 // ps->Weighted(StoB(token[2]));
466 // ps->DivideByArea(StoB(token[3]));
467 // if ( StoB(token[3]) ){
468 // ps->SetUnit(token[4]);
469 // }else{
470 // ps->SetUnit("");
471 // }
472 // ps->SetUnit(token[4]);
473 // mesh->SetPrimitiveScorer(ps);
474 // }
475 // } else if(command== qCylSurfFluxCmd){
476 // if( CheckMeshPS(mesh, token[0],command ) {
477 // G4PSCylinerSurfaceFlux3D* ps =new G4PSCylinderSurfaceFlux3D(token[0], StoI(token[1]));
478 // ps->Weighted(StoB(token[2]));
479 // ps->DivideByArea(StoB(token[3]));
480 // if ( StoB(token[3]) ){
481 // ps->SetUnit(token[4]);
482 // }else{
483 // ps->SetUnit("");
484 // }
485 // mesh->SetPrimitiveScorer(ps);
486 // }
487  } else if(command== qNofCollisionCmd){
488  if( CheckMeshPS(mesh,token[0],command)) {
489  G4PSNofCollision* ps = nullptr;
490  if(shape==MeshShape::realWorldLogVol)
491  { ps = new G4PSNofCollision3D(token[0],mesh->GetCopyNumberLevel()); }
492  else
493  { ps = new G4PSNofCollision3D(token[0]); }
494  ps->Weighted(StoB(token[1]));
495  mesh->SetPrimitiveScorer(ps);
496  }
497  } else if(command== qPopulationCmd){
498  if( CheckMeshPS(mesh,token[0],command) ) {
499  G4PSPopulation* ps = nullptr;
500  if(shape==MeshShape::realWorldLogVol)
501  { ps = new G4PSPopulation(token[0],mesh->GetCopyNumberLevel()); }
502  else
503  { ps = new G4PSPopulation3D(token[0]); }
504  ps->Weighted(StoB(token[1]));
505  mesh->SetPrimitiveScorer(ps);
506  }
507  } else if(command== qTrackCountCmd){
508  if( CheckMeshPS(mesh,token[0],command)) {
509  G4PSTrackCounter* ps = nullptr;
510  if(shape==MeshShape::realWorldLogVol)
511  { ps = new G4PSTrackCounter(token[0],StoI(token[1]),mesh->GetCopyNumberLevel()); }
512  else
513  { ps = new G4PSTrackCounter3D(token[0],StoI(token[1])); }
514  ps->Weighted(StoB(token[2]));
515  mesh->SetPrimitiveScorer(ps);
516  }
517  } else if(command== qTerminationCmd){
518  if( CheckMeshPS(mesh,token[0],command)) {
519  G4PSTermination* ps = nullptr;
520  if(shape==MeshShape::realWorldLogVol)
521  { ps = new G4PSTermination(token[0],mesh->GetCopyNumberLevel()); }
522  else
523  { ps = new G4PSTermination3D(token[0]); }
524  ps->Weighted(StoB(token[1]));
525  mesh->SetPrimitiveScorer(ps);
526  }
527 
528  } else if(command== qMinKinEAtGeneCmd){
529  if( CheckMeshPS(mesh,token[0],command) ){
530  G4PSMinKinEAtGeneration* ps = nullptr;
531  if(shape==MeshShape::realWorldLogVol)
532  { ps = new G4PSMinKinEAtGeneration(token[0],mesh->GetCopyNumberLevel()); }
533  else
534  { ps = new G4PSMinKinEAtGeneration3D(token[0]); }
535  ps->SetUnit(token[1]);
536  mesh->SetPrimitiveScorer(ps);
537  }
538  } else if(command== qStepCheckerCmd){
539  if( CheckMeshPS(mesh,token[0],command) ){
540  G4PSStepChecker* ps = nullptr;
541  if(shape==MeshShape::realWorldLogVol)
542  { ps = new G4PSStepChecker(token[0],mesh->GetCopyNumberLevel()); }
543  else
544  { ps = new G4PSStepChecker3D(token[0]); }
545  mesh->SetPrimitiveScorer(ps);
546  }
547 
548  //
549  // Filters
550  //
551  }else if(command== fchargedCmd){
552  if(!mesh->IsCurrentPrimitiveScorerNull()) {
553  mesh->SetFilter(new G4SDChargedFilter(token[0]));
554  } else {
555  ed << "WARNING[" << fchargedCmd->GetCommandPath()
556  << "] : Current quantity is not set. Set or touch a quantity first.";
557  command->CommandFailed(ed);
558  }
559  }else if(command== fneutralCmd){
560  if(!mesh->IsCurrentPrimitiveScorerNull()) {
561  mesh->SetFilter(new G4SDNeutralFilter(token[0]));
562  } else {
563  ed << "WARNING[" << fneutralCmd->GetCommandPath()
564  << "] : Current quantity is not set. Set or touch a quantity first.";
565  command->CommandFailed(ed);
566  }
567  }else if(command== fkinECmd){
568  if(!mesh->IsCurrentPrimitiveScorerNull()) {
569  G4String& name = token[0];
570  G4double elow = StoD(token[1]);
571  G4double ehigh = StoD(token[2]);
572  G4double unitVal = G4UnitDefinition::GetValueOf(token[3]);
573  mesh->SetFilter(new G4SDKineticEnergyFilter(name,elow*unitVal,ehigh*unitVal));
574  } else {
575  ed << "WARNING[" << fkinECmd->GetCommandPath()
576  << "] : Current quantity is not set. Set or touch a quantity first.";
577  command->CommandFailed(ed);
578  }
579  }else if(command== fparticleKinECmd){
580  if(!mesh->IsCurrentPrimitiveScorerNull()) {
581  FParticleWithEnergyCommand(mesh,token);
582  } else {
583  ed << "WARNING[" << fparticleKinECmd->GetCommandPath()
584  << "] : Current quantity is not set. Set or touch a quantity first.";
585  command->CommandFailed(ed);
586  }
587  } else if(command==fparticleCmd) {
588  if(!mesh->IsCurrentPrimitiveScorerNull()) {
589  FParticleCommand(mesh,token);
590  } else {
591  ed << "WARNING[" << fparticleCmd->GetCommandPath()
592  << "] : Current quantity is not set. Set or touch a quantity first.";
593  command->CommandFailed(ed);
594  }
595  }
596 }
597 
599 {
600  G4String val;
601 
602  return val;
603 }
604 
606 
607  G4Tokenizer next(newValues);
608  G4String val;
609  while ( !(val = next()).isNull() ) { // Loop checking 12.18.2015 M.Asai
610  token.push_back(val);
611  }
612 }
613 
614 
616  //
617  // Filter name
618  G4String name = token[0];
619  //
620  // particle list
621  std::vector<G4String> pnames;
622  for ( G4int i = 1; i<(G4int)token.size(); i++){
623  pnames.push_back(token[i]);
624  }
625  //
626  // Attach Filter
627  mesh->SetFilter(new G4SDParticleFilter(name,pnames));
628 }
629 
631  G4String& name = token[0];
632  G4double elow = StoD(token[1]);
633  G4double ehigh= StoD(token[2]);
634  G4double unitVal = G4UnitDefinition::GetValueOf(token[3]);
636  new G4SDParticleWithEnergyFilter(name,elow*unitVal,ehigh*unitVal);
637  for ( G4int i = 4; i < (G4int)token.size(); i++){
638  filter->add(token[i]);
639  }
640  mesh->SetFilter(filter);
641 }
642 
644  G4UIcommand* command){
645  if(!mesh->FindPrimitiveScorer(psname)) {
646  return true;
647  } else {
649  ed << "WARNING[" << qTouchCmd->GetCommandPath()
650  << "] : Quantity name, \"" << psname << "\", is already existing.";
651  command->CommandFailed(ed);
653  return false;
654  }
655 }