CMS 3D CMS Logo

HGCalMulticlusteringImpl.cc
Go to the documentation of this file.
3 
4 
6  dr_(conf.getParameter<double>("dR_multicluster")),
7  ptC3dThreshold_(conf.getParameter<double>("minPt_multicluster")),
8  calibSF_(conf.getParameter<double>("calibSF_multicluster"))
9 {
10  edm::LogInfo("HGCalMulticlusterParameters") << "Multicluster dR for Near Neighbour search: " << dr_;
11  edm::LogInfo("HGCalMulticlusterParameters") << "Multicluster minimum transverse-momentum: " << ptC3dThreshold_;
12  edm::LogInfo("HGCalMulticlusterParameters") << "Multicluster global calibration factor: " << calibSF_;
13 
14 }
15 
16 
18  const l1t::HGCalMulticluster & mclu,
19  double dR ) const
20 {
21  HGCalDetId cluDetId( clu.detId() );
22  HGCalDetId firstClusterDetId( mclu.detId() );
23 
24  if( cluDetId.zside() != firstClusterDetId.zside() ){
25  return false;
26  }
27  if( ( mclu.centreProj() - clu.centreProj() ).mag() < dR ){
28  return true;
29  }
30  return false;
31 
32 }
33 
34 
36  l1t::HGCalMulticlusterBxCollection & multiclusters)
37 {
38 
39  std::vector<l1t::HGCalMulticluster> multiclustersTmp;
40 
41  int iclu = 0;
42  for(edm::PtrVector<l1t::HGCalCluster>::const_iterator clu = clustersPtrs.begin(); clu != clustersPtrs.end(); ++clu, ++iclu){
43 
44  int imclu=0;
45  vector<int> tcPertinentMulticlusters;
46  for( const auto& mclu : multiclustersTmp ){
47  if( this->isPertinent(**clu, mclu, dr_) ){
48  tcPertinentMulticlusters.push_back(imclu);
49  }
50  ++imclu;
51  }
52  if( tcPertinentMulticlusters.empty() ){
53  multiclustersTmp.emplace_back( *clu );
54  }
55  else{
56  unsigned minDist = 1;
57  unsigned targetMulticlu = 0;
58  for( int imclu : tcPertinentMulticlusters ){
59  double d = ( multiclustersTmp.at(imclu).centreProj() - (*clu)->centreProj() ).mag() ;
60  if( d < minDist ){
61  minDist = d;
62  targetMulticlu = imclu;
63  }
64  }
65 
66  multiclustersTmp.at( targetMulticlu ).addConstituent( *clu );
67 
68  }
69  }
70 
71  /* making the collection of multiclusters */
72  for( unsigned i(0); i<multiclustersTmp.size(); ++i ){
73  math::PtEtaPhiMLorentzVector calibP4( multiclustersTmp.at(i).pt() * calibSF_,
74  multiclustersTmp.at(i).eta(),
75  multiclustersTmp.at(i).phi(),
76  0. );
77  // overwriting the 4p with the calibrated 4p
78  multiclustersTmp.at(i).setP4( calibP4 );
79  if( multiclustersTmp.at(i).pt() > ptC3dThreshold_ ){
80  multiclusters.push_back( 0, multiclustersTmp.at(i));
81  }
82  }
83 
84 }
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:129
PtEtaPhiMLorentzVectorD PtEtaPhiMLorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:25
const_iterator end() const
Definition: PtrVector.h:134
uint32_t detId() const
Definition: HGCalClusterT.h:96
bool isPertinent(const l1t::HGCalCluster &clu, const l1t::HGCalMulticluster &mclu, double dR) const
void clusterize(const edm::PtrVector< l1t::HGCalCluster > &clustersPtr, l1t::HGCalMulticlusterBxCollection &multiclusters)
void push_back(int bx, T object)