49 endcapSClusterToken_ =
58 produces<reco::PreshowerClusterCollection>(preshClusterCollectionX_);
59 produces<reco::PreshowerClusterCollection>(preshClusterCollectionY_);
60 produces<reco::SuperClusterCollection>(assocSClusterCollection_);
62 float esStripECut = ps.
getParameter<
double>(
"esStripEnergyCut");
63 esPhiClusterDeltaEta_ = ps.
getParameter<
double>(
"esPhiClusterDeltaEta");
64 esPhiClusterDeltaPhi_ = ps.
getParameter<
double>(
"esPhiClusterDeltaPhi");
88 auto clusters_p1 = std::make_unique<reco::PreshowerClusterCollection>();
89 auto clusters_p2 = std::make_unique<reco::PreshowerClusterCollection>();
91 auto superclusters_p = std::make_unique<reco::SuperClusterCollection>();
94 evt.
getByToken(endcapSClusterToken_, pSuperClusters);
102 LogTrace(
"EcalClusters") <<
"PreshowerPhiClusterProducerInfo: ### Total # of preshower RecHits: " <<
rechits->size();
105 std::map<DetId, EcalRecHit> rechits_map;
109 if (it->recoFlag() == 1 || it->recoFlag() == 14 || (it->recoFlag() <= 10 && it->recoFlag() >= 5))
112 rechits_map.insert(std::make_pair(it->id(), *it));
115 std::set<DetId> used_strips;
117 LogTrace(
"EcalClusters") <<
"PreshowerPhiClusterProducerInfo: ### rechits_map of size " << rechits_map.size()
124 reco::SuperClusterCollection::const_iterator it_super;
126 for (it_super = SClusts->begin(); it_super != SClusts->end(); ++it_super) {
133 LogTrace(
"EcalClusters") <<
" superE = " << it_super->energy() <<
" superETA = " << it_super->eta()
134 <<
" superPHI = " << it_super->phi();
147 for (; bc_iter != it_super->clustersEnd(); ++bc_iter) {
149 refPhi = (*bc_iter)->phi();
164 for (bc_iter = it_super->clustersBegin(); bc_iter != it_super->clustersEnd(); ++bc_iter) {
167 double X = (*bc_iter)->x();
168 double Y = (*bc_iter)->y();
169 double Z = (*bc_iter)->z();
172 DetId tmp1 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 1);
173 DetId tmp2 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 2);
181 if (status_p1->getStatusCode() == 1)
183 if (status_p2->getStatusCode() == 1)
185 }
else if (strip1 ==
ESDetId(0)) {
187 }
else if (strip2 ==
ESDetId(0)) {
197 clusters1.push_back(cl1);
203 cl2.setBCRef(*bc_iter);
204 clusters2.push_back(
cl2);
213 LogTrace(
"EcalClusters") <<
" For SC #" << isc - 1 <<
", containing " << it_super->clustersSize()
214 <<
" basic clusters, PreshowerPhiClusterAlgo made " << clusters1.size()
215 <<
" in X plane and " << clusters2.size() <<
" in Y plane "
216 <<
" preshower clusters ";
219 if (
e1 + e2 > 1.0
e-10) {
223 if (condP1 == 1 && condP2 == 1) {
224 deltaE = gamma0_ * (
e1 + alpha0_ * e2);
225 }
else if (condP1 == 1 && condP2 == 0) {
226 deltaE = gamma1_ * (
e1 + alpha1_ * e2);
227 }
else if (condP1 == 0 && condP2 == 1) {
228 deltaE = gamma2_ * (
e1 + alpha2_ * e2);
229 }
else if (condP1 == 0 && condP2 == 0) {
230 deltaE = gamma3_ * (
e1 + alpha3_ * e2);
235 float E = it_super->energy() +
deltaE;
237 LogTrace(
"EcalClusters") <<
" Creating corrected SC ";
241 sc.setPreshowerEnergyPlane2(e2 * mip_);
242 if (condP1 == 1 && condP2 == 1)
243 sc.setPreshowerPlanesStatus(0);
244 else if (condP1 == 1 && condP2 == 0)
245 sc.setPreshowerPlanesStatus(1);
246 else if (condP1 == 0 && condP2 == 1)
247 sc.setPreshowerPlanesStatus(2);
248 else if (condP1 == 0 && condP2 == 0)
249 sc.setPreshowerPlanesStatus(3);
252 if (sc.energy() *
sin(sc.position().theta()) > etThresh_)
253 new_SC.push_back(sc);
255 new_SC.push_back(sc);
261 clusters_p1->assign(clusters1.begin(), clusters1.end());
262 clusters_p2->assign(clusters2.begin(), clusters2.end());
264 evt.
put(
std::move(clusters_p1), preshClusterCollectionX_);
265 evt.
put(
std::move(clusters_p2), preshClusterCollectionY_);
266 LogTrace(
"EcalClusters") <<
"Preshower clusters added to the event";
269 superclusters_p->assign(new_SC.begin(), new_SC.end());
270 evt.
put(
std::move(superclusters_p), assocSClusterCollection_);
271 LogTrace(
"EcalClusters") <<
"Corrected SClusters added to the event";