CMS 3D CMS Logo

Public Member Functions | Private Attributes

Cluster1DMerger< T > Class Template Reference

#include <Cluster1DMerger.h>

List of all members.

Public Member Functions

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

Private Attributes

WeightEstimator< T > * theEstimator

Detailed Description

template<class T>
class Cluster1DMerger< T >

The class that should always be used to merge two Cluster1D into a single Cluster1D.

Definition at line 14 of file Cluster1DMerger.h.


Constructor & Destructor Documentation

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

Definition at line 32 of file Cluster1DMerger.h.

                                   : theEstimator ( est.clone() )
{}
template<class T >
Cluster1DMerger< T >::~Cluster1DMerger ( )

Definition at line 36 of file Cluster1DMerger.h.

{
    delete theEstimator;
}
template<class T >
Cluster1DMerger< T >::Cluster1DMerger ( const Cluster1DMerger< T > &  other)

Definition at line 42 of file Cluster1DMerger.h.

                                                                    :
        theEstimator ( other.theEstimator->clone() )
{}

Member Function Documentation

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

Definition at line 47 of file Cluster1DMerger.h.

References Measurement1D::error(), i, Cluster1D< T >::position(), mathSSE::sqrt(), Cluster1D< T >::tracks(), testEve_cfg::tracks, Measurement1D::value(), and Cluster1D< T >::weight().

{
    std::vector < const T * > tracks = first.tracks();
    std::vector < const T * > sectracks = second.tracks();
    for ( typename std::vector< const T * >::const_iterator i=sectracks.begin(); 
          i!=sectracks.end() ; ++i )
    {
        tracks.push_back ( *i );
    };
    double V1=first.position().error() * first.position().error();
    double V2=second.position().error() * second.position().error();
    double C1=first.weight() / V1;
    double C2=second.weight() / V2;

    double newpos = ( first.position().value() * C1 +
                     second.position().value() * C2 ) / ( C1 + C2 );

    double newerr = sqrt ( C1 * C1 * V1 + C2 * C2 * V2 ) / ( C1 + C2 );
    double newWeight = theEstimator->weight ( tracks );

    Measurement1D newmeas ( newpos, newerr );
    return Cluster1D<T> ( newmeas, tracks, newWeight );
}

Member Data Documentation

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

Definition at line 23 of file Cluster1DMerger.h.