diff --git a/Simulation/G4Extensions/Quirks/src/DebugSteppingActionTool.cxx b/Simulation/G4Extensions/Quirks/src/DebugSteppingActionTool.cxx index 94a9d315b7dd9254ae092f6e5a9fd13800dc6aeb..b79e3fed380b7639e6876c2e9140a79c4247bd8b 100644 --- a/Simulation/G4Extensions/Quirks/src/DebugSteppingActionTool.cxx +++ b/Simulation/G4Extensions/Quirks/src/DebugSteppingActionTool.cxx @@ -4,26 +4,26 @@ #include "CxxUtils/make_unique.h" #include "DebugSteppingActionTool.h" -namespace G4UA{ - DebugSteppingActionTool::DebugSteppingActionTool(const std::string& type, const std::string& name,const IInterface* parent): - ActionToolBase<DebugSteppingAction>(type, name, parent), m_config(){ +namespace G4UA +{ + + DebugSteppingActionTool::DebugSteppingActionTool(const std::string& type, + const std::string& name, + const IInterface* parent) + : UserActionToolBase<DebugSteppingAction>(type, name, parent) + { declareProperty("DebugStep", m_config.step); declareProperty("NumSteps", m_config.numSteps); } - std::unique_ptr<DebugSteppingAction> DebugSteppingActionTool::makeAction(){ - ATH_MSG_DEBUG("makeAction"); + + std::unique_ptr<DebugSteppingAction> + DebugSteppingActionTool::makeAndFillAction(G4AtlasUserActions& actionList) + { + ATH_MSG_DEBUG("Constructing a DebugSteppingAction"); auto action = CxxUtils::make_unique<DebugSteppingAction>(m_config); - return std::move(action); + actionList.steppingActions.push_back( action.get() ); + return action; } - StatusCode DebugSteppingActionTool::queryInterface(const InterfaceID& riid, void** ppvIf){ - - if(riid == IG4SteppingActionTool::interfaceID()) { - *ppvIf = (IG4SteppingActionTool*) this; - addRef(); - return StatusCode::SUCCESS; - } - return ActionToolBase<DebugSteppingAction>::queryInterface(riid, ppvIf); - } - -} // namespace G4UA + +} // namespace G4UA diff --git a/Simulation/G4Extensions/Quirks/src/DebugSteppingActionTool.h b/Simulation/G4Extensions/Quirks/src/DebugSteppingActionTool.h index 9d4d825443af1771c7a7814ffd6a597edf1adfd2..80ebb1c6d1ef8416cc90dc9a1a14d9ddf85c4452 100644 --- a/Simulation/G4Extensions/Quirks/src/DebugSteppingActionTool.h +++ b/Simulation/G4Extensions/Quirks/src/DebugSteppingActionTool.h @@ -2,36 +2,42 @@ Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration */ -#ifndef QUIRKS_G4UA__DEBUGSTEPPINGACTIONTOOL_H -#define QUIRKS_G4UA__DEBUGSTEPPINGACTIONTOOL_H -#include "G4AtlasInterfaces/IG4SteppingActionTool.h" -#include "G4AtlasTools/ActionToolBase.h" +#ifndef QUIRKS_G4UA__DEBUGSTEPPINGACTIONTOOL_H +#define QUIRKS_G4UA__DEBUGSTEPPINGACTIONTOOL_H + +#include "G4AtlasTools/UserActionToolBase.h" #include "DebugSteppingAction.h" -namespace G4UA{ + +namespace G4UA +{ + /// @class DebugSteppingActionTool /// @brief a class to manage the DebugSteppingAction action /// @author Andrea Di Simone - - class DebugSteppingActionTool: - public ActionToolBase<DebugSteppingAction>, - public IG4SteppingActionTool - { - + /// + class DebugSteppingActionTool : public UserActionToolBase<DebugSteppingAction> + { + public: - DebugSteppingActionTool(const std::string& type, const std::string& name,const IInterface* parent); - /// retrieves the stepping action - virtual G4UserSteppingAction* getSteppingAction() override final - { return static_cast<G4UserSteppingAction*>( getAction() ); } - /// gaudi interface handling - virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvInterface) override; + + /// Standard constructor + DebugSteppingActionTool(const std::string& type, + const std::string& name, + const IInterface* parent); + protected: + /// creates one action per thread - virtual std::unique_ptr<DebugSteppingAction> makeAction() override final; + virtual std::unique_ptr<DebugSteppingAction> + makeAndFillAction(G4AtlasUserActions&) override final; + private: + /// the config for the action DebugSteppingAction::Config m_config; - }; // class DebugSteppingActionTool - - -} // namespace G4UA + + }; // class DebugSteppingActionTool + +} // namespace G4UA + #endif