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

L1 MHT and forward jet fixes (74X backport of #11676) #11678

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions L1Trigger/L1TCalorimeter/src/JetFinderMethods.cc
Expand Up @@ -144,6 +144,19 @@ namespace l1t {
if(forward)
jetQual |= 0x2;

// check for input overflow regions
if(forward && regionET == 255) {
jetET = 1023; // 10 bit max
} else if(!forward && regionET == 1023) {
jetET = 1023; // 10 bit max
} else if(region->hwEta() == 17) {
if(neighborNE_et == 255 || neighborE_et == 255 || neighborSE_et == 255)
jetET = 1023; // 10 bit max
} else if(region->hwEta() == 4) {
if(neighborNW_et == 255 || neighborW_et == 255 || neighborSW_et == 255)
jetET = 1023; // 10 bit max
}

ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > jetLorentz(0,0,0,0);
l1t::Jet theJet(*&jetLorentz, jetET, jetEta, jetPhi, jetQual);
//l1t::Jet theJet(0, jetET, jetEta, jetPhi);
Expand Down
4 changes: 4 additions & 0 deletions L1Trigger/L1TCalorimeter/src/PUSubtractionMethods.cc
Expand Up @@ -124,6 +124,10 @@ namespace l1t {
//std::cout << "eta: " << regionEta << " pusub: " << puSub << std::endl;

int regionEtCorr = std::max(0, regionET - puSub);
if(regionET == 1023)
regionEtCorr = 1023; // do not subtract overflow regions
if((regionET==255) && (regionEta < 4 || regionEta > 17))
regionEtCorr = 255;

ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > lorentz(0,0,0,0);
CaloRegion newSubRegion(*&lorentz, 0, 0, regionEtCorr, regionEta, regionPhi, notCorrectedRegion->hwQual(), notCorrectedRegion->hwEtEm(), notCorrectedRegion->hwEtHad());
Expand Down
Expand Up @@ -63,6 +63,26 @@ void l1t::Stage1Layer2EtSumAlgorithmImpHW::processEvent(const std::vector<l1t::C
std::vector<SimpleRegion> regionEtVect;
std::vector<SimpleRegion> regionHtVect;

// check the un-subtracted regions for overflow
bool regionOverflowEt(false);
bool regionOverflowHt(false);
for (auto& region : regions) {
if(region.hwEta() >= etSumEtaMinEt && region.hwEta() <= etSumEtaMaxEt)
{
if(region.hwPt() >= 1023)
{
regionOverflowEt = true;
}
}
if ( region.hwEta() >= etSumEtaMinHt && region.hwEta() <= etSumEtaMaxHt)
{
if(region.hwPt() >= 1023)
{
regionOverflowHt = true;
}
}
}

// hwPt() is the sum ET+HT in region, for stage 1 this will be
// the region sum input to MET algorithm
// In stage 2, we would move to hwEtEm() and hwEtHad() for separate MET/MHT
Expand Down Expand Up @@ -98,25 +118,25 @@ void l1t::Stage1Layer2EtSumAlgorithmImpHW::processEvent(const std::vector<l1t::C
int sumHT, MHT, iPhiHT;
std::tie(sumHT, MHT, iPhiHT) = doSumAndMET(regionHtVect, ETSumType::kHadronicSum);

//MHT is replaced with MHT/HT
uint16_t MHToHT=MHToverHT(MHT,sumHT);
//iPhiHt is replaced by the dPhi between two most energetic jets
iPhiHT = DiJetPhi(jets);

// Set quality (i.e. overflow) bits appropriately
int METqual = 0;
int MHTqual = 0;
int ETTqual = 0;
int HTTqual = 0;
if(MET >= 0xfff) // MET 12 bits
if(MET > 0xfff || regionOverflowEt) // MET 12 bits
METqual = 1;
if(MHT >= 0x7f) // MHT 7 bits
if(MHT > 0x7f || regionOverflowHt) // MHT 7 bits
MHTqual = 1;
if(sumET >= 0xfff)
if(sumET > 0xfff || regionOverflowEt)
ETTqual = 1;
if(sumHT >= 0xfff)
if(sumHT > 0xfff || regionOverflowHt)
HTTqual = 1;

MHT &= 127; // limit MHT to 7 bits as the firmware does, but only after checking for overflow.
//MHT is replaced with MHT/HT
uint16_t MHToHT=MHToverHT(MHT,sumHT);
//iPhiHt is replaced by the dPhi between two most energetic jets
iPhiHT = DiJetPhi(jets);

const ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > etLorentz(0,0,0,0);
l1t::EtSum etMiss(*&etLorentz,EtSum::EtSumType::kMissingEt,MET&0xfff,0,iPhiET,METqual);
Expand Down Expand Up @@ -171,16 +191,12 @@ l1t::Stage1Layer2EtSumAlgorithmImpHW::doSumAndMET(const std::vector<SimpleRegion
{
std::array<int, 18> sumEtaPos{};
std::array<int, 18> sumEtaNeg{};
bool inputOverflow(false);
for (const auto& r : regionEt)
{
if ( r.ieta < 11 )
sumEtaNeg[r.iphi] += r.et;
else
sumEtaPos[r.iphi] += r.et;

if ( r.et >= (1<<10) )
inputOverflow = true;
}

std::array<int, 18> sumEta{};
Expand All @@ -191,8 +207,6 @@ l1t::Stage1Layer2EtSumAlgorithmImpHW::doSumAndMET(const std::vector<SimpleRegion
sumEta[i] = sumEtaPos[i] + sumEtaNeg[i];
sumEt += sumEta[i];
}
sumEt = (sumEt % (1<<12)) | ((sumEt >= (1<<12) || inputOverflow) ? (1<<12):0);
assert(sumEt>=0 && sumEt < (1<<13));

// 0, 20, 40, 60, 80 degrees
std::array<int, 5> sumsForCos{};
Expand Down