CMS 3D CMS Logo

OutermostClusterizer1D< T > Class Template Reference

Produces two clusters for each end of the 1d data points. More...

#include <CommonTools/Clustering1D/interface/OutermostClusterizer1D.h>

Inheritance diagram for OutermostClusterizer1D< T >:

Clusterizer1D< T >

List of all members.

Public Member Functions

virtual OutermostClusterizer1Dclone () const
std::pair< std::vector
< Cluster1D< T > >,
std::vector< const T * > > 
operator() (const std::vector< Cluster1D< T > > &) const
 OutermostClusterizer1D (const OutermostClusterizer1D &)
 OutermostClusterizer1D (const WeightEstimator< T > &est=TrivialWeightEstimator< T >())
 
Parameters:
fraction fraction of values that will be considered to be 'in'.

 ~OutermostClusterizer1D ()

Private Attributes

WeightEstimator< T > * theEstimator


Detailed Description

template<class T>
class OutermostClusterizer1D< T >

Produces two clusters for each end of the 1d data points.

It then puts 50 % of the points in each cluster.

Definition at line 20 of file OutermostClusterizer1D.h.


Constructor & Destructor Documentation

template<class T>
OutermostClusterizer1D< T >::OutermostClusterizer1D ( const WeightEstimator< T > &  est = TrivialWeightEstimator<T>()  )  [inline]

Parameters:
fraction fraction of values that will be considered to be 'in'.

Definition at line 50 of file OutermostClusterizer1D.h.

00051                                      : theEstimator ( est.clone() )
00052 {}

template<class T>
OutermostClusterizer1D< T >::OutermostClusterizer1D ( const OutermostClusterizer1D< T > &  o  )  [inline]

Definition at line 45 of file OutermostClusterizer1D.h.

00046     : theEstimator( o.theEstimator->clone() )
00047 {}

template<class T>
OutermostClusterizer1D< T >::~OutermostClusterizer1D (  )  [inline]

Definition at line 55 of file OutermostClusterizer1D.h.

References OutermostClusterizer1D< T >::theEstimator.

00056 {
00057     delete theEstimator;
00058 }


Member Function Documentation

template<class T>
OutermostClusterizer1D< T > * OutermostClusterizer1D< T >::clone ( void   )  const [inline, virtual]

Implements Clusterizer1D< T >.

Definition at line 61 of file OutermostClusterizer1D.h.

00062 {
00063     return new OutermostClusterizer1D<T>( *this );
00064 }

template<class T>
std::pair< std::vector< Cluster1D< T > >, std::vector< const T * > > OutermostClusterizer1D< T >::operator() ( const std::vector< Cluster1D< T > > &  ov  )  const [inline, virtual]

Implements Clusterizer1D< T >.

Definition at line 68 of file OutermostClusterizer1D.h.

References i, python::multivaluedict::sort(), OutermostClusterizer1D< T >::theEstimator, tmp, and v.

00069 {
00070     using namespace Clusterizer1DCommons;
00071     typedef Cluster1D<T> Cluster1D;
00072     std::vector < const T * > unusedtracks;
00073 
00074     switch ( ov.size() )
00075     {
00076     case 0:
00077         throw Clustering1DException("[OutermostClusterizer1D] no values given" );
00078     case 1:
00079       {
00080         std::pair < std::vector < Cluster1D >, std::vector < const T * > > ret ( ov, unusedtracks );
00081         return ret;
00082       };
00083     case 2:
00084       {
00085         std::pair < std::vector < Cluster1D >, std::vector < const T * > > ret ( ov, unusedtracks );
00086         return ret;
00087       };
00088     };
00089 
00090     std::vector < Cluster1D > v = ov;
00091     sort ( v.begin(), v.end(), ComparePairs<T>() );
00092     std::vector < Cluster1D > sols;
00093     int sze=v.size()/2;
00094     Cluster1D tmp = v[0];
00095     Cluster1DMerger< T > merger ( *theEstimator );
00096     // merge the inner half to the primary cluster
00097     for ( typename std::vector< Cluster1D >::const_iterator i=v.begin()+1; i!=v.begin()+sze ; ++i )
00098     {
00099       tmp = merger ( tmp, *i );
00100     }
00101     sols.push_back ( tmp );
00102     tmp=v[sze];
00103     for ( typename std::vector< Cluster1D >::const_iterator i=v.begin()+sze+1; i!=v.end() ; ++i )
00104     {
00105       tmp = merger ( tmp, *i );
00106     }
00107     sols.push_back ( tmp );
00108 
00109     std::pair < std::vector < Cluster1D >, std::vector < const T * > > ret ( sols, unusedtracks );
00110     return ret;
00111 }


Member Data Documentation

template<class T>
WeightEstimator<T>* OutermostClusterizer1D< T >::theEstimator [private]

Definition at line 36 of file OutermostClusterizer1D.h.

Referenced by OutermostClusterizer1D< T >::operator()(), and OutermostClusterizer1D< T >::~OutermostClusterizer1D().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:29:25 2009 for CMSSW by  doxygen 1.5.4