16 _nNeighbours(conf.getParameter<
int>(
"nNeighbours")),
25 {
"HCAL_BARREL2_RING1", 19},
29 const std::vector<edm::ParameterSet>&
thresholds = conf.getParameterSetVector(
"thresholdsByDetector");
34 std::vector<double> thresh_E;
35 std::vector<double> thresh_pT;
36 std::vector<double> thresh_pT2;
39 depths =
pset.getParameter<std::vector<int> >(
"depths");
40 thresh_E =
pset.getParameter<std::vector<double> >(
"seedingThreshold");
41 thresh_pT =
pset.getParameter<std::vector<double> >(
"seedingThresholdPt");
42 if (thresh_E.size() !=
depths.size() || thresh_pT.size() !=
depths.size()) {
43 throw cms::Exception(
"InvalidGatheringThreshold") <<
"gatheringThresholds mismatch with the numbers of depths";
47 thresh_E.push_back(
pset.getParameter<
double>(
"seedingThreshold"));
48 thresh_pT.push_back(
pset.getParameter<
double>(
"seedingThresholdPt"));
51 for (
unsigned int i = 0;
i < thresh_pT.size(); ++
i) {
52 thresh_pT2.push_back(thresh_pT[
i] * thresh_pT[
i]);
55 auto entry = _layerMap.find(det);
56 if (
entry == _layerMap.end()) {
57 throw cms::Exception(
"InvalidDetectorLayer") <<
"Detector layer : " << det <<
" is not in the list of recognized"
58 <<
" detector layers!";
61 _thresholds[
entry->second + layerOffset] = std::make_tuple(
depths, thresh_E, thresh_pT2);
67 const std::vector<bool>& mask,
68 std::vector<bool>& seedable) {
74 auto cmp = [&](
int i,
int j) {
return energies[
i] < energies[
j]; };
75 std::priority_queue<int, DynArray<int>, decltype(
cmp)> ordered_hits(
cmp,
std::move(qst));
77 for (
unsigned i = 0;
i <
nhits; ++
i) {
80 auto const& maybeseed = (*input)[
i];
81 energies[
i] = maybeseed.energy();
82 int seedlayer = (
int)maybeseed.layer();
88 double thresholdE = 0.;
89 double thresholdPT2 = 0.;
101 if (maybeseed.energy() < thresholdE || maybeseed.pt2() < thresholdPT2)
105 ordered_hits.push(
i);
108 while (!ordered_hits.empty()) {
109 auto idx = ordered_hits.top();
114 auto const& maybeseed = (*input)[
idx];
118 myNeighbours = maybeseed.neighbours();
121 myNeighbours = _noNeighbours;
124 myNeighbours = maybeseed.neighbours4();
127 myNeighbours = maybeseed.neighbours8();
130 throw cms::Exception(
"InvalidConfiguration") <<
"LocalMaximumSeedFinder only accepts nNeighbors = {-1,0,4,8}";
132 seedable[
idx] =
true;
133 for (
auto neighbour : myNeighbours) {
134 if (!mask[neighbour])
136 if (energies[neighbour] > energies[
idx]) {
138 seedable[
idx] =
false;
143 for (
auto neighbour : myNeighbours) {
148 int seedlayer = (
int)maybeseed.layer();
156 auto const& nei = (*input)[neighbour];
157 if (maybeseed.depth() != nei.depth())
160 std::abs(maybeseed.positionREP().eta() - nei.positionREP().eta()) >
detacut)
165 usable[neighbour] =
false;
171 LogDebug(
"LocalMaximumSeedFinder") <<
" found " <<
std::count(seedable.begin(), seedable.end(),
true) <<
" seeds";