ATLAS Offline Software
Loading...
Searching...
No Matches
CombinationsIterator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
5#include <iostream>
6
7std::ostream& operator << (std::ostream& os, const CombinationsIterator& iter) {
8 os << std::boolalpha
9 << " generator: " << iter.m_gen
10 << " end: " << iter.m_end
11 << " input vals: ";
12 for(const auto& hj : iter.m_input_vals) {
13 os << static_cast<const void*>(hj.get()) << '\n';
14 }
15
16 os << '\n' <<" vals: ";
17
18 for(const auto& hj : iter.m_vals) {
19 os << static_cast<const void*>(hj.get()) << '\n';
20 }
21 os<<std::noboolalpha; //restore stream state
22 return os;
23}
24
26 const HypoJetVector& iv,
27 bool end):
28 m_gen{CombinationsGenerator(iv.size(), k)},
29 m_k{k},
30 m_input_vals{iv},
31 m_end{end}
32{
33 auto indices = m_gen.get();
34 std::transform(indices.cbegin(),
35 indices.cend(),
36 std::back_inserter(m_vals),
37 [iv = this->m_input_vals](const auto& ind) {
38 return iv.at(ind);
39 });
40}
41
42
std::ostream & operator<<(std::ostream &os, const CombinationsIterator &iter)
std::vector< pHypoJet > HypoJetVector
Definition HypoJetDefs.h:27
generate all possible combinations of objects
CombinationsIterator(std::size_t k, const HypoJetVector &input_vals, bool end=false)
CombinationsGenerator m_gen
CombinationsIterator endIter() const