CMS 3D CMS Logo

Public Member Functions | Private Attributes

L2TauSimpleClustering Class Reference

#include <L2TauSimpleClustering.h>

List of all members.

Public Member Functions

math::PtEtaPhiELorentzVectorCollection clusterize (const math::PtEtaPhiELorentzVectorCollection &)
 L2TauSimpleClustering (double)
 L2TauSimpleClustering ()
 ~L2TauSimpleClustering ()

Private Attributes

double m_clusterRadius

Detailed Description

Definition at line 15 of file L2TauSimpleClustering.h.


Constructor & Destructor Documentation

L2TauSimpleClustering::L2TauSimpleClustering ( )

Definition at line 5 of file L2TauSimpleClustering.cc.

References m_clusterRadius.

{
  m_clusterRadius=0.08;
}
L2TauSimpleClustering::L2TauSimpleClustering ( double  radius)

Definition at line 10 of file L2TauSimpleClustering.cc.

References m_clusterRadius, and CosmicsPD_Skims::radius.

L2TauSimpleClustering::~L2TauSimpleClustering ( )

Definition at line 15 of file L2TauSimpleClustering.cc.

{}

Member Function Documentation

math::PtEtaPhiELorentzVectorCollection L2TauSimpleClustering::clusterize ( const math::PtEtaPhiELorentzVectorCollection myRecHits)

Definition at line 20 of file L2TauSimpleClustering.cc.

References h, j, and m_clusterRadius.

Referenced by L2TauModularIsolationProducer::produce(), L2TauNarrowConeIsolationProducer::produce(), and L2TauIsolationProducer::produce().

{

  math::PtEtaPhiELorentzVectorCollection m_clusters;

   //If we have Hits do Clustering
   if(myRecHits.size()>0)
     {
       //Create the first Cluster by maximum Crystal
       m_clusters.push_back(myRecHits[0]);

       //Loop on The Clusters if there are at least two hits
       if(myRecHits.size()>=2)
       for(math::PtEtaPhiELorentzVectorCollection::const_iterator h = myRecHits.begin()+1;h!=myRecHits.end();++h)
       {
          //These vars are used to find the nearest clusters to this hits
          double dR_min=100;  
          int ptr=0;
          int ptr_min=-1;
         
          for(math::PtEtaPhiELorentzVectorCollection::iterator j=m_clusters.begin()+1;j!=m_clusters.end();j++)
          {
             if(ROOT::Math::VectorUtil::DeltaR(*h,*j)<m_clusterRadius)
                {
                  if(ROOT::Math::VectorUtil::DeltaR(*h,*j)<dR_min)
                    {
                      dR_min=ROOT::Math::VectorUtil::DeltaR(*h,*j);
                      ptr_min=ptr;
                    }
                }
                  ptr++;
          }
             
          //If it does not belong to cluster add a new one else add the Crystal to the Cluster
          if(ptr_min==-1)
            m_clusters.push_back(*h);
          else
            m_clusters[ptr_min]+=*h;
       }
              
     }
   return m_clusters;
}

Member Data Documentation

Definition at line 31 of file L2TauSimpleClustering.h.

Referenced by clusterize(), and L2TauSimpleClustering().