CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
OutermostClusterizer1D< T > Class Template Reference

#include <OutermostClusterizer1D.h>

Inheritance diagram for OutermostClusterizer1D< T >:
Clusterizer1D< T >

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 WeightEstimator< T > &est=TrivialWeightEstimator< T >())
 
 OutermostClusterizer1D (const OutermostClusterizer1D &)
 
 ~OutermostClusterizer1D ()
 
- Public Member Functions inherited from Clusterizer1D< T >
virtual ~Clusterizer1D ()
 

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>())
Parameters
fractionfraction of values that will be considered to be 'in'.

Definition at line 50 of file OutermostClusterizer1D.h.

51  : theEstimator ( est.clone() )
52 {}
WeightEstimator< T > * theEstimator
virtual WeightEstimator * clone() const =0
template<class T >
OutermostClusterizer1D< T >::~OutermostClusterizer1D ( )

Definition at line 55 of file OutermostClusterizer1D.h.

56 {
57  delete theEstimator;
58 }
WeightEstimator< T > * theEstimator

Member Function Documentation

template<class T >
OutermostClusterizer1D< T > * OutermostClusterizer1D< T >::clone ( void  ) const
virtual

Implements Clusterizer1D< T >.

Definition at line 61 of file OutermostClusterizer1D.h.

62 {
63  return new OutermostClusterizer1D<T>( *this );
64 }
template<class T >
std::pair< std::vector< Cluster1D< T > >, std::vector< const T * > > OutermostClusterizer1D< T >::operator() ( const std::vector< Cluster1D< T > > &  ov) const
virtual

Implements Clusterizer1D< T >.

Definition at line 68 of file OutermostClusterizer1D.h.

References i, runTheMatrix::ret, tmp, and findQualityFiles::v.

69 {
70  using namespace Clusterizer1DCommons;
71  typedef Cluster1D<T> Cluster1D;
72  std::vector < const T * > unusedtracks;
73 
74  switch ( ov.size() )
75  {
76  case 0:
77  throw Clustering1DException("[OutermostClusterizer1D] no values given" );
78  case 1:
79  {
80  std::pair < std::vector < Cluster1D >, std::vector < const T * > > ret ( ov, unusedtracks );
81  return ret;
82  };
83  case 2:
84  {
85  std::pair < std::vector < Cluster1D >, std::vector < const T * > > ret ( ov, unusedtracks );
86  return ret;
87  };
88  };
89 
90  std::vector < Cluster1D > v = ov;
91  sort ( v.begin(), v.end(), ComparePairs<T>() );
92  std::vector < Cluster1D > sols;
93  int sze=v.size()/2;
94  Cluster1D tmp = v[0];
96  // merge the inner half to the primary cluster
97  for ( typename std::vector< Cluster1D >::const_iterator i=v.begin()+1; i!=v.begin()+sze ; ++i )
98  {
99  tmp = merger ( tmp, *i );
100  }
101  sols.push_back ( tmp );
102  tmp=v[sze];
103  for ( typename std::vector< Cluster1D >::const_iterator i=v.begin()+sze+1; i!=v.end() ; ++i )
104  {
105  tmp = merger ( tmp, *i );
106  }
107  sols.push_back ( tmp );
108 
109  std::pair < std::vector < Cluster1D >, std::vector < const T * > > ret ( sols, unusedtracks );
110  return ret;
111 }
int i
Definition: DBlmapReader.cc:9
tuple ret
prodAgent to be discontinued
WeightEstimator< T > * theEstimator
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100

Member Data Documentation

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

Definition at line 36 of file OutermostClusterizer1D.h.