CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
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 Cluster1DCleaner< T >

Definition at line 13 of file Cluster1DCleaner.h.

Constructor & Destructor Documentation

◆ Cluster1DCleaner()

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

Definition at line 15 of file Cluster1DCleaner.h.

References Cluster1DCleaner< T >::theCleanedCluster1Ds, and Cluster1DCleaner< T >::theDiscardedCluster1Ds.

15  : theZOffSet(zoffset), theUseError(useErr) {
16  theCleanedCluster1Ds.clear();
17  theDiscardedCluster1Ds.clear();
18  }
std::vector< Cluster1D< T > > theDiscardedCluster1Ds
std::vector< Cluster1D< T > > theCleanedCluster1Ds

Member Function Documentation

◆ average()

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

Definition at line 70 of file Cluster1DCleaner.h.

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

Referenced by average.Average::__str__().

70  {
71  float ave = clust.front().position().value();
72  float err = clust.front().position().error();
73  for (typename std::vector<Cluster1D<T> >::const_iterator ic = (clust.begin()) + 1; ic != clust.end(); ic++) {
74  float oldave = ave;
75  float olderr = err;
76  ave = (oldave / olderr / olderr + ic->position().value() / ic->position().error() / ic->position().error()) /
77  (1. / olderr / olderr + 1. / ic->position().error() / ic->position().error());
78  err = sqrt(olderr * olderr + ic->position().error() * ic->position().error());
79  }
80  return ave;
81 }
T sqrt(T t)
Definition: SSEVec.h:19

◆ cleanCluster1Ds()

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

Definition at line 49 of file Cluster1DCleaner.h.

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

49  {
50  std::vector<Cluster1D<T> > clust = _clust;
51  theCleanedCluster1Ds.clear();
52  theDiscardedCluster1Ds.clear();
53  if (clust.empty())
54  return;
55  float oldPos = average(clust);
56  for (typename std::vector<Cluster1D<T> >::const_iterator ic = clust.begin(); ic != clust.end(); ic++) {
57  float discr = theUseError ? fabs(((*ic).position().value() - oldPos) / (*ic).position().error())
58  : fabs(((*ic).position().value() - oldPos));
59  if (discr < theZOffSet) {
60  theCleanedCluster1Ds.push_back(*ic);
61  } else {
62  theDiscardedCluster1Ds.push_back(*ic);
63  }
64  }
65  return;
66 }
float average(const std::vector< Cluster1D< T > > &)
std::vector< Cluster1D< T > > theDiscardedCluster1Ds
std::vector< Cluster1D< T > > theCleanedCluster1Ds

◆ clusters()

template<class T >
std::vector< Cluster1D< T > > Cluster1DCleaner< T >::clusters ( const std::vector< Cluster1D< T > > &  _clust)

Definition at line 42 of file Cluster1DCleaner.h.

42  {
43  std::vector<Cluster1D<T> > clust = _clust;
44  cleanCluster1Ds(clust);
45  return theCleanedCluster1Ds;
46 }
void cleanCluster1Ds(const std::vector< Cluster1D< T > > &)
std::vector< Cluster1D< T > > theCleanedCluster1Ds

◆ discardedCluster1Ds()

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

Definition at line 26 of file Cluster1DCleaner.h.

References Cluster1DCleaner< T >::theDiscardedCluster1Ds.

26 { return theDiscardedCluster1Ds; }
std::vector< Cluster1D< T > > theDiscardedCluster1Ds

Member Data Documentation

◆ theCleanedCluster1Ds

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

Definition at line 31 of file Cluster1DCleaner.h.

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

◆ theDiscardedCluster1Ds

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

◆ theUseError

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

Definition at line 34 of file Cluster1DCleaner.h.

◆ theZOffSet

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

Definition at line 33 of file Cluster1DCleaner.h.