From 4698f3b5ddd64473925a5f64b5ee13753a980ab8 Mon Sep 17 00:00:00 2001 From: francescobrivio Date: Thu, 15 Feb 2024 18:30:24 +0100 Subject: [PATCH] Update LHCInfoProducer to use LHCInfoCombined --- .../plugins/SiPixelStatusHarvester.cc | 3 -- DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc | 7 ----- PhysicsTools/NanoAOD/plugins/BuildFile.xml | 2 +- .../NanoAOD/plugins/LHCInfoProducer.cc | 28 ++++++++++++++----- PhysicsTools/NanoAOD/python/nano_cff.py | 6 +++- PhysicsTools/NanoAOD/python/nano_eras_cff.py | 1 + 6 files changed, 28 insertions(+), 19 deletions(-) diff --git a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc index 0dc7621c6b37f..e9288ca65c653 100644 --- a/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc +++ b/CalibTracker/SiPixelQuality/plugins/SiPixelStatusHarvester.cc @@ -23,9 +23,6 @@ #include "CondFormats/DataRecord/interface/SiPixelFedCablingMapRcd.h" // Condition Format #include "CondFormats/DataRecord/interface/SiPixelQualityRcd.h" -// LHCinfo -//#include "CondFormats/RunInfo/interface/LHCInfo.h" -//#include "CondFormats/DataRecord/interface/LHCInfoRcd.h" // CondOutput #include "CondCore/DBOutputService/interface/PoolDBOutputService.h" diff --git a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc index e7a4e6d5bba6c..9627e026bb737 100644 --- a/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc +++ b/DQM/CTPPS/plugins/CTPPSDiamondDQMSource.cc @@ -37,9 +37,6 @@ #include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h" #include "Geometry/Records/interface/VeryForwardRealGeometryRecord.h" -// #include "CondFormats/RunInfo/interface/LHCInfo.h" -// #include "CondFormats/DataRecord/interface/LHCInfoRcd.h" - #include //---------------------------------------------------------------------------------------------------- @@ -220,7 +217,6 @@ class CTPPSDiamondDQMSource : public DQMOneEDAnalyzer ctppsGeometryRunToken_; edm::ESGetToken ctppsGeometryEventToken_; - // edm::ESGetToken ctppsLhcInfoToken_; bool excludeMultipleHits_; const bool extract_digi_info_; @@ -594,7 +590,6 @@ CTPPSDiamondDQMSource::CTPPSDiamondDQMSource(const edm::ParameterSet& ps) ps.getUntrackedParameter("tagDiamondLocalTracks"))), ctppsGeometryRunToken_(esConsumes()), ctppsGeometryEventToken_(esConsumes()), - // ctppsLhcInfoToken_(esConsumes()), excludeMultipleHits_(ps.getParameter("excludeMultipleHits")), extract_digi_info_(ps.getParameter("extractDigiInfo")), centralOOT_(-999), @@ -725,7 +720,6 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet event.getByToken(tokenDiamondTrack_, diamondLocalTracks); const CTPPSGeometry* ctppsGeometry = &iSetup.getData(ctppsGeometryEventToken_); - // const LHCInfo* hLhcInfo = &iSetup.getData(ctppsLhcInfoToken_); // check validity bool valid = true; @@ -990,7 +984,6 @@ void CTPPSDiamondDQMSource::analyze(const edm::Event& event, const edm::EventSet if (plotOffline_ && !perLSsaving_) { // potPlots_[detId_pot].trackTimeVsLS->Fill(event.luminosityBlock(),track.time()); potPlots_[detId_pot].trackTimeVsBX->Fill(event.bunchCrossing(), track.time()); - //potPlots_[detId_pot].trackTimeVsXAngle->Fill(hLhcInfo->crossingAngle(), track.time()); } } } diff --git a/PhysicsTools/NanoAOD/plugins/BuildFile.xml b/PhysicsTools/NanoAOD/plugins/BuildFile.xml index 2d06b9ec6bfd6..e833cd0cd4c04 100644 --- a/PhysicsTools/NanoAOD/plugins/BuildFile.xml +++ b/PhysicsTools/NanoAOD/plugins/BuildFile.xml @@ -6,8 +6,8 @@ - + diff --git a/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc b/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc index d9e4773015c1f..d9e1fd399ebbb 100644 --- a/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc +++ b/PhysicsTools/NanoAOD/plugins/LHCInfoProducer.cc @@ -45,12 +45,18 @@ #include "FWCore/Utilities/interface/transform.h" -#include "CondFormats/RunInfo/interface/LHCInfo.h" -#include "CondFormats/DataRecord/interface/LHCInfoRcd.h" +#include "CondTools/RunInfo/interface/LHCInfoCombined.h" class LHCInfoProducer : public edm::global::EDProducer { public: - LHCInfoProducer(edm::ParameterSet const&) : lhcinfoToken_(esConsumes()) { + LHCInfoProducer(edm::ParameterSet const& iConfig) + : lhcinfoToken_(esConsumes( + edm::ESInputTag("", iConfig.getParameter("lhcInfoLabel")))), + lhcinfoPerLSToken_(esConsumes( + edm::ESInputTag("", iConfig.getParameter("lhcInfoPerLSLabel")))), + lhcinfoPerFillToken_(esConsumes( + edm::ESInputTag("", iConfig.getParameter("lhcInfoPerFillLabel")))), + useNewLHCInfo_(iConfig.getParameter("useNewLHCInfo")) { produces(); } ~LHCInfoProducer() override {} @@ -59,20 +65,28 @@ class LHCInfoProducer : public edm::global::EDProducer(); - out->addFloat("crossingAngle", "LHC crossing angle", info.crossingAngle()); - out->addFloat("betaStar", "LHC beta star", info.betaStar()); - out->addFloat("energy", "LHC beam energy", info.energy()); + out->addFloat("crossingAngle", "LHC crossing angle", lhcInfoCombined.crossingAngle()); + out->addFloat("betaStar", "LHC beta star", lhcInfoCombined.betaStarX); + out->addFloat("energy", "LHC beam energy", lhcInfoCombined.energy); iLumi.put(std::move(out)); } // ------------ method fills 'descriptions' with the allowed parameters for the module ------------ static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) { edm::ParameterSetDescription desc; + desc.add("lhcInfoLabel", "")->setComment("label used for LHCInfo"); + desc.add("lhcInfoPerLSLabel", "")->setComment("label of the LHCInfoPerLS record"); + desc.add("lhcInfoPerFillLabel", "")->setComment("label of the LHCInfoPerFill record"); + desc.add("useNewLHCInfo", true) + ->setComment("flag whether to use new LHCInfoPerLS/Fill records or old LHCInfo"); descriptions.addWithDefaultLabel(desc); } edm::ESGetToken lhcinfoToken_; + edm::ESGetToken lhcinfoPerLSToken_; + edm::ESGetToken lhcinfoPerFillToken_; + bool useNewLHCInfo_; }; DEFINE_FWK_MODULE(LHCInfoProducer); diff --git a/PhysicsTools/NanoAOD/python/nano_cff.py b/PhysicsTools/NanoAOD/python/nano_cff.py index cf194650941dd..05b93bee87630 100644 --- a/PhysicsTools/NanoAOD/python/nano_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_cff.py @@ -56,7 +56,11 @@ linkedObjects, boostedTaus=None, ) -lhcInfoTable = cms.EDProducer("LHCInfoProducer") +from PhysicsTools.NanoAOD.lhcInfoProducer_cfi import lhcInfoProducer +lhcInfoTable = lhcInfoProducer.clone() +(~run3_common).toModify( + lhcInfoTable, useNewLHCInfo=False +) nanoTableTaskCommon = cms.Task( cms.Task(nanoMetadata), diff --git a/PhysicsTools/NanoAOD/python/nano_eras_cff.py b/PhysicsTools/NanoAOD/python/nano_eras_cff.py index 4163b72b9dce7..3da976ed4d9f5 100644 --- a/PhysicsTools/NanoAOD/python/nano_eras_cff.py +++ b/PhysicsTools/NanoAOD/python/nano_eras_cff.py @@ -14,6 +14,7 @@ from Configuration.Eras.Modifier_run2_nanoAOD_106Xv2_cff import run2_nanoAOD_106Xv2 from Configuration.Eras.Modifier_tracker_apv_vfp30_2016_cff import tracker_apv_vfp30_2016 +from Configuration.Eras.Modifier_run3_common_cff import run3_common from Configuration.Eras.Modifier_run3_nanoAOD_122_cff import run3_nanoAOD_122 from Configuration.Eras.Modifier_run3_nanoAOD_124_cff import run3_nanoAOD_124 from Configuration.Eras.Modifier_run3_jme_Winter22runsBCDEprompt_cff import run3_jme_Winter22runsBCDEprompt