CMS 3D CMS Logo

pixeltemp::Cluster1DMerger< T > Class Template Reference

#include <RecoPixelVertexing/PixelVertexFinding/interface/Cluster1DMerger.h>

List of all members.

Public Member Functions

 Cluster1DMerger (const Cluster1DMerger &)
 Cluster1DMerger (const WeightEstimator< T > &)
Cluster1D< T > operator() (const Cluster1D< T > &first, const Cluster1D< T > &second) const
 ~Cluster1DMerger ()

Private Attributes

WeightEstimator< T > * theEstimator


Detailed Description

template<class T>
class pixeltemp::Cluster1DMerger< T >

Definition at line 15 of file Cluster1DMerger.h.


Constructor & Destructor Documentation

template<class T>
Cluster1DMerger< T >::Cluster1DMerger ( const WeightEstimator< T > &  est  )  [inline]

Definition at line 33 of file Cluster1DMerger.h.

00033                                    : theEstimator ( est.clone() )
00034 {}

template<class T>
Cluster1DMerger< T >::~Cluster1DMerger (  )  [inline]

Definition at line 37 of file Cluster1DMerger.h.

References pixeltemp::Cluster1DMerger< T >::theEstimator.

00038 {
00039     delete theEstimator;
00040 }

template<class T>
Cluster1DMerger< T >::Cluster1DMerger ( const Cluster1DMerger< T > &  other  )  [inline]

Definition at line 43 of file Cluster1DMerger.h.

00043                                                                     :
00044         theEstimator ( other.theEstimator->clone() )
00045 {}


Member Function Documentation

template<class T>
Cluster1D< T > Cluster1DMerger< T >::operator() ( const Cluster1D< T > &  first,
const Cluster1D< T > &  second 
) const [inline]

Definition at line 48 of file Cluster1DMerger.h.

References err, err2, Measurement1D::error(), i, Cluster1D< T >::position(), funct::sqrt(), pixeltemp::Cluster1DMerger< T >::theEstimator, Cluster1D< T >::tracks(), tracks, Measurement1D::value(), and Cluster1D< T >::weight().

00050 {
00051     std::vector < const T * > tracks = first.tracks();
00052     std::vector < const T * > sectracks = second.tracks();
00053     for ( typename std::vector< const T * >::const_iterator i=sectracks.begin(); i!=sectracks.end() ; ++i )
00054     {
00055         tracks.push_back ( *i );
00056     };
00057     float newpos = ( first.position().value() * first.weight() / first.position().error() / first.position().error() +
00058                      second.position().value() * second.weight() / second.position().error() / second.position().error() ) /
00059                    ( first.weight() / first.position().error()/ first.position().error() +
00060                      second.weight() / second.position().error()/ second.position().error() );
00061 
00062     float newerr = sqrt ( first.position().error() * first.position().error() +
00063                           second.position().error() * second.position().error() );
00064     float newWeight = theEstimator->weight ( tracks );
00065 
00066     // Now try a different method
00067     float sumUp = 0;
00068     float sumDown = 0;
00069     float err = 0;
00070     for (unsigned int i=0; i<tracks.size(); ++i) {
00071 
00072 //      float err2 = tracks[i]->covariance( reco::TrackBase::i_dz, reco::TrackBase::i_dz );
00073       float err2 = tracks[i]->dzError(); err2 *= err2;    
00074       
00075       if (err2 != 0){
00076         sumUp += tracks[i]->dz() * 1/err2; // error-weighted average of Z at IP
00077         sumDown += 1/err2;
00078       }
00079       err += sqrt( err2 );
00080     }  
00081       
00082     newpos = sumUp/sumDown;
00083     newerr = err/tracks.size()/sqrt(1.0*tracks.size());
00084 
00085     Measurement1D newmeas ( newpos, newerr );
00086     return Cluster1D<T> ( newmeas, tracks, newWeight );
00087 }


Member Data Documentation

template<class T>
WeightEstimator<T>* pixeltemp::Cluster1DMerger< T >::theEstimator [private]

Definition at line 24 of file Cluster1DMerger.h.

Referenced by pixeltemp::Cluster1DMerger< T >::operator()(), and pixeltemp::Cluster1DMerger< T >::~Cluster1DMerger().


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:50:28 2009 for CMSSW by  doxygen 1.5.4