Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/gorad/src/GRDetectorConstructionMessenger.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/gorad/src/GRDetectorConstructionMessenger.cc (Version 11.3.0) and /examples/advanced/gorad/src/GRDetectorConstructionMessenger.cc (Version 11.0.p2)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //  Gorad (Geant4 Open-source Radiation Analys     26 //  Gorad (Geant4 Open-source Radiation Analysis and Design)
 27 //                                                 27 //
 28 //  Author : Makoto Asai (SLAC National Accele     28 //  Author : Makoto Asai (SLAC National Accelerator Laboratory)
 29 //                                                 29 //
 30 //  Development of Gorad is funded by NASA Joh     30 //  Development of Gorad is funded by NASA Johnson Space Center (JSC)
 31 //  under the contract NNJ15HK11B.                 31 //  under the contract NNJ15HK11B.
 32 //                                                 32 //
 33 // *******************************************     33 // ********************************************************************
 34 //                                                 34 //
 35 // GRDetectorConstructionMessenger.cc              35 // GRDetectorConstructionMessenger.cc
 36 //   A messenger class that handles geometry c     36 //   A messenger class that handles geometry configuration.
 37 //                                                 37 //
 38 // History                                         38 // History
 39 //   September 8th, 2020 : first implementatio     39 //   September 8th, 2020 : first implementation
 40 //                                                 40 //
 41 // *******************************************     41 // ********************************************************************
 42                                                    42 
 43 #include "GRDetectorConstructionMessenger.hh"      43 #include "GRDetectorConstructionMessenger.hh"
 44                                                    44 
 45 #include "GRDetectorConstruction.hh"               45 #include "GRDetectorConstruction.hh"
 46 #include "G4UIcommand.hh"                          46 #include "G4UIcommand.hh"
 47 #include "G4UIparameter.hh"                        47 #include "G4UIparameter.hh"
 48 #include "G4UIdirectory.hh"                        48 #include "G4UIdirectory.hh"
 49 #include "G4UIcmdWithAString.hh"                   49 #include "G4UIcmdWithAString.hh"
 50 #include "G4UIcmdWithAnInteger.hh"                 50 #include "G4UIcmdWithAnInteger.hh"
 51 #include "G4UIcmdWithoutParameter.hh"              51 #include "G4UIcmdWithoutParameter.hh"
 52                                                    52 
 53 GRDetectorConstructionMessenger::GRDetectorCon     53 GRDetectorConstructionMessenger::GRDetectorConstructionMessenger(GRDetectorConstruction* dc)
 54 : pDC(dc)                                          54 : pDC(dc)
 55 {                                                  55 {
 56   G4UIparameter* para = nullptr;                   56   G4UIparameter* para = nullptr;
 57                                                    57 
 58   geomDir = new G4UIdirectory("/gorad/geometry     58   geomDir = new G4UIdirectory("/gorad/geometry/");
 59   geomDir->SetGuidance("GORAD geometry selecti     59   geomDir->SetGuidance("GORAD geometry selection");
 60                                                    60 
 61   selectCmd = new G4UIcmdWithAString("/gorad/g     61   selectCmd = new G4UIcmdWithAString("/gorad/geometry/selectGDML",this);
 62   selectCmd->SetGuidance("Select GDML file");      62   selectCmd->SetGuidance("Select GDML file");
 63   selectCmd->SetParameterName("gdml",false);       63   selectCmd->SetParameterName("gdml",false);
 64   selectCmd->AvailableForStates(G4State_PreIni     64   selectCmd->AvailableForStates(G4State_PreInit);
 65   selectCmd->SetToBeBroadcasted(false);            65   selectCmd->SetToBeBroadcasted(false);
 66                                                    66 
 67   listSolidCmd = new G4UIcmdWithAnInteger("/go     67   listSolidCmd = new G4UIcmdWithAnInteger("/gorad/geometry/listSolids",this);
 68   listSolidCmd->SetGuidance("List all the regi     68   listSolidCmd->SetGuidance("List all the registered solids");
 69   listSolidCmd->SetParameterName("level",true)     69   listSolidCmd->SetParameterName("level",true);
 70   listSolidCmd->SetDefaultValue(0);                70   listSolidCmd->SetDefaultValue(0);
 71   listSolidCmd->SetRange("level>=0 && level<=2     71   listSolidCmd->SetRange("level>=0 && level<=2");
 72   listSolidCmd->AvailableForStates(G4State_Idl     72   listSolidCmd->AvailableForStates(G4State_Idle);
 73   listSolidCmd->SetToBeBroadcasted(false);         73   listSolidCmd->SetToBeBroadcasted(false);
 74                                                    74 
 75   listLogVolCmd = new G4UIcmdWithAnInteger("/g     75   listLogVolCmd = new G4UIcmdWithAnInteger("/gorad/geometry/listLogicalVolumes",this);
 76   listLogVolCmd->SetGuidance("List all the reg     76   listLogVolCmd->SetGuidance("List all the registered logical volumes");
 77   listLogVolCmd->SetParameterName("level",true     77   listLogVolCmd->SetParameterName("level",true);
 78   listLogVolCmd->SetDefaultValue(0);               78   listLogVolCmd->SetDefaultValue(0);
 79   listLogVolCmd->SetRange("level>=0 && level<=     79   listLogVolCmd->SetRange("level>=0 && level<=2");
 80   listLogVolCmd->AvailableForStates(G4State_Id     80   listLogVolCmd->AvailableForStates(G4State_Idle);
 81   listLogVolCmd->SetToBeBroadcasted(false);        81   listLogVolCmd->SetToBeBroadcasted(false);
 82                                                    82 
 83   listPhysVolCmd = new G4UIcmdWithAnInteger("/     83   listPhysVolCmd = new G4UIcmdWithAnInteger("/gorad/geometry/listPhysicalVolumes",this);
 84   listPhysVolCmd->SetGuidance("List all the re     84   listPhysVolCmd->SetGuidance("List all the registered physical volumes");
 85   listPhysVolCmd->SetParameterName("level",tru     85   listPhysVolCmd->SetParameterName("level",true);
 86   listPhysVolCmd->SetDefaultValue(0);              86   listPhysVolCmd->SetDefaultValue(0);
 87   listPhysVolCmd->SetRange("level>=0 && level<     87   listPhysVolCmd->SetRange("level>=0 && level<=2");
 88   listPhysVolCmd->AvailableForStates(G4State_I     88   listPhysVolCmd->AvailableForStates(G4State_Idle);
 89   listPhysVolCmd->SetToBeBroadcasted(false);       89   listPhysVolCmd->SetToBeBroadcasted(false);
 90                                                    90 
 91   listRegionCmd = new G4UIcmdWithAnInteger("/g     91   listRegionCmd = new G4UIcmdWithAnInteger("/gorad/geometry/listRegions",this);
 92   listRegionCmd->SetGuidance("List all the reg     92   listRegionCmd->SetGuidance("List all the registered regions");
 93   listRegionCmd->SetParameterName("level",true     93   listRegionCmd->SetParameterName("level",true);
 94   listRegionCmd->SetDefaultValue(0);               94   listRegionCmd->SetDefaultValue(0);
 95   listRegionCmd->SetRange("level>=0 && level<=     95   listRegionCmd->SetRange("level>=0 && level<=2");
 96   listRegionCmd->AvailableForStates(G4State_Id     96   listRegionCmd->AvailableForStates(G4State_Idle);
 97   listRegionCmd->SetToBeBroadcasted(false);        97   listRegionCmd->SetToBeBroadcasted(false);
 98                                                    98 
 99   createRegionCmd = new G4UIcommand("/gorad/ge     99   createRegionCmd = new G4UIcommand("/gorad/geometry/createRegion",this);
100   createRegionCmd->SetGuidance("Create a regio    100   createRegionCmd->SetGuidance("Create a region and set the root logical volume to it.");
101   createRegionCmd->SetGuidance("Region propaga    101   createRegionCmd->SetGuidance("Region propagates to the daughter volumes. So, only the root logical volume (i.e. top of the hierarchy) should be defined.");
102   createRegionCmd->SetGuidance("If two isolate    102   createRegionCmd->SetGuidance("If two isolated root logical volumes should share the same region, the same region name can be used.");
103   createRegionCmd->SetGuidance("Region must no    103   createRegionCmd->SetGuidance("Region must not be set to the world volume.");
104   para = new G4UIparameter("regionName",'s',fa    104   para = new G4UIparameter("regionName",'s',false);
105   para->SetGuidance("Name of the region to be     105   para->SetGuidance("Name of the region to be created");
106   createRegionCmd->SetParameter(para);            106   createRegionCmd->SetParameter(para);
107   para = new G4UIparameter("logVolName",'s',fa    107   para = new G4UIparameter("logVolName",'s',false);
108   para->SetGuidance("Name of the root logical     108   para->SetGuidance("Name of the root logical volume");
109   createRegionCmd->SetParameter(para);            109   createRegionCmd->SetParameter(para);
110   createRegionCmd->AvailableForStates(G4State_    110   createRegionCmd->AvailableForStates(G4State_Idle);
111   createRegionCmd->SetToBeBroadcasted(false);     111   createRegionCmd->SetToBeBroadcasted(false);
112                                                   112 
113   //// This command is fragile for large-scale    113   //// This command is fragile for large-scale geometry - temporally disabled
114   ////checkOverlapCmd = new G4UIcommand("/gora    114   ////checkOverlapCmd = new G4UIcommand("/gorad/geometry/checkOverlap",this);
115   ////checkOverlapCmd->SetGuidance("Check volu    115   ////checkOverlapCmd->SetGuidance("Check volume overlap with existing volumes");
116   ////checkOverlapCmd->SetGuidance(" i.e. with    116   ////checkOverlapCmd->SetGuidance(" i.e. with mother volume for protrusion and with other siblings for overlap.");
117   ////checkOverlapCmd->SetGuidance(" - This co    117   ////checkOverlapCmd->SetGuidance(" - This command is valid only for placement and parameterized volumes. If this command is");
118   ////checkOverlapCmd->SetGuidance("   used fo    118   ////checkOverlapCmd->SetGuidance("   used for other physical volume type, e.g. replica, command will be simply ignored.");
119   ////checkOverlapCmd->SetGuidance("   If \"**    119   ////checkOverlapCmd->SetGuidance("   If \"**ALL**\" is used as the volume name, all physical volumes are examined (SLOW!!).");
120   ////checkOverlapCmd->SetGuidance(" - nSpots     120   ////checkOverlapCmd->SetGuidance(" - nSpots specifies number of spots on the surface of the volume to be examined.");
121   ////checkOverlapCmd->SetGuidance("   The mor    121   ////checkOverlapCmd->SetGuidance("   The more spots used, the more chances to detect overlaps, but the more time it takes.");
122   ////checkOverlapCmd->SetGuidance(" - maxErr     122   ////checkOverlapCmd->SetGuidance(" - maxErr specifies maximum number of errors to be generated (default 1) before quiting.");
123   ////para = new G4UIparameter("physVol",'s',t    123   ////para = new G4UIparameter("physVol",'s',true);
124   ////para->SetDefaultValue("**ALL**");           124   ////para->SetDefaultValue("**ALL**");
125   ////checkOverlapCmd->SetParameter(para);        125   ////checkOverlapCmd->SetParameter(para);
126   ////para = new G4UIparameter("nSpots",'i',tr    126   ////para = new G4UIparameter("nSpots",'i',true);
127   ////para->SetDefaultValue(1000);                127   ////para->SetDefaultValue(1000);
128   ////para->SetGuidance("Number of trial spots    128   ////para->SetGuidance("Number of trial spots on the volume surface");
129   ////checkOverlapCmd->SetParameter(para);        129   ////checkOverlapCmd->SetParameter(para);
130   ////para = new G4UIparameter("maxErr",'i',tr    130   ////para = new G4UIparameter("maxErr",'i',true);
131   ////para->SetDefaultValue(1);                   131   ////para->SetDefaultValue(1);
132   ////para->SetParameterRange("maxErr > 0");      132   ////para->SetParameterRange("maxErr > 0");
133   ////para->SetGuidance("Maxinum number of rep    133   ////para->SetGuidance("Maxinum number of report to be generated");
134   ////checkOverlapCmd->SetParameter(para);        134   ////checkOverlapCmd->SetParameter(para);
135   ////para = new G4UIparameter("tolerance",'d'    135   ////para = new G4UIparameter("tolerance",'d',true);
136   ////para->SetDefaultValue(0.);                  136   ////para->SetDefaultValue(0.);
137   ////para->SetParameterRange("tolerance >= 0.    137   ////para->SetParameterRange("tolerance >= 0.");
138   ////para->SetGuidance("Tolerance (default 0.    138   ////para->SetGuidance("Tolerance (default 0.)");
139   ////checkOverlapCmd->SetParameter(para);        139   ////checkOverlapCmd->SetParameter(para);
140   ////para = new G4UIparameter("unit",'s',true    140   ////para = new G4UIparameter("unit",'s',true);
141   ////para->SetDefaultUnit("mm");                 141   ////para->SetDefaultUnit("mm");
142   ////checkOverlapCmd->SetParameter(para);        142   ////checkOverlapCmd->SetParameter(para);
143   ////checkOverlapCmd->AvailableForStates(G4St    143   ////checkOverlapCmd->AvailableForStates(G4State_Idle);
144   ////checkOverlapCmd->SetToBeBroadcasted(fals    144   ////checkOverlapCmd->SetToBeBroadcasted(false);
145                                                   145   
146   materialDir = new G4UIdirectory("/gorad/mate    146   materialDir = new G4UIdirectory("/gorad/material/");
147   materialDir->SetGuidance("GORAD material com    147   materialDir->SetGuidance("GORAD material commands");
148                                                   148 
149   listMatCmd = new G4UIcmdWithAString("/gorad/    149   listMatCmd = new G4UIcmdWithAString("/gorad/material/list",this);
150   listMatCmd->SetGuidance("List material prope    150   listMatCmd->SetGuidance("List material property");
151   listMatCmd->SetGuidance(" If material name i    151   listMatCmd->SetGuidance(" If material name is not specified, this command list all registered materials");
152   listMatCmd->SetParameterName("matName",true)    152   listMatCmd->SetParameterName("matName",true);
153   listMatCmd->SetDefaultValue("**ALL**");         153   listMatCmd->SetDefaultValue("**ALL**");
154   listMatCmd->AvailableForStates(G4State_Idle)    154   listMatCmd->AvailableForStates(G4State_Idle);
155   listMatCmd->SetToBeBroadcasted(false);          155   listMatCmd->SetToBeBroadcasted(false);
156                                                   156 
157   dumpMatCmd = new G4UIcmdWithoutParameter("/g    157   dumpMatCmd = new G4UIcmdWithoutParameter("/gorad/material/dumpNistMaterials",this);
158   dumpMatCmd->SetGuidance("List all pre-define    158   dumpMatCmd->SetGuidance("List all pre-defined material names in G4NistManager.");
159   dumpMatCmd->SetGuidance(" Note : a material     159   dumpMatCmd->SetGuidance(" Note : a material has to be instantiated with /gorad/material/create before setting it to a logical volume");
160   dumpMatCmd->AvailableForStates(G4State_Idle)    160   dumpMatCmd->AvailableForStates(G4State_Idle);
161   dumpMatCmd->SetToBeBroadcasted(false);          161   dumpMatCmd->SetToBeBroadcasted(false);
162                                                   162 
163   createMatCmd = new G4UIcmdWithAString("/gora    163   createMatCmd = new G4UIcmdWithAString("/gorad/material/create",this);
164   createMatCmd->SetGuidance("Instantiate a mat    164   createMatCmd->SetGuidance("Instantiate a material defined in G4NistManager");
165   createMatCmd->SetGuidance(" If the material     165   createMatCmd->SetGuidance(" If the material has already existed, this command does nothing.");
166   createMatCmd->SetParameterName("matName",fal    166   createMatCmd->SetParameterName("matName",false);
167   createMatCmd->AvailableForStates(G4State_Idl    167   createMatCmd->AvailableForStates(G4State_Idle);
168   createMatCmd->SetToBeBroadcasted(false);        168   createMatCmd->SetToBeBroadcasted(false);
169                                                   169 
170   getMatCmd = new G4UIcmdWithAString("/gorad/m    170   getMatCmd = new G4UIcmdWithAString("/gorad/material/show",this); 
171   getMatCmd->SetGuidance("Show the current mat    171   getMatCmd->SetGuidance("Show the current material of the specified logical volume");
172   getMatCmd->SetParameterName("logVol",false);    172   getMatCmd->SetParameterName("logVol",false);
173   getMatCmd->AvailableForStates(G4State_Idle);    173   getMatCmd->AvailableForStates(G4State_Idle);
174   getMatCmd->SetToBeBroadcasted(false);           174   getMatCmd->SetToBeBroadcasted(false);
175                                                   175 
176   setMatCmd = new G4UIcommand("/gorad/material    176   setMatCmd = new G4UIcommand("/gorad/material/set",this);
177   setMatCmd->SetGuidance("Set the material to     177   setMatCmd->SetGuidance("Set the material to the logical volume. The material has to be instantiated in advance.");
178   setMatCmd->SetGuidance("  [usage] /gorad/mat    178   setMatCmd->SetGuidance("  [usage] /gorad/material/set logicalVolumeName materialName");
179   para = new G4UIparameter("logVol",'s',false)    179   para = new G4UIparameter("logVol",'s',false);
180   setMatCmd->SetParameter(para);                  180   setMatCmd->SetParameter(para);
181   para = new G4UIparameter("matName",'s',false    181   para = new G4UIparameter("matName",'s',false);
182   setMatCmd->SetParameter(para);                  182   setMatCmd->SetParameter(para);
183   setMatCmd->AvailableForStates(G4State_Idle);    183   setMatCmd->AvailableForStates(G4State_Idle);
184   setMatCmd->SetToBeBroadcasted(false);           184   setMatCmd->SetToBeBroadcasted(false);
185 }                                                 185 }
186                                                   186 
187 GRDetectorConstructionMessenger::~GRDetectorCo    187 GRDetectorConstructionMessenger::~GRDetectorConstructionMessenger()
188 {                                                 188 {
189   delete selectCmd;                               189   delete selectCmd;
190   delete listSolidCmd;                            190   delete listSolidCmd;
191   delete listLogVolCmd;                           191   delete listLogVolCmd;
192   delete listPhysVolCmd;                          192   delete listPhysVolCmd;
193   delete listRegionCmd;                           193   delete listRegionCmd;
194   delete createRegionCmd;                         194   delete createRegionCmd;
195   ////delete checkOverlapCmd;                     195   ////delete checkOverlapCmd;
196   delete geomDir;                                 196   delete geomDir;
197                                                   197 
198   delete listMatCmd;                              198   delete listMatCmd;
199   delete dumpMatCmd;                              199   delete dumpMatCmd;
200   delete createMatCmd;                            200   delete createMatCmd;
201   delete getMatCmd;                               201   delete getMatCmd;
202   delete setMatCmd;                               202   delete setMatCmd;
203   delete materialDir;                             203   delete materialDir;
204 }                                                 204 }
205                                                   205 
206 #include "G4Tokenizer.hh"                         206 #include "G4Tokenizer.hh"
207                                                   207 
208 void GRDetectorConstructionMessenger::SetNewVa    208 void GRDetectorConstructionMessenger::SetNewValue(G4UIcommand* cmd, G4String val)
209 {                                                 209 {
210   if(cmd==selectCmd)                              210   if(cmd==selectCmd)
211   {                                               211   {
212     auto valid = pDC->SetGDMLFile(val);           212     auto valid = pDC->SetGDMLFile(val);
213     if(!valid)                                    213     if(!valid)
214     {                                             214     {
215       G4ExceptionDescription ed;                  215       G4ExceptionDescription ed;
216       ed << "<" << val << "> is not a valid GD    216       ed << "<" << val << "> is not a valid GDML file.";
217       cmd->CommandFailed(ed);                     217       cmd->CommandFailed(ed);
218     }                                             218     }
219   }                                               219   }
220   else if(cmd==listSolidCmd)                      220   else if(cmd==listSolidCmd)
221   { pDC->ListSolids(listSolidCmd->GetNewIntVal    221   { pDC->ListSolids(listSolidCmd->GetNewIntValue(val)); }
222   else if(cmd==listLogVolCmd)                     222   else if(cmd==listLogVolCmd)
223   { pDC->ListLogVols(listLogVolCmd->GetNewIntV    223   { pDC->ListLogVols(listLogVolCmd->GetNewIntValue(val)); }
224   else if(cmd==listPhysVolCmd)                    224   else if(cmd==listPhysVolCmd)
225   { pDC->ListPhysVols(listPhysVolCmd->GetNewIn    225   { pDC->ListPhysVols(listPhysVolCmd->GetNewIntValue(val)); }
226   else if(cmd==listRegionCmd)                     226   else if(cmd==listRegionCmd)
227   { pDC->ListRegions(listRegionCmd->GetNewIntV    227   { pDC->ListRegions(listRegionCmd->GetNewIntValue(val)); }
228   else if(cmd==createRegionCmd)                   228   else if(cmd==createRegionCmd)
229   {                                               229   {
230     G4Tokenizer next(val);                        230     G4Tokenizer next(val);
231     G4String regionName = next();                 231     G4String regionName = next();
232     G4String logVolName = next();                 232     G4String logVolName = next();
233     auto valid = pDC->CreateRegion(regionName,    233     auto valid = pDC->CreateRegion(regionName,logVolName);
234     if(!valid)                                    234     if(!valid)
235     {                                             235     {
236       G4ExceptionDescription ed;                  236       G4ExceptionDescription ed;
237       ed << "Logical volume <" << logVolName <    237       ed << "Logical volume <" << logVolName << "> is not defined. Command ignored.";
238       cmd->CommandFailed(ed);                     238       cmd->CommandFailed(ed);
239     }                                             239     }
240   }                                               240   }
241   ////else if(cmd==checkOverlapCmd)               241   ////else if(cmd==checkOverlapCmd)
242   ////{                                           242   ////{
243     ////G4Tokenizer next(val);                    243     ////G4Tokenizer next(val);
244     ////G4String physVolName = next();            244     ////G4String physVolName = next();
245     ////G4int nSpots = StoI(next());              245     ////G4int nSpots = StoI(next());
246     ////G4int maxErr = StoI(next());              246     ////G4int maxErr = StoI(next());
247     ////G4String tolStr = next();                 247     ////G4String tolStr = next();
248     ////G4double tol = StoD(tolStr);              248     ////G4double tol = StoD(tolStr);
249     ////if(tol>0.)                                249     ////if(tol>0.)
250     ////{                                         250     ////{
251       ////tolStr += " ";                          251       ////tolStr += " ";
252       ////tolStr += next();                       252       ////tolStr += next();
253       ////tol = checkOverlapCmd->ConvertToDime    253       ////tol = checkOverlapCmd->ConvertToDimensionedDouble(tolStr);
254     ////}                                         254     ////}
255     ////auto valid = pDC->CheckOverlap(physVol    255     ////auto valid = pDC->CheckOverlap(physVolName,nSpots,maxErr,tol);
256     ////if(!valid)                                256     ////if(!valid)
257     ////{                                         257     ////{
258       ////G4ExceptionDescription ed;              258       ////G4ExceptionDescription ed;
259       ////ed << "Physical volume <" << physVol    259       ////ed << "Physical volume <" << physVolName << "> is not defined. Command ignored.";
260       ////cmd->CommandFailed(ed);                 260       ////cmd->CommandFailed(ed);
261     ////}                                         261     ////}
262   ////}                                           262   ////}
263                                                   263 
264   else if(cmd==listMatCmd)                        264   else if(cmd==listMatCmd)
265   {                                               265   { 
266     if(val=="**ALL**")                            266     if(val=="**ALL**") 
267     { pDC->ListAllMaterial(); }                   267     { pDC->ListAllMaterial(); }
268     else                                          268     else
269     {                                             269     {
270       auto valid = pDC->ListMaterial(val);        270       auto valid = pDC->ListMaterial(val);
271       if(!valid)                                  271       if(!valid)
272       {                                           272       {
273         G4ExceptionDescription ed;                273         G4ExceptionDescription ed;
274         ed << "<" << val << "> is not defined.    274         ed << "<" << val << "> is not defined. If necessary, create it with /gorad/material/create command.";
275         cmd->CommandFailed(ed);                   275         cmd->CommandFailed(ed);
276       }                                           276       }
277     }                                             277     }
278   }                                               278   }
279   else if(cmd==dumpMatCmd)                        279   else if(cmd==dumpMatCmd)
280   { pDC->DumpNistMaterials(); }                   280   { pDC->DumpNistMaterials(); }
281   else if(cmd==createMatCmd)                      281   else if(cmd==createMatCmd)
282   {                                               282   { 
283     auto valid = pDC->CreateMaterial(val);        283     auto valid = pDC->CreateMaterial(val); 
284     if(!valid)                                    284     if(!valid)
285     {                                             285     {
286       G4ExceptionDescription ed;                  286       G4ExceptionDescription ed;
287       ed << "The material name <" << val << ">    287       ed << "The material name <" << val << "> is not defined in G4NistManager.";
288       cmd->CommandFailed(ed);                     288       cmd->CommandFailed(ed);
289     }                                             289     }
290   }                                               290   }
291   else if(cmd==getMatCmd)                         291   else if(cmd==getMatCmd)
292   {                                               292   {
293     auto valid = pDC->GetMaterial(val);           293     auto valid = pDC->GetMaterial(val);
294     if(!valid)                                    294     if(!valid)
295     {                                             295     {
296       G4ExceptionDescription ed;                  296       G4ExceptionDescription ed;
297       ed << "<" << val << "> is not a name of     297       ed << "<" << val << "> is not a name of registered logical volume.\n"
298          << "Check existing logical volumes wi    298          << "Check existing logical volumes with /gorad/geometry/listLogicalVolumes command.";
299       cmd->CommandFailed(ed);                     299       cmd->CommandFailed(ed);
300     }                                             300     }
301   }                                               301   }
302   else if(cmd==setMatCmd)                         302   else if(cmd==setMatCmd)
303   {                                               303   {
304     G4Tokenizer next(val);                        304     G4Tokenizer next(val);
305     G4String logVolName = next();                 305     G4String logVolName = next();
306     G4String matName = next();                    306     G4String matName = next();
307     auto valid = pDC->SetMaterial(logVolName,m    307     auto valid = pDC->SetMaterial(logVolName,matName);
308     if(valid!=0)                                  308     if(valid!=0)
309     {                                             309     {
310       G4ExceptionDescription ed;                  310       G4ExceptionDescription ed;
311       if(valid==1 || valid==3)                    311       if(valid==1 || valid==3)
312       {                                           312       {
313         ed << "<" << logVolName << "> is not a    313         ed << "<" << logVolName << "> is not a name of registered logical volume.\n"
314            << "Check existing logical volumes     314            << "Check existing logical volumes with /gorad/geometry/listLogicalVolumes command.\n";
315       }                                           315       }
316       if(valid==2 || valid==3)                    316       if(valid==2 || valid==3)
317       {                                           317       {
318         ed << "<" << matName << "> is not defi    318         ed << "<" << matName << "> is not defined. If necessary, create it with /gorad/material/create command.";
319       }                                           319       }
320       cmd->CommandFailed(ed);                     320       cmd->CommandFailed(ed);
321     }                                             321     }
322   }                                               322   }
323                                                   323 
324 }                                                 324 }
325                                                   325 
326 G4String GRDetectorConstructionMessenger::GetC    326 G4String GRDetectorConstructionMessenger::GetCurrentValue(G4UIcommand* cmd)
327 {                                                 327 {
328   G4String val("");                               328   G4String val("");
329   if(cmd==selectCmd)                              329   if(cmd==selectCmd)
330   { val = pDC->GetGDMLFile(); }                   330   { val = pDC->GetGDMLFile(); }
331   return val;                                     331   return val;
332 }                                                 332 }
333                                                   333 
334                                                   334 
335                                                   335