Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // 26 /// \file hadronic/Hadr00/src/EventActionMesse << 26 // $Id: EventActionMessenger.cc,v 1.1 2008/07/07 16:37:26 vnivanch Exp $ 27 /// \brief Implementation of the EventActionMe << 27 // GEANT4 tag $Name: geant4-09-02-patch-03 $ 28 // << 29 // 28 // 30 ////////////////////////////////////////////// 29 ///////////////////////////////////////////////////////////////////////// 31 // 30 // 32 // EventActionMessenger 31 // EventActionMessenger 33 // 32 // 34 // Created: 31.01.03 V.Ivanchenko 33 // Created: 31.01.03 V.Ivanchenko 35 // 34 // 36 // Modified: 35 // Modified: 37 // 04.06.2006 Adoptation of hadr01 (V.Ivanchen 36 // 04.06.2006 Adoptation of hadr01 (V.Ivanchenko) 38 // 37 // 39 ////////////////////////////////////////////// 38 //////////////////////////////////////////////////////////////////////// 40 // 39 // 41 40 42 #include "EventActionMessenger.hh" 41 #include "EventActionMessenger.hh" 43 42 44 #include "EventAction.hh" 43 #include "EventAction.hh" 45 << 46 #include "G4UIcmdWithAString.hh" 44 #include "G4UIcmdWithAString.hh" 47 #include "G4UIcmdWithAnInteger.hh" 45 #include "G4UIcmdWithAnInteger.hh" 48 46 49 //....oooOO0OOooo........oooOO0OOooo........oo 47 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 50 48 51 EventActionMessenger::EventActionMessenger(Eve << 49 EventActionMessenger::EventActionMessenger(EventAction* EvAct) 52 : G4UImessenger(), fEventAction(evAct), fPri << 50 :eventAction(EvAct) 53 { << 51 { 54 fPrintCmd = new G4UIcmdWithAnInteger("/testh << 52 drawCmd = new G4UIcmdWithAString("/testhadr/DrawTracks", this); 55 fPrintCmd->SetGuidance("Print events modulo << 53 drawCmd->SetGuidance("Draw the tracks in the event"); 56 fPrintCmd->SetParameterName("EventNb", false << 54 drawCmd->SetGuidance(" Choice : neutral, charged, all"); 57 fPrintCmd->SetRange("EventNb>0"); << 55 drawCmd->SetParameterName("choice",true); 58 fPrintCmd->AvailableForStates(G4State_PreIni << 56 drawCmd->SetDefaultValue("all"); 59 << 57 drawCmd->SetCandidates("none charged all"); 60 fCmd = new G4UIcmdWithAnInteger("/testhadr/D << 58 drawCmd->AvailableForStates(G4State_PreInit,G4State_Idle); 61 fCmd->SetGuidance("D event to debug"); << 59 62 fCmd->SetParameterName("fNb", false); << 60 printCmd = new G4UIcmdWithAnInteger("/testhadr/PrintModulo",this); 63 fCmd->SetRange("fNb>0"); << 61 printCmd->SetGuidance("Print events modulo n"); 64 fCmd->AvailableForStates(G4State_PreInit, G4 << 62 printCmd->SetParameterName("EventNb",false); >> 63 printCmd->SetRange("EventNb>0"); >> 64 printCmd->AvailableForStates(G4State_PreInit,G4State_Idle); >> 65 >> 66 dCmd = new G4UIcmdWithAnInteger("/testhadr/DebugEvent",this); >> 67 dCmd->SetGuidance("D event to debug"); >> 68 dCmd->SetParameterName("fNb",false); >> 69 dCmd->SetRange("fNb>0"); >> 70 dCmd->AvailableForStates(G4State_PreInit,G4State_Idle); >> 71 65 } 72 } 66 73 67 //....oooOO0OOooo........oooOO0OOooo........oo 74 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 68 75 69 EventActionMessenger::~EventActionMessenger() 76 EventActionMessenger::~EventActionMessenger() 70 { 77 { 71 delete fPrintCmd; << 78 delete drawCmd; 72 delete fCmd; << 79 delete printCmd; >> 80 delete dCmd; 73 } 81 } 74 82 75 //....oooOO0OOooo........oooOO0OOooo........oo 83 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 76 84 77 void EventActionMessenger::SetNewValue(G4UIcom << 85 void EventActionMessenger::SetNewValue(G4UIcommand* command, 78 { << 86 G4String newValue) 79 if (command == fPrintCmd) { << 87 { 80 fEventAction->SetPrintModulo(fPrintCmd->Ge << 88 if(command == drawCmd) 81 } << 89 {eventAction->SetDrawFlag(newValue);} 82 if (command == fCmd) { << 90 83 fEventAction->AddEventToDebug(fCmd->GetNew << 91 if(command == printCmd) 84 } << 92 {eventAction->SetPrintModulo(printCmd->GetNewIntValue(newValue));} >> 93 >> 94 if(command == dCmd) >> 95 {eventAction->AddEventToDebug(dCmd->GetNewIntValue(newValue));} >> 96 85 } 97 } 86 98 87 //....oooOO0OOooo........oooOO0OOooo........oo 99 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 88 100