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

Correct RegionalMuon (un)packer when running on EMTF data #34801

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace l1t {
for (auto imu = muons->begin(); imu != muons->end(); imu++) {
if (imu->processor() + 1 == board_id) {
uint32_t firstWord(0), lastWord(0);
RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_);
RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_, false);
payloadMap_[bmtfBlockID].push_back(firstWord); //imu->link()*2+1
payloadMap_[bmtfBlockID].push_back(lastWord); //imu->link()*2+1
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ namespace l1t {

RegionalMuonCand muCand;
RegionalMuonRawDigiTranslator::fillRegionalMuonCand(
muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman);
muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman, false);

if (muCand.hwPt() == 0) {
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ namespace l1t {
if (fed == 1402) {
auto gmt_in_packer = static_pointer_cast<l1t::stage2::RegionalMuonGMTPacker>(
PackerFactory::get()->make("stage2::RegionalMuonGMTPacker"));
if (fw >= 0x6010000) {
gmt_in_packer->setUseEmtfDisplacementInfo();
}
if (fw >= 0x6000000) {
gmt_in_packer->setIsRun3();
gmt_in_packer->setIsKbmtf();
}
auto gmt_out_packer =
static_pointer_cast<l1t::stage2::GMTMuonPacker>(PackerFactory::get()->make("stage2::GMTMuonPacker"));
Expand Down Expand Up @@ -86,8 +89,11 @@ namespace l1t {
// input muons on links 36-71
auto gmt_in_unp = static_pointer_cast<l1t::stage2::RegionalMuonGMTUnpacker>(
UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker"));
if (fw >= 0x6010000) {
gmt_in_unp->setUseEmtfDisplacementInfo();
}
if (fw >= 0x6000000) {
gmt_in_unp->setIsRun3();
gmt_in_unp->setIsKbmtf();
}

for (int iLink = 72; iLink < 144; iLink += 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace l1t {
uint32_t msw = 0;
uint32_t lsw = 0;

RegionalMuonRawDigiTranslator::generatePackedDataWords(*mu, lsw, msw, isRun3_);
RegionalMuonRawDigiTranslator::generatePackedDataWords(*mu, lsw, msw, isKbmtf_, useEmtfDisplacementInfo_);

payloadMap[linkTimes2].push_back(lsw);
payloadMap[linkTimes2].push_back(msw);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ namespace l1t {
class RegionalMuonGMTPacker : public Packer {
public:
Blocks pack(const edm::Event&, const PackerTokens*) override;
void setIsRun3() { isRun3_ = true; };
void setIsKbmtf() { isKbmtf_ = true; };
void setUseEmtfDisplacementInfo() { useEmtfDisplacementInfo_ = true; };

private:
typedef std::map<unsigned int, std::vector<uint32_t>> PayloadMap;
void packTF(const edm::Event&, const edm::EDGetTokenT<RegionalMuonCandBxCollection>&, Blocks&);

bool isRun3_{false};
bool isKbmtf_{false};
bool useEmtfDisplacementInfo_{false};
};
} // namespace stage2
} // namespace l1t
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace l1t {
RegionalMuonCand mu;

RegionalMuonRawDigiTranslator::fillRegionalMuonCand(
mu, raw_data_00_31, raw_data_32_63, processor, trackFinder, isRun3_);
mu, raw_data_00_31, raw_data_32_63, processor, trackFinder, isKbmtf_, useEmtfDisplacementInfo_);

LogDebug("L1T") << "Mu" << nWord / 2 << ": eta " << mu.hwEta() << " phi " << mu.hwPhi() << " pT "
<< mu.hwPt() << " qual " << mu.hwQual() << " sign " << mu.hwSign() << " sign valid "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ namespace l1t {
class RegionalMuonGMTUnpacker : public Unpacker {
public:
bool unpack(const Block& block, UnpackerCollections* coll) override;
void setIsRun3() { isRun3_ = true; }
void setIsKbmtf() { isKbmtf_ = true; }
void setUseEmtfDisplacementInfo() { useEmtfDisplacementInfo_ = true; }

private:
static constexpr unsigned nWords_ = 6; // every link transmits 6 words (3 muons) per bx
static constexpr unsigned bxzs_enable_shift_ = 1;

bool isRun3_{false};
bool isKbmtf_{false};
bool useEmtfDisplacementInfo_{false};
};
} // namespace stage2
} // namespace l1t
Expand Down
4 changes: 2 additions & 2 deletions EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ImdInputLabelOMTFNeg = cms.InputTag("simGmtStage2Digis", "imdMuonsOMTFNeg"),
ImdInputLabelOMTFPos = cms.InputTag("simGmtStage2Digis", "imdMuonsOMTFPos"),
FedId = cms.int32(1402),
FWId = cms.uint32(0x6000000), # FW version in GMT with displaced muon information
FWId = cms.uint32(0x3000000), # First used uGMT firmware version
lenSlinkHeader = cms.untracked.int32(8),
lenSlinkTrailer = cms.untracked.int32(8)
)
Expand All @@ -32,4 +32,4 @@

### Era: Run3_2021
from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021
stage2L1Trigger_2021.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(0x6000000))
stage2L1Trigger_2021.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(0x6010000))
15 changes: 11 additions & 4 deletions L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@
namespace l1t {
class RegionalMuonRawDigiTranslator {
public:
static void fillRegionalMuonCand(RegionalMuonCand& mu,
uint32_t raw_data_00_31,
uint32_t raw_data_32_63,
int proc,
tftype tf,
bool isKbmtf,
bool useEmtfDisplacementInfo);
static void fillRegionalMuonCand(
RegionalMuonCand& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int proc, tftype tf, bool isRun3);
static void fillRegionalMuonCand(RegionalMuonCand& mu, uint64_t dataword, int proc, tftype tf, bool isRun3);
RegionalMuonCand& mu, uint64_t dataword, int proc, tftype tf, bool isKbmtf, bool useEmtfDisplacementInfo);
static void generatePackedDataWords(const RegionalMuonCand& mu,
uint32_t& raw_data_00_31,
uint32_t& raw_data_32_63,
bool isRun3);
static uint64_t generate64bitDataWord(const RegionalMuonCand& mu, bool isRun3);
bool isKbmtf,
bool useEmtfDisplacementInfo);
static uint64_t generate64bitDataWord(const RegionalMuonCand& mu, bool isKbmtf, bool useEmtfDisplacementInfo);
static int generateRawTrkAddress(const RegionalMuonCand&, bool isKalman);

static constexpr unsigned ptMask_ = 0x1FF;
Expand Down
39 changes: 26 additions & 13 deletions L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand&
const uint32_t raw_data_32_63,
const int proc,
const tftype tf,
const bool isRun3) {
const bool isKbmtf,
const bool useEmtfDisplacementInfo) {
// translations as defined in DN-15-017
mu.setHwPt((raw_data_00_31 >> ptShift_) & ptMask_);
mu.setHwQual((raw_data_00_31 >> qualShift_) & qualMask_);
Expand Down Expand Up @@ -44,7 +45,7 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand&

mu.setTrackSubAddress(RegionalMuonCand::kWheelSide, detSide);
mu.setTrackSubAddress(RegionalMuonCand::kWheelNum, wheelNum);
if (!isRun3) { // The Run-2 standard configuration
if (!isKbmtf) { // The Run-2 standard configuration for BMTF
mu.setTrackSubAddress(RegionalMuonCand::kStat1, statAddr1);
mu.setTrackSubAddress(RegionalMuonCand::kStat2, statAddr2);
mu.setTrackSubAddress(RegionalMuonCand::kStat3, statAddr3);
Expand Down Expand Up @@ -78,7 +79,7 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand&
mu.setTrackSubAddress(RegionalMuonCand::kTrkNum,
(rawTrackAddress >> emtfTrAddrTrkNumShift_) & emtfTrAddrTrkNumMask_);
mu.setTrackSubAddress(RegionalMuonCand::kBX, (rawTrackAddress >> emtfTrAddrBxShift_) & emtfTrAddrBxMask_);
if (isRun3) { // In Run-3 we receive displaced muon information from EMTF
if (useEmtfDisplacementInfo) { // In Run-3 we receive displaced muon information from EMTF
mu.setHwPtUnconstrained((raw_data_32_63 >> emtfPtUnconstrainedShift_) & ptUnconstrainedMask_);
mu.setHwDXY((raw_data_32_63 >> emtfDxyShift_) & dxyMask_);
}
Expand All @@ -98,16 +99,26 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand&
mu.setDataword(raw_data_32_63, raw_data_00_31);
}

void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(
RegionalMuonCand& mu, const uint64_t dataword, const int proc, const tftype tf, const bool isRun3) {
fillRegionalMuonCand(
mu, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF), proc, tf, isRun3);
void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& mu,
const uint64_t dataword,
const int proc,
const tftype tf,
const bool isKbmtf,
const bool useEmtfDisplacementInfo) {
fillRegionalMuonCand(mu,
(uint32_t)(dataword & 0xFFFFFFFF),
(uint32_t)((dataword >> 32) & 0xFFFFFFFF),
proc,
tf,
isKbmtf,
useEmtfDisplacementInfo);
}

void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalMuonCand& mu,
uint32_t& raw_data_00_31,
uint32_t& raw_data_32_63,
const bool isRun3) {
const bool isKbmtf,
const bool useEmtfDisplacementInfo) {
int abs_eta = mu.hwEta();
if (abs_eta < 0) {
abs_eta += (1 << (etaSignShift_ - absEtaShift_));
Expand All @@ -122,24 +133,26 @@ void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalM
(mu.hwPhi() < 0) << phiSignShift_;

// generate the raw track address from the subaddresses
int rawTrkAddr = generateRawTrkAddress(mu, isRun3);
int rawTrkAddr = generateRawTrkAddress(mu, isKbmtf);

raw_data_32_63 = mu.hwSign() << signShift_ | mu.hwSignValid() << signValidShift_ |
(rawTrkAddr & trackAddressMask_) << trackAddressShift_;
if (isRun3 && mu.trackFinderType() == bmtf) {
if (isKbmtf && mu.trackFinderType() == bmtf) {
raw_data_32_63 |= (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << bmtfPtUnconstrainedShift_ |
(mu.hwDXY() & dxyMask_) << bmtfDxyShift_;
} else if (isRun3 && (mu.trackFinderType() == emtf_pos || mu.trackFinderType() == emtf_neg)) {
} else if (useEmtfDisplacementInfo && (mu.trackFinderType() == emtf_pos || mu.trackFinderType() == emtf_neg)) {
raw_data_32_63 |= (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << emtfPtUnconstrainedShift_ |
(mu.hwDXY() & dxyMask_) << emtfDxyShift_;
}
}

uint64_t l1t::RegionalMuonRawDigiTranslator::generate64bitDataWord(const RegionalMuonCand& mu, const bool isRun3) {
uint64_t l1t::RegionalMuonRawDigiTranslator::generate64bitDataWord(const RegionalMuonCand& mu,
const bool isKbmtf,
const bool useEmtfDisplacementInfo) {
uint32_t lsw;
uint32_t msw;

generatePackedDataWords(mu, lsw, msw, isRun3);
generatePackedDataWords(mu, lsw, msw, isKbmtf, useEmtfDisplacementInfo);
return (((uint64_t)msw) << 32) + lsw;
}

Expand Down