diff --git a/L1Trigger/L1TMuonEndCap/interface/PrimitiveSelection.h b/L1Trigger/L1TMuonEndCap/interface/PrimitiveSelection.h index 8a8fee5d74d90..951d833ec434c 100644 --- a/L1Trigger/L1TMuonEndCap/interface/PrimitiveSelection.h +++ b/L1Trigger/L1TMuonEndCap/interface/PrimitiveSelection.h @@ -15,7 +15,9 @@ class PrimitiveSelection { int bxShiftME0, bool includeNeighbor, bool duplicateTheta, - bool bugME11Dupes); + bool bugME11Dupes, + bool useRun3CCLUT_OTMB, + bool useRun3CCLUT_TMB); template void process(T tag, @@ -114,6 +116,9 @@ class PrimitiveSelection { bool includeNeighbor_, duplicateTheta_; bool bugME11Dupes_; + // Run 3 CCLUT algorithm + bool useRun3CCLUT_OTMB_; + bool useRun3CCLUT_TMB_; }; #endif diff --git a/L1Trigger/L1TMuonEndCap/interface/TrackTools.h b/L1Trigger/L1TMuonEndCap/interface/TrackTools.h index 631d347ea83d8..88751670d668a 100644 --- a/L1Trigger/L1TMuonEndCap/interface/TrackTools.h +++ b/L1Trigger/L1TMuonEndCap/interface/TrackTools.h @@ -27,6 +27,10 @@ namespace emtf { std::pair get_csc_max_pattern_and_quality(int station, int ring); + // CSC max slope + + int get_csc_max_slope(int station, int ring, bool useRun3CCLUT_OTMB, bool useRun3CCLUT_TMB); + // ___________________________________________________________________________ // coordinate ranges: phi[-180, 180] or [-pi, pi], theta[0, 90] or [0, pi/2] inline double wrap_phi_deg(double deg) { diff --git a/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc b/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc index e359596498af7..b1951e02a0dc9 100644 --- a/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc +++ b/L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc @@ -25,7 +25,9 @@ void PrimitiveSelection::configure(int verbose, int bxShiftME0, bool includeNeighbor, bool duplicateTheta, - bool bugME11Dupes) { + bool bugME11Dupes, + bool useRun3CCLUT_OTMB, + bool useRun3CCLUT_TMB) { verbose_ = verbose; endcap_ = endcap; sector_ = sector; @@ -39,6 +41,10 @@ void PrimitiveSelection::configure(int verbose, includeNeighbor_ = includeNeighbor; duplicateTheta_ = duplicateTheta; bugME11Dupes_ = bugME11Dupes; + + // Run 3 CCLUT algorithm + useRun3CCLUT_OTMB_ = useRun3CCLUT_OTMB; + useRun3CCLUT_TMB_ = useRun3CCLUT_TMB; } // _____________________________________________________________________________ @@ -601,6 +607,7 @@ int PrimitiveSelection::select_csc(const TriggerPrimitive& muon_primitive) const const auto& [max_strip, max_wire] = emtf::get_csc_max_strip_and_wire(tp_station, tp_ring); const auto& [max_pattern, max_quality] = emtf::get_csc_max_pattern_and_quality(tp_station, tp_ring); + const auto max_slope = emtf::get_csc_max_slope(tp_station, tp_ring, useRun3CCLUT_OTMB_, useRun3CCLUT_TMB_); if (endcap_ == 1 && sector_ == 1 && bx_ == -3) { // do assertion checks only once emtf_assert(emtf::MIN_ENDCAP <= tp_endcap && tp_endcap <= emtf::MAX_ENDCAP); @@ -665,6 +672,16 @@ int PrimitiveSelection::select_csc(const TriggerPrimitive& muon_primitive) const << ". (Note that this LCT may be reported multiple times. See source code for explanations.)"; return selected; } + + if (!(tp_data.slope < max_slope)) { + edm::LogWarning("L1T") << "Found error in LCT slope: " << tp_data.slope << " (allowed range: 0-" + << max_slope - 1 << ")."; + edm::LogWarning("L1T") + << "From endcap " << tp_endcap << ", sector " << tp_sector << ", station " << tp_station << ", ring " + << tp_ring << ", cscid " << tp_csc_ID + << ". (Note that this LCT may be reported multiple times. See source code for explanations.)"; + return selected; + } } // end check for corrupted LCT data // station 1 --> subsector 1 or 2 diff --git a/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc b/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc index 8cdb84d1f38ab..8274e84c4f8ec 100644 --- a/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc +++ b/L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc @@ -86,7 +86,9 @@ void SectorProcessor::process_single_bx(int bx, cfg.bxShiftME0_, cfg.includeNeighbor_, cfg.duplicateTheta_, - cfg.bugME11Dupes_); + cfg.bugME11Dupes_, + cfg.useRun3CCLUT_OTMB_, + cfg.useRun3CCLUT_TMB_); PrimitiveConversion prim_conv; prim_conv.configure(tp_geom_, diff --git a/L1Trigger/L1TMuonEndCap/src/TrackTools.cc b/L1Trigger/L1TMuonEndCap/src/TrackTools.cc index f60a34bd43657..3407f1219adc2 100644 --- a/L1Trigger/L1TMuonEndCap/src/TrackTools.cc +++ b/L1Trigger/L1TMuonEndCap/src/TrackTools.cc @@ -172,4 +172,13 @@ namespace emtf { return std::make_pair(max_pattern, max_quality); } + int get_csc_max_slope(int station, int ring, bool useRun3CCLUT_OTMB, bool useRun3CCLUT_TMB) { + int max_slope = 65536; // Uninitialized slope can be 65536. This is expected when CCLUT is not running + if (useRun3CCLUT_OTMB and (ring == 1 or ring == 4)) + max_slope = 16; + if (useRun3CCLUT_TMB and (ring == 2 or ring == 3)) + max_slope = 16; + return max_slope; + } + } // namespace emtf