Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:30:15

0001 #include "SimG4Core/Application/interface/RunAction.h"
0002 #include "SimG4Core/Application/interface/SimRunInterface.h"
0003 
0004 #include "SimG4Core/Notification/interface/BeginOfRun.h"
0005 #include "SimG4Core/Notification/interface/EndOfRun.h"
0006 
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008 
0009 #include <iostream>
0010 #include <fstream>
0011 
0012 RunAction::RunAction(const edm::ParameterSet& p, SimRunInterface* rm, bool)
0013     : m_runInterface(rm), m_stopFile(p.getParameter<std::string>("StopFile")) {}
0014 
0015 RunAction::~RunAction() {}
0016 
0017 void RunAction::BeginOfRunAction(const G4Run* aRun) {
0018   if (!m_stopFile.empty() && std::ifstream(m_stopFile.c_str())) {
0019     edm::LogWarning("SimG4CoreApplication") << "RunAction::BeginOfRunAction: termination signal received";
0020     m_runInterface->abortRun(true);
0021   }
0022   BeginOfRun r(aRun);
0023   m_beginOfRunSignal(&r);
0024 }
0025 
0026 void RunAction::EndOfRunAction(const G4Run* aRun) {
0027   EndOfRun r(aRun);
0028   m_endOfRunSignal(&r);
0029 }