Skip to content

Commit

Permalink
Merge pull request cms-sw#105 from thomreis/l1t-muon-CMSSW_8_0_0_pre1…
Browse files Browse the repository at this point in the history
…_uGMT-unpacker-fixes

uGMT unpacker fixes
  • Loading branch information
thomreis committed Dec 16, 2015
2 parents d6d882b + 5674854 commit 9ca8b10
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ namespace l1t {
for (int oLink = 1; oLink < 9; oLink += 2)
res[oLink] = gmt_out_unp;
// internal muons
for (int oLink = 9; oLink < 24; oLink += 2)
res[oLink] = gmt_out_unp;
//for (int oLink = 9; oLink < 24; oLink += 2)
// res[oLink] = gmt_out_unp;

return res;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,19 @@ namespace l1t {
for (unsigned nWord = 0; nWord < nWords && i < block.header().getSize(); nWord += 2) {
uint32_t raw_data_00_31 = payload[i++];
uint32_t raw_data_32_63 = payload[i++];
LogDebug("L1T|Muon") << "raw_data_00_31 = 0x" << hex << raw_data_00_31 << " raw_data_32_63 = 0x" << raw_data_32_63;
LogDebug("L1T|Muon") << "raw_data_00_31 = 0x" << hex << setw(8) << setfill('0') << raw_data_00_31 << " raw_data_32_63 = 0x" << setw(8) << setfill('0') << raw_data_32_63;
// skip empty muons (hwPt == 0)
//// the msb are reserved for global information
//if ((raw_data_00_31 & 0x7FFFFFFF) == 0 && (raw_data_32_63 & 0x7FFFFFFF) == 0) {
if (((raw_data_00_31 >> l1t::RegionalMuonRawDigiTranslator::ptShift_) & l1t::RegionalMuonRawDigiTranslator::ptMask_) == 0) {
LogDebug("L1T|Muon") << "Muon hwPt zero. Skip.";
continue;
}
// Detect and ignore comma events
if (raw_data_00_31 == 0x505050bc || raw_data_32_63 == 0x505050bc) {
edm::LogWarning("L1T|Muon") << "Comma detected in raw data stream. Orbit number: " << block.amc().getOrbitNumber() << ", BX ID: " << block.amc().getBX() << ", BX: " << bx << ", linkId: " << linkId << ", Raw data: 0x" << hex << setw(8) << setfill('0') << raw_data_32_63 << setw(8) << setfill('0') << raw_data_00_31 << dec << ". Skip.";
continue;
}

RegionalMuonCand mu;

Expand Down
5 changes: 3 additions & 2 deletions L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ namespace l1t {
static const unsigned etaSignShift_ = 21;
static const unsigned hfMask_ = 0x1;
static const unsigned hfShift_ = 22;
static const unsigned phiMask_ = 0xFF;
static const unsigned phiShift_ = 23;
static const unsigned absPhiMask_ = 0x7F;
static const unsigned absPhiShift_ = 23;
static const unsigned phiSignShift_ = 30;
static const unsigned signShift_ = 0;
static const unsigned signValidShift_ = 1;
static const unsigned trackAddressMask_ = 0x1FFFFFFF;
Expand Down
6 changes: 3 additions & 3 deletions L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,8 @@ L1TMuonProducer::splitAndConvertMuons(const edm::Handle<MicroGMTConfiguration::I
}
}
for (int i = 0; i < 6; ++i) {
if(wedges_pos[i].size() > 3) edm::LogWarning("Input Mismatch") << " too many inputs per processor for emtf+ / omtf+" << std::endl;
if(wedges_neg[i].size() > 3) edm::LogWarning("Input Mismatch") << " too many inputs per processor for emtf- / omtf-" << std::endl;
if(wedges_pos[i].size() > 3) edm::LogWarning("Input Mismatch") << " too many inputs per processor for emtf+ / omtf+. Wedge " << i << ": Size " << wedges_pos[i].size() << std::endl;
if(wedges_neg[i].size() > 3) edm::LogWarning("Input Mismatch") << " too many inputs per processor for emtf- / omtf-. Wedge " << i << ": Size " << wedges_neg[i].size() << std::endl;
}
}

Expand All @@ -395,7 +395,7 @@ L1TMuonProducer::convertMuons(const edm::Handle<MicroGMTConfiguration::InputColl
wedges[in->at(bx, i).processor()].push_back(outMu);
}
for (int i = 0; i < 12; ++i) {
if(wedges[i].size() > 3) edm::LogWarning("Input Mismatch") << " too many inputs per processor for barrel" << std::endl;
if(wedges[i].size() > 3) edm::LogWarning("Input Mismatch") << " too many inputs per processor for barrel. Wedge " << i << ": Size " << wedges[i].size() << std::endl;
}
}

Expand Down
16 changes: 14 additions & 2 deletions L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,14 @@ l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& mu, u
mu.setHwEta(abs_eta);
}

mu.setHwPhi((raw_data_00_31 >> phiShift_) & phiMask_);
// phi is coded as two's complement
int abs_phi = (raw_data_00_31 >> absPhiShift_) & absPhiMask_;
if ((raw_data_00_31 >> phiSignShift_) & 0x1) {
mu.setHwPhi(abs_phi - (1 << (phiSignShift_ - absPhiShift_)));
} else {
mu.setHwPhi(abs_phi);
}

// sign is coded as -1^signBit
int signBit = (raw_data_32_63 >> signShift_) & 0x1;
mu.setHwSign(1 - 2*signBit);
Expand Down Expand Up @@ -69,12 +76,17 @@ l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalMuonCa
if (abs_eta < 0) {
abs_eta += (1 << (etaSignShift_ - absEtaShift_));
}
int abs_phi = mu.hwPhi();
if (abs_phi < 0) {
abs_phi += (1 << (phiSignShift_ - absPhiShift_));
}
raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_
| (mu.hwQual() & qualMask_) << qualShift_
| (abs_eta & absEtaMask_) << absEtaShift_
| (mu.hwEta() < 0) << etaSignShift_
| (mu.hwHF() & hfMask_) << hfShift_
| (mu.hwPhi() & phiMask_) << phiShift_;
| (abs_phi & absPhiMask_) << absPhiShift_
| (mu.hwPhi() < 0) << phiSignShift_;

int tf = mu.trackFinderType();
int rawTrkAddr = 0;
Expand Down

0 comments on commit 9ca8b10

Please sign in to comment.