CMS 3D CMS Logo

Tracklet.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTracklet_interface_Tracklet_h
2 #define L1Trigger_TrackFindingTracklet_interface_Tracklet_h
3 
4 #include <iostream>
5 #include <fstream>
6 #include <cassert>
7 #include <cmath>
8 #include <vector>
9 #include <memory>
10 #include <set>
11 
20 
21 namespace trklet {
22 
23  class Settings;
24  class Stub;
25  class Track;
26 
27  class Tracklet {
28  public:
29  Tracklet(Settings const& settings,
30  unsigned int iSeed,
31  const Stub* innerFPGAStub,
32  const Stub* middleFPGAStub,
33  const Stub* outerFPGAStub,
34  double rinv,
35  double phi0,
36  double d0,
37  double z0,
38  double t,
39  double rinvapprox,
40  double phi0approx,
41  double d0approx,
42  double z0approx,
43  double tapprox,
44  int irinv,
45  int iphi0,
46  int id0,
47  int iz0,
48  int it,
49  Projection projs[N_LAYER + N_DISK],
50  bool disk,
51  bool overlap = false);
52 
53  ~Tracklet() = default;
54 
55  //Find tp corresponding to seed.
56  //Will require 'tight match' such that tp is part of each of the four clustes returns 0 if no tp matches
57  int tpseed();
58 
59  bool stubtruthmatch(const L1TStub* stub);
60 
61  const Stub* innerFPGAStub() { return innerFPGAStub_; }
62 
63  const Stub* middleFPGAStub() { return middleFPGAStub_; }
64 
65  const Stub* outerFPGAStub() { return outerFPGAStub_; }
66 
68 
69  //Tracklet parameters print out
71 
72  std::string vmstrlayer(int layer, unsigned int allstubindex);
73 
74  std::string vmstrdisk(int disk, unsigned int allstubindex);
75 
78 
81 
82  bool validProj(int layerdisk) const {
83  assert(layerdisk >= 0 && layerdisk < N_LAYER + N_DISK);
84  return proj_[layerdisk].valid();
85  }
86 
87  Projection& proj(int layerdisk) {
88  assert(validProj(layerdisk));
89  return proj_[layerdisk];
90  }
91 
92  void addMatch(unsigned int layerdisk,
93  int ideltaphi,
94  int ideltarz,
95  double dphi,
96  double drz,
97  double dphiapprox,
98  double drzapprox,
99  int stubid,
100  const trklet::Stub* stubptr);
101 
104 
105  bool match(unsigned int layerdisk) {
106  assert(layerdisk < N_LAYER + N_DISK);
107  return resid_[layerdisk].valid();
108  }
109 
110  const Residual& resid(unsigned int layerdisk) {
111  assert(layerdisk < N_LAYER + N_DISK);
112  assert(resid_[layerdisk].valid());
113  return resid_[layerdisk];
114  }
115 
116  std::vector<const L1TStub*> getL1Stubs();
117 
118  std::map<int, int> getStubIDs();
119 
120  double rinv() const { return trackpars_.rinv(); }
121  double phi0() const { return trackpars_.phi0(); }
122  double d0() const { return trackpars_.d0(); }
123  double t() const { return trackpars_.t(); }
124  double z0() const { return trackpars_.z0(); }
125 
126  double rinvapprox() const { return trackparsapprox_.rinv(); }
127  double phi0approx() const { return trackparsapprox_.phi0(); }
128  double d0approx() const { return trackparsapprox_.d0(); }
129  double tapprox() const { return trackparsapprox_.t(); }
130  double z0approx() const { return trackparsapprox_.z0(); }
131 
132  const FPGAWord& fpgarinv() const { return fpgapars_.rinv(); }
133  const FPGAWord& fpgaphi0() const { return fpgapars_.phi0(); }
134  const FPGAWord& fpgad0() const { return fpgapars_.d0(); }
135  const FPGAWord& fpgat() const { return fpgapars_.t(); }
136  const FPGAWord& fpgaz0() const { return fpgapars_.z0(); }
137 
138  double rinvfit() const { return fitpars_.rinv(); }
139  double phi0fit() const { return fitpars_.phi0(); }
140  double d0fit() const { return fitpars_.d0(); }
141  double tfit() const { return fitpars_.t(); }
142  double z0fit() const { return fitpars_.z0(); }
143  double chiSqfit() const { return chisqrphifit_ + chisqrzfit_; }
144 
145  double rinvfitexact() const { return fitparsexact_.rinv(); }
146  double phi0fitexact() const { return fitparsexact_.phi0(); }
147  double d0fitexact() const { return fitparsexact_.d0(); }
148  double tfitexact() const { return fitparsexact_.t(); }
149  double z0fitexact() const { return fitparsexact_.z0(); }
150 
151  const FPGAWord& irinvfit() const { return fpgafitpars_.rinv(); }
152  const FPGAWord& iphi0fit() const { return fpgafitpars_.phi0(); }
153  const FPGAWord& id0fit() const { return fpgafitpars_.d0(); }
154  const FPGAWord& itfit() const { return fpgafitpars_.t(); }
155  const FPGAWord& iz0fit() const { return fpgafitpars_.z0(); }
156  FPGAWord ichiSqfit() const {
158  }
159 
160  void setFitPars(double rinvfit,
161  double phi0fit,
162  double d0fit,
163  double tfit,
164  double z0fit,
165  double chisqrphifit,
166  double chisqrzfit,
167  double rinvfitexact,
168  double phi0fitexact,
169  double d0fitexact,
170  double tfitexact,
171  double z0fitexact,
172  double chisqrphifitexact,
173  double chisqrzfitexact,
174  int irinvfit,
175  int iphi0fit,
176  int id0fit,
177  int itfit,
178  int iz0fit,
179  int ichisqrphifit,
180  int ichisqrzfit,
181  int hitpattern,
182  const std::vector<const L1TStub*>& l1stubs = std::vector<const L1TStub*>());
183 
184  const std::string layerstubstr(const unsigned layer) const;
185  const std::string diskstubstr(const unsigned disk) const;
186  std::string trackfitstr() const;
187 
188  Track makeTrack(const std::vector<const L1TStub*>& l1stubs);
189 
191  assert(fpgatrack_ != nullptr);
192  return fpgatrack_.get();
193  }
194 
195  bool fit() const { return ichisqrphifit_.value() != -1; }
196 
197  int layer() const;
198  int disk() const;
199 
200  bool isBarrel() const { return barrel_; }
201  bool isOverlap() const { return overlap_; }
202  int isDisk() const { return disk_; }
203 
204  void setTrackletIndex(unsigned int index);
205 
206  int trackletIndex() const { return trackletIndex_; }
207 
208  void setTCIndex(int index) { TCIndex_ = index; }
209 
210  int TCIndex() const { return TCIndex_; }
211 
212  int TCID() const { return TCIndex_ * (1 << settings_.nbitstrackletindex()) + trackletIndex_; }
213 
214  int getISeed() const;
215  int getITC() const;
216 
217  void setTrackIndex(int index);
218  int trackIndex() const;
219 
220  unsigned int PSseed() const { return ((layer() == 1) || (layer() == 2) || (disk() != 0)) ? 1 : 0; }
221 
222  unsigned int seedIndex() const { return seedIndex_; }
223 
224  private:
225  unsigned int seedIndex_;
226 
227  // three types of tracklets + one triplet
228  bool barrel_;
229  bool disk_;
230  bool overlap_;
231  bool triplet_;
232 
236 
238  int TCIndex_;
240 
241  //Tracklet track parameters
243 
246 
247  // the layer/disk ids that we project to (never project to >4 barrel layers)
248  int projlayer_[N_LAYER - 2];
250 
251  //Track parameters from track fit
255 
258  double chisqrzfit_;
259 
263 
265 
266  std::unique_ptr<Track> fpgatrack_;
267 
269 
271 
273  };
274 }; // namespace trklet
275 #endif
Settings.h
Util.h
trklet::Tracklet::fullmatchstr
std::string fullmatchstr(int layer)
Definition: Tracklet.cc:308
L1TStub.h
trklet::Tracklet::addressstr
std::string addressstr()
Definition: Tracklet.cc:177
trklet::Tracklet::stubtruthmatch
bool stubtruthmatch(const L1TStub *stub)
Definition: Tracklet.cc:138
trklet::Tracklet::TCIndex
int TCIndex() const
Definition: Tracklet.h:210
trklet::Tracklet::chisqrphifitexact_
double chisqrphifitexact_
Definition: Tracklet.h:261
trklet::Tracklet::PSseed
unsigned int PSseed() const
Definition: Tracklet.h:220
trklet::Tracklet::z0approx
double z0approx() const
Definition: Tracklet.h:130
trklet::Tracklet::settings_
Settings const & settings_
Definition: Tracklet.h:272
trklet::Tracklet::phi0fitexact
double phi0fitexact() const
Definition: Tracklet.h:146
trklet::Tracklet::fitpars_
TrackPars< double > fitpars_
Definition: Tracklet.h:256
trklet::Tracklet::fpgat
const FPGAWord & fpgat() const
Definition: Tracklet.h:135
trklet::Tracklet::getTrack
Track * getTrack()
Definition: Tracklet.h:190
trklet::Tracklet::chisqrzfitexact_
double chisqrzfitexact_
Definition: Tracklet.h:262
trklet::Tracklet::layerstubstr
const std::string layerstubstr(const unsigned layer) const
Definition: Tracklet.cc:572
trklet::Tracklet::trackletIndex_
int trackletIndex_
Definition: Tracklet.h:237
trklet::Tracklet::ichisqrphifit_
FPGAWord ichisqrphifit_
Definition: Tracklet.h:253
trklet::Tracklet::resid_
Residual resid_[N_LAYER+N_DISK]
Definition: Tracklet.h:270
trklet::Tracklet::getITC
int getITC() const
Definition: Tracklet.cc:804
trklet::Tracklet::phi0
double phi0() const
Definition: Tracklet.h:121
trklet::Tracklet::overlap_
bool overlap_
Definition: Tracklet.h:230
trklet::Tracklet::d0approx
double d0approx() const
Definition: Tracklet.h:128
trklet::TrackPars::t
const T & t() const
Definition: TrackPars.h:32
trklet::Tracklet::middleFPGAStub_
const Stub * middleFPGAStub_
Definition: Tracklet.h:234
trklet::Tracklet::trackpars_
TrackPars< double > trackpars_
Definition: Tracklet.h:244
trklet::TrackPars::d0
const T & d0() const
Definition: TrackPars.h:31
trklet::Tracklet::trackletprojstrlayer
std::string trackletprojstrlayer(int layer) const
Definition: Tracklet.h:79
trklet::Settings
Definition: Settings.h:52
trklet::L1TStub
Definition: L1TStub.h:14
trklet::Tracklet::getISeed
int getISeed() const
Definition: Tracklet.cc:798
cms::cuda::assert
assert(be >=bs)
trklet::Tracklet::TCIndex_
int TCIndex_
Definition: Tracklet.h:238
trklet::Tracklet::setTrackIndex
void setTrackIndex(int index)
Definition: Tracklet.cc:810
trklet::Tracklet::fpgad0
const FPGAWord & fpgad0() const
Definition: Tracklet.h:134
trklet::N_DISK
constexpr int N_DISK
Definition: Settings.h:22
trklet::Tracklet::d0fitexact
double d0fitexact() const
Definition: Tracklet.h:147
trklet::Tracklet::itfit
const FPGAWord & itfit() const
Definition: Tracklet.h:154
trklet::Tracklet::tfit
double tfit() const
Definition: Tracklet.h:141
trklet::Tracklet::fit
bool fit() const
Definition: Tracklet.h:195
trklet::Tracklet::rinvapprox
double rinvapprox() const
Definition: Tracklet.h:126
trklet::Tracklet::z0fitexact
double z0fitexact() const
Definition: Tracklet.h:149
trklet::FPGAWord::nbits
int nbits() const
Definition: FPGAWord.h:25
trklet::Tracklet::vmstrdisk
std::string vmstrdisk(int disk, unsigned int allstubindex)
Definition: Tracklet.cc:244
trklet::Tracklet::irinvfit
const FPGAWord & irinvfit() const
Definition: Tracklet.h:151
TrackPars.h
trklet::Tracklet::tpseed
int tpseed()
Definition: Tracklet.cc:107
trklet::Tracklet::triplet_
bool triplet_
Definition: Tracklet.h:231
trklet::Tracklet::isDisk
int isDisk() const
Definition: Tracklet.h:202
trklet::Tracklet
Definition: Tracklet.h:27
trklet::Tracklet::outerFPGAStub_
const Stub * outerFPGAStub_
Definition: Tracklet.h:235
FPGAWord.h
trklet::Tracklet::trackletIndex
int trackletIndex() const
Definition: Tracklet.h:206
trklet::Projection
Definition: Projection.h:10
trklet::Settings::nbitstrackletindex
unsigned int nbitstrackletindex() const
Definition: Settings.h:271
trklet::Tracklet::fpgatrack_
std::unique_ptr< Track > fpgatrack_
Definition: Tracklet.h:266
trklet::Tracklet::middleFPGAStub
const Stub * middleFPGAStub()
Definition: Tracklet.h:63
trklet::Residual::valid
bool valid() const
Definition: Residual.h:30
trklet::Tracklet::proj
Projection & proj(int layerdisk)
Definition: Tracklet.h:87
trklet::Tracklet::barrel_
bool barrel_
Definition: Tracklet.h:228
trklet::Tracklet::trackletprojstr
std::string trackletprojstr(int layer) const
Definition: Tracklet.cc:259
trklet::Tracklet::~Tracklet
~Tracklet()=default
trklet::Tracklet::resid
const Residual & resid(unsigned int layerdisk)
Definition: Tracklet.h:110
trklet::Stub
Definition: Stub.h:18
trklet::Track
Definition: Track.h:18
trklet::Tracklet::validProj
bool validProj(int layerdisk) const
Definition: Tracklet.h:82
trklet::Tracklet::isOverlap
bool isOverlap() const
Definition: Tracklet.h:201
trklet::Tracklet::seedIndex
unsigned int seedIndex() const
Definition: Tracklet.h:222
trklet::Tracklet::trackletprojstrD
std::string trackletprojstrD(int disk) const
Definition: Tracklet.cc:275
trklet::Tracklet::phi0approx
double phi0approx() const
Definition: Tracklet.h:127
trklet::Tracklet::hitpattern_
int hitpattern_
Definition: Tracklet.h:264
trklet::Tracklet::fullmatchdiskstr
std::string fullmatchdiskstr(int disk)
Definition: Tracklet.cc:324
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:21
trklet::Tracklet::projdisk_
int projdisk_[N_DISK]
Definition: Tracklet.h:249
trklet::Tracklet::diskstubstr
const std::string diskstubstr(const unsigned disk) const
Definition: Tracklet.cc:595
trklet::Projection::valid
bool valid() const
Definition: Projection.h:32
trklet::Tracklet::d0fit
double d0fit() const
Definition: Tracklet.h:140
trklet::Tracklet::Tracklet
Tracklet(Settings const &settings, unsigned int iSeed, const Stub *innerFPGAStub, const Stub *middleFPGAStub, const Stub *outerFPGAStub, double rinv, double phi0, double d0, double z0, double t, double rinvapprox, double phi0approx, double d0approx, double z0approx, double tapprox, int irinv, int iphi0, int id0, int iz0, int it, Projection projs[N_LAYER+N_DISK], bool disk, bool overlap=false)
Definition: Tracklet.cc:16
trklet::FPGAWord
Definition: FPGAWord.h:9
trklet::Tracklet::trackIndex
int trackIndex() const
Definition: Tracklet.cc:815
trklet::Tracklet::trackIndex_
int trackIndex_
Definition: Tracklet.h:239
trklet::Tracklet::setTrackletIndex
void setTrackletIndex(unsigned int index)
Definition: Tracklet.cc:793
trklet::Tracklet::phi0fit
double phi0fit() const
Definition: Tracklet.h:139
trklet::Tracklet::TCID
int TCID() const
Definition: Tracklet.h:212
trklet::Tracklet::iphi0fit
const FPGAWord & iphi0fit() const
Definition: Tracklet.h:152
trklet::Tracklet::trackletparstr
std::string trackletparstr()
Definition: Tracklet.cc:188
trklet::Tracklet::rinvfitexact
double rinvfitexact() const
Definition: Tracklet.h:145
trklet::Tracklet::tapprox
double tapprox() const
Definition: Tracklet.h:129
trklet::Tracklet::getStubIDs
std::map< int, int > getStubIDs()
Definition: Tracklet.cc:361
trklet::Tracklet::innerFPGAStub_
const Stub * innerFPGAStub_
Definition: Tracklet.h:233
muon::overlap
bool overlap(const reco::Muon &muon1, const reco::Muon &muon2, double pullX=1.0, double pullY=1.0, bool checkAdjacentChambers=false)
Definition: MuonSelectors.cc:791
trklet::Tracklet::ichiSqfit
FPGAWord ichiSqfit() const
Definition: Tracklet.h:156
Residual.h
trklet::TrackPars
Definition: TrackPars.h:7
trklet::Tracklet::addMatch
void addMatch(unsigned int layerdisk, int ideltaphi, int ideltarz, double dphi, double drz, double dphiapprox, double drzapprox, int stubid, const trklet::Stub *stubptr)
Definition: Tracklet.cc:295
trklet::Residual
Definition: Residual.h:13
trklet::Tracklet::trackletprojstrdisk
std::string trackletprojstrdisk(int disk) const
Definition: Tracklet.h:80
trklet::Tracklet::fpgaz0
const FPGAWord & fpgaz0() const
Definition: Tracklet.h:136
trklet::Tracklet::id0fit
const FPGAWord & id0fit() const
Definition: Tracklet.h:153
trklet
Definition: AllInnerStubsMemory.h:10
trklet::FPGAWord::value
int value() const
Definition: FPGAWord.h:24
trklet::Tracklet::isBarrel
bool isBarrel() const
Definition: Tracklet.h:200
trklet::Tracklet::fpgafitpars_
TrackPars< FPGAWord > fpgafitpars_
Definition: Tracklet.h:252
trklet::Tracklet::tfitexact
double tfitexact() const
Definition: Tracklet.h:148
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
trklet::TrackPars::z0
const T & z0() const
Definition: TrackPars.h:33
trklet::TrackPars::rinv
const T & rinv() const
Definition: TrackPars.h:29
trklet::Tracklet::rinvfit
double rinvfit() const
Definition: Tracklet.h:138
trklet::Tracklet::innerFPGAStub
const Stub * innerFPGAStub()
Definition: Tracklet.h:61
trklet::Tracklet::match
bool match(unsigned int layerdisk)
Definition: Tracklet.h:105
trklet::Tracklet::z0
double z0() const
Definition: Tracklet.h:124
trklet::Tracklet::rinv
double rinv() const
Definition: Tracklet.h:120
trklet::Tracklet::d0
double d0() const
Definition: Tracklet.h:122
trklet::Tracklet::chisqrphifit_
double chisqrphifit_
Definition: Tracklet.h:257
trklet::Tracklet::setTCIndex
void setTCIndex(int index)
Definition: Tracklet.h:208
Track.h
trklet::Tracklet::makeTrack
Track makeTrack(const std::vector< const L1TStub * > &l1stubs)
Definition: Tracklet.cc:738
trklet::Tracklet::fpgapars_
TrackPars< FPGAWord > fpgapars_
Definition: Tracklet.h:242
trklet::Tracklet::outerFPGAStub
const Stub * outerFPGAStub()
Definition: Tracklet.h:65
trklet::Tracklet::proj_
Projection proj_[N_LAYER+N_DISK]
Definition: Tracklet.h:268
trklet::Tracklet::setFitPars
void setFitPars(double rinvfit, double phi0fit, double d0fit, double tfit, double z0fit, double chisqrphifit, double chisqrzfit, double rinvfitexact, double phi0fitexact, double d0fitexact, double tfitexact, double z0fitexact, double chisqrphifitexact, double chisqrzfitexact, int irinvfit, int iphi0fit, int id0fit, int itfit, int iz0fit, int ichisqrphifit, int ichisqrzfit, int hitpattern, const std::vector< const L1TStub * > &l1stubs=std::vector< const L1TStub * >())
Definition: Tracklet.cc:515
trklet::Tracklet::chiSqfit
double chiSqfit() const
Definition: Tracklet.h:143
trklet::Tracklet::chisqrzfit_
double chisqrzfit_
Definition: Tracklet.h:258
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
trklet::Tracklet::disk
int disk() const
Definition: Tracklet.cc:779
trklet::Tracklet::fpgarinv
const FPGAWord & fpgarinv() const
Definition: Tracklet.h:132
trklet::Tracklet::z0fit
double z0fit() const
Definition: Tracklet.h:142
RunInfoPI::valid
Definition: RunInfoPayloadInspectoHelper.h:16
Projection.h
trklet::TrackPars::phi0
const T & phi0() const
Definition: TrackPars.h:30
trklet::Tracklet::ichisqrzfit_
FPGAWord ichisqrzfit_
Definition: Tracklet.h:254
trklet::Tracklet::t
double t() const
Definition: Tracklet.h:123
trklet::Tracklet::trackparsapprox_
TrackPars< double > trackparsapprox_
Definition: Tracklet.h:245
trklet::Tracklet::fpgaphi0
const FPGAWord & fpgaphi0() const
Definition: Tracklet.h:133
trklet::Tracklet::seedIndex_
unsigned int seedIndex_
Definition: Tracklet.h:225
trklet::Tracklet::getL1Stubs
std::vector< const L1TStub * > getL1Stubs()
Definition: Tracklet.cc:343
trklet::Tracklet::disk_
bool disk_
Definition: Tracklet.h:229
trklet::Tracklet::fitparsexact_
TrackPars< double > fitparsexact_
Definition: Tracklet.h:260
trklet::Tracklet::layer
int layer() const
Definition: Tracklet.cc:770
trklet::Tracklet::vmstrlayer
std::string vmstrlayer(int layer, unsigned int allstubindex)
Definition: Tracklet.cc:209
trklet::Tracklet::projlayer_
int projlayer_[N_LAYER - 2]
Definition: Tracklet.h:248
trklet::Tracklet::iz0fit
const FPGAWord & iz0fit() const
Definition: Tracklet.h:155
trklet::Tracklet::trackfitstr
std::string trackfitstr() const
Definition: Tracklet.cc:620