CMS 3D CMS Logo

Public Member Functions | Private Attributes

pixeltemp::Cluster1DMerger< T > Class Template Reference

#include <Cluster1DMerger.h>

List of all members.

Public Member Functions

 Cluster1DMerger (const WeightEstimator< T > &, const math::XYZPoint &bs=math::XYZPoint(0., 0., 0.))
 Cluster1DMerger (const Cluster1DMerger &)
Cluster1D< Toperator() (const Cluster1D< T > &first, const Cluster1D< T > &second) const
void setBeamSpot (const math::XYZPoint &bs)
 ~Cluster1DMerger ()

Private Attributes

math::XYZPoint theBS
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,
const math::XYZPoint bs = math::XYZPoint(0.,0.,0.) 
)

Definition at line 35 of file Cluster1DMerger.h.

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

Definition at line 39 of file Cluster1DMerger.h.

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

Definition at line 45 of file Cluster1DMerger.h.

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

Member Function Documentation

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

Definition at line 50 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 );
    };
    float newpos = ( first.position().value() * first.weight() / first.position().error() / first.position().error() +
                     second.position().value() * second.weight() / second.position().error() / second.position().error() ) /
                   ( first.weight() / first.position().error()/ first.position().error() +
                     second.weight() / second.position().error()/ second.position().error() );

    float newerr = sqrt ( first.position().error() * first.position().error() +
                          second.position().error() * second.position().error() );
    float newWeight = theEstimator->weight ( tracks );

    // Now try a different method
    float sumUp = 0;
    float sumDown = 0;
    float err = 0;
    for (unsigned int i=0; i<tracks.size(); ++i) {

//      float err2 = tracks[i]->covariance( reco::TrackBase::i_dz, reco::TrackBase::i_dz );
      float err2 = tracks[i]->dzError(); err2 *= err2;    
      
      if (err2 != 0){
        sumUp += tracks[i]->dz(theBS) * 1/err2; // error-weighted average of Z at IP
        sumDown += 1/err2;
      }
      err += sqrt( err2 );
    }  
      
    newpos = sumUp/sumDown;
    newerr = err/tracks.size()/sqrt(1.0*tracks.size());

    Measurement1D newmeas ( newpos, newerr );
    return Cluster1D<T> ( newmeas, tracks, newWeight );
}
template<class T>
void pixeltemp::Cluster1DMerger< T >::setBeamSpot ( const math::XYZPoint bs) [inline]

Definition at line 19 of file Cluster1DMerger.h.

{ theBS = bs; }

Member Data Documentation

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

Definition at line 25 of file Cluster1DMerger.h.