CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes | Private Attributes
RunAction Class Reference

#include <RunAction.h>

Inheritance diagram for RunAction:

Public Member Functions

void BeginOfRunAction (const G4Run *aRun) override
 
void EndOfRunAction (const G4Run *aRun) override
 
 RunAction (const edm::ParameterSet &ps, SimRunInterface *, bool master)
 
 ~RunAction () override
 

Public Attributes

SimActivityRegistry::BeginOfRunSignal m_beginOfRunSignal
 
SimActivityRegistry::EndOfRunSignal m_endOfRunSignal
 

Private Attributes

bool m_isMaster
 
SimRunInterfacem_runInterface
 
std::string m_stopFile
 
G4Timer * m_timer
 

Detailed Description

Definition at line 16 of file RunAction.h.

Constructor & Destructor Documentation

RunAction::RunAction ( const edm::ParameterSet ps,
SimRunInterface rm,
bool  master 
)
explicit

Definition at line 13 of file RunAction.cc.

14  : m_runInterface(rm),
15  m_stopFile(p.getParameter<std::string>("StopFile")),
16  m_timer(nullptr), m_isMaster(master)
17 {}
Master< F > master(const F &f)
Definition: FunctClone.h:68
G4Timer * m_timer
Definition: RunAction.h:31
bool m_isMaster
Definition: RunAction.h:32
std::string m_stopFile
Definition: RunAction.h:30
SimRunInterface * m_runInterface
Definition: RunAction.h:29
RunAction::~RunAction ( )
override

Definition at line 19 of file RunAction.cc.

20 {}

Member Function Documentation

void RunAction::BeginOfRunAction ( const G4Run *  aRun)
override

Definition at line 22 of file RunAction.cc.

References SimRunInterface::abortRun(), m_beginOfRunSignal, m_runInterface, m_stopFile, and alignCSCRings::r.

Referenced by RunManagerMT::initG4(), and RunManager::initializeRun().

23 {
24  if (std::ifstream(m_stopFile.c_str()))
25  {
26  edm::LogWarning("SimG4CoreApplication")
27  << "RunAction::BeginOfRunAction: termination signal received";
28  m_runInterface->abortRun(true);
29  }
30  BeginOfRun r(aRun);
32  /*
33  if (m_isMaster) {
34  m_timer = new G4Timer();
35  m_timer->Start();
36  }
37  */
38 }
void abortRun(bool softAbort)
std::string m_stopFile
Definition: RunAction.h:30
SimActivityRegistry::BeginOfRunSignal m_beginOfRunSignal
Definition: RunAction.h:25
SimRunInterface * m_runInterface
Definition: RunAction.h:29
void RunAction::EndOfRunAction ( const G4Run *  aRun)
override

Definition at line 40 of file RunAction.cc.

References SimRunInterface::abortRun(), m_endOfRunSignal, m_runInterface, m_stopFile, m_timer, and alignCSCRings::r.

Referenced by RunManager::terminateRun(), and RunManagerMT::terminateRun().

41 {
42  if (isMaster) {
43  edm::LogInfo("SimG4CoreApplication")
44  << "RunAction: total number of events " << aRun->GetNumberOfEvent();
45  if(m_timer) {
46  m_timer->Stop();
47  edm::LogInfo("SimG4CoreApplication")
48  << "RunAction: Master thread time " << *m_timer;
49  // std::cout << "\n" << "Master thread time: " << *m_timer << std::endl;
50  delete m_timer;
51  }
52  }
53  if (std::ifstream(m_stopFile.c_str()))
54  {
55  edm::LogWarning("SimG4CoreApplication")
56  << "RunAction::EndOfRunAction: termination signal received";
57  m_runInterface->abortRun(true);
58  }
59  EndOfRun r(aRun);
61 }
G4Timer * m_timer
Definition: RunAction.h:31
SimActivityRegistry::EndOfRunSignal m_endOfRunSignal
Definition: RunAction.h:26
void abortRun(bool softAbort)
std::string m_stopFile
Definition: RunAction.h:30
SimRunInterface * m_runInterface
Definition: RunAction.h:29

Member Data Documentation

SimActivityRegistry::BeginOfRunSignal RunAction::m_beginOfRunSignal
SimActivityRegistry::EndOfRunSignal RunAction::m_endOfRunSignal
bool RunAction::m_isMaster
private

Definition at line 32 of file RunAction.h.

SimRunInterface* RunAction::m_runInterface
private

Definition at line 29 of file RunAction.h.

Referenced by BeginOfRunAction(), and EndOfRunAction().

std::string RunAction::m_stopFile
private

Definition at line 30 of file RunAction.h.

Referenced by BeginOfRunAction(), and EndOfRunAction().

G4Timer* RunAction::m_timer
private

Definition at line 31 of file RunAction.h.

Referenced by EndOfRunAction().