QwGeant4
EventAction Class Reference

#include <EventAction.hh>

Inherits G4UserEventAction.

+ Collaboration diagram for EventAction:

Public Member Functions

 EventAction ()
 
virtual ~EventAction ()
 
virtual void BeginOfEventAction (const G4Event *)
 
virtual void EndOfEventAction (const G4Event *)
 
void SetPrintModulo (G4int val)
 
void AddEventToDebug (G4int val)
 

Private Member Functions

EventActionoperator= (const EventAction &right)
 
 EventAction (const EventAction &)
 

Private Attributes

EventActionMessengerfEventMessenger
 
G4UImanager * UI
 
std::vector< G4int > fSelectedEvents
 
G4int fPrintModulo
 
G4int fSelected
 
G4bool fDebugStarted
 

Detailed Description

Definition at line 55 of file EventAction.hh.

Constructor & Destructor Documentation

EventAction::EventAction ( )

Definition at line 51 of file EventAction.cc.

References fEventMessenger, fSelectedEvents, and UI.

51  :
52  fPrintModulo(100),
53  fSelected(0),
54  fDebugStarted(false)
55 {
57  UI = G4UImanager::GetUIpointer();
58  fSelectedEvents.clear();
59 }
std::vector< G4int > fSelectedEvents
Definition: EventAction.hh:75
G4int fPrintModulo
Definition: EventAction.hh:77
G4UImanager * UI
Definition: EventAction.hh:74
EventActionMessenger * fEventMessenger
Definition: EventAction.hh:73
G4int fSelected
Definition: EventAction.hh:78
G4bool fDebugStarted
Definition: EventAction.hh:80
EventAction::~EventAction ( )
virtual

Definition at line 63 of file EventAction.cc.

References fEventMessenger.

64 {
65  delete fEventMessenger;
66 }
EventActionMessenger * fEventMessenger
Definition: EventAction.hh:73
EventAction::EventAction ( const EventAction )
private

Member Function Documentation

void EventAction::AddEventToDebug ( G4int  val)
inline

Definition at line 89 of file EventAction.hh.

References fSelected, and fSelectedEvents.

Referenced by EventActionMessenger::SetNewValue().

90 {
91  fSelectedEvents.push_back(val);
92  ++fSelected;
93 }
std::vector< G4int > fSelectedEvents
Definition: EventAction.hh:75
G4int fSelected
Definition: EventAction.hh:78

+ Here is the caller graph for this function:

void EventAction::BeginOfEventAction ( const G4Event *  evt)
virtual

Definition at line 70 of file EventAction.cc.

References fDebugStarted, fPrintModulo, fSelected, fSelectedEvents, and UI.

71 {
72  // New event
73  G4int nEvt = evt->GetEventID();
74 
75  if(fSelected>0) {
76  for(G4int i=0; i<fSelected; ++i) {
77  if(nEvt == fSelectedEvents[i]) {
78  UI->ApplyCommand("/random/saveThisEvent");
79  UI->ApplyCommand("/tracking/verbose 2");
80  fDebugStarted = true;
81  break;
82  }
83  }
84  }
85 
86  // Initialize user actions
87  if(G4int(nEvt/fPrintModulo)*fPrintModulo == nEvt) {
88  G4cout << "EventAction: Event # "
89  << nEvt << " started" << G4endl;
90  }
91 }
std::vector< G4int > fSelectedEvents
Definition: EventAction.hh:75
G4int fPrintModulo
Definition: EventAction.hh:77
G4UImanager * UI
Definition: EventAction.hh:74
G4int fSelected
Definition: EventAction.hh:78
G4bool fDebugStarted
Definition: EventAction.hh:80
void EventAction::EndOfEventAction ( const G4Event *  )
virtual

Definition at line 95 of file EventAction.cc.

References fDebugStarted, and UI.

96 {
97  if(fDebugStarted) {
98  UI->ApplyCommand("/tracking/verbose 0");
99  fDebugStarted = false;
100  G4cout << "EventAction: Event ended" << G4endl;
101  }
102 }
G4UImanager * UI
Definition: EventAction.hh:74
G4bool fDebugStarted
Definition: EventAction.hh:80
EventAction& EventAction::operator= ( const EventAction right)
private
void EventAction::SetPrintModulo ( G4int  val)
inline

Definition at line 84 of file EventAction.hh.

References fPrintModulo.

Referenced by EventActionMessenger::SetNewValue().

85 {
86  fPrintModulo = val;
87 }
G4int fPrintModulo
Definition: EventAction.hh:77

+ Here is the caller graph for this function:

Field Documentation

G4bool EventAction::fDebugStarted
private

Definition at line 80 of file EventAction.hh.

Referenced by BeginOfEventAction(), and EndOfEventAction().

EventActionMessenger* EventAction::fEventMessenger
private

Definition at line 73 of file EventAction.hh.

Referenced by EventAction(), and ~EventAction().

G4int EventAction::fPrintModulo
private

Definition at line 77 of file EventAction.hh.

Referenced by BeginOfEventAction(), and SetPrintModulo().

G4int EventAction::fSelected
private

Definition at line 78 of file EventAction.hh.

Referenced by AddEventToDebug(), and BeginOfEventAction().

std::vector<G4int> EventAction::fSelectedEvents
private

Definition at line 75 of file EventAction.hh.

Referenced by AddEventToDebug(), BeginOfEventAction(), and EventAction().

G4UImanager* EventAction::UI
private

Definition at line 74 of file EventAction.hh.

Referenced by BeginOfEventAction(), EndOfEventAction(), and EventAction().


The documentation for this class was generated from the following files: