diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CapacityCheckedCondition.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CapacityCheckedCondition.cxx index ac1f62fe3cf0ad702290069376f7accb79ba6b1b..2e892344abd79d56e8986afd234dc683551308e2 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CapacityCheckedCondition.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CapacityCheckedCondition.cxx @@ -31,6 +31,10 @@ CapacityCheckedCondition::isSatisfied(const HypoJetVector& v, unsigned int CapacityCheckedCondition::capacity() const { return m_condition->capacity(); } + +std::size_t CapacityCheckedCondition::multiplicity() const { + return m_multiplicity; +} std::string CapacityCheckedCondition::toString() const { std::stringstream ss; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CapacityCheckedCondition.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CapacityCheckedCondition.h index d9c3e333a63b45493735950e6d786d314d87a6e8..1317e8a5f4e24339542b7613591dd06b5acd876a 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CapacityCheckedCondition.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/CapacityCheckedCondition.h @@ -41,6 +41,7 @@ class CapacityCheckedCondition: public ICapacityCheckedCondition { const std::unique_ptr<ITrigJetHypoInfoCollector>& c) const override; virtual unsigned int capacity() const override; + virtual std::size_t multiplicity() const override; virtual std::string toString() const override; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.cxx index d30fb5d240ad9692cea125c2d7fa3d7ee02b7515..dd5eb619ac8254a5962bafb1200bbabe7da3dda1 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.cxx @@ -17,11 +17,17 @@ FastReductionMatcher::FastReductionMatcher(ConditionPtrs& conditions, m_conditionFilters(std::move(filters)), m_tree(tree){ + int minNjets{0}; for (const auto& il : m_tree.leaves()){ - if (!m_conditions[il]->isFromChainPart()) { + const auto& condition = m_conditions[il]; + if (!condition->isFromChainPart()) { throw std::runtime_error("Tree leaf condition but not from ChainPart"); } + minNjets += condition->capacity() * condition->multiplicity(); } + + m_minNjets = std::max(1, minNjets); + if (filters.size() != conditions.size()) { throw std::runtime_error("Conditions and ConditionFilters sequence sizes differ"); } @@ -48,6 +54,20 @@ FastReductionMatcher::match(const HypoJetCIter& jets_b, there is a match. */ + auto njets = jets_e - jets_b; + if (njets < 0) { + throw std::runtime_error("Negative number of jets"); + } + + if (njets < m_minNjets) { + if (collector) { + collector->collect("FastReductionMatcher", + "have " + std::to_string(njets) + + " jets need " + std::to_string(m_minNjets) + + "pass: false"); + } + return false; + } FastReducer reducer(jets_b, jets_e, diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.h index ec33356e024576cf22ddc1e62731fcd26166086f..ca5f0dde6f38a6c1b07534cc029ac151d5760bc1 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/FastReductionMatcher.h @@ -54,5 +54,10 @@ class FastReductionMatcher: public IJetsMatcherMT { Tree m_tree; + // minimum number of jets required - determined by summing + // leaf Condition capacities + long int m_minNjets{0}; + + }; #endif diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.cxx b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.cxx index f2c7e5b8269880a05227b1b85b07b79086734b15..71970a47a2585465751618bb134eba929799b05b 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.cxx +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/GrouperByCapacityFactory.cxx @@ -15,11 +15,9 @@ std::unique_ptr<IJetGrouper> grouperByCapacityFactory(unsigned int cap, std::unique_ptr<IJetGrouper> pGrouper(nullptr); if (cap == 0) { - throw std::runtime_error("groupByMultFactory - attempting ctrct grouper with mult == 0"); + pGrouper.reset(new AllJetsGrouper(b, e)); } else if (cap == 1) { pGrouper.reset(new SingleJetGrouper(b, e)); - } else if (cap == std::numeric_limits<int>::max()) { - pGrouper.reset(new AllJetsGrouper(b, e)); } else { pGrouper.reset(new CombinationsGrouper(cap, b, e)); } diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.h index 6c7a31be177891322b7817df5ed293acb1f3e59a..6459f2f6f4065d45d575422a46b37061fc6d022d 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/HTConditionFastReduction.h @@ -16,8 +16,7 @@ #include "./IConditionMT.h" #include <string> -#include <limits> -// #include <memory> + namespace HypoJet{ class IJet; @@ -44,8 +43,9 @@ class HTConditionFastReduction: public IConditionMT{ private: double m_htMin; - - const static unsigned int s_capacity{std::numeric_limits<int>::max()}; + + // number of jets unspecified - signalled by 0. + const static unsigned int s_capacity{0}; }; diff --git a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ICapacityCheckedCondition.h b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ICapacityCheckedCondition.h index 7fc182b89aea0db6cb00bb72cf7fd099ddd67ebb..e29016bd7e875962fe3fde08725bd01584ba8423 100644 --- a/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ICapacityCheckedCondition.h +++ b/Trigger/TrigHypothesis/TrigHLTJetHypo/src/ICapacityCheckedCondition.h @@ -35,6 +35,7 @@ class ICapacityCheckedCondition: public IConditionMT { virtual int label() const = 0; + virtual std::size_t multiplicity() const = 0; virtual std::string toString() const = 0; virtual bool isFromChainPart() const = 0;