17 bool operator () (
const std::size_t& lhs,
const std::size_t rhs){
27 const std::vector<std::size_t>& rhs){
28 if(lhs.size() < rhs.size()){
return true;}
29 if(rhs.size() < rhs.size()){
return false;}
31 for(std::size_t
i = 0;
i < lhs.size(); ++
i){
32 if(lhs[
i] > rhs[
i]){
return false;}
48 m_conditions(conditions), m_conditionFilters(filters),
49 m_conditionFilterInds(filterInds), m_tree(
tree) {
65 collector->collect(
"FastReducer early return",
66 "from findInitialJetGroups");
76 collector->collect(
"FastReducer early return",
77 "from propagateJetGroups");
85 collector->collect(
"FastReducer returning",
86 "from propagateJetGroups");
104 std::set<std::size_t> rootSatJetGroupInds(
m_satisfiedBy.at(0).begin(),
109 std::set<std::size_t> rootElSatJetGroupInds;
110 for (
const auto& ji : rootSatJetGroupInds) {
111 rootElSatJetGroupInds.insert(
m_jg2elemjgs.at(ji).begin(),
122 for (
const auto& ci : leaves) {
123 std::set<std::size_t> satJetGroupInds;
130 std::set<std::size_t> elSatJetGroupInds;
131 for (
const auto& ji : satJetGroupInds) {
140 std::stringstream
ss;
141 ss <<
"elSatJettGroupInds.size() "
144 << elSatJetGroupInds.size();
145 collector->collect(
"FastReducer",
ss.str());
154 auto end = rootElSatJetGroupInds.end();
155 for(
const auto& ji : elSatJetGroupInds) {
157 if (rootElSatJetGroupInds.find(ji) !=
end){
165 collector->collect(
"FastReducer",
184 for(
const auto& leaf: leaves){
186 auto filtered_jets = jv;
188 if (filter_ind != -1) {
190 filtered_jets =
filter->filter(filtered_jets, collector);
193 auto iters = std::make_pair(filtered_jets.begin(),
194 filtered_jets.end());
203 auto jg = grouper->next();
204 if (jg.empty()) {
break;}
227 std::vector<std::size_t>& elem_indices =
m_jg2elemjgs[jg_ind];
228 if (elem_indices.empty()) {
230 elem_indices.reserve(jg.size());
231 for (
const auto& hj : jg){
234 auto single_jet_group = std::vector{hj};
236 auto& single_jet_elems =
m_jg2elemjgs[single_jet_index];
237 if (single_jet_elems.empty()) {
238 single_jet_elems.push_back(single_jet_index);
243 elem_indices.push_back(single_jet_index);
248 elem_indices.push_back(jg_ind);
265 for (
const auto&
i : leaves) {
288 typedef std::priority_queue<std::size_t,
289 std::vector<std::size_t>,
293 DepthQueue to_process(comparator);
300 if(!(
item.second.empty())){
301 to_process.push(
item.first);
305 while(!to_process.empty()){
307 auto k = to_process.top();
318 collector->collect(
"FastReducer",
319 "Condition node 0 fails");
328 for(
const auto&
s : siblings){
340 to_process.push(
par);
347 const std::vector<std::size_t>& siblings,
362 if(child == 0){
return true;}
381 auto jg_indices = jg_product->next(collector);
387 while (!jg_indices.empty()){
388 if (!std::is_sorted(jg_indices.begin(), jg_indices.end())) {
389 throw std::runtime_error(
"Jet hypo unsorted jet group");
392 for (
const auto&
ind : jg_indices) {
394 throw std::runtime_error(
"Jet hypo jet group with non-elementary index");
401 for(
const auto&
i : jg_indices){
403 jg.insert(jg.end(), jetGroup.begin(), jetGroup.end());
411 jg_indices = jg_product->next(collector);
427 jg_indices = jg_product->next(collector);
434 if(collector and !par_satisfied){
435 collector->collect(
"FastReducer",
440 return par_satisfied;
446 std::stringstream
ss;
447 ss <<
"FastReducer:\n";
448 ss <<
" treeVector: " <<
m_tree <<
'\n';;
449 ss <<
"FastReducer Conditions ["
455 sc.insert(
sc.begin(), 3-
sc.length(),
' ');
456 ss <<
sc <<
": "<<
c->toString() +
'\n';
465 std::stringstream
ss;
466 ss <<
"FastReducer data structure dumps\nindToJetGroup:\n";
468 ss << pair.first <<
" [";
469 for(
const auto& j : pair.second){
470 ss << static_cast<const void*>(j.get()) <<
" ";
475 ss <<
"satisfiedBy: \n";
477 ss << pair.first <<
" [";
478 for(
const auto&
i : pair.second){
485 ss <<
"testedBy: \n";
487 ss << pair.first <<
" [";
488 for(
const auto&
i : pair.second){
494 ss <<
"jg to elemental jgs: \n";
497 ss << pair.first <<
" [";
498 for(
const auto&
i : pair.second){
510 if(!collector){
return;}
512 collector->collect(
"FastReducer",
521 std::stringstream ss0;
522 ss0 <<
"FastReducer jet group "
523 <<
ind <<
" [" << jg.size() <<
"]:";
525 std::stringstream ss1;
527 const void*
address =
static_cast<const void*
>(
ip.get());
528 ss1 <<
"\n " <<
address <<
" eta " <<
ip->eta()
530 <<
" et " <<
ip->et();
533 collector->collect(ss0.str(), ss1.str());
537 std::size_t n_injets,
541 if(!collector) {
return;}
543 std::stringstream ss0;
544 ss0 <<
"FastReducer filtering Condition index: " << leaf_ind;
546 std::stringstream ss1;
547 ss1 <<
"n jets. in: " << n_injets <<
" filtered: " << n_filteredjets <<
'\n';
549 collector->collect(ss0.str(), ss1.str());
562 auto capSat =
m_conditions.at(
ind)->multiplicitySatisfied(jgMult, collector);
563 if (!capSat and collector) {
565 +
" unsatisfied multiplicity, aborting");