ATLAS Offline Software
Loading...
Searching...
No Matches
JetGroupProduct Class Reference

#include <JetGroupProduct.h>

Inheritance diagram for JetGroupProduct:
Collaboration diagram for JetGroupProduct:

Public Member Functions

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

Private Member Functions

void init (const std::vector< std::size_t > &siblings, const CondInd2JetGroupsInds &satisfiedBy, const std::vector< std::size_t > &condMult)

Private Attributes

JetGroupInd2ElemInds m_jg2elemjgs
std::vector< bool > m_jetMask
std::size_t m_jetEnd {0}
std::vector< std::vector< std::size_t > > m_seenIndices
std::unique_ptr< JetStreamerm_jetstreamer {nullptr}
bool m_valid {false}

Detailed Description

Definition at line 20 of file JetGroupProduct.h.

Constructor & Destructor Documentation

◆ JetGroupProduct()

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

Definition at line 13 of file JetGroupProduct.cxx.

16 :
17 m_jg2elemjgs{jg2elemjgs}
18{
19
20 m_valid = !siblings.empty() or satisfiedBy.size() != condMult.size();
21 if (m_valid) {init(siblings, satisfiedBy, condMult);}
22}
JetGroupInd2ElemInds m_jg2elemjgs
void init(const std::vector< std::size_t > &siblings, const CondInd2JetGroupsInds &satisfiedBy, const std::vector< std::size_t > &condMult)

Member Function Documentation

◆ init()

void JetGroupProduct::init ( const std::vector< std::size_t > & siblings,
const CondInd2JetGroupsInds & satisfiedBy,
const std::vector< std::size_t > & condMult )
private

Definition at line 24 of file JetGroupProduct.cxx.

26 {
27
28 // create a jetstreamer object to cycle through the
29 // possoble combinations. The streamer may form
30 // vectors of indices by performing external products, and
31 // these may have duplicates, and vectors that differ only in
32 // order, which will need to be removed.
33
34
35 std::vector<std::vector<std::size_t>> condIndices;
36 condIndices.reserve(siblings.size());
37 std::vector<std::size_t> repeats;
38 condIndices.reserve(siblings.size());
39
40 for(const auto& isib : siblings){
41 auto mult = condMult[isib]; // jet groups indices of satisying jgs.
42 repeats.push_back(mult);
43 condIndices.push_back(satisfiedBy.at(isib));
44
45 // find the greatest jet index we will deal with
46 const auto& sibjets = satisfiedBy.at(isib);
47 m_jetEnd = std::max(m_jetEnd,
48 *std::max_element(sibjets.begin(),
49 sibjets.end()));
50 ++m_jetEnd;; // to be used as an end marker
51 m_jetMask.reserve(m_jetEnd);
52
53 }
54
55
56 auto streamer = make_jetstream(std::move(condIndices), std::move(repeats), 0);
57 m_jetstreamer.reset(new JetStreamer(std::move(streamer)));
58}
std::vector< bool > m_jetMask
std::unique_ptr< JetStreamer > m_jetstreamer
std::size_t m_jetEnd
std::unique_ptr< IJetStream > make_jetstream(std::vector< std::vector< std::size_t > > indices, std::vector< std::size_t > repeats, std::size_t sid)

◆ next()

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

Implements IJetGroupProduct.

Definition at line 60 of file JetGroupProduct.cxx.

60 {
61 // Produce an ordered set sequence of jet indices, one from each Condition
62 // with no duplicate indices.
63 //
64 // Ask ProductGen for the next set of indices into the condIndices arrays
65 // use these to create a sequences of jet indices. The process is blocked
66 // if there is a duplicate jet index using m_jetMask
67 //
68 // finally, m_seenIndices keeps track of jet index seqiences that have
69 // already been generated. If this is the first time the sequece has
70 // been generated, it will be added to m_seenJetIndices, and then requrned
71 // to the caller. If it has already been seen, it will be abandoned.
72
73 if (!m_valid) {return std::vector<std::size_t>();}
74
75 unsigned int ipass{0};
76 std::vector<std::size_t> jg_indices;
77 while(true){
78
79 m_jetMask.assign(m_jetEnd, false);
80
81 if(collector){
82 collector->collect("JetGroupProduct::next()",
83 "loop start pass " + std::to_string(ipass++));
84 }
85
86
87 bool blocked{false};
88 auto jet_indices = m_jetstreamer->next();
89 if (jet_indices.empty()) {
90 if(collector){
91 collector->collect("JetGroupProduct::next()",
92 "end of iteration ");
93 }
94 return jet_indices;
95 }
96 for (const auto& ind : jet_indices) {
97 if (m_jetMask[ind]) {
98 blocked = true;
99 break;
100 }
101 m_jetMask[ind] = true;
102 }
103
104 if (blocked){continue;}
105
106 jg_indices.clear();
107 for(std::size_t i = 0; i != m_jetEnd; ++i) {
108 if (m_jetMask[i]) {
109 jg_indices.push_back(i);
110 }
111 }
112
113 auto elem_indices = elementalJetGroups(jg_indices,
115 if (elem_indices.empty()) {continue;}
116
117 if (std::find(m_seenIndices.begin(),
118 m_seenIndices.end(),
119 elem_indices) == m_seenIndices.end()){
120 m_seenIndices.push_back(elem_indices);
121 return elem_indices;
122 }
123 }
124}
virtual void collect(const std::string &, const std::string &)=0
std::vector< std::vector< std::size_t > > m_seenIndices
std::vector< std::size_t > elementalJetGroups(const std::vector< std::size_t > &non_elemental, const JetGroupInd2ElemInds &jg2elemjg)

◆ valid()

bool JetGroupProduct::valid ( ) const
overridevirtual

Implements IJetGroupProduct.

Definition at line 127 of file JetGroupProduct.cxx.

127{return m_valid;}

Member Data Documentation

◆ m_jetEnd

std::size_t JetGroupProduct::m_jetEnd {0}
private

Definition at line 48 of file JetGroupProduct.h.

48{0};

◆ m_jetMask

std::vector<bool> JetGroupProduct::m_jetMask
private

Definition at line 47 of file JetGroupProduct.h.

◆ m_jetstreamer

std::unique_ptr<JetStreamer> JetGroupProduct::m_jetstreamer {nullptr}
private

Definition at line 51 of file JetGroupProduct.h.

51{nullptr};

◆ m_jg2elemjgs

JetGroupInd2ElemInds JetGroupProduct::m_jg2elemjgs
private

Definition at line 45 of file JetGroupProduct.h.

◆ m_seenIndices

std::vector<std::vector<std::size_t> > JetGroupProduct::m_seenIndices
private

Definition at line 50 of file JetGroupProduct.h.

◆ m_valid

bool JetGroupProduct::m_valid {false}
private

Definition at line 52 of file JetGroupProduct.h.

52{false};

The documentation for this class was generated from the following files: