ATLAS Offline Software
MomentumAccessorExampleTool.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  MomentumAccessorExampleTool (const std::string& name)
21  : AsgTool (name)
22  {}
23 
24 
25 
27  initialize ()
28  {
29  if (auto type = objectTypeAcc.staticType())
30  resetObjectType (momAcc, *this, *type);
31  else
32  ANA_MSG_INFO ("ObjectTypeAccessor: no object type set, using default");
33 
34  // give the base class a chance to initialize the column accessor
35  // backends
36  ANA_CHECK (initializeColumns());
37  return StatusCode::SUCCESS;
38  }
39 
40 
41 
44  {
46  {
48  }
49  }
50 
51 
52 
55  {
56  // loop over all events and particles. note that this is
57  // deliberately looping by value, as the ID classes are very small
58  // and can be copied cheaply. this could have also been written as
59  // a single loop over all particles in the event range, but I chose
60  // to split it up into two loops as most tools will need to do some
61  // per-event things, e.g. retrieve `EventInfo`.
63  {
65  }
66  }
67 }
Trk::ParticleSwitcher::particle
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:79
MomentumAccessorExampleTool.h
columnar::resetObjectType
void resetObjectType(MomentumAccessors< CI, CM > &accessors, ColumnarTool< CM > &columnarTool, xAODType::ObjectType type)
Definition: MomentumAccessors.h:371
columnar::MomentumAccessorExampleTool::callEvents
virtual void callEvents(EventContextRange events) const override
Definition: MomentumAccessorExampleTool.cxx:54
columnar::MomentumAccessorExampleTool::initialize
virtual StatusCode initialize() override
Dummy implementation of the initialisation function.
Definition: MomentumAccessorExampleTool.cxx:27
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
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
columnar::MomentumAccessorExampleTool::MomentumAccessorExampleTool
MomentumAccessorExampleTool(const std::string &name)
Definition: MomentumAccessorExampleTool.cxx:20
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ANA_MSG_INFO
#define ANA_MSG_INFO(xmsg)
Macro printing info messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:290
columnar::MomentumAccessorExampleTool::selectionDec
ParticleDecorator< char > selectionDec
the selection decorator for the particles
Definition: MomentumAccessorExampleTool.h:89
columnar::ObjectId
a class representing a single object (electron, muons, etc.)
Definition: ContainerId.h:178
columnar::MomentumAccessorExampleTool::callSingleEvent
void callSingleEvent(ParticleRange particles) const
Definition: MomentumAccessorExampleTool.cxx:43
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
columnar::MomentumAccessorExampleTool::momAcc
MomentumAccessors< ContainerId::particle > momAcc
the momentum accessors for the particle container
Definition: MomentumAccessorExampleTool.h:64
columnar
Definition: ClusterDef.h:16
columnar::MomentumAccessorExampleTool::particlesHandle
ParticleAccessor< ObjectColumn > particlesHandle
the object accessor for the particles
Definition: MomentumAccessorExampleTool.h:56
LArG4FSStartPointFilter.particles
list particles
Definition: LArG4FSStartPointFilter.py:84
columnar::MomentumAccessorExampleTool::m_energyCut
Gaudi::Property< float > m_energyCut
the energy cut to apply
Definition: MomentumAccessorExampleTool.h:48
columnar::MomentumAccessorExampleTool::objectTypeAcc
ObjectTypeAccessor< ContainerId::particle > objectTypeAcc
the object type accessor for the particle container
Definition: MomentumAccessorExampleTool.h:72