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")),
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")),
123 caloGeometryToken_{esConsumes()},
124 l1CaloGeometryToken_{esConsumes()} {
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);
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(&
regions, *emIsolColl, l1CaloGeom,
true);
185 if (!doIsolated_
or (l1LowerThrIgnoreIsolation_ < 64))
186 getEtaPhiRegions(&
regions, evt.
get(l1TokenNonIsolated_), l1CaloGeom,
false);
190 for (
unsigned int i = 0;
i < hitLabels.size();
i++) {
191 auto uhits = std::make_unique<EcalUncalibratedRecHitCollection>();
194 if (!(urhcH[
i].isValid())) {
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) {
205 }
else if ((*uncalibRecHits)[0].
id().subdetId() ==
EcalEndcap) {
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"));
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;
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>();
239 if (!(rhcH[
i].isValid())) {
240 edm::LogError(
"ProductNotFound") <<
"could not get a handle on the EcalRecHitCollection! ("
241 << hitLabels[
i].encode() <<
")" << std::endl;
255 topology = std::make_unique<EcalPreshowerTopology>();
257 throw(std::runtime_error(
"\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
262 auto this_cell = geometry_p->
getGeometry(it->id());
264 std::vector<RectangularEtaPhiRegion>::const_iterator
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_;
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_;