Skip to content

Commit a065bd2

Browse files
author
Max Zhao
committed
Moved module declaration to SealModule, added checking for empty region or empty CICADAScore
1 parent 6833a35 commit a065bd2

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

DQM/L1TMonitor/plugins/SealModule.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ DEFINE_FWK_MODULE(L1TGMT);
2727
#include "DQM/L1TMonitor/interface/L1TStage2CaloLayer1.h"
2828
DEFINE_FWK_MODULE(L1TStage2CaloLayer1);
2929

30+
#include "DQM/L1TMonitor/interface/L1TCaloLayer1Summary.h"
31+
DEFINE_FWK_MODULE(L1TCaloLayer1Summary);
32+
3033
#include "DQM/L1TMonitor/interface/L1TStage2CaloLayer2.h"
3134
DEFINE_FWK_MODULE(L1TStage2CaloLayer2);
3235

DQM/L1TMonitor/src/L1TCaloLayer1Summary.cc

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ L1TCaloLayer1Summary::L1TCaloLayer1Summary(const edm::ParameterSet& iConfig)
99
consumes<L1CaloRegionCollection>(iConfig.getParameter<edm::InputTag>("caloLayer1Regions"))),
1010
simRegionsToken_(consumes<L1CaloRegionCollection>(iConfig.getParameter<edm::InputTag>("simRegions"))),
1111
fedRawData_(consumes<FEDRawDataCollection>(iConfig.getParameter<edm::InputTag>("fedRawDataLabel"))),
12-
histFolder_(iConfig.getParameter<std::string>("histFolder")) {}
12+
histFolder_(iConfig.getParameter<std::string>("histFolder")) {
13+
}
1314

1415
// ------------ method called for each event ------------
1516
void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) {
@@ -77,15 +78,21 @@ void L1TCaloLayer1Summary::analyze(const edm::Event& iEvent, const edm::EventSet
7778
}
7879
}
7980

80-
float caloCICADAScore = iEvent.get(caloLayer1CICADAScoreToken_)[0];
81+
auto caloCICADAScores = iEvent.get(caloLayer1CICADAScoreToken_);
8182
auto gtCICADAScores = iEvent.get(gtCICADAScoreToken_);
82-
float simCICADAScore = iEvent.get(simCICADAScoreToken_)[0];
83+
auto simCICADAScores = iEvent.get(simCICADAScoreToken_);
8384

84-
histoSimCICADAScore->Fill(simCICADAScore);
85-
histoCaloMinusSim->Fill(caloCICADAScore - simCICADAScore);
86-
histoCaloLayer1CICADAScore->Fill(caloCICADAScore);
87-
histoGtCICADAScore->Fill(gtCICADAScores.at(0, 0));
88-
histoCaloMinusGt->Fill(gtCICADAScores.at(0, 0) - caloCICADAScore);
85+
if (caloCICADAScores.size() > 0) {
86+
histoCaloLayer1CICADAScore->Fill(caloCICADAScores[0]);
87+
if (gtCICADAScores.size() > 0) {
88+
histoGtCICADAScore->Fill(gtCICADAScores.at(0, 0));
89+
histoCaloMinusGt->Fill(caloCICADAScores[0] - gtCICADAScores.at(0, 0));
90+
}
91+
if (simCICADAScores.size() > 0) {
92+
histoSimCICADAScore->Fill(simCICADAScores[0]);
93+
histoCaloMinusSim->Fill(caloCICADAScores[0] - simCICADAScores[0]);
94+
}
95+
}
8996
}
9097

9198
void L1TCaloLayer1Summary::bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) {
@@ -119,7 +126,4 @@ void L1TCaloLayer1Summary::fillDescriptions(edm::ConfigurationDescriptions& desc
119126
desc.add<edm::InputTag>("fedRawDataLabel", edm::InputTag("rawDataCollector"));
120127
desc.add<std::string>("histFolder", "L1T/L1TCaloLayer1Summary");
121128
descriptions.add("l1tCaloLayer1Summary", desc);
122-
}
123-
124-
//define this as a plug-in
125-
DEFINE_FWK_MODULE(L1TCaloLayer1Summary);
129+
}

L1Trigger/L1TCaloLayer1/plugins/L1TCaloSummary.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ class L1TCaloSummary : public edm::stream::EDProducer<> {
107107
int fwVersion;
108108

109109
edm::EDGetTokenT<L1CaloRegionCollection> regionToken;
110+
edm::EDGetTokenT<L1CaloRegionCollection> backupRegionToken;
110111

111112
UCTLayer1* layer1;
112113

@@ -142,6 +143,7 @@ L1TCaloSummary<INPUT, OUTPUT>::L1TCaloSummary(const edm::ParameterSet& iConfig)
142143
verbose(iConfig.getParameter<bool>("verbose")),
143144
fwVersion(iConfig.getParameter<int>("firmwareVersion")),
144145
regionToken(consumes<L1CaloRegionCollection>(iConfig.getParameter<edm::InputTag>("caloLayer1Regions"))),
146+
backupRegionToken(consumes<L1CaloRegionCollection>(edm::InputTag("simCaloStage2Layer1Digis"))),
145147
loader(hls4mlEmulator::ModelLoader(iConfig.getParameter<string>("CICADAModelVersion"))),
146148
overwriteWithTestPatterns(iConfig.getParameter<bool>("useTestPatterns")),
147149
testPatterns(iConfig.getParameter<std::vector<edm::ParameterSet>>("testPatterns")) {
@@ -198,6 +200,12 @@ void L1TCaloSummary<INPUT, OUTPUT>::produce(edm::Event& iEvent, const edm::Event
198200
if (!iEvent.getByToken(regionToken, regionCollection))
199201
edm::LogError("L1TCaloSummary") << "UCT: Failed to get regions from region collection!";
200202
iEvent.getByToken(regionToken, regionCollection);
203+
204+
if (regionCollection->size() == 0) {
205+
iEvent.getByToken(backupRegionToken, regionCollection);
206+
edm::LogWarning("L1TCaloSummary") << "Switched to emulated regions since data regions was empty.\n";
207+
}
208+
201209
//Model input
202210
//This is done as a flat vector input, but future versions may involve 2D input
203211
//This will have to be handled later

0 commit comments

Comments
 (0)