CMS 3D CMS Logo

DivisiveVertexFinder Class Reference

Description: Fits a primary vertex in 1D (z) using the "divisive method". More...

#include <RecoPixelVertexing/PixelVertexFinding/interface/DivisiveVertexFinder.h>

List of all members.

Public Member Functions

 DivisiveVertexFinder (double zOffset=5.0, int ntrkMin=5, bool useError=true, double zSeparation=0.05, bool wtAverage=true, int verbosity=0)
bool findVertexes (const reco::TrackRefVector &trks, reco::VertexCollection &vertexes)
 Run the divisive algorithm and return a vector of vertexes for the input track collection.
bool findVertexesAlt (const reco::TrackRefVector &trks, reco::VertexCollection &vertexes)
 ~DivisiveVertexFinder ()

Private Attributes

pixeltemp::DivisiveClusterizer1D
< reco::Track
divmeth_
 We use Wolfgang's templated class that implements the actual divisive method.
int ntrkMin_
bool useError_
int verbose_
bool wtAverage_
double zOffset_
 Cuts on vertex formation and other options.
double zSeparation_


Detailed Description

Description: Fits a primary vertex in 1D (z) using the "divisive method".

Implementation: This class was ported from ORCA by me (Aaron). It was originally written by ... Find the PV candidates with a simple divisive method. Divide the luminosity region in several regions according to the track distance and for each of them make a PVCluster. Iteratively discard tracks and recover them in a new PVCluster. Return a sorted vector<Vertex> (aka VertexCollection) with the z coordinate of PV candidates

Parameters:
ntkmin Minimum number of tracks required to form a cluster.
useError physical distances or weighted distances.
zsep Maximum distance between two adjacent tracks that belong to the same initial cluster.
wei Compute the cluster "center" with an unweighted or a weighted average of the tracks. Weighted means weighted with the error of the data point.
Date
2006/08/10 03:06:08
Revision
1.6
Author:
Aaron Dominguez (UNL)

Definition at line 34 of file DivisiveVertexFinder.h.


Constructor & Destructor Documentation

DivisiveVertexFinder::DivisiveVertexFinder ( double  zOffset = 5.0,
int  ntrkMin = 5,
bool  useError = true,
double  zSeparation = 0.05,
bool  wtAverage = true,
int  verbosity = 0 
)

Definition at line 13 of file DivisiveVertexFinder.cc.

00016   : zOffset_(zOffset), zSeparation_(zSeparation), ntrkMin_(ntrkMin), useError_(useError),
00017     wtAverage_(wtAverage),
00018     divmeth_(zOffset, ntrkMin, useError, zSeparation, wtAverage),
00019     verbose_(verbosity)
00020 {
00021 
00022 }

DivisiveVertexFinder::~DivisiveVertexFinder (  ) 

Definition at line 24 of file DivisiveVertexFinder.cc.

00024 {}


Member Function Documentation

bool DivisiveVertexFinder::findVertexes ( const reco::TrackRefVector trks,
reco::VertexCollection vertexes 
)

Run the divisive algorithm and return a vector of vertexes for the input track collection.

Definition at line 26 of file DivisiveVertexFinder.cc.

References PVPositionBuilder::average(), err, Measurement1D::error(), i, edm::RefVector< C, T, F >::size(), v, Measurement1D::value(), PVPositionBuilder::wtAverage(), and wtAverage_.

Referenced by PixelVertexProducer::produce().

00027                                                                        { // output
00028   PVPositionBuilder pos;
00029   Measurement1D vz;
00030   if (wtAverage_) {
00031     vz = pos.wtAverage(trks);
00032   }
00033   else {
00034     vz = pos.average(trks);
00035   }
00036   reco::Vertex::Error err;
00037   err(2,2) = vz.error()*vz.error();
00038 
00039   reco::Vertex v( reco::Vertex::Point(0,0,vz.value()), err, 0, 1, trks.size() );
00040   for (unsigned int i=0; i<trks.size(); i++) {
00041     v.add(reco::TrackBaseRef(trks[i]));
00042   }
00043 
00044   vertexes.push_back(v);
00045 
00046   return true;
00047 }

bool DivisiveVertexFinder::findVertexesAlt ( const reco::TrackRefVector trks,
reco::VertexCollection vertexes 
)

Definition at line 49 of file DivisiveVertexFinder.cc.

References divmeth_, err, i, in, out, edm::RefVector< C, T, F >::size(), python::multivaluedict::sort(), funct::sqrt(), pyDBSRunClass::temp, v, and verbose_.

Referenced by PixelVertexProducer::produce().

00050                                                                           { // output
00051   std::vector< PVCluster > in;
00052   std::pair< std::vector< PVCluster >, std::vector< const reco::Track* > > out;
00053   
00054   // Convert input track collection into container needed by Wolfgang's templated code
00055   // Need to save a map to reconvert from bare pointers, oy vey
00056   std::map< const reco::Track*, reco::TrackRef > mapa; 
00057   //  std::vector< std::vector< const reco::Track* > > trkps;
00058   for (unsigned int i=0; i<trks.size(); ++i) {
00059     std::vector< const reco::Track* > temp;
00060     temp.clear();
00061     temp.push_back( &(*trks[i]) );
00062 
00063     in.push_back( PVCluster( Measurement1D(trks[i]->dz(), trks[i]->dzError() ), temp ) );
00064     mapa[temp[0]] = trks[i];
00065   }
00066 
00067   if (verbose_ > 0 ) {
00068     edm::LogInfo("DivisiveVertexFinder") << "size of input vector of clusters " << in.size();
00069     for (unsigned int i=0; i<in.size(); ++i) {
00070       edm::LogInfo("DivisiveVertexFinder") << "Track " << i << " addr " << in[i].tracks()[0] 
00071                                            << " dz " << in[i].tracks()[0]->dz()
00072                                            << " +- " << in[i].tracks()[0]->dzError()
00073                                            << " prodID " << mapa[in[i].tracks()[0]].id()
00074                                            << " dz from RefTrack " << mapa[in[i].tracks()[0]]->dz()
00075                                            << " +- " << mapa[in[i].tracks()[0]]->dzError();
00076     }
00077   }
00078 
00079   // Run the darn thing
00080   out = divmeth_(in);
00081 
00082   if (verbose_ > 0) edm::LogInfo("DivisiveVertexFinder") << " DivisiveClusterizer1D found " 
00083                                                          << out.first.size() << " vertexes";
00084 
00085   // Now convert the output yet again into something we can safely store in the event
00086   for (unsigned int iv=0; iv<out.first.size(); ++iv) { // loop over output vertexes
00087     reco::Vertex::Error err;
00088     err(2,2) = out.first[iv].position().error()*out.first[iv].position().error();
00089     
00090     reco::Vertex v( reco::Vertex::Point(0,0,out.first[iv].position().value()), err, 0, 1, out.second.size() );
00091     if (verbose_ > 0 ) edm::LogInfo("DivisiveVertexFinder") << " DivisiveClusterizer1D vertex " << iv 
00092                                                             << " has " << out.first[iv].tracks().size()
00093                                                             << " tracks and a position of " << v.z() 
00094                                                             << " +- " << std::sqrt(v.error(2,2));
00095     for (unsigned int itrk=0; itrk<out.first[iv].tracks().size(); ++itrk) {
00096       v.add( reco::TrackBaseRef(mapa[out.first[iv].tracks()[itrk]] ) );
00097     }
00098     vertexes.push_back(v); // Done with horrible conversion, save it
00099   }
00100 
00101   // Finally, sort the vertexes in decreasing sumPtSquared
00102   std::sort(vertexes.begin(), vertexes.end(), PVClusterComparer());
00103 
00104   return true;
00105 }


Member Data Documentation

pixeltemp::DivisiveClusterizer1D< reco::Track > DivisiveVertexFinder::divmeth_ [private]

We use Wolfgang's templated class that implements the actual divisive method.

Definition at line 52 of file DivisiveVertexFinder.h.

Referenced by findVertexesAlt().

int DivisiveVertexFinder::ntrkMin_ [private]

Definition at line 48 of file DivisiveVertexFinder.h.

bool DivisiveVertexFinder::useError_ [private]

Definition at line 49 of file DivisiveVertexFinder.h.

int DivisiveVertexFinder::verbose_ [private]

Definition at line 56 of file DivisiveVertexFinder.h.

Referenced by findVertexesAlt().

bool DivisiveVertexFinder::wtAverage_ [private]

Definition at line 49 of file DivisiveVertexFinder.h.

Referenced by findVertexes().

double DivisiveVertexFinder::zOffset_ [private]

Cuts on vertex formation and other options.

Definition at line 47 of file DivisiveVertexFinder.h.

double DivisiveVertexFinder::zSeparation_ [private]

Definition at line 47 of file DivisiveVertexFinder.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:29 2009 for CMSSW by  doxygen 1.5.4