69 template <
typename T1>
102 std::vector<edm::EDGetTokenT<EcalRecHitCollection>>
hitTokens;
109 template <
typename T1>
111 : useUncalib_(ps.getParameter<
bool>(
"useUncalib")),
112 doIsolated_(ps.getParameter<
bool>(
"doIsolated")),
116 l1LowerThr_(ps.getParameter<double>(
"l1LowerThr")),
117 l1UpperThr_(ps.getParameter<double>(
"l1UpperThr")),
118 l1LowerThrIgnoreIsolation_(ps.getParameter<double>(
"l1LowerThrIgnoreIsolation")),
119 regionEtaMargin_(ps.getParameter<double>(
"regionEtaMargin")),
120 regionPhiMargin_(ps.getParameter<double>(
"regionPhiMargin")),
144 template <
typename T1>
149 template <
typename T1>
152 std::vector<std::string> productTags;
153 productTags.push_back(
"EcalRegionalRecHitsEB");
154 productTags.push_back(
"EcalRegionalRecHitsEE");
155 desc.add<std::vector<std::string>>(
"productLabels", productTags);
160 desc.add<std::vector<edm::InputTag>>(
"ecalhitLabels",
inputTags);
163 desc.add<
bool>(
"useUncalib",
true);
164 desc.add<
bool>(
"doIsolated",
true);
165 desc.add<
double>(
"l1LowerThr", 5.0);
166 desc.add<
double>(
"l1UpperThr", 999.);
167 desc.add<
double>(
"l1LowerThrIgnoreIsolation", 0.0);
168 desc.add<
double>(
"regionEtaMargin", 0.14);
169 desc.add<
double>(
"regionPhiMargin", 0.4);
173 template <
typename T1>
178 std::unique_ptr<const CaloSubdetectorTopology>
topology;
186 std::vector<RectangularEtaPhiRegion>
regions;
190 if (!doIsolated_
or (l1LowerThrIgnoreIsolation_ < 64))
195 for (
unsigned int i = 0;
i < hitLabels.size();
i++) {
196 auto uhits = std::make_unique<EcalUncalibratedRecHitCollection>();
200 edm::LogError(
"ProductNotFound") <<
"could not get a handle on the EcalRecHitCollection! (" 201 << hitLabels[
i].encode() <<
")" << std::endl;
206 if (!uncalibRecHits->
empty()) {
207 if ((*uncalibRecHits)[0].id().subdetId() ==
EcalBarrel) {
210 }
else if ((*uncalibRecHits)[0].id().subdetId() ==
EcalEndcap) {
213 }
else if ((*uncalibRecHits)[0].id().subdetId() ==
EcalPreshower) {
215 topology = std::make_unique<EcalPreshowerTopology>();
217 throw(std::runtime_error(
"\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
222 for (
it = uncalibRecHits->
begin();
it != uncalibRecHits->
end();
it++) {
225 std::vector<RectangularEtaPhiRegion>::const_iterator
region;
227 if (
region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
228 uhits->push_back(*
it);
240 for (
unsigned int i = 0;
i < hitLabels.size();
i++) {
241 auto hits = std::make_unique<EcalRecHitCollection>();
245 edm::LogError(
"ProductNotFound") <<
"could not get a handle on the EcalRecHitCollection! (" 246 << hitLabels[
i].encode() <<
")" << std::endl;
260 topology = std::make_unique<EcalPreshowerTopology>();
262 throw(std::runtime_error(
"\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
269 std::vector<RectangularEtaPhiRegion>::const_iterator
region;
271 if (
region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
286 std::vector<RectangularEtaPhiRegion>* theRegions,
289 bool const isolatedCase) {
290 auto const& l1CaloGeom =
eventSetup.getData(l1CaloGeometryToken_);
292 for (
unsigned int candItr = 0; candItr < theCandidateCollection.size(); candItr++) {
296 if (doIsolated_ and (emItr.
et() < l1LowerThrIgnoreIsolation_))
300 if ((emItr.
et() > l1LowerThr_) and (emItr.
et() < l1UpperThr_)) {
306 double etaLow = l1CaloGeom.etaBinLowEdge(etaIndex);
307 double etaHigh = l1CaloGeom.etaBinHighEdge(etaIndex);
308 double phiLow = l1CaloGeom.emJetPhiBinLowEdge(phiIndex);
309 double phiHigh = l1CaloGeom.emJetPhiBinHighEdge(phiIndex);
311 etaLow -= regionEtaMargin_;
312 etaHigh += regionEtaMargin_;
313 phiLow -= regionPhiMargin_;
314 phiHigh += regionPhiMargin_;
321 template <
typename T1>
326 for (
unsigned int candItr = 0; candItr < theCandidateCollection.size(); candItr++) {
327 const T1& emItr = theCandidateCollection.at(candItr);
328 if ((emItr.et() > l1LowerThr_) and (emItr.et() < l1UpperThr_)) {
329 double etaLow = emItr.eta() - regionEtaMargin_;
330 double etaHigh = emItr.eta() + regionEtaMargin_;
331 double phiLow = emItr.phi() - regionPhiMargin_;
332 double phiHigh = emItr.phi() + regionPhiMargin_;
unsigned etaIndex() const override
get eta index -6 to -0, +0 to +6 (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
HLTRechitInRegionsProducer(const edm::ParameterSet &ps)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< T1 > T1Collection
HLTRechitInRegionsProducer< reco::RecoChargedCandidate > MuonHLTRechitInRegionsProducer
bool get(ProductID const &oid, Handle< PROD > &result) const
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
const std::vector< edm::InputTag > hitLabels
HLTRechitInRegionsProducer< l1extra::L1EmParticle > EgammaHLTRechitInRegionsProducer
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
T const * product() const
const std::vector< std::string > productLabels
std::vector< T >::const_iterator const_iterator
const edm::EDGetTokenT< T1Collection > l1TokenIsolated_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::string defaultModuleLabel()
~HLTRechitInRegionsProducer() override=default
T1::const_iterator T1iterator
Log< level::Error, false > LogError
void eventSetupConsumes()
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
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
const L1GctEmCand * gctEmCand() const
#define DEFINE_FWK_MODULE(type)
const_iterator begin() const
void produce(edm::Event &, edm::EventSetup const &) override
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const_iterator end() const
inputTags
All input tags are specified in this pset for convenience.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::ESGetToken< L1CaloGeometry, L1CaloGeometryRecord > l1CaloGeometryToken_
double et() const final
transverse energy
const double regionEtaMargin_
const double regionPhiMargin_
const edm::EDGetTokenT< T1Collection > l1TokenNonIsolated_
unsigned phiIndex() const override
get phi index (0-17)
const double l1LowerThrIgnoreIsolation_
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens
void getEtaPhiRegions(std::vector< RectangularEtaPhiRegion > *, T1Collection const &, edm::EventSetup const &, bool const)