CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
reco::PFDisplacedVertexCandidate Class Reference

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, VertexLinkVertexLinkData
 
enum  VertexLinkTest { LINKTEST_DCA, LINKTEST_DUMMY, LINKTEST_ALL }
 

Public Member Functions

void addElement (const TrackBaseRef)
 add a track Reference to the current Candidate More...
 
void associatedElements (const unsigned i, const VertexLinkData &vertexLinkData, std::multimap< float, unsigned > &sortedAssociates, const VertexLinkTest test=LINKTEST_DCA) const
 associate 2 elements More...
 
const GlobalPoint dcaPoint (unsigned ie1, unsigned ie2) const
 
DistVector distVector () const
 
void Dump (std::ostream &out=std::cout) const
 cout function More...
 
const std::vector< TrackBaseRef > & elements () const
 
bool isValid () const
 A Vertex Candidate is valid if it has at least two tracks. More...
 
unsigned nTracks () const
 
 PFDisplacedVertexCandidate ()
 Default constructor. More...
 
DistMap r2Map () const
 -----— Provide useful information -----— /// More...
 
DistVector r2Vector () const
 
void setLink (unsigned i1, unsigned i2, const float dist, const GlobalPoint &dcaPoint, const VertexLinkTest test=LINKTEST_DCA)
 
const TrackBaseReftref (unsigned ie) const
 
const VertexLinkDatavertexLinkData () const
 

Private Member Functions

const float dist (unsigned ie1, unsigned ie2) const
 -----— Internal tools -----— /// More...
 
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 More...
 
unsigned vertexLinkDataSize () const
 -----— Storage of the information -----— /// More...
 

Private Attributes

std::vector< TrackBaseRefelements_
 -----— MEMBERS -----— /// More...
 
VertexLinkData vertexLinkData_
 map of links between tracks More...
 

Friends

std::ostream & operator<< (std::ostream &, const PFDisplacedVertexCandidate &)
 cout function More...
 

Detailed Description

A block of tracks linked together.

Author
Gouzevitch Maxime
Date
November 2009

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 28 of file PFDisplacedVertexCandidate.h.

Member Typedef Documentation

◆ DistMap

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 49 of file PFDisplacedVertexCandidate.h.

◆ DistVector

Definition at line 50 of file PFDisplacedVertexCandidate.h.

◆ VertexLinkData

Definition at line 45 of file PFDisplacedVertexCandidate.h.

Member Enumeration Documentation

◆ VertexLinkTest

Test used for the track linkind. For the moment only DCA is used, but other are possibles like distance between inner hits.

Enumerator
LINKTEST_DCA 
LINKTEST_DUMMY 
LINKTEST_ALL 

Definition at line 43 of file PFDisplacedVertexCandidate.h.

Constructor & Destructor Documentation

◆ PFDisplacedVertexCandidate()

PFDisplacedVertexCandidate::PFDisplacedVertexCandidate ( )

Default constructor.

Definition at line 9 of file PFDisplacedVertexCandidate.cc.

9 {}

Member Function Documentation

◆ addElement()

void PFDisplacedVertexCandidate::addElement ( const TrackBaseRef  element)

add a track Reference to the current Candidate

Definition at line 11 of file PFDisplacedVertexCandidate.cc.

11 { elements_.push_back(element); }

Referenced by PFDisplacedVertexCandidateFinder::associate().

◆ associatedElements()

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 39 of file PFDisplacedVertexCandidate.cc.

42  {
43  sortedAssociates.clear();
44 
45  // i is too large
46  if (i > elements_.size())
47  return;
48  // assert(i>=0); // i >= 0, since i is unsigned
49  for (unsigned ie = 0; ie < elements_.size(); ie++) {
50  // considered element itself
51  if (ie == i) {
52  continue;
53  }
54 
55  // Order the elements by increasing distance !
56 
57  unsigned index = 0;
58  if (!matrix2vector(i, ie, index))
59  continue;
60 
61  float c2 = -1;
62  VertexLinkData::const_iterator it = vertexLinkData.find(index);
63  if (it != vertexLinkData.end() && (((1 << test) & it->second.test_) != 0 || (test == LINKTEST_ALL)))
64  c2 = it->second.distance_;
65 
66  // not associated
67  if (c2 < 0) {
68  continue;
69  }
70 
71  sortedAssociates.insert(pair<float, unsigned>(c2, ie));
72  }
73 }

References mps_fire::i, if(), and ctpps_dqm_sourceclient-live_cfg::test.

◆ dcaPoint()

const GlobalPoint PFDisplacedVertexCandidate::dcaPoint ( unsigned  ie1,
unsigned  ie2 
) const
Returns
DCA point between two tracks

Definition at line 126 of file PFDisplacedVertexCandidate.cc.

126  {
127  GlobalPoint dcaPoint(1e10, 1e10, 1e10);
128 
129  unsigned index = 0;
130  if (!matrix2vector(ie1, ie2, index))
131  return dcaPoint;
132  VertexLinkData::const_iterator it = vertexLinkData_.find(index);
133  if (it != vertexLinkData_.end())
134  dcaPoint = it->second.dcaPoint_;
135 
136  return dcaPoint;
137 }

Referenced by PFDisplacedVertexFinder::findSeedsFromCandidate().

◆ dist()

const float PFDisplacedVertexCandidate::dist ( unsigned  ie1,
unsigned  ie2 
) const
private

-----— Internal tools -----— ///

Returns
distance of link between two tracks

Definition at line 148 of file PFDisplacedVertexCandidate.cc.

148  {
149  float dist = -1;
150 
151  unsigned index = 0;
152  if (!matrix2vector(ie1, ie2, index))
153  return dist;
154  VertexLinkData::const_iterator it = vertexLinkData_.find(index);
155  if (it != vertexLinkData_.end())
156  dist = it->second.distance_;
157 
158  return dist;
159 }

◆ distVector()

PFDisplacedVertexCandidate::DistVector PFDisplacedVertexCandidate::distVector ( ) const
Returns
the vector of DCA useful for DCA

Definition at line 111 of file PFDisplacedVertexCandidate.cc.

111  {
113 
114  for (unsigned ie1 = 0; ie1 < elements_.size(); ie1++)
115  for (unsigned ie2 = ie1 + 1; ie2 < elements_.size(); ie2++) {
116  float d = dist(ie1, ie2);
117  if (d < -0.5)
118  continue;
119 
120  distVector.push_back(d);
121  }
122 
123  return distVector;
124 }

References ztail::d.

◆ Dump()

void PFDisplacedVertexCandidate::Dump ( std::ostream &  out = std::cout) const

cout function

Definition at line 192 of file PFDisplacedVertexCandidate.cc.

192  {
193  if (!out)
194  return;
195 
196  const vector<TrackBaseRef>& elements = elements_;
197  out << "\t--- DisplacedVertexCandidate --- " << endl;
198  out << "\tnumber of elements: " << elements.size() << endl;
199 
200  // Build element label (string) : elid from type, layer and occurence number
201  // use stringstream instead of sprintf to concatenate string and integer into string
202  for (unsigned ie = 0; ie < elements.size(); ie++) {
203  math::XYZPoint Pi(elements[ie].get()->innerPosition());
204  math::XYZPoint Po(elements[ie].get()->outerPosition());
205 
206  float innermost_radius = sqrt(Pi.x() * Pi.x() + Pi.y() * Pi.y() + Pi.z() * Pi.z());
207  float outermost_radius = sqrt(Po.x() * Po.x() + Po.y() * Po.y() + Po.z() * Po.z());
208  float innermost_rho = sqrt(Pi.x() * Pi.x() + Pi.y() * Pi.y());
209  float outermost_rho = sqrt(Po.x() * Po.x() + Po.y() * Po.y());
210 
211  double pt = elements[ie]->pt();
212 
213  out << "ie = " << elements[ie].key() << " pt = " << pt << " innermost hit radius = " << innermost_radius
214  << " rho = " << innermost_rho << " outermost hit radius = " << outermost_radius << " rho = " << outermost_rho
215  << endl;
216  }
217 
218  out << endl;
219 }

References bookConverter::elements, get, MillePedeFileConverter_cfg::out, Pi, DiDispStaMuonMonitor_cfi::pt, and mathSSE::sqrt().

◆ elements()

const std::vector<TrackBaseRef>& reco::PFDisplacedVertexCandidate::elements ( ) const
inline

◆ isValid()

bool reco::PFDisplacedVertexCandidate::isValid ( void  ) const
inline

A Vertex Candidate is valid if it has at least two tracks.

Definition at line 89 of file PFDisplacedVertexCandidate.h.

89 { return elements_.size() > 1; }

References elements_.

Referenced by ntupleDataFormat._Object::_checkIsValid(), PFDisplacedVertexCandidateFinder::findDisplacedVertexCandidates(), and core.AutoHandle.AutoHandle::ReallyLoad().

◆ matrix2vector()

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 172 of file PFDisplacedVertexCandidate.cc.

172  {
173  unsigned size = elements_.size();
174  if (iindex == jindex || iindex >= size || jindex >= size) {
175  return false;
176  }
177 
178  if (iindex > jindex)
179  swap(iindex, jindex);
180 
181  index = jindex - iindex - 1;
182 
183  if (iindex > 0) {
184  index += iindex * size;
185  unsigned missing = iindex * (iindex + 1) / 2;
186  index -= missing;
187  }
188 
189  return true;
190 }

References combine::missing, findQualityFiles::size, and std::swap().

◆ nTracks()

unsigned reco::PFDisplacedVertexCandidate::nTracks ( ) const
inline
Returns
the number of tracks associated to the candidate

Definition at line 98 of file PFDisplacedVertexCandidate.h.

98 { return elements_.size(); }

References elements_.

◆ r2Map()

PFDisplacedVertexCandidate::DistMap PFDisplacedVertexCandidate::r2Map ( ) const

-----— Provide useful information -----— ///

Returns
the map of Radius^2 to DCA Points

Definition at line 77 of file PFDisplacedVertexCandidate.cc.

77  {
78  DistMap r2Map;
79 
80  for (unsigned ie1 = 0; ie1 < elements_.size(); ie1++)
81  for (unsigned ie2 = ie1 + 1; ie2 < elements_.size(); ie2++) {
82  GlobalPoint P = dcaPoint(ie1, ie2);
83  if (P.x() > 1e9)
84  continue;
85 
86  float r2 = P.x() * P.x() + P.y() * P.y() + P.z() * P.z();
87 
88  r2Map.insert(pair<float, pair<int, int> >(r2, pair<int, int>(ie1, ie2)));
89  }
90 
91  return r2Map;
92 }

References diffTwoXMLs::r2.

Referenced by PFDisplacedVertexFinder::findSeedsFromCandidate().

◆ r2Vector()

PFDisplacedVertexCandidate::DistVector PFDisplacedVertexCandidate::r2Vector ( ) const
Returns
the vector of Radius^2 to DCA Points useful for FWLite

Definition at line 94 of file PFDisplacedVertexCandidate.cc.

94  {
96 
97  for (unsigned ie1 = 0; ie1 < elements_.size(); ie1++)
98  for (unsigned ie2 = ie1 + 1; ie2 < elements_.size(); ie2++) {
99  GlobalPoint P = dcaPoint(ie1, ie2);
100  if (P.x() > 1e9)
101  continue;
102 
103  float r2 = P.x() * P.x() + P.y() * P.y() + P.z() * P.z();
104 
105  r2Vector.push_back(r2);
106  }
107 
108  return r2Vector;
109 }

References diffTwoXMLs::r2.

◆ setLink()

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 13 of file PFDisplacedVertexCandidate.cc.

14  {
16 
17  unsigned index = 0;
18  bool ok = matrix2vector(i1, i2, index);
19 
20  if (ok) {
21  //ignore the -1, -1 pair
22  if (dist > -0.5) {
23  VertexLink& l = vertexLinkData_[index];
24  l.distance_ = dist;
25  l.dcaPoint_ = dcaPoint;
26  l.test_ |= (1 << test);
27  } else //delete if existing
28  {
29  VertexLinkData::iterator it = vertexLinkData_.find(index);
30  if (it != vertexLinkData_.end())
31  vertexLinkData_.erase(it);
32  }
33 
34  } else {
35  assert(0);
36  }
37 }

References cms::cuda::assert(), testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, cmsLHEtoEOSManager::l, convertSQLiteXML::ok, and ctpps_dqm_sourceclient-live_cfg::test.

Referenced by PFDisplacedVertexCandidateFinder::packLinks().

◆ testLink()

bool PFDisplacedVertexCandidate::testLink ( unsigned  ie1,
unsigned  ie2 
) const
private

test if a link between two tracks is valid: value_link =! -1

Definition at line 141 of file PFDisplacedVertexCandidate.cc.

141  {
142  float d = dist(ie1, ie2);
143  if (d < -0.5)
144  return false;
145  return true;
146 }

References ztail::d.

◆ tref()

const TrackBaseRef& reco::PFDisplacedVertexCandidate::tref ( unsigned  ie) const
inline
Returns
the reference to a given tracks

Definition at line 92 of file PFDisplacedVertexCandidate.h.

92 { return elements_[ie]; }

References elements_.

Referenced by PFDisplacedVertexFinder::findSeedsFromCandidate().

◆ vertexLinkData()

const VertexLinkData& reco::PFDisplacedVertexCandidate::vertexLinkData ( ) const
inline
Returns
the map of link data

Definition at line 101 of file PFDisplacedVertexCandidate.h.

101 { return vertexLinkData_; }

References vertexLinkData_.

◆ vertexLinkDataSize()

unsigned PFDisplacedVertexCandidate::vertexLinkDataSize ( ) const
private

-----— Storage of the information -----— ///

Those are the tools from PFBlockAlgo

Returns
size of linkData_, calculated from the number of elements

Definition at line 163 of file PFDisplacedVertexCandidate.cc.

163  {
164  unsigned n = elements_.size();
165 
166  // number of possible undirected links between n elements.
167  // reflective links impossible.
168 
169  return n * (n - 1) / 2;
170 }

References dqmiodumpmetadata::n.

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  ,
const PFDisplacedVertexCandidate  
)
friend

cout function

Member Data Documentation

◆ elements_

std::vector<TrackBaseRef> reco::PFDisplacedVertexCandidate::elements_
private

-----— MEMBERS -----— ///

vector of refs to the associated tracks

Definition at line 131 of file PFDisplacedVertexCandidate.h.

Referenced by elements(), isValid(), nTracks(), and tref().

◆ vertexLinkData_

VertexLinkData reco::PFDisplacedVertexCandidate::vertexLinkData_
private

map of links between tracks

Definition at line 134 of file PFDisplacedVertexCandidate.h.

Referenced by vertexLinkData().

reco::PFDisplacedVertexCandidate::vertexLinkData_
VertexLinkData vertexLinkData_
map of links between tracks
Definition: PFDisplacedVertexCandidate.h:134
testProducerWithPsetDescEmpty_cfi.i2
i2
Definition: testProducerWithPsetDescEmpty_cfi.py:46
mps_fire.i
i
Definition: mps_fire.py:428
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
testProducerWithPsetDescEmpty_cfi.i1
i1
Definition: testProducerWithPsetDescEmpty_cfi.py:45
if
if(0==first)
Definition: CAHitNtupletGeneratorKernelsImpl.h:48
cms::cuda::assert
assert(be >=bs)
reco::PFDisplacedVertexCandidate::dcaPoint
const GlobalPoint dcaPoint(unsigned ie1, unsigned ie2) const
Definition: PFDisplacedVertexCandidate.cc:126
reco::PFDisplacedVertexCandidate::elements
const std::vector< TrackBaseRef > & elements() const
Definition: PFDisplacedVertexCandidate.h:95
convertSQLiteXML.ok
bool ok
Definition: convertSQLiteXML.py:98
reco::PFDisplacedVertexCandidate::LINKTEST_DCA
Definition: PFDisplacedVertexCandidate.h:43
reco::PFDisplacedVertexCandidate::DistMap
std::map< float, std::pair< int, int > > DistMap
Definition: PFDisplacedVertexCandidate.h:49
test
Definition: SmallWORMDict.h:13
ctpps_dqm_sourceclient-live_cfg.test
test
Definition: ctpps_dqm_sourceclient-live_cfg.py:7
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
reco::PFDisplacedVertexCandidate::vertexLinkData
const VertexLinkData & vertexLinkData() const
Definition: PFDisplacedVertexCandidate.h:101
Point3DBase< float, GlobalTag >
reco::PFDisplacedVertexCandidate::dist
const float dist(unsigned ie1, unsigned ie2) const
-----— Internal tools -----— ///
Definition: PFDisplacedVertexCandidate.cc:148
reco::PFDisplacedVertexCandidate::r2Map
DistMap r2Map() const
-----— Provide useful information -----— ///
Definition: PFDisplacedVertexCandidate.cc:77
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
reco::PFDisplacedVertexCandidate::distVector
DistVector distVector() const
Definition: PFDisplacedVertexCandidate.cc:111
reco::PFDisplacedVertexCandidate::LINKTEST_DUMMY
Definition: PFDisplacedVertexCandidate.h:43
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:204
reco::get
T get(const Candidate &c)
Definition: component.h:60
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
reco::swap
void swap(reco::ClusterRemovalInfo &cri1, reco::ClusterRemovalInfo &cri2)
Definition: ClusterRemovalInfo.cc:12
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
ztail.d
d
Definition: ztail.py:151
reco::PFDisplacedVertexCandidate::matrix2vector
bool matrix2vector(unsigned i, unsigned j, unsigned &index) const
Definition: PFDisplacedVertexCandidate.cc:172
combine.missing
missing
Definition: combine.py:5
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202
reco::PFDisplacedVertexCandidate::DistVector
std::vector< float > DistVector
Definition: PFDisplacedVertexCandidate.h:50
reco::PFDisplacedVertexCandidate::elements_
std::vector< TrackBaseRef > elements_
-----— MEMBERS -----— ///
Definition: PFDisplacedVertexCandidate.h:131
reco::PFDisplacedVertexCandidate::r2Vector
DistVector r2Vector() const
Definition: PFDisplacedVertexCandidate.cc:94
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
reco::PFDisplacedVertexCandidate::LINKTEST_ALL
Definition: PFDisplacedVertexCandidate.h:43