CMS 3D CMS Logo

KFbase.cc
Go to the documentation of this file.
1 
4 
14 #include "TMatrixD.h"
15 
16 #include <algorithm>
17 #include <functional>
18 #include <fstream>
19 #include <iomanip>
20 #include <atomic>
21 #include <sstream>
22 
23 using namespace std;
24 
25 namespace tmtt {
26 
27  /* Initialize cfg parameters */
28 
29  KFbase::KFbase(const Settings *settings, const uint nHelixPar, const string &fitterName, const uint nMeas)
30  : TrackFitGeneric(settings, fitterName) {
31  nHelixPar_ = nHelixPar;
32  nMeas_ = nMeas;
33  numEtaRegions_ = settings->numEtaRegions();
34  }
35 
36  /* Do track fit */
37 
38  L1fittedTrack KFbase::fit(const L1track3D &l1track3D) {
39  iPhiSec_ = l1track3D.iPhiSec();
40  iEtaReg_ = l1track3D.iEtaReg();
41  resetStates();
42  numUpdateCalls_ = 0;
43 
44  vector<Stub *> stubs = l1track3D.stubs();
45 
46  auto orderByLayer = [](const Stub *a, const Stub *b) { return bool(a->layerId() < b->layerId()); };
47  sort(stubs.begin(), stubs.end(), orderByLayer); // Makes debug printout pretty.
48 
49  //TP
50  const TP *tpa(nullptr);
51  if (l1track3D.matchedTP()) {
52  tpa = l1track3D.matchedTP();
53  }
54  tpa_ = tpa;
55 
56  //track information dump
57  if (settings_->kalmanDebugLevel() >= 1) {
58  PrintL1trk() << "===============================================================================";
59  std::stringstream text;
60  text << std::fixed << std::setprecision(4);
61  text << "Input track cand: [phiSec,etaReg]=[" << l1track3D.iPhiSec() << "," << l1track3D.iEtaReg() << "]";
62  text << " HT(m,c)=(" << l1track3D.cellLocationHT().first << "," << l1track3D.cellLocationHT().second
63  << ") q/pt=" << l1track3D.qOverPt() << " tanL=" << l1track3D.tanLambda() << " z0=" << l1track3D.z0()
64  << " phi0=" << l1track3D.phi0() << " nStubs=" << l1track3D.numStubs() << " d0=" << l1track3D.d0();
65  PrintL1trk() << text.str();
66  if (not settings_->hybrid())
67  printTP(tpa);
68  if (settings_->kalmanDebugLevel() >= 2) {
69  printStubLayers(stubs, l1track3D.iEtaReg());
70  printStubs(stubs);
71  }
72  }
73 
74  //Kalman Filter
75  const KalmanState *cand = doKF(l1track3D, stubs, tpa);
76 
77  //return L1fittedTrk for the selected state (if KF produced one it was happy with).
78  if (cand != nullptr) {
79  // Get track helix params.
80  TVectorD trackPars = trackParams(cand);
81  double d0 = (nHelixPar_ == 5) ? trackPars[D0] : 0.;
82 
83  L1fittedTrack fitTrk(settings_,
84  &l1track3D,
85  cand->stubs(),
86  cand->hitPattern(),
87  trackPars[QOVERPT],
88  d0,
89  trackPars[PHI0],
90  trackPars[Z0],
91  trackPars[T],
92  cand->chi2rphi(),
93  cand->chi2rz(),
94  nHelixPar_);
95 
96  // Store supplementary info, specific to KF fitter.
97  fitTrk.setInfoKF(cand->nSkippedLayers(), numUpdateCalls_);
98 
99  // If doing 5 parameter fit, optionally also calculate helix params & chi2 with beam-spot constraint applied,
100  // and store inside L1fittedTrack object.
102  if (nHelixPar_ == 5) {
103  double chi2rphi_bcon = 0.;
104  TVectorD trackPars_bcon = trackParams_BeamConstr(cand, chi2rphi_bcon);
105 
106  // Check scaled chi2 cut
107  vector<double> kfLayerVsChiSqCut = settings_->kfLayerVsChiSq5();
108  double chi2scaled = chi2rphi_bcon / settings_->kalmanChi2RphiScale() + fitTrk.chi2rz();
109  bool accepted = true;
110  if (chi2scaled > kfLayerVsChiSqCut[cand->nStubLayers()])
111  accepted = false;
112 
113  fitTrk.setBeamConstr(trackPars_bcon[QOVERPT], trackPars_bcon[PHI0], chi2rphi_bcon, accepted);
114  }
115  }
116 
117  // Fitted track params must lie in same sector as HT originally found track in.
118  if (!settings_->hybrid()) { // consistentSector() function not yet working for Hybrid.
119 
120  // Bodge to take into account digitisation in sector consistency check.
121  if (settings_->enableDigitize())
122  fitTrk.digitizeTrack("KF4ParamsComb");
123 
124  if (!fitTrk.consistentSector()) {
125  if (settings_->kalmanDebugLevel() >= 1)
126  PrintL1trk() << "Track rejected by sector consistency test";
127  L1fittedTrack rejectedTrk;
128  return rejectedTrk;
129  }
130  }
131 
132  return fitTrk;
133 
134  } else { // Track rejected by fitter
135 
136  if (settings_->kalmanDebugLevel() >= 1) {
137  bool goodTrack = (tpa && tpa->useForAlgEff()); // Matches truth particle.
138  if (goodTrack) {
139  int tpin = tpa->index();
140  PrintL1trk() << "TRACK LOST: eta=" << l1track3D.iEtaReg() << " pt=" << l1track3D.pt() << " tp=" << tpin;
141 
142  for (auto stub : stubs) {
143  int kalmanLay =
144  this->kalmanLayer(l1track3D.iEtaReg(), stub->layerIdReduced(), stub->barrel(), stub->r(), stub->z());
145  std::stringstream text;
146  text << std::fixed << std::setprecision(4);
147  text << " Stub: lay_red=" << stub->layerIdReduced() << " KFlay=" << kalmanLay << " r=" << stub->r()
148  << " z=" << stub->z() << " assoc TPs =";
149  for (const TP *tp_i : stub->assocTPs())
150  text << " " << tp_i->index();
151  PrintL1trk() << text.str();
152  if (stub->assocTPs().empty())
153  PrintL1trk() << " none";
154  }
155  PrintL1trk() << "=====================";
156  }
157  }
158 
159  //dump on the missed TP for efficiency calculation.
160  if (settings_->kalmanDebugLevel() >= 3) {
161  if (tpa && tpa->useForAlgEff()) {
162  PrintL1trk() << "TP for eff. missed addr. index : " << tpa << " " << tpa->index();
163  printStubs(stubs);
164  }
165  }
166 
167  L1fittedTrack rejectedTrk;
168  return rejectedTrk;
169  }
170  }
171 
172  /* Do track fit (internal function) */
173 
174  const KalmanState *KFbase::doKF(const L1track3D &l1track3D, const vector<Stub *> &stubs, const TP *tpa) {
175  const KalmanState *finished_state = nullptr;
176 
177  map<unsigned int, const KalmanState *, std::greater<unsigned int>>
178  best_state_by_nstubs; // Best state (if any) for each viable no. of stubs on track value.
179 
180  // seed helix params & their covariance.
181  TVectorD x0 = seedX(l1track3D);
182  TMatrixD pxx0 = seedC(l1track3D);
183  TMatrixD K(nHelixPar_, 2);
184  TMatrixD dcov(2, 2);
185 
186  const KalmanState *state0 = mkState(l1track3D, 0, -1, nullptr, x0, pxx0, K, dcov, nullptr, 0, 0);
187 
188  // internal containers - i.e. the state FIFO. Contains estimate of helix params in last/next layer, with multiple entries if there were multiple stubs, yielding multiple states.
189  vector<const KalmanState *> new_states;
190  vector<const KalmanState *> prev_states;
191  prev_states.push_back(state0);
192 
193  // Get dead layers, if any.
194  bool remove2PSCut = settings_->kalmanRemove2PScut();
195  set<unsigned> kfDeadLayers = kalmanDeadLayers(remove2PSCut);
196 
197  // arrange stubs into Kalman layers according to eta region
198  int etaReg = l1track3D.iEtaReg();
199  map<int, vector<Stub *>> layerStubs;
200 
201  for (auto stub : stubs) {
202  // Get Kalman encoded layer ID for this stub.
203  int kalmanLay = this->kalmanLayer(etaReg, stub->layerIdReduced(), stub->barrel(), stub->r(), stub->z());
204 
205  constexpr unsigned int invalidKFlayer = 7;
206  if (kalmanLay != invalidKFlayer) {
207  if (layerStubs[kalmanLay].size() < settings_->kalmanMaxStubsPerLayer()) {
208  layerStubs[kalmanLay].push_back(stub);
209  } else {
210  // If too many stubs, FW keeps the last stub.
211  layerStubs[kalmanLay].back() = stub;
212  }
213  }
214  }
215 
216  // iterate using state->nextLayer() to determine next Kalman layer(s) to add stubs from
217  constexpr unsigned int nTypicalLayers = 6; // Number of tracker layers a typical track can pass through.
218  // If user asked to add up to 7 layers to track, increase number of iterations by 1.
219  const unsigned int maxIterations = std::max(nTypicalLayers, settings_->kalmanMaxNumStubs());
220  for (unsigned iteration = 0; iteration < maxIterations; iteration++) {
221  int combinations_per_iteration = 0;
222 
223  bool easy = (l1track3D.numStubs() < settings_->kalmanMaxStubsEasy());
224  unsigned int kalmanMaxSkipLayers =
226 
227  // update each state from previous iteration (or seed) using stubs in next Kalman layer
228  vector<const KalmanState *>::const_iterator i_state = prev_states.begin();
229  for (; i_state != prev_states.end(); i_state++) {
230  const KalmanState *the_state = *i_state;
231 
232  unsigned int layer = the_state->nextLayer(); // Get KF layer where stubs to be searched for next
233  unsigned nSkipped = the_state->nSkippedLayers();
234 
235  // If this layer is known to be dead, skip to the next layer (layer+1)
236  // The next_states_skipped will then look at layer+2
237  // However, if there are stubs in this layer, then don't skip (e.g. our phi/eta boundaries might not line up exactly with a dead region)
238  // Continue to skip until you reach a functioning layer (or a layer with stubs)
239  unsigned nSkippedDeadLayers = 0;
240  unsigned nSkippedAmbiguousLayers = 0;
241  while (kfDeadLayers.find(layer) != kfDeadLayers.end() && layerStubs[layer].empty()) {
242  layer += 1;
243  ++nSkippedDeadLayers;
244  }
245  while (this->kalmanAmbiguousLayer(etaReg, layer) && layerStubs[layer].empty()) {
246  layer += 1;
247  ++nSkippedAmbiguousLayers;
248  }
249 
250  // containers for updated state+stub combinations
251  vector<const KalmanState *> next_states;
252  vector<const KalmanState *> next_states_skipped;
253 
254  // find stubs for this layer
255  // (If layer > 6, this will return empty vector, so safe).
256  vector<Stub *> thislay_stubs = layerStubs[layer];
257 
258  // find stubs for next layer if we skip a layer, except when we are on the penultimate layer,
259  // or we have exceeded the max skipped layers
260  vector<Stub *> nextlay_stubs;
261 
262  // If the next layer (layer+1) is a dead layer, then proceed to the layer after next (layer+2), if possible
263  // Also note if we need to increase "skipped" by one more for these states
264  unsigned nSkippedDeadLayers_nextStubs = 0;
265  unsigned nSkippedAmbiguousLayers_nextStubs = 0;
266  if (nSkipped < kalmanMaxSkipLayers) {
267  if (kfDeadLayers.find(layer + 1) != kfDeadLayers.end() && layerStubs[layer + 1].empty()) {
268  nextlay_stubs = layerStubs[layer + 2];
269  nSkippedDeadLayers_nextStubs++;
270  } else if (this->kalmanAmbiguousLayer(etaReg, layer) && layerStubs[layer + 1].empty()) {
271  nextlay_stubs = layerStubs[layer + 2];
272  nSkippedAmbiguousLayers_nextStubs++;
273  } else {
274  nextlay_stubs = layerStubs[layer + 1];
275  }
276  }
277 
278  // If track was not rejected by isGoodState() is previous iteration, failure here usually means the tracker ran out of layers to explore.
279  // (Due to "kalmanLay" not having unique ID for each layer within a given eta sector).
280  if (settings_->kalmanDebugLevel() >= 2 && best_state_by_nstubs.empty() && thislay_stubs.empty() &&
281  nextlay_stubs.empty())
282  PrintL1trk() << "State is lost by start of iteration " << iteration
283  << " : #thislay_stubs=" << thislay_stubs.size() << " #nextlay_stubs=" << nextlay_stubs.size()
284  << " layer=" << layer << " eta=" << l1track3D.iEtaReg();
285 
286  // If we skipped over a dead layer, only increment "nSkipped" after the stubs in next+1 layer have been obtained
287  nSkipped += nSkippedDeadLayers;
288  nSkipped += nSkippedAmbiguousLayers;
289 
290  // check to guarantee no fewer than 2PS hits per state at iteration 1
291  // (iteration 0 will always include a PS hit, but iteration 1 could use 2S hits
292  // unless we include this)
293  if (iteration == 1 && !remove2PSCut) {
294  vector<Stub *> temp_thislaystubs;
295  vector<Stub *> temp_nextlaystubs;
296  for (auto stub : thislay_stubs) {
297  if (stub->psModule())
298  temp_thislaystubs.push_back(stub);
299  }
300  for (auto stub : nextlay_stubs) {
301  if (stub->psModule())
302  temp_nextlaystubs.push_back(stub);
303  }
304  thislay_stubs = temp_thislaystubs;
305  nextlay_stubs = temp_nextlaystubs;
306  }
307 
308  combinations_per_iteration += thislay_stubs.size() + nextlay_stubs.size();
309 
310  // loop over each stub in this layer and check for compatibility with this state
311  for (unsigned i = 0; i < thislay_stubs.size(); i++) {
312  Stub *stub = thislay_stubs[i];
313 
314  // Update helix params by adding this stub.
315  const KalmanState *new_state = kalmanUpdate(nSkipped, layer, stub, the_state, tpa);
316 
317  // Cut on track chi2, pt etc.
318  if (isGoodState(*new_state))
319  next_states.push_back(new_state);
320  }
321 
322  // loop over each stub in next layer if we skip, and check for compatibility with this state
323  for (unsigned i = 0; i < nextlay_stubs.size(); i++) {
324  Stub *stub = nextlay_stubs[i];
325 
326  const KalmanState *new_state =
327  kalmanUpdate(nSkipped + 1 + nSkippedDeadLayers_nextStubs + nSkippedAmbiguousLayers_nextStubs,
328  layer + 1 + nSkippedDeadLayers_nextStubs + nSkippedAmbiguousLayers_nextStubs,
329  stub,
330  the_state,
331  tpa);
332 
333  if (isGoodState(*new_state))
334  next_states_skipped.push_back(new_state);
335  }
336 
337  // post Kalman filter local sorting per state
338  auto orderByChi2 = [](const KalmanState *a, const KalmanState *b) {
339  return bool(a->chi2scaled() < b->chi2scaled());
340  };
341  sort(next_states.begin(), next_states.end(), orderByChi2);
342  sort(next_states_skipped.begin(), next_states_skipped.end(), orderByChi2);
343 
344  new_states.insert(new_states.end(), next_states.begin(), next_states.end());
345  new_states.insert(new_states.end(), next_states_skipped.begin(), next_states_skipped.end());
346  /*
347  i = 0;
348  for (auto state : next_states) {
349  new_states.push_back(state);
350  i++;
351  }
352 
353  i = 0;
354  for (auto state : next_states_skipped) {
355  new_states.push_back(state);
356  i++;
357  }
358 */
359  } //end of state loop
360 
361  // copy new_states into prev_states for next iteration or end if we are on
362  // last iteration by clearing all states and making final state selection
363 
364  auto orderByMinSkipChi2 = [](const KalmanState *a, const KalmanState *b) {
365  return bool((a->chi2scaled()) * (a->nSkippedLayers() + 1) < (b->chi2scaled()) * (b->nSkippedLayers() + 1));
366  };
367  sort(new_states.begin(), new_states.end(), orderByMinSkipChi2); // Sort by chi2*(skippedLayers+1)
368 
369  unsigned int nStubs = iteration + 1;
370  // Success. We have at least one state that passes all cuts. Save best state found with this number of stubs.
371  if (nStubs >= settings_->kalmanMinNumStubs() && not new_states.empty())
372  best_state_by_nstubs[nStubs] = new_states[0];
373 
374  if (nStubs == settings_->kalmanMaxNumStubs()) {
375  // We're done.
376  prev_states.clear();
377  new_states.clear();
378 
379  } else {
380  // Continue iterating.
381  prev_states = new_states;
382  new_states.clear();
383  }
384  }
385 
386  if (not best_state_by_nstubs.empty()) {
387  // Select state with largest number of stubs.
388  finished_state = best_state_by_nstubs.begin()->second; // First element has largest number of stubs.
389  if (settings_->kalmanDebugLevel() >= 1) {
390  std::stringstream text;
391  text << std::fixed << std::setprecision(4);
392  text << "Track found! final state selection: nLay=" << finished_state->nStubLayers()
393  << " hitPattern=" << std::hex << finished_state->hitPattern() << std::dec
394  << " phiSec=" << l1track3D.iPhiSec() << " etaReg=" << l1track3D.iEtaReg() << " HT(m,c)=("
395  << l1track3D.cellLocationHT().first << "," << l1track3D.cellLocationHT().second << ")";
396  TVectorD y = trackParams(finished_state);
397  text << " q/pt=" << y[QOVERPT] << " tanL=" << y[T] << " z0=" << y[Z0] << " phi0=" << y[PHI0];
398  if (nHelixPar_ == 5)
399  text << " d0=" << y[D0];
400  text << " chosen from states:";
401  for (const auto &p : best_state_by_nstubs)
402  text << " " << p.second->chi2() << "/" << p.second->nStubLayers();
403  PrintL1trk() << text.str();
404  }
405  } else {
406  if (settings_->kalmanDebugLevel() >= 1) {
407  PrintL1trk() << "Track lost";
408  }
409  }
410 
411  return finished_state;
412  }
413 
414  /*--- Update a helix state by adding a stub. */
415 
417  unsigned nSkipped, unsigned int layer, Stub *stub, const KalmanState *state, const TP *tpa) {
418  if (settings_->kalmanDebugLevel() >= 4) {
419  PrintL1trk() << "---------------";
420  PrintL1trk() << "kalmanUpdate";
421  PrintL1trk() << "---------------";
422  printStub(stub);
423  }
424 
425  numUpdateCalls_++; // For monitoring, count calls to updator per track.
426 
427  // Helix params & their covariance.
428  TVectorD vecX = state->vectorX();
429  TMatrixD matC = state->matrixC();
430  if (state->barrel() && !stub->barrel()) {
431  if (settings_->kalmanDebugLevel() >= 4) {
432  PrintL1trk() << "STATE BARREL TO ENDCAP BEFORE ";
433  PrintL1trk() << "state : " << vecX[0] << " " << vecX[1] << " " << vecX[2] << " " << vecX[3];
434  PrintL1trk() << "cov(x): ";
435  matC.Print();
436  }
437  if (settings_->kalmanDebugLevel() >= 4) {
438  PrintL1trk() << "STATE BARREL TO ENDCAP AFTER ";
439  PrintL1trk() << "state : " << vecX[0] << " " << vecX[1] << " " << vecX[2] << " " << vecX[3];
440  PrintL1trk() << "cov(x): ";
441  matC.Print();
442  }
443  }
444  // Matrix to propagate helix reference point from one layer to next.
445  TMatrixD matF = matrixF(stub, state);
446  TMatrixD matFtrans(TMatrixD::kTransposed, matF);
447  if (settings_->kalmanDebugLevel() >= 4) {
448  PrintL1trk() << "matF";
449  matF.Print();
450  }
451 
452  // Multiply matrices to get helix params relative to reference point at next layer.
453  TVectorD vecXref = matF * vecX;
454  if (settings_->kalmanDebugLevel() >= 4) {
455  PrintL1trk() << "vecFref = [";
456  for (unsigned i = 0; i < nHelixPar_; i++)
457  PrintL1trk() << vecXref[i] << ", ";
458  PrintL1trk() << "]";
459  }
460 
461  // Get stub residuals.
462  TVectorD delta = residual(stub, vecXref, state->candidate().qOverPt());
463  if (settings_->kalmanDebugLevel() >= 4) {
464  PrintL1trk() << "delta = " << delta[0] << ", " << delta[1];
465  }
466 
467  // Derivative of predicted (phi,z) intercept with layer w.r.t. helix params.
468  TMatrixD matH = matrixH(stub);
469  if (settings_->kalmanDebugLevel() >= 4) {
470  PrintL1trk() << "matH";
471  matH.Print();
472  }
473 
474  if (settings_->kalmanDebugLevel() >= 4) {
475  PrintL1trk() << "previous state covariance";
476  matC.Print();
477  }
478  // Get scattering contribution to helix parameter covariance (currently zero).
479  TMatrixD matScat(nHelixPar_, nHelixPar_);
480 
481  // Get covariance on helix parameters at new reference point including scattering..
482  TMatrixD matCref = matF * matC * matFtrans + matScat;
483  if (settings_->kalmanDebugLevel() >= 4) {
484  PrintL1trk() << "matCref";
485  matCref.Print();
486  }
487  // Get hit position covariance matrix.
488  TMatrixD matV = matrixV(stub, state);
489  if (settings_->kalmanDebugLevel() >= 4) {
490  PrintL1trk() << "matV";
491  matV.Print();
492  }
493 
494  TMatrixD matRinv = matrixRinv(matH, matCref, matV);
495  if (settings_->kalmanDebugLevel() >= 4) {
496  PrintL1trk() << "matRinv";
497  matRinv.Print();
498  }
499 
500  // Calculate Kalman Gain matrix.
501  TMatrixD matK = getKalmanGainMatrix(matH, matCref, matRinv);
502  if (settings_->kalmanDebugLevel() >= 4) {
503  PrintL1trk() << "matK";
504  matK.Print();
505  }
506 
507  // Update helix state & its covariance matrix with new stub.
508  TVectorD new_vecX(nHelixPar_);
509  TMatrixD new_matC(nHelixPar_, nHelixPar_);
510  adjustState(matK, matCref, vecXref, matH, delta, new_vecX, new_matC);
511 
512  // Update track fit chi2 with new stub.
513  double new_chi2rphi = 0, new_chi2rz = 0;
514  this->adjustChi2(state, matRinv, delta, new_chi2rphi, new_chi2rz);
515 
516  if (settings_->kalmanDebugLevel() >= 4) {
517  if (nHelixPar_ == 4)
518  PrintL1trk() << "adjusted x = " << new_vecX[0] << ", " << new_vecX[1] << ", " << new_vecX[2] << ", "
519  << new_vecX[3];
520  else if (nHelixPar_ == 5)
521  PrintL1trk() << "adjusted x = " << new_vecX[0] << ", " << new_vecX[1] << ", " << new_vecX[2] << ", "
522  << new_vecX[3] << ", " << new_vecX[4];
523  PrintL1trk() << "adjusted C ";
524  new_matC.Print();
525  PrintL1trk() << "adjust chi2rphi=" << new_chi2rphi << " chi2rz=" << new_chi2rz;
526  }
527 
528  const KalmanState *new_state = mkState(
529  state->candidate(), nSkipped, layer, state, new_vecX, new_matC, matK, matV, stub, new_chi2rphi, new_chi2rz);
530 
531  return new_state;
532  }
533 
534  /* Create a KalmanState, containing a helix state & next stub it is to be updated with. */
535 
536  const KalmanState *KFbase::mkState(const L1track3D &candidate,
537  unsigned nSkipped,
538  unsigned layer,
539  const KalmanState *last_state,
540  const TVectorD &vecX,
541  const TMatrixD &matC,
542  const TMatrixD &matK,
543  const TMatrixD &matV,
544  Stub *stub,
545  double chi2rphi,
546  double chi2rz) {
547  auto new_state = std::make_unique<const KalmanState>(
548  settings_, candidate, nSkipped, layer, last_state, vecX, matC, matK, matV, stub, chi2rphi, chi2rz);
549 
550  const KalmanState *p_new_state = new_state.get();
551  listAllStates_.push_back(std::move(new_state)); // Vector keeps ownership of all states.
552  return p_new_state;
553  }
554 
555  /* Product of H*C*H(transpose) (where C = helix covariance matrix) */
556 
557  TMatrixD KFbase::matrixHCHt(const TMatrixD &matH, const TMatrixD &matC) const {
558  TMatrixD matHtrans(TMatrixD::kTransposed, matH);
559  return matH * matC * matHtrans;
560  }
561 
562  /* Get inverted Kalman R matrix: inverse(V + HCHt) */
563 
564  TMatrixD KFbase::matrixRinv(const TMatrixD &matH, const TMatrixD &matCref, const TMatrixD &matV) const {
565  TMatrixD matHCHt = matrixHCHt(matH, matCref);
566  TMatrixD matR = matV + matHCHt;
567  TMatrixD matRinv(2, 2);
568  if (matR.Determinant() > 0) {
569  matRinv = TMatrixD(TMatrixD::kInverted, matR);
570  } else {
571  // Protection against rare maths instability.
572  const TMatrixD unitMatrix(TMatrixD::kUnit, TMatrixD(nHelixPar_, nHelixPar_));
573  const double big = 9.9e9;
574  matRinv = big * unitMatrix;
575  }
576  if (settings_->kalmanDebugLevel() >= 4) {
577  PrintL1trk() << "matHCHt";
578  matHCHt.Print();
579  PrintL1trk() << "matR";
580  matR.Print();
581  }
582  return matRinv;
583  }
584 
585  /* Determine Kalman gain matrix K */
586 
587  TMatrixD KFbase::getKalmanGainMatrix(const TMatrixD &matH, const TMatrixD &matCref, const TMatrixD &matRinv) const {
588  TMatrixD matHtrans(TMatrixD::kTransposed, matH);
589  TMatrixD matCrefht = matCref * matHtrans;
590  TMatrixD matK = matCrefht * matRinv;
591  return matK;
592  }
593 
594  /* Calculate stub residual w.r.t. helix */
595 
596  TVectorD KFbase::residual(const Stub *stub, const TVectorD &vecX, double candQoverPt) const {
597  TVectorD vd = vectorM(stub); // Get (phi relative to sector, z) of hit.
598  TMatrixD h = matrixH(stub);
599  TVectorD hx = h * vecX; // Get intercept of helix with layer (linear approx).
600  TVectorD delta = vd - hx;
601 
602  // Calculate higher order corrections to residuals.
603 
604  if (not settings_->kalmanHOfw()) {
605  TVectorD correction(2);
606 
607  float inv2R = (settings_->invPtToInvR()) * 0.5 * candQoverPt;
608  float tanL = vecX[T];
609  float z0 = vecX[Z0];
610 
611  float deltaS = 0.;
612  if (settings_->kalmanHOhelixExp()) {
613  // Higher order correction correction to circle expansion for improved accuracy at low Pt.
614  double corr = stub->r() * inv2R;
615 
616  // N.B. In endcap 2S, this correction to correction[0] is exactly cancelled by the deltaS-dependent correction to it below.
617  correction[0] += (1. / 6.) * pow(corr, 3);
618 
619  deltaS = (1. / 6.) * (stub->r()) * pow(corr, 2);
620  correction[1] -= deltaS * tanL;
621  }
622 
623  if ((not stub->barrel()) && not(stub->psModule())) {
624  // These corrections rely on inside --> outside tracking, so r-z track params in 2S modules known.
625  float rShift = (stub->z() - z0) / tanL - stub->r();
626 
628  rShift -= deltaS;
629 
630  if (settings_->kalmanHOprojZcorr() == 1) {
631  // Add correlation term related to conversion of stub residuals from (r,phi) to (z,phi).
632  correction[0] += inv2R * rShift;
633  }
634 
635  if (settings_->kalmanHOalpha() == 1) {
636  // Add alpha correction for non-radial 2S endcap strips..
637  correction[0] += stub->alpha() * rShift;
638  }
639  }
640 
641  // Apply correction to residuals.
642  delta += correction;
643  }
644 
645  delta[0] = reco::deltaPhi(delta[0], 0.);
646 
647  return delta;
648  }
649 
650  /* Update helix state & its covariance matrix with new stub */
651 
652  void KFbase::adjustState(const TMatrixD &matK,
653  const TMatrixD &matCref,
654  const TVectorD &vecXref,
655  const TMatrixD &matH,
656  const TVectorD &delta,
657  TVectorD &new_vecX,
658  TMatrixD &new_matC) const {
659  new_vecX = vecXref + matK * delta;
660  const TMatrixD unitMatrix(TMatrixD::kUnit, TMatrixD(nHelixPar_, nHelixPar_));
661  TMatrixD tmp = unitMatrix - matK * matH;
662  new_matC = tmp * matCref;
663  }
664 
665  /* Update track fit chi2 with new stub */
666 
668  const TMatrixD &matRinv,
669  const TVectorD &delta,
670  double &chi2rphi,
671  double &chi2rz) const {
672  // Change in chi2 (with r-phi/r-z correlation term included in r-phi component)
673  double delChi2rphi = delta[PHI] * delta[PHI] * matRinv[PHI][PHI] + 2 * delta[PHI] * delta[Z] * matRinv[PHI][Z];
674  double delChi2rz = delta[Z] * delta[Z] * matRinv[Z][Z];
675 
676  if (settings_->kalmanDebugLevel() >= 4) {
677  PrintL1trk() << "delta(chi2rphi)=" << delChi2rphi << " delta(chi2rz)= " << delChi2rz;
678  }
679  chi2rphi = state->chi2rphi() + delChi2rphi;
680  chi2rz = state->chi2rz() + delChi2rz;
681  return;
682  }
683 
684  /* Reset internal data ready for next track. */
685 
687 
688  /* Get Kalman layer mapping (i.e. layer order in which stubs should be processed) */
689 
690  unsigned int KFbase::kalmanLayer(
691  unsigned int iEtaReg, unsigned int layerIDreduced, bool barrel, float r, float z) const {
692  // index across is GP encoded layer ID (where barrel layers=1,2,7,5,4,3 & endcap wheels=3,4,5,6,7 & 0 never occurs)
693  // index down is eta reg
694  // element is kalman layer, where 7 is invalid
695 
696  // If stub with given GP encoded layer ID can have different KF layer ID depending on whether it
697  // is barrel or endcap, then in layerMap, the the barrel case is assumed.
698  // The endcap case is fixed by hand later in this function.
699 
700  const unsigned int nEta = 16;
701  const unsigned int nGPlayID = 7;
702 
703  if (nEta != numEtaRegions_)
704  throw cms::Exception("LogicError")
705  << "ERROR KFbase::getKalmanLayer hardwired value of nEta differs from NumEtaRegions cfg param";
706 
707  // In cases where identical GP encoded layer ID present in this sector from both barrel & endcap, this array filled considering barrel. The endcap is fixed by subsequent code.
708 
709  constexpr unsigned layerMap[nEta / 2][nGPlayID + 1] = {
710  {7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4 B5 B6 -- current FW
711  {7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4 B5 B6
712  {7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4 B5 B6
713  {7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4 B5 B6
714  {7, 0, 1, 5, 4, 3, 7, 2}, // B1 B2 B3 B4(/D3) B5(/D2) B6(/D1)
715  {7, 0, 1, 3, 4, 2, 6, 2}, // B1 B2 B3(/D5)+B4(/D3) D1 D2 X D4
716  {7, 0, 1, 1, 2, 3, 4, 5}, // B1 B2+D1 D2 D3 D5 D6
717  {7, 0, 7, 1, 2, 3, 4, 5}, // B1 D1 D2 D3 D4 D5
718  };
719 
720  unsigned int kfEtaReg; // KF VHDL eta sector def: small in barrel & large in endcap.
721  if (iEtaReg < numEtaRegions_ / 2) {
722  kfEtaReg = numEtaRegions_ / 2 - 1 - iEtaReg;
723  } else {
724  kfEtaReg = iEtaReg - numEtaRegions_ / 2;
725  }
726 
727  unsigned int kalmanLay = layerMap[kfEtaReg][layerIDreduced];
728 
729  // Fixes to layermap when "maybe layer" used
730  if (settings_->kfUseMaybeLayers()) {
731  switch (kfEtaReg) {
732  case 5: //case 5: B1 B2 (B3+B4)* D1 D2 D3+D4 D5+D6 -- B3 is combined with B4 and is flagged as "maybe layer"
733  if (layerIDreduced == 6) {
734  kalmanLay = 5;
735  }
736  break;
737  case 6: //case 6: B1* B2* D1 D2 D3 D4 D5 -- B1 and B2 are flagged as "maybe layer"
738  if (layerIDreduced > 2) {
739  kalmanLay++;
740  }
741  break;
742  default:
743  break;
744  }
745  }
746 
747  // Fixes to endcap stubs, for cases where identical GP encoded layer ID present in this sector from both barrel & endcap.
748 
749  if (not barrel) {
750  switch (kfEtaReg) {
751  case 4: // B1 B2 B3 B4 B5/D1 B6/D2 D3
752  if (layerIDreduced == 3) {
753  kalmanLay = 4;
754  } else if (layerIDreduced == 4) {
755  kalmanLay = 5;
756  } else if (layerIDreduced == 5) {
757  kalmanLay = 6;
758  }
759  break;
760  //case 5: // B1 B2 B3+B4 D1 D2 D3 D4/D5
761  case 5: // B1 B2 B3 D1+B4 D2 D3 D4/D5
762  if (layerIDreduced == 5) {
763  kalmanLay = 5;
764  } else if (layerIDreduced == 7) {
765  kalmanLay = 6;
766  }
767  break;
768  default:
769  break;
770  }
771  }
772 
773  /*
774  // Fix cases where a barrel layer only partially crosses the eta sector.
775  // (Logically should work, but actually reduces efficiency -- INVESTIGATE).
776 
777  const float barrelHalfLength = 120.;
778  const float barrel4Radius = 68.8;
779  const float barrel5Radius = 86.1;
780 
781  if ( not barrel) {
782  switch ( kfEtaReg ) {
783  case 4:
784  if (layerIDreduced==3) { // D1
785  float disk1_rCut = barrel5Radius*(std::abs(z)/barrelHalfLength);
786  if (r > disk1_rCut) kalmanLay++;
787  }
788  break;
789  case 5:
790  if (layerIDreduced==3) { // D1
791  float disk1_rCut = barrel4Radius*(std::abs(z)/barrelHalfLength);
792  if (r > disk1_rCut) kalmanLay++;
793  }
794  if (layerIDreduced==4) { // D2
795  float disk2_rCut = barrel4Radius*(std::abs(z)/barrelHalfLength);
796  if (r > disk2_rCut) kalmanLay++;
797  }
798  break;
799  default:
800  break;
801  }
802  }
803  */
804 
805  return kalmanLay;
806  }
807 
808  /*=== Check if particles in given eta sector are uncertain to go through the given KF layer. */
809  /*=== (If so, count layer for numbers of hit layers, but not for number of skipped layers). */
810 
811  bool KFbase::kalmanAmbiguousLayer(unsigned int iEtaReg, unsigned int kfLayer) {
812  // Only helps in extreme forward sector, and there not significantly.
813  // UNDERSTAND IF CAN BE USED ELSEWHERE.
814 
815  const unsigned int nEta = 16;
816  const unsigned int nKFlayer = 7;
817  constexpr bool ambiguityMap[nEta / 2][nKFlayer] = {
818  {false, false, false, false, false, false, false},
819  {false, false, false, false, false, false, false},
820  {false, false, false, false, false, false, false},
821  {false, false, false, false, false, false, false},
822  {false, false, false, false, false, false, false},
823  {false, false, true, false, false, false, false},
824  {true, true, false, false, false, false, false},
825  {true, false, false, false, false, false, false},
826  };
827 
828  unsigned int kfEtaReg; // KF VHDL eta sector def: small in barrel & large in endcap.
829  if (iEtaReg < numEtaRegions_ / 2) {
830  kfEtaReg = numEtaRegions_ / 2 - 1 - iEtaReg;
831  } else {
832  kfEtaReg = iEtaReg - numEtaRegions_ / 2;
833  }
834 
835  bool ambiguous = false;
836  if (settings_->kfUseMaybeLayers() and kfLayer < nKFlayer)
837  ambiguous = ambiguityMap[kfEtaReg][kfLayer];
838 
839  return ambiguous;
840  }
841 
842  /* Adjust KF algorithm to allow for any dead tracker layers */
843 
844  set<unsigned> KFbase::kalmanDeadLayers(bool &remove2PSCut) const {
845  // Kill scenarios described StubKiller.cc
846 
847  // By which Stress Test scenario (if any) are dead modules being emulated?
848  const StubKiller::KillOptions killScenario = static_cast<StubKiller::KillOptions>(settings_->killScenario());
849  // Should TMTT tracking be modified to reduce efficiency loss due to dead modules?
850  const bool killRecover = settings_->killRecover();
851 
852  set<pair<unsigned, bool>> deadGPlayers; // GP layer ID & boolean indicating if in barrel.
853 
854  // Range of sectors chosen to cover dead regions from StubKiller.
855  if (killRecover) {
856  if (killScenario == StubKiller::KillOptions::layer5) { // barrel layer 5
857  if (iEtaReg_ >= 3 && iEtaReg_ <= 7 && iPhiSec_ >= 1 && iPhiSec_ <= 5) {
858  deadGPlayers.insert(pair<unsigned, bool>(4, true));
859  }
860  } else if (killScenario == StubKiller::KillOptions::layer1) { // barrel layer 1
861  if (iEtaReg_ <= 7 && iPhiSec_ >= 1 && iPhiSec_ <= 5) {
862  deadGPlayers.insert(pair<unsigned, bool>(1, true));
863  }
864  remove2PSCut = true;
865  } else if (killScenario == StubKiller::KillOptions::layer1layer2) { // barrel layers 1 & 2
866  if (iEtaReg_ <= 7 && iPhiSec_ >= 1 && iPhiSec_ <= 5) {
867  deadGPlayers.insert(pair<unsigned, bool>(1, true));
868  }
869  if (iEtaReg_ >= 1 && iEtaReg_ <= 7 && iPhiSec_ >= 1 && iPhiSec_ <= 5) {
870  deadGPlayers.insert(pair<unsigned, bool>(2, true));
871  }
872  remove2PSCut = true;
873  } else if (killScenario == StubKiller::KillOptions::layer1disk1) { // barrel layer 1 & disk 1
874  if (iEtaReg_ <= 7 && iPhiSec_ >= 1 && iPhiSec_ <= 5) {
875  deadGPlayers.insert(pair<unsigned, bool>(1, true));
876  }
877  if (iEtaReg_ <= 3 && iPhiSec_ >= 1 && iPhiSec_ <= 5) {
878  deadGPlayers.insert(pair<unsigned, bool>(3, false));
879  }
880  remove2PSCut = true;
881  }
882  }
883 
884  set<unsigned> kfDeadLayers;
885  for (const auto &p : deadGPlayers) {
886  unsigned int layer = p.first;
887  bool barrel = p.second;
888  float r = 0.; // This fails for r-dependent parts of kalmanLayer(). FIX
889  float z = 999.;
890  unsigned int kalmanLay = this->kalmanLayer(iEtaReg_, layer, barrel, r, z);
891  kfDeadLayers.insert(kalmanLay);
892  }
893 
894  return kfDeadLayers;
895  }
896 
897  //=== Function to calculate approximation for tilted barrel modules (aka B) copied from Stub class.
898 
899  float KFbase::approxB(float z, float r) const {
901  }
902 
903  /* Print truth particle */
904 
905  void KFbase::printTP(const TP *tp) const {
906  TVectorD tpParams(5);
907  bool useForAlgEff(false);
908  if (tp) {
909  useForAlgEff = tp->useForAlgEff();
910  tpParams[QOVERPT] = tp->qOverPt();
911  tpParams[PHI0] = tp->phi0();
912  tpParams[Z0] = tp->z0();
913  tpParams[T] = tp->tanLambda();
914  tpParams[D0] = tp->d0();
915  }
916  std::stringstream text;
917  text << std::fixed << std::setprecision(4);
918  if (tp) {
919  text << " TP index = " << tp->index() << " useForAlgEff = " << useForAlgEff << " ";
920  const string helixNames[5] = {"qOverPt", "phi0", "z0", "tanL", "d0"};
921  for (int i = 0; i < tpParams.GetNrows(); i++) {
922  text << helixNames[i] << ":" << tpParams[i] << ", ";
923  }
924  text << " inv2R = " << tp->qOverPt() * settings_->invPtToInvR() * 0.5;
925  } else {
926  text << " Fake";
927  }
928  PrintL1trk() << text.str();
929  }
930 
931  /* Print tracker layers with stubs */
932 
933  void KFbase::printStubLayers(const vector<Stub *> &stubs, unsigned int iEtaReg) const {
934  std::stringstream text;
935  text << std::fixed << std::setprecision(4);
936  if (stubs.empty())
937  text << "stub layers = []\n";
938  else {
939  text << "stub layers = [ ";
940  for (unsigned i = 0; i < stubs.size(); i++) {
941  text << stubs[i]->layerId();
942  if (i != stubs.size() - 1)
943  text << ", ";
944  }
945  text << " ] ";
946  text << "KF stub layers = [ ";
947  for (unsigned j = 0; j < stubs.size(); j++) {
948  unsigned int kalmanLay =
949  this->kalmanLayer(iEtaReg, stubs[j]->layerIdReduced(), stubs[j]->barrel(), stubs[j]->r(), stubs[j]->z());
950  text << kalmanLay;
951  if (j != stubs.size() - 1)
952  text << ", ";
953  }
954  text << " ]\n";
955  }
956  PrintL1trk() << text.str();
957  }
958 
959  /* Print a stub */
960 
961  void KFbase::printStub(const Stub *stub) const {
962  std::stringstream text;
963  text << std::fixed << std::setprecision(4);
964  text << "stub ";
965  text << "index=" << stub->index() << " ";
966  text << "layerId=" << stub->layerId() << " ";
967  text << "r=" << stub->r() << " ";
968  text << "phi=" << stub->phi() << " ";
969  text << "z=" << stub->z() << " ";
970  text << "sigmaX=" << stub->sigmaPerp() << " ";
971  text << "sigmaZ=" << stub->sigmaPar() << " ";
972  text << "TPids=";
973  std::set<const TP *> tps = stub->assocTPs();
974  for (auto tp : tps)
975  text << tp->index() << ",";
976  PrintL1trk() << text.str();
977  }
978 
979  /* Print all stubs */
980 
981  void KFbase::printStubs(const vector<Stub *> &stubs) const {
982  for (auto &stub : stubs) {
983  printStub(stub);
984  }
985  }
986 
987 } // namespace tmtt
size
Write out results.
unsigned int kalmanMaxStubsPerLayer() const
Definition: Settings.h:322
unsigned int iEtaReg() const override
Definition: L1track3D.h:175
constexpr double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:26
bool kalmanHOhelixExp() const
Definition: Settings.h:331
unsigned int layerId() const
Definition: Stub.h:198
float phi0() const override
Definition: L1track3D.h:158
unsigned nextLayer() const
Definition: KalmanState.h:39
bool enableDigitize() const
Definition: Settings.h:80
float r() const
Definition: Stub.h:108
unsigned nSkippedLayers() const
Definition: KalmanState.h:43
unsigned int kalmanHOalpha() const
Definition: Settings.h:333
const Settings * settings() const
Definition: KalmanState.h:37
float qOverPt() const override
Definition: L1track3D.h:149
unsigned numEtaRegions_
Definition: KFbase.h:155
double bApprox_intercept() const
Definition: Settings.h:105
void printStubLayers(const std::vector< Stub *> &stubs, unsigned int iEtaReg) const
Definition: KFbase.cc:933
void adjustState(const TMatrixD &K, const TMatrixD &pxcov, const TVectorD &x, const TMatrixD &h, const TVectorD &delta, TVectorD &new_x, TMatrixD &new_xcov) const
Definition: KFbase.cc:652
void printTP(const TP *tp) const
Definition: KFbase.cc:905
virtual unsigned int kalmanLayer(unsigned int iEtaReg, unsigned int layerIDreduced, bool barrel, float r, float z) const
Definition: KFbase.cc:690
const TP * matchedTP() const override
Definition: L1track3D.h:186
float z0() const
Definition: L1track3D.h:159
void printStubs(const std::vector< Stub *> &stubs) const
Definition: KFbase.cc:981
unsigned int killScenario() const
Definition: Settings.h:343
L1fittedTrack fit(const L1track3D &l1track3D) override
Definition: KFbase.cc:38
float alpha() const
Definition: Stub.h:119
bool kalmanRemove2PScut() const
Definition: Settings.h:305
std::set< unsigned > kalmanDeadLayers(bool &remove2PSCut) const
Definition: KFbase.cc:844
float approxB(float z, float r) const
Definition: KFbase.cc:899
const std::vector< Stub * > & stubs() const override
Definition: L1track3D.h:95
float pt() const
Definition: L1track3D.h:153
unsigned int kalmanMaxStubsEasy() const
Definition: Settings.h:310
std::pair< unsigned int, unsigned int > cellLocationHT() const override
Definition: L1track3D.h:101
float z() const
Definition: Stub.h:109
unsigned int numEtaRegions() const
Definition: Settings.h:125
unsigned int iEtaReg_
Definition: KFbase.h:158
float tanLambda() const
Definition: L1track3D.h:160
virtual TVectorD trackParams(const KalmanState *state) const =0
bool killRecover() const
Definition: Settings.h:345
constexpr std::array< uint8_t, layerIndexSize > layer
unsigned int index() const
Definition: Stub.h:101
unsigned nStubLayers() const
Definition: KalmanState.h:65
unsigned kalmanDebugLevel() const
Definition: Settings.h:297
unsigned int iPhiSec() const override
Definition: L1track3D.h:174
const KalmanState * mkState(const L1track3D &candidate, unsigned nSkipped, unsigned layer, const KalmanState *last_state, const TVectorD &x, const TMatrixD &pxx, const TMatrixD &K, const TMatrixD &dcov, Stub *stub, double chi2rphi, double chi2rz)
Definition: KFbase.cc:536
Definition: TP.h:23
dictionary corr
virtual const KalmanState * kalmanUpdate(unsigned nSkipped, unsigned layer, Stub *stub, const KalmanState *state, const TP *tp)
Definition: KFbase.cc:416
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
bool kalmanAddBeamConstr() const
Definition: Settings.h:303
virtual bool kalmanAmbiguousLayer(unsigned int iEtaReg, unsigned int kfLayer)
Definition: KFbase.cc:811
virtual TMatrixD matrixV(const Stub *stub, const KalmanState *state) const =0
const TP * tpa_
Definition: KFbase.h:165
float sigmaPerp() const
Definition: Stub.h:189
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual TVectorD seedX(const L1track3D &l1track3D) const =0
const KalmanState * doKF(const L1track3D &l1track3D, const std::vector< Stub *> &stubs, const TP *tpa)
Definition: KFbase.cc:174
const Settings * settings_
void resetStates()
Definition: KFbase.cc:686
void printStub(const Stub *stub) const
Definition: KFbase.cc:961
double bApprox_gradient() const
Definition: Settings.h:104
bool barrel() const
Definition: Stub.h:201
unsigned int kalmanMinNumStubs() const
Definition: Settings.h:299
virtual TMatrixD seedC(const L1track3D &l1track3D) const =0
std::vector< DeviationSensor2D * > vd
unsigned int kalmanMaxSkipLayersEasy() const
Definition: Settings.h:308
virtual TMatrixD matrixH(const Stub *stub) const =0
TMatrixD matrixHCHt(const TMatrixD &h, const TMatrixD &c) const
Definition: KFbase.cc:557
float phi() const
Definition: Stub.h:107
virtual TVectorD trackParams_BeamConstr(const KalmanState *state, double &chi2rphi_bcon) const =0
virtual TVectorD residual(const Stub *stub, const TVectorD &x, double candQoverPt) const
Definition: KFbase.cc:596
unsigned int kalmanMaxNumStubs() const
Definition: Settings.h:301
static constexpr float d0
void setInfoKF(unsigned int nSkippedLayers, unsigned int numUpdateCalls)
TMatrixD matrixRinv(const TMatrixD &matH, const TMatrixD &matCref, const TMatrixD &matV) const
Definition: KFbase.cc:564
bool kalmanHOfw() const
Definition: Settings.h:337
TMatrixD getKalmanGainMatrix(const TMatrixD &h, const TMatrixD &pxcov, const TMatrixD &covRinv) const
Definition: KFbase.cc:587
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: Array2D.h:16
unsigned int kalmanMaxSkipLayersHard() const
Definition: Settings.h:307
const std::set< const TP * > & assocTPs() const
Definition: Stub.h:164
virtual bool isGoodState(const KalmanState &state) const =0
double b
Definition: hdecay.h:118
unsigned int numUpdateCalls_
Definition: KFbase.h:160
unsigned nHelixPar_
Definition: KFbase.h:153
double a
Definition: hdecay.h:119
Definition: big.h:8
bool hybrid() const
Definition: Settings.h:409
unsigned int numStubs() const override
Definition: L1track3D.h:97
unsigned int iPhiSec_
Definition: KFbase.h:157
unsigned int kalmanHOprojZcorr() const
Definition: Settings.h:335
unsigned int kalmanChi2RphiScale() const
Definition: Settings.h:326
float d0() const
Definition: L1track3D.h:157
virtual TVectorD vectorM(const Stub *stub) const =0
const std::vector< double > & kfLayerVsChiSq5() const
Definition: Settings.h:319
std::vector< std::unique_ptr< const KalmanState > > listAllStates_
Definition: KFbase.h:163
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
tmp
align.sh
Definition: createJobs.py:716
unsigned int hitPattern() const
Definition: KalmanState.h:66
float sigmaPar() const
Definition: Stub.h:191
bool psModule() const
Definition: Stub.h:196
virtual TMatrixD matrixF(const Stub *stub=nullptr, const KalmanState *state=nullptr) const =0
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
def move(src, dest)
Definition: eostools.py:511
bool kfUseMaybeLayers() const
Definition: Settings.h:312
virtual void adjustChi2(const KalmanState *state, const TMatrixD &covRinv, const TVectorD &delta, double &chi2rphi, double &chi2rz) const
Definition: KFbase.cc:667
double invPtToInvR() const
Definition: Settings.h:395