Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding extra protection against invalid data to EMTF PrimitiveSelection #38775

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion L1Trigger/L1TMuonEndCap/interface/PrimitiveSelection.h
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
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
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
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
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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is station needed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the station there as well to be safe. Currently it's not needed, but I don't know if there will be a station based enabling of CCLUT algorithm in the future. This is also the reason station and ring are there for other functions like get_csc_max_pattern_and_quality.

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