CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
LocalMaximumSeedFinder Class Reference

#include <LocalMaximumSeedFinder.h>

Inheritance diagram for LocalMaximumSeedFinder:
SeedFinderBase

Public Member Functions

void findSeeds (const edm::Handle< reco::PFRecHitCollection > &input, const std::vector< bool > &mask, std::vector< bool > &seedable)
 
 LocalMaximumSeedFinder (const edm::ParameterSet &conf)
 
 LocalMaximumSeedFinder (const LocalMaximumSeedFinder &)=delete
 
LocalMaximumSeedFinderoperator= (const LocalMaximumSeedFinder &)=delete
 
- Public Member Functions inherited from SeedFinderBase
const std::string & name () const
 
SeedFinderBaseoperator= (const SeedFinderBase &)=delete
 
 SeedFinderBase (const edm::ParameterSet &conf)
 
 SeedFinderBase (const SeedFinderBase &)=delete
 

Private Attributes

const std::unordered_map
< std::string, int > 
_layerMap
 
const int _nNeighbours
 
std::unordered_map< int,
std::pair< double, double > > 
_thresholds
 

Static Private Attributes

static const
reco::PFRecHitRefVector 
_noNeighbours
 

Detailed Description

Definition at line 8 of file LocalMaximumSeedFinder.h.

Constructor & Destructor Documentation

LocalMaximumSeedFinder::LocalMaximumSeedFinder ( const edm::ParameterSet conf)

Definition at line 13 of file LocalMaximumSeedFinder.cc.

References PFLayer::ECAL_BARREL, PFLayer::ECAL_ENDCAP, edm::ParameterSet::getParameterSetVector(), PFLayer::HCAL_BARREL1, PFLayer::HCAL_BARREL2, PFLayer::HCAL_ENDCAP, PFLayer::HF_EM, PFLayer::HF_HAD, PFLayer::NONE, PFLayer::PS1, and PFLayer::PS2.

13  :
14  SeedFinderBase(conf),
15  _nNeighbours(conf.getParameter<int>("nNeighbours")),
16  _layerMap({ {"PS2",(int)PFLayer::PS2},
17  {"PS1",(int)PFLayer::PS1},
18  {"ECAL_ENDCAP",(int)PFLayer::ECAL_ENDCAP},
19  {"ECAL_BARREL",(int)PFLayer::ECAL_BARREL},
20  {"NONE",(int)PFLayer::NONE},
21  {"HCAL_BARREL1",(int)PFLayer::HCAL_BARREL1},
22  {"HCAL_BARREL2_RING0",(int)PFLayer::HCAL_BARREL2},
23  // hack to deal with ring1 in HO
24  {"HCAL_BARREL2_RING1",100*(int)PFLayer::HCAL_BARREL2},
25  {"HCAL_ENDCAP",(int)PFLayer::HCAL_ENDCAP},
26  {"HF_EM",(int)PFLayer::HF_EM},
27  {"HF_HAD",(int)PFLayer::HF_HAD} }) {
T getParameter(std::string const &) const
const std::unordered_map< std::string, int > _layerMap
SeedFinderBase(const edm::ParameterSet &conf)
LocalMaximumSeedFinder::LocalMaximumSeedFinder ( const LocalMaximumSeedFinder )
delete

Member Function Documentation

void LocalMaximumSeedFinder::findSeeds ( const edm::Handle< reco::PFRecHitCollection > &  input,
const std::vector< bool > &  mask,
std::vector< bool > &  seedable 
)
virtual

Implements SeedFinderBase.

Definition at line 48 of file LocalMaximumSeedFinder.cc.

References _nNeighbours, _noNeighbours, _thresholds, funct::abs(), reco::PFRecHit::energy(), edm::hlt::Exception, PFLayer::HCAL_BARREL2, i, customizeTrackingMonitorSeedNumber::idx, reco::PFRecHit::layer(), reco::PFRecHit::neighbours(), reco::PFRecHit::neighbours4(), reco::PFRecHit::neighbours8(), reco::PFRecHit::positionREP(), and reco::PFRecHit::pt2().

50  {
51  std::vector<bool> usable(input->size(),true);
52  //need to run over energy sorted rechits
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);
60  }
61 
62  for( const auto& idx_e : ordered_hits ) {
63  const unsigned idx = idx_e.first;
64  if( !mask[idx] ) continue; // cannot seed masked objects
65  const reco::PFRecHit& maybeseed = input->at(idx);
66  int seedlayer = (int)maybeseed.layer();
67  if( seedlayer == PFLayer::HCAL_BARREL2 &&
68  std::abs(maybeseed.positionREP().eta()) > 0.34 ) {
69  seedlayer *= 100;
70  }
71  const std::pair<double,double>& thresholds =
72  _thresholds.find(seedlayer)->second;
73  if( maybeseed.energy() < thresholds.first ||
74  maybeseed.pt2() < thresholds.second ) usable[idx] = false;
75  if( !usable[idx] ) continue;
76  //get the neighbours of this seed
77  const reco::PFRecHitRefVector* myNeighbours;
78  switch( _nNeighbours ) {
79  case -1:
80  myNeighbours = &maybeseed.neighbours();
81  break;
82  case 0: // for HF clustering
83  myNeighbours = &_noNeighbours;
84  break;
85  case 4:
86  myNeighbours = &maybeseed.neighbours4();
87  break;
88  case 8:
89  myNeighbours = &maybeseed.neighbours8();
90  break;
91  default:
92  throw cms::Exception("InvalidConfiguration")
93  << "LocalMaximumSeedFinder only accepts nNeighbors = {-1,0,4,8}";
94  }
95  seedable[idx] = true;
96  for( const reco::PFRecHitRef& neighbour : *myNeighbours ) {
97  if( !mask[neighbour.key()] ) continue;
98  if( neighbour->energy() > maybeseed.energy() ) {
99  seedable[idx] = false;
100  break;
101  }
102  }
103  if( seedable[idx] ) {
104  for( const reco::PFRecHitRef& neighbour : *myNeighbours ) {
105  usable[neighbour.key()] = false;
106  }
107  }
108  }
109 }
int i
Definition: DBlmapReader.cc:9
double pt2() const
rechit momentum transverse to the beam, squared.
Definition: PFRecHit.h:114
const PFRecHitRefVector & neighbours4() const
Definition: PFRecHit.h:79
PFLayer::Layer layer() const
rechit layer
Definition: PFRecHit.h:104
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:35
std::unordered_map< int, std::pair< double, double > > _thresholds
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const PFRecHitRefVector & neighbours8() const
Definition: PFRecHit.h:82
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
double energy() const
rechit energy
Definition: PFRecHit.h:107
const REPPoint & positionREP() const
Definition: PFRecHit.h:125
static const reco::PFRecHitRefVector _noNeighbours
const PFRecHitRefVector & neighbours() const
Definition: PFRecHit.h:86
LocalMaximumSeedFinder& LocalMaximumSeedFinder::operator= ( const LocalMaximumSeedFinder )
delete

Member Data Documentation

const std::unordered_map<std::string,int> LocalMaximumSeedFinder::_layerMap
private

Definition at line 22 of file LocalMaximumSeedFinder.h.

Referenced by for().

const int LocalMaximumSeedFinder::_nNeighbours
private

Definition at line 19 of file LocalMaximumSeedFinder.h.

Referenced by findSeeds().

const reco::PFRecHitRefVector LocalMaximumSeedFinder::_noNeighbours
staticprivate

Definition at line 21 of file LocalMaximumSeedFinder.h.

Referenced by findSeeds().

std::unordered_map<int,std::pair<double,double> > LocalMaximumSeedFinder::_thresholds
private

Definition at line 24 of file LocalMaximumSeedFinder.h.

Referenced by findSeeds(), and for().