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

Update TrackReco HitPattern in light of GEM now including GE0 #35205

Merged
merged 5 commits into from
Sep 11, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions DataFormats/TrackReco/interface/HitPattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// | mu = 0 | DT = 1 | 4*(stat-1)+superlayer | | hit type = 0-3 |
// | mu = 0 | CSC = 2 | 4*(stat-1)+(ring-1) | | hit type = 0-3 |
// | mu = 0 | RPC = 3 | 4*(stat-1)+2*layer+region | | hit type = 0-3 |
// | mu = 0 | GEM = 4 | 2*(stat-1)+2*(layer-1) | | hit type = 0-3 |
// | mu = 0 | GEM = 4 | 1xxx=st0, 0yxx=st y-1 la x| | hit type = 0-3 |
// | mu = 0 | ME0 = 5 | roll | | hit type = 0-3 |
// | mtd = 2 | BTL = 1 | moduleType = 1-3 | | hit type = 0-3 |
// | mtd = 2 | ETL = 2 | ring = 1-12 | | hit type = 0-3 |
Expand Down Expand Up @@ -214,7 +214,7 @@ namespace reco {
/// GEM station: 1,2. Only valid for muon GEM patterns, of course.
static uint16_t getGEMStation(uint16_t pattern);

/// GEM layer: 1,2. Only valid for muon GEM patterns, of course.
/// GEM layer: 1-6 for station 0, 1-2 for stations 1 and 2. Only valid for muon GEM patterns, of course.
static uint16_t getGEMLayer(uint16_t pattern);

/// BTL Module type: 1,2,3. Only valid for BTL patterns of course.
Expand Down Expand Up @@ -746,7 +746,9 @@ namespace reco {
return ((pattern >> HitTypeOffset) & HitTypeMask);
}

inline uint16_t HitPattern::getMuonStation(uint16_t pattern) { return (getSubSubStructure(pattern) >> 2) + 1; }
inline uint16_t HitPattern::getMuonStation(uint16_t pattern) {
return muonGEMHitFilter(pattern) ? getGEMStation(pattern) : (getSubSubStructure(pattern) >> 2) + 1;
}

inline uint16_t HitPattern::getDTSuperLayer(uint16_t pattern) { return (getSubSubStructure(pattern) & 3); }

Expand All @@ -766,19 +768,24 @@ namespace reco {
inline uint16_t HitPattern::getRPCregion(uint16_t pattern) { return getSubSubStructure(pattern) & 1; }

////////////////////////////// GEM
inline uint16_t HitPattern::getGEMStation(uint16_t pattern)

{
uint16_t sss = getSubSubStructure(pattern), stat = sss >> 1;
return stat + 1;
inline uint16_t HitPattern::getGEMStation(uint16_t pattern) {
uint16_t sss = getSubSubStructure(pattern);
if (sss & 0b1000)
return 0;
return (sss >> 2) + 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

this looks like a bugfix (a shift by 2 instead of 1 in view of what was encoded as (gemid.station() - 1) << 2.
Please add a more explicit note about this in the PR description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated the PR

}

/// MTD
inline uint16_t HitPattern::getBTLModType(uint16_t pattern) { return getSubSubStructure(pattern); }

inline uint16_t HitPattern::getETLRing(uint16_t pattern) { return getSubSubStructure(pattern); }

inline uint16_t HitPattern::getGEMLayer(uint16_t pattern) { return (getSubSubStructure(pattern) & 1) + 1; }
inline uint16_t HitPattern::getGEMLayer(uint16_t pattern) {
uint16_t sss = getSubSubStructure(pattern);
if (sss & 0b1000)
return (sss & 0b0111) + 1;
return (sss & 0b11) + 1;
}

inline bool HitPattern::validHitFilter(uint16_t pattern) { return getHitType(pattern) == HitPattern::VALID; }

Expand Down
16 changes: 13 additions & 3 deletions DataFormats/TrackReco/src/HitPattern.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,17 @@ namespace {
} break;
case MuonSubdetId::GEM: {
GEMDetId gemid(id.rawId());
layer = ((gemid.station() - 1) << 2);
layer |= abs(gemid.layer() - 1);
{
uint16_t st = gemid.station();
uint16_t la = gemid.layer();
if (st == 0) {
layer |= 0b1000;
layer |= (la - 1);
} else {
layer |= (st - 1) << 2;
layer |= (la - 1);
}
}
} break;
case MuonSubdetId::ME0: {
ME0DetId me0id(id.rawId());
Expand Down Expand Up @@ -818,7 +827,8 @@ void HitPattern::printHitPattern(HitCategory category, int position, std::ostrea
} else if (muonRPCHitFilter(pattern)) {
stream << "\trpc " << (getRPCregion(pattern) ? "endcaps" : "barrel") << ", layer " << getRPCLayer(pattern);
} else if (muonGEMHitFilter(pattern)) {
stream << "\tgem " << (getGEMLayer(pattern) ? "layer1" : "layer2") << ", station " << getGEMStation(pattern);
stream << "\tgem "
<< " station " << getGEMStation(pattern) << ", layer" << getGEMLayer(pattern);
} else if (muonME0HitFilter(pattern)) {
stream << "\tme0 ";
} else {
Expand Down