From 3bb72b0055b5be203450efa44cbff8ddc274f731 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Wed, 31 Jul 2024 12:10:43 +0200 Subject: [PATCH 1/8] Add L1TCaloLayer1Summary and necessary changes to emulator --- .../l1tstage2_dqm_sourceclient-live_cfg.py | 23 ++++ .../interface/L1TCaloLayer1Summary.h | 73 +++++++++++ .../python/L1TCaloLayer1Summary_cfi.py | 12 ++ DQM/L1TMonitor/python/L1TStage2_cff.py | 6 +- DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 119 ++++++++++++++++++ .../L1TCaloLayer1/plugins/L1TCaloSummary.cc | 2 +- .../python/simCaloStage2Layer1Summary_cfi.py | 3 +- 7 files changed, 235 insertions(+), 3 deletions(-) create mode 100644 DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h create mode 100644 DQM/L1TMonitor/python/L1TCaloLayer1Summary_cfi.py create mode 100644 DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc diff --git a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py index 0350ce6412c73..268fb1273e87f 100644 --- a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py @@ -177,6 +177,29 @@ process.dqmEndPath ) +#-------------------------------------------------- +# L1T Emulator +process.load('Configuration.StandardSequences.Services_cff') +process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.MagneticField_cff') +process.load('Configuration.StandardSequences.EndOfProcess_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') +process.load('L1Trigger.Configuration.SimL1Emulator_cff') +process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff') +process.load('EventFilter.L1TXRawToDigi.caloLayer1Stage2Digis_cfi') +process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff') +process.load('CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi') + +from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask +associatePatAlgosToolsTask(process) + +from L1Trigger.Configuration.customiseReEmul import L1TReEmulFromRAW +process = L1TReEmulFromRAW(process) + +process.simCaloStage2Layer1Summary.caloLayer1Regions = cms.InputTag("caloLayer1Digis", "") + #-------------------------------------------------- # Process Customizations diff --git a/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h b/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h new file mode 100644 index 0000000000000..99f2925b6b195 --- /dev/null +++ b/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h @@ -0,0 +1,73 @@ +// -*- C++ -*- +// +// Package: L1TMonitor/L1TCaloLayer1Summary +// Class: L1TCaloLayer1Summary +// +/**\class L1TCaloLayer1Summary L1TCaloLayer1Summary.cc Demo/L1TCaloLayer1Summary/plugins/L1TCaloLayer1Summary.cc + + Description: DQM Analyzer for CaloLayer1 regions and CICADAScore + + Implementation: + This module uses emulator sequence for CaloLayer1. +*/ +// +// Original Author: Max Zhao +// Created: 31 Jul 2024 +// +// + +// system include files +#include +#include + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" + +// user include files +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/one/EDAnalyzer.h" + +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/MakerMacros.h" + +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "DataFormats/L1CaloTrigger/interface/CICADA.h" +#include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h" +#include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" +#include "EventFilter/L1TXRawToDigi/interface/UCTDAQRawData.h" +#include "EventFilter/L1TXRawToDigi/interface/UCTAMCRawData.h" + +class L1TCaloLayer1Summary : public DQMEDAnalyzer { +public: + explicit L1TCaloLayer1Summary(const edm::ParameterSet&); + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + void analyze(const edm::Event&, const edm::EventSetup&) override; + void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override; + + // ----------member data --------------------------- + edm::EDGetTokenT caloLayer1CICADAScoreToken_; + edm::EDGetTokenT gtCICADAScoreToken_; + edm::EDGetTokenT simCICADAScoreToken_; + edm::EDGetTokenT caloLayer1RegionsToken_; + edm::EDGetTokenT simRegionsToken_; + edm::EDGetTokenT fedRawData_; + + dqm::reco::MonitorElement* histoCaloLayer1CICADAScore; + dqm::reco::MonitorElement* histoGtCICADAScore; + dqm::reco::MonitorElement* histoSimCICADAScore; + dqm::reco::MonitorElement* histoCaloMinusSim; + dqm::reco::MonitorElement* histoCaloMinusGt; + dqm::reco::MonitorElement* histoSlot7MinusDaqBxid; + dqm::reco::MonitorElement* histoCaloRegions; + dqm::reco::MonitorElement* histoSimRegions; + dqm::reco::MonitorElement* histoCaloMinusSimRegions; + + std::string histFolder_; +}; \ No newline at end of file diff --git a/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cfi.py b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cfi.py new file mode 100644 index 0000000000000..7e50633658ffb --- /dev/null +++ b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cfi.py @@ -0,0 +1,12 @@ +import FWCore.ParameterSet.Config as cms +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer + +l1tCaloLayer1Summary = DQMEDAnalyzer("L1TCaloLayer1Summary", + caloLayer1CICADAScore = cms.InputTag("caloLayer1Digis", "CICADAScore"), + gtCICADAScore = cms.InputTag("gtTestcrateStage2Digis", "CICADAScore"), + simCICADAScore = cms.InputTag("simCaloStage2Layer1Summary", "CICADAScore"), + caloLayer1Regions = cms.InputTag("caloLayer1Digis", ""), + simRegions = cms.InputTag("simCaloStage2Layer1Digis", ""), + fedRawDataLabel = cms.InputTag("rawDataCollector"), + histFolder = cms.string('L1T/L1TCaloLayer1Summary') +) \ No newline at end of file diff --git a/DQM/L1TMonitor/python/L1TStage2_cff.py b/DQM/L1TMonitor/python/L1TStage2_cff.py index 0d830856c7396..ab5df6654a6e3 100644 --- a/DQM/L1TMonitor/python/L1TStage2_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2_cff.py @@ -9,6 +9,9 @@ # CaloLayer2 from DQM.L1TMonitor.L1TStage2CaloLayer2_cfi import * +# CaloLayer1Summary +from DQM.L1TMonitor.L1TCaloLayer1Summary_cfi import * + # BMTF from DQM.L1TMonitor.L1TStage2BMTF_cff import * @@ -47,7 +50,8 @@ l1tStage2RegionalShower + l1tStage2uGMTOnlineDQMSeq + l1tObjectsTiming + - l1tStage2uGTOnlineDQMSeq + l1tStage2uGTOnlineDQMSeq + + l1tCaloLayer1Summary ) # sequence to run only for validation events diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc new file mode 100644 index 0000000000000..6dffa1124db15 --- /dev/null +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -0,0 +1,119 @@ +#include "DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h" + +L1TCaloLayer1Summary::L1TCaloLayer1Summary(const edm::ParameterSet& iConfig) + : caloLayer1CICADAScoreToken_(consumes(iConfig.getParameter("caloLayer1CICADAScore"))), + gtCICADAScoreToken_(consumes(iConfig.getParameter("gtCICADAScore"))), + simCICADAScoreToken_(consumes(iConfig.getParameter("simCICADAScore"))), + caloLayer1RegionsToken_(consumes(iConfig.getParameter("caloLayer1Regions"))), + simRegionsToken_(consumes(iConfig.getParameter("simRegions"))), + fedRawData_(consumes(iConfig.getParameter("fedRawDataLabel"))), + histFolder_(iConfig.getParameter("histFolder")) { +} + +// ------------ method called for each event ------------ +void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { + edm::Handle fedRawDataCollection; + iEvent.getByToken(fedRawData_, fedRawDataCollection); + if (fedRawDataCollection.isValid()) { + for (int iFed = 1354; iFed < 1360; iFed += 2) { + const FEDRawData& fedRawData = fedRawDataCollection->FEDData(iFed); + if (fedRawData.size() == 0) { + continue; + } + const uint64_t* fedRawDataArray = (const uint64_t*)fedRawData.data(); + UCTDAQRawData daqData(fedRawDataArray); + + if (daqData.nAMCs() == 7) { + UCTAMCRawData amcSlot7(daqData.amcPayload(3)); + if (amcSlot7.amcNo() != 7) { + std::cout << "Wrong AMC No: " << amcSlot7.amcNo() << std::endl; + } else { + histoSlot7MinusDaqBxid->Fill(amcSlot7.BXID() - daqData.BXID()); + } + } + } + } + + L1CaloRegionCollection caloLayer1Regions = iEvent.get(caloLayer1RegionsToken_); + L1CaloRegionCollection simRegions = iEvent.get(simRegionsToken_); + + bool foundMatrix[2][18][18] = {}; + int etMatrix[2][18][18] = {}; + + int nRegions = caloLayer1Regions.size(); + for (int iRegion = 0; iRegion < nRegions; iRegion++) { + L1CaloRegion cRegion = caloLayer1Regions[iRegion]; + L1CaloRegion sRegion = simRegions[iRegion]; + + foundMatrix[0][cRegion.gctEta()][cRegion.gctPhi()] = true; + etMatrix[0][cRegion.gctEta()][cRegion.gctPhi()] = cRegion.et(); + foundMatrix[1][sRegion.gctEta()][sRegion.gctPhi()] = true; + etMatrix[1][sRegion.gctEta()][sRegion.gctPhi()] = sRegion.et(); + } + int iRegion = 0; + for (int iEta = 0; iEta < 18; iEta++) { + for (int iPhi = 0; iPhi < 18; iPhi++) { + if (foundMatrix[0][iEta][iPhi] && foundMatrix[1][iEta][iPhi]) { + histoCaloRegions->Fill(iRegion, etMatrix[0][iEta][iPhi]); + histoSimRegions->Fill(iRegion, etMatrix[1][iEta][iPhi]); + histoCaloMinusSimRegions->Fill(iRegion, etMatrix[0][iEta][iPhi] - etMatrix[1][iEta][iPhi]); + iRegion++; + } + } + } + + float caloCICADAScore = iEvent.get(caloLayer1CICADAScoreToken_)[0]; + auto gtCICADAScores = iEvent.get(gtCICADAScoreToken_); + float simCICADAScore = iEvent.get(simCICADAScoreToken_)[0]; + + histoSimCICADAScore->Fill(simCICADAScore); + histoCaloMinusSim->Fill(caloCICADAScore - simCICADAScore); + + uint32_t bx0Idx; + if (gtCICADAScores.size() == 30) { + bx0Idx = 12; + } else if (gtCICADAScores.size() == 5) { + bx0Idx = 2; + } else { + bx0Idx = 2; + } + + histoCaloLayer1CICADAScore->Fill(caloCICADAScore); + histoGtCICADAScore->Fill(gtCICADAScores[bx0Idx]); + histoCaloMinusGt->Fill(gtCICADAScores[bx0Idx] - caloCICADAScore); +} + +void L1TCaloLayer1Summary::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) { + ibooker.setCurrentFolder(histFolder_); + histoSlot7MinusDaqBxid = ibooker.book1D("slot7BXID", "Slot 7- DAQ BXID", 50, -20, 20); + + ibooker.setCurrentFolder(histFolder_ + "/CICADAScore"); + histoCaloLayer1CICADAScore = ibooker.book1D("caloLayer1CICADAScore" , "CaloLayer1 CICADAScore" , 50 , 0 , 200 ); + histoGtCICADAScore = ibooker.book1D("gtCICADAScore" , "GT CICADAScore at BX0" , 50 , 0 , 200 ); + histoCaloMinusGt = ibooker.book1D("caloMinusGtCICADAScore" , "CaloLayer1 - GT CICADAScore at BX0", 50, -50, 50); + histoSimCICADAScore = ibooker.book1D("simCaloLayer1CICADAScore" , "simCaloLayer1 CICADAScore" , 50 , 0 , 200 ); + histoCaloMinusSim = ibooker.book1D("caloMinusSimCICADAScore" , "CaloLayer1 - simCaloLayer1 CICADAScore", 50, -50, 50); + + ibooker.setCurrentFolder(histFolder_ + "/Regions"); + histoCaloMinusSimRegions = ibooker.book2D("caloMinusSumRegions", "CaloLayer1 - simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, -400, 400); + histoCaloRegions = ibooker.book2D("caloLayer1Regions", "CaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, 0, 800); + histoSimRegions = ibooker.book2D("simCaloLayer1Regions", "simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, 0, 800); +} + +// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ +void L1TCaloLayer1Summary::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { + //The following says we do not know what parameters are allowed so do no validation + // Please change this to state exactly what you do use, even if it is no parameters + edm::ParameterSetDescription desc; + desc.setUnknown(); + descriptions.addDefault(desc); + + //Specify that only 'tracks' is allowed + //To use, remove the default given above and uncomment below + //edm::ParameterSetDescription desc; + //desc.addUntracked("tracks", edm::InputTag("ctfWithMaterialTracks")); + //descriptions.addWithDefaultLabel(desc); +} + +//define this as a plug-in +DEFINE_FWK_MODULE(L1TCaloLayer1Summary); \ No newline at end of file diff --git a/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc b/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc index 324a6f99a362a..c1914f9a318bb 100644 --- a/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc +++ b/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc @@ -141,7 +141,7 @@ L1TCaloSummary::L1TCaloSummary(const edm::ParameterSet& iConfig) boostedJetPtFactor(iConfig.getParameter("boostedJetPtFactor")), verbose(iConfig.getParameter("verbose")), fwVersion(iConfig.getParameter("firmwareVersion")), - regionToken(consumes(edm::InputTag("simCaloStage2Layer1Digis"))), + regionToken(consumes(iConfig.getParameter("caloLayer1Regions"))), loader(hls4mlEmulator::ModelLoader(iConfig.getParameter("CICADAModelVersion"))), overwriteWithTestPatterns(iConfig.getParameter("useTestPatterns")), testPatterns(iConfig.getParameter>("testPatterns")) { diff --git a/L1Trigger/L1TCaloLayer1/python/simCaloStage2Layer1Summary_cfi.py b/L1Trigger/L1TCaloLayer1/python/simCaloStage2Layer1Summary_cfi.py index 6ee4753fc5d73..b1a6617bac5be 100644 --- a/L1Trigger/L1TCaloLayer1/python/simCaloStage2Layer1Summary_cfi.py +++ b/L1Trigger/L1TCaloLayer1/python/simCaloStage2Layer1Summary_cfi.py @@ -52,5 +52,6 @@ firmwareVersion = cms.int32(1), CICADAModelVersion = cms.string("CICADAModel_v2p1p2"), useTestPatterns = cms.bool(False), - testPatterns = standardCICADATestPatterns + testPatterns = standardCICADATestPatterns, + caloLayer1Regions = cms.InputTag("simCaloStage2Layer1Digis", "") ) From 3d7afba1cd3eb2502f127733cbae8eba91ba25bf Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Wed, 31 Jul 2024 13:53:45 +0200 Subject: [PATCH 2/8] Code quality formatting --- DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 33 ++++++++++++---------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc index 6dffa1124db15..ee5abe0472d5a 100644 --- a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -1,14 +1,15 @@ #include "DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h" L1TCaloLayer1Summary::L1TCaloLayer1Summary(const edm::ParameterSet& iConfig) - : caloLayer1CICADAScoreToken_(consumes(iConfig.getParameter("caloLayer1CICADAScore"))), - gtCICADAScoreToken_(consumes(iConfig.getParameter("gtCICADAScore"))), - simCICADAScoreToken_(consumes(iConfig.getParameter("simCICADAScore"))), - caloLayer1RegionsToken_(consumes(iConfig.getParameter("caloLayer1Regions"))), - simRegionsToken_(consumes(iConfig.getParameter("simRegions"))), - fedRawData_(consumes(iConfig.getParameter("fedRawDataLabel"))), - histFolder_(iConfig.getParameter("histFolder")) { -} + : caloLayer1CICADAScoreToken_( + consumes(iConfig.getParameter("caloLayer1CICADAScore"))), + gtCICADAScoreToken_(consumes(iConfig.getParameter("gtCICADAScore"))), + simCICADAScoreToken_(consumes(iConfig.getParameter("simCICADAScore"))), + caloLayer1RegionsToken_( + consumes(iConfig.getParameter("caloLayer1Regions"))), + simRegionsToken_(consumes(iConfig.getParameter("simRegions"))), + fedRawData_(consumes(iConfig.getParameter("fedRawDataLabel"))), + histFolder_(iConfig.getParameter("histFolder")) {} // ------------ method called for each event ------------ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -88,16 +89,18 @@ void L1TCaloLayer1Summary::bookHistograms(DQMStore::IBooker& ibooker, edm::Run c histoSlot7MinusDaqBxid = ibooker.book1D("slot7BXID", "Slot 7- DAQ BXID", 50, -20, 20); ibooker.setCurrentFolder(histFolder_ + "/CICADAScore"); - histoCaloLayer1CICADAScore = ibooker.book1D("caloLayer1CICADAScore" , "CaloLayer1 CICADAScore" , 50 , 0 , 200 ); - histoGtCICADAScore = ibooker.book1D("gtCICADAScore" , "GT CICADAScore at BX0" , 50 , 0 , 200 ); - histoCaloMinusGt = ibooker.book1D("caloMinusGtCICADAScore" , "CaloLayer1 - GT CICADAScore at BX0", 50, -50, 50); - histoSimCICADAScore = ibooker.book1D("simCaloLayer1CICADAScore" , "simCaloLayer1 CICADAScore" , 50 , 0 , 200 ); - histoCaloMinusSim = ibooker.book1D("caloMinusSimCICADAScore" , "CaloLayer1 - simCaloLayer1 CICADAScore", 50, -50, 50); + histoCaloLayer1CICADAScore = ibooker.book1D("caloLayer1CICADAScore", "CaloLayer1 CICADAScore", 50, 0, 200); + histoGtCICADAScore = ibooker.book1D("gtCICADAScore", "GT CICADAScore at BX0", 50, 0, 200); + histoCaloMinusGt = ibooker.book1D("caloMinusGtCICADAScore", "CaloLayer1 - GT CICADAScore at BX0", 50, -50, 50); + histoSimCICADAScore = ibooker.book1D("simCaloLayer1CICADAScore", "simCaloLayer1 CICADAScore", 50, 0, 200); + histoCaloMinusSim = ibooker.book1D("caloMinusSimCICADAScore", "CaloLayer1 - simCaloLayer1 CICADAScore", 50, -50, 50); ibooker.setCurrentFolder(histFolder_ + "/Regions"); - histoCaloMinusSimRegions = ibooker.book2D("caloMinusSumRegions", "CaloLayer1 - simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, -400, 400); + histoCaloMinusSimRegions = ibooker.book2D( + "caloMinusSumRegions", "CaloLayer1 - simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, -400, 400); histoCaloRegions = ibooker.book2D("caloLayer1Regions", "CaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, 0, 800); - histoSimRegions = ibooker.book2D("simCaloLayer1Regions", "simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, 0, 800); + histoSimRegions = + ibooker.book2D("simCaloLayer1Regions", "simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, 0, 800); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ From 182848e88d0659d9a8333d6df64ab59e2ede020b Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Wed, 31 Jul 2024 16:02:18 +0200 Subject: [PATCH 3/8] Fixes for comments from mmusich --- .../interface/L1TCaloLayer1Summary.h | 1 + DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 56 +++++++++---------- 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h b/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h index 99f2925b6b195..bc11d45e7f9ac 100644 --- a/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h +++ b/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h @@ -40,6 +40,7 @@ #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h" #include "EventFilter/L1TXRawToDigi/interface/UCTDAQRawData.h" #include "EventFilter/L1TXRawToDigi/interface/UCTAMCRawData.h" +#include "DataFormats/FEDRawData/interface/FEDNumbering.h" class L1TCaloLayer1Summary : public DQMEDAnalyzer { public: diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc index ee5abe0472d5a..a65cfa174ee3e 100644 --- a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -16,7 +16,7 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet edm::Handle fedRawDataCollection; iEvent.getByToken(fedRawData_, fedRawDataCollection); if (fedRawDataCollection.isValid()) { - for (int iFed = 1354; iFed < 1360; iFed += 2) { + for (int iFed = FEDNumbering::MINRCTFEDID + 4; iFed < FEDNumbering::MAXRCTFEDID; iFed += 2) { const FEDRawData& fedRawData = fedRawDataCollection->FEDData(iFed); if (fedRawData.size() == 0) { continue; @@ -26,9 +26,7 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet if (daqData.nAMCs() == 7) { UCTAMCRawData amcSlot7(daqData.amcPayload(3)); - if (amcSlot7.amcNo() != 7) { - std::cout << "Wrong AMC No: " << amcSlot7.amcNo() << std::endl; - } else { + if (amcSlot7.amcNo() == 7) { histoSlot7MinusDaqBxid->Fill(amcSlot7.BXID() - daqData.BXID()); } } @@ -37,11 +35,18 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet L1CaloRegionCollection caloLayer1Regions = iEvent.get(caloLayer1RegionsToken_); L1CaloRegionCollection simRegions = iEvent.get(simRegionsToken_); + int nRegions = caloLayer1Regions.size(); - bool foundMatrix[2][18][18] = {}; - int etMatrix[2][18][18] = {}; + unsigned int maxEtaIdx = 0; + for (int iRegion = 0; iRegion < nRegions; iRegion++) { + if (maxEtaIdx < caloLayer1Regions[iRegion].gctEta()) { + maxEtaIdx = caloLayer1Regions[iRegion].gctEta(); + } + } + int matrixSize = maxEtaIdx + 1; - int nRegions = caloLayer1Regions.size(); + bool foundMatrix[2][matrixSize][matrixSize] = {}; + int etMatrix[2][matrixSize][matrixSize] = {}; for (int iRegion = 0; iRegion < nRegions; iRegion++) { L1CaloRegion cRegion = caloLayer1Regions[iRegion]; L1CaloRegion sRegion = simRegions[iRegion]; @@ -52,8 +57,8 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet etMatrix[1][sRegion.gctEta()][sRegion.gctPhi()] = sRegion.et(); } int iRegion = 0; - for (int iEta = 0; iEta < 18; iEta++) { - for (int iPhi = 0; iPhi < 18; iPhi++) { + for (int iEta = 0; iEta < matrixSize; iEta++) { + for (int iPhi = 0; iPhi < matrixSize; iPhi++) { if (foundMatrix[0][iEta][iPhi] && foundMatrix[1][iEta][iPhi]) { histoCaloRegions->Fill(iRegion, etMatrix[0][iEta][iPhi]); histoSimRegions->Fill(iRegion, etMatrix[1][iEta][iPhi]); @@ -69,19 +74,9 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet histoSimCICADAScore->Fill(simCICADAScore); histoCaloMinusSim->Fill(caloCICADAScore - simCICADAScore); - - uint32_t bx0Idx; - if (gtCICADAScores.size() == 30) { - bx0Idx = 12; - } else if (gtCICADAScores.size() == 5) { - bx0Idx = 2; - } else { - bx0Idx = 2; - } - histoCaloLayer1CICADAScore->Fill(caloCICADAScore); - histoGtCICADAScore->Fill(gtCICADAScores[bx0Idx]); - histoCaloMinusGt->Fill(gtCICADAScores[bx0Idx] - caloCICADAScore); + histoGtCICADAScore->Fill(gtCICADAScores.at(0, 0)); + histoCaloMinusGt->Fill(gtCICADAScores.at(0, 0) - caloCICADAScore); } void L1TCaloLayer1Summary::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) { @@ -105,17 +100,16 @@ void L1TCaloLayer1Summary::bookHistograms(DQMStore::IBooker& ibooker, edm::Run c // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ void L1TCaloLayer1Summary::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters + // l1tCaloLayer1Summary edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); - - //Specify that only 'tracks' is allowed - //To use, remove the default given above and uncomment below - //edm::ParameterSetDescription desc; - //desc.addUntracked("tracks", edm::InputTag("ctfWithMaterialTracks")); - //descriptions.addWithDefaultLabel(desc); + desc.add("caloLayer1CICADAScore", edm::InputTag("caloLayer1Digis", "CICADAScore")); + desc.add("gtCICADAScore", edm::InputTag("gtTestcrateStage2Digis", "CICADAScore")); + desc.add("simCICADAScore", edm::InputTag("simCaloStage2Layer1Summary", "CICADAScore")); + desc.add("caloLayer1Regions", edm::InputTag("caloLayer1Digis")); + desc.add("simRegions", edm::InputTag("simCaloStage2Layer1Digis")); + desc.add("fedRawDataLabel", edm::InputTag("rawDataCollector")); + desc.add("histFolder", "L1T/L1TCaloLayer1Summary"); + descriptions.add("l1tCaloLayer1Summary", desc); } //define this as a plug-in From 78802f4fa5b1fbea1a414ec2b11ede427daf2080 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Thu, 1 Aug 2024 12:02:27 +0200 Subject: [PATCH 4/8] Fixed variable size array Clang compilation bug --- DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc index a65cfa174ee3e..14d11bd99b7a8 100644 --- a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -45,8 +45,17 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet } int matrixSize = maxEtaIdx + 1; - bool foundMatrix[2][matrixSize][matrixSize] = {}; - int etMatrix[2][matrixSize][matrixSize] = {}; + bool foundMatrix[2][matrixSize][matrixSize]; + int etMatrix[2][matrixSize][matrixSize]; + for (int i = 0; i < 2; i++) { + for (int j = 0; j < matrixSize; j++) { + for (int k = 0; k < matrixSize; k++) { + foundMatrix[i][j][k] = false; + etMatrix[i][j][k] = 0; + } + } + } + for (int iRegion = 0; iRegion < nRegions; iRegion++) { L1CaloRegion cRegion = caloLayer1Regions[iRegion]; L1CaloRegion sRegion = simRegions[iRegion]; From 6833a35fdd1b06078212965147940bd67a213423 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Fri, 2 Aug 2024 13:58:05 +0200 Subject: [PATCH 5/8] Move emulator to its own cff --- .../l1tstage2_dqm_sourceclient-live_cfg.py | 23 ---- .../python/L1TCaloLayer1Summary_cff.py | 109 ++++++++++++++++++ DQM/L1TMonitor/python/L1TStage2_cff.py | 4 +- 3 files changed, 111 insertions(+), 25 deletions(-) create mode 100644 DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py diff --git a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py index 268fb1273e87f..0350ce6412c73 100644 --- a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py @@ -177,29 +177,6 @@ process.dqmEndPath ) -#-------------------------------------------------- -# L1T Emulator -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.EventContent.EventContent_cff') -process.load('Configuration.StandardSequences.MagneticField_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') -process.load('L1Trigger.Configuration.SimL1Emulator_cff') -process.load('L1Trigger.Configuration.CaloTriggerPrimitives_cff') -process.load('EventFilter.L1TXRawToDigi.caloLayer1Stage2Digis_cfi') -process.load('SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cff') -process.load('CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi') - -from PhysicsTools.PatAlgos.tools.helpers import associatePatAlgosToolsTask -associatePatAlgosToolsTask(process) - -from L1Trigger.Configuration.customiseReEmul import L1TReEmulFromRAW -process = L1TReEmulFromRAW(process) - -process.simCaloStage2Layer1Summary.caloLayer1Regions = cms.InputTag("caloLayer1Digis", "") - #-------------------------------------------------- # Process Customizations diff --git a/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py new file mode 100644 index 0000000000000..bab547cb3a93c --- /dev/null +++ b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py @@ -0,0 +1,109 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger +from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017 +from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM + +from L1Trigger.Configuration.SimL1Emulator_cff import * +from L1Trigger.Configuration.CaloTriggerPrimitives_cff import * +simEcalTriggerPrimitiveDigis.Label = 'ecalDigis' +simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag( + cms.InputTag('hcalDigis'), + cms.InputTag('hcalDigis') +) +simHcalTriggerPrimitiveDigis.inputUpgradeLabel = cms.VInputTag( + cms.InputTag('hcalDigis'), + cms.InputTag('hcalDigis') +) +simDtTriggerPrimitiveDigis.digiTag = cms.InputTag("muonDTDigis") +simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCComparatorDigi') +simCscTriggerPrimitiveDigis.CSCWireDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCWireDigi' ) +L1TReEmul = cms.Sequence(simEcalTriggerPrimitiveDigis * simHcalTriggerPrimitiveDigis * SimL1Emulator) + +from L1Trigger.L1TCaloLayer1.simCaloStage2Layer1Summary_cfi import simCaloStage2Layer1Summary as _simCaloStage2Layer1Summary +cicadaEmulFromDigis = _simCaloStage2Layer1Summary.clone(caloLayer1Regions = cms.InputTag("caloLayer1Digis", "")) +L1TReEmul.replace(simCaloStage2Layer1Summary, cicadaEmulFromDigis) + +# TwinMux +stage2L1Trigger.toModify(simTwinMuxDigis, + RPC_Source = 'rpcTwinMuxRawToDigi', + DTDigi_Source = 'twinMuxStage2Digis:PhIn', + DTThetaDigi_Source = 'twinMuxStage2Digis:ThIn' +) +# BMTF +stage2L1Trigger.toModify(simBmtfDigis, +DTDigi_Source = "simTwinMuxDigis", +DTDigi_Theta_Source = "bmtfDigis" +) +# KBMTF +stage2L1Trigger.toModify(simKBmtfStubs, +srcPhi = 'simTwinMuxDigis', +srcTheta = 'bmtfDigis' +) +# OMTF +stage2L1Trigger.toModify(simOmtfDigis, + srcRPC = 'muonRPCDigis', + srcCSC = 'csctfDigis', + srcDTPh = 'bmtfDigis', + srcDTTh = 'bmtfDigis' +) +# EMTF +stage2L1Trigger.toModify(simEmtfDigis, + CSCInput = 'emtfStage2Digis', + RPCInput = 'muonRPCDigis' +) +# Calo Layer1 +stage2L1Trigger.toModify(simCaloStage2Layer1Digis, + ecalToken = 'ecalDigis:EcalTriggerPrimitives', + hcalToken = 'hcalDigis:' +) + +(~stage2L1Trigger).toModify(simRctDigis, + ecalDigis = ['ecalDigis:EcalTriggerPrimitives'], + hcalDigis = ['hcalDigis:'] +) +(~stage2L1Trigger).toModify(simRpcTriggerDigis, label = 'muonRPCDigis') + +# if not hasattr(process, 'L1TReEmulPath'): +# process.L1TReEmulPath = cms.Path(process.L1TReEmul) +# process.schedule.append(process.L1TReEmulPath) + +stage2L1Trigger_2017.toModify(simOmtfDigis, + srcRPC = 'omtfStage2Digis', + srcCSC = 'omtfStage2Digis', + srcDTPh = 'omtfStage2Digis', + srcDTTh = 'omtfStage2Digis' +) + +stage2L1Trigger.toModify(simEmtfDigis, + CSCInput = cms.InputTag('emtfStage2Digis'), + RPCInput = cms.InputTag('muonRPCDigis'), + CPPFInput = cms.InputTag('emtfStage2Digis'), + GEMEnable = cms.bool(False), + GEMInput = cms.InputTag('muonGEMPadDigis'), + CPPFEnable = cms.bool(True), # Use CPPF-emulated clustered RPC hits from CPPF as the RPC hits +) + +run3_GEM.toModify(simMuonGEMPadDigis, + InputCollection = 'muonGEMDigis', +) + +run3_GEM.toModify(simTwinMuxDigis, + RPC_Source = 'rpcTwinMuxRawToDigi', + DTDigi_Source = 'simDtTriggerPrimitiveDigis', + DTThetaDigi_Source = 'simDtTriggerPrimitiveDigis' +) + +run3_GEM.toModify(simKBmtfStubs, + srcPhi = 'bmtfDigis', + srcTheta = 'bmtfDigis' +) + +run3_GEM.toModify(simBmtfDigis, + DTDigi_Source = 'bmtfDigis', + DTDigi_Theta_Source = 'bmtfDigis' +) + +from DQM.L1TMonitor.L1TCaloLayer1Summary_cfi import l1tCaloLayer1Summary as _l1tCaloLayer1Summary +l1tCaloLayer1Summary = _l1tCaloLayer1Summary.clone(simCICADAScore = cms.InputTag("cicadaEmulFromDigis", "CICADAScore")) +l1tCaloLayer1SummarySeq = cms.Sequence(L1TReEmul * l1tCaloLayer1Summary) \ No newline at end of file diff --git a/DQM/L1TMonitor/python/L1TStage2_cff.py b/DQM/L1TMonitor/python/L1TStage2_cff.py index ab5df6654a6e3..ef089869a4b5e 100644 --- a/DQM/L1TMonitor/python/L1TStage2_cff.py +++ b/DQM/L1TMonitor/python/L1TStage2_cff.py @@ -10,7 +10,7 @@ from DQM.L1TMonitor.L1TStage2CaloLayer2_cfi import * # CaloLayer1Summary -from DQM.L1TMonitor.L1TCaloLayer1Summary_cfi import * +from DQM.L1TMonitor.L1TCaloLayer1Summary_cff import * # BMTF from DQM.L1TMonitor.L1TStage2BMTF_cff import * @@ -51,7 +51,7 @@ l1tStage2uGMTOnlineDQMSeq + l1tObjectsTiming + l1tStage2uGTOnlineDQMSeq + - l1tCaloLayer1Summary + l1tCaloLayer1SummarySeq ) # sequence to run only for validation events From a065bd2268bd76486a72184eb1ad665d22d02014 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Sat, 10 Aug 2024 12:32:04 +0200 Subject: [PATCH 6/8] Moved module declaration to SealModule, added checking for empty region or empty CICADAScore --- DQM/L1TMonitor/plugins/SealModule.cc | 3 ++ DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 28 +++++++++++-------- .../L1TCaloLayer1/plugins/L1TCaloSummary.cc | 8 ++++++ 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/DQM/L1TMonitor/plugins/SealModule.cc b/DQM/L1TMonitor/plugins/SealModule.cc index 0d5311f961517..38f2e1a69283e 100644 --- a/DQM/L1TMonitor/plugins/SealModule.cc +++ b/DQM/L1TMonitor/plugins/SealModule.cc @@ -27,6 +27,9 @@ DEFINE_FWK_MODULE(L1TGMT); #include "DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h" DEFINE_FWK_MODULE(L1TStage2CaloLayer1); +#include "DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h" +DEFINE_FWK_MODULE(L1TCaloLayer1Summary); + #include "DQM/L1TMonitor/interface/L1TStage2CaloLayer2.h" DEFINE_FWK_MODULE(L1TStage2CaloLayer2); diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc index 14d11bd99b7a8..686e183820d99 100644 --- a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -9,7 +9,8 @@ L1TCaloLayer1Summary::L1TCaloLayer1Summary(const edm::ParameterSet& iConfig) consumes(iConfig.getParameter("caloLayer1Regions"))), simRegionsToken_(consumes(iConfig.getParameter("simRegions"))), fedRawData_(consumes(iConfig.getParameter("fedRawDataLabel"))), - histFolder_(iConfig.getParameter("histFolder")) {} + histFolder_(iConfig.getParameter("histFolder")) { +} // ------------ method called for each event ------------ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { @@ -77,15 +78,21 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet } } - float caloCICADAScore = iEvent.get(caloLayer1CICADAScoreToken_)[0]; + auto caloCICADAScores = iEvent.get(caloLayer1CICADAScoreToken_); auto gtCICADAScores = iEvent.get(gtCICADAScoreToken_); - float simCICADAScore = iEvent.get(simCICADAScoreToken_)[0]; + auto simCICADAScores = iEvent.get(simCICADAScoreToken_); - histoSimCICADAScore->Fill(simCICADAScore); - histoCaloMinusSim->Fill(caloCICADAScore - simCICADAScore); - histoCaloLayer1CICADAScore->Fill(caloCICADAScore); - histoGtCICADAScore->Fill(gtCICADAScores.at(0, 0)); - histoCaloMinusGt->Fill(gtCICADAScores.at(0, 0) - caloCICADAScore); + if (caloCICADAScores.size() > 0) { + histoCaloLayer1CICADAScore->Fill(caloCICADAScores[0]); + if (gtCICADAScores.size() > 0) { + histoGtCICADAScore->Fill(gtCICADAScores.at(0, 0)); + histoCaloMinusGt->Fill(caloCICADAScores[0] - gtCICADAScores.at(0, 0)); + } + if (simCICADAScores.size() > 0) { + histoSimCICADAScore->Fill(simCICADAScores[0]); + histoCaloMinusSim->Fill(caloCICADAScores[0] - simCICADAScores[0]); + } + } } void L1TCaloLayer1Summary::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) { @@ -119,7 +126,4 @@ void L1TCaloLayer1Summary::fillDescriptions(edm::ConfigurationDescriptions& desc desc.add("fedRawDataLabel", edm::InputTag("rawDataCollector")); desc.add("histFolder", "L1T/L1TCaloLayer1Summary"); descriptions.add("l1tCaloLayer1Summary", desc); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(L1TCaloLayer1Summary); \ No newline at end of file +} \ No newline at end of file diff --git a/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc b/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc index c1914f9a318bb..b5a72290406dd 100644 --- a/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc +++ b/L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc @@ -107,6 +107,7 @@ class L1TCaloSummary : public edm::stream::EDProducer<> { int fwVersion; edm::EDGetTokenT regionToken; + edm::EDGetTokenT backupRegionToken; UCTLayer1* layer1; @@ -142,6 +143,7 @@ L1TCaloSummary::L1TCaloSummary(const edm::ParameterSet& iConfig) verbose(iConfig.getParameter("verbose")), fwVersion(iConfig.getParameter("firmwareVersion")), regionToken(consumes(iConfig.getParameter("caloLayer1Regions"))), + backupRegionToken(consumes(edm::InputTag("simCaloStage2Layer1Digis"))), loader(hls4mlEmulator::ModelLoader(iConfig.getParameter("CICADAModelVersion"))), overwriteWithTestPatterns(iConfig.getParameter("useTestPatterns")), testPatterns(iConfig.getParameter>("testPatterns")) { @@ -198,6 +200,12 @@ void L1TCaloSummary::produce(edm::Event& iEvent, const edm::Event if (!iEvent.getByToken(regionToken, regionCollection)) edm::LogError("L1TCaloSummary") << "UCT: Failed to get regions from region collection!"; iEvent.getByToken(regionToken, regionCollection); + + if (regionCollection->size() == 0) { + iEvent.getByToken(backupRegionToken, regionCollection); + edm::LogWarning("L1TCaloSummary") << "Switched to emulated regions since data regions was empty.\n"; + } + //Model input //This is done as a flat vector input, but future versions may involve 2D input //This will have to be handled later From 274119ffeb0ea441c2b5786c20e9e012ba4f8c37 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Sat, 10 Aug 2024 13:00:03 +0200 Subject: [PATCH 7/8] code checks fix --- DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc index 686e183820d99..a9b8da939bec2 100644 --- a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -9,8 +9,7 @@ L1TCaloLayer1Summary::L1TCaloLayer1Summary(const edm::ParameterSet& iConfig) consumes(iConfig.getParameter("caloLayer1Regions"))), simRegionsToken_(consumes(iConfig.getParameter("simRegions"))), fedRawData_(consumes(iConfig.getParameter("fedRawDataLabel"))), - histFolder_(iConfig.getParameter("histFolder")) { -} + histFolder_(iConfig.getParameter("histFolder")) {} // ------------ method called for each event ------------ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { From 83fe29e6564bdbc638d6e4e35e81dd1b54855866 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Tue, 27 Aug 2024 05:28:44 +0200 Subject: [PATCH 8/8] Changes for L1 concerns about emulator sequence and plot titles --- .../python/L1TCaloLayer1Summary_cff.py | 101 ++---------------- DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 27 +++-- 2 files changed, 28 insertions(+), 100 deletions(-) diff --git a/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py index bab547cb3a93c..551c4aa1c9295 100644 --- a/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py +++ b/DQM/L1TMonitor/python/L1TCaloLayer1Summary_cff.py @@ -1,10 +1,5 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger -from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017 -from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM - -from L1Trigger.Configuration.SimL1Emulator_cff import * from L1Trigger.Configuration.CaloTriggerPrimitives_cff import * simEcalTriggerPrimitiveDigis.Label = 'ecalDigis' simHcalTriggerPrimitiveDigis.inputLabel = cms.VInputTag( @@ -15,95 +10,13 @@ cms.InputTag('hcalDigis'), cms.InputTag('hcalDigis') ) -simDtTriggerPrimitiveDigis.digiTag = cms.InputTag("muonDTDigis") -simCscTriggerPrimitiveDigis.CSCComparatorDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCComparatorDigi') -simCscTriggerPrimitiveDigis.CSCWireDigiProducer = cms.InputTag( 'muonCSCDigis', 'MuonCSCWireDigi' ) -L1TReEmul = cms.Sequence(simEcalTriggerPrimitiveDigis * simHcalTriggerPrimitiveDigis * SimL1Emulator) - -from L1Trigger.L1TCaloLayer1.simCaloStage2Layer1Summary_cfi import simCaloStage2Layer1Summary as _simCaloStage2Layer1Summary -cicadaEmulFromDigis = _simCaloStage2Layer1Summary.clone(caloLayer1Regions = cms.InputTag("caloLayer1Digis", "")) -L1TReEmul.replace(simCaloStage2Layer1Summary, cicadaEmulFromDigis) - -# TwinMux -stage2L1Trigger.toModify(simTwinMuxDigis, - RPC_Source = 'rpcTwinMuxRawToDigi', - DTDigi_Source = 'twinMuxStage2Digis:PhIn', - DTThetaDigi_Source = 'twinMuxStage2Digis:ThIn' -) -# BMTF -stage2L1Trigger.toModify(simBmtfDigis, -DTDigi_Source = "simTwinMuxDigis", -DTDigi_Theta_Source = "bmtfDigis" -) -# KBMTF -stage2L1Trigger.toModify(simKBmtfStubs, -srcPhi = 'simTwinMuxDigis', -srcTheta = 'bmtfDigis' -) -# OMTF -stage2L1Trigger.toModify(simOmtfDigis, - srcRPC = 'muonRPCDigis', - srcCSC = 'csctfDigis', - srcDTPh = 'bmtfDigis', - srcDTTh = 'bmtfDigis' -) -# EMTF -stage2L1Trigger.toModify(simEmtfDigis, - CSCInput = 'emtfStage2Digis', - RPCInput = 'muonRPCDigis' -) -# Calo Layer1 -stage2L1Trigger.toModify(simCaloStage2Layer1Digis, - ecalToken = 'ecalDigis:EcalTriggerPrimitives', - hcalToken = 'hcalDigis:' -) - -(~stage2L1Trigger).toModify(simRctDigis, - ecalDigis = ['ecalDigis:EcalTriggerPrimitives'], - hcalDigis = ['hcalDigis:'] -) -(~stage2L1Trigger).toModify(simRpcTriggerDigis, label = 'muonRPCDigis') -# if not hasattr(process, 'L1TReEmulPath'): -# process.L1TReEmulPath = cms.Path(process.L1TReEmul) -# process.schedule.append(process.L1TReEmulPath) +from L1Trigger.L1TCaloLayer1.simCaloStage2Layer1Summary_cfi import * +from L1Trigger.L1TCaloLayer1.simCaloStage2Layer1Digis_cfi import * +from DQM.L1TMonitor.L1TCaloLayer1Summary_cfi import * -stage2L1Trigger_2017.toModify(simOmtfDigis, - srcRPC = 'omtfStage2Digis', - srcCSC = 'omtfStage2Digis', - srcDTPh = 'omtfStage2Digis', - srcDTTh = 'omtfStage2Digis' -) - -stage2L1Trigger.toModify(simEmtfDigis, - CSCInput = cms.InputTag('emtfStage2Digis'), - RPCInput = cms.InputTag('muonRPCDigis'), - CPPFInput = cms.InputTag('emtfStage2Digis'), - GEMEnable = cms.bool(False), - GEMInput = cms.InputTag('muonGEMPadDigis'), - CPPFEnable = cms.bool(True), # Use CPPF-emulated clustered RPC hits from CPPF as the RPC hits -) - -run3_GEM.toModify(simMuonGEMPadDigis, - InputCollection = 'muonGEMDigis', -) - -run3_GEM.toModify(simTwinMuxDigis, - RPC_Source = 'rpcTwinMuxRawToDigi', - DTDigi_Source = 'simDtTriggerPrimitiveDigis', - DTThetaDigi_Source = 'simDtTriggerPrimitiveDigis' -) - -run3_GEM.toModify(simKBmtfStubs, - srcPhi = 'bmtfDigis', - srcTheta = 'bmtfDigis' -) - -run3_GEM.toModify(simBmtfDigis, - DTDigi_Source = 'bmtfDigis', - DTDigi_Theta_Source = 'bmtfDigis' -) +simCaloStage2Layer1Summary.caloLayer1Regions = cms.InputTag("caloLayer1Digis", "") +simCaloStage2Layer1Digis.ecalToken = cms.InputTag("ecalDigis", "EcalTriggerPrimitives") +simCaloStage2Layer1Digis.hcalToken = cms.InputTag("hcalDigis", "") -from DQM.L1TMonitor.L1TCaloLayer1Summary_cfi import l1tCaloLayer1Summary as _l1tCaloLayer1Summary -l1tCaloLayer1Summary = _l1tCaloLayer1Summary.clone(simCICADAScore = cms.InputTag("cicadaEmulFromDigis", "CICADAScore")) -l1tCaloLayer1SummarySeq = cms.Sequence(L1TReEmul * l1tCaloLayer1Summary) \ No newline at end of file +l1tCaloLayer1SummarySeq = cms.Sequence(simEcalTriggerPrimitiveDigis * simHcalTriggerPrimitiveDigis * simCaloStage2Layer1Digis * simCaloStage2Layer1Summary * l1tCaloLayer1Summary) \ No newline at end of file diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc index a9b8da939bec2..30955ee3ffb9b 100644 --- a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -102,15 +102,30 @@ void L1TCaloLayer1Summary::bookHistograms(DQMStore::IBooker& ibooker, edm::Run c histoCaloLayer1CICADAScore = ibooker.book1D("caloLayer1CICADAScore", "CaloLayer1 CICADAScore", 50, 0, 200); histoGtCICADAScore = ibooker.book1D("gtCICADAScore", "GT CICADAScore at BX0", 50, 0, 200); histoCaloMinusGt = ibooker.book1D("caloMinusGtCICADAScore", "CaloLayer1 - GT CICADAScore at BX0", 50, -50, 50); - histoSimCICADAScore = ibooker.book1D("simCaloLayer1CICADAScore", "simCaloLayer1 CICADAScore", 50, 0, 200); - histoCaloMinusSim = ibooker.book1D("caloMinusSimCICADAScore", "CaloLayer1 - simCaloLayer1 CICADAScore", 50, -50, 50); + histoSimCICADAScore = + ibooker.book1D("simCaloLayer1CICADAScore", "simCaloLayer1 CICADAScore (input: DAQ regions)", 50, 0, 200); + histoCaloMinusSim = ibooker.book1D( + "caloMinusSimCICADAScore", "CaloLayer1 - simCaloLayer1 (input: DAQ regions) CICADAScore", 50, -50, 50); ibooker.setCurrentFolder(histFolder_ + "/Regions"); - histoCaloMinusSimRegions = ibooker.book2D( - "caloMinusSumRegions", "CaloLayer1 - simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, -400, 400); + histoCaloMinusSimRegions = + ibooker.book2D("caloMinusSumRegions", + "CaloLayer1 - simCaloLayer1 (input: DAQ trigger primatives) Regions;Region;ET Difference", + 252, + -0.5, + 252.5, + 100, + -400, + 400); histoCaloRegions = ibooker.book2D("caloLayer1Regions", "CaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, 0, 800); - histoSimRegions = - ibooker.book2D("simCaloLayer1Regions", "simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 100, 0, 800); + histoSimRegions = ibooker.book2D("simCaloLayer1Regions", + "simCaloLayer1 Regions (input: DAQ trigger primatives);Region;ET", + 252, + -0.5, + 252.5, + 100, + 0, + 800); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------