5 std::pair<double,double> dCrack(
double phi,
double eta) {
6 constexpr double oneOverCrystalSize=1.0/0.0175;
11 constexpr double cPhi[18] = {2.97025, 2.621184149601134, 2.272118299202268,
12 1.9230524488034024, 1.5739865984045365,
13 1.2249207480056705, 0.8758548976068048,
14 0.5267890472079388, 0.1777231968090729,
15 -0.17134265358979306, -0.520408503988659,
16 -0.8694743543875245, -1.2185402047863905,
17 -1.5676060551852569, -1.9166719055841224,
18 -2.265737755982988, -2.6148036063818543,
21 4.44747e-01, -4.44747e-01,
22 7.92824e-01, -7.92824e-01,
23 1.14090e+00, -1.14090e+00,
24 1.47464e+00, -1.47464e+00};
29 if( eta < 0 ) phi+=delta_cPhi;
30 if( phi >= -pi && phi <= pi ) {
32 if( phi < cPhi[17] || phi >= cPhi[0] ) {
33 if( phi < 0 ) phi += 2*
pi;
52 for(
const double etaGap : cEta ) {
55 defi *= oneOverCrystalSize;
56 deta *= oneOverCrystalSize;
57 return std::make_pair(defi,deta);
76 const std::vector<edm::ParameterSet>&
thresholds =
77 conf.getParameterSetVector(
"cleaningByDetector");
78 for(
const auto&
pset : thresholds ) {
86 pset.getParameter<
double>(
"fractionThresholdModifier");
92 <<
"Detector layer : " << det <<
" is not in the list of recognized" 93 <<
" detector layers!";
102 std::vector<bool>&
mask ) {
105 std::vector<unsigned > ordered_hits(
hits.size());
106 for(
unsigned i = 0; i <
hits.size(); ++
i ) ordered_hits[i]=i;
107 std::sort(ordered_hits.begin(),ordered_hits.end(),[&](
unsigned i,
unsigned j) {
return hits[
i].energy()>
hits[j].energy();});
109 for(
const auto&
idx : ordered_hits ) {
110 const unsigned i =
idx;
111 if( !mask[i] )
continue;
120 const double rhenergy = rechit.
energy();
123 double surroundingEnergy = rechit.
energy();
124 double neighbourEnergy = 0.0;
125 double layerEnergy = 0.0;
126 for(
auto k : neighbours4 ) {
127 if( !mask[
k] )
continue;
128 const auto & neighbour =
hits[
k];
129 const double sum = neighbour.energy();
130 surroundingEnergy += sum;
131 neighbourEnergy += sum;
132 layerEnergy += neighbour.energy();
137 const double fraction1 = surroundingEnergy/rhenergy;
142 if( fraction1 < f1Cut ) {
146 std::pair<double,double> dcr = dCrack(phi,eta);
151 ( (aeta < 2.85 && dcrmin > 1.0) ||
160 double surroundingEnergyi = 0.0;
161 double enmax = -999.0;
162 unsigned int mostEnergeticNeighbour=0;
164 for(
auto k : neighbours4i ) {
165 if( !mask[
k] )
continue;
166 const auto & neighbour =
hits[
k];
167 const double nenergy = neighbour.energy();
168 surroundingEnergyi += nenergy;
169 if( nenergy > enmax ) {
171 mostEnergeticNeighbour =
k;
176 double surroundingEnergyj = 0.0;
177 auto const & neighbours4j =
178 hits[mostEnergeticNeighbour].neighbours4();
179 for(
auto k : neighbours4j ) {
181 surroundingEnergyj +=
hits[
k].energy();
184 const double surroundingEnergyFraction =
185 (surroundingEnergyi+surroundingEnergyj) /
186 (rechit.
energy()+
hits[mostEnergeticNeighbour].energy()) - 1.;
191 std::pair<double,double> dcr = dCrack(phi,eta);
196 ( (aeta < 2.85 && dcrmin > 1.0) ||
201 mask[mostEnergeticNeighbour] =
false;
float phi() const
momentum azimuthal angle
SpikeAndDoubleSpikeCleaner(const edm::ParameterSet &conf)
void clean(const edm::Handle< reco::PFRecHitCollection > &input, std::vector< bool > &mask)
double _doubleSpikeThresh
static std::string const input
PFLayer::Layer layer() const
rechit layer
double _singleSpikeThresh
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Abs< T >::type abs(const T &t)
float energy() const
rechit energy
std::pair< int, edm::FunctionWithDict > OK
std::unordered_map< int, spike_cleaning > _thresholds
float eta() const
momentum pseudorapidity
Neighbours neighbours4() const
const std::unordered_map< std::string, int > _layerMap
RhoEtaPhi const & positionREP() const