#include <Cluster1DCleaner.h>
Public Member Functions | |
Cluster1DCleaner (const float zoffset, bool useErr) | |
std::vector< Cluster1D< T > > | clusters (std::vector< Cluster1D< T > >) |
std::vector< Cluster1D< T > > | discardedCluster1Ds () const |
Private Member Functions | |
float | average (const std::vector< Cluster1D< T > > &) |
void | cleanCluster1Ds (std::vector< Cluster1D< T > >) |
Private Attributes | |
std::vector< Cluster1D< T > > | theCleanedCluster1Ds |
std::vector< Cluster1D< T > > | theDiscardedCluster1Ds |
bool | theUseError |
float | theZOffSet |
Definition at line 13 of file Cluster1DCleaner.h.
Cluster1DCleaner< T >::Cluster1DCleaner | ( | const float | zoffset, |
bool | useErr | ||
) | [inline] |
Definition at line 17 of file Cluster1DCleaner.h.
References Cluster1DCleaner< T >::theCleanedCluster1Ds, and Cluster1DCleaner< T >::theDiscardedCluster1Ds.
: theZOffSet(zoffset), theUseError(useErr) { theCleanedCluster1Ds.clear(); theDiscardedCluster1Ds.clear(); }
float Cluster1DCleaner< T >::average | ( | const std::vector< Cluster1D< T > > & | clust | ) | [private] |
Definition at line 86 of file Cluster1DCleaner.h.
References mathSSE::sqrt().
{ float ave = clust.front().position().value(); float err = clust.front().position().error(); for( typename std::vector < Cluster1D<T> >::const_iterator ic=(clust.begin())+1; ic != clust.end(); ic++) { float oldave = ave; float olderr = err; ave = ( oldave/olderr/olderr + ic->position().value()/ic->position().error()/ic->position().error()) / (1./olderr/olderr + 1./ic->position().error()/ic->position().error()); err = sqrt(olderr*olderr + ic->position().error()*ic->position().error()); } return ave; }
void Cluster1DCleaner< T >::cleanCluster1Ds | ( | std::vector< Cluster1D< T > > | clust | ) | [private] |
Definition at line 58 of file Cluster1DCleaner.h.
References PDRates::average.
{ theCleanedCluster1Ds.clear(); theDiscardedCluster1Ds.clear(); if (clust.size() == 0) return; float oldPos = average(clust); for( typename std::vector < Cluster1D<T> >::const_iterator ic=clust.begin(); ic != clust.end(); ic++) { float discr = theUseError ? fabs( ((*ic).position().value() - oldPos) / (*ic).position().error()) : fabs( ((*ic).position().value() - oldPos) ); if ( discr < theZOffSet ) { theCleanedCluster1Ds.push_back(*ic); } else { theDiscardedCluster1Ds.push_back(*ic); } } return; }
std::vector< Cluster1D< T > > Cluster1DCleaner< T >::clusters | ( | std::vector< Cluster1D< T > > | clust | ) |
Definition at line 50 of file Cluster1DCleaner.h.
{ cleanCluster1Ds(clust); return theCleanedCluster1Ds; }
std::vector< Cluster1D< T > > Cluster1DCleaner< T >::discardedCluster1Ds | ( | ) | const [inline] |
Definition at line 30 of file Cluster1DCleaner.h.
References Cluster1DCleaner< T >::theDiscardedCluster1Ds.
{ return theDiscardedCluster1Ds; }
std::vector<Cluster1D<T> > Cluster1DCleaner< T >::theCleanedCluster1Ds [private] |
Definition at line 38 of file Cluster1DCleaner.h.
Referenced by Cluster1DCleaner< T >::Cluster1DCleaner().
std::vector<Cluster1D<T> > Cluster1DCleaner< T >::theDiscardedCluster1Ds [private] |
Definition at line 39 of file Cluster1DCleaner.h.
Referenced by Cluster1DCleaner< T >::Cluster1DCleaner(), and Cluster1DCleaner< T >::discardedCluster1Ds().
bool Cluster1DCleaner< T >::theUseError [private] |
Definition at line 41 of file Cluster1DCleaner.h.
float Cluster1DCleaner< T >::theZOffSet [private] |
Definition at line 40 of file Cluster1DCleaner.h.