CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
pixeltemp::Cluster1DCleaner< T > Class Template Reference

#include <Cluster1DCleaner.h>

Public Member Functions

 Cluster1DCleaner (const float zoffset, bool useErr)
 
std::vector< Cluster1D< T > > clusters (const std::vector< Cluster1D< T > > &)
 
std::vector< Cluster1D< T > > discardedCluster1Ds () const
 

Private Member Functions

float average (const std::vector< Cluster1D< T > > &)
 
void cleanCluster1Ds (const 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 16 of file Cluster1DCleaner.h.

Constructor & Destructor Documentation

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

Definition at line 20 of file Cluster1DCleaner.h.

20  :
21  theZOffSet(zoffset), theUseError(useErr)
22  {
23  theCleanedCluster1Ds.clear();
24  theDiscardedCluster1Ds.clear();
25  }
std::vector< Cluster1D< T > > theDiscardedCluster1Ds
std::vector< Cluster1D< T > > theCleanedCluster1Ds

Member Function Documentation

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

Definition at line 89 of file Cluster1DCleaner.h.

References mathSSE::sqrt().

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

90 {
91 // float ave = clust.front().position().value();
92 // float err = clust.front().position().error();
93 // for( typename std::vector < Cluster1D<T> >::const_iterator ic=(clust.begin())+1;
94 // ic != clust.end(); ic++)
95 // {
96 // float oldave = ave;
97 // float olderr = err;
98 // ave = ( oldave/olderr/olderr +
99 // ic->position().value()/ic->position().error()/ic->position().error()) /
100 // (1./olderr/olderr + 1./ic->position().error()/ic->position().error());
101 // err = sqrt(olderr*olderr + ic->position().error()*ic->position().error());
102 // }
103  float sumUp = 0;
104  float sumDown = 0;
105  float err = 0;
106  for( typename std::vector < Cluster1D<T> >::const_iterator ic=(clust.begin())+1;
107  ic != clust.end(); ic++)
108  {
109  float err2 = ic->position().error();
110  err2 *= err2;
111  if (err2 != 0){
112  sumUp += ic->position().value() / err2; // error-weighted average of Z at IP
113  sumDown += 1/err2;
114  }
115  err += std::sqrt( err2 );
116  }
117  return (sumDown>0) ? sumUp/sumDown : 0;
118 }
T sqrt(T t)
Definition: SSEVec.h:18
template<class T>
void Cluster1DCleaner< T >::cleanCluster1Ds ( const std::vector< Cluster1D< T > > &  clust)
private

Definition at line 61 of file Cluster1DCleaner.h.

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

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

62 {
63  theCleanedCluster1Ds.clear();
64  theDiscardedCluster1Ds.clear();
65  if (clust.empty())
66  return;
67  float oldPos = average(clust);
68  for( typename std::vector < Cluster1D<T> >::const_iterator ic=clust.begin();
69  ic != clust.end(); ic++)
70  {
71  float discr =
72  theUseError ? fabs( ((*ic).position().value() - oldPos) / (*ic).position().error())
73  : fabs( ((*ic).position().value() - oldPos) );
74  if ( discr < theZOffSet )
75  {
76  theCleanedCluster1Ds.push_back(*ic);
77  }
78  else
79  {
80  theDiscardedCluster1Ds.push_back(*ic);
81  }
82  }
83  return;
84 }
std::vector< Cluster1D< T > > theDiscardedCluster1Ds
std::vector< Cluster1D< T > > theCleanedCluster1Ds
float average(const std::vector< Cluster1D< T > > &)
template<class T>
std::vector< Cluster1D< T > > Cluster1DCleaner< T >::clusters ( const std::vector< Cluster1D< T > > &  clust)

Definition at line 53 of file Cluster1DCleaner.h.

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

Referenced by pixeltemp::Cluster1DCleaner< reco::Track >::Cluster1DCleaner().

54 {
55  cleanCluster1Ds(clust);
56  return theCleanedCluster1Ds;
57 }
std::vector< Cluster1D< T > > theCleanedCluster1Ds
void cleanCluster1Ds(const std::vector< Cluster1D< T > > &)
template<class T>
std::vector< Cluster1D< T > > pixeltemp::Cluster1DCleaner< T >::discardedCluster1Ds ( ) const
inline

Definition at line 33 of file Cluster1DCleaner.h.

34  {
36  }
std::vector< Cluster1D< T > > theDiscardedCluster1Ds

Member Data Documentation

template<class T>
std::vector<Cluster1D<T> > pixeltemp::Cluster1DCleaner< T >::theCleanedCluster1Ds
private
template<class T>
std::vector<Cluster1D<T> > pixeltemp::Cluster1DCleaner< T >::theDiscardedCluster1Ds
private
template<class T>
bool pixeltemp::Cluster1DCleaner< T >::theUseError
private
template<class T>
float pixeltemp::Cluster1DCleaner< T >::theZOffSet
private