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
Cluster1DCleaner< T > Class Template Reference

#include <Cluster1DCleaner.h>

Public Member Functions

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

Private Member Functions

float average (const std::vector< Cluster1D< T > > &)
 
void cleanCluster1Ds (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

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

Definition at line 17 of file Cluster1DCleaner.h.

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

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

References mathSSE::sqrt().

87 {
88  float ave = clust.front().position().value();
89  float err = clust.front().position().error();
90  for( typename std::vector < Cluster1D<T> >::const_iterator ic=(clust.begin())+1;
91  ic != clust.end(); ic++)
92  {
93  float oldave = ave;
94  float olderr = err;
95  ave = ( oldave/olderr/olderr +
96  ic->position().value()/ic->position().error()/ic->position().error()) /
97  (1./olderr/olderr + 1./ic->position().error()/ic->position().error());
98  err = sqrt(olderr*olderr + ic->position().error()*ic->position().error());
99  }
100  return ave;
101 }
T sqrt(T t)
Definition: SSEVec.h:48
template<class T >
void Cluster1DCleaner< T >::cleanCluster1Ds ( std::vector< Cluster1D< T > >  clust)
private

Definition at line 58 of file Cluster1DCleaner.h.

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

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

Definition at line 50 of file Cluster1DCleaner.h.

51 {
52  cleanCluster1Ds(clust);
53  return theCleanedCluster1Ds;
54 }
void cleanCluster1Ds(std::vector< Cluster1D< T > >)
std::vector< Cluster1D< T > > theCleanedCluster1Ds
template<class T>
std::vector< Cluster1D< T > > Cluster1DCleaner< T >::discardedCluster1Ds ( ) const
inline

Definition at line 30 of file Cluster1DCleaner.h.

References Cluster1DCleaner< T >::theDiscardedCluster1Ds.

31  {
33  }
std::vector< Cluster1D< T > > theDiscardedCluster1Ds

Member Data Documentation

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

Definition at line 38 of file Cluster1DCleaner.h.

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

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

Definition at line 41 of file Cluster1DCleaner.h.

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

Definition at line 40 of file Cluster1DCleaner.h.