#include "EventAction.hh" #include "Analysis.hh" #include "G4Event.hh" #include "G4UnitsTable.hh" #include "G4SystemOfUnits.hh" #include "RunAction.hh" #include "G4RunManager.hh" #include "GlobalVars.hh" G4int gEventCount; EventAction::EventAction(RunAction* runAction) :G4UserEventAction(), fTotalEnergyDeposit(0.), fRunAction(runAction) { } EventAction::~EventAction() { } void EventAction::BeginOfEventAction( const G4Event*) { fTotalEnergyDeposit = 0.; } void EventAction::EndOfEventAction( const G4Event*) { G4AnalysisManager* analysisManager = G4AnalysisManager::Instance(); if(fTotalEnergyDeposit>0.0) { analysisManager->FillH1(1, fTotalEnergyDeposit/MeV); gEventCount++; std::fstream ned; ned.open("nenergyd.txt",std::ios::app|std::ios::out); ned<GetUserRunAction()))->AddEvent(); } fRunAction->AddEdep(fTotalEnergyDeposit/MeV); }