From 178a9369d10d423f6f97afa306b82df9c22a9b74 Mon Sep 17 00:00:00 2001 From: Fredrik Date: Tue, 13 Jun 2023 21:50:09 +0200 Subject: [PATCH 1/3] Totem T2 not in regular runs --- RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py b/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py index 873ae84467014..309437919c3ae 100644 --- a/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py +++ b/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py @@ -14,11 +14,6 @@ 'keep TotemRPUVPatternedmDetSetVector_totemRPUVPatternFinder_*_*', 'keep TotemRPLocalTrackedmDetSetVector_totemRPLocalTrackFitter_*_*', - # totem T2 - 'keep TotemFEDInfos_totemT2Digis_*_*', - 'keep TotemT2DigiedmNewDetSetVector_totemT2Digis_*_*', - 'keep TotemVFATStatusedmDetSetVector_totemT2Digis_*_*', - # timing diamonds 'keep TotemFEDInfos_ctppsDiamondRawToDigi_*_*', 'keep CTPPSDiamondDigiedmDetSetVector_ctppsDiamondRawToDigi_*_*', From 4fddc8f9e4ba4be5b36587e381759d407cb91de5 Mon Sep 17 00:00:00 2001 From: Fredrik Date: Tue, 13 Jun 2023 21:51:39 +0200 Subject: [PATCH 2/3] Turn off T2 plots by default --- DQM/CTPPS/plugins/TotemT2DQMSource.cc | 114 +++++++++--------- DQM/CTPPS/python/totemT2DQMSource_cfi.py | 1 + DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py | 2 + 3 files changed, 63 insertions(+), 54 deletions(-) diff --git a/DQM/CTPPS/plugins/TotemT2DQMSource.cc b/DQM/CTPPS/plugins/TotemT2DQMSource.cc index dd897e8ccb5cd..b2ce268f07478 100644 --- a/DQM/CTPPS/plugins/TotemT2DQMSource.cc +++ b/DQM/CTPPS/plugins/TotemT2DQMSource.cc @@ -61,6 +61,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer { enum evFlag { t2TE = 0, t2LE, t2MT, t2ML }; const unsigned int nbinsx_, nbinsy_; + const bool t2Plots_; const unsigned int windowsNum_; struct SectorPlots { @@ -214,77 +215,82 @@ TotemT2DQMSource::TotemT2DQMSource(const edm::ParameterSet& iConfig) : digiToken_(consumes>(iConfig.getParameter("digisTag"))), nbinsx_(iConfig.getParameter("nbinsx")), nbinsy_(iConfig.getParameter("nbinsy")), + t2Plots_(iConfig.getParameter("specialRunT2")), windowsNum_(iConfig.getParameter("windowsNum")) {} void TotemT2DQMSource::dqmBeginRun(const edm::Run&, const edm::EventSetup&) {} void TotemT2DQMSource::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run&, const edm::EventSetup& iSetup) { - ibooker.cd(); - ibooker.setCurrentFolder("TotemT2"); - - bookErrorFlagsHistogram(ibooker); - - for (unsigned int arm = 0; arm <= CTPPSDetId::maxArm; ++arm) { - for (unsigned int pl = 0; pl <= TotemT2DetId::maxPlane; ++pl) { - const TotemT2DetId detid(arm, pl, 0); - const TotemT2DetId planeId(detid.planeId()); - planePlots_[planeId] = PlanePlots(ibooker, planeId, nbinsx_, nbinsy_); - for (unsigned int ch = 0; ch <= TotemT2DetId::maxChannel; ++ch) { - const TotemT2DetId detidCh(arm, pl, ch); - channelPlots_[detidCh] = ChannelPlots(ibooker, detidCh, windowsNum_); + if (t2Plots_) { + ibooker.cd(); + ibooker.setCurrentFolder("TotemT2"); + + bookErrorFlagsHistogram(ibooker); + + for (unsigned int arm = 0; arm <= CTPPSDetId::maxArm; ++arm) { + for (unsigned int pl = 0; pl <= TotemT2DetId::maxPlane; ++pl) { + const TotemT2DetId detid(arm, pl, 0); + const TotemT2DetId planeId(detid.planeId()); + planePlots_[planeId] = PlanePlots(ibooker, planeId, nbinsx_, nbinsy_); + for (unsigned int ch = 0; ch <= TotemT2DetId::maxChannel; ++ch) { + const TotemT2DetId detidCh(arm, pl, ch); + channelPlots_[detidCh] = ChannelPlots(ibooker, detidCh, windowsNum_); + } } + const TotemT2DetId detid(arm, 0, 0); + const TotemT2DetId secId(detid.armId()); + sectorPlots_[secId] = SectorPlots(ibooker, secId, nbinsx_, nbinsy_, windowsNum_); } - const TotemT2DetId detid(arm, 0, 0); - const TotemT2DetId secId(detid.armId()); - sectorPlots_[secId] = SectorPlots(ibooker, secId, nbinsx_, nbinsy_, windowsNum_); - } - // build a segmentation helper for the size of histograms previously booked - segm_ = std::make_unique(nbinsx_, nbinsy_); + // build a segmentation helper for the size of histograms previously booked + segm_ = std::make_unique(nbinsx_, nbinsy_); + } } void TotemT2DQMSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { - // fill digis information - std::unordered_map> planes; - - for (const auto& ds_digis : iEvent.get(digiToken_)) { - if (!ds_digis.empty()) { - const TotemT2DetId detid(ds_digis.detId()); - const TotemT2DetId planeId(detid.planeId()); - for (const auto& digi : ds_digis) { - if (digi.hasLE()) { - segm_->fill(planePlots_[planeId].digisMultiplicity->getTH2D(), detid); - if (digi.hasTE()) - fillTriggerBitset(detid); + if (t2Plots_) { + // fill digis information + std::unordered_map> planes; + + for (const auto& ds_digis : iEvent.get(digiToken_)) { + if (!ds_digis.empty()) { + const TotemT2DetId detid(ds_digis.detId()); + const TotemT2DetId planeId(detid.planeId()); + for (const auto& digi : ds_digis) { + if (digi.hasLE()) { + segm_->fill(planePlots_[planeId].digisMultiplicity->getTH2D(), detid); + if (digi.hasTE()) + fillTriggerBitset(detid); + } + fillErrorFlagsHistogram(digi, detid); + fillEdges(digi, detid); + fillToT(digi, detid); + fillFlags(digi, detid); + int bx = iEvent.bunchCrossing(); + fillBX(digi, detid, bx); + if (digi.hasLE() && digi.hasTE()) //good digi + fillActivePlanes(planes, detid); } - fillErrorFlagsHistogram(digi, detid); - fillEdges(digi, detid); - fillToT(digi, detid); - fillFlags(digi, detid); - int bx = iEvent.bunchCrossing(); - fillBX(digi, detid, bx); - if (digi.hasLE() && digi.hasTE()) //good digi - fillActivePlanes(planes, detid); } } - } - for (const auto& plt : sectorPlots_) - plt.second.activePlanesCount->Fill(planes[plt.first].size()); - - for (unsigned short arm = 0; arm <= CTPPSDetId::maxArm; ++arm) - for (unsigned short plane = 0; plane <= 1; ++plane) - for (unsigned short id = 0; id <= TotemT2DetId::maxChannel; ++id) { - const TotemT2DetId detid(arm, plane, id); - if (areChannelsTriggered(detid)) { - const TotemT2DetId secId(detid.armId()); - segm_->fill(sectorPlots_[secId].triggerEmulator->getTH2D(), detid); + for (const auto& plt : sectorPlots_) + plt.second.activePlanesCount->Fill(planes[plt.first].size()); + + for (unsigned short arm = 0; arm <= CTPPSDetId::maxArm; ++arm) + for (unsigned short plane = 0; plane <= 1; ++plane) + for (unsigned short id = 0; id <= TotemT2DetId::maxChannel; ++id) { + const TotemT2DetId detid(arm, plane, id); + if (areChannelsTriggered(detid)) { + const TotemT2DetId secId(detid.armId()); + segm_->fill(sectorPlots_[secId].triggerEmulator->getTH2D(), detid); + } } - } - // fill rechits information + // fill rechits information - clearTriggerBitset(); + clearTriggerBitset(); + } } void TotemT2DQMSource::fillActivePlanes(std::unordered_map>& planes, @@ -353,8 +359,8 @@ void TotemT2DQMSource::fillEdges(const TotemT2Digi& digi, const TotemT2DetId& de } void TotemT2DQMSource::fillBX(const TotemT2Digi& digi, const TotemT2DetId& detid, const int bx) { - const TotemT2DetId secId(detid.armId()); if (digi.hasLE()) { + const TotemT2DetId secId(detid.armId()); sectorPlots_[secId].activityPerBX->Fill(bx); channelPlots_[detid].activityPerBXCh->Fill(bx); } diff --git a/DQM/CTPPS/python/totemT2DQMSource_cfi.py b/DQM/CTPPS/python/totemT2DQMSource_cfi.py index 41e1a0c5d8278..4eaf9f7db8362 100644 --- a/DQM/CTPPS/python/totemT2DQMSource_cfi.py +++ b/DQM/CTPPS/python/totemT2DQMSource_cfi.py @@ -5,6 +5,7 @@ digisTag = cms.InputTag('totemT2Digis', 'TotemT2'), nbinsx = cms.uint32(25), nbinsy = cms.uint32(25), + specialRunT2 = cms.bool(False), windowsNum = cms.uint32(8), perLSsaving = cms.untracked.bool(False), #driven by DQMServices/Core/python/DQMStore_cfi.py diff --git a/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py b/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py index 82d0f763c92b8..38ff5401a4497 100644 --- a/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py +++ b/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py @@ -53,6 +53,8 @@ # CTPPS DQM modules process.load("DQM.CTPPS.ctppsDQM_cff") +process.totemT2DQMSource.specialRunT2 = True + process.path = cms.Path( process.ctppsRawToDigi * process.recoCTPPS * From 5e3ef9c0f52572a45172090e96cae095aab970a7 Mon Sep 17 00:00:00 2001 From: Fredrik Date: Tue, 20 Jun 2023 12:46:43 +0200 Subject: [PATCH 3/3] No exception on 0 T2 Digis found --- DQM/CTPPS/plugins/TotemT2DQMSource.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DQM/CTPPS/plugins/TotemT2DQMSource.cc b/DQM/CTPPS/plugins/TotemT2DQMSource.cc index b2ce268f07478..5926fea31966f 100644 --- a/DQM/CTPPS/plugins/TotemT2DQMSource.cc +++ b/DQM/CTPPS/plugins/TotemT2DQMSource.cc @@ -252,6 +252,9 @@ void TotemT2DQMSource::analyze(const edm::Event& iEvent, const edm::EventSetup& // fill digis information std::unordered_map> planes; + if (!iEvent.getHandle(digiToken_).isValid()) + return; + for (const auto& ds_digis : iEvent.get(digiToken_)) { if (!ds_digis.empty()) { const TotemT2DetId detid(ds_digis.detId());