CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 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.

18  :
19  theZOffSet(zoffset), theUseError(useErr)
20  {
21  theCleanedCluster1Ds.clear();
22  theDiscardedCluster1Ds.clear();
23  }
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 87 of file Cluster1DCleaner.h.

References mathSSE::sqrt().

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

Definition at line 59 of file Cluster1DCleaner.h.

References PDRates::average, and listHistos::discr.

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

Definition at line 51 of file Cluster1DCleaner.h.

52 {
53  cleanCluster1Ds(clust);
54  return theCleanedCluster1Ds;
55 }
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 31 of file Cluster1DCleaner.h.

32  {
34  }
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

Definition at line 42 of file Cluster1DCleaner.h.

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

Definition at line 41 of file Cluster1DCleaner.h.