ATLAS Offline Software
Loading...
Searching...
No Matches
ParticleSortingAlg.h
Go to the documentation of this file.
1
2
3/*
4 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5*/
6
7// ParticleSortingAlg.h
8// Header file for class ParticleSortingAlg
9// Author: Karsten Koeneke <karsten.koeneke@cern.ch>
11#ifndef EVENTUTILS_PARTICLESORTINGALG_H
12#define EVENTUTILS_PARTICLESORTINGALG_H 1
13
14// FrameWork includes
15#include "Gaudi/Interfaces/IOptionsSvc.h"
16#include "GaudiKernel/ToolHandle.h"
17#include "GaudiKernel/ServiceHandle.h"
19
20// STL includes
21#include <string>
22
23// Forward declarations
26}
27
29 : public ::AthAlgorithm
30{
31
33 // Public methods:
35 public:
36
37 // Copy constructor:
38
40 ParticleSortingAlg( const std::string& name, ISvcLocator* pSvcLocator );
41
43 virtual ~ParticleSortingAlg();
44
46 virtual StatusCode initialize() override;
47
49 virtual StatusCode execute() override;
50
52 virtual StatusCode finalize() override;
53
54
55private:
56 // The update handlers
57
59 void setupInputContainer( Gaudi::Details::PropertyBase& /*prop*/ );
60
62 void setupOutputContainer( Gaudi::Details::PropertyBase& /*prop*/ );
63
65 void setupSortVar( Gaudi::Details::PropertyBase& /*prop*/ );
66
68 void setupSortDescending( Gaudi::Details::PropertyBase& /*prop*/ );
69
70
71
73 // Private data:
75 private:
79 this, "JobOptionsSvc", "JobOptionsSvc", "The JobOptionService instance." };
80
82 ToolHandle<DerivationFramework::IAugmentationTool> m_tool{
83 this, "SortingTool", "ParticleSortingTool/ParticleSortingTool", "The private ParticleSortingTool" };
84
85
87 StringProperty m_inCollKey{this, "InputContainer", "", &ParticleSortingAlg::setupInputContainer,
88 "Input container name" };
89
91 bool m_setInCollKey{false};
92
94 StringProperty m_outCollKey{this, "OutputContainer", "", &ParticleSortingAlg::setupOutputContainer,
95 "The name of the output container (with SG::VIEW_ELEMENTS) with the sorted copy of input objects" };
96
98 bool m_setOutCollKey{false};
99
101 StringProperty m_sortVar{this, "SortVariable", "pt", &ParticleSortingAlg::setupSortVar,
102 "Define by what parameter to sort (default: 'pt'; allowed: 'pt', 'eta', 'phi', 'm', 'e', 'rapidity')" };
103
105 bool m_setSortVar{false};
106
108 BooleanProperty m_sortDescending{this, "SortDescending", true, &ParticleSortingAlg::setupSortDescending,
109 "Define if the container should be sorted in a descending order (default=true)" };
110
113
115 unsigned long m_nEventsProcessed{0};
116
117};
118
119
120
122// Inline methods:
124
126inline void ParticleSortingAlg::setupInputContainer( Gaudi::Details::PropertyBase& /*prop*/ ) {
127 m_setInCollKey = true;
128 return;
129}
130
132inline void ParticleSortingAlg::setupOutputContainer( Gaudi::Details::PropertyBase& /*prop*/ ) {
133 m_setOutCollKey = true;
134 return;
135}
136
138inline void ParticleSortingAlg::setupSortVar( Gaudi::Details::PropertyBase& /*prop*/ )
139{
140 m_setSortVar = true;
141 return;
142}
143
145inline void ParticleSortingAlg::setupSortDescending( Gaudi::Details::PropertyBase& /*prop*/ )
146{
147 m_setSortDescending = true;
148 return;
149}
150
151
152#endif //> !EVENTUTILS_PARTICLESORTINGALG_H
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
StringProperty m_inCollKey
Input container name.
void setupInputContainer(Gaudi::Details::PropertyBase &)
This internal method will realize if a user sets the 'InputContainer' property.
ServiceHandle< Gaudi::Interfaces::IOptionsSvc > m_jos
The job options service (will be used to forward this algs properties to the private tool)
virtual ~ParticleSortingAlg()
Destructor:
bool m_setSortVar
This boolean is true if the user sets the 'SortVariable' property.
bool m_setSortDescending
This boolean is true if the user sets the 'SortDescending' property.
virtual StatusCode execute() override
Athena algorithm's execute hook.
StringProperty m_sortVar
Define by what parameter to sort (default: 'pt')
void setupSortVar(Gaudi::Details::PropertyBase &)
This internal method will realize if a user sets the 'SortVariable' property.
ParticleSortingAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
StringProperty m_outCollKey
The name of the output container (with SG::VIEW_ELEMENTS) with the sorted copy of input objects.
ToolHandle< DerivationFramework::IAugmentationTool > m_tool
The ToolHandle to the private ParticleSortingTool.
void setupOutputContainer(Gaudi::Details::PropertyBase &)
This internal method will realize if a user sets the 'OutputContainer' property.
virtual StatusCode finalize() override
Athena algorithm's finalize hook.
BooleanProperty m_sortDescending
Define if the container should be sorted in a descending order (default=true)
virtual StatusCode initialize() override
Athena algorithm's initalize hook.
void setupSortDescending(Gaudi::Details::PropertyBase &)
This internal method will realize if a user sets the 'SortDeceding' property.
unsigned long m_nEventsProcessed
Internal event counter.
bool m_setInCollKey
This boolean is true if the user sets the 'InputContainer' property.
bool m_setOutCollKey
This boolean is true if the user sets the 'OutputContainer' property.
THE reconstruction tool.