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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 /examples/advanced/exp_microdosimetry/src/DetectorMessenger.cc (Version 11.3.0) and /examples/advanced/exp_microdosimetry/src/DetectorMessenger.cc (Version 11.0.p1)


  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 // Authors: Susanna Guatelli and Francesco Rom    
 27 // susanna@uow.edu.au, francesco.romano@ct.inf    
 28 //                                                
 29 // Created by Jacopo Magini: j.magini@surrey.a    
 30                                                   
 31 #include "DetectorMessenger.hh"                   
 32 #include "G4UIdirectory.hh"                       
 33 #include "G4UIcmdWithADoubleAndUnit.hh"           
 34 #include "G4UIcmdWithAString.hh"                  
 35 #include "G4UIcmdWithABool.hh"                    
 36 #include "G4UIcmdWithoutParameter.hh"             
 37 #include "G4SystemOfUnits.hh"                     
 38 #include "DetectorConstruction.hh"                
 39 #include "G4RunManager.hh"                        
 40                                                   
 41 DetectorMessenger::DetectorMessenger(AnalysisM    
 42   : geometryHasChanged(false)                     
 43 {                                                 
 44     changeTheGeometryDir = new G4UIdirectory("    
 45     changeTheGeometryDir -> SetGuidance("Geome    
 46                                                   
 47     changeTheDetectorCmd = new G4UIcmdWithAStr    
 48     changeTheDetectorCmd -> SetGuidance("Selec    
 49     changeTheDetectorCmd -> SetParameterName("    
 50     changeTheDetectorCmd -> AvailableForStates    
 51                                                   
 52   changeDetectorDimensionDir = new G4UIdirecto    
 53   changeDetectorDimensionDir -> SetGuidance("M    
 54                                                   
 55   changeDetectorSizeWidthCmd = new G4UIcmdWith    
 56   changeDetectorSizeWidthCmd -> SetGuidance("S    
 57   changeDetectorSizeWidthCmd -> SetParameterNa    
 58   changeDetectorSizeWidthCmd -> SetRange("Widt    
 59   changeDetectorSizeWidthCmd -> SetUnitCategor    
 60   changeDetectorSizeWidthCmd -> SetDefaultUnit    
 61   changeDetectorSizeWidthCmd -> AvailableForSt    
 62                                                   
 63   changeDetectorSizeThicknessCmd = new G4UIcmd    
 64   changeDetectorSizeThicknessCmd -> SetGuidanc    
 65   changeDetectorSizeThicknessCmd -> SetParamet    
 66   changeDetectorSizeThicknessCmd -> SetRange("    
 67   changeDetectorSizeThicknessCmd -> SetUnitCat    
 68   changeDetectorSizeThicknessCmd -> SetDefault    
 69   changeDetectorSizeThicknessCmd -> AvailableF    
 70                                                   
 71   changeSecondStageDimensionDir = new G4UIdire    
 72   changeSecondStageDimensionDir -> SetGuidance    
 73                                                   
 74   changeSecondStageSizeWidthCmd = new G4UIcmdW    
 75   changeSecondStageSizeWidthCmd -> SetGuidance    
 76   changeSecondStageSizeWidthCmd -> SetParamete    
 77   changeSecondStageSizeWidthCmd -> SetRange("W    
 78   changeSecondStageSizeWidthCmd -> SetUnitCate    
 79   changeSecondStageSizeWidthCmd -> SetDefaultU    
 80   changeSecondStageSizeWidthCmd -> AvailableFo    
 81                                                   
 82   changeSecondStageSizeThicknessCmd = new G4UI    
 83   changeSecondStageSizeThicknessCmd -> SetGuid    
 84   changeSecondStageSizeThicknessCmd -> SetPara    
 85   changeSecondStageSizeThicknessCmd -> SetRang    
 86   changeSecondStageSizeThicknessCmd -> SetUnit    
 87   changeSecondStageSizeThicknessCmd -> SetDefa    
 88   changeSecondStageSizeThicknessCmd -> Availab    
 89                                                   
 90   enableWaterPhantomCmd = new G4UIcmdWithABool    
 91   enableWaterPhantomCmd -> SetGuidance("If tru    
 92   enableWaterPhantomCmd -> SetParameterName("P    
 93   enableWaterPhantomCmd -> AvailableForStates(    
 94                                                   
 95   changeDetectorPositionDir = new G4UIdirector    
 96   changeDetectorPositionDir -> SetGuidance("Mo    
 97                                                   
 98   changeDetectorPositionDepthCmd = new G4UIcmd    
 99   changeDetectorPositionDepthCmd -> SetGuidanc    
100   changeDetectorPositionDepthCmd -> SetParamet    
101   changeDetectorPositionDepthCmd -> SetRange("    
102   changeDetectorPositionDepthCmd -> SetUnitCat    
103   changeDetectorPositionDepthCmd -> SetDefault    
104   changeDetectorPositionDepthCmd -> AvailableF    
105                                                   
106   applyChangesToGeometryCmd = new G4UIcmdWitho    
107     applyChangesToGeometryCmd -> SetGuidance("    
108   applyChangesToGeometryCmd -> AvailableForSta    
109                                                   
110   // default values                               
111   detectorType = "Diamond";                       
112   detectorWidth = 30.*um;                         
113   detectorThickness = 10.*um;                     
114   phantomEnabled = false;                         
115   detectorDepth = 50*mm;                          
116   secondStageWidth = 800.*um;                     
117   secondStageThickness = 500.*um;                 
118                                                   
119   analysis = analysis_manager;                    
120 }                                                 
121                                                   
122 DetectorMessenger::~DetectorMessenger()           
123 {                                                 
124   delete changeTheDetectorCmd;                    
125   delete changeDetectorSizeWidthCmd;              
126   delete changeDetectorSizeThicknessCmd;          
127   delete changeSecondStageSizeWidthCmd;           
128   delete changeSecondStageSizeThicknessCmd;       
129   delete enableWaterPhantomCmd;                   
130   delete changeDetectorPositionDepthCmd;          
131                                                   
132   delete applyChangesToGeometryCmd;               
133                                                   
134   delete changeSecondStageDimensionDir;           
135   delete changeDetectorDimensionDir;              
136   delete changeDetectorPositionDir;               
137   delete changeTheGeometryDir;                    
138 }                                                 
139                                                   
140 void DetectorMessenger::SetNewValue(G4UIcomman    
141 {                                                 
142                                                   
143   if( command == changeTheDetectorCmd )           
144   {                                               
145     if( commandContent == "Diamond" || command    
146     {                                             
147       detectorType = commandContent;              
148       geometryHasChanged = true;                  
149                                                   
150       G4cout << "Detector type changed to " <<    
151       G4cout << "Run /geometrySetup/applyChang    
152     }                                             
153                                                   
154     else                                          
155     {                                             
156       G4cout <<"Unknown detector type: " << co    
157     }                                             
158   }                                               
159                                                   
160   else if( command == changeDetectorSizeWidthC    
161   {                                               
162     detectorWidth = G4UIcmdWithADoubleAndUnit:    
163     geometryHasChanged = true;                    
164                                                   
165     G4cout << "Detector width changed to " <<     
166     G4cout << "Run /geometrySetup/applyChanges    
167   }                                               
168                                                   
169   else if( command == changeDetectorSizeThickn    
170   {                                               
171     detectorThickness = G4UIcmdWithADoubleAndU    
172     geometryHasChanged = true;                    
173                                                   
174     G4cout << "Detector thickness changed to "    
175     G4cout << "Run /geometrySetup/applyChanges    
176   }                                               
177                                                   
178   else if( command == changeSecondStageSizeWid    
179   {                                               
180     secondStageWidth = G4UIcmdWithADoubleAndUn    
181     geometryHasChanged = true;                    
182                                                   
183     G4cout << "Telescope E-stage width changed    
184     if ( detectorType != "DiamondTelescope" )     
185     {                                             
186       G4cout << "However this setting only tak    
187       G4cout << "Select it with '/geometrySetu    
188     }                                             
189     else G4cout << "Run /geometrySetup/applyCh    
190   }                                               
191                                                   
192   else if( command == changeSecondStageSizeThi    
193   {                                               
194     secondStageThickness = G4UIcmdWithADoubleA    
195     geometryHasChanged = true;                    
196                                                   
197     G4cout << "Telescope E-stage thickness cha    
198     if ( detectorType != "DiamondTelescope" )     
199     {                                             
200       G4cout << "However this setting only tak    
201       G4cout << "Select it with '/geometrySetu    
202     }                                             
203     else G4cout << "Run /geometrySetup/applyCh    
204   }                                               
205                                                   
206   else if( command == enableWaterPhantomCmd )     
207   {                                               
208     phantomEnabled = G4UIcmdWithABool::GetNewB    
209     geometryHasChanged = true;                    
210                                                   
211     if( phantomEnabled == true )  G4cout << "W    
212     else G4cout << "Water phantom disabled" <<    
213     G4cout << "Run /geometrySetup/applyChanges    
214   }                                               
215                                                   
216   else if( command == changeDetectorPositionDe    
217   {                                               
218     detectorDepth = G4UIcmdWithADoubleAndUnit:    
219     geometryHasChanged = true;                    
220                                                   
221     G4cout << "Detector depth in water changed    
222     if( phantomEnabled == false )                 
223     {                                             
224       G4cout << "However the water phantom is     
225       G4cout << "Enable it with '/geometrySetu    
226     }                                             
227     else G4cout << "Run /geometrySetup/applyCh    
228   }                                               
229                                                   
230   else if( command == applyChangesToGeometryCm    
231   {                                               
232     if( geometryHasChanged == true )              
233     {                                             
234       G4RunManager* runManager = G4RunManager:    
235                                                   
236       DetectorConstruction* newDetector = new     
237                                                   
238       runManager -> SetUserInitialization(newD    
239       runManager -> GeometryHasBeenModified();    
240                                                   
241       geometryHasChanged = false;                 
242                                                   
243       G4cout << "All pending changes to geomet    
244     }                                             
245                                                   
246     else                                          
247     {                                             
248       G4cout << "No pending changes to geometr    
249     }                                             
250   }                                               
251 }                                                 
252