46 endcapSClusterToken_ =
49 esGainToken_ = esConsumes<ESGain, ESGainRcd>();
50 esMIPToGeVToken_ = esConsumes<ESMIPToGeVConstant, ESMIPToGeVConstantRcd>();
51 esEEInterCalibToken_ = esConsumes<ESEEIntercalibConstants, ESEEIntercalibConstantsRcd>();
52 esMissingECalibToken_ = esConsumes<ESMissingEnergyCalibration, ESMissingEnergyCalibrationRcd>();
53 esChannelStatusToken_ = esConsumes<ESChannelStatus, ESChannelStatusRcd>();
54 caloGeometryToken_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
65 produces<reco::PreshowerClusterCollection>(preshClusterCollectionX_);
66 produces<reco::PreshowerClusterCollection>(preshClusterCollectionY_);
67 produces<reco::SuperClusterCollection>(assocSClusterCollection_);
69 float preshStripECut = ps.
getParameter<
double>(
"preshStripEnergyCut");
70 int preshSeededNst = ps.
getParameter<
int>(
"preshSeededNstrip");
71 preshClustECut = ps.
getParameter<
double>(
"preshClusterEnergyCut");
94 auto clusters_p1 = std::make_unique<reco::PreshowerClusterCollection>();
95 auto clusters_p2 = std::make_unique<reco::PreshowerClusterCollection>();
97 auto superclusters_p = std::make_unique<reco::SuperClusterCollection>();
99 std::unique_ptr<CaloSubdetectorTopology> topology_p;
101 topology_p = std::make_unique<EcalPreshowerTopology>();
104 evt.
getByToken(endcapSClusterToken_, pSuperClusters);
112 LogTrace(
"EcalClusters") <<
"PreshowerClusterProducerInfo: ### Total # of preshower RecHits: " <<
rechits->size();
115 std::map<DetId, EcalRecHit> rechits_map;
119 if (it->recoFlag() == 1 || it->recoFlag() == 14 || (it->recoFlag() <= 10 && it->recoFlag() >= 5))
122 rechits_map.insert(std::make_pair(it->id(), *it));
125 std::set<DetId> used_strips;
127 LogTrace(
"EcalClusters") <<
"PreshowerClusterProducerInfo: ### rechits_map of size " << rechits_map.size()
134 reco::SuperClusterCollection::const_iterator it_super;
136 for (it_super = SClusts->begin(); it_super != SClusts->end(); ++it_super) {
143 LogTrace(
"EcalClusters") <<
" superE = " << it_super->energy() <<
" superETA = " << it_super->eta()
144 <<
" superPHI = " << it_super->phi();
150 for (; bc_iter != it_super->clustersEnd(); ++bc_iter) {
153 double X = (*bc_iter)->x();
154 double Y = (*bc_iter)->y();
155 double Z = (*bc_iter)->z();
158 DetId tmp1 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 1);
159 DetId tmp2 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_p))->getClosestCellInPlane(
point, 2);
167 if (status_p1->getStatusCode() == 1)
169 if (status_p2->getStatusCode() == 1)
171 }
else if (strip1 ==
ESDetId(0))
178 for (
int i = 0;
i < preshNclust_;
i++) {
180 presh_algo->makeOneCluster(strip1, &used_strips, &rechits_map, geometry_p, topology_p.get());
182 if (cl1.
energy() > preshClustECut) {
183 clusters1.push_back(cl1);
187 presh_algo->makeOneCluster(strip2, &used_strips, &rechits_map, geometry_p, topology_p.get());
188 cl2.setBCRef(*bc_iter);
190 if (
cl2.energy() > preshClustECut) {
191 clusters2.push_back(
cl2);
201 LogTrace(
"EcalClusters") <<
" For SC #" << isc - 1 <<
", containing " << it_super->clustersSize()
202 <<
" basic clusters, PreshowerClusterAlgo made " << clusters1.size() <<
" in X plane and "
203 << clusters2.size() <<
" in Y plane "
204 <<
" preshower clusters ";
207 if (
e1 + e2 > 1.0
e-10) {
211 if (condP1 == 1 && condP2 == 1) {
212 deltaE = gamma0_ * (
e1 + alpha0_ * e2);
213 }
else if (condP1 == 1 && condP2 == 0) {
214 deltaE = gamma1_ * (
e1 + alpha1_ * e2);
215 }
else if (condP1 == 0 && condP2 == 1) {
216 deltaE = gamma2_ * (
e1 + alpha2_ * e2);
217 }
else if (condP1 == 0 && condP2 == 0) {
218 deltaE = gamma3_ * (
e1 + alpha3_ * e2);
223 float E = it_super->energy() +
deltaE;
225 LogTrace(
"EcalClusters") <<
" Creating corrected SC ";
228 if (condP1 == 1 && condP2 == 1)
230 else if (condP1 == 1 && condP2 == 0)
231 sc.setPreshowerPlanesStatus(1);
232 else if (condP1 == 0 && condP2 == 1)
233 sc.setPreshowerPlanesStatus(2);
234 else if (condP1 == 0 && condP2 == 0)
235 sc.setPreshowerPlanesStatus(3);
237 if (sc.energy() *
sin(sc.position().theta()) > etThresh_)
238 new_SC.push_back(sc);
239 LogTrace(
"EcalClusters") <<
" SuperClusters energies: new E = " << sc.energy()
240 <<
" vs. old E =" << it_super->energy();
245 clusters_p1->assign(clusters1.begin(), clusters1.end());
246 clusters_p2->assign(clusters2.begin(), clusters2.end());
248 evt.
put(
std::move(clusters_p1), preshClusterCollectionX_);
249 evt.
put(
std::move(clusters_p2), preshClusterCollectionY_);
250 LogTrace(
"EcalClusters") <<
"Preshower clusters added to the event";
253 superclusters_p->assign(new_SC.begin(), new_SC.end());
254 evt.
put(
std::move(superclusters_p), assocSClusterCollection_);
255 LogTrace(
"EcalClusters") <<
"Corrected SClusters added to the event";
266 esMIPToGeV_ = es.
getHandle(esMIPToGeVToken_);
271 esChannelStatus_ = es.
getHandle(esChannelStatusToken_);
273 esEEInterCalib_ = es.
getHandle(esEEInterCalibToken_);
292 esMissingECalib_ = es.
getHandle(esMissingECalibToken_);