CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
HGCalMulticlusteringImpl Class Reference

#include <HGCalMulticlusteringImpl.h>

Public Member Functions

void clusterize (const edm::PtrVector< l1t::HGCalCluster > &clustersPtr, l1t::HGCalMulticlusterBxCollection &multiclusters)
 
 HGCalMulticlusteringImpl (const edm::ParameterSet &conf)
 
bool isPertinent (const l1t::HGCalCluster &clu, const l1t::HGCalMulticluster &mclu, double dR) const
 

Private Attributes

double dr_
 

Detailed Description

Definition at line 9 of file HGCalMulticlusteringImpl.h.

Constructor & Destructor Documentation

HGCalMulticlusteringImpl::HGCalMulticlusteringImpl ( const edm::ParameterSet conf)

Definition at line 5 of file HGCalMulticlusteringImpl.cc.

References dr_.

5  :
6  dr_(conf.getParameter<double>("dR_multicluster"))
7 {
8  edm::LogInfo("HGCalMulticlusterParameters") << "Multicluster dR for Near Neighbour search: " << dr_;
9 }
T getParameter(std::string const &) const

Member Function Documentation

void HGCalMulticlusteringImpl::clusterize ( const edm::PtrVector< l1t::HGCalCluster > &  clustersPtr,
l1t::HGCalMulticlusterBxCollection multiclusters 
)

Definition at line 30 of file HGCalMulticlusteringImpl.cc.

References edm::PtrVector< T >::begin(), edmIntegrityCheck::d, dr_, edm::PtrVector< T >::end(), mps_fire::i, isPertinent(), mag(), BXVector< T >::resize(), and BXVector< T >::set().

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 }
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
bool isPertinent(const l1t::HGCalCluster &clu, const l1t::HGCalMulticluster &mclu, double dR) const
void set(int bx, unsigned i, const T &object)
void resize(int bx, unsigned size)
bool HGCalMulticlusteringImpl::isPertinent ( const l1t::HGCalCluster clu,
const l1t::HGCalMulticluster mclu,
double  dR 
) const

Definition at line 12 of file HGCalMulticlusteringImpl.cc.

References l1t::HGCalClusterT< C >::centreProj(), l1t::HGCalClusterT< C >::detId(), PFRecoTauDiscriminationAgainstElectronDeadECAL_cfi::dR, and mag().

Referenced by clusterize().

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 }
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
const GlobalPoint & centreProj() const
uint32_t detId() const
Definition: HGCalClusterT.h:91

Member Data Documentation

double HGCalMulticlusteringImpl::dr_
private

Definition at line 24 of file HGCalMulticlusteringImpl.h.

Referenced by clusterize(), and HGCalMulticlusteringImpl().