diff --git a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py
index 60ecd09644f95..4637ecbceea04 100644
--- a/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py
+++ b/DQM/Integration/python/clients/hcal_dqm_sourceclient-live_cfg.py
@@ -110,12 +110,9 @@
ZS_threshold = 0
)
-#inserting zdc emulator after tp digis
-process.etSumZdcProducer = cms.EDProducer('L1TZDCProducer',
- hcalTPDigis = cms.InputTag("emulTPDigis"),
- bxFirst = cms.int32(-2),
- bxLast = cms.int32(3)
-)
+# Emulation of L1T ZDC EtSums based on HCAL trigger primitives
+from L1Trigger.L1TZDC.l1tZDCEtSums_cfi import l1tZDCEtSums as _l1tZDCEtSums
+process.etSumZdcProducer = _l1tZDCEtSums.clone(hcalTPDigis = "emulTPDigis")
process.hcalDigis.InputLabel = rawTag
process.emulTPDigisNoTDCCut = process.emulTPDigis.clone(
diff --git a/L1Trigger/L1TCalorimeter/plugins/BuildFile.xml b/L1Trigger/L1TCalorimeter/plugins/BuildFile.xml
index 1af052ed69c0e..9683c695ceec5 100644
--- a/L1Trigger/L1TCalorimeter/plugins/BuildFile.xml
+++ b/L1Trigger/L1TCalorimeter/plugins/BuildFile.xml
@@ -1,4 +1,5 @@
+
diff --git a/L1Trigger/L1TCalorimeter/plugins/L1TEtSumsPrinter.cc b/L1Trigger/L1TCalorimeter/plugins/L1TEtSumsPrinter.cc
new file mode 100644
index 0000000000000..6279bc3ef0d97
--- /dev/null
+++ b/L1Trigger/L1TCalorimeter/plugins/L1TEtSumsPrinter.cc
@@ -0,0 +1,59 @@
+#include "FWCore/Framework/interface/global/EDAnalyzer.h"
+#include "FWCore/Framework/interface/Event.h"
+#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
+#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
+#include "FWCore/Utilities/interface/EDGetToken.h"
+#include "FWCore/Utilities/interface/InputTag.h"
+#include "FWCore/MessageLogger/interface/MessageLogger.h"
+
+#include "DataFormats/L1Trigger/interface/EtSum.h"
+
+#include
+#include
+
+class L1TEtSumsPrinter : public edm::global::EDAnalyzer<> {
+public:
+ explicit L1TEtSumsPrinter(const edm::ParameterSet&);
+
+ static void fillDescriptions(edm::ConfigurationDescriptions&);
+
+private:
+ void analyze(edm::StreamID, edm::Event const&, edm::EventSetup const&) const override;
+
+ edm::EDGetTokenT const srcToken_;
+ std::unordered_set const etSumTypes_;
+};
+
+L1TEtSumsPrinter::L1TEtSumsPrinter(const edm::ParameterSet& iConfig)
+ : srcToken_{consumes(iConfig.getParameter("src"))}, etSumTypes_{[](std::vector const& vInts) {
+ return std::unordered_set{vInts.begin(), vInts.end()};
+ }(iConfig.getParameter>("etSumTypes"))} {}
+
+void L1TEtSumsPrinter::analyze(edm::StreamID, edm::Event const& iEvent, edm::EventSetup const&) const {
+ auto const& etSums = iEvent.get(srcToken_);
+ auto const& moduleLabel = moduleDescription().moduleLabel();
+ for (int ibx = etSums.getFirstBX(); ibx <= etSums.getLastBX(); ++ibx) {
+ auto const size = etSums.size(ibx);
+ for (uint idx = 0; idx < size; ++idx) {
+ auto const& etSum = etSums.at(ibx, idx);
+ if ((not etSumTypes_.empty()) and etSumTypes_.find(etSum.getType()) == etSumTypes_.end()) {
+ continue;
+ }
+
+ edm::LogPrint("L1TEtSumsPrinter") << "[" << moduleLabel << "] etSums[" << ibx << "][" << idx
+ << "] (type, hwPt) = (" << etSum.getType() << ", " << etSum.hwPt() << ")";
+ }
+ }
+}
+
+void L1TEtSumsPrinter::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
+ edm::ParameterSetDescription desc;
+ desc.add("src", edm::InputTag("gtStage2Digis:EtSum"))
+ ->setComment("Input collection of type l1t::EtSumBxCollection");
+ desc.add>("etSumTypes", {})
+ ->setComment("If not empty, only the specified l1t::EtSumType values are considered");
+ descriptions.add("l1tEtSumsPrinter", desc);
+}
+
+#include "FWCore/Framework/interface/MakerMacros.h"
+DEFINE_FWK_MODULE(L1TEtSumsPrinter);
diff --git a/L1Trigger/L1TZDC/README.md b/L1Trigger/L1TZDC/README.md
deleted file mode 100644
index 775fee4844407..0000000000000
--- a/L1Trigger/L1TZDC/README.md
+++ /dev/null
@@ -1,112 +0,0 @@
-Below README for testing prior to CMSSW integration
-
-
-***** COMMON FIXES ON FAIL (Skip to below for build instructions) *****
-
-If you see output like the following
-```
------ Begin Fatal Exception 18-Aug-2023 22:34:50 CEST-----------------------
-An exception of category 'ProductNotFound' occurred while
- [0] Processing Event run: 326295 lumi: 4 event: 32601 stream: 0
- [1] Running path 'zdcEtSum'
- [2] Calling method for module L1TZDCProducer/'zdcEtSumProducer'
-Exception Message:
-Principal::getByToken: Found zero products matching all criteria
-Looking for type: HcalDataFrameContainer
-Looking for module label: hcalDigis
-Looking for productInstanceName: ZDC
-Looking for process: reRECO
- Additional Info:
- [a] If you wish to continue processing events after a ProductNotFound exception,
-add "SkipEvent = cms.untracked.vstring('ProductNotFound')" to the "options" PSet in the configuration.
-
------ End Fatal Exception -------------------------------------------------
-```
-
-The issue is almost certainly the inclusion of "reRECO" as a third argument for the zdcDigis input tag to zDCEtSumProducer (CM note: putting this at the top as I have forgotten this issue twice now)
-
-***********************************************************************
-
-
-Basic build instructions, integratable into Molly's L1Emulator instructions with the Run 3 HI menu using CMSSW_13_1_0_pre4 Found here: \
-https://github.com/mitaylor/L1StudiesFramework/tree/main/RunPbPbL1Ntuples
-
-To build, do
-```
-cmsrel CMSSW_13_1_0_pre4
-cd CMSSW_13_1_0_pre4/src
-cmsenv
-git cms-init
-#Insert zdcL1T_v0.0.X
-git remote add cfmcginn https://github.com/cfmcginn/cmssw.git
-git fetch cfmcginn zdcL1TOnCMSSW_13_1_0_pre4
-git cms-merge-topic -u cfmcginn:zdcL1T_latest
-#Note we will do the next line using https instead of Molly's ssh instructions
-#git remote add cms-l1t-offline git@github.com:cms-l1t-offline/cmssw.git
-git remote add cms-l1t-offline https://github.com/cms-l1t-offline/cmssw.git
-git fetch cms-l1t-offline l1t-integration-CMSSW_13_1_0_pre4
-git cms-merge-topic -u cms-l1t-offline:l1t-integration-v161
-git clone https://github.com/cms-l1t-offline/L1Trigger-L1TCalorimeter.git L1Trigger/L1TCalorimeter/data
-svn export https://github.com/boundino/HltL1Run2021.git/trunk/L1/ADC
-
-git cms-checkdeps -A -a
-
-scram b -j 8
-
-wget https://raw.githubusercontent.com/ginnocen/UPCopenHFanalysis/main/zdc_calibration/newZDCAnalyzer/test/files_327524.txt
-mv files_327524.txt L1Trigger/L1TZDC/test/
-```
-
-To test, do
-```
-cd L1Trigger/L1TZDC/test
-cmsRun l1ZDCProducerTest.py
-```
-
-Continuing, but now explicitly using Molly's build instructions directly (Step 2)
-
-```
-git cms-addpkg L1Trigger/L1TCommon
-git cms-addpkg L1Trigger/L1TGlobal
-mkdir -p L1Trigger/L1TGlobal/data/Luminosity/startup/
-cd L1Trigger/L1TGlobal/data/Luminosity/startup/
-wget https://raw.githubusercontent.com/mitaylor/HIMenus/main/Menus/L1Menu_CollisionsHeavyIons2023_v0_0_1.xml
-cd ../../../../../
-scram b -j 8
-```
-On a good build we need to edit customiseUtils.py per Molly's instructions:
-
-emacs -nw L1Trigger/Configuration/python/customiseUtils.py
-
-process.TriggerMenu.L1TriggerMenuFile = cms.string('L1Menu_Collisions2022_v1_2_0.xml') → process.TriggerMenu.L1TriggerMenuFile = cms.string('L1Menu_CollisionsHeavyIons2023_v0_0_1.xml')
-
-Create the python by grabbing Molly's runCmsDriver for 2018 data
-```
-wget https://raw.githubusercontent.com/mitaylor/L1StudiesFramework/main/RunPbPbL1Ntuples/runCmsDriver_2018Data.sh
-bash runCmsDriver_2018Data.sh
-```
-
-We need to modify the output, l1Ntuple_2018Data.py
-Towards the end add this block, but before the line
-
-"MassReplaceInputTag(process, new="rawDataMapperByLabel", old="rawDataCollector")"
-****************************
-```
-process.l1UpgradeTree.sumZDCToken = cms.untracked.InputTag("zdcEtSumProducer")
-
-process.l1UpgradeEmuTree.sumZDCToken = cms.untracked.InputTag("zdcEtSumProducer")
-
-process.zdcEtSumProducer = cms.EDProducer('L1TZDCProducer',
- zdcDigis = cms.InputTag("hcalDigis", "ZDC")
-)
-
-process.zdcEtSum = cms.Path(process.zdcEtSumProducer)
-process.schedule.append(process.zdcEtSum)
-
-#ABOVE CODE BEFORE THIS LINE
-MassReplaceInputTag(process, new="rawDataMapperByLabel", old="rawDataCollector")
-```
-****************************
-
-
-This should run out of the box - if it does not please contact me (cfmcginn) or ginnocen @ github
diff --git a/L1Trigger/L1TZDC/plugins/BuildFile.xml b/L1Trigger/L1TZDC/plugins/BuildFile.xml
index be33fe576c701..9fc4b7986ec97 100644
--- a/L1Trigger/L1TZDC/plugins/BuildFile.xml
+++ b/L1Trigger/L1TZDC/plugins/BuildFile.xml
@@ -1,13 +1,11 @@
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/L1Trigger/L1TZDC/plugins/L1TZDCAnalyzer.cc b/L1Trigger/L1TZDC/plugins/L1TZDCEtSumsAnalyzer.cc
similarity index 75%
rename from L1Trigger/L1TZDC/plugins/L1TZDCAnalyzer.cc
rename to L1Trigger/L1TZDC/plugins/L1TZDCEtSumsAnalyzer.cc
index 43c061535401b..819587818e550 100644
--- a/L1Trigger/L1TZDC/plugins/L1TZDCAnalyzer.cc
+++ b/L1Trigger/L1TZDC/plugins/L1TZDCEtSumsAnalyzer.cc
@@ -2,25 +2,16 @@
//Modified by Chris McGinn to instead work for just ZDC etSums
//Contact at christopher.mc.ginn@cern.ch or cfmcginn @ github for bugs
-#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/MakerMacros.h"
-#include "FWCore/Framework/interface/one/EDAnalyzer.h"
-
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
-
-#include "FWCore/ServiceRegistry/interface/Service.h"
#include "CommonTools/UtilAlgos/interface/TFileService.h"
-#include "CondFormats/L1TObjects/interface/CaloParams.h"
-#include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h"
-
-#include "DataFormats/L1TCalorimeter/interface/CaloTower.h"
-#include "DataFormats/L1TCalorimeter/interface/CaloCluster.h"
-#include "DataFormats/L1Trigger/interface/EGamma.h"
-#include "DataFormats/L1Trigger/interface/Tau.h"
-#include "DataFormats/L1Trigger/interface/Jet.h"
#include "DataFormats/L1Trigger/interface/EtSum.h"
+#include "FWCore/Framework/interface/Event.h"
+#include "FWCore/Framework/interface/one/EDAnalyzer.h"
+#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
+#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
+#include "FWCore/ServiceRegistry/interface/Service.h"
+
//For the output
#include "TTree.h"
//string for some branch handling
@@ -32,10 +23,10 @@
namespace l1t {
- class L1TZDCAnalyzer : public edm::one::EDAnalyzer {
+ class L1TZDCEtSumsAnalyzer : public edm::one::EDAnalyzer {
public:
- explicit L1TZDCAnalyzer(const edm::ParameterSet&);
- ~L1TZDCAnalyzer() override = default;
+ explicit L1TZDCEtSumsAnalyzer(const edm::ParameterSet&);
+ ~L1TZDCEtSumsAnalyzer() override = default;
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
@@ -73,7 +64,7 @@ namespace l1t {
//
// constructors and destructor
//
- L1TZDCAnalyzer::L1TZDCAnalyzer(const edm::ParameterSet& iConfig)
+ L1TZDCEtSumsAnalyzer::L1TZDCEtSumsAnalyzer(const edm::ParameterSet& iConfig)
: doHistos_(iConfig.getUntrackedParameter("doHistos", true)) {
usesResource(TFileService::kSharedResource);
//now do what ever initialization is needed
@@ -84,7 +75,7 @@ namespace l1t {
edm::InputTag sumTag = iConfig.getParameter("etSumTag");
sumToken_ = consumes(sumTag);
- edm::LogInfo("L1TZDCAnalyzer") << "Processing " << sumTag.label() << std::endl;
+ edm::LogInfo("L1TZDCEtSumsAnalyzer") << "Processing " << sumTag.label() << std::endl;
}
//
@@ -92,7 +83,7 @@ namespace l1t {
//
// ------------ method called for each event ------------
- void L1TZDCAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
+ void L1TZDCEtSumsAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
using namespace edm;
// Handle sums;
@@ -114,26 +105,25 @@ namespace l1t {
}
// ------------ method called once each job just before starting event loop ------------
- void L1TZDCAnalyzer::beginJob() {
+ void L1TZDCEtSumsAnalyzer::beginJob() {
etSumZdcTree_ = fs_->make("etSumZdcTree", "");
etSumZdcTree_->Branch("etSumZdcP", etSumZdcP_, ("etSumZdcP[" + std::to_string(maxBPX_) + "]/F").c_str());
etSumZdcTree_->Branch("etSumZdcM", etSumZdcM_, ("etSumZdcM[" + std::to_string(maxBPX_) + "]/F").c_str());
}
// ------------ method called once each job just after ending the event loop ------------
- void L1TZDCAnalyzer::endJob() {}
+ void L1TZDCEtSumsAnalyzer::endJob() {}
// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
- void L1TZDCAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
+ void L1TZDCEtSumsAnalyzer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
edm::ParameterSetDescription desc;
-
desc.add("etSumTag", edm::InputTag("l1tZDCEtSums", ""));
- descriptions.add("l1tZDCAnalyzer", desc);
+ descriptions.add("l1tZDCEtSumsAnalyzer", desc);
}
} // namespace l1t
using namespace l1t;
-//define this as a plug-in
-DEFINE_FWK_MODULE(L1TZDCAnalyzer);
+#include "FWCore/Framework/interface/MakerMacros.h"
+DEFINE_FWK_MODULE(L1TZDCEtSumsAnalyzer);
diff --git a/L1Trigger/L1TZDC/plugins/L1TZDCEtSumsProducer.cc b/L1Trigger/L1TZDC/plugins/L1TZDCEtSumsProducer.cc
new file mode 100644
index 0000000000000..379c0492548cc
--- /dev/null
+++ b/L1Trigger/L1TZDC/plugins/L1TZDCEtSumsProducer.cc
@@ -0,0 +1,163 @@
+//
+// L1TZDCEtSumsProducer
+// EDProducer to compute the ZDC l1t::EtSums from HCAL trigger primitives
+//
+// Original author: Chris McGinn
+// Contact: christopher.mc.ginn@cern.ch or
+// cfmcginn on github for bugs/issues
+//
+#include
+#include
+#include
+#include
+
+#include "DataFormats/L1Trigger/interface/EtSum.h"
+#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
+
+#include "FWCore/Framework/interface/EventSetup.h"
+#include "FWCore/Framework/interface/global/EDProducer.h"
+#include "FWCore/Framework/interface/Event.h"
+#include "FWCore/MessageLogger/interface/MessageLogger.h"
+#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
+#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
+#include "FWCore/Utilities/interface/EDGetToken.h"
+#include "FWCore/Utilities/interface/InputTag.h"
+
+#include "L1Trigger/L1TCalorimeter/interface/CaloTools.h"
+
+class L1TZDCEtSumsProducer : public edm::global::EDProducer<> {
+public:
+ explicit L1TZDCEtSumsProducer(edm::ParameterSet const&);
+
+ static void fillDescriptions(edm::ConfigurationDescriptions&);
+
+private:
+ void produce(edm::StreamID, edm::Event&, edm::EventSetup const&) const override;
+
+ edm::EDGetTokenT const hcalTPDigisToken_;
+
+ int const bxFirst_;
+ int const bxLast_;
+
+ static constexpr int kZDCAbsIEta = 42;
+ static constexpr int kZDCiEtSumsIPhi = 99;
+ static constexpr int kZDCiEtSumMaxValue = 1023;
+};
+
+L1TZDCEtSumsProducer::L1TZDCEtSumsProducer(edm::ParameterSet const& ps)
+ : hcalTPDigisToken_{consumes(ps.getParameter("hcalTPDigis"))},
+ bxFirst_{ps.getParameter("bxFirst")},
+ bxLast_{ps.getParameter("bxLast")} {
+ produces();
+}
+
+void L1TZDCEtSumsProducer::produce(edm::StreamID, edm::Event& iEvent, edm::EventSetup const&) const {
+ auto outZDCEtSums = std::make_unique(0, bxFirst_, bxLast_);
+
+ auto const hcalTPs = iEvent.getHandle(hcalTPDigisToken_);
+
+ if (not hcalTPs.isValid()) {
+ edm::LogWarning("L1TZDCEtSumsProducer") << "Invalid handle to HcalTrigPrimDigiCollection collection"
+ << ": returning empty l1t::EtSumBxCollection for ZDC EtSums !";
+ } else if (bxFirst_ > bxLast_) {
+ edm::LogWarning("L1TZDCEtSumsProducer")
+ << "Invalid configuration parameters (bxFirst [" << bxFirst_ << "] > bxLast [" << bxLast_
+ << "]): returning empty l1t::EtSumBxCollection for ZDC EtSums !";
+ } else {
+ // number of bunch crossings
+ unsigned int const nBXs = (bxLast_ - bxFirst_) + 1;
+
+ // iEtSums as taken directly from the ZDC iEtSum TPs (iphi == 99)
+ std::vector> iEtSumsFromEtSumTPs{nBXs, {{0, 0}}};
+
+ // iEtSums recomputed from the ZDC non-iEtSums TPs (iphi != 99)
+ std::vector> iEtSumsFromOtherTPs{nBXs, {{0, 0}}};
+
+ // unsigned integers indicating which iEtSums are available for a given BX
+ // - Bit #1 (0b01): iEtSums as taken directly from the ZDC iEtSum TPs
+ // - Bit #2 (0b10): iEtSums recomputed from the ZDC non-iEtSums TPs
+ std::vector> iEtSumsFillFlags{nBXs, {{0, 0}}};
+
+ for (auto const& hcalTp : *hcalTPs) {
+ // absIEta position 42 is used for the ZDC (-42 for ZDCM, +42 for ZDCP)
+ auto const ieta = hcalTp.id().ieta();
+ auto const absIEta = std::abs(ieta);
+
+ if (absIEta != kZDCAbsIEta) {
+ continue;
+ }
+
+ // ZDC "index": 0 for ZDCM, 1 for ZDCP
+ auto const zdcIndex = (ieta < 0) ? 0 : 1;
+
+ // For ZDC, iphi position 99 is used for iEtSum TPs
+ auto const iphi = hcalTp.id().iphi();
+ auto const isZDCiEtSum = (iphi == kZDCiEtSumsIPhi);
+
+ // Number of samples, and number of presamples (nPresamples is BX=0)
+ int const nSamples = hcalTp.size();
+ int const nPresamples = hcalTp.presamples();
+
+ for (auto iSample = 0; iSample < nSamples; ++iSample) {
+ auto const ibx = iSample - nPresamples;
+ if (ibx >= bxFirst_ and ibx <= bxLast_) {
+ auto const& hcalTpSample = hcalTp.sample(iSample);
+ auto const ietIn = hcalTpSample.raw() & kZDCiEtSumMaxValue;
+ auto const bxIndex = ibx - bxFirst_;
+ if (isZDCiEtSum) {
+ iEtSumsFromEtSumTPs[bxIndex][zdcIndex] = ietIn;
+ iEtSumsFillFlags[bxIndex][zdcIndex] |= 0b01;
+ } else {
+ iEtSumsFromOtherTPs[bxIndex][zdcIndex] += ietIn;
+ iEtSumsFillFlags[bxIndex][zdcIndex] |= 0b10;
+ }
+ }
+ }
+ }
+
+ for (unsigned int bxIndex = 0; bxIndex < nBXs; ++bxIndex) {
+ int const bx = bxIndex + bxFirst_;
+ for (unsigned int zdcIndex = 0; zdcIndex < 2; ++zdcIndex) {
+ int zdc_hwPt{0};
+ // Option #1: take iEtSum from the ZDC iEtSum TP
+ if (iEtSumsFillFlags[bxIndex][zdcIndex] & 0b01) {
+ zdc_hwPt = iEtSumsFromEtSumTPs[bxIndex][zdcIndex];
+ }
+ // Option #2: take iEtSum recomputed from the ZDC non-iEtSums TPs
+ else if (iEtSumsFillFlags[bxIndex][zdcIndex] & 0b10) {
+ // recomputed sum cannot be higher than kZDCiEtSumMaxValue
+ zdc_hwPt = std::min(iEtSumsFromOtherTPs[bxIndex][zdcIndex], kZDCiEtSumMaxValue);
+ }
+ // Skip if no iEtSum value is available for this BX
+ else {
+ continue;
+ }
+
+ int const zdc_hwEta = (zdcIndex == 0) ? -1 : 1;
+
+ auto const zdc_type = (zdcIndex == 0) ? l1t::EtSum::EtSumType::kZDCM : l1t::EtSum::EtSumType::kZDCP;
+
+ l1t::EtSum zdc_etSum{};
+ zdc_etSum.setHwPt(zdc_hwPt);
+ zdc_etSum.setHwEta(zdc_hwEta);
+ zdc_etSum.setHwPhi(0);
+ zdc_etSum.setType(zdc_type);
+
+ outZDCEtSums->push_back(bx, l1t::CaloTools::etSumP4Demux(zdc_etSum));
+ }
+ }
+ }
+
+ iEvent.put(std::move(outZDCEtSums));
+}
+
+void L1TZDCEtSumsProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
+ edm::ParameterSetDescription desc;
+ desc.add("hcalTPDigis", edm::InputTag("simHcalTriggerPrimitiveDigis"));
+ desc.add("bxFirst", -2);
+ desc.add("bxLast", 2);
+ descriptions.add("l1tZDCEtSumsProducer", desc);
+}
+
+#include "FWCore/Framework/interface/MakerMacros.h"
+DEFINE_FWK_MODULE(L1TZDCEtSumsProducer);
diff --git a/L1Trigger/L1TZDC/plugins/L1TZDCProducer.cc b/L1Trigger/L1TZDC/plugins/L1TZDCProducer.cc
deleted file mode 100644
index 26269f948873a..0000000000000
--- a/L1Trigger/L1TZDC/plugins/L1TZDCProducer.cc
+++ /dev/null
@@ -1,168 +0,0 @@
-// -*- C++ -*-
-//
-// Package: L1Trigger/L1TZDC
-// Class: L1TZDC
-//
-/**\class L1TZDC L1TZDCProducer.cc L1Trigger/L1TZDC/plugins/L1TZDCProducer.cc
-
- Description: ZDC Producer for L1 Trigger emulation
-
- Implementation:
- Modified from v1 L1TZDCProducer (v1 under L1Trigger/L1TZDC/test) to work w/ hcalTps w/ ZDC included at abs(ieta) 42 - effectively a pass through
- ZDC EtSums found at iphi 99
-*/
-//
-// Modded from L1TZDCProducer by: Chris McGinn
-// Modifications Made: Wed, 26 Sep 2023
-// Contact: christopher.mc.ginn@cern.ch or
-// cfmcginn on github for bugs/issues
-//
-#include
-#include
-// user include files
-
-#include "FWCore/Framework/interface/EventSetup.h"
-#include "FWCore/Framework/interface/Frameworkfwd.h"
-#include "FWCore/Framework/interface/stream/EDProducer.h"
-#include "FWCore/Framework/interface/ESHandle.h"
-#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/MakerMacros.h"
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
-#include "FWCore/Utilities/interface/EDGetToken.h"
-#include "FWCore/Utilities/interface/EDPutToken.h"
-#include "FWCore/Utilities/interface/InputTag.h"
-#include "FWCore/Utilities/interface/ESGetToken.h"
-#include "FWCore/MessageLogger/interface/MessageLogger.h"
-
-#include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2FirmwareFactory.h"
-#include "L1Trigger/L1TCalorimeter/interface/Stage2MainProcessor.h"
-#include "L1Trigger/L1TCalorimeter/interface/CaloTools.h"
-
-#include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
-#include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h"
-#include "CondFormats/DataRecord/interface/L1TCaloParamsO2ORcd.h"
-
-#include "DataFormats/L1TCalorimeter/interface/CaloTower.h"
-#include "DataFormats/L1Trigger/interface/EGamma.h"
-#include "DataFormats/L1Trigger/interface/Tau.h"
-#include "DataFormats/L1Trigger/interface/Jet.h"
-#include "DataFormats/L1Trigger/interface/EtSum.h"
-
-#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
-
-//
-// class declaration
-//
-
-using namespace l1t;
-
-class L1TZDCProducer : public edm::stream::EDProducer<> {
-public:
- explicit L1TZDCProducer(const edm::ParameterSet& ps);
- ~L1TZDCProducer() override = default;
-
- static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
-
-private:
- void produce(edm::Event&, const edm::EventSetup&) override;
-
- // ----------member data ---------------------------
-
- // input tokens
- //Add the hcalTP token
- edm::EDGetTokenT hcalTPSource;
-
- //input ints
- int bxFirst_;
- int bxLast_;
-
- // put tokens
- edm::EDPutTokenT etToken_;
-};
-
-L1TZDCProducer::L1TZDCProducer(const edm::ParameterSet& ps)
- : hcalTPSource(consumes(ps.getParameter("hcalTPDigis"))) {
- // register what you produce
- etToken_ = produces();
-
- bxFirst_ = ps.getParameter("bxFirst");
- bxLast_ = ps.getParameter("bxLast");
-}
-
-// ------------ method called to produce the data ------------
-void L1TZDCProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
- using namespace edm;
- using namespace l1t;
-
- LogDebug("L1TZDCProducer") << "L1TZDCProducer::produce function called..." << std::endl;
-
- // reduced collection to be emplaced in output
- EtSumBxCollection etsumsReduced(0, bxFirst_, bxLast_);
-
- edm::Handle hcalTPs;
- iEvent.getByToken(hcalTPSource, hcalTPs);
-
- //Check if the hcal tokens are valid
- if (hcalTPs.isValid()) {
- //If valid, process
- for (const auto& hcalTp : *hcalTPs) {
- int ieta = hcalTp.id().ieta();
- uint32_t absIEta = std::abs(ieta);
-
- //absIEta position 42 is used for the ZDC; -42 for ZDCM, +42 for ZDCP
- if (absIEta != 42)
- continue;
-
- int iphi = hcalTp.id().iphi();
- //iphi position 99 is used for the etSums
- if (iphi != 99)
- continue;
-
- //Get number of samples and number of presamples; bx 0 is nPresamples
- int nSamples = hcalTp.size();
- int nPresamples = hcalTp.presamples();
-
- for (int ibx = 0; ibx < nSamples; ibx++) {
- if (ibx >= nPresamples + bxFirst_ && ibx <= nPresamples + bxLast_) {
- HcalTriggerPrimitiveSample hcalTpSample = hcalTp.sample(ibx);
- int ietIn = hcalTpSample.raw();
-
- l1t::EtSum tempEt = l1t::EtSum();
- tempEt.setHwPt(ietIn);
- tempEt.setHwPhi(0.);
-
- //ieta < 0 is ZDCMinus; > 0 is ZDCPlus
- if (ieta < 0) {
- tempEt.setHwEta(-1.);
- tempEt.setType(EtSum::EtSumType::kZDCM);
- } else {
- tempEt.setHwEta(1.);
- tempEt.setType(EtSum::EtSumType::kZDCP);
- }
-
- //By construction, nPresamples is 0 bx (since presamples span 0 to nPresamples-1)
- etsumsReduced.push_back(ibx - nPresamples, CaloTools::etSumP4Demux(tempEt));
- }
- }
- }
- } else {
- // If the collection is not valid issue a warning before putting an empty collection
- edm::LogWarning("L1TZDCProducer") << "hcalTps not valid; return empty ZDC Et Sum BXCollection" << std::endl;
- }
-
- // Emplace even if !hcalTps.isValid()
- // Output in this case will be an empty collection
- iEvent.emplace(etToken_, std::move(etsumsReduced));
-}
-
-// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
-void L1TZDCProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
- edm::ParameterSetDescription desc;
- desc.add("hcalTPDigis", edm::InputTag("simHcalTriggerPrimitiveDigis"));
- desc.add("bxFirst", -2);
- desc.add("bxLast", 2);
- descriptions.add("l1tZDCProducer", desc);
-}
-
-//define this as a plug-in
-DEFINE_FWK_MODULE(L1TZDCProducer);
diff --git a/L1Trigger/L1TZDC/python/etSumZdcAnalyzer_cfi.py b/L1Trigger/L1TZDC/python/etSumZdcAnalyzer_cfi.py
deleted file mode 100644
index 2fe3fdc06a322..0000000000000
--- a/L1Trigger/L1TZDC/python/etSumZdcAnalyzer_cfi.py
+++ /dev/null
@@ -1,5 +0,0 @@
-import FWCore.ParameterSet.Config as cms
-
-etSumZdcAnalyzer = cms.EDAnalyzer('L1TZDCAnalyzer',
- etSumTag = cms.InputTag("l1tZDCEtSums")
- )
diff --git a/L1Trigger/L1TZDC/python/l1tZDCEtSums_cfi.py b/L1Trigger/L1TZDC/python/l1tZDCEtSums_cfi.py
index e7344cc6ed14a..5b2c314f0d0db 100644
--- a/L1Trigger/L1TZDC/python/l1tZDCEtSums_cfi.py
+++ b/L1Trigger/L1TZDC/python/l1tZDCEtSums_cfi.py
@@ -1,7 +1,7 @@
import FWCore.ParameterSet.Config as cms
-from L1Trigger.L1TZDC.l1tZDCProducer_cfi import l1tZDCProducer as _l1tZDCProducer
+from L1Trigger.L1TZDC.l1tZDCEtSumsProducer_cfi import l1tZDCEtSumsProducer as _l1tZDCEtSumsProducer
-l1tZDCEtSums = _l1tZDCProducer.clone(
+l1tZDCEtSums = _l1tZDCEtSumsProducer.clone(
bxLast = 3
)
diff --git a/L1Trigger/L1TZDC/test/BuildFile.xml b/L1Trigger/L1TZDC/test/BuildFile.xml
new file mode 100644
index 0000000000000..1cc4f49f0f0ee
--- /dev/null
+++ b/L1Trigger/L1TZDC/test/BuildFile.xml
@@ -0,0 +1,2 @@
+
+
diff --git a/L1Trigger/L1TZDC/test/L1TZDCProducerV1.cc b/L1Trigger/L1TZDC/test/L1TZDCProducerV1.cc
deleted file mode 100644
index 27885f85df2f3..0000000000000
--- a/L1Trigger/L1TZDC/test/L1TZDCProducerV1.cc
+++ /dev/null
@@ -1,259 +0,0 @@
-// -*- C++ -*-
-//
-// Package: L1Trigger/L1TZDC
-// Class: L1TZDC
-//
-/**\class L1TZDC L1TZDCProducer.cc L1Trigger/L1TZDC/plugins/L1TZDCProducer.cc
-
- Description: ZDC Producer for L1 Trigger emulation
-
- Implementation:
- Below text meant to indicate this was largely copied from some original work by James;
-modified to be appropriate for producing ZDC Et Sums
-*/
-//
-// Original Author: James Brooke
-// Created: Thu, 05 Dec 2013 17:39:27 GMT
-//
-// Copied for ZDC by: Chris McGinn
-// Copy Made: Wed, 03 Aug 2023
-// Contact: christopher.mc.ginn@cern.ch or
-// cfmcginn on github for bugs/issues
-//
-#include
-#include
-// user include files
-
-#include "FWCore/Framework/interface/EventSetup.h"
-#include "FWCore/Framework/interface/Frameworkfwd.h"
-#include "FWCore/Framework/interface/stream/EDProducer.h"
-#include "FWCore/Framework/interface/ESHandle.h"
-#include "FWCore/Framework/interface/Event.h"
-#include "FWCore/Framework/interface/MakerMacros.h"
-#include "FWCore/ParameterSet/interface/ParameterSet.h"
-#include "FWCore/Utilities/interface/EDGetToken.h"
-#include "FWCore/Utilities/interface/EDPutToken.h"
-#include "FWCore/Utilities/interface/InputTag.h"
-#include "FWCore/Utilities/interface/ESGetToken.h"
-#include "FWCore/MessageLogger/interface/MessageLogger.h"
-
-#include "L1Trigger/L1TCalorimeter/interface/Stage2Layer2FirmwareFactory.h"
-#include "L1Trigger/L1TCalorimeter/interface/Stage2MainProcessor.h"
-#include "L1Trigger/L1TCalorimeter/interface/CaloTools.h"
-
-#include "L1Trigger/L1TCalorimeter/interface/CaloParamsHelper.h"
-#include "CondFormats/DataRecord/interface/L1TCaloParamsRcd.h"
-#include "CondFormats/DataRecord/interface/L1TCaloParamsO2ORcd.h"
-
-#include "DataFormats/L1TCalorimeter/interface/CaloTower.h"
-#include "DataFormats/L1Trigger/interface/EGamma.h"
-#include "DataFormats/L1Trigger/interface/Tau.h"
-#include "DataFormats/L1Trigger/interface/Jet.h"
-#include "DataFormats/L1Trigger/interface/EtSum.h"
-
-#include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
-
-//
-// class declaration
-//
-
-using namespace l1t;
-
-class L1TZDCProducer : public edm::stream::EDProducer<> {
-public:
- explicit L1TZDCProducer(const edm::ParameterSet& ps);
- ~L1TZDCProducer() override = default;
-
- static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
-
-private:
- void produce(edm::Event&, const edm::EventSetup&) override;
-
- void beginRun(edm::Run const&, edm::EventSetup const&) override;
- // void endRun(edm::Run const&, edm::EventSetup const&) override;
-
- int zdcLUTIndexHelper(int iDetPos, int iBXPos);
-
- // ----------member data ---------------------------
-
- // input tokens
- //Add the ZDC token, candidateToken for caloParamsHelper
- edm::EDGetTokenT zdcToken_;
- edm::ESGetToken candidateToken_;
-
- //input ints
- int bxFirst_;
- int bxLast_;
- int sampleToCenterBX_;
-
- // put tokens
- edm::EDPutTokenT etToken_;
-
- //Following the L1TStage2Layer2Producer
- std::unique_ptr params_;
- int scaleFactor_;
-};
-
-L1TZDCProducer::L1TZDCProducer(const edm::ParameterSet& ps) {
- // register what you produce
- etToken_ = produces();
-
- // register what you consume and keep token for later access:
- zdcToken_ = consumes(ps.getParameter("zdcDigis"));
- candidateToken_ = esConsumes();
-
- bxFirst_ = ps.getParameter("bxFirst");
- bxLast_ = ps.getParameter("bxLast");
- sampleToCenterBX_ = ps.getParameter("sampleToCenterBX");
-}
-
-// ------------ method called to produce the data ------------
-void L1TZDCProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
- using namespace edm;
- using namespace l1t;
-
- LogDebug("L1TZDCProducer") << "L1TZDCProducer::produce function called..." << std::endl;
-
- // reduced collection to be emplaced in output
- EtSumBxCollection etsumsReduced(0, bxFirst_, bxLast_);
-
- //inputs
- Handle zdcDigiCollection;
- iEvent.getByToken(zdcToken_, zdcDigiCollection);
-
- //Produce ZDC EtSums IF input zdcDigiCollection is valid
- if (zdcDigiCollection.isValid()) {
- //In lieu of bxFirst, bxLast, use the number of the timeslice samples
- const QIE10DataFrame& frametest = (*zdcDigiCollection)[0];
- int nSamples = frametest.samples();
-
- //Check if the sample requested as center bx is valid
- int sampleToCenterBXChecked = sampleToCenterBX_;
-
- if (sampleToCenterBXChecked < 0) {
- edm::LogWarning("L1TZDCProducer") << "sampleToCenterBX LT 0; Set bx 0 to sample 0 (minimum allowed)" << std::endl;
- sampleToCenterBXChecked = 0;
- } else if (sampleToCenterBXChecked >= nSamples) {
- edm::LogWarning("L1TZDCProducer")
- << "sampleToCenterBX GE nsamples; Set bx 0 to sample nsamples-1 (maximum allowed)" << std::endl;
- sampleToCenterBXChecked = nSamples - 1;
- }
-
- //rawadc[detector index][time slices]
- unsigned short rawadc[18][10];
-
- // the loop below loops over all the elements of the QIE10DigiCollection. Each entry corresponds to one channel
- for (QIE10DigiCollection::const_iterator it = zdcDigiCollection->begin(); it != zdcDigiCollection->end(); it++) {
- const QIE10DataFrame& frame(*it);
- HcalZDCDetId cell = frame.id();
- int zside = cell.zside();
- int section = cell.section();
- int channel = cell.channel();
-
- if (zside != -1 && zside != 1)
- continue;
- if (section != 1 && section != 2)
- continue;
- if (section == 1 && (channel < 1 || channel > 5))
- continue;
- if (section == 2 && (channel < 1 || channel > 4))
- continue;
-
- int ihitid = (zside == 1 ? 9 : 0) + (section == 2 ? 5 : 0) + (channel - 1);
- //the loop below iterates over the time slices
- for (int iTS = 0; iTS < nSamples; iTS++) {
- unsigned short adc = (unsigned short)frame[iTS].adc();
- rawadc[ihitid][iTS] = adc;
- } // end of loop over iTS
- } //end of loop over channels
-
- for (int ibx = 0; ibx < nSamples; ibx++) {
- double cEMP = 0, cEMM = 0, cHDP = 0, cHDM = 0;
- double sumcEMP = 0, sumcEMM = 0, sumcHDP = 0, sumcHDM = 0;
- //idet=0-4 correpond to the EM channels
- for (int idet = 0; idet < 5; idet++) {
- unsigned short EMP = rawadc[idet + 9][ibx];
- unsigned short EMM = rawadc[idet][ibx];
-
- int cEMP_LUTIndex = zdcLUTIndexHelper(idet + 9, (int)EMP);
- int cEMM_LUTIndex = zdcLUTIndexHelper(idet, (int)EMM);
-
- cEMP = ((double)params_->zdcLUT()->data(cEMP_LUTIndex)) / ((double)scaleFactor_);
- cEMM = ((double)params_->zdcLUT()->data(cEMM_LUTIndex)) / ((double)scaleFactor_);
-
- sumcEMP = sumcEMP + cEMP;
- sumcEMM = sumcEMM + cEMM;
- }
- //idet=5-8 correspond to HAD channels
- for (int idet = 5; idet < 9; idet++) {
- unsigned short HDP = rawadc[idet + 9][ibx];
- unsigned short HDM = rawadc[idet][ibx];
-
- int cHDP_LUTIndex = zdcLUTIndexHelper(idet + 9, (int)HDP);
- int cHDM_LUTIndex = zdcLUTIndexHelper(idet, (int)HDM);
-
- cHDP = ((double)params_->zdcLUT()->data(cHDP_LUTIndex)) / ((double)scaleFactor_);
- cHDM = ((double)params_->zdcLUT()->data(cHDM_LUTIndex)) / ((double)scaleFactor_);
-
- sumcHDP = sumcHDP + cHDP;
- sumcHDM = sumcHDM + cHDM;
- }
- double sumM = sumcEMM + sumcHDM;
- double sumP = sumcEMP + sumcHDP;
-
- if (ibx == 4) {
- edm::LogInfo("L1TZDCProducer") << ", sumM= " << sumM << std::endl;
- edm::LogInfo("L1TZDCProducer") << ", sumP= " << sumP << std::endl;
- }
- l1t::EtSum tempEtM = l1t::EtSum();
- tempEtM.setHwPt(sumM);
- tempEtM.setHwEta(-1.);
- tempEtM.setHwPhi(0.);
- tempEtM.setType(EtSum::EtSumType::kZDCM);
-
- l1t::EtSum tempEtP = l1t::EtSum();
- tempEtP.setHwPt(sumP);
- tempEtP.setHwEta(1.);
- tempEtP.setHwPhi(0.);
- tempEtP.setType(EtSum::EtSumType::kZDCP);
-
- if (ibx >= sampleToCenterBXChecked + bxFirst_ && ibx <= sampleToCenterBXChecked + bxLast_) {
- etsumsReduced.push_back(ibx - sampleToCenterBXChecked, CaloTools::etSumP4Demux(tempEtP));
- etsumsReduced.push_back(ibx - sampleToCenterBXChecked, CaloTools::etSumP4Demux(tempEtM));
- }
- } // end of loop over bunch crossings
- } // end if(zdcDigiCollection.isValid())
- else {
- // If the collection is not valid issue a warning before putting an empty collection
- edm::LogWarning("L1TZDCProducer") << "zdcDigis not valid; return empty ZDC Et Sum BXCollection" << std::endl;
- }
-
- // Emplace even if !zdcDigiCollection.isValid()
- // Output in this case will be an empty collection
- iEvent.emplace(etToken_, std::move(etsumsReduced));
-}
-
-// ------------ method called when starting to processes a run ------------
-void L1TZDCProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {
- edm::ESHandle candidateHandle = iSetup.getHandle(candidateToken_);
-
- params_ = std::make_unique(*candidateHandle.product());
- scaleFactor_ = params_->zdcLUT()->data(0); //First position is the integer scaling factor
- edm::LogInfo("L1TZDCProducer") << "SCALE FACTOR FOR LUT: " << scaleFactor_ << std::endl;
-}
-
-// LUT HELPER METHOD
-int L1TZDCProducer::zdcLUTIndexHelper(int iDetPos, int iBxPos) { return 1 + iDetPos * 256 + iBxPos; }
-
-// ------------ method fills 'descriptions' with the allowed parameters for the module ------------
-void L1TZDCProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
- edm::ParameterSetDescription desc;
- desc.add("zdcDigis", edm::InputTag("hcalDigis", "ZDC"));
- desc.add("bxFirst", -2);
- desc.add("bxLast", 2);
- desc.add("sampleToCenterBX", 4);
- descriptions.add("l1tZDCProducer", desc);
-}
-
-//define this as a plug-in
-DEFINE_FWK_MODULE(L1TZDCProducer);
diff --git a/L1Trigger/L1TZDC/test/README b/L1Trigger/L1TZDC/test/README
deleted file mode 100644
index 78050b0adda9f..0000000000000
--- a/L1Trigger/L1TZDC/test/README
+++ /dev/null
@@ -1,3 +0,0 @@
-L1TZDCProducerV1.cc is the V1 version of the L1TZDCProducer plugin prior to the adoption of fully calibrated tpDigis as provided by the HCal group
-
-Similarly, etSumZDCProducerV1_cfi.py is the corresponding initialization of the v1 producer that would be under the python directory
diff --git a/L1Trigger/L1TZDC/test/etSumZDCProducerV1_cfi.py b/L1Trigger/L1TZDC/test/etSumZDCProducerV1_cfi.py
deleted file mode 100644
index 56b8c7aac734e..0000000000000
--- a/L1Trigger/L1TZDC/test/etSumZDCProducerV1_cfi.py
+++ /dev/null
@@ -1,9 +0,0 @@
-import FWCore.ParameterSet.Config as cms
-
-process.etSumZdcProducer = cms.EDProducer('L1TZDCProducer',
- zdcDigis = cms.InputTag("simHcalTriggerPrimitiveDigis"),
- sampleToCenterBX = cms.int32(2),
- bxFirst = cms.int32(-2),
- bxLast = cms.int32(3)
-)
-
diff --git a/L1Trigger/L1TZDC/test/l1ZDCProducerTest.py b/L1Trigger/L1TZDC/test/l1ZDCProducerTest.py
deleted file mode 100644
index fb9ad9cffcc42..0000000000000
--- a/L1Trigger/L1TZDC/test/l1ZDCProducerTest.py
+++ /dev/null
@@ -1,112 +0,0 @@
-#Copied rom GM zdcDigiAnalyze.py 2023.08.04
-#Found here https://github.com/ginnocen/UPCopenHFanalysis/blob/zdc_calibrationcode/zdc_calibration/newZDCAnalyzer/test/zdcDigiAnalyze.py
-#CMcGinn it modifying to test the l1zdc producer, see comments below
-#Bugs, contact christopher.mc.ginn@cern.ch or cfmcginn on github
-
-import FWCore.ParameterSet.Config as cms
-import FWCore.Utilities.FileUtils as FileUtils
-
-from Configuration.StandardSequences.Eras import eras
-
-process = cms.Process("Demo",eras.Run2_2018_pp_on_AA)
-
-process.load('Configuration.StandardSequences.Services_cff')
-process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi')
-process.load('FWCore.MessageService.MessageLogger_cfi')
-process.load('Configuration.EventContent.EventContent_cff')
-process.load('SimGeneral.MixingModule.mixNoPU_cfi')
-process.load('Configuration.StandardSequences.GeometryRecoDB_cff')
-process.load('Configuration.Geometry.GeometrySimDB_cff')
-process.load('Configuration.StandardSequences.MagneticField_38T_cff')
-process.load('Configuration.StandardSequences.Generator_cff')
-process.load('IOMC.EventVertexGenerators.VtxSmearedNominalCollision2015_cfi')
-process.load('GeneratorInterface.Core.genFilterSummary_cff')
-process.load('Configuration.StandardSequences.SimIdeal_cff')
-process.load('Configuration.StandardSequences.Digi_cff')
-process.load('Configuration.StandardSequences.SimL1Emulator_cff')
-process.load('Configuration.StandardSequences.DigiToRaw_cff')
-process.load('HLTrigger.Configuration.HLT_GRun_cff')
-process.load('Configuration.StandardSequences.RawToDigi_cff')
-process.load('Configuration.StandardSequences.Reconstruction_cff')
-process.load('Configuration.StandardSequences.EndOfProcess_cff')
-
-#process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff")
-#process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(-1))
-#process.MessageLogger.cerr.FwkReport.reportEvery = 10000
-
-process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(1000))
-process.MessageLogger.cerr.FwkReport.reportEvery = 10
-#process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10))
-#process.MessageLogger.cerr.FwkReport.reportEvery = 1
-
-process.TFileService = cms.Service("TFileService",fileName=cms.string("zdcdigitree_DoDUMMYPyLUT_327524.root"))
-
-#mylist = FileUtils.loadListFromFile('files_temp.txt')
-mylist = FileUtils.loadListFromFile('files_327524.txt')
-readFiles = cms.untracked.vstring(*mylist)
-
-process.source = cms.Source("PoolSource",
- fileNames = cms.untracked.vstring(
- 'file:/afs/cern.ch/user/m/mcsanad/public/CMSSW_10_3_1/src/zdc/newZDCAnalyzer/test/ED0B7A21-B558-924C-A57E-B1651E8BFFA3.root'
-# *mylist
- )
-)
-
-#Try some real basic replacement - producer and analyzer
-process.etSumZdcProducer = cms.EDProducer('L1TZDCProducer',
- zdcDigis = cms.InputTag("hcalDigis", "ZDC", "reRECO"),
- bxFirst = cms.int32(-2),
- bxLast = cms.int32(2),
- sampleToCenterBX = cms.int32(4)
-
-)
-
-process.etSumZdcAnalyzer = cms.EDAnalyzer('L1TZDCAnalyzer',
- etSumTag = cms.InputTag("etSumZdcProducer")
-)
-
-
-process.skimOutput = cms.OutputModule("PoolOutputModule",
- fileName = cms.untracked.string("comp.root"),
- outputCommands = cms.untracked.vstring(
- 'keep *'
- ),
-)
-
-
-#process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
-#process.GlobalTag.globaltag = '92X_upgrade2017_realistic_v10'
-#process.GlobalTag.globaltag = '103X_dataRun2_Express_v2'
-#process.GlobalTag.globaltag = '103X_dataRun2_Prompt_v3'
-
-#CM Note - below global tag file doesnt appear to exist, swapping in the file from runEmulator-CaloStage2.py for now
-#process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_condDBv2_cff')
-#the below is the swap from runEmulator-CaloStage2.py
-process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
-process.GlobalTag.globaltag = cms.string('103X_dataRun2_v6')
-
-#For lookup tables
-# Automatic addition of the customisation function from L1Trigger.Configuration.customiseSettings
-from L1Trigger.Configuration.customiseSettings import L1TSettingsToCaloParams_2018_v1_4_1
-#call to customisation function L1TSettingsToCaloParams_2018_v1_4_1 imported from L1Trigger.Configuration.customiseSettings
-
-#process.caloStage2Params
-#L1TSettingsToCaloParams_2018_v1_4_1.caloStage2Params.zdcLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/zdcLUT_HI_DUMMY.txt"),
-
-process = L1TSettingsToCaloParams_2018_v1_4_1(process)
-#process.caloStage2Params.zdcLUTFile = cms.FileInPath("L1Trigger/L1TCalorimeter/data/zdcLUT_HI_DUMMY.txt"),
-
-
-process.produce_step = cms.Path(process.etSumZdcProducer)
-process.analyze_step = cms.Path(process.etSumZdcAnalyzer)
-process.output_step = cms.EndPath(process.skimOutput)
-
-
-process.schedule = cms.Schedule(
- process.produce_step,
- process.analyze_step,
- process.output_step
-)
-
-
-#uncomment the output for debugging/saving the etsums
diff --git a/L1Trigger/L1TZDC/test/testL1TZDCEtSumsProducer.sh b/L1Trigger/L1TZDC/test/testL1TZDCEtSumsProducer.sh
new file mode 100755
index 0000000000000..264a2cac005e1
--- /dev/null
+++ b/L1Trigger/L1TZDC/test/testL1TZDCEtSumsProducer.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+
+# Pass in name and status
+function die {
+ echo $1: status $2
+ exit $2
+}
+
+# run test job
+TESTDIR="${SCRAM_TEST_PATH}"
+
+set -o pipefail
+
+cmsRun "${TESTDIR}"/testL1TZDCEtSumsProducer_cfg.py -n 10 2>&1 | tee log_testL1TZDCEtSumsProducer \
+ || die "Failure running testL1TZDCEtSumsProducer_cfg.py" $?
+
+set +o pipefail
+
+grep l1tZDCEtSumsPrinter2 log_testL1TZDCEtSumsProducer > log_testL1TZDCEtSumsProducer_l1tZDCEtSumsPrinter2
+
+# expected PathSummary of test job
+cat <<@EOF > log_testL1TZDCEtSumsProducer_l1tZDCEtSumsPrinter2_expected
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (27, 2)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (27, 3)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (27, 4)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (27, 6)
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (28, 7)
+[l1tZDCEtSumsPrinter2] etSums[-1][1] (type, hwPt) = (27, 2)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (28, 12)
+[l1tZDCEtSumsPrinter2] etSums[0][1] (type, hwPt) = (27, 1)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (28, 0)
+[l1tZDCEtSumsPrinter2] etSums[1][1] (type, hwPt) = (27, 1)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (28, 0)
+[l1tZDCEtSumsPrinter2] etSums[2][1] (type, hwPt) = (27, 2)
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (28, 0)
+[l1tZDCEtSumsPrinter2] etSums[-1][1] (type, hwPt) = (27, 3)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (28, 1023)
+[l1tZDCEtSumsPrinter2] etSums[0][1] (type, hwPt) = (27, 6)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (28, 0)
+[l1tZDCEtSumsPrinter2] etSums[1][1] (type, hwPt) = (27, 5)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (28, 1)
+[l1tZDCEtSumsPrinter2] etSums[2][1] (type, hwPt) = (27, 7)
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (28, 3)
+[l1tZDCEtSumsPrinter2] etSums[-1][1] (type, hwPt) = (27, 9)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (28, 31)
+[l1tZDCEtSumsPrinter2] etSums[0][1] (type, hwPt) = (27, 12)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (28, 31)
+[l1tZDCEtSumsPrinter2] etSums[1][1] (type, hwPt) = (27, 8)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (28, 31)
+[l1tZDCEtSumsPrinter2] etSums[2][1] (type, hwPt) = (27, 215)
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (28, 0)
+[l1tZDCEtSumsPrinter2] etSums[-1][1] (type, hwPt) = (27, 6)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (28, 8)
+[l1tZDCEtSumsPrinter2] etSums[0][1] (type, hwPt) = (27, 5)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (28, 14)
+[l1tZDCEtSumsPrinter2] etSums[1][1] (type, hwPt) = (27, 4)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (28, 16)
+[l1tZDCEtSumsPrinter2] etSums[2][1] (type, hwPt) = (27, 2)
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (28, 8)
+[l1tZDCEtSumsPrinter2] etSums[-1][1] (type, hwPt) = (27, 4)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (28, 5)
+[l1tZDCEtSumsPrinter2] etSums[0][1] (type, hwPt) = (27, 1023)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (28, 6)
+[l1tZDCEtSumsPrinter2] etSums[1][1] (type, hwPt) = (27, 0)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (28, 6)
+[l1tZDCEtSumsPrinter2] etSums[2][1] (type, hwPt) = (27, 6)
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (28, 1)
+[l1tZDCEtSumsPrinter2] etSums[-1][1] (type, hwPt) = (27, 61)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (28, 36)
+[l1tZDCEtSumsPrinter2] etSums[0][1] (type, hwPt) = (27, 55)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (28, 5)
+[l1tZDCEtSumsPrinter2] etSums[1][1] (type, hwPt) = (27, 30)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (28, 2)
+[l1tZDCEtSumsPrinter2] etSums[2][1] (type, hwPt) = (27, 18)
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (28, 0)
+[l1tZDCEtSumsPrinter2] etSums[-1][1] (type, hwPt) = (27, 0)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (28, 131)
+[l1tZDCEtSumsPrinter2] etSums[0][1] (type, hwPt) = (27, 121)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (28, 9)
+[l1tZDCEtSumsPrinter2] etSums[1][1] (type, hwPt) = (27, 22)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (28, 27)
+[l1tZDCEtSumsPrinter2] etSums[2][1] (type, hwPt) = (27, 31)
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (28, 59)
+[l1tZDCEtSumsPrinter2] etSums[-1][1] (type, hwPt) = (27, 47)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (28, 845)
+[l1tZDCEtSumsPrinter2] etSums[0][1] (type, hwPt) = (27, 52)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (28, 1)
+[l1tZDCEtSumsPrinter2] etSums[1][1] (type, hwPt) = (27, 46)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (28, 28)
+[l1tZDCEtSumsPrinter2] etSums[2][1] (type, hwPt) = (27, 35)
+[l1tZDCEtSumsPrinter2] etSums[-1][0] (type, hwPt) = (28, 19)
+[l1tZDCEtSumsPrinter2] etSums[-1][1] (type, hwPt) = (27, 66)
+[l1tZDCEtSumsPrinter2] etSums[0][0] (type, hwPt) = (28, 20)
+[l1tZDCEtSumsPrinter2] etSums[0][1] (type, hwPt) = (27, 61)
+[l1tZDCEtSumsPrinter2] etSums[1][0] (type, hwPt) = (28, 23)
+[l1tZDCEtSumsPrinter2] etSums[1][1] (type, hwPt) = (27, 47)
+[l1tZDCEtSumsPrinter2] etSums[2][0] (type, hwPt) = (28, 12)
+[l1tZDCEtSumsPrinter2] etSums[2][1] (type, hwPt) = (27, 45)
+@EOF
+
+# compare to expected output of test job
+diff log_testL1TZDCEtSumsProducer_l1tZDCEtSumsPrinter2_expected \
+ log_testL1TZDCEtSumsProducer_l1tZDCEtSumsPrinter2 \
+ || die "differences in expected log report" $?
diff --git a/L1Trigger/L1TZDC/test/testL1TZDCEtSumsProducer_cfg.py b/L1Trigger/L1TZDC/test/testL1TZDCEtSumsProducer_cfg.py
new file mode 100644
index 0000000000000..b6116a0c3a193
--- /dev/null
+++ b/L1Trigger/L1TZDC/test/testL1TZDCEtSumsProducer_cfg.py
@@ -0,0 +1,97 @@
+import FWCore.ParameterSet.Config as cms
+
+import argparse
+import sys
+
+parser = argparse.ArgumentParser(prog=sys.argv[0],
+ description='Test of the L1TZDCEtSumsProducer plugin')
+
+parser.add_argument('-f', '--fileNames', dest='fileNames', nargs='+',
+ default=['/store/hidata/HIRun2024B/HIForward0/RAW/v1/000/388/784/00000/a277c6d8-c445-4d2b-a45c-0e74e4ed8ce8.root'],
+ help='Input EDM file(s)'
+)
+
+parser.add_argument('-l', '--rawDataLabel', dest='rawDataLabel', type=str, default='rawDataRepacker',
+ help="Label of the FEDRawDataCollection product to be used as input")
+
+parser.add_argument('-g', '--globalTag', dest='globalTag', type=str, default='auto:run3_hlt_relval',
+ help="Name of the GlobalTag")
+
+parser.add_argument('-n', '--maxEvents', dest='maxEvents', type=int, default=10,
+ help="Max number of events to be processed")
+
+parser.add_argument('--skipEvents', dest='skipEvents', type=int, default=0,
+ help="Value of process.source.skipEvents")
+
+parser.add_argument('-t', '--numberOfThreads', dest='numberOfThreads', type=int, default=1,
+ help="Value of process.options.numberOfThreads")
+
+parser.add_argument('-s', '--numberOfStreams', dest='numberOfStreams', type=int, default=0,
+ help="Value of process.options.numberOfStreams")
+
+args = parser.parse_args()
+
+process = cms.Process('TEST')
+
+process.maxEvents.input = args.maxEvents
+
+process.options.numberOfThreads = args.numberOfThreads
+process.options.numberOfStreams = args.numberOfStreams
+process.options.wantSummary = False
+
+# MessageLogger
+process.load('FWCore.MessageService.MessageLogger_cfi')
+process.MessageLogger.cerr.FwkReport.reportEvery = 1
+
+# Input source
+process.source = cms.Source('PoolSource',
+ fileNames = cms.untracked.vstring(args.fileNames),
+ skipEvents = cms.untracked.uint32(args.skipEvents)
+)
+
+# GlobalTag (ESSource)
+from Configuration.AlCa.GlobalTag import GlobalTag
+process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
+process.GlobalTag = GlobalTag(process.GlobalTag, args.globalTag)
+
+# EventSetup modules
+process.HcalTopologyIdealEP = cms.ESProducer("HcalTopologyIdealEP",
+ Exclude = cms.untracked.string( "" ),
+ MergePosition = cms.untracked.bool( True ),
+ appendToDataLabel = cms.string( "" )
+)
+
+process.hcalDDDRecConstants = cms.ESProducer("HcalDDDRecConstantsESModule",
+ appendToDataLabel = cms.string( "" )
+)
+
+process.hcalDDDSimConstants = cms.ESProducer("HcalDDDSimConstantsESModule",
+ appendToDataLabel = cms.string( "" )
+)
+
+process.zdcTopologyEP = cms.ESProducer("ZdcTopologyEP",
+ appendToDataLabel = cms.string( "" )
+)
+
+# EventData modules
+from EventFilter.L1TRawToDigi.gtStage2Digis_cfi import gtStage2Digis as _gtStage2Digis
+process.gtStage2Digis = _gtStage2Digis.clone(InputLabel = args.rawDataLabel)
+
+from EventFilter.HcalRawToDigi.HcalRawToDigi_cfi import hcalDigis as _hcalDigis
+process.hcalDigis = _hcalDigis.clone(InputLabel = args.rawDataLabel)
+
+from L1Trigger.L1TZDC.l1tZDCEtSums_cfi import l1tZDCEtSums as _l1tZDCEtSums
+process.l1tZDCEtSums = _l1tZDCEtSums.clone(hcalTPDigis = 'hcalDigis')
+
+from L1Trigger.L1TCalorimeter.l1tEtSumsPrinter_cfi import l1tEtSumsPrinter as _l1tEtSumsPrinter
+process.l1tZDCEtSumsPrinter1 = _l1tEtSumsPrinter.clone(etSumTypes = [27, 28], src = 'gtStage2Digis:EtSumZDC')
+process.l1tZDCEtSumsPrinter2 = process.l1tZDCEtSumsPrinter1.clone(src = 'l1tZDCEtSums')
+
+# Path
+process.ThePath = cms.Path(
+ process.gtStage2Digis
+ + process.hcalDigis
+ + process.l1tZDCEtSums
+ + process.l1tZDCEtSumsPrinter1
+ + process.l1tZDCEtSumsPrinter2
+)