File indexing completed on 2024-04-06 12:04:51
0001 #ifndef DataFormat_ParticleFlowReco_PFDisplacedVertexCandidate_h
0002 #define DataFormat_ParticleFlowReco_PFDisplacedVertexCandidate_h
0003
0004 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0005 #include "DataFormats/TrackReco/interface/TrackFwd.h"
0006
0007 #include <vector>
0008 #include <map>
0009 #include <iostream>
0010
0011 namespace reco {
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028 class PFDisplacedVertexCandidate {
0029 public:
0030
0031
0032
0033 struct VertexLink {
0034 VertexLink() : distance_(-1), dcaPoint_(0, 0, 0), test_(0) {}
0035 VertexLink(float d, GlobalPoint p, char t) : distance_(d), dcaPoint_(p), test_(t) {}
0036 float distance_;
0037 GlobalPoint dcaPoint_;
0038 char test_;
0039 };
0040
0041
0042
0043 enum VertexLinkTest { LINKTEST_DCA, LINKTEST_DUMMY, LINKTEST_ALL };
0044
0045 typedef std::map<unsigned int, VertexLink> VertexLinkData;
0046
0047
0048
0049 typedef std::map<float, std::pair<int, int> > DistMap;
0050 typedef std::vector<float> DistVector;
0051
0052
0053 PFDisplacedVertexCandidate();
0054
0055
0056 void addElement(const TrackBaseRef);
0057
0058
0059
0060
0061 void setLink(unsigned i1,
0062 unsigned i2,
0063 const float dist,
0064 const GlobalPoint& dcaPoint,
0065 const VertexLinkTest test = LINKTEST_DCA);
0066
0067
0068 void associatedElements(const unsigned i,
0069 const VertexLinkData& vertexLinkData,
0070 std::multimap<float, unsigned>& sortedAssociates,
0071 const VertexLinkTest test = LINKTEST_DCA) const;
0072
0073
0074
0075
0076 DistMap r2Map() const;
0077
0078
0079
0080 DistVector r2Vector() const;
0081
0082
0083 DistVector distVector() const;
0084
0085
0086 const GlobalPoint dcaPoint(unsigned ie1, unsigned ie2) const;
0087
0088
0089 bool isValid() const { return elements_.size() > 1; }
0090
0091
0092 const TrackBaseRef& tref(unsigned ie) const { return elements_[ie]; }
0093
0094
0095 const std::vector<TrackBaseRef>& elements() const { return elements_; }
0096
0097
0098 unsigned nTracks() const { return elements_.size(); }
0099
0100
0101 const VertexLinkData& vertexLinkData() const { return vertexLinkData_; }
0102
0103
0104 void Dump(std::ostream& out = std::cout) const;
0105
0106 private:
0107
0108
0109
0110 const float dist(unsigned ie1, unsigned ie2) const;
0111
0112
0113 bool testLink(unsigned ie1, unsigned ie2) const;
0114
0115
0116 friend std::ostream& operator<<(std::ostream&, const PFDisplacedVertexCandidate&);
0117
0118
0119
0120
0121
0122 unsigned vertexLinkDataSize() const;
0123
0124
0125
0126 bool matrix2vector(unsigned i, unsigned j, unsigned& index) const;
0127
0128
0129
0130
0131 std::vector<TrackBaseRef> elements_;
0132
0133
0134 VertexLinkData vertexLinkData_;
0135 };
0136 }
0137
0138 #endif