ATLAS Offline Software
Loading...
Searching...
No Matches
OverlapDecorationHelper.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ASSOCIATIONUTILS_OVERLAPDECORATIONHELPER_H
6#define ASSOCIATIONUTILS_OVERLAPDECORATIONHELPER_H
7
8// EDM includes
10
11// Columnar includes
15
16// Local includes
18
19namespace ORUtils
20{
21
31 template<columnar::ContainerIdConcept CI>
33 {
34
35 public:
36
45 const std::string& outputLabel,
46 bool outputPassValue = false);
47
50
53
56
59
62
65
68
73
77
80
81 private:
82
85
90
93
94 }; // class OverlapDecorationHelper
95
96 //---------------------------------------------------------------------------
97 // Constructor
98 //---------------------------------------------------------------------------
99 template<columnar::ContainerIdConcept CI>
101 OverlapDecorationHelper(const std::string& inputLabel,
102 const std::string& outputLabel,
103 bool outputPassValue)
107 {
109 resetAccessor (m_inputAccessor, *this, inputLabel);
110 }
111
112 //---------------------------------------------------------------------------
113 // Determine if object is currently OK for input to OR
114 //---------------------------------------------------------------------------
115 template<columnar::ContainerIdConcept CI>
117 (columnar::ObjectId<CI> obj) const
118 {
119 // Input label is turned off if empty string
120 if(!m_useInputLabel) return true;
121 return m_inputAccessor(obj);
122 }
123
124 //---------------------------------------------------------------------------
125 // Determine if object is currently rejected by OR
126 //---------------------------------------------------------------------------
127 template<columnar::ContainerIdConcept CI>
129 (columnar::ObjectId<CI> obj) const
130 {
131 // isRejected = isInput && (output == fail)
132 return isInputObject(obj) && ( m_outputDecorator(obj) != m_outputPassValue );
133 }
134 //---------------------------------------------------------------------------
135 // Determine if object is NOT currently rejected by OR (is surviving)
136 //---------------------------------------------------------------------------
137 template<columnar::ContainerIdConcept CI>
139 (columnar::ObjectId<CI> obj) const
140 {
141 // isSurviving = isInput && (output == pass)
142 return isInputObject(obj) && ( m_outputDecorator(obj) == m_outputPassValue );
143 }
144 //---------------------------------------------------------------------------
145 // Retrieve the user-defined object priority
146 //---------------------------------------------------------------------------
147 template<columnar::ContainerIdConcept CI>
150 {
151 // We current reuse the input decoration as the priority score
152 return m_inputAccessor(obj);
153 }
154
155 //---------------------------------------------------------------------------
156 // Set the overlap (output) decoration
157 //---------------------------------------------------------------------------
158 template<columnar::ContainerIdConcept CI>
164 //---------------------------------------------------------------------------
165 template<columnar::ContainerIdConcept CI>
170 //---------------------------------------------------------------------------
171 template<columnar::ContainerIdConcept CI>
176
177 //---------------------------------------------------------------------------
178 // Check if output decoration has been applied to a container
179 //---------------------------------------------------------------------------
180 template<columnar::ContainerIdConcept CI>
183 {
184 return container.size() > 0 &&
185 m_outputDecorator.isAvailable(container[0]);
186 }
187
188 //---------------------------------------------------------------------------
189 // Initialize output decoration
190 //---------------------------------------------------------------------------
191 template<columnar::ContainerIdConcept CI>
198
199 //---------------------------------------------------------------------------
200 // Reset output decoration
201 //---------------------------------------------------------------------------
202 template<columnar::ContainerIdConcept CI>
205 {
206 for(auto obj : container){
207 // This isn't terrible intuitive, but in order to support both output
208 // logic modes in a reasonable way, we initialize the output flag to the
209 // logical AND of isInput and outputPassValue. This results in non-input
210 // objects being initialized to 'false' regardless of output logic.
211 bool result = ( isInputObject(obj) && m_outputPassValue );
213 }
214 //for(auto obj : container) setObjectPass(obj);
215 }
216
217} // namespace ORUtils
218
219#endif
const std::string outputLabel
const bool outputPassValue
const std::string inputLabel
static const Attributes_t empty
bool m_outputPassValue
Output decoration logic.
char getObjectPriority(columnar::ObjectId< CI > obj) const
Get the user priority score, which is currently the input decoration.
bool isInputObject(columnar::ObjectId< CI > obj) const
Check if object is flagged as input for OR.
columnar::ColumnAccessor< CI, char > m_inputAccessor
Input label accessor.
void initializeDecorations(columnar::ObjectRange< CI > container) const
Initialize decorations for a container to "pass".
OverlapDecorationHelper(const std::string &inputLabel, const std::string &outputLabel, bool outputPassValue=false)
Constructor.
void resetDecorations(columnar::ObjectRange< CI > container) const
Helper method for setting all objects as passing.
bool isSurvivingObject(columnar::ObjectId< CI > obj) const
Check if object is surviving OR thus far.
bool isRejectedObject(columnar::ObjectId< CI > obj) const
Check if an object has been rejected by decoration.
void setObjectPass(columnar::ObjectId< CI > obj) const
Shorthand way to set an object as passing overlap removal.
columnar::ColumnDecorator< CI, char > m_outputDecorator
Output decorator.
bool isDecorated(columnar::ObjectRange< CI > container) const
Check if output decoration has been applied to a container.
void setOverlapDecoration(columnar::ObjectId< CI > obj, bool result) const
Set output decoration on object, pass or fail.
void setObjectFail(columnar::ObjectId< CI > obj) const
Shorthand way to set an object as failing overlap removal.
bool m_useInputLabel
Toggle usage of input label.
the base class for all columnar components
a class representing a single object (electron, muons, etc.)
a class representing a continuous sequence of objects (a.k.a. a container)
AccessorTemplate< CI, CT, ColumnAccessMode::input, CM > ColumnAccessor
AccessorTemplate< CI, CT, ColumnAccessMode::output, CM > ColumnDecorator