106 std::vector<unsigned> ordered_hits(
hits.size());
107 for (
unsigned i = 0;
i <
hits.size(); ++
i)
109 std::sort(ordered_hits.begin(), ordered_hits.end(), [&](
unsigned i,
unsigned j) {
113 for (
const auto&
idx : ordered_hits) {
114 const unsigned i =
idx;
128 float compsumE = 0.0;
134 int heta = detid.
ieta();
135 int hphi = detid.
iphi();
142 int curphiL = hphi - predphi;
143 int curphiH = hphi + predphi;
151 std::pair<std::vector<int>, std::vector<int>> phietas({heta, heta + 1, heta - 1, heta, heta},
152 {hphi, hphi, hphi, curphiL, curphiH});
154 std::vector<uint32_t> rawDetIds;
155 for (
unsigned in = 0;
in < phietas.first.size();
in++) {
157 rawDetIds.push_back(tempID.rawId());
160 for (
const auto& jdx : ordered_hits) {
161 const unsigned j = jdx;
163 for (
const auto& iID : rawDetIds)
164 if (iID == matchrechit.
detId())
165 compsumE += matchrechit.
energy();
170 const double rhenergy = rechit.
energy();
173 double surroundingEnergy = compsumE;
174 for (
auto k : neighbours4) {
177 auto const& neighbour =
hits[
k];
178 const double sum = neighbour.energy();
179 surroundingEnergy += sum;
184 const double fraction1 = surroundingEnergy / rhenergy;
187 const double f1Cut = (
clean._minS4S1_a * std::log10(rechit.
energy()) +
clean._minS4S1_b);
188 if (fraction1 < f1Cut) {
192 std::pair<double, double> dcr = dCrack(
phi,
eta);
194 if (aeta < 5.0 && ((aeta < 2.85 && dcrmin > 1.0) || (rhenergy >
clean._eneThreshMod *
clean._singleSpikeThresh &&
195 fraction1 < f1Cut /
clean._fracThreshMod))) {
200 if (mask[
i] && rhenergy >
clean._doubleSpikeThresh) {
202 double surroundingEnergyi = 0.0;
203 double enmax = -999.0;
204 unsigned int mostEnergeticNeighbour = 0;
206 for (
auto k : neighbours4i) {
209 auto const& neighbour =
hits[
k];
210 const double nenergy = neighbour.energy();
211 surroundingEnergyi += nenergy;
212 if (nenergy > enmax) {
214 mostEnergeticNeighbour =
k;
219 double surroundingEnergyj = 0.0;
220 auto const& neighbours4j =
hits[mostEnergeticNeighbour].neighbours4();
221 for (
auto k : neighbours4j) {
223 surroundingEnergyj +=
hits[
k].energy();
226 const double surroundingEnergyFraction =
227 (surroundingEnergyi + surroundingEnergyj) / (rechit.
energy() +
hits[mostEnergeticNeighbour].energy()) - 1.;
228 if (surroundingEnergyFraction <
clean._doubleSpikeS6S2) {
232 std::pair<double, double> dcr = dCrack(
phi,
eta);
234 if (aeta < 5.0 && ((aeta < 2.85 && dcrmin > 1.0) ||
235 (rhenergy >
clean._eneThreshMod *
clean._doubleSpikeThresh &&
236 surroundingEnergyFraction <
clean._doubleSpikeS6S2 /
clean._fracThreshMod))) {
238 mask[mostEnergeticNeighbour] =
false;