Skip to content

Commit

Permalink
Merge pull request #38775 from eyigitba/EMTF_addDataProtectionToPrimS…
Browse files Browse the repository at this point in the history
…el_Jul22

Adding extra protection against invalid data to EMTF PrimitiveSelection
  • Loading branch information
cmsbuild authored Jul 19, 2022
2 parents 2ab64ee + 22d7a21 commit 664cfd9
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 3 deletions.
7 changes: 6 additions & 1 deletion L1Trigger/L1TMuonEndCap/interface/PrimitiveSelection.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ class PrimitiveSelection {
int bxShiftME0,
bool includeNeighbor,
bool duplicateTheta,
bool bugME11Dupes);
bool bugME11Dupes,
bool useRun3CCLUT_OTMB,
bool useRun3CCLUT_TMB);

template <typename T>
void process(T tag,
Expand Down Expand Up @@ -114,6 +116,9 @@ class PrimitiveSelection {
bool includeNeighbor_, duplicateTheta_;

bool bugME11Dupes_;
// Run 3 CCLUT algorithm
bool useRun3CCLUT_OTMB_;
bool useRun3CCLUT_TMB_;
};

#endif
4 changes: 4 additions & 0 deletions L1Trigger/L1TMuonEndCap/interface/TrackTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ namespace emtf {

std::pair<int, int> 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) {
Expand Down
19 changes: 18 additions & 1 deletion L1Trigger/L1TMuonEndCap/src/PrimitiveSelection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}

// _____________________________________________________________________________
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion L1Trigger/L1TMuonEndCap/src/SectorProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand Down
9 changes: 9 additions & 0 deletions L1Trigger/L1TMuonEndCap/src/TrackTools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 664cfd9

Please sign in to comment.