CMS 3D CMS Logo

TrackletCalculatorDisplaced.cc
Go to the documentation of this file.
8 
12 
13 using namespace std;
14 using namespace trklet;
15 
16 TrackletCalculatorDisplaced::TrackletCalculatorDisplaced(string name,
17  Settings const& settings,
18  Globals* global,
19  unsigned int iSector)
20  : ProcessBase(name, settings, global, iSector) {
21  for (unsigned int ilayer = 0; ilayer < N_LAYER; ilayer++) {
22  vector<TrackletProjectionsMemory*> tmp(settings.nallstubs(ilayer), nullptr);
23  trackletprojlayers_.push_back(tmp);
24  }
25 
26  for (unsigned int idisk = 0; idisk < N_DISK; idisk++) {
27  vector<TrackletProjectionsMemory*> tmp(settings.nallstubs(idisk + N_LAYER), nullptr);
28  trackletprojdisks_.push_back(tmp);
29  }
30 
31  layer_ = 0;
32  disk_ = 0;
33 
34  string name1 = name.substr(1); //this is to correct for "TCD" having one more letter then "TC"
35  if (name1[3] == 'L')
36  layer_ = name1[4] - '0';
37  if (name1[3] == 'D')
38  disk_ = name1[4] - '0';
39 
40  // set TC index
41  int iSeed = -1;
42 
43  int iTC = name1[9] - 'A';
44 
45  if (name1.substr(3, 6) == "L3L4L2")
46  iSeed = 8;
47  else if (name1.substr(3, 6) == "L5L6L4")
48  iSeed = 9;
49  else if (name1.substr(3, 6) == "L2L3D1")
50  iSeed = 10;
51  else if (name1.substr(3, 6) == "D1D2L2")
52  iSeed = 11;
53 
54  assert(iSeed != -1);
55 
56  TCIndex_ = (iSeed << 4) + iTC;
57  assert(TCIndex_ >= 128 && TCIndex_ < 191);
58 
59  assert((layer_ != 0) || (disk_ != 0));
60 
61  toR_.clear();
62  toZ_.clear();
63 
64  if (iSeed == 8 || iSeed == 9) {
65  if (layer_ == 3) {
66  rproj_[0] = settings_.rmean(0);
67  rproj_[1] = settings_.rmean(4);
68  rproj_[2] = settings_.rmean(5);
69  lproj_[0] = 1;
70  lproj_[1] = 5;
71  lproj_[2] = 6;
72 
73  dproj_[0] = 1;
74  dproj_[1] = 2;
75  dproj_[2] = 0;
76  toZ_.push_back(settings_.zmean(0));
77  toZ_.push_back(settings_.zmean(1));
78  }
79  if (layer_ == 5) {
80  rproj_[0] = settings_.rmean(0);
81  rproj_[1] = settings_.rmean(1);
82  rproj_[2] = settings_.rmean(2);
83  lproj_[0] = 1;
84  lproj_[1] = 2;
85  lproj_[2] = 3;
86 
87  dproj_[0] = 0;
88  dproj_[1] = 0;
89  dproj_[2] = 0;
90  }
91  for (unsigned int i = 0; i < N_LAYER - 3; ++i)
92  toR_.push_back(rproj_[i]);
93  }
94 
95  if (iSeed == 10 || iSeed == 11) {
96  if (layer_ == 2) {
97  rproj_[0] = settings_.rmean(0);
98  lproj_[0] = 1;
99  lproj_[1] = -1;
100  lproj_[2] = -1;
101 
102  zproj_[0] = settings_.zmean(1);
103  zproj_[1] = settings_.zmean(2);
104  zproj_[2] = settings_.zmean(3);
105  dproj_[0] = 2;
106  dproj_[1] = 3;
107  dproj_[2] = 4;
108  }
109  if (disk_ == 1) {
110  rproj_[0] = settings_.rmean(0);
111  lproj_[0] = 1;
112  lproj_[1] = -1;
113  lproj_[2] = -1;
114 
115  zproj_[0] = settings_.zmean(2);
116  zproj_[1] = settings_.zmean(3);
117  zproj_[2] = settings_.zmean(4);
118  dproj_[0] = 3;
119  dproj_[1] = 4;
120  dproj_[2] = 5;
121  }
122  toR_.push_back(settings_.rmean(0));
123  for (unsigned int i = 0; i < N_DISK - 2; ++i)
124  toZ_.push_back(zproj_[i]);
125  }
126 }
127 
129  outputProj = dynamic_cast<TrackletProjectionsMemory*>(memory);
130  assert(outputProj != nullptr);
131 }
132 
134  if (settings_.writetrace()) {
135  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
136  << output;
137  }
138  if (output == "trackpar") {
139  auto* tmp = dynamic_cast<TrackletParametersMemory*>(memory);
140  assert(tmp != nullptr);
141  trackletpars_ = tmp;
142  return;
143  }
144 
145  if (output.substr(0, 7) == "projout") {
146  //output is on the form 'projoutL2PHIC' or 'projoutD3PHIB'
147  auto* tmp = dynamic_cast<TrackletProjectionsMemory*>(memory);
148  assert(tmp != nullptr);
149 
150  unsigned int layerdisk = output[8] - '1'; //layer or disk counting from 0
151  unsigned int phiregion = output[12] - 'A'; //phiregion counting from 0
152 
153  if (output[7] == 'L') {
154  assert(layerdisk < N_LAYER);
155  assert(phiregion < trackletprojlayers_[layerdisk].size());
156  //check that phiregion not already initialized
157  assert(trackletprojlayers_[layerdisk][phiregion] == nullptr);
158  trackletprojlayers_[layerdisk][phiregion] = tmp;
159  return;
160  }
161 
162  if (output[7] == 'D') {
163  assert(layerdisk < N_DISK);
164  assert(phiregion < trackletprojdisks_[layerdisk].size());
165  //check that phiregion not already initialized
166  assert(trackletprojdisks_[layerdisk][phiregion] == nullptr);
167  trackletprojdisks_[layerdisk][phiregion] = tmp;
168  return;
169  }
170  }
171 
172  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find output : " << output;
173 }
174 
176  if (settings_.writetrace()) {
177  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
178  << input;
179  }
180  if (input == "thirdallstubin") {
181  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
182  assert(tmp != nullptr);
183  innerallstubs_.push_back(tmp);
184  return;
185  }
186  if (input == "firstallstubin") {
187  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
188  assert(tmp != nullptr);
189  middleallstubs_.push_back(tmp);
190  return;
191  }
192  if (input == "secondallstubin") {
193  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
194  assert(tmp != nullptr);
195  outerallstubs_.push_back(tmp);
196  return;
197  }
198  if (input.find("stubtriplet") == 0) {
199  auto* tmp = dynamic_cast<StubTripletsMemory*>(memory);
200  assert(tmp != nullptr);
201  stubtriplets_.push_back(tmp);
202  return;
203  }
204  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find input : " << input;
205 }
206 
208  unsigned int countall = 0;
209  unsigned int countsel = 0;
210 
211  for (auto& stubtriplet : stubtriplets_) {
213  edm::LogVerbatim("Tracklet") << "Will break on too many tracklets in " << getName();
214  break;
215  }
216  for (unsigned int i = 0; i < stubtriplet->nStubTriplets(); i++) {
217  countall++;
218 
219  const Stub* innerFPGAStub = stubtriplet->getFPGAStub1(i);
220  const L1TStub* innerStub = innerFPGAStub->l1tstub();
221 
222  const Stub* middleFPGAStub = stubtriplet->getFPGAStub2(i);
223  const L1TStub* middleStub = middleFPGAStub->l1tstub();
224 
225  const Stub* outerFPGAStub = stubtriplet->getFPGAStub3(i);
226  const L1TStub* outerStub = outerFPGAStub->l1tstub();
227 
228  if (settings_.debugTracklet()) {
229  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute " << getName() << "[" << iSector_ << "]";
230  }
231 
232  if (innerFPGAStub->isBarrel() && middleFPGAStub->isBarrel() && outerFPGAStub->isBarrel()) {
233  //barrel+barrel seeding
234  bool accept = LLLSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
235  if (accept)
236  countsel++;
237  } else if (innerFPGAStub->isDisk() && middleFPGAStub->isDisk() && outerFPGAStub->isDisk()) {
238  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " Invalid seeding!";
239  } else {
240  //layer+disk seeding
241  if (innerFPGAStub->isBarrel() && middleFPGAStub->isDisk() && outerFPGAStub->isDisk()) { //D1D2L2
242  bool accept = DDLSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
243  if (accept)
244  countsel++;
245  } else if (innerFPGAStub->isDisk() && middleFPGAStub->isBarrel() && outerFPGAStub->isBarrel()) { //L2L3D1
246  bool accept = LLDSeeding(innerFPGAStub, innerStub, middleFPGAStub, middleStub, outerFPGAStub, outerStub);
247  if (accept)
248  countsel++;
249  } else {
250  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " Invalid seeding!";
251  }
252  }
253 
255  edm::LogVerbatim("Tracklet") << "Will break on number of tracklets in " << getName();
256  break;
257  }
258 
259  if (countall >= settings_.maxStep("TC")) {
260  if (settings_.debugTracklet())
261  edm::LogVerbatim("Tracklet") << "Will break on MAXTC 1";
262  break;
263  }
264  if (settings_.debugTracklet()) {
265  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute done";
266  }
267  }
268  if (countall >= settings_.maxStep("TC")) {
269  if (settings_.debugTracklet())
270  edm::LogVerbatim("Tracklet") << "Will break on MAXTC 2";
271  break;
272  }
273  }
274 
275  if (settings_.writeMonitorData("TPD")) {
276  globals_->ofstream("trackletcalculatordisplaced.txt") << getName() << " " << countall << " " << countsel << endl;
277  }
278 }
279 
281  FPGAWord fpgar = tracklet->fpgarprojdisk(disk);
282 
283  if (fpgar.value() * settings_.krprojshiftdisk() < settings_.rmindiskvm())
284  return;
285  if (fpgar.value() * settings_.krprojshiftdisk() > settings_.rmaxdisk())
286  return;
287 
288  FPGAWord fpgaphi = tracklet->fpgaphiprojdisk(disk);
289 
290  int iphivmRaw = fpgaphi.value() >> (fpgaphi.nbits() - 5);
291  int iphi = iphivmRaw / (32 / settings_.nallstubs(abs(disk) + N_DISK));
292 
293  addProjectionDisk(disk, iphi, trackletprojdisks_[abs(disk) - 1][iphi], tracklet);
294 }
295 
297  assert(layer > 0);
298 
299  FPGAWord fpgaz = tracklet->fpgazproj(layer);
300  FPGAWord fpgaphi = tracklet->fpgaphiproj(layer);
301 
302  if (fpgaz.atExtreme())
303  return false;
304 
305  if (std::abs(fpgaz.value() * settings_.kz()) > settings_.zlength())
306  return false;
307 
308  int iphivmRaw = fpgaphi.value() >> (fpgaphi.nbits() - 5);
309  int iphi = iphivmRaw / (32 / settings_.nallstubs(layer - 1));
310 
311  addProjection(layer, iphi, trackletprojlayers_[layer - 1][iphi], tracklet);
312 
313  return true;
314 }
315 
317  int iphi,
318  TrackletProjectionsMemory* trackletprojs,
319  Tracklet* tracklet) {
320  if (trackletprojs == nullptr) {
321  if (settings_.warnNoMem()) {
322  edm::LogVerbatim("Tracklet") << "No projection memory exists in " << getName() << " for layer = " << layer
323  << " iphi = " << iphi + 1;
324  }
325  return;
326  }
327  assert(trackletprojs != nullptr);
328  trackletprojs->addProj(tracklet);
329 }
330 
332  int iphi,
333  TrackletProjectionsMemory* trackletprojs,
334  Tracklet* tracklet) {
335  if (trackletprojs == nullptr) {
336  if (layer_ == 3 && abs(disk) == 3)
337  return; //L3L4 projections to D3 are not used.
338  if (settings_.warnNoMem()) {
339  edm::LogVerbatim("Tracklet") << "No projection memory exists in " << getName() << " for disk = " << abs(disk)
340  << " iphi = " << iphi + 1;
341  }
342  return;
343  }
344  assert(trackletprojs != nullptr);
345  if (settings_.debugTracklet()) {
346  edm::LogVerbatim("Tracklet") << getName() << " adding projection to " << trackletprojs->getName();
347  }
348  trackletprojs->addProj(tracklet);
349 }
350 
352  const L1TStub* innerStub,
353  const Stub* middleFPGAStub,
354  const L1TStub* middleStub,
355  const Stub* outerFPGAStub,
356  const L1TStub* outerStub) {
357  if (settings_.debugTracklet()) {
358  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName() << " " << layer_
359  << " trying stub triplet in layer (L L L): " << innerFPGAStub->layer().value() << " "
360  << middleFPGAStub->layer().value() << " " << outerFPGAStub->layer().value();
361  }
362 
363  assert(outerFPGAStub->isBarrel());
364 
365  double r1 = innerStub->r();
366  double z1 = innerStub->z();
367  double phi1 = innerStub->phi();
368 
369  double r2 = middleStub->r();
370  double z2 = middleStub->z();
371  double phi2 = middleStub->phi();
372 
373  double r3 = outerStub->r();
374  double z3 = outerStub->z();
375  double phi3 = outerStub->phi();
376 
377  int take3 = 0;
378  if (layer_ == 5)
379  take3 = 1;
380 
381  double rinv, phi0, d0, t, z0;
382 
383  LayerProjection layerprojs[N_LAYER - 2];
384  DiskProjection diskprojs[N_DISK];
385 
386  double phiproj[N_LAYER - 2], zproj[N_LAYER - 2], phider[N_LAYER - 2], zder[N_LAYER - 2];
387  double phiprojdisk[N_DISK], rprojdisk[N_DISK], phiderdisk[N_DISK], rderdisk[N_DISK];
388 
390  z1,
391  phi1,
392  r2,
393  z2,
394  phi2,
395  r3,
396  z3,
397  phi3,
398  take3,
399  rinv,
400  phi0,
401  d0,
402  t,
403  z0,
404  phiproj,
405  zproj,
406  phiprojdisk,
407  rprojdisk,
408  phider,
409  zder,
410  phiderdisk,
411  rderdisk);
412 
413  if (settings_.useapprox()) {
414  phi1 = innerFPGAStub->phiapprox(phimin_, phimax_);
415  z1 = innerFPGAStub->zapprox();
416  r1 = innerFPGAStub->rapprox();
417 
418  phi2 = outerFPGAStub->phiapprox(phimin_, phimax_);
419  z2 = outerFPGAStub->zapprox();
420  r2 = outerFPGAStub->rapprox();
421  }
422 
423  double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
424  double phiprojapprox[N_LAYER - 2], zprojapprox[N_LAYER - 2], phiderapprox[N_LAYER - 2], zderapprox[N_LAYER - 2];
425  double phiprojdiskapprox[N_DISK], rprojdiskapprox[N_DISK];
426  double phiderdiskapprox[N_DISK], rderdiskapprox[N_DISK];
427 
428  //TODO: implement the actual integer calculation
429 
430  //store the approcximate results
431  rinvapprox = rinv;
432  phi0approx = phi0;
433  d0approx = d0;
434  tapprox = t;
435  z0approx = z0;
436 
437  for (unsigned int i = 0; i < toR_.size(); ++i) {
438  phiprojapprox[i] = phiproj[i];
439  zprojapprox[i] = zproj[i];
440  phiderapprox[i] = phider[i];
441  zderapprox[i] = zder[i];
442  }
443 
444  for (unsigned int i = 0; i < toZ_.size(); ++i) {
445  phiprojdiskapprox[i] = phiprojdisk[i];
446  rprojdiskapprox[i] = rprojdisk[i];
447  phiderdiskapprox[i] = phiderdisk[i];
448  rderdiskapprox[i] = rderdisk[i];
449  }
450 
451  //now binary
452  double krinv = settings_.kphi1() / settings_.kr() * pow(2, settings_.rinv_shift()),
453  kphi0 = settings_.kphi1() * pow(2, settings_.phi0_shift()),
454  kt = settings_.kz() / settings_.kr() * pow(2, settings_.t_shift()),
455  kz0 = settings_.kz() * pow(2, settings_.z0_shift()),
456  kphiproj = settings_.kphi1() * pow(2, settings_.SS_phiL_shift()),
457  kphider = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderL_shift()),
458  kzproj = settings_.kz() * pow(2, settings_.PS_zL_shift()),
459  kzder = settings_.kz() / settings_.kr() * pow(2, settings_.PS_zderL_shift()),
460  kphiprojdisk = settings_.kphi1() * pow(2, settings_.SS_phiD_shift()),
461  kphiderdisk = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderD_shift()),
462  krprojdisk = settings_.kr() * pow(2, settings_.PS_rD_shift()),
463  krderdisk = settings_.kr() / settings_.kz() * pow(2, settings_.PS_rderD_shift());
464 
465  int irinv, iphi0, id0, it, iz0;
466  int iphiproj[N_LAYER - 2], izproj[N_LAYER - 2], iphider[N_LAYER - 2], izder[N_LAYER - 2];
467  int iphiprojdisk[N_DISK], irprojdisk[N_DISK], iphiderdisk[N_DISK], irderdisk[N_DISK];
468 
469  //store the binary results
470  irinv = rinvapprox / krinv;
471  iphi0 = phi0approx / kphi0;
472  id0 = d0approx / settings_.kd0();
473  it = tapprox / kt;
474  iz0 = z0approx / kz0;
475 
476  bool success = true;
477  if (std::abs(rinvapprox) > settings_.rinvcut()) {
478  if (settings_.debugTracklet())
479  edm::LogVerbatim("Tracklet") << "TrackletCalculator::LLL Seeding irinv too large: " << rinvapprox << "(" << irinv
480  << ")";
481  success = false;
482  }
483  if (std::abs(z0approx) > 1.8 * settings_.z0cut()) {
484  if (settings_.debugTracklet())
485  edm::LogVerbatim("Tracklet") << "Failed tracklet z0 cut " << z0approx << " in layer " << layer_;
486  success = false;
487  }
488  if (std::abs(d0approx) > settings_.maxd0()) {
489  if (settings_.debugTracklet())
490  edm::LogVerbatim("Tracklet") << "Failed tracklet d0 cut " << d0approx;
491  success = false;
492  }
493 
494  if (!success)
495  return false;
496 
497  double phicritapprox = phi0approx - asin(0.5 * settings_.rcrit() * rinvapprox);
498  int phicrit = iphi0 - 2 * irinv;
499 
500  int iphicritmincut = settings_.phicritminmc() / globals_->ITC_L1L2()->phi0_final.K();
501  int iphicritmaxcut = settings_.phicritmaxmc() / globals_->ITC_L1L2()->phi0_final.K();
502 
503  bool keepapprox = (phicritapprox > settings_.phicritminmc()) && (phicritapprox < settings_.phicritmaxmc()),
504  keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
505 
506  if (settings_.debugTracklet())
507  if (keep && !keepapprox)
508  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced::LLLSeeding tracklet kept with exact phicrit cut "
509  "but not approximate, phicritapprox: "
510  << phicritapprox;
511  if (settings_.usephicritapprox()) {
512  if (!keepapprox)
513  return false;
514  } else {
515  if (!keep)
516  return false;
517  }
518 
519  for (unsigned int i = 0; i < toR_.size(); ++i) {
520  iphiproj[i] = phiprojapprox[i] / kphiproj;
521  izproj[i] = zprojapprox[i] / kzproj;
522 
523  iphider[i] = phiderapprox[i] / kphider;
524  izder[i] = zderapprox[i] / kzder;
525 
526  //check that z projection is in range
527  if (izproj[i] < -(1 << (settings_.nzbitsstub(0) - 1)))
528  continue;
529  if (izproj[i] >= (1 << (settings_.nzbitsstub(0) - 1)))
530  continue;
531 
532  //check that phi projection is in range
533  if (iphiproj[i] >= (1 << settings_.nphibitsstub(N_LAYER - 1)) - 1)
534  continue;
535  if (iphiproj[i] <= 0)
536  continue;
537 
538  //adjust number of bits for phi and z projection
539  if (rproj_[i] < settings_.rPS2S()) {
540  iphiproj[i] >>= (settings_.nphibitsstub(N_LAYER - 1) - settings_.nphibitsstub(0));
541  if (iphiproj[i] >= (1 << settings_.nphibitsstub(0)) - 1)
542  iphiproj[i] = (1 << settings_.nphibitsstub(0)) - 2; //-2 not to hit atExtreme
543  } else {
544  izproj[i] >>= (settings_.nzbitsstub(0) - settings_.nzbitsstub(N_LAYER - 1));
545  }
546 
547  if (rproj_[i] < settings_.rPS2S()) {
548  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL123() - 1))) {
549  iphider[i] = -(1 << (settings_.nbitsphiprojderL123() - 1));
550  }
551  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL123() - 1))) {
552  iphider[i] = (1 << (settings_.nbitsphiprojderL123() - 1)) - 1;
553  }
554  } else {
555  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL456() - 1))) {
556  iphider[i] = -(1 << (settings_.nbitsphiprojderL456() - 1));
557  }
558  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL456() - 1))) {
559  iphider[i] = (1 << (settings_.nbitsphiprojderL456() - 1)) - 1;
560  }
561  }
562 
563  layerprojs[i].init(settings_,
564  lproj_[i],
565  rproj_[i],
566  iphiproj[i],
567  izproj[i],
568  iphider[i],
569  izder[i],
570  phiproj[i],
571  zproj[i],
572  phider[i],
573  zder[i],
574  phiprojapprox[i],
575  zprojapprox[i],
576  phiderapprox[i],
577  zderapprox[i]);
578  }
579 
580  if (std::abs(it * kt) > 1.0) {
581  for (unsigned int i = 0; i < toZ_.size(); ++i) {
582  iphiprojdisk[i] = phiprojdiskapprox[i] / kphiprojdisk;
583  irprojdisk[i] = rprojdiskapprox[i] / krprojdisk;
584 
585  iphiderdisk[i] = phiderdiskapprox[i] / kphiderdisk;
586  irderdisk[i] = rderdiskapprox[i] / krderdisk;
587 
588  //check phi projection in range
589  if (iphiprojdisk[i] <= 0)
590  continue;
591  if (iphiprojdisk[i] >= (1 << settings_.nphibitsstub(0)) - 1)
592  continue;
593 
594  //check r projection in range
595  if (rprojdiskapprox[i] < settings_.rmindisk() || rprojdiskapprox[i] > settings_.rmaxdisk())
596  continue;
597 
598  diskprojs[i].init(settings_,
599  i + 1,
600  rproj_[i],
601  iphiprojdisk[i],
602  irprojdisk[i],
603  iphiderdisk[i],
604  irderdisk[i],
605  phiprojdisk[i],
606  rprojdisk[i],
607  phiderdisk[i],
608  rderdisk[i],
609  phiprojdiskapprox[i],
610  rprojdiskapprox[i],
611  phiderdisk[i],
612  rderdisk[i]);
613  }
614  }
615 
616  if (settings_.writeMonitorData("TrackletPars")) {
617  globals_->ofstream("trackletpars.txt")
618  << "Trackpars " << layer_ << " " << rinv << " " << rinvapprox << " " << rinvapprox << " " << phi0 << " "
619  << phi0approx << " " << phi0approx << " " << t << " " << tapprox << " " << tapprox << " " << z0 << " "
620  << z0approx << " " << z0approx << endl;
621  }
622 
623  Tracklet* tracklet = new Tracklet(settings_,
624  innerStub,
625  middleStub,
626  outerStub,
627  innerFPGAStub,
628  middleFPGAStub,
629  outerFPGAStub,
630  rinv,
631  phi0,
632  d0,
633  z0,
634  t,
635  rinvapprox,
636  phi0approx,
637  d0approx,
638  z0approx,
639  tapprox,
640  irinv,
641  iphi0,
642  id0,
643  iz0,
644  it,
645  layerprojs,
646  diskprojs,
647  false);
648 
649  if (settings_.debugTracklet()) {
650  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName()
651  << " Found LLL tracklet in sector = " << iSector_ << " phi0 = " << phi0;
652  }
653 
655  tracklet->setTCIndex(TCIndex_);
656 
657  if (settings_.writeMonitorData("Seeds")) {
658  ofstream fout("seeds.txt", ofstream::app);
659  fout << __FILE__ << ":" << __LINE__ << " " << name_ << "_" << iSector_ << " " << tracklet->getISeed() << endl;
660  fout.close();
661  }
662  trackletpars_->addTracklet(tracklet);
663 
664  bool addL5 = false;
665  bool addL6 = false;
666  for (unsigned int j = 0; j < toR_.size(); j++) {
667  bool added = false;
668  if (settings_.debugTracklet())
669  edm::LogVerbatim("Tracklet") << "adding layer projection " << j << "/" << toR_.size() << " " << lproj_[j];
670  if (tracklet->validProj(lproj_[j])) {
671  added = addLayerProj(tracklet, lproj_[j]);
672  if (added && lproj_[j] == 5)
673  addL5 = true;
674  if (added && lproj_[j] == 6)
675  addL6 = true;
676  }
677  }
678 
679  for (unsigned int j = 0; j < toZ_.size(); j++) {
680  int disk = dproj_[j];
681  if (disk == 0)
682  continue;
683  if (disk == 2 && addL5)
684  continue;
685  if (disk == 1 && addL6)
686  continue;
687  if (it < 0)
688  disk = -disk;
689  if (settings_.debugTracklet())
690  edm::LogVerbatim("Tracklet") << "adding disk projection " << j << "/" << toZ_.size() << " " << disk;
691  if (tracklet->validProjDisk(abs(disk))) {
692  addDiskProj(tracklet, disk);
693  }
694  }
695 
696  return true;
697 }
698 
700  const L1TStub* innerStub,
701  const Stub* middleFPGAStub,
702  const L1TStub* middleStub,
703  const Stub* outerFPGAStub,
704  const L1TStub* outerStub) {
705  if (settings_.debugTracklet()) {
706  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName() << " " << layer_
707  << " trying stub triplet in (L2 D1 D2): " << innerFPGAStub->layer().value() << " "
708  << middleFPGAStub->disk().value() << " " << outerFPGAStub->disk().value();
709  }
710 
711  int take3 = 1; //D1D2L2
712 
713  double r1 = innerStub->r();
714  double z1 = innerStub->z();
715  double phi1 = innerStub->phi();
716 
717  double r2 = middleStub->r();
718  double z2 = middleStub->z();
719  double phi2 = middleStub->phi();
720 
721  double r3 = outerStub->r();
722  double z3 = outerStub->z();
723  double phi3 = outerStub->phi();
724 
725  double rinv, phi0, d0, t, z0;
726 
727  double phiproj[N_LAYER - 2], zproj[N_LAYER - 2], phider[N_LAYER - 2], zder[N_LAYER - 2];
728  double phiprojdisk[N_DISK], rprojdisk[N_DISK], phiderdisk[N_DISK], rderdisk[N_DISK];
729 
731  z1,
732  phi1,
733  r2,
734  z2,
735  phi2,
736  r3,
737  z3,
738  phi3,
739  take3,
740  rinv,
741  phi0,
742  d0,
743  t,
744  z0,
745  phiproj,
746  zproj,
747  phiprojdisk,
748  rprojdisk,
749  phider,
750  zder,
751  phiderdisk,
752  rderdisk);
753 
754  if (settings_.useapprox()) {
755  phi1 = innerFPGAStub->phiapprox(phimin_, phimax_);
756  z1 = innerFPGAStub->zapprox();
757  r1 = innerFPGAStub->rapprox();
758 
759  phi2 = outerFPGAStub->phiapprox(phimin_, phimax_);
760  z2 = outerFPGAStub->zapprox();
761  r2 = outerFPGAStub->rapprox();
762  }
763 
764  double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
765  double phiprojapprox[N_LAYER - 2], zprojapprox[N_LAYER - 2], phiderapprox[N_LAYER - 2], zderapprox[N_LAYER - 2];
766  double phiprojdiskapprox[N_DISK], rprojdiskapprox[N_DISK];
767  double phiderdiskapprox[N_DISK], rderdiskapprox[N_DISK];
768 
769  //TODO: implement the actual integer calculation
770 
771  //store the approcximate results
772  rinvapprox = rinv;
773  phi0approx = phi0;
774  d0approx = d0;
775  tapprox = t;
776  z0approx = z0;
777 
778  for (unsigned int i = 0; i < toR_.size(); ++i) {
779  phiprojapprox[i] = phiproj[i];
780  zprojapprox[i] = zproj[i];
781  phiderapprox[i] = phider[i];
782  zderapprox[i] = zder[i];
783  }
784 
785  for (unsigned int i = 0; i < toZ_.size(); ++i) {
786  phiprojdiskapprox[i] = phiprojdisk[i];
787  rprojdiskapprox[i] = rprojdisk[i];
788  phiderdiskapprox[i] = phiderdisk[i];
789  rderdiskapprox[i] = rderdisk[i];
790  }
791 
792  //now binary
793  double krinv = settings_.kphi1() / settings_.kr() * pow(2, settings_.rinv_shift()),
794  kphi0 = settings_.kphi1() * pow(2, settings_.phi0_shift()),
795  kt = settings_.kz() / settings_.kr() * pow(2, settings_.t_shift()),
796  kz0 = settings_.kz() * pow(2, settings_.z0_shift()),
797  kphiproj = settings_.kphi1() * pow(2, settings_.SS_phiL_shift()),
798  kphider = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderL_shift()),
799  kzproj = settings_.kz() * pow(2, settings_.PS_zL_shift()),
800  kzder = settings_.kz() / settings_.kr() * pow(2, settings_.PS_zderL_shift()),
801  kphiprojdisk = settings_.kphi1() * pow(2, settings_.SS_phiD_shift()),
802  kphiderdisk = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderD_shift()),
803  krprojdisk = settings_.kr() * pow(2, settings_.PS_rD_shift()),
804  krderdisk = settings_.kr() / settings_.kz() * pow(2, settings_.PS_rderD_shift());
805 
806  int irinv, iphi0, id0, it, iz0;
807  int iphiproj[N_LAYER - 2], izproj[N_LAYER - 2], iphider[N_LAYER - 2], izder[N_LAYER - 2];
808  int iphiprojdisk[N_DISK], irprojdisk[N_DISK], iphiderdisk[N_DISK], irderdisk[N_DISK];
809 
810  //store the binary results
811  irinv = rinvapprox / krinv;
812  iphi0 = phi0approx / kphi0;
813  id0 = d0approx / settings_.kd0();
814  it = tapprox / kt;
815  iz0 = z0approx / kz0;
816 
817  bool success = true;
818  if (std::abs(rinvapprox) > settings_.rinvcut()) {
819  if (settings_.debugTracklet())
820  edm::LogVerbatim("Tracklet") << "TrackletCalculator::DDL Seeding irinv too large: " << rinvapprox << "(" << irinv
821  << ")";
822  success = false;
823  }
824  if (std::abs(z0approx) > 1.8 * settings_.z0cut()) {
825  if (settings_.debugTracklet())
826  edm::LogVerbatim("Tracklet") << "Failed tracklet z0 cut " << z0approx;
827  success = false;
828  }
829  if (std::abs(d0approx) > settings_.maxd0()) {
830  if (settings_.debugTracklet())
831  edm::LogVerbatim("Tracklet") << "Failed tracklet d0 cut " << d0approx;
832  success = false;
833  }
834 
835  if (!success)
836  return false;
837 
838  double phicritapprox = phi0approx - asin(0.5 * settings_.rcrit() * rinvapprox);
839  int phicrit = iphi0 - 2 * irinv;
840 
841  int iphicritmincut = settings_.phicritminmc() / globals_->ITC_L1L2()->phi0_final.K();
842  int iphicritmaxcut = settings_.phicritmaxmc() / globals_->ITC_L1L2()->phi0_final.K();
843 
844  bool keepapprox = (phicritapprox > settings_.phicritminmc()) && (phicritapprox < settings_.phicritmaxmc()),
845  keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
846 
847  if (settings_.debugTracklet())
848  if (keep && !keepapprox)
849  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced::DDLSeeding tracklet kept with exact phicrit cut "
850  "but not approximate, phicritapprox: "
851  << phicritapprox;
852  if (settings_.usephicritapprox()) {
853  if (!keepapprox)
854  return false;
855  } else {
856  if (!keep)
857  return false;
858  }
859 
860  LayerProjection layerprojs[N_LAYER - 2];
861  DiskProjection diskprojs[N_DISK];
862 
863  for (unsigned int i = 0; i < toR_.size(); ++i) {
864  iphiproj[i] = phiprojapprox[i] / kphiproj;
865  izproj[i] = zprojapprox[i] / kzproj;
866 
867  iphider[i] = phiderapprox[i] / kphider;
868  izder[i] = zderapprox[i] / kzder;
869 
870  //check that z projection in range
871  if (izproj[i] < -(1 << (settings_.nzbitsstub(0) - 1)))
872  continue;
873  if (izproj[i] >= (1 << (settings_.nzbitsstub(0) - 1)))
874  continue;
875 
876  //check that phi projection in range
877  if (iphiproj[i] >= (1 << settings_.nphibitsstub(5)) - 1)
878  continue;
879  if (iphiproj[i] <= 0)
880  continue;
881 
882  if (rproj_[i] < settings_.rPS2S()) {
883  iphiproj[i] >>= (settings_.nphibitsstub(5) - settings_.nphibitsstub(0));
884  } else {
885  izproj[i] >>= (settings_.nzbitsstub(0) - settings_.nzbitsstub(5));
886  }
887 
888  if (rproj_[i] < settings_.rPS2S()) {
889  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL123() - 1)))
890  iphider[i] = -(1 << (settings_.nbitsphiprojderL123() - 1));
891  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL123() - 1)))
892  iphider[i] = (1 << (settings_.nbitsphiprojderL123() - 1)) - 1;
893  } else {
894  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL456() - 1)))
895  iphider[i] = -(1 << (settings_.nbitsphiprojderL456() - 1));
896  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL456() - 1)))
897  iphider[i] = (1 << (settings_.nbitsphiprojderL456() - 1)) - 1;
898  }
899 
900  layerprojs[i].init(settings_,
901  lproj_[i],
902  rproj_[i],
903  iphiproj[i],
904  izproj[i],
905  iphider[i],
906  izder[i],
907  phiproj[i],
908  zproj[i],
909  phider[i],
910  zder[i],
911  phiprojapprox[i],
912  zprojapprox[i],
913  phiderapprox[i],
914  zderapprox[i]);
915  }
916 
917  if (std::abs(it * kt) > 1.0) {
918  for (unsigned int i = 0; i < toZ_.size(); ++i) {
919  iphiprojdisk[i] = phiprojdiskapprox[i] / kphiprojdisk;
920  irprojdisk[i] = rprojdiskapprox[i] / krprojdisk;
921 
922  iphiderdisk[i] = phiderdiskapprox[i] / kphiderdisk;
923  irderdisk[i] = rderdiskapprox[i] / krderdisk;
924 
925  if (iphiprojdisk[i] <= 0)
926  continue;
927  if (iphiprojdisk[i] >= (1 << settings_.nphibitsstub(0)) - 1)
928  continue;
929 
930  if (irprojdisk[i] < settings_.rmindisk() / krprojdisk || irprojdisk[i] > settings_.rmaxdisk() / krprojdisk)
931  continue;
932 
933  diskprojs[i].init(settings_,
934  i + 1,
935  rproj_[i],
936  iphiprojdisk[i],
937  irprojdisk[i],
938  iphiderdisk[i],
939  irderdisk[i],
940  phiprojdisk[i],
941  rprojdisk[i],
942  phiderdisk[i],
943  rderdisk[i],
944  phiprojdiskapprox[i],
945  rprojdiskapprox[i],
946  phiderdisk[i],
947  rderdisk[i]);
948  }
949  }
950 
951  if (settings_.writeMonitorData("TrackletPars")) {
952  globals_->ofstream("trackletpars.txt")
953  << "Trackpars " << layer_ << " " << rinv << " " << rinvapprox << " " << rinvapprox << " " << phi0 << " "
954  << phi0approx << " " << phi0approx << " " << t << " " << tapprox << " " << tapprox << " " << z0 << " "
955  << z0approx << " " << z0approx << endl;
956  }
957 
958  Tracklet* tracklet = new Tracklet(settings_,
959  innerStub,
960  middleStub,
961  outerStub,
962  innerFPGAStub,
963  middleFPGAStub,
964  outerFPGAStub,
965  rinv,
966  phi0,
967  d0,
968  z0,
969  t,
970  rinvapprox,
971  phi0approx,
972  d0approx,
973  z0approx,
974  tapprox,
975  irinv,
976  iphi0,
977  id0,
978  iz0,
979  it,
980  layerprojs,
981  diskprojs,
982  true);
983 
984  if (settings_.debugTracklet()) {
985  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName()
986  << " Found DDL tracklet in sector = " << iSector_ << " phi0 = " << phi0;
987  }
988 
990  tracklet->setTCIndex(TCIndex_);
991 
992  if (settings_.writeMonitorData("Seeds")) {
993  ofstream fout("seeds.txt", ofstream::app);
994  fout << __FILE__ << ":" << __LINE__ << " " << name_ << "_" << iSector_ << " " << tracklet->getISeed() << endl;
995  fout.close();
996  }
997  trackletpars_->addTracklet(tracklet);
998 
999  for (unsigned int j = 0; j < toR_.size(); j++) {
1000  if (settings_.debugTracklet())
1001  edm::LogVerbatim("Tracklet") << "adding layer projection " << j << "/" << toR_.size() << " " << lproj_[j] << " "
1002  << tracklet->validProj(lproj_[j]);
1003  if (tracklet->validProj(lproj_[j])) {
1004  addLayerProj(tracklet, lproj_[j]);
1005  }
1006  }
1007 
1008  for (unsigned int j = 0; j < toZ_.size(); j++) {
1009  int disk = dproj_[j];
1010  if (disk == 0)
1011  continue;
1012  if (it < 0)
1013  disk = -disk;
1014  if (settings_.debugTracklet())
1015  edm::LogVerbatim("Tracklet") << "adding disk projection " << j << "/" << toZ_.size() << " " << disk << " "
1016  << tracklet->validProjDisk(abs(disk));
1017  if (tracklet->validProjDisk(abs(disk))) {
1018  addDiskProj(tracklet, disk);
1019  }
1020  }
1021 
1022  return true;
1023 }
1024 
1026  const L1TStub* innerStub,
1027  const Stub* middleFPGAStub,
1028  const L1TStub* middleStub,
1029  const Stub* outerFPGAStub,
1030  const L1TStub* outerStub) {
1031  if (settings_.debugTracklet()) {
1032  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName() << " " << layer_
1033  << " trying stub triplet in (L2L3D1): " << middleFPGAStub->layer().value() << " "
1034  << outerFPGAStub->layer().value() << " " << innerFPGAStub->disk().value();
1035  }
1036 
1037  int take3 = 0; //L2L3D1
1038 
1039  double r3 = innerStub->r();
1040  double z3 = innerStub->z();
1041  double phi3 = innerStub->phi();
1042 
1043  double r1 = middleStub->r();
1044  double z1 = middleStub->z();
1045  double phi1 = middleStub->phi();
1046 
1047  double r2 = outerStub->r();
1048  double z2 = outerStub->z();
1049  double phi2 = outerStub->phi();
1050 
1051  double rinv, phi0, d0, t, z0;
1052 
1053  double phiproj[N_LAYER - 2], zproj[N_LAYER - 2], phider[N_LAYER - 2], zder[N_LAYER - 2];
1054  double phiprojdisk[N_DISK], rprojdisk[N_DISK], phiderdisk[N_DISK], rderdisk[N_DISK];
1055 
1056  exacttracklet(r1,
1057  z1,
1058  phi1,
1059  r2,
1060  z2,
1061  phi2,
1062  r3,
1063  z3,
1064  phi3,
1065  take3,
1066  rinv,
1067  phi0,
1068  d0,
1069  t,
1070  z0,
1071  phiproj,
1072  zproj,
1073  phiprojdisk,
1074  rprojdisk,
1075  phider,
1076  zder,
1077  phiderdisk,
1078  rderdisk);
1079 
1080  if (settings_.useapprox()) {
1081  phi1 = innerFPGAStub->phiapprox(phimin_, phimax_);
1082  z1 = innerFPGAStub->zapprox();
1083  r1 = innerFPGAStub->rapprox();
1084 
1085  phi2 = outerFPGAStub->phiapprox(phimin_, phimax_);
1086  z2 = outerFPGAStub->zapprox();
1087  r2 = outerFPGAStub->rapprox();
1088  }
1089 
1090  double rinvapprox, phi0approx, d0approx, tapprox, z0approx;
1091  double phiprojapprox[N_LAYER - 2], zprojapprox[N_LAYER - 2], phiderapprox[N_LAYER - 2], zderapprox[N_LAYER - 2];
1092  double phiprojdiskapprox[N_DISK], rprojdiskapprox[N_DISK];
1093  double phiderdiskapprox[N_DISK], rderdiskapprox[N_DISK];
1094 
1095  //TODO: implement the actual integer calculation
1096 
1097  //store the approcximate results
1098  rinvapprox = rinv;
1099  phi0approx = phi0;
1100  d0approx = d0;
1101  tapprox = t;
1102  z0approx = z0;
1103 
1104  for (unsigned int i = 0; i < toR_.size(); ++i) {
1105  phiprojapprox[i] = phiproj[i];
1106  zprojapprox[i] = zproj[i];
1107  phiderapprox[i] = phider[i];
1108  zderapprox[i] = zder[i];
1109  }
1110 
1111  for (unsigned int i = 0; i < toZ_.size(); ++i) {
1112  phiprojdiskapprox[i] = phiprojdisk[i];
1113  rprojdiskapprox[i] = rprojdisk[i];
1114  phiderdiskapprox[i] = phiderdisk[i];
1115  rderdiskapprox[i] = rderdisk[i];
1116  }
1117 
1118  //now binary
1119  double krinv = settings_.kphi1() / settings_.kr() * pow(2, settings_.rinv_shift()),
1120  kphi0 = settings_.kphi1() * pow(2, settings_.phi0_shift()),
1121  kt = settings_.kz() / settings_.kr() * pow(2, settings_.t_shift()),
1122  kz0 = settings_.kz() * pow(2, settings_.z0_shift()),
1123  kphiproj = settings_.kphi1() * pow(2, settings_.SS_phiL_shift()),
1124  kphider = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderL_shift()),
1125  kzproj = settings_.kz() * pow(2, settings_.PS_zL_shift()),
1126  kzder = settings_.kz() / settings_.kr() * pow(2, settings_.PS_zderL_shift()),
1127  kphiprojdisk = settings_.kphi1() * pow(2, settings_.SS_phiD_shift()),
1128  kphiderdisk = settings_.kphi1() / settings_.kr() * pow(2, settings_.SS_phiderD_shift()),
1129  krprojdisk = settings_.kr() * pow(2, settings_.PS_rD_shift()),
1130  krderdisk = settings_.kr() / settings_.kz() * pow(2, settings_.PS_rderD_shift());
1131 
1132  int irinv, iphi0, id0, it, iz0;
1133  int iphiproj[N_LAYER - 2], izproj[N_LAYER - 2], iphider[N_LAYER - 2], izder[N_LAYER - 2];
1134  int iphiprojdisk[N_DISK], irprojdisk[N_DISK], iphiderdisk[N_DISK], irderdisk[N_DISK];
1135 
1136  //store the binary results
1137  irinv = rinvapprox / krinv;
1138  iphi0 = phi0approx / kphi0;
1139  id0 = d0approx / settings_.kd0();
1140  it = tapprox / kt;
1141  iz0 = z0approx / kz0;
1142 
1143  bool success = true;
1144  if (std::abs(rinvapprox) > settings_.rinvcut()) {
1145  if (settings_.debugTracklet())
1146  edm::LogVerbatim("Tracklet") << "TrackletCalculator:: LLD Seeding irinv too large: " << rinvapprox << "(" << irinv
1147  << ")";
1148  success = false;
1149  }
1150  if (std::abs(z0approx) > 1.8 * settings_.z0cut()) {
1151  if (settings_.debugTracklet())
1152  edm::LogVerbatim("Tracklet") << "Failed tracklet z0 cut " << z0approx;
1153  success = false;
1154  }
1155  if (std::abs(d0approx) > settings_.maxd0()) {
1156  if (settings_.debugTracklet())
1157  edm::LogVerbatim("Tracklet") << "Failed tracklet d0 cut " << d0approx;
1158  success = false;
1159  }
1160 
1161  if (!success)
1162  return false;
1163 
1164  double phicritapprox = phi0approx - asin(0.5 * settings_.rcrit() * rinvapprox);
1165  int phicrit = iphi0 - 2 * irinv;
1166 
1167  int iphicritmincut = settings_.phicritminmc() / globals_->ITC_L1L2()->phi0_final.K();
1168  int iphicritmaxcut = settings_.phicritmaxmc() / globals_->ITC_L1L2()->phi0_final.K();
1169 
1170  bool keepapprox = (phicritapprox > settings_.phicritminmc()) && (phicritapprox < settings_.phicritmaxmc()),
1171  keep = (phicrit > iphicritmincut) && (phicrit < iphicritmaxcut);
1172 
1173  if (settings_.debugTracklet())
1174  if (keep && !keepapprox)
1175  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced::LLDSeeding tracklet kept with exact phicrit cut "
1176  "but not approximate, phicritapprox: "
1177  << phicritapprox;
1178  if (settings_.usephicritapprox()) {
1179  if (!keepapprox)
1180  return false;
1181  } else {
1182  if (!keep)
1183  return false;
1184  }
1185 
1186  LayerProjection layerprojs[N_LAYER - 2];
1187  DiskProjection diskprojs[N_DISK];
1188 
1189  for (unsigned int i = 0; i < toR_.size(); ++i) {
1190  iphiproj[i] = phiprojapprox[i] / kphiproj;
1191  izproj[i] = zprojapprox[i] / kzproj;
1192 
1193  iphider[i] = phiderapprox[i] / kphider;
1194  izder[i] = zderapprox[i] / kzder;
1195 
1196  if (izproj[i] < -(1 << (settings_.nzbitsstub(0) - 1)))
1197  continue;
1198  if (izproj[i] >= (1 << (settings_.nzbitsstub(0) - 1)))
1199  continue;
1200 
1201  //this is left from the original....
1202  if (iphiproj[i] >= (1 << settings_.nphibitsstub(5)) - 1)
1203  continue;
1204  if (iphiproj[i] <= 0)
1205  continue;
1206 
1207  if (rproj_[i] < settings_.rPS2S()) {
1208  iphiproj[i] >>= (settings_.nphibitsstub(5) - settings_.nphibitsstub(0));
1209  } else {
1210  izproj[i] >>= (settings_.nzbitsstub(0) - settings_.nzbitsstub(5));
1211  }
1212 
1213  if (rproj_[i] < settings_.rPS2S()) {
1214  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL123() - 1)))
1215  iphider[i] = -(1 << (settings_.nbitsphiprojderL123() - 1));
1216  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL123() - 1)))
1217  iphider[i] = (1 << (settings_.nbitsphiprojderL123() - 1)) - 1;
1218  } else {
1219  if (iphider[i] < -(1 << (settings_.nbitsphiprojderL456() - 1)))
1220  iphider[i] = -(1 << (settings_.nbitsphiprojderL456() - 1));
1221  if (iphider[i] >= (1 << (settings_.nbitsphiprojderL456() - 1)))
1222  iphider[i] = (1 << (settings_.nbitsphiprojderL456() - 1)) - 1;
1223  }
1224 
1225  layerprojs[i].init(settings_,
1226  lproj_[i],
1227  rproj_[i],
1228  iphiproj[i],
1229  izproj[i],
1230  iphider[i],
1231  izder[i],
1232  phiproj[i],
1233  zproj[i],
1234  phider[i],
1235  zder[i],
1236  phiprojapprox[i],
1237  zprojapprox[i],
1238  phiderapprox[i],
1239  zderapprox[i]);
1240  }
1241 
1242  if (std::abs(it * kt) > 1.0) {
1243  for (unsigned int i = 0; i < toZ_.size(); ++i) {
1244  iphiprojdisk[i] = phiprojdiskapprox[i] / kphiprojdisk;
1245  irprojdisk[i] = rprojdiskapprox[i] / krprojdisk;
1246 
1247  iphiderdisk[i] = phiderdiskapprox[i] / kphiderdisk;
1248  irderdisk[i] = rderdiskapprox[i] / krderdisk;
1249 
1250  //Check phi range of projection
1251  if (iphiprojdisk[i] <= 0)
1252  continue;
1253  if (iphiprojdisk[i] >= (1 << settings_.nphibitsstub(0)) - 1)
1254  continue;
1255 
1256  //Check r range of projection
1257  if (irprojdisk[i] < settings_.rmindisk() / krprojdisk || irprojdisk[i] > settings_.rmaxdisk() / krprojdisk)
1258  continue;
1259 
1260  diskprojs[i].init(settings_,
1261  i + 1,
1262  rproj_[i],
1263  iphiprojdisk[i],
1264  irprojdisk[i],
1265  iphiderdisk[i],
1266  irderdisk[i],
1267  phiprojdisk[i],
1268  rprojdisk[i],
1269  phiderdisk[i],
1270  rderdisk[i],
1271  phiprojdiskapprox[i],
1272  rprojdiskapprox[i],
1273  phiderdisk[i],
1274  rderdisk[i]);
1275  }
1276  }
1277 
1278  if (settings_.writeMonitorData("TrackletPars")) {
1279  globals_->ofstream("trackletpars.txt")
1280  << "Trackpars " << layer_ << " " << rinv << " " << rinvapprox << " " << rinvapprox << " " << phi0 << " "
1281  << phi0approx << " " << phi0approx << " " << t << " " << tapprox << " " << tapprox << " " << z0 << " "
1282  << z0approx << " " << z0approx << endl;
1283  }
1284 
1285  Tracklet* tracklet = new Tracklet(settings_,
1286  innerStub,
1287  middleStub,
1288  outerStub,
1289  innerFPGAStub,
1290  middleFPGAStub,
1291  outerFPGAStub,
1292  rinv,
1293  phi0,
1294  d0,
1295  z0,
1296  t,
1297  rinvapprox,
1298  phi0approx,
1299  d0approx,
1300  z0approx,
1301  tapprox,
1302  irinv,
1303  iphi0,
1304  id0,
1305  iz0,
1306  it,
1307  layerprojs,
1308  diskprojs,
1309  false);
1310 
1311  if (settings_.debugTracklet()) {
1312  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced " << getName()
1313  << " Found LLD tracklet in sector = " << iSector_ << " phi0 = " << phi0;
1314  }
1315 
1317  tracklet->setTCIndex(TCIndex_);
1318 
1319  if (settings_.writeMonitorData("Seeds")) {
1320  ofstream fout("seeds.txt", ofstream::app);
1321  fout << __FILE__ << ":" << __LINE__ << " " << name_ << "_" << iSector_ << " " << tracklet->getISeed() << endl;
1322  fout.close();
1323  }
1324  trackletpars_->addTracklet(tracklet);
1325 
1326  for (unsigned int j = 0; j < toR_.size(); j++) {
1327  if (settings_.debugTracklet())
1328  edm::LogVerbatim("Tracklet") << "adding layer projection " << j << "/" << toR_.size() << " " << lproj_[j];
1329  if (tracklet->validProj(lproj_[j])) {
1330  addLayerProj(tracklet, lproj_[j]);
1331  }
1332  }
1333 
1334  for (unsigned int j = 0; j < toZ_.size(); j++) {
1335  int disk = dproj_[j];
1336  if (disk == 0)
1337  continue;
1338  if (it < 0)
1339  disk = -disk;
1340  if (settings_.debugTracklet())
1341  edm::LogVerbatim("Tracklet") << "adding disk projection " << j << "/" << toZ_.size() << " " << disk;
1342  if (tracklet->validProjDisk(abs(disk))) {
1343  addDiskProj(tracklet, disk);
1344  }
1345  }
1346 
1347  return true;
1348 }
1349 
1351  double rinv,
1352  double phi0,
1353  double d0,
1354  double t,
1355  double z0,
1356  double r0,
1357  double& phiproj,
1358  double& zproj,
1359  double& phider,
1360  double& zder) {
1361  double rho = 1 / rinv;
1362  if (rho < 0) {
1363  r0 = -r0;
1364  }
1365  phiproj = phi0 - asin((rproj * rproj + r0 * r0 - rho * rho) / (2 * rproj * r0));
1366  double beta = acos((rho * rho + r0 * r0 - rproj * rproj) / (2 * r0 * rho));
1367  zproj = z0 + t * std::abs(rho * beta);
1368 
1369  //not exact, but close
1370  phider = -0.5 * rinv / sqrt(1 - pow(0.5 * rproj * rinv, 2)) + d0 / (rproj * rproj);
1371  zder = t / sqrt(1 - pow(0.5 * rproj * rinv, 2));
1372 
1373  if (settings_.debugTracklet()) {
1374  edm::LogVerbatim("Tracklet") << "exact proj layer at " << rproj << " : " << phiproj << " " << zproj;
1375  }
1376 }
1377 
1379  double rinv,
1380  double,
1381  double, //phi0 and d0 are not used.
1382  double t,
1383  double z0,
1384  double x0,
1385  double y0,
1386  double& phiproj,
1387  double& rproj,
1388  double& phider,
1389  double& rder) {
1390  //protect against t=0
1391  if (std::abs(t) < 0.1)
1392  t = 0.1;
1393  if (t < 0)
1394  zproj = -zproj;
1395  double rho = std::abs(1 / rinv);
1396  double beta = (zproj - z0) / (t * rho);
1397  double phiV = atan2(-y0, -x0);
1398  double c = rinv > 0 ? -1 : 1;
1399 
1400  double x = x0 + rho * cos(phiV + c * beta);
1401  double y = y0 + rho * sin(phiV + c * beta);
1402 
1403  phiproj = atan2(y, x);
1404 
1405  phiproj = reco::reduceRange(phiproj - phimin_);
1406 
1407  rproj = sqrt(x * x + y * y);
1408 
1409  phider = c / t / (x * x + y * y) * (rho + x0 * cos(phiV + c * beta) + y0 * sin(phiV + c * beta));
1410  rder = c / t / rproj * (y0 * cos(phiV + c * beta) - x0 * sin(phiV + c * beta));
1411 
1412  if (settings_.debugTracklet()) {
1413  edm::LogVerbatim("Tracklet") << "exact proj disk at" << zproj << " : " << phiproj << " " << rproj;
1414  }
1415 }
1416 
1418  double z1,
1419  double phi1,
1420  double r2,
1421  double z2,
1422  double phi2,
1423  double r3,
1424  double z3,
1425  double phi3,
1426  int take3,
1427  double& rinv,
1428  double& phi0,
1429  double& d0,
1430  double& t,
1431  double& z0,
1432  double phiproj[N_DISK],
1433  double zproj[N_DISK],
1434  double phiprojdisk[N_DISK],
1435  double rprojdisk[N_DISK],
1436  double phider[N_DISK],
1437  double zder[N_DISK],
1438  double phiderdisk[N_DISK],
1439  double rderdisk[N_DISK]) {
1440  //two lines perpendicular to the 1->2 and 2->3
1441  double x1 = r1 * cos(phi1);
1442  double x2 = r2 * cos(phi2);
1443  double x3 = r3 * cos(phi3);
1444 
1445  double y1 = r1 * sin(phi1);
1446  double y2 = r2 * sin(phi2);
1447  double y3 = r3 * sin(phi3);
1448 
1449  double k1 = -(x2 - x1) / (y2 - y1);
1450  double k2 = -(x3 - x2) / (y3 - y2);
1451  double b1 = 0.5 * (y2 + y1) - 0.5 * (x1 + x2) * k1;
1452  double b2 = 0.5 * (y3 + y2) - 0.5 * (x2 + x3) * k2;
1453  //their intersection gives the center of the circle
1454  double y0 = (b1 * k2 - b2 * k1) / (k2 - k1);
1455  double x0 = (b1 - b2) / (k2 - k1);
1456  //get the radius three ways:
1457  double R1 = sqrt(pow(x1 - x0, 2) + pow(y1 - y0, 2));
1458  double R2 = sqrt(pow(x2 - x0, 2) + pow(y2 - y0, 2));
1459  double R3 = sqrt(pow(x3 - x0, 2) + pow(y3 - y0, 2));
1460  //check if the same
1461  double eps1 = std::abs(R1 / R2 - 1);
1462  double eps2 = std::abs(R3 / R2 - 1);
1463  if (eps1 > 1e-10 || eps2 > 1e-10)
1464  edm::LogVerbatim("Tracklet") << "&&&&&&&&&&&& bad circle! " << R1 << "\t" << R2 << "\t" << R3;
1465 
1466  //results
1467  rinv = 1. / R1;
1468  phi0 = 0.5 * M_PI + atan2(y0, x0);
1469 
1470  phi0 -= phimin_;
1471 
1472  d0 = -R1 + sqrt(x0 * x0 + y0 * y0);
1473  //sign of rinv:
1474  double dphi = reco::reduceRange(phi3 - atan2(y0, x0));
1475  if (dphi < 0) {
1476  rinv = -rinv;
1477  d0 = -d0;
1478  phi0 = phi0 + M_PI;
1479  }
1480  phi0 = angle0to2pi::make0To2pi(phi0);
1481 
1482  //now in RZ:
1483  //turning angle
1484  double beta1 = reco::reduceRange(atan2(y1 - y0, x1 - x0) - atan2(-y0, -x0));
1485  double beta2 = reco::reduceRange(atan2(y2 - y0, x2 - x0) - atan2(-y0, -x0));
1486  double beta3 = reco::reduceRange(atan2(y3 - y0, x3 - x0) - atan2(-y0, -x0));
1487 
1488  double t12 = (z2 - z1) / std::abs(beta2 - beta1) / R1;
1489  double z12 = (z1 * beta2 - z2 * beta1) / (beta2 - beta1);
1490  double t13 = (z3 - z1) / std::abs(beta3 - beta1) / R1;
1491  double z13 = (z1 * beta3 - z3 * beta1) / (beta3 - beta1);
1492 
1493  if (take3 > 0) {
1494  //take 13 (large lever arm)
1495  t = t13;
1496  z0 = z13;
1497  } else {
1498  //take 12 (pixel layers)
1499  t = t12;
1500  z0 = z12;
1501  }
1502 
1503  if (settings_.debugTracklet())
1504  edm::LogVerbatim("Tracklet") << "exact tracklet: " << rinv << " " << phi0 << " " << d0 << " " << t << " " << z0;
1505 
1506  for (unsigned int i = 0; i < toR_.size(); i++) {
1507  exactproj(toR_[i], rinv, phi0, d0, t, z0, sqrt(x0 * x0 + y0 * y0), phiproj[i], zproj[i], phider[i], zder[i]);
1508  }
1509 
1510  for (unsigned int i = 0; i < toZ_.size(); i++) {
1511  exactprojdisk(toZ_[i], rinv, phi0, d0, t, z0, x0, y0, phiprojdisk[i], rprojdisk[i], phiderdisk[i], rderdisk[i]);
1512  }
1513 }
trklet::TrackletCalculatorDisplaced::toZ_
std::vector< double > toZ_
Definition: TrackletCalculatorDisplaced.h:117
Settings.h
trklet::TrackletCalculatorDisplaced::outerallstubs_
std::vector< AllStubsMemory * > outerallstubs_
Definition: TrackletCalculatorDisplaced.h:121
trklet::Settings::phicritmaxmc
double phicritmaxmc() const
Definition: Settings.h:244
L1TStub.h
trklet::Settings::rmindisk
double rmindisk() const
Definition: Settings.h:103
trklet::Settings::maxd0
double maxd0() const
Definition: Settings.h:253
trklet::Settings::rmindiskvm
double rmindiskvm() const
Definition: Settings.h:260
mps_fire.i
i
Definition: mps_fire.py:428
trklet::Settings::ntrackletmax
unsigned int ntrackletmax() const
Definition: Settings.h:274
trklet::Settings::writetrace
bool writetrace() const
Definition: Settings.h:147
input
static const std::string input
Definition: EdmProvDump.cc:48
MessageLogger.h
trklet::TrackletCalculatorDisplaced::addProjection
void addProjection(int layer, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
Definition: TrackletCalculatorDisplaced.cc:316
trklet::Settings::krprojshiftdisk
double krprojshiftdisk() const
Definition: Settings.h:341
trklet::TrackletCalculatorDisplaced::innerallstubs_
std::vector< AllStubsMemory * > innerallstubs_
Definition: TrackletCalculatorDisplaced.h:119
trklet::Tracklet::fpgaphiprojdisk
const FPGAWord & fpgaphiprojdisk(int disk) const
Definition: Tracklet.h:266
trklet::TrackletParametersMemory::addTracklet
void addTracklet(Tracklet *tracklet)
Definition: TrackletParametersMemory.h:23
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:72
trklet::TrackletCalculatorDisplaced::stubtriplets_
std::vector< StubTripletsMemory * > stubtriplets_
Definition: TrackletCalculatorDisplaced.h:122
deltaPhi.h
trklet::Settings::SS_phiL_shift
int SS_phiL_shift() const
Definition: Settings.h:291
zMuMuMuonUserData.beta
beta
Definition: zMuMuMuonUserData.py:10
testProducerWithPsetDescEmpty_cfi.x2
x2
Definition: testProducerWithPsetDescEmpty_cfi.py:28
trklet::LayerProjection::init
void init(Settings const &settings, int projlayer, double rproj, int iphiproj, int izproj, int iphider, int izder, double phiproj, double zproj, double phiprojder, double zprojder, double phiprojapprox, double zprojapprox, double phiprojderapprox, double zprojderapprox)
Definition: LayerProjection.cc:9
trklet::Settings::phicritminmc
double phicritminmc() const
Definition: Settings.h:243
trklet::TrackletCalculatorDisplaced::disk_
int disk_
Definition: TrackletCalculatorDisplaced.h:110
trklet::TrackletProjectionsMemory
Definition: TrackletProjectionsMemory.h:15
trklet::Settings
Definition: Settings.h:26
trklet::L1TStub
Definition: L1TStub.h:12
trklet::TrackletCalculatorDisplaced::addLayerProj
bool addLayerProj(Tracklet *tracklet, int layer)
Definition: TrackletCalculatorDisplaced.cc:296
trklet::L1TStub::z
double z() const
Definition: L1TStub.h:56
trklet::Tracklet::getISeed
int getISeed() const
Definition: Tracklet.cc:849
trklet::TrackletCalculatorDisplaced::middleallstubs_
std::vector< AllStubsMemory * > middleallstubs_
Definition: TrackletCalculatorDisplaced.h:120
cms::cuda::assert
assert(be >=bs)
trklet::Settings::rmean
double rmean(unsigned int iLayer) const
Definition: Settings.h:128
trklet::N_DISK
constexpr int N_DISK
Definition: Settings.h:20
trklet::ProcessBase::settings_
Settings const & settings_
Definition: ProcessBase.h:44
trklet::Stub::phiapprox
double phiapprox(double phimin, double) const
Definition: Stub.cc:236
trklet::Settings::kphi1
double kphi1() const
Definition: Settings.h:247
trklet::TrackletCalculatorDisplaced::lproj_
int lproj_[N_LAYER - 2]
Definition: TrackletCalculatorDisplaced.h:112
trklet::FPGAWord::nbits
int nbits() const
Definition: FPGAWord.h:25
b2
static constexpr float b2
Definition: L1EGammaCrystalsEmulatorProducer.cc:82
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
trklet::Globals
Definition: Globals.h:32
trklet::Tracklet::validProj
bool validProj(int layer) const
Definition: Tracklet.h:89
trklet::Settings::PS_rderD_shift
int PS_rderD_shift() const
Definition: Settings.h:303
trklet::Stub::isBarrel
bool isBarrel() const
Definition: Stub.h:60
trklet::LayerProjection
Definition: LayerProjection.h:10
trklet::Tracklet
Definition: Tracklet.h:28
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
testProducerWithPsetDescEmpty_cfi.z2
z2
Definition: testProducerWithPsetDescEmpty_cfi.py:41
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
b1
static constexpr float b1
Definition: L1EGammaCrystalsEmulatorProducer.cc:82
accept
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:30
testProducerWithPsetDescEmpty_cfi.x1
x1
Definition: testProducerWithPsetDescEmpty_cfi.py:33
TrackletCalculatorDisplaced.h
testProducerWithPsetDescEmpty_cfi.y1
y1
Definition: testProducerWithPsetDescEmpty_cfi.py:29
trklet::Tracklet::fpgazproj
const FPGAWord & fpgazproj(int layer) const
Definition: Tracklet.h:99
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
trklet::Stub::disk
const FPGAWord & disk() const
Definition: Stub.h:57
trklet::MemoryBase::getName
std::string const & getName() const
Definition: MemoryBase.h:19
trklet::Settings::z0_shift
int z0_shift() const
Definition: Settings.h:286
trklet::Stub
Definition: Stub.h:16
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
trklet::DiskProjection
Definition: DiskProjection.h:12
trklet::TrackletCalculatorDisplaced::layer_
int layer_
Definition: TrackletCalculatorDisplaced.h:109
trklet::TrackletCalculatorDisplaced::trackletprojlayers_
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
Definition: TrackletCalculatorDisplaced.h:127
trklet::N_LAYER
constexpr int N_LAYER
Definition: Settings.h:19
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
trklet::Settings::zmean
double zmean(unsigned int iDisk) const
Definition: Settings.h:131
trklet::TrackletCalculatorDisplaced::exacttracklet
void exacttracklet(double r1, double z1, double phi1, double r2, double z2, double phi2, double r3, double z3, double phi3, int take3, double &rinv, double &phi0, double &d0, double &t, double &z0, double phiproj[N_LAYER - 2], double zproj[N_LAYER - 2], double phiprojdisk[N_DISK], double rprojdisk[N_DISK], double phider[N_LAYER - 2], double zder[N_LAYER - 2], double phiderdisk[N_DISK], double rderdisk[N_DISK])
Definition: TrackletCalculatorDisplaced.cc:1417
trklet::Stub::isDisk
bool isDisk() const
Definition: Stub.h:61
HLTMuonOfflineAnalyzer_cfi.z0
z0
Definition: HLTMuonOfflineAnalyzer_cfi.py:98
trklet::Settings::phi0_shift
int phi0_shift() const
Definition: Settings.h:284
trklet::Settings::SS_phiderD_shift
int SS_phiderD_shift() const
Definition: Settings.h:302
trklet::FPGAWord
Definition: FPGAWord.h:9
trklet::Settings::kr
double kr() const
Definition: Settings.h:250
trklet::TrackletCalculatorDisplaced::exactprojdisk
void exactprojdisk(double zproj, double rinv, double, double, double t, double z0, double x0, double y0, double &phiproj, double &rproj, double &phider, double &rder)
Definition: TrackletCalculatorDisplaced.cc:1378
trklet::TrackletCalculatorDisplaced::LLDSeeding
bool LLDSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
Definition: TrackletCalculatorDisplaced.cc:1025
trklet::Settings::warnNoMem
bool warnNoMem() const
Definition: Settings.h:149
testProducerWithPsetDescEmpty_cfi.y2
y2
Definition: testProducerWithPsetDescEmpty_cfi.py:30
trklet::Settings::rmaxdisk
double rmaxdisk() const
Definition: Settings.h:102
trklet::MemoryBase
Definition: MemoryBase.h:13
trklet::Settings::nbitsphiprojderL456
unsigned int nbitsphiprojderL456() const
Definition: Settings.h:70
trklet::TrackletCalculatorDisplaced::addDiskProj
void addDiskProj(Tracklet *tracklet, int disk)
Definition: TrackletCalculatorDisplaced.cc:280
trklet::FPGAWord::atExtreme
bool atExtreme() const
Definition: FPGAWord.cc:79
trklet::rinv
double rinv(double phi1, double phi2, double r1, double r2)
Definition: Util.h:167
trklet::TrackletCalculatorDisplaced::LLLSeeding
bool LLLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
Definition: TrackletCalculatorDisplaced.cc:351
trklet::VarBase::K
double K() const
Definition: imath.h:246
trklet::Globals::ITC_L1L2
IMATH_TrackletCalculator * ITC_L1L2()
Definition: Globals.h:52
trklet::Settings::nzbitsstub
unsigned int nzbitsstub(unsigned int layerdisk) const
Definition: Settings.h:64
trklet::IMATH_TrackletCalculator::phi0_final
VarAdjustK phi0_final
Definition: IMATH_TrackletCalculator.h:218
trklet::Settings::SS_phiderL_shift
int SS_phiderL_shift() const
Definition: Settings.h:294
diffTwoXMLs.r2
r2
Definition: diffTwoXMLs.py:73
groupFilesInBlocks.fout
fout
Definition: groupFilesInBlocks.py:162
trklet::Stub::rapprox
double rapprox() const
Definition: Stub.cc:209
trklet::TrackletCalculatorDisplaced::execute
void execute()
Definition: TrackletCalculatorDisplaced.cc:207
Globals.h
trklet::Settings::nphibitsstub
unsigned int nphibitsstub(unsigned int layerdisk) const
Definition: Settings.h:65
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
trklet::Settings::t_shift
int t_shift() const
Definition: Settings.h:285
trklet::Tracklet::setTrackletIndex
void setTrackletIndex(int index)
Definition: Tracklet.cc:844
HltBtagPostValidation_cff.c
c
Definition: HltBtagPostValidation_cff.py:31
trklet::TrackletCalculatorDisplaced::zproj_
double zproj_[N_DISK - 2]
Definition: TrackletCalculatorDisplaced.h:113
trklet::TrackletCalculatorDisplaced::TCIndex_
int TCIndex_
Definition: TrackletCalculatorDisplaced.h:108
trklet::TrackletCalculatorDisplaced::rproj_
double rproj_[N_LAYER - 2]
Definition: TrackletCalculatorDisplaced.h:111
trklet
Definition: AllProjectionsMemory.h:9
trklet::FPGAWord::value
int value() const
Definition: FPGAWord.h:24
IMATH_TrackletCalculator.h
angle0to2pi::make0To2pi
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
trklet::TrackletCalculatorDisplaced::trackletprojdisks_
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
Definition: TrackletCalculatorDisplaced.h:128
trklet::TrackletCalculatorDisplaced::dproj_
int dproj_[N_DISK - 2]
Definition: TrackletCalculatorDisplaced.h:114
trklet::Settings::writeMonitorData
bool writeMonitorData(std::string module) const
Definition: Settings.h:86
std
Definition: JetResolutionObject.h:76
trklet::TrackletCalculatorDisplaced::toR_
std::vector< double > toR_
Definition: TrackletCalculatorDisplaced.h:116
trklet::Settings::usephicritapprox
bool usephicritapprox() const
Definition: Settings.h:194
trklet::TrackletParametersMemory::nTracklets
unsigned int nTracklets() const
Definition: TrackletParametersMemory.h:25
trklet::Tracklet::setTCIndex
void setTCIndex(int index)
Definition: Tracklet.h:496
trklet::ProcessBase
Definition: ProcessBase.h:12
trklet::Settings::rinvcut
double rinvcut() const
Definition: Settings.h:169
trklet::Globals::ofstream
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
trklet::Settings::SS_phiD_shift
int SS_phiD_shift() const
Definition: Settings.h:299
trklet::TrackletProjectionsMemory::addProj
void addProj(Tracklet *tracklet)
Definition: TrackletProjectionsMemory.cc:16
trklet::TrackletCalculatorDisplaced::exactproj
void exactproj(double rproj, double rinv, double phi0, double d0, double t, double z0, double r0, double &phiproj, double &zproj, double &phider, double &zder)
Definition: TrackletCalculatorDisplaced.cc:1350
trklet::Stub::l1tstub
L1TStub * l1tstub()
Definition: Stub.h:69
diffTwoXMLs.r1
r1
Definition: diffTwoXMLs.py:53
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
mps_setup.memory
memory
Definition: mps_setup.py:156
trklet::Settings::useapprox
bool useapprox() const
Definition: Settings.h:193
trklet::TrackletCalculatorDisplaced::DDLSeeding
bool DDLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
Definition: TrackletCalculatorDisplaced.cc:699
Exception
Definition: hltDiff.cc:246
trklet::TrackletCalculatorDisplaced::addOutput
void addOutput(MemoryBase *memory, std::string output) override
Definition: TrackletCalculatorDisplaced.cc:133
trklet::TrackletCalculatorDisplaced::trackletpars_
TrackletParametersMemory * trackletpars_
Definition: TrackletCalculatorDisplaced.h:124
trklet::ProcessBase::getName
std::string const & getName() const
Definition: ProcessBase.h:22
trklet::Tracklet::fpgaphiproj
const FPGAWord & fpgaphiproj(int layer) const
Definition: Tracklet.h:104
trklet::Settings::kz
double kz() const
Definition: Settings.h:249
trklet::ProcessBase::name_
std::string name_
Definition: ProcessBase.h:38
trklet::Settings::nallstubs
unsigned int nallstubs(unsigned int layerdisk) const
Definition: Settings.h:84
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
trklet::ProcessBase::iSector_
unsigned int iSector_
Definition: ProcessBase.h:39
trklet::Settings::debugTracklet
bool debugTracklet() const
Definition: Settings.h:146
trklet::Settings::rcrit
double rcrit() const
Definition: Settings.h:236
Exception.h
trklet::TrackletCalculatorDisplaced::addInput
void addInput(MemoryBase *memory, std::string input) override
Definition: TrackletCalculatorDisplaced.cc:175
trklet::Tracklet::fpgarprojdisk
const FPGAWord & fpgarprojdisk(int disk) const
Definition: Tracklet.h:276
trklet::Settings::maxStep
unsigned int maxStep(std::string module) const
Definition: Settings.h:93
trklet::Settings::kd0
double kd0() const
Definition: Settings.h:256
trklet::L1TStub::r
double r() const
Definition: L1TStub.h:57
trklet::Settings::PS_zderL_shift
int PS_zderL_shift() const
Definition: Settings.h:295
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
trklet::Settings::PS_rD_shift
int PS_rD_shift() const
Definition: Settings.h:300
trklet::ProcessBase::phimin_
double phimin_
Definition: ProcessBase.h:41
trklet::Settings::z0cut
double z0cut() const
Definition: Settings.h:269
trklet::Settings::PS_zL_shift
int PS_zL_shift() const
Definition: Settings.h:292
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
trklet::Settings::nbitsphiprojderL123
unsigned int nbitsphiprojderL123() const
Definition: Settings.h:69
trklet::Stub::layer
const FPGAWord & layer() const
Definition: Stub.h:56
trklet::Tracklet::validProjDisk
bool validProjDisk(int disk) const
Definition: Tracklet.h:206
trklet::ProcessBase::globals_
Globals * globals_
Definition: ProcessBase.h:45
trklet::Settings::rPS2S
double rPS2S() const
Definition: Settings.h:267
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
d0
static constexpr float d0
Definition: L1EGammaCrystalsEmulatorProducer.cc:84
edm::Log
Definition: MessageLogger.h:70
trklet::ProcessBase::phimax_
double phimax_
Definition: ProcessBase.h:42
trklet::TrackletCalculatorDisplaced::addOutputProjection
void addOutputProjection(TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
Definition: TrackletCalculatorDisplaced.cc:128
keep
const int keep
Definition: GenParticlePruner.cc:48
Stub.h
Tracklet.h
trklet::Stub::zapprox
double zapprox() const
Definition: Stub.cc:217
trklet::L1TStub::phi
double phi() const
Definition: L1TStub.h:62
trklet::Settings::rinv_shift
int rinv_shift() const
Definition: Settings.h:283
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
trklet::TrackletCalculatorDisplaced::addProjectionDisk
void addProjectionDisk(int disk, int iphi, TrackletProjectionsMemory *trackletprojs, Tracklet *tracklet)
Definition: TrackletCalculatorDisplaced.cc:331
reco::reduceRange
constexpr T reduceRange(T x)
Definition: deltaPhi.h:18
trklet::Settings::zlength
double zlength() const
Definition: Settings.h:101
trklet::DiskProjection::init
void init(Settings const &settings, int projdisk, double zproj, int iphiproj, int irproj, int iphider, int irder, double phiproj, double rproj, double phiprojder, double rprojder, double phiprojapprox, double rprojapprox, double phiprojderapprox, double rprojderapprox)
Definition: DiskProjection.cc:12