Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4OpticalPhysicsMessenger.cc
이 파일의 문서화 페이지로 가기
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 #include "G4UIparameter.hh"
53 
54 #include "G4ParticleTable.hh"
55 #include "G4ProcessManager.hh"
56 #include "G4ParticleDefinition.hh"
57 
58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
59 
61  G4OpticalPhysics* opticalPhysics)
62  : G4UImessenger(),
63  fOpticalPhysics(opticalPhysics),
64  fSelectedProcessIndex(kNoProcess),
65  fActivateProcessCmd(0),
66  fSetOpProcessVerboseCmd(0),
67  fSetCerenkovMaxPhotonsCmd(0),
68  fSetCerenkovMaxBetaChangeCmd(0),
69  fSetCerenkovStackPhotonsCmd(0),
70  fSetScintillationYieldFactorCmd(0),
71  fSetScintillationByParticleTypeCmd(0),
72  fSetScintillationTrackInfoCmd(0),
73  fSetScintillationStackPhotonsCmd(0),
74  fSetWLSTimeProfileCmd(0),
75  fSetTrackSecondariesFirstCmd(0),
76  fSetFiniteRiseTimeCmd(0),
77  fSetInvokeSDCmd(0)
78 {
79  G4bool toBeBroadcasted = false;
80  fDir = new G4UIdirectory("/process/optical/defaults/",toBeBroadcasted);
81  fDir->SetGuidance("Commands related to the optical physics simulation engine.");
82  fDir2 = new G4UIdirectory("/process/optical/",toBeBroadcasted);
83  fDir2->SetGuidance("Commands related to the optical physics simulation engine.");
84 
85  fActivateProcessCmd= new G4UIcommand("/process/optical/processActivation", this);
86  fActivateProcessCmd->SetGuidance("Activate/deactivate the specified optical process");
87  G4UIparameter* par = new G4UIparameter("proc_name",'s',false);
88  G4String candidates;
89  for ( G4int i=0; i<kNoProcess; i++ ) {
90  candidates += G4OpticalProcessName(i);
91  candidates += G4String(" ");
92  }
93  par->SetParameterCandidates(candidates);
94  par->SetGuidance("the process name");
96  par = new G4UIparameter("flag",'b',true);
97  par->SetDefaultValue(true);
98  par->SetGuidance("activation flag");
101 
102 
103  fSetOpProcessVerboseCmd = new G4UIcmdWithAnInteger("/process/optical/verbose", this);
104  fSetOpProcessVerboseCmd->SetGuidance("Set default verbosity level for optical processes");
109 
110 
111  fSetTrackSecondariesFirstCmd = new G4UIcommand("/process/optical/setTrackSecondariesFirst", this);
112  fSetTrackSecondariesFirstCmd->SetGuidance("Activate/deactivate tracking of secondaries before finishing their parent track");
113  par = new G4UIparameter("proc_name",'s',false);
114  par->SetParameterCandidates(candidates);
116  par = new G4UIparameter("flag",'b',false);
117  par->SetDefaultValue(true);
120 
121  //This are repetition of process specific ui commands needed by ATLICE and VMC
122  //(UI messages needed to exist in PreInit state before actual processes are instantiated)
123  fSetCerenkovMaxPhotonsCmd = new G4UIcmdWithAnInteger("/process/optical/defaults/cerenkov/setMaxPhotons", this);
124  fSetCerenkovMaxPhotonsCmd->SetGuidance("Set default maximum number of photons per step");
125  fSetCerenkovMaxPhotonsCmd->SetGuidance("Note this command is used to set the default value,");
126  fSetCerenkovMaxPhotonsCmd->SetGuidance("if process is not active command will not have effect.");
127  fSetCerenkovMaxPhotonsCmd->SetParameterName("CerenkovMaxPhotons", false);
128  fSetCerenkovMaxPhotonsCmd->SetRange("CerenkovMaxPhotons>=0");
130 
131  fSetCerenkovMaxBetaChangeCmd = new G4UIcmdWithADouble("/process/optical/defaults/cerenkov/setMaxBetaChange", this);
132  fSetCerenkovMaxBetaChangeCmd->SetGuidance("Set default maximum change of beta of parent particle per step");
133  fSetCerenkovMaxBetaChangeCmd->SetGuidance("Note this command is used to set the default value,");
134  fSetCerenkovMaxBetaChangeCmd->SetGuidance("if process is not active command will not have effect.");
135  fSetCerenkovMaxBetaChangeCmd->SetParameterName("CerenkovMaxBetaChange", false);
136  fSetCerenkovMaxBetaChangeCmd->SetRange("CerenkovMaxBetaChange>=0");
138 
139  fSetCerenkovStackPhotonsCmd = new G4UIcmdWithABool("/process/optical/defaults/cerenkov/setStackPhotons", this);
140  fSetCerenkovStackPhotonsCmd->SetGuidance("Set default whether or not to stack secondary Cerenkov photons");
141  fSetCerenkovStackPhotonsCmd->SetGuidance("Note this command is used to set the default value,");
142  fSetCerenkovStackPhotonsCmd->SetGuidance("if process is not active command will not have effect.");
143  fSetCerenkovStackPhotonsCmd->SetParameterName("CerenkovStackPhotons", true);
145 
146  fSetScintillationYieldFactorCmd = new G4UIcmdWithADouble("/process/optical/defaults/scintillation/setYieldFactor", this);
147  fSetScintillationYieldFactorCmd->SetGuidance("Set scintillation yield factor");
148  fSetScintillationYieldFactorCmd->SetGuidance("Note this command is used to set the default value,");
149  fSetScintillationYieldFactorCmd->SetGuidance("if process is not active command will not have effect.");
150  fSetScintillationYieldFactorCmd->SetParameterName("ScintillationYieldFactor", false);
151  fSetScintillationYieldFactorCmd->SetRange("ScintillationYieldFactor>=0");
153 
154  fSetScintillationByParticleTypeCmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setByParticleType", this);
155  fSetScintillationByParticleTypeCmd->SetGuidance("Activate/Inactivate scintillation process by particle type");
156  fSetScintillationByParticleTypeCmd->SetGuidance("Note this command is used to set the default value,");
157  fSetScintillationByParticleTypeCmd->SetGuidance("if process is not active command will not have effect.");
158  fSetScintillationByParticleTypeCmd->SetParameterName("ScintillationByParticleTypeActivation", false);
160 
161  fSetScintillationTrackInfoCmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setTrackInfo", this);
162  fSetScintillationTrackInfoCmd->SetGuidance("Activate/Inactivate scintillation TrackInformation");
163  fSetScintillationTrackInfoCmd->SetParameterName("ScintillationTrackInfo", false);
165 
166  fSetFiniteRiseTimeCmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setFiniteRiseTime", this);
167  fSetFiniteRiseTimeCmd->SetGuidance("Set option of a finite rise-time for G4Scintillation");
168  fSetFiniteRiseTimeCmd->SetGuidance("If set, the G4Scintillation process expects the user to have set the constant material property FAST/SLOWSCINTILLATIONRISETIME");
169  fSetFiniteRiseTimeCmd->SetGuidance("Note this command is used to set the default value,");
170  fSetFiniteRiseTimeCmd->SetGuidance("if process is not active command will not have effect.");
171  fSetFiniteRiseTimeCmd->SetParameterName("FiniteRiseTime", false);
173 
174  fSetScintillationStackPhotonsCmd = new G4UIcmdWithABool("/process/optical/defaults/scintillation/setStackPhotons", this);
175  fSetScintillationStackPhotonsCmd->SetGuidance("Set default whether or not to stack secondary Scintillation photons");
176  fSetScintillationStackPhotonsCmd->SetGuidance("Note this command is used to set the default value,");
177  fSetScintillationStackPhotonsCmd->SetGuidance("if process is not active command will not have effect.");
178  fSetScintillationStackPhotonsCmd->SetParameterName("ScintillationStackPhotons", true);
180 
181  fSetWLSTimeProfileCmd = new G4UIcmdWithAString("/process/optical/defaults/wls/setTimeProfile", this);
182  fSetWLSTimeProfileCmd->SetGuidance("Set the WLS time profile (delta or exponential)");
183  fSetWLSTimeProfileCmd->SetParameterName("WLSTimeProfile", false);
184  fSetWLSTimeProfileCmd->SetCandidates("delta exponential");
186 
187  fSetInvokeSDCmd = new G4UIcmdWithABool("/process/optical/defaults/boundary/setInvokeSD", this);
188  fSetInvokeSDCmd->SetGuidance("Set option for calling InvokeSD in G4OpBoundaryProcess");
189  fSetInvokeSDCmd->SetParameterName("InvokeSD", false);
191 }
192 
194 {
195 // Destructor
196 
197  delete fDir;
198  delete fDir2;
199  delete fActivateProcessCmd;
208  delete fSetWLSTimeProfileCmd;
210  delete fSetFiniteRiseTimeCmd;
211  delete fSetInvokeSDCmd;
212 }
213 
214 #include <iostream>
216  G4String newValue)
217 {
219  if (command == fActivateProcessCmd) {
220  std::istringstream is(newValue.data());
221  G4String pn;
222  G4String flag;
223  is >> pn >> flag;
224  if ( pn == "Cerenkov" ) {
226  } else if ( pn == "Scintillation" ) {
228  } else if ( pn == "OpAbsorption" ) {
230  } else if ( pn == "OpRayleigh" ) {
232  } else if ( pn == "OpMieHG" ) {
234  } else if ( pn == "OpBoundary" ) {
236  } else if ( pn == "OpWLS" ) {
238  } else {
240  msg << "Not allowed process name: "<<pn<<" (UI: "<<newValue<<")";
241  G4Exception("G4OpticalPhysicsMessenger::SetNewValue(...)","Optical001",FatalException,msg);
242  }
245  }
246  else if (command == fSetTrackSecondariesFirstCmd )
247  {
248  std::istringstream is(newValue.data());
249  G4String pn;
250  G4String flag;
251  is >> pn >> flag;
252  if ( pn == "Cerenkov" ) {
254  } else if ( pn == "Scintillation" ) {
256  } else if ( pn == "OpAbsorption" ) {
258  } else if ( pn == "OpRayleigh" ) {
260  } else if ( pn == "OpMieHG" ) {
262  } else if ( pn == "OpBoundary" ) {
264  } else if ( pn == "OpWLS" ) {
266  } else {
268  msg << "Not allowed process name: "<<pn<<" (UI: "<<newValue<<")";
269  G4Exception("G4OpticalPhysicsMessenger::SetNewValue(...)","Optical001",FatalException,msg);
270  }
273  }
274  else if (command == fSetOpProcessVerboseCmd) {
276  }
277  else if (command == fSetCerenkovMaxPhotonsCmd) {
281  }
282  else if (command == fSetCerenkovMaxBetaChangeCmd) {
286  }
287  else if (command == fSetCerenkovStackPhotonsCmd) {
291  }
292  else if (command == fSetScintillationYieldFactorCmd) {
296  }
297  else if (command == fSetScintillationByParticleTypeCmd) {
301  }
302  else if (command == fSetScintillationTrackInfoCmd) {
306  }
307  else if (command == fSetFiniteRiseTimeCmd) {
311  }
312  else if (command == fSetScintillationStackPhotonsCmd) {
316  }
317  else if (command == fSetWLSTimeProfileCmd) {
319  }
320  else if (command == fSetInvokeSDCmd) {
323  }
324 }
G4UIcmdWithABool * fSetScintillationStackPhotonsCmd
setStackPhotons command
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:161
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:45
G4UIcmdWithAString * fSetWLSTimeProfileCmd
setWLSTimeProfile command
void SetVerboseLevel(G4int value)
Rayleigh scattering process index.
G4UIcmdWithADouble * fSetCerenkovMaxBetaChangeCmd
setCerenkovMaxBetaChange command
void SetCerenkovStackPhotons(G4bool)
Scintillation process index.
void SetDefaultValue(G4int defVal)
void SetFiniteRiseTime(G4bool)
void Configure(G4OpticalProcessIndex, G4bool)
G4UIcmdWithABool * fSetFiniteRiseTimeCmd
setFiniteRiseTime command
static G4bool ConvertToBool(const char *st)
Definition: G4UIcommand.cc:439
void SetRange(const char *rs)
Definition: G4UIcommand.hh:125
static G4double GetNewDoubleValue(const char *paramString)
G4UIcmdWithABool * fSetScintillationByParticleTypeCmd
setScintillationByParticleType command
G4UIcmdWithABool * fSetInvokeSDCmd
setInvokeSD command
G4UIdirectory * fDir
command directory
Absorption process index.
void SetGuidance(const char *theGuidance)
static G4bool GetNewBoolValue(const char *paramString)
virtual void SetNewValue(G4UIcommand *, G4String)
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:152
void SetDefaultValue(const char *theDefaultValue)
void SetMaxBetaChangePerStep(G4double)
bool G4bool
Definition: G4Types.hh:79
Number of processes, no selected process.
G4UIcommand * fSetTrackSecondariesFirstCmd
setTrackSecondariesFirst command
const XML_Char int const XML_Char * value
Definition: expat.h:331
void SetScintillationByParticleType(G4bool)
Cerenkov process index.
const char * data() const
Boundary process index.
void SetCandidates(const char *candidateList)
void SetScintillationStackPhotons(G4bool)
G4String G4OpticalProcessName(G4int)
Return the name for a given optical process index.
G4UIcommand * fActivateProcessCmd
selectOpProcess command
void SetScintillationYieldFactor(G4double)
void SetTrackSecondariesFirst(G4OpticalProcessIndex, G4bool)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
G4OpticalPhysicsMessenger()
Not implemented.
int G4int
Definition: G4Types.hh:78
G4UIcmdWithABool * fSetCerenkovStackPhotonsCmd
setStackPhotons command
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
static G4int GetNewIntValue(const char *paramString)
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4UIcmdWithABool * fSetScintillationTrackInfoCmd
setScintillationTrackInfo command
G4OpticalPhysics * fOpticalPhysics
associated class
Wave Length Shifting process index.
void SetParameterName(const char *theName, G4bool omittable, G4bool currentAsDefault=false)
G4OpticalProcessIndex fSelectedProcessIndex
selected optical process
void SetMaxNumPhotonsPerStep(G4int)
void SetInvokeSD(G4bool)
void SetParameterCandidates(const char *theString)
void SetScintillationTrackInfo(G4bool)
G4UIcmdWithAnInteger * fSetOpProcessVerboseCmd
setProcessVerbose command
void AvailableForStates(G4ApplicationState s1)
Definition: G4UIcommand.cc:242
void SetWLSTimeProfile(G4String)
G4UIcmdWithADouble * fSetScintillationYieldFactorCmd
setScintillationYieldFactor command
G4UIcmdWithAnInteger * fSetCerenkovMaxPhotonsCmd
setCerenkovMaxPhotons command
Mie scattering process index.