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 ) {
35 std::vector<double> thresh_E;
36 std::vector<double> thresh_pT ;
37 std::vector<double> thresh_pT2;
40 depths =
pset.getParameter<std::vector<int> >(
"depths");
41 thresh_E =
pset.getParameter<std::vector<double> >(
"seedingThreshold");
42 thresh_pT =
pset.getParameter<std::vector<double> >(
"seedingThresholdPt");
43 if(thresh_E.size()!=depths.size() || thresh_pT.size()!=depths.size()) {
45 <<
"gatheringThresholds mismatch with the numbers of depths";
49 thresh_E.push_back(
pset.getParameter<
double>(
"seedingThreshold"));
50 thresh_pT.push_back(
pset.getParameter<
double>(
"seedingThresholdPt"));
53 for(
unsigned int i=0;
i < thresh_pT.size();++
i){
54 thresh_pT2.push_back(thresh_pT[
i]*thresh_pT[
i]);
60 <<
"Detector layer : " << det <<
" is not in the list of recognized" 61 <<
" detector layers!";
65 std::make_tuple(depths,thresh_E,thresh_pT2);
72 const std::vector<bool>&
mask,
73 std::vector<bool>& seedable ) {
75 auto nhits = input->size();
80 auto cmp = [&](
int i,
int j) {
return energies[
i] < energies[j]; };
81 std::priority_queue<int, DynArray<int>, decltype(cmp)> ordered_hits(cmp,
std::move(qst));
83 for(
unsigned i = 0; i <
nhits; ++
i ) {
84 if( !mask[i] )
continue;
85 auto const & maybeseed = (*input)[
i];
86 energies[
i]=maybeseed.energy();
87 int seedlayer = (
int)maybeseed.layer();
89 std::abs(maybeseed.positionREP().eta()) > 0.34 ) {
96 double thresholdPT2=0.;
98 for (
unsigned int j=0; j<(std::get<2>(
thresholds)).size(); ++j) {
108 if( maybeseed.energy() < thresholdE ||
109 maybeseed.pt2() < thresholdPT2 ) usable[i] =
false;
110 if( !usable[i] )
continue;
111 ordered_hits.push(i);
116 while(!ordered_hits.empty() ) {
117 auto idx = ordered_hits.top();
119 if( !usable[
idx] )
continue;
121 auto const & maybeseed = (*input)[
idx];
125 myNeighbours = maybeseed.neighbours();
128 myNeighbours = _noNeighbours;
131 myNeighbours = maybeseed.neighbours4();
134 myNeighbours = maybeseed.neighbours8();
138 <<
"LocalMaximumSeedFinder only accepts nNeighbors = {-1,0,4,8}";
140 seedable[
idx] =
true;
141 for(
auto neighbour : myNeighbours ) {
142 if( !mask[neighbour] )
continue;
143 if( energies[neighbour] > energies[idx] ) {
145 seedable[
idx] =
false;
149 if( seedable[idx] ) {
150 for(
auto neighbour : myNeighbours ) {
151 usable[neighbour] =
false;
156 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< I3tuple, 35 > _thresholds
#define unInitDynArray(T, n, x)
Abs< T >::type abs(const T &t)
#define declareDynArray(T, n, x)