CMS 3D CMS Logo

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