A block of tracks linked together. More...
#include <PFDisplacedVertexCandidate.h>
Classes | |
struct | VertexLink |
Public Types | |
typedef std::map< float, std::pair< int, int > > | DistMap |
typedef std::vector< float > | DistVector |
typedef std::map< unsigned int, VertexLink > | VertexLinkData |
enum | VertexLinkTest { LINKTEST_DCA, LINKTEST_DUMMY, LINKTEST_ALL } |
Public Member Functions | |
void | addElement (const TrackBaseRef) |
add a track Reference to the current Candidate | |
void | associatedElements (const unsigned i, const VertexLinkData &vertexLinkData, std::multimap< float, unsigned > &sortedAssociates, const VertexLinkTest test=LINKTEST_DCA) const |
associate 2 elements | |
const GlobalPoint | dcaPoint (unsigned ie1, unsigned ie2) const |
DistVector | distVector () const |
void | Dump (std::ostream &out=std::cout) const |
cout function | |
const std::vector< TrackBaseRef > & | elements () const |
bool | isValid () const |
A Vertex Candidate is valid if it has at least two tracks. | |
unsigned | nTracks () const |
PFDisplacedVertexCandidate () | |
Default constructor. | |
DistMap | r2Map () const |
-------- Provide useful information -------- /// | |
DistVector | r2Vector () const |
void | setLink (unsigned i1, unsigned i2, const float dist, const GlobalPoint &dcaPoint, const VertexLinkTest test=LINKTEST_DCA) |
const TrackBaseRef & | tref (unsigned ie) const |
const VertexLinkData & | vertexLinkData () const |
Private Member Functions | |
const float | dist (unsigned ie1, unsigned ie2) const |
-------- Internal tools -------- /// | |
bool | matrix2vector (unsigned i, unsigned j, unsigned &index) const |
bool | testLink (unsigned ie1, unsigned ie2) const |
test if a link between two tracks is valid: value_link =! -1 | |
unsigned | vertexLinkDataSize () const |
-------- Storage of the information -------- /// | |
Private Attributes | |
std::vector< TrackBaseRef > | elements_ |
-------- MEMBERS -------- /// | |
VertexLinkData | vertexLinkData_ |
map of links between tracks | |
Friends | |
std::ostream & | operator<< (std::ostream &, const PFDisplacedVertexCandidate &) |
cout function |
A block of tracks linked together.
A DisplacedVertexCandidate is a format produced by the DisplacedVertexCandidateFinder to hold a Collection of Refs to the tracks linked together by DCA. It contains:
Definition at line 29 of file PFDisplacedVertexCandidate.h.
typedef std::map< float, std::pair<int,int> > reco::PFDisplacedVertexCandidate::DistMap |
A type to provide the information about the position of DCA Points or values of DCA.
Definition at line 58 of file PFDisplacedVertexCandidate.h.
typedef std::vector< float > reco::PFDisplacedVertexCandidate::DistVector |
Definition at line 59 of file PFDisplacedVertexCandidate.h.
typedef std::map< unsigned int, VertexLink > reco::PFDisplacedVertexCandidate::VertexLinkData |
Definition at line 54 of file PFDisplacedVertexCandidate.h.
Test used for the track linkind. For the moment only DCA is used, but other are possibles like distance between inner hits.
Definition at line 47 of file PFDisplacedVertexCandidate.h.
PFDisplacedVertexCandidate::PFDisplacedVertexCandidate | ( | ) |
void PFDisplacedVertexCandidate::addElement | ( | const TrackBaseRef | element | ) |
add a track Reference to the current Candidate
Definition at line 12 of file PFDisplacedVertexCandidate.cc.
Referenced by PFDisplacedVertexCandidateFinder::associate().
{ elements_.push_back( element ); }
void PFDisplacedVertexCandidate::associatedElements | ( | const unsigned | i, |
const VertexLinkData & | vertexLinkData, | ||
std::multimap< float, unsigned > & | sortedAssociates, | ||
const VertexLinkTest | test = LINKTEST_DCA |
||
) | const |
associate 2 elements
Definition at line 75 of file PFBlock.cc.
References getHLTprescales::index, and NONE.
{ sortedAssociates.clear(); // i is too large if( i > elements_.size() ) return; // assert(i>=0); i >= 0, since i is unsigned for(unsigned ie=0; ie<elements_.size(); ie++) { // considered element itself if( ie == i ) { continue; } // not the right type if(type != PFBlockElement::NONE && elements_[ie].type() != type ) { continue; } // Order the elements by increasing distance ! unsigned index = 0; if( !matrix2vector(i, ie, index) ) continue; double c2=-1; LinkData::const_iterator it = linkData.find(index); if ( it!=linkData.end() && ( ( (1 << test ) & it->second.test) !=0 || (test == LINKTEST_ALL) ) ) c2= it->second.distance; // not associated if( c2 < 0 ) { continue; } sortedAssociates.insert( pair<double,unsigned>(c2, ie) ); } }
const GlobalPoint PFDisplacedVertexCandidate::dcaPoint | ( | unsigned | ie1, |
unsigned | ie2 | ||
) | const |
Definition at line 155 of file PFDisplacedVertexCandidate.cc.
Referenced by PFDisplacedVertexFinder::findSeedsFromCandidate().
{ GlobalPoint dcaPoint(1e10,1e10,1e10); unsigned index = 0; if( !matrix2vector(ie1, ie2, index) ) return dcaPoint; VertexLinkData::const_iterator it = vertexLinkData_.find(index); if( it!=vertexLinkData_.end() ) dcaPoint = it->second.dcaPoint_; return dcaPoint; }
const float PFDisplacedVertexCandidate::dist | ( | unsigned | ie1, |
unsigned | ie2 | ||
) | const [private] |
-------- Internal tools -------- ///
Definition at line 178 of file PFDisplacedVertexCandidate.cc.
{ float dist = -1; unsigned index = 0; if( !matrix2vector(ie1, ie2, index) ) return dist; VertexLinkData::const_iterator it = vertexLinkData_.find(index); if( it!=vertexLinkData_.end() ) dist= it->second.distance_; return dist; }
PFDisplacedVertexCandidate::DistVector PFDisplacedVertexCandidate::distVector | ( | ) | const |
Definition at line 136 of file PFDisplacedVertexCandidate.cc.
{ DistVector distVector; for (unsigned ie1 = 0; ie1<elements_.size(); ie1++) for (unsigned ie2 = ie1+1; ie2<elements_.size(); ie2++){ float d = dist(ie1, ie2); if (d < -0.5) continue; distVector.push_back(d); } return distVector; }
void reco::PFDisplacedVertexCandidate::Dump | ( | std::ostream & | out = std::cout | ) | const |
cout function
const std::vector< TrackBaseRef >& reco::PFDisplacedVertexCandidate::elements | ( | ) | const [inline] |
Definition at line 110 of file PFDisplacedVertexCandidate.h.
References elements_.
{return elements_;}
bool reco::PFDisplacedVertexCandidate::isValid | ( | void | ) | const [inline] |
A Vertex Candidate is valid if it has at least two tracks.
Definition at line 101 of file PFDisplacedVertexCandidate.h.
References elements_.
Referenced by PFDisplacedVertexCandidateFinder::findDisplacedVertexCandidates().
{return elements_.size()>1;}
bool PFDisplacedVertexCandidate::matrix2vector | ( | unsigned | i, |
unsigned | j, | ||
unsigned & | index | ||
) | const [private] |
makes the correspondance between a 2d element matrix and the 1D vector which is the most compact way to store the matrix
Definition at line 212 of file PFDisplacedVertexCandidate.cc.
References combine::missing, findQualityFiles::size, and std::swap().
unsigned reco::PFDisplacedVertexCandidate::nTracks | ( | ) | const [inline] |
Definition at line 114 of file PFDisplacedVertexCandidate.h.
References elements_.
{return elements_.size();}
PFDisplacedVertexCandidate::DistMap PFDisplacedVertexCandidate::r2Map | ( | ) | const |
-------- Provide useful information -------- ///
Definition at line 95 of file PFDisplacedVertexCandidate.cc.
References P.
Referenced by PFDisplacedVertexFinder::findSeedsFromCandidate().
{ DistMap r2Map; for (unsigned ie1 = 0; ie1<elements_.size(); ie1++) for (unsigned ie2 = ie1+1; ie2<elements_.size(); ie2++){ GlobalPoint P = dcaPoint(ie1, ie2); if (P.x() > 1e9) continue; float r2 = P.x()*P.x()+P.y()*P.y()+P.z()*P.z(); r2Map.insert(pair<float, pair<int,int> >(r2, pair <int, int>(ie1, ie2))); } return r2Map; }
PFDisplacedVertexCandidate::DistVector PFDisplacedVertexCandidate::r2Vector | ( | ) | const |
Definition at line 116 of file PFDisplacedVertexCandidate.cc.
References P.
void PFDisplacedVertexCandidate::setLink | ( | unsigned | i1, |
unsigned | i2, | ||
const float | dist, | ||
const GlobalPoint & | dcaPoint, | ||
const VertexLinkTest | test = LINKTEST_DCA |
||
) |
set a link between elements of indices i1 and i2, of "distance" dist the link is set in the linkData vector provided as an argument. As indicated by the 'const' statement, 'this' is not modified.
Definition at line 17 of file PFDisplacedVertexCandidate.cc.
References reco::PFDisplacedVertexCandidate::VertexLink::dcaPoint_, reco::PFDisplacedVertexCandidate::VertexLink::distance_, getHLTprescales::index, prof2calltree::l, convertSQLiteXML::ok, and reco::PFDisplacedVertexCandidate::VertexLink::test_.
{ assert( test<LINKTEST_ALL ); unsigned index = 0; bool ok = matrix2vector(i1,i2, index); if(ok) { //ignore the -1, -1 pair if ( dist > -0.5 ) { VertexLink & l = vertexLinkData_[index]; l.distance_ = dist; l.dcaPoint_ = dcaPoint; l.test_ |= (1 << test); } else //delete if existing { VertexLinkData::iterator it = vertexLinkData_.find(index); if(it!=vertexLinkData_.end()) vertexLinkData_.erase(it); } } else { assert(0); } }
bool PFDisplacedVertexCandidate::testLink | ( | unsigned | ie1, |
unsigned | ie2 | ||
) | const [private] |
test if a link between two tracks is valid: value_link =! -1
Definition at line 171 of file PFDisplacedVertexCandidate.cc.
{ float d = dist( ie1, ie2); if (d < -0.5) return false; return true; }
const TrackBaseRef& reco::PFDisplacedVertexCandidate::tref | ( | unsigned | ie | ) | const [inline] |
Definition at line 106 of file PFDisplacedVertexCandidate.h.
References elements_.
Referenced by PFDisplacedVertexFinder::findSeedsFromCandidate().
{return elements_[ie];}
const VertexLinkData& reco::PFDisplacedVertexCandidate::vertexLinkData | ( | ) | const [inline] |
Definition at line 119 of file PFDisplacedVertexCandidate.h.
References vertexLinkData_.
{return vertexLinkData_;}
unsigned PFDisplacedVertexCandidate::vertexLinkDataSize | ( | ) | const [private] |
-------- Storage of the information -------- ///
Those are the tools from PFBlockAlgo
Definition at line 202 of file PFDisplacedVertexCandidate.cc.
References n.
std::ostream& operator<< | ( | std::ostream & | , |
const PFDisplacedVertexCandidate & | |||
) | [friend] |
cout function
std::vector< TrackBaseRef > reco::PFDisplacedVertexCandidate::elements_ [private] |
-------- MEMBERS -------- ///
vector of refs to the associated tracks
Definition at line 153 of file PFDisplacedVertexCandidate.h.
Referenced by elements(), isValid(), nTracks(), and tref().
map of links between tracks
Definition at line 156 of file PFDisplacedVertexCandidate.h.
Referenced by vertexLinkData().