116 endcapSClusterToken_ =
119 esGainToken_ = esConsumes<ESGain, ESGainRcd>();
120 esMIPToGeVToken_ = esConsumes<ESMIPToGeVConstant, ESMIPToGeVConstantRcd>();
121 esEEInterCalibToken_ = esConsumes<ESEEIntercalibConstants, ESEEIntercalibConstantsRcd>();
122 esMissingECalibToken_ = esConsumes<ESMissingEnergyCalibration, ESMissingEnergyCalibrationRcd>();
123 esChannelStatusToken_ = esConsumes<ESChannelStatus, ESChannelStatusRcd>();
124 caloGeometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
135 produces<reco::PreshowerClusterCollection>(preshClusterCollectionX_);
136 produces<reco::PreshowerClusterCollection>(preshClusterCollectionY_);
137 produces<reco::SuperClusterCollection>(assocSClusterCollection_);
139 float preshStripECut = ps.
getParameter<
double>(
"preshStripEnergyCut");
140 int preshSeededNst = ps.
getParameter<
int>(
"preshSeededNstrip");
141 preshClustECut = ps.
getParameter<
double>(
"preshClusterEnergyCut");
164 auto clusters_p1 = std::make_unique<reco::PreshowerClusterCollection>();
165 auto clusters_p2 = std::make_unique<reco::PreshowerClusterCollection>();
167 auto superclusters_p = std::make_unique<reco::SuperClusterCollection>();
169 std::unique_ptr<CaloSubdetectorTopology> topology_p;
171 topology_p = std::make_unique<EcalPreshowerTopology>();
174 evt.
getByToken(endcapSClusterToken_, pSuperClusters);
182 LogTrace(
"EcalClusters") <<
"PreshowerClusterProducerInfo: ### Total # of preshower RecHits: " <<
rechits->size();
185 std::map<DetId, EcalRecHit> rechits_map;
189 if (it->recoFlag() == 1 || it->recoFlag() == 14 || (it->recoFlag() <= 10 && it->recoFlag() >= 5))
192 rechits_map.insert(std::make_pair(it->id(), *it));
195 std::set<DetId> used_strips;
197 LogTrace(
"EcalClusters") <<
"PreshowerClusterProducerInfo: ### rechits_map of size " << rechits_map.size()
204 reco::SuperClusterCollection::const_iterator it_super;
206 for (it_super = SClusts->begin(); it_super != SClusts->end(); ++it_super) {
213 LogTrace(
"EcalClusters") <<
" superE = " << it_super->energy() <<
" superETA = " << it_super->eta()
214 <<
" superPHI = " << it_super->phi();
220 for (; bc_iter != it_super->clustersEnd(); ++bc_iter) {
223 double X = (*bc_iter)->x();
224 double Y = (*bc_iter)->y();
225 double Z = (*bc_iter)->z();
228 DetId tmp1 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 1);
229 DetId tmp2 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 2);
237 if (status_p1->getStatusCode() == 1)
239 if (status_p2->getStatusCode() == 1)
241 }
else if (strip1 ==
ESDetId(0))
248 for (
int i = 0;
i < preshNclust_;
i++) {
250 presh_algo->makeOneCluster(strip1, &used_strips, &rechits_map, geometry_p, topology_p.get());
252 if (cl1.
energy() > preshClustECut) {
253 clusters1.push_back(cl1);
257 presh_algo->makeOneCluster(strip2, &used_strips, &rechits_map, geometry_p, topology_p.get());
258 cl2.setBCRef(*bc_iter);
260 if (
cl2.energy() > preshClustECut) {
261 clusters2.push_back(
cl2);
271 LogTrace(
"EcalClusters") <<
" For SC #" << isc - 1 <<
", containing " << it_super->clustersSize()
272 <<
" basic clusters, PreshowerClusterAlgo made " << clusters1.size() <<
" in X plane and "
273 << clusters2.size() <<
" in Y plane "
274 <<
" preshower clusters ";
277 if (
e1 + e2 > 1.0
e-10) {
281 if (condP1 == 1 && condP2 == 1) {
282 deltaE = gamma0_ * (
e1 + alpha0_ * e2);
283 }
else if (condP1 == 1 && condP2 == 0) {
284 deltaE = gamma1_ * (
e1 + alpha1_ * e2);
285 }
else if (condP1 == 0 && condP2 == 1) {
286 deltaE = gamma2_ * (
e1 + alpha2_ * e2);
287 }
else if (condP1 == 0 && condP2 == 0) {
288 deltaE = gamma3_ * (
e1 + alpha3_ * e2);
293 float E = it_super->energy() +
deltaE;
295 LogTrace(
"EcalClusters") <<
" Creating corrected SC ";
298 if (condP1 == 1 && condP2 == 1)
300 else if (condP1 == 1 && condP2 == 0)
301 sc.setPreshowerPlanesStatus(1);
302 else if (condP1 == 0 && condP2 == 1)
303 sc.setPreshowerPlanesStatus(2);
304 else if (condP1 == 0 && condP2 == 0)
305 sc.setPreshowerPlanesStatus(3);
307 if (sc.energy() *
sin(sc.position().theta()) > etThresh_)
308 new_SC.push_back(sc);
309 LogTrace(
"EcalClusters") <<
" SuperClusters energies: new E = " << sc.energy()
310 <<
" vs. old E =" << it_super->energy();
315 clusters_p1->assign(clusters1.begin(), clusters1.end());
316 clusters_p2->assign(clusters2.begin(), clusters2.end());
318 evt.
put(
std::move(clusters_p1), preshClusterCollectionX_);
319 evt.
put(
std::move(clusters_p2), preshClusterCollectionY_);
320 LogTrace(
"EcalClusters") <<
"Preshower clusters added to the event";
323 superclusters_p->assign(new_SC.begin(), new_SC.end());
324 evt.
put(
std::move(superclusters_p), assocSClusterCollection_);
325 LogTrace(
"EcalClusters") <<
"Corrected SClusters added to the event";
336 esMIPToGeV_ = es.
getHandle(esMIPToGeVToken_);
341 esChannelStatus_ = es.
getHandle(esChannelStatusToken_);
343 esEEInterCalib_ = es.
getHandle(esEEInterCalibToken_);
362 esMissingECalib_ = es.
getHandle(esMissingECalibToken_);