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 #include <GaudiKernel/StatusCode.h>
14 
15 // G4Atlas includes
18 
19 // Local includes
21 
22 
23 namespace G4UA
24 {
25 
33  template <class ActionType>
34  class UserActionToolBase : public extends<AthAlgTool, IUserActionTool>
35  {
36 
37  public:
38 
40  UserActionToolBase(const std::string& type, const std::string& name,
41  const IInterface* parent)
42  : base_class(type, name, parent)
43  {}
44 
46  virtual StatusCode
47  fillUserAction(G4AtlasUserActions& actionLists) override final
48  {
49  auto myAction = makeAndFillAction(actionLists);
50  if(myAction == nullptr) {
51  ATH_MSG_ERROR( "Failed to construct user action in " << name() );
52  return StatusCode::FAILURE;
53  }
54  m_actions.set( std::move(myAction) );
55  return StatusCode::SUCCESS;
56  }
57 
59  StatusCode BeginOfAthenaEvent(HitCollectionMap&) override {return StatusCode::SUCCESS;};
61  StatusCode EndOfAthenaEvent(HitCollectionMap&) override {return StatusCode::SUCCESS;};
62 
63  protected:
64 
66  virtual std::unique_ptr<ActionType>
68 
71 
72  }; // UserActionToolBase
73 
74 } // namespace G4UA
75 
76 #endif // G4ATLASTOOLS_USERACTIONTOOLBASE_H
G4UA::G4AtlasUserActions
Struct for passing around user actions.
Definition: IUserActionTool.h:34
ThreadSpecificUserAction.h
HitCollectionMap
Small wrapper around hit collection map to facilitate accessing the hit collection.
Definition: HitCollectionMap.h:21
HitCollectionMap.h
G4UA
for nSW
Definition: CalibrationDefaultProcessing.h:19
G4UA::UserActionToolBase::EndOfAthenaEvent
StatusCode EndOfAthenaEvent(HitCollectionMap &) override
Calls EndOfAthenaEvent.
Definition: UserActionToolBase.h:61
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
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:70
G4UA::UserActionToolBase::UserActionToolBase
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition: UserActionToolBase.h:40
G4UA::UserActionToolBase::fillUserAction
virtual StatusCode fillUserAction(G4AtlasUserActions &actionLists) override final
Fill the user action lists.
Definition: UserActionToolBase.h:47
AthAlgTool.h
test_pyathena.parent
parent
Definition: test_pyathena.py:15
G4UA::UserActionToolBase::BeginOfAthenaEvent
StatusCode BeginOfAthenaEvent(HitCollectionMap &) override
Calls BeginOfAthenaEvent.
Definition: UserActionToolBase.h:59
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
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:35
IUserActionTool.h
G4UA::ThreadSpecificUserAction
A thread-local storage wrapper for the user actions.
Definition: ThreadSpecificUserAction.h:31