16 _nNeighbours(conf.getParameter<
int>(
"nNeighbours")),
25 {
"HCAL_BARREL2_RING1", 19},
29 const std::vector<edm::ParameterSet>&
thresholds =
30 conf.getParameterSetVector(
"thresholdsByDetector");
31 for(
const auto&
pset : thresholds ) {
33 const double& thresh_E =
pset.getParameter<
double>(
"seedingThreshold");
34 const double& thresh_pT =
pset.getParameter<
double>(
"seedingThresholdPt");
35 const double thresh_pT2 = thresh_pT*thresh_pT;
39 <<
"Detector layer : " << det <<
" is not in the list of recognized" 40 <<
" detector layers!";
43 std::make_pair(thresh_E,thresh_pT2);
50 const std::vector<bool>&
mask,
51 std::vector<bool>& seedable ) {
53 auto nhits = input->size();
58 auto cmp = [&](
int i,
int j) {
return energies[
i] < energies[j]; };
59 std::priority_queue<int, DynArray<int>, decltype(cmp)> ordered_hits(cmp,
std::move(qst));
61 for(
unsigned i = 0; i <
nhits; ++
i ) {
62 if( !mask[i] )
continue;
63 auto const & maybeseed = (*input)[
i];
64 energies[
i]=maybeseed.energy();
65 int seedlayer = (
int)maybeseed.layer();
67 std::abs(maybeseed.positionREP().eta()) > 0.34 ) {
72 maybeseed.pt2() <
thresholds.second ) usable[i] =
false;
73 if( !usable[i] )
continue;
78 while(!ordered_hits.empty() ) {
79 auto idx = ordered_hits.top();
81 if( !usable[
idx] )
continue;
83 auto const & maybeseed = (*input)[
idx];
87 myNeighbours = maybeseed.neighbours();
90 myNeighbours = _noNeighbours;
93 myNeighbours = maybeseed.neighbours4();
96 myNeighbours = maybeseed.neighbours8();
100 <<
"LocalMaximumSeedFinder only accepts nNeighbors = {-1,0,4,8}";
102 seedable[
idx] =
true;
103 for(
auto neighbour : myNeighbours ) {
104 if( !mask[neighbour] )
continue;
105 if( energies[neighbour] > energies[idx] ) {
107 seedable[
idx] =
false;
111 if( seedable[idx] ) {
112 for(
auto neighbour : myNeighbours ) {
113 usable[neighbour] =
false;
118 LogDebug(
"LocalMaximumSeedFinder") <<
" found " <<
std::count(seedable.begin(),seedable.end(),
true) <<
" seeds";
const std::unordered_map< std::string, int > _layerMap
#define initDynArray(T, n, x, i)
void findSeeds(const edm::Handle< reco::PFRecHitCollection > &input, const std::vector< bool > &mask, std::vector< bool > &seedable) override
LocalMaximumSeedFinder(const edm::ParameterSet &conf)
static std::string const input
std::array< std::pair< double, double >, 35 > _thresholds
#define unInitDynArray(T, n, x)
Abs< T >::type abs(const T &t)
#define declareDynArray(T, n, x)