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;
123 float compsumE = 0.0;
128 int heta = detid.
ieta();
129 int hphi = detid.
iphi();
135 int curphiL = hphi-predphi;
136 int curphiH = hphi+predphi;
139 while (curphiL<0) curphiL+=72;
140 while (curphiH>72) curphiH-=72;
142 std::pair<std::vector<int>, std::vector<int>> phietas({heta,heta+1,heta-1,heta,heta},{hphi,hphi,hphi,curphiL,curphiH});
144 std::vector<uint32_t> rawDetIds;
145 for(
unsigned in=0;
in<phietas.first.size();
in++) {
147 rawDetIds.push_back(tempID.
rawId());
150 for(
const auto& jdx : ordered_hits ) {
151 const unsigned j = jdx;
153 for(
const auto& iID : rawDetIds )
if (iID==matchrechit.
detId())compsumE+=matchrechit.
energy();
158 const double rhenergy = rechit.
energy();
161 double surroundingEnergy = compsumE;
162 for(
auto k : neighbours4 ) {
163 if( !mask[
k] )
continue;
164 auto const & neighbour =
hits[
k];
165 const double sum = neighbour.energy();
166 surroundingEnergy += sum;
171 const double fraction1 = surroundingEnergy/rhenergy;
176 if( fraction1 < f1Cut ) {
180 std::pair<double,double> dcr = dCrack(phi,eta);
185 ( (aeta < 2.85 && dcrmin > 1.0) ||
194 double surroundingEnergyi = 0.0;
195 double enmax = -999.0;
196 unsigned int mostEnergeticNeighbour=0;
198 for(
auto k : neighbours4i ) {
199 if( !mask[
k] )
continue;
200 auto const & neighbour =
hits[
k];
201 const double nenergy = neighbour.energy();
202 surroundingEnergyi += nenergy;
203 if( nenergy > enmax ) {
205 mostEnergeticNeighbour =
k;
210 double surroundingEnergyj = 0.0;
211 auto const & neighbours4j =
212 hits[mostEnergeticNeighbour].neighbours4();
213 for(
auto k : neighbours4j ) {
215 surroundingEnergyj +=
hits[
k].energy();
218 const double surroundingEnergyFraction =
219 (surroundingEnergyi+surroundingEnergyj) /
220 (rechit.
energy()+
hits[mostEnergeticNeighbour].energy()) - 1.;
225 std::pair<double,double> dcr = dCrack(phi,eta);
230 ( (aeta < 2.85 && dcrmin > 1.0) ||
235 mask[mostEnergeticNeighbour] =
false;
float phi() const
momentum azimuthal angle
SpikeAndDoubleSpikeCleaner(const edm::ParameterSet &conf)
unsigned detId() const
rechit detId
double _doubleSpikeThresh
constexpr uint32_t rawId() const
get the raw id
void clean(const edm::Handle< reco::PFRecHitCollection > &input, std::vector< bool > &mask) override
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...
int ieta() const
get the cell ieta
Abs< T >::type abs(const T &t)
float energy() const
rechit energy
std::pair< int, edm::FunctionWithDict > OK
int iphi() const
get the cell iphi
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