54 std::vector<RectangularEtaPhiRegion>&)
const = 0;
57 template <
typename T1>
71 :
minEt_(para.getParameter<double>(
"minEt")),
72 maxEt_(para.getParameter<double>(
"maxEt")),
75 token_(consumesColl.consumes<T1>(para.getParameter<
edm::
InputTag>(
"inputColl"))) {
81 std::vector<RectangularEtaPhiRegion>&)
const override;
82 template <
typename T2>
83 static typename T2::const_iterator
beginIt(
const T2& coll) {
86 template <
typename T2>
87 static typename T2::const_iterator
endIt(
const T2& coll) {
90 template <
typename T2>
94 template <
typename T2>
100 template <
typename RecHitType>
126 template <
typename RecHitType>
130 para.getParameter<std::vector<edm::ParameterSet>>(
"l1InputRegions");
134 l1RegionData_.emplace_back(createL1RegionData(
type,
pset, consumesCollector()));
136 recHitLabels_ = para.getParameter<std::vector<edm::InputTag>>(
"recHitLabels");
137 productLabels_ = para.getParameter<std::vector<std::string>>(
"productLabels");
139 for (
unsigned int collNr = 0; collNr < recHitLabels_.size(); collNr++) {
140 recHitTokens_.push_back(consumes<RecHitCollectionType>(recHitLabels_[collNr]));
141 produces<RecHitCollectionType>(productLabels_[collNr]);
145 template <
typename RecHitType>
148 std::vector<std::string> productTags;
149 productTags.push_back(
"EcalRegionalRecHitsEB");
150 productTags.push_back(
"EcalRegionalRecHitsEE");
151 desc.add<std::vector<std::string>>(
"productLabels", productTags);
163 emIsoPSet.
addParameter<
double>(
"regionEtaMargin", 0.14);
171 emNonIsoPSet.
addParameter<
double>(
"regionEtaMargin", 0.14);
172 emNonIsoPSet.
addParameter<
double>(
"regionPhiMargin", 0.4);
190 jetPSet.addParameter<
double>(
"minEt", 200);
191 jetPSet.addParameter<
double>(
"maxEt", 999);
192 jetPSet.addParameter<
double>(
"regionEtaMargin", 0.4);
193 jetPSet.addParameter<
double>(
"regionPhiMargin", 0.5);
199 l1InputRegionDesc.
add<
double>(
"minEt");
200 l1InputRegionDesc.
add<
double>(
"maxEt");
201 l1InputRegionDesc.
add<
double>(
"regionEtaMargin");
202 l1InputRegionDesc.
add<
double>(
"regionPhiMargin");
209 template <
typename RecHitType>
212 auto const& caloGeom =
setup.getData(caloGeometryToken_);
214 std::vector<RectangularEtaPhiRegion>
regions;
215 std::for_each(l1RegionData_.begin(),
221 for (
size_t recHitCollNr = 0; recHitCollNr < recHitTokens_.size(); recHitCollNr++) {
223 event.getByToken(recHitTokens_[recHitCollNr],
recHits);
227 <<
" named " << recHitLabels_[recHitCollNr].encode() << std::endl;
231 auto filteredRecHits = std::make_unique<RecHitCollectionType>();
239 if (
region.inRegion(this_cell->etaPos(), this_cell->phiPos())) {
240 filteredRecHits->push_back(
recHit);
248 event.put(
std::move(filteredRecHits), productLabels_[recHitCollNr]);
252 template <
typename RecHitType>
255 if (
type ==
"L1EmParticle") {
257 }
else if (
type ==
"L1JetParticle") {
259 }
else if (
type ==
"L1MuonParticle") {
261 }
else if (
type ==
"EGamma") {
263 }
else if (
type ==
"Jet") {
265 }
else if (
type ==
"Muon") {
267 }
else if (
type ==
"Tau") {
273 <<
" is not recognised, this means the rec-hit you think you are keeping may not be and you should fix this " 274 "error as it can lead to hard to find efficiency loses" 279 template <
typename L1CollType>
282 template <
typename L1CollType>
285 std::vector<RectangularEtaPhiRegion>&
regions)
const {
287 event.getByToken(token_, l1Cands);
289 for (
auto l1CandIt = beginIt(*l1Cands); l1CandIt != endIt(*l1Cands); ++l1CandIt) {
290 if (l1CandIt->et() >= minEt_ && l1CandIt->et() < maxEt_) {
291 double etaLow = l1CandIt->eta() - regionEtaMargin_;
292 double etaHigh = l1CandIt->eta() + regionEtaMargin_;
293 double phiLow = l1CandIt->phi() - regionPhiMargin_;
294 double phiHigh = l1CandIt->phi() + regionPhiMargin_;
303 l1CaloGeometryToken_ = consumesColl.
esConsumes();
310 event.getByToken(token_, l1Cands);
312 auto const& l1CaloGeom =
setup.getData(l1CaloGeometryToken_);
314 for (
const auto& l1Cand : *l1Cands) {
315 if (l1Cand.et() >= minEt_ && l1Cand.et() < maxEt_) {
317 int etaIndex = l1Cand.gctJetCand()->etaIndex();
318 int phiIndex = l1Cand.gctJetCand()->phiIndex();
321 double etaLow = l1CaloGeom.etaBinLowEdge(etaIndex);
322 double etaHigh = l1CaloGeom.etaBinHighEdge(etaIndex);
323 double phiLow = l1CaloGeom.emJetPhiBinLowEdge(phiIndex);
324 double phiHigh = l1CaloGeom.emJetPhiBinHighEdge(phiIndex);
326 etaLow -= regionEtaMargin_;
327 etaHigh += regionEtaMargin_;
328 phiLow -= regionPhiMargin_;
329 phiHigh += regionPhiMargin_;
338 l1CaloGeometryToken_ = consumesColl.
esConsumes();
345 event.getByToken(token_, l1Cands);
347 auto const& l1CaloGeom =
setup.getData(l1CaloGeometryToken_);
349 for (
const auto& l1Cand : *l1Cands) {
350 if (l1Cand.et() >= minEt_ && l1Cand.et() < maxEt_) {
352 int etaIndex = l1Cand.gctEmCand()->etaIndex();
353 int phiIndex = l1Cand.gctEmCand()->phiIndex();
356 double etaLow = l1CaloGeom.etaBinLowEdge(etaIndex);
357 double etaHigh = l1CaloGeom.etaBinHighEdge(etaIndex);
358 double phiLow = l1CaloGeom.emJetPhiBinLowEdge(phiIndex);
359 double phiHigh = l1CaloGeom.emJetPhiBinHighEdge(phiIndex);
361 etaLow -= regionEtaMargin_;
362 etaHigh += regionEtaMargin_;
363 phiLow -= regionPhiMargin_;
364 phiHigh += regionPhiMargin_;
HLTRecHitInAllL1RegionsProducer< EcalUncalibratedRecHit > HLTEcalUncalibratedRecHitInAllL1RegionsProducer
void getEtaPhiRegions(const edm::Event &, const edm::EventSetup &, std::vector< RectangularEtaPhiRegion > &) const override
void eventSetupConsumes(edm::ConsumesCollector &consumesColl)
std::vector< std::unique_ptr< L1RegionDataBase > > l1RegionData_
constexpr SubDetector subDetGeom[21]
double const regionPhiMargin_
void produce(edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
L1RegionData(const edm::ParameterSet ¶, edm::ConsumesCollector &consumesColl)
virtual ~L1RegionDataBase()
static BXVector< T2 >::const_iterator beginIt(const BXVector< T2 > &coll)
HLTRecHitInAllL1RegionsProducer(const edm::ParameterSet &ps)
std::string defaultModuleLabel()
std::vector< edm::InputTag > recHitLabels_
Log< level::Error, false > LogError
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
static std::string const input
const_iterator begin(int bx) const
std::vector< std::string > productLabels_
HLTRecHitInAllL1RegionsProducer< EcalRecHit > HLTEcalRecHitInAllL1RegionsProducer
void addParameter(std::string const &name, T const &value)
#define DEFINE_FWK_MODULE(type)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static T2::const_iterator endIt(const T2 &coll)
edm::EDGetTokenT< T1 > const token_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~HLTRecHitInAllL1RegionsProducer() override
const_iterator end(int bx) const
virtual void getEtaPhiRegions(const edm::Event &, const edm::EventSetup &, std::vector< RectangularEtaPhiRegion > &) const =0
static BXVector< T2 >::const_iterator endIt(const BXVector< T2 > &coll)
static T2::const_iterator beginIt(const T2 &coll)
std::vector< edm::EDGetTokenT< RecHitCollectionType > > recHitTokens_
double const regionEtaMargin_
L1RegionDataBase * createL1RegionData(const std::string &, const edm::ParameterSet &, edm::ConsumesCollector &&)
edm::ESGetToken< L1CaloGeometry, L1CaloGeometryRecord > l1CaloGeometryToken_