CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

Cluster1DCleaner< T > Class Template Reference

#include <Cluster1DCleaner.h>

List of all members.

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

Detailed Description

template<class T>
class Cluster1DCleaner< T >

Definition at line 13 of file Cluster1DCleaner.h.


Constructor & Destructor Documentation

template<class T>
Cluster1DCleaner< T >::Cluster1DCleaner ( const float  zoffset,
bool  useErr 
) [inline]

Member Function Documentation

template<class T >
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;
}
template<class T >
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;
}
template<class T >
std::vector< Cluster1D< T > > Cluster1DCleaner< T >::clusters ( std::vector< Cluster1D< T > >  clust)

Definition at line 50 of file Cluster1DCleaner.h.

template<class T>
std::vector< Cluster1D< T > > Cluster1DCleaner< T >::discardedCluster1Ds ( ) const [inline]

Member Data Documentation

template<class T>
std::vector<Cluster1D<T> > Cluster1DCleaner< T >::theCleanedCluster1Ds [private]

Definition at line 38 of file Cluster1DCleaner.h.

Referenced by Cluster1DCleaner< T >::Cluster1DCleaner().

template<class T>
std::vector<Cluster1D<T> > Cluster1DCleaner< T >::theDiscardedCluster1Ds [private]
template<class T>
bool Cluster1DCleaner< T >::theUseError [private]

Definition at line 41 of file Cluster1DCleaner.h.

template<class T>
float Cluster1DCleaner< T >::theZOffSet [private]

Definition at line 40 of file Cluster1DCleaner.h.