Geant4  10.00.p01
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 "G4ProcessManager.hh"
55 #include "G4ParticleDefinition.hh"
56 
57 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
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->
78  SetGuidance("Commands related to the optical physics simulation engine.");
79 
81  = new G4UIcmdWithAString("/optics_engine/selectOpProcess", this);
83  ->SetGuidance("Select optical process for applying use/verbose/trackfirst commands");
84  fSelectOpProcessCmd->SetParameterName("OpProcess", false);
85  G4String candidates;
86  for ( G4int i=0; i<kNoProcess; i++ ) {
87  candidates += G4OpticalProcessName(i);
88  candidates += G4String(" ");
89  }
92 
94  = new G4UIcmdWithABool("/optics_engine/setOpProcessUse", this);
95  fSetOpProcessUseCmd->SetGuidance("Use/Not use selected optical process");
96  fSetOpProcessUseCmd->SetParameterName("OpProcessUse", false);
98 
100  = new G4UIcmdWithAnInteger("/optics_engine/setOpProcessVerbose", this);
101  fSetOpProcessVerboseCmd->SetGuidance("Set verbosity level for selected optical process");
102  fSetOpProcessVerboseCmd->SetParameterName("OpProcessVerbose", true);
104  fSetOpProcessVerboseCmd->SetRange("OpProcessVerbose>=0");
106 
108  = new G4UIcmdWithAnInteger("/optics_engine/setCerenkovMaxPhotons", this);
109  fSetCerenkovMaxPhotonsCmd->SetGuidance("Set maximum number of photons per step");
110  fSetCerenkovMaxPhotonsCmd->SetParameterName("CerenkovMaxPhotons", false);
111  fSetCerenkovMaxPhotonsCmd->SetRange("CerenkovMaxPhotons>=0");
113 
115  = new G4UIcmdWithADouble("/optics_engine/setCerenkovMaxBetaChange", this);
117  ->SetGuidance("Set maximum change of beta of parent particle per step");
119  SetParameterName("CerenkovMaxBetaChange", false);
120  fSetCerenkovMaxBetaChangeCmd->SetRange("CerenkovMaxBetaChange>=0");
122  AvailableForStates(G4State_PreInit, G4State_Idle);
123 
125  = new G4UIcmdWithADouble("/optics_engine/setScintillationYieldFactor", this);
127  SetGuidance("Set scintillation yield factor");
129  SetParameterName("ScintillationYieldFactor", false);
130  fSetScintillationYieldFactorCmd->SetRange("ScintillationYieldFactor>=0");
132  AvailableForStates(G4State_PreInit, G4State_Idle);
133 
135  = new G4UIcmdWithABool("/optics_engine/setScintillationByParticleType", this);
137  SetGuidance("Activate/Inactivate scintillation process by particle type");
139  SetParameterName("ScintillationByParticleTypeActivation", false);
141  AvailableForStates(G4State_PreInit, G4State_Idle);
142 
143 // fSetOpticalSurfaceModelCmd
144 // = new G4UIcmdWithAString("/optics_engine/setOpticalSurfaceModel", this);
145 // fSetOpticalSurfaceModelCmd
146 // ->SetGuidance("Set optical surface model (glisur or unified)");
147 // fSetOpticalSurfaceModelCmd->SetParameterName("OpticalSurfaceModel", false);
148 // fSetOpticalSurfaceModelCmd->SetCandidates("glisur unified");
149 // fSetOpticalSurfaceModelCmd->
150 // AvailableForStates(G4State_PreInit, G4State_Idle);
151 
153  = new G4UIcmdWithAString("/optics_engine/setWLSTimeProfile", this);
155  ->SetGuidance("Set the WLS time profile (delta or exponential)");
156  fSetWLSTimeProfileCmd->SetParameterName("WLSTimeProfile", false);
157  fSetWLSTimeProfileCmd->SetCandidates("delta exponential");
159 
161  = new G4UIcmdWithABool("/optics_engine/setTrackSecondariesFirst", this);
163  ->SetGuidance("Set option to track secondaries before finishing their parent track");
165  SetParameterName("TrackSecondariesFirst", false);
167  AvailableForStates(G4State_PreInit, G4State_Idle);
168 
170  = new G4UIcmdWithABool("/optics_engine/setFiniteRiseTime", this);
172  ->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");
173  fSetFiniteRiseTimeCmd->SetParameterName("FiniteRiseTime", false);
175 }
176 
178 {
179 // Destructor
180 
181  delete fDir;
182  delete fSelectOpProcessCmd;
183  delete fSetOpProcessUseCmd;
189 // delete fSetOpticalSurfaceModelCmd;
190  delete fSetWLSTimeProfileCmd;
192  delete fSetFiniteRiseTimeCmd;
193 }
194 
196  G4String newValue)
197 {
199 
200  if (command == fSelectOpProcessCmd) {
201  if ( newValue == "Cerenkov" ) {
203  } else if ( newValue == "Scintillation" ) {
205  } else if ( newValue == "OpAbsorption" ) {
207  } else if ( newValue == "OpRayleigh" ) {
209  } else if ( newValue == "OpMieHG" ) {
211  } else if ( newValue == "OpBoundary" ) {
213  } else if ( newValue == "OpWLS" ) {
215  }
216  }
217  else if (command == fSetOpProcessUseCmd) {
219  Configure(fSelectedProcessIndex,
221  }
222  else if (command == fSetOpProcessVerboseCmd) {
225  SetProcessVerbose(fSelectedProcessIndex,
227  } else {
228  for ( G4int i=0; i<kNoProcess; i++ ) {
230  SetProcessVerbose(i,fSetOpProcessVerboseCmd->GetNewIntValue(newValue));
231  }
232  }
233  }
234  else if (command == fSetCerenkovMaxPhotonsCmd) {
238  }
239  else if (command == fSetCerenkovMaxBetaChangeCmd) {
243  }
244  else if (command == fSetScintillationYieldFactorCmd) {
248  }
249  else if (command == fSetScintillationByParticleTypeCmd) {
253  }
254  else if (command == fSetFiniteRiseTimeCmd) {
258  }
259 // else if (command == fSetOpticalSurfaceModelCmd) {
260 // if ( newValue == "glisur" ) {
261 // fOpticalPhysics
262 // ->SetOpticalSurfaceModel(glisur);
263 // }
264 // if ( newValue == "unified" ) {
265 // fOpticalPhysics
266 // ->SetOpticalSurfaceModel(unified);
267 // }
268 // }
269  else if (command == fSetWLSTimeProfileCmd) {
270  if ( newValue == "delta" ) {
272  ->SetWLSTimeProfile("delta"); }
273  if ( newValue == "exponential" ) {
275  ->SetWLSTimeProfile("exponential");
276  }
277  }
278  else if (command == fSetTrackSecondariesFirstCmd) {
281  GetNewBoolValue(newValue));
282  }
283 }
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4OpticalPhysics * fOpticalPhysics
associated class
virtual void SetNewValue(G4UIcommand *, G4String)
G4UIcmdWithABool * fSetFiniteRiseTimeCmd
setFiniteRiseTime command
Number of processes, no selected process.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4OpticalProcessIndex fSelectedProcessIndex
selected optical process
static G4int GetNewIntValue(const char *paramString)
void SetMaxBetaChangePerStep(G4double)
G4UIcmdWithAString * fSetWLSTimeProfileCmd
setWLSTimeProfile command
Scintillation process index.
Mie scattering process index.
G4UIcmdWithAnInteger * fSetOpProcessVerboseCmd
setProcessVerbose command
void SetFiniteRiseTime(G4bool)
Absorption process index.
int G4int
Definition: G4Types.hh:78
static G4bool GetNewBoolValue(const char *paramString)
void SetScintillationByParticleType(G4bool)
G4UIcmdWithAnInteger * fSetCerenkovMaxPhotonsCmd
setCerenkovMaxPhotons command
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithABool * fSetOpProcessUseCmd
setProcessUse command
G4UIcmdWithABool * fSetTrackSecondariesFirstCmd
setTrackSecondariesFirst command
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
G4UIcmdWithABool * fSetScintillationByParticleTypeCmd
setScintillationByParticleType command
Wave Length Shifting process index.
G4OpticalPhysicsMessenger()
Not implemented.
G4UIdirectory * fDir
command directory
G4String G4OpticalProcessName(G4int)
Return the name for a given optical process index.
Boundary process index.
void SetScintillationYieldFactor(G4double)
Cerenkov process index.
void SetWLSTimeProfile(G4String)
void SetTrackSecondariesFirst(G4OpticalProcessIndex, G4bool)
G4UIcmdWithADouble * fSetScintillationYieldFactorCmd
setScintillationYieldFactor command
void SetCandidates(const char *candidateList)
G4UIcmdWithADouble * fSetCerenkovMaxBetaChangeCmd
setCerenkovMaxBetaChange command
void SetDefaultValue(G4int defVal)
G4UIcmdWithAString * fSelectOpProcessCmd
selectOpProcess command
Rayleigh scattering process index.