5 std::pair<double, double> dCrack(
double phi,
double eta) {
6 constexpr
double oneOverCrystalSize = 1.0 / 0.0175;
8 constexpr
double twopi = 2 *
pi;
11 constexpr
double cPhi[18] = {2.97025,
29 constexpr
double cEta[9] = {
30 0.0, 4.44747e-01, -4.44747e-01, 7.92824e-01, -7.92824e-01, 1.14090e+00, -1.14090e+00, 1.47464e+00, -1.47464e+00};
32 constexpr
double delta_cPhi = 0.00638;
39 if (
phi < cPhi[17] ||
phi >= cPhi[0]) {
60 for (
const double etaGap : cEta) {
63 defi *= oneOverCrystalSize;
64 deta *= oneOverCrystalSize;
65 return std::make_pair(defi, deta);
83 const std::vector<edm::ParameterSet>&
thresholds = conf.getParameterSetVector(
"cleaningByDetector");
87 info._minS4S1_a =
pset.getParameter<
double>(
"minS4S1_a");
88 info._minS4S1_b =
pset.getParameter<
double>(
"minS4S1_b");
89 info._doubleSpikeS6S2 =
pset.getParameter<
double>(
"doubleSpikeS6S2");
90 info._eneThreshMod =
pset.getParameter<
double>(
"energyThresholdModifier");
91 info._fracThreshMod =
pset.getParameter<
double>(
"fractionThresholdModifier");
92 info._doubleSpikeThresh =
pset.getParameter<
double>(
"doubleSpikeThresh");
93 info._singleSpikeThresh =
pset.getParameter<
double>(
"singleSpikeThresh");
94 auto entry = _layerMap.find(det);
95 if (
entry == _layerMap.end()) {
96 throw cms::Exception(
"InvalidDetectorLayer") <<
"Detector layer : " << det <<
" is not in the list of recognized"
97 <<
" detector layers!";
99 _thresholds.emplace(_layerMap.find(det)->second,
info);
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;