CMS 3D CMS Logo

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

OutermostClusterizer1Dclone () const override
 
std::pair< std::vector< Cluster1D< T > >, std::vector< const T * > > operator() (const std::vector< Cluster1D< T > > &) const override
 
 OutermostClusterizer1D (const WeightEstimator< T > &est=TrivialWeightEstimator< T >())
 
 OutermostClusterizer1D (const OutermostClusterizer1D &)
 
 ~OutermostClusterizer1D () override
 
- 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

◆ OutermostClusterizer1D() [1/2]

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 47 of file OutermostClusterizer1D.h.

47 : theEstimator(est.clone()) {}
WeightEstimator< T > * theEstimator
virtual WeightEstimator * clone() const =0

◆ OutermostClusterizer1D() [2/2]

◆ ~OutermostClusterizer1D()

template<class T >
OutermostClusterizer1D< T >::~OutermostClusterizer1D ( )
override

Definition at line 50 of file OutermostClusterizer1D.h.

50  {
51  delete theEstimator;
52 }
WeightEstimator< T > * theEstimator

Member Function Documentation

◆ clone()

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

Implements Clusterizer1D< T >.

Definition at line 55 of file OutermostClusterizer1D.h.

55  {
56  return new OutermostClusterizer1D<T>(*this);
57 }

◆ operator()()

template<class T >
std::pair< std::vector< Cluster1D< T > >, std::vector< const T * > > OutermostClusterizer1D< T >::operator() ( const std::vector< Cluster1D< T > > &  ov) const
overridevirtual

Implements Clusterizer1D< T >.

Definition at line 60 of file OutermostClusterizer1D.h.

References mps_fire::i, runTheMatrix::ret, jetUpdater_cfi::sort, createJobs::tmp, and findQualityFiles::v.

61  {
62  using namespace Clusterizer1DCommons;
63  typedef Cluster1D<T> Cluster1D;
64  std::vector<const T*> unusedtracks;
65 
66  switch (ov.size()) {
67  case 0:
68  throw Clustering1DException("[OutermostClusterizer1D] no values given");
69  case 1: {
70  std::pair<std::vector<Cluster1D>, std::vector<const T*> > ret(ov, unusedtracks);
71  return ret;
72  };
73  case 2: {
74  std::pair<std::vector<Cluster1D>, std::vector<const T*> > ret(ov, unusedtracks);
75  return ret;
76  };
77  };
78 
79  std::vector<Cluster1D> v = ov;
80  sort(v.begin(), v.end(), ComparePairs<T>());
81  std::vector<Cluster1D> sols;
82  int sze = v.size() / 2;
83  Cluster1D tmp = v[0];
85  // merge the inner half to the primary cluster
86  for (typename std::vector<Cluster1D>::const_iterator i = v.begin() + 1; i != v.begin() + sze; ++i) {
87  tmp = merger(tmp, *i);
88  }
89  sols.push_back(tmp);
90  tmp = v[sze];
91  for (typename std::vector<Cluster1D>::const_iterator i = v.begin() + sze + 1; i != v.end(); ++i) {
92  tmp = merger(tmp, *i);
93  }
94  sols.push_back(tmp);
95 
96  std::pair<std::vector<Cluster1D>, std::vector<const T*> > ret(sols, unusedtracks);
97  return ret;
98 }
ret
prodAgent to be discontinued
WeightEstimator< T > * theEstimator
tmp
align.sh
Definition: createJobs.py:716

Member Data Documentation

◆ theEstimator

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

Definition at line 34 of file OutermostClusterizer1D.h.