#include <CommonTools/Clustering1D/interface/OutermostClusterizer1D.h>
Public Member Functions | ||||
virtual OutermostClusterizer1D * | clone () 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 >()) | ||||
| ||||
~OutermostClusterizer1D () | ||||
Private Attributes | ||||
WeightEstimator< T > * | theEstimator |
It then puts 50 % of the points in each cluster.
Definition at line 20 of file OutermostClusterizer1D.h.
OutermostClusterizer1D< T >::OutermostClusterizer1D | ( | const WeightEstimator< T > & | est = TrivialWeightEstimator<T>() |
) | [inline] |
fraction | fraction of values that will be considered to be 'in'. |
Definition at line 50 of file OutermostClusterizer1D.h.
00051 : theEstimator ( est.clone() ) 00052 {}
OutermostClusterizer1D< T >::OutermostClusterizer1D | ( | const OutermostClusterizer1D< T > & | o | ) | [inline] |
Definition at line 45 of file OutermostClusterizer1D.h.
00046 : theEstimator( o.theEstimator->clone() ) 00047 {}
OutermostClusterizer1D< T >::~OutermostClusterizer1D | ( | ) | [inline] |
Definition at line 55 of file OutermostClusterizer1D.h.
References OutermostClusterizer1D< T >::theEstimator.
00056 { 00057 delete theEstimator; 00058 }
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 }
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 }
WeightEstimator<T>* OutermostClusterizer1D< T >::theEstimator [private] |
Definition at line 36 of file OutermostClusterizer1D.h.
Referenced by OutermostClusterizer1D< T >::operator()(), and OutermostClusterizer1D< T >::~OutermostClusterizer1D().