ATLAS Offline Software
Loading...
Searching...
No Matches
IPartCombItr.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 TRIGCOMPOSITEUTILS_IPARTCOMBITR_H
6#define TRIGCOMPOSITEUTILS_IPARTCOMBITR_H
7
8#include <iterator>
9#include <vector>
10#include <tuple>
11#include <utility>
12#include <algorithm>
13#include <functional>
18
19namespace TrigCompositeUtils
20{
32
33 bool uniqueObjects(const std::vector<LinkInfo<xAOD::IParticleContainer>> &links);
35 bool uniqueInitialRoIs(const std::vector<LinkInfo<xAOD::IParticleContainer>> &links);
37 bool uniqueRoIs(const std::vector<LinkInfo<xAOD::IParticleContainer>> &links);
38
40 std::function<bool(const std::vector<LinkInfo<xAOD::IParticleContainer>> &)> getFilter(FilterType filter);
42 {
43 public:
44 using VecLInfo_t = std::vector<LinkInfo<xAOD::IParticleContainer>>;
45 using LInfoItr_t = VecLInfo_t::const_iterator;
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
55
66 const std::vector<std::tuple<std::size_t, LInfoItr_t, LInfoItr_t>> &pieces,
67 std::function<bool(const VecLInfo_t &)> filter);
68
79 const std::vector<std::tuple<std::size_t, LInfoItr_t, LInfoItr_t>> &pieces,
81
83 std::size_t size() const { return m_current.size(); }
84
86 std::size_t nLegs() const { return m_linkInfoItrs.size(); }
87
95 void reset();
96
98 bool exhausted() const;
99
101 reference operator*() const;
102 pointer operator->() const;
103
106
109
111 bool operator==(const IPartCombItr &other) const;
112 bool operator!=(const IPartCombItr &other) const;
113
114 private:
115 std::function<bool(const VecLInfo_t &)> m_filter;
116 std::vector<LInfoItr_t> m_linkInfoItrs;
118 void readCurrent();
120
121 }; //> end class IPartCombItr
122} // namespace TrigCompositeUtils
123
124#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::function< bool(const VecLInfo_t &)> m_filter
std::vector< LinkInfo< xAOD::IParticleContainer > > VecLInfo_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.
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 fucntion 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.
std::function< bool(const std::vector< LinkInfo< xAOD::IParticleContainer > > &)> getFilter(FilterType filter)
Get a lambda corresponding to the specified FilterType enum.
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