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>();
132 produces<reco::PreshowerClusterCollection>(preshClusterCollectionX_);
133 produces<reco::PreshowerClusterCollection>(preshClusterCollectionY_);
134 produces<reco::SuperClusterCollection>(assocSClusterCollection_);
136 float esStripECut = ps.
getParameter<
double>(
"esStripEnergyCut");
137 esPhiClusterDeltaEta_ = ps.
getParameter<
double>(
"esPhiClusterDeltaEta");
138 esPhiClusterDeltaPhi_ = ps.
getParameter<
double>(
"esPhiClusterDeltaPhi");
161 auto clusters_p1 = std::make_unique<reco::PreshowerClusterCollection>();
162 auto clusters_p2 = std::make_unique<reco::PreshowerClusterCollection>();
164 auto superclusters_p = std::make_unique<reco::SuperClusterCollection>();
167 evt.
getByToken(endcapSClusterToken_, pSuperClusters);
175 LogTrace(
"EcalClusters") <<
"PreshowerPhiClusterProducerInfo: ### Total # of preshower RecHits: " <<
rechits->size();
178 std::map<DetId, EcalRecHit> rechits_map;
182 if (it->recoFlag() == 1 || it->recoFlag() == 14 || (it->recoFlag() <= 10 && it->recoFlag() >= 5))
185 rechits_map.insert(std::make_pair(it->id(), *it));
188 std::set<DetId> used_strips;
190 LogTrace(
"EcalClusters") <<
"PreshowerPhiClusterProducerInfo: ### rechits_map of size " << rechits_map.size()
197 reco::SuperClusterCollection::const_iterator it_super;
199 for (it_super = SClusts->begin(); it_super != SClusts->end(); ++it_super) {
206 LogTrace(
"EcalClusters") <<
" superE = " << it_super->energy() <<
" superETA = " << it_super->eta()
207 <<
" superPHI = " << it_super->phi();
220 for (; bc_iter != it_super->clustersEnd(); ++bc_iter) {
222 refPhi = (*bc_iter)->phi();
237 for (bc_iter = it_super->clustersBegin(); bc_iter != it_super->clustersEnd(); ++bc_iter) {
240 double X = (*bc_iter)->x();
241 double Y = (*bc_iter)->y();
242 double Z = (*bc_iter)->z();
245 DetId tmp1 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 1);
246 DetId tmp2 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 2);
254 if (status_p1->getStatusCode() == 1)
256 if (status_p2->getStatusCode() == 1)
258 }
else if (strip1 ==
ESDetId(0)) {
260 }
else if (strip2 ==
ESDetId(0)) {
270 clusters1.push_back(cl1);
276 cl2.setBCRef(*bc_iter);
277 clusters2.push_back(
cl2);
286 LogTrace(
"EcalClusters") <<
" For SC #" << isc - 1 <<
", containing " << it_super->clustersSize()
287 <<
" basic clusters, PreshowerPhiClusterAlgo made " << clusters1.size()
288 <<
" in X plane and " << clusters2.size() <<
" in Y plane "
289 <<
" preshower clusters ";
292 if (
e1 + e2 > 1.0
e-10) {
296 if (condP1 == 1 && condP2 == 1) {
297 deltaE = gamma0_ * (
e1 + alpha0_ * e2);
298 }
else if (condP1 == 1 && condP2 == 0) {
299 deltaE = gamma1_ * (
e1 + alpha1_ * e2);
300 }
else if (condP1 == 0 && condP2 == 1) {
301 deltaE = gamma2_ * (
e1 + alpha2_ * e2);
302 }
else if (condP1 == 0 && condP2 == 0) {
303 deltaE = gamma3_ * (
e1 + alpha3_ * e2);
308 float E = it_super->energy() +
deltaE;
310 LogTrace(
"EcalClusters") <<
" Creating corrected SC ";
314 sc.setPreshowerEnergyPlane2(e2 * mip_);
315 if (condP1 == 1 && condP2 == 1)
316 sc.setPreshowerPlanesStatus(0);
317 else if (condP1 == 1 && condP2 == 0)
318 sc.setPreshowerPlanesStatus(1);
319 else if (condP1 == 0 && condP2 == 1)
320 sc.setPreshowerPlanesStatus(2);
321 else if (condP1 == 0 && condP2 == 0)
322 sc.setPreshowerPlanesStatus(3);
325 if (sc.energy() *
sin(sc.position().theta()) > etThresh_)
326 new_SC.push_back(sc);
328 new_SC.push_back(sc);
334 clusters_p1->assign(clusters1.begin(), clusters1.end());
335 clusters_p2->assign(clusters2.begin(), clusters2.end());
337 evt.
put(
std::move(clusters_p1), preshClusterCollectionX_);
338 evt.
put(
std::move(clusters_p2), preshClusterCollectionY_);
339 LogTrace(
"EcalClusters") <<
"Preshower clusters added to the event";
342 superclusters_p->assign(new_SC.begin(), new_SC.end());
343 evt.
put(
std::move(superclusters_p), assocSClusterCollection_);
344 LogTrace(
"EcalClusters") <<
"Corrected SClusters added to the event";
353 esMIPToGeV_ = es.
getHandle(esMIPToGeVToken_);
358 esChannelStatus_ = es.
getHandle(esChannelStatusToken_);
360 esEEInterCalib_ = es.
getHandle(esEEInterCalibToken_);
379 esMissingECalib_ = es.
getHandle(esMissingECalibToken_);