From 9eb59764aaec7f99768d301ca0a2069ed7244726 Mon Sep 17 00:00:00 2001 From: Fredrik Date: Sat, 27 May 2023 16:58:19 +0200 Subject: [PATCH 1/2] Update the Totem T2 mapping, data format, and DQM functionality, from PR #41785 --- .../plugins/TotemDAQMappingESSourceXML.cc | 4 +- .../python/totemDAQMappingESSourceXML_cfi.py | 1 + .../python/totemT2DAQMapping_cff.py | 16 ++- .../xml/mapping_totem_nt2_2023_final.xml | 103 ++++++++++++++++++ DQM/CTPPS/plugins/TotemT2DQMSource.cc | 83 +++++++++++--- DQM/CTPPS/python/ctppsDQM_cff.py | 3 + DQM/CTPPS/python/totemT2DQMSource_cfi.py | 2 +- DQM/CTPPS/test/totemt2_dqm_test_cfg.py | 6 +- DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py | 75 +++++++++++++ DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py | 80 ++++++++++++++ DataFormats/TotemReco/interface/TotemT2Digi.h | 5 +- DataFormats/TotemReco/src/TotemT2Digi.cc | 5 +- DataFormats/TotemReco/src/classes_def.xml | 3 +- .../interface/RawToDigiConverter.h | 27 +++-- .../interface/TotemT2VFATFrame.h | 3 + .../CTPPSRawToDigi/interface/VFATFrame.h | 11 ++ .../python/ctppsRawToDigi_cff.py | 16 ++- .../CTPPSRawToDigi/python/totemT2Digis_cfi.py | 10 +- .../python/totemTimingRawToDigi_cfi.py | 33 +++--- .../python/totemVFATRawToDigi_cfi.py | 13 ++- .../CTPPSRawToDigi/src/RawDataUnpacker.cc | 1 + .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 32 ++++-- EventFilter/CTPPSRawToDigi/src/VFATFrame.cc | 45 ++++++++ .../python/RecoCTPPS_EventContent_cff.py | 6 + RecoPPS/Configuration/python/recoCTPPS_cff.py | 2 + .../python/totemT2LocalReconstruction_cff.py | 13 +++ RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py | 14 +-- 27 files changed, 524 insertions(+), 88 deletions(-) create mode 100644 CondFormats/PPSObjects/xml/mapping_totem_nt2_2023_final.xml create mode 100644 DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py create mode 100644 DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py create mode 100644 RecoPPS/Local/python/totemT2LocalReconstruction_cff.py diff --git a/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc b/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc index 56f5a4ded3776..d03afef4b972b 100644 --- a/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc +++ b/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc @@ -276,7 +276,9 @@ TotemDAQMappingESSourceXML::TotemDAQMappingESSourceXML(const edm::ParameterSet & : verbosity(conf.getUntrackedParameter("verbosity", 0)), subSystemName(conf.getUntrackedParameter("subSystem")), sampicSubDetId(conf.getParameter("sampicSubDetId")), - packedPayload(conf.getUntrackedParameter("multipleChannelsPerPayload", false)), + packedPayload(conf.existsAs("multipleChannelsPerPayload", true) + ? conf.getParameter("multipleChannelsPerPayload") + : false), currentBlock(0), currentBlockValid(false) { for (const auto &it : conf.getParameter>("configuration")) { diff --git a/CalibPPS/ESProducers/python/totemDAQMappingESSourceXML_cfi.py b/CalibPPS/ESProducers/python/totemDAQMappingESSourceXML_cfi.py index db425a1a7e347..961fa3e55ce6b 100644 --- a/CalibPPS/ESProducers/python/totemDAQMappingESSourceXML_cfi.py +++ b/CalibPPS/ESProducers/python/totemDAQMappingESSourceXML_cfi.py @@ -5,6 +5,7 @@ # set it to: TrackingStrip, ... subSystem = cms.untracked.string(""), + multipleChannelsPerPayload = cms.bool(False), configuration = cms.VPSet( # example configuration block: diff --git a/CalibPPS/ESProducers/python/totemT2DAQMapping_cff.py b/CalibPPS/ESProducers/python/totemT2DAQMapping_cff.py index c7ff2e5fd1a33..316d7fff99faf 100644 --- a/CalibPPS/ESProducers/python/totemT2DAQMapping_cff.py +++ b/CalibPPS/ESProducers/python/totemT2DAQMapping_cff.py @@ -4,20 +4,26 @@ totemDAQMappingESSourceXML = _xml.clone( subSystem = "TotemT2", - multipleChannelsPerPayload = cms.untracked.bool(False), configuration = cms.VPSet( - #initial dummy diamond map copy + #initial dummy diamond map copy, use only for Run 2 where T2 mapping is read with old schema cms.PSet( - validityRange = cms.EventRange("1:min - 364982:max"), + validityRange = cms.EventRange("1:min - 339999:max"), mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/mapping_totem_nt2_2021.xml"), maskFileNames = cms.vstring() ), - #T2 firmware test files + #old v2.1 T2 firmware test file cms.PSet( - validityRange = cms.EventRange("364983:min - 999999999:max"), + validityRange = cms.EventRange("340000:min - 368022:max"), mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/mapping_totem_nt2_2023.xml"), maskFileNames = cms.vstring() + ), + #final T2 mapping test files + cms.PSet( + validityRange = cms.EventRange("368023:min - 999999999:max"), + mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/mapping_totem_nt2_2023_final.xml"), + maskFileNames = cms.vstring() ) ), sampicSubDetId = cms.uint32(6), + multipleChannelsPerPayload = True, ) diff --git a/CondFormats/PPSObjects/xml/mapping_totem_nt2_2023_final.xml b/CondFormats/PPSObjects/xml/mapping_totem_nt2_2023_final.xml new file mode 100644 index 0000000000000..64a6a4367f85f --- /dev/null +++ b/CondFormats/PPSObjects/xml/mapping_totem_nt2_2023_final.xml @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DQM/CTPPS/plugins/TotemT2DQMSource.cc b/DQM/CTPPS/plugins/TotemT2DQMSource.cc index a76e4d2728e71..d54a3b5174307 100644 --- a/DQM/CTPPS/plugins/TotemT2DQMSource.cc +++ b/DQM/CTPPS/plugins/TotemT2DQMSource.cc @@ -44,9 +44,10 @@ class TotemT2DQMSource : public DQMEDAnalyzer { void clearTriggerBitset(); bool areChannelsTriggered(const TotemT2DetId&); void bookErrorFlagsHistogram(DQMStore::IBooker&); - void fillErrorFlagsHistogram(const TotemT2Digi&); + void fillErrorFlagsHistogram(const TotemT2Digi&, const TotemT2DetId&); void fillEdges(const TotemT2Digi&, const TotemT2DetId&); void fillToT(const TotemT2RecHit&, const TotemT2DetId&); + void fillFlags(const TotemT2Digi&, const TotemT2DetId&); const edm::ESGetToken geometryToken_; const edm::EDGetTokenT> digiToken_; @@ -55,7 +56,9 @@ class TotemT2DQMSource : public DQMEDAnalyzer { std::unique_ptr segm_; static constexpr double T2_BIN_WIDTH_NS_ = 25. / 4; - MonitorElement* HPTDCErrorFlags_2D_ = nullptr; + MonitorElement* totemT2ErrorFlags_2D_ = nullptr; + + enum evFlag { t2TE = 0, t2LE, t2MT, t2ML }; const unsigned int nbinsx_, nbinsy_; const unsigned int windowsNum_; @@ -68,7 +71,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer { std::bitset<(TotemT2DetId::maxPlane + 1) * (TotemT2DetId::maxChannel + 1)> hitTilesArray; static const unsigned int MINIMAL_TRIGGER = 3; - MonitorElement *leadingEdge = nullptr, *trailingEdge = nullptr, *timeOverTreshold = nullptr; + MonitorElement *leadingEdge = nullptr, *trailingEdge = nullptr, *timeOverTreshold = nullptr, *eventFlags = nullptr; SectorPlots() = default; SectorPlots( @@ -78,6 +81,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer { struct PlanePlots { MonitorElement* digisMultiplicity = nullptr; MonitorElement* rechitMultiplicity = nullptr; + MonitorElement* eventFlagsPl = nullptr; PlanePlots() = default; PlanePlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int nbinsx, unsigned int nbinsy); @@ -86,6 +90,7 @@ class TotemT2DQMSource : public DQMEDAnalyzer { MonitorElement* leadingEdgeCh = nullptr; MonitorElement* trailingEdgeCh = nullptr; MonitorElement* timeOverTresholdCh = nullptr; + MonitorElement* eventFlagsCh = nullptr; ChannelPlots() = default; ChannelPlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum); @@ -124,7 +129,13 @@ TotemT2DQMSource::SectorPlots::SectorPlots( "trailing edge", title + " trailing edge (DIGIs); trailing edge (ns)", 25 * windowsNum, 0, 25 * windowsNum); timeOverTreshold = ibooker.book1D( - "time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 250, -25, 100); + "time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 500, -50, 200); + + eventFlags = ibooker.book1D( + "event flags", title + " event flags (digi);Event flags (TE/LE valid, TE/LE multiple)", 4, -0.5, 3.5); + + for (unsigned short flag_index = 1; flag_index <= 4; ++flag_index) + eventFlags->setBinLabel(flag_index, "Flag " + std::to_string(flag_index)); } TotemT2DQMSource::PlanePlots::PlanePlots(DQMStore::IBooker& ibooker, @@ -152,6 +163,12 @@ TotemT2DQMSource::PlanePlots::PlanePlots(DQMStore::IBooker& ibooker, nbinsy, -0.5, double(nbinsy) - 0.5); + + eventFlagsPl = ibooker.book1D( + "event flags", title + " event flags (digi);Event flags (TE/LE valid, TE/LE multiple)", 4, -0.5, 3.5); + + for (unsigned short flag_index = 1; flag_index <= 4; ++flag_index) + eventFlagsPl->setBinLabel(flag_index, "Flag " + std::to_string(flag_index)); } TotemT2DQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, unsigned int id, unsigned int windowsNum) { @@ -166,7 +183,13 @@ TotemT2DQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, unsigne "trailing edge", title + " trailing edge (DIGIs); trailing edge (ns)", 25 * windowsNum, 0, 25 * windowsNum); timeOverTresholdCh = ibooker.book1D( - "time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 250, -25, 100); + "time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 500, -50, 200); + + eventFlagsCh = ibooker.book1D( + "event flags", title + " event flags (digi);Event flags (TE/LE valid, TE/LE multiple)", 4, -0.5, 3.5); + + for (unsigned short flag_index = 1; flag_index <= 4; ++flag_index) + eventFlagsCh->setBinLabel(flag_index, "Flag " + std::to_string(flag_index)); } TotemT2DQMSource::TotemT2DQMSource(const edm::ParameterSet& iConfig) @@ -212,8 +235,9 @@ void TotemT2DQMSource::analyze(const edm::Event& iEvent, const edm::EventSetup& for (const auto& digi : ds_digis) { segm_->fill(planePlots_[planeId].digisMultiplicity->getTH2D(), detid); fillTriggerBitset(detid); - fillErrorFlagsHistogram(digi); + fillErrorFlagsHistogram(digi, detid); fillEdges(digi, detid); + fillFlags(digi, detid); } } @@ -285,18 +309,21 @@ bool TotemT2DQMSource::areChannelsTriggered(const TotemT2DetId& detid) { } void TotemT2DQMSource::bookErrorFlagsHistogram(DQMStore::IBooker& ibooker) { - HPTDCErrorFlags_2D_ = ibooker.book2D("HPTDC Errors", " HPTDC Errors?", 8, -0.5, 7.5, 2, -0.5, 1.5); - for (unsigned short error_index = 1; error_index <= 8; ++error_index) - HPTDCErrorFlags_2D_->setBinLabel(error_index, "Flag " + std::to_string(error_index)); + totemT2ErrorFlags_2D_ = ibooker.book2D("nt2 readout flags", " nt2 readout flags", 4, -0.5, 3.5, 2, -0.5, 1.5); + for (unsigned short error_index = 1; error_index <= 4; ++error_index) + totemT2ErrorFlags_2D_->setBinLabel(error_index, "Flag " + std::to_string(error_index)); int tmpIndex = 0; - HPTDCErrorFlags_2D_->setBinLabel(++tmpIndex, "some id 0", /* axis */ 2); - HPTDCErrorFlags_2D_->setBinLabel(++tmpIndex, "some id 1", /* axis */ 2); + totemT2ErrorFlags_2D_->setBinLabel(++tmpIndex, "arm 4-5", /* axis */ 2); + totemT2ErrorFlags_2D_->setBinLabel(++tmpIndex, "arm 5-6", /* axis */ 2); } -void TotemT2DQMSource::fillErrorFlagsHistogram(const TotemT2Digi& digi) { - // placeholder for error hitogram filling - (void)digi; +void TotemT2DQMSource::fillErrorFlagsHistogram(const TotemT2Digi& digi, const TotemT2DetId& detid) { + // readout flags histogram filling + for (unsigned int i = 0; i < 4; i++) { + if (digi.getStatus() & (1 << i)) + totemT2ErrorFlags_2D_->Fill(i + 0.0, detid.arm() + 0.0); + } } void TotemT2DQMSource::fillEdges(const TotemT2Digi& digi, const TotemT2DetId& detid) { @@ -313,4 +340,32 @@ void TotemT2DQMSource::fillToT(const TotemT2RecHit& rechit, const TotemT2DetId& channelPlots_[detid].timeOverTresholdCh->Fill(rechit.toT()); } +void TotemT2DQMSource::fillFlags(const TotemT2Digi& digi, const TotemT2DetId& detid) { + const TotemT2DetId secId(detid.armId()); + const TotemT2DetId planeId(detid.planeId()); + if (digi.hasTE()) { + sectorPlots_[secId].eventFlags->Fill(t2TE + 0.0); + planePlots_[planeId].eventFlagsPl->Fill(t2TE + 0.0); + channelPlots_[detid].eventFlagsCh->Fill(t2TE + 0.0); + } + + if (digi.hasLE()) { + sectorPlots_[secId].eventFlags->Fill(t2LE + 0.0); + planePlots_[planeId].eventFlagsPl->Fill(t2LE + 0.0); + channelPlots_[detid].eventFlagsCh->Fill(t2LE + 0.0); + } + + if (digi.hasManyTE()) { + sectorPlots_[secId].eventFlags->Fill(t2MT + 0.0); + planePlots_[planeId].eventFlagsPl->Fill(t2MT + 0.0); + channelPlots_[detid].eventFlagsCh->Fill(t2MT + 0.0); + } + + if (digi.hasManyLE()) { + sectorPlots_[secId].eventFlags->Fill(t2ML + 0.0); + planePlots_[planeId].eventFlagsPl->Fill(t2ML + 0.0); + channelPlots_[detid].eventFlagsCh->Fill(t2ML + 0.0); + } +} + DEFINE_FWK_MODULE(TotemT2DQMSource); diff --git a/DQM/CTPPS/python/ctppsDQM_cff.py b/DQM/CTPPS/python/ctppsDQM_cff.py index 58c83de4ba182..a3c1898a1f32c 100644 --- a/DQM/CTPPS/python/ctppsDQM_cff.py +++ b/DQM/CTPPS/python/ctppsDQM_cff.py @@ -11,6 +11,8 @@ from DQM.CTPPS.totemTimingDQMSource_cfi import * +from DQM.CTPPS.totemT2DQMSource_cfi import * + from DQM.CTPPS.ctppsPixelDQMSource_cfi import * from DQM.CTPPS.elasticPlotDQMSource_cfi import * @@ -42,6 +44,7 @@ + diamondSampicDQMSourceOnline + ctppsCommonDQMSourceOnline + elasticPlotDQMSource + + totemT2DQMSource ) _ctppsDQMCalibrationHarvest = cms.Sequence( diff --git a/DQM/CTPPS/python/totemT2DQMSource_cfi.py b/DQM/CTPPS/python/totemT2DQMSource_cfi.py index 001b9c7d509bb..952c472e9738d 100644 --- a/DQM/CTPPS/python/totemT2DQMSource_cfi.py +++ b/DQM/CTPPS/python/totemT2DQMSource_cfi.py @@ -6,7 +6,7 @@ rechitsTag = cms.InputTag('totemT2RecHits'), nbinsx = cms.uint32(25), nbinsy = cms.uint32(25), - windowsNum = cms.uint32(4), + 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_cfg.py b/DQM/CTPPS/test/totemt2_dqm_test_cfg.py index ac80aea04182a..dc08bf5c6d030 100644 --- a/DQM/CTPPS/test/totemt2_dqm_test_cfg.py +++ b/DQM/CTPPS/test/totemt2_dqm_test_cfg.py @@ -50,9 +50,9 @@ process.totemDAQMappingESSourceXML_TotemT2.verbosity = 0 process.totemT2Digis.RawUnpacking.verbosity = 0 process.totemT2Digis.RawToDigi.verbosity = 0 -process.totemT2Digis.RawToDigi.useOlderT2TestFile = cms.untracked.uint32(1) -process.totemT2Digis.RawToDigi.printUnknownFrameSummary = 0 -process.totemT2Digis.RawToDigi.printErrorSummary = 0 +process.totemT2Digis.RawToDigi.useOlderT2TestFile = True +process.totemT2Digis.RawToDigi.printUnknownFrameSummary = False +process.totemT2Digis.RawToDigi.printErrorSummary = False process.totemDAQMappingESSourceXML_TotemT2.multipleChannelsPerPayload = True process.path = cms.Path( diff --git a/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py b/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py new file mode 100644 index 0000000000000..66af8d76dd40e --- /dev/null +++ b/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py @@ -0,0 +1,75 @@ +import FWCore.ParameterSet.Config as cms + +from Configuration.Eras.Era_Run3_cff import Run3 + +# needed to have ctppsDQMCalibrationSource properly working +from Configuration.Eras.Modifier_ctpps_cff import ctpps + +process = cms.Process('RECODQM', Run3) + +# minimum of logs +process.MessageLogger = cms.Service("MessageLogger", + statistics = cms.untracked.vstring(), + destinations = cms.untracked.vstring('cerr'), + cerr = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) +) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +# load DQM framework +process.load("DQM.Integration.config.environment_cfi") +process.dqmEnv.subSystemFolder = "CTPPS" +process.dqmEnv.eventInfoFolder = "EventInfo" +process.dqmSaver.path = "" +process.dqmSaver.tag = "CTPPS" + +# raw data source +#alignment run without T2, TimingDiamond and TrackingStrip not affected by PR changes +process.source = cms.Source("PoolSource", + fileNames = cms.untracked.vstring( + '/store/data/Run2023A/HLTPhysics/RAW/v1/000/366/192/00000/f277ee80-e88b-41e8-b1ba-6c18af119fbc.root' + ) +) + + +process.maxEvents = cms.untracked.PSet( + input = cms.untracked.int32(8000) +) + +# raw-to-digi conversion +process.load("EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff") + +# global tag - conditions for P5 cluster +process.load("DQM.Integration.config.FrontierCondition_GT_cfi") + +#from Configuration.AlCa.GlobalTag import GlobalTag +#process.GlobalTag = GlobalTag(process.GlobalTag, '130X_dataRun3_HLT_v2', '') + +# local T2 reconstruction chain with standard settings +process.load("RecoPPS.Configuration.recoCTPPS_cff") + +# CTPPS DQM modules +process.load("DQM.CTPPS.ctppsDQM_cff") + +process.path = cms.Path( + process.ctppsRawToDigi * + process.recoCTPPS * + process.ctppsDQMCalibrationSource * + process.ctppsDQMCalibrationHarvest +) + +process.end_path = cms.EndPath( + process.dqmEnv + + process.dqmSaver +) + +process.schedule = cms.Schedule( + process.path, + process.end_path +) diff --git a/DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py b/DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py new file mode 100644 index 0000000000000..c2f7c8379353a --- /dev/null +++ b/DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py @@ -0,0 +1,80 @@ +import FWCore.ParameterSet.Config as cms +import string + +from Configuration.Eras.Era_Run3_cff import Run3 + +process = cms.Process('RECODQM', Run3) + +process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(6000) ) +process.verbosity = cms.untracked.PSet( input = cms.untracked.int32(-1) ) + +# minimum of logs +process.MessageLogger = cms.Service("MessageLogger", + statistics = cms.untracked.vstring(), + destinations = cms.untracked.vstring('cerr'), + cerr = cms.untracked.PSet( + threshold = cms.untracked.string('WARNING') + ) +) + +# import of standard configurations +process.load('Configuration.StandardSequences.Services_cff') +process.load('FWCore.MessageService.MessageLogger_cfi') +process.load('Configuration.EventContent.EventContent_cff') +process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') + +# load DQM framework +process.load("DQM.Integration.config.environment_cfi") +process.dqmEnv.subSystemFolder = "CTPPS" +process.dqmEnv.eventInfoFolder = "EventInfo" +process.dqmSaver.path = "" +process.dqmSaver.tag = "CTPPS" +# raw data source +process.source = cms.Source("NewEventStreamFileReader", + fileNames = cms.untracked.vstring( +# '/store/t0streamer/Minidaq/A/000/368/023/run368023_ls0001_streamA_StorageManager.dat', + 'file:/eos/cms/store/t0streamer/Minidaq/A/000/368/080/run368080_ls0001_streamA_StorageManager.dat', + 'file:/eos/cms/store/t0streamer/Minidaq/A/000/368/080/run368080_ls0002_streamA_StorageManager.dat', +# '/store/t0streamer/Minidaq/A/000/368/081/run368081_ls0001_streamA_StorageManager.dat', +# '/store/t0streamer/Minidaq/A/000/368/081/run368081_ls0002_streamA_StorageManager.dat', +# '/store/t0streamer/Minidaq/A/000/368/082/run368082_ls0001_streamA_StorageManager.dat', +# '/store/t0streamer/Minidaq/A/000/368/082/run368082_ls0002_streamA_StorageManager.dat', +# '/store/group/dpg_ctpps/comm_ctpps/TotemT2/RecoTest/run364983_ls0001_streamA_StorageManager.dat', + ) +) + +from Configuration.AlCa.GlobalTag import GlobalTag +process.GlobalTag = GlobalTag(process.GlobalTag, '130X_dataRun3_HLT_v2', '') + +#Raw-to-digi +process.load('EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff') + +# local RP reconstruction chain with standard settings +process.load("RecoPPS.Configuration.recoCTPPS_cff") + +# CTPPS DQM modules +process.load("DQM.CTPPS.ctppsDQM_cff") +process.totemDAQMappingESSourceXML_TotemT2.verbosity = 0 +process.totemT2Digis.RawUnpacking.verbosity = 0 +process.totemT2Digis.RawToDigi.verbosity = 0 +process.totemT2Digis.RawToDigi.testCRC = 1 +process.totemT2Digis.RawToDigi.useOlderT2TestFile = False +process.totemT2Digis.RawToDigi.printUnknownFrameSummary = True +process.totemT2Digis.RawToDigi.printErrorSummary = True + +process.path = cms.Path( + process.ctppsRawToDigi * + process.totemT2Digis * + process.totemT2RecHits * + process.totemT2DQMSource +) + +process.end_path = cms.EndPath( + process.dqmEnv + + process.dqmSaver +) + +process.schedule = cms.Schedule( + process.path, + process.end_path +) diff --git a/DataFormats/TotemReco/interface/TotemT2Digi.h b/DataFormats/TotemReco/interface/TotemT2Digi.h index 2a5450c08446a..23eeb788eee87 100644 --- a/DataFormats/TotemReco/interface/TotemT2Digi.h +++ b/DataFormats/TotemReco/interface/TotemT2Digi.h @@ -12,12 +12,13 @@ class TotemT2Digi { public: TotemT2Digi() = default; - TotemT2Digi(unsigned short id, unsigned char marker, unsigned short le, unsigned short te); + TotemT2Digi(unsigned short id, unsigned char marker, unsigned short le, unsigned short te, unsigned char status); void setLeadingEdge(unsigned short le) { lead_edge_ = le; } unsigned short leadingEdge() const { return lead_edge_; } void setTrailingEdge(unsigned short te) { trail_edge_ = te; } unsigned short trailingEdge() const { return trail_edge_; } + unsigned char getStatus() const { return status_ & 0xF; } bool hasLE() const { return marker_ & 0x1; } bool hasTE() const { return marker_ & 0x2; } bool hasManyLE() const { return marker_ & 0x4; } @@ -32,6 +33,8 @@ class TotemT2Digi { unsigned short lead_edge_{0}; /// Trailing edge time unsigned short trail_edge_{0}; + /// Header status flags + unsigned char status_{0}; }; bool operator<(const TotemT2Digi& lhs, const TotemT2Digi& rhs); diff --git a/DataFormats/TotemReco/src/TotemT2Digi.cc b/DataFormats/TotemReco/src/TotemT2Digi.cc index 6d8e5cffd2efd..47ffd2076e42c 100644 --- a/DataFormats/TotemReco/src/TotemT2Digi.cc +++ b/DataFormats/TotemReco/src/TotemT2Digi.cc @@ -1,7 +1,8 @@ #include "DataFormats/TotemReco/interface/TotemT2Digi.h" -TotemT2Digi::TotemT2Digi(unsigned short id, unsigned char marker, unsigned short le, unsigned short te) - : id_(id), marker_(marker), lead_edge_(le), trail_edge_(te) {} +TotemT2Digi::TotemT2Digi( + unsigned short id, unsigned char marker, unsigned short le, unsigned short te, unsigned char status) + : id_(id), marker_(marker), lead_edge_(le), trail_edge_(te), status_(status) {} bool operator<(const TotemT2Digi& lhs, const TotemT2Digi& rhs) { if (lhs.leadingEdge() < rhs.leadingEdge()) diff --git a/DataFormats/TotemReco/src/classes_def.xml b/DataFormats/TotemReco/src/classes_def.xml index 7df18e6c92ba4..2f35479c49d5f 100644 --- a/DataFormats/TotemReco/src/classes_def.xml +++ b/DataFormats/TotemReco/src/classes_def.xml @@ -1,5 +1,6 @@ - + + diff --git a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h index c1c8f3c1d5b0b..6738ac3f98d35 100644 --- a/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h +++ b/EventFilter/CTPPSRawToDigi/interface/RawToDigiConverter.h @@ -69,29 +69,28 @@ class RawToDigiConverter { TotemVFATStatus status; }; - unsigned char verbosity; + const unsigned char verbosity; - unsigned int olderTotemT2FileTest; //Test file with T2 frame ver 2.1 - - unsigned int printErrorSummary; - unsigned int printUnknownFrameSummary; + const bool printErrorSummary; + const bool printUnknownFrameSummary; enum TestFlag { tfNoTest, tfWarn, tfErr }; /// flags for which tests to run - unsigned int testFootprint; - unsigned int testCRC; - unsigned int testID; - unsigned int testECRaw; - unsigned int testECDAQ; - unsigned int testECMostFrequent; - unsigned int testBCMostFrequent; + const unsigned int testFootprint; + const unsigned int testCRC; + const unsigned int testID; + const unsigned int testECMostFrequent; + const unsigned int testBCMostFrequent; /// the minimal required number of frames to determine the most frequent counter value - unsigned int EC_min, BC_min; + const unsigned int EC_min, BC_min; /// the minimal required (relative) occupancy of the most frequent counter value to be accepted - double EC_fraction, BC_fraction; + const double EC_fraction, BC_fraction; + + //Test file with two 8-bit hwID fields + const bool olderTotemT2FileTest; /// error summaries std::map > errorSummary; diff --git a/EventFilter/CTPPSRawToDigi/interface/TotemT2VFATFrame.h b/EventFilter/CTPPSRawToDigi/interface/TotemT2VFATFrame.h index 84fa5ca984be8..77ef26aebaf18 100644 --- a/EventFilter/CTPPSRawToDigi/interface/TotemT2VFATFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/TotemT2VFATFrame.h @@ -36,6 +36,9 @@ namespace totem::nt2::vfat { return frame.getData()[header_offset + 1 + num_words_per_channel * ch_id] & 0x1f; } + /// retrieve the header status flags + inline uint8_t statusMarker(const VFATFrame& frame) { return (frame.getData()[header_offset - 1] >> 8) & 0xf; } + /// retrieve the HW identifier for this channel, in firmware >2.1 inline uint16_t newChannelId(const VFATFrame& frame, size_t ch_id) { return frame.getData()[header_offset + 0 + num_words_per_channel * ch_id] & 0xffff; diff --git a/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h b/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h index 96decce9d1bf6..b17b256efd275 100644 --- a/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h +++ b/EventFilter/CTPPSRawToDigi/interface/VFATFrame.h @@ -54,6 +54,9 @@ class VFATFrame { /// Returns the CRC. VFATFrame::word getCRC() const { return data[0]; } + /// Returns the CRC, for non-reversed TOTEM T2. + VFATFrame::word getCRCT2() const { return data[11]; } + /// Sets presence flags. void setPresenceFlags(uint8_t v) { presenceFlags = v; } @@ -85,11 +88,19 @@ class VFATFrame { /// Returns false if any of the groups (in BC, EC and ID words) is present but wrong. bool checkFootprint() const; + /// Checks the fixed bits in the frame, for the TOTEM T2 non-inverse word ordering. + /// Returns false if any of the groups (in BC, EC and ID words) is present but wrong. + bool checkFootprintT2() const; + /// Checks the validity of frame (CRC and daqErrorFlags). /// Returns false if daqErrorFlags is non-zero. /// Returns false if the CRC is present and invalid. virtual bool checkCRC() const; + /// Checks the validity of Totem T2 non-reversed CRC. + /// Returns false if the CRC is present and invalid. + virtual bool checkCRCT2() const; + /// Checks if channel number 'channel' was active. /// Returns positive number if it was active, 0 otherwise. virtual bool channelActive(unsigned char channel) const { diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index 1e5b35027f1ed..b521b5d697a3c 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -52,8 +52,8 @@ # various error/warning/info output may be enabled with these flags # totemRPRawToDigi.RawUnpacking.verbosity = 1 # totemRPRawToDigi.RawToDigi.verbosity = 1 # or higher number for more output -# totemRPRawToDigi.RawToDigi.printErrorSummary = 1 -# totemRPRawToDigi.RawToDigi.printUnknownFrameSummary = 1 +# totemRPRawToDigi.RawToDigi.printErrorSummary = True +# totemRPRawToDigi.RawToDigi.printUnknownFrameSummary = True # ---------- diamonds ---------- totemDAQMappingESSourceXML_TimingDiamond = cms.ESSource("TotemDAQMappingESSourceXML", @@ -102,7 +102,7 @@ ) from EventFilter.CTPPSRawToDigi.ctppsDiamondRawToDigi_cfi import ctppsDiamondRawToDigi -ctppsDiamondRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") +ctppsDiamondRawToDigi.rawDataTag = "rawDataCollector" # ---------- Totem Timing ---------- totemDAQMappingESSourceXML_TotemTiming = cms.ESSource("TotemDAQMappingESSourceXML", @@ -132,16 +132,16 @@ ) from EventFilter.CTPPSRawToDigi.totemTimingRawToDigi_cfi import totemTimingRawToDigi -totemTimingRawToDigi.rawDataTag = cms.InputTag("rawDataCollector") +totemTimingRawToDigi.rawDataTag = "rawDataCollector" # ---------- Totem nT2 ---------- from CalibPPS.ESProducers.totemT2DAQMapping_cff import totemDAQMappingESSourceXML as totemDAQMappingESSourceXML_TotemT2 from EventFilter.CTPPSRawToDigi.totemT2Digis_cfi import totemT2Digis -totemT2Digis.rawDataTag = cms.InputTag("rawDataCollector") +totemT2Digis.rawDataTag = "rawDataCollector" # ---------- pixels ---------- from EventFilter.CTPPSRawToDigi.ctppsPixelDigis_cfi import ctppsPixelDigis -ctppsPixelDigis.inputLabel = cms.InputTag("rawDataCollector") +ctppsPixelDigis.inputLabel = "rawDataCollector" from Configuration.Eras.Modifier_ctpps_2016_cff import ctpps_2016 from Configuration.Eras.Modifier_ctpps_2017_cff import ctpps_2017 @@ -149,6 +149,10 @@ (ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ctppsPixelDigis, isRun3 = False ) (ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(totemDAQMappingESSourceXML_TotemTiming, sampicSubDetId = 6) +# The Totem T2 mapping was expanded with a 2-channel unpacker in PR #41472, changing the xml format causing this module to not accept +# the 2021 dummy mapping copied from diamonds if this parameter is turned on +(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(totemDAQMappingESSourceXML_TotemT2, multipleChannelsPerPayload = False) + # raw-to-digi task and sequence ctppsRawToDigiTask = cms.Task( totemRPRawToDigi, diff --git a/EventFilter/CTPPSRawToDigi/python/totemT2Digis_cfi.py b/EventFilter/CTPPSRawToDigi/python/totemT2Digis_cfi.py index 58a085d5964b0..2ca895ad79791 100644 --- a/EventFilter/CTPPSRawToDigi/python/totemT2Digis_cfi.py +++ b/EventFilter/CTPPSRawToDigi/python/totemT2Digis_cfi.py @@ -3,10 +3,12 @@ from EventFilter.CTPPSRawToDigi.totemVFATRawToDigi_cfi import totemVFATRawToDigi totemT2Digis = totemVFATRawToDigi.clone( - subSystem = cms.string('TotemT2'), + subSystem = 'TotemT2', RawToDigi = totemVFATRawToDigi.RawToDigi.clone( - testID = cms.uint32(0), #Some ID mismatch in test sample - testCRC = cms.uint32(0), # no need to test CRC for diamond frames - testECMostFrequent = cms.uint32(0) # show error in the DQM and then DAQ is sending resync, no need to test in the unpacker + testID = 0, #Some ID mismatch in test sample + testCRC = 0, # no need to test CRC for diamond frames + testECMostFrequent = 0, # show error in the DQM and then DAQ is sending resync, no need to test in the unpacker + testBCMostFrequent = 0, # no need to test in the unpacker, footprint test is enough + useOlderT2TestFile = False # March '23 version with two 8-bit ID fields ) ) diff --git a/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py index 86a1457ad6fc0..6a08f1a3f7293 100644 --- a/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py +++ b/EventFilter/CTPPSRawToDigi/python/totemTimingRawToDigi_cfi.py @@ -9,24 +9,27 @@ totemTimingRawToDigi = totemVFATRawToDigi.clone( subSystem = 'TotemTiming', - fedIds = cms.vuint32(586, 587), #as declared in DataFormats/FEDRawData/interface/FEDNumbering.h + fedIds = [586, 587], #as declared in DataFormats/FEDRawData/interface/FEDNumbering.h - RawToDigi = cms.PSet( - verbosity = cms.untracked.uint32(0), + RawToDigi = dict( + verbosity = 0, - # disable all the checks - testFootprint = cms.uint32(0), - testCRC = cms.uint32(0), - testID = cms.uint32(0), # compare the ID from data and mapping - testECMostFrequent = cms.uint32(0), # compare frame's EC with the most frequent value in the event - testBCMostFrequent = cms.uint32(0), # compare frame's BC with the most frequent value in the event - - # if non-zero, prints a per-VFAT error summary at the end of the job - printErrorSummary = cms.untracked.uint32(0), + # disable all the checks + testFootprint = 0, + testCRC = 0, + testID = 0, # compare the ID from data and mapping + testECMostFrequent = 0, # compare frame's EC with the most frequent value in the event + testBCMostFrequent = 0, # compare frame's BC with the most frequent value in the event + + # tracked parameter for Totem T2 + useOlderT2TestFile = False, + + # if true, prints a per-VFAT error summary at the end of the job + printErrorSummary = False, - # if non-zero, prints a summary of frames found in data, but not in the mapping - printUnknownFrameSummary = cms.untracked.uint32(0) - ) + # if true, prints a summary of frames found in data, but not in the mapping + printUnknownFrameSummary = False + ) ) # for Run 2 backward compatibility diff --git a/EventFilter/CTPPSRawToDigi/python/totemVFATRawToDigi_cfi.py b/EventFilter/CTPPSRawToDigi/python/totemVFATRawToDigi_cfi.py index c9f7ab11433f8..70a2e8321e255 100644 --- a/EventFilter/CTPPSRawToDigi/python/totemVFATRawToDigi_cfi.py +++ b/EventFilter/CTPPSRawToDigi/python/totemVFATRawToDigi_cfi.py @@ -38,11 +38,14 @@ # the most frequent counter value is accepted provided its relative occupancy is higher than this fraction EC_fraction = cms.untracked.double(0.6), BC_fraction = cms.untracked.double(0.6), + + # if true, tread hwID field as two separate 8-bit fields instead of one 16-bit + useOlderT2TestFile = cms.bool(False), + + # prints a per-VFAT error summary at the end of the job + printErrorSummary = cms.untracked.bool(False), - # if non-zero, prints a per-VFAT error summary at the end of the job - printErrorSummary = cms.untracked.uint32(0), - - # if non-zero, prints a summary of frames found in data, but not in the mapping - printUnknownFrameSummary = cms.untracked.uint32(0), + # prints a summary of frames found in data, but not in the mapping + printUnknownFrameSummary = cms.untracked.bool(False), ) ) diff --git a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc index 12b2c794b6fc4..f8ba166409d0b 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawDataUnpacker.cc @@ -459,6 +459,7 @@ int RawDataUnpacker::processOptoRxFrameSampic(const word *buf, // save frame to output frame.setPresenceFlags(1); if ((optoRxId >= FEDNumbering::MINTotemT2FEDID && optoRxId <= FEDNumbering::MAXTotemT2FEDID)) { + frame.setPresenceFlags(15); // check three VFAT signature digits, CRC present if (verbosity > 0) edm::LogWarning("Totem") << "T2 Frame Positions created: " << fp2a << "/" << fp2b << std::endl; diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index 4ed3dba9bb1e6..436082b2f254a 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -25,9 +25,12 @@ using namespace edm; RawToDigiConverter::RawToDigiConverter(const edm::ParameterSet &conf) : verbosity(conf.getUntrackedParameter("verbosity", 0)), - olderTotemT2FileTest(conf.getUntrackedParameter("useOlderT2TestFile", 0)), - printErrorSummary(conf.getUntrackedParameter("printErrorSummary", 1)), - printUnknownFrameSummary(conf.getUntrackedParameter("printUnknownFrameSummary", 1)), + printErrorSummary(conf.existsAs("printErrorSummary", false) + ? conf.getUntrackedParameter("printErrorSummary") + : true), + printUnknownFrameSummary(conf.existsAs("printUnknownFrameSummary", false) + ? conf.getUntrackedParameter("printUnknownFrameSummary") + : true), testFootprint(conf.getParameter("testFootprint")), testCRC(conf.getParameter("testCRC")), @@ -39,7 +42,10 @@ RawToDigiConverter::RawToDigiConverter(const edm::ParameterSet &conf) BC_min(conf.getUntrackedParameter("BC_min", 10)), EC_fraction(conf.getUntrackedParameter("EC_fraction", 0.6)), - BC_fraction(conf.getUntrackedParameter("BC_fraction", 0.6)) {} + BC_fraction(conf.getUntrackedParameter("BC_fraction", 0.6)), + + olderTotemT2FileTest( + conf.existsAs("useOlderT2TestFile", true) ? conf.getParameter("useOlderT2TestFile") : false) {} void RawToDigiConverter::runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, @@ -80,8 +86,13 @@ void RawToDigiConverter::runCommon(const VFATFrameCollection &input, record.status.setNumberOfClustersSpecified(record.frame->isNumberOfClustersPresent()); record.status.setNumberOfClusters(record.frame->getNumberOfClusters()); + // check for T2 payload bits + int rawT2 = fr.Position().getRawPosition(); + bool isT2Frame = (rawT2 >> 18); + // check footprint - if (testFootprint != tfNoTest && !record.frame->checkFootprint()) { + if (((!isT2Frame) && testFootprint != tfNoTest && !record.frame->checkFootprint()) || + (isT2Frame && testFootprint != tfNoTest && !record.frame->checkFootprintT2())) { problemsPresent = true; if (verbosity > 0) @@ -94,7 +105,8 @@ void RawToDigiConverter::runCommon(const VFATFrameCollection &input, } // check CRC - if (testCRC != tfNoTest && !record.frame->checkCRC()) { + if (((!isT2Frame) && (testCRC != tfNoTest && !record.frame->checkCRC())) || + (isT2Frame && testCRC != tfNoTest && !record.frame->checkCRCT2())) { problemsPresent = true; if (verbosity > 0) @@ -123,6 +135,8 @@ void RawToDigiConverter::runCommon(const VFATFrameCollection &input, if (verbosity > 0 && problemsPresent) { string message = (stopProcessing) ? "(and will be dropped)" : "(but will be used though)"; if (verbosity > 2) { + if (isT2Frame && verbosity > 3) + record.frame->PrintT2(); ees << " Frame at " << fr.Position() << " seems corrupted " << message << ":" << endl; ees << fes.rdbuf(); } else @@ -395,8 +409,7 @@ void RawToDigiConverter::run(const VFATFrameCollection &coll, int allT2 = 0; int goodT2 = 0; int foundT2 = 0; - const int T2shiftOld = - (olderTotemT2FileTest > 0 ? 8 : 0); //Run on TOTEM T2 test file (ver 2.1) or final T2 data ver 2.2 + const int T2shiftOld = (olderTotemT2FileTest ? 8 : 0); //Run on TOTEM T2 test file (ver 2.1) or final T2 data ver 2.3 // second loop over data for (auto &p : records) { @@ -431,7 +444,8 @@ void RawToDigiConverter::run(const VFATFrameCollection &coll, .emplace_back(hw_id, totem::nt2::vfat::channelMarker(*record.frame, frame_id), totem::nt2::vfat::leadingEdgeTime(*record.frame, frame_id), - totem::nt2::vfat::trailingEdgeTime(*record.frame, frame_id)); + totem::nt2::vfat::trailingEdgeTime(*record.frame, frame_id), + totem::nt2::vfat::statusMarker(*record.frame)); foundT2++; } else { if (verbosity > 2) diff --git a/EventFilter/CTPPSRawToDigi/src/VFATFrame.cc b/EventFilter/CTPPSRawToDigi/src/VFATFrame.cc index 36fbf224cbf01..fbff151ddc2cb 100644 --- a/EventFilter/CTPPSRawToDigi/src/VFATFrame.cc +++ b/EventFilter/CTPPSRawToDigi/src/VFATFrame.cc @@ -59,6 +59,19 @@ bool VFATFrame::checkFootprint() const { return true; } +bool VFATFrame::checkFootprintT2() const { + if (isIDPresent() && (data[2] & 0xF000) != 0xE000) + return false; + + if (isECPresent() && (data[1] & 0xF000) != 0xC000) + return false; + + if (isBCPresent() && (data[0] & 0xF000) != 0xA000) + return false; + + return true; +} + bool VFATFrame::checkCRC() const { // check DAQ error flags if (daqErrorFlags != 0) @@ -77,6 +90,20 @@ bool VFATFrame::checkCRC() const { return (crc_fin == data[0]); } +bool VFATFrame::checkCRCT2() const { + // return true if CRC not present + if (!isCRCPresent()) + return true; + + // compare CRC + word crc_fin = 0xffff; + + for (int i = 0; i < 11; i++) + crc_fin = calculateCRC(crc_fin, data[i]); + + return (crc_fin == data[11]); +} + VFATFrame::word VFATFrame::calculateCRC(VFATFrame::word crc_in, VFATFrame::word dato) { word v = 0x0001; word mask = 0x0001; @@ -164,6 +191,24 @@ void VFATFrame::PrintT2(bool binary) const { printf("\n"); } } else { + // print right CRC + word crc_fin = 0xffff; + + for (int i = 0; i < 11; i++) + crc_fin = calculateCRC(crc_fin, data[i]); + + printf("CRC = %04x ", getCRCT2()); + + if (checkCRCT2()) + printf("( OK), footprint "); + else + printf("(FAIL, right = %04x), footprint ", crc_fin); + + if (checkFootprintT2()) + printf(" OK"); + else + printf("FAIL"); + printf("Frame = %04x|%04x|%04x|", data[0], data[1], data[2]); for (int i = 3; i < 11; i++) printf("%04x", data[i]); diff --git a/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py b/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py index 309437919c3ae..5f2566403d039 100644 --- a/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py +++ b/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py @@ -14,6 +14,12 @@ 'keep TotemRPUVPatternedmDetSetVector_totemRPUVPatternFinder_*_*', 'keep TotemRPLocalTrackedmDetSetVector_totemRPLocalTrackFitter_*_*', + # totem T2 + 'keep TotemFEDInfos_totemT2Digis_*_*', + 'keep TotemT2DigiedmNewDetSetVector_totemT2Digis_*_*', + 'keep TotemVFATStatusedmDetSetVector_totemT2Digis_*_*', + 'keep TotemT2RecHitedmNewDetSetVector_totemT2RecHits_*_*', + # timing diamonds 'keep TotemFEDInfos_ctppsDiamondRawToDigi_*_*', 'keep CTPPSDiamondDigiedmDetSetVector_ctppsDiamondRawToDigi_*_*', diff --git a/RecoPPS/Configuration/python/recoCTPPS_cff.py b/RecoPPS/Configuration/python/recoCTPPS_cff.py index 1f036f35c1e38..2c769029fd723 100644 --- a/RecoPPS/Configuration/python/recoCTPPS_cff.py +++ b/RecoPPS/Configuration/python/recoCTPPS_cff.py @@ -1,6 +1,7 @@ import FWCore.ParameterSet.Config as cms from RecoPPS.Local.totemRPLocalReconstruction_cff import * +from RecoPPS.Local.totemT2LocalReconstruction_cff import * from RecoPPS.Local.ctppsDiamondLocalReconstruction_cff import * from RecoPPS.Local.totemTimingLocalReconstruction_cff import * from RecoPPS.Local.ctppsPixelLocalReconstruction_cff import * @@ -14,6 +15,7 @@ recoCTPPSTask = cms.Task( totemRPLocalReconstructionTask , + totemT2LocalReconstructionTask , ctppsDiamondLocalReconstructionTask , diamondSampicLocalReconstructionTask , ctppsPixelLocalReconstructionTask , diff --git a/RecoPPS/Local/python/totemT2LocalReconstruction_cff.py b/RecoPPS/Local/python/totemT2LocalReconstruction_cff.py new file mode 100644 index 0000000000000..a8cf0823b205b --- /dev/null +++ b/RecoPPS/Local/python/totemT2LocalReconstruction_cff.py @@ -0,0 +1,13 @@ +import FWCore.ParameterSet.Config as cms + +# reco hit production +from RecoPPS.Local.totemT2RecHits_cfi import * + +# T2 geometry seems not to be uploaded to CondDB, here we load XML version, which produces `TotemGeometryRcd`, consumed only by T2 code. +from Geometry.ForwardCommonData.totemT22021V2XML_cfi import * +from Geometry.ForwardGeometry.totemGeometryESModule_cfi import * + +totemT2LocalReconstructionTask = cms.Task( + totemT2RecHits +) +totemT2LocalReconstruction = cms.Sequence(totemT2LocalReconstructionTask) diff --git a/RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py b/RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py index 84de085f5cb5f..7e9731ce99017 100644 --- a/RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py +++ b/RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py @@ -32,13 +32,13 @@ process.load('CalibPPS.ESProducers.totemT2DAQMapping_cff') process.load('EventFilter.CTPPSRawToDigi.totemT2Digis_cfi') process.totemT2Digis.rawDataTag = cms.InputTag("rawDataCollector") -process.totemDAQMappingESSourceXML.verbosity = cms.untracked.uint32(1) -process.totemT2Digis.RawUnpacking.verbosity = cms.untracked.uint32(1) -process.totemT2Digis.RawToDigi.verbosity = cms.untracked.uint32(3) -process.totemT2Digis.RawToDigi.useOlderT2TestFile = cms.untracked.uint32(1) -process.totemT2Digis.RawToDigi.printUnknownFrameSummary = cms.untracked.uint32(3) -process.totemT2Digis.RawToDigi.printErrorSummary = cms.untracked.uint32(3) -process.totemDAQMappingESSourceXML.multipleChannelsPerPayload = cms.untracked.bool(True) +process.totemDAQMappingESSourceXML.verbosity = 1 +process.totemT2Digis.RawUnpacking.verbosity = 1 +process.totemT2Digis.RawToDigi.verbosity = 3 +process.totemT2Digis.RawToDigi.useOlderT2TestFile = True +process.totemT2Digis.RawToDigi.printUnknownFrameSummary = True +process.totemT2Digis.RawToDigi.printErrorSummary = True +process.totemDAQMappingESSourceXML.multipleChannelsPerPayload = True # rechits production process.load('Geometry.ForwardCommonData.totemT22021V2XML_cfi') From f932e9c835720795ace93f7ab83c42ff53e7bee2 Mon Sep 17 00:00:00 2001 From: Fredrik Date: Tue, 6 Jun 2023 13:20:07 +0200 Subject: [PATCH 2/2] Don't use Totem T2 RecHits due to relVal geometry problems, DB vs xml --- .../plugins/TotemDAQMappingESSourceXML.cc | 38 +++++++++- .../python/totemDAQMappingESSourceXML_cfi.py | 18 ----- .../python/totemT2DAQMapping_cff.py | 8 +-- DQM/CTPPS/plugins/TotemT2DQMSource.cc | 69 +++++++------------ DQM/CTPPS/python/totemT2DQMSource_cfi.py | 1 - DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py | 2 +- DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py | 4 -- DataFormats/TotemReco/interface/TotemT2Digi.h | 2 +- .../plugins/TotemVFATRawToDigi.cc | 49 +++++++++++++ .../python/ctppsRawToDigi_cff.py | 4 -- .../python/totemVFATRawToDigi_cfi.py | 51 -------------- .../CTPPSRawToDigi/src/RawToDigiConverter.cc | 11 +-- .../python/RecoCTPPS_EventContent_cff.py | 1 - RecoPPS/Configuration/python/recoCTPPS_cff.py | 2 - .../python/totemT2LocalReconstruction_cff.py | 6 +- RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py | 10 +-- 16 files changed, 120 insertions(+), 156 deletions(-) delete mode 100644 CalibPPS/ESProducers/python/totemDAQMappingESSourceXML_cfi.py delete mode 100644 EventFilter/CTPPSRawToDigi/python/totemVFATRawToDigi_cfi.py diff --git a/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc b/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc index d03afef4b972b..c9e412ef265ad 100644 --- a/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc +++ b/CalibPPS/ESProducers/plugins/TotemDAQMappingESSourceXML.cc @@ -14,6 +14,8 @@ #include "FWCore/Framework/interface/ModuleFactory.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" #include "FWCore/Framework/interface/ESProducer.h" #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h" #include "FWCore/Framework/interface/ESProducts.h" @@ -85,6 +87,8 @@ class TotemDAQMappingESSourceXML : public edm::ESProducer, public edm::EventSetu TotemDAQMappingESSourceXML(const edm::ParameterSet &); ~TotemDAQMappingESSourceXML() override; + static void fillDescriptions(edm::ConfigurationDescriptions &); + edm::ESProducts, std::unique_ptr> produce(const TotemReadoutRcd &); private: @@ -276,9 +280,7 @@ TotemDAQMappingESSourceXML::TotemDAQMappingESSourceXML(const edm::ParameterSet & : verbosity(conf.getUntrackedParameter("verbosity", 0)), subSystemName(conf.getUntrackedParameter("subSystem")), sampicSubDetId(conf.getParameter("sampicSubDetId")), - packedPayload(conf.existsAs("multipleChannelsPerPayload", true) - ? conf.getParameter("multipleChannelsPerPayload") - : false), + packedPayload(conf.getParameter("multipleChannelsPerPayload")), currentBlock(0), currentBlockValid(false) { for (const auto &it : conf.getParameter>("configuration")) { @@ -1062,4 +1064,34 @@ void TotemDAQMappingESSourceXML::GetChannels(xercesc::DOMNode *n, set("verbosity", 0); + desc.addUntracked("subSystem", "")->setComment("set it to: TrackingStrip, ..."); + desc.add("sampicSubDetId"); + desc.add("multipleChannelsPerPayload", false); + { + edm::ParameterSetDescription vpsd1; + vpsd1.add("validityRange", edm::EventRange(1, 0, 1, 1, 0, 0)); + vpsd1.add>("mappingFileNames", {}); + vpsd1.add>("maskFileNames", {}); + std::vector temp1; + temp1.reserve(1); + { + edm::ParameterSet temp2; + temp2.addParameter("validityRange", edm::EventRange(1, 0, 1, 1, 0, 0)); + temp2.addParameter>("mappingFileNames", {}); + temp2.addParameter>("maskFileNames", {}); + temp1.push_back(temp2); + } + desc.addVPSet("configuration", vpsd1, temp1)->setComment("validityRange, mappingFileNames and maskFileNames"); + } + descriptions.add("totemDAQMappingESSourceXML", desc); + // or use the following to generate the label from the module's C++ type + //descriptions.addWithDefaultLabel(desc); +} + +//---------------------------------------------------------------------------------------------------- + DEFINE_FWK_EVENTSETUP_SOURCE(TotemDAQMappingESSourceXML); diff --git a/CalibPPS/ESProducers/python/totemDAQMappingESSourceXML_cfi.py b/CalibPPS/ESProducers/python/totemDAQMappingESSourceXML_cfi.py deleted file mode 100644 index 961fa3e55ce6b..0000000000000 --- a/CalibPPS/ESProducers/python/totemDAQMappingESSourceXML_cfi.py +++ /dev/null @@ -1,18 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -totemDAQMappingESSourceXML = cms.ESSource("TotemDAQMappingESSourceXML", - verbosity = cms.untracked.uint32(0), - - # set it to: TrackingStrip, ... - subSystem = cms.untracked.string(""), - multipleChannelsPerPayload = cms.bool(False), - - configuration = cms.VPSet( - # example configuration block: - #cms.PSet( - # validityRange = cms.EventRange("1:min - 999999999:max"), - # mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/ctpps_mapping_to_fill_5288.xml"), - # maskFileNames = cms.vstring() - #) - ) -) diff --git a/CalibPPS/ESProducers/python/totemT2DAQMapping_cff.py b/CalibPPS/ESProducers/python/totemT2DAQMapping_cff.py index 316d7fff99faf..2dbe3115eb3c0 100644 --- a/CalibPPS/ESProducers/python/totemT2DAQMapping_cff.py +++ b/CalibPPS/ESProducers/python/totemT2DAQMapping_cff.py @@ -5,15 +5,9 @@ totemDAQMappingESSourceXML = _xml.clone( subSystem = "TotemT2", configuration = cms.VPSet( - #initial dummy diamond map copy, use only for Run 2 where T2 mapping is read with old schema - cms.PSet( - validityRange = cms.EventRange("1:min - 339999:max"), - mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/mapping_totem_nt2_2021.xml"), - maskFileNames = cms.vstring() - ), #old v2.1 T2 firmware test file cms.PSet( - validityRange = cms.EventRange("340000:min - 368022:max"), + validityRange = cms.EventRange("1:min - 368022:max"), mappingFileNames = cms.vstring("CondFormats/PPSObjects/xml/mapping_totem_nt2_2023.xml"), maskFileNames = cms.vstring() ), diff --git a/DQM/CTPPS/plugins/TotemT2DQMSource.cc b/DQM/CTPPS/plugins/TotemT2DQMSource.cc index d54a3b5174307..451a3854e192a 100644 --- a/DQM/CTPPS/plugins/TotemT2DQMSource.cc +++ b/DQM/CTPPS/plugins/TotemT2DQMSource.cc @@ -21,7 +21,6 @@ #include "DataFormats/CTPPSDetId/interface/TotemT2DetId.h" #include "DataFormats/TotemReco/interface/TotemT2Digi.h" -#include "DataFormats/TotemReco/interface/TotemT2RecHit.h" #include "Geometry/Records/interface/TotemGeometryRcd.h" #include "DQM/CTPPS/interface/TotemT2Segmentation.h" @@ -46,14 +45,11 @@ class TotemT2DQMSource : public DQMEDAnalyzer { void bookErrorFlagsHistogram(DQMStore::IBooker&); void fillErrorFlagsHistogram(const TotemT2Digi&, const TotemT2DetId&); void fillEdges(const TotemT2Digi&, const TotemT2DetId&); - void fillToT(const TotemT2RecHit&, const TotemT2DetId&); + void fillToT(const TotemT2Digi&, const TotemT2DetId&); void fillFlags(const TotemT2Digi&, const TotemT2DetId&); const edm::ESGetToken geometryToken_; const edm::EDGetTokenT> digiToken_; - const edm::EDGetTokenT> rechitToken_; - - std::unique_ptr segm_; static constexpr double T2_BIN_WIDTH_NS_ = 25. / 4; MonitorElement* totemT2ErrorFlags_2D_ = nullptr; @@ -129,7 +125,7 @@ TotemT2DQMSource::SectorPlots::SectorPlots( "trailing edge", title + " trailing edge (DIGIs); trailing edge (ns)", 25 * windowsNum, 0, 25 * windowsNum); timeOverTreshold = ibooker.book1D( - "time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 500, -50, 200); + "time over threshold", title + " time over threshold (digi);time over threshold (ns)", 500, -50, 200); eventFlags = ibooker.book1D( "event flags", title + " event flags (digi);Event flags (TE/LE valid, TE/LE multiple)", 4, -0.5, 3.5); @@ -183,7 +179,7 @@ TotemT2DQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, unsigne "trailing edge", title + " trailing edge (DIGIs); trailing edge (ns)", 25 * windowsNum, 0, 25 * windowsNum); timeOverTresholdCh = ibooker.book1D( - "time over threshold", title + " time over threshold (rechit);time over threshold (ns)", 500, -50, 200); + "time over threshold", title + " time over threshold (digi);time over threshold (ns)", 500, -50, 200); eventFlagsCh = ibooker.book1D( "event flags", title + " event flags (digi);Event flags (TE/LE valid, TE/LE multiple)", 4, -0.5, 3.5); @@ -195,7 +191,6 @@ TotemT2DQMSource::ChannelPlots::ChannelPlots(DQMStore::IBooker& ibooker, unsigne TotemT2DQMSource::TotemT2DQMSource(const edm::ParameterSet& iConfig) : geometryToken_(esConsumes()), digiToken_(consumes>(iConfig.getParameter("digisTag"))), - rechitToken_(consumes>(iConfig.getParameter("rechitsTag"))), nbinsx_(iConfig.getParameter("nbinsx")), nbinsy_(iConfig.getParameter("nbinsy")), windowsNum_(iConfig.getParameter("windowsNum")) {} @@ -224,47 +219,23 @@ void TotemT2DQMSource::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run } // build a segmentation helper for the size of histograms previously booked - segm_ = std::make_unique(iSetup.getData(geometryToken_), nbinsx_, nbinsy_); } void TotemT2DQMSource::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // fill digis information for (const auto& ds_digis : iEvent.get(digiToken_)) { - const TotemT2DetId detid(ds_digis.detId()); - const TotemT2DetId planeId(detid.planeId()); - for (const auto& digi : ds_digis) { - segm_->fill(planePlots_[planeId].digisMultiplicity->getTH2D(), detid); - fillTriggerBitset(detid); - fillErrorFlagsHistogram(digi, detid); - fillEdges(digi, detid); - fillFlags(digi, detid); + if (!ds_digis.empty()) { + const TotemT2DetId detid(ds_digis.detId()); + for (const auto& digi : ds_digis) { + fillTriggerBitset(detid); + fillErrorFlagsHistogram(digi, detid); + fillEdges(digi, detid); + fillToT(digi, detid); + fillFlags(digi, detid); + } } } - // fill rechits information - std::unordered_map> planes; - for (const auto& ds_rechits : iEvent.get(rechitToken_)) { - const TotemT2DetId detid(ds_rechits.detId()); - const TotemT2DetId planeId(detid.planeId()); - for (const auto& rechit : ds_rechits) { - segm_->fill(planePlots_[planeId].rechitMultiplicity->getTH2D(), detid); - fillToT(rechit, detid); - 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); - } - } clearTriggerBitset(); } @@ -321,7 +292,7 @@ void TotemT2DQMSource::bookErrorFlagsHistogram(DQMStore::IBooker& ibooker) { void TotemT2DQMSource::fillErrorFlagsHistogram(const TotemT2Digi& digi, const TotemT2DetId& detid) { // readout flags histogram filling for (unsigned int i = 0; i < 4; i++) { - if (digi.getStatus() & (1 << i)) + if (digi.status() & (1 << i)) totemT2ErrorFlags_2D_->Fill(i + 0.0, detid.arm() + 0.0); } } @@ -334,10 +305,18 @@ void TotemT2DQMSource::fillEdges(const TotemT2Digi& digi, const TotemT2DetId& de channelPlots_[detid].trailingEdgeCh->Fill(T2_BIN_WIDTH_NS_ * digi.trailingEdge()); } -void TotemT2DQMSource::fillToT(const TotemT2RecHit& rechit, const TotemT2DetId& detid) { +void TotemT2DQMSource::fillToT(const TotemT2Digi& digi, const TotemT2DetId& detid) { const TotemT2DetId secId(detid.armId()); - sectorPlots_[secId].timeOverTreshold->Fill(rechit.toT()); - channelPlots_[detid].timeOverTresholdCh->Fill(rechit.toT()); + + const int t_lead = digi.leadingEdge(), t_trail = digi.trailingEdge(); + // don't skip no-edge digis + double toT = 0.; + if (digi.hasLE() && digi.hasTE()) { + toT = (t_trail - t_lead) * T2_BIN_WIDTH_NS_; // in ns + } + + sectorPlots_[secId].timeOverTreshold->Fill(toT); + channelPlots_[detid].timeOverTresholdCh->Fill(toT); } void TotemT2DQMSource::fillFlags(const TotemT2Digi& digi, const TotemT2DetId& detid) { diff --git a/DQM/CTPPS/python/totemT2DQMSource_cfi.py b/DQM/CTPPS/python/totemT2DQMSource_cfi.py index 952c472e9738d..41e1a0c5d8278 100644 --- a/DQM/CTPPS/python/totemT2DQMSource_cfi.py +++ b/DQM/CTPPS/python/totemT2DQMSource_cfi.py @@ -3,7 +3,6 @@ from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer totemT2DQMSource = DQMEDAnalyzer('TotemT2DQMSource', digisTag = cms.InputTag('totemT2Digis', 'TotemT2'), - rechitsTag = cms.InputTag('totemT2RecHits'), nbinsx = cms.uint32(25), nbinsy = cms.uint32(25), windowsNum = cms.uint32(8), diff --git a/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py b/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py index 66af8d76dd40e..97599a16b2569 100644 --- a/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py +++ b/DQM/CTPPS/test/totemt2_dqm_test_common_cfg.py @@ -51,7 +51,7 @@ #from Configuration.AlCa.GlobalTag import GlobalTag #process.GlobalTag = GlobalTag(process.GlobalTag, '130X_dataRun3_HLT_v2', '') -# local T2 reconstruction chain with standard settings +# local RP reconstruction chain with standard settings process.load("RecoPPS.Configuration.recoCTPPS_cff") # CTPPS DQM modules diff --git a/DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py b/DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py index c2f7c8379353a..6a15df51bd877 100644 --- a/DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py +++ b/DQM/CTPPS/test/totemt2_dqm_test_nino_cfg.py @@ -49,9 +49,6 @@ #Raw-to-digi process.load('EventFilter.CTPPSRawToDigi.ctppsRawToDigi_cff') -# local RP reconstruction chain with standard settings -process.load("RecoPPS.Configuration.recoCTPPS_cff") - # CTPPS DQM modules process.load("DQM.CTPPS.ctppsDQM_cff") process.totemDAQMappingESSourceXML_TotemT2.verbosity = 0 @@ -65,7 +62,6 @@ process.path = cms.Path( process.ctppsRawToDigi * process.totemT2Digis * - process.totemT2RecHits * process.totemT2DQMSource ) diff --git a/DataFormats/TotemReco/interface/TotemT2Digi.h b/DataFormats/TotemReco/interface/TotemT2Digi.h index 23eeb788eee87..ff1f7bec7f529 100644 --- a/DataFormats/TotemReco/interface/TotemT2Digi.h +++ b/DataFormats/TotemReco/interface/TotemT2Digi.h @@ -18,7 +18,7 @@ class TotemT2Digi { unsigned short leadingEdge() const { return lead_edge_; } void setTrailingEdge(unsigned short te) { trail_edge_ = te; } unsigned short trailingEdge() const { return trail_edge_; } - unsigned char getStatus() const { return status_ & 0xF; } + unsigned char status() const { return status_ & 0xF; } bool hasLE() const { return marker_ & 0x1; } bool hasTE() const { return marker_ & 0x2; } bool hasManyLE() const { return marker_ & 0x4; } diff --git a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc index 951395833e8a1..8ceb238e8a5e5 100644 --- a/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc +++ b/EventFilter/CTPPSRawToDigi/plugins/TotemVFATRawToDigi.cc @@ -35,6 +35,9 @@ #include "DataFormats/CTPPSDigi/interface/TotemTimingDigi.h" #include "DataFormats/TotemReco/interface/TotemT2Digi.h" +#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" +#include "FWCore/ParameterSet/interface/ParameterSetDescription.h" + #include class TotemVFATRawToDigi : public edm::stream::EDProducer<> { @@ -44,6 +47,7 @@ class TotemVFATRawToDigi : public edm::stream::EDProducer<> { void produce(edm::Event &, const edm::EventSetup &) override; void endStream() override; + static void fillDescriptions(edm::ConfigurationDescriptions &); private: std::string subSystemName; @@ -196,4 +200,49 @@ void TotemVFATRawToDigi::run(edm::Event &event, const edm::EventSetup &es) { void TotemVFATRawToDigi::endStream() { rawToDigiConverter.printSummaries(); } +void TotemVFATRawToDigi::fillDescriptions(edm::ConfigurationDescriptions &descriptions) { + // totemVFATRawToDigi + edm::ParameterSetDescription desc; + desc.add("rawDataTag", edm::InputTag("")); + desc.add("subSystem", "")->setComment("options: RP"); + desc.add>("fedIds", {}) + ->setComment( + "IMPORTANT: leave empty to load the default configuration from " + "DataFormats/FEDRawData/interface/FEDNumbering.h"); + { + edm::ParameterSetDescription psd0; + psd0.addUntracked("verbosity", 0); + desc.add("RawUnpacking", psd0); + } + { + edm::ParameterSetDescription psd0; + psd0.addUntracked("verbosity", 0) + ->setComment( + "0-3: 1=one line/event with some corrupted VFAT frame, 2=list all corrupt VFAT frames/event, 3=all " + "problems with every corrupt frame"); + psd0.add("testFootprint", 2)->setComment("0=no test, 1=warn only, 2=warn and skip"); + psd0.add("testCRC", 2); + psd0.add("testID", 2)->setComment("compare the ID from data and mapping"); + psd0.add("testECMostFrequent", 2) + ->setComment("compare frame EC with the most frequent value in the event"); + psd0.add("testBCMostFrequent", 2); + psd0.addUntracked("EC_min", 10) + ->setComment("minimal number of frames to search for the most frequent counter value"); + psd0.addUntracked("BC_min", 10); + psd0.addUntracked("EC_fraction", 0.6) + ->setComment( + "the most frequent counter value is accepted provided its relative occupancy is higher than this fraction"); + psd0.addUntracked("BC_fraction", 0.6); + psd0.add("useOlderT2TestFile", false) + ->setComment("treat hwID field as two separate 8-bit fields instead of one 16-bit"); + psd0.addUntracked("printErrorSummary", false)->setComment("per-VFAT error summary at the end of the job"); + psd0.addUntracked("printUnknownFrameSummary", false) + ->setComment("summary of frames found in data, but not in the mapping"); + desc.add("RawToDigi", psd0); + } + descriptions.add("totemVFATRawToDigi", desc); + // or use the following to generate the label from the module's C++ type + //descriptions.addWithDefaultLabel(desc); +} + DEFINE_FWK_MODULE(TotemVFATRawToDigi); diff --git a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py index b521b5d697a3c..2cf2c8c9d36b2 100644 --- a/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py +++ b/EventFilter/CTPPSRawToDigi/python/ctppsRawToDigi_cff.py @@ -149,10 +149,6 @@ (ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(ctppsPixelDigis, isRun3 = False ) (ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(totemDAQMappingESSourceXML_TotemTiming, sampicSubDetId = 6) -# The Totem T2 mapping was expanded with a 2-channel unpacker in PR #41472, changing the xml format causing this module to not accept -# the 2021 dummy mapping copied from diamonds if this parameter is turned on -(ctpps_2016 | ctpps_2017 | ctpps_2018).toModify(totemDAQMappingESSourceXML_TotemT2, multipleChannelsPerPayload = False) - # raw-to-digi task and sequence ctppsRawToDigiTask = cms.Task( totemRPRawToDigi, diff --git a/EventFilter/CTPPSRawToDigi/python/totemVFATRawToDigi_cfi.py b/EventFilter/CTPPSRawToDigi/python/totemVFATRawToDigi_cfi.py deleted file mode 100644 index 70a2e8321e255..0000000000000 --- a/EventFilter/CTPPSRawToDigi/python/totemVFATRawToDigi_cfi.py +++ /dev/null @@ -1,51 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -totemVFATRawToDigi = cms.EDProducer("TotemVFATRawToDigi", - rawDataTag = cms.InputTag(""), - - # options: "RP" - subSystem = cms.string(""), - - # IMPORTANT: leave empty to load the default configuration from - # DataFormats/FEDRawData/interface/FEDNumbering.h - fedIds = cms.vuint32(), - - RawUnpacking = cms.PSet( - verbosity = cms.untracked.uint32(0), - ), - - RawToDigi = cms.PSet( - # 0: no error output - # 1: one-line message for every event with at least one corrupted VFAT frame - # 2: lists all corrupted VFATs in all events - # 3: lists all corruptions for all corrupted VFATs in all events - verbosity = cms.untracked.uint32(0), - - # flags for available consistency tests - # 0: do not perform the test at all - # 1: print an error message, but keep the frame - # 2: print an error message and do not process the frame - testFootprint = cms.uint32(2), - testCRC = cms.uint32(2), - testID = cms.uint32(2), # compare the ID from data and mapping - testECMostFrequent = cms.uint32(2), # compare frame's EC with the most frequent value in the event - testBCMostFrequent = cms.uint32(2), # compare frame's BC with the most frequent value in the event - - # the minimal number of frames to search for the most frequent counter value - EC_min = cms.untracked.uint32(10), - BC_min = cms.untracked.uint32(10), - - # the most frequent counter value is accepted provided its relative occupancy is higher than this fraction - EC_fraction = cms.untracked.double(0.6), - BC_fraction = cms.untracked.double(0.6), - - # if true, tread hwID field as two separate 8-bit fields instead of one 16-bit - useOlderT2TestFile = cms.bool(False), - - # prints a per-VFAT error summary at the end of the job - printErrorSummary = cms.untracked.bool(False), - - # prints a summary of frames found in data, but not in the mapping - printUnknownFrameSummary = cms.untracked.bool(False), - ) -) diff --git a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc index 436082b2f254a..b5baf2c0230ce 100644 --- a/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc +++ b/EventFilter/CTPPSRawToDigi/src/RawToDigiConverter.cc @@ -25,12 +25,8 @@ using namespace edm; RawToDigiConverter::RawToDigiConverter(const edm::ParameterSet &conf) : verbosity(conf.getUntrackedParameter("verbosity", 0)), - printErrorSummary(conf.existsAs("printErrorSummary", false) - ? conf.getUntrackedParameter("printErrorSummary") - : true), - printUnknownFrameSummary(conf.existsAs("printUnknownFrameSummary", false) - ? conf.getUntrackedParameter("printUnknownFrameSummary") - : true), + printErrorSummary(conf.getUntrackedParameter("printErrorSummary")), + printUnknownFrameSummary(conf.getUntrackedParameter("printUnknownFrameSummary")), testFootprint(conf.getParameter("testFootprint")), testCRC(conf.getParameter("testCRC")), @@ -44,8 +40,7 @@ RawToDigiConverter::RawToDigiConverter(const edm::ParameterSet &conf) EC_fraction(conf.getUntrackedParameter("EC_fraction", 0.6)), BC_fraction(conf.getUntrackedParameter("BC_fraction", 0.6)), - olderTotemT2FileTest( - conf.existsAs("useOlderT2TestFile", true) ? conf.getParameter("useOlderT2TestFile") : false) {} + olderTotemT2FileTest(conf.getParameter("useOlderT2TestFile")) {} void RawToDigiConverter::runCommon(const VFATFrameCollection &input, const TotemDAQMapping &mapping, diff --git a/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py b/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py index 5f2566403d039..873ae84467014 100644 --- a/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py +++ b/RecoPPS/Configuration/python/RecoCTPPS_EventContent_cff.py @@ -18,7 +18,6 @@ 'keep TotemFEDInfos_totemT2Digis_*_*', 'keep TotemT2DigiedmNewDetSetVector_totemT2Digis_*_*', 'keep TotemVFATStatusedmDetSetVector_totemT2Digis_*_*', - 'keep TotemT2RecHitedmNewDetSetVector_totemT2RecHits_*_*', # timing diamonds 'keep TotemFEDInfos_ctppsDiamondRawToDigi_*_*', diff --git a/RecoPPS/Configuration/python/recoCTPPS_cff.py b/RecoPPS/Configuration/python/recoCTPPS_cff.py index 2c769029fd723..1f036f35c1e38 100644 --- a/RecoPPS/Configuration/python/recoCTPPS_cff.py +++ b/RecoPPS/Configuration/python/recoCTPPS_cff.py @@ -1,7 +1,6 @@ import FWCore.ParameterSet.Config as cms from RecoPPS.Local.totemRPLocalReconstruction_cff import * -from RecoPPS.Local.totemT2LocalReconstruction_cff import * from RecoPPS.Local.ctppsDiamondLocalReconstruction_cff import * from RecoPPS.Local.totemTimingLocalReconstruction_cff import * from RecoPPS.Local.ctppsPixelLocalReconstruction_cff import * @@ -15,7 +14,6 @@ recoCTPPSTask = cms.Task( totemRPLocalReconstructionTask , - totemT2LocalReconstructionTask , ctppsDiamondLocalReconstructionTask , diamondSampicLocalReconstructionTask , ctppsPixelLocalReconstructionTask , diff --git a/RecoPPS/Local/python/totemT2LocalReconstruction_cff.py b/RecoPPS/Local/python/totemT2LocalReconstruction_cff.py index a8cf0823b205b..341d00f1e31f8 100644 --- a/RecoPPS/Local/python/totemT2LocalReconstruction_cff.py +++ b/RecoPPS/Local/python/totemT2LocalReconstruction_cff.py @@ -3,11 +3,7 @@ # reco hit production from RecoPPS.Local.totemT2RecHits_cfi import * -# T2 geometry seems not to be uploaded to CondDB, here we load XML version, which produces `TotemGeometryRcd`, consumed only by T2 code. -from Geometry.ForwardCommonData.totemT22021V2XML_cfi import * -from Geometry.ForwardGeometry.totemGeometryESModule_cfi import * - totemT2LocalReconstructionTask = cms.Task( - totemT2RecHits + totemT2RecHits ) totemT2LocalReconstruction = cms.Sequence(totemT2LocalReconstructionTask) diff --git a/RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py b/RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py index 7e9731ce99017..853f2f78c1455 100644 --- a/RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py +++ b/RecoPPS/Local/test/totemT2NewDigi_reco_cfg.py @@ -41,12 +41,12 @@ process.totemDAQMappingESSourceXML.multipleChannelsPerPayload = True # rechits production -process.load('Geometry.ForwardCommonData.totemT22021V2XML_cfi') -process.load('Geometry.ForwardGeometry.totemGeometryESModule_cfi') -process.load('RecoPPS.Local.totemT2RecHits_cfi') +#process.load('Geometry.ForwardCommonData.totemT22021V2XML_cfi') +#process.load('Geometry.ForwardGeometry.totemGeometryESModule_cfi') +#process.load('RecoPPS.Local.totemT2RecHits_cfi') process.output = cms.OutputModule("PoolOutputModule", - fileName = cms.untracked.string("file:output-miniDaq2303-T2testFile-ver2.1--1ev.root"), + fileName = cms.untracked.string("file:output-miniDaq2303-T2testFile-ver2.1-noRecHits--1ev.root"), outputCommands = cms.untracked.vstring( 'drop *', 'keep *_totemT2*_*_*', @@ -56,7 +56,7 @@ # execution configuration process.p = cms.Path( process.totemT2Digis - * process.totemT2RecHits +# * process.totemT2RecHits ) process.outpath = cms.EndPath(process.output)