00001
00002
00003
00004 static const char* MyStackingActionMessenger_cc =
00005 "@(#) $Id: MyStackingActionMessenger.cc 80 2007-12-09 10:01:09Z comet $";
00006
00007 #include "MyStackingActionMessenger.hh"
00008
00009 #include "MyStackingAction.hh"
00010 #include "G4UIdirectory.hh"
00011 #include "G4UIcmdWithAString.hh"
00012 #include "G4UIcmdWithADoubleAndUnit.hh"
00013 #include "G4UIcmdWithAnInteger.hh"
00014 #include "G4UIcmdWithoutParameter.hh"
00015 #include "myglobals.hh"
00016
00017 MyStackingActionMessenger::MyStackingActionMessenger(MyStackingAction* aStack)
00018 : fStackingAction(aStack) {
00019 fDir = new G4UIdirectory("/stacking/");
00020 fDir->SetGuidance("My stacking action control.");
00021
00022 fEleCmd = new G4UIcmdWithADoubleAndUnit("/stacking/setEleCut",this);
00023 fEleCmd->SetGuidance("Set the minimum energy of electron to be stacked.");
00024 fEleCmd->SetParameterName("eleCut",false);
00025 fEleCmd->SetUnitCategory("Energy");
00026 fEleCmd->AvailableForStates(G4State_Idle);
00027
00028 fPosCmd = new G4UIcmdWithADoubleAndUnit("/stacking/setPosCut",this);
00029 fPosCmd->SetGuidance("Set the minimum energy of positron to be stacked.");
00030 fPosCmd->SetParameterName("posCut",false);
00031 fPosCmd->SetUnitCategory("Energy");
00032 fPosCmd->AvailableForStates(G4State_Idle);
00033
00034 fGamCmd = new G4UIcmdWithADoubleAndUnit("/stacking/setGamCut",this);
00035 fGamCmd->SetGuidance("Set the minimum energy of gamma to be stacked.");
00036 fGamCmd->SetParameterName("gamCut",false);
00037 fGamCmd->SetUnitCategory("Energy");
00038 fGamCmd->AvailableForStates(G4State_Idle);
00039
00040 fadd_whiteCmd = new G4UIcmdWithAnInteger("/stacking/add_white_list", this);
00041 fadd_whiteCmd->SetGuidance("Add PDGEncoding to white list.");
00042 fadd_whiteCmd->SetParameterName("PDGEncoding",false);
00043 fadd_whiteCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00044
00045 fadd_blackCmd = new G4UIcmdWithAnInteger("/stacking/add_black_list", this);
00046 fadd_blackCmd->SetGuidance("Add PDGEncoding to black list.");
00047 fadd_blackCmd->SetParameterName("PDGEncoding",false);
00048 fadd_blackCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00049
00050 fclear_whiteCmd = new G4UIcmdWithoutParameter("/stacking/clear_white_list",this);
00051 fclear_whiteCmd->SetGuidance("Clear white list.");
00052 fclear_whiteCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00053
00054 fclear_blackCmd = new G4UIcmdWithoutParameter("/stacking/clear_black_list",this);
00055 fclear_blackCmd->SetGuidance("Clear black list.");
00056 fclear_blackCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00057
00058 fset_no_secCmd = new G4UIcmdWithAnInteger("/stacking/set_no_sec",this);
00059 fset_no_secCmd->SetGuidance("Set Muon Capture");
00060 fset_no_secCmd->SetParameterName("val",false);
00061 fset_no_secCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00062
00063 fset_no_MCCmd = new G4UIcmdWithAnInteger("/stacking/set_no_MC",this);
00064 fset_no_MCCmd->SetGuidance("Set Muon Capture");
00065 fset_no_MCCmd->SetParameterName("val",false);
00066 fset_no_MCCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00067
00068 fset_no_PCCmd = new G4UIcmdWithAnInteger("/stacking/set_no_PC",this);
00069 fset_no_PCCmd->SetGuidance("Set Pion Capture");
00070 fset_no_PCCmd->SetParameterName("val",false);
00071 fset_no_PCCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00072 }
00073
00074
00075 MyStackingActionMessenger::~MyStackingActionMessenger() {
00076 delete fDir;
00077 delete fEleCmd;
00078 delete fPosCmd;
00079 delete fGamCmd;
00080 delete fadd_whiteCmd;
00081 delete fadd_blackCmd;
00082 delete fclear_blackCmd;
00083 delete fclear_whiteCmd;
00084 delete fset_no_PCCmd;
00085 delete fset_no_secCmd;
00086 delete fset_no_MCCmd;
00087 }
00088
00089
00090 void MyStackingActionMessenger::SetNewValue(G4UIcommand * command,
00091 G4String newValue) {
00092 if( command == fEleCmd ) {
00093 fStackingAction->
00094 SetEleCut(fEleCmd->GetNewDoubleValue(newValue));
00095 }
00096
00097 if( command == fPosCmd ) {
00098 fStackingAction->
00099 SetPosCut(fPosCmd->GetNewDoubleValue(newValue));
00100 }
00101
00102 if( command == fGamCmd ) {
00103 fStackingAction->
00104 SetGamCut(fGamCmd->GetNewDoubleValue(newValue));
00105 }
00106
00107 if( command == fadd_whiteCmd ) {
00108 fStackingAction->
00109 add_white_list(fadd_whiteCmd->GetNewIntValue(newValue));
00110 }
00111
00112 if( command == fadd_blackCmd ) {
00113 fStackingAction->
00114 add_black_list(fadd_blackCmd->GetNewIntValue(newValue));
00115 }
00116
00117 if( command == fclear_whiteCmd ) {
00118 fStackingAction->
00119 clear_white_list();
00120 }
00121
00122 if( command == fclear_blackCmd ) {
00123 fStackingAction->
00124 clear_black_list();
00125 }
00126
00127 if( command == fset_no_secCmd ) {
00128 fStackingAction->
00129 set_no_sec(fset_no_secCmd->GetNewIntValue(newValue));
00130 }
00131
00132 if( command == fset_no_MCCmd ) {
00133 fStackingAction->
00134 set_no_MC(fset_no_MCCmd->GetNewIntValue(newValue));
00135 }
00136
00137 if( command == fset_no_PCCmd ) {
00138 fStackingAction->
00139 set_no_PC(fset_no_PCCmd->GetNewIntValue(newValue));
00140 }
00141
00142 }