From b7f29b6edeb66b2ec82a4908a0aa4c769ccee414 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Mon, 6 Jul 2020 15:15:51 -0500 Subject: [PATCH 1/4] Bugfix --- .../interface/CSCGEMMotherboard.h | 2 ++ .../src/CSCGEMMotherboard.cc | 34 ++++++++++++++----- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h index 3da30e9482edd..ddb6766caa07a 100644 --- a/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h +++ b/L1Trigger/CSCTriggerPrimitives/interface/CSCGEMMotherboard.h @@ -200,6 +200,8 @@ class CSCGEMMotherboard : public CSCUpgradeMotherboard { /** Chamber id (trigger-type labels). */ unsigned gemId; + int maxPads() const; + int maxRolls() const; const GEMGeometry* gem_g; bool gemGeometryAvailable; diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 8d9133834a2dd..b6f6e532a0e86 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -144,20 +144,26 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct p = CSCPart::ME1A; } + assert(gem2.pad(1) >= 0); + assert(gem2.pad(2) >= 0); + assert(gem2.pad(1) < maxPads()); + assert(gem2.pad(2) < maxPads()); + const auto& mymap1 = getLUT()->get_gem_pad_to_csc_hs(theParity, p); // GEM pad number is counting from 1 // keyStrip from mymap: for ME1b 0-127 and for ME1a 0-95 // keyStrip for CLCT: for ME1b 0-127 and for ME1a 128-223 - keyStrip = mymap1[gem2.pad(2) - 1]; - if (p == CSCPart::ME1A and keyStrip <= CSCConstants::MAX_HALF_STRIP_ME1B) + keyStrip = mymap1.at(gem2.pad(2)); + if (p == CSCPart::ME1A and keyStrip <= CSCConstants::MAX_HALF_STRIP_ME1B) { keyStrip += CSCConstants::MAX_HALF_STRIP_ME1B + 1; + } keyWG = alct.getKeyWG(); if ((not doesWiregroupCrossStrip(keyWG, keyStrip)) and p == CSCPart::ME1B and keyWG <= 15) { //try ME1A as strip and WG do not cross p = CSCPart::ME1A; const auto& mymap2 = getLUT()->get_gem_pad_to_csc_hs(theParity, p); - keyStrip = mymap2[gem2.pad(2) - 1] + CSCConstants::MAX_HALF_STRIP_ME1B + 1; + keyStrip = mymap2.at(gem2.pad(2)) + CSCConstants::MAX_HALF_STRIP_ME1B + 1; } pattern = promoteALCTGEMpattern_ ? 10 : 0; @@ -169,13 +175,17 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct thisLCT.setType(CSCCorrelatedLCTDigi::ALCT2GEM); valid = true; } else if (clct.isValid() and gem2.isValid() and not alct.isValid()) { + + assert(gem2.roll() >= GEMDetId::minRollId); + assert(gem2.roll() <= maxRolls()); + const auto& mymap2 = getLUT()->get_gem_roll_to_csc_wg(theParity); pattern = encodePattern(clct.getPattern()); quality = promoteCLCTGEMquality_ ? 15 : 11; bx = gem2.bx(1) + CSCConstants::LCT_CENTRAL_BX; keyStrip = clct.getKeyStrip(); // choose the corresponding wire-group in the middle of the partition - keyWG = mymap2[gem2.roll() - 1]; + keyWG = mymap2.at(gem2.roll() -1 ); bend = clct.getBend(); thisLCT.setCLCT(clct); thisLCT.setGEM1(gem2.first()); @@ -222,7 +232,7 @@ bool CSCGEMMotherboard::isPadInOverlap(int roll) const { // overlap region are WGs 10-15 if ((i < 10) or (i > 15)) continue; - if ((mymap[i].first <= roll) and (roll <= mymap[i].second)) + if ((mymap.at(i).first <= roll) and (roll <= mymap.at(i).second)) return true; } return false; @@ -241,8 +251,8 @@ int CSCGEMMotherboard::getRoll(const GEMPadDigiId& p) const { return GEMDetId(p. int CSCGEMMotherboard::getRoll(const GEMCoPadDigiId& p) const { return p.second.roll(); } std::pair CSCGEMMotherboard::getRolls(const CSCALCTDigi& alct) const { - return std::make_pair((getLUT()->get_csc_wg_to_gem_roll(theParity))[alct.getKeyWG()].first, - (getLUT()->get_csc_wg_to_gem_roll(theParity))[alct.getKeyWG()].second); + const auto& mymap(getLUT()->get_csc_wg_to_gem_roll(theParity)); + return std::make_pair(mymap.at(alct.getKeyWG()).first, mymap.at(alct.getKeyWG()).second); } float CSCGEMMotherboard::getPad(const GEMPadDigi& p) const { return p.pad(); } @@ -258,7 +268,7 @@ float CSCGEMMotherboard::getPad(const CSCCLCTDigi& clct, enum CSCPart part) cons //ME1A part, convert halfstrip from 128-223 to 0-95 if (part == CSCPart::ME1A and keyStrip > CSCConstants::MAX_HALF_STRIP_ME1B) keyStrip = keyStrip - CSCConstants::MAX_HALF_STRIP_ME1B - 1; - return 0.5 * (mymap[keyStrip].first + mymap[keyStrip].second); + return 0.5 * (mymap.at(keyStrip).first + mymap.at(keyStrip).second); } void CSCGEMMotherboard::setupGeometry() { @@ -266,6 +276,14 @@ void CSCGEMMotherboard::setupGeometry() { generator_->setGEMGeometry(gem_g); } +int CSCGEMMotherboard::maxPads() const { + return gem_g->superChamber(gemId)->chamber(1)->etaPartition(1)->npads(); +} + +int CSCGEMMotherboard::maxRolls() const { + return gem_g->superChamber(gemId)->chamber(1)->nEtaPartitions(); +} + void CSCGEMMotherboard::printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart part) { LogTrace("CSCGEMMotherboard") << "------------------------------------------------------------------------" << std::endl; From 644ec190c3bf7655a54d309e024bf51d819995cc Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Mon, 6 Jul 2020 15:16:32 -0500 Subject: [PATCH 2/4] Code format --- .../CSCTriggerPrimitives/src/CSCGEMMotherboard.cc | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index b6f6e532a0e86..9cc87f68a4b4d 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -175,7 +175,6 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct thisLCT.setType(CSCCorrelatedLCTDigi::ALCT2GEM); valid = true; } else if (clct.isValid() and gem2.isValid() and not alct.isValid()) { - assert(gem2.roll() >= GEMDetId::minRollId); assert(gem2.roll() <= maxRolls()); @@ -185,7 +184,7 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct bx = gem2.bx(1) + CSCConstants::LCT_CENTRAL_BX; keyStrip = clct.getKeyStrip(); // choose the corresponding wire-group in the middle of the partition - keyWG = mymap2.at(gem2.roll() -1 ); + keyWG = mymap2.at(gem2.roll() - 1); bend = clct.getBend(); thisLCT.setCLCT(clct); thisLCT.setGEM1(gem2.first()); @@ -276,13 +275,9 @@ void CSCGEMMotherboard::setupGeometry() { generator_->setGEMGeometry(gem_g); } -int CSCGEMMotherboard::maxPads() const { - return gem_g->superChamber(gemId)->chamber(1)->etaPartition(1)->npads(); -} +int CSCGEMMotherboard::maxPads() const { return gem_g->superChamber(gemId)->chamber(1)->etaPartition(1)->npads(); } -int CSCGEMMotherboard::maxRolls() const { - return gem_g->superChamber(gemId)->chamber(1)->nEtaPartitions(); -} +int CSCGEMMotherboard::maxRolls() const { return gem_g->superChamber(gemId)->chamber(1)->nEtaPartitions(); } void CSCGEMMotherboard::printGEMTriggerPads(int bx_start, int bx_stop, enum CSCPart part) { LogTrace("CSCGEMMotherboard") << "------------------------------------------------------------------------" From aa5986085b8872bc1839f01a7ee96e4d92ddf96c Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Mon, 6 Jul 2020 15:21:58 -0500 Subject: [PATCH 3/4] Add more comments --- L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 9cc87f68a4b4d..430dcbc6123b8 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -144,6 +144,8 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct p = CSCPart::ME1A; } + // min pad number is always 0 + // max pad number is 191 or 383, depending on the station assert(gem2.pad(1) >= 0); assert(gem2.pad(2) >= 0); assert(gem2.pad(1) < maxPads()); @@ -175,6 +177,8 @@ CSCCorrelatedLCTDigi CSCGEMMotherboard::constructLCTsGEM(const CSCALCTDigi& alct thisLCT.setType(CSCCorrelatedLCTDigi::ALCT2GEM); valid = true; } else if (clct.isValid() and gem2.isValid() and not alct.isValid()) { + // min roll number is always 1 + // max roll number is 8 or 16, depending on the station assert(gem2.roll() >= GEMDetId::minRollId); assert(gem2.roll() <= maxRolls()); From d08b6a09aa9e8a0e17bbfe0929006317ea96bc10 Mon Sep 17 00:00:00 2001 From: Sven Dildick Date: Wed, 8 Jul 2020 11:40:24 -0500 Subject: [PATCH 4/4] Suggestion by Andrea Bocci --- L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc index 430dcbc6123b8..04d36d84c2c46 100644 --- a/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc +++ b/L1Trigger/CSCTriggerPrimitives/src/CSCGEMMotherboard.cc @@ -255,7 +255,7 @@ int CSCGEMMotherboard::getRoll(const GEMCoPadDigiId& p) const { return p.second. std::pair CSCGEMMotherboard::getRolls(const CSCALCTDigi& alct) const { const auto& mymap(getLUT()->get_csc_wg_to_gem_roll(theParity)); - return std::make_pair(mymap.at(alct.getKeyWG()).first, mymap.at(alct.getKeyWG()).second); + return mymap.at(alct.getKeyWG()); } float CSCGEMMotherboard::getPad(const GEMPadDigi& p) const { return p.pad(); }