CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
PVPositionBuilder Class Reference

#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. More...
 
 PVPositionBuilder ()
 Constructor does nothing, no data members. More...
 
Measurement1D wtAverage (const reco::TrackRefVector &trks) const
 Calculate Error-Weighted average of Z of tracks from const collection of track pointers. More...
 

Detailed Description

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

Date:
2007/03/12 00:50:36
Revision:
1.4
Author
Aaron Dominguez (UNL)

Definition at line 19 of file PVPositionBuilder.h.

Constructor & Destructor Documentation

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.

5 {}

Member Function Documentation

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().

7  {
8  // Cut and paste (more or less) from same class in ORCA framework
9  double ntracks = double(trks.size());
10  if (ntracks==0) return Measurement1D ( 0. , 0. );
11  double sumZIP = 0;
12  double err = 0;
13  for (unsigned int i=0; i<trks.size(); i++) {
14  sumZIP += trks[i]->dz(); // Z at IP
15  err += trks[i]->dzError(); // error on Z at IP (I hope). Fix d.k.
16  }
17  return Measurement1D ( sumZIP/ntracks, err/ntracks/std::sqrt(ntracks) );
18 
19 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:46
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89
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().

21  {
22  double ntracks = double(trks.size());
23  if (ntracks==0) return Measurement1D ( 0.0 , 0.0 );
24  double sumUp = 0;
25  double sumDown = 0;
26  double err = 0;
27  for (unsigned int i=0; i<trks.size(); i++) {
28  // double err2 = trks[i]->covariance(3,3); // error on Z at IP (I hope)
29  double err2 = trks[i]->dzError(); // Fix d.k.
30  err2 *= err2;
31  if (err2 != 0){
32  sumUp += trks[i]->dz() * 1/err2; // error-weighted average of Z at IP
33  sumDown += 1/err2;
34  }
35  err += std::sqrt( err2 );
36  }
37  if (sumDown > 0) return Measurement1D ( sumUp/sumDown , err/ntracks/sqrt(ntracks) );
38  else return Measurement1D ( 0.0 , 0.0 );
39 }
int i
Definition: DBlmapReader.cc:9
T sqrt(T t)
Definition: SSEVec.h:46
size_type size() const
Size of the RefVector.
Definition: RefVector.h:89