Skip to content

Commit 59b3826

Browse files
committed
Apply some further simplification in Muon.cc
1 parent 3b68b66 commit 59b3826

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

DataFormats/MuonReco/src/Muon.cc

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ unsigned int Muon::stationMask(ArbitrationType type) const {
151151

152152
// for (auto& rpcMatch : chamberMatch.rpcMatches) { // TO BE FIXED: there is clearly something odd here
153153
// Replaced by something which restores the previous functionality, but one should verify which were the
154-
// Original intentions of the author and provide a more appropriate fix (and remove these comment lines)
154+
// original intentions of the author and provide a more appropriate fix (and remove these comment lines)
155155
if (!chamberMatch.rpcMatches.empty()) {
156156
curMask = 1 << ((chamberMatch.station() - 1) + 4 * (rpcIndex - 1));
157157

@@ -227,19 +227,20 @@ unsigned int Muon::RPClayerMask(ArbitrationType type) const {
227227

228228
RPCDetId rollId = chamberMatch.id.rawId();
229229
const int region = rollId.region();
230+
const int stationIndex = chamberMatch.station();
230231

231-
int rpcLayer = chamberMatch.station();
232+
int rpcLayer = stationIndex;
232233
if (region == 0) {
233234
const int layer = rollId.layer();
234-
rpcLayer = chamberMatch.station() - 1 + chamberMatch.station() * layer;
235-
if ((chamberMatch.station() == 2 && layer == 2) || (chamberMatch.station() == 4 && layer == 1))
235+
rpcLayer = stationIndex - 1 + stationIndex * layer;
236+
if ((stationIndex == 2 && layer == 2) || (stationIndex == 4 && layer == 1))
236237
rpcLayer -= 1;
237238
} else
238239
rpcLayer += 6;
239240

240241
// for (auto& rpcMatch : chamberMatch.rpcMatches) { // TO BE FIXED: there is clearly something odd here
241242
// Replaced by something which restores the previous functionality, but one should verify which were the
242-
// Original intentions of the author and provide a more appropriate fix (and remove these comment lines)
243+
// original intentions of the author and provide a more appropriate fix (and remove these comment lines)
243244
if (!chamberMatch.rpcMatches.empty()) {
244245
curMask = 1 << (rpcLayer - 1);
245246

@@ -257,12 +258,12 @@ unsigned int Muon::stationGapMaskDistance(float distanceCut) const {
257258
distanceCut = std::abs(distanceCut);
258259
for (auto& chamberMatch : muMatches_) {
259260
unsigned int curMask(0);
260-
int stationIndex = chamberMatch.station();
261-
if (stationIndex < 1 || stationIndex >= 5)
262-
continue;
263-
int detectorIndex = chamberMatch.detector();
261+
const int detectorIndex = chamberMatch.detector();
264262
if (detectorIndex < 1 || detectorIndex >= 4)
265263
continue;
264+
const int stationIndex = chamberMatch.station();
265+
if (stationIndex < 1 || stationIndex >= 5)
266+
continue;
266267

267268
float edgeX = chamberMatch.edgeX;
268269
float edgeY = chamberMatch.edgeY;
@@ -284,12 +285,12 @@ unsigned int Muon::stationGapMaskPull(float sigmaCut) const {
284285
unsigned int totMask(0);
285286
for (auto& chamberMatch : muMatches_) {
286287
unsigned int curMask(0);
287-
int stationIndex = chamberMatch.station();
288-
if (stationIndex < 1 || stationIndex >= 5)
289-
continue;
290-
int detectorIndex = chamberMatch.detector();
288+
const int detectorIndex = chamberMatch.detector();
291289
if (detectorIndex < 1 || detectorIndex >= 4)
292290
continue;
291+
const int stationIndex = chamberMatch.station();
292+
if (stationIndex < 1 || stationIndex >= 5)
293+
continue;
293294

294295
float edgeX = chamberMatch.edgeX;
295296
float edgeY = chamberMatch.edgeY;
@@ -376,7 +377,7 @@ int Muon::numberOfSegments(int station, int muonSubdetId, ArbitrationType type)
376377
for (auto& chamberMatch : muMatches_) {
377378
if (chamberMatch.segmentMatches.empty())
378379
continue;
379-
if (!(chamberMatch.station() == station && chamberMatch.detector() == muonSubdetId))
380+
if (chamberMatch.detector() != muonSubdetId || chamberMatch.station() != station)
380381
continue;
381382

382383
if (type == NoArbitration) {
@@ -414,7 +415,7 @@ const std::vector<const MuonChamberMatch*> Muon::chambers(int station, int muonS
414415
for (std::vector<MuonChamberMatch>::const_iterator chamberMatch = muMatches_.begin();
415416
chamberMatch != muMatches_.end();
416417
chamberMatch++)
417-
if (chamberMatch->station() == station && chamberMatch->detector() == muonSubdetId)
418+
if (chamberMatch->detector() == muonSubdetId && chamberMatch->station() == station)
418419
chambers.push_back(&(*chamberMatch));
419420
return chambers;
420421
}

0 commit comments

Comments
 (0)