00001
00002
00003
00004
00005
00006
00007
00008 #include "MyAnalysisSvcMessenger.hh"
00009
00010 #include "MyAnalysisSvc.hh"
00011 #include "myglobals.hh"
00012 #include "G4UIdirectory.hh"
00013 #include "G4UIcmdWithAString.hh"
00014 #include "G4UIcmdWithAnInteger.hh"
00015 #include "G4UIcmdWithABool.hh"
00016 #include "G4UIcmdWithADoubleAndUnit.hh"
00017
00018
00019
00020 MyAnalysisSvcMessenger::MyAnalysisSvcMessenger(MyAnalysisSvc* myAnalysisSvc)
00021 :m_myAnalysisSvc(myAnalysisSvc)
00022 {
00023
00024 myAnalysisSvcDir = new G4UIdirectory("/g4sim/myAnalysisSvc/");
00025 myAnalysisSvcDir->SetGuidance("myAnalysisSvc control");
00026
00027
00028 out_card_cmd = new G4UIcmdWithAString("/g4sim/myAnalysisSvc/set_out_card",this);
00029 out_card_cmd->SetGuidance("set name for MyAnalysisSvc file");
00030 out_card_cmd->SetParameterName("out_card",false);
00031 out_card_cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00032
00033
00034 ofile_name_cmd = new G4UIcmdWithAString("/g4sim/myAnalysisSvc/set_ofile_name",this);
00035 ofile_name_cmd->SetGuidance("set name for MyAnalysisSvc file");
00036 ofile_name_cmd->SetParameterName("ofile_name",true);
00037 ofile_name_cmd->SetDefaultValue("raw_g4sim.root");
00038 ofile_name_cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00039
00040 tree_name_cmd = new G4UIcmdWithAString("/g4sim/myAnalysisSvc/set_tree_name",this);
00041 tree_name_cmd->SetGuidance("set name for MyAnalysisSvc tree");
00042 tree_name_cmd->SetParameterName("tree_name",true);
00043 tree_name_cmd->SetDefaultValue("t");
00044 tree_name_cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00045
00046
00047 set_minT_cmd = new G4UIcmdWithADoubleAndUnit("/g4sim/myAnalysisSvc/set_minT",this);
00048 set_minT_cmd->SetGuidance("Define minimal time");
00049 set_minT_cmd->SetParameterName("minT",false,false);
00050 set_minT_cmd->SetDefaultUnit("ns");
00051 set_minT_cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00052
00053 set_maxT_cmd = new G4UIcmdWithADoubleAndUnit("/g4sim/myAnalysisSvc/set_maxT",this);
00054 set_maxT_cmd->SetGuidance("Define minimal time");
00055 set_maxT_cmd->SetParameterName("maxT",false,false);
00056 set_maxT_cmd->SetDefaultUnit("ns");
00057 set_maxT_cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00058
00059
00060 run_name_cmd = new G4UIcmdWithAString("/g4sim/myAnalysisSvc/set_run_name",this);
00061 run_name_cmd->SetGuidance("set run_name");
00062 run_name_cmd->SetParameterName("run_name",true);
00063 run_name_cmd->SetDefaultValue("test");
00064 run_name_cmd->AvailableForStates(G4State_PreInit,G4State_Idle);
00065
00066
00067 PrintCmd = new G4UIcmdWithAnInteger("/g4sim/myAnalysisSvc/printModulo",this);
00068 PrintCmd->SetGuidance("Print events modulo n");
00069 PrintCmd->SetParameterName("EventNb",false);
00070 PrintCmd->SetRange("EventNb>0");
00071 }
00072
00073
00074
00075 MyAnalysisSvcMessenger::~MyAnalysisSvcMessenger()
00076 {
00077 delete myAnalysisSvcDir;
00078
00079 delete out_card_cmd;
00080
00081
00082 delete ofile_name_cmd;
00083 delete tree_name_cmd;
00084
00085
00086 delete set_minT_cmd;
00087 delete set_maxT_cmd;
00088
00089
00090 delete run_name_cmd;
00091
00092
00093 delete PrintCmd;
00094 }
00095
00096
00097
00098 void MyAnalysisSvcMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
00099 {
00100
00101 if(command==out_card_cmd){m_myAnalysisSvc->set_out_card(newValue);}
00102
00103
00104 if(command==ofile_name_cmd){m_myAnalysisSvc->set_ofile_name(newValue);}
00105 if(command==tree_name_cmd){m_myAnalysisSvc->set_tree_name(newValue);}
00106
00107
00108 if(command==set_minT_cmd) m_myAnalysisSvc->set_minT(set_minT_cmd->GetNewDoubleValue(newValue));
00109 if(command==set_maxT_cmd) m_myAnalysisSvc->set_maxT(set_maxT_cmd->GetNewDoubleValue(newValue));
00110
00111
00112 if(command==run_name_cmd){m_myAnalysisSvc->set_run_name(newValue);}
00113
00114
00115 if(command == PrintCmd){m_myAnalysisSvc->set_PrintModulo(PrintCmd->GetNewIntValue(newValue));}
00116 }
00117
00118