CMS 3D CMS Logo

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

◆ MultiClusterizer1D() [1/2]

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()) {}

◆ MultiClusterizer1D() [2/2]

template<class T>
MultiClusterizer1D< T >::MultiClusterizer1D ( const MultiClusterizer1D< T > &  )

◆ ~MultiClusterizer1D()

template<class T >
MultiClusterizer1D< T >::~MultiClusterizer1D ( )

Definition at line 55 of file MultiClusterizer1D.h.

55  {
56  delete theEstimator;
57  delete theSingle;
58 }

Member Function Documentation

◆ clone()

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 }

◆ operator()()

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.

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 }

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

Member Data Documentation

◆ theEstimator

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

Definition at line 32 of file MultiClusterizer1D.h.

◆ theSingle

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

Definition at line 33 of file MultiClusterizer1D.h.

runTheMatrix.ret
ret
prodAgent to be discontinued
Definition: runTheMatrix.py:542
Clusterizer1DCommons
Definition: Clusterizer1DCommons.h:6
mps_fire.i
i
Definition: mps_fire.py:428
Cluster1D
Definition: Cluster1D.h:13
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
MultiClusterizer1D::theEstimator
WeightEstimator< T > * theEstimator
Definition: MultiClusterizer1D.h:32
WeightEstimator::clone
virtual WeightEstimator * clone() const =0
trackerHitRTTI::single
Definition: trackerHitRTTI.h:10
dqmiodatasetharvest.ctr
ctr
Definition: dqmiodatasetharvest.py:191
MultiClusterizer1D::theSingle
Clusterizer1D< T > * theSingle
Definition: MultiClusterizer1D.h:33
res
Definition: Electron.h:6
MultiClusterizer1D
Definition: MultiClusterizer1D.h:20
Clustering1DException
Definition: Clustering1DException.h:10