ATLAS Offline Software
Loading...
Searching...
No Matches
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 }
std::vector< std::size_t > m_jetIndices
std::vector< std::size_t > elementalJetGroups(const std::vector< std::size_t > &non_elemental, const JetGroupInd2ElemInds &jg2elemjg)
DataModel_detail::iterator< DVL > unique(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of unique for DataVector/List.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

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}
virtual void collect(const std::string &, const std::string &)=0

◆ 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.

43{false};

◆ 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: