ATLAS Offline Software
PhysicsAnalysis
DerivationFramework
DerivationFrameworkTools
src
AsgSelectionToolWrapper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
// AsgSelectionToolWrapper.cxx, (c) ATLAS Detector software
8
// Author: James Catmore (james.catmore@cern.ch)
9
//
10
11
#include "
DerivationFrameworkTools/AsgSelectionToolWrapper.h
"
12
#include "
PATCore/AcceptData.h
"
13
#include "
StoreGate/ReadHandle.h
"
14
#include "
StoreGate/WriteDecorHandle.h
"
15
16
17
namespace
DerivationFramework
{
18
19
AsgSelectionToolWrapper::AsgSelectionToolWrapper
(
const
std::string&
t
,
20
const
std::string&
n
,
21
const
IInterface*
p
) :
22
base_class(
t
,
n
,
p
)
23
24
{
25
}
26
27
StatusCode
AsgSelectionToolWrapper::initialize
() {
28
if
(
m_sgName
.value().empty()) {
29
ATH_MSG_ERROR
(
"No SG name provided for the output of invariant mass tool!"
);
30
return
StatusCode::FAILURE;
31
}
32
ATH_CHECK
(
m_tool
.retrieve());
33
ATH_CHECK
(
m_containerKey
.initialize());
34
m_decorKey
=
m_containerKey
.key() +
"."
+
m_sgName
;
35
ATH_CHECK
(
m_decorKey
.initialize());
36
return
StatusCode::SUCCESS;
37
}
38
39
40
41
StatusCode
AsgSelectionToolWrapper::addBranches
()
const
42
{
43
// retrieve container
44
45
const
EventContext& ctx = Gaudi::Hive::currentContext();
46
SG::WriteDecorHandle<xAOD::IParticleContainer, char>
decorator (
m_decorKey
, ctx);
47
if
( ! decorator.isValid() ) {
48
ATH_MSG_ERROR
(
"Couldn't retrieve IParticles with key: "
<<
m_containerKey
.fullKey() );
49
return
StatusCode::FAILURE;
50
}
51
52
// Write mask for each element and record to SG for subsequent selection
53
for
(
const
xAOD::IParticle
*
part
: *decorator) {
54
auto
theAccept =
m_tool
->accept(
part
);
// asg::AcceptData or TAccept
55
if
(
m_cut
.empty()){
56
decorator(*
part
) =
true
&& theAccept;
57
}
else
{
58
decorator(*
part
) =
true
&& theAccept.getCutResult(
m_cut
);
59
}
60
}
61
62
return
StatusCode::SUCCESS;
63
}
64
}
LArG4FSStartPointFilter.part
part
Definition:
LArG4FSStartPointFilter.py:21
DerivationFramework::AsgSelectionToolWrapper::AsgSelectionToolWrapper
AsgSelectionToolWrapper(const std::string &t, const std::string &n, const IInterface *p)
Definition:
AsgSelectionToolWrapper.cxx:19
read_hist_ntuple.t
t
Definition:
read_hist_ntuple.py:5
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition:
Event/xAOD/xAODBase/xAODBase/IParticle.h:41
python.utils.AtlRunQueryDQUtils.p
p
Definition:
AtlRunQueryDQUtils.py:209
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition:
AthMsgStreamMacros.h:33
beamspotman.n
n
Definition:
beamspotman.py:729
DerivationFramework::AsgSelectionToolWrapper::m_tool
PublicToolHandle< IAsgSelectionTool > m_tool
Definition:
AsgSelectionToolWrapper.h:27
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition:
StoreGate/StoreGate/WriteDecorHandle.h:100
WriteDecorHandle.h
Handle class for adding a decoration to an object.
DerivationFramework::AsgSelectionToolWrapper::m_sgName
Gaudi::Property< std::string > m_sgName
Definition:
AsgSelectionToolWrapper.h:29
ATH_CHECK
#define ATH_CHECK
Definition:
AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition:
ParticleSortingAlg.h:24
AcceptData.h
DerivationFramework::AsgSelectionToolWrapper::m_containerKey
SG::ReadHandleKey< xAOD::IParticleContainer > m_containerKey
Definition:
AsgSelectionToolWrapper.h:31
DerivationFramework::AsgSelectionToolWrapper::addBranches
virtual StatusCode addBranches() const override final
Definition:
AsgSelectionToolWrapper.cxx:41
DerivationFramework::AsgSelectionToolWrapper::m_cut
Gaudi::Property< std::string > m_cut
Definition:
AsgSelectionToolWrapper.h:28
DerivationFramework::AsgSelectionToolWrapper::initialize
StatusCode initialize() override final
Definition:
AsgSelectionToolWrapper.cxx:27
DerivationFramework::AsgSelectionToolWrapper::m_decorKey
SG::WriteDecorHandleKey< xAOD::IParticleContainer > m_decorKey
Definition:
AsgSelectionToolWrapper.h:33
AsgSelectionToolWrapper.h
ReadHandle.h
Handle class for reading from StoreGate.
Generated on Wed Sep 3 2025 21:06:38 for ATLAS Offline Software by
1.8.18