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 Types | Private Member Functions | Private Attributes
Basic2DGenericTopoClusterizer Class Reference

#include <Basic2DGenericTopoClusterizer.h>

Inheritance diagram for Basic2DGenericTopoClusterizer:
InitialClusteringStepBase

Public Member Functions

 Basic2DGenericTopoClusterizer (const edm::ParameterSet &conf)
 
 Basic2DGenericTopoClusterizer (const B2DGT &)=delete
 
void buildClusters (const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const std::vector< bool > &, reco::PFClusterCollection &)
 
B2DGToperator= (const B2DGT &)=delete
 
virtual ~Basic2DGenericTopoClusterizer ()
 
- Public Member Functions inherited from InitialClusteringStepBase
 _algoName (conf.getParameter< std::string >("algoName"))
 
 InitialClusteringStepBase (const edm::ParameterSet &conf)
 
 InitialClusteringStepBase (const ICSB &)=delete
 
std::ostream & operator<< (std::ostream &o)
 
ICSBoperator= (const ICSB &)=delete
 
void reset ()
 
virtual void update (const edm::EventSetup &)
 
virtual ~InitialClusteringStepBase ()
 

Private Types

typedef
Basic2DGenericTopoClusterizer 
B2DGT
 

Private Member Functions

void buildTopoCluster (const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const reco::PFRecHitRef &, std::vector< bool > &, reco::PFCluster &)
 

Private Attributes

const bool _useCornerCells
 

Additional Inherited Members

- Protected Member Functions inherited from InitialClusteringStepBase
reco::PFRecHitRef makeRefhit (const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
 
- Protected Attributes inherited from InitialClusteringStepBase
const std::unordered_map
< std::string, int > 
_layerMap
 
unsigned _nClustersFound
 
unsigned _nSeeds
 
std::unordered_map< int,
std::pair< double, double > > 
_thresholds
 

Detailed Description

Definition at line 7 of file Basic2DGenericTopoClusterizer.h.

Member Typedef Documentation

Definition at line 8 of file Basic2DGenericTopoClusterizer.h.

Constructor & Destructor Documentation

Basic2DGenericTopoClusterizer::Basic2DGenericTopoClusterizer ( const edm::ParameterSet conf)
inline

Definition at line 10 of file Basic2DGenericTopoClusterizer.h.

10  :
12  _useCornerCells(conf.getParameter<bool>("useCornerCells")) { }
T getParameter(std::string const &) const
InitialClusteringStepBase(const edm::ParameterSet &conf)
virtual Basic2DGenericTopoClusterizer::~Basic2DGenericTopoClusterizer ( )
inlinevirtual

Definition at line 13 of file Basic2DGenericTopoClusterizer.h.

13 {}
Basic2DGenericTopoClusterizer::Basic2DGenericTopoClusterizer ( const B2DGT )
delete

Member Function Documentation

void Basic2DGenericTopoClusterizer::buildClusters ( const edm::Handle< reco::PFRecHitCollection > &  input,
const std::vector< bool > &  rechitMask,
const std::vector< bool > &  seedable,
reco::PFClusterCollection output 
)
virtual

Implements InitialClusteringStepBase.

Definition at line 24 of file Basic2DGenericTopoClusterizer.cc.

References buildTopoCluster(), i, InitialClusteringStepBase::makeRefhit(), reco::PFCluster::recHitFractions(), reco::PFCluster::reset(), fileCollector::seed, and groupFilesInBlocks::temp.

27  {
28  std::vector<bool> used(input->size(),false);
29  std::vector<std::pair<unsigned,double> > seeds;
30 
31  // get the seeds and sort them descending in energy
32  seeds.reserve(input->size());
33  for( unsigned i = 0; i < input->size(); ++i ) {
34  if( !rechitMask[i] || !seedable[i] || used[i] ) continue;
35  std::pair<unsigned,double> val = std::make_pair(i,input->at(i).energy());
36  auto pos = std::upper_bound(seeds.begin(),seeds.end(),val,greaterByEnergy);
37  seeds.insert(pos,val);
38  }
39 
41  for( const auto& idx_e : seeds ) {
42  const int seed = idx_e.first;
43  if( !rechitMask[seed] || !seedable[seed] || used[seed] ) continue;
44  temp.reset();
45  buildTopoCluster(input,rechitMask,makeRefhit(input,seed),used,temp);
46  if( temp.recHitFractions().size() ) output.push_back(temp);
47  }
48 }
int i
Definition: DBlmapReader.cc:9
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
void buildTopoCluster(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const reco::PFRecHitRef &, std::vector< bool > &, reco::PFCluster &)
void reset()
resets clusters parameters
Definition: PFCluster.cc:37
const std::vector< reco::PFRecHitFraction > & recHitFractions() const
vector of rechit fractions
Definition: PFCluster.h:69
void Basic2DGenericTopoClusterizer::buildTopoCluster ( const edm::Handle< reco::PFRecHitCollection > &  input,
const std::vector< bool > &  rechitMask,
const reco::PFRecHitRef cell,
std::vector< bool > &  used,
reco::PFCluster topocluster 
)
private

Definition at line 51 of file Basic2DGenericTopoClusterizer.cc.

References InitialClusteringStepBase::_thresholds, _useCornerCells, funct::abs(), reco::PFCluster::addRecHitFraction(), relval_parameters_module::energy, PFLayer::HCAL_BARREL2, edm::Ref< C, T, F >::key(), LOGDRESSED, and fff_deleter::thresholds.

Referenced by buildClusters().

55  {
56  int cell_layer = (int)cell->layer();
57  if( cell_layer == PFLayer::HCAL_BARREL2 &&
58  std::abs(cell->positionREP().eta()) > 0.34 ) {
59  cell_layer *= 100;
60  }
61  const std::pair<double,double>& thresholds =
62  _thresholds.find(cell_layer)->second;
63  if( cell->energy() < thresholds.first ||
64  cell->pt2() < thresholds.second ) {
65  LOGDRESSED("GenericTopoCluster::buildTopoCluster()")
66  << "RecHit " << cell->detId() << " with enegy "
67  << cell->energy() << " GeV was rejected!." << std::endl;
68  return;
69  }
70 
71  used[cell.key()] = true;
72  topocluster.addRecHitFraction(reco::PFRecHitFraction(cell, 1.0));
73 
74  const reco::PFRecHitRefVector& neighbours =
75  ( _useCornerCells ? cell->neighbours8() : cell->neighbours4() );
76 
77  for( const reco::PFRecHitRef nb : neighbours ) {
78  if( used[nb.key()] || !rechitMask[nb.key()] ) {
79  LOGDRESSED("GenericTopoCluster::buildTopoCluster()")
80  << " RecHit " << cell->detId() << "\'s"
81  << " neighbor RecHit " << input->at(nb.key()).detId()
82  << " with enegy "
83  << input->at(nb.key()).energy() << " GeV was rejected!"
84  << " Reasons : " << used[nb.key()] << " (used) "
85  << !rechitMask[nb.key()] << " (masked)." << std::endl;
86  continue;
87  }
88  buildTopoCluster(input,rechitMask,nb,used,topocluster);
89  }
90 }
dictionary thresholds
Definition: fff_deleter.py:273
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
key_type key() const
Accessor for product key.
Definition: Ref.h:266
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void buildTopoCluster(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, const reco::PFRecHitRef &, std::vector< bool > &, reco::PFCluster &)
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:57
#define LOGDRESSED(x)
std::unordered_map< int, std::pair< double, double > > _thresholds
B2DGT& Basic2DGenericTopoClusterizer::operator= ( const B2DGT )
delete

Member Data Documentation

const bool Basic2DGenericTopoClusterizer::_useCornerCells
private

Definition at line 23 of file Basic2DGenericTopoClusterizer.h.

Referenced by buildTopoCluster().