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

Make both ME1a and ME1b LCT (A/CLCT) sorted into ring 1. #37188

Merged
merged 2 commits into from
Mar 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 deletions Validation/MuonCSCDigis/src/CSCStubMatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ void CSCStubMatcher::matchCLCTsToSimTrack(const CSCCLCTDigiCollection& clcts) {
if (isME1a)
ring = 1;
CSCDetId ch_id2(ch_id.endcap(), ch_id.station(), ring, ch_id.chamber(), 0);
auto id2 = ch_id2.rawId(); // CLCTs should be sorted into the det of the CLCTs.

const auto& clcts_in_det = clcts.get(ch_id2);

Expand All @@ -156,7 +157,7 @@ void CSCStubMatcher::matchCLCTsToSimTrack(const CSCCLCTDigiCollection& clcts) {
continue;

// store all CLCTs in this chamber
chamber_to_clcts_all_[id].push_back(*c);
chamber_to_clcts_all_[id2].push_back(*c);

// check that at least 3 comparator digis were matched!
int nMatches = 0;
Expand Down Expand Up @@ -190,13 +191,14 @@ void CSCStubMatcher::matchCLCTsToSimTrack(const CSCCLCTDigiCollection& clcts) {
edm::LogInfo("CSCStubMatcher") << "clctGOOD";

// store matching CLCTs in this chamber
if (std::find(chamber_to_clcts_[id].begin(), chamber_to_clcts_[id].end(), *c) == chamber_to_clcts_[id].end()) {
chamber_to_clcts_[id].push_back(*c);
if (std::find(chamber_to_clcts_[id2].begin(), chamber_to_clcts_[id2].end(), *c) == chamber_to_clcts_[id2].end()) {
chamber_to_clcts_[id2].push_back(*c);
}
}
if (chamber_to_clcts_[id].size() > 2) {
edm::LogInfo("CSCStubMatcher") << "WARNING!!! too many CLCTs " << chamber_to_clcts_[id].size() << " in " << ch_id;
for (auto& c : chamber_to_clcts_[id])
if (chamber_to_clcts_[id2].size() > 2) {
edm::LogInfo("CSCStubMatcher") << "WARNING!!! too many CLCTs " << chamber_to_clcts_[id2].size() << " in "
<< ch_id2;
for (auto& c : chamber_to_clcts_[id2])
edm::LogInfo("CSCStubMatcher") << " " << c;
}
}
Expand All @@ -220,8 +222,9 @@ void CSCStubMatcher::matchALCTsToSimTrack(const CSCALCTDigiCollection& alcts) {

int ring = ch_id.ring();
if (ring == 4)
ring = 1; //use ME1b id to get CLCTs
ring = 1; //use ME1b id to get ALCTs
CSCDetId ch_id2(ch_id.endcap(), ch_id.station(), ring, ch_id.chamber(), 0);
auto id2 = ch_id2.rawId(); // ALCTs should be sorted into the det of the ALCTs.

const auto& alcts_in_det = alcts.get(ch_id2);
for (auto a = alcts_in_det.first; a != alcts_in_det.second; ++a) {
Expand All @@ -238,7 +241,7 @@ void CSCStubMatcher::matchALCTsToSimTrack(const CSCALCTDigiCollection& alcts) {
int wg = a->getKeyWG() + 1; // as ALCT wiregroups numbers start from 0

// store all ALCTs in this chamber
chamber_to_alcts_all_[id].push_back(*a);
chamber_to_alcts_all_[id2].push_back(*a);

// match by wiregroup with the digis
if (digi_wgs.find(wg) == digi_wgs.end()) {
Expand All @@ -248,13 +251,14 @@ void CSCStubMatcher::matchALCTsToSimTrack(const CSCALCTDigiCollection& alcts) {
edm::LogInfo("CSCStubMatcher") << "alctGOOD";

// store matching ALCTs in this chamber
if (std::find(chamber_to_alcts_[id].begin(), chamber_to_alcts_[id].end(), *a) == chamber_to_alcts_[id].end()) {
chamber_to_alcts_[id].push_back(*a);
if (std::find(chamber_to_alcts_[id2].begin(), chamber_to_alcts_[id2].end(), *a) == chamber_to_alcts_[id2].end()) {
chamber_to_alcts_[id2].push_back(*a);
}
}
if (chamber_to_alcts_[id].size() > 2) {
edm::LogInfo("CSCStubMatcher") << "WARNING!!! too many ALCTs " << chamber_to_alcts_[id].size() << " in " << ch_id;
for (auto& a : chamber_to_alcts_[id])
if (chamber_to_alcts_[id2].size() > 2) {
edm::LogInfo("CSCStubMatcher") << "WARNING!!! too many ALCTs " << chamber_to_alcts_[id2].size() << " in "
<< ch_id;
for (auto& a : chamber_to_alcts_[id2])
edm::LogInfo("CSCStubMatcher") << " " << a;
}
}
Expand Down Expand Up @@ -282,6 +286,7 @@ void CSCStubMatcher::matchLCTsToSimTrack(const CSCCorrelatedLCTDigiCollection& l
if (ring == 4)
ring = 1;
CSCDetId ch_id2(ch_id.endcap(), ch_id.station(), ring, ch_id.chamber(), 0);
auto id2 = ch_id2.rawId(); // LCTs should be sorted into the det of the LCTs.

const auto& lcts_in_det = lcts.get(ch_id2);

Expand Down Expand Up @@ -377,8 +382,8 @@ void CSCStubMatcher::matchLCTsToSimTrack(const CSCCorrelatedLCTDigiCollection& l
if (lct_matched) {
if (verboseLCT_)
edm::LogInfo("CSCStubMatcher") << "...was matched";
if (std::find(chamber_to_lcts_[id].begin(), chamber_to_lcts_[id].end(), lct) == chamber_to_lcts_[id].end()) {
chamber_to_lcts_[id].emplace_back(lct);
if (std::find(chamber_to_lcts_[id2].begin(), chamber_to_lcts_[id2].end(), lct) == chamber_to_lcts_[id2].end()) {
chamber_to_lcts_[id2].emplace_back(lct);
}
}
} // lct loop over
Expand Down Expand Up @@ -643,9 +648,15 @@ GlobalPoint CSCStubMatcher::getGlobalPosition(unsigned int rawId, const CSCCorre
CSCDetId cscId(rawId);
CSCDetId keyId(cscId.endcap(), cscId.station(), cscId.ring(), cscId.chamber(), CSCConstants::KEY_CLCT_LAYER);
float fractional_strip = lct.getFractionalStrip();
// case ME1/a
if (cscId.station() == 1 and cscId.ring() == 4 and lct.getStrip() > CSCConstants::MAX_HALF_STRIP_ME1B) {
fractional_strip -= CSCConstants::NUM_STRIPS_ME1B;
// case ME1/1
if (cscId.station() == 1 and (cscId.ring() == 4 || cscId.ring() == 1)) {
int ring = 1; // Default to ME1/b
if (lct.getStrip() > CSCConstants::MAX_HALF_STRIP_ME1B) {
ring = 4; // Change to ME1/a if the HalfStrip Number exceeds the range of ME1/b
fractional_strip -= CSCConstants::NUM_STRIPS_ME1B;
}
CSCDetId cscId_(cscId.endcap(), cscId.station(), ring, cscId.chamber(), cscId.layer());
cscId = cscId_;
}
// regular cases
const auto& chamber = cscGeometry_->chamber(cscId);
Expand Down