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 (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

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 88 of file Cluster1DCleaner.h.

References mathSSE::sqrt().

Referenced by average.Average::__str__().

89 {
90  float ave = clust.front().position().value();
91  float err = clust.front().position().error();
92  for( typename std::vector < Cluster1D<T> >::const_iterator ic=(clust.begin())+1;
93  ic != clust.end(); ic++)
94  {
95  float oldave = ave;
96  float olderr = err;
97  ave = ( oldave/olderr/olderr +
98  ic->position().value()/ic->position().error()/ic->position().error()) /
99  (1./olderr/olderr + 1./ic->position().error()/ic->position().error());
100  err = sqrt(olderr*olderr + ic->position().error()*ic->position().error());
101  }
102  return ave;
103 }
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  std::vector<Cluster1D<T> > clust = _clust;
62  theCleanedCluster1Ds.clear();
63  theDiscardedCluster1Ds.clear();
64  if (clust.size() == 0)
65  return;
66  float oldPos = average(clust);
67  for( typename std::vector < Cluster1D<T> >::const_iterator ic=clust.begin();
68  ic != clust.end(); ic++)
69  {
70  float discr =
71  theUseError ? fabs( ((*ic).position().value() - oldPos) / (*ic).position().error())
72  : fabs( ((*ic).position().value() - oldPos) );
73  if ( discr < theZOffSet )
74  {
75  theCleanedCluster1Ds.push_back(*ic);
76  }
77  else
78  {
79  theDiscardedCluster1Ds.push_back(*ic);
80  }
81  }
82  return;
83 }
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 ( const std::vector< Cluster1D< T > > &  _clust)

Definition at line 50 of file Cluster1DCleaner.h.

51 {
52  std::vector<Cluster1D<T> > clust = _clust;
53  cleanCluster1Ds(clust);
54  return theCleanedCluster1Ds;
55 }
void cleanCluster1Ds(const 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.