CMS 3D CMS Logo

L1TMuonBarrelKalmanAlgo.cc
Go to the documentation of this file.
1 #include <cmath>
3 
5  : verbose_(settings.getParameter<bool>("verbose")),
6  lutService_(new L1TMuonBarrelKalmanLUTs(settings.getParameter<std::string>("lutFile"))),
7  initK_(settings.getParameter<std::vector<double> >("initialK")),
8  initK2_(settings.getParameter<std::vector<double> >("initialK2")),
9  eLoss_(settings.getParameter<std::vector<double> >("eLoss")),
10  aPhi_(settings.getParameter<std::vector<double> >("aPhi")),
11  aPhiB_(settings.getParameter<std::vector<double> >("aPhiB")),
12  aPhiBNLO_(settings.getParameter<std::vector<double> >("aPhiBNLO")),
13  bPhi_(settings.getParameter<std::vector<double> >("bPhi")),
14  bPhiB_(settings.getParameter<std::vector<double> >("bPhiB")),
15  phiAt2_(settings.getParameter<double>("phiAt2")),
16 
17  chiSquare_(settings.getParameter<std::vector<double> >("chiSquare")),
18  chiSquareCutPattern_(settings.getParameter<std::vector<int> >("chiSquareCutPattern")),
19  chiSquareCutCurv_(settings.getParameter<std::vector<int> >("chiSquareCutCurvMax")),
20  chiSquareCut_(settings.getParameter<std::vector<int> >("chiSquareCut")),
21  trackComp_(settings.getParameter<std::vector<double> >("trackComp")),
22  trackCompErr1_(settings.getParameter<std::vector<double> >("trackCompErr1")),
23  trackCompErr2_(settings.getParameter<std::vector<double> >("trackCompErr2")),
24  trackCompPattern_(settings.getParameter<std::vector<int> >("trackCompCutPattern")),
25  trackCompCutCurv_(settings.getParameter<std::vector<int> >("trackCompCutCurvMax")),
26  trackCompCut_(settings.getParameter<std::vector<int> >("trackCompCut")),
27  chiSquareCutTight_(settings.getParameter<std::vector<int> >("chiSquareCutTight")),
28  combos4_(settings.getParameter<std::vector<int> >("combos4")),
29  combos3_(settings.getParameter<std::vector<int> >("combos3")),
30  combos2_(settings.getParameter<std::vector<int> >("combos2")),
31  combos1_(settings.getParameter<std::vector<int> >("combos1")),
32  useOfflineAlgo_(settings.getParameter<bool>("useOfflineAlgo")),
33  mScatteringPhi_(settings.getParameter<std::vector<double> >("mScatteringPhi")),
34  mScatteringPhiB_(settings.getParameter<std::vector<double> >("mScatteringPhiB")),
35  pointResolutionPhi_(settings.getParameter<double>("pointResolutionPhi")),
36  pointResolutionPhiB_(settings.getParameter<double>("pointResolutionPhiB")),
37  pointResolutionVertex_(settings.getParameter<double>("pointResolutionVertex"))
38 
39 {}
40 
41 std::pair<bool, uint> L1TMuonBarrelKalmanAlgo::getByCode(const L1MuKBMTrackCollection& tracks, int mask) {
42  for (uint i = 0; i < tracks.size(); ++i) {
43  printf("Code=%d, track=%d\n", tracks[i].hitPattern(), mask);
44  if (tracks[i].hitPattern() == mask)
45  return std::make_pair(true, i);
46  }
47  return std::make_pair(false, 0);
48 }
49 
51  // int K = fabs(track.curvatureAtVertex());
52 
53  //calibration
54  int sign, signValid;
55 
56  if (track.curvatureAtVertex() == 0) {
57  sign = 0;
58  signValid = 0;
59  } else if (track.curvatureAtVertex() > 0) {
60  sign = 0;
61  signValid = 1;
62  } else {
63  sign = 1;
64  signValid = 1;
65  }
66 
67  // if (K<22)
68  // K=22;
69 
70  // if (K>4095)
71  // K=4095;
72 
73  int pt = ptLUT(track.curvatureAtVertex());
74 
75  // int K2 = fabs(track.curvatureAtMuon());
76  // if (K2<22)
77  // K2=22;
78 
79  // if (K2>4095)
80  // K2=4095;
81  int pt2 = ptLUT(track.curvatureAtMuon()) / 2;
82  int eta = track.hasFineEta() ? track.fineEta() : track.coarseEta();
83 
84  // int phi2 = track.phiAtMuon()>>2;
85  // float phi_f = float(phi2);
86  //double kPhi = 57.2958/0.625/1024.;
87  //int phi = 24+int(floor(kPhi*phi_f));
88  // if (phi > 69) phi = 69;
89  // if (phi < -8) phi = -8;
90  int phi2 = track.phiAtMuon() >> 2;
91  int tmp = fp_product(0.0895386, phi2, 14);
92  int phi = 24 + tmp;
93 
94  int processor = track.sector();
95  int HF = track.hasFineEta();
96 
97  int quality = 12 | (rank(track) >> 6);
98 
99  int dxy = abs(track.dxy()) >> 9;
100  if (dxy > 3)
101  dxy = 3;
102 
103  int trackAddr;
104  std::map<int, int> addr = trackAddress(track, trackAddr);
105 
106  l1t::RegionalMuonCand muon(pt, phi, eta, sign, signValid, quality, processor, l1t::bmtf, addr);
107  muon.setHwHF(HF);
108  muon.setHwPt2(pt2);
109  muon.setHwDXY(dxy);
110 
111  //nw the words!
112  uint32_t word1 = pt;
113  word1 = word1 | quality << 9;
114  word1 = word1 | (twosCompToBits(eta)) << 13;
115  word1 = word1 | HF << 22;
116  word1 = word1 | (twosCompToBits(phi)) << 23;
117 
118  uint32_t word2 = sign;
119  word2 = word2 | signValid << 1;
120  word2 = word2 | dxy << 2;
121  word2 = word2 | trackAddr << 4;
122  word2 = word2 | (twosCompToBits(track.wheel())) << 20;
123  word2 = word2 | pt2 << 23;
124  muon.setDataword(word2, word1);
125  return muon;
126 }
127 
129  const L1MuKBMTrack& track,
130  std::unique_ptr<l1t::RegionalMuonCandBxCollection>& out) {
131  out->push_back(bx, convertToBMTF(track));
132 }
133 
134 // std::pair<bool,uint> L1TMuonBarrelKalmanAlgo::match(const L1MuKBMTCombinedStubRef& seed, const L1MuKBMTCombinedStubRefVector& stubs,int step) {
135 // L1MuKBMTCombinedStubRefVector selected;
136 
137 // bool found=false;
138 // uint best=0;
139 // int distance=100000;
140 // uint N=0;
141 // for (const auto& stub :stubs) {
142 // N=N+1;
143 // if (stub->stNum()!=step)
144 // continue;
145 
146 // int d = fabs(wrapAround(((correctedPhi(seed,seed->scNum())-correctedPhi(stub,seed->scNum()))>>3),1024));
147 // if (d<distance) {
148 // distance = d;
149 // best=N-1;
150 // found=true;
151 // }
152 // }
153 // return std::make_pair(found,best);
154 // }
155 
157  if (info[i] < info[j])
158  return i;
159  else
160  return j;
161 }
162 
164  const L1MuKBMTCombinedStubRefVector& stubs,
165  int step) {
167 
168  std::map<uint, uint> diffInfo;
169  for (uint i = 0; i < 12; ++i) {
170  diffInfo[i] = 60000;
171  }
172 
173  std::map<uint, uint> stubInfo;
174 
175  int sector = seed->scNum();
176  int previousSector = sector - 1;
177  int nextSector = sector + 1;
178  if (sector == 0) {
179  previousSector = 11;
180  }
181  if (sector == 11) {
182  nextSector = 0;
183  }
184 
185  int wheel = seed->whNum();
186  int innerWheel = 0;
187  if (wheel == -2)
188  innerWheel = -1;
189  if (wheel == -1)
190  innerWheel = 0;
191  if (wheel == 0)
192  innerWheel = 1982;
193  if (wheel == 1)
194  innerWheel = 0;
195  if (wheel == 2)
196  innerWheel = 1;
197 
198  //First align the data
199  uint N = 0;
200  for (const auto& stub : stubs) {
201  N = N + 1;
202 
203  if (stub->stNum() != step)
204  continue;
205 
206  uint distance =
207  fabs(wrapAround(((correctedPhi(seed, seed->scNum()) - correctedPhi(stub, seed->scNum())) >> 3), 1024));
208 
209  if (stub->scNum() == previousSector) {
210  if (stub->whNum() == wheel) {
211  if (!stub->tag()) {
212  diffInfo[0] = distance;
213  stubInfo[0] = N - 1;
214  } else {
215  diffInfo[1] = distance;
216  stubInfo[1] = N - 1;
217  }
218  } else if (stub->whNum() == innerWheel) {
219  if (!stub->tag()) {
220  diffInfo[2] = distance;
221  stubInfo[2] = N - 1;
222  } else {
223  diffInfo[3] = distance;
224  stubInfo[3] = N - 1;
225  }
226  }
227  } else if (stub->scNum() == sector) {
228  if (stub->whNum() == wheel) {
229  if (!stub->tag()) {
230  diffInfo[4] = distance;
231  stubInfo[4] = N - 1;
232  } else {
233  diffInfo[5] = distance;
234  stubInfo[5] = N - 1;
235  }
236  } else if (stub->whNum() == innerWheel) {
237  if (!stub->tag()) {
238  diffInfo[6] = distance;
239  stubInfo[6] = N - 1;
240  } else {
241  diffInfo[7] = distance;
242  stubInfo[7] = N - 1;
243  }
244  }
245  } else if (stub->scNum() == nextSector) {
246  if (stub->whNum() == wheel) {
247  if (!stub->tag()) {
248  diffInfo[8] = distance;
249  stubInfo[8] = N - 1;
250  } else {
251  diffInfo[9] = distance;
252  stubInfo[9] = N - 1;
253  }
254  } else if (stub->whNum() == innerWheel) {
255  if (!stub->tag()) {
256  diffInfo[10] = distance;
257  stubInfo[10] = N - 1;
258  } else {
259  diffInfo[11] = distance;
260  stubInfo[11] = N - 1;
261  }
262  }
263  }
264  }
265 
266  uint s1_1 = matchAbs(diffInfo, 0, 1);
267  uint s1_2 = matchAbs(diffInfo, 2, 3);
268  uint s1_3 = matchAbs(diffInfo, 4, 5);
269  uint s1_4 = matchAbs(diffInfo, 6, 7);
270  uint s1_5 = matchAbs(diffInfo, 8, 9);
271  uint s1_6 = matchAbs(diffInfo, 10, 11);
272 
273  uint s2_1 = matchAbs(diffInfo, s1_1, s1_2);
274  uint s2_2 = matchAbs(diffInfo, s1_3, s1_4);
275  uint s2_3 = matchAbs(diffInfo, s1_5, s1_6);
276 
277  uint s3_1 = matchAbs(diffInfo, s2_1, s2_2);
278 
279  uint s4 = matchAbs(diffInfo, s3_1, s2_3);
280 
281  if (diffInfo[s4] != 60000)
282  return std::make_pair(true, stubInfo[s4]);
283  else
284  return std::make_pair(false, 0);
285 }
286 
288  //Promote phiB to 12 bits
289  return 8 * stub->phiB();
290 }
291 
293  if (stub->scNum() == sector) {
294  return stub->phi();
295  } else if ((stub->scNum() == sector - 1) || (stub->scNum() == 11 && sector == 0)) {
296  return stub->phi() - 2144;
297  } else if ((stub->scNum() == sector + 1) || (stub->scNum() == 0 && sector == 11)) {
298  return stub->phi() + 2144;
299  }
300  return stub->phi();
301 }
302 
304  unsigned int mask = 0;
305  for (const auto& stub : track.stubs()) {
306  mask = mask + round(pow(2, stub->stNum() - 1));
307  }
308  return mask;
309 }
310 
311 int L1TMuonBarrelKalmanAlgo::customBitmask(unsigned int bit1, unsigned int bit2, unsigned int bit3, unsigned int bit4) {
312  return bit1 * 1 + bit2 * 2 + bit3 * 4 + bit4 * 8;
313 }
314 
315 bool L1TMuonBarrelKalmanAlgo::getBit(int bitmask, int pos) { return (bitmask & (1 << pos)) >> pos; }
316 
318  int K = track.curvature();
319  int phi = track.positionAngle();
320  int phiB = track.bendingAngle();
321  unsigned int step = track.step();
322 
323  //energy loss term only for MU->VERTEX
324  //int offset=int(charge*eLoss_[step-1]*K*K);
325  // if (fabs(offset)>4096)
326  // offset=4096*offset/fabs(offset);
327 
328  int charge = 1;
329  if (K != 0)
330  charge = K / fabs(K);
331 
332  int KBound = K;
333  if (KBound > 4095)
334  KBound = 4095;
335  if (KBound < -4095)
336  KBound = -4095;
337 
338  int deltaK = 0;
339  int KNew = 0;
340  if (step == 1) {
341  int addr = KBound / 2;
342  if (addr < 0)
343  addr = (-KBound) / 2;
344  deltaK = 2 * addr - int(2 * addr / (1 + eLoss_[step - 1] * addr));
345 
346  if (verbose_)
347  printf("propagate to vertex K=%d deltaK=%d addr=%d\n", K, deltaK, addr);
348  }
349 
350  if (K >= 0)
351  KNew = K - deltaK;
352  else
353  KNew = K + deltaK;
354 
355  //phi propagation
356  int phi11 = fp_product(aPhi_[step - 1], K, 10);
357  int phi12 = fp_product(-bPhi_[step - 1], phiB, 10);
358  if (verbose_) {
359  printf("phi prop = %d* %f = %d, %d* %f =%d\n", K, aPhi_[step - 1], phi11, phiB, -bPhi_[step - 1], phi12);
360  }
361  int phiNew = wrapAround(phi + phi11 + phi12, 2048);
362  //phiB propagation
363  int phiB11 = fp_product(aPhiB_[step - 1], K, 10);
364  int phiB12 = fp_product(bPhiB_[step - 1], phiB, 11);
365  int phiBNew = wrapAround(phiB11 + phiB12, 4096);
366  if (verbose_) {
367  printf("phiB prop = %d* %f = %d, %d* %f =%d\n", K, aPhiB_[step - 1], phiB11, phiB, bPhiB_[step - 1], phiB12);
368  }
369 
370  //Only for the propagation to vertex we use the LUT for better precision and the full function
371  if (step == 1) {
372  int addr = KBound / 2;
373  phiBNew = wrapAround(
374  int(aPhiB_[step - 1] * addr / (1 + charge * aPhiBNLO_[step - 1] * addr)) + int(bPhiB_[step - 1] * phiB), 4096);
375  }
377  //Rest of the stuff is for the offline version only
378  //where we want to check what is happening in the covariaznce matrix
379 
380  //Create the transformation matrix
381  double a[9];
382  a[0] = 1.;
383  a[1] = 0.0;
384  a[2] = 0.0;
385  a[3] = aPhi_[step - 1];
386  // a[3] = 0.0;
387  a[4] = 1.0;
388  a[5] = -bPhi_[step - 1];
389  //a[6]=0.0;
390  a[6] = aPhiB_[step - 1];
391  if (step == 1)
392  a[6] = aPhiB_[step - 1] / 2.0;
393 
394  a[7] = 0.0;
395  a[8] = bPhiB_[step - 1];
396 
397  ROOT::Math::SMatrix<double, 3> P(a, 9);
398 
399  const std::vector<double>& covLine = track.covariance();
400  L1MuKBMTrack::CovarianceMatrix cov(covLine.begin(), covLine.end());
401  cov = ROOT::Math::Similarity(P, cov);
402 
403  //Add the multiple scattering
404  double phiRMS = mScatteringPhi_[step - 1] * K * K;
405  double phiBRMS = mScatteringPhiB_[step - 1] * K * K;
406 
407  std::vector<double> b(6);
408  b[0] = 0;
409  b[1] = 0;
410  b[2] = phiRMS;
411  b[3] = 0;
412  b[4] = 0;
413  b[5] = phiBRMS;
414 
415  reco::Candidate::CovarianceMatrix MS(b.begin(), b.end());
416 
417  cov = cov + MS;
418 
419  if (verbose_) {
420  printf("Covariance term for phiB = %f\n", cov(2, 2));
421  printf("Multiple scattering term for phiB = %f\n", MS(2, 2));
422  }
423 
424  track.setCovariance(cov);
425  track.setCoordinates(step - 1, KNew, phiNew, phiBNew);
426 }
427 
429  updateEta(track, stub);
430  if (useOfflineAlgo_) {
431  if (mask == 3 || mask == 5 || mask == 9 || mask == 6 || mask == 10 || mask == 12)
432  return updateOffline(track, stub);
433  else
434  return updateOffline1D(track, stub);
435 
436  } else
437  return updateLUT(track, stub, mask);
438 }
439 
441  int trackK = track.curvature();
442  int trackPhi = track.positionAngle();
443  int trackPhiB = track.bendingAngle();
444 
445  int phi = correctedPhi(stub, track.sector());
446  int phiB = correctedPhiB(stub);
447 
448  Vector2 residual;
449  residual[0] = phi - trackPhi;
450  residual[1] = phiB - trackPhiB;
451 
452  Matrix23 H;
453  H(0, 0) = 0.0;
454  H(0, 1) = 1.0;
455  H(0, 2) = 0.0;
456  H(1, 0) = 0.0;
457  H(1, 1) = 0.0;
458  H(1, 2) = 1.0;
459 
461  R(0, 0) = pointResolutionPhi_;
462  R(0, 1) = 0.0;
463  R(1, 0) = 0.0;
464  R(1, 1) = pointResolutionPhiB_;
465 
466  const std::vector<double>& covLine = track.covariance();
467  L1MuKBMTrack::CovarianceMatrix cov(covLine.begin(), covLine.end());
468 
469  CovarianceMatrix2 S = ROOT::Math::Similarity(H, cov) + R;
470  if (!S.Invert())
471  return false;
472  Matrix32 Gain = cov * ROOT::Math::Transpose(H) * S;
473 
474  track.setKalmanGain(
475  track.step(), fabs(trackK), Gain(0, 0), Gain(0, 1), Gain(1, 0), Gain(1, 1), Gain(2, 0), Gain(2, 1));
476 
477  int KNew = (trackK + int(Gain(0, 0) * residual(0) + Gain(0, 1) * residual(1)));
478  if (fabs(KNew) > 8192)
479  return false;
480 
481  int phiNew = wrapAround(trackPhi + residual(0), 8192);
482  int phiBNew = wrapAround(trackPhiB + int(Gain(2, 0) * residual(0) + Gain(2, 1) * residual(1)), 4096);
483 
484  track.setResidual(stub->stNum() - 1, fabs(phi - phiNew) + fabs(phiB - phiBNew) / 8);
485 
486  if (verbose_) {
487  printf(" K = %d + %f * %f + %f * %f\n", trackK, Gain(0, 0), residual(0), Gain(0, 1), residual(1));
488  printf(" phiB = %d + %f * %f + %f * %f\n", trackPhiB, Gain(2, 0), residual(0), Gain(2, 1), residual(1));
489  }
490 
491  track.setCoordinates(track.step(), KNew, phiNew, phiBNew);
492  Matrix33 covNew = cov - Gain * (H * cov);
494 
495  c(0, 0) = covNew(0, 0);
496  c(0, 1) = covNew(0, 1);
497  c(0, 2) = covNew(0, 2);
498  c(1, 0) = covNew(1, 0);
499  c(1, 1) = covNew(1, 1);
500  c(1, 2) = covNew(1, 2);
501  c(2, 0) = covNew(2, 0);
502  c(2, 1) = covNew(2, 1);
503  c(2, 2) = covNew(2, 2);
504  if (verbose_) {
505  printf("Post Fit Covariance Matrix %f %f %f \n", cov(0, 0), cov(1, 1), cov(2, 2));
506  }
507 
508  track.setCovariance(c);
509  track.addStub(stub);
510  track.setHitPattern(hitPattern(track));
511 
512  return true;
513 }
514 
516  int trackK = track.curvature();
517  int trackPhi = track.positionAngle();
518  int trackPhiB = track.bendingAngle();
519 
520  int phi = correctedPhi(stub, track.sector());
521 
522  double residual = phi - trackPhi;
523 
524  Matrix13 H;
525  H(0, 0) = 0.0;
526  H(0, 1) = 1.0;
527  H(0, 2) = 0.0;
528 
529  const std::vector<double>& covLine = track.covariance();
530  L1MuKBMTrack::CovarianceMatrix cov(covLine.begin(), covLine.end());
531 
532  double S = ROOT::Math::Similarity(H, cov)(0, 0) + pointResolutionPhi_;
533 
534  if (S == 0.0)
535  return false;
536  Matrix31 Gain = cov * ROOT::Math::Transpose(H) / S;
537 
538  track.setKalmanGain(track.step(), fabs(trackK), Gain(0, 0), 0.0, Gain(1, 0), 0.0, Gain(2, 0), 0.0);
539 
540  int KNew = wrapAround(trackK + int(Gain(0, 0) * residual), 8192);
541  int phiNew = wrapAround(trackPhi + residual, 8192);
542  int phiBNew = wrapAround(trackPhiB + int(Gain(2, 0) * residual), 4096);
543  track.setCoordinates(track.step(), KNew, phiNew, phiBNew);
544  Matrix33 covNew = cov - Gain * (H * cov);
546 
547  c(0, 0) = covNew(0, 0);
548  c(0, 1) = covNew(0, 1);
549  c(0, 2) = covNew(0, 2);
550  c(1, 0) = covNew(1, 0);
551  c(1, 1) = covNew(1, 1);
552  c(1, 2) = covNew(1, 2);
553  c(2, 0) = covNew(2, 0);
554  c(2, 1) = covNew(2, 1);
555  c(2, 2) = covNew(2, 2);
556  track.setCovariance(c);
557  track.addStub(stub);
558  track.setHitPattern(hitPattern(track));
559 
560  return true;
561 }
562 
564  int trackK = track.curvature();
565  int trackPhi = track.positionAngle();
566  int trackPhiB = track.bendingAngle();
567 
568  int phi = correctedPhi(stub, track.sector());
569  int phiB = correctedPhiB(stub);
570 
571  if (stub->quality() < 4)
572  phiB = trackPhiB;
573 
574  Vector2 residual;
575  int residualPhi = wrapAround(phi - trackPhi, 4096);
576  int residualPhiB = wrapAround(phiB - trackPhiB, 8192);
577 
578  if (verbose_)
579  printf("residuals %d-%d=%d %d-%d=%d\n", phi, trackPhi, int(residualPhi), phiB, trackPhiB, int(residualPhiB));
580 
581  uint absK = fabs(trackK);
582  if (absK > 4095)
583  absK = 4095;
584 
585  std::vector<float> GAIN;
586  //For the three stub stuff use only gains 0 and 4
587  if (!(mask == 3 || mask == 5 || mask == 9 || mask == 6 || mask == 10 || mask == 12)) {
588  GAIN = lutService_->trackGain(track.step(), track.hitPattern(), absK / 4);
589  GAIN[1] = 0.0;
590  GAIN[3] = 0.0;
591 
592  } else {
593  GAIN = lutService_->trackGain2(track.step(), track.hitPattern(), absK / 8);
594  }
595  if (verbose_)
596  printf("Gains:%d %f %f %f %f\n", absK / 4, GAIN[0], GAIN[1], GAIN[2], GAIN[3]);
597  track.setKalmanGain(track.step(), fabs(trackK), GAIN[0], GAIN[1], 1, 0, GAIN[2], GAIN[3]);
598 
599  int k_0 = fp_product(GAIN[0], residualPhi, 3);
600  int k_1 = fp_product(GAIN[1], residualPhiB, 5);
601  int KNew = trackK + k_0 + k_1;
602  if (fabs(KNew) >= 8191)
603  return false;
604  KNew = wrapAround(KNew, 8192);
605  int phiNew = phi;
606 
607  //different products for different firmware logic
608  int pbdouble_0 = fp_product(fabs(GAIN[2]), residualPhi, 9);
609  int pb_0 = fp_product(GAIN[2], residualPhi, 9);
610  int pb_1 = fp_product(GAIN[3], residualPhiB, 9);
611 
612  if (verbose_)
613  printf("phiupdate: %d %d\n", pb_0, pb_1);
614 
615  int phiBNew;
616  if (!(mask == 3 || mask == 5 || mask == 9 || mask == 6 || mask == 10 || mask == 12)) {
617  phiBNew = wrapAround(trackPhiB + pb_0, 4096);
618  if (fabs(trackPhiB + pb_0) >= 4095)
619  return false;
620  } else {
621  phiBNew = wrapAround(trackPhiB + pb_1 - pbdouble_0, 4096);
622  if (fabs(trackPhiB + pb_1 - pbdouble_0) >= 4095)
623  return false;
624  }
625  track.setCoordinates(track.step(), KNew, phiNew, phiBNew);
626  track.addStub(stub);
627  track.setHitPattern(hitPattern(track));
628  return true;
629 }
630 
632 
634  if (useOfflineAlgo_)
636  else
638 }
639 
641  double residual = -track.dxy();
642  Matrix13 H;
643  H(0, 0) = 0;
644  H(0, 1) = 0;
645  H(0, 2) = 1;
646 
647  const std::vector<double>& covLine = track.covariance();
648  L1MuKBMTrack::CovarianceMatrix cov(covLine.begin(), covLine.end());
649 
650  double S = (ROOT::Math::Similarity(H, cov))(0, 0) + pointResolutionVertex_;
651  S = 1.0 / S;
652  Matrix31 Gain = cov * (ROOT::Math::Transpose(H)) * S;
653  track.setKalmanGain(track.step(), fabs(track.curvature()), Gain(0, 0), Gain(1, 0), Gain(2, 0));
654 
655  if (verbose_) {
656  printf("sigma3=%f sigma6=%f\n", cov(0, 3), cov(3, 3));
657  printf(" K = %d + %f * %f\n", track.curvature(), Gain(0, 0), residual);
658  }
659 
660  int KNew = wrapAround(int(track.curvature() + Gain(0, 0) * residual), 8192);
661  int phiNew = wrapAround(int(track.positionAngle() + Gain(1, 0) * residual), 8192);
662  int dxyNew = wrapAround(int(track.dxy() + Gain(2, 0) * residual), 8192);
663  if (verbose_)
664  printf("Post fit impact parameter=%d\n", dxyNew);
665  track.setCoordinatesAtVertex(KNew, phiNew, -residual);
666  Matrix33 covNew = cov - Gain * (H * cov);
668  c(0, 0) = covNew(0, 0);
669  c(0, 1) = covNew(0, 1);
670  c(0, 2) = covNew(0, 2);
671  c(1, 0) = covNew(1, 0);
672  c(1, 1) = covNew(1, 1);
673  c(1, 2) = covNew(1, 2);
674  c(2, 0) = covNew(2, 0);
675  c(2, 1) = covNew(2, 1);
676  c(2, 2) = covNew(2, 2);
677  track.setCovariance(c);
678  // track.covariance = track.covariance - Gain*H*track.covariance;
679 }
680 
682  double residual = -track.dxy();
683  uint absK = fabs(track.curvature());
684  if (absK > 2047)
685  absK = 2047;
686 
687  std::pair<float, float> GAIN = lutService_->vertexGain(track.hitPattern(), absK / 2);
688  track.setKalmanGain(track.step(), fabs(track.curvature()), GAIN.first, GAIN.second, -1);
689 
690  int k_0 = fp_product(GAIN.first, int(residual), 7);
691  int KNew = wrapAround(track.curvature() + k_0, 8192);
692 
693  if (verbose_) {
694  printf("VERTEX GAIN(%d)= %f * %d = %d\n", absK / 2, GAIN.first, int(residual), k_0);
695  }
696 
697  int p_0 = fp_product(GAIN.second, int(residual), 7);
698  int phiNew = wrapAround(track.positionAngle() + p_0, 8192);
699  track.setCoordinatesAtVertex(KNew, phiNew, -residual);
700 }
701 
703  int K, etaINT;
704 
705  if (track.hasFineEta())
706  etaINT = track.fineEta();
707  else
708  etaINT = track.coarseEta();
709 
710  double lsb = 1.25 / float(1 << 13);
711  double lsbEta = 0.010875;
712 
713  if (vertex) {
714  int charge = 1;
715  if (track.curvatureAtVertex() < 0)
716  charge = -1;
717  double pt = double(ptLUT(track.curvatureAtVertex())) / 2.0;
718 
719  double phi = track.sector() * M_PI / 6.0 + track.phiAtVertex() * M_PI / (6 * 2048.) - 2 * M_PI;
720 
721  double eta = etaINT * lsbEta;
722  track.setPtEtaPhi(pt, eta, phi);
723  track.setCharge(charge);
724  } else {
725  K = track.curvatureAtMuon();
726  if (K == 0)
727  K = 1;
728 
729  if (fabs(K) < 46)
730  K = 46 * K / fabs(K);
731  double pt = 1.0 / (lsb * fabs(K));
732  if (pt < 1.6)
733  pt = 1.6;
734  track.setPtUnconstrained(pt);
735  }
736 }
737 
738 std::pair<bool, L1MuKBMTrack> L1TMuonBarrelKalmanAlgo::chain(const L1MuKBMTCombinedStubRef& seed,
739  const L1MuKBMTCombinedStubRefVector& stubs) {
740  L1MuKBMTrackCollection pretracks;
741  std::vector<int> combinatorics;
742  switch (seed->stNum()) {
743  case 1:
744  combinatorics = combos1_;
745  break;
746  case 2:
747  combinatorics = combos2_;
748  break;
749 
750  case 3:
751  combinatorics = combos3_;
752  break;
753 
754  case 4:
755  combinatorics = combos4_;
756  break;
757 
758  default:
759  printf("Something really bad happend\n");
760  }
761 
762  L1MuKBMTrack nullTrack(seed, correctedPhi(seed, seed->scNum()), correctedPhiB(seed));
763 
764  for (const auto& mask : combinatorics) {
766  int phiB = correctedPhiB(seed);
767  int charge;
768  if (phiB == 0)
769  charge = 0;
770  else
771  charge = phiB / fabs(phiB);
772 
773  int address = phiB;
774  if (track.step() == 4 && (fabs(seed->phiB()) > 15))
775  address = charge * 15 * 8;
776 
777  if (track.step() == 3 && (fabs(seed->phiB()) > 30))
778  address = charge * 30 * 8;
779  if (track.step() == 2 && (fabs(seed->phiB()) > 127))
780  address = charge * 127 * 8;
781  int initialK = int(initK_[seed->stNum() - 1] * address / (1 + initK2_[seed->stNum() - 1] * charge * address));
782  if (initialK > 8191)
783  initialK = 8191;
784  if (initialK < -8191)
785  initialK = -8191;
786 
787  track.setCoordinates(seed->stNum(), initialK, correctedPhi(seed, seed->scNum()), phiB);
788  if (seed->quality() < 4) {
789  track.setCoordinates(seed->stNum(), 0, correctedPhi(seed, seed->scNum()), 0);
790  }
791 
792  track.setHitPattern(hitPattern(track));
793  //set covariance
795 
796  float DK = 512 * 512.;
797  covariance(0, 0) = DK;
798  covariance(0, 1) = 0;
799  covariance(0, 2) = 0;
800  covariance(1, 0) = 0;
801  covariance(1, 1) = float(pointResolutionPhi_);
802  covariance(1, 2) = 0;
803  covariance(2, 0) = 0;
804  covariance(2, 1) = 0;
805  covariance(2, 2) = float(pointResolutionPhiB_);
806  track.setCovariance(covariance);
807  //
808  if (verbose_) {
809  printf("New Kalman fit staring at step=%d, phi=%d,phiB=%d with curvature=%d\n",
810  track.step(),
811  track.positionAngle(),
812  track.bendingAngle(),
813  track.curvature());
814  printf("BITMASK:");
815  for (unsigned int i = 0; i < 4; ++i)
816  printf("%d", getBit(mask, i));
817  printf("\n");
818  printf("------------------------------------------------------\n");
819  printf("------------------------------------------------------\n");
820  printf("------------------------------------------------------\n");
821  printf("stubs:\n");
822  for (const auto& stub : stubs)
823  printf("station=%d phi=%d phiB=%d qual=%d tag=%d sector=%d wheel=%d fineEta= %d %d\n",
824  stub->stNum(),
825  correctedPhi(stub, seed->scNum()),
826  correctedPhiB(stub),
827  stub->quality(),
828  stub->tag(),
829  stub->scNum(),
830  stub->whNum(),
831  stub->eta1(),
832  stub->eta2());
833  printf("------------------------------------------------------\n");
834  printf("------------------------------------------------------\n");
835  }
836 
837  int phiAtStation2 = 0;
838 
839  while (track.step() > 0) {
840  // muon station 1
841  if (track.step() == 1) {
842  track.setCoordinatesAtMuon(track.curvature(), track.positionAngle(), track.bendingAngle());
843  phiAtStation2 = phiAt2(track);
845  if (!passed)
846  break;
849  //calculate coarse eta
851 
852  if (verbose_)
853  printf("Unconstrained PT in Muon System: pt=%f\n", track.ptUnconstrained());
854  }
855 
856  propagate(track);
857  if (verbose_)
858  printf("propagated Coordinates step:%d,phi=%d,phiB=%d,K=%d\n",
859  track.step(),
860  track.positionAngle(),
861  track.bendingAngle(),
862  track.curvature());
863 
864  if (track.step() > 0)
865  if (getBit(mask, track.step() - 1)) {
866  std::pair<bool, uint> bestStub = match(seed, stubs, track.step());
867  if ((!bestStub.first) || (!update(track, stubs[bestStub.second], mask)))
868  break;
869  if (verbose_) {
870  printf("updated Coordinates step:%d,phi=%d,phiB=%d,K=%d\n",
871  track.step(),
872  track.positionAngle(),
873  track.bendingAngle(),
874  track.curvature());
875  }
876  }
877 
878  if (track.step() == 0) {
879  track.setCoordinatesAtVertex(track.curvature(), track.positionAngle(), track.bendingAngle());
880  if (verbose_)
881  printf(" Coordinates before vertex constraint step:%d,phi=%d,dxy=%d,K=%d\n",
882  track.step(),
883  track.phiAtVertex(),
884  track.dxy(),
885  track.curvatureAtVertex());
886  if (verbose_)
887  printf("Chi Square = %d\n", track.approxChi2());
888 
891  if (verbose_) {
892  printf(" Coordinates after vertex constraint step:%d,phi=%d,dxy=%d,K=%d maximum local chi2=%d\n",
893  track.step(),
894  track.phiAtVertex(),
895  track.dxy(),
896  track.curvatureAtVertex(),
897  track.approxChi2());
898  printf("------------------------------------------------------\n");
899  printf("------------------------------------------------------\n");
900  }
902  //rset the coordinates at muon to include phi at station 2
903  track.setCoordinatesAtMuon(track.curvatureAtMuon(), phiAtStation2, track.phiBAtMuon());
904  track.setRank(rank(track));
905  if (verbose_)
906  printf("Floating point coordinates at vertex: pt=%f, eta=%f phi=%f\n", track.pt(), track.eta(), track.phi());
907  pretracks.push_back(track);
908  }
909  }
910  }
911  //Now for all the pretracks we need only one
912  L1MuKBMTrackCollection cleaned = clean(pretracks, seed->stNum());
913 
914  if (!cleaned.empty()) {
915  return std::make_pair(true, cleaned[0]);
916  }
917  return std::make_pair(false, nullTrack);
918 }
919 
921  //here we have a simplification of the algorithm for the sake of the emulator - rsult is identical
922  // we apply cuts on the firmware as |u -u'|^2 < a+b *K^2
923  int K = track.curvatureAtMuon();
924 
925  uint chi = 0;
926 
927  // const double PHI[4]={0.0,0.249,0.543,0.786};
928  // const double DROR[4]={0.0,0.182,0.430,0.677};
929 
930  int coords = wrapAround((track.phiAtMuon() + track.phiBAtMuon()) >> 4, 512);
931  for (const auto& stub : track.stubs()) {
932  int AK = wrapAround(fp_product(-chiSquare_[stub->stNum() - 1], K >> 4, 8), 256);
933  int stubCoords = wrapAround((correctedPhi(stub, track.sector()) >> 4) + (stub->phiB() >> 1), 512);
934  int diff1 = wrapAround(stubCoords - coords, 1024);
935  uint delta = wrapAround(abs(diff1 + AK), 2048);
936  chi = chi + delta;
937  if (verbose_)
938  printf("Chi Square stub for track with coords=%d -> AK=%d stubCoords=%d diff=%d delta=%d\n",
939  coords,
940  AK,
941  stubCoords,
942  diff1,
943  delta);
944  }
945 
946  if (chi > 127)
947  chi = 127;
948  // for (const auto& stub: track.stubs()) {
949  // int deltaPhi = (correctedPhi(stub,track.sector())-track.phiAtMuon())>>3;
950  // int AK = fp_product(PHI[stub->stNum()-1],K>>3,8);
951  // int BPB = fp_product(DROR[stub->stNum()-1],track.phiBAtMuon()>>3,8);
952  // chi=chi+abs(deltaPhi-AK-BPB);
953  // }
954  // // }
955 
956  track.setApproxChi2(chi);
957 
958  for (uint i = 0; i < chiSquareCutPattern_.size(); ++i) {
959  if (track.hitPattern() == chiSquareCutPattern_[i] && fabs(K) < chiSquareCutCurv_[i] &&
960  track.approxChi2() > chiSquareCut_[i])
961  return false;
962  }
963  return true;
964 }
965 
967  int K = track.curvatureAtVertex() >> 4;
968 
969  if (track.stubs().size() != 2) {
970  track.setTrackCompatibility(0);
971  return;
972  }
973 
974  uint stubSel = 1;
975  if (track.stubs()[0]->quality() > track.stubs()[1]->quality())
976  stubSel = 0;
977 
978  const L1MuKBMTCombinedStubRef& stub = track.stubs()[stubSel];
979  int absK = fabs(K);
980  int diff = wrapAround(stub->phiB() - fp_product(trackComp_[stub->stNum() - 1], K, 9), 2048);
981  int delta = fabs(diff);
982  uint err =
983  wrapAround(trackCompErr1_[stub->stNum() - 1] + fp_product(trackCompErr2_[stub->stNum() - 1], absK, 9), 256);
984  track.setTrackCompatibility(delta / err);
985 
986  for (uint i = 0; i < trackCompPattern_.size(); ++i) {
987  int deltaMax = err * trackCompCut_[i];
988  if ((track.hitPattern() == trackCompPattern_[i]) && (absK < trackCompCutCurv_[i]) &&
989  ((track.approxChi2() > chiSquareCutTight_[i]) || (delta > deltaMax))) {
990  track.setCoordinatesAtVertex(8191, track.phiAtVertex(), track.dxy());
991  break;
992  }
993  }
994 }
995 
997  // int offset=0;
998  uint chi = track.approxChi2() > 127 ? 127 : track.approxChi2();
999  if (hitPattern(track) == customBitmask(0, 0, 1, 1))
1000  return 60;
1001  // return offset+(track.stubs().size()*2+track.quality())*80-track.approxChi2();
1002  return 160 + (track.stubs().size()) * 20 - chi;
1003 }
1004 
1006  if (value > maximum - 1)
1007  return wrapAround(value - 2 * maximum, maximum);
1008  if (value < -maximum)
1009  return wrapAround(value + 2 * maximum, maximum);
1010  return value;
1011 }
1012 
1013 int L1TMuonBarrelKalmanAlgo::encode(bool ownwheel, int sector, bool tag) {
1014  if (ownwheel) {
1015  if (sector == 0) {
1016  if (tag)
1017  return 9;
1018  else
1019  return 8;
1020  } else if (sector == 1) {
1021  if (tag)
1022  return 11;
1023  else
1024  return 10;
1025 
1026  } else {
1027  if (tag)
1028  return 13;
1029  else
1030  return 12;
1031  }
1032 
1033  } else {
1034  if (sector == 0) {
1035  if (tag)
1036  return 1;
1037  else
1038  return 0;
1039  } else if (sector == 1) {
1040  if (tag)
1041  return 3;
1042  else
1043  return 2;
1044 
1045  } else {
1046  if (tag)
1047  return 5;
1048  else
1049  return 4;
1050  }
1051  }
1052  return 15;
1053 }
1054 
1056  std::map<int, int> out;
1057 
1059  if (track.wheel() == -2)
1061  else if (track.wheel() == -1)
1063  else if (track.wheel() == 0)
1065  else if (track.wheel() == 1)
1067  else if (track.wheel() == 2)
1069  else
1079  //out[l1t::RegionalMuonCand::kNumBmtfSubAddr]=0; // This is commented out for better data/MC agreement
1080 
1081  for (const auto& stub : track.stubs()) {
1082  bool ownwheel = stub->whNum() == track.wheel();
1083  int sector = 0;
1084  if ((stub->scNum() == track.sector() + 1) || (stub->scNum() == 0 && track.sector() == 11))
1085  sector = +1;
1086  if ((stub->scNum() == track.sector() - 1) || (stub->scNum() == 11 && track.sector() == 0))
1087  sector = -1;
1088  int addr = encode(ownwheel, sector, stub->tag());
1089 
1090  if (stub->stNum() == 4) {
1091  if (stub->tag())
1092  addr = 1;
1093  else
1094  addr = 2;
1096  }
1097  if (stub->stNum() == 3) {
1099  }
1100  if (stub->stNum() == 2) {
1102  }
1103  if (stub->stNum() == 1) {
1105  }
1106  }
1107 
1108  word = 0;
1113 
1114  return out;
1115 }
1116 
1118  if (q >= 0)
1119  return q;
1120  else
1121  return (~q) + 1;
1122 }
1123 
1125  // return long(a*(1<<bits)*b)>>bits;
1126  return (long((a * (1 << bits)) * b)) >> bits;
1127 }
1128 
1130  int charge = (K >= 0) ? +1 : -1;
1131  float lsb = 1.25 / float(1 << 13);
1132  float FK = fabs(K);
1133 
1134  if (FK > 2047)
1135  FK = 2047.;
1136  if (FK < 26)
1137  FK = 26.;
1138 
1139  FK = FK * lsb;
1140 
1141  //step 1 -material and B-field
1142  FK = 0.898 * FK / (1.0 - 0.6 * FK);
1143  //step 2 -low Pt
1144  FK = FK - 26.382 * FK * FK * FK * FK * FK;
1145  //step 3 - misalignment
1146  FK = FK - charge * 1.408e-3;
1147  //Get to BMTF
1148  FK = FK / 1.17;
1149 
1150  int pt = 0;
1151  if (FK != 0)
1152  pt = int(2.0 / FK);
1153 
1154  if (pt > 511)
1155  pt = 511;
1156 
1157  if (pt < 6)
1158  pt = 6;
1159 
1160  return pt;
1161 }
1162 
1165 
1166  std::map<uint, int> infoRank;
1167  std::map<uint, L1MuKBMTrack> infoTrack;
1168  for (uint i = 3; i <= 15; ++i) {
1169  if (i == 4 || i == 8)
1170  continue;
1171  infoRank[i] = -1;
1172  }
1173 
1174  for (const auto& track : tracks) {
1175  infoRank[track.hitPattern()] = rank(track);
1176  infoTrack[track.hitPattern()] = track;
1177  }
1178 
1179  int selected = 15;
1180  if (seed == 4) //station 4 seeded
1181  {
1182  int sel6 = infoRank[10] >= infoRank[12] ? 10 : 12;
1183  int sel5 = infoRank[14] >= infoRank[9] ? 14 : 9;
1184  int sel4 = infoRank[11] >= infoRank[13] ? 11 : 13;
1185  int sel3 = infoRank[sel6] >= infoRank[sel5] ? sel6 : sel5;
1186  int sel2 = infoRank[sel4] >= infoRank[sel3] ? sel4 : sel3;
1187  selected = infoRank[15] >= infoRank[sel2] ? 15 : sel2;
1188  }
1189  if (seed == 3) //station 3 seeded
1190  {
1191  int sel2 = infoRank[5] >= infoRank[6] ? 5 : 6;
1192  selected = infoRank[7] >= infoRank[sel2] ? 7 : sel2;
1193  }
1194  if (seed == 2) //station 3 seeded
1195  selected = 3;
1196 
1197  auto search = infoTrack.find(selected);
1198  if (search != infoTrack.end())
1199  out.push_back(search->second);
1200 
1201  return out;
1202 }
1203 
1205  if (stub->qeta1() != 0 && stub->qeta2() != 0) {
1206  return 0;
1207  }
1208  if (stub->qeta1() == 0) {
1209  return 0;
1210  }
1211  // return (stub->qeta1()*4+stub->stNum());
1212  return (stub->qeta1());
1213 }
1214 
1216  uint pattern = track.hitPattern();
1217  int wheel = track.stubs()[0]->whNum();
1218  uint awheel = fabs(wheel);
1219  int sign = 1;
1220  if (wheel < 0)
1221  sign = -1;
1222  uint nstubs = track.stubs().size();
1223  uint mask = 0;
1224  for (unsigned int i = 0; i < track.stubs().size(); ++i) {
1225  if (fabs(track.stubs()[i]->whNum()) != awheel)
1226  mask = mask | (1 << i);
1227  }
1228  mask = (awheel << nstubs) | mask;
1229  track.setCoarseEta(sign * lutService_->coarseEta(pattern, mask));
1230 
1231  int sumweights = 0;
1232  int sums = 0;
1233 
1234  for (const auto& stub : track.stubs()) {
1235  uint rank = etaStubRank(stub);
1236  if (rank == 0)
1237  continue;
1238  // printf("Stub station=%d rank=%d values=%d %d\n",stub->stNum(),rank,stub->eta1(),stub->eta2());
1239  sumweights += rank;
1240  sums += rank * stub->eta1();
1241  }
1242 
1243  //0.5 0.332031 0.25 0.199219 0.164063
1244  float factor;
1245  if (sumweights == 1)
1246  factor = 1.0;
1247  else if (sumweights == 2)
1248  factor = 0.5;
1249  else if (sumweights == 3)
1250  factor = 0.332031;
1251  else if (sumweights == 4)
1252  factor = 0.25;
1253  else if (sumweights == 5)
1254  factor = 0.199219;
1255  else if (sumweights == 6)
1256  factor = 0.164063;
1257  else
1258  factor = 0.0;
1259 
1260  int eta = 0;
1261  if (sums > 0)
1262  eta = fp_product(factor, sums, 10);
1263  else
1264  eta = -fp_product(factor, fabs(sums), 10);
1265 
1266  //int eta=int(factor*sums);
1267  // printf("Eta debug %f *%d=%d\n",factor,sums,eta);
1268 
1269  if (sumweights > 0)
1270  track.setFineEta(eta);
1271 }
1272 
1274  //If there is stub at station 2 use this else propagate from 1
1275  for (const auto& stub : track.stubs())
1276  if (stub->stNum() == 2)
1277  return correctedPhi(stub, track.sector());
1278 
1279  int phi = track.phiAtMuon();
1280  int phiB = track.phiBAtMuon();
1281 
1282  int phiNew = phi + fp_product(phiAt2_, phiB, 10);
1283  if (verbose_)
1284  printf("Phi at second station=%d\n", phiNew);
1285  if (phiNew > 4095)
1286  phiNew = 4095;
1287  if (phiNew < -4096)
1288  phiNew = -4096;
1289  return phiNew;
1290 }
L1TMuonBarrelKalmanAlgo::chiSquareCutCurv_
std::vector< int > chiSquareCutCurv_
Definition: L1TMuonBarrelKalmanAlgo.h:92
L1TMuonBarrelKalmanAlgo::Matrix32
ROOT::Math::SMatrix< double, 3, 2 > Matrix32
Definition: L1TMuonBarrelKalmanAlgo.h:20
class-composition.H
H
Definition: class-composition.py:31
l1t::RegionalMuonCand::kStat2
Definition: RegionalMuonCand.h:16
change_name.diff
diff
Definition: change_name.py:13
L1TMuonBarrelKalmanAlgo::combos3_
std::vector< int > combos3_
Definition: L1TMuonBarrelKalmanAlgo.h:105
l1t::bmtf
Definition: RegionalMuonCandFwd.h:8
L1TMuonBarrelKalmanLUTs::trackGain2
std::vector< float > trackGain2(uint, uint, uint)
Definition: L1TMuonBarrelKalmanLUTs.cc:63
l1t::RegionalMuonCand::kWheelNum
Definition: RegionalMuonCand.h:14
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
L1TMuonBarrelKalmanLUTs::trackGain
std::vector< float > trackGain(uint, uint, uint)
Definition: L1TMuonBarrelKalmanLUTs.cc:55
electrons_cff.bool
bool
Definition: electrons_cff.py:372
L1TMuonBarrelKalmanAlgo::pointResolutionPhi_
double pointResolutionPhi_
Definition: L1TMuonBarrelKalmanAlgo.h:116
mps_fire.i
i
Definition: mps_fire.py:355
HLT_2018_cff.pt2
pt2
Definition: HLT_2018_cff.py:8552
l1t::RegionalMuonCand::kSegSelStat4
Definition: RegionalMuonCand.h:22
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
l1t::RegionalMuonCand::kSegSelStat1
Definition: RegionalMuonCand.h:19
step
step
Definition: StallMonitor.cc:94
muon
Definition: MuonCocktails.h:17
L1TMuonBarrelKalmanAlgo::rank
int rank(const L1MuKBMTrack &)
Definition: L1TMuonBarrelKalmanAlgo.cc:996
L1TMuonBarrelKalmanAlgo::pointResolutionPhiB_
double pointResolutionPhiB_
Definition: L1TMuonBarrelKalmanAlgo.h:118
L1TMuonBarrelKalmanAlgo::combos2_
std::vector< int > combos2_
Definition: L1TMuonBarrelKalmanAlgo.h:106
L1TMuonBarrelKalmanAlgo::twosCompToBits
uint twosCompToBits(int)
Definition: L1TMuonBarrelKalmanAlgo.cc:1117
L1TMuonBarrelKalmanAlgo::mScatteringPhiB_
std::vector< double > mScatteringPhiB_
Definition: L1TMuonBarrelKalmanAlgo.h:114
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
L1TMuonBarrelKalmanAlgo::trackAddress
std::map< int, int > trackAddress(const L1MuKBMTrack &, int &)
Definition: L1TMuonBarrelKalmanAlgo.cc:1055
L1MuKBMTrackCollection
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
L1TMuonBarrelKalmanAlgo::correctedPhiB
int correctedPhiB(const L1MuKBMTCombinedStubRef &)
Definition: L1TMuonBarrelKalmanAlgo.cc:287
pos
Definition: PixelAliasList.h:18
L1TMuonBarrelKalmanAlgo::L1TMuonBarrelKalmanAlgo
L1TMuonBarrelKalmanAlgo(const edm::ParameterSet &settings)
Definition: L1TMuonBarrelKalmanAlgo.cc:4
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
data-class-funcs.q
q
Definition: data-class-funcs.py:169
L1TMuonBarrelKalmanAlgo::estimateCompatibility
void estimateCompatibility(L1MuKBMTrack &)
Definition: L1TMuonBarrelKalmanAlgo.cc:966
L1TMuonBarrelKalmanAlgo::vertexConstraintLUT
void vertexConstraintLUT(L1MuKBMTrack &)
Definition: L1TMuonBarrelKalmanAlgo.cc:681
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
L1TMuonBarrelKalmanAlgo::useOfflineAlgo_
bool useOfflineAlgo_
Definition: L1TMuonBarrelKalmanAlgo.h:112
L1TMuonBarrelKalmanAlgo::match
std::pair< bool, uint > match(const L1MuKBMTCombinedStubRef &, const L1MuKBMTCombinedStubRefVector &, int)
Definition: L1TMuonBarrelKalmanAlgo.cc:163
l1t::RegionalMuonCand::kStat4
Definition: RegionalMuonCand.h:18
l1t::RegionalMuonCand::kStat3
Definition: RegionalMuonCand.h:17
Validation_hcalonly_cfi.sign
sign
Definition: Validation_hcalonly_cfi.py:32
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
IntegrityClient_cfi.Gain
Gain
Definition: IntegrityClient_cfi.py:16
L1TMuonBarrelKalmanAlgo::trackCompPattern_
std::vector< int > trackCompPattern_
Definition: L1TMuonBarrelKalmanAlgo.h:98
L1TMuonBarrelKalmanAlgo::aPhiB_
std::vector< double > aPhiB_
Definition: L1TMuonBarrelKalmanAlgo.h:79
L1TMuonBarrelKalmanAlgo::updateLUT
bool updateLUT(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &, int)
Definition: L1TMuonBarrelKalmanAlgo.cc:563
L1TMuonBarrelKalmanAlgo::aPhiBNLO_
std::vector< double > aPhiBNLO_
Definition: L1TMuonBarrelKalmanAlgo.h:80
L1TMuonBarrelKalmanLUTs
Definition: L1TMuonBarrelKalmanLUTs.h:9
HLT_2018_cff.muon
muon
Definition: HLT_2018_cff.py:10349
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
L1TMuonBarrelKalmanAlgo::update
bool update(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &, int)
Definition: L1TMuonBarrelKalmanAlgo.cc:428
parallelization.uint
uint
Definition: parallelization.py:124
L1TMuonBarrelKalmanAlgo::updateOffline1D
bool updateOffline1D(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
Definition: L1TMuonBarrelKalmanAlgo.cc:515
L1TMuonBarrelKalmanLUTs::coarseEta
uint coarseEta(uint, uint)
Definition: L1TMuonBarrelKalmanLUTs.cc:81
edm::Ref
Definition: AssociativeIterator.h:58
word
uint64_t word
Definition: CTPPSTotemDataFormatter.cc:29
L1TMuonBarrelKalmanAlgo::getByCode
std::pair< bool, uint > getByCode(const L1MuKBMTrackCollection &tracks, int mask)
Definition: L1TMuonBarrelKalmanAlgo.cc:41
generateTowerEtThresholdLUT.addr
addr
Definition: generateTowerEtThresholdLUT.py:57
L1TMuonBarrelKalmanAlgo::phiAt2
int phiAt2(const L1MuKBMTrack &track)
Definition: L1TMuonBarrelKalmanAlgo.cc:1273
L1TMuonBarrelKalmanAlgo::phiAt2_
double phiAt2_
Definition: L1TMuonBarrelKalmanAlgo.h:83
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
L1TMuonBarrelKalmanAlgo::Matrix13
ROOT::Math::SMatrix< double, 1, 3 > Matrix13
Definition: L1TMuonBarrelKalmanAlgo.h:22
L1TMuonBarrelKalmanLUTs::vertexGain
std::pair< float, float > vertexGain(uint, uint)
Definition: L1TMuonBarrelKalmanLUTs.cc:75
PVValHelper::eta
Definition: PVValidationHelpers.h:69
l1t::RegionalMuonCand::kStat1
Definition: RegionalMuonCand.h:15
simKBmtfDigis_cfi.initialK
initialK
Definition: simKBmtfDigis_cfi.py:6
L1TMuonBarrelKalmanAlgo::chiSquare_
std::vector< double > chiSquare_
Definition: L1TMuonBarrelKalmanAlgo.h:90
N
#define N
Definition: blowfish.cc:9
L1TMuonBarrelKalmanAlgo::fp_product
int fp_product(float, int, uint)
Definition: L1TMuonBarrelKalmanAlgo.cc:1124
L1TMuonBarrelKalmanAlgo::CovarianceMatrix2
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > CovarianceMatrix2
Definition: L1TMuonBarrelKalmanAlgo.h:19
DQMScaleToClient_cfi.factor
factor
Definition: DQMScaleToClient_cfi.py:8
L1TMuonBarrelKalmanAlgo::matchAbs
uint matchAbs(std::map< uint, uint > &, uint, uint)
Definition: L1TMuonBarrelKalmanAlgo.cc:156
L1TMuonBarrelKalmanAlgo::mScatteringPhi_
std::vector< double > mScatteringPhi_
Definition: L1TMuonBarrelKalmanAlgo.h:113
cond::persistency::search
std::vector< T >::const_iterator search(const cond::Time_t &val, const std::vector< T > &container)
Definition: IOVProxy.cc:19
b
double b
Definition: hdecay.h:118
L1TMuonBarrelKalmanAlgo::initK2_
std::vector< double > initK2_
Definition: L1TMuonBarrelKalmanAlgo.h:74
L1TMuonBarrelKalmanAlgo::pointResolutionVertex_
double pointResolutionVertex_
Definition: L1TMuonBarrelKalmanAlgo.h:120
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
S
double S(const TLorentzVector &, const TLorentzVector &)
Definition: Particle.cc:97
L1TMuonBarrelKalmanAlgo::vertexConstraintOffline
void vertexConstraintOffline(L1MuKBMTrack &)
Definition: L1TMuonBarrelKalmanAlgo.cc:640
ALCARECOTkAlJpsiMuMu_cff.charge
charge
Definition: ALCARECOTkAlJpsiMuMu_cff.py:47
bphysicsOniaDQM_cfi.vertex
vertex
Definition: bphysicsOniaDQM_cfi.py:7
edm::ParameterSet
Definition: ParameterSet.h:36
L1TMuonBarrelKalmanAlgo::initK_
std::vector< double > initK_
Definition: L1TMuonBarrelKalmanAlgo.h:73
a
double a
Definition: hdecay.h:119
runTheMatrix.err
err
Definition: runTheMatrix.py:288
reco::btau::trackPhi
Definition: TaggingVariable.h:43
dumpMFGeometry_cfg.delta
delta
Definition: dumpMFGeometry_cfg.py:25
L1TMuonBarrelKalmanAlgo::customBitmask
int customBitmask(unsigned int, unsigned int, unsigned int, unsigned int)
Definition: L1TMuonBarrelKalmanAlgo.cc:311
L1TMuonBarrelKalmanAlgo::eLoss_
std::vector< double > eLoss_
Definition: L1TMuonBarrelKalmanAlgo.h:77
makeMuonMisalignmentScenario.wheel
wheel
Definition: makeMuonMisalignmentScenario.py:319
createfilelist.int
int
Definition: createfilelist.py:10
L1TMuonBarrelKalmanAlgo::Matrix31
ROOT::Math::SMatrix< double, 3, 1 > Matrix31
Definition: L1TMuonBarrelKalmanAlgo.h:23
value
Definition: value.py:1
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
l1t::RegionalMuonCand::kSegSelStat2
Definition: RegionalMuonCand.h:20
L1TMuonBarrelKalmanAlgo::chain
std::pair< bool, L1MuKBMTrack > chain(const L1MuKBMTCombinedStubRef &, const L1MuKBMTCombinedStubRefVector &)
Definition: L1TMuonBarrelKalmanAlgo.cc:738
L1MuKBMTrack
Definition: L1MuKBMTrack.h:19
L1TMuonBarrelKalmanAlgo::calculateEta
void calculateEta(L1MuKBMTrack &track)
Definition: L1TMuonBarrelKalmanAlgo.cc:1215
L1TMuonBarrelKalmanAlgo::trackComp_
std::vector< double > trackComp_
Definition: L1TMuonBarrelKalmanAlgo.h:95
L1TMuonBarrelKalmanAlgo::Matrix23
ROOT::Math::SMatrix< double, 2, 3 > Matrix23
Definition: L1TMuonBarrelKalmanAlgo.h:21
L1TMuonBarrelKalmanAlgo::combos4_
std::vector< int > combos4_
Definition: L1TMuonBarrelKalmanAlgo.h:104
l1t::RegionalMuonCand::kSegSelStat3
Definition: RegionalMuonCand.h:21
L1TMuonBarrelKalmanAlgo::chiSquareCutTight_
std::vector< int > chiSquareCutTight_
Definition: L1TMuonBarrelKalmanAlgo.h:101
l1t::RegionalMuonCand::kWheelSide
Definition: RegionalMuonCand.h:13
L1TMuonBarrelKalmanAlgo::lutService_
L1TMuonBarrelKalmanLUTs * lutService_
Definition: L1TMuonBarrelKalmanAlgo.h:69
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
L1TMuonBarrelKalmanAlgo::updateEta
void updateEta(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
Definition: L1TMuonBarrelKalmanAlgo.cc:631
L1TMuonBarrelKalmanAlgo::vertexConstraint
void vertexConstraint(L1MuKBMTrack &)
Definition: L1TMuonBarrelKalmanAlgo.cc:633
L1TMuonBarrelKalmanAlgo::setFloatingPointValues
void setFloatingPointValues(L1MuKBMTrack &, bool)
Definition: L1TMuonBarrelKalmanAlgo.cc:702
L1TMuonBarrelKalmanAlgo::Matrix33
ROOT::Math::SMatrix< double, 3, 3 > Matrix33
Definition: L1TMuonBarrelKalmanAlgo.h:24
L1TMuonBarrelKalmanAlgo::hitPattern
int hitPattern(const L1MuKBMTrack &)
Definition: L1TMuonBarrelKalmanAlgo.cc:303
L1TMuonBarrelKalmanAlgo::chiSquareCutPattern_
std::vector< int > chiSquareCutPattern_
Definition: L1TMuonBarrelKalmanAlgo.h:91
L1TMuonBarrelKalmanAlgo::clean
L1MuKBMTrackCollection clean(const L1MuKBMTrackCollection &, uint)
Definition: L1TMuonBarrelKalmanAlgo.cc:1163
DDAxes::phi
L1TMuonBarrelKalmanAlgo::estimateChiSquare
bool estimateChiSquare(L1MuKBMTrack &)
Definition: L1TMuonBarrelKalmanAlgo.cc:920
bits
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision bits
Definition: EventSelector-behavior.doc:35
std
Definition: JetResolutionObject.h:76
reco::Candidate::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
covariance error matrix (3x3)
Definition: Candidate.h:46
L1TMuonBarrelKalmanAlgo::bPhi_
std::vector< double > bPhi_
Definition: L1TMuonBarrelKalmanAlgo.h:81
PVValHelper::dxy
Definition: PVValidationHelpers.h:47
L1TMuonBarrelKalmanAlgo::wrapAround
int wrapAround(int, int)
Definition: L1TMuonBarrelKalmanAlgo.cc:1005
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
L1TMuonBarrelKalmanAlgo::propagate
void propagate(L1MuKBMTrack &)
Definition: L1TMuonBarrelKalmanAlgo.cc:317
L1TMuonBarrelKalmanAlgo::updateOffline
bool updateOffline(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
Definition: L1TMuonBarrelKalmanAlgo.cc:440
relativeConstraints.value
value
Definition: relativeConstraints.py:53
L1TMuonBarrelKalmanAlgo::getBit
bool getBit(int, int)
Definition: L1TMuonBarrelKalmanAlgo.cc:315
L1TMuonBarrelKalmanAlgo::chiSquareCut_
std::vector< int > chiSquareCut_
Definition: L1TMuonBarrelKalmanAlgo.h:93
CaloTPGTranscoder_cfi.HF
HF
Definition: CaloTPGTranscoder_cfi.py:4
TriggerAnalyzer.passed
passed
Definition: TriggerAnalyzer.py:62
L1TMuonBarrelKalmanAlgo::Vector2
ROOT::Math::SVector< double, 2 > Vector2
Definition: L1TMuonBarrelKalmanAlgo.h:18
L1TMuonBarrelKalmanAlgo::encode
int encode(bool ownwheel, int sector, bool tag)
Definition: L1TMuonBarrelKalmanAlgo.cc:1013
L1TMuonBarrelKalmanAlgo::verbose_
bool verbose_
Definition: L1TMuonBarrelKalmanAlgo.h:35
L1TMuonBarrelKalmanAlgo::bPhiB_
std::vector< double > bPhiB_
Definition: L1TMuonBarrelKalmanAlgo.h:82
S
Definition: CSCDBL1TPParametersExtended.h:16
MillePedeFileConverter_cfg.out
out
Definition: MillePedeFileConverter_cfg.py:31
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:30
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
L1TMuonBarrelKalmanAlgo::combos1_
std::vector< int > combos1_
Definition: L1TMuonBarrelKalmanAlgo.h:107
L1TMuonBarrelKalmanAlgo::etaStubRank
uint etaStubRank(const L1MuKBMTCombinedStubRef &)
Definition: L1TMuonBarrelKalmanAlgo.cc:1204
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
L1TMuonBarrelKalmanAlgo::addBMTFMuon
void addBMTFMuon(int, const L1MuKBMTrack &, std::unique_ptr< l1t::RegionalMuonCandBxCollection > &)
Definition: L1TMuonBarrelKalmanAlgo.cc:128
P
std::pair< OmniClusterRef, TrackingParticleRef > P
Definition: BDHadronTrackMonitoringAnalyzer.cc:202
L1TMuonBarrelKalmanAlgo::trackCompCutCurv_
std::vector< int > trackCompCutCurv_
Definition: L1TMuonBarrelKalmanAlgo.h:99
L1TMuonBarrelKalmanAlgo.h
dttmaxenums::R
Definition: DTTMax.h:29
L1TMuonBarrelKalmanAlgo::trackCompErr2_
std::vector< double > trackCompErr2_
Definition: L1TMuonBarrelKalmanAlgo.h:97
l1t::RegionalMuonCand
Definition: RegionalMuonCand.h:8
L1TMuonBarrelKalmanAlgo::convertToBMTF
l1t::RegionalMuonCand convertToBMTF(const L1MuKBMTrack &track)
Definition: L1TMuonBarrelKalmanAlgo.cc:50
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295
L1TMuonBarrelKalmanAlgo::correctedPhi
int correctedPhi(const L1MuKBMTCombinedStubRef &, int)
Definition: L1TMuonBarrelKalmanAlgo.cc:292
L1TMuonBarrelKalmanAlgo::trackCompErr1_
std::vector< double > trackCompErr1_
Definition: L1TMuonBarrelKalmanAlgo.h:96
L1TMuonBarrelKalmanAlgo::ptLUT
int ptLUT(int K)
Definition: L1TMuonBarrelKalmanAlgo.cc:1129
L1TMuonBarrelKalmanAlgo::trackCompCut_
std::vector< int > trackCompCut_
Definition: L1TMuonBarrelKalmanAlgo.h:100
L1MuKBMTCombinedStubRefVector
std::vector< edm::Ref< L1MuKBMTCombinedStubCollection > > L1MuKBMTCombinedStubRefVector
Definition: L1MuKBMTCombinedStub.h:43
L1TMuonBarrelKalmanAlgo::aPhi_
std::vector< double > aPhi_
Definition: L1TMuonBarrelKalmanAlgo.h:78