CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RecoVertex.h
Go to the documentation of this file.
1 #ifndef __L1Trigger_VertexFinder_RecoVertex_h__
2 #define __L1Trigger_VertexFinder_RecoVertex_h__
3 
7 
8 #include <numeric>
9 #include <set>
10 #include <vector>
11 
12 namespace l1tVertexFinder {
13 
14  template <typename T = L1Track>
15  class RecoVertex {
16  public:
18  RecoVertex(const double z0 = -999.);
21  std::map<const edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_>>, const T*> trackAssociationMap);
23  RecoVertex(const l1t::Vertex& vertex,
24  std::map<const edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_>>, const T*> trackAssociationMap);
27 
30  this->tracks_.insert(std::end(this->tracks_), std::begin(rhs.tracks()), std::end(rhs.tracks()));
31  return *this;
32  }
33 
35  void clear() { tracks_.clear(); }
37  //void computeParameters(unsigned int weightedmean = false, double highPtThreshold = 50., int highPtBehavior = -1);
39  bool hasHighPt() const { return highPt_; }
41  double highestPt() const { return highestPt_; }
43  void insert(const T* fitTrack) { tracks_.push_back(fitTrack); }
45  void isPrimary(bool is) { pv_ = is; }
47  unsigned int numHighPtTracks() const { return numHighPtTracks_; }
49  unsigned int numTracks() const { return tracks_.size(); }
51  unsigned int numTrueTracks() const { return trueTracks_.size(); }
53  bool primaryVertex() const { return pv_; }
55  double pt() const { return pT_; }
57  const std::vector<const T*>& tracks() const { return tracks_; }
59  const std::set<const TP*>& trueTracks() const { return trueTracks_; }
61  void setPt(double pt) { pT_ = pt; }
63  void setZ0(double z) { z0_ = z; }
65  void setParameters(double pt,
66  double z0,
67  double width = -999.,
68  bool highPt = false,
69  unsigned int nHighPt = -999,
70  double highestPt = -999.,
71  bool pv = false);
73  double z0() const { return z0_; }
75  double z0width() const { return z0width_; }
76 
77  private:
78  double z0_;
79  double z0width_;
80  double pT_;
81  double highestPt_;
82  std::vector<const T*> tracks_;
83  std::set<const TP*> trueTracks_;
84  bool pv_;
85  bool highPt_;
86  unsigned int numHighPtTracks_;
87  };
88 
90 
91  template <typename T>
92  RecoVertex<T>::RecoVertex(const double z0) : z0_(z0) {
93  z0width_ = -999.;
94  pT_ = -999.;
95  highestPt_ = -999.;
96  pv_ = false;
97  highPt_ = false;
98  numHighPtTracks_ = 0;
99  clear();
100  }
101 
102  template <typename T>
104  std::map<const edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_>>, const T*> trackAssociationMap) {
105  z0_ = vertex.z0();
106  z0width_ = vertex.z0width();
107  pT_ = vertex.pt();
108  highestPt_ = vertex.highestPt();
109  pv_ = vertex.primaryVertex();
110  highPt_ = vertex.hasHighPt();
111  numHighPtTracks_ = vertex.numHighPtTracks();
112  clear();
113 
114  // loop over base fitted tracks in reco vertex and find the corresponding TP
115  // track using the TTTrack - L1TrackTruthMatched map from above
116  for (const auto& trackIt : vertex.tracks()) {
117  // using insert ensures that true tracks are also stored in vertex object
118  insert(trackAssociationMap[trackIt->getTTTrackPtr()]);
119  }
120  }
121 
122  template <typename T>
124  std::map<const edm::Ptr<TTTrack<Ref_Phase2TrackerDigi_>>, const T*> trackAssociationMap) {
125  z0_ = vertex.z0();
126  z0width_ = -999.;
127  pT_ = vertex.pt();
128  highestPt_ = -999.;
129  pv_ = false;
130  highPt_ = false;
131  numHighPtTracks_ = 0;
132  clear();
133 
134  // populate vertex with tracks and TP track using the
135  // TTTrack - L1TrackTruthMatched map from above
136  for (const auto& track : vertex.tracks()) {
137  // using insert ensures that true tracks are also stored in vertex object
138  insert(trackAssociationMap.at(track));
139  }
140  }
141 
142  template <typename T>
144  double pt, double z0, double width, bool highPt, unsigned int nHighPt, double highestPt, bool pv) {
145  pT_ = pt;
146  z0_ = z0;
147  z0width_ = width;
148  highPt_ = highPt;
149  numHighPtTracks_ = nHighPt;
150  highestPt_ = highestPt;
151  pv_ = pv;
152  }
153 
154  // Template specializations
155  template <>
157 
158  template <>
160 
161  template <>
162  void RecoVertexWithTP::insert(const L1TrackTruthMatched* fitTrack);
163 
164 } // namespace l1tVertexFinder
165 
166 #endif
unsigned int numHighPtTracks_
Definition: RecoVertex.h:86
bool hasHighPt() const
Compute vertex parameters.
Definition: RecoVertex.h:39
~RecoVertex()
Basic destructor.
Definition: RecoVertex.h:26
void setZ0(double z)
Set z0 position [cm].
Definition: RecoVertex.h:63
activeDets clear()
RecoVertex & operator+=(const RecoVertex &rhs)
Operators.
Definition: RecoVertex.h:29
void setPt(double pt)
set the pT [GeV] of the vertex
Definition: RecoVertex.h:61
RecoVertex(const double z0=-999.)
Basic constructor.
Definition: RecoVertex.h:92
unsigned int numTracks() const
Number of tracks originating from this vertex.
Definition: RecoVertex.h:49
Simple wrapper class for TTTrack, with match to a tracking particle.
double highestPt() const
highest track pT in the vertex
Definition: RecoVertex.h:41
std::vector< const T * > tracks_
Definition: RecoVertex.h:82
unsigned int numTrueTracks() const
Number of true particles assigned to this vertex.
Definition: RecoVertex.h:51
bool insert(Storage &iStorage, ItemType *iItem, const IdTag &iIdTag)
Definition: HCMethods.h:50
double z0() const
Vertex z0 position [cm].
Definition: RecoVertex.h:73
const std::vector< const T * > & tracks() const
Tracks in the vertex.
Definition: RecoVertex.h:57
float pt() const
Definition: Vertex.cc:12
double pt() const
Sum of fitted tracks transverse momentum [GeV].
Definition: RecoVertex.h:55
void isPrimary(bool is)
Set primary vertex tag.
Definition: RecoVertex.h:45
Class to store the L1 Track Trigger tracks.
Definition: TTTrack.h:29
bool primaryVertex() const
True if primary vertex.
Definition: RecoVertex.h:53
float z0() const
Definition: Vertex.cc:14
unsigned int numHighPtTracks() const
Number of high-pT tracks (pT &gt; 10 GeV)
Definition: RecoVertex.h:47
const std::vector< edm::Ptr< Track_t > > & tracks() const
Definition: Vertex.cc:16
double z0width() const
Vertex z0 width [cm].
Definition: RecoVertex.h:75
void clear()
Clear track vector.
Definition: RecoVertex.h:35
string end
Definition: dataset.py:937
const std::set< const TP * > & trueTracks() const
Tracking particles asociated to the vertex.
Definition: RecoVertex.h:59
long double T
std::set< const TP * > trueTracks_
Definition: RecoVertex.h:83
void setParameters(double pt, double z0, double width=-999., bool highPt=false, unsigned int nHighPt=-999, double highestPt=-999., bool pv=false)
Set the vertex parameters.
Definition: RecoVertex.h:143
void insert(const T *fitTrack)
Assign fitted track to this vertex.
Definition: RecoVertex.h:43