File indexing completed on 2025-01-31 09:22:17
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #include "HadrontherapyEventActionMessenger.hh"
0030
0031 #include "HadrontherapyEventAction.hh"
0032 #include "G4UIdirectory.hh"
0033 #include "G4UIcmdWithAString.hh"
0034 #include "G4UIcmdWithAnInteger.hh"
0035 #include "G4SystemOfUnits.hh"
0036 #include "G4RunManager.hh"
0037 #include "G4UnitsTable.hh"
0038
0039
0040
0041 HadrontherapyEventActionMessenger::HadrontherapyEventActionMessenger(HadrontherapyEventAction* EvAct)
0042 :eventAction(EvAct)
0043 {
0044 eventDir = new G4UIdirectory("/event/");
0045 eventDir->SetGuidance("Permits controls on simulation events");
0046
0047 DrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
0048 DrawCmd->SetGuidance("Draw the tracks in the event");
0049 DrawCmd->SetGuidance(" Choice : none,charged, all, neutral");
0050 DrawCmd->SetParameterName("choice",true);
0051 DrawCmd->SetDefaultValue("all");
0052 DrawCmd->SetCandidates("none charged all neutral");
0053 DrawCmd->AvailableForStates(G4State_Idle);
0054
0055 PrintCmd = new G4UIcmdWithAnInteger("/event/printEventNumber",this);
0056 PrintCmd->SetGuidance("Print the event number of modulo n");
0057 PrintCmd->SetParameterName("EventNb",false);
0058 PrintCmd->SetRange("EventNb>0");
0059 PrintCmd->AvailableForStates(G4State_Idle);
0060 }
0061
0062
0063 HadrontherapyEventActionMessenger::~HadrontherapyEventActionMessenger()
0064 {
0065 delete DrawCmd;
0066 delete PrintCmd;
0067 delete eventDir;
0068 }
0069
0070
0071 void HadrontherapyEventActionMessenger::SetNewValue(G4UIcommand* command,
0072 G4String newValue)
0073 {
0074 if(command == DrawCmd)
0075 {eventAction->SetDrawFlag(newValue);}
0076
0077 if(command == PrintCmd)
0078 {eventAction->SetPrintModulo(PrintCmd->GetNewIntValue(newValue));}
0079 }