#include <RecoPixelVertexing/PixelVertexFinding/interface/DivisiveVertexFinder.h>
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, const math::XYZPoint &bs) |
~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_ |
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
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. |
Definition at line 34 of file DivisiveVertexFinder.h.
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 14 of file DivisiveVertexFinder.cc.
: zOffset_(zOffset), zSeparation_(zSeparation), ntrkMin_(ntrkMin), useError_(useError), wtAverage_(wtAverage), divmeth_(zOffset, ntrkMin, useError, zSeparation, wtAverage), verbose_(verbosity) { }
DivisiveVertexFinder::~DivisiveVertexFinder | ( | ) |
Definition at line 25 of file DivisiveVertexFinder.cc.
{}
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 27 of file DivisiveVertexFinder.cc.
References PVPositionBuilder::average(), Measurement1D::error(), i, edm::isNotFinite(), pos, edm::RefVector< C, T, F >::size(), findQualityFiles::v, Measurement1D::value(), PVPositionBuilder::wtAverage(), and wtAverage_.
Referenced by PixelVertexProducer::produce().
{ // output PVPositionBuilder pos; Measurement1D vz; if (wtAverage_) { vz = pos.wtAverage(trks); } else { vz = pos.average(trks); } reco::Vertex::Error err; err(2,2) = vz.error()*vz.error(); reco::Vertex v( reco::Vertex::Point(0,0,vz.value()), err, 0, 1, trks.size() ); for (unsigned int i=0; i<trks.size(); i++) { double vz = trks[i]->vz(); if(edm::isNotFinite(vz)) continue; v.add(reco::TrackBaseRef(trks[i])); } vertexes.push_back(v); return true; }
bool DivisiveVertexFinder::findVertexesAlt | ( | const reco::TrackRefVector & | trks, |
reco::VertexCollection & | vertexes, | ||
const math::XYZPoint & | bs | ||
) |
Definition at line 52 of file DivisiveVertexFinder.cc.
References divmeth_, i, recoMuon::in, edm::isNotFinite(), dbtoconf::out, pixeltemp::DivisiveClusterizer1D< T >::setBeamSpot(), edm::RefVector< C, T, F >::size(), python::multivaluedict::sort(), mathSSE::sqrt(), groupFilesInBlocks::temp, findQualityFiles::v, and verbose_.
Referenced by PixelVertexProducer::produce().
{ // output std::vector< PVCluster > in; std::pair< std::vector< PVCluster >, std::vector< const reco::Track* > > out; // Convert input track collection into container needed by Wolfgang's templated code // Need to save a map to reconvert from bare pointers, oy vey std::map< const reco::Track*, reco::TrackRef > mapa; // std::vector< std::vector< const reco::Track* > > trkps; for (unsigned int i=0; i<trks.size(); ++i) { double vz = trks[i]->vz(); if(edm::isNotFinite(vz)) continue; std::vector< const reco::Track* > temp; temp.clear(); temp.push_back( &(*trks[i]) ); in.push_back( PVCluster( Measurement1D(trks[i]->dz(bs), trks[i]->dzError() ), temp ) ); mapa[temp[0]] = trks[i]; } if (verbose_ > 0 ) { edm::LogInfo("DivisiveVertexFinder") << "size of input vector of clusters " << in.size(); for (unsigned int i=0; i<in.size(); ++i) { edm::LogInfo("DivisiveVertexFinder") << "Track " << i << " addr " << in[i].tracks()[0] << " dz " << in[i].tracks()[0]->dz(bs) << " +- " << in[i].tracks()[0]->dzError() << " prodID " << mapa[in[i].tracks()[0]].id() << " dz from RefTrack " << mapa[in[i].tracks()[0]]->dz(bs) << " +- " << mapa[in[i].tracks()[0]]->dzError(); } } // Run the darn thing divmeth_.setBeamSpot(bs); out = divmeth_(in); if (verbose_ > 0) edm::LogInfo("DivisiveVertexFinder") << " DivisiveClusterizer1D found " << out.first.size() << " vertexes"; // Now convert the output yet again into something we can safely store in the event for (unsigned int iv=0; iv<out.first.size(); ++iv) { // loop over output vertexes reco::Vertex::Error err; err(2,2) = out.first[iv].position().error()*out.first[iv].position().error(); reco::Vertex v( reco::Vertex::Point(0,0,out.first[iv].position().value()), err, 0, 1, out.second.size() ); if (verbose_ > 0 ) edm::LogInfo("DivisiveVertexFinder") << " DivisiveClusterizer1D vertex " << iv << " has " << out.first[iv].tracks().size() << " tracks and a position of " << v.z() << " +- " << std::sqrt(v.covariance(2,2)); for (unsigned int itrk=0; itrk<out.first[iv].tracks().size(); ++itrk) { v.add( reco::TrackBaseRef(mapa[out.first[iv].tracks()[itrk]] ) ); } vertexes.push_back(v); // Done with horrible conversion, save it } // Finally, sort the vertexes in decreasing sumPtSquared std::sort(vertexes.begin(), vertexes.end(), PVClusterComparer()); return true; }
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.