134 auto const& hits = *
input;
135 std::vector<unsigned> ordered_hits(hits.size());
136 for (
unsigned i = 0;
i < hits.size(); ++
i)
138 std::sort(ordered_hits.begin(), ordered_hits.end(), [&](
unsigned i,
unsigned j) {
139 return hits[
i].energy() > hits[
j].energy();
142 for (
const auto& idx : ordered_hits) {
143 const unsigned i = idx;
147 int hitlayer = (int)rechit.
layer();
152 if (rechit.
energy() < clean._singleSpikeThresh)
157 float compsumE = 0.0;
163 int heta = detid.
ieta();
164 int hphi = detid.
iphi();
171 int curphiL = hphi - predphi;
172 int curphiH = hphi + predphi;
180 std::pair<std::vector<int>, std::vector<int>> phietas({heta, heta + 1, heta - 1, heta, heta},
181 {hphi, hphi, hphi, curphiL, curphiH});
183 std::vector<uint32_t> rawDetIds;
184 for (
unsigned in = 0;
in < phietas.first.size();
in++) {
186 rawDetIds.push_back(tempID.rawId());
189 for (
const auto& jdx : ordered_hits) {
190 const unsigned j = jdx;
192 for (
const auto& iID : rawDetIds)
193 if (iID == matchrechit.
detId())
194 compsumE += matchrechit.
energy();
199 const double rhenergy = rechit.
energy();
202 double surroundingEnergy = compsumE;
203 for (
auto k : neighbours4) {
206 auto const& neighbour = hits[
k];
207 const double sum = neighbour.energy();
208 surroundingEnergy += sum;
213 const double fraction1 = surroundingEnergy / rhenergy;
216 const double f1Cut = (clean._minS4S1_a * std::log10(rechit.
energy()) + clean._minS4S1_b);
217 if (fraction1 < f1Cut) {
221 std::pair<double, double> dcr = dCrack(phi, eta);
223 if (aeta < 5.0 && ((aeta < 2.85 && dcrmin > 1.0) || (rhenergy > clean._eneThreshMod * clean._singleSpikeThresh &&
224 fraction1 < f1Cut / clean._fracThreshMod))) {
229 if (mask[i] && rhenergy > clean._doubleSpikeThresh) {
231 double surroundingEnergyi = 0.0;
232 double enmax = -999.0;
233 unsigned int mostEnergeticNeighbour = 0;
235 for (
auto k : neighbours4i) {
238 auto const& neighbour = hits[
k];
239 const double nenergy = neighbour.energy();
240 surroundingEnergyi += nenergy;
241 if (nenergy > enmax) {
243 mostEnergeticNeighbour =
k;
248 double surroundingEnergyj = 0.0;
249 auto const& neighbours4j = hits[mostEnergeticNeighbour].neighbours4();
250 for (
auto k : neighbours4j) {
252 surroundingEnergyj += hits[
k].energy();
255 const double surroundingEnergyFraction =
256 (surroundingEnergyi + surroundingEnergyj) / (rechit.
energy() + hits[mostEnergeticNeighbour].energy()) - 1.;
257 if (surroundingEnergyFraction < clean._doubleSpikeS6S2) {
261 std::pair<double, double> dcr = dCrack(phi, eta);
263 if (aeta < 5.0 && ((aeta < 2.85 && dcrmin > 1.0) ||
264 (rhenergy > clean._eneThreshMod * clean._doubleSpikeThresh &&
265 surroundingEnergyFraction < clean._doubleSpikeS6S2 / clean._fracThreshMod))) {
267 mask[mostEnergeticNeighbour] =
false;
float phi() const
momentum azimuthal angle
unsigned detId() const
rechit detId
void clean(const edm::Handle< reco::PFRecHitCollection > &input, std::vector< bool > &mask) override
static std::string const input
PFLayer::Layer layer() const
rechit layer
U second(std::pair< T, U > const &p)
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
constexpr int iphi() const
get the cell iphi
Abs< T >::type abs(const T &t)
constexpr int ieta() const
get the cell ieta
float energy() const
rechit energy
std::unordered_map< int, spike_cleaning > _thresholds
float eta() const
momentum pseudorapidity
Neighbours neighbours4() const
RhoEtaPhi const & positionREP() const