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.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 /visualization/gMocren/src/G4GMocrenMessenger.cc (Version 11.3.0) and /visualization/gMocren/src/G4GMocrenMessenger.cc (Version 9.2.p4)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 //                                                
 27 //                                                
 28 //                                                
 29 // Created:  Mar. 31, 2009  Akinori Kimura        
 30 //                                                
 31 #include "G4GMocrenMessenger.hh"                  
 32                                                   
 33 #include "G4UIdirectory.hh"                       
 34 #include "G4UIcmdWithABool.hh"                    
 35 #include "G4UIcmdWithAString.hh"                  
 36 #include "G4UIcmdWithoutParameter.hh"             
 37 #include "G4UIcommand.hh"                         
 38 #include "G4Tokenizer.hh"                         
 39                                                   
 40 #include <utility>                                
 41                                                   
 42 G4GMocrenMessenger::G4GMocrenMessenger()          
 43   : suffix (""), geometry(true), pointAttribut    
 44     kgMocrenVolumeName("gMocrenVolume"),          
 45     kgMocrenScoringMeshName("gMocrenScoringMes    
 46     kDrawVolumeGrid(false) {                      
 47                                                   
 48   kgMocrenDirectory = new G4UIdirectory("/vis/    
 49   kgMocrenDirectory->SetGuidance("gMocren comm    
 50                                                   
 51   setEventNumberSuffixCommand = new G4UIcmdWit    
 52   setEventNumberSuffixCommand->SetGuidance("Wr    
 53   setEventNumberSuffixCommand->SetGuidance("De    
 54   setEventNumberSuffixCommand->SetParameterNam    
 55   setEventNumberSuffixCommand->SetDefaultValue    
 56   setEventNumberSuffixCommand->AvailableForSta    
 57                                                   
 58   appendGeometryCommand = new G4UIcmdWithABool    
 59   appendGeometryCommand->SetGuidance("Appends     
 60   appendGeometryCommand->SetParameterName("fla    
 61   appendGeometryCommand->SetDefaultValue(true)    
 62   appendGeometryCommand->AvailableForStates(G4    
 63                                                   
 64   addPointAttributesCommand = new G4UIcmdWithA    
 65   addPointAttributesCommand->SetGuidance("Adds    
 66   addPointAttributesCommand->SetParameterName(    
 67   addPointAttributesCommand->SetDefaultValue(f    
 68   addPointAttributesCommand->AvailableForState    
 69                                                   
 70   useSolidsCommand = new G4UIcmdWithABool("/vi    
 71   useSolidsCommand->SetGuidance("Use GMocren S    
 72   useSolidsCommand->SetParameterName("flag",fa    
 73   useSolidsCommand->SetDefaultValue(true);        
 74   useSolidsCommand->AvailableForStates(G4State    
 75                                                   
 76   /* Not Enabled Yet                              
 77      writeInvisiblesCommand = new G4UIcmdWithA    
 78      writeInvisiblesCommand->SetGuidance("Writ    
 79      writeInvisiblesCommand->SetParameterName(    
 80      writeInvisiblesCommand->SetDefaultValue(t    
 81      writeInvisiblesCommand->AvailableForState    
 82   */                                              
 83                                                   
 84   kSetgMocrenVolumeNameCommand = new G4UIcmdWi    
 85   kSetgMocrenVolumeNameCommand->SetGuidance("d    
 86   kSetgMocrenVolumeNameCommand->SetParameterNa    
 87   kSetgMocrenVolumeNameCommand->SetDefaultValu    
 88   kSetgMocrenVolumeNameCommand->AvailableForSt    
 89                                                   
 90   kAddgMocrenHitNameCommand = new G4UIcmdWithA    
 91   kAddgMocrenHitNameCommand->SetGuidance("hit     
 92   kAddgMocrenHitNameCommand->SetParameterName(    
 93   kAddgMocrenHitNameCommand->AvailableForState    
 94                                                   
 95   kResetgMocrenHitNameCommand = new G4UIcmdWit    
 96   kResetgMocrenHitNameCommand->SetGuidance("re    
 97   kResetgMocrenHitNameCommand->AvailableForSta    
 98                                                   
 99   kSetgMocrenScoringMeshNameCommand = new G4UI    
100   kSetgMocrenScoringMeshNameCommand->SetGuidan    
101   kSetgMocrenScoringMeshNameCommand->SetParame    
102   kSetgMocrenScoringMeshNameCommand->SetDefaul    
103   kSetgMocrenScoringMeshNameCommand->Available    
104                                                   
105   kAddgMocrenHitScorerNameCommand = new G4UIcm    
106   kAddgMocrenHitScorerNameCommand->SetGuidance    
107   kAddgMocrenHitScorerNameCommand->SetParamete    
108   kAddgMocrenHitScorerNameCommand->AvailableFo    
109                                                   
110   kResetgMocrenHitScorerNameCommand = new G4UI    
111   kResetgMocrenHitScorerNameCommand->SetGuidan    
112   kResetgMocrenHitScorerNameCommand->Available    
113                                                   
114   kSetgMocrenNoVoxelsCommand = new G4UIcommand    
115   kSetgMocrenNoVoxelsCommand->SetGuidance("set    
116   kSetgMocrenNoVoxelsCommand->AvailableForStat    
117   G4UIparameter * param = new G4UIparameter("n    
118   param->SetDefaultValue("1");                    
119   param->SetParameterRange("nX>0");               
120   kSetgMocrenNoVoxelsCommand->SetParameter(par    
121   param = new G4UIparameter("nY", 'i', false);    
122   param->SetDefaultValue("1");                    
123   param->SetParameterRange("nY>0");               
124   kSetgMocrenNoVoxelsCommand->SetParameter(par    
125   param = new G4UIparameter("nZ", 'i', false);    
126   param->SetDefaultValue("1");                    
127   param->SetParameterRange("nZ>0");               
128   kSetgMocrenNoVoxelsCommand->SetParameter(par    
129                                                   
130   kListgMocrenCommand = new G4UIcmdWithoutPara    
131   kListgMocrenCommand->SetGuidance("list gMocr    
132   kListgMocrenCommand->AvailableForStates(G4St    
133                                                   
134   kDrawVolumeGridCommand = new G4UIcmdWithABoo    
135   kDrawVolumeGridCommand->SetGuidance("Add gri    
136   kDrawVolumeGridCommand->SetParameterName("kD    
137   kDrawVolumeGridCommand->SetDefaultValue(fals    
138   kDrawVolumeGridCommand->AvailableForStates(G    
139                                                   
140 }                                                 
141                                                   
142 G4GMocrenMessenger::~G4GMocrenMessenger() {       
143   delete setEventNumberSuffixCommand;             
144   delete appendGeometryCommand;                   
145   delete addPointAttributesCommand;               
146   delete useSolidsCommand;                        
147   //    delete writeInvisiblesCommand;            
148   delete kSetgMocrenVolumeNameCommand;            
149   delete kAddgMocrenHitNameCommand;               
150   delete kResetgMocrenHitNameCommand;             
151   //                                              
152   delete kSetgMocrenScoringMeshNameCommand;       
153   delete kAddgMocrenHitScorerNameCommand;         
154   delete kResetgMocrenHitScorerNameCommand;       
155   //                                              
156   delete kSetgMocrenNoVoxelsCommand;              
157   //                                              
158   delete kgMocrenDirectory;                       
159   //                                              
160   delete kDrawVolumeGridCommand;                  
161 }                                                 
162                                                   
163 G4String G4GMocrenMessenger::GetCurrentValue(G    
164   if (command==setEventNumberSuffixCommand) {     
165     return suffix;                                
166   } else if (command==appendGeometryCommand) {    
167     return appendGeometryCommand->ConvertToStr    
168   } else if (command==addPointAttributesComman    
169     return addPointAttributesCommand->ConvertT    
170   } else if (command==useSolidsCommand) {         
171     return useSolidsCommand->ConvertToString(s    
172     //    } else if (command==writeInvisiblesC    
173     //        return writeInvisiblesCommand->C    
174   } else if (command == kSetgMocrenVolumeNameC    
175     return kgMocrenVolumeName;                    
176   } else if (command == kAddgMocrenHitNameComm    
177     G4String strval;                              
178     std::vector<G4String>::iterator itr = kgMo    
179     for(; itr != kgMocrenHitNames.end(); itr++    
180       strval += *itr;                             
181       strval += " ";                              
182     }                                             
183     return strval;                                
184   } else if (command == kSetgMocrenScoringMesh    
185     return kgMocrenScoringMeshName;               
186   } else if (command == kAddgMocrenHitScorerNa    
187     G4String strval;                              
188     std::vector<G4String>::iterator itr = kgMo    
189     for(; itr != kgMocrenHitScorerNames.end();    
190       strval += *itr;                             
191       strval += " ";                              
192     }                                             
193     return strval;                                
194   } else if (command==kDrawVolumeGridCommand)     
195     return kDrawVolumeGridCommand->ConvertToSt    
196   } else {                                        
197     return "";                                    
198   }                                               
199 }                                                 
200                                                   
201 void G4GMocrenMessenger::SetNewValue(G4UIcomma    
202   if (command==setEventNumberSuffixCommand) {     
203     suffix = std::move(newValue);                 
204   } else if (command==appendGeometryCommand) {    
205     geometry = appendGeometryCommand->GetNewBo    
206   } else if (command==addPointAttributesComman    
207     pointAttributes = addPointAttributesComman    
208   } else if (command==useSolidsCommand) {         
209     solids = useSolidsCommand->GetNewBoolValue    
210     //    } else if (command==writeInvisiblesC    
211     //        invisibles = writeInvisiblesComm    
212   } else if (command == kSetgMocrenVolumeNameC    
213     kgMocrenVolumeName = std::move(newValue);     
214   } else if (command == kAddgMocrenHitNameComm    
215     kgMocrenHitNames.push_back(std::move(newVa    
216   } else if (command == kResetgMocrenHitNameCo    
217     kgMocrenHitNames.clear();                     
218   } else if (command == kSetgMocrenScoringMesh    
219     kgMocrenScoringMeshName = std::move(newVal    
220   } else if (command == kAddgMocrenHitScorerNa    
221     kgMocrenHitScorerNames.push_back(std::move    
222   } else if (command == kResetgMocrenHitScorer    
223     kgMocrenHitScorerNames.clear();               
224   } else if (command == kListgMocrenCommand) {    
225     list();                                       
226   } else if (command == kSetgMocrenNoVoxelsCom    
227     G4Tokenizer next(newValue);                   
228     for(int i = 0; i < 3; i++) {                  
229       kgMocrenNoVoxels[i] = StoI(next());         
230     }                                             
231   } else if (command==kDrawVolumeGridCommand)     
232     kDrawVolumeGrid = kDrawVolumeGridCommand->    
233   }                                               
234 }                                                 
235                                                   
236 G4String G4GMocrenMessenger::getEventNumberSuf    
237   return suffix;                                  
238 }                                                 
239                                                   
240 G4bool G4GMocrenMessenger::appendGeometry() {     
241   return geometry;                                
242 }                                                 
243                                                   
244 G4bool G4GMocrenMessenger::addPointAttributes(    
245   return pointAttributes;                         
246 }                                                 
247                                                   
248 G4bool G4GMocrenMessenger::useSolids() {          
249   return solids;                                  
250 }                                                 
251                                                   
252 G4bool G4GMocrenMessenger::writeInvisibles() {    
253   return invisibles;                              
254 }                                                 
255                                                   
256 G4String G4GMocrenMessenger::getVolumeName() {    
257   return kgMocrenVolumeName;                      
258 }                                                 
259                                                   
260 std::vector<G4String> G4GMocrenMessenger::getH    
261   return kgMocrenHitNames;                        
262 }                                                 
263                                                   
264 G4String G4GMocrenMessenger::getScoringMeshNam    
265   return kgMocrenScoringMeshName;                 
266 }                                                 
267                                                   
268 std::vector<G4String> G4GMocrenMessenger::getH    
269   return kgMocrenHitScorerNames;                  
270 }                                                 
271                                                   
272 void G4GMocrenMessenger::list() {                 
273   G4cout << "  Current valuess of gMocren comm    
274   //                                              
275   G4cout << "    volume name:        " << kgMo    
276   //                                              
277   G4cout << "    hit names:          ";           
278   if(kgMocrenHitNames.size() > 0) {               
279     std::vector<G4String>::iterator itr = kgMo    
280     for(; itr != kgMocrenHitNames.end(); itr++    
281       G4cout << *itr << "  " << G4endl;           
282   } else {                                        
283     G4cout << G4endl;                             
284   }                                               
285   //                                              
286   G4cout << "    scoring mesh name:  " << kgMo    
287   //                                              
288   G4cout << "    scorer names:       ";           
289   if(kgMocrenHitScorerNames.size() > 0) {         
290     std::vector<G4String>::iterator itr = kgMo    
291     for(; itr != kgMocrenHitScorerNames.end();    
292       G4cout << *itr << "  " << G4endl;           
293   } else {                                        
294     G4cout << G4endl;                             
295   }                                               
296   G4cout << G4endl;                               
297 }                                                 
298                                                   
299 void G4GMocrenMessenger::getNoVoxels(G4int & n    
300   nx = kgMocrenNoVoxels[0];                       
301   ny = kgMocrenNoVoxels[1];                       
302   nz = kgMocrenNoVoxels[2];                       
303 }                                                 
304