#include <DivisiveClusterizer1D.h>
Public Member Functions | |
virtual DivisiveClusterizer1D * | clone () const |
DivisiveClusterizer1D (float zoffset=5., int ntkmin=5, bool useError=true, float zsep=0.05, bool wei=true) | |
std::pair< std::vector < Cluster1D< T > >, std::vector< const T * > > | operator() (const std::vector< Cluster1D< T > > &) const |
void | setBeamSpot (const math::XYZPoint &bs) |
~DivisiveClusterizer1D () | |
Private Member Functions | |
void | findCandidates (const std::vector< Cluster1D< T > > &, std::vector< Cluster1D< T > > &, std::vector< Cluster1D< T > > &) const |
void | insertTracks (std::vector< Cluster1D< T > > &, std::vector< Cluster1D< T > > &) const |
std::vector< Cluster1D< T > > | makeCluster1Ds (std::vector< Cluster1D< T > > &, std::vector< Cluster1D< T > > &) const |
Cluster1D< T > | mergeCluster1Ds (std::vector< Cluster1D< T > > &) const |
std::vector< const T * > | takeTracks (const std::vector< Cluster1D< T > > &) const |
Private Attributes | |
pixeltemp::Cluster1DCleaner< T > * | theCleaner |
pixeltemp::Cluster1DMerger< T > * | theMerger |
unsigned int | theNTkMin |
bool | theUseError |
bool | theWei |
float | theZOffSet |
float | theZSeparation |
Definition at line 19 of file DivisiveClusterizer1D.h.
DivisiveClusterizer1D< T >::DivisiveClusterizer1D | ( | float | zoffset = 5. , |
int | ntkmin = 5 , |
||
bool | useError = true , |
||
float | zsep = 0.05 , |
||
bool | wei = true |
||
) |
zoffset | maximum distance between track position and position of its cluster (depending on useError its either weighted or physical distance) |
ntkmin | Minimum number of tracks required to form a cluster. |
useError | physical distances or weighted distances. |
zsep | Maximum distance between two adjacent tracks that belong to the same initial cluster. |
wei | Compute the cluster "center" with an unweighted or a weighted average of the tracks. Weighted means weighted with the error of the data point. |
Definition at line 74 of file DivisiveClusterizer1D.h.
References pixeltemp::DivisiveClusterizer1D< T >::theCleaner, pixeltemp::DivisiveClusterizer1D< T >::theMerger, pixeltemp::DivisiveClusterizer1D< T >::theUseError, and pixeltemp::DivisiveClusterizer1D< T >::theZOffSet.
:theZOffSet(zoffset), theNTkMin(ntkmin), theUseError(useError), theZSeparation(zsep), theWei(wei) { // theDiscardedTracks.clear(); // theTotalDiscardedTracks.clear(); // theCluster1Ds.clear(); TrivialWeightEstimator<T> weightEstimator; theMerger = new pixeltemp::Cluster1DMerger<T>( weightEstimator ); theCleaner = new pixeltemp::Cluster1DCleaner<T>(theZOffSet,theUseError); }
DivisiveClusterizer1D< T >::~DivisiveClusterizer1D | ( | ) |
Definition at line 90 of file DivisiveClusterizer1D.h.
{ delete theMerger; delete theCleaner; }
DivisiveClusterizer1D< T > * DivisiveClusterizer1D< T >::clone | ( | void | ) | const [virtual] |
Implements Clusterizer1D< T >.
Definition at line 109 of file DivisiveClusterizer1D.h.
{ return new DivisiveClusterizer1D<T> ( * this ); }
void DivisiveClusterizer1D< T >::findCandidates | ( | const std::vector< Cluster1D< T > > & | inputo, |
std::vector< Cluster1D< T > > & | finalCluster1Ds, | ||
std::vector< Cluster1D< T > > & | totDiscardedTracks | ||
) | const [private] |
Definition at line 116 of file DivisiveClusterizer1D.h.
References collect_tpl::input, and python::multivaluedict::sort().
{ using namespace Clusterizer1DCommons; std::vector < Cluster1D<T> > input = inputo; std::vector < Cluster1D<T> > discardedTracks; if ( input.size() < (unsigned int)theNTkMin) { insertTracks( input, totDiscardedTracks); return; } sort( input.begin(), input.end(), ComparePairs<T>()); int ncount =0; std::vector < Cluster1D<T> > partOfPTracks; partOfPTracks.push_back(input.front()); for( typename std::vector < Cluster1D<T> >::const_iterator ic=(input.begin())+1; ic != input.end(); ic++) { ncount++; if ( fabs( (*ic).position().value()-(*(ic-1)).position().value() ) < (double) theZSeparation ) { partOfPTracks.push_back((*ic)); } else { if(partOfPTracks.size() >= (unsigned int)theNTkMin) { std::vector< Cluster1D<T> > clusters = makeCluster1Ds(partOfPTracks, discardedTracks); for (typename std::vector< Cluster1D<T> >::const_iterator iclus=clusters.begin(); iclus != clusters.end(); iclus++) { finalCluster1Ds.push_back(*iclus); } insertTracks(discardedTracks,totDiscardedTracks); } else { insertTracks(partOfPTracks,totDiscardedTracks); } partOfPTracks.clear(); partOfPTracks.push_back((*ic)); } } if (partOfPTracks.size() >= (unsigned int)theNTkMin) { std::vector < Cluster1D<T> > clusters = makeCluster1Ds(partOfPTracks, discardedTracks); for (typename std::vector< Cluster1D<T> >::const_iterator iclus = clusters.begin(); iclus != clusters.end(); iclus++) { finalCluster1Ds.push_back(*iclus); } insertTracks(discardedTracks,totDiscardedTracks); } else { insertTracks(partOfPTracks,totDiscardedTracks); } sort(finalCluster1Ds.begin(), finalCluster1Ds.end(), ComparePairs<T>() ); // reverse(theCluster1Ds.begin(), theCluster1Ds.end()); return; }
void DivisiveClusterizer1D< T >::insertTracks | ( | std::vector< Cluster1D< T > > & | clusou, |
std::vector< Cluster1D< T > > & | cludest | ||
) | const [private] |
Definition at line 240 of file DivisiveClusterizer1D.h.
{ if (clusou.size() == 0) return; for ( typename std::vector< Cluster1D<T> >::const_iterator iclu = clusou.begin(); iclu != clusou.end(); iclu++) { cludest.push_back(*iclu); } /* for ( typename std::vector< Cluster1D<T> >::const_iterator iclu = clu.begin(); iclu != clu.end(); iclu++){ if (total) { theTotalDiscardedTracks.push_back(*iclu); }else { theDiscardedTracks.push_back(*iclu); } } */ return; }
std::vector< Cluster1D< T > > DivisiveClusterizer1D< T >::makeCluster1Ds | ( | std::vector< Cluster1D< T > > & | clusters, |
std::vector< Cluster1D< T > > & | discardedTracks | ||
) | const [private] |
Definition at line 188 of file DivisiveClusterizer1D.h.
{ std::vector < Cluster1D<T> > finalCluster1Ds; discardedTracks.clear(); std::vector<Cluster1D<T> > pvClu0 = clusters; std::vector<Cluster1D<T> > pvCluNew = pvClu0; bool stop = false; while (!stop) { int nDiscardedAtIteration = 100; while ( nDiscardedAtIteration !=0 ) { pvCluNew = theCleaner->clusters(pvClu0); std::vector<Cluster1D<T> > tracksAtIteration = theCleaner->discardedCluster1Ds(); nDiscardedAtIteration = tracksAtIteration.size(); if ( nDiscardedAtIteration!=0 ) { insertTracks(tracksAtIteration,discardedTracks); pvClu0 = pvCluNew; } } // while nDiscardedAtIteration unsigned ntkclus = pvCluNew.size(); unsigned ndiscard = discardedTracks.size(); if ( ntkclus >= theNTkMin ) { //save the cluster finalCluster1Ds.push_back( mergeCluster1Ds(pvCluNew) ); if ( ndiscard >= theNTkMin ) { //make a new cluster and reset pvClu0 = discardedTracks; discardedTracks.clear(); } else { //out of loop stop = true; } } else { insertTracks(pvCluNew, discardedTracks); stop = true; } }// while stop return finalCluster1Ds; }
Cluster1D< T > DivisiveClusterizer1D< T >::mergeCluster1Ds | ( | std::vector< Cluster1D< T > > & | clusters | ) | const [private] |
Definition at line 283 of file DivisiveClusterizer1D.h.
References query::result.
{ Cluster1D<T> result = clusters.front(); for ( typename std::vector< Cluster1D<T> >::iterator iclu = (clusters.begin())+1; iclu != clusters.end(); iclu++) { Cluster1D<T> old = result; result = (*theMerger)( old , *iclu ); } return result; }
std::pair< std::vector< Cluster1D< T > >, std::vector< const T * > > DivisiveClusterizer1D< T >::operator() | ( | const std::vector< Cluster1D< T > > & | input | ) | const [virtual] |
Implements Clusterizer1D< T >.
Definition at line 99 of file DivisiveClusterizer1D.h.
References collect_tpl::input, and convertSQLitetoXML_cfg::output.
{ std::vector < Cluster1D<T> > discardedCluster1Ds; std::vector < Cluster1D<T> > output; findCandidates ( input, output, discardedCluster1Ds ); return std::pair < std::vector < Cluster1D<T> >, std::vector < const T * > > ( output, takeTracks(discardedCluster1Ds) ); }
void pixeltemp::DivisiveClusterizer1D< T >::setBeamSpot | ( | const math::XYZPoint & | bs | ) | [inline] |
Definition at line 42 of file DivisiveClusterizer1D.h.
Referenced by DivisiveVertexFinder::findVertexesAlt().
{theMerger->setBeamSpot(bs); }
std::vector< const T * > DivisiveClusterizer1D< T >::takeTracks | ( | const std::vector< Cluster1D< T > > & | clu | ) | const [private] |
Definition at line 265 of file DivisiveClusterizer1D.h.
References i, and testEve_cfg::tracks.
{ std::vector<const T* > tracks; for ( typename std::vector< Cluster1D<T> >::const_iterator iclu = clu.begin(); iclu != clu.end(); iclu++) { std::vector < const T * > clutks = iclu->tracks(); for ( typename std::vector< const T * >::const_iterator i=clutks.begin(); i!=clutks.end() ; ++i ) { tracks.push_back ( *i ); } } return tracks; }
pixeltemp::Cluster1DCleaner<T>* pixeltemp::DivisiveClusterizer1D< T >::theCleaner [private] |
Definition at line 60 of file DivisiveClusterizer1D.h.
Referenced by pixeltemp::DivisiveClusterizer1D< T >::DivisiveClusterizer1D().
pixeltemp::Cluster1DMerger<T>* pixeltemp::DivisiveClusterizer1D< T >::theMerger [private] |
Definition at line 59 of file DivisiveClusterizer1D.h.
Referenced by pixeltemp::DivisiveClusterizer1D< T >::DivisiveClusterizer1D(), and pixeltemp::DivisiveClusterizer1D< reco::Track >::setBeamSpot().
unsigned int pixeltemp::DivisiveClusterizer1D< T >::theNTkMin [private] |
Definition at line 62 of file DivisiveClusterizer1D.h.
bool pixeltemp::DivisiveClusterizer1D< T >::theUseError [private] |
Definition at line 63 of file DivisiveClusterizer1D.h.
Referenced by pixeltemp::DivisiveClusterizer1D< T >::DivisiveClusterizer1D().
bool pixeltemp::DivisiveClusterizer1D< T >::theWei [private] |
Definition at line 65 of file DivisiveClusterizer1D.h.
float pixeltemp::DivisiveClusterizer1D< T >::theZOffSet [private] |
Definition at line 61 of file DivisiveClusterizer1D.h.
Referenced by pixeltemp::DivisiveClusterizer1D< T >::DivisiveClusterizer1D().
float pixeltemp::DivisiveClusterizer1D< T >::theZSeparation [private] |
Definition at line 64 of file DivisiveClusterizer1D.h.