6 bool greaterByEnergy(
const std::pair<unsigned,double>&
a,
7 const std::pair<unsigned,double>&
b) {
8 return a.second > b.second;
15 _nNeighbours(conf.getParameter<int>(
"nNeighbours")),
28 const std::vector<edm::ParameterSet>& thresholds =
30 for(
const auto& pset : thresholds ) {
32 const double& thresh_E = pset.getParameter<
double>(
"seedingThreshold");
33 const double& thresh_pT = pset.getParameter<
double>(
"seedingThresholdPt");
34 const double thresh_pT2 = thresh_pT*thresh_pT;
38 <<
"Detector layer : " << det <<
" is not in the list of recognized"
39 <<
" detector layers!";
42 std::make_pair(thresh_E,thresh_pT2));
49 const std::vector<bool>& mask,
50 std::vector<bool>& seedable ) {
51 std::vector<bool> usable(input->size(),
true);
53 std::vector<std::pair<unsigned,double> > ordered_hits;
54 ordered_hits.reserve(input->size());
55 for(
unsigned i = 0;
i < input->size(); ++
i ) {
56 std::pair<unsigned,double> val = std::make_pair(
i,input->at(
i).energy());
57 auto pos = std::upper_bound(ordered_hits.begin(),ordered_hits.end(),
58 val, greaterByEnergy);
59 ordered_hits.insert(pos,val);
62 for(
const auto& idx_e : ordered_hits ) {
63 const unsigned idx = idx_e.first;
64 if( !mask[idx] )
continue;
66 int seedlayer = (int)maybeseed.
layer();
71 const std::pair<double,double>& thresholds =
73 if( maybeseed.
energy() < thresholds.first ||
74 maybeseed.
pt2() < thresholds.second ) usable[idx] =
false;
75 if( !usable[idx] )
continue;
93 <<
"LocalMaximumSeedFinder only accepts nNeighbors = {-1,0,4,8}";
97 if( !mask[neighbour.key()] )
continue;
98 if( neighbour->energy() > maybeseed.
energy() ) {
99 seedable[
idx] =
false;
103 if( seedable[idx] ) {
105 usable[neighbour.key()] =
false;
VParameterSet const & getParameterSetVector(std::string const &name) const
const std::unordered_map< std::string, int > _layerMap
void findSeeds(const edm::Handle< reco::PFRecHitCollection > &input, const std::vector< bool > &mask, std::vector< bool > &seedable)
double pt2() const
rechit momentum transverse to the beam, squared.
const PFRecHitRefVector & neighbours4() const
LocalMaximumSeedFinder(const edm::ParameterSet &conf)
static std::string const input
PFLayer::Layer layer() const
rechit layer
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
std::unordered_map< int, std::pair< double, double > > _thresholds
Abs< T >::type abs(const T &t)
const PFRecHitRefVector & neighbours8() const
tuple idx
DEBUGGING if hasattr(process,"trackMonIterativeTracking2012"): print "trackMonIterativeTracking2012 D...
double energy() const
rechit energy
const REPPoint & positionREP() const
static const reco::PFRecHitRefVector _noNeighbours
const PFRecHitRefVector & neighbours() const