CMS 3D CMS Logo

pixeltemp::Cluster1DCleaner< T > Class Template Reference

#include <RecoPixelVertexing/PixelVertexFinding/interface/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 pixeltemp::Cluster1DCleaner< T >

Definition at line 14 of file Cluster1DCleaner.h.


Constructor & Destructor Documentation

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

Definition at line 18 of file Cluster1DCleaner.h.

00018                                                       :
00019         theZOffSet(zoffset), theUseError(useErr)
00020     {
00021         theCleanedCluster1Ds.clear();
00022         theDiscardedCluster1Ds.clear();
00023     }
    // return the compatible clusters


Member Function Documentation

template<class T>
float Cluster1DCleaner< T >::average ( const std::vector< Cluster1D< T > > &  clust  )  [inline, private]

Definition at line 87 of file Cluster1DCleaner.h.

References err, err2, and funct::sqrt().

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

00088 {
00089 //    float ave = clust.front().position().value();
00090 //    float err = clust.front().position().error();
00091 //    for( typename std::vector < Cluster1D<T> >::const_iterator ic=(clust.begin())+1;
00092 //         ic != clust.end(); ic++)
00093 //    {
00094 //        float oldave = ave;
00095 //        float olderr = err;
00096 //        ave = ( oldave/olderr/olderr +
00097 //                ic->position().value()/ic->position().error()/ic->position().error()) /
00098 //              (1./olderr/olderr + 1./ic->position().error()/ic->position().error());
00099 //        err = sqrt(olderr*olderr + ic->position().error()*ic->position().error());
00100 //    }
00101   float sumUp = 0;
00102   float sumDown = 0;
00103   float err = 0;
00104   for( typename std::vector < Cluster1D<T> >::const_iterator ic=(clust.begin())+1;
00105        ic != clust.end(); ic++)
00106     {
00107       float err2 = ic->position().error();
00108       err2 *= err2;
00109       if (err2 != 0){
00110         sumUp += ic->position().value() / err2; // error-weighted average of Z at IP
00111         sumDown += 1/err2;
00112       }
00113       err += std::sqrt( err2 );
00114     }  
00115   return (sumDown>0) ? sumUp/sumDown : 0;
00116 }

template<class T>
void Cluster1DCleaner< T >::cleanCluster1Ds ( std::vector< Cluster1D< T > >  clust  )  [inline, private]

Definition at line 59 of file Cluster1DCleaner.h.

References pixeltemp::Cluster1DCleaner< T >::average(), pixeltemp::Cluster1DCleaner< T >::theCleanedCluster1Ds, pixeltemp::Cluster1DCleaner< T >::theDiscardedCluster1Ds, pixeltemp::Cluster1DCleaner< T >::theUseError, and pixeltemp::Cluster1DCleaner< T >::theZOffSet.

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

00060 {
00061     theCleanedCluster1Ds.clear();
00062     theDiscardedCluster1Ds.clear();
00063     if (clust.size() == 0)
00064         return;
00065     float oldPos = average(clust);
00066     for( typename std::vector < Cluster1D<T> >::const_iterator ic=clust.begin();
00067             ic != clust.end(); ic++)
00068     {
00069         float discr =
00070             theUseError ? fabs( ((*ic).position().value() - oldPos) / (*ic).position().error())
00071             : fabs( ((*ic).position().value() - oldPos) );
00072         if ( discr < theZOffSet )
00073         {
00074             theCleanedCluster1Ds.push_back(*ic);
00075         }
00076         else
00077         {
00078             theDiscardedCluster1Ds.push_back(*ic);
00079         }
00080     }
00081     return;
00082 }

template<class T>
std::vector< Cluster1D< T > > Cluster1DCleaner< T >::clusters ( std::vector< Cluster1D< T > >  clust  )  [inline]

Definition at line 51 of file Cluster1DCleaner.h.

References pixeltemp::Cluster1DCleaner< T >::cleanCluster1Ds(), and pixeltemp::Cluster1DCleaner< T >::theCleanedCluster1Ds.

00052 {
00053     cleanCluster1Ds(clust);
00054     return theCleanedCluster1Ds;
00055 }

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

Definition at line 31 of file Cluster1DCleaner.h.

00032     {
00033         return theDiscardedCluster1Ds;
00034     }


Member Data Documentation

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

Definition at line 39 of file Cluster1DCleaner.h.

Referenced by pixeltemp::Cluster1DCleaner< T >::cleanCluster1Ds(), pixeltemp::Cluster1DCleaner< reco::Track >::Cluster1DCleaner(), and pixeltemp::Cluster1DCleaner< T >::clusters().

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

Definition at line 40 of file Cluster1DCleaner.h.

Referenced by pixeltemp::Cluster1DCleaner< T >::cleanCluster1Ds(), pixeltemp::Cluster1DCleaner< reco::Track >::Cluster1DCleaner(), and pixeltemp::Cluster1DCleaner< reco::Track >::discardedCluster1Ds().

template<class T>
bool pixeltemp::Cluster1DCleaner< T >::theUseError [private]

Definition at line 42 of file Cluster1DCleaner.h.

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

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

Definition at line 41 of file Cluster1DCleaner.h.

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


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:50:28 2009 for CMSSW by  doxygen 1.5.4