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] [ 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 /processes/electromagnetic/utils/src/G4OpticalParametersMessenger.cc (Version 11.3.0) and /processes/electromagnetic/utils/src/G4OpticalParametersMessenger.cc (Version 9.2)


  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 // ClassName:   G4OpticalParametersMessenger      
 30 //                                                
 31 // Author:      P.Gumplinger 30.09.2009 //        
 32 //                                                
 33 // Modified:    P.Gumplinger 29.09.2011           
 34 //              (based on code from I. Hrivnac    
 35 //                                                
 36 //--------------------------------------------    
 37 //                                                
 38                                                   
 39 #include "G4OpticalParametersMessenger.hh"        
 40 #include "G4OpticalParameters.hh"                 
 41                                                   
 42 #include "G4UIcommand.hh"                         
 43 #include "G4UIdirectory.hh"                       
 44 #include "G4UIcmdWithABool.hh"                    
 45 #include "G4UIcmdWithAString.hh"                  
 46 #include "G4UIcmdWithADouble.hh"                  
 47 #include "G4UIcmdWithAnInteger.hh"                
 48 #include "G4UIcmdWithADoubleAndUnit.hh"           
 49 #include "G4UImanager.hh"                         
 50 #include "G4UIparameter.hh"                       
 51                                                   
 52 //....oooOO0OOooo........oooOO0OOooo........oo    
 53                                                   
 54 G4OpticalParametersMessenger::G4OpticalParamet    
 55   G4OpticalParameters* opticalParameters)         
 56   : params(opticalParameters)                     
 57                                                   
 58 {                                                 
 59   G4bool toBeBroadcasted = false;                 
 60   fDir = new G4UIdirectory("/process/optical/"    
 61   fDir->SetGuidance(                              
 62     "Commands related to the optical physics s    
 63                                                   
 64   fCerenkovDir =                                  
 65     new G4UIdirectory("/process/optical/cerenk    
 66   fCerenkovDir->SetGuidance("Cerenkov process     
 67   fScintDir =                                     
 68     new G4UIdirectory("/process/optical/scinti    
 69   fScintDir->SetGuidance("Scintillation proces    
 70   fWlsDir = new G4UIdirectory("/process/optica    
 71   fWlsDir->SetGuidance("Wave length shifting p    
 72   fWls2Dir = new G4UIdirectory("/process/optic    
 73   fWls2Dir->SetGuidance("Second Wave length sh    
 74   fBoundaryDir =                                  
 75     new G4UIdirectory("/process/optical/bounda    
 76   fBoundaryDir->SetGuidance("Boundary scatteri    
 77   fMieDir = new G4UIdirectory("/process/optica    
 78   fMieDir->SetGuidance("Mie scattering process    
 79   fAbsDir = new G4UIdirectory("/process/optica    
 80   fAbsDir->SetGuidance("absorption process com    
 81   fRaylDir = new G4UIdirectory("/process/optic    
 82   fRaylDir->SetGuidance("Rayleigh scattering c    
 83                                                   
 84   // general commands                             
 85   fActivateProcessCmd =                           
 86     new G4UIcommand("/process/optical/processA    
 87   fActivateProcessCmd->SetGuidance(               
 88     "Activate/deactivate the specified optical    
 89   auto par = new G4UIparameter("proc_name", 's    
 90   G4String candidates;                            
 91   for(G4int i = 0; i < kNoProcess; ++i)           
 92   {                                               
 93     candidates += G4OpticalProcessName(i);        
 94     candidates += G4String(" ");                  
 95   }                                               
 96   par->SetParameterCandidates(candidates);        
 97   par->SetGuidance("the process name");           
 98   fActivateProcessCmd->SetParameter(par);         
 99   par = new G4UIparameter("flag", 'b', true);     
100   par->SetDefaultValue(true);                     
101   par->SetGuidance("activation flag");            
102   fActivateProcessCmd->SetParameter(par);         
103   fActivateProcessCmd->AvailableForStates(G4St    
104                                                   
105   fVerboseCmd = new G4UIcmdWithAnInteger("/pro    
106   fVerboseCmd->SetGuidance("Set default verbos    
107   fVerboseCmd->SetParameterName("ver", true);     
108   fVerboseCmd->SetDefaultValue(1);                
109   fVerboseCmd->SetRange("ver>=0");                
110   fVerboseCmd->AvailableForStates(G4State_PreI    
111                                                   
112   fDumpCmd = new G4UIcommand("/process/optical    
113   fDumpCmd->SetGuidance("Print all optical par    
114                                                   
115   // Cerenkov ////////////////////                
116   fCerenkovMaxPhotonsCmd =                        
117     new G4UIcmdWithAnInteger("/process/optical    
118   fCerenkovMaxPhotonsCmd->SetGuidance("Set max    
119   fCerenkovMaxPhotonsCmd->SetParameterName("Ce    
120   fCerenkovMaxPhotonsCmd->SetRange("CerenkovMa    
121   fCerenkovMaxPhotonsCmd->AvailableForStates(G    
122                                                   
123   fCerenkovMaxBetaChangeCmd =                     
124     new G4UIcmdWithADouble("/process/optical/c    
125   fCerenkovMaxBetaChangeCmd->SetGuidance(         
126     "Set maximum change of beta of parent part    
127   fCerenkovMaxBetaChangeCmd->SetParameterName(    
128   fCerenkovMaxBetaChangeCmd->SetRange("Cerenko    
129   fCerenkovMaxBetaChangeCmd->AvailableForState    
130                                                   
131   fCerenkovStackPhotonsCmd =                      
132     new G4UIcmdWithABool("/process/optical/cer    
133   fCerenkovStackPhotonsCmd->SetGuidance(          
134     "Set whether or not to stack secondary Cer    
135   fCerenkovStackPhotonsCmd->AvailableForStates    
136                                                   
137   fCerenkovTrackSecondariesFirstCmd = new G4UI    
138     "/process/optical/cerenkov/setTrackSeconda    
139   fCerenkovTrackSecondariesFirstCmd->SetGuidan    
140     "Whether to track secondary Cerenkov photo    
141   fCerenkovTrackSecondariesFirstCmd->Available    
142                                                   
143                                                   
144   fCerenkovVerboseLevelCmd =                      
145     new G4UIcmdWithAnInteger("/process/optical    
146   fCerenkovVerboseLevelCmd->SetGuidance("Verbo    
147   fCerenkovVerboseLevelCmd->SetParameterName("    
148   fCerenkovVerboseLevelCmd->SetRange("verbose     
149   fCerenkovVerboseLevelCmd->SetDefaultValue(2)    
150   fCerenkovVerboseLevelCmd->AvailableForStates    
151                                                   
152   // Scintillation //////////////////////////     
153   fScintByParticleTypeCmd = new G4UIcmdWithABo    
154     "/process/optical/scintillation/setByParti    
155   fScintByParticleTypeCmd->SetGuidance(           
156     "Activate/Inactivate scintillation process    
157   fScintByParticleTypeCmd->SetParameterName(      
158     "ScintillationByParticleTypeActivation", f    
159   fScintByParticleTypeCmd->AvailableForStates(    
160                                                   
161   fScintTrackInfoCmd =                            
162     new G4UIcmdWithABool("/process/optical/sci    
163   fScintTrackInfoCmd->SetGuidance(                
164     "Activate/Inactivate scintillation TrackIn    
165   fScintTrackInfoCmd->SetParameterName("Scinti    
166   fScintTrackInfoCmd->AvailableForStates(G4Sta    
167                                                   
168   fScintFiniteRiseTimeCmd = new G4UIcmdWithABo    
169     "/process/optical/scintillation/setFiniteR    
170   fScintFiniteRiseTimeCmd->SetGuidance(           
171     "Set option of a finite rise-time for G4Sc    
172   fScintFiniteRiseTimeCmd->SetGuidance(           
173     "If set, the G4Scintillation process expec    
174   fScintFiniteRiseTimeCmd->SetGuidance(           
175     "constant material property SCINTILLATIONR    
176   fScintFiniteRiseTimeCmd->SetParameterName("F    
177   fScintFiniteRiseTimeCmd->AvailableForStates(    
178                                                   
179   fScintStackPhotonsCmd = new G4UIcmdWithABool    
180     "/process/optical/scintillation/setStackPh    
181   fScintStackPhotonsCmd->SetGuidance(             
182     "Set whether or not to stack secondary Sci    
183   fScintStackPhotonsCmd->SetParameterName("Sci    
184   fScintStackPhotonsCmd->SetDefaultValue(true)    
185   fScintStackPhotonsCmd->AvailableForStates(G4    
186                                                   
187   fScintTrackSecondariesFirstCmd = new G4UIcmd    
188     "/process/optical/scintillation/setTrackSe    
189   fScintTrackSecondariesFirstCmd->SetGuidance(    
190     "Whether to track scintillation secondarie    
191   fScintTrackSecondariesFirstCmd->AvailableFor    
192                                                   
193                                                   
194   fScintVerboseLevelCmd =                         
195     new G4UIcmdWithAnInteger("/process/optical    
196   fScintVerboseLevelCmd->SetGuidance(             
197     "Verbose level for scintillation process."    
198   fScintVerboseLevelCmd->SetParameterName("ver    
199   fScintVerboseLevelCmd->SetRange("verbose >=     
200   fScintVerboseLevelCmd->AvailableForStates(G4    
201                                                   
202   // WLS   //////////////////////////////////     
203   fWLSTimeProfileCmd =                            
204     new G4UIcmdWithAString("/process/optical/w    
205   fWLSTimeProfileCmd->SetGuidance(                
206     "Set the WLS time profile (delta or expone    
207   fWLSTimeProfileCmd->SetParameterName("WLSTim    
208   fWLSTimeProfileCmd->SetCandidates("delta exp    
209   fWLSTimeProfileCmd->AvailableForStates(G4Sta    
210                                                   
211   fWLSVerboseLevelCmd =                           
212     new G4UIcmdWithAnInteger("/process/optical    
213   fWLSVerboseLevelCmd->SetGuidance("Verbose le    
214   fWLSVerboseLevelCmd->SetParameterName("verbo    
215   fWLSVerboseLevelCmd->SetRange("verbose >= 0     
216   fWLSVerboseLevelCmd->SetDefaultValue(1);        
217   fWLSVerboseLevelCmd->AvailableForStates(G4St    
218                                                   
219   // WLS2   //////////////////////////////////    
220   fWLS2TimeProfileCmd =                           
221     new G4UIcmdWithAString("/process/optical/w    
222   fWLS2TimeProfileCmd->SetGuidance(               
223     "Set the WLS2 time profile (delta or expon    
224   fWLS2TimeProfileCmd->SetParameterName("WLS2T    
225   fWLS2TimeProfileCmd->SetCandidates("delta ex    
226   fWLS2TimeProfileCmd->AvailableForStates(G4St    
227                                                   
228   fWLS2VerboseLevelCmd =                          
229     new G4UIcmdWithAnInteger("/process/optical    
230   fWLS2VerboseLevelCmd->SetGuidance("Verbose l    
231   fWLS2VerboseLevelCmd->SetParameterName("verb    
232   fWLS2VerboseLevelCmd->SetRange("verbose >= 0    
233   fWLS2VerboseLevelCmd->SetDefaultValue(1);       
234   fWLS2VerboseLevelCmd->AvailableForStates(G4S    
235                                                   
236   // boundary ////////////////////////////////    
237   fBoundaryInvokeSDCmd =                          
238     new G4UIcmdWithABool("/process/optical/bou    
239   fBoundaryInvokeSDCmd->SetGuidance(              
240     "Set option for calling InvokeSD in G4OpBo    
241   fBoundaryInvokeSDCmd->SetParameterName("Invo    
242   fBoundaryInvokeSDCmd->AvailableForStates(G4S    
243                                                   
244   fBoundaryVerboseLevelCmd =                      
245     new G4UIcmdWithAnInteger("/process/optical    
246   fBoundaryVerboseLevelCmd->SetGuidance("Verbo    
247   fBoundaryVerboseLevelCmd->SetParameterName("    
248   fBoundaryVerboseLevelCmd->SetRange("verbose     
249   fBoundaryVerboseLevelCmd->SetDefaultValue(1)    
250   fBoundaryVerboseLevelCmd->AvailableForStates    
251                                                   
252   // absorption //////////////////////////////    
253   fAbsorptionVerboseLevelCmd =                    
254     new G4UIcmdWithAnInteger("/process/optical    
255   fAbsorptionVerboseLevelCmd->SetGuidance(        
256     "Verbose level for absorption process.");     
257   fAbsorptionVerboseLevelCmd->SetParameterName    
258   fAbsorptionVerboseLevelCmd->SetRange("verbos    
259   fAbsorptionVerboseLevelCmd->SetDefaultValue(    
260   fAbsorptionVerboseLevelCmd->AvailableForStat    
261                                                   
262   // rayleigh ////////////////////////////////    
263   fRayleighVerboseLevelCmd =                      
264     new G4UIcmdWithAnInteger("/process/optical    
265   fRayleighVerboseLevelCmd->SetGuidance("Verbo    
266   fRayleighVerboseLevelCmd->SetParameterName("    
267   fRayleighVerboseLevelCmd->SetRange("verbose     
268   fRayleighVerboseLevelCmd->SetDefaultValue(1)    
269   fRayleighVerboseLevelCmd->AvailableForStates    
270                                                   
271   // mie /////////////////////////////////////    
272   fMieVerboseLevelCmd =                           
273     new G4UIcmdWithAnInteger("/process/optical    
274   fMieVerboseLevelCmd->SetGuidance("Verbose le    
275   fMieVerboseLevelCmd->SetParameterName("verbo    
276   fMieVerboseLevelCmd->SetRange("verbose >= 0     
277   fMieVerboseLevelCmd->SetDefaultValue(1);        
278   fMieVerboseLevelCmd->AvailableForStates(G4St    
279 }                                                 
280                                                   
281 G4OpticalParametersMessenger::~G4OpticalParame    
282 {                                                 
283   delete fDir;                                    
284   delete fCerenkovDir;                            
285   delete fScintDir;                               
286   delete fWlsDir;                                 
287   delete fBoundaryDir;                            
288   delete fMieDir;                                 
289   delete fAbsDir;                                 
290   delete fRaylDir;                                
291   delete fActivateProcessCmd;                     
292   delete fVerboseCmd;                             
293   delete fDumpCmd;                                
294   delete fCerenkovMaxPhotonsCmd;                  
295   delete fCerenkovMaxBetaChangeCmd;               
296   delete fCerenkovStackPhotonsCmd;                
297   delete fCerenkovTrackSecondariesFirstCmd;       
298   delete fCerenkovVerboseLevelCmd;                
299   delete fScintByParticleTypeCmd;                 
300   delete fScintTrackInfoCmd;                      
301   delete fScintStackPhotonsCmd;                   
302   delete fScintVerboseLevelCmd;                   
303   delete fScintFiniteRiseTimeCmd;                 
304   delete fScintTrackSecondariesFirstCmd;          
305   delete fWLSTimeProfileCmd;                      
306   delete fWLSVerboseLevelCmd;                     
307   delete fWLS2TimeProfileCmd;                     
308   delete fWLS2VerboseLevelCmd;                    
309   delete fAbsorptionVerboseLevelCmd;              
310   delete fRayleighVerboseLevelCmd;                
311   delete fMieVerboseLevelCmd;                     
312   delete fBoundaryVerboseLevelCmd;                
313   delete fBoundaryInvokeSDCmd;                    
314 }                                                 
315                                                   
316 void G4OpticalParametersMessenger::SetNewValue    
317                                                   
318 {                                                 
319   // physics needs to be rebuilt for all comma    
320   G4bool physicsModified = true;                  
321                                                   
322   /// Apply command to the associated object.     
323   if(command == fActivateProcessCmd)              
324   {                                               
325     std::istringstream is(newValue.data());       
326     G4String pn;                                  
327     G4String flag;                                
328     is >> pn >> flag;                             
329     G4bool value = G4UIcommand::ConvertToBool(    
330     params->SetProcessActivation(pn, value);      
331   }                                               
332   else if(command == fVerboseCmd)                 
333   {                                               
334     params->SetVerboseLevel(fVerboseCmd->GetNe    
335   }                                               
336   else if(command == fDumpCmd)                    
337   {                                               
338     params->Dump();                               
339   }                                               
340   else if(command == fCerenkovMaxPhotonsCmd)      
341   {                                               
342     params->SetCerenkovMaxPhotonsPerStep(         
343       fCerenkovMaxPhotonsCmd->GetNewIntValue(n    
344     G4cout << "Cerenkov max photons: " << para    
345            << G4endl;                             
346   }                                               
347   else if(command == fCerenkovMaxBetaChangeCmd    
348   {                                               
349     params->SetCerenkovMaxBetaChange(             
350       fCerenkovMaxBetaChangeCmd->GetNewDoubleV    
351   }                                               
352   else if(command == fCerenkovStackPhotonsCmd)    
353   {                                               
354     params->SetCerenkovStackPhotons(              
355       fCerenkovStackPhotonsCmd->GetNewBoolValu    
356   }                                               
357   else if(command == fCerenkovTrackSecondaries    
358   {                                               
359     params->SetCerenkovTrackSecondariesFirst(     
360       fCerenkovTrackSecondariesFirstCmd->GetNe    
361   }                                               
362   else if(command == fCerenkovVerboseLevelCmd)    
363   {                                               
364     params->SetCerenkovVerboseLevel(              
365       fCerenkovVerboseLevelCmd->GetNewIntValue    
366   }                                               
367   else if(command == fScintByParticleTypeCmd)     
368   {                                               
369     params->SetScintByParticleType(               
370       fScintByParticleTypeCmd->GetNewBoolValue    
371   }                                               
372   else if(command == fScintTrackInfoCmd)          
373   {                                               
374     params->SetScintTrackInfo(fScintTrackInfoC    
375   }                                               
376   else if(command == fScintFiniteRiseTimeCmd)     
377   {                                               
378     params->SetScintFiniteRiseTime(               
379       fScintFiniteRiseTimeCmd->GetNewBoolValue    
380   }                                               
381   else if(command == fScintStackPhotonsCmd)       
382   {                                               
383     params->SetScintStackPhotons(                 
384       fScintStackPhotonsCmd->GetNewBoolValue(n    
385   }                                               
386   else if(command == fScintTrackSecondariesFir    
387   {                                               
388     params->SetScintTrackSecondariesFirst(        
389       fScintTrackSecondariesFirstCmd->GetNewBo    
390   }                                               
391   else if(command == fScintVerboseLevelCmd)       
392   {                                               
393     params->SetScintVerboseLevel(                 
394       fScintVerboseLevelCmd->GetNewIntValue(ne    
395   }                                               
396   else if(command == fWLSTimeProfileCmd)          
397   {                                               
398     params->SetWLSTimeProfile(newValue);          
399   }                                               
400   else if(command == fWLSVerboseLevelCmd)         
401   {                                               
402     params->SetWLSVerboseLevel(fWLSVerboseLeve    
403   }                                               
404   else if(command == fWLS2TimeProfileCmd)         
405   {                                               
406     params->SetWLS2TimeProfile(newValue);         
407   }                                               
408   else if(command == fWLS2VerboseLevelCmd)        
409   {                                               
410     params->SetWLS2VerboseLevel(fWLS2VerboseLe    
411   }                                               
412   else if(command == fAbsorptionVerboseLevelCm    
413   {                                               
414     params->SetAbsorptionVerboseLevel(            
415       fAbsorptionVerboseLevelCmd->GetNewIntVal    
416   }                                               
417   else if(command == fRayleighVerboseLevelCmd)    
418   {                                               
419     params->SetRayleighVerboseLevel(              
420       fRayleighVerboseLevelCmd->GetNewIntValue    
421   }                                               
422   else if(command == fMieVerboseLevelCmd)         
423   {                                               
424     params->SetMieVerboseLevel(fMieVerboseLeve    
425   }                                               
426   else if(command == fBoundaryVerboseLevelCmd)    
427   {                                               
428     params->SetBoundaryVerboseLevel(              
429       fBoundaryVerboseLevelCmd->GetNewIntValue    
430   }                                               
431   else if(command == fBoundaryInvokeSDCmd)        
432   {                                               
433     params->SetBoundaryInvokeSD(                  
434       fBoundaryInvokeSDCmd->GetNewBoolValue(ne    
435   }                                               
436   if(physicsModified)                             
437   {                                               
438     G4UImanager::GetUIpointer()->ApplyCommand(    
439   }                                               
440 }                                                 
441