00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #include "G4OpticalPhysicsMessenger.hh"
00040 #include "G4OpticalPhysics.hh"
00041
00042 #include "G4UIcommand.hh"
00043 #include "G4UIdirectory.hh"
00044
00045 #include "G4UIcommand.hh"
00046 #include "G4UIdirectory.hh"
00047 #include "G4UIcmdWithABool.hh"
00048 #include "G4UIcmdWithAString.hh"
00049 #include "G4UIcmdWithADouble.hh"
00050 #include "G4UIcmdWithAnInteger.hh"
00051 #include "G4UIcmdWithADoubleAndUnit.hh"
00052
00053 #include "G4ParticleTable.hh"
00054 #include "G4ProcessVector.hh"
00055 #include "G4ProcessManager.hh"
00056 #include "G4ParticleDefinition.hh"
00057
00058
00059 G4OpticalPhysicsMessenger::G4OpticalPhysicsMessenger(
00060 G4OpticalPhysics* opticalPhysics)
00061 : G4UImessenger(),
00062 fOpticalPhysics(opticalPhysics),
00063 fSelectedProcessIndex(kNoProcess),
00064 fSelectOpProcessCmd(0),
00065 fSetOpProcessUseCmd(0),
00066 fSetOpProcessVerboseCmd(0),
00067 fSetCerenkovMaxPhotonsCmd(0),
00068 fSetCerenkovMaxBetaChangeCmd(0),
00069 fSetScintillationYieldFactorCmd(0),
00070 fSetScintillationByParticleTypeCmd(0),
00071
00072 fSetWLSTimeProfileCmd(0),
00073 fSetTrackSecondariesFirstCmd(0),
00074 fSetFiniteRiseTimeCmd(0)
00075 {
00076 fDir = new G4UIdirectory("/optics_engine/");
00077 fDir->SetGuidance("Commands related to the optical physics simulation engine.");
00078
00079 fSelectOpProcessCmd
00080 = new G4UIcmdWithAString("/optics_engine/selectOpProcess", this);
00081 fSelectOpProcessCmd
00082 ->SetGuidance("Select optical process for applying use/verbose/trackfirst commands");
00083 fSelectOpProcessCmd->SetParameterName("OpProcess", false);
00084 G4String candidates;
00085 for ( G4int i=0; i<kNoProcess; i++ ) {
00086 candidates += G4OpticalProcessName(i);
00087 candidates += G4String(" ");
00088 }
00089 fSelectOpProcessCmd->SetCandidates(candidates);
00090 fSelectOpProcessCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
00091
00092 fSetOpProcessUseCmd
00093 = new G4UIcmdWithABool("/optics_engine/setOpProcessUse", this);
00094 fSetOpProcessUseCmd->SetGuidance("Use/Not use selected optical process");
00095 fSetOpProcessUseCmd->SetParameterName("OpProcessUse", false);
00096 fSetOpProcessUseCmd->AvailableForStates(G4State_PreInit);
00097
00098 fSetOpProcessVerboseCmd
00099 = new G4UIcmdWithAnInteger("/optics_engine/setOpProcessVerbose", this);
00100 fSetOpProcessVerboseCmd->SetGuidance("Set verbosity level for selected optical process");
00101 fSetOpProcessVerboseCmd->SetParameterName("OpProcessVerbose", false);
00102 fSetOpProcessVerboseCmd->SetRange("OpProcessVerbose>=0");
00103 fSetOpProcessVerboseCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
00104
00105 fSetCerenkovMaxPhotonsCmd
00106 = new G4UIcmdWithAnInteger("/optics_engine/setCerenkovMaxPhotons", this);
00107 fSetCerenkovMaxPhotonsCmd->SetGuidance("Set maximum number of photons per step");
00108 fSetCerenkovMaxPhotonsCmd->SetParameterName("CerenkovMaxPhotons", false);
00109 fSetCerenkovMaxPhotonsCmd->SetRange("CerenkovMaxPhotons>=0");
00110 fSetCerenkovMaxPhotonsCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
00111
00112 fSetCerenkovMaxBetaChangeCmd
00113 = new G4UIcmdWithADouble("/optics_engine/setCerenkovMaxBetaChange", this);
00114 fSetCerenkovMaxBetaChangeCmd
00115 ->SetGuidance("Set maximum change of beta of parent particle per step");
00116 fSetCerenkovMaxBetaChangeCmd->SetParameterName("CerenkovMaxBetaChange", false);
00117 fSetCerenkovMaxBetaChangeCmd->SetRange("CerenkovMaxBetaChange>=0");
00118 fSetCerenkovMaxBetaChangeCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
00119
00120 fSetScintillationYieldFactorCmd
00121 = new G4UIcmdWithADouble("/optics_engine/setScintillationYieldFactor", this);
00122 fSetScintillationYieldFactorCmd->SetGuidance("Set scintillation yield factor");
00123 fSetScintillationYieldFactorCmd->SetParameterName("ScintillationYieldFactor", false);
00124 fSetScintillationYieldFactorCmd->SetRange("ScintillationYieldFactor>=0");
00125 fSetScintillationYieldFactorCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
00126
00127 fSetScintillationByParticleTypeCmd
00128 = new G4UIcmdWithABool("/optics_engine/setScintillationByParticleType", this);
00129 fSetScintillationByParticleTypeCmd->SetGuidance("Activate/Inactivate scintillation process by particle type");
00130 fSetScintillationByParticleTypeCmd->SetParameterName("ScintillationByParticleTypeActivation", false);
00131 fSetScintillationByParticleTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141 fSetWLSTimeProfileCmd
00142 = new G4UIcmdWithAString("/optics_engine/setWLSTimeProfile", this);
00143 fSetWLSTimeProfileCmd
00144 ->SetGuidance("Set the WLS time profile (delta or exponential)");
00145 fSetWLSTimeProfileCmd->SetParameterName("WLSTimeProfile", false);
00146 fSetWLSTimeProfileCmd->SetCandidates("delta exponential");
00147 fSetWLSTimeProfileCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
00148
00149 fSetTrackSecondariesFirstCmd
00150 = new G4UIcmdWithABool("/optics_engine/setTrackSecondariesFirst", this);
00151 fSetTrackSecondariesFirstCmd
00152 ->SetGuidance("Set option to track secondaries before finishing their parent track");
00153 fSetTrackSecondariesFirstCmd->SetParameterName("TrackSecondariesFirst", false);
00154 fSetTrackSecondariesFirstCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
00155
00156 fSetFiniteRiseTimeCmd
00157 = new G4UIcmdWithABool("/optics_engine/setFiniteRiseTime", this);
00158 fSetFiniteRiseTimeCmd
00159 ->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");
00160 fSetFiniteRiseTimeCmd->SetParameterName("FiniteRiseTime", false);
00161 fSetFiniteRiseTimeCmd->AvailableForStates(G4State_PreInit, G4State_Idle, G4State_GeomClosed, G4State_EventProc);
00162 }
00163
00164 G4OpticalPhysicsMessenger::~G4OpticalPhysicsMessenger()
00165 {
00166
00167
00168 delete fDir;
00169 delete fSelectOpProcessCmd;
00170 delete fSetOpProcessUseCmd;
00171 delete fSetOpProcessVerboseCmd;
00172 delete fSetCerenkovMaxPhotonsCmd;
00173 delete fSetCerenkovMaxBetaChangeCmd;
00174 delete fSetScintillationYieldFactorCmd;
00175 delete fSetScintillationByParticleTypeCmd;
00176
00177 delete fSetWLSTimeProfileCmd;
00178 delete fSetTrackSecondariesFirstCmd;
00179 delete fSetFiniteRiseTimeCmd;
00180 }
00181
00182 void G4OpticalPhysicsMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
00183 {
00185
00186 if (command == fSelectOpProcessCmd) {
00187 if ( newValue == "Cerenkov" ) {
00188 fSelectedProcessIndex = kCerenkov;
00189 } else if ( newValue == "Scintillation" ) {
00190 fSelectedProcessIndex = kScintillation;
00191 } else if ( newValue == "OpAbsorption" ) {
00192 fSelectedProcessIndex = kAbsorption;
00193 } else if ( newValue == "OpRayleigh" ) {
00194 fSelectedProcessIndex = kRayleigh;
00195 } else if ( newValue == "OpMieHG" ) {
00196 fSelectedProcessIndex = kMieHG;
00197 } else if ( newValue == "OpBoundary" ) {
00198 fSelectedProcessIndex = kBoundary;
00199 } else if ( newValue == "OpWLS" ) {
00200 fSelectedProcessIndex = kWLS;
00201 }
00202 }
00203 else if (command == fSetOpProcessUseCmd) {
00204 fOpticalPhysics->
00205 Configure(fSelectedProcessIndex,
00206 fSetOpProcessUseCmd->GetNewBoolValue(newValue));
00207 }
00208 else if (command == fSetOpProcessVerboseCmd) {
00209 if ( fSelectedProcessIndex < kNoProcess ) {
00210 fOpticalPhysics->
00211 SetProcessVerbose(fSelectedProcessIndex,
00212 fSetOpProcessVerboseCmd->GetNewIntValue(newValue));
00213 } else {
00214 for ( G4int i=0; i<kNoProcess; i++ ) {
00215 fOpticalPhysics->
00216 SetProcessVerbose(i,fSetOpProcessVerboseCmd->GetNewIntValue(newValue));
00217 }
00218 }
00219 }
00220 else if (command == fSetCerenkovMaxPhotonsCmd) {
00221 fOpticalPhysics
00222 ->SetMaxNumPhotonsPerStep(
00223 fSetCerenkovMaxPhotonsCmd->GetNewIntValue(newValue));
00224 }
00225 else if (command == fSetCerenkovMaxBetaChangeCmd) {
00226 fOpticalPhysics
00227 ->SetMaxBetaChangePerStep(
00228 fSetCerenkovMaxBetaChangeCmd->GetNewDoubleValue(newValue));
00229 }
00230 else if (command == fSetScintillationYieldFactorCmd) {
00231 fOpticalPhysics
00232 ->SetScintillationYieldFactor(
00233 fSetScintillationYieldFactorCmd->GetNewDoubleValue(newValue));
00234 }
00235 else if (command == fSetScintillationByParticleTypeCmd) {
00236 fOpticalPhysics
00237 ->SetScintillationByParticleType(
00238 fSetScintillationByParticleTypeCmd->GetNewBoolValue(newValue));
00239 }
00240 else if (command == fSetFiniteRiseTimeCmd) {
00241 fOpticalPhysics
00242 ->SetFiniteRiseTime(
00243 fSetFiniteRiseTimeCmd->GetNewBoolValue(newValue));
00244 }
00245
00246
00247
00248
00249
00250
00251
00252
00253
00254
00255 else if (command == fSetWLSTimeProfileCmd) {
00256 if ( newValue == "delta" ) {
00257 fOpticalPhysics
00258 ->SetWLSTimeProfile("delta"); }
00259 if ( newValue == "exponential" ) {
00260 fOpticalPhysics
00261 ->SetWLSTimeProfile("exponential");
00262 }
00263 }
00264 else if (command == fSetTrackSecondariesFirstCmd) {
00265 fOpticalPhysics->SetTrackSecondariesFirst(fSelectedProcessIndex,
00266 fSetTrackSecondariesFirstCmd->
00267 GetNewBoolValue(newValue));
00268 }
00269 }