CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 16 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  : theZOffSet(zoffset), theUseError(useErr) {
19  theCleanedCluster1Ds.clear();
20  theDiscardedCluster1Ds.clear();
21  }
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 71 of file Cluster1DCleaner.h.

References submitPVValidationJobs::err, mathSSE::sqrt(), and trackerHitRTTI::vector.

71  {
72  // float ave = clust.front().position().value();
73  // float err = clust.front().position().error();
74  // for( typename std::vector < Cluster1D<T> >::const_iterator ic=(clust.begin())+1;
75  // ic != clust.end(); ic++)
76  // {
77  // float oldave = ave;
78  // float olderr = err;
79  // ave = ( oldave/olderr/olderr +
80  // ic->position().value()/ic->position().error()/ic->position().error()) /
81  // (1./olderr/olderr + 1./ic->position().error()/ic->position().error());
82  // err = sqrt(olderr*olderr + ic->position().error()*ic->position().error());
83  // }
84  float sumUp = 0;
85  float sumDown = 0;
86  float err = 0;
87  for (typename std::vector<Cluster1D<T> >::const_iterator ic = (clust.begin()) + 1; ic != clust.end(); ic++) {
88  float err2 = ic->position().error();
89  err2 *= err2;
90  if (err2 != 0) {
91  sumUp += ic->position().value() / err2; // error-weighted average of Z at IP
92  sumDown += 1 / err2;
93  }
94  err += std::sqrt(err2);
95  }
96  return (sumDown > 0) ? sumUp / sumDown : 0;
97  }
T sqrt(T t)
Definition: SSEVec.h:19
template<class T>
void Cluster1DCleaner< T >::cleanCluster1Ds ( const std::vector< Cluster1D< T > > &  clust)
private

Definition at line 51 of file Cluster1DCleaner.h.

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

51  {
52  theCleanedCluster1Ds.clear();
53  theDiscardedCluster1Ds.clear();
54  if (clust.empty())
55  return;
56  float oldPos = average(clust);
57  for (typename std::vector<Cluster1D<T> >::const_iterator ic = clust.begin(); ic != clust.end(); ic++) {
58  float discr = theUseError ? fabs(((*ic).position().value() - oldPos) / (*ic).position().error())
59  : fabs(((*ic).position().value() - oldPos));
60  if (discr < theZOffSet) {
61  theCleanedCluster1Ds.push_back(*ic);
62  } else {
63  theDiscardedCluster1Ds.push_back(*ic);
64  }
65  }
66  return;
67  }
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 45 of file Cluster1DCleaner.h.

45  {
46  cleanCluster1Ds(clust);
47  return theCleanedCluster1Ds;
48  }
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 29 of file Cluster1DCleaner.h.

29 { return theDiscardedCluster1Ds; }
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 37 of file Cluster1DCleaner.h.

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

Definition at line 36 of file Cluster1DCleaner.h.