Skip to content

Commit 5f41aa7

Browse files
authored
Merge pull request cms-sw#42513 from makortel/l1tMuonEndCapPSet
Configure SectorProcessShower objects only once in L1TMuonEndCapShowerProducer
2 parents 6975683 + 16593d9 commit 5f41aa7

File tree

4 files changed

+22
-18
lines changed

4 files changed

+22
-18
lines changed

L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.cc

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,28 @@
11
#include "L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h"
22
#include "L1Trigger/L1TMuonEndCap/interface/Common.h"
33

4+
namespace {
5+
template <typename F>
6+
void forEachProcessor(F&& func) {
7+
for (int endcap = emtf::MIN_ENDCAP; endcap <= emtf::MAX_ENDCAP; ++endcap) {
8+
for (int sector = emtf::MIN_TRIGSECTOR; sector <= emtf::MAX_TRIGSECTOR; ++sector) {
9+
const int es = (endcap - emtf::MIN_ENDCAP) * (emtf::MAX_TRIGSECTOR - emtf::MIN_TRIGSECTOR + 1) +
10+
(sector - emtf::MIN_TRIGSECTOR);
11+
func(endcap, sector, es);
12+
}
13+
}
14+
}
15+
} // namespace
16+
417
L1TMuonEndCapShowerProducer::L1TMuonEndCapShowerProducer(const edm::ParameterSet& iConfig)
5-
: config_(iConfig),
6-
tokenCSCShower_(consumes<CSCShowerDigiCollection>(iConfig.getParameter<edm::InputTag>("CSCShowerInput"))),
18+
: tokenCSCShower_(consumes<CSCShowerDigiCollection>(iConfig.getParameter<edm::InputTag>("CSCShowerInput"))),
719
sector_processors_shower_() {
820
// Make output products
921
produces<l1t::RegionalMuonShowerBxCollection>("EMTF");
22+
23+
forEachProcessor([&](const int endcap, const int sector, const int es) {
24+
sector_processors_shower_.at(es).configure(iConfig, endcap, sector);
25+
});
1026
}
1127

1228
L1TMuonEndCapShowerProducer::~L1TMuonEndCapShowerProducer() {}
@@ -23,16 +39,9 @@ void L1TMuonEndCapShowerProducer::produce(edm::Event& iEvent, const edm::EventSe
2339

2440
// ___________________________________________________________________________
2541
// Run the sector processors
26-
27-
for (int endcap = emtf::MIN_ENDCAP; endcap <= emtf::MAX_ENDCAP; ++endcap) {
28-
for (int sector = emtf::MIN_TRIGSECTOR; sector <= emtf::MAX_TRIGSECTOR; ++sector) {
29-
const int es = (endcap - emtf::MIN_ENDCAP) * (emtf::MAX_TRIGSECTOR - emtf::MIN_TRIGSECTOR + 1) +
30-
(sector - emtf::MIN_TRIGSECTOR);
31-
32-
sector_processors_shower_.at(es).configure(config_, endcap, sector);
33-
sector_processors_shower_.at(es).process(showers, *out_showers);
34-
}
35-
}
42+
forEachProcessor([&](const int endcap, const int sector, const int es) {
43+
sector_processors_shower_.at(es).process(showers, *out_showers);
44+
});
3645

3746
// Fill the output products
3847
iEvent.put(std::move(out_showers), "EMTF");

L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapShowerProducer.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ class L1TMuonEndCapShowerProducer : public edm::stream::EDProducer<> {
3333
void produce(edm::Event&, const edm::EventSetup&) override;
3434

3535
private:
36-
const edm::ParameterSet& config_;
3736
edm::EDGetToken tokenCSCShower_;
3837
emtf::sector_array<SectorProcessorShower> sector_processors_shower_;
3938
};

L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapTrackProducer.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
#include "L1TMuonEndCapTrackProducer.h"
22

33
L1TMuonEndCapTrackProducer::L1TMuonEndCapTrackProducer(const edm::ParameterSet& iConfig)
4-
: track_finder_(new TrackFinder(iConfig, consumesCollector())),
5-
uGMT_converter_(new MicroGMTConverter()),
6-
config_(iConfig) {
4+
: track_finder_(new TrackFinder(iConfig, consumesCollector())), uGMT_converter_(new MicroGMTConverter()) {
75
// Make output products
86
produces<EMTFHitCollection>(""); // All CSC LCTs and RPC clusters received by EMTF
97
produces<EMTFTrackCollection>(""); // All output EMTF tracks, in same format as unpacked data

L1Trigger/L1TMuonEndCap/plugins/L1TMuonEndCapTrackProducer.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ class L1TMuonEndCapTrackProducer : public edm::stream::EDProducer<> {
3636
private:
3737
std::unique_ptr<TrackFinder> track_finder_;
3838
std::unique_ptr<MicroGMTConverter> uGMT_converter_;
39-
40-
const edm::ParameterSet& config_;
4139
};
4240

4341
#endif

0 commit comments

Comments
 (0)