#include <RecoPixelVertexing/PixelVertexFinding/PVPositionBuilder.h>
Public Member Functions | |
Measurement1D | average (const reco::TrackRefVector &trks) const |
Calculate unweighted average of Z of tracks from const collection of track pointers. | |
PVPositionBuilder () | |
Constructor does nothing, no data members. | |
Measurement1D | wtAverage (const reco::TrackRefVector &trks) const |
Calculate Error-Weighted average of Z of tracks from const collection of track pointers. |
This helper class calculates the average Z position of a collection of tracks. You have the option of calculating the straight average, or making a weighted average using the error of the Z of the tracks. This class is used by the pixel vertexing to make a PVCluster and is used by other PVCluster-related classes
Definition at line 19 of file PVPositionBuilder.h.
PVPositionBuilder::PVPositionBuilder | ( | ) |
Constructor does nothing, no data members.
Constructor does nothing since this class has no data.
Definition at line 5 of file PVPositionBuilder.cc.
{}
Measurement1D PVPositionBuilder::average | ( | const reco::TrackRefVector & | trks | ) | const |
Calculate unweighted average of Z of tracks from const collection of track pointers.
Definition at line 7 of file PVPositionBuilder.cc.
References i, edm::RefVector< C, T, F >::size(), and mathSSE::sqrt().
Referenced by DivisiveVertexFinder::findVertexes().
{ // Cut and paste (more or less) from same class in ORCA framework double ntracks = double(trks.size()); if (ntracks==0) return Measurement1D ( 0. , 0. ); double sumZIP = 0; double err = 0; for (unsigned int i=0; i<trks.size(); i++) { sumZIP += trks[i]->dz(); // Z at IP err += trks[i]->dzError(); // error on Z at IP (I hope). Fix d.k. } return Measurement1D ( sumZIP/ntracks, err/ntracks/std::sqrt(ntracks) ); }
Measurement1D PVPositionBuilder::wtAverage | ( | const reco::TrackRefVector & | trks | ) | const |
Calculate Error-Weighted average of Z of tracks from const collection of track pointers.
Definition at line 21 of file PVPositionBuilder.cc.
References i, edm::RefVector< C, T, F >::size(), and mathSSE::sqrt().
Referenced by DivisiveVertexFinder::findVertexes().
{ double ntracks = double(trks.size()); if (ntracks==0) return Measurement1D ( 0.0 , 0.0 ); double sumUp = 0; double sumDown = 0; double err = 0; for (unsigned int i=0; i<trks.size(); i++) { // double err2 = trks[i]->covariance(3,3); // error on Z at IP (I hope) double err2 = trks[i]->dzError(); // Fix d.k. err2 *= err2; if (err2 != 0){ sumUp += trks[i]->dz() * 1/err2; // error-weighted average of Z at IP sumDown += 1/err2; } err += std::sqrt( err2 ); } if (sumDown > 0) return Measurement1D ( sumUp/sumDown , err/ntracks/sqrt(ntracks) ); else return Measurement1D ( 0.0 , 0.0 ); }