71 template <
typename T1>
102 std::vector<edm::EDGetTokenT<EcalRecHitCollection>>
hitTokens;
106 template <
typename T1>
108 : useUncalib_(ps.getParameter<
bool>(
"useUncalib")),
109 doIsolated_(ps.getParameter<
bool>(
"doIsolated")),
113 l1LowerThr_(ps.getParameter<double>(
"l1LowerThr")),
114 l1UpperThr_(ps.getParameter<double>(
"l1UpperThr")),
115 l1LowerThrIgnoreIsolation_(ps.getParameter<double>(
"l1LowerThrIgnoreIsolation")),
116 regionEtaMargin_(ps.getParameter<double>(
"regionEtaMargin")),
117 regionPhiMargin_(ps.getParameter<double>(
"regionPhiMargin")),
118 hitLabels(ps.getParameter<
std::vector<
edm::
InputTag>>(
"ecalhitLabels")),
133 template <
typename T1>
136 template <
typename T1>
139 std::vector<std::string> productTags;
140 productTags.push_back(
"EcalRegionalRecHitsEB");
141 productTags.push_back(
"EcalRegionalRecHitsEE");
142 desc.
add<std::vector<std::string>>(
"productLabels", productTags);
147 desc.
add<std::vector<edm::InputTag>>(
"ecalhitLabels",
inputTags);
150 desc.
add<
bool>(
"useUncalib",
true);
151 desc.
add<
bool>(
"doIsolated",
true);
152 desc.
add<
double>(
"l1LowerThr", 5.0);
153 desc.
add<
double>(
"l1UpperThr", 999.);
154 desc.
add<
double>(
"l1LowerThrIgnoreIsolation", 0.0);
155 desc.
add<
double>(
"regionEtaMargin", 0.14);
156 desc.
add<
double>(
"regionPhiMargin", 0.4);
160 template <
typename T1>
167 std::unique_ptr<const CaloSubdetectorTopology>
topology;
177 evt.
getByToken(l1TokenNonIsolated_, emNonIsolColl);
183 std::vector<RectangularEtaPhiRegion>
regions;
185 getEtaPhiRegions(&
regions, *emIsolColl, *l1CaloGeom,
true);
187 if (!doIsolated_
or (l1LowerThrIgnoreIsolation_ < 64))
188 getEtaPhiRegions(&
regions, *emNonIsolColl, *l1CaloGeom,
false);
192 for (
unsigned int i = 0;
i < hitLabels.size();
i++) {
193 auto uhits = std::make_unique<EcalUncalibratedRecHitCollection>();
196 if (!(urhcH[
i].isValid())) {
197 edm::LogError(
"ProductNotFound") <<
"could not get a handle on the EcalRecHitCollection! ("
198 << hitLabels[
i].encode() <<
")" << std::endl;
203 if (!uncalibRecHits->
empty()) {
204 if ((*uncalibRecHits)[0].id().subdetId() ==
EcalBarrel) {
206 topology = std::make_unique<EcalBarrelTopology>(*geoHandle);
207 }
else if ((*uncalibRecHits)[0].
id().subdetId() ==
EcalEndcap) {
209 topology = std::make_unique<EcalEndcapTopology>(*geoHandle);
210 }
else if ((*uncalibRecHits)[0].
id().subdetId() ==
EcalPreshower) {
212 topology = std::make_unique<EcalPreshowerTopology>();
214 throw(std::runtime_error(
"\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
219 for (it = uncalibRecHits->
begin(); it != uncalibRecHits->
end(); it++) {
220 auto this_cell = geometry_p->
getGeometry(it->id());
222 std::vector<RectangularEtaPhiRegion>::const_iterator
region;
224 if (
region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
225 uhits->push_back(*it);
237 for (
unsigned int i = 0;
i < hitLabels.size();
i++) {
238 auto hits = std::make_unique<EcalRecHitCollection>();
241 if (!(rhcH[
i].isValid())) {
242 edm::LogError(
"ProductNotFound") <<
"could not get a handle on the EcalRecHitCollection! ("
243 << hitLabels[
i].encode() <<
")" << std::endl;
251 topology = std::make_unique<EcalBarrelTopology>(*geoHandle);
254 topology = std::make_unique<EcalEndcapTopology>(*geoHandle);
257 topology = std::make_unique<EcalPreshowerTopology>();
259 throw(std::runtime_error(
"\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
264 auto this_cell = geometry_p->
getGeometry(it->id());
266 std::vector<RectangularEtaPhiRegion>::const_iterator
region;
268 if (
region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
269 hits->push_back(*it);
283 std::vector<RectangularEtaPhiRegion>* theRegions,
287 for (
unsigned int candItr = 0; candItr < theCandidateCollection.size(); candItr++) {
291 if (doIsolated_ and (emItr.
et() < l1LowerThrIgnoreIsolation_))
295 if ((emItr.
et() > l1LowerThr_) and (emItr.
et() < l1UpperThr_)) {
306 etaLow -= regionEtaMargin_;
307 etaHigh += regionEtaMargin_;
308 phiLow -= regionPhiMargin_;
309 phiHigh += regionPhiMargin_;
316 template <
typename T1>
321 for (
unsigned int candItr = 0; candItr < theCandidateCollection.size(); candItr++) {
322 T1 emItr = theCandidateCollection.at(candItr);
323 if ((emItr.et() > l1LowerThr_) and (emItr.et() < l1UpperThr_)) {
324 double etaLow = emItr.eta() - regionEtaMargin_;
325 double etaHigh = emItr.eta() + regionEtaMargin_;
326 double phiLow = emItr.phi() - regionPhiMargin_;
327 double phiHigh = emItr.phi() + regionPhiMargin_;