Geant4_10
G4OpticalPhysicsMessenger.cc
Go to the documentation of this file.
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 // ClassName: G4OpticalPhysicsMessenger
30 //
31 // Author: P.Gumplinger 30.09.2009 //
32 //
33 // Modified: P.Gumplinger 29.09.2011
34 // (based on code from I. Hrivnacova)
35 //
36 //----------------------------------------------------------------------------
37 //
38 
40 #include "G4OpticalPhysics.hh"
41 
42 #include "G4UIcommand.hh"
43 #include "G4UIdirectory.hh"
44 
45 #include "G4UIcommand.hh"
46 #include "G4UIdirectory.hh"
47 #include "G4UIcmdWithABool.hh"
48 #include "G4UIcmdWithAString.hh"
49 #include "G4UIcmdWithADouble.hh"
50 #include "G4UIcmdWithAnInteger.hh"
52 
53 #include "G4ParticleTable.hh"
54 #include "G4ProcessVector.hh"
55 #include "G4ProcessManager.hh"
56 #include "G4ParticleDefinition.hh"
57 
58 //_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
60  G4OpticalPhysics* opticalPhysics)
61  : G4UImessenger(),
62  fOpticalPhysics(opticalPhysics),
63  fSelectedProcessIndex(kNoProcess),
64  fSelectOpProcessCmd(0),
65  fSetOpProcessUseCmd(0),
66  fSetOpProcessVerboseCmd(0),
67  fSetCerenkovMaxPhotonsCmd(0),
68  fSetCerenkovMaxBetaChangeCmd(0),
69  fSetScintillationYieldFactorCmd(0),
70  fSetScintillationByParticleTypeCmd(0),
71 // fSetOpticalSurfaceModelCmd(0),
72  fSetWLSTimeProfileCmd(0),
73  fSetTrackSecondariesFirstCmd(0),
74  fSetFiniteRiseTimeCmd(0)
75 {
76  fDir = new G4UIdirectory("/optics_engine/");
77  fDir->SetGuidance("Commands related to the optical physics simulation engine.");
78 
79  fSelectOpProcessCmd
80  = new G4UIcmdWithAString("/optics_engine/selectOpProcess", this);
81  fSelectOpProcessCmd
82  ->SetGuidance("Select optical process for applying use/verbose/trackfirst commands");
83  fSelectOpProcessCmd->SetParameterName("OpProcess", false);
84  G4String candidates;
85  for ( G4int i=0; i<kNoProcess; i++ ) {
86  candidates += G4OpticalProcessName(i);
87  candidates += G4String(" ");
88  }
89  fSelectOpProcessCmd->SetCandidates(candidates);
91 
92  fSetOpProcessUseCmd
93  = new G4UIcmdWithABool("/optics_engine/setOpProcessUse", this);
94  fSetOpProcessUseCmd->SetGuidance("Use/Not use selected optical process");
95  fSetOpProcessUseCmd->SetParameterName("OpProcessUse", false);
96  fSetOpProcessUseCmd->AvailableForStates(G4State_PreInit);
97 
98  fSetOpProcessVerboseCmd
99  = new G4UIcmdWithAnInteger("/optics_engine/setOpProcessVerbose", this);
100  fSetOpProcessVerboseCmd->SetGuidance("Set verbosity level for selected optical process");
101  fSetOpProcessVerboseCmd->SetParameterName("OpProcessVerbose", false);
102  fSetOpProcessVerboseCmd->SetRange("OpProcessVerbose>=0");
104 
105  fSetCerenkovMaxPhotonsCmd
106  = new G4UIcmdWithAnInteger("/optics_engine/setCerenkovMaxPhotons", this);
107  fSetCerenkovMaxPhotonsCmd->SetGuidance("Set maximum number of photons per step");
108  fSetCerenkovMaxPhotonsCmd->SetParameterName("CerenkovMaxPhotons", false);
109  fSetCerenkovMaxPhotonsCmd->SetRange("CerenkovMaxPhotons>=0");
111 
112  fSetCerenkovMaxBetaChangeCmd
113  = new G4UIcmdWithADouble("/optics_engine/setCerenkovMaxBetaChange", this);
114  fSetCerenkovMaxBetaChangeCmd
115  ->SetGuidance("Set maximum change of beta of parent particle per step");
116  fSetCerenkovMaxBetaChangeCmd->SetParameterName("CerenkovMaxBetaChange", false);
117  fSetCerenkovMaxBetaChangeCmd->SetRange("CerenkovMaxBetaChange>=0");
119 
120  fSetScintillationYieldFactorCmd
121  = new G4UIcmdWithADouble("/optics_engine/setScintillationYieldFactor", this);
122  fSetScintillationYieldFactorCmd->SetGuidance("Set scintillation yield factor");
123  fSetScintillationYieldFactorCmd->SetParameterName("ScintillationYieldFactor", false);
124  fSetScintillationYieldFactorCmd->SetRange("ScintillationYieldFactor>=0");
126 
127  fSetScintillationByParticleTypeCmd
128  = new G4UIcmdWithABool("/optics_engine/setScintillationByParticleType", this);
129  fSetScintillationByParticleTypeCmd->SetGuidance("Activate/Inactivate scintillation process by particle type");
130  fSetScintillationByParticleTypeCmd->SetParameterName("ScintillationByParticleTypeActivation", false);
132 
133 // fSetOpticalSurfaceModelCmd
134 // = new G4UIcmdWithAString("/optics_engine/setOpticalSurfaceModel", this);
135 // fSetOpticalSurfaceModelCmd
136 // ->SetGuidance("Set optical surface model (glisur or unified)");
137 // fSetOpticalSurfaceModelCmd->SetParameterName("OpticalSurfaceModel", false);
138 // fSetOpticalSurfaceModelCmd->SetCandidates("glisur unified");
139 // fSetOpticalSurfaceModelCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
140 
141  fSetWLSTimeProfileCmd
142  = new G4UIcmdWithAString("/optics_engine/setWLSTimeProfile", this);
143  fSetWLSTimeProfileCmd
144  ->SetGuidance("Set the WLS time profile (delta or exponential)");
145  fSetWLSTimeProfileCmd->SetParameterName("WLSTimeProfile", false);
146  fSetWLSTimeProfileCmd->SetCandidates("delta exponential");
148 
149  fSetTrackSecondariesFirstCmd
150  = new G4UIcmdWithABool("/optics_engine/setTrackSecondariesFirst", this);
151  fSetTrackSecondariesFirstCmd
152  ->SetGuidance("Set option to track secondaries before finishing their parent track");
153  fSetTrackSecondariesFirstCmd->SetParameterName("TrackSecondariesFirst", false);
155 
156  fSetFiniteRiseTimeCmd
157  = new G4UIcmdWithABool("/optics_engine/setFiniteRiseTime", this);
158  fSetFiniteRiseTimeCmd
159  ->SetGuidance("Set option of a finite rise-time for G4Scintillation - If set, the G4Scintillation process expects the user to have set the constant material property FAST/SLOWSCINTILLATIONRISETIME");
160  fSetFiniteRiseTimeCmd->SetParameterName("FiniteRiseTime", false);
162 }
163 
165 {
166 // Destructor
167 
168  delete fDir;
169  delete fSelectOpProcessCmd;
170  delete fSetOpProcessUseCmd;
171  delete fSetOpProcessVerboseCmd;
172  delete fSetCerenkovMaxPhotonsCmd;
173  delete fSetCerenkovMaxBetaChangeCmd;
174  delete fSetScintillationYieldFactorCmd;
175  delete fSetScintillationByParticleTypeCmd;
176 // delete fSetOpticalSurfaceModelCmd;
177  delete fSetWLSTimeProfileCmd;
178  delete fSetTrackSecondariesFirstCmd;
179  delete fSetFiniteRiseTimeCmd;
180 }
181 
183 {
185 
186  if (command == fSelectOpProcessCmd) {
187  if ( newValue == "Cerenkov" ) {
188  fSelectedProcessIndex = kCerenkov;
189  } else if ( newValue == "Scintillation" ) {
190  fSelectedProcessIndex = kScintillation;
191  } else if ( newValue == "OpAbsorption" ) {
192  fSelectedProcessIndex = kAbsorption;
193  } else if ( newValue == "OpRayleigh" ) {
194  fSelectedProcessIndex = kRayleigh;
195  } else if ( newValue == "OpMieHG" ) {
196  fSelectedProcessIndex = kMieHG;
197  } else if ( newValue == "OpBoundary" ) {
198  fSelectedProcessIndex = kBoundary;
199  } else if ( newValue == "OpWLS" ) {
200  fSelectedProcessIndex = kWLS;
201  }
202  }
203  else if (command == fSetOpProcessUseCmd) {
204  fOpticalPhysics->
205  Configure(fSelectedProcessIndex,
206  fSetOpProcessUseCmd->GetNewBoolValue(newValue));
207  }
208  else if (command == fSetOpProcessVerboseCmd) {
209  if ( fSelectedProcessIndex < kNoProcess ) {
210  fOpticalPhysics->
211  SetProcessVerbose(fSelectedProcessIndex,
212  fSetOpProcessVerboseCmd->GetNewIntValue(newValue));
213  } else {
214  for ( G4int i=0; i<kNoProcess; i++ ) {
215  fOpticalPhysics->
216  SetProcessVerbose(i,fSetOpProcessVerboseCmd->GetNewIntValue(newValue));
217  }
218  }
219  }
220  else if (command == fSetCerenkovMaxPhotonsCmd) {
221  fOpticalPhysics
223  fSetCerenkovMaxPhotonsCmd->GetNewIntValue(newValue));
224  }
225  else if (command == fSetCerenkovMaxBetaChangeCmd) {
226  fOpticalPhysics
228  fSetCerenkovMaxBetaChangeCmd->GetNewDoubleValue(newValue));
229  }
230  else if (command == fSetScintillationYieldFactorCmd) {
231  fOpticalPhysics
233  fSetScintillationYieldFactorCmd->GetNewDoubleValue(newValue));
234  }
235  else if (command == fSetScintillationByParticleTypeCmd) {
236  fOpticalPhysics
238  fSetScintillationByParticleTypeCmd->GetNewBoolValue(newValue));
239  }
240  else if (command == fSetFiniteRiseTimeCmd) {
241  fOpticalPhysics
243  fSetFiniteRiseTimeCmd->GetNewBoolValue(newValue));
244  }
245 // else if (command == fSetOpticalSurfaceModelCmd) {
246 // if ( newValue == "glisur" ) {
247 // fOpticalPhysics
248 // ->SetOpticalSurfaceModel(glisur);
249 // }
250 // if ( newValue == "unified" ) {
251 // fOpticalPhysics
252 // ->SetOpticalSurfaceModel(unified);
253 // }
254 // }
255  else if (command == fSetWLSTimeProfileCmd) {
256  if ( newValue == "delta" ) {
257  fOpticalPhysics
258  ->SetWLSTimeProfile("delta"); }
259  if ( newValue == "exponential" ) {
260  fOpticalPhysics
261  ->SetWLSTimeProfile("exponential");
262  }
263  }
264  else if (command == fSetTrackSecondariesFirstCmd) {
265  fOpticalPhysics->SetTrackSecondariesFirst(fSelectedProcessIndex,
266  fSetTrackSecondariesFirstCmd->
267  GetNewBoolValue(newValue));
268  }
269 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
virtual void SetNewValue(G4UIcommand *, G4String)
Number of processes, no selected process.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetMaxBetaChangePerStep(G4double)
Scintillation process index.
Mie scattering process index.
void SetFiniteRiseTime(G4bool)
Absorption process index.
int G4int
Definition: G4Types.hh:78
static G4bool GetNewBoolValue(const char *paramString)
void SetScintillationByParticleType(G4bool)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
def Configure
Definition: Lesson1.py:20
void SetMaxNumPhotonsPerStep(G4int)
static G4double GetNewDoubleValue(const char *paramString)
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:225
Wave Length Shifting process index.
G4String G4OpticalProcessName(G4int)
Return the name for a given optical process index.
Boundary process index.
void SetScintillationYieldFactor(G4double)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
Cerenkov process index.
void SetWLSTimeProfile(G4String)
void SetTrackSecondariesFirst(G4OpticalProcessIndex, G4bool)
void SetCandidates(const char *candidateList)
Rayleigh scattering process index.
G4OpticalPhysicsMessenger(G4OpticalPhysics *)