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 > &, unsigned int, 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 17 of file Basic2DGenericTopoClusterizer.cc.

References buildTopoCluster(), i, input, j, fileCollector::seed, and groupFilesInBlocks::temp.

20  {
21  auto const & hits = *input;
22  std::vector<bool> used(hits.size(),false);
23  std::vector<unsigned int> seeds;
24 
25  // get the seeds and sort them descending in energy
26  seeds.reserve(hits.size());
27  for( unsigned int i = 0; i < hits.size(); ++i ) {
28  if( !rechitMask[i] || !seedable[i] || used[i] ) continue;
29  seeds.emplace_back(i);
30  }
31  // maxHeap would be better
32  std::sort(seeds.begin(),seeds.end(),
33  [&](unsigned int i, unsigned int j) { return hits[i].energy()>hits[j].energy();});
34 
36  for( auto seed : seeds ) {
37  if( !rechitMask[seed] || !seedable[seed] || used[seed] ) continue;
38  temp.reset();
39  buildTopoCluster(input,rechitMask,seed,used,temp);
40  if( temp.recHitFractions().size() ) output.push_back(temp);
41  }
42 }
int i
Definition: DBlmapReader.cc:9
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
void buildTopoCluster(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, unsigned int, std::vector< bool > &, reco::PFCluster &)
static std::string const input
Definition: EdmProvDump.cc:44
int j
Definition: DBlmapReader.cc:9
void Basic2DGenericTopoClusterizer::buildTopoCluster ( const edm::Handle< reco::PFRecHitCollection > &  input,
const std::vector< bool > &  rechitMask,
unsigned int  kcell,
std::vector< bool > &  used,
reco::PFCluster topocluster 
)
private

Definition at line 45 of file Basic2DGenericTopoClusterizer.cc.

References InitialClusteringStepBase::_thresholds, _useCornerCells, funct::abs(), reco::PFCluster::addRecHitFraction(), PFLayer::HCAL_BARREL2, relval_2017::k, LOGDRESSED, and InitialClusteringStepBase::makeRefhit().

Referenced by buildClusters().

49  {
50  auto const & cell = (*input)[kcell];
51  int cell_layer = (int)cell.layer();
52  if( cell_layer == PFLayer::HCAL_BARREL2 &&
53  std::abs(cell.positionREP().eta()) > 0.34 ) {
54  cell_layer *= 100;
55  }
56  const std::pair<double,double>& thresholds =
57  _thresholds.find(cell_layer)->second;
58  if( cell.energy() < thresholds.first ||
59  cell.pt2() < thresholds.second ) {
60  LOGDRESSED("GenericTopoCluster::buildTopoCluster()")
61  << "RecHit " << cell.detId() << " with enegy "
62  << cell.energy() << " GeV was rejected!." << std::endl;
63  return;
64  }
65  auto k = kcell;
66  used[k] = true;
67  auto ref = makeRefhit(input,k);
68  topocluster.addRecHitFraction(reco::PFRecHitFraction(ref, 1.0));
69 
70  auto const & neighbours =
71  ( _useCornerCells ? cell.neighbours8() : cell.neighbours4() );
72 
73  for( auto nb : neighbours ) {
74  if( used[nb] || !rechitMask[nb] ) {
75  LOGDRESSED("GenericTopoCluster::buildTopoCluster()")
76  << " RecHit " << cell.detId() << "\'s"
77  << " neighbor RecHit " << input->at(nb).detId()
78  << " with enegy "
79  << input->at(nb).energy() << " GeV was rejected!"
80  << " Reasons : " << used[nb] << " (used) "
81  << !rechitMask[nb] << " (masked)." << std::endl;
82  continue;
83  }
84  buildTopoCluster(input,rechitMask,nb,used,topocluster);
85  }
86 }
void buildTopoCluster(const edm::Handle< reco::PFRecHitCollection > &, const std::vector< bool > &, unsigned int, std::vector< bool > &, reco::PFCluster &)
Fraction of a PFRecHit (rechits can be shared between several PFCluster&#39;s)
reco::PFRecHitRef makeRefhit(const edm::Handle< reco::PFRecHitCollection > &h, const unsigned i) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void addRecHitFraction(const reco::PFRecHitFraction &frac)
add a given fraction of the rechit
Definition: PFCluster.cc:99
#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().