71 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")),
113 l1TokenIsolated_(doIsolated_ ? consumes<
T1Collection>(ps.getParameter<edm::
InputTag>(
"l1TagIsolated"))
115 l1TokenNonIsolated_(consumes<
T1Collection>(ps.getParameter<edm::
InputTag>(
"l1TagNonIsolated"))),
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")),
121 hitLabels(ps.getParameter<std::
vector<edm::
InputTag>>(
"ecalhitLabels")),
126 for (
unsigned int i = 0;
i < hitLabels.size();
i++) {
127 uncalibHitTokens.push_back(consumes<EcalUncalibratedRecHitCollection>(hitLabels[
i]));
131 for (
unsigned int i = 0;
i < hitLabels.size();
i++) {
132 hitTokens.push_back(consumes<EcalRecHitCollection>(hitLabels[
i]));
138 template <
typename T1>
141 template <
typename T1>
144 std::vector<std::string> productTags;
145 productTags.push_back(
"EcalRegionalRecHitsEB");
146 productTags.push_back(
"EcalRegionalRecHitsEE");
147 desc.
add<std::vector<std::string>>(
"productLabels", productTags);
148 std::vector<edm::InputTag> inputTags;
149 inputTags.push_back(
edm::InputTag(
"hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
150 inputTags.push_back(
edm::InputTag(
"hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
151 inputTags.push_back(
edm::InputTag(
"hltESRegionalEgammaRecHit:EcalRecHitsES"));
152 desc.
add<std::vector<edm::InputTag>>(
"ecalhitLabels", inputTags);
155 desc.
add<
bool>(
"useUncalib",
true);
156 desc.
add<
bool>(
"doIsolated",
true);
157 desc.
add<
double>(
"l1LowerThr", 5.0);
158 desc.
add<
double>(
"l1UpperThr", 999.);
159 desc.
add<
double>(
"l1LowerThrIgnoreIsolation", 0.0);
160 desc.
add<
double>(
"regionEtaMargin", 0.14);
161 desc.
add<
double>(
"regionPhiMargin", 0.4);
165 template <
typename T1>
170 std::unique_ptr<const CaloSubdetectorTopology> topology;
179 auto const& l1CaloGeom = eventSetup.
getData(l1CaloGeometryToken_);
181 std::vector<RectangularEtaPhiRegion>
regions;
183 getEtaPhiRegions(®ions, *emIsolColl, l1CaloGeom,
true);
185 if (!doIsolated_
or (l1LowerThrIgnoreIsolation_ < 64))
186 getEtaPhiRegions(®ions, evt.
get(l1TokenNonIsolated_), l1CaloGeom,
false);
190 for (
unsigned int i = 0;
i < hitLabels.size();
i++) {
191 auto uhits = std::make_unique<EcalUncalibratedRecHitCollection>();
195 edm::LogError(
"ProductNotFound") <<
"could not get a handle on the EcalRecHitCollection! ("
196 << hitLabels[
i].encode() <<
")" << std::endl;
201 if (!uncalibRecHits->
empty()) {
202 if ((*uncalibRecHits)[0].id().subdetId() ==
EcalBarrel) {
204 topology = std::make_unique<EcalBarrelTopology>(
geometry);
205 }
else if ((*uncalibRecHits)[0].id().subdetId() ==
EcalEndcap) {
207 topology = std::make_unique<EcalEndcapTopology>(
geometry);
208 }
else if ((*uncalibRecHits)[0].id().subdetId() ==
EcalPreshower) {
210 topology = std::make_unique<EcalPreshowerTopology>();
212 throw(std::runtime_error(
"\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
214 if (!regions.empty()) {
217 for (it = uncalibRecHits->
begin(); it != uncalibRecHits->
end(); it++) {
218 auto this_cell = geometry_p->
getGeometry(it->id());
220 std::vector<RectangularEtaPhiRegion>::const_iterator
region;
221 for (region = regions.begin(); region != regions.end(); region++) {
222 if (region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
223 uhits->push_back(*it);
235 for (
unsigned int i = 0;
i < hitLabels.size();
i++) {
236 auto hits = std::make_unique<EcalRecHitCollection>();
240 edm::LogError(
"ProductNotFound") <<
"could not get a handle on the EcalRecHitCollection! ("
241 << hitLabels[
i].encode() <<
")" << std::endl;
246 if (!recHits->
empty()) {
247 if ((*recHits)[0].id().subdetId() ==
EcalBarrel) {
249 topology = std::make_unique<EcalBarrelTopology>(
geometry);
250 }
else if ((*recHits)[0].id().subdetId() ==
EcalEndcap) {
252 topology = std::make_unique<EcalEndcapTopology>(
geometry);
255 topology = std::make_unique<EcalPreshowerTopology>();
257 throw(std::runtime_error(
"\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
259 if (!regions.empty()) {
261 for (it = recHits->
begin(); it != recHits->
end(); it++) {
262 auto this_cell = geometry_p->
getGeometry(it->id());
264 std::vector<RectangularEtaPhiRegion>::const_iterator
region;
265 for (region = regions.begin(); region != regions.end(); region++) {
266 if (region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
267 hits->push_back(*it);
281 std::vector<RectangularEtaPhiRegion>* theRegions,
285 for (
unsigned int candItr = 0; candItr < theCandidateCollection.size(); candItr++) {
289 if (doIsolated_ and (emItr.
et() < l1LowerThrIgnoreIsolation_))
293 if ((emItr.
et() > l1LowerThr_) and (emItr.
et() < l1UpperThr_)) {
304 etaLow -= regionEtaMargin_;
305 etaHigh += regionEtaMargin_;
306 phiLow -= regionPhiMargin_;
307 phiHigh += regionPhiMargin_;
314 template <
typename T1>
319 for (
unsigned int candItr = 0; candItr < theCandidateCollection.size(); candItr++) {
320 T1 emItr = theCandidateCollection.at(candItr);
321 if ((emItr.et() > l1LowerThr_) and (emItr.et() < l1UpperThr_)) {
322 double etaLow = emItr.eta() - regionEtaMargin_;
323 double etaHigh = emItr.eta() + regionEtaMargin_;
324 double phiLow = emItr.phi() - regionPhiMargin_;
325 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
double etaBinHighEdge(unsigned int etaIndex, bool central=true) const
HLTRechitInRegionsProducer< reco::RecoChargedCandidate > MuonHLTRechitInRegionsProducer
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
const std::vector< edm::InputTag > hitLabels
double etaBinLowEdge(unsigned int etaIndex, bool central=true) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
HLTRechitInRegionsProducer< l1extra::L1EmParticle > EgammaHLTRechitInRegionsProducer
#define DEFINE_FWK_MODULE(type)
const std::vector< std::string > productLabels
std::vector< T >::const_iterator const_iterator
const L1GctEmCand * gctEmCand() const
const edm::EDGetTokenT< T1Collection > l1TokenIsolated_
std::string defaultModuleLabel()
T1::const_iterator T1iterator
Log< level::Error, false > LogError
bool getData(T &iHolder) const
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
bool get(ProductID const &oid, Handle< PROD > &result) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
const_iterator end() const
void produce(edm::Event &, const edm::EventSetup &) override
T const * product() const
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 edm::ESGetToken< L1CaloGeometry, L1CaloGeometryRecord > l1CaloGeometryToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void getEtaPhiRegions(std::vector< RectangularEtaPhiRegion > *, T1Collection, const L1CaloGeometry &, bool)
double et() const final
transverse energy
const double regionEtaMargin_
~HLTRechitInRegionsProducer() override
const double regionPhiMargin_
const edm::EDGetTokenT< T1Collection > l1TokenNonIsolated_
double emJetPhiBinLowEdge(unsigned int phiIndex) const
unsigned phiIndex() const override
get phi index (0-17)
const double l1LowerThrIgnoreIsolation_
const_iterator begin() const
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens
double emJetPhiBinHighEdge(unsigned int phiIndex) const