From 768ecfd51f3cad5123658127e18382ce0bcb72f6 Mon Sep 17 00:00:00 2001 From: Ho-Fung Tsoi Date: Thu, 9 Feb 2023 12:20:04 -0500 Subject: [PATCH] HCAL Fb DQM monitoring at layer1 - test 12_6_3 --- .../interface/L1TStage2CaloLayer1.h | 31 +++- .../python/L1TStage2CaloLayer1_cfi.py | 1 + DQM/L1TMonitor/src/L1TStage2CaloLayer1.cc | 163 +++++++++++++----- 3 files changed, 150 insertions(+), 45 deletions(-) diff --git a/DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h b/DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h index adae620d75f8a..a42ecbe812e4b 100644 --- a/DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h +++ b/DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h @@ -27,6 +27,8 @@ #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "DataFormats/L1TCalorimeter/interface/CaloTower.h" + namespace ComparisonHelper { // Designed for edm::SortedCollection // Iterators should have a value type that derives from DetID, or @@ -108,15 +110,30 @@ namespace CaloL1Information { dqm::reco::MonitorElement *ecalOccNoMatch_; dqm::reco::MonitorElement *hcalOccEtDiscrepancy_; - dqm::reco::MonitorElement *hcalOccFbDiscrepancy_; - dqm::reco::MonitorElement *hcalOccFb2Discrepancy_; + dqm::reco::MonitorElement *hcalOccLLPFbDiscrepancy_; + dqm::reco::MonitorElement *hcalOccLLPFbExpd_; + dqm::reco::MonitorElement *hcalOccLLPFbData_; dqm::reco::MonitorElement *hcalOccLinkMasked_; dqm::reco::MonitorElement *hcalOccRecdEtWgt_; - dqm::reco::MonitorElement *hcalOccRecdFb_; - dqm::reco::MonitorElement *hcalOccRecdFb2_; + dqm::reco::MonitorElement *hcalOccFg0Discrepancy_; + dqm::reco::MonitorElement *hcalOccFg1Discrepancy_; + dqm::reco::MonitorElement *hcalOccFg2Discrepancy_; + dqm::reco::MonitorElement *hcalOccFg3Discrepancy_; + dqm::reco::MonitorElement *hcalOccFg4Discrepancy_; + dqm::reco::MonitorElement *hcalOccFg5Discrepancy_; + dqm::reco::MonitorElement *hcalOccRecdFg0_; + dqm::reco::MonitorElement *hcalOccRecdFg1_; + dqm::reco::MonitorElement *hcalOccRecdFg2_; + dqm::reco::MonitorElement *hcalOccRecdFg3_; + dqm::reco::MonitorElement *hcalOccRecdFg4_; + dqm::reco::MonitorElement *hcalOccRecdFg5_; dqm::reco::MonitorElement *hcalOccSentAndRecd_; - dqm::reco::MonitorElement *hcalOccSentFb_; - dqm::reco::MonitorElement *hcalOccSentFb2_; + dqm::reco::MonitorElement *hcalOccSentFg0_; + dqm::reco::MonitorElement *hcalOccSentFg1_; + dqm::reco::MonitorElement *hcalOccSentFg2_; + dqm::reco::MonitorElement *hcalOccSentFg3_; + dqm::reco::MonitorElement *hcalOccSentFg4_; + dqm::reco::MonitorElement *hcalOccSentFg5_; dqm::reco::MonitorElement *hcalOccSent_; dqm::reco::MonitorElement *hcalOccTowerMasked_; dqm::reco::MonitorElement *hcalTPRawEtCorrelationHBHE_; @@ -290,6 +307,8 @@ class L1TStage2CaloLayer1 std::string ecalTPSourceSentLabel_; edm::EDGetTokenT hcalTPSourceSent_; std::string hcalTPSourceSentLabel_; + edm::EDGetTokenT CaloTowerCollectionData_; + std::string CaloTowerCollectionDataLabel_; edm::EDGetTokenT fedRawData_; std::string histFolder_; int tpFillThreshold_; diff --git a/DQM/L1TMonitor/python/L1TStage2CaloLayer1_cfi.py b/DQM/L1TMonitor/python/L1TStage2CaloLayer1_cfi.py index 5b5a339402eba..b78434ac0e09d 100644 --- a/DQM/L1TMonitor/python/L1TStage2CaloLayer1_cfi.py +++ b/DQM/L1TMonitor/python/L1TStage2CaloLayer1_cfi.py @@ -11,6 +11,7 @@ hcalTPSourceRecd = cms.InputTag("caloLayer1Digis"), ecalTPSourceSent = cms.InputTag("ecalDigis","EcalTriggerPrimitives"), hcalTPSourceSent = cms.InputTag("hcalDigis"), + CaloTowerCollectionData = cms.InputTag("caloStage2Digis","CaloTower"), fedRawDataLabel = cms.InputTag("rawDataCollector"), histFolder = cms.string('L1T/L1TStage2CaloLayer1'), ignoreHFfb2 = cms.untracked.bool(False), diff --git a/DQM/L1TMonitor/src/L1TStage2CaloLayer1.cc b/DQM/L1TMonitor/src/L1TStage2CaloLayer1.cc index 9eceb47bd35e1..271a2df32ec53 100644 --- a/DQM/L1TMonitor/src/L1TStage2CaloLayer1.cc +++ b/DQM/L1TMonitor/src/L1TStage2CaloLayer1.cc @@ -19,6 +19,8 @@ #include "EventFilter/L1TXRawToDigi/interface/UCTDAQRawData.h" #include "EventFilter/L1TXRawToDigi/interface/UCTAMCRawData.h" +using namespace l1t; + L1TStage2CaloLayer1::L1TStage2CaloLayer1(const edm::ParameterSet& ps) : ecalTPSourceRecd_(consumes(ps.getParameter("ecalTPSourceRecd"))), ecalTPSourceRecdLabel_(ps.getParameter("ecalTPSourceRecd").label()), @@ -38,6 +40,8 @@ L1TStage2CaloLayer1::L1TStage2CaloLayer1(const edm::ParameterSet& ps) ecalTPSourceSentLabel_(ps.getParameter("ecalTPSourceSent").label()), hcalTPSourceSent_(consumes(ps.getParameter("hcalTPSourceSent"))), hcalTPSourceSentLabel_(ps.getParameter("hcalTPSourceSent").label()), + CaloTowerCollectionData_(consumes(ps.getParameter("CaloTowerCollectionData"))), + CaloTowerCollectionDataLabel_(ps.getParameter("CaloTowerCollectionData").label()), fedRawData_(consumes(ps.getParameter("fedRawDataLabel"))), histFolder_(ps.getParameter("histFolder")), tpFillThreshold_(ps.getUntrackedParameter("etDistributionsFillThreshold", 0)), @@ -292,6 +296,8 @@ void L1TStage2CaloLayer1::dqmAnalyze(const edm::Event& event, event.getByToken(hcalTPSourceSent_, hcalTPsSent); edm::Handle hcalTPsRecd; event.getByToken(hcalTPSourceRecd_, hcalTPsRecd); + edm::Handle caloTowerDataCol; + event.getByToken(CaloTowerCollectionData_, caloTowerDataCol); hcalTPSentRecd_.clear(); @@ -327,12 +333,6 @@ void L1TStage2CaloLayer1::dqmAnalyze(const edm::Event& event, eventMonitors.hcalTPRawEtSent_->Fill(sentTp.SOI_compressedEt()); eventMonitors.hcalOccSent_->Fill(ieta, iphi); } - if (sentTp.SOI_fineGrain() == 1) { - eventMonitors.hcalOccSentFb_->Fill(ieta, iphi); - } - if (sentTp.t0().fineGrain(1) == 1) { - eventMonitors.hcalOccSentFb2_->Fill(ieta, iphi); - } if (towerMasked || caloLayer1OutOfRun) { // Do not compare if we have a mask applied @@ -347,17 +347,100 @@ void L1TStage2CaloLayer1::dqmAnalyze(const edm::Event& event, continue; } + // HCAL LLP trigger feature bits monitoring + if (abs(ieta) < 29) { + // Input feature bits readout at uHTR vs. Layer1 + if (recdTp.SOI_fineGrain(0)) { + eventMonitors.hcalOccRecdFg0_->Fill(ieta, iphi); + } + if (recdTp.SOI_fineGrain(1)) { + eventMonitors.hcalOccRecdFg1_->Fill(ieta, iphi); + } + if (recdTp.SOI_fineGrain(2)) { + eventMonitors.hcalOccRecdFg2_->Fill(ieta, iphi); + } + if (recdTp.SOI_fineGrain(3)) { + eventMonitors.hcalOccRecdFg3_->Fill(ieta, iphi); + } + if (recdTp.SOI_fineGrain(4)) { + eventMonitors.hcalOccRecdFg4_->Fill(ieta, iphi); + } + if (recdTp.SOI_fineGrain(5)) { + eventMonitors.hcalOccRecdFg5_->Fill(ieta, iphi); + } + if (sentTp.SOI_fineGrain(0)) { + eventMonitors.hcalOccSentFg0_->Fill(ieta, iphi); + } + if (sentTp.SOI_fineGrain(1)) { + eventMonitors.hcalOccSentFg1_->Fill(ieta, iphi); + } + if (sentTp.SOI_fineGrain(2)) { + eventMonitors.hcalOccSentFg2_->Fill(ieta, iphi); + } + if (sentTp.SOI_fineGrain(3)) { + eventMonitors.hcalOccSentFg3_->Fill(ieta, iphi); + } + if (sentTp.SOI_fineGrain(4)) { + eventMonitors.hcalOccSentFg4_->Fill(ieta, iphi); + } + if (sentTp.SOI_fineGrain(5)) { + eventMonitors.hcalOccSentFg5_->Fill(ieta, iphi); + } + if (not (recdTp.SOI_fineGrain(0) == sentTp.SOI_fineGrain(0))) { + eventMonitors.hcalOccFg0Discrepancy_->Fill(ieta, iphi); + } + if (not (recdTp.SOI_fineGrain(1) == sentTp.SOI_fineGrain(1))) { + eventMonitors.hcalOccFg1Discrepancy_->Fill(ieta, iphi); + } + if (not (recdTp.SOI_fineGrain(2) == sentTp.SOI_fineGrain(2))) { + eventMonitors.hcalOccFg2Discrepancy_->Fill(ieta, iphi); + } + if (not (recdTp.SOI_fineGrain(3) == sentTp.SOI_fineGrain(3))) { + eventMonitors.hcalOccFg3Discrepancy_->Fill(ieta, iphi); + } + if (not (recdTp.SOI_fineGrain(4) == sentTp.SOI_fineGrain(4))) { + eventMonitors.hcalOccFg4Discrepancy_->Fill(ieta, iphi); + } + if (not (recdTp.SOI_fineGrain(5) == sentTp.SOI_fineGrain(5))) { + eventMonitors.hcalOccFg5Discrepancy_->Fill(ieta, iphi); + } + // Construct a 6-bit integer from the 6 fine grain bits at uHTR (will change to at Layer1 readout later) + uint64_t fg_bits = 0; + for (int index = 0; index < 6; index++) { + fg_bits |= sentTp.SOI_fineGrain(index) << index; + } + // Current 6:1 LUT in fw + const uint64_t HCalFbLUT = 0xAAAAAAAAAAAAAAAA; + // Expected feature bit output + const bool fb_Expd = (HCalFbLUT >> fg_bits) & 1; + // Actual feature bit output in data + uint32_t tower_hwqual = 0; + for (auto tower = caloTowerDataCol->begin(0); tower != caloTowerDataCol->end(0); ++tower) { + if (not (tower->hwEta() == ieta && tower->hwPhi() == iphi)) { + continue; + } + tower_hwqual = tower->hwQual(); + } + // CaloTower hwQual is 4-bit long, HCAL Fb is set at the 2nd bit (counting from 0) + const bool fb_Data = ((tower_hwqual & 0b0100) >> 2) & 1; + // Fill Fb Occ and compare between expected and data + if (fb_Expd) { + eventMonitors.hcalOccLLPFbExpd_->Fill(ieta, iphi); + } + if (fb_Data) { + eventMonitors.hcalOccLLPFbData_->Fill(ieta, iphi); + } + if (not (fb_Expd == fb_Data)) { + eventMonitors.hcalOccLLPFbDiscrepancy_->Fill(ieta, iphi); + } + } + + if (recdTp.SOI_compressedEt() > tpFillThreshold_) { eventMonitors.hcalTPRawEtRecd_->Fill(recdTp.SOI_compressedEt()); eventMonitors.hcalOccupancy_->Fill(ieta, iphi); eventMonitors.hcalOccRecdEtWgt_->Fill(ieta, iphi, recdTp.SOI_compressedEt()); } - if (recdTp.SOI_fineGrain()) { - eventMonitors.hcalOccRecdFb_->Fill(ieta, iphi); - } - if (recdTp.t0().fineGrain(1)) { - eventMonitors.hcalOccRecdFb2_->Fill(ieta, iphi); - } if (abs(ieta) > 29) { eventMonitors.hcalTPRawEtCorrelationHF_->Fill(sentTp.SOI_compressedEt(), recdTp.SOI_compressedEt()); @@ -366,15 +449,7 @@ void L1TStage2CaloLayer1::dqmAnalyze(const edm::Event& event, } const bool HetAgreement = sentTp.SOI_compressedEt() == recdTp.SOI_compressedEt(); - const bool Hfb1Agreement = (abs(ieta) < 29) ? true - : (recdTp.SOI_compressedEt() == 0 || - (sentTp.SOI_fineGrain() == recdTp.SOI_fineGrain()) || ignoreHFfbs_); - // Ignore minBias (FB2) bit if we receieve 0 ET, which means it is likely zero-suppressed on HCal readout side - const bool Hfb2Agreement = - (abs(ieta) < 29) - ? true - : (recdTp.SOI_compressedEt() == 0 || (sentTp.SOI_fineGrain(1) == recdTp.SOI_fineGrain(1)) || ignoreHFfbs_); - if (HetAgreement && Hfb1Agreement && Hfb2Agreement) { + if (HetAgreement) { // Full match if (sentTp.SOI_compressedEt() > tpFillThreshold_) { eventMonitors.hcalOccSentAndRecd_->Fill(ieta, iphi); @@ -404,16 +479,6 @@ void L1TStage2CaloLayer1::dqmAnalyze(const edm::Event& event, else eventMonitors.hcalOccNoMatch_->Fill(ieta, iphi); } - if (not Hfb1Agreement) { - // Handle fine grain discrepancies - eventMonitors.hcalOccFbDiscrepancy_->Fill(ieta, iphi); - updateMismatch(event, 3, streamCache(event.streamID())->streamMismatchList); - } - if (not Hfb2Agreement) { - // Handle fine grain discrepancies - eventMonitors.hcalOccFb2Discrepancy_->Fill(ieta, iphi); - updateMismatch(event, 3, streamCache(event.streamID())->streamMismatchList); - } } } @@ -555,16 +620,36 @@ void L1TStage2CaloLayer1::bookHistograms(DQMStore::IBooker& ibooker, ibooker.setCurrentFolder(histFolder_ + "/HCalDetail"); eventMonitors.hcalOccEtDiscrepancy_ = bookHcalOccupancy("hcalOccEtDiscrepancy", "HCal Et Discrepancy Occupancy"); - eventMonitors.hcalOccFbDiscrepancy_ = - bookHcalOccupancy("hcalOccFbDiscrepancy", "HCal Feature Bit Discrepancy Occupancy"); - eventMonitors.hcalOccFb2Discrepancy_ = - bookHcalOccupancy("hcalOccFb2Discrepancy", "HCal Second Feature Bit Discrepancy Occupancy"); + eventMonitors.hcalOccLLPFbDiscrepancy_ = + bookHcalOccupancy("hcalOccLLPFbDiscrepancy", "HCal LLP Feature Bit Discrepancy between Expected and Data"); + eventMonitors.hcalOccLLPFbExpd_ = bookHcalOccupancy("hcalOccLLPFbExpd", "HCal LLP Feature Bit Occupancy Expected"); + eventMonitors.hcalOccLLPFbData_ = bookHcalOccupancy("hcalOccLLPFbData", "HCal LLP Feature Bit Occupancy in Data"); + eventMonitors.hcalOccFg0Discrepancy_ = + bookHcalOccupancy("hcalOccFg0Discrepancy", "HCal Fine Grain 0 Discrepancy between uHTR and Layer1"); + eventMonitors.hcalOccFg1Discrepancy_ = + bookHcalOccupancy("hcalOccFg1Discrepancy", "HCal Fine Grain 1 Discrepancy between uHTR and Layer1"); + eventMonitors.hcalOccFg2Discrepancy_ = + bookHcalOccupancy("hcalOccFg2Discrepancy", "HCal Fine Grain 2 Discrepancy between uHTR and Layer1"); + eventMonitors.hcalOccFg3Discrepancy_ = + bookHcalOccupancy("hcalOccFg3Discrepancy", "HCal Fine Grain 3 Discrepancy between uHTR and Layer1"); + eventMonitors.hcalOccFg4Discrepancy_ = + bookHcalOccupancy("hcalOccFg4Discrepancy", "HCal Fine Grain 4 Discrepancy between uHTR and Layer1"); + eventMonitors.hcalOccFg5Discrepancy_ = + bookHcalOccupancy("hcalOccFg5Discrepancy", "HCal Fine Grain 5 Discrepancy between uHTR and Layer1"); + eventMonitors.hcalOccSentFg0_ = bookHcalOccupancy("hcalOccSentFg0", "HCal Fine Grain 0 Occupancy at uHTR"); + eventMonitors.hcalOccSentFg1_ = bookHcalOccupancy("hcalOccSentFg1", "HCal Fine Grain 1 Occupancy at uHTR"); + eventMonitors.hcalOccSentFg2_ = bookHcalOccupancy("hcalOccSentFg2", "HCal Fine Grain 2 Occupancy at uHTR"); + eventMonitors.hcalOccSentFg3_ = bookHcalOccupancy("hcalOccSentFg3", "HCal Fine Grain 3 Occupancy at uHTR"); + eventMonitors.hcalOccSentFg4_ = bookHcalOccupancy("hcalOccSentFg4", "HCal Fine Grain 4 Occupancy at uHTR"); + eventMonitors.hcalOccSentFg5_ = bookHcalOccupancy("hcalOccSentFg5", "HCal Fine Grain 5 Occupancy at uHTR"); + eventMonitors.hcalOccRecdFg0_ = bookHcalOccupancy("hcalOccRecdFg0", "HCal Fine Grain 0 Occupancy at Layer1"); + eventMonitors.hcalOccRecdFg1_ = bookHcalOccupancy("hcalOccRecdFg1", "HCal Fine Grain 1 Occupancy at Layer1"); + eventMonitors.hcalOccRecdFg2_ = bookHcalOccupancy("hcalOccRecdFg2", "HCal Fine Grain 2 Occupancy at Layer1"); + eventMonitors.hcalOccRecdFg3_ = bookHcalOccupancy("hcalOccRecdFg3", "HCal Fine Grain 3 Occupancy at Layer1"); + eventMonitors.hcalOccRecdFg4_ = bookHcalOccupancy("hcalOccRecdFg4", "HCal Fine Grain 4 Occupancy at Layer1"); + eventMonitors.hcalOccRecdFg5_ = bookHcalOccupancy("hcalOccRecdFg5", "HCal Fine Grain 5 Occupancy at Layer1"); eventMonitors.hcalOccLinkMasked_ = bookHcalOccupancy("hcalOccLinkMasked", "HCal Masked Links"); - eventMonitors.hcalOccRecdFb_ = bookHcalOccupancy("hcalOccRecdFb", "HCal Feature Bit Occupancy at Layer1"); - eventMonitors.hcalOccRecdFb2_ = bookHcalOccupancy("hcalOccRecdFb2", "HF Second Feature Bit Occupancy at Layer1"); eventMonitors.hcalOccSentAndRecd_ = bookHcalOccupancy("hcalOccSentAndRecd", "HCal TP Occupancy FULL MATCH"); - eventMonitors.hcalOccSentFb_ = bookHcalOccupancy("hcalOccSentFb", "HCal Feature Bit Occupancy at uHTR"); - eventMonitors.hcalOccSentFb2_ = bookHcalOccupancy("hcalOccSentFb2", "HF Second Feature Bit Occupancy at uHTR"); eventMonitors.hcalOccSent_ = bookHcalOccupancy("hcalOccSent", "HCal TP Occupancy at uHTR"); eventMonitors.hcalOccTowerMasked_ = bookHcalOccupancy("hcalOccTowerMasked", "HCal Masked towers"); eventMonitors.hcalTPRawEtCorrelationHBHE_ =