ATLAS Offline Software
KFromNItr.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGCOMPOSITEUTILS_KFROMNITR_H
6 #define TRIGCOMPOSITEUTILS_KFROMNITR_H
7 
8 #include <iterator>
9 #include <vector>
10 
11 namespace TrigCompositeUtils {
34  class KFromNItr
35  {
36  public:
38  using iterator_category = std::input_iterator_tag;
39  using value_type = std::vector<std::size_t>;
40  using reference = const value_type &;
41  using pointer = const value_type *;
42  using difference_type = std::ptrdiff_t;
43 
45  KFromNItr() = default;
46 
48  KFromNItr(std::size_t k, std::size_t N);
49 
51  std::size_t size() const { return m_current.size(); }
52 
54  void reset();
55 
57  bool exhausted() const;
58 
60  reference operator*() const;
61  pointer operator->() const;
62 
65 
67  KFromNItr operator++(int);
68 
70  bool operator==(const KFromNItr &other) const;
71  bool operator!=(const KFromNItr &other) const;
72 
73  private:
75  std::size_t m_N{0};
77  std::vector<std::size_t> m_current;
78  }; //> end class KFromNItr
79 } //> end namespace TrigCompositeUtils
80 
81 #endif //> !TRIGCOMPOSITEUTILS_KFROMNITR_H
TrigCompositeUtils::KFromNItr::iterator_category
std::input_iterator_tag iterator_category
Iterator traits.
Definition: KFromNItr.h:38
TrigCompositeUtils::KFromNItr::value_type
std::vector< std::size_t > value_type
Definition: KFromNItr.h:39
TrigCompositeUtils::KFromNItr::operator++
KFromNItr & operator++()
Pre-increment operator.
Definition: KFromNItr.cxx:43
JetTiledMap::N
@ N
Definition: TiledEtaPhiMap.h:44
reference
Definition: hcg.cxx:437
TrigCompositeUtils::KFromNItr::operator->
pointer operator->() const
Definition: KFromNItr.cxx:36
TrigCompositeUtils::KFromNItr::reset
void reset()
Reset the iterator to its start position.
Definition: KFromNItr.cxx:18
TrigCompositeUtils::KFromNItr::pointer
const value_type * pointer
Definition: KFromNItr.h:41
TrigCompositeUtils::KFromNItr::size
std::size_t size() const
The size of each combination (k)
Definition: KFromNItr.h:51
TrigCompositeUtils::KFromNItr::operator!=
bool operator!=(const KFromNItr &other) const
Definition: KFromNItr.cxx:109
TrigCompositeUtils::KFromNItr::operator==
bool operator==(const KFromNItr &other) const
Iterator comparison functions.
Definition: KFromNItr.cxx:100
TrigCompositeUtils::KFromNItr::m_N
std::size_t m_N
The number of indices.
Definition: KFromNItr.h:75
TrigCompositeUtils::KFromNItr::operator*
reference operator*() const
Dereference.
Definition: KFromNItr.cxx:29
TrigCompositeUtils::KFromNItr
Iterates over all combinations of k values chosen from a range n.
Definition: KFromNItr.h:35
TrigCompositeUtils::KFromNItr::exhausted
bool exhausted() const
True if this iterator is past the end.
Definition: KFromNItr.cxx:24
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
TrigCompositeUtils::KFromNItr::difference_type
std::ptrdiff_t difference_type
Definition: KFromNItr.h:42
TrigCompositeUtils
Definition: Event/xAOD/xAODTrigger/xAODTrigger/TrigComposite.h:19
TrigCompositeUtils::KFromNItr::m_current
std::vector< std::size_t > m_current
The current combination.
Definition: KFromNItr.h:77
fitman.k
k
Definition: fitman.py:528
TrigCompositeUtils::KFromNItr::KFromNItr
KFromNItr()=default
Default constructor creates a generic past-the-end iterator.
TrigCompositeUtils::KFromNItr::reference
const value_type & reference
Definition: KFromNItr.h:40