From ed42ed2d1a17f67a1c424a3870586f94e106ffb0 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 20 Apr 2022 17:33:47 +0200 Subject: [PATCH 1/7] optimizatoins for event size --- .../Scouting/interface/Run3ScoutingElectron.h | 11 ++++++-- .../Scouting/interface/Run3ScoutingParticle.h | 16 +++++------ .../Scouting/interface/Run3ScoutingPhoton.h | 11 ++++++-- DataFormats/Scouting/src/classes_def.xml | 10 +++++-- .../plugins/HLTScoutingEgammaProducer.cc | 26 ++++++++++------- .../plugins/HLTScoutingEgammaProducer.h | 1 + .../JetMET/plugins/HLTScoutingPFProducer.cc | 28 ++++++++++++------- 7 files changed, 66 insertions(+), 37 deletions(-) mode change 100755 => 100644 DataFormats/Scouting/src/classes_def.xml diff --git a/DataFormats/Scouting/interface/Run3ScoutingElectron.h b/DataFormats/Scouting/interface/Run3ScoutingElectron.h index 8f8e8abbdec4f..58857a0e0ac6f 100644 --- a/DataFormats/Scouting/interface/Run3ScoutingElectron.h +++ b/DataFormats/Scouting/interface/Run3ScoutingElectron.h @@ -31,7 +31,8 @@ class Run3ScoutingElectron { uint32_t seedId, std::vector energyMatrix, std::vector detIds, - std::vector timingMatrix) + std::vector timingMatrix, + bool rechitZeroSuppression) : pt_(pt), eta_(eta), phi_(phi), @@ -54,7 +55,8 @@ class Run3ScoutingElectron { seedId_(seedId), energyMatrix_(std::move(energyMatrix)), detIds_(std::move(detIds)), - timingMatrix_(std::move(timingMatrix)) {} + timingMatrix_(std::move(timingMatrix)), + rechitZeroSuppression_(rechitZeroSuppression) {} //default constructor Run3ScoutingElectron() : pt_(0), @@ -76,7 +78,8 @@ class Run3ScoutingElectron { r9_(0), sMin_(0), sMaj_(0), - seedId_(0) {} + seedId_(0), + rechitZeroSuppression_(false) {} //accessor functions float pt() const { return pt_; } @@ -102,6 +105,7 @@ class Run3ScoutingElectron { std::vector const& energyMatrix() const { return energyMatrix_; } std::vector const& detIds() const { return detIds_; } std::vector const& timingMatrix() const { return timingMatrix_; } + bool rechitZeroSuppression() const { return rechitZeroSuppression_; } private: float pt_; @@ -127,6 +131,7 @@ class Run3ScoutingElectron { std::vector energyMatrix_; std::vector detIds_; std::vector timingMatrix_; + bool rechitZeroSuppression_; }; typedef std::vector Run3ScoutingElectronCollection; diff --git a/DataFormats/Scouting/interface/Run3ScoutingParticle.h b/DataFormats/Scouting/interface/Run3ScoutingParticle.h index 764cbc05bf38a..3ed05eaae9543 100644 --- a/DataFormats/Scouting/interface/Run3ScoutingParticle.h +++ b/DataFormats/Scouting/interface/Run3ScoutingParticle.h @@ -12,7 +12,6 @@ class Run3ScoutingParticle { Run3ScoutingParticle(float pt, float eta, float phi, - float m, int pdgId, int vertex, float normchi2, @@ -24,11 +23,11 @@ class Run3ScoutingParticle { uint8_t quality, float trk_pt, float trk_eta, - float trk_phi) + float trk_phi, + bool trk_vars_rel) : pt_(pt), eta_(eta), phi_(phi), - m_(m), pdgId_(pdgId), vertex_(vertex), normchi2_(normchi2), @@ -40,14 +39,14 @@ class Run3ScoutingParticle { quality_(quality), trk_pt_(trk_pt), trk_eta_(trk_eta), - trk_phi_(trk_phi) {} + trk_phi_(trk_phi), + trk_vars_rel_(trk_vars_rel) {} // default constractor Run3ScoutingParticle() : pt_(0), eta_(0), phi_(0), - m_(0), pdgId_(0), vertex_(-1), normchi2_(0), @@ -59,13 +58,13 @@ class Run3ScoutingParticle { quality_(0), trk_pt_(0), trk_eta_(0), - trk_phi_(0) {} + trk_phi_(0), + trk_vars_rel_(false) {} //accessor functions float pt() const { return pt_; } float eta() const { return eta_; } float phi() const { return phi_; } - float m() const { return m_; } int pdgId() const { return pdgId_; } int vertex() const { return vertex_; } float normchi2() const { return normchi2_; } @@ -78,12 +77,12 @@ class Run3ScoutingParticle { float trk_pt() const { return trk_pt_; } float trk_eta() const { return trk_eta_; } float trk_phi() const { return trk_phi_; } + bool trk_vars_rel() const { return trk_vars_rel_; } private: float pt_; float eta_; float phi_; - float m_; int pdgId_; int vertex_; float normchi2_; @@ -96,6 +95,7 @@ class Run3ScoutingParticle { float trk_pt_; float trk_eta_; float trk_phi_; + bool trk_vars_rel_; }; typedef std::vector Run3ScoutingParticleCollection; diff --git a/DataFormats/Scouting/interface/Run3ScoutingPhoton.h b/DataFormats/Scouting/interface/Run3ScoutingPhoton.h index 5bc73c740c435..44399ef32a907 100644 --- a/DataFormats/Scouting/interface/Run3ScoutingPhoton.h +++ b/DataFormats/Scouting/interface/Run3ScoutingPhoton.h @@ -24,7 +24,8 @@ class Run3ScoutingPhoton { uint32_t seedId, std::vector energyMatrix, std::vector detIds, - std::vector timingMatrix) + std::vector timingMatrix, + bool rechitZeroSuppression) : pt_(pt), eta_(eta), phi_(phi), @@ -40,7 +41,8 @@ class Run3ScoutingPhoton { seedId_(seedId), energyMatrix_(std::move(energyMatrix)), detIds_(std::move(detIds)), - timingMatrix_(std::move(timingMatrix)) {} + timingMatrix_(std::move(timingMatrix)), + rechitZeroSuppression_(rechitZeroSuppression) {} //default constructor Run3ScoutingPhoton() : pt_(0), @@ -57,7 +59,8 @@ class Run3ScoutingPhoton { sMaj_(0), seedId_(0), energyMatrix_(0), - timingMatrix_(0) {} + timingMatrix_(0), + rechitZeroSuppression_(false) {} //accessor functions float pt() const { return pt_; } @@ -76,6 +79,7 @@ class Run3ScoutingPhoton { std::vector const& energyMatrix() const { return energyMatrix_; } std::vector const& detIds() const { return detIds_; } std::vector const& timingMatrix() const { return timingMatrix_; } + bool rechitZeroSuppression() const { return rechitZeroSuppression_; } private: float pt_; @@ -94,6 +98,7 @@ class Run3ScoutingPhoton { std::vector energyMatrix_; std::vector detIds_; std::vector timingMatrix_; + bool rechitZeroSuppression_; }; typedef std::vector Run3ScoutingPhotonCollection; diff --git a/DataFormats/Scouting/src/classes_def.xml b/DataFormats/Scouting/src/classes_def.xml old mode 100755 new mode 100644 index bad4f787d6fea..8003d59fd4b77 --- a/DataFormats/Scouting/src/classes_def.xml +++ b/DataFormats/Scouting/src/classes_def.xml @@ -33,14 +33,17 @@ - + + + - + + @@ -48,7 +51,8 @@ - + + diff --git a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc index 35b23d017a0ec..85f4ec4ad73c3 100644 --- a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc +++ b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc @@ -65,6 +65,7 @@ HLTScoutingEgammaProducer::HLTScoutingEgammaProducer(const edm::ParameterSet& iC mantissaPrecision(iConfig.getParameter("mantissaPrecision")), saveRecHitTiming(iConfig.getParameter("saveRecHitTiming")), rechitMatrixSize(iConfig.getParameter("rechitMatrixSize")), //(2n+1)^2 + rechitZeroSuppression(iConfig.getParameter("rechitZeroSuppression")), ecalRechitEB_(consumes(iConfig.getParameter("ecalRechitEB"))), ecalRechitEE_(consumes(iConfig.getParameter("ecalRechitEE"))) { //register products @@ -212,16 +213,18 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e std::vector mDetIds = EcalClusterTools::matrixDetId((topology), (*SCseed).seed(), rechitMatrixSize); int detSize = mDetIds.size(); - std::vector mDetIdIds(detSize, 0); - std::vector mEnergies(detSize, 0.); - std::vector mTimes(detSize, 0.); + std::vector mDetIdIds; + std::vector mEnergies; + std::vector mTimes; for (int i = 0; i < detSize; i++) { - mDetIdIds[i] = mDetIds[i]; - mEnergies[i] = - MiniFloatConverter::reduceMantissaToNbitsRounding(recHitE(mDetIds[i], *rechits), mantissaPrecision); - if (saveRecHitTiming) - mTimes[i] = MiniFloatConverter::reduceMantissaToNbitsRounding(recHitT(mDetIds[i], *rechits), mantissaPrecision); + if (recHitE(mDetIds[i], *rechits)>0 or (!rechitZeroSuppression)) { + mDetIdIds.push_back(mDetIds[i]); + mEnergies.push_back(MiniFloatConverter::reduceMantissaToNbitsRounding(recHitE(mDetIds[i], *rechits), mantissaPrecision)); + if (saveRecHitTiming) { + mTimes.push_back(MiniFloatConverter::reduceMantissaToNbitsRounding(recHitT(mDetIds[i], *rechits), mantissaPrecision)); + } + } } float HoE = 999.; @@ -258,7 +261,8 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e seedId, mEnergies, mDetIdIds, - mTimes); //read for(ieta){for(iphi){}} + mTimes, + rechitZeroSuppression); //read for(ieta){for(iphi){}} } else { // Candidate is a scouting electron outElectrons->emplace_back(candidate.pt(), candidate.eta(), @@ -282,7 +286,8 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e seedId, mEnergies, mDetIdIds, - mTimes); //read for(ieta){for(iphi){}} + mTimes, + rechitZeroSuppression); //read for(ieta){for(iphi){}} } } @@ -312,6 +317,7 @@ void HLTScoutingEgammaProducer::fillDescriptions(edm::ConfigurationDescriptions& desc.add("saveRecHitTiming", false); desc.add("mantissaPrecision", 10)->setComment("default float16, change to 23 for float32"); desc.add("rechitMatrixSize", 10); + desc.add("rechitZeroSuppression", true); desc.add("ecalRechitEB", edm::InputTag("hltEcalRecHit:EcalRecHitsEB")); desc.add("ecalRechitEE", edm::InputTag("hltEcalRecHit:EcalRecHitsEE")); descriptions.add("hltScoutingEgammaProducer", desc); diff --git a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.h b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.h index 093721d7bc7a7..7d0d660b5299b 100644 --- a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.h +++ b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.h @@ -85,6 +85,7 @@ class HLTScoutingEgammaProducer : public edm::global::EDProducer<> { const int mantissaPrecision; const bool saveRecHitTiming; const int rechitMatrixSize; + const bool rechitZeroSuppression; const edm::EDGetTokenT ecalRechitEB_; const edm::EDGetTokenT ecalRechitEE_; diff --git a/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc b/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc index d459ccf16eec6..48fa3032122b3 100644 --- a/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc +++ b/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc @@ -69,7 +69,8 @@ class HLTScoutingPFProducer : public edm::global::EDProducer<> { const bool doJetTags_; const bool doCandidates_; const bool doMet_; - const bool doTrackRelVars_; + const bool doTrackVars_; + const bool trackVarsRel_; const bool doCandIndsForJets_; }; @@ -91,7 +92,8 @@ HLTScoutingPFProducer::HLTScoutingPFProducer(const edm::ParameterSet &iConfig) doJetTags_(iConfig.getParameter("doJetTags")), doCandidates_(iConfig.getParameter("doCandidates")), doMet_(iConfig.getParameter("doMet")), - doTrackRelVars_(iConfig.getParameter("doTrackRelVars")), + doTrackVars_(iConfig.getParameter("doTrackVars")), + trackVarsRel_(iConfig.getParameter("trackVarsRel")), doCandIndsForJets_(iConfig.getParameter("doCandIndsForJets")) { //register products produces(); @@ -162,16 +164,21 @@ void HLTScoutingPFProducer::produce(edm::StreamID sid, edm::Event &iEvent, edm:: } float normchi2{0}, dz{0}, dxy{0}, dzError{0}, dxyError{0}, trk_pt{0}, trk_eta{0}, trk_phi{0}; uint8_t lostInnerHits{0}, quality{0}; - if (doTrackRelVars_) { + if (doTrackVars_) { const auto *trk = cand.bestTrack(); if (trk != nullptr) { normchi2 = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->normalizedChi2(), mantissaPrecision_); lostInnerHits = btagbtvdeep::lost_inner_hits_from_pfcand(cand); quality = btagbtvdeep::quality_from_pfcand(cand); - trk_pt = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->pt(), mantissaPrecision_); - trk_eta = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->eta(), mantissaPrecision_); - trk_phi = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->phi(), mantissaPrecision_); - + if (trackVarsRel_) { + trk_pt = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->pt()-cand.pt(), mantissaPrecision_); + trk_eta = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->eta()-cand.eta(), mantissaPrecision_); + trk_phi = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->phi()-cand.phi(), mantissaPrecision_); + } else { + trk_pt = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->pt(), mantissaPrecision_); + trk_eta = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->eta(), mantissaPrecision_); + trk_phi = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->phi(), mantissaPrecision_); + } if (not vertexCollection->empty()) { const reco::Vertex &pv = (*vertexCollection)[0]; @@ -191,7 +198,6 @@ void HLTScoutingPFProducer::produce(edm::StreamID sid, edm::Event &iEvent, edm:: MiniFloatConverter::reduceMantissaToNbitsRounding(cand.pt(), mantissaPrecision_), MiniFloatConverter::reduceMantissaToNbitsRounding(cand.eta(), mantissaPrecision_), MiniFloatConverter::reduceMantissaToNbitsRounding(cand.phi(), mantissaPrecision_), - MiniFloatConverter::reduceMantissaToNbitsRounding(cand.mass(), mantissaPrecision_), cand.pdgId(), vertex_index, normchi2, @@ -203,7 +209,8 @@ void HLTScoutingPFProducer::produce(edm::StreamID sid, edm::Event &iEvent, edm:: quality, trk_pt, trk_eta, - trk_phi); + trk_phi, + trackVarsRel_); } } } @@ -314,7 +321,8 @@ void HLTScoutingPFProducer::fillDescriptions(edm::ConfigurationDescriptions &des desc.add("doJetTags", true); desc.add("doCandidates", true); desc.add("doMet", true); - desc.add("doTrackRelVars", true); + desc.add("doTrackVars", true); + desc.add("trackVarsRel", true); desc.add("doCandIndsForJets", false); descriptions.addWithDefaultLabel(desc); } From 3115592a7a80431023d5b09e954313c52a68f32b Mon Sep 17 00:00:00 2001 From: David Date: Thu, 21 Apr 2022 15:21:29 +0200 Subject: [PATCH 2/7] event size optimizations --- DataFormats/Scouting/interface/Run3ScoutingParticle.h | 10 +++++----- DataFormats/Scouting/src/classes_def.xml | 3 ++- HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc | 5 ++++- HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc | 10 +++++----- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/DataFormats/Scouting/interface/Run3ScoutingParticle.h b/DataFormats/Scouting/interface/Run3ScoutingParticle.h index 3ed05eaae9543..b44ee47f205ef 100644 --- a/DataFormats/Scouting/interface/Run3ScoutingParticle.h +++ b/DataFormats/Scouting/interface/Run3ScoutingParticle.h @@ -24,7 +24,7 @@ class Run3ScoutingParticle { float trk_pt, float trk_eta, float trk_phi, - bool trk_vars_rel) + bool relative_trk_vars) : pt_(pt), eta_(eta), phi_(phi), @@ -40,7 +40,7 @@ class Run3ScoutingParticle { trk_pt_(trk_pt), trk_eta_(trk_eta), trk_phi_(trk_phi), - trk_vars_rel_(trk_vars_rel) {} + relative_trk_vars_(relative_trk_vars) {} // default constractor Run3ScoutingParticle() @@ -59,7 +59,7 @@ class Run3ScoutingParticle { trk_pt_(0), trk_eta_(0), trk_phi_(0), - trk_vars_rel_(false) {} + relative_trk_vars_(false) {} //accessor functions float pt() const { return pt_; } @@ -77,7 +77,7 @@ class Run3ScoutingParticle { float trk_pt() const { return trk_pt_; } float trk_eta() const { return trk_eta_; } float trk_phi() const { return trk_phi_; } - bool trk_vars_rel() const { return trk_vars_rel_; } + bool relative_trk_vars() const { return relative_trk_vars_; } private: float pt_; @@ -95,7 +95,7 @@ class Run3ScoutingParticle { float trk_pt_; float trk_eta_; float trk_phi_; - bool trk_vars_rel_; + bool relative_trk_vars_; }; typedef std::vector Run3ScoutingParticleCollection; diff --git a/DataFormats/Scouting/src/classes_def.xml b/DataFormats/Scouting/src/classes_def.xml index 8003d59fd4b77..14d679fa0d3cb 100644 --- a/DataFormats/Scouting/src/classes_def.xml +++ b/DataFormats/Scouting/src/classes_def.xml @@ -33,7 +33,8 @@ - + + diff --git a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc index 85f4ec4ad73c3..7df5823d9db09 100644 --- a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc +++ b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc @@ -216,9 +216,12 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e std::vector mDetIdIds; std::vector mEnergies; std::vector mTimes; + mDetIdIds.reserve(detSize); + mEnergies.reserve(detSize); + mTimes.reserve(detSize); for (int i = 0; i < detSize; i++) { - if (recHitE(mDetIds[i], *rechits)>0 or (!rechitZeroSuppression)) { + if (not rechitZeroSuppression or recHitE(mDetIds[i], *rechits) > 0) { mDetIdIds.push_back(mDetIds[i]); mEnergies.push_back(MiniFloatConverter::reduceMantissaToNbitsRounding(recHitE(mDetIds[i], *rechits), mantissaPrecision)); if (saveRecHitTiming) { diff --git a/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc b/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc index 48fa3032122b3..a2a2f4c304355 100644 --- a/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc +++ b/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc @@ -70,7 +70,7 @@ class HLTScoutingPFProducer : public edm::global::EDProducer<> { const bool doCandidates_; const bool doMet_; const bool doTrackVars_; - const bool trackVarsRel_; + const bool relativeTrackVars_; const bool doCandIndsForJets_; }; @@ -93,7 +93,7 @@ HLTScoutingPFProducer::HLTScoutingPFProducer(const edm::ParameterSet &iConfig) doCandidates_(iConfig.getParameter("doCandidates")), doMet_(iConfig.getParameter("doMet")), doTrackVars_(iConfig.getParameter("doTrackVars")), - trackVarsRel_(iConfig.getParameter("trackVarsRel")), + relativeTrackVars_(iConfig.getParameter("relativeTrackVars")), doCandIndsForJets_(iConfig.getParameter("doCandIndsForJets")) { //register products produces(); @@ -170,7 +170,7 @@ void HLTScoutingPFProducer::produce(edm::StreamID sid, edm::Event &iEvent, edm:: normchi2 = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->normalizedChi2(), mantissaPrecision_); lostInnerHits = btagbtvdeep::lost_inner_hits_from_pfcand(cand); quality = btagbtvdeep::quality_from_pfcand(cand); - if (trackVarsRel_) { + if (relativeTrackVars_) { trk_pt = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->pt()-cand.pt(), mantissaPrecision_); trk_eta = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->eta()-cand.eta(), mantissaPrecision_); trk_phi = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->phi()-cand.phi(), mantissaPrecision_); @@ -210,7 +210,7 @@ void HLTScoutingPFProducer::produce(edm::StreamID sid, edm::Event &iEvent, edm:: trk_pt, trk_eta, trk_phi, - trackVarsRel_); + relativeTrackVars_); } } } @@ -322,7 +322,7 @@ void HLTScoutingPFProducer::fillDescriptions(edm::ConfigurationDescriptions &des desc.add("doCandidates", true); desc.add("doMet", true); desc.add("doTrackVars", true); - desc.add("trackVarsRel", true); + desc.add("relativeTrackVars", true); desc.add("doCandIndsForJets", false); descriptions.addWithDefaultLabel(desc); } From 76aa1a75bcee9097fa4afa32558457513cbb8b84 Mon Sep 17 00:00:00 2001 From: David Date: Thu, 21 Apr 2022 20:51:33 +0200 Subject: [PATCH 3/7] code checks --- .../plugins/HLTScoutingEgammaProducer.cc | 16 ++++--- .../JetMET/plugins/HLTScoutingPFProducer.cc | 45 +++++++++---------- 2 files changed, 31 insertions(+), 30 deletions(-) diff --git a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc index 7df5823d9db09..f441616f0b99d 100644 --- a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc +++ b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc @@ -221,13 +221,15 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e mTimes.reserve(detSize); for (int i = 0; i < detSize; i++) { - if (not rechitZeroSuppression or recHitE(mDetIds[i], *rechits) > 0) { - mDetIdIds.push_back(mDetIds[i]); - mEnergies.push_back(MiniFloatConverter::reduceMantissaToNbitsRounding(recHitE(mDetIds[i], *rechits), mantissaPrecision)); - if (saveRecHitTiming) { - mTimes.push_back(MiniFloatConverter::reduceMantissaToNbitsRounding(recHitT(mDetIds[i], *rechits), mantissaPrecision)); - } + if (not rechitZeroSuppression or recHitE(mDetIds[i], *rechits) > 0) { + mDetIdIds.push_back(mDetIds[i]); + mEnergies.push_back( + MiniFloatConverter::reduceMantissaToNbitsRounding(recHitE(mDetIds[i], *rechits), mantissaPrecision)); + if (saveRecHitTiming) { + mTimes.push_back( + MiniFloatConverter::reduceMantissaToNbitsRounding(recHitT(mDetIds[i], *rechits), mantissaPrecision)); } + } } float HoE = 999.; @@ -266,7 +268,7 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e mDetIdIds, mTimes, rechitZeroSuppression); //read for(ieta){for(iphi){}} - } else { // Candidate is a scouting electron + } else { // Candidate is a scouting electron outElectrons->emplace_back(candidate.pt(), candidate.eta(), candidate.phi(), diff --git a/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc b/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc index a2a2f4c304355..09b9f5f4f8301 100644 --- a/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc +++ b/HLTrigger/JetMET/plugins/HLTScoutingPFProducer.cc @@ -171,13 +171,13 @@ void HLTScoutingPFProducer::produce(edm::StreamID sid, edm::Event &iEvent, edm:: lostInnerHits = btagbtvdeep::lost_inner_hits_from_pfcand(cand); quality = btagbtvdeep::quality_from_pfcand(cand); if (relativeTrackVars_) { - trk_pt = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->pt()-cand.pt(), mantissaPrecision_); - trk_eta = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->eta()-cand.eta(), mantissaPrecision_); - trk_phi = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->phi()-cand.phi(), mantissaPrecision_); + trk_pt = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->pt() - cand.pt(), mantissaPrecision_); + trk_eta = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->eta() - cand.eta(), mantissaPrecision_); + trk_phi = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->phi() - cand.phi(), mantissaPrecision_); } else { - trk_pt = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->pt(), mantissaPrecision_); - trk_eta = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->eta(), mantissaPrecision_); - trk_phi = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->phi(), mantissaPrecision_); + trk_pt = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->pt(), mantissaPrecision_); + trk_eta = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->eta(), mantissaPrecision_); + trk_phi = MiniFloatConverter::reduceMantissaToNbitsRounding(trk->phi(), mantissaPrecision_); } if (not vertexCollection->empty()) { const reco::Vertex &pv = (*vertexCollection)[0]; @@ -194,23 +194,22 @@ void HLTScoutingPFProducer::produce(edm::StreamID sid, edm::Event &iEvent, edm:: normchi2 = MiniFloatConverter::reduceMantissaToNbitsRounding(999, mantissaPrecision_); } } - outPFCandidates->emplace_back( - MiniFloatConverter::reduceMantissaToNbitsRounding(cand.pt(), mantissaPrecision_), - MiniFloatConverter::reduceMantissaToNbitsRounding(cand.eta(), mantissaPrecision_), - MiniFloatConverter::reduceMantissaToNbitsRounding(cand.phi(), mantissaPrecision_), - cand.pdgId(), - vertex_index, - normchi2, - dz, - dxy, - dzError, - dxyError, - lostInnerHits, - quality, - trk_pt, - trk_eta, - trk_phi, - relativeTrackVars_); + outPFCandidates->emplace_back(MiniFloatConverter::reduceMantissaToNbitsRounding(cand.pt(), mantissaPrecision_), + MiniFloatConverter::reduceMantissaToNbitsRounding(cand.eta(), mantissaPrecision_), + MiniFloatConverter::reduceMantissaToNbitsRounding(cand.phi(), mantissaPrecision_), + cand.pdgId(), + vertex_index, + normchi2, + dz, + dxy, + dzError, + dxyError, + lostInnerHits, + quality, + trk_pt, + trk_eta, + trk_phi, + relativeTrackVars_); } } } From 8d35ab057e51b893a88442190590e9cd2ee9f0f6 Mon Sep 17 00:00:00 2001 From: dsperka Date: Tue, 26 Apr 2022 22:32:20 -0400 Subject: [PATCH 4/7] Update HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc Co-authored-by: Marino Missiroli --- HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc index f441616f0b99d..908c43659975b 100644 --- a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc +++ b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc @@ -221,10 +221,11 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e mTimes.reserve(detSize); for (int i = 0; i < detSize; i++) { - if (not rechitZeroSuppression or recHitE(mDetIds[i], *rechits) > 0) { + auto const recHit_en = recHitE(mDetIds[i], *rechits); + if (not rechitZeroSuppression or recHit_en > 0) { mDetIdIds.push_back(mDetIds[i]); mEnergies.push_back( - MiniFloatConverter::reduceMantissaToNbitsRounding(recHitE(mDetIds[i], *rechits), mantissaPrecision)); + MiniFloatConverter::reduceMantissaToNbitsRounding(recHit_en, mantissaPrecision)); if (saveRecHitTiming) { mTimes.push_back( MiniFloatConverter::reduceMantissaToNbitsRounding(recHitT(mDetIds[i], *rechits), mantissaPrecision)); From 3141306f12e5d3fe233fb8acc564a6800367c05b Mon Sep 17 00:00:00 2001 From: David Date: Wed, 27 Apr 2022 04:33:54 +0200 Subject: [PATCH 5/7] update class versions --- DataFormats/Scouting/src/classes_def.xml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/DataFormats/Scouting/src/classes_def.xml b/DataFormats/Scouting/src/classes_def.xml index 14d679fa0d3cb..7be86ecd8abfd 100644 --- a/DataFormats/Scouting/src/classes_def.xml +++ b/DataFormats/Scouting/src/classes_def.xml @@ -33,29 +33,27 @@ - - - - + + - + - + From 56d14b44d51a9737b2bd6d144290586a834ae395 Mon Sep 17 00:00:00 2001 From: David Date: Wed, 27 Apr 2022 14:02:15 +0200 Subject: [PATCH 6/7] code checks --- HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc index 908c43659975b..abd85c534b932 100644 --- a/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc +++ b/HLTrigger/Egamma/plugins/HLTScoutingEgammaProducer.cc @@ -224,8 +224,7 @@ void HLTScoutingEgammaProducer::produce(edm::StreamID sid, edm::Event& iEvent, e auto const recHit_en = recHitE(mDetIds[i], *rechits); if (not rechitZeroSuppression or recHit_en > 0) { mDetIdIds.push_back(mDetIds[i]); - mEnergies.push_back( - MiniFloatConverter::reduceMantissaToNbitsRounding(recHit_en, mantissaPrecision)); + mEnergies.push_back(MiniFloatConverter::reduceMantissaToNbitsRounding(recHit_en, mantissaPrecision)); if (saveRecHitTiming) { mTimes.push_back( MiniFloatConverter::reduceMantissaToNbitsRounding(recHitT(mDetIds[i], *rechits), mantissaPrecision)); From 7737fb0cd75d3b36d7364b55f36e2e212ee1059c Mon Sep 17 00:00:00 2001 From: David Date: Fri, 29 Apr 2022 16:05:52 +0200 Subject: [PATCH 7/7] add customization function to remove old parameter --- .../Configuration/python/customizeHLTforCMSSW.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py index 5fff8ba91499a..447e54978b7f3 100644 --- a/HLTrigger/Configuration/python/customizeHLTforCMSSW.py +++ b/HLTrigger/Configuration/python/customizeHLTforCMSSW.py @@ -156,6 +156,16 @@ def customiseFor37046(process): return process +def customiseFor37646(process): + """ Customisation to remove a renamed parameter in HLTScoutingPFProducer + from PR 37646 (https://github.com/cms-sw/cmssw/pull/37646) + """ + for prod in producers_by_type(process, 'HLTScoutingPFProducer'): + if hasattr(prod, 'doTrackRelVars'): + delattr(prod, 'doTrackRelVars') + return process + + # CMSSW version specific customizations def customizeHLTforCMSSW(process, menuType="GRun"): @@ -168,4 +178,6 @@ def customizeHLTforCMSSW(process, menuType="GRun"): process = customiseFor37046(process) + process = customiseFor37646(process) + return process