#include <MultiClusterizer1D.h>
Public Member Functions | |
virtual MultiClusterizer1D * | clone () const |
MultiClusterizer1D (const MultiClusterizer1D &) | |
MultiClusterizer1D (const Clusterizer1D< T > &single, const WeightEstimator< T > &est=TrivialWeightEstimator< T >()) | |
std::pair< std::vector < Cluster1D< T > >, std::vector< const T * > > | operator() (const std::vector< Cluster1D< T > > &) const |
~MultiClusterizer1D () | |
Private Attributes | |
WeightEstimator< T > * | theEstimator |
Clusterizer1D< T > * | theSingle |
A clusterizer that uses a "single" clusterizer iteratively ...
Definition at line 20 of file MultiClusterizer1D.h.
MultiClusterizer1D< T >::MultiClusterizer1D | ( | const Clusterizer1D< T > & | single, |
const WeightEstimator< T > & | est = TrivialWeightEstimator<T>() |
||
) |
Definition at line 55 of file MultiClusterizer1D.h.
: theEstimator ( est.clone() ), theSingle ( single.clone() ) {}
MultiClusterizer1D< T >::MultiClusterizer1D | ( | const MultiClusterizer1D< T > & | ) |
MultiClusterizer1D< T >::~MultiClusterizer1D | ( | ) |
Definition at line 61 of file MultiClusterizer1D.h.
{ delete theEstimator; delete theSingle; }
MultiClusterizer1D< T > * MultiClusterizer1D< T >::clone | ( | void | ) | const [virtual] |
Implements Clusterizer1D< T >.
Definition at line 68 of file MultiClusterizer1D.h.
{ return new MultiClusterizer1D<T>( *this ); }
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 75 of file MultiClusterizer1D.h.
References i, runTheMatrix::ret, and tmp.
{ using namespace Clusterizer1DCommons; // using namespace MultiClusterizer1DNameSpace; typedef Cluster1D<T> Cluster1D; std::vector < const T * > unusedtracks; switch ( ov.size() ) { case 0: throw Clustering1DException("[MultiClusterizer1D] no values given" ); case 1: std::pair < std::vector < Cluster1D >, std::vector < const T * > > ret ( ov, unusedtracks ); return ret; }; std::pair < std::vector< Cluster1D >, std::vector< const T * > > res; // works only with one track per cluster!!! std::map < const T *, Cluster1D > ass; std::vector < Cluster1D > cur; for ( typename std::vector< Cluster1D >::const_iterator i=ov.begin(); i!=ov.end() ; ++i ) { if ( i->tracks().size()==1 ) { ass[ i->tracks()[0] ]=*i; } cur.push_back ( *i ); } int ctr=0; try { while ( true ) { std::pair < std::vector< Cluster1D >, std::vector< const T * > > tmp = (*theSingle)( cur ); for ( typename std::vector< Cluster1D >::const_iterator i=tmp.first.begin(); i!=tmp.first.end() ; ++i ) { res.first.push_back ( *i ); } res.second=tmp.second; cur.clear(); for ( typename std::vector< const T * >::const_iterator i=res.second.begin(); i!=res.second.end() ; ++i ) { cur.push_back ( ass[*i] ); } if ( ctr++ > 5 ) break; if ( cur.size() < 2 ) break; } } catch ( ... ) {}; return res; }
WeightEstimator<T>* MultiClusterizer1D< T >::theEstimator [private] |
Definition at line 35 of file MultiClusterizer1D.h.
Clusterizer1D<T>* MultiClusterizer1D< T >::theSingle [private] |
Definition at line 36 of file MultiClusterizer1D.h.