15 _nNeighbours(conf.getParameter<
int>(
"nNeighbours")),
24 {
"HCAL_BARREL2_RING1", 19},
28 const std::vector<edm::ParameterSet>&
thresholds = conf.getParameterSetVector(
"thresholdsByDetector");
29 for (
const auto&
pset : thresholds) {
33 std::vector<double> thresh_E;
34 std::vector<double> thresh_pT;
35 std::vector<double> thresh_pT2;
38 depths =
pset.getParameter<std::vector<int> >(
"depths");
39 thresh_E =
pset.getParameter<std::vector<double> >(
"seedingThreshold");
40 thresh_pT =
pset.getParameter<std::vector<double> >(
"seedingThresholdPt");
41 if (thresh_E.size() != depths.size() || thresh_pT.size() != depths.size()) {
42 throw cms::Exception(
"InvalidGatheringThreshold") <<
"gatheringThresholds mismatch with the numbers of depths";
46 thresh_E.push_back(
pset.getParameter<
double>(
"seedingThreshold"));
47 thresh_pT.push_back(
pset.getParameter<
double>(
"seedingThresholdPt"));
50 for (
unsigned int i = 0;
i < thresh_pT.size(); ++
i) {
51 thresh_pT2.push_back(thresh_pT[
i] * thresh_pT[
i]);
56 throw cms::Exception(
"InvalidDetectorLayer") <<
"Detector layer : " << det <<
" is not in the list of recognized" 57 <<
" detector layers!";
66 const std::vector<bool>& mask,
67 std::vector<bool>& seedable) {
68 auto nhits = input->size();
73 auto cmp = [&](
int i,
int j) {
return energies[
i] < energies[
j]; };
74 std::priority_queue<int, DynArray<int>, decltype(
cmp)> ordered_hits(
cmp,
std::move(qst));
76 for (
unsigned i = 0; i <
nhits; ++
i) {
79 auto const& maybeseed = (*input)[
i];
80 energies[
i] = maybeseed.energy();
81 int seedlayer = (
int)maybeseed.layer();
87 double thresholdE = 0.;
88 double thresholdPT2 = 0.;
90 for (
unsigned int j = 0; j < (std::get<2>(
thresholds)).size(); ++
j) {
100 if (maybeseed.energy() < thresholdE || maybeseed.pt2() < thresholdPT2)
104 ordered_hits.push(i);
107 while (!ordered_hits.empty()) {
108 auto idx = ordered_hits.top();
113 auto const& maybeseed = (*input)[
idx];
117 myNeighbours = maybeseed.neighbours();
120 myNeighbours = _noNeighbours;
123 myNeighbours = maybeseed.neighbours4();
126 myNeighbours = maybeseed.neighbours8();
129 throw cms::Exception(
"InvalidConfiguration") <<
"LocalMaximumSeedFinder only accepts nNeighbors = {-1,0,4,8}";
131 seedable[
idx] =
true;
132 for (
auto neighbour : myNeighbours) {
133 if (!mask[neighbour])
135 if (energies[neighbour] > energies[idx]) {
137 seedable[
idx] =
false;
142 for (
auto neighbour : myNeighbours) {
143 usable[neighbour] =
false;
148 LogDebug(
"LocalMaximumSeedFinder") <<
" found " <<
std::count(seedable.begin(), seedable.end(),
true) <<
" seeds";
#define declareDynArray(T, n, x)
void findSeeds(const edm::Handle< reco::PFRecHitCollection > &input, const std::vector< bool > &mask, std::vector< bool > &seedable) override
#define initDynArray(T, n, x, i)
LocalMaximumSeedFinder(const edm::ParameterSet &conf)
static std::string const input
#define unInitDynArray(T, n, x)
std::array< I3tuple, 35 > _thresholds
Abs< T >::type abs(const T &t)
const std::unordered_map< std::string, int > _layerMap