15 _nNeighbours(conf.getParameter<
int>(
"nNeighbours")),
24 {
"HCAL_BARREL2_RING1", 19},
28 const std::vector<edm::ParameterSet>&
thresholds = conf.getParameterSetVector(
"thresholdsByDetector");
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]);
54 auto entry = _layerMap.find(det);
55 if (
entry == _layerMap.end()) {
56 throw cms::Exception(
"InvalidDetectorLayer") <<
"Detector layer : " << det <<
" is not in the list of recognized"
57 <<
" detector layers!";
60 _thresholds[
entry->second + layerOffset] = std::make_tuple(
depths, thresh_E, thresh_pT2);
66 const std::vector<bool>& mask,
67 std::vector<bool>& seedable) {
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.;
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";