CMS 3D CMS Logo

HGCalMulticlusteringImpl.cc
Go to the documentation of this file.
3 
4 
6  dr_(conf.getParameter<double>("dR_multicluster"))
7 {
8  edm::LogInfo("HGCalMulticlusterParameters") << "Multicluster dR for Near Neighbour search: " << dr_;
9 }
10 
11 
13  const l1t::HGCalMulticluster & mclu,
14  double dR ) const
15 {
16  HGCalDetId cluDetId( clu.detId() );
17  HGCalDetId firstClusterDetId( mclu.detId() );
18 
19  if( cluDetId.zside() != firstClusterDetId.zside() ){
20  return false;
21  }
22  if( ( mclu.centreProj() - clu.centreProj() ).mag() < dR ){
23  return true;
24  }
25  return false;
26 
27 }
28 
29 
31  l1t::HGCalMulticlusterBxCollection & multiclusters)
32 {
33 
34  std::vector<l1t::HGCalMulticluster> multiclustersTmp;
35 
36  int iclu = 0;
37  for(edm::PtrVector<l1t::HGCalCluster>::const_iterator clu = clustersPtrs.begin(); clu != clustersPtrs.end(); ++clu, ++iclu){
38 
39  int imclu=0;
40  vector<int> tcPertinentMulticlusters;
41  for( const auto& mclu : multiclustersTmp ){
42  if( this->isPertinent(**clu, mclu, dr_) ){
43  tcPertinentMulticlusters.push_back(imclu);
44  }
45  ++imclu;
46  }
47  if( tcPertinentMulticlusters.size() == 0 ){
48  multiclustersTmp.emplace_back( *clu );
49  }
50  else{
51  unsigned minDist = 1;
52  unsigned targetMulticlu = 0;
53  for( int imclu : tcPertinentMulticlusters ){
54  double d = ( multiclustersTmp.at(imclu).centreProj() - (*clu)->centreProj() ).mag() ;
55  if( d < minDist ){
56  minDist = d;
57  targetMulticlu = imclu;
58  }
59  }
60 
61  multiclustersTmp.at( targetMulticlu ).addConstituent( *clu );
62 
63  }
64  }
65 
66  /* making the collection of multiclusters */
67  multiclusters.resize(0, multiclustersTmp.size());
68  for( unsigned i(0); i<multiclustersTmp.size(); ++i ){
69  multiclusters.set( 0, i, multiclustersTmp.at(i) );
70  }
71 
72 }
HGCalMulticlusteringImpl(const edm::ParameterSet &conf)
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const GlobalPoint & centreProj() const
const_iterator begin() const
Definition: PtrVector.h:130
const_iterator end() const
Definition: PtrVector.h:135
uint32_t detId() const
Definition: HGCalClusterT.h:91
bool isPertinent(const l1t::HGCalCluster &clu, const l1t::HGCalMulticluster &mclu, double dR) const
void set(int bx, unsigned i, const T &object)
void clusterize(const edm::PtrVector< l1t::HGCalCluster > &clustersPtr, l1t::HGCalMulticlusterBxCollection &multiclusters)
void resize(int bx, unsigned size)