CMS 3D CMS Logo

TrackletLUT.cc
Go to the documentation of this file.
6 
7 #include <filesystem>
8 
9 using namespace std;
10 using namespace trklet;
11 
12 TrackletLUT::TrackletLUT(const Settings& settings) : settings_(settings), setup_(settings.setup()) {}
13 
14 std::vector<const tt::SensorModule*> TrackletLUT::getSensorModules(
15  unsigned int layerdisk, bool isPS, std::array<double, 2> tan_range, unsigned int nzbins, unsigned int zbin) {
16  //Returns a vector of SensorModules using T. Schuh's Setup and SensorModule classes.
17  //Can be used 3 ways:
18  //Default: No specified tan_range or nzbins, returns all SensorModules in specified layerdisk (unique in |z|)
19  //tan_range: Returns modules in given tan range, where the min and max tan(theta) are measured from 0 -/+ z0 to account for displaced tracks
20  //zbins: Returns modules in specified z bin (2 zbins = (Flat, Tilted), 13 zbins = (Flat, TR1, ..., TR12). Only for tilted barrel
21 
22  bool use_tan_range = !(tan_range[0] == -1 and tan_range[1] == -1);
23  bool use_zbins = (nzbins > 1);
24 
25  bool barrel = layerdisk < N_LAYER;
26 
27  int layerId = barrel ? layerdisk + 1 : layerdisk + N_LAYER - 1;
28 
29  std::vector<const tt::SensorModule*> sensorModules;
30 
31  double z0 = settings_.z0cut();
32 
33  for (auto& sm : setup_->sensorModules()) {
34  if (sm.layerId() != layerId || sm.z() < 0 || sm.psModule() != isPS) {
35  continue;
36  }
37 
38  if (use_tan_range) {
39  const double term = (sm.numColumns() / 2 - 0.5) * sm.pitchCol();
40  double rmin = sm.r() - term * std::abs(sm.sinTilt());
41  double rmax = sm.r() + term * std::abs(sm.sinTilt());
42 
43  double zmin = std::abs(sm.z()) - term * std::abs(sm.cosTilt());
44  double zmax = std::abs(sm.z()) + term * std::abs(sm.cosTilt());
45 
46  //z0_max is swapped here so that the comparison down 5 lines is from same origin (+/- z0)
47  double mod_tan_max = tan_theta(rmin, zmax, z0, false);
48  double mod_tan_min = tan_theta(rmax, zmin, z0, true);
49 
50  if (mod_tan_max >= tan_range[0] && mod_tan_min <= tan_range[1]) {
51  sensorModules.push_back(&sm);
52  }
53  } else if (use_zbins) {
54  assert(layerdisk < 3);
55 
56  if (nzbins == 2) {
57  bool useFlat = (zbin == 0);
58  bool isFlat = (sm.tilt() == 0);
59 
60  if (useFlat and isFlat)
61  sensorModules.push_back(&sm);
62  else if (!useFlat and !isFlat)
63  sensorModules.push_back(&sm);
64  } else if (nzbins == 13) {
65  if (sm.ringId(setup_) == zbin)
66  sensorModules.push_back(&sm);
67  } else {
68  throw cms::Exception("Unspecified number of z bins");
69  }
70  } else {
71  sensorModules.push_back(&sm);
72  }
73  }
74 
75  //Remove Duplicate Modules
76  static constexpr double delta = 1.e-3;
77  auto smallerR = [](const tt::SensorModule* lhs, const tt::SensorModule* rhs) { return lhs->r() < rhs->r(); };
78  auto smallerZ = [](const tt::SensorModule* lhs, const tt::SensorModule* rhs) { return lhs->z() < rhs->z(); };
79  auto equalRZ = [](const tt::SensorModule* lhs, const tt::SensorModule* rhs) {
80  return abs(lhs->r() - rhs->r()) < delta && abs(lhs->z() - rhs->z()) < delta;
81  };
82  stable_sort(sensorModules.begin(), sensorModules.end(), smallerR);
83  stable_sort(sensorModules.begin(), sensorModules.end(), smallerZ);
84  sensorModules.erase(unique(sensorModules.begin(), sensorModules.end(), equalRZ), sensorModules.end());
85 
86  return sensorModules;
87 }
88 
89 std::array<double, 2> TrackletLUT::getTanRange(const std::vector<const tt::SensorModule*>& sensorModules) {
90  //Given a set of modules returns a range in tan(theta), the angle is measured in the r-z(+/-z0) plane from the r-axis
91 
92  std::array<double, 2> tan_range = {{2147483647, 0}}; //(tan_min, tan_max)
93 
94  double z0 = settings_.z0cut();
95 
96  for (auto sm : sensorModules) {
97  const double term = (sm->numColumns() / 2 - 0.5) * sm->pitchCol();
98  double rmin = sm->r() - term * std::abs(sm->sinTilt());
99  double rmax = sm->r() + term * std::abs(sm->sinTilt());
100 
101  double zmin = std::abs(sm->z()) - term * sm->cosTilt();
102  double zmax = std::abs(sm->z()) + term * sm->cosTilt();
103 
104  double mod_tan_max = tan_theta(rmin, zmax, z0, true); //(r, z, z0, bool z0_max), z0_max measures from +/- z0
105  double mod_tan_min = tan_theta(rmax, zmin, z0, false);
106 
107  if (mod_tan_min < tan_range[0])
108  tan_range[0] = mod_tan_min;
109  if (mod_tan_max > tan_range[1])
110  tan_range[1] = mod_tan_max;
111  }
112  return tan_range;
113 }
114 
115 std::vector<std::array<double, 2>> TrackletLUT::getBendCut(unsigned int layerdisk,
116  const std::vector<const tt::SensorModule*>& sensorModules,
117  bool isPS,
118  double FEbendcut) {
119  //Finds range of bendstrip for given SensorModules as a function of the encoded bend. Returns in format (mid, half_range).
120  //This uses the stub windows provided by T. Schuh's SensorModule class to determine the bend encoding. TODO test changes in stub windows
121  //Any other change to the bend encoding requires changes here, perhaps a function that given (FEbend, isPS, stub window) and outputs an encoded bend
122  //would be useful for consistency.
123 
124  unsigned int bendbits = isPS ? 3 : 4;
125 
126  std::vector<std::array<double, 2>> bendpars; // mid, cut
127  std::vector<std::array<double, 2>> bendminmax; // min, max
128 
129  //Initialize array
130  for (int i = 0; i < 1 << bendbits; i++) {
131  bendpars.push_back({{99, 0}});
132  bendminmax.push_back({{99, -99}});
133  }
134 
135  //Loop over modules
136  for (auto sm : sensorModules) {
137  int window = sm->windowSize(); //Half-strip units
138  const vector<double>& encodingBend = setup_->encodingBend(window, isPS);
139 
140  //Loop over FEbends
141  for (int ibend = 0; ibend <= 2 * window; ibend++) {
142  int FEbend = ibend - window; //Half-strip units
143  double BEbend = setup_->stubAlgorithm()->degradeBend(isPS, window, FEbend); //Full strip units
144 
145  const auto pos = std::find(encodingBend.begin(), encodingBend.end(), std::abs(BEbend));
146  int bend = std::signbit(BEbend) ? (1 << bendbits) - distance(encodingBend.begin(), pos)
147  : distance(encodingBend.begin(), pos); //Encoded bend
148 
149  double bendmin = FEbend / 2.0 - FEbendcut; //Full Strip units
150  double bendmax = FEbend / 2.0 + FEbendcut;
151 
152  //Convert to bendstrip, calculate at module edges (z min, r max) and (z max, r min)
153  double z_mod[2];
154  double r_mod[2];
155 
156  z_mod[0] = std::abs(sm->z()) + (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * sm->cosTilt(); //z max
157  z_mod[1] = std::abs(sm->z()) - (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * sm->cosTilt(); //z min
158 
159  r_mod[0] = sm->r() - (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * std::abs(sm->sinTilt()); //r min
160  r_mod[1] = sm->r() + (sm->numColumns() / 2 - 0.5) * sm->pitchCol() * std::abs(sm->sinTilt()); //r max
161 
162  for (int i = 0; i < 2; i++) { // 2 points to cover range in tan(theta) = z/r
163  double CF = std::abs(sm->sinTilt()) * (z_mod[i] / r_mod[i]) + sm->cosTilt();
164 
165  double cbendmin =
166  convertFEBend(bendmin, sm->sep(), settings_.sensorSpacing2S(), CF, (layerdisk < N_LAYER), r_mod[i]);
167  double cbendmax =
168  convertFEBend(bendmax, sm->sep(), settings_.sensorSpacing2S(), CF, (layerdisk < N_LAYER), r_mod[i]);
169 
170  if (cbendmin < bendminmax[bend][0])
171  bendminmax.at(bend)[0] = cbendmin;
172  if (cbendmax > bendminmax[bend][1])
173  bendminmax.at(bend)[1] = cbendmax;
174  }
175  }
176  }
177  //Convert min, max to mid, cut for ease of use
178  for (int i = 0; i < 1 << bendbits; i++) {
179  double mid = (bendminmax[i][1] + bendminmax[i][0]) / 2;
180  double cut = (bendminmax[i][1] - bendminmax[i][0]) / 2;
181 
182  bendpars[i][0] = mid;
183  bendpars[i][1] = cut;
184  }
185 
186  return bendpars;
187 }
188 
189 void TrackletLUT::initmatchcut(unsigned int layerdisk, MatchType type, unsigned int region) {
190  char cregion = 'A' + region;
191 
192  for (unsigned int iSeed = 0; iSeed < N_SEED; iSeed++) {
193  if (type == barrelphi) {
194  table_.push_back(settings_.rphimatchcut(iSeed, layerdisk) / (settings_.kphi1() * settings_.rmean(layerdisk)));
195  }
196  if (type == barrelz) {
197  table_.push_back(settings_.zmatchcut(iSeed, layerdisk) / settings_.kz());
198  }
199  if (type == diskPSphi) {
200  table_.push_back(settings_.rphicutPS(iSeed, layerdisk - N_LAYER) / (settings_.kphi() * settings_.kr()));
201  }
202  if (type == disk2Sphi) {
203  table_.push_back(settings_.rphicut2S(iSeed, layerdisk - N_LAYER) / (settings_.kphi() * settings_.kr()));
204  }
205  if (type == disk2Sr) {
206  table_.push_back(settings_.rcut2S(iSeed, layerdisk - N_LAYER) / settings_.krprojshiftdisk());
207  }
208  if (type == diskPSr) {
209  table_.push_back(settings_.rcutPS(iSeed, layerdisk - N_LAYER) / settings_.krprojshiftdisk());
210  }
211  }
212  if (type == alphainner) {
213  for (unsigned int i = 0; i < N_DSS_MOD * 2; i++) {
215  (1 << (settings_.nbitsalpha() - 1)) / (settings_.rDSSinner(i) * settings_.rDSSinner(i)) /
216  settings_.kphi());
217  }
218  }
219  if (type == alphaouter) {
220  for (unsigned int i = 0; i < N_DSS_MOD * 2; i++) {
222  (1 << (settings_.nbitsalpha() - 1)) / (settings_.rDSSouter(i) * settings_.rDSSouter(i)) /
223  settings_.kphi());
224  }
225  }
226  if (type == rSSinner) {
227  for (unsigned int i = 0; i < N_DSS_MOD * 2; i++) {
228  table_.push_back(settings_.rDSSinner(i) / settings_.kr());
229  }
230  }
231  if (type == rSSouter) {
232  for (unsigned int i = 0; i < N_DSS_MOD * 2; i++) {
233  table_.push_back(settings_.rDSSouter(i) / settings_.kr());
234  }
235  }
236 
237  name_ = settings_.combined() ? "MP_" : "MC_";
238 
239  if (type == barrelphi) {
240  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_phicut.tab";
241  }
242  if (type == barrelz) {
243  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_zcut.tab";
244  }
245  if (type == diskPSphi) {
246  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_PSphicut.tab";
247  }
248  if (type == disk2Sphi) {
249  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_2Sphicut.tab";
250  }
251  if (type == disk2Sr) {
252  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_2Srcut.tab";
253  }
254  if (type == diskPSr) {
255  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_PSrcut.tab";
256  }
257  if (type == alphainner) {
258  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_alphainner.tab";
259  }
260  if (type == alphaouter) {
261  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_alphaouter.tab";
262  }
263  if (type == rSSinner) {
264  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_rDSSinner.tab";
265  }
266  if (type == rSSouter) {
267  name_ += TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_rDSSouter.tab";
268  }
269 
270  positive_ = false;
271 
272  writeTable();
273 }
274 
275 void TrackletLUT::initTPlut(bool fillInner,
276  unsigned int iSeed,
277  unsigned int layerdisk1,
278  unsigned int layerdisk2,
279  unsigned int nbitsfinephidiff,
280  unsigned int iTP) {
281  //number of fine phi bins in sector
282  int nfinephibins = settings_.nallstubs(layerdisk2) * settings_.nvmte(1, iSeed) * (1 << settings_.nfinephi(1, iSeed));
283  double dfinephi = settings_.dphisectorHG() / nfinephibins;
284 
285  int outerrbits = 3;
286 
287  if (iSeed == Seed::L1L2 || iSeed == Seed::L2L3 || iSeed == Seed::L3L4 || iSeed == Seed::L5L6) {
288  outerrbits = 0;
289  }
290 
291  int outerrbins = (1 << outerrbits);
292 
293  double dphi[2];
294  double router[2];
295 
296  bool isPSinner;
297  bool isPSouter;
298 
299  if (iSeed == Seed::L3L4) {
300  isPSinner = true;
301  isPSouter = false;
302  } else if (iSeed == Seed::L5L6) {
303  isPSinner = false;
304  isPSouter = false;
305  } else {
306  isPSinner = true;
307  isPSouter = true;
308  }
309 
310  unsigned int nbendbitsinner = isPSinner ? N_BENDBITS_PS : N_BENDBITS_2S;
311  unsigned int nbendbitsouter = isPSouter ? N_BENDBITS_PS : N_BENDBITS_2S;
312 
313  double z0 = settings_.z0cut();
314 
315  int nbinsfinephidiff = (1 << nbitsfinephidiff);
316 
317  for (int iphibin = 0; iphibin < nbinsfinephidiff; iphibin++) {
318  int iphidiff = iphibin;
319  if (iphibin >= nbinsfinephidiff / 2) {
320  iphidiff = iphibin - nbinsfinephidiff;
321  }
322  //min and max dphi
323  //ramge of dphi to consider due to resolution
324  double deltaphi = 1.5;
325  dphi[0] = (iphidiff - deltaphi) * dfinephi;
326  dphi[1] = (iphidiff + deltaphi) * dfinephi;
327  for (int irouterbin = 0; irouterbin < outerrbins; irouterbin++) {
328  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4 || iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
329  router[0] =
330  settings_.rmindiskvm() + irouterbin * (settings_.rmaxdiskvm() - settings_.rmindiskvm()) / outerrbins;
331  router[1] =
332  settings_.rmindiskvm() + (irouterbin + 1) * (settings_.rmaxdiskvm() - settings_.rmindiskvm()) / outerrbins;
333  } else {
334  router[0] = settings_.rmean(layerdisk2);
335  router[1] = settings_.rmean(layerdisk2);
336  }
337 
338  //Determine bend cuts using geometry
339  std::vector<std::array<double, 2>> bend_cuts_inner;
340  std::vector<std::array<double, 2>> bend_cuts_outer;
341 
343  std::vector<const tt::SensorModule*> sminner;
344  std::vector<const tt::SensorModule*> smouter;
345 
346  if (iSeed == Seed::L1L2 || iSeed == Seed::L2L3 || iSeed == Seed::L3L4 || iSeed == Seed::L5L6) {
347  double outer_tan_max = tan_theta(settings_.rmean(layerdisk2), settings_.zlength(), z0, true);
348  std::array<double, 2> tan_range = {{0, outer_tan_max}};
349 
350  smouter = getSensorModules(layerdisk2, isPSouter, tan_range);
351  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
352 
353  } else if (iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
354  double outer_tan_min = tan_theta(router[1], settings_.zmindisk(layerdisk2 - N_LAYER), z0, false);
355  double outer_tan_max = tan_theta(router[0], settings_.zmaxdisk(layerdisk2 - N_LAYER), z0, true);
356 
357  smouter = getSensorModules(layerdisk2, isPSouter, {{outer_tan_min, outer_tan_max}});
358  std::array<double, 2> tan_range = getTanRange(smouter);
359  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
360 
361  } else { // D1D2 D3D4
362 
363  double outer_tan_min = tan_theta(router[1], settings_.zmindisk(layerdisk2 - N_LAYER), z0, false);
364  double outer_tan_max = tan_theta(router[0], settings_.zmaxdisk(layerdisk2 - N_LAYER), z0, true);
365 
366  smouter = getSensorModules(layerdisk2, isPSouter, {{outer_tan_min, outer_tan_max}});
367 
368  std::array<double, 2> tan_range = getTanRange(smouter);
369  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
370  }
371 
372  bend_cuts_inner = getBendCut(layerdisk1, sminner, isPSinner, settings_.bendcutTE(iSeed, true));
373  bend_cuts_outer = getBendCut(layerdisk2, smouter, isPSouter, settings_.bendcutTE(iSeed, false));
374 
375  } else {
376  for (int ibend = 0; ibend < (1 << nbendbitsinner); ibend++) {
377  double mid = settings_.benddecode(ibend, layerdisk1, isPSinner);
378  double cut = settings_.bendcutte(ibend, layerdisk1, isPSinner);
379  bend_cuts_inner.push_back({{mid, cut}});
380  }
381  for (int ibend = 0; ibend < (1 << nbendbitsouter); ibend++) {
382  double mid = settings_.benddecode(ibend, layerdisk2, isPSouter);
383  double cut = settings_.bendcutte(ibend, layerdisk2, isPSouter);
384  bend_cuts_outer.push_back({{mid, cut}});
385  }
386  }
387 
388  double bendinnermin = 20.0;
389  double bendinnermax = -20.0;
390  double bendoutermin = 20.0;
391  double bendoutermax = -20.0;
392  double rinvmin = 1.0;
393  double rinvmax = -1.0;
394  double absrinvmin = 1.0;
395 
396  for (int i2 = 0; i2 < 2; i2++) {
397  for (int i3 = 0; i3 < 2; i3++) {
398  double rinner = 0.0;
399  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4) {
400  rinner = router[i3] * settings_.zmean(layerdisk1 - N_LAYER) / settings_.zmean(layerdisk2 - N_LAYER);
401  } else {
402  rinner = settings_.rmean(layerdisk1);
403  }
405  if (rinner >= router[i3])
406  continue;
407  }
408  double rinv1 = (rinner < router[i3]) ? rinv(0.0, -dphi[i2], rinner, router[i3]) : 20.0;
409  double pitchinner = (rinner < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
410  double pitchouter =
411  (router[i3] < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
412  double abendinner = bendstrip(rinner, rinv1, pitchinner, settings_.sensorSpacing2S());
413  double abendouter = bendstrip(router[i3], rinv1, pitchouter, settings_.sensorSpacing2S());
414  if (abendinner < bendinnermin)
415  bendinnermin = abendinner;
416  if (abendinner > bendinnermax)
417  bendinnermax = abendinner;
418  if (abendouter < bendoutermin)
419  bendoutermin = abendouter;
420  if (abendouter > bendoutermax)
421  bendoutermax = abendouter;
422  if (std::abs(rinv1) < absrinvmin)
423  absrinvmin = std::abs(rinv1);
424  if (rinv1 > rinvmax)
425  rinvmax = rinv1;
426  if (rinv1 < rinvmin)
427  rinvmin = rinv1;
428  }
429  }
430 
431  bool passptcut;
432  double bendfac;
433  double rinvcutte = settings_.rinvcutte();
434 
436  double lowrinvcutte =
437  rinvcutte / 3; //Somewhat arbitrary value, allows for better acceptance in bins with low rinv (high pt)
438  passptcut = rinvmin < rinvcutte and rinvmax > -rinvcutte;
439  bendfac = (rinvmin < lowrinvcutte and rinvmax > -lowrinvcutte)
440  ? 1.05
441  : 1.0; //Somewhat arbirary value, bend cuts are 5% larger in bins with low rinv (high pt)
442  } else {
443  passptcut = absrinvmin < rinvcutte;
444  bendfac = 1.0;
445  }
446 
447  if (fillInner) {
448  for (int ibend = 0; ibend < (1 << nbendbitsinner); ibend++) {
449  double bendminfac = (isPSinner and (ibend == 2 or ibend == 3)) ? bendfac : 1.0;
450  double bendmaxfac = (isPSinner and (ibend == 6 or ibend == 5)) ? bendfac : 1.0;
451 
452  double mid = bend_cuts_inner.at(ibend)[0];
453  double cut = bend_cuts_inner.at(ibend)[1];
454 
455  bool passinner = mid + cut * bendmaxfac > bendinnermin && mid - cut * bendminfac < bendinnermax;
456 
457  table_.push_back(passinner && passptcut);
458  }
459  } else {
460  for (int ibend = 0; ibend < (1 << nbendbitsouter); ibend++) {
461  double bendminfac = (isPSouter and (ibend == 2 or ibend == 3)) ? bendfac : 1.0;
462  double bendmaxfac = (isPSouter and (ibend == 6 or ibend == 5)) ? bendfac : 1.0;
463 
464  double mid = bend_cuts_outer.at(ibend)[0];
465  double cut = bend_cuts_outer.at(ibend)[1];
466 
467  bool passouter = mid + cut * bendmaxfac > bendoutermin && mid - cut * bendminfac < bendoutermax;
468 
469  table_.push_back(passouter && passptcut);
470  }
471  }
472  }
473  }
474 
475  nbits_ = 8;
476 
477  positive_ = false;
478  char cTP = 'A' + iTP;
479 
480  name_ = "TP_" + TrackletConfigBuilder::LayerName(layerdisk1) + TrackletConfigBuilder::LayerName(layerdisk2) + cTP;
481 
482  if (fillInner) {
483  name_ += "_stubptinnercut.tab";
484  } else {
485  name_ += "_stubptoutercut.tab";
486  }
487 
488  writeTable();
489 }
490 
491 void TrackletLUT::initTPregionlut(unsigned int iSeed,
492  unsigned int layerdisk1,
493  unsigned int layerdisk2,
494  unsigned int iAllStub,
495  unsigned int nbitsfinephidiff,
496  unsigned int nbitsfinephi,
497  const TrackletLUT& tplutinner,
498  unsigned int iTP) {
499  int nirbits = 0;
500  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4 || iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
501  nirbits = 3;
502  }
503 
504  unsigned int nbendbitsinner = 3;
505 
506  if (iSeed == Seed::L5L6) {
507  nbendbitsinner = 4;
508  }
509 
510  for (int innerfinephi = 0; innerfinephi < (1 << nbitsfinephi); innerfinephi++) {
511  for (int innerbend = 0; innerbend < (1 << nbendbitsinner); innerbend++) {
512  for (int ir = 0; ir < (1 << nirbits); ir++) {
513  unsigned int usereg = 0;
514  for (unsigned int ireg = 0; ireg < settings_.nvmte(1, iSeed); ireg++) {
515  bool match = false;
516  for (int ifinephiouter = 0; ifinephiouter < (1 << settings_.nfinephi(1, iSeed)); ifinephiouter++) {
517  int outerfinephi = iAllStub * (1 << (nbitsfinephi - settings_.nbitsallstubs(layerdisk2))) +
518  ireg * (1 << settings_.nfinephi(1, iSeed)) + ifinephiouter;
519  int idphi = outerfinephi - innerfinephi;
520  bool inrange = (idphi < (1 << (nbitsfinephidiff - 1))) && (idphi >= -(1 << (nbitsfinephidiff - 1)));
521  if (idphi < 0)
522  idphi = idphi + (1 << nbitsfinephidiff);
523  int idphi1 = idphi;
524  if (iSeed >= 4)
525  idphi1 = (idphi << 3) + ir;
526  int ptinnerindexnew = (idphi1 << nbendbitsinner) + innerbend;
527  match = match || (inrange && tplutinner.lookup(ptinnerindexnew));
528  }
529  if (match) {
530  usereg = usereg | (1 << ireg);
531  }
532  }
533 
534  table_.push_back(usereg);
535  }
536  }
537  }
538 
539  positive_ = false;
540  char cTP = 'A' + iTP;
541 
542  name_ = "TP_" + TrackletConfigBuilder::LayerName(layerdisk1) + TrackletConfigBuilder::LayerName(layerdisk2) + cTP +
543  "_usereg.tab";
544 
545  writeTable();
546 }
547 
548 void TrackletLUT::initteptlut(bool fillInner,
549  bool fillTEMem,
550  unsigned int iSeed,
551  unsigned int layerdisk1,
552  unsigned int layerdisk2,
553  unsigned int innerphibits,
554  unsigned int outerphibits,
555  double innerphimin,
556  double innerphimax,
557  double outerphimin,
558  double outerphimax,
559  const std::string& innermem,
560  const std::string& outermem) {
561  int outerrbits = 0;
562  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4 || iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
563  outerrbits = 3;
564  }
565 
566  int outerrbins = (1 << outerrbits);
567  int innerphibins = (1 << innerphibits);
568  int outerphibins = (1 << outerphibits);
569 
570  double phiinner[2];
571  double phiouter[2];
572  double router[2];
573 
574  bool isPSinner;
575  bool isPSouter;
576 
577  if (iSeed == Seed::L3L4) {
578  isPSinner = true;
579  isPSouter = false;
580  } else if (iSeed == Seed::L5L6) {
581  isPSinner = false;
582  isPSouter = false;
583  } else {
584  isPSinner = true;
585  isPSouter = true;
586  }
587 
588  unsigned int nbendbitsinner = isPSinner ? N_BENDBITS_PS : N_BENDBITS_2S;
589  unsigned int nbendbitsouter = isPSouter ? N_BENDBITS_PS : N_BENDBITS_2S;
590 
591  if (fillTEMem) {
592  if (fillInner) {
593  table_.resize((1 << nbendbitsinner), false);
594  } else {
595  table_.resize((1 << nbendbitsouter), false);
596  }
597  }
598 
599  double z0 = settings_.z0cut();
600 
601  for (int irouterbin = 0; irouterbin < outerrbins; irouterbin++) {
602  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4 || iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
603  router[0] = settings_.rmindiskvm() + irouterbin * (settings_.rmaxdiskvm() - settings_.rmindiskvm()) / outerrbins;
604  router[1] =
605  settings_.rmindiskvm() + (irouterbin + 1) * (settings_.rmaxdiskvm() - settings_.rmindiskvm()) / outerrbins;
606  } else {
607  router[0] = settings_.rmean(layerdisk2);
608  router[1] = settings_.rmean(layerdisk2);
609  }
610 
611  //Determine bend cuts using geometry
612  std::vector<std::array<double, 2>> bend_cuts_inner;
613  std::vector<std::array<double, 2>> bend_cuts_outer;
614 
616  std::vector<const tt::SensorModule*> sminner;
617  std::vector<const tt::SensorModule*> smouter;
618 
619  if (iSeed == Seed::L1L2 || iSeed == Seed::L2L3 || iSeed == Seed::L3L4 || iSeed == Seed::L5L6) {
620  double outer_tan_max = tan_theta(settings_.rmean(layerdisk2), settings_.zlength(), z0, true);
621  std::array<double, 2> tan_range = {{0, outer_tan_max}};
622 
623  smouter = getSensorModules(layerdisk2, isPSouter, tan_range);
624  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
625 
626  } else if (iSeed == Seed::L1D1 || iSeed == Seed::L2D1) {
627  double outer_tan_min = tan_theta(router[1], settings_.zmindisk(layerdisk2 - N_LAYER), z0, false);
628  double outer_tan_max = tan_theta(router[0], settings_.zmaxdisk(layerdisk2 - N_LAYER), z0, true);
629 
630  smouter = getSensorModules(layerdisk2, isPSouter, {{outer_tan_min, outer_tan_max}});
631  std::array<double, 2> tan_range = getTanRange(smouter);
632  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
633 
634  } else { // D1D2 D3D4
635 
636  double outer_tan_min = tan_theta(router[1], settings_.zmindisk(layerdisk2 - N_LAYER), z0, false);
637  double outer_tan_max = tan_theta(router[0], settings_.zmaxdisk(layerdisk2 - N_LAYER), z0, true);
638 
639  smouter = getSensorModules(layerdisk2, isPSouter, {{outer_tan_min, outer_tan_max}});
640 
641  std::array<double, 2> tan_range = getTanRange(smouter);
642  sminner = getSensorModules(layerdisk1, isPSinner, tan_range);
643  }
644 
645  bend_cuts_inner = getBendCut(layerdisk1, sminner, isPSinner, settings_.bendcutTE(iSeed, true));
646  bend_cuts_outer = getBendCut(layerdisk2, smouter, isPSouter, settings_.bendcutTE(iSeed, false));
647 
648  } else {
649  for (int ibend = 0; ibend < (1 << nbendbitsinner); ibend++) {
650  double mid = settings_.benddecode(ibend, layerdisk1, nbendbitsinner == 3);
651  double cut = settings_.bendcutte(ibend, layerdisk1, nbendbitsinner == 3);
652  bend_cuts_inner.push_back({{mid, cut}});
653  }
654  for (int ibend = 0; ibend < (1 << nbendbitsouter); ibend++) {
655  double mid = settings_.benddecode(ibend, layerdisk2, nbendbitsouter == 3);
656  double cut = settings_.bendcutte(ibend, layerdisk2, nbendbitsouter == 3);
657  bend_cuts_outer.push_back({{mid, cut}});
658  }
659  }
660 
661  for (int iphiinnerbin = 0; iphiinnerbin < innerphibins; iphiinnerbin++) {
662  phiinner[0] = innerphimin + iphiinnerbin * (innerphimax - innerphimin) / innerphibins;
663  phiinner[1] = innerphimin + (iphiinnerbin + 1) * (innerphimax - innerphimin) / innerphibins;
664  for (int iphiouterbin = 0; iphiouterbin < outerphibins; iphiouterbin++) {
665  phiouter[0] = outerphimin + iphiouterbin * (outerphimax - outerphimin) / outerphibins;
666  phiouter[1] = outerphimin + (iphiouterbin + 1) * (outerphimax - outerphimin) / outerphibins;
667 
668  double bendinnermin = 20.0;
669  double bendinnermax = -20.0;
670  double bendoutermin = 20.0;
671  double bendoutermax = -20.0;
672  double rinvmin = 1.0;
673  double rinvmax = -1.0;
674  double absrinvmin = 1.0;
675 
676  for (int i1 = 0; i1 < 2; i1++) {
677  for (int i2 = 0; i2 < 2; i2++) {
678  for (int i3 = 0; i3 < 2; i3++) {
679  double rinner = 0.0;
680  if (iSeed == Seed::D1D2 || iSeed == Seed::D3D4) {
681  rinner = router[i3] * settings_.zmean(layerdisk1 - N_LAYER) / settings_.zmean(layerdisk2 - N_LAYER);
682  } else {
683  rinner = settings_.rmean(layerdisk1);
684  }
685 
687  if (rinner >= router[i3])
688  continue;
689  }
690 
691  double rinv1 = (rinner < router[i3]) ? -rinv(phiinner[i1], phiouter[i2], rinner, router[i3]) : -20.0;
692  double pitchinner =
693  (rinner < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
694  double pitchouter =
695  (router[i3] < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
696 
697  double abendinner = bendstrip(rinner, rinv1, pitchinner, settings_.sensorSpacing2S());
698  double abendouter = bendstrip(router[i3], rinv1, pitchouter, settings_.sensorSpacing2S());
699 
700  if (abendinner < bendinnermin)
701  bendinnermin = abendinner;
702  if (abendinner > bendinnermax)
703  bendinnermax = abendinner;
704  if (abendouter < bendoutermin)
705  bendoutermin = abendouter;
706  if (abendouter > bendoutermax)
707  bendoutermax = abendouter;
708  if (std::abs(rinv1) < absrinvmin)
709  absrinvmin = std::abs(rinv1);
710  if (rinv1 > rinvmax)
711  rinvmax = rinv1;
712  if (rinv1 < rinvmin)
713  rinvmin = rinv1;
714  }
715  }
716  }
717 
718  double lowrinvcutte = 0.002;
719 
720  bool passptcut;
721  double bendfac;
722 
724  passptcut = rinvmin < settings_.rinvcutte() and rinvmax > -settings_.rinvcutte();
725  bendfac = (rinvmin < lowrinvcutte and rinvmax > -lowrinvcutte) ? 1.05 : 1.0; // Better acceptance for high pt
726  } else {
727  passptcut = absrinvmin < settings_.rinvcutte();
728  bendfac = 1.0;
729  }
730 
731  if (fillInner) {
732  for (int ibend = 0; ibend < (1 << nbendbitsinner); ibend++) {
733  double bendminfac = (isPSinner and (ibend == 2 or ibend == 3)) ? bendfac : 1.0;
734  double bendmaxfac = (isPSinner and (ibend == 6 or ibend == 5)) ? bendfac : 1.0;
735 
736  double mid = bend_cuts_inner.at(ibend)[0];
737  double cut = bend_cuts_inner.at(ibend)[1];
738 
739  bool passinner = mid + cut * bendmaxfac > bendinnermin && mid - cut * bendminfac < bendinnermax;
740 
741  if (fillTEMem) {
742  if (passinner)
743  table_[ibend] = 1;
744  } else {
745  table_.push_back(passinner && passptcut);
746  }
747  }
748  } else {
749  for (int ibend = 0; ibend < (1 << nbendbitsouter); ibend++) {
750  double bendminfac = (isPSouter and (ibend == 2 or ibend == 3)) ? bendfac : 1.0;
751  double bendmaxfac = (isPSouter and (ibend == 6 or ibend == 5)) ? bendfac : 1.0;
752 
753  double mid = bend_cuts_outer.at(ibend)[0];
754  double cut = bend_cuts_outer.at(ibend)[1];
755 
756  bool passouter = mid + cut * bendmaxfac > bendoutermin && mid - cut * bendminfac < bendoutermax;
757 
758  if (fillTEMem) {
759  if (passouter)
760  table_[ibend] = 1;
761  } else {
762  table_.push_back(passouter && passptcut);
763  }
764  }
765  }
766  }
767  }
768  }
769 
770  positive_ = false;
771 
772  if (fillTEMem) {
773  if (fillInner) {
774  name_ = "VMSTE_" + innermem + "_vmbendcut.tab";
775  } else {
776  name_ = "VMSTE_" + outermem + "_vmbendcut.tab";
777  }
778  } else {
779  name_ = "TE_" + innermem.substr(0, innermem.size() - 2) + "_" + outermem.substr(0, outermem.size() - 2);
780  if (fillInner) {
781  name_ += "_stubptinnercut.tab";
782  } else {
783  name_ += "_stubptoutercut.tab";
784  }
785  }
786  writeTable();
787 }
788 
789 void TrackletLUT::initProjectionBend(double k_phider,
790  unsigned int idisk,
791  unsigned int nrbits,
792  unsigned int nphiderbits) {
793  unsigned int nsignbins = 2;
794  unsigned int nrbins = 1 << (nrbits);
795  unsigned int nphiderbins = 1 << (nphiderbits);
796 
797  for (unsigned int isignbin = 0; isignbin < nsignbins; isignbin++) {
798  for (unsigned int irbin = 0; irbin < nrbins; irbin++) {
799  int ir = irbin;
800  if (ir > (1 << (nrbits - 1)))
801  ir -= (1 << nrbits);
802  ir = ir << (settings_.nrbitsstub(N_LAYER) - nrbits);
803  for (unsigned int iphiderbin = 0; iphiderbin < nphiderbins; iphiderbin++) {
804  int iphider = iphiderbin;
805  if (iphider > (1 << (nphiderbits - 1)))
806  iphider -= (1 << nphiderbits);
807  iphider = iphider << (settings_.nbitsphiprojderL123() - nphiderbits);
808 
809  double rproj = ir * settings_.krprojshiftdisk();
810  double phider = iphider * k_phider;
811  double t = settings_.zmean(idisk) / rproj;
812 
813  if (isignbin)
814  t = -t;
815 
816  double rinv = -phider * (2.0 * t);
817 
818  double stripPitch = (rproj < settings_.rcrit()) ? settings_.stripPitch(true) : settings_.stripPitch(false);
819  double bendproj = bendstrip(rproj, rinv, stripPitch, settings_.sensorSpacing2S());
820 
821  constexpr double maxbend = (1 << NRINVBITS) - 1;
822 
823  int ibendproj = 2.0 * bendproj + 0.5 * maxbend;
824  if (ibendproj < 0)
825  ibendproj = 0;
826  if (ibendproj > maxbend)
827  ibendproj = maxbend;
828 
829  table_.push_back(ibendproj);
830  }
831  }
832  }
833 
834  positive_ = false;
835  name_ = settings_.combined() ? "MP_" : "PR_";
836  name_ += "ProjectionBend_" + TrackletConfigBuilder::LayerName(N_LAYER + idisk) + ".tab";
837 
838  writeTable();
839 }
840 
842  //When a projection to a disk is considered this offset and added and subtracted to calculate
843  //the bin the projection is pointing to. This is to account for resolution effects such that
844  //projections that are near a bin boundary will be assigned to both bins. The value (3 cm) should
845  //cover the uncertanty in the resolution.
846  double roffset = 3.0;
847 
848  for (unsigned int ir = 0; ir < (1u << nrbits); ir++) {
849  double r = ir * settings_.rmaxdisk() / (1u << nrbits);
850 
851  int rbin1 =
852  (1 << N_RZBITS) * (r - roffset - settings_.rmindiskvm()) / (settings_.rmaxdisk() - settings_.rmindiskvm());
853  int rbin2 =
854  (1 << N_RZBITS) * (r + roffset - settings_.rmindiskvm()) / (settings_.rmaxdisk() - settings_.rmindiskvm());
855 
856  if (rbin1 < 0) {
857  rbin1 = 0;
858  }
859  rbin2 = clamp(rbin2, 0, ((1 << N_RZBITS) - 1));
860 
861  assert(rbin1 <= rbin2);
862  assert(rbin2 - rbin1 <= 1);
863 
864  int d = rbin1 != rbin2;
865 
866  int finer =
867  (1 << (N_RZBITS + NFINERZBITS)) *
868  ((r - settings_.rmindiskvm()) - rbin1 * (settings_.rmaxdisk() - settings_.rmindiskvm()) / (1 << N_RZBITS)) /
870 
871  finer = clamp(finer, 0, ((1 << (NFINERZBITS + 1)) - 1));
872 
873  //Pack the data in a 8 bit word (ffffrrrd) where f is finer, r is rbin1, and d is difference
874  int N_DIFF_FLAG = 1; // Single bit for bool flag
875 
876  int word = (finer << (N_RZBITS + N_DIFF_FLAG)) + (rbin1 << N_DIFF_FLAG) + d;
877 
878  table_.push_back(word);
879  }
880 
881  //Size of the data word from above (8 bits)
882  nbits_ = NFINERZBITS + 1 + N_RZBITS + 1;
883  positive_ = true;
884  name_ = "ProjectionDiskRadius.tab";
885  writeTable();
886 }
887 
888 void TrackletLUT::initBendMatch(unsigned int layerdisk) {
889  unsigned int nrinv = NRINVBITS;
890  double rinvhalf = 0.5 * ((1 << nrinv) - 1);
891 
892  bool barrel = layerdisk < N_LAYER;
893 
894  if (barrel) {
895  bool isPSmodule = layerdisk < N_PSLAYER;
896  double stripPitch = settings_.stripPitch(isPSmodule);
897  unsigned int nbits = isPSmodule ? N_BENDBITS_PS : N_BENDBITS_2S;
898 
899  std::vector<std::array<double, 2>> bend_cuts;
900 
902  double bendcutFE = settings_.bendcutME(layerdisk, isPSmodule);
903  std::vector<const tt::SensorModule*> sm = getSensorModules(layerdisk, isPSmodule);
904  bend_cuts = getBendCut(layerdisk, sm, isPSmodule, bendcutFE);
905 
906  } else {
907  for (unsigned int ibend = 0; ibend < (1u << nbits); ibend++) {
908  double mid = settings_.benddecode(ibend, layerdisk, isPSmodule);
909  double cut = settings_.bendcutte(ibend, layerdisk, isPSmodule);
910  bend_cuts.push_back({{mid, cut}});
911  }
912  }
913 
914  for (unsigned int irinv = 0; irinv < (1u << nrinv); irinv++) {
915  double rinv = (irinv - rinvhalf) * (1 << (settings_.nbitsrinv() - nrinv)) * settings_.krinvpars();
916 
917  double projbend = bendstrip(settings_.rmean(layerdisk), rinv, stripPitch, settings_.sensorSpacing2S());
918  for (unsigned int ibend = 0; ibend < (1u << nbits); ibend++) {
919  double mid = bend_cuts[ibend][0];
920  double cut = bend_cuts[ibend][1];
921 
922  double pass = mid + cut > projbend && mid - cut < projbend;
923 
924  table_.push_back(pass);
925  }
926  }
927  } else {
928  std::vector<std::array<double, 2>> bend_cuts_2S;
929  std::vector<std::array<double, 2>> bend_cuts_PS;
930 
932  double bendcutFE2S = settings_.bendcutME(layerdisk, false);
933  std::vector<const tt::SensorModule*> sm2S = getSensorModules(layerdisk, false);
934  bend_cuts_2S = getBendCut(layerdisk, sm2S, false, bendcutFE2S);
935 
936  double bendcutFEPS = settings_.bendcutME(layerdisk, true);
937  std::vector<const tt::SensorModule*> smPS = getSensorModules(layerdisk, true);
938  bend_cuts_PS = getBendCut(layerdisk, smPS, true, bendcutFEPS);
939 
940  } else {
941  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_2S); ibend++) {
942  double mid = settings_.benddecode(ibend, layerdisk, false);
943  double cut = settings_.bendcutme(ibend, layerdisk, false);
944  bend_cuts_2S.push_back({{mid, cut}});
945  }
946  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_PS); ibend++) {
947  double mid = settings_.benddecode(ibend, layerdisk, true);
948  double cut = settings_.bendcutme(ibend, layerdisk, true);
949  bend_cuts_PS.push_back({{mid, cut}});
950  }
951  }
952 
953  for (unsigned int iprojbend = 0; iprojbend < (1u << nrinv); iprojbend++) {
954  double projbend = 0.5 * (iprojbend - rinvhalf);
955  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_2S); ibend++) {
956  double mid = bend_cuts_2S[ibend][0];
957  double cut = bend_cuts_2S[ibend][1];
958 
959  double pass = mid + cut > projbend && mid - cut < projbend;
960 
961  table_.push_back(pass);
962  }
963  }
964  for (unsigned int iprojbend = 0; iprojbend < (1u << nrinv); iprojbend++) { //Should this be binned in r?
965  double projbend = 0.5 * (iprojbend - rinvhalf);
966  for (unsigned int ibend = 0; ibend < (1 << N_BENDBITS_PS); ibend++) {
967  double mid = bend_cuts_PS[ibend][0];
968  double cut = bend_cuts_PS[ibend][1];
969 
970  double pass = mid + cut > projbend && mid - cut < projbend;
971 
972  table_.push_back(pass);
973  }
974  }
975  }
976 
977  positive_ = false;
978 
979  name_ = "METable_" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
980 
981  writeTable();
982 }
983 
984 void TrackletLUT::initVMRTable(unsigned int layerdisk, VMRTableType type, int region) {
985  unsigned int zbits = settings_.vmrlutzbits(layerdisk);
986  unsigned int rbits = settings_.vmrlutrbits(layerdisk);
987 
988  unsigned int rbins = (1 << rbits);
989  unsigned int zbins = (1 << zbits);
990 
991  double zmin, zmax, rmin, rmax;
992 
993  if (layerdisk < N_LAYER) {
994  zmin = -settings_.zlength();
995  zmax = settings_.zlength();
996  rmin = settings_.rmean(layerdisk) - settings_.drmax();
997  rmax = settings_.rmean(layerdisk) + settings_.drmax();
998  } else {
999  rmin = 0;
1000  rmax = settings_.rmaxdisk();
1001  zmin = settings_.zmean(layerdisk - N_LAYER) - settings_.dzmax();
1002  zmax = settings_.zmean(layerdisk - N_LAYER) + settings_.dzmax();
1003  }
1004 
1005  double dr = (rmax - rmin) / rbins;
1006  double dz = (zmax - zmin) / zbins;
1007 
1009 
1010  for (unsigned int izbin = 0; izbin < zbins; izbin++) {
1011  for (unsigned int irbin = 0; irbin < rbins; irbin++) {
1012  double r = rmin + (irbin + 0.5) * dr;
1013  double z = zmin + (izbin + 0.5) * dz;
1014 
1015  if (settings_.combined()) {
1016  int iznew = izbin - (1 << (zbits - 1));
1017  if (iznew < 0)
1018  iznew += (1 << zbits);
1019  assert(iznew >= 0);
1020  assert(iznew < (1 << zbits));
1021  z = zmin + (iznew + 0.5) * dz;
1022  if (layerdisk < N_LAYER) {
1023  int irnew = irbin - (1 << (rbits - 1));
1024  if (irnew < 0)
1025  irnew += (1 << rbits);
1026  assert(irnew >= 0);
1027  assert(irnew < (1 << rbits));
1028  r = rmin + (irnew + 0.5) * dr;
1029  }
1030  }
1031 
1032  unsigned int NRING =
1033  5; //number of 2S rings in disks. This is multiplied below by two since we have two halfs of a module
1034  if (layerdisk >= N_LAYER && irbin < 2 * NRING) //special case for the tabulated radii in 2S disks
1035  r = (layerdisk < N_LAYER + 2) ? settings_.rDSSinner(irbin) : settings_.rDSSouter(irbin);
1036 
1037  int bin;
1038  if (layerdisk < N_LAYER) {
1039  double zproj = z * settings_.rmean(layerdisk) / r;
1040  bin = NBINS * (zproj + settings_.zlength()) / (2 * settings_.zlength());
1041  } else {
1042  double rproj = r * settings_.zmean(layerdisk - N_LAYER) / z;
1043  bin = NBINS * (rproj - settings_.rmindiskvm()) / (settings_.rmaxdisk() - settings_.rmindiskvm());
1044  }
1045  if (bin < 0)
1046  bin = 0;
1047  if (bin >= NBINS)
1048  bin = NBINS - 1;
1049 
1050  if (type == VMRTableType::me) {
1051  table_.push_back(bin);
1052  }
1053 
1054  if (type == VMRTableType::disk) {
1055  if (layerdisk >= N_LAYER) {
1056  double rproj = r * settings_.zmean(layerdisk - N_LAYER) / z;
1057  bin = 0.5 * NBINS * (rproj - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
1058  //bin value of zero indicates that stub is out of range
1059  if (bin < 0)
1060  bin = 0;
1061  if (bin >= NBINS / 2)
1062  bin = 0;
1063  table_.push_back(bin);
1064  }
1065  }
1066 
1067  if (type == VMRTableType::inner) {
1068  if (layerdisk == LayerDisk::L1 || layerdisk == LayerDisk::L3 || layerdisk == LayerDisk::L5 ||
1069  layerdisk == LayerDisk::D1 || layerdisk == LayerDisk::D3) {
1070  table_.push_back(getVMRLookup(layerdisk + 1, z, r, dz, dr));
1071  }
1072  if (layerdisk == LayerDisk::L2) {
1073  table_.push_back(getVMRLookup(layerdisk + 1, z, r, dz, dr, Seed::L2L3));
1074  }
1075  }
1076 
1077  if (type == VMRTableType::inneroverlap) {
1078  if (layerdisk == LayerDisk::L1 || layerdisk == LayerDisk::L2) {
1079  table_.push_back(getVMRLookup(6, z, r, dz, dr, layerdisk + 6));
1080  }
1081  }
1082 
1083  if (type == VMRTableType::innerthird) {
1084  if (layerdisk == LayerDisk::L2) { //projection from L2 to D1 for L2L3D1 seeding
1085  table_.push_back(getVMRLookup(LayerDisk::D1, z, r, dz, dr, Seed::L2L3D1));
1086  }
1087 
1088  if (layerdisk == LayerDisk::L5) { //projection from L5 to L4 for L5L6L4 seeding
1089  table_.push_back(getVMRLookup(LayerDisk::L4, z, r, dz, dr));
1090  }
1091 
1092  if (layerdisk == LayerDisk::L3) { //projection from L3 to L5 for L3L4L2 seeding
1093  table_.push_back(getVMRLookup(LayerDisk::L2, z, r, dz, dr));
1094  }
1095 
1096  if (layerdisk == LayerDisk::D1) { //projection from D1 to L2 for D1D2L2 seeding
1097  table_.push_back(getVMRLookup(LayerDisk::L2, z, r, dz, dr));
1098  }
1099  }
1100  }
1101  }
1102 
1103  if (settings_.combined()) {
1104  if (type == VMRTableType::me) {
1105  nbits_ = 2 * settings_.NLONGVMBITS();
1106  positive_ = false;
1107  name_ = "VMRME_" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1108  }
1109  if (type == VMRTableType::disk) {
1110  nbits_ = 2 * settings_.NLONGVMBITS();
1111  positive_ = false;
1112  name_ = "VMRTE_" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1113  }
1114  if (type == VMRTableType::inner) {
1115  positive_ = true;
1116  nbits_ = 10;
1117  name_ = "TP_" + TrackletConfigBuilder::LayerName(layerdisk) + TrackletConfigBuilder::LayerName(layerdisk + 1) +
1118  ".tab";
1119  }
1120 
1121  if (type == VMRTableType::inneroverlap) {
1122  positive_ = true;
1123  nbits_ = 10;
1125  }
1126 
1127  } else {
1128  if (type == VMRTableType::me) {
1129  //This if a hack where the same memory is used in both ME and TE modules
1130  if (layerdisk == LayerDisk::L2 || layerdisk == LayerDisk::L3 || layerdisk == LayerDisk::L4 ||
1131  layerdisk == LayerDisk::L6) {
1132  positive_ = false;
1133  name_ = "VMTableOuter" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1134  writeTable();
1135  }
1136 
1137  assert(region >= 0);
1138  char cregion = 'A' + region;
1139  name_ = "VMR_" + TrackletConfigBuilder::LayerName(layerdisk) + "PHI" + cregion + "_finebin.tab";
1140  positive_ = false;
1141  }
1142 
1143  if (type == VMRTableType::inner) {
1144  positive_ = false;
1145  name_ = "VMTableInner" + TrackletConfigBuilder::LayerName(layerdisk) +
1146  TrackletConfigBuilder::LayerName(layerdisk + 1) + ".tab";
1147  }
1148 
1149  if (type == VMRTableType::inneroverlap) {
1150  positive_ = false;
1152  ".tab";
1153  }
1154 
1155  if (type == VMRTableType::disk) {
1156  positive_ = false;
1157  name_ = "VMTableOuter" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
1158  }
1159  }
1160 
1161  writeTable();
1162 }
1163 
1164 int TrackletLUT::getVMRLookup(unsigned int layerdisk, double z, double r, double dz, double dr, int iseed) const {
1165  double z0cut = settings_.z0cut();
1166 
1167  if (layerdisk < N_LAYER) {
1168  double constexpr zcutL2L3 = 52.0; //Stubs closer to IP in z will not be used for L2L3 seeds
1169  if (iseed == Seed::L2L3 && std::abs(z) < zcutL2L3)
1170  return -1;
1171 
1172  double rmean = settings_.rmean(layerdisk);
1173 
1174  double rratio1 = rmean / (r + 0.5 * dr);
1175  double rratio2 = rmean / (r - 0.5 * dr);
1176 
1177  double z1 = (z - 0.5 * dz) * rratio1 + z0cut * (rratio1 - 1.0);
1178  double z2 = (z + 0.5 * dz) * rratio1 + z0cut * (rratio1 - 1.0);
1179  double z3 = (z - 0.5 * dz) * rratio2 + z0cut * (rratio2 - 1.0);
1180  double z4 = (z + 0.5 * dz) * rratio2 + z0cut * (rratio2 - 1.0);
1181  double z5 = (z - 0.5 * dz) * rratio1 - z0cut * (rratio1 - 1.0);
1182  double z6 = (z + 0.5 * dz) * rratio1 - z0cut * (rratio1 - 1.0);
1183  double z7 = (z - 0.5 * dz) * rratio2 - z0cut * (rratio2 - 1.0);
1184  double z8 = (z + 0.5 * dz) * rratio2 - z0cut * (rratio2 - 1.0);
1185 
1186  double zmin = std::min({z1, z2, z3, z4, z5, z6, z7, z8});
1187  double zmax = std::max({z1, z2, z3, z4, z5, z6, z7, z8});
1188 
1190 
1191  int zbin1 = NBINS * (zmin + settings_.zlength()) / (2 * settings_.zlength());
1192  int zbin2 = NBINS * (zmax + settings_.zlength()) / (2 * settings_.zlength());
1193 
1194  if (zbin1 >= NBINS)
1195  return -1;
1196  if (zbin2 < 0)
1197  return -1;
1198 
1199  if (zbin2 >= NBINS)
1200  zbin2 = NBINS - 1;
1201  if (zbin1 < 0)
1202  zbin1 = 0;
1203 
1204  // This is a 10 bit word:
1205  // xxx|yyy|z|rrr
1206  // xxx is the delta z window
1207  // yyy is the z bin
1208  // z is flag to look in next bin
1209  // rrr first fine z bin
1210  // NOTE : this encoding is not efficient z is one if xxx+rrr is greater than 8
1211  // and xxx is only 1,2, or 3
1212  // should also reject xxx=0 as this means projection is outside range
1213 
1214  int value = zbin1 / 8;
1215  value *= 2;
1216  if (zbin2 / 8 - zbin1 / 8 > 0)
1217  value += 1;
1218  value *= 8;
1219  value += (zbin1 & 7);
1220  assert(value / 8 < 15);
1221  int deltaz = zbin2 - zbin1;
1222  if (deltaz > 7) {
1223  deltaz = 7;
1224  }
1225  assert(deltaz < 8);
1226  value += (deltaz << 7);
1227 
1228  return value;
1229 
1230  } else {
1231  if (std::abs(z) < 2.0 * z0cut)
1232  return -1;
1233 
1234  double zmean = settings_.zmean(layerdisk - N_LAYER);
1235  if (z < 0.0)
1236  zmean = -zmean;
1237 
1238  double r1 = (r + 0.5 * dr) * (zmean + z0cut) / (z + 0.5 * dz + z0cut);
1239  double r2 = (r - 0.5 * dr) * (zmean - z0cut) / (z + 0.5 * dz - z0cut);
1240  double r3 = (r + 0.5 * dr) * (zmean + z0cut) / (z - 0.5 * dz + z0cut);
1241  double r4 = (r - 0.5 * dr) * (zmean - z0cut) / (z - 0.5 * dz - z0cut);
1242  double r5 = (r + 0.5 * dr) * (zmean - z0cut) / (z + 0.5 * dz - z0cut);
1243  double r6 = (r - 0.5 * dr) * (zmean + z0cut) / (z + 0.5 * dz + z0cut);
1244  double r7 = (r + 0.5 * dr) * (zmean - z0cut) / (z - 0.5 * dz - z0cut);
1245  double r8 = (r - 0.5 * dr) * (zmean + z0cut) / (z - 0.5 * dz + z0cut);
1246 
1247  double rmin = std::min({r1, r2, r3, r4, r5, r6, r7, r8});
1248  double rmax = std::max({r1, r2, r3, r4, r5, r6, r7, r8});
1249 
1251 
1252  double rmindisk = settings_.rmindiskvm();
1253  double rmaxdisk = settings_.rmaxdiskvm();
1254 
1255  if (iseed == Seed::L1D1)
1256  rmaxdisk = settings_.rmaxdiskl1overlapvm();
1257  if (iseed == Seed::L2D1)
1258  rmindisk = settings_.rmindiskl2overlapvm();
1259  if (iseed == Seed::L2L3D1)
1260  rmaxdisk = settings_.rmaxdisk();
1261 
1262  if (rmin > rmaxdisk)
1263  return -1;
1264  if (rmax > rmaxdisk)
1265  rmax = rmaxdisk;
1266 
1267  if (rmax < rmindisk)
1268  return -1;
1269  if (rmin < rmindisk)
1270  rmin = rmindisk;
1271 
1272  int rbin1 = NBINS * (rmin - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
1273  int rbin2 = NBINS * (rmax - settings_.rmindiskvm()) / (settings_.rmaxdiskvm() - settings_.rmindiskvm());
1274 
1275  if (iseed == Seed::L2L3D1) {
1276  constexpr double rminspec = 40.0;
1277  rbin1 = NBINS * (rmin - rminspec) / (settings_.rmaxdisk() - rminspec);
1278  rbin2 = NBINS * (rmax - rminspec) / (settings_.rmaxdisk() - rminspec);
1279  }
1280 
1281  if (rbin2 >= NBINS)
1282  rbin2 = NBINS - 1;
1283  if (rbin1 < 0)
1284  rbin1 = 0;
1285 
1286  // This is a 9 bit word:
1287  // xxx|yy|z|rrr
1288  // xxx is the delta r window
1289  // yy is the r bin yy is three bits for overlaps
1290  // z is flag to look in next bin
1291  // rrr fine r bin
1292  // NOTE : this encoding is not efficient z is one if xxx+rrr is greater than 8
1293  // and xxx is only 1,2, or 3
1294  // should also reject xxx=0 as this means projection is outside range
1295 
1296  bool overlap = iseed == Seed::L1D1 || iseed == Seed::L2D1 || iseed == Seed::L2L3D1;
1297 
1298  int value = rbin1 / 8;
1299  if (overlap) {
1300  if (z < 0.0)
1301  value += 4;
1302  }
1303  value *= 2;
1304  if (rbin2 / 8 - rbin1 / 8 > 0)
1305  value += 1;
1306  value *= 8;
1307  value += (rbin1 & 7);
1308  assert(value / 8 < 15);
1309  int deltar = rbin2 - rbin1;
1310  if (deltar > 7)
1311  deltar = 7;
1312  if (overlap) {
1313  value += (deltar << 7);
1314  } else {
1315  value += (deltar << 6);
1316  }
1317 
1318  return value;
1319  }
1320 }
1321 
1322 void TrackletLUT::initPhiCorrTable(unsigned int layerdisk, unsigned int rbits) {
1323  bool psmodule = layerdisk < N_PSLAYER;
1324 
1325  unsigned int bendbits = psmodule ? N_BENDBITS_PS : N_BENDBITS_2S;
1326 
1327  unsigned int rbins = (1 << rbits);
1328 
1329  double rmean = settings_.rmean(layerdisk);
1330  double drmax = settings_.drmax();
1331 
1332  double dr = 2.0 * drmax / rbins;
1333 
1334  std::vector<std::array<double, 2>> bend_vals;
1335 
1336  if (settings_.useCalcBendCuts) {
1337  std::vector<const tt::SensorModule*> sm = getSensorModules(layerdisk, psmodule);
1338  bend_vals = getBendCut(layerdisk, sm, psmodule);
1339 
1340  } else {
1341  for (int ibend = 0; ibend < 1 << bendbits; ibend++) {
1342  bend_vals.push_back({{settings_.benddecode(ibend, layerdisk, layerdisk < N_PSLAYER), 0}});
1343  }
1344  }
1345 
1346  for (int ibend = 0; ibend < 1 << bendbits; ibend++) {
1347  for (unsigned int irbin = 0; irbin < rbins; irbin++) {
1348  double bend = -bend_vals[ibend][0];
1349  int value = getphiCorrValue(layerdisk, bend, irbin, rmean, dr, drmax);
1350  table_.push_back(value);
1351  }
1352  }
1353 
1354  name_ = "VMPhiCorrL" + std::to_string(layerdisk + 1) + ".tab";
1355  nbits_ = 14;
1356  positive_ = false;
1357 
1358  writeTable();
1359 }
1360 
1362  unsigned int layerdisk, double bend, unsigned int irbin, double rmean, double dr, double drmax) const {
1363  bool psmodule = layerdisk < N_PSLAYER;
1364 
1365  //for the rbin - calculate the distance to the nominal layer radius
1366  double Delta = (irbin + 0.5) * dr - drmax;
1367 
1368  //calculate the phi correction - this is a somewhat approximate formula
1369  double drnom = 0.18; //This is the nominal module separation for which bend is referenced
1370  double dphi = (Delta / drnom) * bend * settings_.stripPitch(psmodule) / rmean;
1371 
1372  double kphi = psmodule ? settings_.kphi() : settings_.kphi1();
1373 
1374  int idphi = dphi / kphi;
1375 
1376  return idphi;
1377 }
1378 
1379 // Write LUT table.
1381  if (!settings_.writeTable()) {
1382  return;
1383  }
1384 
1385  if (name_.empty()) {
1386  return;
1387  }
1388 
1389  ofstream out = openfile(settings_.tablePath(), name_, __FILE__, __LINE__);
1390 
1391  out << "{" << endl;
1392  for (unsigned int i = 0; i < table_.size(); i++) {
1393  if (i != 0) {
1394  out << "," << endl;
1395  }
1396 
1397  int itable = table_[i];
1398  if (positive_) {
1399  if (table_[i] < 0) {
1400  itable = (1 << nbits_) - 1;
1401  }
1402  }
1403 
1404  out << itable;
1405  }
1406  out << endl << "};" << endl;
1407  out.close();
1408 
1409  string name = name_;
1410 
1411  name[name_.size() - 3] = 'd';
1412  name[name_.size() - 2] = 'a';
1413  name[name_.size() - 1] = 't';
1414 
1415  out = openfile(settings_.tablePath(), name, __FILE__, __LINE__);
1416 
1417  int width = (nbits_ + 3) / 4;
1418 
1419  for (unsigned int i = 0; i < table_.size(); i++) {
1420  int itable = table_[i];
1421  if (positive_) {
1422  if (table_[i] < 0) {
1423  itable = (1 << nbits_) - 1;
1424  }
1425  }
1426 
1427  out << uppercase << setfill('0') << setw(width) << hex << itable << dec << endl;
1428  }
1429 
1430  out.close();
1431 }
1432 
1433 int TrackletLUT::lookup(unsigned int index) const {
1434  assert(index < table_.size());
1435  return table_[index];
1436 }
double rphicutPS(unsigned int iSeed, unsigned int idisk) const
Definition: Settings.h:166
unsigned int vmrlutrbits(unsigned int layerdisk) const
Definition: Settings.h:189
void initBendMatch(unsigned int layerdisk)
Definition: TrackletLUT.cc:888
constexpr unsigned int N_RZBITS
Definition: Settings.h:39
double kz() const
Definition: Settings.h:336
double sensorSpacing2S() const
Definition: Settings.h:286
double zmatchcut(unsigned int iSeed, unsigned int ilayer) const
Definition: Settings.h:165
double bendcutME(unsigned int layerdisk, bool isPSmodule) const
Definition: Settings.h:483
unsigned int nrbitsstub(unsigned int layerdisk) const
Definition: Settings.h:91
bool writeTable() const
Definition: Settings.h:199
double kphi1() const
Definition: Settings.h:333
unsigned int NLONGVMBITS() const
Definition: Settings.h:362
void initmatchcut(unsigned int layerdisk, MatchType type, unsigned int region)
Definition: TrackletLUT.cc:189
double rDSSinner(unsigned int iBin) const
Definition: Settings.h:181
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:437
constexpr unsigned int NRINVBITS
Definition: Settings.h:36
constexpr unsigned int N_SEED
Definition: Settings.h:28
bool combined() const
Definition: Settings.h:268
void initProjectionBend(double k_phider, unsigned int idisk, unsigned int nrbits, unsigned int nphiderbits)
Definition: TrackletLUT.cc:789
void initteptlut(bool fillInner, bool fillTEMem, unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int innerphibits, unsigned int outerphibits, double innerphimin, double innerphimax, double outerphimin, double outerphimax, const std::string &innermem, const std::string &outermem)
Definition: TrackletLUT.cc:548
double dphisectorHG() const
Definition: Settings.h:314
const Settings & settings_
Definition: TrackletLUT.h:120
static std::string LayerName(unsigned int ilayer)
double zlength() const
Definition: Settings.h:131
constexpr unsigned int N_BENDBITS_2S
Definition: Settings.h:34
int lookup(unsigned int index) const
double rmindiskvm() const
Definition: Settings.h:349
double rphimatchcut(unsigned int iSeed, unsigned int ilayer) const
Definition: Settings.h:164
double krinvpars() const
Definition: Settings.h:419
double dzmax() const
Definition: Settings.h:136
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
constexpr unsigned int N_DSS_MOD
Definition: Settings.h:31
assert(be >=bs)
int getphiCorrValue(unsigned int layerdisk, double bend, unsigned int irbin, double rmean, double dr, double drmax) const
static std::string to_string(const XMLCh *ch)
constexpr unsigned int N_BENDBITS_PS
Definition: Settings.h:33
const std::vector< double > & encodingBend(int windowSize, bool psModule) const
Definition: Setup.cc:373
bool useCalcBendCuts
Definition: Settings.h:473
void initPhiCorrTable(unsigned int layerdisk, unsigned int rbits)
std::array< double, 2 > getTanRange(const std::vector< const tt::SensorModule *> &sensorModules)
Definition: TrackletLUT.cc:89
unsigned int NLONGVMBINS() const
Definition: Settings.h:363
std::string tablePath() const
Definition: Settings.h:203
double rmindiskl2overlapvm() const
Definition: Settings.h:353
uint64_t word
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:113
std::string name_
Definition: TrackletLUT.h:142
double half2SmoduleWidth() const
Definition: Settings.h:138
double rmean(unsigned int iLayer) const
Definition: Settings.h:171
double rDSSouter(unsigned int iBin) const
Definition: Settings.h:184
const std::vector< SensorModule > & sensorModules() const
Definition: Setup.h:126
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
def unique(seq, keepstr=True)
Definition: tier0.py:24
Divides< A, C > D1
Definition: Factorize.h:136
int nbitsrinv() const
Definition: Settings.h:368
double stripPitch(bool isPSmodule) const
Definition: Settings.h:282
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double bendcutme(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:467
float degradeBend(bool psModule, int window, int bend) const
double r() const
Definition: SensorModule.h:45
def window(xmin, xmax, ymin, ymax, x=0, y=0, width=100, height=100, xlogbase=None, ylogbase=None, minusInfinity=-1000, flipx=False, flipy=True)
Definition: svgfig.py:643
int alphashift() const
Definition: Settings.h:226
Definition: value.py:1
double convertFEBend(double FEbend, double sensorSep, double sensorSpacing, double CF, bool barrel, double r=0)
Definition: Util.h:48
double bendcutte(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:465
d
Definition: ztail.py:151
double zmean(unsigned int iDisk) const
Definition: Settings.h:174
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:108
constexpr unsigned int NFINERZBITS
Definition: Settings.h:37
double tan_theta(double r, double z, double z0, bool z0_max)
Definition: Util.h:54
unsigned int nallstubs(unsigned int layerdisk) const
Definition: Settings.h:114
double rcut2S(unsigned int iSeed, unsigned int idisk) const
Definition: Settings.h:169
constexpr unsigned int N_PSLAYER
Definition: Settings.h:27
double kr() const
Definition: Settings.h:338
double drmax() const
Definition: Settings.h:135
double z0cut() const
Definition: Settings.h:358
int iseed
Definition: AMPTWrapper.h:134
double rmaxdisk() const
Definition: Settings.h:132
double rphicut2S(unsigned int iSeed, unsigned int idisk) const
Definition: Settings.h:168
Definition: deltar.py:1
const StubAlgorithmOfficial * stubAlgorithm() const
Definition: Setup.h:516
double rcutPS(unsigned int iSeed, unsigned int idisk) const
Definition: Settings.h:167
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:66
void initTPlut(bool fillInner, unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int nbitsfinephidiff, unsigned int iTP)
Definition: TrackletLUT.cc:275
double z() const
Definition: SensorModule.h:49
unsigned int nbits_
Definition: TrackletLUT.h:146
int nfinephi(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:140
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:94
void initTPregionlut(unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int iAllStub, unsigned int nbitsfinephidiff, unsigned int nbitsfinephi, const TrackletLUT &tplutinner, unsigned int iTP)
Definition: TrackletLUT.cc:491
std::vector< std::array< double, 2 > > getBendCut(unsigned int layerdisk, const std::vector< const tt::SensorModule *> &sensorModules, bool isPS, double FEbendcut=0)
Definition: TrackletLUT.cc:115
double rmaxdiskvm() const
Definition: Settings.h:350
int getVMRLookup(unsigned int layerdisk, double z, double r, double dz, double dr, int iseed=-1) const
int nbitsalpha() const
Definition: Settings.h:227
double rinvcutte() const
Definition: Settings.h:347
double zmaxdisk(unsigned int iDisk) const
Definition: Settings.h:179
std::vector< int > table_
Definition: TrackletLUT.h:144
double krprojshiftdisk() const
Definition: Settings.h:435
void initProjectionDiskRadius(int nrbits)
Definition: TrackletLUT.cc:841
std::vector< const tt::SensorModule * > getSensorModules(unsigned int layerdisk, bool isPS, std::array< double, 2 > tan_range={{-1, -1}}, unsigned int nzbins=1, unsigned int zbin=0)
Definition: TrackletLUT.cc:14
double kphi() const
Definition: Settings.h:332
const tt::Setup * setup_
Definition: TrackletLUT.h:121
void initVMRTable(unsigned int layerdisk, VMRTableType type, int region=-1)
Definition: TrackletLUT.cc:984
const int NBINS
void writeTable() const
double bendstrip(double r, double rinv, double stripPitch, double sensorSpacing)
Definition: Util.h:42
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)
Definition: Util.h:154
double zmindisk(unsigned int iDisk) const
Definition: Settings.h:178
unsigned int vmrlutzbits(unsigned int layerdisk) const
Definition: Settings.h:188
double bendcutTE(unsigned int seed, bool inner) const
Definition: Settings.h:475
constexpr int N_LAYER
Definition: Settings.h:25
double rmaxdiskl1overlapvm() const
Definition: Settings.h:352
double rcrit() const
Definition: Settings.h:321