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

◆ Cluster1DCleaner()

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  }

Member Function Documentation

◆ average()

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

Definition at line 71 of file Cluster1DCleaner.h.

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  }

◆ cleanCluster1Ds()

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

Definition at line 51 of file Cluster1DCleaner.h.

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  }

◆ clusters()

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  }

◆ discardedCluster1Ds()

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

Definition at line 29 of file Cluster1DCleaner.h.

29 { return theDiscardedCluster1Ds; }

Member Data Documentation

◆ theCleanedCluster1Ds

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

◆ theDiscardedCluster1Ds

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

◆ theUseError

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

Definition at line 37 of file Cluster1DCleaner.h.

◆ theZOffSet

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

Definition at line 36 of file Cluster1DCleaner.h.

pixeltemp::Cluster1DCleaner::average
float average(const std::vector< Cluster1D< T > > &)
Definition: Cluster1DCleaner.h:71
Cluster1D
Definition: Cluster1D.h:13
pixeltemp::Cluster1DCleaner::theDiscardedCluster1Ds
std::vector< Cluster1D< T > > theDiscardedCluster1Ds
Definition: Cluster1DCleaner.h:35
pixeltemp::Cluster1DCleaner::theCleanedCluster1Ds
std::vector< Cluster1D< T > > theCleanedCluster1Ds
Definition: Cluster1DCleaner.h:34
listHistos.discr
discr
Definition: listHistos.py:51
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
pixeltemp::Cluster1DCleaner::theUseError
bool theUseError
Definition: Cluster1DCleaner.h:37
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
submitPVResolutionJobs.err
err
Definition: submitPVResolutionJobs.py:85
pixeltemp::Cluster1DCleaner::theZOffSet
float theZOffSet
Definition: Cluster1DCleaner.h:36
pixeltemp::Cluster1DCleaner::cleanCluster1Ds
void cleanCluster1Ds(const std::vector< Cluster1D< T > > &)
Definition: Cluster1DCleaner.h:51