Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
12 
13 //
14 // method implementations
15 //
16 
17 namespace columnar
18 {
20  ModularExampleTool (const std::string& name)
21  : AsgTool (name)
22  {}
23 
24 
25 
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 
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`.
57  {
59  {
60  selectionDec(particle) = m_subtoolPt->select (particle) && m_subtoolEta->select (particle);
61  }
62  }
63  }
64 
65 
66 
68  SubtoolPt (float val_cutValue)
69  : m_cutValue (val_cutValue)
70  {}
71 
72 
73 
75  select (ParticleId particle) const
76  {
77  return ptAcc(particle) > m_cutValue;
78  }
79 
80 
81 
83  SubtoolEta (ColumnarTool<> *val_parent, float val_cutValue)
84  : ColumnarTool<> (val_parent), m_cutValue (val_cutValue)
85  {}
86 
87 
88 
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
columnar::ModularExampleTool::particlesHandle
ParticleAccessor< ObjectColumn > particlesHandle
the object accessor for the particles
Definition: ModularExampleTool.h:59
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: ObjectRange.h:18
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:70
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:51
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
columnar::ModularExampleTool::m_subtoolPt
std::unique_ptr< SubtoolPt > m_subtoolPt
Definition: ModularExampleTool.h:92
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:48
columnar::ObjectId
a class representing a single object (electron, muons, etc.)
Definition: ObjectId.h:18
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
columnar::ModularExampleTool::m_subtoolEta
std::unique_ptr< SubtoolEta > m_subtoolEta
Definition: ModularExampleTool.h:113
columnar
Definition: ClusterDef.h:16
columnar::ModularExampleTool::SubtoolPt::SubtoolPt
SubtoolPt(float val_cutValue)
Definition: ModularExampleTool.cxx:68
columnar::ColumnarTool<>