// M Hentz, 2016 #include "G4UIdirectory.hh" #include "G4UIcmdWithAString.hh" #include "G4UIcmdWithAnInteger.hh" #include "EventActionMessenger.hh" #include "EventAction.hh" EventActionMessenger::EventActionMessenger( EventAction* eventAction ) :G4UImessenger(), fEventAction( eventAction ), fEventDir(0), fDrawCmd(0), fPrintCmd(0) { fEventDir = new G4UIdirectory( "/cb_sim/event/" ); fEventDir->SetGuidance( "event control" ); fDrawCmd = new G4UIcmdWithAString( "/cb_sim/event/drawTracks", this ); fDrawCmd->SetGuidance( "Draw the tracks in the event" ); fDrawCmd->SetGuidance( " Choice : none,charged, all" ); fDrawCmd->SetParameterName( "choice", true ); fDrawCmd->SetDefaultValue( "all" ); fDrawCmd->SetCandidates( "none charged all" ); fDrawCmd->AvailableForStates( G4State_Idle ); fPrintCmd = new G4UIcmdWithAnInteger( "/cb_sim/event/printModulo", this ); fPrintCmd->SetGuidance( "Print events modulo n" ); fPrintCmd->SetParameterName( "EventPrintMod", false ); fPrintCmd->SetRange( "EventPrintMod > 0" ); fPrintCmd->AvailableForStates( G4State_Idle ); } EventActionMessenger::~EventActionMessenger() { delete fDrawCmd; delete fPrintCmd; delete fEventDir; } void EventActionMessenger::SetNewValue( G4UIcommand* command, G4String newValue ) { if ( command == fDrawCmd ) { fEventAction->SetDrawFlag( newValue ); } if ( command == fPrintCmd ) { fEventAction->SetPrintModulo( fPrintCmd->GetNewIntValue( newValue ) ); } }