diff --git a/DQM/CTPPS/plugins/TotemT2DQMSource.cc b/DQM/CTPPS/plugins/TotemT2DQMSource.cc index dd897e8ccb5cd..5926fea31966f 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,85 @@ 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; + + if (!iEvent.getHandle(digiToken_).isValid()) + return; + + 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 +362,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 * 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_*_*',