LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
artg4tk::ArtG4RunManager Class Reference

#include "ArtG4RunManager.hh"

Inheritance diagram for artg4tk::ArtG4RunManager:

Public Member Functions

 ArtG4RunManager ()
 
virtual ~ArtG4RunManager ()
 
virtual void BeamOnBeginRun (unsigned int runNumber, const char *macroFile=0, G4int n_select=-1)
 
virtual void BeamOnDoOneEvent (int eventNumber)
 
virtual void BeamOnEndEvent ()
 
virtual void BeamOnEndRun ()
 
G4Event const * getCurrentEvent () const
 
G4Timer const * getG4Timer () const
 
G4double realElapsedTime () const
 
G4double systemElapsedTime () const
 
G4double userElapsedTime () const
 

Private Member Functions

 ArtG4RunManager (ArtG4RunManager const &)
 
ArtG4RunManageroperator= (ArtG4RunManager const &)
 

Private Attributes

G4Event * previousEvent_
 
char const * macroFile_
 
G4int n_select_
 
G4int nProcessed_
 
G4double realElapsed_
 
G4double systemElapsed_
 
G4double userElapsed_
 
G4String msg_
 

Detailed Description

Definition at line 36 of file ArtG4RunManager.hh.

Constructor & Destructor Documentation

artg4tk::ArtG4RunManager::ArtG4RunManager ( )

Definition at line 28 of file ArtG4RunManager.cc.

Referenced by userElapsedTime().

29  : G4RunManager()
30  , macroFile_(0)
31  , n_select_(-1)
32  , nProcessed_(0)
33  , realElapsed_(0.)
34  , systemElapsed_(0.)
35  , userElapsed_(0.)
36  , msg_("")
37  {}
artg4tk::ArtG4RunManager::~ArtG4RunManager ( )
virtual

Definition at line 40 of file ArtG4RunManager.cc.

40 {}
artg4tk::ArtG4RunManager::ArtG4RunManager ( ArtG4RunManager const &  )
private

Member Function Documentation

void artg4tk::ArtG4RunManager::BeamOnBeginRun ( unsigned int  runNumber,
const char *  macroFile = 0,
G4int  n_select = -1 
)
virtual

Definition at line 44 of file ArtG4RunManager.cc.

References macroFile_, msg_, n_select_, nProcessed_, realElapsed_, systemElapsed_, and userElapsed_.

45  {
46 
47  SetRunIDCounter(runNumber);
48 
49  bool cond = ConfirmBeamOnCondition();
50  if (!cond) {
51  // throw here
52  return;
53  }
54 
55  // Initialize member data for the new run.
56  macroFile_ = macroFile;
57  n_select_ = n_select;
58  msg_ = "";
59  nProcessed_ = 0;
60  realElapsed_ = 0;
61  systemElapsed_ = 0;
62  userElapsed_ = 0;
63 
64  // Construct command to execute the macro.
65  if (macroFile_ != 0) {
66  msg_ = "/control/execute ";
67  msg_ += macroFile_;
68  } else {
69  n_select_ = -1;
70  }
71 
72  numberOfEventToBeProcessed = 1;
73  ConstructScoringWorlds();
74  RunInitialization();
75  }
void artg4tk::ArtG4RunManager::BeamOnDoOneEvent ( int  eventNumber)
virtual

Definition at line 79 of file ArtG4RunManager.cc.

References msg_, n_select_, nProcessed_, realElapsed_, systemElapsed_, and userElapsed_.

80  {
81 
82  timer->Start();
83 
84  // This is the body of the event loop from DoEventLoop().
85  currentEvent = GenerateEvent(eventNumber);
86  eventManager->ProcessOneEvent(currentEvent);
87  AnalyzeEvent(currentEvent);
88  UpdateScoring();
89 
90  if (nProcessed_ < n_select_)
91  G4UImanager::GetUIpointer()->ApplyCommand(msg_);
92 
93  // Should pause, not stop, if I can do that.
94  timer->Stop();
95 
96  // Accumulate time spent in G4 for all events in this run.
97  realElapsed_ += timer->GetRealElapsed();
98  systemElapsed_ += timer->GetSystemElapsed();
99  userElapsed_ += timer->GetUserElapsed();
100 
101  if (verboseLevel > 0) {
102 
103  G4int oldPrecision = G4cout.precision(3);
104  std::ios::fmtflags oldFlags = G4cout.flags();
105  G4cout.setf(std::ios::fixed, std::ios::floatfield);
106 
107  G4cout << "TimeEvent> " << eventNumber << " "
108  << G4RunManager::GetRunManager()->GetCurrentRun()->GetRunID() << " "
109  << timer->GetRealElapsed() << " "
110  << timer->GetUserElapsed() + timer->GetSystemElapsed() << " "
111  << userElapsed_ + systemElapsed_ << G4endl;
112 
113  G4cout.setf(oldFlags);
114  G4cout.precision(oldPrecision);
115  }
116  }
void artg4tk::ArtG4RunManager::BeamOnEndEvent ( )
virtual

Definition at line 119 of file ArtG4RunManager.cc.

References nProcessed_.

120  {
121 
122  StackPreviousEvent(currentEvent);
123  currentEvent = 0;
124 
125  ++nProcessed_;
126  }
void artg4tk::ArtG4RunManager::BeamOnEndRun ( )
virtual

Definition at line 130 of file ArtG4RunManager.cc.

References nProcessed_, realElapsed_, systemElapsed_, and userElapsed_.

131  {
132 
133  // From G4RunManager::DoEventLoop
134  if (verboseLevel > 0) {
135 
136  G4cout << "G4Run terminated." << G4endl;
137  G4cout << "G4Run Summary" << G4endl;
138  if (runAborted) {
139  G4cout << " G4Run Aborted after " << nProcessed_ << " events processed." << G4endl;
140  } else {
141  G4cout << " Number of events processed : " << nProcessed_ << G4endl;
142  }
143  G4cout << " User=" << userElapsed_ << "s Real=" << realElapsed_ << "s Sys=" << systemElapsed_
144  << G4endl;
145 
146  G4int oldPrecision = G4cout.precision(3);
147  std::ios::fmtflags oldFlags = G4cout.flags();
148  G4cout.setf(std::ios::fixed, std::ios::floatfield);
149 
150  G4cout << "TimeReport> Time report complete in ";
151  G4cout << realElapsed_;
152  G4cout << " seconds" << G4endl;
153 
154  G4cout.setf(oldFlags);
155  G4cout.precision(oldPrecision);
156  }
157 
158  // From G4RunManager::BeamOn.
159  RunTermination();
160  }
G4Event const* artg4tk::ArtG4RunManager::getCurrentEvent ( ) const
inline

Definition at line 52 of file ArtG4RunManager.hh.

53  {
54  return currentEvent;
55  }
G4Timer const* artg4tk::ArtG4RunManager::getG4Timer ( ) const
inline

Definition at line 57 of file ArtG4RunManager.hh.

58  {
59  return timer;
60  }
ArtG4RunManager& artg4tk::ArtG4RunManager::operator= ( ArtG4RunManager const &  )
private

Referenced by userElapsedTime().

G4double artg4tk::ArtG4RunManager::realElapsedTime ( ) const
inline

Definition at line 63 of file ArtG4RunManager.hh.

References realElapsed_.

64  {
65  return realElapsed_;
66  }
G4double artg4tk::ArtG4RunManager::systemElapsedTime ( ) const
inline

Definition at line 68 of file ArtG4RunManager.hh.

References systemElapsed_.

69  {
70  return systemElapsed_;
71  }
G4double artg4tk::ArtG4RunManager::userElapsedTime ( ) const
inline

Definition at line 73 of file ArtG4RunManager.hh.

References ArtG4RunManager(), operator=(), and userElapsed_.

74  {
75  return userElapsed_;
76  }

Member Data Documentation

char const* artg4tk::ArtG4RunManager::macroFile_
private

Definition at line 93 of file ArtG4RunManager.hh.

Referenced by BeamOnBeginRun().

G4String artg4tk::ArtG4RunManager::msg_
private

Definition at line 109 of file ArtG4RunManager.hh.

Referenced by BeamOnBeginRun(), and BeamOnDoOneEvent().

G4int artg4tk::ArtG4RunManager::n_select_
private

Definition at line 97 of file ArtG4RunManager.hh.

Referenced by BeamOnBeginRun(), and BeamOnDoOneEvent().

G4int artg4tk::ArtG4RunManager::nProcessed_
private

Definition at line 101 of file ArtG4RunManager.hh.

Referenced by BeamOnBeginRun(), BeamOnDoOneEvent(), BeamOnEndEvent(), and BeamOnEndRun().

G4Event* artg4tk::ArtG4RunManager::previousEvent_
private

Definition at line 84 of file ArtG4RunManager.hh.

G4double artg4tk::ArtG4RunManager::realElapsed_
private
G4double artg4tk::ArtG4RunManager::systemElapsed_
private
G4double artg4tk::ArtG4RunManager::userElapsed_
private

The documentation for this class was generated from the following files: