ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
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
}
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
ModularExampleTool.h
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition
AsgTool.cxx:58
columnar::ColumnarTool<>
columnar::ModularExampleTool::m_subtoolEta
std::unique_ptr< SubtoolEta > m_subtoolEta
Definition
ModularExampleTool.h:109
columnar::ModularExampleTool::m_subtoolPt
std::unique_ptr< SubtoolPt > m_subtoolPt
Definition
ModularExampleTool.h:88
columnar::ModularExampleTool::m_etaCut
Gaudi::Property< float > m_etaCut
the eta cut to apply
Definition
ModularExampleTool.h:54
columnar::ModularExampleTool::selectionDec
ParticleDecorator< char > selectionDec
the selection decorator for the particles
Definition
ModularExampleTool.h:73
columnar::ModularExampleTool::particlesHandle
ParticleAccessor< ObjectColumn > particlesHandle
the object accessor for the particles
Definition
ModularExampleTool.h:62
columnar::ModularExampleTool::m_ptCut
Gaudi::Property< float > m_ptCut
the pt cut to apply
Definition
ModularExampleTool.h:51
columnar
Definition
ClusterDef.h:16
columnar::EventContextRange
ObjectRange< EventContextDef > EventContextRange
Definition
ContainerId.h:211
columnar::EventContextId
ObjectId< EventContextDef > EventContextId
Definition
ContainerId.h:212
columnar::ParticleId
ObjectId< ParticleDef > ParticleId
Definition
ParticleDef.h:33
columnar::ModularExampleTool::SubtoolEta::m_cutValue
float m_cutValue
Definition
ModularExampleTool.h:107
columnar::ModularExampleTool::SubtoolEta::etaAcc
ParticleAccessor< float > etaAcc
Definition
ModularExampleTool.h:106
columnar::ModularExampleTool::SubtoolPt::m_cutValue
float m_cutValue
Definition
ModularExampleTool.h:86
columnar::ModularExampleTool::SubtoolPt::ptAcc
ParticleAccessor< float > ptAcc
Definition
ModularExampleTool.h:85
Generated on
for ATLAS Offline Software by
1.17.0