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 #include "G4ErrorMessenger.hh"
00034 #include "G4ErrorStepLengthLimitProcess.hh"
00035 #include "G4ErrorMagFieldLimitProcess.hh"
00036 #include "G4ErrorEnergyLoss.hh"
00037
00038 #include "G4UIdirectory.hh"
00039 #include "G4UIcmdWithADoubleAndUnit.hh"
00040 #include "G4UIcmdWithADouble.hh"
00041 #include "globals.hh"
00042
00043 #ifdef G4VERBOSE
00044 #include "G4ErrorPropagatorData.hh"
00045 #endif
00046
00047
00048 G4ErrorMessenger::G4ErrorMessenger(G4ErrorStepLengthLimitProcess* lengthAct, G4ErrorMagFieldLimitProcess* magAct, G4ErrorEnergyLoss* elossAct)
00049 :StepLengthAction(lengthAct),MagFieldAction(magAct),EnergyLossAction(elossAct)
00050 {
00051
00052 myDir = new G4UIdirectory("/geant4e/");
00053 myDir->SetGuidance("GEANT4e control commands");
00054
00055 myDirLimits = new G4UIdirectory("/geant4e/limits/");
00056 myDirLimits->SetGuidance("GEANT4e commands to limit the step");
00057
00058
00059 StepLengthLimitCmd = new G4UIcmdWithADoubleAndUnit("/geant4e/limits/stepLength",this);
00060 StepLengthLimitCmd->SetGuidance("Limit the length of an step");
00061 StepLengthLimitCmd->SetDefaultUnit("mm");
00062 StepLengthLimitCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc);
00063
00064 MagFieldLimitCmd = new G4UIcmdWithADouble("/geant4e/limits/magField",this);
00065 MagFieldLimitCmd->SetGuidance("Limit the length of an step");
00066 MagFieldLimitCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc);
00067
00068 EnergyLossCmd = new G4UIcmdWithADouble("/geant4e/limits/energyLoss",this);
00069 EnergyLossCmd->SetGuidance("Limit the length of an step");
00070 EnergyLossCmd->AvailableForStates(G4State_PreInit,G4State_Idle,G4State_GeomClosed,G4State_EventProc);
00071 }
00072
00073
00074
00075 G4ErrorMessenger::~G4ErrorMessenger()
00076 {
00077 delete StepLengthLimitCmd;
00078 delete MagFieldLimitCmd;
00079 delete EnergyLossCmd;
00080 delete myDir;
00081 delete myDirLimits;
00082 }
00083
00084
00085
00086 void G4ErrorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
00087 {
00088 if( command == StepLengthLimitCmd ) {
00089 #ifdef G4VERBOSE
00090 if(G4ErrorPropagatorData::verbose() >= 3 ) {
00091 G4cout << " G4ErrorMessenger::StepLengthAction SetStepLimit " << StepLengthLimitCmd->GetNewDoubleValue(newValue) << G4endl;
00092 }
00093 #endif
00094 StepLengthAction->SetStepLimit(StepLengthLimitCmd->GetNewDoubleValue(newValue));
00095 } else if( command == MagFieldLimitCmd ) {
00096 #ifdef G4VERBOSE
00097 if(G4ErrorPropagatorData::verbose() >= 3 ) {
00098 G4cout << " G4ErrorMessenger::MagFieldAction SetStepLimit " << MagFieldLimitCmd->GetNewDoubleValue(newValue) << G4endl;
00099 }
00100 #endif
00101 MagFieldAction->SetStepLimit(MagFieldLimitCmd->GetNewDoubleValue(newValue));
00102 } else if( command == EnergyLossCmd ) {
00103 #ifdef G4VERBOSE
00104 if(G4ErrorPropagatorData::verbose() >= 3 ) {
00105 G4cout << " G4ErrorMessenger::EnergyLossAction SetStepLimit " << EnergyLossCmd->GetNewDoubleValue(newValue) << G4endl;
00106 }
00107 #endif
00108 EnergyLossAction->SetStepLimit(EnergyLossCmd->GetNewDoubleValue(newValue));
00109 }
00110 }
00111