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 OutermostClusterizer1D &)
 
 OutermostClusterizer1D (const WeightEstimator< T > &est=TrivialWeightEstimator< T >())
 
 ~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()) {}

◆ OutermostClusterizer1D() [2/2]

◆ ~OutermostClusterizer1D()

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

Definition at line 50 of file OutermostClusterizer1D.h.

50  {
51  delete theEstimator;
52 }

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.

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 }

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

Member Data Documentation

◆ theEstimator

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

Definition at line 34 of file OutermostClusterizer1D.h.

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:373
Clusterizer1DCommons
Definition: Clusterizer1DCommons.h:6
mps_fire.i
i
Definition: mps_fire.py:428
Cluster1D
Definition: Cluster1D.h:13
findQualityFiles.v
v
Definition: findQualityFiles.py:179
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
Clusterizer1DCommons::ComparePairs
Definition: Clusterizer1DCommons.h:11
WeightEstimator::clone
virtual WeightEstimator * clone() const =0
OutermostClusterizer1D
Definition: OutermostClusterizer1D.h:20
Cluster1DMerger
Definition: Cluster1DMerger.h:14
OutermostClusterizer1D::theEstimator
WeightEstimator< T > * theEstimator
Definition: OutermostClusterizer1D.h:34
Clustering1DException
Definition: Clustering1DException.h:10