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 #include "G4ProductionCutsTableMessenger.hh"
00039 #include "G4ProductionCutsTable.hh"
00040
00041 #include "G4UIdirectory.hh"
00042 #include "G4UIcmdWithoutParameter.hh"
00043 #include "G4UIcmdWithAnInteger.hh"
00044 #include "G4UIcmdWithADoubleAndUnit.hh"
00045 #include "G4UIcmdWithAString.hh"
00046 #include "G4ios.hh"
00047 #include "G4Tokenizer.hh"
00048
00049 #include <sstream>
00050
00051 G4ProductionCutsTableMessenger::G4ProductionCutsTableMessenger( G4ProductionCutsTable* pTable)
00052 :theCutsTable(pTable)
00053 {
00054
00055 theDirectory = new G4UIdirectory("/cuts/");
00056 theDirectory->SetGuidance("Commands for G4VUserPhysicsList.");
00057
00058
00059 verboseCmd = new G4UIcmdWithAnInteger("/cuts/verbose",this);
00060 verboseCmd->SetGuidance("Set the Verbose level of G4ProductionCutsTable.");
00061 verboseCmd->SetGuidance(" 0 : Silent (default)");
00062 verboseCmd->SetGuidance(" 1 : Display warning messages");
00063 verboseCmd->SetGuidance(" 2 : Display more info");
00064 verboseCmd->SetGuidance(" 2 : Display debug info");
00065 verboseCmd->SetParameterName("level",true);
00066 verboseCmd->SetDefaultValue(0);
00067 verboseCmd->SetRange("level >=0 && level <=3");
00068
00069
00070 setLowEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setLowEdge",this);
00071 setLowEdgeCmd->SetGuidance("Set low edge energy value ");
00072 setLowEdgeCmd->SetParameterName("edge",false);
00073 setLowEdgeCmd->SetDefaultValue(0.99);
00074 setLowEdgeCmd->SetRange("edge >0.0");
00075 setLowEdgeCmd->SetDefaultUnit("keV");
00076 setLowEdgeCmd->AvailableForStates(G4State_PreInit);
00077
00078
00079 setHighEdgeCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setHighEdge",this);
00080 setHighEdgeCmd->SetGuidance("Set high edge energy value ");
00081 setHighEdgeCmd->SetParameterName("edge",false);
00082 setHighEdgeCmd->SetDefaultValue(100.0);
00083 setHighEdgeCmd->SetRange("edge >0.0");
00084 setHighEdgeCmd->SetDefaultUnit("TeV");
00085 setHighEdgeCmd->AvailableForStates(G4State_PreInit);
00086
00087
00088 setMaxEnergyCutCmd = new G4UIcmdWithADoubleAndUnit("/cuts/setMaxCutEnergy",this);
00089 setMaxEnergyCutCmd->SetGuidance("Set maximum of cut energy value ");
00090 setMaxEnergyCutCmd->SetParameterName("cut",false);
00091 setMaxEnergyCutCmd->SetDefaultValue(10.0);
00092 setMaxEnergyCutCmd->SetRange("cut >0.0");
00093 setMaxEnergyCutCmd->SetDefaultUnit("GeV");
00094 setMaxEnergyCutCmd->AvailableForStates(G4State_PreInit);
00095
00096
00097 dumpCmd = new G4UIcmdWithoutParameter("/cuts/dump",this);
00098 dumpCmd->SetGuidance("Dump cuplues in ProductuinCutsTable. ");
00099
00100 }
00101
00102 G4ProductionCutsTableMessenger::~G4ProductionCutsTableMessenger()
00103 {
00104 delete dumpCmd;
00105 delete setMaxEnergyCutCmd;
00106 delete setHighEdgeCmd;
00107 delete setLowEdgeCmd;
00108 delete verboseCmd;
00109 delete theDirectory;
00110 }
00111
00112 void G4ProductionCutsTableMessenger::SetNewValue(G4UIcommand * command,
00113 G4String newValue)
00114 {
00115 if( command==verboseCmd ) {
00116 theCutsTable->SetVerboseLevel(verboseCmd->GetNewIntValue(newValue));
00117
00118 } else if( command==dumpCmd ){
00119 theCutsTable-> DumpCouples();
00120
00121 } else if( command==setLowEdgeCmd ){
00122 G4double lowEdge = setLowEdgeCmd->GetNewDoubleValue(newValue);
00123 G4double highEdge = theCutsTable->GetHighEdgeEnergy();
00124 theCutsTable->SetEnergyRange(lowEdge, highEdge);
00125
00126 } else if( command==setHighEdgeCmd ){
00127 G4double highEdge = setHighEdgeCmd->GetNewDoubleValue(newValue);
00128 G4double lowEdge = theCutsTable->GetLowEdgeEnergy();
00129 theCutsTable->SetEnergyRange(lowEdge, highEdge);
00130
00131 } else if( command==setMaxEnergyCutCmd ){
00132 G4double cut = setHighEdgeCmd->GetNewDoubleValue(newValue);
00133 theCutsTable->SetMaxEnergyCut(cut);
00134
00135 }
00136 }
00137
00138 G4String G4ProductionCutsTableMessenger::GetCurrentValue(G4UIcommand * command)
00139 {
00140 G4String cv;
00141
00142 if( command==verboseCmd ){
00143 cv = verboseCmd->ConvertToString(theCutsTable->GetVerboseLevel());
00144
00145 } else if( command==setLowEdgeCmd ){
00146 G4double lowEdge = theCutsTable->GetLowEdgeEnergy();
00147 cv = setLowEdgeCmd->ConvertToString( lowEdge, "keV" );
00148
00149 } else if( command==setHighEdgeCmd ){
00150 G4double highEdge = theCutsTable->GetHighEdgeEnergy();
00151 cv = setHighEdgeCmd->ConvertToString( highEdge, "TeV" );
00152
00153 } else if( command==setMaxEnergyCutCmd ){
00154 G4double cut = theCutsTable->GetMaxEnergyCut();
00155 cv = setMaxEnergyCutCmd->ConvertToString( cut, "GeV" );
00156 }
00157
00158
00159 return cv;
00160
00161 }
00162