ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Simulation
G4Atlas
G4AtlasTools
G4AtlasTools
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
12
#include "
AthenaBaseComps/AthAlgTool.h
"
13
#include <GaudiKernel/StatusCode.h>
14
15
// G4Atlas includes
16
#include "
G4AtlasInterfaces/IUserActionTool.h
"
17
#include "
HitManagement/HitCollectionMap.h
"
18
19
// Local includes
20
#include "
ThreadSpecificUserAction.h
"
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>
67
makeAndFillAction
(
G4AtlasUserActions
& actionLists) = 0;
68
70
ThreadSpecificUserAction<ActionType>
m_actions
;
71
72
};
// UserActionToolBase
73
74
}
// namespace G4UA
75
76
#endif
// G4ATLASTOOLS_USERACTIONTOOLBASE_H
AthAlgTool.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
HitCollectionMap.h
IUserActionTool.h
ThreadSpecificUserAction.h
G4UA::ThreadSpecificUserAction
A thread-local storage wrapper for the user actions.
Definition
ThreadSpecificUserAction.h:31
G4UA::UserActionToolBase::BeginOfAthenaEvent
StatusCode BeginOfAthenaEvent(HitCollectionMap &) override
Calls BeginOfAthenaEvent.
Definition
UserActionToolBase.h:59
G4UA::UserActionToolBase::EndOfAthenaEvent
StatusCode EndOfAthenaEvent(HitCollectionMap &) override
Calls EndOfAthenaEvent.
Definition
UserActionToolBase.h:61
G4UA::UserActionToolBase::makeAndFillAction
virtual std::unique_ptr< ActionType > makeAndFillAction(G4AtlasUserActions &actionLists)=0
Make the action and push onto the lists.
G4UA::UserActionToolBase::m_actions
ThreadSpecificUserAction< ActionType > m_actions
Thread-specific storage of the user action.
Definition
UserActionToolBase.h:70
G4UA::UserActionToolBase::fillUserAction
virtual StatusCode fillUserAction(G4AtlasUserActions &actionLists) override final
Fill the user action lists.
Definition
UserActionToolBase.h:47
G4UA::UserActionToolBase::UserActionToolBase
UserActionToolBase(const std::string &type, const std::string &name, const IInterface *parent)
Standard constructor.
Definition
UserActionToolBase.h:40
HitCollectionMap
Small wrapper around hit collection map to facilitate accessing the hit collection.
Definition
HitCollectionMap.h:23
G4UA
for nSW
Definition
CalibrationDefaultProcessing.h:19
G4UA::G4AtlasUserActions
Struct for passing around user actions.
Definition
IUserActionTool.h:35
type
Generated on
for ATLAS Offline Software by
1.17.0