CMS 3D CMS Logo

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