Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
LinkColumnExampleTool.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  LinkColumnExampleTool (const std::string& name)
21  : AsgTool (name)
22  {}
23 
24 
25 
27  initialize ()
28  {
29  // give the base class a chance to initialize the column accessor
30  // backends
31  ANA_CHECK (initializeColumns());
32  return StatusCode::SUCCESS;
33  }
34 
35 
36 
39  {
40  // loop over all events and particles. note that this is
41  // deliberately looping by value, as the ID classes are very small
42  // and can be copied cheaply. this could have also been written as
43  // a single loop over all particles in the event range, but I chose
44  // to split it up into two loops as most tools will need to do some
45  // per-event things, e.g. retrieve `EventInfo`.
47  {
48  for (auto muon : muonsHandle(event))
49  {
50  // retrieve the track linked to the muon
51  OptTrackId track = trackLinkAcc(muon);
52 
53  // apply the selection, the OptTrackId tries to (mostly) behave
54  // like a std::optional<TrackId>, so we can use it in a similar
55  // way. Here we first check if the track is valid, then do a
56  // curvature selection on the track.
57  selectionDec(muon) = track && std::abs(trackQOverPAcc(track.value())) < 1. / m_ptCut.value();
58  }
59  }
60  }
61 }
columnar::LinkColumnExampleTool::LinkColumnExampleTool
LinkColumnExampleTool(const std::string &name)
Definition: LinkColumnExampleTool.cxx:20
columnar::LinkColumnExampleTool::selectionDec
MuonDecorator< char > selectionDec
the selection decorator for the particles
Definition: LinkColumnExampleTool.h:87
ANA_CHECK
#define ANA_CHECK(EXP)
check whether the given expression was successful
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:324
columnar::OptObjectId
a class representing a single optional object (electron, muons, etc.)
Definition: OptObjectId.h:24
columnar::LinkColumnExampleTool::muonsHandle
MuonAccessor< ObjectColumn > muonsHandle
the object accessor for the muons
Definition: LinkColumnExampleTool.h:50
columnar::LinkColumnExampleTool::trackLinkAcc
MuonAccessor< OptTrackId > trackLinkAcc
the link accessor for the particles
Definition: LinkColumnExampleTool.h:67
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::LinkColumnExampleTool::m_ptCut
Gaudi::Property< float > m_ptCut
the pt cut to apply
Definition: LinkColumnExampleTool.h:42
LinkColumnExampleTool.h
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
columnar::LinkColumnExampleTool::callEvents
virtual void callEvents(EventContextRange events) const override
Definition: LinkColumnExampleTool.cxx:38
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
columnar::LinkColumnExampleTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: LinkColumnExampleTool.cxx:27
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:228
columnar::LinkColumnExampleTool::trackQOverPAcc
TrackAccessor< float > trackQOverPAcc
the q/p accessor for the track container
Definition: LinkColumnExampleTool.h:76
columnar
Definition: ClusterDef.h:16