CMS 3D CMS Logo

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

#include <MultiClusterizer1D.h>

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

Public Member Functions

virtual MultiClusterizer1Dclone () const
 
 MultiClusterizer1D (const Clusterizer1D< T > &single, const WeightEstimator< T > &est=TrivialWeightEstimator< T >())
 
 MultiClusterizer1D (const MultiClusterizer1D &)
 
std::pair< std::vector
< Cluster1D< T >
>, std::vector< const T * > > 
operator() (const std::vector< Cluster1D< T > > &) const
 
 ~MultiClusterizer1D ()
 
- Public Member Functions inherited from Clusterizer1D< T >
virtual ~Clusterizer1D ()
 

Private Attributes

WeightEstimator< T > * theEstimator
 
Clusterizer1D< T > * theSingle
 

Detailed Description

template<class T>
class MultiClusterizer1D< T >

A clusterizer that uses a "single" clusterizer iteratively ...

Definition at line 20 of file MultiClusterizer1D.h.

Constructor & Destructor Documentation

template<class T >
MultiClusterizer1D< T >::MultiClusterizer1D ( const Clusterizer1D< T > &  single,
const WeightEstimator< T > &  est = TrivialWeightEstimator<T>() 
)

Definition at line 51 of file MultiClusterizer1D.h.

52  : theEstimator(est.clone()), theSingle(single.clone()) {}
WeightEstimator< T > * theEstimator
Clusterizer1D< T > * theSingle
virtual Clusterizer1D * clone() const =0
virtual WeightEstimator * clone() const =0
template<class T>
MultiClusterizer1D< T >::MultiClusterizer1D ( const MultiClusterizer1D< T > &  )
template<class T >
MultiClusterizer1D< T >::~MultiClusterizer1D ( )

Definition at line 55 of file MultiClusterizer1D.h.

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

Member Function Documentation

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

Implements Clusterizer1D< T >.

Definition at line 61 of file MultiClusterizer1D.h.

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

Implements Clusterizer1D< T >.

Definition at line 66 of file MultiClusterizer1D.h.

References dqmiodatasetharvest::ctr, mps_fire::i, runTheMatrix::ret, and createJobs::tmp.

67  {
68  using namespace Clusterizer1DCommons;
69  // using namespace MultiClusterizer1DNameSpace;
70  typedef Cluster1D<T> Cluster1D;
71  std::vector<const T *> unusedtracks;
72  switch (ov.size()) {
73  case 0:
74  throw Clustering1DException("[MultiClusterizer1D] no values given");
75  case 1:
76  std::pair<std::vector<Cluster1D>, std::vector<const T *> > ret(ov, unusedtracks);
77  return ret;
78  };
79 
80  std::pair<std::vector<Cluster1D>, std::vector<const T *> > res;
81 
82  // works only with one track per cluster!!!
83  std::map<const T *, Cluster1D> ass;
84  std::vector<Cluster1D> cur;
85 
86  for (typename std::vector<Cluster1D>::const_iterator i = ov.begin(); i != ov.end(); ++i) {
87  if (i->tracks().size() == 1) {
88  ass[i->tracks()[0]] = *i;
89  }
90  cur.push_back(*i);
91  }
92 
93  int ctr = 0;
94  try {
95  while (true) {
96  std::pair<std::vector<Cluster1D>, std::vector<const T *> > tmp = (*theSingle)(cur);
97 
98  for (typename std::vector<Cluster1D>::const_iterator i = tmp.first.begin(); i != tmp.first.end(); ++i) {
99  res.first.push_back(*i);
100  }
101  res.second = tmp.second;
102 
103  cur.clear();
104 
105  for (typename std::vector<const T *>::const_iterator i = res.second.begin(); i != res.second.end(); ++i) {
106  cur.push_back(ass[*i]);
107  }
108  if (ctr++ > 5)
109  break;
110  if (cur.size() < 2)
111  break;
112  }
113  } catch (...) {
114  };
115 
116  return res;
117 }
tuple ret
prodAgent to be discontinued
tmp
align.sh
Definition: createJobs.py:716

Member Data Documentation

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

Definition at line 32 of file MultiClusterizer1D.h.

template<class T>
Clusterizer1D<T>* MultiClusterizer1D< T >::theSingle
private

Definition at line 33 of file MultiClusterizer1D.h.