CMS 3D CMS Logo

TrackletProcessorDisplaced.cc
Go to the documentation of this file.
10 
14 
15 #include <utility>
16 #include <tuple>
17 
18 using namespace std;
19 using namespace trklet;
20 
21 TrackletProcessorDisplaced::TrackletProcessorDisplaced(string name, Settings const& settings, Globals* globals)
22  : TrackletCalculatorDisplaced(name, settings, globals),
23  innerTable_(settings),
24  innerOverlapTable_(settings),
25  innerThirdTable_(settings) {
26  innerallstubs_.clear();
27  middleallstubs_.clear();
28  outerallstubs_.clear();
29  stubpairs_.clear();
30  innervmstubs_.clear();
31  outervmstubs_.clear();
32 
33  const unsigned layerdiskPosInName = 4;
34  const unsigned regionPosInName1 = 9;
35 
36  // iAllStub_ = -1;
37  layerdisk_ = initLayerDisk(layerdiskPosInName);
38 
39  unsigned int region = name.substr(1)[regionPosInName1] - 'A';
40  // assert(region < settings_.nallstubs(layerdisk_));
41 
45  }
46 
49  layerdisk_, TrackletLUT::VMRTableType::inneroverlap, region); //projection to disk from layer
50  }
51 
55  layerdisk_, TrackletLUT::VMRTableType::innerthird, region); //projection to third layer/disk
56  }
57 
60 
61  for (unsigned int ilayer = 0; ilayer < N_LAYER; ilayer++) {
62  vector<TrackletProjectionsMemory*> tmp(settings_.nallstubs(ilayer), nullptr);
63  trackletprojlayers_.push_back(tmp);
64  }
65 
66  for (unsigned int idisk = 0; idisk < N_DISK; idisk++) {
67  vector<TrackletProjectionsMemory*> tmp(settings_.nallstubs(idisk + N_LAYER), nullptr);
68  trackletprojdisks_.push_back(tmp);
69  }
70 
71  // initLayerDisksandISeed(layerdisk1_, layerdisk2_, iSeed_);
72 
73  layer_ = 0;
74  disk_ = 0;
75  layer1_ = 0;
76  layer2_ = 0;
77  layer3_ = 0;
78  disk1_ = 0;
79  disk2_ = 0;
80  disk3_ = 0;
81 
82  constexpr unsigned layerPosInName1 = 4;
83  constexpr unsigned diskPosInName1 = 4;
84  constexpr unsigned layer1PosInName1 = 4;
85  constexpr unsigned disk1PosInName1 = 4;
86  constexpr unsigned layer2PosInName1 = 6;
87  constexpr unsigned disk2PosInName1 = 6;
88 
89  string name1 = name.substr(1); //this is to correct for "TPD" having one more letter then "TP"
90  if (name1[3] == 'L')
91  layer_ = name1[layerPosInName1] - '0';
92  if (name1[3] == 'D')
93  disk_ = name1[diskPosInName1] - '0';
94 
95  if (name1[3] == 'L')
96  layer1_ = name1[layer1PosInName1] - '0';
97  if (name1[3] == 'D')
98  disk1_ = name1[disk1PosInName1] - '0';
99  if (name1[5] == 'L')
100  layer2_ = name1[layer2PosInName1] - '0';
101  if (name1[5] == 'D')
102  disk2_ = name1[disk2PosInName1] - '0';
103 
104  // set TC index
105  iSeed_ = 0;
106 
107  int iTC = name1[regionPosInName1] - 'A';
108 
109  if (name1.substr(3, 6) == "L3L4L2") {
110  iSeed_ = 8;
111  layer3_ = 2;
112  } else if (name1.substr(3, 6) == "L5L6L4") {
113  iSeed_ = 9;
114  layer3_ = 4;
115  } else if (name1.substr(3, 6) == "L2L3D1") {
116  iSeed_ = 10;
117  disk3_ = 1;
118  } else if (name1.substr(3, 6) == "D1D2L2") {
119  iSeed_ = 11;
120  layer3_ = 2;
121  }
122  assert(iSeed_ != 0);
123 
124  constexpr int TCIndexMin = 128;
125  constexpr int TCIndexMax = 191;
126 
127  TCIndex_ = (iSeed_ << 4) + iTC;
128  assert(TCIndex_ >= TCIndexMin && TCIndex_ < TCIndexMax);
129 
130  assert((layer_ != 0) || (disk_ != 0));
131 }
132 
134  outputProj = dynamic_cast<TrackletProjectionsMemory*>(memory);
135  assert(outputProj != nullptr);
136 }
137 
139  if (settings_.writetrace()) {
140  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
141  << output;
142  }
143 
144  if (output == "trackpar") {
145  auto* tmp = dynamic_cast<TrackletParametersMemory*>(memory);
146  assert(tmp != nullptr);
147  trackletpars_ = tmp;
148  return;
149  }
150 
151  if (output.substr(0, 7) == "projout") {
152  //output is on the form 'projoutL2PHIC' or 'projoutD3PHIB'
153  auto* tmp = dynamic_cast<TrackletProjectionsMemory*>(memory);
154  assert(tmp != nullptr);
155 
156  constexpr unsigned layerdiskPosInprojout = 8;
157  constexpr unsigned phiPosInprojout = 12;
158 
159  unsigned int layerdisk = output[layerdiskPosInprojout] - '1'; //layer or disk counting from 0
160  unsigned int phiregion = output[phiPosInprojout] - 'A'; //phiregion counting from 0
161 
162  if (output[7] == 'L') {
163  assert(layerdisk < N_LAYER);
164  assert(phiregion < trackletprojlayers_[layerdisk].size());
165  //check that phiregion not already initialized
166  assert(trackletprojlayers_[layerdisk][phiregion] == nullptr);
167  trackletprojlayers_[layerdisk][phiregion] = tmp;
168  return;
169  }
170 
171  if (output[7] == 'D') {
172  assert(layerdisk < N_DISK);
173  assert(phiregion < trackletprojdisks_[layerdisk].size());
174  //check that phiregion not already initialized
175  assert(trackletprojdisks_[layerdisk][phiregion] == nullptr);
176  trackletprojdisks_[layerdisk][phiregion] = tmp;
177  return;
178  }
179  }
180 
181  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find output : " << output;
182 }
183 
185  if (settings_.writetrace()) {
186  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
187  << input;
188  }
189 
190  if (input == "thirdallstubin") {
191  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
192  assert(tmp != nullptr);
193  innerallstubs_.push_back(tmp);
194  return;
195  }
196  if (input == "firstallstubin") {
197  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
198  assert(tmp != nullptr);
199  middleallstubs_.push_back(tmp);
200  return;
201  }
202  if (input == "secondallstubin") {
203  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
204  assert(tmp != nullptr);
205  outerallstubs_.push_back(tmp);
206  return;
207  }
208  if (input.substr(0, 8) == "stubpair") {
209  auto* tmp = dynamic_cast<StubPairsMemory*>(memory);
210  assert(tmp != nullptr);
211  stubpairs_.push_back(tmp);
212  return;
213  }
214 
215  if (input == "thirdvmstubin") {
216  auto* tmp = dynamic_cast<VMStubsTEMemory*>(memory);
217  assert(tmp != nullptr);
218  innervmstubs_.push_back(tmp);
219  return;
220  }
221  if (input == "secondvmstubin") {
222  auto* tmp = dynamic_cast<VMStubsTEMemory*>(memory);
223  assert(tmp != nullptr);
224  // outervmstubs_ = tmp;
225  outervmstubs_.push_back(tmp);
226  return;
227  }
228 
229  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " Could not find input : " << input;
230 }
231 
232 void TrackletProcessorDisplaced::execute(unsigned int iSector, double phimin, double phimax) {
233  unsigned int countall = 0;
234  unsigned int countsel = 0;
235  // unsigned int nThirdStubs = 0;
236  // unsigned int nOuterStubs = 0;
237  count_ = 0;
238 
239  phimin_ = phimin;
240  phimax_ = phimax;
241  iSector_ = iSector;
242 
243  assert(!innerallstubs_.empty());
244  assert(!middleallstubs_.empty());
245  assert(!outerallstubs_.empty());
246  assert(!innervmstubs_.empty());
247  assert(!outervmstubs_.empty());
248  assert(stubpairs_.empty());
249 
250  for (auto& iInnerMem : middleallstubs_) {
251  assert(iInnerMem->nStubs() == iInnerMem->nStubs());
252  for (unsigned int j = 0; j < iInnerMem->nStubs(); j++) {
253  const Stub* firstallstub = iInnerMem->getStub(j);
254 
255  if (settings_.debugTracklet()) {
256  edm::LogVerbatim("Tracklet") << "In " << getName() << " have first stub\n";
257  }
258 
259  int inner = 0;
260  bool negdisk = (firstallstub->disk().value() < 0);
261  int indexz = (((1 << (firstallstub->z().nbits() - 1)) + firstallstub->z().value()) >>
262  (firstallstub->z().nbits() - nbitszfinebintable_));
263  int indexr = -1;
264  if (layerdisk_ > (N_LAYER - 1)) {
265  if (negdisk) {
266  indexz = (1 << nbitszfinebintable_) - indexz;
267  }
268  indexr = firstallstub->r().value();
269  if (firstallstub->isPSmodule()) {
270  indexr = firstallstub->r().value() >> (firstallstub->r().nbits() - nbitsrfinebintable_);
271  }
272  } else {
273  //Take the top nbitsfinebintable_ bits of the z coordinate. The & is to handle the negative z values.
274  indexr = (((1 << (firstallstub->r().nbits() - 1)) + firstallstub->r().value()) >>
275  (firstallstub->r().nbits() - nbitsrfinebintable_));
276  }
277 
278  assert(indexz >= 0);
279  assert(indexr >= 0);
280  assert(indexz < (1 << nbitszfinebintable_));
281  assert(indexr < (1 << nbitsrfinebintable_));
282 
283  // int melut = meTable_.lookup((indexz << nbitsrfinebintable_) + indexr);
284  // assert(melut >= 0);
285 
286  unsigned int lutwidth = settings_.lutwidthtab(inner, iSeed_);
287  if (settings_.extended()) {
289  }
290 
291  int lutval = -999;
292 
293  if (iSeed_ < Seed::L1D1 || iSeed_ > Seed::L2D1) {
294  lutval = innerTable_.lookup((indexz << nbitsrfinebintable_) + indexr);
295  } else {
296  lutval = innerOverlapTable_.lookup((indexz << nbitsrfinebintable_) + indexr);
297  }
298 
299  if (lutval == -1)
300  continue;
301  if (settings_.extended() &&
303  int lutval2 = innerThirdTable_.lookup((indexz << nbitsrfinebintable_) + indexr);
304  if (lutval2 != -1)
305  lutval += (lutval2 << 10);
306  }
307 
308  assert(lutval >= 0);
309  // assert(lutwidth > 0);
310 
311  FPGAWord binlookup(lutval, lutwidth, true, __LINE__, __FILE__);
312 
313  if ((layer1_ == 3 && layer2_ == 4) || (layer1_ == 5 && layer2_ == 6)) {
314  if (settings_.debugTracklet()) {
315  edm::LogVerbatim("Tracklet") << getName() << " Layer-layer pair\n";
316  }
317 
318  constexpr int andlookupbits = 1023;
319  constexpr int shiftzdiffmax = 7;
320  constexpr int andnewbin = 127;
321  constexpr int divbin = 8;
322  constexpr int andzbinfirst = 7;
323  constexpr int shiftstart = 1;
324  constexpr int andlast = 1;
325  constexpr int maxlast = 8;
326 
327  int lookupbits = binlookup.value() & andlookupbits;
328  int zdiffmax = (lookupbits >> shiftzdiffmax);
329  int newbin = (lookupbits & andnewbin);
330  int bin = newbin / divbin;
331 
332  int zbinfirst = newbin & andzbinfirst;
333 
334  int start = (bin >> shiftstart);
335  int last = start + (bin & andlast);
336 
337  assert(last < maxlast);
338 
339  if (settings_.debugTracklet()) {
340  edm::LogVerbatim("Tracklet") << "Will look in zbins " << start << " to " << last << endl;
341  }
342 
343  for (int ibin = start; ibin <= last; ibin++) {
344  for (unsigned int m = 0; m < outervmstubs_.size(); m++) {
345  for (unsigned int j = 0; j < outervmstubs_.at(m)->nVMStubsBinned(ibin); j++) {
346  if (settings_.debugTracklet()) {
347  edm::LogVerbatim("Tracklet")
348  << "In " << getName() << " have second stub(1) " << ibin << " " << j << endl;
349  }
350 
351  const VMStubTE& secondvmstub = outervmstubs_.at(m)->getVMStubTEBinned(ibin, j);
352 
353  int zbin = (secondvmstub.vmbits().value() & 7);
354  if (start != ibin)
355  zbin += 8;
356  if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
357  if (settings_.debugTracklet()) {
358  edm::LogVerbatim("Tracklet") << "Stubpair rejected because of wrong zbin";
359  }
360  continue;
361  }
362 
363  if ((layer2_ == 4 && layer3_ == 2) || (layer2_ == 6 && layer3_ == 4)) {
364  constexpr int vmbitshift = 10;
365  constexpr int andlookupbits_ = 1023;
366  constexpr int andnewbin_ = 127;
367  constexpr int divbin_ = 8;
368  constexpr int shiftstart_ = 1;
369  constexpr int andlast_ = 1;
370 
371  int lookupbits_ = (int)((binlookup.value() >> vmbitshift) & andlookupbits_);
372  int newbin_ = (lookupbits_ & andnewbin_);
373  int bin_ = newbin_ / divbin_;
374 
375  int start_ = (bin_ >> shiftstart_);
376  int last_ = start_ + (bin_ & andlast_);
377 
378  if (settings_.debugTracklet()) {
379  edm::LogVerbatim("Tracklet")
380  << "Will look in zbins for third stub" << start_ << " to " << last_ << endl;
381  }
382 
383  for (int ibin_ = start_; ibin_ <= last_; ibin_++) {
384  for (unsigned int k = 0; k < innervmstubs_.size(); k++) {
385  for (unsigned int l = 0; l < innervmstubs_.at(k)->nVMStubsBinned(ibin_); l++) {
386  if (settings_.debugTracklet()) {
387  edm::LogVerbatim("Tracklet") << "In " << getName() << " have third stub\n";
388  }
389 
390  countall++;
391 
392  const VMStubTE& thirdvmstub = innervmstubs_.at(k)->getVMStubTEBinned(ibin_, l);
393 
394  const Stub* innerFPGAStub = firstallstub;
395  const Stub* middleFPGAStub = secondvmstub.stub();
396  const Stub* outerFPGAStub = thirdvmstub.stub();
397 
398  const L1TStub* innerStub = innerFPGAStub->l1tstub();
399  const L1TStub* middleStub = middleFPGAStub->l1tstub();
400  const L1TStub* outerStub = outerFPGAStub->l1tstub();
401 
402  if (settings_.debugTracklet()) {
403  edm::LogVerbatim("Tracklet")
404  << "LLL seeding\n"
405  << innerFPGAStub->strbare() << middleFPGAStub->strbare() << outerFPGAStub->strbare()
406  << innerStub->stubword() << middleStub->stubword() << outerStub->stubword()
407  << innerFPGAStub->layerdisk() << middleFPGAStub->layerdisk() << outerFPGAStub->layerdisk();
408  }
409 
410  if (settings_.debugTracklet()) {
411  edm::LogVerbatim("Tracklet")
412  << "TrackletCalculatorDisplaced execute " << getName() << "[" << iSector_ << "]";
413  }
414 
415  if (innerFPGAStub->layerdisk() < N_LAYER && middleFPGAStub->layerdisk() < N_LAYER &&
416  outerFPGAStub->layerdisk() < N_LAYER) {
417  bool accept =
418  LLLSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub, middleFPGAStub, middleStub);
419 
420  if (accept)
421  countsel++;
422  } else if (innerFPGAStub->layerdisk() >= N_LAYER && middleFPGAStub->layerdisk() >= N_LAYER &&
423  outerFPGAStub->layerdisk() >= N_LAYER) {
424  throw cms::Exception("LogicError") << __FILE__ << " " << __LINE__ << " Invalid seeding!";
425  }
426 
427  if (settings_.debugTracklet()) {
428  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute done";
429  }
430  }
431  }
432  }
433  }
434  }
435  }
436  }
437 
438  } else if (layer1_ == 2 && layer2_ == 3) {
439  if (settings_.debugTracklet()) {
440  edm::LogVerbatim("Tracklet") << getName() << " Layer-layer pair";
441  }
442 
443  constexpr int andlookupbits = 1023;
444  constexpr int shiftzdiffmax = 7;
445  constexpr int andnewbin = 127;
446  constexpr int divbin = 8;
447  constexpr int andzbinfirst = 7;
448  constexpr int shiftstart = 1;
449  constexpr int andlast = 1;
450  constexpr int maxlast = 8;
451 
452  int lookupbits = binlookup.value() & andlookupbits;
453  int zdiffmax = (lookupbits >> shiftzdiffmax);
454  int newbin = (lookupbits & andnewbin);
455  int bin = newbin / divbin;
456 
457  int zbinfirst = newbin & andzbinfirst;
458 
459  int start = (bin >> shiftstart);
460  int last = start + (bin & andlast);
461 
462  assert(last < maxlast);
463 
464  if (settings_.debugTracklet()) {
465  edm::LogVerbatim("Tracklet") << "Will look in zbins " << start << " to " << last;
466  }
467 
468  for (int ibin = start; ibin <= last; ibin++) {
469  for (unsigned int m = 0; m < outervmstubs_.size(); m++) {
470  for (unsigned int j = 0; j < outervmstubs_.at(m)->nVMStubsBinned(ibin); j++) {
471  if (settings_.debugTracklet()) {
472  edm::LogVerbatim("Tracklet") << "In " << getName() << " have second stub(1) " << ibin << " " << j;
473  }
474 
475  const VMStubTE& secondvmstub = outervmstubs_.at(m)->getVMStubTEBinned(ibin, j);
476 
477  int zbin = (secondvmstub.vmbits().value() & 7);
478  if (start != ibin)
479  zbin += 8;
480  if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
481  if (settings_.debugTracklet()) {
482  edm::LogVerbatim("Tracklet") << "Stubpair rejected because of wrong zbin";
483  }
484  continue;
485  }
486 
487  if (layer2_ == 3 && disk3_ == 1) {
488  constexpr int vmbitshift = 10;
489  constexpr int andlookupbits_ = 1023;
490  constexpr int andnewbin_ = 127;
491  constexpr int divbin_ = 8;
492  constexpr int shiftstart_ = 1;
493  constexpr int andlast_ = 1;
494 
495  int lookupbits_ = (int)((binlookup.value() >> vmbitshift) & andlookupbits_);
496  int newbin_ = (lookupbits_ & andnewbin_);
497  int bin_ = newbin_ / divbin_;
498 
499  int start_ = (bin_ >> shiftstart_);
500  int last_ = start_ + (bin_ & andlast_);
501 
502  for (int ibin_ = start_; ibin_ <= last_; ibin_++) {
503  for (unsigned int k = 0; k < innervmstubs_.size(); k++) {
504  for (unsigned int l = 0; l < innervmstubs_.at(k)->nVMStubsBinned(ibin_); l++) {
505  if (settings_.debugTracklet()) {
506  edm::LogVerbatim("Tracklet") << "In " << getName() << " have third stub";
507  }
508 
509  countall++;
510 
511  const VMStubTE& thirdvmstub = innervmstubs_.at(k)->getVMStubTEBinned(ibin_, l);
512 
513  const Stub* innerFPGAStub = firstallstub;
514  const Stub* middleFPGAStub = secondvmstub.stub();
515  const Stub* outerFPGAStub = thirdvmstub.stub();
516 
517  const L1TStub* innerStub = innerFPGAStub->l1tstub();
518  const L1TStub* middleStub = middleFPGAStub->l1tstub();
519  const L1TStub* outerStub = outerFPGAStub->l1tstub();
520 
521  if (settings_.debugTracklet()) {
522  edm::LogVerbatim("Tracklet")
523  << "LLD seeding\n"
524  << innerFPGAStub->strbare() << middleFPGAStub->strbare() << outerFPGAStub->strbare()
525  << innerStub->stubword() << middleStub->stubword() << outerStub->stubword()
526  << innerFPGAStub->layerdisk() << middleFPGAStub->layerdisk() << outerFPGAStub->layerdisk();
527  }
528 
529  if (settings_.debugTracklet()) {
530  edm::LogVerbatim("Tracklet")
531  << "TrackletCalculatorDisplaced execute " << getName() << "[" << iSector_ << "]";
532  }
533 
534  bool accept =
535  LLDSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub, middleFPGAStub, middleStub);
536 
537  if (accept)
538  countsel++;
539 
540  if (settings_.debugTracklet()) {
541  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute done";
542  }
543  }
544  }
545  }
546  }
547  }
548  }
549  }
550 
551  } else if (disk1_ == 1 && disk2_ == 2) {
552  if (settings_.debugTracklet())
553  edm::LogVerbatim("Tracklet") << getName() << " Disk-disk pair";
554 
555  constexpr int andlookupbits = 511;
556  constexpr int shiftrdiffmax = 6;
557  constexpr int andnewbin = 63;
558  constexpr int divbin = 8;
559  constexpr int andrbinfirst = 7;
560  constexpr int shiftstart = 1;
561  constexpr int andlast = 1;
562  constexpr int maxlast = 8;
563 
564  int lookupbits = binlookup.value() & andlookupbits;
565  bool negdisk = firstallstub->disk().value() < 0;
566  int rdiffmax = (lookupbits >> shiftrdiffmax);
567  int newbin = (lookupbits & andnewbin);
568  int bin = newbin / divbin;
569 
570  int rbinfirst = newbin & andrbinfirst;
571 
572  int start = (bin >> shiftstart);
573  if (negdisk)
574  start += 4;
575  int last = start + (bin & andlast);
576  assert(last < maxlast);
577 
578  for (int ibin = start; ibin <= last; ibin++) {
579  for (unsigned int m = 0; m < outervmstubs_.size(); m++) {
580  if (settings_.debugTracklet()) {
581  edm::LogVerbatim("Tracklet")
582  << getName() << " looking for matching stub in " << outervmstubs_.at(m)->getName()
583  << " in bin = " << ibin << " with " << outervmstubs_.at(m)->nVMStubsBinned(ibin) << " stubs";
584  }
585 
586  for (unsigned int j = 0; j < outervmstubs_.at(m)->nVMStubsBinned(ibin); j++) {
587  const VMStubTE& secondvmstub = outervmstubs_.at(m)->getVMStubTEBinned(ibin, j);
588  int rbin = (secondvmstub.vmbits().value() & 7);
589  if (start != ibin)
590  rbin += 8;
591  if (rbin < rbinfirst)
592  continue;
593  if (rbin - rbinfirst > rdiffmax)
594  continue;
595 
596  if (disk2_ == 2 && layer3_ == 2) {
597  constexpr int vmbitshift = 10;
598  constexpr int andlookupbits_ = 1023;
599  constexpr int andnewbin_ = 127;
600  constexpr int divbin_ = 8;
601  constexpr int shiftstart_ = 1;
602  constexpr int andlast_ = 1;
603 
604  int lookupbits_ = (int)((binlookup.value() >> vmbitshift) & andlookupbits_);
605  int newbin_ = (lookupbits_ & andnewbin_);
606  int bin_ = newbin_ / divbin_;
607 
608  int start_ = (bin_ >> shiftstart_);
609  int last_ = start_ + (bin_ & andlast_);
610 
611  if (firstallstub->disk().value() < 0) { //TODO - negative disk should come from memory
612  start_ = settings_.NLONGVMBINS() - last_ - 1;
613  last_ = settings_.NLONGVMBINS() - start_ - 1;
614  }
615 
616  for (int ibin_ = start_; ibin_ <= last_; ibin_++) {
617  for (unsigned int k = 0; k < innervmstubs_.size(); k++) {
618  for (unsigned int l = 0; l < innervmstubs_.at(k)->nVMStubsBinned(ibin_); l++) {
619  if (settings_.debugTracklet()) {
620  edm::LogVerbatim("Tracklet") << "In " << getName() << " have third stub";
621  }
622 
623  countall++;
624 
625  const VMStubTE& thirdvmstub = innervmstubs_.at(k)->getVMStubTEBinned(ibin_, l);
626 
627  const Stub* innerFPGAStub = firstallstub;
628  const Stub* middleFPGAStub = secondvmstub.stub();
629  const Stub* outerFPGAStub = thirdvmstub.stub();
630 
631  const L1TStub* innerStub = innerFPGAStub->l1tstub();
632  const L1TStub* middleStub = middleFPGAStub->l1tstub();
633  const L1TStub* outerStub = outerFPGAStub->l1tstub();
634 
635  if (settings_.debugTracklet()) {
636  edm::LogVerbatim("Tracklet")
637  << "DDL seeding\n"
638  << innerFPGAStub->strbare() << middleFPGAStub->strbare() << outerFPGAStub->strbare()
639  << innerStub->stubword() << middleStub->stubword() << outerStub->stubword()
640  << innerFPGAStub->layerdisk() << middleFPGAStub->layerdisk() << outerFPGAStub->layerdisk();
641  }
642 
643  if (settings_.debugTracklet()) {
644  edm::LogVerbatim("Tracklet")
645  << "TrackletCalculatorDisplaced execute " << getName() << "[" << iSector_ << "]";
646  }
647 
648  bool accept =
649  DDLSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub, middleFPGAStub, middleStub);
650 
651  if (accept)
652  countsel++;
653 
654  if (settings_.debugTracklet()) {
655  edm::LogVerbatim("Tracklet") << "TrackletCalculatorDisplaced execute done";
656  }
657  }
658  }
659  }
660  }
661  }
662  }
663  }
664  }
665  }
666  }
667 
668  if (settings_.writeMonitorData("TPD")) {
669  globals_->ofstream("trackletprocessordisplaced.txt") << getName() << " " << countall << " " << countsel << endl;
670  }
671 }
Definition: start.py:1
unsigned int vmrlutrbits(unsigned int layerdisk) const
Definition: Settings.h:191
Log< level::Info, true > LogVerbatim
std::vector< AllStubsMemory * > middleallstubs_
constexpr int N_DISK
Definition: Settings.h:26
const FPGAWord & r() const
Definition: Stub.h:65
double lutwidthtab(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:149
std::string name_
Definition: ProcessBase.h:38
std::vector< AllStubsMemory * > innerallstubs_
const FPGAWord & z() const
Definition: Stub.h:66
std::string strbare() const
Definition: Stub.h:40
Settings const & settings_
Definition: ProcessBase.h:40
Globals * globals_
Definition: ProcessBase.h:41
int lookup(unsigned int index) const
bool writetrace() const
Definition: Settings.h:195
std::vector< VMStubsTEMemory * > innervmstubs_
assert(be >=bs)
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
Definition: TopDQMHelpers.h:31
static std::string const input
Definition: EdmProvDump.cc:50
unsigned int NLONGVMBINS() const
Definition: Settings.h:369
const FPGAWord & disk() const
Definition: Stub.h:74
bool LLDSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
const Stub * stub() const
Definition: VMStubTE.h:29
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
void execute(unsigned int iSector, double phimin, double phimax)
Divides< A, C > D1
Definition: Factorize.h:136
bool LLLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
const FPGAWord & vmbits() const
Definition: VMStubTE.h:27
int value() const
Definition: FPGAWord.h:24
double lutwidthtabextended(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:150
L1TStub * l1tstub()
Definition: Stub.h:83
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
bool writeMonitorData(std::string module) const
Definition: Settings.h:118
unsigned int layerdisk() const
Definition: Stub.cc:193
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: ProcessBase.cc:33
unsigned int nallstubs(unsigned int layerdisk) const
Definition: Settings.h:116
bool debugTracklet() const
Definition: Settings.h:194
std::vector< StubPairsMemory * > stubpairs_
bool DDLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
int nbits() const
Definition: FPGAWord.h:25
const std::string & stubword() const
Definition: L1TStub.h:123
bool isPSmodule() const
Definition: Stub.h:77
bool extended() const
Definition: Settings.h:268
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
Definition: output.py:1
std::vector< AllStubsMemory * > outerallstubs_
void addOutput(MemoryBase *memory, std::string output) override
tmp
align.sh
Definition: createJobs.py:716
std::vector< VMStubsTEMemory * > outervmstubs_
std::string const & getName() const
Definition: ProcessBase.h:22
void addOutputProjection(TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
void initVMRTable(unsigned int layerdisk, VMRTableType type, int region=-1)
Definition: TrackletLUT.cc:998
void addInput(MemoryBase *memory, std::string input) override
unsigned int vmrlutzbits(unsigned int layerdisk) const
Definition: Settings.h:190
constexpr int N_LAYER
Definition: Settings.h:25