ATLAS Offline Software
Loading...
Searching...
No Matches
MomentumAccessorExampleTool.h File Reference
Include dependency graph for MomentumAccessorExampleTool.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

namespace ADD_CMODE (columnar)

Function Documentation

◆ ADD_CMODE()

namespace ADD_CMODE ( columnar )
Author
Nils Krumnack

an example of a columnar tool that uses momentum accessors

This is a variation of the SimpleSelectorExampleTool but it uses the momentum accessors to access the energy of the particles, instead of using column accessors to read variables directly from the file.

the energy cut to apply

the object accessor for the particles

This is equivalent to a ReadHandleKey in the xAOD world. It is used to access the particle range/container for a given event.

the momentum accessors for the particle container

This is an accessor that provides access to all the available momentum variables and can be reconfigured at configuration time to different momentum accessors.

the object type accessor for the particle container

This is a bit of a hybrid between a property accessor and a column accessor, as it needs to be able to access the property type at configuration time (to set the correct momentum accessor).

the selection decorator for the particles

This is the equivalent to an AuxElement::Decorator in the xAOD world. One thing to note is that the tools generally run on many objects, not a a single object. So the tool doesn't have the option to return individual output values. Instead it needs to provide an output value per object, which in the columnar world is done by filling a column.

Definition at line 1 of file MomentumAccessorExampleTool.h.

21{
28
29 class MomentumAccessorExampleTool final
30 : public asg::AsgTool,
32 {
33 public:
34
35 // Create a proper constructor for Athena
36 ASG_TOOL_CLASS( MomentumAccessorExampleTool, asg::IAsgTool )
37
38 MomentumAccessorExampleTool (const std::string& name);
39
40 virtual StatusCode initialize () override;
41
42 void callSingleEvent (columnar::ParticleRange particles) const;
43
44 virtual void callEvents (columnar::EventContextRange events) const override;
45
46
48 Gaudi::Property<float> m_energyCut {this, "energyCut", 10e3, "energy cut (in MeV)"};
49
50
56 columnar::ParticleAccessor<columnar::ObjectColumn> particlesHandle {*this, "Particles"};
57
58
64 columnar::MomentumAccessors<columnar::ParticleDef> momAcc;
65
72 columnar::ObjectTypeAccessor<columnar::ParticleDef> objectTypeAcc {*this, "ObjectType", "the object type of the particles"};
73
74 // If you want to use a statically configured momentum accessor,
75 // this would be the basic way to do it. For now (24 Jul 25) I don't
76 // think this is worth the effort, as the dynamic momentum accessors
77 // seem to be working pretty well.
78 // Detail::FullMomentumAccessorsPtEtaPhiM<Detail::CoreMomentumAccessorsPtEtaPhiReadM<columnar::ParticleDef,ColumnarMode>> momAcc {*this};
79
80
89 columnar::ParticleDecorator<char> selectionDec {*this, "selection"};
90 };
91}
#define ASG_TOOL_CLASS(CLASSNAME, INT1)
Base class for the dual-use tool implementation classes.
Definition AsgTool.h:47
virtual StatusCode initialize()
Dummy implementation of the initialisation function.
Definition AsgTool.h:133
the base class for all columnar components
::StatusCode StatusCode
StatusCode definition for legacy code.
ObjectRange< EventContextDef > EventContextRange
AccessorTemplate< ParticleDef, CT, ColumnAccessMode::input, CM > ParticleAccessor
Definition ParticleDef.h:35
AccessorTemplate< ParticleDef, CT, ColumnAccessMode::output, CM > ParticleDecorator
Definition ParticleDef.h:36
ObjectRange< ParticleDef > ParticleRange
Definition ParticleDef.h:32