ATLAS Offline Software
Loading...
Searching...
No Matches
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
23namespace 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
#define ATH_MSG_ERROR(x)
A thread-local storage wrapper for the user actions.
StatusCode BeginOfAthenaEvent(HitCollectionMap &) override
Calls BeginOfAthenaEvent.
StatusCode EndOfAthenaEvent(HitCollectionMap &) override
Calls EndOfAthenaEvent.
virtual std::unique_ptr< ActionType > makeAndFillAction(G4AtlasUserActions &actionLists)=0
Make the action and push onto the lists.
ThreadSpecificUserAction< ActionType > m_actions
Thread-specific storage of the user action.
virtual StatusCode fillUserAction(G4AtlasUserActions &actionLists) override final
Fill the user action lists.
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Small wrapper around hit collection map to facilitate accessing the hit collection.
Struct for passing around user actions.