ATLAS Offline Software
PhysicsAnalysis
Columnar
ColumnarExampleTools
Root
ModularExampleTool.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
//
8
// includes
9
//
10
11
#include <
ColumnarExampleTools/ModularExampleTool.h
>
12
13
//
14
// method implementations
15
//
16
17
namespace
columnar
18
{
19
ModularExampleTool ::
20
ModularExampleTool
(
const
std::string&
name
)
21
: AsgTool (
name
)
22
{}
23
24
25
26
StatusCode
ModularExampleTool ::
27
initialize
()
28
{
29
m_subtoolPt
= std::make_unique<SubtoolPt> (
m_ptCut
.value());
30
31
// all subtools need to be connected to the base class, so that the
32
// accessors can be properly connected in columnar mode.
33
addSubtool (*
m_subtoolPt
);
34
37
m_subtoolEta
= std::make_unique<SubtoolEta> (
this
,
m_etaCut
.value());
38
39
// give the base class a chance to initialize the column accessor
40
// backends
41
ANA_CHECK
(initializeColumns());
42
return
StatusCode::SUCCESS;
43
}
44
45
46
47
void
ModularExampleTool ::
48
callEvents
(
EventContextRange
events
)
const
49
{
50
// loop over all events and particles. note that this is
51
// deliberately looping by value, as the ID classes are very small
52
// and can be copied cheaply. this could have also been written as
53
// a single loop over all particles in the event range, but I chose
54
// to split it up into two loops as most tools will need to do some
55
// per-event things, e.g. retrieve `EventInfo`.
56
for
(
columnar::EventContextId
event
:
events
)
57
{
58
for
(
columnar::ParticleId
particle
:
particlesHandle
(
event
))
59
{
60
selectionDec
(
particle
) =
m_subtoolPt
->select (
particle
) &&
m_subtoolEta
->select (
particle
);
61
}
62
}
63
}
64
65
66
67
ModularExampleTool::SubtoolPt ::
68
SubtoolPt
(
float
val_cutValue)
69
: m_cutValue (val_cutValue)
70
{}
71
72
73
74
bool
ModularExampleTool::SubtoolPt ::
75
select
(
ParticleId
particle
)
const
76
{
77
return
ptAcc(
particle
) > m_cutValue;
78
}
79
80
81
82
ModularExampleTool::SubtoolEta ::
83
SubtoolEta
(
ColumnarTool<>
*val_parent,
float
val_cutValue)
84
:
ColumnarTool
<> (val_parent), m_cutValue (val_cutValue)
85
{}
86
87
88
89
bool
ModularExampleTool::SubtoolEta ::
90
select
(
ParticleId
particle
)
const
91
{
92
return
std::abs(etaAcc(
particle
)) < m_cutValue;
93
}
94
}
columnar::ModularExampleTool::callEvents
virtual void callEvents(EventContextRange events) const override
Definition:
ModularExampleTool.cxx:48
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition:
ParticleHypothesis.h:79
columnar::ModularExampleTool::particlesHandle
ParticleAccessor< ObjectColumn > particlesHandle
the object accessor for the particles
Definition:
ModularExampleTool.h:62
columnar::ModularExampleTool::ModularExampleTool
ModularExampleTool(const std::string &name)
Definition:
ModularExampleTool.cxx:20
columnar::ModularExampleTool::SubtoolPt::select
bool select(ParticleId particle) const
Definition:
ModularExampleTool.cxx:75
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition:
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
columnar::ObjectRange
a class representing a continuous sequence of objects (a.k.a. a container)
Definition:
ContainerId.h:177
python.DataFormatRates.events
events
Definition:
DataFormatRates.py:105
columnar::ModularExampleTool::SubtoolEta::SubtoolEta
SubtoolEta(ColumnarTool<> *parent, float val_cutValue)
Definition:
ModularExampleTool.cxx:83
columnar::ModularExampleTool::selectionDec
ParticleDecorator< char > selectionDec
the selection decorator for the particles
Definition:
ModularExampleTool.h:73
columnar::ModularExampleTool::SubtoolEta::select
bool select(ParticleId particle) const
Definition:
ModularExampleTool.cxx:90
columnar::ModularExampleTool::m_etaCut
Gaudi::Property< float > m_etaCut
the eta cut to apply
Definition:
ModularExampleTool.h:54
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
columnar::ModularExampleTool::m_subtoolPt
std::unique_ptr< SubtoolPt > m_subtoolPt
Definition:
ModularExampleTool.h:95
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition:
PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ModularExampleTool.h
columnar::ModularExampleTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition:
ModularExampleTool.cxx:27
columnar::ModularExampleTool::m_ptCut
Gaudi::Property< float > m_ptCut
the pt cut to apply
Definition:
ModularExampleTool.h:51
columnar::ObjectId
a class representing a single object (electron, muons, etc.)
Definition:
ContainerId.h:178
name
std::string name
Definition:
Control/AthContainers/Root/debug.cxx:240
columnar::ModularExampleTool::m_subtoolEta
std::unique_ptr< SubtoolEta > m_subtoolEta
Definition:
ModularExampleTool.h:116
columnar
Definition:
ClusterDef.h:16
columnar::ModularExampleTool::SubtoolPt::SubtoolPt
SubtoolPt(float val_cutValue)
Definition:
ModularExampleTool.cxx:68
columnar::ColumnarTool<>
Generated on Tue Sep 30 2025 21:14:21 for ATLAS Offline Software by
1.8.18