CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
pixeltemp::Cluster1DMerger< T > Class Template Reference

#include <Cluster1DMerger.h>

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 17 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 37 of file Cluster1DMerger.h.

Referenced by pixeltemp::Cluster1DMerger< reco::Track >::setBeamSpot().

37  : theEstimator ( est.clone() ), theBS(bs)
38 {}
WeightEstimator< T > * theEstimator
virtual WeightEstimator * clone() const =0
template<class T >
Cluster1DMerger< T >::~Cluster1DMerger ( )

Definition at line 41 of file Cluster1DMerger.h.

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

Referenced by pixeltemp::Cluster1DMerger< reco::Track >::setBeamSpot().

42 {
43  delete theEstimator;
44 }
WeightEstimator< T > * theEstimator
template<class T>
Cluster1DMerger< T >::Cluster1DMerger ( const Cluster1DMerger< T > &  other)

Definition at line 47 of file Cluster1DMerger.h.

47  :
48  theEstimator ( other.theEstimator->clone() ), theBS(other.theBS)
49 {}
WeightEstimator< T > * theEstimator
WeightEstimator< T > * theEstimator

Member Function Documentation

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

Definition at line 52 of file Cluster1DMerger.h.

References Measurement1D::error(), mps_fire::i, Cluster1D< T >::position(), mathSSE::sqrt(), pixeltemp::Cluster1DMerger< T >::theBS, pixeltemp::Cluster1DMerger< T >::theEstimator, l1t::tracks, Cluster1D< T >::tracks(), Measurement1D::value(), and Cluster1D< T >::weight().

Referenced by pixeltemp::Cluster1DMerger< reco::Track >::setBeamSpot().

54 {
55  std::vector < const T * > tracks = first.tracks();
56  std::vector < const T * > sectracks = second.tracks();
57  for ( typename std::vector< const T * >::const_iterator i=sectracks.begin(); i!=sectracks.end() ; ++i )
58  {
59  tracks.push_back ( *i );
60  };
61  float newpos = ( first.position().value() * first.weight() / first.position().error() / first.position().error() +
62  second.position().value() * second.weight() / second.position().error() / second.position().error() ) /
63  ( first.weight() / first.position().error()/ first.position().error() +
64  second.weight() / second.position().error()/ second.position().error() );
65 
66  float newerr = sqrt ( first.position().error() * first.position().error() +
67  second.position().error() * second.position().error() );
68  float newWeight = theEstimator->weight ( tracks );
69 
70  // Now try a different method
71  float sumUp = 0;
72  float sumDown = 0;
73  float err = 0;
74  for (unsigned int i=0; i<tracks.size(); ++i) {
75 
76 // float err2 = tracks[i]->covariance( reco::TrackBase::i_dz, reco::TrackBase::i_dz );
77  float err2 = tracks[i]->dzError(); err2 *= err2;
78 
79  if (err2 != 0){
80  sumUp += tracks[i]->dz(theBS) * 1/err2; // error-weighted average of Z at IP
81  sumDown += 1/err2;
82  }
83  err += sqrt( err2 );
84  }
85 
86  newpos = sumUp/sumDown;
87  newerr = err/tracks.size()/sqrt(1.0*tracks.size());
88 
89  Measurement1D newmeas ( newpos, newerr );
90  return Cluster1D<T> ( newmeas, tracks, newWeight );
91 }
double error() const
Definition: Measurement1D.h:30
T sqrt(T t)
Definition: SSEVec.h:18
WeightEstimator< T > * theEstimator
std::vector< const T * > tracks() const
Definition: Cluster1D.h:49
Measurement1D position() const
Definition: Cluster1D.h:55
double weight() const
Definition: Cluster1D.h:61
double value() const
Definition: Measurement1D.h:28
template<class T>
void pixeltemp::Cluster1DMerger< T >::setBeamSpot ( const math::XYZPoint bs)
inline

Definition at line 21 of file Cluster1DMerger.h.

21 { 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