ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
JetGroupReducer Class Reference

#include <JetGroupReducer.h>

Inheritance diagram for JetGroupReducer:
Collaboration diagram for JetGroupReducer:

Public Member Functions

 JetGroupReducer (const std::vector< std::size_t > &siblings, const CondInd2JetGroupsInds &satisfiedBy, const JetGroupInd2ElemInds &)
 
virtual std::vector< std::size_t > next (const Collector &) override
 
virtual bool valid () const override
 

Private Attributes

std::vector< std::size_t > m_jetIndices
 
bool m_done {false}
 

Detailed Description

Definition at line 29 of file JetGroupReducer.h.

Constructor & Destructor Documentation

◆ JetGroupReducer()

JetGroupReducer::JetGroupReducer ( const std::vector< std::size_t > &  siblings,
const CondInd2JetGroupsInds satisfiedBy,
const JetGroupInd2ElemInds jg2elemjgs 
)

Definition at line 13 of file JetGroupReducer.cxx.

15  {
16 
17  // make a vector of the jet indices that satisfy the sibling Conditions
18  // with no duplicates
19 
20  // edge cases
21  if (siblings.empty()){
22  m_done = true;
23  return;
24  }
25 
26  for (const auto& s : siblings){
27  if (satisfiedBy.at(s).empty()) {
28  m_done = true;
29  return;
30  }
31  }
32 
33  std::vector<std::size_t> satisfying;
34 
35  for (const auto& s :siblings){
36  satisfying.insert(satisfying.end(),
37  satisfiedBy.at(s).cbegin(),
38  satisfiedBy.at(s).cend()
39  );
40  }
41 
42  // If more there are more than one siblings, there could be
43  // duplicates in the combined list of (non-elementary) jet groups.
44  // Eliminate these.
45 
46  auto end = satisfying.end();
47  if (siblings.size() > 1) {
48  std::sort(satisfying.begin(),
49  satisfying.end());
50 
51  end = std::unique(satisfying.begin(),
52  satisfying.end());
53  }
54 
55  std::vector<std::size_t> jet_indices;
56  for(auto iter = satisfying.begin(); iter != end; ++iter) {
57  jet_indices.insert(jet_indices.end(),
58  jg2elemjgs.at(*iter).begin(),
59  jg2elemjgs.at(*iter).end());
60  }
61 
62  std::sort(jet_indices.begin(),
63  jet_indices.end());
64 
65  auto final_end = std::unique(jet_indices.begin(),
66  jet_indices.end());
67 
68 
69  jet_indices.resize(final_end-jet_indices.begin());
70 
71  m_jetIndices = elementalJetGroups(jet_indices,
72  jg2elemjgs);
73  m_done = false;
74  }

Member Function Documentation

◆ next()

std::vector< std::size_t > JetGroupReducer::next ( const Collector collector)
overridevirtual

Implements IJetGroupProduct.

Definition at line 77 of file JetGroupReducer.cxx.

77  {
78  if(collector){
79  std::stringstream sstr;
80  sstr << "no of indices " << m_jetIndices.size()
81  << " done " << std::boolalpha << m_done;
82  collector->collect("JetGroupReducer::next()", sstr.str());
83  }
84 
85  if (m_done) {
86  return std::vector<std::size_t>();
87  }
88 
89  m_done = true;
90  return m_jetIndices;
91 }

◆ valid()

bool JetGroupReducer::valid ( ) const
overridevirtual

Implements IJetGroupProduct.

Definition at line 93 of file JetGroupReducer.cxx.

93 {return true;}

Member Data Documentation

◆ m_done

bool JetGroupReducer::m_done {false}
private

Definition at line 43 of file JetGroupReducer.h.

◆ m_jetIndices

std::vector<std::size_t> JetGroupReducer::m_jetIndices
private

Definition at line 42 of file JetGroupReducer.h.


The documentation for this class was generated from the following files:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
elementalJetGroups
std::vector< std::size_t > elementalJetGroups(const std::vector< std::size_t > &non_elemental, const JetGroupInd2ElemInds &jg2elemjg)
Definition: elementalJetGroups.cxx:9
std::unique
std::reverse_iterator< DataModel_detail::iterator< DVL > > unique(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, BinaryPredicate pred)
Specialization of unique for DataVector/List.
Definition: DVL_algorithms.h:199
JetGroupReducer::m_jetIndices
std::vector< std::size_t > m_jetIndices
Definition: JetGroupReducer.h:42
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
JetGroupReducer::m_done
bool m_done
Definition: JetGroupReducer.h:43