Skip to content
Snippets Groups Projects
Commit bc18e29b authored by lintao@ihep.ac.cn's avatar lintao@ihep.ac.cn
Browse files

WIP: invoke IDetSimSvc in DetSimAlg.

parent bf862d50
No related branches found
No related tags found
No related merge requests found
#include "DetSimAlg.h"
#include "G4RunManager.hh"
DECLARE_COMPONENT(DetSimAlg)
DetSimAlg::DetSimAlg(const std::string& name, ISvcLocator* pSvcLocator)
: Algorithm(name, pSvcLocator) {
i_event = -1;
}
StatusCode
......@@ -13,18 +15,47 @@ DetSimAlg::initialize() {
info() << "Initialize DetSimAlg... " << endmsg;
m_detsimsvc = service("DetSimSvc");
if (!m_detsimsvc) {
error() << "Failed to find DetSimSvc. " << endmsg;
return StatusCode::FAILURE;
}
// Initialize the Run Manager
G4RunManager* runmgr = m_detsimsvc->getRM();
if (!runmgr) {
error() << "Failed to get Run Manager. " << endmsg;
return StatusCode::FAILURE;
}
runmgr->SetUserInitialization((G4VUserDetectorConstruction*)0);
runmgr->SetUserInitialization((G4VUserPhysicsList*)0);
runmgr->SetUserAction((G4VUserPrimaryGeneratorAction*)0);
// after set up the user initialization and user actions, start the initialization.
m_detsimsvc->initializeRM();
return sc;
}
StatusCode
DetSimAlg::execute() {
StatusCode sc;
m_detsimsvc->simulateEvent(++i_event);
return sc;
}
StatusCode
DetSimAlg::finalize() {
StatusCode sc;
if (!m_detsimsvc) {
return StatusCode::FAILURE;
}
m_detsimsvc->finalizeRM();
return sc;
}
......
......@@ -25,6 +25,9 @@ private:
Gaudi::Property<std::vector<std::string>> m_run_macs{this, "RunMacs"};
Gaudi::Property<std::vector<std::string>> m_run_cmds{this, "RunCmds"};
Gaudi::Property<std::vector<std::string>> m_vis_macs{this, "VisMacs"};
private:
int i_event;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment