Skip to content

Commit

Permalink
Merge pull request #36919 from gk199/L1emulator_L1TNtuples_LLPtrig
Browse files Browse the repository at this point in the history
L1 emulator for LLP displaced jet trigger (L1 6:1 LUT, L2 jet algo), L1TNtuples addition of jet hwQual
  • Loading branch information
cmsbuild authored Feb 17, 2022
2 parents 2215975 + e757f7b commit 988e293
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,14 @@ namespace l1t {

HcalTrigTowerDetId id(cEta, cPhi);
const auto tp = hcalTPGs->find(id);

int fg_bits = 0;
for (int index = 0; index < 6; index++)
fg_bits += tp->SOI_fineGrain(index) << index;

if (tp != hcalTPGs->end()) {
ctp7Data.setET(cType, negativeEta, iEta, iPhi, tp->SOI_compressedEt());
ctp7Data.setFB(cType, negativeEta, iEta, iPhi, tp->SOI_fineGrain());
ctp7Data.setFB(cType, negativeEta, iEta, iPhi, fg_bits);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,14 @@ class UCTCTP7RawData {
if (((cEta - 1) % 2) == 1) {
tower += 4;
}
data |= (fb & 0x1) << tower;
if (cType == HBHE) {
int depth = fb & 0b1;
int prompt = (fb & 0b10) >> 1;
int delay1 = (fb & 0b100) >> 2;
int delay2 = (fb & 0b1000) >> 3;
data |= (depth | ((!prompt) & (delay1 | delay2))) << tower; // bit[0] | (!bit[1] & (bit[2] | bit[3]))
} else
data |= (fb & 0x1) << tower;
}
}

Expand Down
20 changes: 13 additions & 7 deletions L1Trigger/L1TCaloLayer1/plugins/L1TCaloLayer1.cc
Original file line number Diff line number Diff line change
Expand Up @@ -209,16 +209,22 @@ void L1TCaloLayer1::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
} else if (absCaloEta <= 41) {
int caloPhi = hcalTp.id().iphi();
int et = hcalTp.SOI_compressedEt();
bool fg = hcalTp.t0().fineGrain(0);
bool fg2 = hcalTp.t0().fineGrain(1);
bool fg = hcalTp.t0().fineGrain(0); // depth
bool fg2 = hcalTp.t0().fineGrain(1); // prompt
bool fg3 = hcalTp.t0().fineGrain(2); // delay 1
bool fg4 = hcalTp.t0().fineGrain(3); // delay 2
// note that hcalTp.t0().fineGrain(4) and hcalTp.t0().fineGrain(5) are the reserved MIP bits (not used for LLP logic)
if (caloPhi <= 72) {
UCTTowerIndex t = UCTTowerIndex(caloEta, caloPhi);
uint32_t featureBits = 0;
if (fg)
featureBits |= 0b01;
// fg2 should only be set for HF
if (absCaloEta > 29 && fg2)
featureBits |= 0b10;
if (absCaloEta > 29) {
if (fg)
featureBits |= 0b01;
// fg2 should only be set for HF
if (fg2)
featureBits |= 0b10;
} else
featureBits |= (fg | ((!fg2) & (fg3 | fg4))); // depth | (!prompt & (delay1 | delay2))
if (!layer1->setHCALData(t, featureBits, et)) {
LOG_ERROR << "caloEta = " << caloEta << "; caloPhi =" << caloPhi << std::endl;
LOG_ERROR << "UCT: Failed loading an HCAL tower" << std::endl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ void l1t::Stage2Layer2JetAlgorithmFirmwareImp1::create(const std::vector<l1t::Ca
const CaloTower& tow = CaloTools::getTower(towers, CaloTools::caloEta(ieta), iphi);

int seedEt = tow.hwPt();
int iDelay = (tow.hwQual() & 0b0100) >> 2;
int iEt = seedEt;
bool satSeed = false;
bool vetoCandidate = false;
Expand All @@ -117,6 +118,7 @@ void l1t::Stage2Layer2JetAlgorithmFirmwareImp1::create(const std::vector<l1t::Ca
for (int deta = -4; deta < 5; ++deta) {
for (int dphi = -4; dphi < 5; ++dphi) {
int towEt = 0;
int towDelay = 0;
int ietaTest = ieta + deta;
int iphiTest = iphi + dphi;

Expand All @@ -135,6 +137,7 @@ void l1t::Stage2Layer2JetAlgorithmFirmwareImp1::create(const std::vector<l1t::Ca
// check jet mask and sum tower et
const CaloTower& towTest = CaloTools::getTower(towers, CaloTools::caloEta(ietaTest), iphiTest);
towEt = towTest.hwPt();
towDelay = (towTest.hwQual() & 0b0100) >> 2;

if (mask_[8 - (dphi + 4)][deta + 4] == 0)
continue;
Expand All @@ -145,8 +148,11 @@ void l1t::Stage2Layer2JetAlgorithmFirmwareImp1::create(const std::vector<l1t::Ca

if (vetoCandidate)
break;
else
else {
iEt += towEt;
if (abs(ieta) < 29 && abs(ietaTest) < 29)
iDelay += towDelay; // don't include HF feature bits in HBHE flagged jets
}
}
if (vetoCandidate)
break;
Expand Down Expand Up @@ -239,6 +245,8 @@ void l1t::Stage2Layer2JetAlgorithmFirmwareImp1::create(const std::vector<l1t::Ca
iEt = CaloTools::kSatJet;

jet.setHwPt(iEt);
if (iDelay >= 2)
jet.setHwQual(1);
jet.setRawEt((short int)rawEt);
jet.setSeedEt((short int)seedEt);
jet.setTowerIEta((short int)caloEta);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ namespace L1Analysis {
jetIEt.clear();
jetIEta.clear();
jetIPhi.clear();
jetHwQual.clear();
jetBx.clear();
jetTowerIPhi.clear();
jetTowerIEta.clear();
Expand Down Expand Up @@ -184,6 +185,7 @@ namespace L1Analysis {
std::vector<short int> jetIEt;
std::vector<short int> jetIEta;
std::vector<short int> jetIPhi;
std::vector<short int> jetHwQual;
std::vector<short int> jetBx;
std::vector<short int> jetTowerIPhi;
std::vector<short int> jetTowerIEta;
Expand Down
1 change: 1 addition & 0 deletions L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ void L1Analysis::L1AnalysisL1Upgrade::SetJet(const edm::Handle<l1t::JetBxCollect
l1upgrade_.jetIEt.push_back(it->hwPt());
l1upgrade_.jetIEta.push_back(it->hwEta());
l1upgrade_.jetIPhi.push_back(it->hwPhi());
l1upgrade_.jetHwQual.push_back(it->hwQual());
l1upgrade_.jetBx.push_back(ibx);
l1upgrade_.jetRawEt.push_back(it->rawEt());
l1upgrade_.jetSeedEt.push_back(it->seedEt());
Expand Down
2 changes: 1 addition & 1 deletion SimCalorimetry/HcalTrigPrimAlgos/src/HcalFinegrainBit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ std::bitset<6> HcalFinegrainBit::compute(const HcalFinegrainBit::TowerTDC& tower
1; // deep layers, 3+. If bit13 = 1, energy in deep layers. Require ADC > 0 to ensure valid hit in cell
}

// very delayed (100000), slightly delayed (010000), prompt (001000), 2 reserved bits (000110), depth flag (000001)
// very delayed (001000), slightly delayed (000100), prompt (000010), depth flag (000001), 2 reserved bits (110000)
if (DeepEnergy > 0 && EarlyEnergy == 0)
result[0] = true; // 000001
else
Expand Down

0 comments on commit 988e293

Please sign in to comment.