diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTCorrelationalCut.h b/L1Trigger/Phase2L1GT/plugins/L1GTCorrelationalCut.h index 32ffe6bde2a3d..a115ea814bf5b 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTCorrelationalCut.h +++ b/L1Trigger/Phase2L1GT/plugins/L1GTCorrelationalCut.h @@ -44,10 +44,30 @@ namespace l1t { "minDR", config, [&scales](double value) { return scales.to_hw_dRSquared_floor(value); })), maxDRSquared_(getOptionalParam( "maxDR", config, [&scales](double value) { return scales.to_hw_dRSquared_ceil(value); })), - minInvMassSqrDiv2_(getOptionalParam( - "minInvMass", config, [&scales](double value) { return scales.to_hw_InvMassSqrDiv2(value); })), - maxInvMassSqrDiv2_(getOptionalParam( - "maxInvMass", config, [&scales](double value) { return scales.to_hw_InvMassSqrDiv2(value); })), + minInvMassSqrDiv2_scale1_(getOptionalParam( + "minInvMass", + config, + [&](double value) { + return std::floor(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT_.output_scale()); + })), + maxInvMassSqrDiv2_scale1_(getOptionalParam( + "maxInvMass", + config, + [&](double value) { + return std::ceil(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT_.output_scale()); + })), + minInvMassSqrDiv2_scale2_(getOptionalParam( + "minInvMass", + config, + [&](double value) { + return std::floor(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT2_.output_scale()); + })), + maxInvMassSqrDiv2_scale2_(getOptionalParam( + "maxInvMass", + config, + [&](double value) { + return std::ceil(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT2_.output_scale()); + })), minTransMassSqrDiv2_(getOptionalParam( "minTransMass", config, @@ -68,10 +88,30 @@ namespace l1t { "maxCombPt", config, [&](double value) { return std::ceil(scales.to_hw_PtSquared(value) * cosPhiLUT_.output_scale()); })), - minInvMassSqrOver2DRSqr_(getOptionalParam( - "minInvMassOverDR", config, [&scales](double value) { return scales.to_hw_InvMassSqrDiv2(value); })), - maxInvMassSqrOver2DRSqr_(getOptionalParam( - "maxInvMassOverDR", config, [&scales](double value) { return scales.to_hw_InvMassSqrDiv2(value); })), + minInvMassSqrOver2DRSqr_scale1_(getOptionalParam( + "minInvMassOverDR", + config, + [&](double value) { + return std::floor(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT_.output_scale()); + })), + maxInvMassSqrOver2DRSqr_scale1_(getOptionalParam( + "maxInvMassOverDR", + config, + [&](double value) { + return std::ceil(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT_.output_scale()); + })), + minInvMassSqrOver2DRSqr_scale2_(getOptionalParam( + "minInvMassOverDR", + config, + [&](double value) { + return std::floor(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT2_.output_scale()); + })), + maxInvMassSqrOver2DRSqr_scale2_(getOptionalParam( + "maxInvMassOverDR", + config, + [&](double value) { + return std::ceil(scales.to_hw_InvMassSqrDiv2(value) * coshEtaLUT2_.output_scale()); + })), os_(config.getParameter("os")), ss_(config.getParameter("ss")), enable_sanity_checks_(enable_sanity_checks), @@ -84,8 +124,10 @@ namespace l1t { std::optional dEta; - if (minDEta_ || maxDEta_ || minDRSquared_ || maxDRSquared_ || minInvMassSqrDiv2_ || maxInvMassSqrDiv2_ || - minInvMassSqrOver2DRSqr_ || maxInvMassSqrOver2DRSqr_) { + if (minDEta_ || maxDEta_ || minDRSquared_ || maxDRSquared_ || minInvMassSqrDiv2_scale1_ || + maxInvMassSqrDiv2_scale1_ || minInvMassSqrDiv2_scale2_ || maxInvMassSqrDiv2_scale2_ || + minInvMassSqrOver2DRSqr_scale1_ || maxInvMassSqrOver2DRSqr_scale1_ || minInvMassSqrOver2DRSqr_scale2_ || + maxInvMassSqrOver2DRSqr_scale2_) { dEta = std::abs(obj1.hwEta().to_int() - obj2.hwEta().to_int()); res &= minDEta_ ? dEta > minDEta_ : true; res &= maxDEta_ ? dEta < maxDEta_ : true; @@ -95,9 +137,10 @@ namespace l1t { std::optional dPhi; - if (minDPhi_ || maxDPhi_ || minDRSquared_ || maxDRSquared_ || minInvMassSqrDiv2_ || maxInvMassSqrDiv2_ || - minTransMassSqrDiv2_ || maxTransMassSqrDiv2_ || minPTSquared_ || maxPTSquared_ || minInvMassSqrOver2DRSqr_ || - maxInvMassSqrOver2DRSqr_) { + if (minDPhi_ || maxDPhi_ || minDRSquared_ || maxDRSquared_ || minInvMassSqrDiv2_scale1_ || + maxInvMassSqrDiv2_scale1_ || minInvMassSqrDiv2_scale2_ || maxInvMassSqrDiv2_scale2_ || minTransMassSqrDiv2_ || + maxTransMassSqrDiv2_ || minPTSquared_ || maxPTSquared_ || minInvMassSqrOver2DRSqr_scale1_ || + maxInvMassSqrOver2DRSqr_scale1_ || minInvMassSqrOver2DRSqr_scale2_ || maxInvMassSqrOver2DRSqr_scale2_) { // Ensure dPhi is always the smaller angle, i.e. always between [0, pi] dPhi = HW_PI - std::abs(std::abs(obj1.hwPhi().to_int() - obj2.hwPhi().to_int()) - HW_PI); } @@ -112,7 +155,8 @@ namespace l1t { } uint32_t dRSquared = 0; - if (minDRSquared_ || maxDRSquared_ || minInvMassSqrOver2DRSqr_ || maxInvMassSqrOver2DRSqr_) { + if (minDRSquared_ || maxDRSquared_ || minInvMassSqrOver2DRSqr_scale1_ || maxInvMassSqrOver2DRSqr_scale1_ || + minInvMassSqrOver2DRSqr_scale2_ || maxInvMassSqrOver2DRSqr_scale2_) { dRSquared = dEta.value() * dEta.value() + dPhi.value() * dPhi.value(); res &= minDRSquared_ ? dRSquared > minDRSquared_ : true; res &= maxDRSquared_ ? dRSquared < maxDRSquared_ : true; @@ -157,25 +201,19 @@ namespace l1t { } int64_t invMassSqrDiv2 = 0; - if (minInvMassSqrDiv2_ || maxInvMassSqrDiv2_ || minInvMassSqrOver2DRSqr_ || maxInvMassSqrOver2DRSqr_) { + if (minInvMassSqrDiv2_scale1_ || maxInvMassSqrDiv2_scale1_ || minInvMassSqrDiv2_scale2_ || + maxInvMassSqrDiv2_scale2_ || minInvMassSqrOver2DRSqr_scale1_ || maxInvMassSqrOver2DRSqr_scale1_ || + minInvMassSqrOver2DRSqr_scale2_ || maxInvMassSqrOver2DRSqr_scale2_) { if (dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT) { // dEta [0, 2pi) invMassSqrDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * (lutCoshDEta - lutCosDPhi); - res &= minInvMassSqrDiv2_ - ? invMassSqrDiv2 > std::floor(minInvMassSqrDiv2_.value() * coshEtaLUT_.output_scale()) - : true; - res &= maxInvMassSqrDiv2_ - ? invMassSqrDiv2 < std::ceil(maxInvMassSqrDiv2_.value() * coshEtaLUT_.output_scale()) - : true; + res &= minInvMassSqrDiv2_scale1_ ? invMassSqrDiv2 > minInvMassSqrDiv2_scale1_ : true; + res &= maxInvMassSqrDiv2_scale1_ ? invMassSqrDiv2 < maxInvMassSqrDiv2_scale1_ : true; } else { // dEta [2pi, 4pi), ignore cos invMassSqrDiv2 = obj1.hwPT().to_int64() * obj2.hwPT().to_int64() * lutCoshDEta; - res &= minInvMassSqrDiv2_ - ? invMassSqrDiv2 > std::floor(minInvMassSqrDiv2_.value() * coshEtaLUT2_.output_scale()) - : true; - res &= maxInvMassSqrDiv2_ - ? invMassSqrDiv2 < std::ceil(maxInvMassSqrDiv2_.value() * coshEtaLUT2_.output_scale()) - : true; + res &= minInvMassSqrDiv2_scale2_ ? invMassSqrDiv2 > minInvMassSqrDiv2_scale2_ : true; + res &= maxInvMassSqrDiv2_scale2_ ? invMassSqrDiv2 < maxInvMassSqrDiv2_scale2_ : true; } if (inv_mass_checks_) { @@ -211,31 +249,24 @@ namespace l1t { res &= maxTransMassSqrDiv2_ ? transMassDiv2 < maxTransMassSqrDiv2_.value() : true; } - if (minInvMassSqrOver2DRSqr_ || maxInvMassSqrOver2DRSqr_) { + if (minInvMassSqrOver2DRSqr_scale1_ || maxInvMassSqrOver2DRSqr_scale1_ || minInvMassSqrOver2DRSqr_scale2_ || + maxInvMassSqrOver2DRSqr_scale2_) { ap_uint<96> invMassSqrDiv2Shift = ap_uint<96>(invMassSqrDiv2) << L1GTScales::INV_MASS_SQR_OVER_2_DR_SQR_RESOLUTION; if (dEta < L1GTSingleInOutLUT::DETA_LUT_SPLIT) { - res &= minInvMassSqrOver2DRSqr_ - ? invMassSqrDiv2Shift > - ap_uint<64>(std::floor(minInvMassSqrOver2DRSqr_.value() * coshEtaLUT_.output_scale())) * - dRSquared + res &= minInvMassSqrOver2DRSqr_scale1_ + ? invMassSqrDiv2Shift > minInvMassSqrOver2DRSqr_scale1_.value() * dRSquared : true; - res &= maxInvMassSqrOver2DRSqr_ - ? invMassSqrDiv2Shift < - ap_uint<64>(std::ceil(maxInvMassSqrOver2DRSqr_.value() * coshEtaLUT_.output_scale())) * - dRSquared + res &= maxInvMassSqrOver2DRSqr_scale1_ + ? invMassSqrDiv2Shift < maxInvMassSqrOver2DRSqr_scale1_.value() * dRSquared : true; } else { - res &= minInvMassSqrOver2DRSqr_ - ? invMassSqrDiv2Shift > - ap_uint<64>(std::floor(minInvMassSqrOver2DRSqr_.value() * coshEtaLUT2_.output_scale())) * - dRSquared + res &= minInvMassSqrOver2DRSqr_scale2_ + ? invMassSqrDiv2Shift > minInvMassSqrOver2DRSqr_scale2_.value() * dRSquared : true; - res &= maxInvMassSqrOver2DRSqr_ - ? invMassSqrDiv2Shift < - ap_uint<64>(std::ceil(maxInvMassSqrOver2DRSqr_.value() * coshEtaLUT2_.output_scale())) * - dRSquared + res &= maxInvMassSqrOver2DRSqr_scale2_ + ? invMassSqrDiv2Shift < maxInvMassSqrOver2DRSqr_scale2_.value() * dRSquared : true; } } @@ -295,16 +326,23 @@ namespace l1t { const std::optional minDRSquared_; const std::optional maxDRSquared_; - const std::optional minInvMassSqrDiv2_; - const std::optional maxInvMassSqrDiv2_; + const std::optional minInvMassSqrDiv2_scale1_; + const std::optional maxInvMassSqrDiv2_scale1_; + + const std::optional minInvMassSqrDiv2_scale2_; + const std::optional maxInvMassSqrDiv2_scale2_; + const std::optional minTransMassSqrDiv2_; const std::optional maxTransMassSqrDiv2_; const std::optional minPTSquared_; const std::optional maxPTSquared_; - const std::optional minInvMassSqrOver2DRSqr_; - const std::optional maxInvMassSqrOver2DRSqr_; + const std::optional minInvMassSqrOver2DRSqr_scale1_; + const std::optional maxInvMassSqrOver2DRSqr_scale1_; + + const std::optional minInvMassSqrOver2DRSqr_scale2_; + const std::optional maxInvMassSqrOver2DRSqr_scale2_; const bool os_; // Opposite sign const bool ss_; // Same sign diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTDoubleObjectCond.cc b/L1Trigger/Phase2L1GT/plugins/L1GTDoubleObjectCond.cc index a4223ed43c6b8..36b1295a07174 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTDoubleObjectCond.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTDoubleObjectCond.cc @@ -115,15 +115,16 @@ bool L1GTDoubleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::E InvariantMassErrorCollection massErrors; for (std::size_t idx1 = 0; idx1 < col1->size(); ++idx1) { + bool single1Pass = collection1Cuts_.checkObject(col1->at(idx1)); + single1Pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol); + for (std::size_t idx2 = 0; idx2 < col2->size(); ++idx2) { // If we're looking at the same collection then we shouldn't use the same object in one comparison. if (col1.product() == col2.product() && idx1 == idx2) { continue; } - bool pass = true; - pass &= collection1Cuts_.checkObject(col1->at(idx1)); - pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol); + bool pass = single1Pass; pass &= collection2Cuts_.checkObject(col2->at(idx2)); pass &= collection2Cuts_.checkPrimaryVertices(col2->at(idx2), *primVertCol); pass &= deltaCuts_.checkObjects(col1->at(idx1), col2->at(idx2), massErrors); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTQuadObjectCond.cc b/L1Trigger/Phase2L1GT/plugins/L1GTQuadObjectCond.cc index a90ab2872804c..811a465dd8383 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTQuadObjectCond.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTQuadObjectCond.cc @@ -215,8 +215,17 @@ bool L1GTQuadObjectCond::filter(edm::StreamID, edm::Event& event, const edm::Eve InvariantMassErrorCollection massErrors; for (std::size_t idx1 = 0; idx1 < col1->size(); ++idx1) { + bool single1Pass = collection1Cuts_.checkObject(col1->at(idx1)); + single1Pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol); + for (std::size_t idx2 = 0; idx2 < col2->size(); ++idx2) { + bool single2Pass = collection2Cuts_.checkObject(col2->at(idx2)); + single2Pass &= collection2Cuts_.checkPrimaryVertices(col2->at(idx2), *primVertCol); + for (std::size_t idx3 = 0; idx3 < col3->size(); ++idx3) { + bool single3Pass = collection3Cuts_.checkObject(col3->at(idx3)); + single3Pass &= collection3Cuts_.checkPrimaryVertices(col3->at(idx3), *primVertCol); + for (std::size_t idx4 = 0; idx4 < col4->size(); ++idx4) { // If we're looking at the same collection then we shouldn't use the same object in one comparison. if (col1.product() == col2.product() && idx1 == idx2) { @@ -243,13 +252,8 @@ bool L1GTQuadObjectCond::filter(edm::StreamID, edm::Event& event, const edm::Eve continue; } - bool pass = true; - pass &= collection1Cuts_.checkObject(col1->at(idx1)); - pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol); - pass &= collection2Cuts_.checkObject(col2->at(idx2)); - pass &= collection2Cuts_.checkPrimaryVertices(col2->at(idx2), *primVertCol); - pass &= collection3Cuts_.checkObject(col3->at(idx3)); - pass &= collection3Cuts_.checkPrimaryVertices(col3->at(idx3), *primVertCol); + bool pass = single1Pass & single2Pass & single3Pass; + pass &= collection4Cuts_.checkObject(col4->at(idx4)); pass &= collection4Cuts_.checkPrimaryVertices(col4->at(idx4), *primVertCol); pass &= correl12Cuts_.checkObjects(col1->at(idx1), col2->at(idx2), massErrors); diff --git a/L1Trigger/Phase2L1GT/plugins/L1GTTripleObjectCond.cc b/L1Trigger/Phase2L1GT/plugins/L1GTTripleObjectCond.cc index 500394ae6a51e..9e35c7c2545f1 100644 --- a/L1Trigger/Phase2L1GT/plugins/L1GTTripleObjectCond.cc +++ b/L1Trigger/Phase2L1GT/plugins/L1GTTripleObjectCond.cc @@ -151,7 +151,13 @@ bool L1GTTripleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::E InvariantMassErrorCollection massErrors; for (std::size_t idx1 = 0; idx1 < col1->size(); ++idx1) { + bool single1Pass = collection1Cuts_.checkObject(col1->at(idx1)); + single1Pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol); + for (std::size_t idx2 = 0; idx2 < col2->size(); ++idx2) { + bool single2Pass = collection2Cuts_.checkObject(col2->at(idx2)); + single2Pass &= collection2Cuts_.checkPrimaryVertices(col2->at(idx2), *primVertCol); + for (std::size_t idx3 = 0; idx3 < col3->size(); ++idx3) { // If we're looking at the same collection then we shouldn't use the same object in one comparison. if (col1.product() == col2.product() && idx1 == idx2) { @@ -166,11 +172,8 @@ bool L1GTTripleObjectCond::filter(edm::StreamID, edm::Event& event, const edm::E continue; } - bool pass = true; - pass &= collection1Cuts_.checkObject(col1->at(idx1)); - pass &= collection1Cuts_.checkPrimaryVertices(col1->at(idx1), *primVertCol); - pass &= collection2Cuts_.checkObject(col2->at(idx2)); - pass &= collection2Cuts_.checkPrimaryVertices(col2->at(idx2), *primVertCol); + bool pass = single1Pass & single2Pass; + pass &= collection3Cuts_.checkObject(col3->at(idx3)); pass &= collection3Cuts_.checkPrimaryVertices(col3->at(idx3), *primVertCol); pass &= correl12Cuts_.checkObjects(col1->at(idx1), col2->at(idx2), massErrors);