00001 // 00002 // ******************************************************************** 00003 // * License and Disclaimer * 00004 // * * 00005 // * The Geant4 software is copyright of the Copyright Holders of * 00006 // * the Geant4 Collaboration. It is provided under the terms and * 00007 // * conditions of the Geant4 Software License, included in the file * 00008 // * LICENSE and available at http://cern.ch/geant4/license . These * 00009 // * include a list of copyright holders. * 00010 // * * 00011 // * Neither the authors of this software system, nor their employing * 00012 // * institutes,nor the agencies providing financial support for this * 00013 // * work make any representation or warranty, express or implied, * 00014 // * regarding this software system or assume any liability for its * 00015 // * use. Please see the license in the file LICENSE and URL above * 00016 // * for the full disclaimer and the limitation of liability. * 00017 // * * 00018 // * This code implementation is the result of the scientific and * 00019 // * technical work of the GEANT4 collaboration. * 00020 // * By using, copying, modifying or distributing the software (or * 00021 // * any work based on the software) you agree to acknowledge its * 00022 // * use in resulting scientific publications, and indicate your * 00023 // * acceptance of all terms of the Geant4 Software license. * 00024 // ******************************************************************** 00025 // 00026 // 00027 // $Id$ 00028 // 00029 // -------------------------------------------------------------------- 00030 00031 #include "G4EvManMessenger.hh" 00032 #include "G4EventManager.hh" 00033 #include "G4UIdirectory.hh" 00034 #include "G4UIcmdWithoutParameter.hh" 00035 #include "G4UIcmdWithAnInteger.hh" 00036 00037 G4EvManMessenger::G4EvManMessenger(G4EventManager * fEvMan) 00038 :fEvManager(fEvMan) 00039 { 00040 eventDirectory = new G4UIdirectory("/event/"); 00041 eventDirectory->SetGuidance("EventManager control commands."); 00042 00043 abortCmd = new G4UIcmdWithoutParameter("/event/abort",this); 00044 abortCmd->SetGuidance("Abort current event."); 00045 abortCmd->AvailableForStates(G4State_EventProc); 00046 00047 verboseCmd = new G4UIcmdWithAnInteger("/event/verbose",this); 00048 verboseCmd->SetGuidance("Set Verbose level of event management category."); 00049 verboseCmd->SetGuidance(" 0 : Silent"); 00050 verboseCmd->SetGuidance(" 1 : Stacking information"); 00051 verboseCmd->SetGuidance(" 2 : More..."); 00052 verboseCmd->SetParameterName("level",false); 00053 verboseCmd->SetRange("level>=0"); 00054 00055 storeEvtCmd = new G4UIcmdWithoutParameter("/event/keepCurrentEvent",this); 00056 storeEvtCmd->SetGuidance("Store the current event to G4Run object instead of deleting it at the end of event."); 00057 storeEvtCmd->SetGuidance("Stored event is available through G4Run until the begining of next run."); 00058 storeEvtCmd->SetGuidance("Given the potential large memory size of G4Event and its datamember objects stored in G4Event,"); 00059 storeEvtCmd->SetGuidance("the user must be careful and responsible for not to store too many G4Event objects."); 00060 storeEvtCmd->AvailableForStates(G4State_EventProc); 00061 } 00062 00063 G4EvManMessenger::~G4EvManMessenger() 00064 { 00065 delete abortCmd; 00066 delete verboseCmd; 00067 delete storeEvtCmd; 00068 delete eventDirectory; 00069 } 00070 00071 void G4EvManMessenger::SetNewValue(G4UIcommand * command,G4String newValues) 00072 { 00073 if( command == verboseCmd ) 00074 { fEvManager->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues)); } 00075 if( command == abortCmd ) 00076 { fEvManager->AbortCurrentEvent(); } 00077 if( command == storeEvtCmd ) 00078 { fEvManager->KeepTheCurrentEvent(); } 00079 } 00080 00081 G4String G4EvManMessenger::GetCurrentValue(G4UIcommand * command) 00082 { 00083 G4String cv; 00084 if( command == verboseCmd ) 00085 { cv = verboseCmd->ConvertToString(fEvManager->GetVerboseLevel()); } 00086 return cv; 00087 } 00088