CMS 3D CMS Logo

FitTrack.cc
Go to the documentation of this file.
7 
10 
11 using namespace std;
12 using namespace trklet;
13 
14 FitTrack::FitTrack(string name, Settings const& settings, Globals* global, unsigned int iSector)
15  : ProcessBase(name, settings, global, iSector), trackfit_(nullptr) {}
16 
18  if (settings_.writetrace()) {
19  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
20  << output;
21  }
22  if (output == "trackout") {
23  TrackFitMemory* tmp = dynamic_cast<TrackFitMemory*>(memory);
24  assert(tmp != nullptr);
25  trackfit_ = tmp;
26  return;
27  }
28 
29  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " addOutput, output = " << output << " not known";
30 }
31 
33  if (settings_.writetrace()) {
34  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
35  << input;
36  }
37  if (input.substr(0, 4) == "tpar") {
38  auto* tmp = dynamic_cast<TrackletParametersMemory*>(memory);
39  assert(tmp != nullptr);
40  seedtracklet_.push_back(tmp);
41  return;
42  }
43  if (input.substr(0, 10) == "fullmatch1") {
44  auto* tmp = dynamic_cast<FullMatchMemory*>(memory);
45  assert(tmp != nullptr);
46  fullmatch1_.push_back(tmp);
47  return;
48  }
49  if (input.substr(0, 10) == "fullmatch2") {
50  auto* tmp = dynamic_cast<FullMatchMemory*>(memory);
51  assert(tmp != nullptr);
52  fullmatch2_.push_back(tmp);
53  return;
54  }
55  if (input.substr(0, 10) == "fullmatch3") {
56  auto* tmp = dynamic_cast<FullMatchMemory*>(memory);
57  assert(tmp != nullptr);
58  fullmatch3_.push_back(tmp);
59  return;
60  }
61  if (input.substr(0, 10) == "fullmatch4") {
62  auto* tmp = dynamic_cast<FullMatchMemory*>(memory);
63  assert(tmp != nullptr);
64  fullmatch4_.push_back(tmp);
65  return;
66  }
67 
68  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " input = " << input << " not found";
69 }
70 
71 #ifdef USEHYBRID
72 void FitTrack::trackFitKF(Tracklet* tracklet,
73  std::vector<const Stub*>& trackstublist,
74  std::vector<std::pair<int, int>>& stubidslist) {
75  if (settings_.doKF()) {
76  // From full match lists, collect all the stubs associated with the tracklet seed
77 
78  // Get seed stubs first
79  trackstublist.emplace_back(tracklet->innerFPGAStub());
80  if (tracklet->getISeed() >= (int)N_TRKLSEED + 1)
81  trackstublist.emplace_back(tracklet->middleFPGAStub());
82  trackstublist.emplace_back(tracklet->outerFPGAStub());
83 
84  // Now get ALL matches (can have multiple per layer)
85  for (const auto& i : fullmatch1_) {
86  for (unsigned int j = 0; j < i->nMatches(); j++) {
87  if (i->getTracklet(j)->TCID() == tracklet->TCID()) {
88  trackstublist.push_back(i->getMatch(j).second);
89  }
90  }
91  }
92 
93  for (const auto& i : fullmatch2_) {
94  for (unsigned int j = 0; j < i->nMatches(); j++) {
95  if (i->getTracklet(j)->TCID() == tracklet->TCID()) {
96  trackstublist.push_back(i->getMatch(j).second);
97  }
98  }
99  }
100 
101  for (const auto& i : fullmatch3_) {
102  for (unsigned int j = 0; j < i->nMatches(); j++) {
103  if (i->getTracklet(j)->TCID() == tracklet->TCID()) {
104  trackstublist.push_back(i->getMatch(j).second);
105  }
106  }
107  }
108 
109  for (const auto& i : fullmatch4_) {
110  for (unsigned int j = 0; j < i->nMatches(); j++) {
111  if (i->getTracklet(j)->TCID() == tracklet->TCID()) {
112  trackstublist.push_back(i->getMatch(j).second);
113  }
114  }
115  }
116 
117  // For merge removal, loop through the resulting list of stubs to calculate their stubids
118  if (settings_.removalType() == "merge") {
119  for (const auto& it : trackstublist) {
120  int layer = it->layer().value() + 1; // Assume layer (1-6) stub first
121  if (it->layer().value() < 0) { // if disk stub, though...
122  layer = it->disk().value() + 10 * it->disk().value() / abs(it->disk().value()); //disk = +/- 11-15
123  }
124  stubidslist.push_back(std::make_pair(layer, it->phiregionaddress()));
125  }
126 
127  // And that's all we need! The rest is just for fitting (in PurgeDuplicate)
128  return;
129  }
130 
131  HybridFit hybridFitter(iSector_, settings_, globals_);
132  hybridFitter.Fit(tracklet, trackstublist);
133  return;
134  }
135 }
136 #endif
137 
138 void FitTrack::trackFitChisq(Tracklet* tracklet, std::vector<const Stub*>&, std::vector<std::pair<int, int>>&) {
139  if (globals_->trackDerTable() == nullptr) {
140  TrackDerTable* derTablePtr = new TrackDerTable(settings_);
141 
142  derTablePtr->readPatternFile(settings_.fitPatternFile());
143  derTablePtr->fillTable();
144  if (settings_.debugTracklet()) {
145  edm::LogVerbatim("Tracklet") << "Number of entries in derivative table: " << derTablePtr->getEntries();
146  }
147  assert(derTablePtr->getEntries() != 0);
148 
149  globals_->trackDerTable() = derTablePtr;
150  }
151 
152  const TrackDerTable& derTable = *globals_->trackDerTable();
153 
154  //First step is to build list of layers and disks.
155  int layers[N_LAYER];
156  double r[N_LAYER];
157  unsigned int nlayers = 0; // layers with found stub-projections
158  int disks[N_DISK];
159  double z[N_DISK];
160  unsigned int ndisks = 0; // disks with found stub-projections
161 
162  // residuals for each stub
163  double phiresid[N_FITSTUB];
164  double zresid[N_FITSTUB];
165  double phiresidexact[N_FITSTUB];
166  double zresidexact[N_FITSTUB];
167  int iphiresid[N_FITSTUB];
168  int izresid[N_FITSTUB];
169  double alpha[N_FITSTUB];
170 
171  for (unsigned int i = 0; i < N_FITSTUB; i++) {
172  iphiresid[i] = 0;
173  izresid[i] = 0;
174  alpha[i] = 0.0;
175 
176  phiresid[i] = 0.0;
177  zresid[i] = 0.0;
178  phiresidexact[i] = 0.0;
179  zresidexact[i] = 0.0;
180  }
181 
182  std::bitset<N_LAYER> lmatches; //layer matches
183  std::bitset<N_DISK * 2> dmatches; //disk matches (2 per disk to separate 2S from PS)
184 
185  int mult = 1;
186 
187  unsigned int layermask = 0;
188  unsigned int diskmask = 0;
189  unsigned int alphaindex = 0;
190  unsigned int power = 1;
191 
192  double t = tracklet->t();
193  double rinv = tracklet->rinv();
194 
195  if (tracklet->isBarrel()) {
196  for (unsigned int l = 1; l <= N_LAYER; l++) {
197  if (l == (unsigned int)tracklet->layer() || l == (unsigned int)tracklet->layer() + 1) {
198  lmatches.set(N_LAYER - l);
199  layermask |= (1 << (N_LAYER - l));
200  layers[nlayers++] = l;
201  continue;
202  }
203  if (tracklet->match(l)) {
204  lmatches.set(N_LAYER - l);
205  layermask |= (1 << (N_LAYER - l));
206  phiresid[nlayers] = tracklet->phiresidapprox(l);
207  zresid[nlayers] = tracklet->zresidapprox(l);
208  phiresidexact[nlayers] = tracklet->phiresid(l);
209  zresidexact[nlayers] = tracklet->zresid(l);
210  iphiresid[nlayers] = tracklet->fpgaphiresid(l).value();
211  izresid[nlayers] = tracklet->fpgazresid(l).value();
212 
213  layers[nlayers++] = l;
214  }
215  }
216 
217  for (unsigned int d = 1; d <= N_DISK; d++) {
218  if (layermask & (1 << (d - 1)))
219  continue;
220 
221  if (mult == 1 << (3 * settings_.alphaBitsTable()))
222  continue;
223 
224  if (ndisks + nlayers >= N_FITSTUB)
225  continue;
226  if (tracklet->matchdisk(d)) {
227  if (std::abs(tracklet->alphadisk(d)) < 1e-20) {
228  dmatches.set(2 * d - 1);
229  diskmask |= (1 << (2 * (N_DISK - d) + 1));
230  } else {
231  int ialpha = tracklet->ialphadisk(d).value();
232  int nalpha = tracklet->ialphadisk(d).nbits();
233  nalpha = nalpha - settings_.alphaBitsTable();
234  ialpha = (1 << (settings_.alphaBitsTable() - 1)) + (ialpha >> nalpha);
235 
236  alphaindex += ialpha * power;
237  power = power << settings_.alphaBitsTable();
238  dmatches.set(2 * (N_DISK - d));
239  diskmask |= (1 << (2 * (N_DISK - d)));
241  }
242  alpha[ndisks] = tracklet->alphadisk(d);
243  phiresid[nlayers + ndisks] = tracklet->phiresidapproxdisk(d);
244  zresid[nlayers + ndisks] = tracklet->rresidapproxdisk(d);
245  phiresidexact[nlayers + ndisks] = tracklet->phiresiddisk(d);
246  zresidexact[nlayers + ndisks] = tracklet->rresiddisk(d);
247  iphiresid[nlayers + ndisks] = tracklet->fpgaphiresiddisk(d).value();
248  izresid[nlayers + ndisks] = tracklet->fpgarresiddisk(d).value();
249 
250  disks[ndisks++] = d;
251  }
252  }
253 
254  if (settings_.writeMonitorData("HitPattern")) {
255  if (mult <= 1 << (3 * settings_.alphaBitsTable())) {
256  globals_->ofstream("hitpattern.txt")
257  << lmatches.to_string() << " " << dmatches.to_string() << " " << mult << endl;
258  }
259  }
260  }
261 
262  if (tracklet->isDisk()) {
263  for (unsigned int l = 1; l <= 2; l++) {
264  if (tracklet->match(l)) {
265  lmatches.set(N_LAYER - l);
266 
267  layermask |= (1 << (N_LAYER - l));
268 
269  phiresid[nlayers] = tracklet->phiresidapprox(l);
270  zresid[nlayers] = tracklet->zresidapprox(l);
271  phiresidexact[nlayers] = tracklet->phiresid(l);
272  zresidexact[nlayers] = tracklet->zresid(l);
273  iphiresid[nlayers] = tracklet->fpgaphiresid(l).value();
274  izresid[nlayers] = tracklet->fpgazresid(l).value();
275 
276  layers[nlayers++] = l;
277  }
278  }
279 
280  for (int d1 = 1; d1 <= N_DISK; d1++) {
281  int d = d1;
282 
283  // skip F/B5 if there's already a L2 match
284  if (d == 5 and layermask & (1 << 4))
285  continue;
286 
287  if (tracklet->fpgat().value() < 0.0)
288  d = -d1;
289  if (d1 == abs(tracklet->disk()) || d1 == abs(tracklet->disk()) + 1) {
290  dmatches.set(2 * d1 - 1);
291  diskmask |= (1 << (2 * (N_DISK - d1) + 1));
292  alpha[ndisks] = 0.0;
293  disks[ndisks++] = d;
294  continue;
295  }
296 
297  if (ndisks + nlayers >= N_FITSTUB)
298  continue;
299  if (tracklet->matchdisk(d)) {
300  if (std::abs(tracklet->alphadisk(d)) < 1e-20) {
301  dmatches.set(2 * d1 - 1);
302  diskmask |= (1 << (2 * (N_DISK - d1) + 1));
303  } else {
304  int ialpha = tracklet->ialphadisk(d).value();
305  int nalpha = tracklet->ialphadisk(d).nbits();
306  nalpha = nalpha - settings_.alphaBitsTable();
307  ialpha = (1 << (settings_.alphaBitsTable() - 1)) + (ialpha >> nalpha);
308 
309  alphaindex += ialpha * power;
310  power = power << settings_.alphaBitsTable();
311  dmatches.set(2 * (N_DISK - d1));
312  diskmask |= (1 << (2 * (N_DISK - d1)));
314  }
315 
316  alpha[ndisks] = tracklet->alphadisk(d);
317  assert(std::abs(tracklet->phiresidapproxdisk(d)) < 0.2);
318  phiresid[nlayers + ndisks] = tracklet->phiresidapproxdisk(d);
319  zresid[nlayers + ndisks] = tracklet->rresidapproxdisk(d);
320  assert(std::abs(tracklet->phiresiddisk(d)) < 0.2);
321  phiresidexact[nlayers + ndisks] = tracklet->phiresiddisk(d);
322  zresidexact[nlayers + ndisks] = tracklet->rresiddisk(d);
323  iphiresid[nlayers + ndisks] = tracklet->fpgaphiresiddisk(d).value();
324  izresid[nlayers + ndisks] = tracklet->fpgarresiddisk(d).value();
325 
326  disks[ndisks++] = d;
327  }
328  }
329  }
330 
331  if (tracklet->isOverlap()) {
332  for (unsigned int l = 1; l <= 2; l++) {
333  if (l == (unsigned int)tracklet->layer()) {
334  lmatches.set(N_LAYER - l);
335  layermask |= (1 << (N_LAYER - l));
336  layers[nlayers++] = l;
337  continue;
338  }
339  if (tracklet->match(l)) {
340  lmatches.set(N_LAYER - l);
341  layermask |= (1 << (N_LAYER - l));
342  assert(std::abs(tracklet->phiresidapprox(l)) < 0.2);
343  phiresid[nlayers] = tracklet->phiresidapprox(l);
344  zresid[nlayers] = tracklet->zresidapprox(l);
345  assert(std::abs(tracklet->phiresid(l)) < 0.2);
346  phiresidexact[nlayers] = tracklet->phiresid(l);
347  zresidexact[nlayers] = tracklet->zresid(l);
348  iphiresid[nlayers] = tracklet->fpgaphiresid(l).value();
349  izresid[nlayers] = tracklet->fpgazresid(l).value();
350 
351  layers[nlayers++] = l;
352  }
353  }
354 
355  for (unsigned int d1 = 1; d1 <= N_DISK; d1++) {
356  if (mult == 1 << (3 * settings_.alphaBitsTable()))
357  continue;
358  int d = d1;
359  if (tracklet->fpgat().value() < 0.0)
360  d = -d1;
361  if (d == tracklet->disk()) { //All seeds in PS modules
362  disks[ndisks] = tracklet->disk();
363  dmatches.set(2 * d1 - 1);
364  diskmask |= (1 << (2 * (N_DISK - d1) + 1));
365  ndisks++;
366  continue;
367  }
368 
369  if (ndisks + nlayers >= N_FITSTUB)
370  continue;
371  if (tracklet->matchdisk(d)) {
372  if (std::abs(tracklet->alphadisk(d)) < 1e-20) {
373  dmatches.set(2 * (N_DISK - d1));
374  diskmask |= (1 << (2 * (N_DISK - d1) + 1));
375  FPGAWord tmp;
376  tmp.set(diskmask, 10);
377  } else {
378  int ialpha = tracklet->ialphadisk(d).value();
379  int nalpha = tracklet->ialphadisk(d).nbits();
380  nalpha = nalpha - settings_.alphaBitsTable();
381  ialpha = (1 << (settings_.alphaBitsTable() - 1)) + (ialpha >> nalpha);
382 
383  alphaindex += ialpha * power;
384  power = power << settings_.alphaBitsTable();
385  dmatches.set(2 * (N_DISK - d1));
386  diskmask |= (1 << (2 * (N_DISK - d1)));
387  FPGAWord tmp;
388  tmp.set(diskmask, 10);
390  }
391 
392  alpha[ndisks] = tracklet->alphadisk(d);
393  assert(std::abs(tracklet->phiresidapproxdisk(d)) < 0.2);
394  phiresid[nlayers + ndisks] = tracklet->phiresidapproxdisk(d);
395  zresid[nlayers + ndisks] = tracklet->rresidapproxdisk(d);
396  assert(std::abs(tracklet->phiresiddisk(d)) < 0.2);
397  phiresidexact[nlayers + ndisks] = tracklet->phiresiddisk(d);
398  zresidexact[nlayers + ndisks] = tracklet->rresiddisk(d);
399  iphiresid[nlayers + ndisks] = tracklet->fpgaphiresiddisk(d).value();
400  izresid[nlayers + ndisks] = tracklet->fpgarresiddisk(d).value();
401 
402  disks[ndisks++] = d;
403  }
404  }
405  }
406 
407  int rinvindex =
408  (1 << (settings_.nrinvBitsTable() - 1)) * rinv / settings_.rinvmax() + (1 << (settings_.nrinvBitsTable() - 1));
409  if (rinvindex < 0)
410  rinvindex = 0;
411  if (rinvindex >= (1 << settings_.nrinvBitsTable()))
412  rinvindex = (1 << settings_.nrinvBitsTable()) - 1;
413 
414  const TrackDer* derivatives = derTable.getDerivatives(layermask, diskmask, alphaindex, rinvindex);
415 
416  if (derivatives == nullptr) {
417  if (settings_.warnNoDer()) {
418  FPGAWord tmpl, tmpd;
419  tmpl.set(layermask, 6);
420  tmpd.set(diskmask, 10);
421  edm::LogVerbatim("Tracklet") << "No derivative for layermask, diskmask : " << layermask << " " << tmpl.str()
422  << " " << diskmask << " " << tmpd.str() << " eta = " << asinh(t);
423  }
424  return;
425  }
426 
427  double ttabi = TrackDerTable::tpar(settings_, diskmask, layermask);
428  if (t < 0.0)
429  ttabi = -ttabi;
430  double ttab = ttabi;
431 
432  if (settings_.debugTracklet()) {
433  edm::LogVerbatim("Tracklet") << "Doing trackfit in " << getName();
434  }
435 
436  int sign = 1;
437  if (t < 0.0)
438  sign = -1;
439 
440  double rstub[6];
441 
442  double realrstub[3];
443  realrstub[0] = -1.0;
444  realrstub[1] = -1.0;
445  realrstub[2] = -1.0;
446 
447  for (unsigned i = 0; i < nlayers; i++) {
448  r[i] = settings_.rmean(layers[i] - 1);
449  if (layers[i] == tracklet->layer()) {
450  if (tracklet->isOverlap()) {
451  realrstub[i] = tracklet->outerStub()->r();
452  } else {
453  realrstub[i] = tracklet->innerStub()->r();
454  }
455  }
456  if (layers[i] == tracklet->layer() + 1) {
457  realrstub[i] = tracklet->outerStub()->r();
458  }
459  if (tracklet->validResid(layers[i]) && layers[i] < 4) {
460  const Stub* stubptr = tracklet->stubptr(layers[i]);
461  realrstub[i] = stubptr->l1tstub()->r();
462  assert(std::abs(realrstub[i] - r[i]) < 5.0);
463  }
464  rstub[i] = r[i];
465  }
466  for (unsigned i = 0; i < ndisks; i++) {
467  z[i] = sign * settings_.zmean(abs(disks[i]) - 1);
468  rstub[i + nlayers] = z[i] / ttabi;
469  }
470 
471  double D[N_FITPARAM][N_FITSTUB * 2];
472  double MinvDt[N_FITPARAM][N_FITSTUB * 2];
473  int iD[N_FITPARAM][N_FITSTUB * 2];
474  int iMinvDt[N_FITPARAM][N_FITSTUB * 2];
475  double sigma[N_FITSTUB * 2];
476  double kfactor[N_FITSTUB * 2];
477 
478  unsigned int n = nlayers + ndisks;
479 
480  if (settings_.exactderivatives()) {
482  settings_, nlayers, r, ndisks, z, alpha, t, rinv, D, iD, MinvDt, iMinvDt, sigma, kfactor);
483  ttabi = t;
484  ttab = t;
485  } else {
488  settings_, nlayers, r, ndisks, z, alpha, t, rinv, D, iD, MinvDt, iMinvDt, sigma, kfactor);
489 
490  double MinvDtDummy[N_FITPARAM][N_FITSTUB * 2];
491  derivatives->fill(tracklet->fpgat().value(), MinvDtDummy, iMinvDt);
492  ttab = t;
493  } else {
494  derivatives->fill(tracklet->fpgat().value(), MinvDt, iMinvDt);
495  }
496  }
497 
498  if (!settings_.exactderivatives()) {
499  for (unsigned int i = 0; i < nlayers; i++) {
500  if (r[i] > settings_.rPS2S())
501  continue;
502  for (unsigned int ii = 0; ii < nlayers; ii++) {
503  if (r[ii] > settings_.rPS2S())
504  continue;
505 
506  double tder = derivatives->tdzcorr(i, ii);
507  double zder = derivatives->z0dzcorr(i, ii);
508 
509  double dr = realrstub[i] - r[i];
510 
511  MinvDt[2][2 * ii + 1] += dr * tder;
512  MinvDt[3][2 * ii + 1] += dr * zder;
513 
514  int itder = derivatives->itdzcorr(i, ii);
515  int izder = derivatives->iz0dzcorr(i, ii);
516 
517  int idr = dr / settings_.kr();
518 
519  iMinvDt[2][2 * ii + 1] += ((idr * itder) >> settings_.rcorrbits());
520  iMinvDt[3][2 * ii + 1] += ((idr * izder) >> settings_.rcorrbits());
521  }
522  }
523  }
524 
525  double rinvseed = tracklet->rinvapprox();
526  double phi0seed = tracklet->phi0approx();
527  double tseed = tracklet->tapprox();
528  double z0seed = tracklet->z0approx();
529 
530  double rinvseedexact = tracklet->rinv();
531  double phi0seedexact = tracklet->phi0();
532  double tseedexact = tracklet->t();
533  double z0seedexact = tracklet->z0();
534 
535  double chisqseed = 0.0;
536  double chisqseedexact = 0.0;
537 
538  double delta[2 * N_FITSTUB];
539  double deltaexact[2 * N_FITSTUB];
540  int idelta[2 * N_FITSTUB];
541 
542  for (unsigned int i = 0; i < 2 * N_FITSTUB; i++) {
543  delta[i] = 0.0;
544  deltaexact[i] = 0.0;
545  idelta[i] = 0;
546  }
547 
548  int j = 0;
549 
550  for (unsigned int i = 0; i < n; i++) {
551  if (i >= nlayers) {
552  iphiresid[i] *= (t / ttabi);
553  phiresid[i] *= (t / ttab);
554  phiresidexact[i] *= (t / ttab);
555  }
556 
557  idelta[j] = iphiresid[i];
558  delta[j] = phiresid[i];
559  if (std::abs(phiresid[i]) > 0.2) {
560  edm::LogWarning("Tracklet") << getName() << " WARNING too large phiresid: " << phiresid[i] << " "
561  << phiresidexact[i];
562  }
563  assert(std::abs(phiresid[i]) < 1.0);
564  assert(std::abs(phiresidexact[i]) < 1.0);
565  deltaexact[j++] = phiresidexact[i];
566 
567  idelta[j] = izresid[i];
568  delta[j] = zresid[i];
569  deltaexact[j++] = zresidexact[i];
570 
571  chisqseed += (delta[j - 2] * delta[j - 2] + delta[j - 1] * delta[j - 1]);
572  chisqseedexact += (deltaexact[j - 2] * deltaexact[j - 2] + deltaexact[j - 1] * deltaexact[j - 1]);
573  }
574  assert(j <= 12);
575 
576  double drinv = 0.0;
577  double dphi0 = 0.0;
578  double dt = 0.0;
579  double dz0 = 0.0;
580 
581  double drinvexact = 0.0;
582  double dphi0exact = 0.0;
583  double dtexact = 0.0;
584  double dz0exact = 0.0;
585 
586  int idrinv = 0;
587  int idphi0 = 0;
588  int idt = 0;
589  int idz0 = 0;
590 
591  double drinv_cov = 0.0;
592  double dphi0_cov = 0.0;
593  double dt_cov = 0.0;
594  double dz0_cov = 0.0;
595 
596  double drinv_covexact = 0.0;
597  double dphi0_covexact = 0.0;
598  double dt_covexact = 0.0;
599  double dz0_covexact = 0.0;
600 
601  for (unsigned int j = 0; j < 2 * n; j++) {
602  drinv -= MinvDt[0][j] * delta[j];
603  dphi0 -= MinvDt[1][j] * delta[j];
604  dt -= MinvDt[2][j] * delta[j];
605  dz0 -= MinvDt[3][j] * delta[j];
606 
607  drinv_cov += D[0][j] * delta[j];
608  dphi0_cov += D[1][j] * delta[j];
609  dt_cov += D[2][j] * delta[j];
610  dz0_cov += D[3][j] * delta[j];
611 
612  drinvexact -= MinvDt[0][j] * deltaexact[j];
613  dphi0exact -= MinvDt[1][j] * deltaexact[j];
614  dtexact -= MinvDt[2][j] * deltaexact[j];
615  dz0exact -= MinvDt[3][j] * deltaexact[j];
616 
617  drinv_covexact += D[0][j] * deltaexact[j];
618  dphi0_covexact += D[1][j] * deltaexact[j];
619  dt_covexact += D[2][j] * deltaexact[j];
620  dz0_covexact += D[3][j] * deltaexact[j];
621 
622  idrinv += ((iMinvDt[0][j] * idelta[j]));
623  idphi0 += ((iMinvDt[1][j] * idelta[j]));
624  idt += ((iMinvDt[2][j] * idelta[j]));
625  idz0 += ((iMinvDt[3][j] * idelta[j]));
626 
627  if (false && j % 2 == 0) {
628  edm::LogVerbatim("Tracklet") << "DEBUG CHI2FIT " << j << " " << rinvseed << " + " << MinvDt[0][j] * delta[j]
629  << " " << MinvDt[0][j] << " " << delta[j] * rstub[j / 2] * 10000 << " \n"
630  << j << " " << tracklet->fpgarinv().value() * settings_.krinvpars() << " + "
631  << ((iMinvDt[0][j] * idelta[j])) * settings_.krinvpars() / 1024.0 << " "
632  << iMinvDt[0][j] * settings_.krinvpars() / settings_.kphi() / 1024.0 << " "
633  << idelta[j] * settings_.kphi() * rstub[j / 2] * 10000 << " " << idelta[j];
634  }
635  }
636 
637  double deltaChisqexact =
638  drinvexact * drinv_covexact + dphi0exact * dphi0_covexact + dtexact * dt_covexact + dz0exact * dz0_covexact;
639 
640  int irinvseed = tracklet->fpgarinv().value();
641  int iphi0seed = tracklet->fpgaphi0().value();
642 
643  int itseed = tracklet->fpgat().value();
644  int iz0seed = tracklet->fpgaz0().value();
645 
646  int irinvfit = irinvseed + ((idrinv + (1 << settings_.fitrinvbitshift())) >> settings_.fitrinvbitshift());
647 
648  int iphi0fit = iphi0seed + (idphi0 >> settings_.fitphi0bitshift());
649  int itfit = itseed + (idt >> settings_.fittbitshift());
650 
651  int iz0fit = iz0seed + (idz0 >> settings_.fitz0bitshift());
652 
653  double rinvfit = rinvseed - drinv;
654  double phi0fit = phi0seed - dphi0;
655 
656  double tfit = tseed - dt;
657  double z0fit = z0seed - dz0;
658 
659  double rinvfitexact = rinvseedexact - drinvexact;
660  double phi0fitexact = phi0seedexact - dphi0exact;
661 
662  double tfitexact = tseedexact - dtexact;
663  double z0fitexact = z0seedexact - dz0exact;
664 
665  double chisqfitexact = chisqseedexact + deltaChisqexact;
666 
668  bool NewChisqDebug = false;
669  double chisqfit = 0.0;
670  uint ichisqfit = 0;
671 
672  double phifactor;
673  double rzfactor;
674  double iphifactor;
675  double irzfactor;
676  int k = 0; // column index of D matrix
677 
678  if (NewChisqDebug) {
679  edm::LogVerbatim("Tracklet") << "OG chisq: \n"
680  << "drinv/cov = " << drinv << "/" << drinv_cov << " \n"
681  << "dphi0/cov = " << drinv << "/" << dphi0_cov << " \n"
682  << "dt/cov = " << drinv << "/" << dt_cov << " \n"
683  << "dz0/cov = " << drinv << "/" << dz0_cov << "\n";
684  std::string myout = "D[0][k]= ";
685  for (unsigned int i = 0; i < 2 * n; i++) {
686  myout += std::to_string(D[0][i]);
687  myout += ", ";
688  }
689  edm::LogVerbatim("Tracklet") << myout;
690  }
691 
692  for (unsigned int i = 0; i < n; i++) { // loop over stubs
693 
694  phifactor = rstub[k / 2] * delta[k] / sigma[k] + D[0][k] * drinv + D[1][k] * dphi0 + D[2][k] * dt + D[3][k] * dz0;
695  iphifactor = kfactor[k] * rstub[k / 2] * idelta[k] * (1 << settings_.chisqphifactbits()) / sigma[k] -
696  iD[0][k] * idrinv - iD[1][k] * idphi0 - iD[2][k] * idt - iD[3][k] * idz0;
697 
698  if (NewChisqDebug) {
699  edm::LogVerbatim("Tracklet") << "delta[k]/sigma = " << delta[k] / sigma[k] << " delta[k] = " << delta[k] << "\n"
700  << "sum = " << phifactor - delta[k] / sigma[k] << " drinvterm = " << D[0][k] * drinv
701  << " dphi0term = " << D[1][k] * dphi0 << " dtterm = " << D[2][k] * dt
702  << " dz0term = " << D[3][k] * dz0 << "\n phifactor = " << phifactor;
703  }
704 
705  chisqfit += phifactor * phifactor;
706  ichisqfit += iphifactor * iphifactor / (1 << (2 * settings_.chisqphifactbits() - 4));
707 
708  k++;
709 
710  rzfactor = delta[k] / sigma[k] + D[0][k] * drinv + D[1][k] * dphi0 + D[2][k] * dt + D[3][k] * dz0;
711  irzfactor = kfactor[k] * idelta[k] * (1 << settings_.chisqzfactbits()) / sigma[k] - iD[0][k] * idrinv -
712  iD[1][k] * idphi0 - iD[2][k] * idt - iD[3][k] * idz0;
713 
714  if (NewChisqDebug) {
715  edm::LogVerbatim("Tracklet") << "delta[k]/sigma = " << delta[k] / sigma[k] << " delta[k] = " << delta[k] << "\n"
716  << "sum = " << rzfactor - delta[k] / sigma[k] << " drinvterm = " << D[0][k] * drinv
717  << " dphi0term = " << D[1][k] * dphi0 << " dtterm = " << D[2][k] * dt
718  << " dz0term = " << D[3][k] * dz0 << "\n rzfactor = " << rzfactor;
719  }
720 
721  chisqfit += rzfactor * rzfactor;
722  ichisqfit += irzfactor * irzfactor / (1 << (2 * settings_.chisqzfactbits() - 4));
723 
724  k++;
725  }
726 
727  if (settings_.writeMonitorData("ChiSq")) {
728  globals_->ofstream("chisq.txt") << asinh(itfit * settings_.ktpars()) << " " << chisqfit << " " << ichisqfit / 16.0
729  << endl;
730  }
731 
732  // Chisquare per DOF capped out at 11 bits, so 15 is an educated guess
733  if (ichisqfit >= (1 << 15)) {
734  if (NewChisqDebug) {
735  edm::LogVerbatim("Tracklet") << "CHISQUARE (" << ichisqfit << ") LARGER THAN 11 BITS!";
736  }
737  ichisqfit = (1 << 15) - 1;
738  }
739 
740  // Eliminate lower bits to fit in 8 bits
741  ichisqfit = ichisqfit >> 7;
742  // Probably redundant... enforce 8 bit cap
743  if (ichisqfit >= (1 << 8))
744  ichisqfit = (1 << 8) - 1;
745 
746  double phicrit = phi0fit - asin(0.5 * settings_.rcrit() * rinvfit);
747  bool keep = (phicrit > settings_.phicritmin()) && (phicrit < settings_.phicritmax());
748 
749  if (!keep) {
750  return;
751  }
752 
753  // NOTE: setFitPars in Tracklet.h now accepts chi2 r-phi and chi2 r-z values. This class only has access
754  // to the composite chi2. When setting fit parameters on a tracklet, this places all of the chi2 into the
755  // r-phi fit, and sets the r-z fit value to zero.
756  //
757  // This is also true for the call to setFitPars in trackFitFake.
758  tracklet->setFitPars(rinvfit,
759  phi0fit,
760  0.0,
761  tfit,
762  z0fit,
763  chisqfit,
764  0.0,
765  rinvfitexact,
766  phi0fitexact,
767  0.0,
768  tfitexact,
769  z0fitexact,
770  chisqfitexact,
771  0.0,
772  irinvfit,
773  iphi0fit,
774  0,
775  itfit,
776  iz0fit,
777  ichisqfit,
778  0,
779  0);
780 }
781 
782 void FitTrack::trackFitFake(Tracklet* tracklet, std::vector<const Stub*>&, std::vector<std::pair<int, int>>&) {
783  tracklet->setFitPars(tracklet->rinvapprox(),
784  tracklet->phi0approx(),
785  tracklet->d0approx(),
786  tracklet->tapprox(),
787  tracklet->z0approx(),
788  0.0,
789  0.0,
790  tracklet->rinv(),
791  tracklet->phi0(),
792  tracklet->d0(),
793  tracklet->t(),
794  tracklet->z0(),
795  0.0,
796  0.0,
797  tracklet->fpgarinv().value(),
798  tracklet->fpgaphi0().value(),
799  tracklet->fpgad0().value(),
800  tracklet->fpgat().value(),
801  tracklet->fpgaz0().value(),
802  0,
803  0,
804  0);
805  return;
806 }
807 
808 std::vector<Tracklet*> FitTrack::orderedMatches(vector<FullMatchMemory*>& fullmatch) {
809  std::vector<Tracklet*> tmp;
810 
811  std::vector<unsigned int> indexArray;
812  for (auto& imatch : fullmatch) {
813  //check that we have correct order
814  if (imatch->nMatches() > 1) {
815  for (unsigned int j = 0; j < imatch->nMatches() - 1; j++) {
816  assert(imatch->getTracklet(j)->TCID() <= imatch->getTracklet(j + 1)->TCID());
817  }
818  }
819 
820  if (settings_.debugTracklet() && imatch->nMatches() != 0) {
821  edm::LogVerbatim("Tracklet") << "orderedMatches: " << imatch->getName() << " " << imatch->nMatches();
822  }
823 
824  indexArray.push_back(0);
825  }
826 
827  int bestIndex = -1;
828  do {
829  int bestTCID = (1 << 16);
830  bestIndex = -1;
831  for (unsigned int i = 0; i < fullmatch.size(); i++) {
832  if (indexArray[i] >= fullmatch[i]->nMatches()) {
833  //skip as we were at the end
834  continue;
835  }
836  int TCID = fullmatch[i]->getTracklet(indexArray[i])->TCID();
837  if (TCID < bestTCID) {
838  bestTCID = TCID;
839  bestIndex = i;
840  }
841  }
842  if (bestIndex != -1) {
843  tmp.push_back(fullmatch[bestIndex]->getTracklet(indexArray[bestIndex]));
844  indexArray[bestIndex]++;
845  }
846  } while (bestIndex != -1);
847 
848  for (unsigned int i = 0; i < tmp.size(); i++) {
849  if (i > 0) {
850  //This allows for equal TCIDs. This means that we can e.g. have a track seeded in L1L2 that projects to both L3 and D4.
851  //The algorithm will pick up the first hit and drop the second.
852  if (tmp[i - 1]->TCID() > tmp[i]->TCID()) {
853  edm::LogVerbatim("Tracklet") << "Wrong TCID ordering in " << getName() << " : " << tmp[i - 1]->TCID() << " "
854  << tmp[i]->TCID();
855  }
856  }
857  }
858 
859  return tmp;
860 }
861 
863  // merge
864  const std::vector<Tracklet*>& matches1 = orderedMatches(fullmatch1_);
865  const std::vector<Tracklet*>& matches2 = orderedMatches(fullmatch2_);
866  const std::vector<Tracklet*>& matches3 = orderedMatches(fullmatch3_);
867  const std::vector<Tracklet*>& matches4 = orderedMatches(fullmatch4_);
868 
869  if (settings_.debugTracklet() && (matches1.size() + matches2.size() + matches3.size() + matches4.size()) > 0) {
870  for (auto& imatch : fullmatch1_) {
871  edm::LogVerbatim("Tracklet") << imatch->getName() << " " << imatch->nMatches();
872  }
873  edm::LogVerbatim("Tracklet") << getName() << "[" << iSector_ << "] matches : " << matches1.size() << " "
874  << matches2.size() << " " << matches3.size() << " " << matches4.size();
875  }
876 
877  unsigned int indexArray[4];
878  for (unsigned int i = 0; i < 4; i++) {
879  indexArray[i] = 0;
880  }
881 
882  int countAll = 0;
883  int countFit = 0;
884 
885  Tracklet* bestTracklet = nullptr;
886  do {
887  countAll++;
888  bestTracklet = nullptr;
889 
890  if (indexArray[0] < matches1.size()) {
891  if (bestTracklet == nullptr) {
892  bestTracklet = matches1[indexArray[0]];
893  } else {
894  if (matches1[indexArray[0]]->TCID() < bestTracklet->TCID())
895  bestTracklet = matches1[indexArray[0]];
896  }
897  }
898 
899  if (indexArray[1] < matches2.size()) {
900  if (bestTracklet == nullptr) {
901  bestTracklet = matches2[indexArray[1]];
902  } else {
903  if (matches2[indexArray[1]]->TCID() < bestTracklet->TCID())
904  bestTracklet = matches2[indexArray[1]];
905  }
906  }
907 
908  if (indexArray[2] < matches3.size()) {
909  if (bestTracklet == nullptr) {
910  bestTracklet = matches3[indexArray[2]];
911  } else {
912  if (matches3[indexArray[2]]->TCID() < bestTracklet->TCID())
913  bestTracklet = matches3[indexArray[2]];
914  }
915  }
916 
917  if (indexArray[3] < matches4.size()) {
918  if (bestTracklet == nullptr) {
919  bestTracklet = matches4[indexArray[3]];
920  } else {
921  if (matches4[indexArray[3]]->TCID() < bestTracklet->TCID())
922  bestTracklet = matches4[indexArray[3]];
923  }
924  }
925 
926  if (bestTracklet == nullptr)
927  break;
928 
929  //Counts total number of matched hits
930  int nMatches = 0;
931 
932  //Counts unique hits in each layer
933  int nMatchesUniq = 0;
934  bool match = false;
935 
936  if (indexArray[0] < matches1.size()) {
937  while (matches1[indexArray[0]] == bestTracklet && indexArray[0] < matches1.size()) {
938  indexArray[0]++;
939  nMatches++;
940  match = true;
941  }
942  }
943 
944  if (match)
945  nMatchesUniq++;
946  match = false;
947 
948  if (indexArray[1] < matches2.size()) {
949  while (matches2[indexArray[1]] == bestTracklet && indexArray[1] < matches2.size()) {
950  indexArray[1]++;
951  nMatches++;
952  match = true;
953  }
954  }
955 
956  if (match)
957  nMatchesUniq++;
958  match = false;
959 
960  if (indexArray[2] < matches3.size()) {
961  while (matches3[indexArray[2]] == bestTracklet && indexArray[2] < matches3.size()) {
962  indexArray[2]++;
963  nMatches++;
964  match = true;
965  }
966  }
967 
968  if (match)
969  nMatchesUniq++;
970  match = false;
971 
972  if (indexArray[3] < matches4.size()) {
973  while (matches4[indexArray[3]] == bestTracklet && indexArray[3] < matches4.size()) {
974  indexArray[3]++;
975  nMatches++;
976  match = true;
977  }
978  }
979 
980  if (match)
981  nMatchesUniq++;
982 
983  if (settings_.debugTracklet()) {
984  edm::LogVerbatim("Tracklet") << getName() << " : nMatches = " << nMatches << " nMatchesUniq = " << nMatchesUniq
985  << " " << asinh(bestTracklet->t());
986  }
987 
988  std::vector<const Stub*> trackstublist;
989  std::vector<std::pair<int, int>> stubidslist;
990  if ((bestTracklet->getISeed() >= 8 && nMatchesUniq >= 1) ||
991  nMatchesUniq >= 2) { //For seeds index >=8 (triplet seeds), there are three stubs associated from start.
992  countFit++;
993 
994 #ifdef USEHYBRID
995  trackFitKF(bestTracklet, trackstublist, stubidslist);
996 #else
997  if (settings_.fakefit()) {
998  trackFitFake(bestTracklet, trackstublist, stubidslist);
999  } else {
1000  trackFitChisq(bestTracklet, trackstublist, stubidslist);
1001  }
1002 #endif
1003 
1004  if (settings_.removalType() == "merge") {
1005  trackfit_->addStubList(trackstublist);
1006  trackfit_->addStubidsList(stubidslist);
1007  trackfit_->addTrack(bestTracklet);
1008  } else if (bestTracklet->fit()) {
1009  assert(trackfit_ != nullptr);
1010  if (settings_.writeMonitorData("Seeds")) {
1011  ofstream fout("seeds.txt", ofstream::app);
1012  fout << __FILE__ << ":" << __LINE__ << " " << name_ << "_" << iSector_ << " " << bestTracklet->getISeed()
1013  << endl;
1014  fout.close();
1015  }
1016  trackfit_->addTrack(bestTracklet);
1017  }
1018  }
1019 
1020  } while (bestTracklet != nullptr);
1021 
1022  if (settings_.writeMonitorData("FT")) {
1023  globals_->ofstream("fittrack.txt") << getName() << " " << countAll << " " << countFit << endl;
1024  }
1025 }
alignBH_cfg.disks
tuple disks
Definition: alignBH_cfg.py:13
trklet::Settings::exactderivatives
bool exactderivatives() const
Definition: Settings.h:191
trklet::TrackDerTable::calculateDerivatives
static void calculateDerivatives(Settings const &settings, unsigned int nlayers, double r[N_LAYER], unsigned int ndisks, double z[N_DISK], double alpha[N_DISK], double t, double rinv, double D[N_FITPARAM][N_FITSTUB *2], int iD[N_FITPARAM][N_FITSTUB *2], double MinvDt[N_FITPARAM][N_FITSTUB *2], int iMinvDt[N_FITPARAM][N_FITSTUB *2], double sigma[N_FITSTUB *2], double kfactor[N_FITSTUB *2])
Definition: TrackDerTable.cc:755
mps_fire.i
i
Definition: mps_fire.py:355
trklet::Settings::writetrace
bool writetrace() const
Definition: Settings.h:147
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
trklet::Tracklet::z0approx
double z0approx() const
Definition: Tracklet.h:419
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
trklet::Settings::doKF
bool doKF() const
Definition: Settings.h:199
trklet::FPGAWord::str
std::string str() const
Definition: FPGAWord.cc:54
trklet::TrackFitMemory::addStubidsList
void addStubidsList(std::vector< std::pair< int, int >> stubidslist)
Definition: TrackFitMemory.h:23
trklet::TrackDer
Definition: TrackDer.h:20
trklet::Tracklet::fpgat
const FPGAWord & fpgat() const
Definition: Tracklet.h:424
trklet::TrackDer::itdzcorr
int itdzcorr(int i, int j) const
Definition: TrackDer.h:78
trklet::Settings::ktpars
double ktpars() const
Definition: Settings.h:332
trklet::Tracklet::fpgaphiresiddisk
const FPGAWord & fpgaphiresiddisk(int disk)
Definition: Tracklet.h:211
trklet::Settings::fittbitshift
int fittbitshift() const
Definition: Settings.h:317
trklet::Settings::krinvpars
double krinvpars() const
Definition: Settings.h:327
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
trklet::Tracklet::phi0
double phi0() const
Definition: Tracklet.h:410
trklet::Settings::fitz0bitshift
int fitz0bitshift() const
Definition: Settings.h:318
zMuMuMuonUserData.alpha
alpha
zGenParticlesMatch = cms.InputTag(""),
Definition: zMuMuMuonUserData.py:9
trklet::Tracklet::fpgazresid
const FPGAWord & fpgazresid(int layer) const
Definition: Tracklet.h:400
FitTrack.h
trklet::Tracklet::d0approx
double d0approx() const
Definition: Tracklet.h:417
trklet::TrackDerTable::getEntries
int getEntries() const
Definition: TrackDerTable.h:37
trklet::Settings
Definition: Settings.h:26
trklet::Tracklet::phiresidapprox
double phiresidapprox(int layer) const
Definition: Tracklet.h:380
trklet::TrackDerTable
Definition: TrackDerTable.h:18
trklet::Tracklet::phiresidapproxdisk
double phiresidapproxdisk(int disk)
Definition: Tracklet.h:231
TrackDerTable.h
trklet::Tracklet::getISeed
int getISeed() const
Definition: Tracklet.cc:847
cms::cuda::assert
assert(be >=bs)
trklet::TrackDer::iz0dzcorr
int iz0dzcorr(int i, int j) const
Definition: TrackDer.h:79
trklet::FPGAWord::set
void set(int value, int nbits, bool positive=true, int line=-1, const char *file=nullptr)
Definition: FPGAWord.cc:14
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
trklet::Settings::rmean
double rmean(unsigned int iLayer) const
Definition: Settings.h:128
trklet::Tracklet::fpgad0
const FPGAWord & fpgad0() const
Definition: Tracklet.h:423
trklet::N_DISK
constexpr int N_DISK
Definition: Settings.h:20
trklet::Tracklet::rresidapproxdisk
double rresidapproxdisk(int disk)
Definition: Tracklet.h:236
trklet::ProcessBase::settings_
Settings const & settings_
Definition: ProcessBase.h:44
trklet::Settings::phicritmin
double phicritmin() const
Definition: Settings.h:240
trklet::Tracklet::fit
bool fit() const
Definition: Tracklet.h:482
trklet::Tracklet::rinvapprox
double rinvapprox() const
Definition: Tracklet.h:415
trklet::FPGAWord::nbits
int nbits() const
Definition: FPGAWord.h:25
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::Globals
Definition: Globals.h:32
parallelization.uint
uint
Definition: parallelization.py:124
trklet::Tracklet::isDisk
int isDisk() const
Definition: Tracklet.h:490
trklet::N_FITSTUB
constexpr unsigned int N_FITSTUB
Definition: Settings.h:735
trklet::Tracklet
Definition: Tracklet.h:28
dt
float dt
Definition: AMPTWrapper.h:136
trklet::Tracklet::middleFPGAStub
const Stub * middleFPGAStub()
Definition: Tracklet.h:69
trklet::Tracklet::zresid
double zresid(int layer) const
Definition: Tracklet.h:385
trklet::Tracklet::rresiddisk
double rresiddisk(int disk)
Definition: Tracklet.h:226
trklet::Settings::rinvmax
double rinvmax() const
Definition: Settings.h:173
trklet::TrackDerTable::tpar
static double tpar(Settings const &settings, int diskmask, int layermask)
Definition: TrackDerTable.cc:1010
trklet::FitTrack::seedtracklet_
std::vector< TrackletParametersMemory * > seedtracklet_
Definition: FitTrack.h:44
trklet::Tracklet::phiresid
double phiresid(int layer) const
Definition: Tracklet.h:375
trklet::FitTrack::execute
void execute()
Definition: FitTrack.cc:862
trklet::Stub
Definition: Stub.h:16
trklet::Tracklet::validResid
bool validResid(int layer) const
Definition: Tracklet.h:365
trklet::Tracklet::isOverlap
bool isOverlap() const
Definition: Tracklet.h:489
trklet::Settings::exactderivativesforfloating
bool exactderivativesforfloating() const
Definition: Settings.h:192
trklet::Tracklet::stubptr
const trklet::Stub * stubptr(int layer) const
Definition: Tracklet.h:370
trklet::Settings::fakefit
bool fakefit() const
Definition: Settings.h:201
trklet::FitTrack::fullmatch1_
std::vector< FullMatchMemory * > fullmatch1_
Definition: FitTrack.h:45
trklet::Tracklet::innerStub
const L1TStub * innerStub()
Definition: Tracklet.h:65
trklet::Tracklet::phi0approx
double phi0approx() const
Definition: Tracklet.h:416
trklet::TrackFitMemory
Definition: TrackFitMemory.h:15
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:19
trklet::Settings::zmean
double zmean(unsigned int iDisk) const
Definition: Settings.h:131
trklet::FitTrack::addOutput
void addOutput(MemoryBase *memory, std::string output) override
Definition: FitTrack.cc:17
dqmdumpme.k
k
Definition: dqmdumpme.py:60
trklet::FitTrack::orderedMatches
std::vector< Tracklet * > orderedMatches(std::vector< FullMatchMemory * > &fullmatch)
Definition: FitTrack.cc:808
OrderedSet.t
t
Definition: OrderedSet.py:90
trklet::FPGAWord
Definition: FPGAWord.h:9
HybridFit.h
trklet::TrackDerTable::fillTable
void fillTable()
Definition: TrackDerTable.cc:184
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
trklet::Settings::kr
double kr() const
Definition: Settings.h:250
trklet::FitTrack::fullmatch2_
std::vector< FullMatchMemory * > fullmatch2_
Definition: FitTrack.h:46
edm::LogWarning
Definition: MessageLogger.h:141
trklet::Tracklet::alphadisk
double alphadisk(int disk) const
Definition: Tracklet.h:256
trklet::Settings::rcorrbits
int rcorrbits() const
Definition: Settings.h:321
trklet::MemoryBase
Definition: MemoryBase.h:13
trklet::FitTrack::fullmatch4_
std::vector< FullMatchMemory * > fullmatch4_
Definition: FitTrack.h:48
trklet::FitTrack::trackfit_
TrackFitMemory * trackfit_
Definition: FitTrack.h:50
trklet::rinv
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:167
trklet::HybridFit
Definition: HybridFit.h:30
trklet::Tracklet::TCID
int TCID() const
Definition: Tracklet.h:500
trklet::Tracklet::fpgarresiddisk
const FPGAWord & fpgarresiddisk(int disk)
Definition: Tracklet.h:216
trklet::N_FITPARAM
constexpr unsigned int N_FITPARAM
Definition: Settings.h:734
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
trklet::Tracklet::ialphadisk
const FPGAWord & ialphadisk(int disk) const
Definition: Tracklet.h:261
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
trklet::Tracklet::fpgaphiresid
const FPGAWord & fpgaphiresid(int layer) const
Definition: Tracklet.h:395
trklet::Tracklet::tapprox
double tapprox() const
Definition: Tracklet.h:418
createfilelist.int
int
Definition: createfilelist.py:10
trklet::TrackDerTable::getDerivatives
const TrackDer * getDerivatives(int index) const
Definition: TrackDerTable.h:24
Globals.h
trklet::Tracklet::outerStub
const L1TStub * outerStub()
Definition: Tracklet.h:71
trklet::Tracklet::phiresiddisk
double phiresiddisk(int disk)
Definition: Tracklet.h:221
edm::LogVerbatim
Definition: MessageLogger.h:297
trklet::TrackDer::z0dzcorr
double z0dzcorr(int i, int j) const
Definition: TrackDer.h:67
trklet::Settings::phicritmax
double phicritmax() const
Definition: Settings.h:241
trklet::Settings::chisqphifactbits
int chisqphifactbits() const
Definition: Settings.h:323
trklet::FitTrack::trackFitFake
void trackFitFake(Tracklet *tracklet, std::vector< const Stub * > &, std::vector< std::pair< int, int >> &)
Definition: FitTrack.cc:782
trklet::TrackFitMemory::addTrack
void addTrack(Tracklet *tracklet)
Definition: TrackFitMemory.h:21
trklet::Tracklet::fpgaz0
const FPGAWord & fpgaz0() const
Definition: Tracklet.h:425
trklet
Definition: AllProjectionsMemory.h:9
trklet::FPGAWord::value
int value() const
Definition: FPGAWord.h:24
trklet::Tracklet::isBarrel
bool isBarrel() const
Definition: Tracklet.h:488
trklet::Settings::fitrinvbitshift
int fitrinvbitshift() const
Definition: Settings.h:315
trklet::Settings::kphi
double kphi() const
Definition: Settings.h:246
cmsLHEtoEOSManager.l
l
Definition: cmsLHEtoEOSManager.py:193
trklet::FitTrack::addInput
void addInput(MemoryBase *memory, std::string input) override
Definition: FitTrack.cc:32
trklet::Tracklet::innerFPGAStub
const Stub * innerFPGAStub()
Definition: Tracklet.h:66
trklet::TrackDer::fill
void fill(int t, double MinvDt[N_FITPARAM][N_FITSTUB *2], int iMinvDt[N_FITPARAM][N_FITSTUB *2]) const
Definition: TrackDer.cc:42
alignCSCRings.r
r
Definition: alignCSCRings.py:93
trklet::N_TRKLSEED
constexpr unsigned int N_TRKLSEED
Definition: Settings.h:730
trklet::Tracklet::z0
double z0() const
Definition: Tracklet.h:413
trklet::Tracklet::matchdisk
bool matchdisk(int disk)
Definition: Tracklet.h:326
trklet::Settings::writeMonitorData
bool writeMonitorData(std::string module) const
Definition: Settings.h:86
trklet::Tracklet::rinv
double rinv() const
Definition: Tracklet.h:409
funct::D
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
trklet::Tracklet::d0
double d0() const
Definition: Tracklet.h:411
trklet::Settings::removalType
std::string removalType() const
Definition: Settings.h:197
std
Definition: JetResolutionObject.h:76
trklet::Settings::fitphi0bitshift
int fitphi0bitshift() const
Definition: Settings.h:316
trklet::ProcessBase
Definition: ProcessBase.h:12
trklet::Settings::warnNoDer
bool warnNoDer() const
Definition: Settings.h:150
trklet::FitTrack::fullmatch3_
std::vector< FullMatchMemory * > fullmatch3_
Definition: FitTrack.h:47
trklet::Globals::ofstream
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
trklet::Stub::l1tstub
L1TStub * l1tstub()
Definition: Stub.h:69
trklet::Settings::fitPatternFile
std::string const & fitPatternFile() const
Definition: Settings.h:43
trklet::TrackDerTable::readPatternFile
void readPatternFile(std::string fileName)
Definition: TrackDerTable.cc:139
trklet::Tracklet::outerFPGAStub
const Stub * outerFPGAStub()
Definition: Tracklet.h:72
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
Exception
Definition: hltDiff.cc:246
trklet::Globals::trackDerTable
TrackDerTable *& trackDerTable()
Definition: Globals.h:42
trklet::ProcessBase::getName
std::string const & getName() const
Definition: ProcessBase.h:22
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:588
trklet::ProcessBase::name_
std::string name_
Definition: ProcessBase.h:38
trklet::TrackFitMemory::addStubList
void addStubList(std::vector< const Stub * > stublist)
Definition: TrackFitMemory.h:22
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::ProcessBase::iSector_
unsigned int iSector_
Definition: ProcessBase.h:39
trklet::Settings::debugTracklet
bool debugTracklet() const
Definition: Settings.h:146
trklet::Settings::rcrit
double rcrit() const
Definition: Settings.h:236
Exception.h
VarParsing.mult
mult
Definition: VarParsing.py:659
trklet::Settings::nrinvBitsTable
int nrinvBitsTable() const
Definition: Settings.h:178
trklet::FitTrack::trackFitChisq
void trackFitChisq(Tracklet *tracklet, std::vector< const Stub * > &, std::vector< std::pair< int, int >> &)
Definition: FitTrack.cc:138
trklet::Tracklet::disk
int disk() const
Definition: Tracklet.cc:822
trklet::Tracklet::fpgarinv
const FPGAWord & fpgarinv() const
Definition: Tracklet.h:421
trklet::L1TStub::r
double r() const
Definition: L1TStub.h:57
ztail.d
d
Definition: ztail.py:151
trklet::Settings::chisqzfactbits
int chisqzfactbits() const
Definition: Settings.h:324
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
trklet::TrackDer::tdzcorr
double tdzcorr(int i, int j) const
Definition: TrackDer.h:66
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
trklet::ProcessBase::globals_
Globals * globals_
Definition: ProcessBase.h:45
trklet::Tracklet::t
double t() const
Definition: Tracklet.h:412
trklet::Tracklet::fpgaphi0
const FPGAWord & fpgaphi0() const
Definition: Tracklet.h:422
trklet::Settings::rPS2S
double rPS2S() const
Definition: Settings.h:267
keep
const int keep
Definition: GenParticlePruner.cc:48
Stub.h
cuy.ii
ii
Definition: cuy.py:590
trklet::Settings::alphaBitsTable
int alphaBitsTable() const
Definition: Settings.h:177
hgcalTopologyTester_cfi.layers
layers
Definition: hgcalTopologyTester_cfi.py:8
d1
static constexpr float d1
Definition: L1EGammaCrystalsEmulatorProducer.cc:84
Tracklet.h
trklet::Tracklet::layer
int layer() const
Definition: Tracklet.cc:815
memory
Definition: vlib.h:178
trklet::Tracklet::match
bool match(int layer)
Definition: Tracklet.h:357
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
nlayers
Definition: HIMultiTrackSelector.h:48
trklet::FitTrack::trackFitKF
void trackFitKF(Tracklet *tracklet, std::vector< const Stub * > &trackstublist, std::vector< std::pair< int, int >> &stubidslist)
trklet::Tracklet::zresidapprox
double zresidapprox(int layer) const
Definition: Tracklet.h:390