From 232aece3ff931840556241793f82f9990a892416 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Mon, 29 Jul 2024 19:32:40 +0200 Subject: [PATCH 01/33] Implemented L1TCaloLayer1Summary, without l1stage2... --- .../interface/L1TCaloLayer1Summary.h | 79 ++++++++++ .../python/L1TCaloLayer1Summary_cfi.py | 12 ++ DQM/L1TMonitor/python/L1TStage2_cff.py | 6 +- DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 143 ++++++++++++++++++ 4 files changed, 239 insertions(+), 1 deletion(-) 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/L1TMonitor/interface/L1TCaloLayer1Summary.h b/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h new file mode 100644 index 0000000000000..8cfeb40818c96 --- /dev/null +++ b/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h @@ -0,0 +1,79 @@ +// -*- C++ -*- +// +// Package: L1TMonitor/L1TCaloLayer1Summary +// Class: L1TCaloLayer1Summary +// +/**\class L1TCaloLayer1Summary L1TCaloLayer1Summary.cc Demo/L1TCaloLayer1Summary/plugins/L1TCaloLayer1Summary.cc + + Description: [one line class summary] + + Implementation: + [Notes on implementation] +*/ +// +// Original Author: Max Zhao +// Created: Wed, 10 Jul 2024 08:52:01 GMT +// +// + +// 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&); + ~L1TCaloLayer1Summary() override; + + static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); + +private: + // void beginJob() override; + void analyze(const edm::Event&, const edm::EventSetup&) override; + void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override; + // void endJob() 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; + + // dqm::reco::MonitorElement* bigVectors[30]; + // dqm::reco::MonitorElement* bigVectorsMinus[30]; + + 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..e4011c8ec0d41 --- /dev/null +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -0,0 +1,143 @@ +#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")) { + // edm::Service fs; + // histoCaloLayer1CICADAScore = fs->make("CICADAScore" , "CICADAScore" , 50 , 0 , 200 ); +} + +L1TCaloLayer1Summary::~L1TCaloLayer1Summary() { + // do anything here that needs to be done at desctruction time + // (e.g. close files, deallocate resources etc.) + // + // please remove this method altogether if it would be left empty +} + +// +// member functions +// + +// ------------ 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()); + } + } + } + } else { + std::cout << "FED Invalid" << std::endl; + } + + 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]; + // std::cout << caloRegion.gctEta() << "\t" << simRegion.gctEta() << "\t" << caloRegion.gctPhi() << "\t" << simRegion.gctPhi() << std::endl; + + 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 { + std::cout << "nGtScores = " << gtCICADAScores.size() << std::endl; + bx0Idx = 2; + } + + histoCaloLayer1CICADAScore->Fill(caloCICADAScore); + histoGtCICADAScore->Fill(gtCICADAScores[bx0Idx]); + histoCaloMinusGt->Fill(gtCICADAScores[bx0Idx] - caloCICADAScore); + +#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE + // if the SetupData is always needed + auto setup = iSetup.getData(setupToken_); + // if need the ESHandle to check if the SetupData was there or not + auto pSetup = iSetup.getHandle(setupToken_); +#endif +} + +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", "CaloLayer 1 - simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 150, -400, 400); + histoCaloRegions = ibooker.book2D("caloLayer1Regions", "CaloLayer 1 Regions;Region;ET", 252, -0.5, 252.5, 150, 0, 800); + histoSimRegions = ibooker.book2D("simCaloLayer1Regions", "simCaloLayer 1 Regions;Region;ET", 252, -0.5, 252.5, 150, 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); From 125fe5b15c56a56fe9bda8d770a7a23dc2a12a7d Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Wed, 31 Jul 2024 16:38:08 +0200 Subject: [PATCH 02/33] get files ready for backport PR --- .../l1tstage2_dqm_sourceclient-live_cfg.py | 24 ++++ .../interface/L1TCaloLayer1Summary.h | 13 +- DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 117 +++++++----------- .../L1TCaloLayer1/plugins/L1TCaloSummary.cc | 2 +- .../python/simCaloStage2Layer1Summary_cfi.py | 3 +- 5 files changed, 76 insertions(+), 83 deletions(-) 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..85c5e4e733a6a 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,30 @@ 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 index 8cfeb40818c96..bc11d45e7f9ac 100644 --- a/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h +++ b/DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h @@ -5,14 +5,14 @@ // /**\class L1TCaloLayer1Summary L1TCaloLayer1Summary.cc Demo/L1TCaloLayer1Summary/plugins/L1TCaloLayer1Summary.cc - Description: [one line class summary] + Description: DQM Analyzer for CaloLayer1 regions and CICADAScore Implementation: - [Notes on implementation] + This module uses emulator sequence for CaloLayer1. */ // // Original Author: Max Zhao -// Created: Wed, 10 Jul 2024 08:52:01 GMT +// Created: 31 Jul 2024 // // @@ -40,19 +40,17 @@ #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: explicit L1TCaloLayer1Summary(const edm::ParameterSet&); - ~L1TCaloLayer1Summary() override; static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); private: - // void beginJob() override; void analyze(const edm::Event&, const edm::EventSetup&) override; void bookHistograms(DQMStore::IBooker&, const edm::Run&, const edm::EventSetup&) override; - // void endJob() override; // ----------member data --------------------------- edm::EDGetTokenT caloLayer1CICADAScoreToken_; @@ -72,8 +70,5 @@ class L1TCaloLayer1Summary : public DQMEDAnalyzer { dqm::reco::MonitorElement* histoSimRegions; dqm::reco::MonitorElement* histoCaloMinusSimRegions; - // dqm::reco::MonitorElement* bigVectors[30]; - // dqm::reco::MonitorElement* bigVectorsMinus[30]; - std::string histFolder_; }; \ No newline at end of file diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc index e4011c8ec0d41..a65cfa174ee3e 100644 --- a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -1,34 +1,22 @@ #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")) { - // edm::Service fs; - // histoCaloLayer1CICADAScore = fs->make("CICADAScore" , "CICADAScore" , 50 , 0 , 200 ); -} - -L1TCaloLayer1Summary::~L1TCaloLayer1Summary() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) - // - // please remove this method altogether if it would be left empty -} - -// -// member functions -// + : 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) { + for (int iFed = FEDNumbering::MINRCTFEDID + 4; iFed < FEDNumbering::MAXRCTFEDID; iFed += 2) { const FEDRawData& fedRawData = fedRawDataCollection->FEDData(iFed); if (fedRawData.size() == 0) { continue; @@ -38,28 +26,30 @@ 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()); } } } - } else { - std::cout << "FED Invalid" << std::endl; } 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]; - // std::cout << caloRegion.gctEta() << "\t" << simRegion.gctEta() << "\t" << caloRegion.gctPhi() << "\t" << simRegion.gctPhi() << std::endl; foundMatrix[0][cRegion.gctEta()][cRegion.gctPhi()] = true; etMatrix[0][cRegion.gctEta()][cRegion.gctPhi()] = cRegion.et(); @@ -67,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]); @@ -84,27 +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 { - std::cout << "nGtScores = " << gtCICADAScores.size() << std::endl; - bx0Idx = 2; - } - histoCaloLayer1CICADAScore->Fill(caloCICADAScore); - histoGtCICADAScore->Fill(gtCICADAScores[bx0Idx]); - histoCaloMinusGt->Fill(gtCICADAScores[bx0Idx] - caloCICADAScore); - -#ifdef THIS_IS_AN_EVENTSETUP_EXAMPLE - // if the SetupData is always needed - auto setup = iSetup.getData(setupToken_); - // if need the ESHandle to check if the SetupData was there or not - auto pSetup = iSetup.getHandle(setupToken_); -#endif + 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&) { @@ -112,32 +84,33 @@ 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", "CaloLayer 1 - simCaloLayer1 Regions;Region;ET", 252, -0.5, 252.5, 150, -400, 400); - histoCaloRegions = ibooker.book2D("caloLayer1Regions", "CaloLayer 1 Regions;Region;ET", 252, -0.5, 252.5, 150, 0, 800); - histoSimRegions = ibooker.book2D("simCaloLayer1Regions", "simCaloLayer 1 Regions;Region;ET", 252, -0.5, 252.5, 150, 0, 800); + 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 + // 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 -DEFINE_FWK_MODULE(L1TCaloLayer1Summary); +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 11cf3c2cbb1a7277227ea97c4b91bc19042b2497 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Thu, 1 Aug 2024 12:03:11 +0200 Subject: [PATCH 03/33] Fixed variable size array Clang comp 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..0f96c7cb3aa19 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 b9ec5bc4cc2d3b5d8714c57cf17cb7047cccdeb7 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Fri, 2 Aug 2024 13:54:13 +0200 Subject: [PATCH 04/33] Moved emulator to its own cff file --- .../l1tstage2_dqm_sourceclient-live_cfg.py | 24 ---- .../python/L1TCaloLayer1Summary_cff.py | 109 ++++++++++++++++++ DQM/L1TMonitor/python/L1TStage2_cff.py | 4 +- DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc | 2 +- 4 files changed, 112 insertions(+), 27 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 85c5e4e733a6a..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,30 +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 diff --git a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc index 0f96c7cb3aa19..14d11bd99b7a8 100644 --- a/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc +++ b/DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc @@ -55,7 +55,7 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet } } } - + for (int iRegion = 0; iRegion < nRegions; iRegion++) { L1CaloRegion cRegion = caloLayer1Regions[iRegion]; L1CaloRegion sRegion = simRegions[iRegion]; From 7f2cf67455594573ca31dbe7d71fa350628425d9 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Sat, 10 Aug 2024 12:32:18 +0200 Subject: [PATCH 05/33] 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 ebaf50c8a22f095731844d9ce17f188ce4bc97a6 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Sat, 10 Aug 2024 13:00:56 +0200 Subject: [PATCH 06/33] 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 f489d68037490026677b5f3042ec5a88bb183081 Mon Sep 17 00:00:00 2001 From: Seungjin Yang Date: Fri, 16 Aug 2024 13:50:50 +0900 Subject: [PATCH 07/33] Update validation for RPC hit reconstruction see https://github.com/cms-sw/cmssw/pull/45626 for more details --- .../RPCRecHits/interface/RPCRecHitValid.h | 9 +- Validation/RPCRecHits/src/RPCRecHitValid.cc | 216 +----------------- .../RPCRecHits/src/RPCRecHitValidClient.cc | 28 +-- 3 files changed, 19 insertions(+), 234 deletions(-) diff --git a/Validation/RPCRecHits/interface/RPCRecHitValid.h b/Validation/RPCRecHits/interface/RPCRecHitValid.h index 8626702e705c1..dda68eac540a9 100644 --- a/Validation/RPCRecHits/interface/RPCRecHitValid.h +++ b/Validation/RPCRecHits/interface/RPCRecHitValid.h @@ -62,17 +62,12 @@ class RPCRecHitValid : public DQMEDAnalyzer { MEP h_recoMuonBarrel_phi, h_recoMuonOverlap_phi, h_recoMuonEndcap_phi, h_recoMuonNoRPC_phi; MEP h_simParticleType, h_simParticleTypeBarrel, h_simParticleTypeEndcap; - MEP h_refPunchOccupancyBarrel_wheel, h_refPunchOccupancyEndcap_disk, h_refPunchOccupancyBarrel_station; - MEP h_refPunchOccupancyBarrel_wheel_station, h_refPunchOccupancyEndcap_disk_ring; - MEP h_recPunchOccupancyBarrel_wheel, h_recPunchOccupancyEndcap_disk, h_recPunchOccupancyBarrel_station; - MEP h_recPunchOccupancyBarrel_wheel_station, h_recPunchOccupancyEndcap_disk_ring; - MEP h_matchOccupancyBarrel_detId; MEP h_matchOccupancyEndcap_detId; MEP h_refOccupancyBarrel_detId; MEP h_refOccupancyEndcap_detId; - MEP h_noiseOccupancyBarrel_detId; - MEP h_noiseOccupancyEndcap_detId; + MEP h_allOccupancyBarrel_detId; + MEP h_allOccupancyEndcap_detId; MEP h_rollAreaBarrel_detId; MEP h_rollAreaEndcap_detId; diff --git a/Validation/RPCRecHits/src/RPCRecHitValid.cc b/Validation/RPCRecHits/src/RPCRecHitValid.cc index ee74e775dcbab..a82bd2c38ed08 100644 --- a/Validation/RPCRecHits/src/RPCRecHitValid.cc +++ b/Validation/RPCRecHits/src/RPCRecHitValid.cc @@ -1,4 +1,3 @@ -#include "FWCore/Framework/interface/MakerMacros.h" #include "Validation/RPCRecHits/interface/RPCRecHitValid.h" #include "FWCore/Framework/interface/ESHandle.h" @@ -166,85 +165,6 @@ void RPCRecHitValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &r } h_eventCount->Fill(3); - h_refPunchOccupancyBarrel_wheel = - booker.book1D("RefPunchOccupancyBarrel_wheel", "RefPunchthrough occupancy", 5, -2.5, 2.5); - h_refPunchOccupancyEndcap_disk = - booker.book1D("RefPunchOccupancyEndcap_disk", "RefPunchthrough occupancy", 9, -4.5, 4.5); - h_refPunchOccupancyBarrel_station = - booker.book1D("RefPunchOccupancyBarrel_station", "RefPunchthrough occupancy", 4, 0.5, 4.5); - h_recPunchOccupancyBarrel_wheel = - booker.book1D("RecPunchOccupancyBarrel_wheel", "Punchthrough recHit occupancy", 5, -2.5, 2.5); - h_recPunchOccupancyEndcap_disk = - booker.book1D("RecPunchOccupancyEndcap_disk", "Punchthrough recHit occupancy", 9, -4.5, 4.5); - h_recPunchOccupancyBarrel_station = - booker.book1D("RecPunchOccupancyBarrel_station", "Punchthrough recHit occupancy", 4, 0.5, 4.5); - - h_refPunchOccupancyBarrel_wheel->getTH1()->SetMinimum(0); - h_refPunchOccupancyEndcap_disk->getTH1()->SetMinimum(0); - h_refPunchOccupancyBarrel_station->getTH1()->SetMinimum(0); - h_recPunchOccupancyBarrel_wheel->getTH1()->SetMinimum(0); - h_recPunchOccupancyEndcap_disk->getTH1()->SetMinimum(0); - h_recPunchOccupancyBarrel_station->getTH1()->SetMinimum(0); - - h_refPunchOccupancyBarrel_wheel_station = - booker.book2D("RefPunchOccupancyBarrel_wheel_station", "RefPunchthrough occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5); - h_refPunchOccupancyEndcap_disk_ring = - booker.book2D("RefPunchOccupancyEndcap_disk_ring", "RefPunchthrough occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5); - h_recPunchOccupancyBarrel_wheel_station = booker.book2D( - "RecPunchOccupancyBarrel_wheel_station", "Punchthrough recHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5); - h_recPunchOccupancyEndcap_disk_ring = - booker.book2D("RecPunchOccupancyEndcap_disk_ring", "Punchthrough recHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5); - - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ"); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetOption("COLZ"); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ"); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetOption("COLZ"); - - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetContour(10); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetContour(10); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetContour(10); - - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(false); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetStats(false); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetStats(false); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetStats(false); - - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->SetMinimum(0); - - for (int i = 1; i <= 5; ++i) { - TString binLabel = Form("Wheel %d", i - 3); - h_refPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyBarrel_wheel->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel); - } - - for (int i = 1; i <= 9; ++i) { - TString binLabel = Form("Disk %d", i - 5); - h_refPunchOccupancyEndcap_disk->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyEndcap_disk->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel); - } - - for (int i = 1; i <= 4; ++i) { - TString binLabel = Form("Station %d", i); - h_refPunchOccupancyBarrel_station->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_refPunchOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyBarrel_station->getTH1()->GetXaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel); - } - - for (int i = 1; i <= 4; ++i) { - TString binLabel = Form("Ring %d", i); - h_refPunchOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel); - h_recPunchOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel); - } - // Book roll-by-roll histograms auto rpcGeom = eventSetup.getHandle(rpcGeomTokenInRun_); @@ -299,17 +219,17 @@ void RPCRecHitValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &r nRPCRollEndcap, 0, nRPCRollEndcap); - h_noiseOccupancyBarrel_detId = booker.book1D( - "NoiseOccupancyBarrel_detId", "Noise occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel); - h_noiseOccupancyEndcap_detId = booker.book1D( - "NoiseOccupancyEndcap_detId", "Noise occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap); + h_allOccupancyBarrel_detId = booker.book1D( + "OccupancyBarrel_detId", "Occupancy;roll index (can be arbitrary)", nRPCRollBarrel, 0, nRPCRollBarrel); + h_allOccupancyEndcap_detId = booker.book1D( + "OccupancyEndcap_detId", "Occupancy;roll index (can be arbitrary)", nRPCRollEndcap, 0, nRPCRollEndcap); h_matchOccupancyBarrel_detId->getTH1()->SetMinimum(0); h_matchOccupancyEndcap_detId->getTH1()->SetMinimum(0); h_refOccupancyBarrel_detId->getTH1()->SetMinimum(0); h_refOccupancyEndcap_detId->getTH1()->SetMinimum(0); - h_noiseOccupancyBarrel_detId->getTH1()->SetMinimum(0); - h_noiseOccupancyEndcap_detId->getTH1()->SetMinimum(0); + h_allOccupancyBarrel_detId->getTH1()->SetMinimum(0); + h_allOccupancyEndcap_detId->getTH1()->SetMinimum(0); h_rollAreaBarrel_detId = booker.bookProfile( "RollAreaBarrel_detId", "Roll area;roll index;Area", nRPCRollBarrel, 0., 1. * nRPCRollBarrel, 0., 1e5); @@ -461,8 +381,6 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve h_simMuonNoRPC_eta->Fill(simParticle->eta()); h_simMuonNoRPC_phi->Fill(simParticle->phi()); } - } else { - pthrSimHits.insert(pthrSimHits.end(), simHitsFromParticle.begin(), simHitsFromParticle.end()); } if (hasRPCHit) { @@ -533,34 +451,6 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve } } - // Loop over punch-through simHits, fill histograms which does not need - // associations - for (const auto &simHit : pthrSimHits) { - const RPCDetId detId = static_cast(simHit->detUnitId()); - const RPCRoll *roll = dynamic_cast(rpcGeom->roll(detId())); - - const int region = roll->id().region(); - const int ring = roll->id().ring(); - // const int sector = roll->id().sector(); - const int station = roll->id().station(); - // const int layer = roll->id().layer(); - // const int subSector = roll->id().subsector(); - - if (region == 0) { - ++nRefHitBarrel; - h_refPunchOccupancyBarrel_wheel->Fill(ring); - h_refPunchOccupancyBarrel_station->Fill(station); - h_refPunchOccupancyBarrel_wheel_station->Fill(ring, station); - - h_refOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[simHit->detUnitId()]); - } else { - ++nRefHitEndcap; - h_refPunchOccupancyEndcap_disk->Fill(region * station); - h_refPunchOccupancyEndcap_disk_ring->Fill(region * station, ring); - - h_refOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[simHit->detUnitId()]); - } - } h_.nRefHitBarrel->Fill(nRefHitBarrel); h_.nRefHitEndcap->Fill(nRefHitEndcap); @@ -592,6 +482,8 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve h_.recHitOccupancyBarrel_station->Fill(station); h_.recHitOccupancyBarrel_wheel_station->Fill(ring, station); + h_allOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[detId.rawId()]); + h_.timeBarrel->Fill(time); } else { ++nRecHitEndcap; @@ -600,6 +492,8 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve h_.recHitOccupancyEndcap_disk->Fill(region * station); h_.recHitOccupancyEndcap_disk_ring->Fill(region * station, ring); + h_allOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[detId.rawId()]); + h_.timeEndcap->Fill(time); } @@ -766,96 +660,8 @@ void RPCRecHitValid::analyze(const edm::Event &event, const edm::EventSetup &eve } } - // Find Non-muon hits - for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) { - const RPCDetId detId = static_cast(recHitIter->rpcId()); - const RPCRoll *roll = dynamic_cast(rpcGeom->roll(detId)); - - const int region = roll->id().region(); - const int ring = roll->id().ring(); - // const int sector = roll->id().sector(); - const int station = roll->id().station(); - // const int layer = roll->id().layer(); - // const int subsector = roll->id().subsector(); - - bool matched = false; - for (const auto &match : simToRecHitMap) { - if (recHitIter == match.second) { - matched = true; - break; - } - } - - if (!matched) { - int nPunchMatched = 0; - // Check if this recHit came from non-muon simHit - for (const auto &simHit : pthrSimHits) { - const int absSimHitPType = abs(simHit->particleType()); - if (absSimHitPType == 13) - continue; - - const RPCDetId simDetId = static_cast(simHit->detUnitId()); - if (simDetId == detId) - ++nPunchMatched; - } - - if (nPunchMatched > 0) { - if (region == 0) { - h_recPunchOccupancyBarrel_wheel->Fill(ring); - h_recPunchOccupancyBarrel_station->Fill(station); - h_recPunchOccupancyBarrel_wheel_station->Fill(ring, station); - } else { - h_recPunchOccupancyEndcap_disk->Fill(region * station); - h_recPunchOccupancyEndcap_disk_ring->Fill(region * station, ring); - } - } - } - } - - // Find noise recHits : RecHits without SimHit match - for (RecHitIter recHitIter = recHitHandle->begin(); recHitIter != recHitHandle->end(); ++recHitIter) { - const RPCDetId recDetId = static_cast(recHitIter->rpcId()); - const RPCRoll *roll = dynamic_cast(rpcGeom->roll(recDetId)); - - const int region = roll->id().region(); - // const int ring = roll->id().ring(); // UNUSED VARIABLE - // const int sector = roll->id().sector(); - // const int station = roll->id().station(); // UNUSED VARIABLE - // const int layer = roll->id().layer(); - // const int subsector = roll->id().subsector(); - - const double recX = recHitIter->localPosition().x(); - const double recErrX = sqrt(recHitIter->localPositionError().xx()); - - bool matched = false; - for (SimHitIter simHitIter = simHitHandle->begin(); simHitIter != simHitHandle->end(); ++simHitIter) { - const RPCDetId simDetId = static_cast(simHitIter->detUnitId()); - const RPCRoll *simRoll = dynamic_cast(rpcGeom->roll(simDetId)); - if (!simRoll) - continue; - - if (simDetId != recDetId) - continue; - - const double simX = simHitIter->localPosition().x(); - const double dX = fabs(recX - simX); - - if (dX / recErrX < 5) { - matched = true; - break; - } - } - - if (!matched) { - if (region == 0) { - h_noiseOccupancyBarrel_detId->Fill(detIdToIndexMapBarrel_[recDetId.rawId()]); - } else { - h_noiseOccupancyEndcap_detId->Fill(detIdToIndexMapEndcap_[recDetId.rawId()]); - } - } - } - h_eventCount->Fill(2); } +#include "FWCore/Framework/interface/MakerMacros.h" DEFINE_FWK_MODULE(RPCRecHitValid); diff --git a/Validation/RPCRecHits/src/RPCRecHitValidClient.cc b/Validation/RPCRecHits/src/RPCRecHitValidClient.cc index bd5d47d99822f..7c699f5ff3df2 100644 --- a/Validation/RPCRecHits/src/RPCRecHitValidClient.cc +++ b/Validation/RPCRecHits/src/RPCRecHitValidClient.cc @@ -19,18 +19,6 @@ void RPCRecHitValidClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGette booker.book1D("RollEfficiencyBarrel_eff", "Roll efficiency in Barrel;Efficiency [%]", 50 + 2, -2, 100 + 2); MEP me_rollEfficiencyEndcap_eff = booker.book1D("RollEfficiencyEndcap_eff", "Roll efficiency in Endcap;Efficiency [%]", 50 + 2, -2, 100 + 2); - MEP me_rollEfficiencyStatCutOffBarrel_eff = - booker.book1D("RollEfficiencyCutOffBarrel_eff", - "Roll efficiency in Barrel without low stat chamber;Efficiency [%]", - 50 + 2, - -2, - 100 + 2); - MEP me_rollEfficiencyStatCutOffEndcap_eff = - booker.book1D("RollEfficiencyCutOffEndcap_eff", - "Roll efficiency in Endcap without low stat chamber;Efficiency [%]", - 50 + 2, - -2, - 100 + 2); const double maxNoise = 1e-7; MEP me_rollNoiseBarrel_noise = booker.book1D("RollNoiseBarrel_noise", @@ -60,8 +48,6 @@ void RPCRecHitValidClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGette const double eff = nRef ? nRec / nRef * 100 : -1; me_rollEfficiencyBarrel_eff->Fill(eff); - if (nRef >= 20) - me_rollEfficiencyStatCutOffBarrel_eff->Fill(eff); } } @@ -76,17 +62,15 @@ void RPCRecHitValidClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGette const double eff = nRef ? nRec / nRef * 100 : -1; me_rollEfficiencyEndcap_eff->Fill(eff); - if (nRef >= 20) - me_rollEfficiencyStatCutOffEndcap_eff->Fill(eff); } } MEP me_eventCount = getter.get(subDir_ + "/Occupancy/EventCount"); const double nEvent = me_eventCount ? me_eventCount->getTH1()->GetBinContent(1) : 1; - MEP me_noiseOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/NoiseOccupancyBarrel_detId"); + MEP me_allOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/OccupancyBarrel_detId"); MEP me_rollAreaBarrel_detId = getter.get(subDir_ + "/Occupancy/RollAreaBarrel_detId"); - if (me_noiseOccupancyBarrel_detId and me_rollAreaBarrel_detId) { - TH1 *h_noiseOccupancyBarrel_detId = me_noiseOccupancyBarrel_detId->getTH1(); + if (me_allOccupancyBarrel_detId and me_rollAreaBarrel_detId) { + TH1 *h_noiseOccupancyBarrel_detId = me_allOccupancyBarrel_detId->getTH1(); TH1 *h_rollAreaBarrel_detId = me_rollAreaBarrel_detId->getTH1(); for (int bin = 1, nBin = h_noiseOccupancyBarrel_detId->GetNbinsX(); bin <= nBin; ++bin) { @@ -100,10 +84,10 @@ void RPCRecHitValidClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGette } } - MEP me_noiseOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/NoiseOccupancyEndcap_detId"); + MEP me_allOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/OccupancyEndcap_detId"); MEP me_rollAreaEndcap_detId = getter.get(subDir_ + "/Occupancy/RollAreaEndcap_detId"); - if (me_noiseOccupancyEndcap_detId and me_rollAreaEndcap_detId) { - TH1 *h_noiseOccupancyEndcap_detId = me_noiseOccupancyEndcap_detId->getTH1(); + if (me_allOccupancyEndcap_detId and me_rollAreaEndcap_detId) { + TH1 *h_noiseOccupancyEndcap_detId = me_allOccupancyEndcap_detId->getTH1(); TH1 *h_rollAreaEndcap_detId = me_rollAreaEndcap_detId->getTH1(); for (int bin = 1, nBin = h_noiseOccupancyEndcap_detId->GetNbinsX(); bin <= nBin; ++bin) { From d34dfe7443c02454abf6ebeb802630ae8109c039 Mon Sep 17 00:00:00 2001 From: Deniz Sunar Cerci Date: Tue, 20 Aug 2024 16:09:06 +0200 Subject: [PATCH 08/33] Change from mod60 to mod10 for Bad Quality Events histogram and Bad CapID rotation histogram --- DQM/HcalTasks/data/HcalQualityTests.xml | 19 +++++++++++++- DQM/HcalTasks/interface/DigiTask.h | 2 +- DQM/HcalTasks/interface/RawTask.h | 7 ++--- DQM/HcalTasks/plugins/DigiTask.cc | 16 ++++++------ DQM/HcalTasks/plugins/RawTask.cc | 34 ++++++++++++++++++++++--- 5 files changed, 62 insertions(+), 16 deletions(-) diff --git a/DQM/HcalTasks/data/HcalQualityTests.xml b/DQM/HcalTasks/data/HcalQualityTests.xml index 1e72797cb84e5..c39d2df08e6de 100644 --- a/DQM/HcalTasks/data/HcalQualityTests.xml +++ b/DQM/HcalTasks/data/HcalQualityTests.xml @@ -30,4 +30,21 @@ BadCapIDThreshold - \ No newline at end of file + + ContentsWithinExpected + 1.0 + 1.0 + -1.0 + 0.0 + 0.0 + 0.0 + -1.0 + 0 + 1 + + + BadQualityThreshold + + + + diff --git a/DQM/HcalTasks/interface/DigiTask.h b/DQM/HcalTasks/interface/DigiTask.h index e13f532ee5a15..e2664eb15c3ee 100644 --- a/DQM/HcalTasks/interface/DigiTask.h +++ b/DQM/HcalTasks/interface/DigiTask.h @@ -169,7 +169,7 @@ class DigiTask : public hcaldqm::DQTask { hcaldqm::ContainerSingle2D _cCapidMinusBXmod4_CrateSlotuTCA[4]; // CrateSlot 2D histograms for each (capid-BX)%4 hcaldqm::ContainerSingle2D _cCapid_BadvsFEDvsLS; hcaldqm::ContainerSingle2D - _cCapid_BadvsFEDvsLSmod60; // Same as _cCapid_BadvsFEDvsLS, but only for last 50 LSes (for sound alarm turning off when problem goes away) + _cCapid_BadvsFEDvsLSmod10; // Same as _cCapid_BadvsFEDvsLS, but only for last 50 LSes (for sound alarm turning off when problem goes away) // #events counters MonitorElement *meNumEvents1LS; // to transfer the #events to harvesting diff --git a/DQM/HcalTasks/interface/RawTask.h b/DQM/HcalTasks/interface/RawTask.h index 99b35969afdf6..fe994a5538518 100644 --- a/DQM/HcalTasks/interface/RawTask.h +++ b/DQM/HcalTasks/interface/RawTask.h @@ -51,7 +51,7 @@ class RawTask : public hcaldqm::DQTask { // physics vs calib processing switch bool _calibProcessing; int _thresh_calib_nbadq; - + int _NBadQEvent; // vector of HcalElectronicsId for FEDs std::vector _vhashFEDs; @@ -75,8 +75,9 @@ class RawTask : public hcaldqm::DQTask { hcaldqm::Container2D _cOrnMsm_ElectronicsuTCA; hcaldqm::ContainerXXX _xEvnMsmLS, _xBcnMsmLS, _xOrnMsmLS, _xBadQLS; - hcaldqm::Container2D _cSummaryvsLS_FED; // online only - hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only + hcaldqm::Container2D _cSummaryvsLS_FED; // online only + hcaldqm::ContainerSingle2D _cSummaryvsLS; // online only + hcaldqm::ContainerSingle2D _cBadQ_FEDvsLSmod10; // online only }; #endif diff --git a/DQM/HcalTasks/plugins/DigiTask.cc b/DQM/HcalTasks/plugins/DigiTask.cc index 7b9daa4e19052..69bede7bd69db 100644 --- a/DQM/HcalTasks/plugins/DigiTask.cc +++ b/DQM/HcalTasks/plugins/DigiTask.cc @@ -459,9 +459,9 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), 0); - _cCapid_BadvsFEDvsLSmod60.initialize(_name, + _cCapid_BadvsFEDvsLSmod10.initialize(_name, "CapID", - new hcaldqm::quantity::LumiSection(60), + new hcaldqm::quantity::LumiSection(10), new hcaldqm::quantity::FEDQuantity(vFEDs), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN, true), 0); @@ -658,7 +658,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) _cCapidMinusBXmod4_SubdetPM.book(ib, _emap, _subsystem); if (_ptype == fOnline) { _cCapid_BadvsFEDvsLS.book(ib, _subsystem, "BadvsLS"); - _cCapid_BadvsFEDvsLSmod60.book(ib, _subsystem, "BadvsLSmod60"); + _cCapid_BadvsFEDvsLSmod10.book(ib, _subsystem, "BadvsLSmod10"); } for (int i = 0; i < 4; ++i) { constexpr unsigned int kSize = 32; @@ -787,10 +787,10 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) _xQuality = lumiCache->xQuality; if (_ptype == fOnline && - lumiCache->EvtCntLS == 1) { // Reset the bin for _cCapid_BadvsFEDvsLSmod60 at the beginning of each new LS + lumiCache->EvtCntLS == 1) { // Reset the bin for _cCapid_BadvsFEDvsLSmod10 at the beginning of each new LS for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { HcalElectronicsId eid = HcalElectronicsId(*it); - _cCapid_BadvsFEDvsLSmod60.setBinContent(eid, _currentLS % 60, 0); + _cCapid_BadvsFEDvsLSmod10.setBinContent(eid, _currentLS % 10, 0); } } @@ -898,7 +898,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) if (!good_capidmbx) { _xBadCapid.get(eid)++; _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); - _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + _cCapid_BadvsFEDvsLSmod10.fill(eid, _currentLS % 10); } if (!eid.isVMEid()) { _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); @@ -1091,7 +1091,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) if (!good_capidmbx) { _xBadCapid.get(eid)++; _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); - _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + _cCapid_BadvsFEDvsLSmod10.fill(eid, _currentLS % 10); } if (!eid.isVMEid()) { _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); @@ -1256,7 +1256,7 @@ DigiTask::DigiTask(edm::ParameterSet const& ps) if (!good_capidmbx) { _xBadCapid.get(eid)++; _cCapid_BadvsFEDvsLS.fill(eid, _currentLS); - _cCapid_BadvsFEDvsLSmod60.fill(eid, _currentLS % 60); + _cCapid_BadvsFEDvsLSmod10.fill(eid, _currentLS % 10); } if (!eid.isVMEid()) { _cCapidMinusBXmod4_CrateSlotuTCA[this_capidmbx].fill(eid); diff --git a/DQM/HcalTasks/plugins/RawTask.cc b/DQM/HcalTasks/plugins/RawTask.cc index 1206a6a5166e3..3fe1693c98fa9 100644 --- a/DQM/HcalTasks/plugins/RawTask.cc +++ b/DQM/HcalTasks/plugins/RawTask.cc @@ -18,6 +18,7 @@ RawTask::RawTask(edm::ParameterSet const& ps) _vflags[fBcnMsm] = flag::Flag("BcnMsm"); _vflags[fBadQ] = flag::Flag("BadQ"); _vflags[fOrnMsm] = flag::Flag("OrnMsm"); + _NBadQEvent = 0; } /* virtual */ void RawTask::bookHistograms(DQMStore::IBooker& ib, edm::Run const& r, edm::EventSetup const& es) { @@ -131,6 +132,12 @@ RawTask::RawTask(edm::ParameterSet const& ps) new hcaldqm::quantity::FEDQuantity(vFEDs), new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fState), 0); + _cBadQ_FEDvsLSmod10.initialize(_name, + "BadQ_FEDvsLSmod10", + new hcaldqm::quantity::LumiSection(10), + new hcaldqm::quantity::FEDQuantity(vFEDs), + new hcaldqm::quantity::ValueQuantity(hcaldqm::quantity::fN), + 0); // FED Size vs LS _cDataSizevsLS_FED.initialize(_name, "DataSizevsLS", @@ -166,6 +173,7 @@ RawTask::RawTask(edm::ParameterSet const& ps) _xBadQLS.book(_emap); _cSummaryvsLS_FED.book(ib, _emap, _subsystem); _cSummaryvsLS.book(ib, _subsystem); + _cBadQ_FEDvsLSmod10.book(ib, _subsystem); _cDataSizevsLS_FED.book(ib, _emap, _subsystem); } @@ -224,6 +232,12 @@ RawTask::RawTask(edm::ParameterSet const& ps) // TODO: Include for Online Calibration Channels marked as bad // a comment below is left on purpose! //_cBadQualityvsBX.fill(bx, creport->badQualityDigis()); + int Nbadq = creport->badQualityDigis(); + if (lumiCache->EvtCntLS == 1) + _NBadQEvent = 0; // Reset at the beginning of each new LS + if (Nbadq > 0) + _NBadQEvent++; + //std::cout << " Nbadq "<< Nbadq << " NBadQEvent " <<_NBadQEvent<< std::endl; for (std::vector::const_iterator it = creport->bad_quality_begin(); it != creport->bad_quality_end(); ++it) { // skip non HCAL det ids if (!HcalGenericDetId(*it).isHcalDetId()) @@ -242,7 +256,9 @@ RawTask::RawTask(edm::ParameterSet const& ps) _cBadQuality_depth.fill(HcalDetId(*it)); // ONLINE ONLY! if (_ptype == fOnline) + //Number of BadQualityDigis _xBadQLS.get(eid)++; + //std::cout << " event _xBadQLS "<< double(_xBadQLS.get(eid)) << std::endl; if (_ptype != fOffline) { // hidefed2crate if (!eid.isVMEid()) { if (_filter_FEDsuTCA.filter(eid)) @@ -393,13 +409,15 @@ std::shared_ptr RawTask::globalBeginLuminosityBlock(edm::Luminos for (std::vector::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) { flag::Flag fSum("RAW"); HcalElectronicsId eid = HcalElectronicsId(*it); - + int fed = hcaldqm::utilities::crate2fed(eid.crateId(), eid.slot()); std::vector::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it); if (cit == _vcdaqEids.end()) { // not @cDAQ for (uint32_t iflag = 0; iflag < _vflags.size(); iflag++) _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), int(flag::fNCDAQ)); _cSummaryvsLS.setBinContent(eid, _currentLS, int(flag::fNCDAQ)); + if (!hcaldqm::utilities::isFEDHO(eid) && fed != 1136) + _cBadQ_FEDvsLSmod10.setBinContent(eid, _currentLS % 10, int(flag::fNCDAQ)); continue; } @@ -419,9 +437,13 @@ std::shared_ptr RawTask::globalBeginLuminosityBlock(edm::Luminos _vflags[fOrnMsm]._state = flag::fGOOD; if (double(_xBadQLS.get(eid)) > double(12 * _evsPerLS)) _vflags[fBadQ]._state = flag::fBAD; - else if (_xBadQLS.get(eid) > 0) + //else if (_xBadQLS.get(eid) > 0){ + // Following line added due to https://gitlab.cern.ch/cmshcal/docs/-/issues/233 + // BadQ > (5%) of number of events in this LS. + else if (double(_xBadQLS.get(eid)) > 0 && double(_NBadQEvent) > double(0.05 * _evsPerLS)) { _vflags[fBadQ]._state = flag::fPROBLEMATIC; - else + + } else _vflags[fBadQ]._state = flag::fGOOD; } @@ -431,6 +453,12 @@ std::shared_ptr RawTask::globalBeginLuminosityBlock(edm::Luminos // - reset each flag right after using it for (std::vector::iterator ft = _vflags.begin(); ft != _vflags.end(); ++ft) { _cSummaryvsLS_FED.setBinContent(eid, _currentLS, int(iflag), ft->_state); + + if (ft->_name == "BadQ") { + if (!hcaldqm::utilities::isFEDHO(eid) && fed != 1136 && ft->_state != 3) { + _cBadQ_FEDvsLSmod10.setBinContent(eid, _currentLS % 10, (double(_NBadQEvent) / double(_evsPerLS)) * 100); + } + } fSum += (*ft); iflag++; From 2ba52ea3015a19276f39b632a6edb8de019d81a3 Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Wed, 21 Aug 2024 01:33:26 +0200 Subject: [PATCH 09/33] Add ECAL DCC desync DQM trend plots --- .../python/RawDataTask_cfi.py | 28 +++++++++++++ DQM/EcalMonitorTasks/src/RawDataTask.cc | 40 ++++++++++++++++--- 2 files changed, 62 insertions(+), 6 deletions(-) diff --git a/DQM/EcalMonitorTasks/python/RawDataTask_cfi.py b/DQM/EcalMonitorTasks/python/RawDataTask_cfi.py index 25c4fe7e05018..6ba4284e2e8cd 100644 --- a/DQM/EcalMonitorTasks/python/RawDataTask_cfi.py +++ b/DQM/EcalMonitorTasks/python/RawDataTask_cfi.py @@ -49,6 +49,34 @@ ecalRawDataTask = cms.untracked.PSet( MEs = cms.untracked.PSet( + TrendBXTCC = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/RawDataTask number of %(prefix)sRDT bunch crossing TCC errors'), + kind = cms.untracked.string('TH1F'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of bunch crossing value mismatches between DCC and TCC.') + ), + TrendL1ATCC = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/RawDataTask number of %(prefix)sRDT L1A TCC errors'), + kind = cms.untracked.string('TH1F'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of L1A value mismatches between DCC and TCC.') + ), + TrendBXSRP = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/RawDataTask number of %(prefix)sRDT bunch crossing SRP errors'), + kind = cms.untracked.string('TH1F'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of bunch crossing value mismatches between DCC and SRP.') + ), + TrendL1ASRP = cms.untracked.PSet( + path = cms.untracked.string('Ecal/Trends/RawDataTask number of %(prefix)sRDT L1A SRP errors'), + kind = cms.untracked.string('TH1F'), + otype = cms.untracked.string('Ecal2P'), + btype = cms.untracked.string('Trend'), + description = cms.untracked.string('Trend of the number of L1A value mismatches between DCC and SRP.') + ), BXSRP = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sRawDataTask/%(prefix)sRDT bunch crossing SRP errors'), kind = cms.untracked.string('TH1F'), diff --git a/DQM/EcalMonitorTasks/src/RawDataTask.cc b/DQM/EcalMonitorTasks/src/RawDataTask.cc index 225dbac456508..d3b9087de0e50 100644 --- a/DQM/EcalMonitorTasks/src/RawDataTask.cc +++ b/DQM/EcalMonitorTasks/src/RawDataTask.cc @@ -88,6 +88,10 @@ namespace ecaldqm { MESet& meBXSRP(MEs_.at("BXSRP")); MESet& meL1ASRP(MEs_.at("L1ASRP")); MESet& meTrendNSyncErrors(MEs_.at("L1ATCC")); + MESet& meTrendBXTCC(MEs_.at("TrendBXTCC")); + MESet& meTrendL1ATCC(MEs_.at("TrendL1ATCC")); + MESet& meTrendBXSRP(MEs_.at("TrendBXSRP")); + MESet& meTrendL1ASRP(MEs_.at("TrendL1ASRP")); MESet& meEventTypePreCalib(MEs_.at("EventTypePreCalib")); MESet& meEventTypeCalib(MEs_.at("EventTypeCalib")); MESet& meEventTypePostCalib(MEs_.at("EventTypePostCalib")); @@ -214,30 +218,54 @@ namespace ecaldqm { if (tccBx.size() == 4) { // EB uses tccBx[0]; EE uses all if (dccId <= kEEmHigh + 1 || dccId >= kEEpLow + 1) { for (int iTCC(0); iTCC < 4; iTCC++) { - if (tccBx[iTCC] != dccBX && tccBx[iTCC] != -1 && dccBX != -1) + if (tccBx[iTCC] != dccBX && tccBx[iTCC] != -1 && dccBX != -1) { meBXTCC.fill(getEcalDQMSetupObjects(), dccId); + meTrendBXTCC.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), 1); + } - if (tccL1[iTCC] != dccL1AShort && tccL1[iTCC] != -1 && dccL1AShort != 0) + if (tccL1[iTCC] != dccL1AShort && tccL1[iTCC] != -1 && dccL1AShort != 0) { meL1ATCC.fill(getEcalDQMSetupObjects(), dccId); + meTrendL1ATCC.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), 1); + } } } else { - if (tccBx[0] != dccBX && tccBx[0] != -1 && dccBX != -1) + if (tccBx[0] != dccBX && tccBx[0] != -1 && dccBX != -1) { meBXTCC.fill(getEcalDQMSetupObjects(), dccId); + meTrendBXTCC.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), 1); + } - if (tccL1[0] != dccL1AShort && tccL1[0] != -1 && dccL1AShort != 0) + if (tccL1[0] != dccL1AShort && tccL1[0] != -1 && dccL1AShort != 0) { meL1ATCC.fill(getEcalDQMSetupObjects(), dccId); + meTrendL1ATCC.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), 1); + } } } short srpBx(dcchItr->getSRPBx()); short srpL1(dcchItr->getSRPLv1()); - if (srpBx != dccBX && srpBx != -1 && dccBX != -1) + if (srpBx != dccBX && srpBx != -1 && dccBX != -1) { meBXSRP.fill(getEcalDQMSetupObjects(), dccId); - if (srpL1 != dccL1AShort && srpL1 != -1 && dccL1AShort != 0) + if (dccId <= kEEmHigh + 1 || dccId >= kEEpLow + 1) { // EE + meTrendBXSRP.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), 1); + } + else { // EB + meTrendBXSRP.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), 1); + } + } + + if (srpL1 != dccL1AShort && srpL1 != -1 && dccL1AShort != 0) { meL1ASRP.fill(getEcalDQMSetupObjects(), dccId); + if (dccId <= kEEmHigh + 1 || dccId >= kEEpLow + 1) { // EE + meTrendL1ASRP.fill(getEcalDQMSetupObjects(), EcalEndcap, double(timestamp_.iLumi), 1); + } + else { // EB + meTrendL1ASRP.fill(getEcalDQMSetupObjects(), EcalBarrel, double(timestamp_.iLumi), 1); + } + } + const int calibBX(3490); short runType(dcchItr->getRunType() + 1); From dc5a86f04ac83df64cd0016b90ccf72843da7e8d Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Wed, 21 Aug 2024 02:02:21 +0200 Subject: [PATCH 10/33] Update ECAL DCC number of desyncs threshold for Integrity Quality Criteria --- DQM/EcalMonitorClient/src/IntegrityClient.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/DQM/EcalMonitorClient/src/IntegrityClient.cc b/DQM/EcalMonitorClient/src/IntegrityClient.cc index 159904346cce8..ecd33aa1ef42f 100644 --- a/DQM/EcalMonitorClient/src/IntegrityClient.cc +++ b/DQM/EcalMonitorClient/src/IntegrityClient.cc @@ -123,15 +123,20 @@ namespace ecaldqm { } } - // Quality check: set an entire FED to BAD if "any" DCC-SRP or DCC-TCC mismatch errors are detected + // Quality check: set an entire FED to BAD if "any" DCC-SRP or DCC-TCC mismatch errors are detected AND the number of events affected by the DCC-SRP or DCC-TCC mismatch errors is more than 1% of the events analyzed in the run // Fill mismatch statistics MESet const& sBXSRP(sources_.at("BXSRP")); MESet const& sBXTCC(sources_.at("BXTCC")); std::vector hasMismatchDCC(nDCC, false); for (unsigned iDCC(0); iDCC < nDCC; ++iDCC) { - if (sBXSRP.getBinContent(getEcalDQMSetupObjects(), iDCC + 1) > 50. || - sBXTCC.getBinContent(getEcalDQMSetupObjects(), iDCC + 1) > 50.) // "any" => 50 - hasMismatchDCC[iDCC] = true; + int nBXSRPdesync = sBXSRP.getBinContent(getEcalDQMSetupObjects(), iDCC + 1); + int nBXTCCdesync = sBXTCC.getBinContent(getEcalDQMSetupObjects(), iDCC + 1); + + if (nBXSRPdesync > 50. || nBXTCCdesync > 50.) { // "any" => 50 + if (nBXSRPdesync > int(0.01 * processedEvents) || nBXTCCdesync > int(0.01 * processedEvents)) { // check if the events with DCC-SRP or DCC-TCC desyncs for the given DCC is more than 1% of the events analyzed + hasMismatchDCC[iDCC] = true; + } + } } // Analyze mismatch statistics for (MESet::iterator qsItr(meQualitySummary.beginChannel(GetElectronicsMap())); From 8d788bcc033778bd1fd31373389cc77571fd5827 Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Wed, 21 Aug 2024 14:51:31 +0200 Subject: [PATCH 11/33] Update the integrity summary plot description --- DQM/EcalMonitorClient/python/IntegrityClient_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQM/EcalMonitorClient/python/IntegrityClient_cfi.py b/DQM/EcalMonitorClient/python/IntegrityClient_cfi.py index 7f631d75a86da..2a2e61d0aecbf 100644 --- a/DQM/EcalMonitorClient/python/IntegrityClient_cfi.py +++ b/DQM/EcalMonitorClient/python/IntegrityClient_cfi.py @@ -27,7 +27,7 @@ kind = cms.untracked.string('TH2F'), otype = cms.untracked.string('Ecal3P'), btype = cms.untracked.string('Crystal'), - description = cms.untracked.string('Summary of the data integrity. A channel is red if more than ' + str(errFractionThreshold) + ' of its entries have integrity errors.') + description = cms.untracked.string('Summary of the data integrity. A channel is red if more than ' + str(errFractionThreshold) + ' of its entries have integrity errors. Also, an entire SuperModule can show red if more than 0.01 of its entries have DCC-SRP or DCC-TCC Desync errors.') ), Quality = cms.untracked.PSet( path = cms.untracked.string('%(subdet)s/%(prefix)sIntegrityClient/%(prefix)sIT data integrity quality %(sm)s'), From a6f4580d0612bc24bcc37c33ab501b9d0a20cb5f Mon Sep 17 00:00:00 2001 From: mmusich Date: Mon, 26 Aug 2024 08:43:07 +0200 Subject: [PATCH 12/33] Update Pixel GPU DQM online client --- .../python/upgradeWorkflowComponents.py | 3 +- .../pixelgpu_dqm_sourceclient-live_cfg.py | 16 ++- .../plugins/SiPixelCompareTrackSoA.cc | 106 +++++++++++++----- .../plugins/SiPixelCompareTracks.cc | 86 +++++++++++--- .../plugins/SiPixelMonitorTrackSoA.cc | 8 +- .../plugins/SiPixelMonitorTrackSoAAlpaka.cc | 8 +- .../SiPixelTrackComparisonHarvester.cc | 38 +++++-- .../SiPixelHeterogenousDQMHarvesting_cff.py | 15 ++- 8 files changed, 217 insertions(+), 63 deletions(-) diff --git a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py index 8a70a74aa0c3e..5534e45c5cb67 100644 --- a/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py +++ b/Configuration/PyReleaseValidation/python/upgradeWorkflowComponents.py @@ -1639,7 +1639,8 @@ def setup_(self, step, stepName, stepDict, k, properties): '--customise' : 'HeterogeneousCore/AlpakaServices/customiseAlpakaServiceMemoryFilling.customiseAlpakaServiceMemoryFilling', }, harvest = { - '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM' + '-s': 'HARVESTING:@trackingOnlyValidation+@pixelTrackingOnlyDQM', + '--procModifiers': 'alpakaValidation', }, suffix = 'Patatrack_PixelOnlyAlpaka_Validation', offset = 0.403, diff --git a/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py index abfa60c5b0d75..78e036c4008ec 100644 --- a/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/pixelgpu_dqm_sourceclient-live_cfg.py @@ -87,14 +87,20 @@ # Pixel DQM Tasks and Harvesters import #------------------------------------- process.load('DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff') +process.load('DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQMHarvesting_cff') +process.siPixelTrackComparisonHarvesterAlpaka.topFolderName = cms.string('SiPixelHeterogeneous/PixelTrackCompareGPUvsCPU') #------------------------------------- # Some Settings before Finishing up #------------------------------------- if process.runType.getRunType() == process.runType.hi_run: - process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = 'hltSiPixelDigisFromSoAPPOnAA' - process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = 'hltSiPixelDigisLegacyPPOnAA' + process.siPixelPhase1MonitorRawDataASerial.src = 'hltSiPixelDigiErrorsPPOnAASerialSync' + process.siPixelPhase1MonitorRawDataADevice.src = 'hltSiPixelDigiErrorsPPOnAA' + process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = 'hltSiPixelDigiErrorsPPOnAA' + process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = 'hltSiPixelDigiErrorsPPOnAASerialSync' else: + process.siPixelPhase1MonitorRawDataASerial.src = 'hltSiPixelDigiErrorsSerialSync' + process.siPixelPhase1MonitorRawDataADevice.src = 'hltSiPixelDigiErrors' process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcGPU = 'hltSiPixelDigiErrors' process.siPixelPhase1RawDataErrorComparator.pixelErrorSrcCPU = 'hltSiPixelDigiErrorsSerialSync' #------------------------------------- @@ -106,7 +112,11 @@ #------------------------------------- # Hcal DQM Tasks/Clients Sequences Definition #------------------------------------- -process.tasksPath = cms.Path(process.siPixelPhase1RawDataErrorComparator) +process.tasksPath = cms.Path(process.siPixelPhase1MonitorRawDataASerial * + process.siPixelPhase1MonitorRawDataADevice * + process.siPixelPhase1RawDataErrorComparator * + process.siPixelHeterogeneousDQMComparisonHarvestingAlpaka + ) #------------------------------------- # Paths/Sequences Definitions diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc index 03d023cf17a71..f3635d6df45da 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTrackSoA.cc @@ -84,6 +84,9 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer { MonitorElement* hnTracks_; MonitorElement* hnLooseAndAboveTracks_; MonitorElement* hnLooseAndAboveTracks_matched_; + MonitorElement* hDeltaNTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_matched_; MonitorElement* hnHits_; MonitorElement* hnHitsVsPhi_; MonitorElement* hnHitsVsEta_; @@ -95,6 +98,7 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi_; MonitorElement* hChi2VsEta_; MonitorElement* hpt_; + MonitorElement* hCurvature_; MonitorElement* hptLogLog_; MonitorElement* heta_; MonitorElement* hphi_; @@ -110,10 +114,10 @@ class SiPixelCompareTrackSoA : public DQMEDAnalyzer { MonitorElement* htipdiffMatched_; //for matching eff vs region: derive the ratio at harvesting - MonitorElement* hpt_eta_tkAllCPU_; - MonitorElement* hpt_eta_tkAllCPUMatched_; - MonitorElement* hphi_z_tkAllCPU_; - MonitorElement* hphi_z_tkAllCPUMatched_; + MonitorElement* hpt_eta_tkAllRef_; + MonitorElement* hpt_eta_tkAllRefMatched_; + MonitorElement* hphi_z_tkAllRef_; + MonitorElement* hphi_z_tkAllRefMatched_; }; // @@ -187,6 +191,7 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve float phiCPU = helper::phi(tsoaCPU.view(), it); float zipCPU = helper::zip(tsoaCPU.view(), it); float tipCPU = helper::tip(tsoaCPU.view(), it); + auto qCPU = helper::charge(tsoaCPU.view(), it); if (!(ptCPU > 0.)) continue; @@ -211,17 +216,18 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve } } - hpt_eta_tkAllCPU_->Fill(etaCPU, ptCPU); //all CPU tk - hphi_z_tkAllCPU_->Fill(phiCPU, zipCPU); + hpt_eta_tkAllRef_->Fill(etaCPU, ptCPU); //all CPU tk + hphi_z_tkAllRef_->Fill(phiCPU, zipCPU); if (closestTkidx == notFound) continue; nLooseAndAboveTracksCPU_matchedGPU++; hchi2_->Fill(tsoaCPU.view()[it].chi2(), tsoaGPU.view()[closestTkidx].chi2()); - hCharge_->Fill(helper::charge(tsoaCPU.view(), it), helper::charge(tsoaGPU.view(), closestTkidx)); + hCharge_->Fill(qCPU, helper::charge(tsoaGPU.view(), closestTkidx)); hnHits_->Fill(helper::nHits(tsoaCPU.view(), it), helper::nHits(tsoaGPU.view(), closestTkidx)); hnLayers_->Fill(tsoaCPU.view()[it].nLayers(), tsoaGPU.view()[closestTkidx].nLayers()); hpt_->Fill(ptCPU, tsoaGPU.view()[closestTkidx].pt()); + hCurvature_->Fill(qCPU / ptCPU, helper::charge(tsoaGPU.view(), closestTkidx) / tsoaGPU.view()[closestTkidx].pt()); hptLogLog_->Fill(ptCPU, tsoaGPU.view()[closestTkidx].pt()); heta_->Fill(etaCPU, tsoaGPU.view()[closestTkidx].eta()); hphi_->Fill(phiCPU, helper::phi(tsoaGPU.view(), closestTkidx)); @@ -234,12 +240,26 @@ void SiPixelCompareTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve hphidiffMatched_->Fill(reco::deltaPhi(phiCPU, helper::phi(tsoaGPU.view(), closestTkidx))); hzdiffMatched_->Fill(zipCPU - helper::zip(tsoaGPU.view(), closestTkidx)); htipdiffMatched_->Fill(tipCPU - helper::tip(tsoaGPU.view(), closestTkidx)); - hpt_eta_tkAllCPUMatched_->Fill(etaCPU, tsoaCPU.view()[it].pt()); //matched to gpu - hphi_z_tkAllCPUMatched_->Fill(etaCPU, zipCPU); + hpt_eta_tkAllRefMatched_->Fill(etaCPU, tsoaCPU.view()[it].pt()); //matched to gpu + hphi_z_tkAllRefMatched_->Fill(etaCPU, zipCPU); } - hnTracks_->Fill(nTracksCPU, nTracksGPU); - hnLooseAndAboveTracks_->Fill(nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU); - hnLooseAndAboveTracks_matched_->Fill(nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU); + + // Define a lambda function for filling the histograms + auto fillHistogram = [](auto& histogram, auto xValue, auto yValue) { histogram->Fill(xValue, yValue); }; + + // Define a lambda for filling delta histograms + auto fillDeltaHistogram = [](auto& histogram, int cpuValue, int gpuValue) { + histogram->Fill(std::min(cpuValue, 1000), std::clamp(gpuValue - cpuValue, -100, 100)); + }; + + // Fill the histograms + fillHistogram(hnTracks_, nTracksCPU, nTracksGPU); + fillHistogram(hnLooseAndAboveTracks_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU); + fillHistogram(hnLooseAndAboveTracks_matched_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU); + + fillDeltaHistogram(hDeltaNTracks_, nTracksCPU, nTracksGPU); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksGPU); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_matched_, nLooseAndAboveTracksCPU, nLooseAndAboveTracksCPU_matchedGPU); } // @@ -252,13 +272,44 @@ void SiPixelCompareTrackSoA::bookHistograms(DQMStore::IBooker& iBook, iBook.cd(); iBook.setCurrentFolder(topFolderName_); - // clang-format off + // Define a helper function for booking histograms std::string toRep = "Number of tracks"; + auto bookTracksTH2I = [&](const std::string& name, + const std::string& title, + int xBins, + double xMin, + double xMax, + int yBins, + double yMin, + double yMax) { + return iBook.book2I(name, fmt::sprintf(title, toRep), xBins, xMin, xMax, yBins, yMin, yMax); + }; + + // Define common parameters for different histogram types + constexpr int xBins = 501; + constexpr double xMin = -0.5; + constexpr double xMax = 1001.5; + + constexpr int dXBins = 1001; + constexpr double dXMin = -0.5; + constexpr double dXMax = 1000.5; + + constexpr int dYBins = 201; + constexpr double dYMin = -100.5; + constexpr double dYMax = 100.5; + // FIXME: all the 2D correlation plots are quite heavy in terms of memory consumption, so a as soon as DQM supports THnSparse // these should be moved to a less resource consuming format - hnTracks_ = iBook.book2I("nTracks", fmt::sprintf("%s per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_ = iBook.book2I("nLooseAndAboveTracks", fmt::sprintf("%s (quality #geq loose) per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_matched_ = iBook.book2I("nLooseAndAboveTracks_matched", fmt::sprintf("%s (quality #geq loose) per event; CPU; GPU",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); + + // Book histograms using the helper function + // clang-format off + hnTracks_ = bookTracksTH2I("nTracks", "%s per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_ = bookTracksTH2I("nLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_matched_ = bookTracksTH2I("nLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + + hDeltaNTracks_ = bookTracksTH2I("deltaNTracks", "%s per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_ = bookTracksTH2I("deltaNLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_matched_ = bookTracksTH2I("deltaNLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits_ = iBook.book2I("nRecHits", fmt::sprintf("%s;CPU;GPU",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5); @@ -273,24 +324,25 @@ void SiPixelCompareTrackSoA::bookHistograms(DQMStore::IBooker& iBook, hCharge_ = iBook.book2I("charge",fmt::sprintf("%s;CPU;GPU",toRep),3, -1.5, 1.5, 3, -1.5, 1.5); hpt_ = iBook.book2I("pt", "Track (quality #geq loose) p_{T} [GeV];CPU;GPU", 200, 0., 200., 200, 0., 200.); + hCurvature_ = iBook.book2I("curvature", "Track (quality #geq loose) q/p_{T} [GeV^{-1}];CPU;GPU", 60,- 3., 3., 60, -3., 3. ); hptLogLog_ = make2DIfLog(iBook, true, true, "ptLogLog", "Track (quality #geq loose) p_{T} [GeV];CPU;GPU", 200, log10(0.5), log10(200.), 200, log10(0.5), log10(200.)); heta_ = iBook.book2I("eta", "Track (quality #geq loose) #eta;CPU;GPU", 30, -3., 3., 30, -3., 3.); hphi_ = iBook.book2I("phi", "Track (quality #geq loose) #phi;CPU;GPU", 30, -M_PI, M_PI, 30, -M_PI, M_PI); hz_ = iBook.book2I("z", "Track (quality #geq loose) z [cm];CPU;GPU", 30, -30., 30., 30, -30., 30.); htip_ = iBook.book2I("tip", "Track (quality #geq loose) TIP [cm];CPU;GPU", 100, -0.5, 0.5, 100, -0.5, 0.5); //1D difference plots - hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 60, -30., 30.); - hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV] between matched tracks; #Delta q/p_{T} [GeV]", 60, -30., 30.); - hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 160, -0.04 ,0.04); - hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 160, -0.04 ,0.04); - hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 300, -1.5, 1.5); - htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 300, -1.5, 1.5); + hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 61, -30.5, 30.5); + hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV^{-1}] between matched tracks; #Delta q/p_{T} [GeV^{-1}]", 61, -3.05, 3.05); + hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 161, -0.045 ,0.045); + hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 161, -0.045 ,0.045); + hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 301, -1.55, 1.55); + htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 301, -1.55, 1.55); //2D plots for eff - hpt_eta_tkAllCPU_ = iBook.book2I("ptetatrkAllCPU", "Track (quality #geq loose) on CPU; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); - hpt_eta_tkAllCPUMatched_ = iBook.book2I("ptetatrkAllCPUmatched", "Track (quality #geq loose) on CPU matched to GPU track; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); + hpt_eta_tkAllRef_ = iBook.book2I("ptetatrkAllReference", "Track (quality #geq loose) on CPU; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); + hpt_eta_tkAllRefMatched_ = iBook.book2I("ptetatrkAllReferencematched", "Track (quality #geq loose) on CPU matched to GPU track; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); - hphi_z_tkAllCPU_ = iBook.book2I("phiztrkAllCPU", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); - hphi_z_tkAllCPUMatched_ = iBook.book2I("phiztrkAllCPUmatched", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); + hphi_z_tkAllRef_ = iBook.book2I("phiztrkAllReference", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); + hphi_z_tkAllRefMatched_ = iBook.book2I("phiztrkAllReferencematched", "Track (quality #geq loose) on CPU; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); } @@ -303,7 +355,7 @@ void SiPixelCompareTrackSoA::fillDescriptions(edm::ConfigurationDescriptions& desc.add("topFolderName", "SiPixelHeterogeneous/PixelTrackCompareGPUvsCPU"); desc.add("useQualityCut", true); desc.add("minQuality", "loose"); - desc.add("deltaR2cut", 0.04); + desc.add("deltaR2cut", 0.02 * 0.02)->setComment("deltaR2 cut between track on CPU and GPU"); descriptions.addWithDefaultLabel(desc); } diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc index 064831cab6d13..4394b5d59f34b 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelCompareTracks.cc @@ -11,6 +11,7 @@ // // for string manipulations +#include #include #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Math/interface/deltaR.h" @@ -94,6 +95,9 @@ class SiPixelCompareTracks : public DQMEDAnalyzer { MonitorElement* hnTracks_; MonitorElement* hnLooseAndAboveTracks_; MonitorElement* hnLooseAndAboveTracks_matched_; + MonitorElement* hDeltaNTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_; + MonitorElement* hDeltaNLooseAndAboveTracks_matched_; MonitorElement* hnHits_; MonitorElement* hnHitsVsPhi_; MonitorElement* hnHitsVsEta_; @@ -105,6 +109,7 @@ class SiPixelCompareTracks : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi_; MonitorElement* hChi2VsEta_; MonitorElement* hpt_; + MonitorElement* hCurvature_; MonitorElement* hptLogLog_; MonitorElement* heta_; MonitorElement* hphi_; @@ -200,6 +205,7 @@ void SiPixelCompareTracks::analyzeSeparate(U tokenRef, V tokenTar, const edm: float phiRef = reco::phi(tsoaRef.view(), it); float zipRef = reco::zip(tsoaRef.view(), it); float tipRef = reco::tip(tsoaRef.view(), it); + auto qRef = reco::charge(tsoaRef.view(), it); if (!(ptRef > 0.)) continue; @@ -231,17 +237,18 @@ void SiPixelCompareTracks::analyzeSeparate(U tokenRef, V tokenTar, const edm: nLooseAndAboveTracksRef_matchedTar++; hchi2_->Fill(tsoaRef.view()[it].chi2(), tsoaTar.view()[closestTkidx].chi2()); - hCharge_->Fill(reco::charge(tsoaRef.view(), it), reco::charge(tsoaTar.view(), closestTkidx)); + hCharge_->Fill(qRef, reco::charge(tsoaTar.view(), closestTkidx)); hnHits_->Fill(helper::nHits(tsoaRef.view(), it), helper::nHits(tsoaTar.view(), closestTkidx)); hnLayers_->Fill(tsoaRef.view()[it].nLayers(), tsoaTar.view()[closestTkidx].nLayers()); hpt_->Fill(ptRef, tsoaTar.view()[closestTkidx].pt()); + hCurvature_->Fill(qRef / ptRef, reco::charge(tsoaTar.view(), closestTkidx) / tsoaTar.view()[closestTkidx].pt()); hptLogLog_->Fill(ptRef, tsoaTar.view()[closestTkidx].pt()); heta_->Fill(etaRef, tsoaTar.view()[closestTkidx].eta()); hphi_->Fill(phiRef, reco::phi(tsoaTar.view(), closestTkidx)); hz_->Fill(zipRef, reco::zip(tsoaTar.view(), closestTkidx)); htip_->Fill(tipRef, reco::tip(tsoaTar.view(), closestTkidx)); hptdiffMatched_->Fill(ptRef - tsoaTar.view()[closestTkidx].pt()); - hCurvdiffMatched_->Fill((reco::charge(tsoaRef.view(), it) / tsoaRef.view()[it].pt()) - + hCurvdiffMatched_->Fill(qRef / ptRef - (reco::charge(tsoaTar.view(), closestTkidx) / tsoaTar.view()[closestTkidx].pt())); hetadiffMatched_->Fill(etaRef - tsoaTar.view()[closestTkidx].eta()); hphidiffMatched_->Fill(reco::deltaPhi(phiRef, reco::phi(tsoaTar.view(), closestTkidx))); @@ -250,9 +257,23 @@ void SiPixelCompareTracks::analyzeSeparate(U tokenRef, V tokenTar, const edm: hpt_eta_tkAllRefMatched_->Fill(etaRef, tsoaRef.view()[it].pt()); //matched to gpu hphi_z_tkAllRefMatched_->Fill(etaRef, zipRef); } - hnTracks_->Fill(nTracksRef, nTracksTar); - hnLooseAndAboveTracks_->Fill(nLooseAndAboveTracksRef, nLooseAndAboveTracksTar); - hnLooseAndAboveTracks_matched_->Fill(nLooseAndAboveTracksRef, nLooseAndAboveTracksRef_matchedTar); + + // Define a lambda function for filling the histograms + auto fillHistogram = [](auto& histogram, auto xValue, auto yValue) { histogram->Fill(xValue, yValue); }; + + // Define a lambda for filling delta histograms + auto fillDeltaHistogram = [](auto& histogram, int cpuValue, int gpuValue) { + histogram->Fill(std::min(cpuValue, 1000), std::clamp(gpuValue - cpuValue, -100, 100)); + }; + + // Fill the histograms + fillHistogram(hnTracks_, nTracksRef, nTracksTar); + fillHistogram(hnLooseAndAboveTracks_, nLooseAndAboveTracksRef, nLooseAndAboveTracksTar); + fillHistogram(hnLooseAndAboveTracks_matched_, nLooseAndAboveTracksRef, nLooseAndAboveTracksRef_matchedTar); + + fillDeltaHistogram(hDeltaNTracks_, nTracksRef, nTracksTar); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_, nLooseAndAboveTracksRef, nLooseAndAboveTracksTar); + fillDeltaHistogram(hDeltaNLooseAndAboveTracks_matched_, nLooseAndAboveTracksRef, nLooseAndAboveTracksRef_matchedTar); } // @@ -275,13 +296,44 @@ void SiPixelCompareTracks::bookHistograms(DQMStore::IBooker& iBook, iBook.cd(); iBook.setCurrentFolder(topFolderName_); - // clang-format off + // Define a helper function for booking histograms std::string toRep = "Number of tracks"; + auto bookTracksTH2I = [&](const std::string& name, + const std::string& title, + int xBins, + double xMin, + double xMax, + int yBins, + double yMin, + double yMax) { + return iBook.book2I(name, fmt::sprintf(title, toRep), xBins, xMin, xMax, yBins, yMin, yMax); + }; + + // Define common parameters for different histogram types + constexpr int xBins = 501; + constexpr double xMin = -0.5; + constexpr double xMax = 1001.5; + + constexpr int dXBins = 1001; + constexpr double dXMin = -0.5; + constexpr double dXMax = 1000.5; + + constexpr int dYBins = 201; + constexpr double dYMin = -100.5; + constexpr double dYMax = 100.5; + // FIXME: all the 2D correlation plots are quite heavy in terms of memory consumption, so a as soon as DQM supports THnSparse // these should be moved to a less resource consuming format - hnTracks_ = iBook.book2I("nTracks", fmt::sprintf("%s per event; Reference; Target",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_ = iBook.book2I("nLooseAndAboveTracks", fmt::sprintf("%s (quality #geq loose) per event; Reference; Target",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); - hnLooseAndAboveTracks_matched_ = iBook.book2I("nLooseAndAboveTracks_matched", fmt::sprintf("%s (quality #geq loose) per event; Reference; Target",toRep), 501, -0.5, 500.5, 501, -0.5, 500.5); + + // Book histograms using the helper function + // clang-format off + hnTracks_ = bookTracksTH2I("nTracks", "%s per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_ = bookTracksTH2I("nLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + hnLooseAndAboveTracks_matched_ = bookTracksTH2I("nLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target", xBins, xMin, xMax, xBins, xMin, xMax); + + hDeltaNTracks_ = bookTracksTH2I("deltaNTracks", "%s per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_ = bookTracksTH2I("deltaNLooseAndAboveTracks", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); + hDeltaNLooseAndAboveTracks_matched_ = bookTracksTH2I("deltaNLooseAndAboveTracks_matched", "%s (quality #geq loose) per event; Reference; Target - Reference", dXBins, dXMin, dXMax, dYBins, dYMin, dYMax); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits_ = iBook.book2I("nRecHits", fmt::sprintf("%s;Reference;Target",toRep), 15, -0.5, 14.5, 15, -0.5, 14.5); @@ -296,18 +348,20 @@ void SiPixelCompareTracks::bookHistograms(DQMStore::IBooker& iBook, hCharge_ = iBook.book2I("charge",fmt::sprintf("%s;Reference;Target",toRep),3, -1.5, 1.5, 3, -1.5, 1.5); hpt_ = iBook.book2I("pt", "Track (quality #geq loose) p_{T} [GeV];Reference;Target", 200, 0., 200., 200, 0., 200.); + hCurvature_ = iBook.book2I("curvature", "Track (quality #geq loose) q/p_{T} [GeV^{-1}];Reference;Target", 60,- 3., 3., 60, -3., 3. ); hptLogLog_ = make2DIfLog(iBook, true, true, "ptLogLog", "Track (quality #geq loose) p_{T} [GeV];Reference;Target", 200, log10(0.5), log10(200.), 200, log10(0.5), log10(200.)); heta_ = iBook.book2I("eta", "Track (quality #geq loose) #eta;Reference;Target", 30, -3., 3., 30, -3., 3.); hphi_ = iBook.book2I("phi", "Track (quality #geq loose) #phi;Reference;Target", 30, -M_PI, M_PI, 30, -M_PI, M_PI); hz_ = iBook.book2I("z", "Track (quality #geq loose) z [cm];Reference;Target", 30, -30., 30., 30, -30., 30.); htip_ = iBook.book2I("tip", "Track (quality #geq loose) TIP [cm];Reference;Target", 100, -0.5, 0.5, 100, -0.5, 0.5); + //1D difference plots - hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 60, -30., 30.); - hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV] between matched tracks; #Delta q/p_{T} [GeV]", 60, -30., 30.); - hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 160, -0.04 ,0.04); - hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 160, -0.04 ,0.04); - hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 300, -1.5, 1.5); - htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 300, -1.5, 1.5); + hptdiffMatched_ = iBook.book1D("ptdiffmatched", " p_{T} diff [GeV] between matched tracks; #Delta p_{T} [GeV]", 61, -30.5, 30.5); + hCurvdiffMatched_ = iBook.book1D("curvdiffmatched", "q/p_{T} diff [GeV^{-1}] between matched tracks; #Delta q/p_{T} [GeV^{-1}]", 61, -3.05, 3.05); + hetadiffMatched_ = iBook.book1D("etadiffmatched", " #eta diff between matched tracks; #Delta #eta", 161, -0.045 ,0.045); + hphidiffMatched_ = iBook.book1D("phidiffmatched", " #phi diff between matched tracks; #Delta #phi", 161, -0.045 ,0.045); + hzdiffMatched_ = iBook.book1D("zdiffmatched", " z diff between matched tracks; #Delta z [cm]", 301, -1.55, 1.55); + htipdiffMatched_ = iBook.book1D("tipdiffmatched", " TIP diff between matched tracks; #Delta TIP [cm]", 301, -1.55, 1.55); //2D plots for eff hpt_eta_tkAllRef_ = iBook.book2I("ptetatrkAllReference", "Track (quality #geq loose) on Reference; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); hpt_eta_tkAllRefMatched_ = iBook.book2I("ptetatrkAllReferencematched", "Track (quality #geq loose) on Reference matched to Target track; #eta; p_{T} [GeV];", 30, -M_PI, M_PI, 200, 0., 200.); @@ -326,7 +380,7 @@ void SiPixelCompareTracks::fillDescriptions(edm::ConfigurationDescriptions& d desc.add("topFolderName", "SiPixelHeterogeneous/PixelTrackCompareDeviceVSHost"); desc.add("useQualityCut", true); desc.add("minQuality", "loose"); - desc.add("deltaR2cut", 0.04); + desc.add("deltaR2cut", 0.02 * 0.02)->setComment("deltaR2 cut between track on device and host"); descriptions.addWithDefaultLabel(desc); } diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc index e971ff184b052..f3ccb74bc3fea 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoA.cc @@ -52,6 +52,7 @@ class SiPixelMonitorTrackSoA : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi; MonitorElement* hChi2VsEta; MonitorElement* hpt; + MonitorElement* hCurvature; MonitorElement* heta; MonitorElement* hphi; MonitorElement* hz; @@ -112,6 +113,7 @@ void SiPixelMonitorTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve float zip = helper::zip(tsoa.const_view(), it); float eta = tsoa.view()[it].eta(); float tip = helper::tip(tsoa.const_view(), it); + auto charge = helper::charge(tsoa.const_view(), it); hchi2->Fill(chi2); hChi2VsPhi->Fill(phi, chi2); @@ -123,6 +125,7 @@ void SiPixelMonitorTrackSoA::analyze(const edm::Event& iEvent, const edm::Eve hnLayersVsPhi->Fill(phi, nLayers); hnLayersVsEta->Fill(eta, nLayers); hpt->Fill(pt); + hCurvature->Fill(charge / pt); heta->Fill(eta); hphi->Fill(phi); hz->Fill(zip); @@ -145,8 +148,8 @@ void SiPixelMonitorTrackSoA::bookHistograms(DQMStore::IBooker& iBook, // clang-format off std::string toRep = "Number of tracks"; - hnTracks = iBook.book1D("nTracks", fmt::sprintf(";%s per event;#events",toRep), 1001, -0.5, 1000.5); - hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::sprintf(";%s (quality #geq loose) per event;#events",toRep), 1001, -0.5, 1000.5); + hnTracks = iBook.book1D("nTracks", fmt::sprintf(";%s per event;#events",toRep), 1001, -0.5, 2001.5); + hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::sprintf(";%s (quality #geq loose) per event;#events",toRep), 1001, -0.5, 2001.5); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits = iBook.book1D("nRecHits", fmt::sprintf(";%s;#tracks",toRep), 15, -0.5, 14.5); @@ -165,6 +168,7 @@ void SiPixelMonitorTrackSoA::bookHistograms(DQMStore::IBooker& iBook, // clang-format on hpt = iBook.book1D("pt", ";Track (quality #geq loose) p_{T} [GeV];#tracks", 200, 0., 200.); + hCurvature = iBook.book1D("curvature", ";Track (quality #geq loose) q/p_{T} [GeV^{-1}];#tracks", 100, -3., 3.); heta = iBook.book1D("eta", ";Track (quality #geq loose) #eta;#tracks", 30, -3., 3.); hphi = iBook.book1D("phi", ";Track (quality #geq loose) #phi;#tracks", 30, -M_PI, M_PI); hz = iBook.book1D("z", ";Track (quality #geq loose) z [cm];#tracks", 30, -30., 30.); diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc index fd98957ee8492..8bd1cdfa2e429 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelMonitorTrackSoAAlpaka.cc @@ -52,6 +52,7 @@ class SiPixelMonitorTrackSoAAlpaka : public DQMEDAnalyzer { MonitorElement* hChi2VsPhi; MonitorElement* hChi2VsEta; MonitorElement* hpt; + MonitorElement* hCurvature; MonitorElement* heta; MonitorElement* hphi; MonitorElement* hz; @@ -112,6 +113,7 @@ void SiPixelMonitorTrackSoAAlpaka::analyze(const edm::Event& iEvent, const ed float zip = tsoa.view()[it].state()(4); float eta = tsoa.view()[it].eta(); float tip = tsoa.view()[it].state()(1); + auto charge = reco::charge(tsoa.view(), it); hchi2->Fill(chi2); hChi2VsPhi->Fill(phi, chi2); @@ -123,6 +125,7 @@ void SiPixelMonitorTrackSoAAlpaka::analyze(const edm::Event& iEvent, const ed hnLayersVsPhi->Fill(phi, nLayers); hnLayersVsEta->Fill(eta, nLayers); hpt->Fill(pt); + hCurvature->Fill(charge / pt); heta->Fill(eta); hphi->Fill(phi); hz->Fill(zip); @@ -145,8 +148,8 @@ void SiPixelMonitorTrackSoAAlpaka::bookHistograms(DQMStore::IBooker& iBook, // clang-format off std::string toRep = "Number of tracks"; -hnTracks = iBook.book1D("nTracks", fmt::format(";{} per event;#events",toRep), 1001, -0.5, 1000.5); -hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::format(";{} (quality #geq loose) per event;#events",toRep), 1001, -0.5, 1000.5); +hnTracks = iBook.book1D("nTracks", fmt::format(";{} per event;#events",toRep), 1001, -0.5, 2001.5); +hnLooseAndAboveTracks = iBook.book1D("nLooseAndAboveTracks", fmt::format(";{} (quality #geq loose) per event;#events",toRep), 1001, -0.5, 2001.5); toRep = "Number of all RecHits per track (quality #geq loose)"; hnHits = iBook.book1D("nRecHits", fmt::format(";{};#tracks",toRep), 15, -0.5, 14.5); @@ -165,6 +168,7 @@ hChi2VsEta = iBook.bookProfile("nChi2ndofVsEta", fmt::format("{} vs track #eta;T // clang-format on hpt = iBook.book1D("pt", ";Track (quality #geq loose) p_{T} [GeV];#tracks", 200, 0., 200.); + hCurvature = iBook.book1D("curvature", ";Track (quality #geq loose) q/p_{T} [GeV^{-1}];#tracks", 100, -3., 3.); heta = iBook.book1D("eta", ";Track (quality #geq loose) #eta;#tracks", 30, -3., 3.); hphi = iBook.book1D("phi", ";Track (quality #geq loose) #phi;#tracks", 30, -M_PI, M_PI); hz = iBook.book1D("z", ";Track (quality #geq loose) z [cm];#tracks", 30, -30., 30.); diff --git a/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc b/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc index 1d72a7bec4105..12be60250a65a 100644 --- a/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc +++ b/DQM/SiPixelHeterogeneous/plugins/SiPixelTrackComparisonHarvester.cc @@ -28,15 +28,31 @@ SiPixelTrackComparisonHarvester::SiPixelTrackComparisonHarvester(const edm::Para : topFolder_(iConfig.getParameter("topFolderName")) {} void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMStore::IGetter& igetter) { - MonitorElement* hpt_eta_tkAllCPU = igetter.get(topFolder_ + "/ptetatrkAllCPU"); - MonitorElement* hpt_eta_tkAllCPUmatched = igetter.get(topFolder_ + "/ptetatrkAllCPUmatched"); - MonitorElement* hphi_z_tkAllCPU = igetter.get(topFolder_ + "/phiztrkAllCPU"); - MonitorElement* hphi_z_tkAllCPUmatched = igetter.get(topFolder_ + "/phiztrkAllCPUmatched"); + MonitorElement* hpt_eta_tkAllReference = igetter.get(topFolder_ + "/ptetatrkAllReference"); + if (hpt_eta_tkAllReference == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MonitorElement not found: " << topFolder_ << "/ptetatrkAllReference. Skipping."; + return; + } + + MonitorElement* hpt_eta_tkAllReferencematched = igetter.get(topFolder_ + "/ptetatrkAllReferencematched"); + if (hpt_eta_tkAllReferencematched == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MonitorElement not found: " << topFolder_ << "/ptetatrkAllReferencematched. Skipping."; + return; + } + + MonitorElement* hphi_z_tkAllReference = igetter.get(topFolder_ + "/phiztrkAllReference"); + if (hphi_z_tkAllReference == nullptr) { + edm::LogError("SiPixelTrackComparisonHarvester") + << "MonitorElement not found: " << topFolder_ << "/phiztrkAllReference. Skipping."; + return; + } - if (hpt_eta_tkAllCPU == nullptr or hpt_eta_tkAllCPUmatched == nullptr or hphi_z_tkAllCPU == nullptr or - hphi_z_tkAllCPUmatched == nullptr) { + MonitorElement* hphi_z_tkAllReferencematched = igetter.get(topFolder_ + "/phiztrkAllReferencematched"); + if (hphi_z_tkAllReferencematched == nullptr) { edm::LogError("SiPixelTrackComparisonHarvester") - << "MEs needed for this module are not found in the input file. Skipping."; + << "MonitorElement not found: " << topFolder_ << "/phiztrkAllReferencematched. Skipping."; return; } @@ -47,8 +63,8 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS MonitorElement* hphi_z_matchRatio = ibooker.book2D( "matchingeff_phi_z", "Efficiency of track matching; #phi; z [cm];", 30, -M_PI, M_PI, 30, -30., 30.); - hpt_eta_matchRatio->divide(hpt_eta_tkAllCPUmatched, hpt_eta_tkAllCPU, 1., 1., "B"); - hphi_z_matchRatio->divide(hphi_z_tkAllCPUmatched, hphi_z_tkAllCPU, 1., 1., "B"); + hpt_eta_matchRatio->divide(hpt_eta_tkAllReferencematched, hpt_eta_tkAllReference, 1., 1., "B"); + hphi_z_matchRatio->divide(hphi_z_tkAllReferencematched, hphi_z_tkAllReference, 1., 1., "B"); // now create the 1D projection from the 2D histograms std::vector listOfMEsToProject = {"nTracks", @@ -59,12 +75,14 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS "nChi2ndof", "charge", "pt", + "curvature", "eta", "phi", "z", "tip"}; for (const auto& me : listOfMEsToProject) { MonitorElement* input2D = igetter.get(topFolder_ + "/" + me); + edm::LogPrint("SiPixelTrackComparisonHarvester") << "processing " << topFolder_ + "/" + me; this->project2DalongDiagonal(input2D, ibooker); } } @@ -72,7 +90,7 @@ void SiPixelTrackComparisonHarvester::dqmEndJob(DQMStore::IBooker& ibooker, DQMS void SiPixelTrackComparisonHarvester::project2DalongDiagonal(MonitorElement* input2D, DQMStore::IBooker& ibooker) { if (input2D == nullptr) { edm::LogError("SiPixelTrackComparisonHarvester") - << "MEs needed for diagonal projection are not found in the input file. Skipping."; + << "ME needed for diagonal projection is not found in the input file at" << topFolder_ << ". Skipping."; return; } diff --git a/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py b/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py index d39b9e277bec7..32573ec5a5281 100644 --- a/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py +++ b/DQM/SiPixelHeterogeneous/python/SiPixelHeterogenousDQMHarvesting_cff.py @@ -2,19 +2,30 @@ siPixelHeterogeneousDQMHarvesting = cms.Sequence() # empty sequence if not both CPU and GPU recos are run from DQM.SiPixelPhase1Common.SiPixelPhase1RawData_cfi import * -from DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff import SiPixelPhase1RawDataConfForCPU,SiPixelPhase1RawDataConfForGPU +from DQM.SiPixelHeterogeneous.SiPixelHeterogenousDQM_FirstStep_cff import SiPixelPhase1RawDataConfForCPU,SiPixelPhase1RawDataConfForGPU,SiPixelPhase1RawDataConfForSerial,SiPixelPhase1RawDataConfForDevice +# CUDA code siPixelPhase1RawDataHarvesterCPU = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForCPU) siPixelPhase1RawDataHarvesterGPU = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForGPU) +# alpaka code +siPixelPhase1RawDataHarvesterSerial = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForSerial) +siPixelPhase1RawDataHarvesterDevice = SiPixelPhase1RawDataHarvester.clone(histograms = SiPixelPhase1RawDataConfForDevice) + from DQM.SiPixelHeterogeneous.siPixelTrackComparisonHarvester_cfi import * +siPixelTrackComparisonHarvesterAlpaka = siPixelTrackComparisonHarvester.clone(topFolderName = cms.string('SiPixelHeterogeneous/PixelTrackCompareDeviceVSHost')) siPixelHeterogeneousDQMComparisonHarvesting = cms.Sequence(siPixelPhase1RawDataHarvesterCPU * siPixelPhase1RawDataHarvesterGPU * siPixelTrackComparisonHarvester ) +siPixelHeterogeneousDQMComparisonHarvestingAlpaka = cms.Sequence(siPixelPhase1RawDataHarvesterSerial * + siPixelPhase1RawDataHarvesterDevice * + siPixelTrackComparisonHarvesterAlpaka ) + # add the harvester in case of the validation modifier is active from Configuration.ProcessModifiers.gpuValidationPixel_cff import gpuValidationPixel gpuValidationPixel.toReplaceWith(siPixelHeterogeneousDQMHarvesting,siPixelHeterogeneousDQMComparisonHarvesting) - +from Configuration.ProcessModifiers.alpakaValidationPixel_cff import alpakaValidationPixel +(alpakaValidationPixel & ~gpuValidationPixel).toReplaceWith(siPixelHeterogeneousDQMHarvesting,siPixelHeterogeneousDQMComparisonHarvestingAlpaka) From 7aa81d43880c750684534b4cd32278b784374b8f Mon Sep 17 00:00:00 2001 From: Atul Jaiswal Date: Mon, 5 Aug 2024 09:08:55 +0200 Subject: [PATCH 13/33] Era modifier updated from Run3 to Run3_2024 in dqm client configs --- .../python/clients/l1tstage2_dqm_sourceclient-live_cfg.py | 4 ++-- .../clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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..80024d91aa6cd 100644 --- a/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2_dqm_sourceclient-live_cfg.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms import sys -from Configuration.Eras.Era_Run3_cff import Run3 -process = cms.Process("L1TStage2DQM", Run3) +from Configuration.Eras.Era_Run3_2024_cff import Run3_2024 +process = cms.Process("L1TStage2DQM", Run3_2024) unitTest = False if 'unitTest=True' in sys.argv: diff --git a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py index 41e11e6a4bd97..2d1e92d8dd370 100644 --- a/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py +++ b/DQM/Integration/python/clients/l1tstage2emulator_dqm_sourceclient-live_cfg.py @@ -1,8 +1,8 @@ import FWCore.ParameterSet.Config as cms import sys -from Configuration.Eras.Era_Run3_cff import Run3 -process = cms.Process("L1TStage2EmulatorDQM", Run3) +from Configuration.Eras.Era_Run3_2024_cff import Run3_2024 +process = cms.Process("L1TStage2EmulatorDQM", Run3_2024) unitTest = False if 'unitTest=True' in sys.argv: From c4830a136ff9a5a30f6896fb990a14ef7b249995 Mon Sep 17 00:00:00 2001 From: Atul Jaiswal Date: Mon, 17 Jun 2024 12:33:12 +0200 Subject: [PATCH 14/33] Unprescaled AXO seeds (L1_AXO_Nominal, L1_AXO_VTight) added to the unprescaled algo shortlist in L1TStage2uGTTiming config --- DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py index a6ffae4956720..1c5acd7db5ea8 100644 --- a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py +++ b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py @@ -20,7 +20,9 @@ "L1_SingleJet180", "L1_ETMHF130", "L1_HTT360er", - "L1_ETT2000" + "L1_ETT2000", + "L1_AXO_Nominal", + "L1_AXO_VTight" ), prescaledAlgoShortList = cms.untracked.vstring( "L1_FirstCollisionInTrain", From 06962db98810dfe5c8a9631372eaeeb009c6262e Mon Sep 17 00:00:00 2001 From: Atul Jaiswal Date: Mon, 5 Aug 2024 08:33:36 +0200 Subject: [PATCH 15/33] AXO and CICADA seeds added with 2024 era modifier --- .../python/L1TStage2uGTTiming_cfi.py | 89 +++++++++++-------- 1 file changed, 52 insertions(+), 37 deletions(-) diff --git a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py index 1c5acd7db5ea8..924bf8dcef65f 100644 --- a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py +++ b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py @@ -1,46 +1,61 @@ import FWCore.ParameterSet.Config as cms from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +unprescaledAlgoList = cms.untracked.vstring( + "L1_SingleMu22_BMTF", + "L1_SingleMu22_OMTF", + "L1_SingleMu22_EMTF", + "L1_SingleIsoEG28er1p5", + "L1_SingleIsoEG32er2p5", + "L1_SingleEG40er2p5", + "L1_SingleEG60", + "L1_SingleTau120er2p1", + "L1_SingleJet180", + "L1_ETMHF130", + "L1_HTT360er", + "L1_ETT2000" +) +prescaledAlgoList = cms.untracked.vstring( + "L1_FirstCollisionInTrain", + "L1_LastCollisionInTrain", + "L1_IsolatedBunch", + "L1_SingleMu0_BMTF", + "L1_SingleMu0_OMTF", + "L1_SingleMu0_EMTF", + "L1_SingleEG10er2p5", + "L1_SingleEG15er2p5", + "L1_SingleEG26er2p5", + "L1_SingleLooseIsoEG28er1p5", + "L1_SingleJet35", + "L1_SingleJet35er2p5", + "L1_SingleJet35_FWD2p5", + "L1_ETMHF100", + "L1_HTT120er", + "L1_ETT1600" +) + +unprescaledAlgoList_2024 = unprescaledAlgoList +unprescaledAlgoList_2024.append("L1_AXO_Nominal") +unprescaledAlgoList_2024.append("L1_AXO_VTight") +unprescaledAlgoList_2024.append("L1_CICADA_Medium") +unprescaledAlgoList_2024.append("L1_CICADA_VTight") +prescaledAlgoList_2024 = prescaledAlgoList +prescaledAlgoList_2024.remove("L1_ETT1600") + l1tStage2uGTTiming = DQMEDAnalyzer('L1TStage2uGTTiming', - l1tStage2uGtSource = cms.InputTag("gtStage2Digis"), + l1tStage2uGtSource = cms.InputTag("gtStage2Digis"), monitorDir = cms.untracked.string("L1T/L1TStage2uGT/timing_aux"), verbose = cms.untracked.bool(False), firstBXInTrainAlgo = cms.untracked.string("L1_FirstCollisionInTrain"), - lastBXInTrainAlgo = cms.untracked.string("L1_LastCollisionInTrain"), - isoBXAlgo = cms.untracked.string("L1_IsolatedBunch"), - unprescaledAlgoShortList = cms.untracked.vstring( - "L1_SingleMu22_BMTF", - "L1_SingleMu22_OMTF", - "L1_SingleMu22_EMTF", - "L1_SingleIsoEG28er1p5", - "L1_SingleIsoEG32er2p5", - "L1_SingleEG40er2p5", - "L1_SingleEG60", - "L1_SingleTau120er2p1", - "L1_SingleJet180", - "L1_ETMHF130", - "L1_HTT360er", - "L1_ETT2000", - "L1_AXO_Nominal", - "L1_AXO_VTight" - ), - prescaledAlgoShortList = cms.untracked.vstring( - "L1_FirstCollisionInTrain", - "L1_LastCollisionInTrain", - "L1_IsolatedBunch", - "L1_SingleMu0_BMTF", - "L1_SingleMu0_OMTF", - "L1_SingleMu0_EMTF", - "L1_SingleEG10er2p5", - "L1_SingleEG15er2p5", - "L1_SingleEG26er2p5", - "L1_SingleLooseIsoEG28er1p5", - "L1_SingleJet35", - "L1_SingleJet35er2p5", - "L1_SingleJet35_FWD2p5", - "L1_ETMHF100", - "L1_HTT120er", - "L1_ETT1600" - ), + lastBXInTrainAlgo = cms.untracked.string("L1_LastCollisionInTrain"), + isoBXAlgo = cms.untracked.string("L1_IsolatedBunch"), + unprescaledAlgoShortList = unprescaledAlgoList, + prescaledAlgoShortList = prescaledAlgoList, useAlgoDecision = cms.untracked.string("initial") ) + +from Configuration.Eras.Modifier_run3_2024_L1T_cff import run3_2024_L1T +run3_2024_L1T.toModify(l1tStage2uGTTiming, + unprescaledAlgoShortList = unprescaledAlgoList_2024, + prescaledAlgoShortList = prescaledAlgoList_2024 +) From 41198678919815853399c063f00fc5bd4cbd7299 Mon Sep 17 00:00:00 2001 From: Atul Jaiswal Date: Fri, 9 Aug 2024 13:11:37 +0200 Subject: [PATCH 16/33] Update DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py --- .../python/L1TStage2uGTTiming_cfi.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py index 924bf8dcef65f..b9fe28c31fec7 100644 --- a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py +++ b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py @@ -34,13 +34,17 @@ "L1_ETT1600" ) -unprescaledAlgoList_2024 = unprescaledAlgoList -unprescaledAlgoList_2024.append("L1_AXO_Nominal") -unprescaledAlgoList_2024.append("L1_AXO_VTight") -unprescaledAlgoList_2024.append("L1_CICADA_Medium") -unprescaledAlgoList_2024.append("L1_CICADA_VTight") -prescaledAlgoList_2024 = prescaledAlgoList -prescaledAlgoList_2024.remove("L1_ETT1600") +unprescaledAlgoList_2024 = cms.untracked.vstring(unprescaledAlgoList) +unprescaledAlgoList_2024.extend([ + "L1_AXO_Nominal", + "L1_AXO_VTight", + "L1_CICADA_Medium", + "L1_CICADA_VTight" +]) + +prescaledAlgoList_2024 = cms.untracked.vstring(prescaledAlgoList) +if "L1_ETT1600" in prescaledAlgoList_2024: + prescaledAlgoList_2024.remove("L1_ETT1600") l1tStage2uGTTiming = DQMEDAnalyzer('L1TStage2uGTTiming', l1tStage2uGtSource = cms.InputTag("gtStage2Digis"), From 112093be5a2622e832a2514743b87a8a1819f3f1 Mon Sep 17 00:00:00 2001 From: Max Zhao Date: Tue, 27 Aug 2024 05:31:43 +0200 Subject: [PATCH 17/33] 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 ------------ From 5e004e119f760f748802762d0ff2e98a72567166 Mon Sep 17 00:00:00 2001 From: Byeonghak Ko Date: Tue, 27 Aug 2024 10:36:58 +0200 Subject: [PATCH 18/33] A cosmetic bug for the summary plot has been fixed --- DQM/GEM/plugins/GEMDQMHarvester.cc | 3 ++- DQM/GEM/src/GEMDQMBase.cc | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/DQM/GEM/plugins/GEMDQMHarvester.cc b/DQM/GEM/plugins/GEMDQMHarvester.cc index 8437308c764e4..f7043cbf51d18 100644 --- a/DQM/GEM/plugins/GEMDQMHarvester.cc +++ b/DQM/GEM/plugins/GEMDQMHarvester.cc @@ -349,12 +349,13 @@ void GEMDQMHarvester::getGeometryInfo(edm::Service &store, MonitorElem if (h2Src != nullptr) { // For online and offline Int_t nBinY = h2Src->getNbinsY(); listLayer_.push_back(""); + Int_t nNumMerge = std::max((Int_t)(h2Src->getBinContent(0, 0) + 0.5), 1); for (Int_t i = 1; i <= nBinY; i++) { std::string strLabelFull = h2Src->getTH2F()->GetYaxis()->GetBinLabel(i); auto nPos = strLabelFull.find(';'); auto strLayer = strLabelFull.substr(nPos + 1); - Int_t nBinXActual = (Int_t)(h2Src->getBinContent(0, i) + 0.5); + Int_t nBinXActual = ((Int_t)(h2Src->getBinContent(0, i) + 0.5)) / nNumMerge; if (nBinXActual > 108) { // When the number seems wrong if (strLayer.find("GE11") != std::string::npos) { nBinXActual = 36; diff --git a/DQM/GEM/src/GEMDQMBase.cc b/DQM/GEM/src/GEMDQMBase.cc index 0544639cdcf7a..5328c0e204bc4 100644 --- a/DQM/GEM/src/GEMDQMBase.cc +++ b/DQM/GEM/src/GEMDQMBase.cc @@ -189,6 +189,8 @@ dqm::impl::MonitorElement* GEMDQMBase::CreateSummaryHist(DQMStore::IBooker& iboo h2Res->setBinContent(0, i, nNumCh); } + h2Res->setBinContent(0, 0, 1.0); + return h2Res; } From b8e0b48ee7b91af08117d019ff18753124ea6629 Mon Sep 17 00:00:00 2001 From: Michal Bluj Date: Mon, 26 Aug 2024 17:41:58 +0200 Subject: [PATCH 19/33] bug fix: move intialization genJetMatch token outside loop --- PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc b/PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc index b23824ed88310..1ad51db3bfdcd 100644 --- a/PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc +++ b/PhysicsTools/PatAlgos/plugins/PATTauHybridProducer.cc @@ -75,11 +75,11 @@ PATTauHybridProducer::PATTauHybridProducer(const edm::ParameterSet& cfg) utagJetScoreNames_.push_back(name); if (UtagPtCorrName_.find(':') != std::string::npos) UtagPtCorrName_ = UtagPtCorrName_.substr(UtagPtCorrName_.find(':') + 1); - // GenJet matching - if (addGenJetMatch_) { - genJetMatchToken_ = - consumes>(cfg.getParameter("genJetMatch")); - } + } + // GenJet matching + if (addGenJetMatch_) { + genJetMatchToken_ = + consumes>(cfg.getParameter("genJetMatch")); } produces>(); From 8e62041a3aa0cc0d3d0612d655b29a176877b14e Mon Sep 17 00:00:00 2001 From: Jan Chyczynski Date: Thu, 22 Aug 2024 22:31:11 +0200 Subject: [PATCH 20/33] Add certificates handling to Tier0Handler Allow overriding T0 api url by TIER0_API_URL env variable on retry provie both proxy and cert --- CondCore/Utilities/python/tier0.py | 89 +++++++++++++++++------------- 1 file changed, 52 insertions(+), 37 deletions(-) diff --git a/CondCore/Utilities/python/tier0.py b/CondCore/Utilities/python/tier0.py index 47dea331c9081..ba807914ee1f5 100644 --- a/CondCore/Utilities/python/tier0.py +++ b/CondCore/Utilities/python/tier0.py @@ -11,7 +11,7 @@ import pycurl -tier0Url = 'https://cmsweb.cern.ch/t0wmadatasvc/prod/' +tier0Url = os.getenv('TIER0_API_URL', 'https://cmsweb.cern.ch/t0wmadatasvc/prod/') class Tier0Error(Exception): '''Tier0 exception. @@ -23,7 +23,7 @@ def __init__(self, message): def unique(seq, keepstr=True): t = type(seq) - if t in (unicode, str): + if t is str: t = (list, t('').join)[bool(keepstr)] try: remaining = set(seq) @@ -90,6 +90,37 @@ def unsetDebug( self ): def setProxy( self, proxy ): self._proxy = proxy + def _getCerts( self ) -> str: + cert_path = os.getenv('X509_USER_CERT', '') + key_path = os.getenv('X509_USER_KEY', '') + + certs = "" + if cert_path: + certs += f' --cert {cert_path}' + else: + logging.warning("No certificate provided for Tier0 access") + if key_path: + certs += f' --key {key_path}' + return certs + + def _curlQueryTier0( self, url:str, force_debug:bool = False, force_cert:bool = False): + userAgent = "User-Agent: ConditionWebServices/1.0 python/%d.%d.%d PycURL/%s" \ + % ( sys.version_info[ :3 ] + ( pycurl.version_info()[ 1 ], ) ) + debug = "-v" if self._debug or force_debug else "-s -S" + + proxy = f"--proxy {self._proxy}" if self._proxy else "" + certs = self._getCerts() if not self._proxy or force_cert else "" + + cmd = '/usr/bin/curl -k -L --user-agent "%s" %s --connect-timeout %i --retry %i %s %s %s' \ + % (userAgent, proxy, self._timeOut, self._retries, debug, url, certs) + + # time the curl to understand if re-tries have been carried out + start = time.time() + process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdoutdata, stderrdata) = process.communicate() + end = time.time() + return process.returncode, stdoutdata, stderrdata, end-start + def _queryTier0DataSvc( self, url ): """ Queries Tier0DataSvc. @@ -97,44 +128,28 @@ def _queryTier0DataSvc( self, url ): @returns: dictionary, from whence the required information must be retrieved according to the API call. Raises if connection error, bad response, or timeout after retries occur. """ - - userAgent = "User-Agent: ConditionWebServices/1.0 python/%d.%d.%d PycURL/%s" % ( sys.version_info[ :3 ] + ( pycurl.version_info()[ 1 ], ) ) - proxy = "" - if self._proxy: proxy = ' --proxy=%s ' % self._proxy - - debug = " -s -S " - if self._debug: debug = " -v " - - cmd = '/usr/bin/curl -k -L --user-agent "%s" %s --connect-timeout %i --retry %i %s %s ' % (userAgent, proxy, self._timeOut, self._retries, debug, url) - - # time the curl to understand if re-tries have been carried out - start = time.time() - process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (stdoutdata, stderrdata) = process.communicate() - retcode = process.returncode - end = time.time() + retcode, stdoutdata, stderrdata, query_time = self._curlQueryTier0(url) if retcode != 0 or stderrdata: - - # if the first curl has failed, logg its stderror and prepare and independent retry - msg = "looks like curl returned an error: retcode=%s and took %s seconds" % (retcode,(end-start),) - msg += ' msg = "'+str(stderrdata)+'"' - logging.error(msg) - - time.sleep(10) - cmd = '/usr/bin/curl -k -L --user-agent "%s" %s --connect-timeout %i --retry %i %s %s ' % (userAgent, proxy, self._timeOut, self._retries, "-v", url) - process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - (stdoutdata, stderrdata) = process.communicate() - retcode = process.returncode - if retcode != 0: - msg = "looks like curl returned an error for the second time: retcode=%s" % (retcode,) - msg += ' msg = "'+str(stderrdata)+'"' - logging.error(msg) - raise Tier0Error(msg) - else : - msg = "curl returned ok upon the second try" - logging.info(msg) + + # if the first curl has failed, logg its stderror and prepare and independent retry + msg = "looks like curl returned an error: retcode=%s and took %s seconds" % (retcode, query_time,) + msg += ' msg = "'+str(stderrdata)+'"' + logging.error(msg) + if self._proxy: + logging.info("before assumed proxy provides authentication, now trying with both proxy and certificate") + + time.sleep(10) + retcode, stdoutdata, stderrdata, query_time = self._curlQueryTier0(url, force_debug=True, force_cert=True) + if retcode != 0: + msg = "looks like curl returned an error for the second time: retcode=%s" % (retcode,) + msg += ' msg = "'+str(stderrdata)+'"' + logging.error(msg) + raise Tier0Error(msg) + else: + msg = "curl returned ok upon the second try" + logging.info(msg) resp = json.loads( ''.join(stdoutdata.decode()).replace( "'", '"').replace(' None', ' "None"') ) return resp From 683fcc711bbfdff1aba775ee553522f045cbf878 Mon Sep 17 00:00:00 2001 From: Junghwan John Goh Date: Thu, 1 Aug 2024 14:26:50 +0200 Subject: [PATCH 21/33] set default draw option to colz for 2d plots, increase x-range of ring1 residual plot --- Validation/MuonRPCDigis/src/RPCDigiValid.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Validation/MuonRPCDigis/src/RPCDigiValid.cc b/Validation/MuonRPCDigis/src/RPCDigiValid.cc index 6ae4f5921d34f..2d8e7eda95565 100644 --- a/Validation/MuonRPCDigis/src/RPCDigiValid.cc +++ b/Validation/MuonRPCDigis/src/RPCDigiValid.cc @@ -201,6 +201,7 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run // RZ plot hRZ_ = booker.book2D("RZ", "R-Z view;Z (cm);R (cm)", nbinsZ, -maxZ, maxZ, nbinsR, minR, maxR); + hRZ_->setOption("colz"); // XY plots hXY_Barrel_ = booker.book2D("XY_Barrel", "X-Y view of Barrel", nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY); @@ -211,6 +212,8 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run const std::string meTitleN = fmt::format("X-Y view of Endcap{:+1d};X (cm);Y (cm)", -disk); hXY_Endcap_[disk] = booker.book2D(meNameP, meTitleP, nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY); hXY_Endcap_[-disk] = booker.book2D(meNameN, meTitleN, nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY); + hXY_Endcap_[disk]->setOption("colz"); + hXY_Endcap_[-disk]->setOption("colz"); } // Z-phi plots @@ -218,6 +221,7 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run const std::string meName = fmt::format("ZPhi_Layer{:1d}", layer); const std::string meTitle = fmt::format("Z-#phi view of Layer{:1d};Z (cm);#phi (degree)", layer); hZPhi_[layer] = booker.book2D(meName, meTitle, nbinsBarrelZ, -maxBarrelZ, maxBarrelZ, nbinsPhi, -180, 180); + hZPhi_[layer]->setOption("colz"); } // Strip profile @@ -267,9 +271,7 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run hResEndcapDisks_[-disk] = booker.book1D(meNameN, meTitleN, 100, -8, 8); } - for (int ring = 1; ring <= 3; ++ring) { - const std::string meName = fmt::format("Residual_Endcap_Ring{:1d}", ring); - const std::string meTitle = fmt::format("Residual of Endcap Ring{:1d};dx (cm)", ring); - hResEndcapRings_[ring] = booker.book1D(meName, meTitle, 100, -8, 8); - } + hResEndcapRings_[1] = booker.book1D("Residual_Endcap_Ring1", "Residual of Endcap Ring1;dx (cm)", 100, -12, 12); + hResEndcapRings_[2] = booker.book1D("Residual_Endcap_Ring2", "Residual of Endcap Ring2;dx (cm)", 100, -8, 8); + hResEndcapRings_[3] = booker.book1D("Residual_Endcap_Ring3", "Residual of Endcap Ring3;dx (cm)", 100, -8, 8); } From cc8612b2a8db7bd2703f2414246eb696ef3e130d Mon Sep 17 00:00:00 2001 From: Junghwan John Goh Date: Thu, 1 Aug 2024 16:07:50 +0200 Subject: [PATCH 22/33] make digi time distribution only for phase2 upgrades using the era modifiers --- .../MuonRPCDigis/interface/RPCDigiValid.h | 1 + .../python/validationMuonRPCDigis_cfi.py | 6 ++++ Validation/MuonRPCDigis/src/RPCDigiValid.cc | 32 +++++++++++-------- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/Validation/MuonRPCDigis/interface/RPCDigiValid.h b/Validation/MuonRPCDigis/interface/RPCDigiValid.h index b7896a53b6c4c..2d3b32a0ef169 100644 --- a/Validation/MuonRPCDigis/interface/RPCDigiValid.h +++ b/Validation/MuonRPCDigis/interface/RPCDigiValid.h @@ -45,6 +45,7 @@ class RPCDigiValid : public DQMEDAnalyzer { MonitorElement *hBxDisc_4Min_; // Timing information + bool isDigiTimeAvailable_; MonitorElement *hDigiTimeAll_, *hDigiTime_, *hDigiTimeIRPC_, *hDigiTimeNoIRPC_; // Multiplicity plots diff --git a/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py b/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py index e04d953a5e736..d1c89422eb6f6 100644 --- a/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py +++ b/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py @@ -8,9 +8,15 @@ # Tag for simulated hits event data retrieval simHitTag = cms.untracked.InputTag("g4SimHits", "MuonRPCHits"), + # Flag to turn on/off timing plots + digiTime = cms.untracked.bool(False), + # Name of the root file which will contain the histos outputFile = cms.untracked.string('') ) from Configuration.Eras.Modifier_fastSim_cff import fastSim fastSim.toModify(validationMuonRPCDigis, simHitTag = "MuonSimHits:MuonRPCHits") + +from Configuration.Eras.Modifier_phase2_common_cff import phase2_common +phase2_common.toModify(validationMuonRPCDigis, digiTime = True) diff --git a/Validation/MuonRPCDigis/src/RPCDigiValid.cc b/Validation/MuonRPCDigis/src/RPCDigiValid.cc index 2d8e7eda95565..70a08c455f795 100644 --- a/Validation/MuonRPCDigis/src/RPCDigiValid.cc +++ b/Validation/MuonRPCDigis/src/RPCDigiValid.cc @@ -26,6 +26,8 @@ RPCDigiValid::RPCDigiValid(const ParameterSet &ps) { rpcDigiToken_ = consumes( ps.getUntrackedParameter("rpcDigiTag", edm::InputTag("simMuonRPCDigis"))); + isDigiTimeAvailable_ = ps.getUntrackedParameter("digiTime", false); + rpcGeomToken_ = esConsumes(); } @@ -122,14 +124,16 @@ void RPCDigiValid::analyze(const Event &event, const EventSetup &eventSetup) { } // Fill timing information - const double digiTime = digiIt->hasTime() ? digiIt->time() : digiIt->bx() * 25; - hDigiTimeAll_->Fill(digiTime); - if (digiIt->hasTime()) { - hDigiTime_->Fill(digiTime); - if (roll->isIRPC()) - hDigiTimeIRPC_->Fill(digiTime); - else - hDigiTimeNoIRPC_->Fill(digiTime); + if ( isDigiTimeAvailable_ ) { + const double digiTime = digiIt->hasTime() ? digiIt->time() : digiIt->bx() * 25; + hDigiTimeAll_->Fill(digiTime); + if (digiIt->hasTime()) { + hDigiTime_->Fill(digiTime); + if (roll->isIRPC()) + hDigiTimeIRPC_->Fill(digiTime); + else + hDigiTimeNoIRPC_->Fill(digiTime); + } } // Keep digi position @@ -237,11 +241,13 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run hBxDisc_4Min_ = booker.book1D("BxDisc_4Min", "BxDisc_4Min", 20, -10., 10.); // Timing informations - hDigiTimeAll_ = - booker.book1D("DigiTimeAll", "Digi time including present electronics;Digi time (ns)", 100, -12.5, 12.5); - hDigiTime_ = booker.book1D("DigiTime", "Digi time only with timing information;Digi time (ns)", 100, -12.5, 12.5); - hDigiTimeIRPC_ = booker.book1D("DigiTimeIRPC", "IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5); - hDigiTimeNoIRPC_ = booker.book1D("DigiTimeNoIRPC", "non-IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5); + if ( isDigiTimeAvailable_ ) { + hDigiTimeAll_ = + booker.book1D("DigiTimeAll", "Digi time including present electronics;Digi time (ns)", 100, -12.5, 12.5); + hDigiTime_ = booker.book1D("DigiTime", "Digi time only with timing information;Digi time (ns)", 100, -12.5, 12.5); + hDigiTimeIRPC_ = booker.book1D("DigiTimeIRPC", "IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5); + hDigiTimeNoIRPC_ = booker.book1D("DigiTimeNoIRPC", "non-IRPC Digi time;Digi time (ns)", 100, -12.5, 12.5); + } // SimHit and Digi multiplicity per roll hNSimHitPerRoll_ = booker.book1D("NSimHitPerRoll", "SimHit multiplicity per Roll;Multiplicity", 10, 0, 10); From 44f1c72d6226fb07607c43390ac8ecc34b342250 Mon Sep 17 00:00:00 2001 From: Junghwan John Goh Date: Thu, 1 Aug 2024 16:09:37 +0200 Subject: [PATCH 23/33] remove deprecated parameter only in cfi file --- Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py b/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py index d1c89422eb6f6..bb5be6e10d096 100644 --- a/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py +++ b/Validation/MuonRPCDigis/python/validationMuonRPCDigis_cfi.py @@ -9,10 +9,7 @@ simHitTag = cms.untracked.InputTag("g4SimHits", "MuonRPCHits"), # Flag to turn on/off timing plots - digiTime = cms.untracked.bool(False), - - # Name of the root file which will contain the histos - outputFile = cms.untracked.string('') + digiTime = cms.untracked.bool(False) ) from Configuration.Eras.Modifier_fastSim_cff import fastSim From 3ae7be13eb8042c966d2d22ba06470b083bff779 Mon Sep 17 00:00:00 2001 From: Junghwan John Goh Date: Thu, 1 Aug 2024 16:11:43 +0200 Subject: [PATCH 24/33] apply code format --- Validation/MuonRPCDigis/src/RPCDigiValid.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Validation/MuonRPCDigis/src/RPCDigiValid.cc b/Validation/MuonRPCDigis/src/RPCDigiValid.cc index 70a08c455f795..bc5b59d6a530c 100644 --- a/Validation/MuonRPCDigis/src/RPCDigiValid.cc +++ b/Validation/MuonRPCDigis/src/RPCDigiValid.cc @@ -124,7 +124,7 @@ void RPCDigiValid::analyze(const Event &event, const EventSetup &eventSetup) { } // Fill timing information - if ( isDigiTimeAvailable_ ) { + if (isDigiTimeAvailable_) { const double digiTime = digiIt->hasTime() ? digiIt->time() : digiIt->bx() * 25; hDigiTimeAll_->Fill(digiTime); if (digiIt->hasTime()) { @@ -241,7 +241,7 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run hBxDisc_4Min_ = booker.book1D("BxDisc_4Min", "BxDisc_4Min", 20, -10., 10.); // Timing informations - if ( isDigiTimeAvailable_ ) { + if (isDigiTimeAvailable_) { hDigiTimeAll_ = booker.book1D("DigiTimeAll", "Digi time including present electronics;Digi time (ns)", 100, -12.5, 12.5); hDigiTime_ = booker.book1D("DigiTime", "Digi time only with timing information;Digi time (ns)", 100, -12.5, 12.5); From 75b30b09aad5d876c2cf5d4b71d3954331fb27a6 Mon Sep 17 00:00:00 2001 From: Junghwan John Goh Date: Wed, 14 Aug 2024 16:53:00 +0200 Subject: [PATCH 25/33] missing colz option to 2d histogram --- Validation/MuonRPCDigis/src/RPCDigiValid.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/Validation/MuonRPCDigis/src/RPCDigiValid.cc b/Validation/MuonRPCDigis/src/RPCDigiValid.cc index bc5b59d6a530c..e6e69d65d4e38 100644 --- a/Validation/MuonRPCDigis/src/RPCDigiValid.cc +++ b/Validation/MuonRPCDigis/src/RPCDigiValid.cc @@ -209,6 +209,7 @@ void RPCDigiValid::bookHistograms(DQMStore::IBooker &booker, edm::Run const &run // XY plots hXY_Barrel_ = booker.book2D("XY_Barrel", "X-Y view of Barrel", nbinsXY, -maxXY, maxXY, nbinsXY, -maxXY, maxXY); + hXY_Barrel_->setOption("colz"); for (int disk = 1; disk <= 4; ++disk) { const std::string meNameP = fmt::format("XY_Endcap_p{:1d}", disk); const std::string meNameN = fmt::format("XY_Endcap_m{:1d}", disk); From 6b68a34087426e4f137fa5a94d591582ad191e48 Mon Sep 17 00:00:00 2001 From: Alessandro Lapertosa Date: Fri, 30 Aug 2024 10:53:07 +0200 Subject: [PATCH 26/33] improve QTest Pixel DQM --- .../qTests/mean_charge_qualitytest_config.xml | 80 +++++++++---------- .../qTests/mean_size_qualitytest_config.xml | 8 +- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/DQM/SiPixelPhase1Config/test/qTests/mean_charge_qualitytest_config.xml b/DQM/SiPixelPhase1Config/test/qTests/mean_charge_qualitytest_config.xml index 0152b5deaa7c0..8caff0998b1a8 100644 --- a/DQM/SiPixelPhase1Config/test/qTests/mean_charge_qualitytest_config.xml +++ b/DQM/SiPixelPhase1Config/test/qTests/mean_charge_qualitytest_config.xml @@ -8,7 +8,7 @@ 0 0.65 0.80 - 27500. + 15000. 75000. @@ -17,7 +17,7 @@ 0 0.65 0.80 - 27500. + 15000. 75000. @@ -26,7 +26,7 @@ 0 0.65 0.80 - 35000. + 15000. 75000. @@ -35,7 +35,7 @@ 0 0.65 0.80 - 30000. + 15000. 75000. @@ -45,7 +45,7 @@ 0 0.75 0.90 - 35000. + 15000. 75000. @@ -54,7 +54,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -63,7 +63,7 @@ 0 0.75 0.90 - 35000. + 15000. 75000. @@ -72,7 +72,7 @@ 0 0.75 0.90 - 25000. + 15000. 75000. @@ -82,7 +82,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -91,7 +91,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -100,7 +100,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -109,7 +109,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -119,7 +119,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -128,7 +128,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -137,7 +137,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -146,7 +146,7 @@ 0 0.85 0.95 - 35000. + 15000. 75000. @@ -158,7 +158,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -167,7 +167,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -176,7 +176,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -186,7 +186,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -195,7 +195,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -204,7 +204,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -216,7 +216,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -225,7 +225,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -234,7 +234,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -244,7 +244,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -253,7 +253,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -262,7 +262,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -274,7 +274,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -283,7 +283,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -292,7 +292,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -302,7 +302,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -311,7 +311,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -320,7 +320,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -332,7 +332,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -341,7 +341,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -350,7 +350,7 @@ 0 0.85 0.95 - 20000. + 15000. 50000. @@ -360,7 +360,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -369,7 +369,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. @@ -378,7 +378,7 @@ 0 0.85 0.95 - 25000. + 15000. 50000. diff --git a/DQM/SiPixelPhase1Config/test/qTests/mean_size_qualitytest_config.xml b/DQM/SiPixelPhase1Config/test/qTests/mean_size_qualitytest_config.xml index a399b87d88a94..9b89bc34c379e 100644 --- a/DQM/SiPixelPhase1Config/test/qTests/mean_size_qualitytest_config.xml +++ b/DQM/SiPixelPhase1Config/test/qTests/mean_size_qualitytest_config.xml @@ -9,7 +9,7 @@ 0.65 0.80 1.5 - 6. + 7. @@ -18,7 +18,7 @@ 0.65 0.80 1.5 - 6. + 7. @@ -27,7 +27,7 @@ 0.65 0.80 1.5 - 6. + 7. @@ -36,7 +36,7 @@ 0.65 0.80 1.5 - 6. + 7. From f9bbcefe9c1cb4510fdf72f5d633f13d24bffaea Mon Sep 17 00:00:00 2001 From: Andre Govinda Stahl Leiton Date: Sat, 31 Aug 2024 23:25:17 +0200 Subject: [PATCH 27/33] Add option to sort UParT input candidates by pT --- ...edParticleTransformerAK4TagInfoProducer.cc | 41 ++++++++++++++----- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/RecoBTag/FeatureTools/plugins/UnifiedParticleTransformerAK4TagInfoProducer.cc b/RecoBTag/FeatureTools/plugins/UnifiedParticleTransformerAK4TagInfoProducer.cc index 349da4f98f797..f9ba49ed31205 100644 --- a/RecoBTag/FeatureTools/plugins/UnifiedParticleTransformerAK4TagInfoProducer.cc +++ b/RecoBTag/FeatureTools/plugins/UnifiedParticleTransformerAK4TagInfoProducer.cc @@ -79,6 +79,8 @@ class UnifiedParticleTransformerAK4TagInfoProducer : public edm::stream::EDProdu const double jet_radius_; const double min_candidate_pt_; const bool flip_; + const bool sort_cand_by_pt_; + const bool fix_lt_sorting_; const edm::EDGetTokenT> jet_token_; const edm::EDGetTokenT vtx_token_; @@ -108,6 +110,8 @@ UnifiedParticleTransformerAK4TagInfoProducer::UnifiedParticleTransformerAK4TagIn : jet_radius_(iConfig.getParameter("jet_radius")), min_candidate_pt_(iConfig.getParameter("min_candidate_pt")), flip_(iConfig.getParameter("flip")), + sort_cand_by_pt_(iConfig.getParameter("sort_cand_by_pt")), + fix_lt_sorting_(iConfig.getParameter("fix_lt_sorting")), jet_token_(consumes>(iConfig.getParameter("jets"))), vtx_token_(consumes(iConfig.getParameter("vertices"))), lt_token_(consumes>(iConfig.getParameter("losttracks"))), @@ -154,6 +158,8 @@ void UnifiedParticleTransformerAK4TagInfoProducer::fillDescriptions(edm::Configu desc.add("jet_radius", 0.4); desc.add("min_candidate_pt", 0.10); desc.add("flip", false); + desc.add("sort_cand_by_pt", false); + desc.add("fix_lt_sorting", false); desc.add("vertices", edm::InputTag("offlinePrimaryVertices")); desc.add("losttracks", edm::InputTag("lostTracks")); desc.add("puppi_value_map", edm::InputTag("puppi")); @@ -275,10 +281,16 @@ void UnifiedParticleTransformerAK4TagInfoProducer::produce(edm::Event& iEvent, c auto& trackinfo = lt_trackinfos.emplace(i, track_builder).first->second; trackinfo.buildTrackInfo(PackedCandidate_, jet_dir, jet_ref_track_dir, pv); - lt_sorted.emplace_back(i, - trackinfo.getTrackSip2dSig(), - -btagbtvdeep::mindrsvpfcand(svs_unsorted, PackedCandidate_), - PackedCandidate_->pt() / jet.pt()); + if (sort_cand_by_pt_) + lt_sorted.emplace_back(i, + PackedCandidate_->pt() / jet.pt(), + trackinfo.getTrackSip2dSig(), + -btagbtvdeep::mindrsvpfcand(svs_unsorted, PackedCandidate_)); + else + lt_sorted.emplace_back(i, + trackinfo.getTrackSip2dSig(), + -btagbtvdeep::mindrsvpfcand(svs_unsorted, PackedCandidate_), + PackedCandidate_->pt() / jet.pt()); ltPtrs.push_back(cand); } @@ -312,7 +324,7 @@ void UnifiedParticleTransformerAK4TagInfoProducer::produce(edm::Event& iEvent, c float drminpfcandsv = btagbtvdeep::mindrsvpfcand(svs_unsorted, PackedCandidate_); float distminpfcandsv = 0; - size_t entry = lt_sortedindices.at(i); + size_t entry = lt_sortedindices.at(fix_lt_sorting_ ? lt_sorted[i].get() : i); // get cached track info auto& trackinfo = lt_trackinfos.emplace(i, track_builder).first->second; trackinfo.buildTrackInfo(PackedCandidate_, jet_dir, jet_ref_track_dir, pv); @@ -353,12 +365,21 @@ void UnifiedParticleTransformerAK4TagInfoProducer::produce(edm::Event& iEvent, c auto& trackinfo = trackinfos.emplace(i, track_builder).first->second; trackinfo.buildTrackInfo(cand, jet_dir, jet_ref_track_dir, pv); - c_sorted.emplace_back(i, - trackinfo.getTrackSip2dSig(), - -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), - cand->pt() / jet.pt()); + if (sort_cand_by_pt_) + c_sorted.emplace_back(i, + cand->pt() / jet.pt(), + trackinfo.getTrackSip2dSig(), + -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand)); + else + c_sorted.emplace_back(i, + trackinfo.getTrackSip2dSig(), + -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), + cand->pt() / jet.pt()); } else { - n_sorted.emplace_back(i, -1, -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), cand->pt() / jet.pt()); + if (sort_cand_by_pt_) + n_sorted.emplace_back(i, cand->pt() / jet.pt(), -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), -1); + else + n_sorted.emplace_back(i, -1, -btagbtvdeep::mindrsvpfcand(svs_unsorted, cand), cand->pt() / jet.pt()); } } } From 65793571c9b4e0441f0f89486d7590ff19634154 Mon Sep 17 00:00:00 2001 From: Marino Missiroli Date: Fri, 16 Aug 2024 11:22:12 +0200 Subject: [PATCH 28/33] rename modifier run3_2024_L1T to stage2L1Trigger_2024 --- Configuration/Eras/python/Era_Run3_2024_cff.py | 4 ++-- ...24_L1T_cff.py => Modifier_stage2L1Trigger_2024_cff.py} | 2 +- DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py | 4 ++-- L1Trigger/L1TMuonBarrel/python/simKBmtfDigis_cfi.py | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) rename Configuration/Eras/python/{Modifier_run3_2024_L1T_cff.py => Modifier_stage2L1Trigger_2024_cff.py} (52%) diff --git a/Configuration/Eras/python/Era_Run3_2024_cff.py b/Configuration/Eras/python/Era_Run3_2024_cff.py index fec4b81b1ddfb..76d2d31177c0a 100644 --- a/Configuration/Eras/python/Era_Run3_2024_cff.py +++ b/Configuration/Eras/python/Era_Run3_2024_cff.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms from Configuration.Eras.Era_Run3_cff import Run3 -from Configuration.Eras.Modifier_run3_2024_L1T_cff import run3_2024_L1T +from Configuration.Eras.Modifier_stage2L1Trigger_2024_cff import stage2L1Trigger_2024 -Run3_2024 = cms.ModifierChain(Run3, run3_2024_L1T) +Run3_2024 = cms.ModifierChain(Run3, stage2L1Trigger_2024) diff --git a/Configuration/Eras/python/Modifier_run3_2024_L1T_cff.py b/Configuration/Eras/python/Modifier_stage2L1Trigger_2024_cff.py similarity index 52% rename from Configuration/Eras/python/Modifier_run3_2024_L1T_cff.py rename to Configuration/Eras/python/Modifier_stage2L1Trigger_2024_cff.py index 7a981a35023ac..e8140b6718e9e 100644 --- a/Configuration/Eras/python/Modifier_run3_2024_L1T_cff.py +++ b/Configuration/Eras/python/Modifier_stage2L1Trigger_2024_cff.py @@ -1,3 +1,3 @@ import FWCore.ParameterSet.Config as cms -run3_2024_L1T = cms.Modifier() +stage2L1Trigger_2024 = cms.Modifier() diff --git a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py index b9fe28c31fec7..f3d76de4717ec 100644 --- a/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py +++ b/DQM/L1TMonitor/python/L1TStage2uGTTiming_cfi.py @@ -58,8 +58,8 @@ useAlgoDecision = cms.untracked.string("initial") ) -from Configuration.Eras.Modifier_run3_2024_L1T_cff import run3_2024_L1T -run3_2024_L1T.toModify(l1tStage2uGTTiming, +from Configuration.Eras.Modifier_stage2L1Trigger_2024_cff import stage2L1Trigger_2024 +stage2L1Trigger_2024.toModify(l1tStage2uGTTiming, unprescaledAlgoShortList = unprescaledAlgoList_2024, prescaledAlgoShortList = prescaledAlgoList_2024 ) diff --git a/L1Trigger/L1TMuonBarrel/python/simKBmtfDigis_cfi.py b/L1Trigger/L1TMuonBarrel/python/simKBmtfDigis_cfi.py index 42d79cefae658..85d543aa26ff4 100644 --- a/L1Trigger/L1TMuonBarrel/python/simKBmtfDigis_cfi.py +++ b/L1Trigger/L1TMuonBarrel/python/simKBmtfDigis_cfi.py @@ -1,5 +1,5 @@ import FWCore.ParameterSet.Config as cms -from Configuration.Eras.Modifier_run3_2024_L1T_cff import run3_2024_L1T +from Configuration.Eras.Modifier_stage2L1Trigger_2024_cff import stage2L1Trigger_2024 bmtfKalmanTrackingSettings = cms.PSet( verbose = cms.bool(False), # @@ -51,12 +51,12 @@ useNewQualityCalculation = cms.bool(False), ) -run3_2024_L1T.toModify( + +stage2L1Trigger_2024.toModify( bmtfKalmanTrackingSettings, - useNewQualityCalculation = cms.bool(True), + useNewQualityCalculation = True, ) - simKBmtfDigis = cms.EDProducer("L1TMuonBarrelKalmanTrackProducer", src = cms.InputTag("simKBmtfStubs"), bx = cms.vint32(-2,-1,0,1,2), From 02d008f8fbf7600e727eee880cb10d38a0a991d0 Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 29 Aug 2024 22:42:18 +0200 Subject: [PATCH 29/33] TrackingRecHitsSoACollection: early return hostData when there aren't hits --- .../interface/alpaka/TrackingRecHitsSoACollection.h | 10 ++++++++++ .../plugins/alpaka/CAHitNtupletGenerator.cc | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/DataFormats/TrackingRecHitSoA/interface/alpaka/TrackingRecHitsSoACollection.h b/DataFormats/TrackingRecHitSoA/interface/alpaka/TrackingRecHitsSoACollection.h index da3c3bef3928d..3374863ea1327 100644 --- a/DataFormats/TrackingRecHitSoA/interface/alpaka/TrackingRecHitsSoACollection.h +++ b/DataFormats/TrackingRecHitSoA/interface/alpaka/TrackingRecHitsSoACollection.h @@ -34,6 +34,16 @@ namespace cms::alpakatools { template static auto copyAsync(TQueue& queue, TrackingRecHitDevice const& deviceData) { TrackingRecHitHost hostData(queue, deviceData.view().metadata().size()); + + // Don't bother if zero hits + if (deviceData.view().metadata().size() == 0) { + std::memset(hostData.buffer().data(), + 0, + alpaka::getExtentProduct(hostData.buffer()) * + sizeof(alpaka::Elem::Buffer>)); + return hostData; + } + alpaka::memcpy(queue, hostData.buffer(), deviceData.buffer()); #ifdef GPU_DEBUG printf("TrackingRecHitsSoACollection: I'm copying to host.\n"); diff --git a/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc b/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc index c6615c08d73bf..0abb5d2b1bbc6 100644 --- a/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc +++ b/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc @@ -299,6 +299,10 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { TrackSoA tracks(queue); + // Don't bother if less than 2 this + if (hits_d.view().metadata().size() < 2) + return tracks; + GPUKernels kernels(m_params, hits_d.view().metadata().size(), hits_d.offsetBPIX2(), queue); kernels.buildDoublets(hits_d.view(), hits_d.offsetBPIX2(), queue); From 9f1e6f88602df120f42a70116105320a16bc4958 Mon Sep 17 00:00:00 2001 From: Ruben Lopez Ruiz <24.lopezr@gmail.com> Date: Wed, 4 Sep 2024 12:43:27 +0200 Subject: [PATCH 30/33] Patch for VertexException --- .../MuonBeamspotConstraintValueMapProducer.cc | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc b/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc index 74459f475cb0c..f7983cc516938 100644 --- a/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc +++ b/RecoMuon/GlobalTrackingTools/plugins/MuonBeamspotConstraintValueMapProducer.cc @@ -66,14 +66,19 @@ class MuonBeamspotConstraintValueMapProducer : public edm::global::EDProducer<> // SingleTrackVertexConstraint uses the width for the constraint, // not the error) if ((BeamWidthXError / BeamWidthX < 0.3) && (BeamWidthYError / BeamWidthY < 0.3)) { - SingleTrackVertexConstraint::BTFtuple btft = - stvc.constrain(ttkb->build(muon.muonBestTrack()), *beamSpotHandle); - if (std::get<0>(btft)) { - const reco::Track& trkBS = std::get<1>(btft).track(); - pts.push_back(trkBS.pt()); - ptErrs.push_back(trkBS.ptError()); - chi2s.push_back(std::get<2>(btft)); - tbd = false; + try { + SingleTrackVertexConstraint::BTFtuple btft = + stvc.constrain(ttkb->build(muon.muonBestTrack()), *beamSpotHandle); + + if (std::get<0>(btft)) { + const reco::Track& trkBS = std::get<1>(btft).track(); + pts.push_back(trkBS.pt()); + ptErrs.push_back(trkBS.ptError()); + chi2s.push_back(std::get<2>(btft)); + tbd = false; + } + } catch (const VertexException& exc) { + // Update failed; give up. } } } From d4ceaa82a8f15dc73c27e4f5c91ce5ee933f4b7b Mon Sep 17 00:00:00 2001 From: adriano Date: Wed, 4 Sep 2024 16:48:48 +0200 Subject: [PATCH 31/33] Put to zero nTracks when no track stored --- .../PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc b/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc index 0abb5d2b1bbc6..a9abc99425a2e 100644 --- a/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc +++ b/RecoTracker/PixelSeeding/plugins/alpaka/CAHitNtupletGenerator.cc @@ -300,9 +300,12 @@ namespace ALPAKA_ACCELERATOR_NAMESPACE { TrackSoA tracks(queue); // Don't bother if less than 2 this - if (hits_d.view().metadata().size() < 2) + if (hits_d.view().metadata().size() < 2) { + const auto device = alpaka::getDev(queue); + auto ntracks_d = cms::alpakatools::make_device_view(device, tracks.view().nTracks()); + alpaka::memset(queue, ntracks_d, 0); return tracks; - + } GPUKernels kernels(m_params, hits_d.view().metadata().size(), hits_d.offsetBPIX2(), queue); kernels.buildDoublets(hits_d.view(), hits_d.offsetBPIX2(), queue); From cd956050fc03d72ce1738fd551723c6dd3b69e29 Mon Sep 17 00:00:00 2001 From: Andrea Date: Fri, 6 Sep 2024 12:08:16 +0200 Subject: [PATCH 32/33] Update run3_data GT in autocond from _v4 to _v9 --- Configuration/AlCa/python/autoCond.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Configuration/AlCa/python/autoCond.py b/Configuration/AlCa/python/autoCond.py index 0de8dce141fc1..d2d45614d765e 100644 --- a/Configuration/AlCa/python/autoCond.py +++ b/Configuration/AlCa/python/autoCond.py @@ -37,9 +37,9 @@ 'run3_data_express' : '140X_dataRun3_Express_frozen_v1', # GlobalTag for Run3 data relvals (prompt GT) - 140X_dataRun3_Prompt_v3 but snapshot at 2024-05-31 09:09:12 (UTC) 'run3_data_prompt' : '140X_dataRun3_Prompt_frozen_v3', - # GlobalTag for Run3 offline data reprocessing - snapshot at 2024-02-07 16:38:59 (UTC) - 'run3_data' : '140X_dataRun3_v4', - # GlobalTag for Run3 offline data reprocessing with Prompt GT, currenlty for 2022FG - snapshot at 2024-02-12 12:00:00 (UTC) + # GlobalTag for Run3 offline data reprocessing - snapshot at 2024-09-04 16:25:09 (UTC) + 'run3_data' : '140X_dataRun3_v9', + # GlobalTag for Run3 offline data reprocessing with Prompt GT, currently for 2022FG - snapshot at 2024-02-12 12:00:00 (UTC) 'run3_data_PromptAnalysis' : '140X_dataRun3_PromptAnalysis_v2', # GlobalTag for MC production with perfectly aligned and calibrated detector for Phase1 2017 (and 0,0,~0-centred beamspot) 'phase1_2017_design' : '131X_mc2017_design_v3', From e2183182f887bc5b63d2f0564f0502480d179689 Mon Sep 17 00:00:00 2001 From: Jan Chyczynski Date: Fri, 6 Sep 2024 15:11:43 +0200 Subject: [PATCH 33/33] Tier0Handler: add maxTime, improve cert warning --- CondCore/Utilities/python/tier0.py | 64 ++++++++++++++++++------------ CondCore/Utilities/scripts/conddb | 3 +- 2 files changed, 40 insertions(+), 27 deletions(-) diff --git a/CondCore/Utilities/python/tier0.py b/CondCore/Utilities/python/tier0.py index ba807914ee1f5..b8eb3d6c349ac 100644 --- a/CondCore/Utilities/python/tier0.py +++ b/CondCore/Utilities/python/tier0.py @@ -38,44 +38,52 @@ def unique(seq, keepstr=True): seen = [] return t(c for c in seq if not (c in seen or seen.append(c))) +#note: this exception seems unused class ResponseError( Tier0Error ): - def __init__( self, curl, response, proxy, timeout ): + def __init__( self, curl, response, proxy, timeout, maxTime ): super( ResponseError, self ).__init__( response ) self.args += ( curl, proxy ) self.timeout = timeout - - def __str__( self ): - errStr = """Wrong response for curl connection to Tier0DataSvc from URL \"%s\"""" %( self.args[1].getinfo( self.args[1].EFFECTIVE_URL ), ) - if self.args[ -1 ]: - errStr += """ using proxy \"%s\"""" %( str( self.args[ -1 ] ), ) - errStr += """ with timeout \"%d\" with error code \"%d\".""" %( self.timeout, self.args[1].getinfo( self.args[1].RESPONSE_CODE) ) - if self.args[0].find( '

' ) != -1: - errStr += """\nFull response: \"%s\".""" %( self.args[0].partition('

')[-1].rpartition('

')[0], ) + self.maxTime = maxTime + + def __str__(self): + errStr = f'Wrong response for curl connection to Tier0DataSvc'\ + f' from URL "{self.args[1].getinfo(self.args[1].EFFECTIVE_URL)}"' + if self.args[-1]: + errStr += f' using proxy "{str(self.args[-1])}"' + errStr += f' with connection-timeout "{self.timeout}", max-time "{self.maxtime}"'\ + f' with error code "{self.args[1].getinfo(self.args[1].RESPONSE_CODE)}".' + if '

' in self.args[0]: + full_response = self.args[0].partition('

')[-1].rpartition('

')[0] + errStr += f'\nFull response: "{full_response}".' else: - errStr += """\nFull response: \"%s\".""" %( self.args[0], ) + errStr += f'\nFull response: "{self.args[0]}".' + return errStr #TODO: Add exceptions for each category of HTTP error codes #TODO: check response code and raise corresponding exceptions - -def _raise_http_error( curl, response, proxy, timeout ): - raise ResponseError( curl, response, proxy, timeout ) +#note: this function seems to be unused +def _raise_http_error( curl, response, proxy, timeout, maxTime ): + raise ResponseError( curl, response, proxy, timeout, maxTime ) class Tier0Handler( object ): - def __init__( self, uri, timeOut, retries, retryPeriod, proxy, debug ): + def __init__( self, uri, timeOut, maxTime, retries, retryPeriod, proxy, debug ): """ Parameters: uri: Tier0DataSvc URI; - timeOut: time out for Tier0DataSvc HTTPS calls; + timeOut: time out for connection of Tier0DataSvc HTTPS calls [seconds]; + maxTime: maximum time for Tier0DataSvc HTTPS calls (including data transfer) [seconds]; retries: maximum retries for Tier0DataSvc HTTPS calls; - retryPeriod: sleep time between two Tier0DataSvc HTTPS calls; + retryPeriod: sleep time between two Tier0DataSvc HTTPS calls [seconds]; proxy: HTTP proxy for accessing Tier0DataSvc HTTPS calls; debug: if set to True, enables debug information. """ self._uri = uri self._timeOut = timeOut + self._maxTime = maxTime self._retries = retries self._retryPeriod = retryPeriod self._proxy = proxy @@ -98,7 +106,9 @@ def _getCerts( self ) -> str: if cert_path: certs += f' --cert {cert_path}' else: - logging.warning("No certificate provided for Tier0 access") + logging.warning("No certificate provided for Tier0 access, use X509_USER_CERT and" + " optionally X509_USER_KEY env variables to specify the path to the cert" + " (and the key unless included in the cert file)") if key_path: certs += f' --key {key_path}' return certs @@ -110,9 +120,10 @@ def _curlQueryTier0( self, url:str, force_debug:bool = False, force_cert:bool = proxy = f"--proxy {self._proxy}" if self._proxy else "" certs = self._getCerts() if not self._proxy or force_cert else "" - - cmd = '/usr/bin/curl -k -L --user-agent "%s" %s --connect-timeout %i --retry %i %s %s %s' \ - % (userAgent, proxy, self._timeOut, self._retries, debug, url, certs) + + cmd = f'/usr/bin/curl -k -L --user-agent "{userAgent}" {proxy}'\ + f' --connect-timeout {self._timeOut} --max-time {self._maxTime} --retry {self._retries}'\ + f' {debug} {url} {certs}' # time the curl to understand if re-tries have been carried out start = time.time() @@ -140,7 +151,7 @@ def _queryTier0DataSvc( self, url ): if self._proxy: logging.info("before assumed proxy provides authentication, now trying with both proxy and certificate") - time.sleep(10) + time.sleep(self._retryPeriod) retcode, stdoutdata, stderrdata, query_time = self._curlQueryTier0(url, force_debug=True, force_cert=True) if retcode != 0: msg = "looks like curl returned an error for the second time: retcode=%s" % (retcode,) @@ -164,7 +175,8 @@ def getFirstSafeRun( self ): firstConditionSafeRunAPI = "firstconditionsaferun" safeRunDict = self._queryTier0DataSvc( os.path.join( self._uri, firstConditionSafeRunAPI ) ) if safeRunDict is None: - errStr = """First condition safe run is not available in Tier0DataSvc from URL \"%s\"""" %( os.path.join( self._uri, firstConditionSafeRunAPI ), ) + errStr = """First condition safe run is not available in Tier0DataSvc from URL \"%s\"""" \ + %( os.path.join( self._uri, firstConditionSafeRunAPI ), ) if self._proxy: errStr += """ using proxy \"%s\".""" %( str( self._proxy ), ) raise Tier0Error( errStr ) @@ -179,19 +191,20 @@ def getGlobalTag( self, config ): Raises if connection error, bad response, timeout after retries occur, or if no Global Tags are available. """ data = self._queryTier0DataSvc( os.path.join( self._uri, config ) ) - gtnames = sorted(unique( [ str( di[ 'global_tag' ] ) for di in data['result'] if di[ 'global_tag' ] is not None ] )) + gtnames = sorted(unique( [ str( di['global_tag'] ) for di in data['result'] if di['global_tag'] is not None ] )) try: recentGT = gtnames[-1] return recentGT except IndexError: - errStr = """No Global Tags for \"%s\" are available in Tier0DataSvc from URL \"%s\"""" %( config, os.path.join( self._uri, config ) ) + errStr = """No Global Tags for \"%s\" are available in Tier0DataSvc from URL \"%s\"""" \ + %( config, os.path.join( self._uri, config ) ) if self._proxy: errStr += """ using proxy \"%s\".""" %( str( self._proxy ), ) raise Tier0Error( errStr ) def test( url ): - t0 = Tier0Handler( url, 1, 1, 1, None, debug=False) + t0 = Tier0Handler( url, 1, 5, 1, 10, None, debug=False) print(' fcsr = %s (%s)' % (t0.getFirstSafeRun(), type(t0.getFirstSafeRun()) )) print(' reco_config = %s' % t0.getGlobalTag('reco_config')) @@ -201,4 +214,3 @@ def test( url ): if __name__ == '__main__': test( tier0Url ) - diff --git a/CondCore/Utilities/scripts/conddb b/CondCore/Utilities/scripts/conddb index 5b33496db1938..788ec3fc2fe6b 100755 --- a/CondCore/Utilities/scripts/conddb +++ b/CondCore/Utilities/scripts/conddb @@ -706,12 +706,13 @@ def _get_hlt_fcsr( session, timeType ): def _get_prompt_fcsr( session, timeType ): tier0timeout = 5 + tier0maxtime = 60 tier0retries = 3 tier0retryPeriod = 5 tier0proxy = None try: t0DataSvc = Tier0Handler( tier0Url, - tier0timeout, tier0retries, tier0retryPeriod, + tier0timeout, tier0maxtime, tier0retries, tier0retryPeriod, tier0proxy, False ) try: fcsr = t0DataSvc.getFirstSafeRun()