53 std::vector<RectangularEtaPhiRegion>&,
57 template <
typename T1>
68 :
minEt_(para.getParameter<double>(
"minEt")),
69 maxEt_(para.getParameter<double>(
"maxEt")),
72 token_(consumesColl.consumes<T1>(para.getParameter<
edm::
InputTag>(
"inputColl"))) {}
75 template <
typename T2>
76 static typename T2::const_iterator
beginIt(
const T2& coll) {
79 template <
typename T2>
80 static typename T2::const_iterator
endIt(
const T2& coll) {
83 template <
typename T2>
87 template <
typename T2>
93 template <
typename RecHitType>
120 template <
typename RecHitType>
122 : caloGeometryToken_{esConsumes()}, l1CaloGeometryToken_{esConsumes()} {
124 para.getParameter<std::vector<edm::ParameterSet>>(
"l1InputRegions");
127 l1RegionData_.emplace_back(createL1RegionData(
130 consumesCollector()));
132 recHitLabels_ = para.getParameter<std::vector<edm::InputTag>>(
"recHitLabels");
133 productLabels_ = para.getParameter<std::vector<std::string>>(
"productLabels");
135 for (
unsigned int collNr = 0; collNr < recHitLabels_.size(); collNr++) {
136 recHitTokens_.push_back(consumes<RecHitCollectionType>(recHitLabels_[collNr]));
137 produces<RecHitCollectionType>(productLabels_[collNr]);
140 template <
typename RecHitType>
143 std::vector<std::string> productTags;
144 productTags.push_back(
"EcalRegionalRecHitsEB");
145 productTags.push_back(
"EcalRegionalRecHitsEE");
146 desc.add<std::vector<std::string>>(
"productLabels", productTags);
158 emIsoPSet.
addParameter<
double>(
"regionEtaMargin", 0.14);
166 emNonIsoPSet.
addParameter<
double>(
"regionEtaMargin", 0.14);
167 emNonIsoPSet.
addParameter<
double>(
"regionPhiMargin", 0.4);
185 jetPSet.addParameter<
double>(
"minEt", 200);
186 jetPSet.addParameter<
double>(
"maxEt", 999);
187 jetPSet.addParameter<
double>(
"regionEtaMargin", 0.4);
188 jetPSet.addParameter<
double>(
"regionPhiMargin", 0.5);
194 l1InputRegionDesc.
add<
double>(
"minEt");
195 l1InputRegionDesc.
add<
double>(
"maxEt");
196 l1InputRegionDesc.
add<
double>(
"regionEtaMargin");
197 l1InputRegionDesc.
add<
double>(
"regionPhiMargin");
204 template <
typename RecHitType>
207 auto const& caloGeom =
setup.getData(caloGeometryToken_);
210 auto const& l1CaloGeom =
setup.getData(l1CaloGeometryToken_);
212 std::vector<RectangularEtaPhiRegion>
regions;
213 std::for_each(l1RegionData_.begin(),
219 for (
size_t recHitCollNr = 0; recHitCollNr < recHitTokens_.size(); recHitCollNr++) {
221 event.getByToken(recHitTokens_[recHitCollNr],
recHits);
225 <<
" named " << recHitLabels_[recHitCollNr].encode() << std::endl;
229 auto filteredRecHits = std::make_unique<RecHitCollectionType>();
237 if (
region.inRegion(this_cell->etaPos(), this_cell->phiPos())) {
238 filteredRecHits->push_back(
recHit);
246 event.put(
std::move(filteredRecHits), productLabels_[recHitCollNr]);
250 template <
typename RecHitType>
253 if (
type ==
"L1EmParticle") {
255 }
else if (
type ==
"L1JetParticle") {
257 }
else if (
type ==
"L1MuonParticle") {
259 }
else if (
type ==
"EGamma") {
261 }
else if (
type ==
"Jet") {
263 }
else if (
type ==
"Muon") {
265 }
else if (
type ==
"Tau") {
271 <<
" is not recognised, this means the rec-hit you think you are keeping may not be and you should fix this "
272 "error as it can lead to hard to find efficiency loses"
277 template <
typename L1CollType>
279 std::vector<RectangularEtaPhiRegion>&
regions,
282 event.getByToken(token_, l1Cands);
284 for (
auto l1CandIt = beginIt(*l1Cands); l1CandIt != endIt(*l1Cands); ++l1CandIt) {
285 if (l1CandIt->et() >= minEt_ && l1CandIt->et() < maxEt_) {
286 double etaLow = l1CandIt->eta() - regionEtaMargin_;
287 double etaHigh = l1CandIt->eta() + regionEtaMargin_;
288 double phiLow = l1CandIt->phi() - regionPhiMargin_;
289 double phiHigh = l1CandIt->phi() + regionPhiMargin_;
298 std::vector<RectangularEtaPhiRegion>&
regions,
301 event.getByToken(token_, l1Cands);
303 for (
const auto& l1Cand : *l1Cands) {
304 if (l1Cand.et() >= minEt_ && l1Cand.et() < maxEt_) {
306 int etaIndex = l1Cand.gctJetCand()->etaIndex();
307 int phiIndex = l1Cand.gctJetCand()->phiIndex();
315 etaLow -= regionEtaMargin_;
317 phiLow -= regionPhiMargin_;
318 phiHigh += regionPhiMargin_;
327 std::vector<RectangularEtaPhiRegion>&
regions,
330 event.getByToken(token_, l1Cands);
332 for (
const auto& l1Cand : *l1Cands) {
333 if (l1Cand.et() >= minEt_ && l1Cand.et() < maxEt_) {
335 int etaIndex = l1Cand.gctEmCand()->etaIndex();
336 int phiIndex = l1Cand.gctEmCand()->phiIndex();
344 etaLow -= regionEtaMargin_;
346 phiLow -= regionPhiMargin_;
347 phiHigh += regionPhiMargin_;