42 endcapSClusterToken_ =
45 esGainToken_ = esConsumes<ESGain, ESGainRcd>();
46 esMIPToGeVToken_ = esConsumes<ESMIPToGeVConstant, ESMIPToGeVConstantRcd>();
47 esEEInterCalibToken_ = esConsumes<ESEEIntercalibConstants, ESEEIntercalibConstantsRcd>();
48 esMissingECalibToken_ = esConsumes<ESMissingEnergyCalibration, ESMissingEnergyCalibrationRcd>();
49 esChannelStatusToken_ = esConsumes<ESChannelStatus, ESChannelStatusRcd>();
50 caloGeometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
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");
87 auto clusters_p1 = std::make_unique<reco::PreshowerClusterCollection>();
88 auto clusters_p2 = std::make_unique<reco::PreshowerClusterCollection>();
90 auto superclusters_p = std::make_unique<reco::SuperClusterCollection>();
93 evt.
getByToken(endcapSClusterToken_, pSuperClusters);
101 LogTrace(
"EcalClusters") <<
"PreshowerPhiClusterProducerInfo: ### Total # of preshower RecHits: " <<
rechits->size();
104 std::map<DetId, EcalRecHit> rechits_map;
108 if (it->recoFlag() == 1 || it->recoFlag() == 14 || (it->recoFlag() <= 10 && it->recoFlag() >= 5))
111 rechits_map.insert(std::make_pair(it->id(), *it));
114 std::set<DetId> used_strips;
116 LogTrace(
"EcalClusters") <<
"PreshowerPhiClusterProducerInfo: ### rechits_map of size " << rechits_map.size()
123 reco::SuperClusterCollection::const_iterator it_super;
125 for (it_super = SClusts->begin(); it_super != SClusts->end(); ++it_super) {
132 LogTrace(
"EcalClusters") <<
" superE = " << it_super->energy() <<
" superETA = " << it_super->eta()
133 <<
" superPHI = " << it_super->phi();
146 for (; bc_iter != it_super->clustersEnd(); ++bc_iter) {
148 refPhi = (*bc_iter)->phi();
163 for (bc_iter = it_super->clustersBegin(); bc_iter != it_super->clustersEnd(); ++bc_iter) {
166 double X = (*bc_iter)->x();
167 double Y = (*bc_iter)->y();
168 double Z = (*bc_iter)->z();
171 DetId tmp1 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 1);
172 DetId tmp2 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 2);
180 if (status_p1->getStatusCode() == 1)
182 if (status_p2->getStatusCode() == 1)
184 }
else if (strip1 ==
ESDetId(0)) {
186 }
else if (strip2 ==
ESDetId(0)) {
196 clusters1.push_back(cl1);
202 cl2.setBCRef(*bc_iter);
203 clusters2.push_back(
cl2);
212 LogTrace(
"EcalClusters") <<
" For SC #" << isc - 1 <<
", containing " << it_super->clustersSize()
213 <<
" basic clusters, PreshowerPhiClusterAlgo made " << clusters1.size()
214 <<
" in X plane and " << clusters2.size() <<
" in Y plane "
215 <<
" preshower clusters ";
218 if (
e1 + e2 > 1.0
e-10) {
222 if (condP1 == 1 && condP2 == 1) {
223 deltaE = gamma0_ * (
e1 + alpha0_ * e2);
224 }
else if (condP1 == 1 && condP2 == 0) {
225 deltaE = gamma1_ * (
e1 + alpha1_ * e2);
226 }
else if (condP1 == 0 && condP2 == 1) {
227 deltaE = gamma2_ * (
e1 + alpha2_ * e2);
228 }
else if (condP1 == 0 && condP2 == 0) {
229 deltaE = gamma3_ * (
e1 + alpha3_ * e2);
234 float E = it_super->energy() +
deltaE;
236 LogTrace(
"EcalClusters") <<
" Creating corrected SC ";
240 sc.setPreshowerEnergyPlane2(e2 * mip_);
241 if (condP1 == 1 && condP2 == 1)
242 sc.setPreshowerPlanesStatus(0);
243 else if (condP1 == 1 && condP2 == 0)
244 sc.setPreshowerPlanesStatus(1);
245 else if (condP1 == 0 && condP2 == 1)
246 sc.setPreshowerPlanesStatus(2);
247 else if (condP1 == 0 && condP2 == 0)
248 sc.setPreshowerPlanesStatus(3);
251 if (sc.energy() *
sin(sc.position().theta()) > etThresh_)
252 new_SC.push_back(sc);
254 new_SC.push_back(sc);
260 clusters_p1->assign(clusters1.begin(), clusters1.end());
261 clusters_p2->assign(clusters2.begin(), clusters2.end());
263 evt.
put(
std::move(clusters_p1), preshClusterCollectionX_);
264 evt.
put(
std::move(clusters_p2), preshClusterCollectionY_);
265 LogTrace(
"EcalClusters") <<
"Preshower clusters added to the event";
268 superclusters_p->assign(new_SC.begin(), new_SC.end());
269 evt.
put(
std::move(superclusters_p), assocSClusterCollection_);
270 LogTrace(
"EcalClusters") <<
"Corrected SClusters added to the event";
279 esMIPToGeV_ = es.
getHandle(esMIPToGeVToken_);
284 esChannelStatus_ = es.
getHandle(esChannelStatusToken_);
286 esEEInterCalib_ = es.
getHandle(esEEInterCalibToken_);
305 esMissingECalib_ = es.
getHandle(esMissingECalibToken_);