00001 // 00002 // $Id: EventAction.cc 168 2008-09-16 13:23:52Z maire $ 00003 // 00004 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00005 00006 #include "EventAction.hh" 00007 00008 #include "RunAction.hh" 00009 00010 #include "G4Event.hh" 00011 #include "G4UnitsTable.hh" 00012 00013 #ifdef G4ANALYSIS_USE 00014 #include "AIDA/IHistogram1D.h" 00015 #endif 00016 00017 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00018 00019 EventAction::EventAction(RunAction* run) 00020 :m_runAction(run), m_printModulo(10000) 00021 {} 00022 00023 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00024 00025 EventAction::~EventAction() 00026 {} 00027 00028 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00029 00030 void EventAction::BeginOfEventAction(const G4Event* evt) 00031 { 00032 G4int evtNb = evt->GetEventID(); 00033 00034 //printing survey 00035 if (evtNb%m_printModulo == 0) 00036 G4cout << "\n---> Begin of Event: " << evtNb << G4endl; 00037 00038 //energy deposited per event 00039 m_edepPerEvent = 0.; 00040 } 00041 00042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00043 00044 void EventAction::EndOfEventAction(const G4Event*) 00045 { 00046 //energy deposited per event 00047 // 00048 if (m_edepPerEvent > 0.) { 00049 m_runAction->SumEvents(m_edepPerEvent); 00050 #ifdef G4ANALYSIS_USE 00051 G4double weight = 1.; 00052 m_runAction->GetHisto(0)->fill(m_edepPerEvent/MeV, weight); 00053 #endif 00054 } 00055 } 00056 00057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 00058 00059