55 std::vector<RectangularEtaPhiRegion>&)
const = 0;
58 template <
typename T1>
72 :
minEt_(para.getParameter<double>(
"minEt")),
73 maxEt_(para.getParameter<double>(
"maxEt")),
76 token_(consumesColl.consumes<T1>(para.getParameter<
edm::
InputTag>(
"inputColl"))) {
82 std::vector<RectangularEtaPhiRegion>&)
const override;
83 template <
typename T2>
87 template <
typename T2>
88 static typename T2::const_iterator
beginIt(
const T2& coll) {
91 template <
typename T2>
92 static typename T2::const_iterator
endIt(
const T2& coll) {
95 template <
typename T2>
99 template <
typename T2>
101 return coll.
begin(0);
103 template <
typename T2>
109 template <
typename RecHitType>
135 template <
typename RecHitType>
139 para.getParameter<std::vector<edm::ParameterSet>>(
"l1InputRegions");
143 l1RegionData_.emplace_back(createL1RegionData(
type,
pset, consumesCollector()));
145 recHitLabels_ = para.getParameter<std::vector<edm::InputTag>>(
"recHitLabels");
146 productLabels_ = para.getParameter<std::vector<std::string>>(
"productLabels");
148 for (
unsigned int collNr = 0; collNr < recHitLabels_.size(); collNr++) {
149 recHitTokens_.push_back(consumes<RecHitCollectionType>(recHitLabels_[collNr]));
150 produces<RecHitCollectionType>(productLabels_[collNr]);
154 template <
typename RecHitType>
157 std::vector<std::string> productTags;
158 productTags.push_back(
"EcalRegionalRecHitsEB");
159 productTags.push_back(
"EcalRegionalRecHitsEE");
160 desc.add<std::vector<std::string>>(
"productLabels", productTags);
172 emIsoPSet.
addParameter<
double>(
"regionEtaMargin", 0.14);
180 emNonIsoPSet.
addParameter<
double>(
"regionEtaMargin", 0.14);
181 emNonIsoPSet.
addParameter<
double>(
"regionPhiMargin", 0.4);
199 jetPSet.addParameter<
double>(
"minEt", 200);
200 jetPSet.addParameter<
double>(
"maxEt", 999);
201 jetPSet.addParameter<
double>(
"regionEtaMargin", 0.4);
202 jetPSet.addParameter<
double>(
"regionPhiMargin", 0.5);
208 l1InputRegionDesc.
add<
double>(
"minEt");
209 l1InputRegionDesc.
add<
double>(
"maxEt");
210 l1InputRegionDesc.
add<
double>(
"regionEtaMargin");
211 l1InputRegionDesc.
add<
double>(
"regionPhiMargin");
218 template <
typename RecHitType>
221 auto const& caloGeom =
setup.getData(caloGeometryToken_);
223 std::vector<RectangularEtaPhiRegion>
regions;
224 std::for_each(l1RegionData_.begin(),
230 for (
size_t recHitCollNr = 0; recHitCollNr < recHitTokens_.size(); recHitCollNr++) {
232 event.getByToken(recHitTokens_[recHitCollNr],
recHits);
236 <<
" named " << recHitLabels_[recHitCollNr].encode() << std::endl;
240 auto filteredRecHits = std::make_unique<RecHitCollectionType>();
248 if (
region.inRegion(this_cell->etaPos(), this_cell->phiPos())) {
249 filteredRecHits->push_back(
recHit);
257 event.put(
std::move(filteredRecHits), productLabels_[recHitCollNr]);
261 template <
typename RecHitType>
264 if (
type ==
"L1EmParticle") {
266 }
else if (
type ==
"L1JetParticle") {
268 }
else if (
type ==
"L1MuonParticle") {
270 }
else if (
type ==
"EGamma") {
272 }
else if (
type ==
"Jet") {
274 }
else if (
type ==
"Muon") {
276 }
else if (
type ==
"Tau") {
282 <<
" is not recognised, this means the rec-hit you think you are keeping may not be and you should fix this " 283 "error as it can lead to hard to find efficiency loses" 288 template <
typename L1CollType>
291 template <
typename L1CollType>
294 std::vector<RectangularEtaPhiRegion>&
regions)
const {
296 event.getByToken(token_, l1Cands);
298 if (isEmpty(*l1Cands)) {
299 LogDebug(
"HLTRecHitInAllL1RegionsProducerL1RegionData")
300 <<
"The input collection of L1T candidates is empty (L1CollType = \"" 305 for (
auto l1CandIt = beginIt(*l1Cands); l1CandIt != endIt(*l1Cands); ++l1CandIt) {
306 if (l1CandIt->et() >= minEt_ && l1CandIt->et() < maxEt_) {
307 double etaLow = l1CandIt->eta() - regionEtaMargin_;
308 double etaHigh = l1CandIt->eta() + regionEtaMargin_;
309 double phiLow = l1CandIt->phi() - regionPhiMargin_;
310 double phiHigh = l1CandIt->phi() + regionPhiMargin_;
319 l1CaloGeometryToken_ = consumesColl.
esConsumes();
326 event.getByToken(token_, l1Cands);
328 auto const& l1CaloGeom =
setup.getData(l1CaloGeometryToken_);
330 for (
const auto& l1Cand : *l1Cands) {
331 if (l1Cand.et() >= minEt_ && l1Cand.et() < maxEt_) {
333 int etaIndex = l1Cand.gctJetCand()->etaIndex();
334 int phiIndex = l1Cand.gctJetCand()->phiIndex();
337 double etaLow = l1CaloGeom.etaBinLowEdge(etaIndex);
338 double etaHigh = l1CaloGeom.etaBinHighEdge(etaIndex);
339 double phiLow = l1CaloGeom.emJetPhiBinLowEdge(phiIndex);
340 double phiHigh = l1CaloGeom.emJetPhiBinHighEdge(phiIndex);
342 etaLow -= regionEtaMargin_;
343 etaHigh += regionEtaMargin_;
344 phiLow -= regionPhiMargin_;
345 phiHigh += regionPhiMargin_;
354 l1CaloGeometryToken_ = consumesColl.
esConsumes();
361 event.getByToken(token_, l1Cands);
363 auto const& l1CaloGeom =
setup.getData(l1CaloGeometryToken_);
365 for (
const auto& l1Cand : *l1Cands) {
366 if (l1Cand.et() >= minEt_ && l1Cand.et() < maxEt_) {
368 int etaIndex = l1Cand.gctEmCand()->etaIndex();
369 int phiIndex = l1Cand.gctEmCand()->phiIndex();
372 double etaLow = l1CaloGeom.etaBinLowEdge(etaIndex);
373 double etaHigh = l1CaloGeom.etaBinHighEdge(etaIndex);
374 double phiLow = l1CaloGeom.emJetPhiBinLowEdge(phiIndex);
375 double phiHigh = l1CaloGeom.emJetPhiBinHighEdge(phiIndex);
377 etaLow -= regionEtaMargin_;
378 etaHigh += regionEtaMargin_;
379 phiLow -= regionPhiMargin_;
380 phiHigh += regionPhiMargin_;
HLTRecHitInAllL1RegionsProducer< EcalUncalibratedRecHit > HLTEcalUncalibratedRecHitInAllL1RegionsProducer
void getEtaPhiRegions(const edm::Event &, const edm::EventSetup &, std::vector< RectangularEtaPhiRegion > &) const override
bool isEmpty(const T2 &coll) const
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_
bool isEmpty(int bx) const
Log< level::Error, false > LogError
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
static std::string const input
const_iterator begin(int bx) const
unsigned size(int bx) const
std::vector< std::string > productLabels_
HLTRecHitInAllL1RegionsProducer< EcalRecHit > HLTEcalRecHitInAllL1RegionsProducer
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
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_
std::string typeDemangle(char const *mangledName)
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 &&)
bool isEmpty(const BXVector< T2 > &coll) const
edm::ESGetToken< L1CaloGeometry, L1CaloGeometryRecord > l1CaloGeometryToken_