test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RunAction.cc
Go to the documentation of this file.
3 
6 
8 
9 #include "G4Timer.hh"
10 #include <iostream>
11 #include <fstream>
12 
13 //using std::cout;
14 //using std::endl;
15 
17  : m_runInterface(rm),
18  m_stopFile(p.getParameter<std::string>("StopFile")), m_timer(0)
19 {}
20 
21 void RunAction::BeginOfRunAction(const G4Run * aRun)
22 {
23  if (std::ifstream(m_stopFile.c_str()))
24  {
25  edm::LogWarning("SimG4CoreApplication")
26  << "RunAction::BeginOfRunAction: termination signal received";
27  m_runInterface->abortRun(true);
28  }
29  BeginOfRun r(aRun);
31  /*
32  if (isMaster) {
33  m_timer = new G4Timer();
34  m_timer->Start();
35  }
36  */
37 }
38 
39 void RunAction::EndOfRunAction(const G4Run * aRun)
40 {
41  if (isMaster) {
42  edm::LogInfo("SimG4CoreApplication")
43  << "RunAction: total number of events " << aRun->GetNumberOfEvent();
44  if(m_timer) {
45  m_timer->Stop();
46  edm::LogInfo("SimG4CoreApplication")
47  << "RunAction: Master thread time " << *m_timer;
48  // std::cout << "\n" << "Master thread time: " << *m_timer << std::endl;
49  delete m_timer;
50  }
51  }
52  if (std::ifstream(m_stopFile.c_str()))
53  {
54  edm::LogWarning("SimG4CoreApplication")
55  << "RunAction::EndOfRunAction: termination signal received";
56  m_runInterface->abortRun(true);
57  }
58  EndOfRun r(aRun);
59  m_endOfRunSignal(&r);
60 }
61 
G4Timer * m_timer
Definition: RunAction.h:29
SimActivityRegistry::EndOfRunSignal m_endOfRunSignal
Definition: RunAction.h:24
void abortRun(bool softAbort)
std::string m_stopFile
Definition: RunAction.h:28
RunAction(const edm::ParameterSet &ps, SimRunInterface *)
Definition: RunAction.cc:16
string rm
Definition: submit.py:76
void EndOfRunAction(const G4Run *aRun)
Definition: RunAction.cc:39
void BeginOfRunAction(const G4Run *aRun)
Definition: RunAction.cc:21
SimActivityRegistry::BeginOfRunSignal m_beginOfRunSignal
Definition: RunAction.h:23
SimRunInterface * m_runInterface
Definition: RunAction.h:27