ATLAS Offline Software
UserActionToolBase.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef G4ATLASTOOLS_USERACTIONTOOLBASE_H
6 #define G4ATLASTOOLS_USERACTIONTOOLBASE_H
7 
8 // System includes
9 #include <memory>
10 
11 // Framework includes
13 
14 // G4Atlas includes
16 
17 // Local includes
19 
20 
21 namespace G4UA
22 {
23 
31  template <class ActionType>
32  class UserActionToolBase : public extends<AthAlgTool, IUserActionTool>
33  {
34 
35  public:
36 
38  UserActionToolBase(const std::string& type, const std::string& name,
39  const IInterface* parent)
40  : base_class(type, name, parent)
41  {}
42 
44  virtual StatusCode
45  fillUserAction(G4AtlasUserActions& actionLists) override final
46  {
47  auto myAction = makeAndFillAction(actionLists);
48  if(myAction == nullptr) {
49  ATH_MSG_ERROR( "Failed to construct user action in " << name() );
50  return StatusCode::FAILURE;
51  }
52  m_actions.set( std::move(myAction) );
53  return StatusCode::SUCCESS;
54  }
55 
56  protected:
57 
59  virtual std::unique_ptr<ActionType>
61 
64 
65  }; // UserActionToolBase
66 
67 } // namespace G4UA
68 
69 #endif // G4ATLASTOOLS_USERACTIONTOOLBASE_H
G4UA::G4AtlasUserActions
Struct for passing around user actions.
Definition: IUserActionTool.h:32
ThreadSpecificUserAction.h
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
G4UA::UserActionToolBase::m_actions
ThreadSpecificUserAction< ActionType > m_actions
Thread-specific storage of the user action.
Definition: UserActionToolBase.h:63
G4UA::UserActionToolBase::UserActionToolBase
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: UserActionToolBase.h:38
G4UA::UserActionToolBase::fillUserAction
virtual StatusCode fillUserAction(G4AtlasUserActions &actionLists) override final
Fill the user action lists.
Definition: UserActionToolBase.h:45
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
G4UA::UserActionToolBase::makeAndFillAction
virtual std::unique_ptr< ActionType > makeAndFillAction(G4AtlasUserActions &actionLists)=0
Make the action and push onto the lists.
G4UA::UserActionToolBase
abstract template utility base-class for G4 user-action tools.
Definition: UserActionToolBase.h:33
IUserActionTool.h
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
G4UA::ThreadSpecificUserAction
A thread-local storage wrapper for the user actions.
Definition: ThreadSpecificUserAction.h:31