From f98da5741f2f0e0f4eac6ffdb0d0f8aa5cefec20 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Thu, 7 Jan 2021 07:50:56 -0600 Subject: [PATCH 01/15] initial changes to get filter weights from DB --- Configuration/Eras/python/Era_Run3_cff.py | 3 +- .../Eras/python/Modifier_run3_HE_cff.py | 6 ++ .../StandardSequences/python/Eras.py | 2 +- .../interface/HcalTriggerPrimitiveAlgo.h | 1 + .../src/HcalTriggerPrimitiveAlgo.cc | 8 +++ .../python/hcaltpdigi_cff.py | 4 ++ .../python/hcaltpdigi_cfi.py | 5 ++ .../src/HcalTrigPrimDigiProducer.cc | 56 ++++++++++++++++++- .../src/HcalTrigPrimDigiProducer.h | 9 +++ 9 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 Configuration/Eras/python/Modifier_run3_HE_cff.py diff --git a/Configuration/Eras/python/Era_Run3_cff.py b/Configuration/Eras/python/Era_Run3_cff.py index 73b7ca8cd89d2..c5ccf16d3aac4 100644 --- a/Configuration/Eras/python/Era_Run3_cff.py +++ b/Configuration/Eras/python/Era_Run3_cff.py @@ -4,10 +4,11 @@ from Configuration.Eras.Modifier_run3_common_cff import run3_common from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM from Configuration.Eras.Modifier_run3_HB_cff import run3_HB +from Configuration.Eras.Modifier_run3_HE_cff import run3_HE from Configuration.Eras.Modifier_run2_GEM_2017_cff import run2_GEM_2017 from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021 from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -Run3 = cms.ModifierChain(Run2_2018.copyAndExclude([run2_GEM_2017, ctpps_2018]), run3_common, run3_GEM, run3_HB, stage2L1Trigger_2021, ctpps_2021) +Run3 = cms.ModifierChain(Run2_2018.copyAndExclude([run2_GEM_2017, ctpps_2018]), run3_common, run3_GEM, run3_HB, run3_HE, stage2L1Trigger_2021, ctpps_2021) diff --git a/Configuration/Eras/python/Modifier_run3_HE_cff.py b/Configuration/Eras/python/Modifier_run3_HE_cff.py new file mode 100644 index 0000000000000..bc688b4edd631 --- /dev/null +++ b/Configuration/Eras/python/Modifier_run3_HE_cff.py @@ -0,0 +1,6 @@ +import FWCore.ParameterSet.Config as cms + +# This modifier is for HE-specific changes for sim, reco, etc. + +run3_HE = cms.Modifier() + diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index 2b5390964fafa..dab1b9172739d 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -51,7 +51,7 @@ def __init__(self): 'peripheralPbPb', 'pA_2016', 'run2_HE_2017', 'stage2L1Trigger', 'stage2L1Trigger_2017', 'stage2L1Trigger_2018', 'stage2L1Trigger_2021', 'run2_HF_2017', 'run2_HCAL_2017', 'run2_HEPlan1_2017', 'run2_HB_2018','run2_HE_2018', - 'run3_HB', 'run3_common', 'run3_RPC', + 'run3_HB', 'run3_HE', 'run3_common', 'run3_RPC', 'phase1Pixel', 'run3_GEM', 'run2_GEM_2017', 'run2_CSC_2018', 'phase2_common', 'phase2_tracker', diff --git a/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h b/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h index 328596ce06101..0b9d66a4aadec 100644 --- a/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h +++ b/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h @@ -78,6 +78,7 @@ class HcalTriggerPrimitiveAlgo { HcalTrigPrimDigiCollection& result); void setPeakFinderAlgorithm(int algo); void setWeightsQIE11(const edm::ParameterSet& weightsQIE11); + void setWeightsQIE11(const std::map& weightsQIE11); void setNCTScaleShift(int); void setRCTScaleShift(int); diff --git a/SimCalorimetry/HcalTrigPrimAlgos/src/HcalTriggerPrimitiveAlgo.cc b/SimCalorimetry/HcalTrigPrimAlgos/src/HcalTriggerPrimitiveAlgo.cc index dd989342c8b2d..b2ff0239cb6b2 100644 --- a/SimCalorimetry/HcalTrigPrimAlgos/src/HcalTriggerPrimitiveAlgo.cc +++ b/SimCalorimetry/HcalTrigPrimAlgos/src/HcalTriggerPrimitiveAlgo.cc @@ -866,6 +866,14 @@ void HcalTriggerPrimitiveAlgo::setWeightsQIE11(const edm::ParameterSet& weightsQ } } +void HcalTriggerPrimitiveAlgo::setWeightsQIE11(const std::map& weightsQIE11) { + // Simple map of |ieta| in HBHE to weight + for (auto& pair : weightsQIE11) { + // Only one weight for SOI-1 TS + weightsQIE11_[pair.first] = {{pair.second, 1.0}}; + } +} + void HcalTriggerPrimitiveAlgo::setPeakFinderAlgorithm(int algo) { if (algo <= 0 || algo > 2) throw cms::Exception("ERROR: Only algo 1 & 2 are supported.") << std::endl; diff --git a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py index fb218d413bb3c..c0981ebe6d12d 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py +++ b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py @@ -6,6 +6,8 @@ from Configuration.Eras.Modifier_run2_HCAL_2018_cff import run2_HCAL_2018 from Configuration.Eras.Modifier_pp_on_AA_2018_cff import pp_on_AA_2018 +from Configuration.Eras.Modifier_run3_HB_cff import run3_HB +from Configuration.Eras.Modifier_run3_HE_cff import run3_HE from SimCalorimetry.HcalTrigPrimProducers.hcaltpdigi_cfi import * from CalibCalorimetry.CaloTPG.CaloTPGTranscoder_cfi import * @@ -33,3 +35,5 @@ run2_HCAL_2018.toModify(HcalTPGCoderULUT, linearLUTs=cms.bool(True)) pp_on_AA_2018.toModify(CaloTPGTranscoder, FG_HF_thresholds = cms.vuint32(15, 19)) pp_on_AA_2018.toModify(HcalTPGCoderULUT, FG_HF_thresholds = cms.vuint32(15, 19)) +run3_HB.toModify(HcalTPGCoderULUT, contain1TSHB=cms.bool(True), containPhaseNSHB=cms.double(3.0)) +run3_HE.toModify(HcalTPGCoderULUT, contain1TSHE=cms.bool(True), containPhaseNSHE=cms.double(3.0)) diff --git a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py index 75d87b5ea569e..01816fb7f0032 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py +++ b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py @@ -4,6 +4,7 @@ from Configuration.Eras.Modifier_run2_HE_2017_cff import run2_HE_2017 from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 from Configuration.Eras.Modifier_run3_HB_cff import run3_HB +from Configuration.Eras.Modifier_run3_HE_cff import run3_HE LSParameter =cms.untracked.PSet( HcalFeatureHFEMBit= cms.bool(False), @@ -81,6 +82,8 @@ cms.InputTag('simHcalUnsuppressedDigis:HBHEQIE11DigiCollection'), cms.InputTag('simHcalUnsuppressedDigis:HFQIE10DigiCollection')), InputTagFEDRaw = cms.InputTag("rawDataCollector"), + useDBweightsHB = cms.bool(False), + useDBweightsHE = cms.bool(False), RunZS = cms.bool(False), FrontEndFormatError = cms.bool(False), # Front End Format Error, for real data only PeakFinderAlgorithm = cms.int32(2), @@ -95,5 +98,7 @@ numberOfPresamplesHF = cms.int32(1) ) run2_HF_2017.toModify(tpScales.HF, NCTShift=cms.int32(2)) +run3_HE.toModify(simHcalTriggerPrimitiveDigis, numberOfFilterPresamplesHEQIE11=cms.int32(1)) +run3_HB.toModify(simHcalTriggerPrimitiveDigis, numberOfFilterPresamplesHBQIE11=cms.int32(1)) run3_HB.toModify(simHcalTriggerPrimitiveDigis, upgradeHB=cms.bool(True)) run3_HB.toModify(tpScales.HBHE, LSBQIE11Overlap=cms.double(1/16.)) diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc index 9091c938acfa5..e4e0a8d9e1646 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc @@ -11,6 +11,7 @@ #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CalibFormats/CaloTPG/interface/HcalTPGCompressor.h" #include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" +#include "CondFormats/HcalObjects/interface/HcalTPChannelParameters.h" #include @@ -40,12 +41,18 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) upgrade_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return a; }); legacy_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return !a; }); + useDBweightsHE_ = ps.getParameter("useDBweightsHE"); + useDBweightsHB_ = ps.getParameter("useDBweightsHB"); + + // Only if we are using DB weights for all HBHE do we skip this + if (!useDBweightsHE_ or !useDBweightsHB_) + theAlgo_.setWeightsQIE11(ps.getParameter("weightsQIE11")); + if (ps.exists("parameters")) { auto pset = ps.getUntrackedParameter("parameters"); theAlgo_.overrideParameters(pset); } theAlgo_.setUpgradeFlags(upgrades[0], upgrades[1], upgrades[2]); - theAlgo_.setWeightsQIE11(ps.getParameter("weightsQIE11")); HFEMB_ = false; if (ps.exists("LSConfig")) { @@ -61,6 +68,7 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) tok_tpgTranscoder_ = esConsumes(); tok_lutMetadata_ = esConsumes(); tok_trigTowerGeom_ = esConsumes(); + tok_caloGeom_ = esConsumes(); // register for data access if (runFrontEndFormatError_) { tok_raw_ = consumes(inputTagFEDRaw_); @@ -76,6 +84,7 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) tok_hf_up_ = consumes(inputUpgradeLabel_[1]); } tok_dbService_ = esConsumes(); + tok_dbService_beginRun_ = esConsumes(); produces(); theAlgo_.setPeakFinderAlgorithm(ps.getParameter("PeakFinderAlgorithm")); @@ -85,6 +94,51 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) theAlgo_.setRCTScaleShift(hfSS.getParameter("RCTShift")); } +void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSetup& eventSetup) { + bool useDBweights = useDBweightsHB_ or useDBweightsHE_; + + if (useDBweights) { + const CaloGeometry& geom = eventSetup.getData(tok_caloGeom_); + + std::map weightsMap; + edm::ESHandle db = eventSetup.getHandle(tok_dbService_beginRun_); + edm::ESHandle topo; + eventSetup.get().get(topo); + int lastHERing = (*topo).lastHERing(); + const HcalSubdetector subdetectors[2] = {HcalBarrel, HcalEndcap}; + + for (HcalSubdetector subd : subdetectors) { + // Skip HB or HE if we don't want to use DB weights + if ((subd == HcalBarrel and !useDBweightsHB_) or (subd == HcalEndcap and !useDBweightsHE_)) + continue; + + const HcalGeometry* hcalGeom = static_cast(geom.getSubdetectorGeometry(DetId::Hcal, subd)); + const std::vector& ids = hcalGeom->getValidDetIds(DetId::Hcal, subd); + + for (const auto cell : ids) { + const auto hcalDetId = HcalDetId(cell); + int aieta = hcalDetId.ietaAbs(); + + // Do not let ieta 29 in the map + // If the aieta already has a weight in the map, then move on + if (weightsMap.find(aieta) != weightsMap.end() or aieta >= lastHERing) + continue; + + // Filter weight represented in fixed point 8 bit + int fixedPointWeight = db->getHcalTPChannelParameter(hcalDetId)->getauxi1(); + std::cout << "|ieta|: " << aieta << " weight: " << fixedPointWeight << std::endl; + + // Weight represented as 8-bit integer + double weight = -fixedPointWeight / pow(2, 8); + + weightsMap[aieta] = weight; + } + } + + theAlgo_.setWeightsQIE11(weightsMap); + } +} + void HcalTrigPrimDigiProducer::produce(edm::Event& iEvent, const edm::EventSetup& eventSetup) { // Step A: get the conditions, for the decoding edm::ESHandle inputCoder = eventSetup.getHandle(tok_tpgCoder_); diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h index d39951a5d3bd1..e135098315627 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h @@ -18,6 +18,9 @@ #include "CondFormats/DataRecord/interface/HcalLutMetadataRcd.h" #include "Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h" #include "Geometry/Records/interface/CaloGeometryRecord.h" +#include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" +#include "Geometry/CaloGeometry/interface/CaloGeometry.h" + #include class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { @@ -26,6 +29,7 @@ class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { ~HcalTrigPrimDigiProducer() override {} /**Produces the EDM products,*/ + virtual void beginRun(const edm::Run& r, const edm::EventSetup& c); void produce(edm::Event& e, const edm::EventSetup& c) override; private: @@ -41,6 +45,9 @@ class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT tok_hbhe_; edm::EDGetTokenT tok_hf_; + bool useDBweightsHE_; + bool useDBweightsHB_; + /// input tag for FEDRawDataCollection edm::InputTag inputTagFEDRaw_; edm::EDGetTokenT tok_raw_; @@ -59,7 +66,9 @@ class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { edm::ESGetToken tok_tpgTranscoder_; edm::ESGetToken tok_lutMetadata_; edm::ESGetToken tok_trigTowerGeom_; + edm::ESGetToken tok_caloGeom_; edm::ESGetToken tok_dbService_; + edm::ESGetToken tok_dbService_beginRun_; }; #endif From f466a167e37ebcd840810b4cfc984397f977b70e Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Thu, 7 Jan 2021 10:04:36 -0600 Subject: [PATCH 02/15] simplify to have DB switch determine everything else --- .../HcalTPGEventSetup/src/HcalTPGCoderULUT.cc | 23 +++++++++++++++---- .../interface/HcalTriggerPrimitiveAlgo.h | 8 +++++++ .../python/hcaltpdigi_cff.py | 6 +++-- .../python/hcaltpdigi_cfi.py | 8 +++---- .../src/HcalTrigPrimDigiProducer.cc | 20 ++++++++++++---- .../src/HcalTrigPrimDigiProducer.h | 4 ++-- 6 files changed, 52 insertions(+), 17 deletions(-) diff --git a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc index e718140593c95..bccbac7d33074 100644 --- a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc +++ b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc @@ -60,6 +60,7 @@ class HcalTPGCoderULUT : public edm::ESProducer { bool read_FGLut_, read_Ascii_, read_XML_, LUTGenerationMode_, linearLUTs_; bool contain1TSHB_, contain1TSHE_; double containPhaseNSHB_, containPhaseNSHE_; + bool useDBweightsAndFilterHB_, useDBweightsAndFilterHE_; double linearLSB_QIE8_, linearLSB_QIE11Overlap_, linearLSB_QIE11_; int maskBit_; std::vector FG_HF_thresholds_; @@ -86,6 +87,8 @@ HcalTPGCoderULUT::HcalTPGCoderULUT(const edm::ParameterSet& iConfig) { contain1TSHE_ = iConfig.getParameter("contain1TSHE"); containPhaseNSHB_ = iConfig.getParameter("containPhaseNSHB"); containPhaseNSHE_ = iConfig.getParameter("containPhaseNSHE"); + useDBweightsAndFilterHB_ = iConfig.getParameter("useDBweightsAndFilterHB"); + useDBweightsAndFilterHE_ = iConfig.getParameter("useDBweightsAndFilterHE"); //the following line is needed to tell the framework what // data is being produced @@ -111,10 +114,22 @@ HcalTPGCoderULUT::HcalTPGCoderULUT(const edm::ParameterSet& iConfig) { void HcalTPGCoderULUT::buildCoder(const HcalTopology* topo, const HcalTimeSlew* delay, HcaluLUTTPGCoder* theCoder) { using namespace edm::es; theCoder->init(topo, delay); - theCoder->set1TSContainHB(contain1TSHB_); - theCoder->set1TSContainHE(contain1TSHE_); - theCoder->setContainPhaseHB(containPhaseNSHB_); - theCoder->setContainPhaseHE(containPhaseNSHE_); + + if (useDBweightsAndFilterHB_) { + theCoder->set1TSContainHB(true); + theCoder->setContainPhaseHB(3.0); + } else { + theCoder->set1TSContainHB(contain1TSHB_); + theCoder->setContainPhaseHB(containPhaseNSHB_); + } + + if (useDBweightsAndFilterHE_) { + theCoder->set1TSContainHE(true); + theCoder->setContainPhaseHE(3.0); + } else { + theCoder->set1TSContainHE(contain1TSHE_); + theCoder->setContainPhaseHE(containPhaseNSHE_); + } if (read_Ascii_ || read_XML_) { edm::LogInfo("HCAL") << "Using ASCII/XML LUTs" << ifilename_.fullPath() << " for HcalTPGCoderULUT initialization"; diff --git a/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h b/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h index 0b9d66a4aadec..51c137d7e4aae 100644 --- a/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h +++ b/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h @@ -82,6 +82,14 @@ class HcalTriggerPrimitiveAlgo { void setNCTScaleShift(int); void setRCTScaleShift(int); + void setNumFilterPresamplesHBQIE11(int presamples) { + numberOfFilterPresamplesHBQIE11_ = presamples; + } + + void setNumFilterPresamplesHEQIE11(int presamples) { + numberOfFilterPresamplesHEQIE11_ = presamples; + } + void setUpgradeFlags(bool hb, bool he, bool hf); void overrideParameters(const edm::ParameterSet& ps); diff --git a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py index c0981ebe6d12d..7ae9aaf3a6468 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py +++ b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py @@ -21,6 +21,8 @@ contain1TSHE = cms.bool(False), containPhaseNSHE = cms.double(-999.0), containPhaseNSHB = cms.double(-999.0), + useDBweightsAndFilterHB = cms.bool(False), + useDBweightsAndFilterHE = cms.bool(False), tpScales = tpScales, MaskBit = cms.int32(0x8000), FG_HF_thresholds = cms.vuint32(17, 255), @@ -35,5 +37,5 @@ run2_HCAL_2018.toModify(HcalTPGCoderULUT, linearLUTs=cms.bool(True)) pp_on_AA_2018.toModify(CaloTPGTranscoder, FG_HF_thresholds = cms.vuint32(15, 19)) pp_on_AA_2018.toModify(HcalTPGCoderULUT, FG_HF_thresholds = cms.vuint32(15, 19)) -run3_HB.toModify(HcalTPGCoderULUT, contain1TSHB=cms.bool(True), containPhaseNSHB=cms.double(3.0)) -run3_HE.toModify(HcalTPGCoderULUT, contain1TSHE=cms.bool(True), containPhaseNSHE=cms.double(3.0)) +run3_HB.toModify(HcalTPGCoderULUT, useDBweightsAndFilterHB=cms.bool(True)) +run3_HE.toModify(HcalTPGCoderULUT, useDBweightsAndFilterHE=cms.bool(True)) diff --git a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py index 01816fb7f0032..dbee058422e68 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py +++ b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py @@ -82,8 +82,8 @@ cms.InputTag('simHcalUnsuppressedDigis:HBHEQIE11DigiCollection'), cms.InputTag('simHcalUnsuppressedDigis:HFQIE10DigiCollection')), InputTagFEDRaw = cms.InputTag("rawDataCollector"), - useDBweightsHB = cms.bool(False), - useDBweightsHE = cms.bool(False), + useDBweightsAndFilterHB = cms.bool(False), + useDBweightsAndFilterHE = cms.bool(False), RunZS = cms.bool(False), FrontEndFormatError = cms.bool(False), # Front End Format Error, for real data only PeakFinderAlgorithm = cms.int32(2), @@ -98,7 +98,7 @@ numberOfPresamplesHF = cms.int32(1) ) run2_HF_2017.toModify(tpScales.HF, NCTShift=cms.int32(2)) -run3_HE.toModify(simHcalTriggerPrimitiveDigis, numberOfFilterPresamplesHEQIE11=cms.int32(1)) -run3_HB.toModify(simHcalTriggerPrimitiveDigis, numberOfFilterPresamplesHBQIE11=cms.int32(1)) +run3_HE.toModify(simHcalTriggerPrimitiveDigis, useDBweightsAndFilter=cms.bool(True)) +run3_HB.toModify(simHcalTriggerPrimitiveDigis, useDBweightsAndFilter=cms.bool(True)) run3_HB.toModify(simHcalTriggerPrimitiveDigis, upgradeHB=cms.bool(True)) run3_HB.toModify(tpScales.HBHE, LSBQIE11Overlap=cms.double(1/16.)) diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc index e4e0a8d9e1646..5ffa0134d4357 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc @@ -41,13 +41,23 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) upgrade_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return a; }); legacy_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return !a; }); - useDBweightsHE_ = ps.getParameter("useDBweightsHE"); - useDBweightsHB_ = ps.getParameter("useDBweightsHB"); + useDBweightsAndFilterHE_ = ps.getParameter("useDBweightsAndFilterHE"); + useDBweightsAndFilterHB_ = ps.getParameter("useDBweightsAndFilterHB"); + + bool noDBweights = !useDBweightsAndFilterHE_ or !useDBweightsAndFilterHB_; // Only if we are using DB weights for all HBHE do we skip this - if (!useDBweightsHE_ or !useDBweightsHB_) + if (noDBweights) theAlgo_.setWeightsQIE11(ps.getParameter("weightsQIE11")); + // Fix number of filter presamples to one if we are using DB weights + // Size of filter is already known when using DB weights + if (useDBweightsAndFilterHE_) + theAlgo_.setNumFilterPresamplesHEQIE11(1); + + if (useDBweightsAndFilterHB_) + theAlgo_.setNumFilterPresamplesHBQIE11(1); + if (ps.exists("parameters")) { auto pset = ps.getUntrackedParameter("parameters"); theAlgo_.overrideParameters(pset); @@ -95,7 +105,7 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) } void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSetup& eventSetup) { - bool useDBweights = useDBweightsHB_ or useDBweightsHE_; + bool useDBweights = useDBweightsAndFilterHB_ or useDBweightsAndFilterHE_; if (useDBweights) { const CaloGeometry& geom = eventSetup.getData(tok_caloGeom_); @@ -109,7 +119,7 @@ void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSet for (HcalSubdetector subd : subdetectors) { // Skip HB or HE if we don't want to use DB weights - if ((subd == HcalBarrel and !useDBweightsHB_) or (subd == HcalEndcap and !useDBweightsHE_)) + if ((subd == HcalBarrel and !useDBweightsAndFilterHB_) or (subd == HcalEndcap and !useDBweightsAndFilterHE_)) continue; const HcalGeometry* hcalGeom = static_cast(geom.getSubdetectorGeometry(DetId::Hcal, subd)); diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h index e135098315627..a36b896397c78 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h @@ -45,8 +45,8 @@ class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT tok_hbhe_; edm::EDGetTokenT tok_hf_; - bool useDBweightsHE_; - bool useDBweightsHB_; + bool useDBweightsAndFilterHE_; + bool useDBweightsAndFilterHB_; /// input tag for FEDRawDataCollection edm::InputTag inputTagFEDRaw_; From 4ec8f8d441a49857c3f10afb6b014f5a20695bcb Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Fri, 8 Jan 2021 10:29:28 -0600 Subject: [PATCH 03/15] remove printing --- .../HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc index 5ffa0134d4357..7b4fe4b9fffc1 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc @@ -136,9 +136,8 @@ void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSet // Filter weight represented in fixed point 8 bit int fixedPointWeight = db->getHcalTPChannelParameter(hcalDetId)->getauxi1(); - std::cout << "|ieta|: " << aieta << " weight: " << fixedPointWeight << std::endl; - // Weight represented as 8-bit integer + // Weight from DB represented as 8-bit integer double weight = -fixedPointWeight / pow(2, 8); weightsMap[aieta] = weight; From 1484463e6d72c28331fe1ec98a389f9729f6149d Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Mon, 11 Jan 2021 11:32:15 -0600 Subject: [PATCH 04/15] don't hardcode 3.0 will get from conditions --- CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc index bccbac7d33074..34ad8c0adc2cb 100644 --- a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc +++ b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc @@ -117,7 +117,6 @@ void HcalTPGCoderULUT::buildCoder(const HcalTopology* topo, const HcalTimeSlew* if (useDBweightsAndFilterHB_) { theCoder->set1TSContainHB(true); - theCoder->setContainPhaseHB(3.0); } else { theCoder->set1TSContainHB(contain1TSHB_); theCoder->setContainPhaseHB(containPhaseNSHB_); @@ -125,7 +124,6 @@ void HcalTPGCoderULUT::buildCoder(const HcalTopology* topo, const HcalTimeSlew* if (useDBweightsAndFilterHE_) { theCoder->set1TSContainHE(true); - theCoder->setContainPhaseHE(3.0); } else { theCoder->set1TSContainHE(contain1TSHE_); theCoder->setContainPhaseHE(containPhaseNSHE_); From 6e7ac16d5a740157002f34304d311fa3c79a7af1 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Fri, 22 Jan 2021 08:24:43 -0600 Subject: [PATCH 05/15] leave switches off for now --- SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py | 4 ++-- SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py index 7ae9aaf3a6468..963ae941e100b 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py +++ b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py @@ -37,5 +37,5 @@ run2_HCAL_2018.toModify(HcalTPGCoderULUT, linearLUTs=cms.bool(True)) pp_on_AA_2018.toModify(CaloTPGTranscoder, FG_HF_thresholds = cms.vuint32(15, 19)) pp_on_AA_2018.toModify(HcalTPGCoderULUT, FG_HF_thresholds = cms.vuint32(15, 19)) -run3_HB.toModify(HcalTPGCoderULUT, useDBweightsAndFilterHB=cms.bool(True)) -run3_HE.toModify(HcalTPGCoderULUT, useDBweightsAndFilterHE=cms.bool(True)) +run3_HB.toModify(HcalTPGCoderULUT, useDBweightsAndFilterHB=cms.bool(False)) +run3_HE.toModify(HcalTPGCoderULUT, useDBweightsAndFilterHE=cms.bool(False)) diff --git a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py index dbee058422e68..7b8cf689f55d9 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py +++ b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py @@ -98,7 +98,7 @@ numberOfPresamplesHF = cms.int32(1) ) run2_HF_2017.toModify(tpScales.HF, NCTShift=cms.int32(2)) -run3_HE.toModify(simHcalTriggerPrimitiveDigis, useDBweightsAndFilter=cms.bool(True)) -run3_HB.toModify(simHcalTriggerPrimitiveDigis, useDBweightsAndFilter=cms.bool(True)) +run3_HE.toModify(simHcalTriggerPrimitiveDigis, useDBweightsAndFilter=cms.bool(False)) +run3_HB.toModify(simHcalTriggerPrimitiveDigis, useDBweightsAndFilter=cms.bool(False)) run3_HB.toModify(simHcalTriggerPrimitiveDigis, upgradeHB=cms.bool(True)) run3_HB.toModify(tpScales.HBHE, LSBQIE11Overlap=cms.double(1/16.)) From 015fc974f0dc33379b197bace1d1f8cd890cf1e4 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Fri, 22 Jan 2021 09:09:57 -0600 Subject: [PATCH 06/15] ensure that we do division of doubles --- .../HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc index 7b4fe4b9fffc1..81bf2498b359f 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc @@ -138,7 +138,7 @@ void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSet int fixedPointWeight = db->getHcalTPChannelParameter(hcalDetId)->getauxi1(); // Weight from DB represented as 8-bit integer - double weight = -fixedPointWeight / pow(2, 8); + double weight = -static_cast(fixedPointWeight) / 256.0; weightsMap[aieta] = weight; } From 8f4d64306885bb509376016dffc4106c9d79722f Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Fri, 22 Jan 2021 09:19:27 -0600 Subject: [PATCH 07/15] clarify why we are hardcoding true here --- CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc index 34ad8c0adc2cb..e43ce2b586ff6 100644 --- a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc +++ b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc @@ -115,6 +115,7 @@ void HcalTPGCoderULUT::buildCoder(const HcalTopology* topo, const HcalTimeSlew* using namespace edm::es; theCoder->init(topo, delay); + // By using the DB, we are making a choice about specifically using a 1TS filter, so set the booleans accordingly if (useDBweightsAndFilterHB_) { theCoder->set1TSContainHB(true); } else { From 8c3dea7670f1bed3249fa7933b57223bf507b244 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Fri, 22 Jan 2021 09:28:32 -0600 Subject: [PATCH 08/15] run scram build code-format --- .../interface/HcalTriggerPrimitiveAlgo.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h b/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h index 51c137d7e4aae..b0a3dee207547 100644 --- a/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h +++ b/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h @@ -82,13 +82,9 @@ class HcalTriggerPrimitiveAlgo { void setNCTScaleShift(int); void setRCTScaleShift(int); - void setNumFilterPresamplesHBQIE11(int presamples) { - numberOfFilterPresamplesHBQIE11_ = presamples; - } + void setNumFilterPresamplesHBQIE11(int presamples) { numberOfFilterPresamplesHBQIE11_ = presamples; } - void setNumFilterPresamplesHEQIE11(int presamples) { - numberOfFilterPresamplesHEQIE11_ = presamples; - } + void setNumFilterPresamplesHEQIE11(int presamples) { numberOfFilterPresamplesHEQIE11_ = presamples; } void setUpgradeFlags(bool hb, bool he, bool hf); void overrideParameters(const edm::ParameterSet& ps); From 93979ff923d730edd9e38f4727a072e840f3e9f6 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Fri, 22 Jan 2021 11:09:12 -0600 Subject: [PATCH 09/15] set default values for two member vars --- CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h index 37442ec1a50bc..c279cce847641 100644 --- a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h +++ b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h @@ -114,7 +114,8 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { double cosh_ieta_28_HE_low_depths_, cosh_ieta_28_HE_high_depths_, cosh_ieta_29_HE_; bool allLinear_; bool contain1TSHB_, contain1TSHE_; - double containPhaseNSHB_, containPhaseNSHE_; + double containPhaseNSHB_ = -999.0; + double containPhaseNSHE_ = -999.0; double linearLSB_QIE8_, linearLSB_QIE11_, linearLSB_QIE11Overlap_; std::unique_ptr pulseCorr_; }; From 2f2cffef7269b5bc2e98e597a213b87abf1c2325 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Fri, 22 Jan 2021 13:09:54 -0600 Subject: [PATCH 10/15] run code-checks --- .../HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h index a36b896397c78..72c969268e942 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h @@ -29,7 +29,7 @@ class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { ~HcalTrigPrimDigiProducer() override {} /**Produces the EDM products,*/ - virtual void beginRun(const edm::Run& r, const edm::EventSetup& c); + void beginRun(const edm::Run& r, const edm::EventSetup& c) override; void produce(edm::Event& e, const edm::EventSetup& c) override; private: From 9e4ebb62495c4d6474ca40d1935a316f3386d0e6 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Wed, 3 Feb 2021 10:46:20 -0600 Subject: [PATCH 11/15] remove deprecated methods --- .../HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc | 7 ++++--- .../HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc index 81bf2498b359f..237e7c1b58000 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc @@ -79,6 +79,8 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) tok_lutMetadata_ = esConsumes(); tok_trigTowerGeom_ = esConsumes(); tok_caloGeom_ = esConsumes(); + tok_hcalTopo_ = esConsumes(); + // register for data access if (runFrontEndFormatError_) { tok_raw_ = consumes(inputTagFEDRaw_); @@ -112,9 +114,8 @@ void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSet std::map weightsMap; edm::ESHandle db = eventSetup.getHandle(tok_dbService_beginRun_); - edm::ESHandle topo; - eventSetup.get().get(topo); - int lastHERing = (*topo).lastHERing(); + const HcalTopology* topo = &eventSetup.getData(tok_hcalTopo_); + int lastHERing = topo->lastHERing(); const HcalSubdetector subdetectors[2] = {HcalBarrel, HcalEndcap}; for (HcalSubdetector subd : subdetectors) { diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h index 72c969268e942..dcdb137108732 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h @@ -67,6 +67,7 @@ class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { edm::ESGetToken tok_lutMetadata_; edm::ESGetToken tok_trigTowerGeom_; edm::ESGetToken tok_caloGeom_; + edm::ESGetToken tok_hcalTopo_; edm::ESGetToken tok_dbService_; edm::ESGetToken tok_dbService_beginRun_; }; From 3cd6f7259d3d5de93823f0750bd82d8e4f6d2347 Mon Sep 17 00:00:00 2001 From: Josh Hiltbrand Date: Wed, 24 Feb 2021 08:23:33 -0600 Subject: [PATCH 12/15] use emap to access TP version to determine if should use new filter scheme --- .../CaloTPG/src/CaloTPGTranscoderULUT.cc | 4 +- .../HcalTPGAlgos/interface/HcaluLUTTPGCoder.h | 12 +- .../HcalTPGAlgos/src/HcaluLUTTPGCoder.cc | 46 ++++++- .../HcalTPGEventSetup/src/HcalTPGCoderULUT.cc | 26 ++-- Geometry/CaloTopology/src/HcalTopology.cc | 7 +- .../interface/HcalTrigTowerGeometry.h | 4 +- .../interface/HcalTriggerPrimitiveAlgo.h | 2 +- .../src/HcalTriggerPrimitiveAlgo.cc | 8 +- .../python/hcaltpdigi_cff.py | 9 +- .../python/hcaltpdigi_cfi.py | 7 +- .../src/HcalTrigPrimDigiProducer.cc | 125 +++++++++++------- .../src/HcalTrigPrimDigiProducer.h | 6 +- 12 files changed, 159 insertions(+), 97 deletions(-) diff --git a/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.cc b/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.cc index f46dce7bb3771..48595c5ae9cec 100644 --- a/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.cc +++ b/CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.cc @@ -88,7 +88,7 @@ void CaloTPGTranscoderULUT::loadHCALCompress(HcalLutMetadata const& lutMetadata, } } else { for (unsigned int i = threshold; i < lutsize; ++i) - outputLUT_[index][i] = version == 0 ? linearRctLUT[i] : linearNctLUT[i]; + outputLUT_[index][i] = version == 1 ? linearNctLUT[i] : linearRctLUT[i]; } double eta_low = 0., eta_high = 0.; @@ -126,7 +126,7 @@ void CaloTPGTranscoderULUT::loadHCALCompress(HcalLutMetadata const& lutMetadata, for (unsigned int i = 0; i < lutsize; ++i) { if (outputLUT_[index][i] != tpg) { tpg = outputLUT_[index][i]; - hcaluncomp_[index][tpg] = lsb_factor_ * i / (version == 0 ? rct_factor_ : nct_factor_); + hcaluncomp_[index][tpg] = lsb_factor_ * i / (version == 1 ? nct_factor_ : rct_factor_); } } } diff --git a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h index c279cce847641..99133ebc7d479 100644 --- a/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h +++ b/CalibCalorimetry/HcalTPGAlgos/interface/HcaluLUTTPGCoder.h @@ -69,6 +69,12 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { void set1TSContainHE(bool contain1TSHE) { contain1TSHE_ = contain1TSHE; } void setContainPhaseHB(double containPhaseNSHB) { containPhaseNSHB_ = containPhaseNSHB; } void setContainPhaseHE(double containPhaseNSHE) { containPhaseNSHE_ = containPhaseNSHE; } + void setOverrideDBweightsAndFilterHB(bool overrideDBweightsAndFilterHB) { + overrideDBweightsAndFilterHB_ = overrideDBweightsAndFilterHB; + } + void setOverrideDBweightsAndFilterHE(bool overrideDBweightsAndFilterHE) { + overrideDBweightsAndFilterHE_ = overrideDBweightsAndFilterHE; + } void lookupMSB(const HBHEDataFrame& df, std::vector& msb) const; void lookupMSB(const QIE10DataFrame& df, std::vector>& msb) const; void lookupMSB(const QIE11DataFrame& df, std::vector>& msb) const; @@ -114,10 +120,12 @@ class HcaluLUTTPGCoder : public HcalTPGCoder { double cosh_ieta_28_HE_low_depths_, cosh_ieta_28_HE_high_depths_, cosh_ieta_29_HE_; bool allLinear_; bool contain1TSHB_, contain1TSHE_; - double containPhaseNSHB_ = -999.0; - double containPhaseNSHE_ = -999.0; + double containPhaseNSHB_ = 6.0; + double containPhaseNSHE_ = 6.0; double linearLSB_QIE8_, linearLSB_QIE11_, linearLSB_QIE11Overlap_; std::unique_ptr pulseCorr_; + bool overrideDBweightsAndFilterHB_ = false; + bool overrideDBweightsAndFilterHE_ = false; }; #endif diff --git a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc index b1b3a490bff48..d6aadc9312574 100644 --- a/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc +++ b/CalibCalorimetry/HcalTPGAlgos/src/HcaluLUTTPGCoder.cc @@ -337,6 +337,43 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { make_cosh_ieta_map(); + // Here we will determine if we are using new version of TPs (1TS) + // i.e. are we using a new pulse filter scheme. + const HcalElectronicsMap* emap = conditions.getHcalMapping(); + + int lastHBRing = topo_->lastHBRing(); + int lastHERing = topo_->lastHERing(); + + // First, determine if we should configure for the filter scheme + // Check the tp version to make this determination + bool foundHB = false; + bool foundHE = false; + bool newHBtp = false; + bool newHEtp = false; + std::vector vIds = emap->allElectronicsIdTrigger(); + for (std::vector::const_iterator eId = vIds.begin(); eId != vIds.end(); eId++) { + // The first HB or HE id is enough to tell whether to use new scheme in HB or HE + if (foundHB and foundHE) + break; + + HcalTrigTowerDetId hcalTTDetId(emap->lookupTrigger(*eId)); + if (hcalTTDetId.null()) + continue; + + int aieta = abs(hcalTTDetId.ieta()); + int tp_version = hcalTTDetId.version(); + + if (aieta <= lastHBRing) { + foundHB = true; + if (tp_version > 1) + newHBtp = true; + } else if (aieta > lastHBRing and aieta < lastHERing) { + foundHE = true; + if (tp_version > 1) + newHEtp = true; + } + } + for (const auto& id : metadata->getAllChannels()) { if (not(id.det() == DetId::Hcal and topo_->valid(id))) continue; @@ -419,11 +456,10 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { double correctionPhaseNS = conditions.getHcalRecoParam(cell)->correctionPhaseNS(); - // When containPhaseNS is not -999.0, and for QIE11 only, override from configuration if (qieType == QIE11) { - if (containPhaseNSHB_ != -999.0 and cell.ietaAbs() <= topo_->lastHBRing()) + if (overrideDBweightsAndFilterHB_ and cell.ietaAbs() <= lastHBRing) correctionPhaseNS = containPhaseNSHB_; - else if (containPhaseNSHE_ != -999.0 and cell.ietaAbs() > topo_->lastHBRing()) + else if (overrideDBweightsAndFilterHE_ and cell.ietaAbs() > lastHBRing) correctionPhaseNS = containPhaseNSHE_; } for (unsigned int adc = 0; adc < SIZE; ++adc) { @@ -444,8 +480,8 @@ void HcaluLUTTPGCoder::update(const HcalDbService& conditions) { pulseCorr_->correction(cell, 2, correctionPhaseNS, correctedCharge); if (qieType == QIE11) { // When contain1TS_ is set, it should still only apply for QIE11-related things - if ((contain1TSHB_ and cell.ietaAbs() <= topo_->lastHBRing()) or - (contain1TSHE_ and cell.ietaAbs() > topo_->lastHBRing())) { + if ((((contain1TSHB_ and overrideDBweightsAndFilterHB_) or newHBtp) and cell.ietaAbs() <= lastHBRing) or + (((contain1TSHE_ and overrideDBweightsAndFilterHE_) or newHEtp) and cell.ietaAbs() > lastHBRing)) { containmentCorrection = containmentCorrection1TS; } else { containmentCorrection = containmentCorrection2TSCorrected; diff --git a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc index e43ce2b586ff6..a76b0bb34cdc4 100644 --- a/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc +++ b/CalibCalorimetry/HcalTPGEventSetup/src/HcalTPGCoderULUT.cc @@ -60,7 +60,7 @@ class HcalTPGCoderULUT : public edm::ESProducer { bool read_FGLut_, read_Ascii_, read_XML_, LUTGenerationMode_, linearLUTs_; bool contain1TSHB_, contain1TSHE_; double containPhaseNSHB_, containPhaseNSHE_; - bool useDBweightsAndFilterHB_, useDBweightsAndFilterHE_; + bool overrideDBweightsAndFilterHB_, overrideDBweightsAndFilterHE_; double linearLSB_QIE8_, linearLSB_QIE11Overlap_, linearLSB_QIE11_; int maskBit_; std::vector FG_HF_thresholds_; @@ -87,8 +87,8 @@ HcalTPGCoderULUT::HcalTPGCoderULUT(const edm::ParameterSet& iConfig) { contain1TSHE_ = iConfig.getParameter("contain1TSHE"); containPhaseNSHB_ = iConfig.getParameter("containPhaseNSHB"); containPhaseNSHE_ = iConfig.getParameter("containPhaseNSHE"); - useDBweightsAndFilterHB_ = iConfig.getParameter("useDBweightsAndFilterHB"); - useDBweightsAndFilterHE_ = iConfig.getParameter("useDBweightsAndFilterHE"); + overrideDBweightsAndFilterHB_ = iConfig.getParameter("overrideDBweightsAndFilterHB"); + overrideDBweightsAndFilterHE_ = iConfig.getParameter("overrideDBweightsAndFilterHE"); //the following line is needed to tell the framework what // data is being produced @@ -115,20 +115,14 @@ void HcalTPGCoderULUT::buildCoder(const HcalTopology* topo, const HcalTimeSlew* using namespace edm::es; theCoder->init(topo, delay); - // By using the DB, we are making a choice about specifically using a 1TS filter, so set the booleans accordingly - if (useDBweightsAndFilterHB_) { - theCoder->set1TSContainHB(true); - } else { - theCoder->set1TSContainHB(contain1TSHB_); - theCoder->setContainPhaseHB(containPhaseNSHB_); - } + theCoder->setOverrideDBweightsAndFilterHB(overrideDBweightsAndFilterHB_); + theCoder->setOverrideDBweightsAndFilterHE(overrideDBweightsAndFilterHE_); - if (useDBweightsAndFilterHE_) { - theCoder->set1TSContainHE(true); - } else { - theCoder->set1TSContainHE(contain1TSHE_); - theCoder->setContainPhaseHE(containPhaseNSHE_); - } + theCoder->set1TSContainHB(contain1TSHB_); + theCoder->set1TSContainHE(contain1TSHE_); + + theCoder->setContainPhaseHB(containPhaseNSHB_); + theCoder->setContainPhaseHE(containPhaseNSHE_); if (read_Ascii_ || read_XML_) { edm::LogInfo("HCAL") << "Using ASCII/XML LUTs" << ifilename_.fullPath() << " for HcalTPGCoderULUT initialization"; diff --git a/Geometry/CaloTopology/src/HcalTopology.cc b/Geometry/CaloTopology/src/HcalTopology.cc index 6fd4317d08524..0f5cc39e845e0 100644 --- a/Geometry/CaloTopology/src/HcalTopology.cc +++ b/Geometry/CaloTopology/src/HcalTopology.cc @@ -245,7 +245,8 @@ bool HcalTopology::validHT(const HcalTrigTowerDetId& id) const { if (id.ietaAbs() > lastHBRing_ && id.ietaAbs() < firstHFRing_) return false; } - if (id.version() == 0) { + // Version 2 TPs should be for HBHE when using 1TS filter scheme + if (id.version() == 0 or id.version() == 2) { if (id.ietaAbs() > 28) { if (triggerMode_ >= HcalTopologyMode::TriggerMode_2017) return false; @@ -265,8 +266,8 @@ bool HcalTopology::validHT(const HcalTrigTowerDetId& id) const { return false; if (id.ietaAbs() > 39 && ((id.iphi() % 4) != 3)) return false; - } else if (id.version() > 1) { - // only versions 0 and 1 are supported + } else if (id.version() > 2) { + // only versions 0, 1, and 2 are supported return false; } diff --git a/Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h b/Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h index f9c7e7cd2fd93..b8b4039e6f1e5 100644 --- a/Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h +++ b/Geometry/HcalTowerAlgo/interface/HcalTrigTowerGeometry.h @@ -15,13 +15,13 @@ class HcalTrigTowerGeometry { std::vector towerIds(const HcalDetId& cellId) const; std::vector detIds(const HcalTrigTowerDetId&) const; - int firstHFTower(int version) const { return (version == 0) ? (29) : (30); } + int firstHFTower(int version) const { return (version == 1) ? (30) : (29); } /// where this tower begins and ends in eta void towerEtaBounds(int ieta, int version, double& eta1, double& eta2) const; /// number of towers (version dependent) - int nTowers(int version) const { return (version == 0) ? (32) : (41); } + int nTowers(int version) const { return (version == 1) ? (41) : (32); } // get the topology pointer const HcalTopology& topology() const { return *theTopology; } diff --git a/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h b/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h index b0a3dee207547..82dee6171edf2 100644 --- a/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h +++ b/SimCalorimetry/HcalTrigPrimAlgos/interface/HcalTriggerPrimitiveAlgo.h @@ -78,7 +78,7 @@ class HcalTriggerPrimitiveAlgo { HcalTrigPrimDigiCollection& result); void setPeakFinderAlgorithm(int algo); void setWeightsQIE11(const edm::ParameterSet& weightsQIE11); - void setWeightsQIE11(const std::map& weightsQIE11); + void setWeightQIE11(int aieta, double weight); void setNCTScaleShift(int); void setRCTScaleShift(int); diff --git a/SimCalorimetry/HcalTrigPrimAlgos/src/HcalTriggerPrimitiveAlgo.cc b/SimCalorimetry/HcalTrigPrimAlgos/src/HcalTriggerPrimitiveAlgo.cc index b2ff0239cb6b2..d37381344ebfd 100644 --- a/SimCalorimetry/HcalTrigPrimAlgos/src/HcalTriggerPrimitiveAlgo.cc +++ b/SimCalorimetry/HcalTrigPrimAlgos/src/HcalTriggerPrimitiveAlgo.cc @@ -866,12 +866,10 @@ void HcalTriggerPrimitiveAlgo::setWeightsQIE11(const edm::ParameterSet& weightsQ } } -void HcalTriggerPrimitiveAlgo::setWeightsQIE11(const std::map& weightsQIE11) { +void HcalTriggerPrimitiveAlgo::setWeightQIE11(int aieta, double weight) { // Simple map of |ieta| in HBHE to weight - for (auto& pair : weightsQIE11) { - // Only one weight for SOI-1 TS - weightsQIE11_[pair.first] = {{pair.second, 1.0}}; - } + // Only one weight for SOI-1 TS + weightsQIE11_[aieta] = {{weight, 1.0}}; } void HcalTriggerPrimitiveAlgo::setPeakFinderAlgorithm(int algo) { diff --git a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py index 87637466083cf..5d6a02561e738 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py +++ b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cff.py @@ -17,10 +17,10 @@ linearLUTs = cms.bool(False), contain1TSHB = cms.bool(False), contain1TSHE = cms.bool(False), - containPhaseNSHE = cms.double(-999.0), - containPhaseNSHB = cms.double(-999.0), - useDBweightsAndFilterHB = cms.bool(False), - useDBweightsAndFilterHE = cms.bool(False), + containPhaseNSHE = cms.double(6.0), + containPhaseNSHB = cms.double(6.0), + overrideDBweightsAndFilterHB = cms.bool(False), + overrideDBweightsAndFilterHE = cms.bool(False), tpScales = tpScales, MaskBit = cms.int32(0x8000), FG_HF_thresholds = cms.vuint32(17, 255), @@ -35,4 +35,3 @@ run2_HCAL_2018.toModify(HcalTPGCoderULUT, linearLUTs=cms.bool(True)) pp_on_AA.toModify(CaloTPGTranscoder, FG_HF_thresholds = cms.vuint32(15, 19)) pp_on_AA.toModify(HcalTPGCoderULUT, FG_HF_thresholds = cms.vuint32(15, 19)) -pp_on_AA.toModify(HcalTPGCoderULUT, useDBweightsAndFilterHB=cms.bool(False), useDBweightsAndFilterHE=cms.bool(False)) \ No newline at end of file diff --git a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py index 7b8cf689f55d9..b23674110dea7 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py +++ b/SimCalorimetry/HcalTrigPrimProducers/python/hcaltpdigi_cfi.py @@ -4,7 +4,6 @@ from Configuration.Eras.Modifier_run2_HE_2017_cff import run2_HE_2017 from Configuration.Eras.Modifier_run2_HF_2017_cff import run2_HF_2017 from Configuration.Eras.Modifier_run3_HB_cff import run3_HB -from Configuration.Eras.Modifier_run3_HE_cff import run3_HE LSParameter =cms.untracked.PSet( HcalFeatureHFEMBit= cms.bool(False), @@ -82,8 +81,8 @@ cms.InputTag('simHcalUnsuppressedDigis:HBHEQIE11DigiCollection'), cms.InputTag('simHcalUnsuppressedDigis:HFQIE10DigiCollection')), InputTagFEDRaw = cms.InputTag("rawDataCollector"), - useDBweightsAndFilterHB = cms.bool(False), - useDBweightsAndFilterHE = cms.bool(False), + overrideDBweightsAndFilterHB = cms.bool(False), + overrideDBweightsAndFilterHE = cms.bool(False), RunZS = cms.bool(False), FrontEndFormatError = cms.bool(False), # Front End Format Error, for real data only PeakFinderAlgorithm = cms.int32(2), @@ -98,7 +97,5 @@ numberOfPresamplesHF = cms.int32(1) ) run2_HF_2017.toModify(tpScales.HF, NCTShift=cms.int32(2)) -run3_HE.toModify(simHcalTriggerPrimitiveDigis, useDBweightsAndFilter=cms.bool(False)) -run3_HB.toModify(simHcalTriggerPrimitiveDigis, useDBweightsAndFilter=cms.bool(False)) run3_HB.toModify(simHcalTriggerPrimitiveDigis, upgradeHB=cms.bool(True)) run3_HB.toModify(tpScales.HBHE, LSBQIE11Overlap=cms.double(1/16.)) diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc index 237e7c1b58000..6a8f6c2cfdf38 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.cc @@ -10,7 +10,6 @@ #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "CalibFormats/CaloTPG/interface/HcalTPGCompressor.h" -#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" #include "CondFormats/HcalObjects/interface/HcalTPChannelParameters.h" #include @@ -41,22 +40,10 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) upgrade_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return a; }); legacy_ = std::any_of(std::begin(upgrades), std::end(upgrades), [](bool a) { return !a; }); - useDBweightsAndFilterHE_ = ps.getParameter("useDBweightsAndFilterHE"); - useDBweightsAndFilterHB_ = ps.getParameter("useDBweightsAndFilterHB"); + overrideDBweightsAndFilterHE_ = ps.getParameter("overrideDBweightsAndFilterHE"); + overrideDBweightsAndFilterHB_ = ps.getParameter("overrideDBweightsAndFilterHB"); - bool noDBweights = !useDBweightsAndFilterHE_ or !useDBweightsAndFilterHB_; - - // Only if we are using DB weights for all HBHE do we skip this - if (noDBweights) - theAlgo_.setWeightsQIE11(ps.getParameter("weightsQIE11")); - - // Fix number of filter presamples to one if we are using DB weights - // Size of filter is already known when using DB weights - if (useDBweightsAndFilterHE_) - theAlgo_.setNumFilterPresamplesHEQIE11(1); - - if (useDBweightsAndFilterHB_) - theAlgo_.setNumFilterPresamplesHBQIE11(1); + theAlgo_.setWeightsQIE11(ps.getParameter("weightsQIE11")); if (ps.exists("parameters")) { auto pset = ps.getUntrackedParameter("parameters"); @@ -78,7 +65,6 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) tok_tpgTranscoder_ = esConsumes(); tok_lutMetadata_ = esConsumes(); tok_trigTowerGeom_ = esConsumes(); - tok_caloGeom_ = esConsumes(); tok_hcalTopo_ = esConsumes(); // register for data access @@ -107,45 +93,88 @@ HcalTrigPrimDigiProducer::HcalTrigPrimDigiProducer(const edm::ParameterSet& ps) } void HcalTrigPrimDigiProducer::beginRun(const edm::Run& run, const edm::EventSetup& eventSetup) { - bool useDBweights = useDBweightsAndFilterHB_ or useDBweightsAndFilterHE_; - - if (useDBweights) { - const CaloGeometry& geom = eventSetup.getData(tok_caloGeom_); - - std::map weightsMap; - edm::ESHandle db = eventSetup.getHandle(tok_dbService_beginRun_); - const HcalTopology* topo = &eventSetup.getData(tok_hcalTopo_); - int lastHERing = topo->lastHERing(); - const HcalSubdetector subdetectors[2] = {HcalBarrel, HcalEndcap}; - - for (HcalSubdetector subd : subdetectors) { - // Skip HB or HE if we don't want to use DB weights - if ((subd == HcalBarrel and !useDBweightsAndFilterHB_) or (subd == HcalEndcap and !useDBweightsAndFilterHE_)) - continue; + edm::ESHandle db = eventSetup.getHandle(tok_dbService_beginRun_); + const HcalTopology* topo = &eventSetup.getData(tok_hcalTopo_); + + const HcalElectronicsMap* emap = db->getHcalMapping(); + + int lastHERing = topo->lastHERing(); + int lastHBRing = topo->lastHBRing(); + + // First, determine if we should configure for the filter scheme + // Check the tp version to make this determination + bool foundHB = false; + bool foundHE = false; + bool newHBtp = false; + bool newHEtp = false; + std::vector vIds = emap->allElectronicsIdTrigger(); + for (std::vector::const_iterator eId = vIds.begin(); eId != vIds.end(); eId++) { + // The first HB or HE id is enough to tell whether to use new scheme in HB or HE + if (foundHB and foundHE) + break; + + HcalTrigTowerDetId hcalTTDetId(emap->lookupTrigger(*eId)); + if (hcalTTDetId.null()) + continue; + + int aieta = abs(hcalTTDetId.ieta()); + int tp_version = hcalTTDetId.version(); + + if (aieta <= lastHBRing) { + foundHB = true; + if (tp_version > 1) + newHBtp = true; + } else if (aieta > lastHBRing and aieta < lastHERing) { + foundHE = true; + if (tp_version > 1) + newHEtp = true; + } + } - const HcalGeometry* hcalGeom = static_cast(geom.getSubdetectorGeometry(DetId::Hcal, subd)); - const std::vector& ids = hcalGeom->getValidDetIds(DetId::Hcal, subd); + std::vector eIds = emap->allElectronicsIdPrecision(); + for (std::vector::const_iterator eId = eIds.begin(); eId != eIds.end(); eId++) { + HcalGenericDetId gid(emap->lookup(*eId)); + if (gid.null() or (gid.genericSubdet() != HcalGenericDetId::HcalGenBarrel and + gid.genericSubdet() != HcalGenericDetId::HcalGenEndcap)) + continue; - for (const auto cell : ids) { - const auto hcalDetId = HcalDetId(cell); - int aieta = hcalDetId.ietaAbs(); + HcalDetId hcalDetId(emap->lookup(*eId)); + if (hcalDetId.null()) + continue; - // Do not let ieta 29 in the map - // If the aieta already has a weight in the map, then move on - if (weightsMap.find(aieta) != weightsMap.end() or aieta >= lastHERing) - continue; + int aieta = abs(hcalDetId.ieta()); - // Filter weight represented in fixed point 8 bit - int fixedPointWeight = db->getHcalTPChannelParameter(hcalDetId)->getauxi1(); + // Do not let ieta 29 in the map + // If the aieta already has a weight in the map, then move on + if (aieta < lastHERing) { + // Filter weight represented in fixed point 8 bit + int fixedPointWeight = db->getHcalTPChannelParameter(hcalDetId)->getauxi1(); + if (aieta <= lastHBRing) { + // Fix number of filter presamples to one if we are using DB weights + // Size of filter is already known when using DB weights // Weight from DB represented as 8-bit integer - double weight = -static_cast(fixedPointWeight) / 256.0; - - weightsMap[aieta] = weight; + if (!overrideDBweightsAndFilterHB_) { + if (newHBtp) { + theAlgo_.setNumFilterPresamplesHBQIE11(1); + theAlgo_.setWeightQIE11(aieta, -static_cast(fixedPointWeight) / 256.0); + } else { + theAlgo_.setNumFilterPresamplesHBQIE11(0); + theAlgo_.setWeightQIE11(aieta, 1.0); + } + } + } else if (aieta > lastHBRing) { + if (!overrideDBweightsAndFilterHE_) { + if (newHEtp) { + theAlgo_.setNumFilterPresamplesHEQIE11(1); + theAlgo_.setWeightQIE11(aieta, -static_cast(fixedPointWeight) / 256.0); + } else { + theAlgo_.setNumFilterPresamplesHEQIE11(0); + theAlgo_.setWeightQIE11(aieta, 1.0); + } + } } } - - theAlgo_.setWeightsQIE11(weightsMap); } } diff --git a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h index dcdb137108732..814aaea4ff824 100644 --- a/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h +++ b/SimCalorimetry/HcalTrigPrimProducers/src/HcalTrigPrimDigiProducer.h @@ -20,6 +20,7 @@ #include "Geometry/Records/interface/CaloGeometryRecord.h" #include "Geometry/HcalTowerAlgo/interface/HcalGeometry.h" #include "Geometry/CaloGeometry/interface/CaloGeometry.h" +#include "CondFormats/HcalObjects/interface/HcalElectronicsMap.h" #include @@ -45,8 +46,8 @@ class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { edm::EDGetTokenT tok_hbhe_; edm::EDGetTokenT tok_hf_; - bool useDBweightsAndFilterHE_; - bool useDBweightsAndFilterHB_; + bool overrideDBweightsAndFilterHE_; + bool overrideDBweightsAndFilterHB_; /// input tag for FEDRawDataCollection edm::InputTag inputTagFEDRaw_; @@ -66,7 +67,6 @@ class HcalTrigPrimDigiProducer : public edm::stream::EDProducer<> { edm::ESGetToken tok_tpgTranscoder_; edm::ESGetToken tok_lutMetadata_; edm::ESGetToken tok_trigTowerGeom_; - edm::ESGetToken tok_caloGeom_; edm::ESGetToken tok_hcalTopo_; edm::ESGetToken tok_dbService_; edm::ESGetToken tok_dbService_beginRun_; From 0db4333aea30ea5283f3cbb60a85b224ddea6711 Mon Sep 17 00:00:00 2001 From: Joshua Hiltbrand Date: Mon, 15 Mar 2021 06:05:19 -0500 Subject: [PATCH 13/15] Update to remove run3_HE modifier (no longer used) --- Configuration/StandardSequences/python/Eras.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/StandardSequences/python/Eras.py b/Configuration/StandardSequences/python/Eras.py index d9de4b115ff55..16ccc8c392161 100644 --- a/Configuration/StandardSequences/python/Eras.py +++ b/Configuration/StandardSequences/python/Eras.py @@ -53,7 +53,7 @@ def __init__(self): 'peripheralPbPb', 'pA_2016', 'run2_HE_2017', 'stage2L1Trigger', 'stage2L1Trigger_2017', 'stage2L1Trigger_2018', 'stage2L1Trigger_2021', 'run2_HF_2017', 'run2_HCAL_2017', 'run2_HEPlan1_2017', 'run2_HB_2018','run2_HE_2018', - 'run3_HB', 'run3_HE', 'run3_common', 'run3_RPC', + 'run3_HB', 'run3_common', 'run3_RPC', 'phase1Pixel', 'run3_GEM', 'run2_GEM_2017', 'run2_CSC_2018', 'phase2_common', 'phase2_tracker', From 2544fd3aef4172a2c8031ec699a465e10cfcedf8 Mon Sep 17 00:00:00 2001 From: Joshua Hiltbrand Date: Mon, 15 Mar 2021 06:05:25 -0500 Subject: [PATCH 14/15] Update to remove run3_HE modifier (no longer used) --- Configuration/Eras/python/Era_Run3_cff.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Configuration/Eras/python/Era_Run3_cff.py b/Configuration/Eras/python/Era_Run3_cff.py index c5ccf16d3aac4..73b7ca8cd89d2 100644 --- a/Configuration/Eras/python/Era_Run3_cff.py +++ b/Configuration/Eras/python/Era_Run3_cff.py @@ -4,11 +4,10 @@ from Configuration.Eras.Modifier_run3_common_cff import run3_common from Configuration.Eras.Modifier_run3_GEM_cff import run3_GEM from Configuration.Eras.Modifier_run3_HB_cff import run3_HB -from Configuration.Eras.Modifier_run3_HE_cff import run3_HE from Configuration.Eras.Modifier_run2_GEM_2017_cff import run2_GEM_2017 from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021 from Configuration.Eras.Modifier_ctpps_2018_cff import ctpps_2018 from Configuration.Eras.Modifier_ctpps_2021_cff import ctpps_2021 -Run3 = cms.ModifierChain(Run2_2018.copyAndExclude([run2_GEM_2017, ctpps_2018]), run3_common, run3_GEM, run3_HB, run3_HE, stage2L1Trigger_2021, ctpps_2021) +Run3 = cms.ModifierChain(Run2_2018.copyAndExclude([run2_GEM_2017, ctpps_2018]), run3_common, run3_GEM, run3_HB, stage2L1Trigger_2021, ctpps_2021) From 238ab46f1addd50102466e0b720c1e08b57347f7 Mon Sep 17 00:00:00 2001 From: Joshua Hiltbrand Date: Mon, 15 Mar 2021 06:05:56 -0500 Subject: [PATCH 15/15] Update to remove run3_HE modifier (no longer used) --- Configuration/Eras/python/Modifier_run3_HE_cff.py | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 Configuration/Eras/python/Modifier_run3_HE_cff.py diff --git a/Configuration/Eras/python/Modifier_run3_HE_cff.py b/Configuration/Eras/python/Modifier_run3_HE_cff.py deleted file mode 100644 index bc688b4edd631..0000000000000 --- a/Configuration/Eras/python/Modifier_run3_HE_cff.py +++ /dev/null @@ -1,6 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -# This modifier is for HE-specific changes for sim, reco, etc. - -run3_HE = cms.Modifier() -