Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 23:31:20

0001 #include "SimG4Core/Application/interface/SimRunInterface.h"
0002 #include "SimG4Core/Application/interface/RunManagerMT.h"
0003 #include "SimG4Core/Application/interface/RunManagerMTWorker.h"
0004 #include "SimG4Core/Application/interface/RunAction.h"
0005 #include "SimG4Core/Application/interface/EventAction.h"
0006 #include "SimG4Core/Application/interface/TrackingAction.h"
0007 #include "SimG4Core/Application/interface/SteppingAction.h"
0008 #include "SimG4Core/Notification/interface/G4SimEvent.h"
0009 
0010 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0011 
0012 SimRunInterface::SimRunInterface(RunManagerMT* runm, bool master)
0013     : m_runManagerMT(runm), m_runManagerMTWorker(nullptr), m_SimTrackManager(nullptr), m_isMaster(master) {}
0014 
0015 SimRunInterface::SimRunInterface(RunManagerMTWorker* runm, bool master)
0016     : m_runManagerMT(nullptr), m_runManagerMTWorker(runm), m_SimTrackManager(nullptr), m_isMaster(master) {
0017   if (m_runManagerMTWorker) {
0018     m_SimTrackManager = m_runManagerMTWorker->GetSimTrackManager();
0019   }
0020 }
0021 
0022 SimRunInterface::~SimRunInterface() {}
0023 
0024 void SimRunInterface::setRunManagerMTWorker(RunManagerMTWorker* run) { m_runManagerMTWorker = run; }
0025 
0026 void SimRunInterface::Connect(RunAction* runAction) {
0027   if (m_runManagerMT) {
0028     m_runManagerMT->Connect(runAction);
0029   } else if (m_runManagerMTWorker) {
0030     m_runManagerMTWorker->Connect(runAction);
0031   }
0032 }
0033 
0034 void SimRunInterface::Connect(EventAction* eventAction) {
0035   if (m_runManagerMTWorker) {
0036     m_runManagerMTWorker->Connect(eventAction);
0037   }
0038 }
0039 
0040 void SimRunInterface::Connect(TrackingAction* trackAction) {
0041   if (m_runManagerMTWorker) {
0042     m_runManagerMTWorker->Connect(trackAction);
0043   }
0044 }
0045 
0046 void SimRunInterface::Connect(SteppingAction* stepAction) {
0047   if (m_runManagerMTWorker) {
0048     m_runManagerMTWorker->Connect(stepAction);
0049   }
0050 }
0051 
0052 SimTrackManager* SimRunInterface::GetSimTrackManager() { return m_SimTrackManager; }
0053 
0054 void SimRunInterface::abortEvent() {
0055   if (m_runManagerMTWorker) {
0056     m_runManagerMTWorker->abortEvent();
0057   }
0058 }
0059 
0060 void SimRunInterface::abortRun(bool softAbort) {
0061   if (m_runManagerMTWorker) {
0062     m_runManagerMTWorker->abortRun(softAbort);
0063   }
0064 }
0065 
0066 G4SimEvent* SimRunInterface::simEvent() {
0067   G4SimEvent* ptr = nullptr;
0068   if (m_runManagerMTWorker) {
0069     ptr = m_runManagerMTWorker->simEvent();
0070   }
0071   return ptr;
0072 }
0073 
0074 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......