CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L2TauSimpleClustering.cc
Go to the documentation of this file.
2 #include "Math/GenVector/VectorUtil.h"
3 
4 
6 {
7  m_clusterRadius=0.08;
8 }
9 
11 {
13 }
14 
16 {}
17 
18 
21 {
22 
24 
25  //If we have Hits do Clustering
26  if(myRecHits.size()>0)
27  {
28  //Create the first Cluster by maximum Crystal
29  m_clusters.push_back(myRecHits[0]);
30 
31  //Loop on The Clusters if there are at least two hits
32  if(myRecHits.size()>=2)
33  for(math::PtEtaPhiELorentzVectorCollection::const_iterator h = myRecHits.begin()+1;h!=myRecHits.end();++h)
34  {
35  //These vars are used to find the nearest clusters to this hits
36  double dR_min=100;
37  int ptr=0;
38  int ptr_min=-1;
39 
40  for(math::PtEtaPhiELorentzVectorCollection::iterator j=m_clusters.begin()+1;j!=m_clusters.end();j++)
41  {
43  {
44  if(ROOT::Math::VectorUtil::DeltaR(*h,*j)<dR_min)
45  {
47  ptr_min=ptr;
48  }
49  }
50  ptr++;
51  }
52 
53  //If it does not belong to cluster add a new one else add the Crystal to the Cluster
54  if(ptr_min==-1)
55  m_clusters.push_back(*h);
56  else
57  m_clusters[ptr_min]+=*h;
58  }
59 
60  }
61  return m_clusters;
62 }
63 
math::PtEtaPhiELorentzVectorCollection clusterize(const math::PtEtaPhiELorentzVectorCollection &)
std::vector< PtEtaPhiELorentzVector > PtEtaPhiELorentzVectorCollection
int j
Definition: DBlmapReader.cc:9
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4