CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1track2D.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTMTT_L1track2D_h
2 #define L1Trigger_TrackFindingTMTT_L1track2D_h
3 
10 
11 #include <vector>
12 #include <utility>
13 
14 //=== L1 track cand found in 2 dimensions.
15 //=== Gives access to all stubs on track and to its 2D helix parameters.
16 //=== Also calculates & gives access to associated truth particle (Tracking Particle) if any.
17 
18 namespace tmtt {
19 
20  class L1track2D : public L1trackBase {
21  public:
22  // Give stubs on track, its cell location inside HT array, its 2D helix parameters.
23  L1track2D(const Settings* settings,
24  const std::vector<Stub*>& stubs,
25  std::pair<unsigned int, unsigned int> cellLocationHT,
26  std::pair<float, float> helix2D,
27  unsigned int iPhiSec,
28  unsigned int iEtaReg,
29  unsigned int optoLinkID,
30  bool mergedHTcell)
31  : L1trackBase(),
32  settings_(settings),
33  stubs_(stubs),
35  cellLocationHT_(cellLocationHT),
36  helix2D_(helix2D),
38  estZ0_(0.),
39  estTanLambda_(0.),
40  iPhiSec_(iPhiSec),
41  iEtaReg_(iEtaReg),
42  optoLinkID_(optoLinkID),
43  mergedHTcell_(mergedHTcell) {
44  nLayers_ = Utility::countLayers(settings, stubs_); // Count tracker layers these stubs are in
46  stubs_,
48  matchedStubs_); // Find associated truth particle & calculate info about match.
49  }
50 
51  ~L1track2D() override = default;
52 
53  //--- Get information about the reconstructed track.
54 
55  // Get stubs on track candidate.
56  const std::vector<const Stub*>& stubsConst() const override { return stubsConst_; }
57  const std::vector<Stub*>& stubs() const override { return stubs_; }
58  // Get number of stubs on track candidate.
59  unsigned int numStubs() const override { return stubs_.size(); }
60  // Get number of tracker layers these stubs are in.
61  unsigned int numLayers() const override { return nLayers_; }
62  // Get cell location of track candidate in Hough Transform array in units of bin number.
63  std::pair<unsigned int, unsigned int> cellLocationHT() const override { return cellLocationHT_; }
64  // The two conventionally agreed track helix parameters relevant in this 2D plane.
65  // i.e. (q/Pt, phi0).
66  std::pair<float, float> helix2D() const { return helix2D_; }
67 
68  //--- User-friendlier access to the helix parameters obtained from track location inside HT array.
69 
70  float qOverPt() const override { return helix2D_.first; }
71  float phi0() const override { return helix2D_.second; }
72 
73  //--- In the case of tracks found by the r-phi HT, a rough estimate of the (z0, tan_lambda) may be provided by any r-z
74  //--- track filter run after the r-phi HT. These two functions give std::set/get access to these.
75  //--- The "get" function returns a boolean indicating if an estimate exists (i.e. "set" has been called).
76 
77  void setTrkEstZ0andTanLam(float estZ0, float estTanLambda) {
78  estZ0_ = estZ0;
79  estTanLambda_ = estTanLambda;
80  estValid_ = true;
81  }
82 
83  bool trkEstZ0andTanLam(float& estZ0, float& estTanLambda) const {
84  estZ0 = estZ0_;
85  estTanLambda = estTanLambda_;
86  return estValid_;
87  }
88 
89  //--- Get phi sector and eta region used by track finding code that this track is in.
90  unsigned int iPhiSec() const override { return iPhiSec_; }
91  unsigned int iEtaReg() const override { return iEtaReg_; }
92 
93  //--- Opto-link ID used to send this track from HT to Track Fitter. Both read & write functions.
94  unsigned int optoLinkID() const override { return optoLinkID_; }
95  void setOptoLinkID(unsigned int linkID) { optoLinkID_ = linkID; }
96 
97  //--- Was this track produced from a marged HT cell (e.g. 2x2)?
98  bool mergedHTcell() const { return mergedHTcell_; }
99 
100  //--- Get information about its association (if any) to a truth Tracking Particle.
101 
102  // Get matching tracking particle (=nullptr if none).
103  const TP* matchedTP() const override { return matchedTP_; }
104  // Get the matched stubs.
105  const std::vector<const Stub*>& matchedStubs() const override { return matchedStubs_; }
106  // Get number of matched stubs.
107  unsigned int numMatchedStubs() const override { return matchedStubs_.size(); }
108  // Get number of tracker layers with matched stubs.
109  unsigned int numMatchedLayers() const override { return nMatchedLayers_; }
110 
111  private:
112  //--- Configuration parameters
114 
115  //--- Information about the reconstructed track from Hough transform.
116  std::vector<Stub*> stubs_;
117  std::vector<const Stub*> stubsConst_;
118  unsigned int nLayers_;
119  std::pair<unsigned int, unsigned int> cellLocationHT_;
120  std::pair<float, float> helix2D_;
121 
122  //--- Rough estimate of r-z track parameters from r-z filter, which may be present in case of r-phi Hough transform
123  bool estValid_;
124  float estZ0_;
126 
127  unsigned int iPhiSec_;
128  unsigned int iEtaReg_;
129  unsigned int optoLinkID_;
130 
132 
133  //--- Information about its association (if any) to a truth Tracking Particle.
134  const TP* matchedTP_;
135  std::vector<const Stub*> matchedStubs_;
136  unsigned int nMatchedLayers_;
137  };
138 
139 } // namespace tmtt
140 
141 #endif
std::vector< const Stub * > stubsConst_
Definition: L1track2D.h:117
unsigned int optoLinkID_
Definition: L1track2D.h:129
~L1track2D() override=default
const TP * matchedTP_
Definition: L1track2D.h:134
const TP * matchedTP() const override
Definition: L1track2D.h:103
unsigned int nMatchedLayers_
Definition: L1track2D.h:136
unsigned int numStubs() const override
Definition: L1track2D.h:59
unsigned int iPhiSec_
Definition: L1track2D.h:127
std::vector< const Stub * > matchedStubs_
Definition: L1track2D.h:135
void setOptoLinkID(unsigned int linkID)
Definition: L1track2D.h:95
const std::vector< const Stub * > & stubsConst() const override
Definition: L1track2D.h:56
L1track2D(const Settings *settings, const std::vector< Stub * > &stubs, std::pair< unsigned int, unsigned int > cellLocationHT, std::pair< float, float > helix2D, unsigned int iPhiSec, unsigned int iEtaReg, unsigned int optoLinkID, bool mergedHTcell)
Definition: L1track2D.h:23
const TP * matchingTP(const Settings *settings, const std::vector< const Stub * > &vstubs, unsigned int &nMatchedLayersBest, std::vector< const Stub * > &matchedStubsBest)
Definition: Utility.cc:63
bool trkEstZ0andTanLam(float &estZ0, float &estTanLambda) const
Definition: L1track2D.h:83
std::pair< unsigned int, unsigned int > cellLocationHT() const override
Definition: L1track2D.h:63
void setTrkEstZ0andTanLam(float estZ0, float estTanLambda)
Definition: L1track2D.h:77
std::vector< Stub * > stubs_
Definition: L1track2D.h:116
unsigned int optoLinkID() const override
Definition: L1track2D.h:94
Definition: TP.h:23
const std::vector< const Stub * > & matchedStubs() const override
Definition: L1track2D.h:105
unsigned int numLayers() const override
Definition: L1track2D.h:61
std::pair< float, float > helix2D() const
Definition: L1track2D.h:66
unsigned int nLayers_
Definition: L1track2D.h:118
unsigned int iEtaReg() const override
Definition: L1track2D.h:91
unsigned int iPhiSec() const override
Definition: L1track2D.h:90
unsigned int numMatchedStubs() const override
Definition: L1track2D.h:107
unsigned int iEtaReg_
Definition: L1track2D.h:128
bool mergedHTcell() const
Definition: L1track2D.h:98
float phi0() const override
Definition: L1track2D.h:71
unsigned int numMatchedLayers() const override
Definition: L1track2D.h:109
std::pair< float, float > helix2D_
Definition: L1track2D.h:120
bool mergedHTcell_
Definition: L1track2D.h:131
const Settings * settings_
Definition: L1track2D.h:113
unsigned int countLayers(const Settings *settings, const std::vector< const Stub * > &stubs, bool disableReducedLayerID=false, bool onlyPS=false)
Definition: Utility.cc:25
string end
Definition: dataset.py:937
std::pair< unsigned int, unsigned int > cellLocationHT_
Definition: L1track2D.h:119
const std::vector< Stub * > & stubs() const override
Definition: L1track2D.h:57
float qOverPt() const override
Definition: L1track2D.h:70
float estTanLambda_
Definition: L1track2D.h:125