ATLAS Offline Software
Loading...
Searching...
No Matches
IPartCombItr.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGCOMPOSITEUTILS_IPARTCOMBITR_H
6#define TRIGCOMPOSITEUTILS_IPARTCOMBITR_H
7
12
13#include <iterator>
14#include <vector>
15#include <tuple>
16#include <functional>
17
18
19namespace TrigCompositeUtils
20{
21
33
34 bool uniqueObjects(const std::vector<LinkInfo<xAOD::IParticleContainer>> &links);
36 bool uniqueInitialRoIs(const std::vector<LinkInfo<xAOD::IParticleContainer>> &links);
38 bool uniqueRoIs(const std::vector<LinkInfo<xAOD::IParticleContainer>> &links);
39
41 {
42 public:
43 using VecLInfo_t = std::vector<LinkInfo<xAOD::IParticleContainer>>;
44 using LInfoItr_t = VecLInfo_t::const_iterator;
45 using FilterFunc_t = std::function<bool(const IPartCombItr::VecLInfo_t &)>;
46
47 using iterator_category = std::input_iterator_tag;
49 using reference = const value_type &;
50 using pointer = const value_type *;
51 using difference_type = std::ptrdiff_t;
52
54 static FilterFunc_t getFilter(FilterType filter);
55
58
69 const std::vector<std::tuple<std::size_t, LInfoItr_t, LInfoItr_t>> &pieces,
70 FilterFunc_t filter);
71
82 const std::vector<std::tuple<std::size_t, LInfoItr_t, LInfoItr_t>> &pieces,
84
86 std::size_t size() const { return m_current.size(); }
87
89 std::size_t nLegs() const { return m_linkInfoItrs.size(); }
90
98 void reset();
99
101 bool exhausted() const;
102
104 reference operator*() const;
105 pointer operator->() const;
106
109
112
114 bool operator==(const IPartCombItr &other) const;
115 bool operator!=(const IPartCombItr &other) const;
116
117 private:
119 std::vector<LInfoItr_t> m_linkInfoItrs;
121 void readCurrent();
123
124 }; //> end class IPartCombItr
125} // namespace TrigCompositeUtils
126
127#endif //> !TRIGCOMPOSITEUTILS_IPARTCOMBITR_H
std::input_iterator_tag iterator_category
void reset()
Reset the iterator to its starting point.
std::vector< LInfoItr_t > m_linkInfoItrs
std::size_t size() const
The size of each combination.
IPartCombItr()
A default constructed iterator acts as a past-the-end iterator.
bool operator!=(const IPartCombItr &other) const
std::vector< LinkInfo< xAOD::IParticleContainer > > VecLInfo_t
std::function< bool(const IPartCombItr::VecLInfo_t &)> FilterFunc_t
IPartCombItr & operator++()
Pre-increment operator.
std::size_t nLegs() const
The number of legs.
VecLInfo_t::const_iterator LInfoItr_t
reference operator*() const
Dereference.
ProductItr< KFromNItr > m_idxItr
bool exhausted() const
True if this iterator is past the end.
static FilterFunc_t getFilter(FilterType filter)
Get a function corresponding to the specified FilterType enum.
bool operator==(const IPartCombItr &other) const
Iterator comparison functions.
Iterates over all combinations of the provided input iterators.
Definition ProductItr.h:43
bool uniqueObjects(const std::vector< LinkInfo< xAOD::IParticleContainer > > &links)
Helper function that returns true if no objects are repeated.
bool uniqueRoIs(const std::vector< LinkInfo< xAOD::IParticleContainer > > &links)
Helper function that returns true if no objects share a final RoI.
bool uniqueInitialRoIs(const std::vector< LinkInfo< xAOD::IParticleContainer > > &links)
Helper function that returns true if no objects share an initial RoI.
@ UniqueRoIs
Do not allow any two objects to share an RoI.
@ UniqueInitialRoIs
Do not allow any two objects to share an initial RoI.
@ All
Allow all combinations.
@ UniqueObjects
Do not allow any repeated objects.
Helper to keep a Decision object, ElementLink and ActiveState (with respect to some requested ChainGr...
Definition LinkInfo.h:22