ATLAS Offline Software
JetGroupUnion.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./JetGroupUnion.h"
6 #include <set>
7 #include <string>
8 #include <algorithm>
9 #include <sstream>
10 
11 
12 JetGroupUnion::JetGroupUnion(const std::vector<std::size_t>& siblings,
13  const CondInd2JetGroupsInds& satisfiedBy) {
14 
15  // make a vector of the jet indices that satisfy the sibling Conditions
16  // with no duplicates
17 
18  for (const auto& s :siblings){
19  m_jetIndices.insert(m_jetIndices.end(),
20  satisfiedBy.at(s).cbegin(),
21  satisfiedBy.at(s).cend()
22  );
23  }
24 
25  std::sort(m_jetIndices.begin(),
26  m_jetIndices.end());
27 
28  auto iter = std::unique(m_jetIndices.begin(),
29  m_jetIndices.end());
30 
31  m_jetIndices.resize(iter-m_jetIndices.begin());
32  m_done = false;
33 }
34 
35 
36 std::vector<std::size_t> JetGroupUnion::next(const Collector& collector){
37  if(collector){
38  std::stringstream sstr;
39  sstr << "no of indices " << m_jetIndices.size()
40  << " done " << std::boolalpha << m_done;
41  collector->collect("JetGroupUnion::next()", sstr.str());
42  }
43 
44  if (m_done) {
45  return std::vector<std::size_t>();
46  }
47 
48  m_done = true;
49  return m_jetIndices;
50 }
51 
52 bool JetGroupUnion::valid() const {return true;}
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CondInd2JetGroupsInds
std::map< int, std::vector< std::size_t > > CondInd2JetGroupsInds
Definition: JetGroupProduct.h:15
JetGroupUnion::m_done
bool m_done
Definition: JetGroupUnion.h:33
JetGroupUnion::JetGroupUnion
JetGroupUnion(const std::vector< std::size_t > &siblings, const CondInd2JetGroupsInds &satisfiedBy)
Definition: JetGroupUnion.cxx:12
JetGroupUnion::valid
virtual bool valid() const override
Definition: JetGroupUnion.cxx:52
JetGroupUnion.h
JetGroupUnion::next
virtual std::vector< std::size_t > next(const Collector &) override
Definition: JetGroupUnion.cxx:36
Collector
std::unique_ptr< ITrigJetHypoInfoCollector > Collector
Definition: FastReducer.h:22
JetGroupUnion::m_jetIndices
std::vector< std::size_t > m_jetIndices
Definition: JetGroupUnion.h:32