CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
trklet::MatchProcessor Class Reference

#include <MatchProcessor.h>

Inheritance diagram for trklet::MatchProcessor:
trklet::ProcessBase

Public Member Functions

void addInput (MemoryBase *memory, std::string input) override
 
void addOutput (MemoryBase *memory, std::string output) override
 
void execute (unsigned int iSector, double phimin)
 
bool matchCalculator (Tracklet *tracklet, const Stub *fpgastub, bool print, unsigned int istep)
 
 MatchProcessor (std::string name, Settings const &settings, Globals *global)
 
 ~MatchProcessor () override=default
 
- Public Member Functions inherited from trklet::ProcessBase
unsigned int getISeed (const std::string &name)
 
std::string const & getName () const
 
void initLayerDisk (unsigned int pos, int &layer, int &disk)
 
void initLayerDisk (unsigned int pos, int &layer, int &disk, int &layerdisk)
 
unsigned int initLayerDisk (unsigned int pos)
 
void initLayerDisksandISeed (unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
 
unsigned int nbits (unsigned int power)
 
 ProcessBase (std::string name, Settings const &settings, Globals *global)
 
virtual ~ProcessBase ()=default
 

Private Attributes

AllStubsMemoryallstubs_
 
TrackletLUT alphainner_
 
TrackletLUT alphaouter_
 
bool barrel_
 
int best_ideltaphi_barrel
 
int best_ideltaphi_disk
 
int best_ideltar_disk
 
int best_ideltaz_barrel
 
Trackletcurr_tracklet
 
TrackletLUT diskRadius_
 
int dzshift_
 
bool first_
 
std::vector< FullMatchMemory * > fullmatches_
 
int ialphafactinner_ [N_DSS_MOD *2]
 
int ialphafactouter_ [N_DSS_MOD *2]
 
int icorrshift_
 
int icorzshift_
 
CircularBuffer< ProjectionTempinputProjBuffer_
 
std::vector< TrackletProjectionsMemory * > inputprojs_
 
unsigned int layerdisk_
 
TrackletLUT luttable_
 
std::vector< MatchEngineUnitmatchengines_
 
Trackletnext_tracklet
 
unsigned int nMatchEngines_
 
int nphiderbits_
 
int nrbits_
 
int nrinv_
 
int nrprojbits_
 
int nvm_
 
int nvmbins_
 
int nvmbits_
 
TrackletLUT phimatchcuttable_
 
double phimin_
 
unsigned int phiregion_
 
int phishift_
 
TrackletLUT rcut2Stable_
 
TrackletLUT rcutPStable_
 
TrackletLUT rinvbendlut_
 
TrackletLUT rphicut2Stable_
 
TrackletLUT rphicutPStable_
 
TrackletLUT rSSinner_
 
TrackletLUT rSSouter_
 
std::vector< VMStubsMEMemory * > vmstubs_
 
TrackletLUT zmatchcuttable_
 

Additional Inherited Members

- Protected Attributes inherited from trklet::ProcessBase
Globalsglobals_
 
std::string name_
 
Settings const & settings_
 

Detailed Description

Definition at line 25 of file MatchProcessor.h.

Constructor & Destructor Documentation

◆ MatchProcessor()

MatchProcessor::MatchProcessor ( std::string  name,
Settings const &  settings,
Globals global 
)

Definition at line 28 of file MatchProcessor.cc.

References alphainner_, alphaouter_, trklet::Settings::alphashift(), cms::cuda::assert(), barrel_, best_ideltaphi_barrel, best_ideltaphi_disk, best_ideltar_disk, best_ideltaz_barrel, curr_tracklet, trklet::IMATH_TrackletCalculator::der_phiD_final, diskRadius_, dzshift_, first_, trklet::ProcessBase::getName(), trklet::Settings::half2SmoduleWidth(), mps_fire::i, ialphafactinner_, ialphafactouter_, icorrshift_, icorzshift_, trklet::ilog2(), trklet::TrackletLUT::initBendMatch(), trklet::ProcessBase::initLayerDisk(), trklet::TrackletLUT::initmatchcut(), trklet::TrackletLUT::initProjectionBend(), trklet::TrackletLUT::initProjectionDiskRadius(), trklet::Globals::ITC_L1L2(), trklet::VarBase::K(), trklet::Settings::kphi(), trklet::Settings::kphider(), trklet::Settings::kphiderdisk(), trklet::Settings::krbarrel(), trklet::Settings::krder(), trklet::Settings::krprojshiftdisk(), trklet::Settings::kz(), trklet::Settings::kzder(), layerdisk_, luttable_, matchengines_, trklet::N_DSS_MOD, trklet::N_LAYER, trklet::Settings::nallstubs(), Skims_PA_cff::name, trklet::Settings::nbitsallstubs(), trklet::Settings::nbitsalpha(), trklet::Settings::nbitsvmme(), next_tracklet, nMatchEngines_, trklet::Settings::nphibitsstub(), nphiderbits_, nrbits_, nrinv_, trklet::NRINVBITS, nrprojbits_, nvm_, nvmbins_, nvmbits_, trklet::Settings::nvmme(), trklet::Settings::nzbitsstub(), phimatchcuttable_, phiregion_, phishift_, rcut2Stable_, rcutPStable_, trklet::Settings::rDSSinner(), trklet::Settings::rDSSouter(), nano_mu_digi_cff::region, rinvbendlut_, rphicut2Stable_, rphicutPStable_, rSSinner_, rSSouter_, trklet::MatchEngineUnit::setimeu(), trklet::ProcessBase::settings_, and zmatchcuttable_.

29  : ProcessBase(name, settings, global),
30  phimatchcuttable_(settings),
31  zmatchcuttable_(settings),
32  rphicutPStable_(settings),
33  rphicut2Stable_(settings),
34  rcutPStable_(settings),
35  rcut2Stable_(settings),
36  alphainner_(settings),
37  alphaouter_(settings),
38  rSSinner_(settings),
39  rSSouter_(settings),
40  diskRadius_(settings),
41  fullmatches_(12),
42  rinvbendlut_(settings),
43  luttable_(settings),
44  inputProjBuffer_(3) {
45  phiregion_ = name[8] - 'A';
46 
48 
50 
53 
54  if (barrel_) {
57  } else {
60  }
61 
63 
64  nrbits_ = 5;
65  nphiderbits_ = 6;
66 
67  nrprojbits_ = 8;
68 
69  if (!barrel_) {
72  }
73 
74  nrinv_ = NRINVBITS;
75 
76  unsigned int region = getName()[8] - 'A';
78 
79  if (barrel_) {
80  phimatchcuttable_.initmatchcut(layerdisk_, TrackletLUT::MatchType::barrelphi, region);
81  zmatchcuttable_.initmatchcut(layerdisk_, TrackletLUT::MatchType::barrelz, region);
82  } else {
83  rphicutPStable_.initmatchcut(layerdisk_, TrackletLUT::MatchType::diskPSphi, region);
84  rphicut2Stable_.initmatchcut(layerdisk_, TrackletLUT::MatchType::disk2Sphi, region);
85  rcutPStable_.initmatchcut(layerdisk_, TrackletLUT::MatchType::diskPSr, region);
86  rcut2Stable_.initmatchcut(layerdisk_, TrackletLUT::MatchType::disk2Sr, region);
87  alphainner_.initmatchcut(layerdisk_, TrackletLUT::MatchType::alphainner, region);
88  alphaouter_.initmatchcut(layerdisk_, TrackletLUT::MatchType::alphaouter, region);
89  rSSinner_.initmatchcut(layerdisk_, TrackletLUT::MatchType::rSSinner, region);
90  rSSouter_.initmatchcut(layerdisk_, TrackletLUT::MatchType::rSSouter, region);
92  }
93 
94  for (unsigned int i = 0; i < N_DSS_MOD * 2; i++) {
96  (1 << (settings_.nbitsalpha() - 1)) / (settings_.rDSSinner(i) * settings_.rDSSinner(i)) /
97  settings_.kphi();
99  (1 << (settings_.nbitsalpha() - 1)) / (settings_.rDSSouter(i) * settings_.rDSSouter(i)) /
100  settings_.kphi();
101  }
102 
106 
107  nMatchEngines_ = 4;
108  for (unsigned int iME = 0; iME < nMatchEngines_; iME++) {
110  tmpME.setimeu(iME);
111  matchengines_.push_back(tmpME);
112  }
113 
114  // Pick some initial large values
115  best_ideltaphi_barrel = 0xFFFF;
116  best_ideltaz_barrel = 0xFFFF;
117  best_ideltaphi_disk = 0xFFFF;
118  best_ideltar_disk = 0xFFFF;
119  curr_tracklet = nullptr;
120  next_tracklet = nullptr;
121  first_ = false;
122 }
void initBendMatch(unsigned int layerdisk)
Definition: TrackletLUT.cc:901
double kz() const
Definition: Settings.h:342
double kphiderdisk() const
Definition: Settings.h:435
void initmatchcut(unsigned int layerdisk, MatchType type, unsigned int region)
Definition: TrackletLUT.cc:190
double rDSSinner(unsigned int iBin) const
Definition: Settings.h:183
std::vector< MatchEngineUnit > matchengines_
double kphider() const
Definition: Settings.h:434
constexpr unsigned int NRINVBITS
Definition: Settings.h:36
void initProjectionBend(double k_phider, unsigned int idisk, unsigned int nrbits, unsigned int nphiderbits)
Definition: TrackletLUT.cc:801
Settings const & settings_
Definition: ProcessBase.h:40
TrackletLUT phimatchcuttable_
double krder() const
Definition: Settings.h:437
constexpr unsigned int N_DSS_MOD
Definition: Settings.h:31
assert(be >=bs)
ProcessBase(std::string name, Settings const &settings, Globals *global)
Definition: ProcessBase.cc:14
double kzder() const
Definition: Settings.h:436
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:115
double half2SmoduleWidth() const
Definition: Settings.h:140
unsigned int nzbitsstub(unsigned int layerdisk) const
Definition: Settings.h:91
unsigned int nphibitsstub(unsigned int layerdisk) const
Definition: Settings.h:92
int ilog2(double factor)
Definition: Util.h:121
double rDSSouter(unsigned int iBin) const
Definition: Settings.h:186
std::vector< FullMatchMemory * > fullmatches_
IMATH_TrackletCalculator * ITC_L1L2()
Definition: Globals.h:48
int alphashift() const
Definition: Settings.h:228
unsigned int nbitsvmme(unsigned int layerdisk) const
Definition: Settings.h:112
CircularBuffer< ProjectionTemp > inputProjBuffer_
void initLayerDisk(unsigned int pos, int &layer, int &disk)
Definition: ProcessBase.cc:33
double K() const
Definition: imath.h:247
TrackletLUT rphicutPStable_
unsigned int nallstubs(unsigned int layerdisk) const
Definition: Settings.h:116
TrackletLUT rphicut2Stable_
int ialphafactinner_[N_DSS_MOD *2]
unsigned int nvmme(unsigned int layerdisk) const
Definition: Settings.h:113
unsigned int nMatchEngines_
int nbitsalpha() const
Definition: Settings.h:229
double krbarrel() const
Definition: Settings.h:345
double krprojshiftdisk() const
Definition: Settings.h:441
void initProjectionDiskRadius(int nrbits)
Definition: TrackletLUT.cc:854
double kphi() const
Definition: Settings.h:338
std::string const & getName() const
Definition: ProcessBase.h:22
TrackletLUT zmatchcuttable_
int ialphafactouter_[N_DSS_MOD *2]
constexpr int N_LAYER
Definition: Settings.h:25

◆ ~MatchProcessor()

trklet::MatchProcessor::~MatchProcessor ( )
overridedefault

Member Function Documentation

◆ addInput()

void MatchProcessor::addInput ( MemoryBase memory,
std::string  input 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 141 of file MatchProcessor.cc.

References allstubs_, cms::cuda::assert(), Exception, input, inputprojs_, mps_setup::memory, trklet::ProcessBase::name_, trklet::ProcessBase::settings_, createJobs::tmp, vmstubs_, and trklet::Settings::writetrace().

141  {
142  if (settings_.writetrace()) {
143  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
144  << input;
145  }
146  if (input == "allstubin") {
147  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
148  assert(tmp != nullptr);
149  allstubs_ = tmp;
150  return;
151  }
152  if (input == "vmstubin") {
153  auto* tmp = dynamic_cast<VMStubsMEMemory*>(memory);
154  assert(tmp != nullptr);
155  vmstubs_.push_back(tmp); //to allow more than one stub in? vmstubs_=tmp;
156  return;
157  }
158  if (input == "projin") {
159  auto* tmp = dynamic_cast<TrackletProjectionsMemory*>(memory);
160  assert(tmp != nullptr);
161  inputprojs_.push_back(tmp);
162  return;
163  }
164  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " could not find input: " << input;
165 }
Log< level::Info, true > LogVerbatim
std::string name_
Definition: ProcessBase.h:38
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:195
std::vector< TrackletProjectionsMemory * > inputprojs_
assert(be >=bs)
static std::string const input
Definition: EdmProvDump.cc:50
std::vector< VMStubsMEMemory * > vmstubs_
tmp
align.sh
Definition: createJobs.py:716
AllStubsMemory * allstubs_

◆ addOutput()

void MatchProcessor::addOutput ( MemoryBase memory,
std::string  output 
)
overridevirtual

Implements trklet::ProcessBase.

Definition at line 124 of file MatchProcessor.cc.

References cms::cuda::assert(), Exception, fullmatches_, trklet::ProcessBase::getISeed(), mps_setup::memory, trklet::ProcessBase::name_, convertSQLitetoXML_cfg::output, trklet::ProcessBase::settings_, createJobs::tmp, and trklet::Settings::writetrace().

124  {
125  if (settings_.writetrace()) {
126  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding output to " << memory->getName() << " to output "
127  << output;
128  }
129  if (output.find("matchout") != std::string::npos) {
130  auto* tmp = dynamic_cast<FullMatchMemory*>(memory);
131  assert(tmp != nullptr);
132  unsigned int iSeed = getISeed(tmp->getName());
133  assert(iSeed < fullmatches_.size());
134  assert(fullmatches_[iSeed] == nullptr);
135  fullmatches_[iSeed] = tmp;
136  return;
137  }
138  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " could not find output: " << output;
139 }
Log< level::Info, true > LogVerbatim
std::string name_
Definition: ProcessBase.h:38
Settings const & settings_
Definition: ProcessBase.h:40
bool writetrace() const
Definition: Settings.h:195
assert(be >=bs)
std::vector< FullMatchMemory * > fullmatches_
unsigned int getISeed(const std::string &name)
Definition: ProcessBase.cc:119
Definition: output.py:1
tmp
align.sh
Definition: createJobs.py:716

◆ execute()

void MatchProcessor::execute ( unsigned int  iSector,
double  phimin 
)

Definition at line 167 of file MatchProcessor.cc.

References cms::cuda::assert(), barrel_, trklet::FPGAWord::bits(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), trklet::Settings::debugTracklet(), diskRadius_, relativeConstraints::empty, trklet::MemoryBase::getName(), trklet::ProcessBase::getName(), trklet::TrackletProjectionsMemory::getTracklet(), trklet::ProcessBase::globals_, inputProjBuffer_, inputprojs_, hcalRecHitTable_cff::iphi, trklet::ProjectionTemp::iphi(), trklet::ProjectionTemp::isPSseed(), layerdisk_, trklet::TrackletLUT::lookup(), matchCalculator(), matchengines_, trklet::Settings::maxStep(), trklet::N_LAYER, trklet::N_RZBITS, LaserClient_cfi::nbins, trklet::FPGAWord::nbits(), trklet::Settings::nbitsvmme(), trklet::NFINEPHIBITS, nMatchEngines_, nphiderbits_, nrbits_, nrinv_, nrprojbits_, trklet::VMStubsMEMemory::nStubsBin(), trklet::TrackletProjectionsMemory::nTracklets(), nvmbins_, nvmbits_, trklet::Globals::ofstream(), phimin, phimin_, print(), amptDefault_cfi::proj, trklet::ProjectionTemp::proj(), trklet::ProjectionTemp::projfinephi(), trklet::ProjectionTemp::projfinerz(), trklet::ProjectionTemp::projrinv(), rinvbendlut_, edm::second(), trklet::ProcessBase::settings_, edm::shift, trklet::ProjectionTemp::shift(), trklet::ProjectionTemp::slot(), FCDTask_cfi::slot, trklet::Tracklet::TCID(), mitigatedMETSequence_cff::U, trklet::ProjectionTemp::use(), trklet::FPGAWord::value(), vmstubs_, and trklet::Settings::writeMonitorData().

167  {
168  assert(vmstubs_.size() == 1);
169 
170  /*
171  The code is organized in three 'steps' corresponding to the PR, ME, and MC functions. The output from
172  the PR step is buffered in a 'circular' buffer, and similarly the ME output is put in a circular buffer.
173  The implementation is done in steps, emulating what can be done in firmware. On each step we do:
174 
175  1) A projection is read and if there is space it is insert into the inputProjBuffer_
176 
177  2) Process next match in the ME - if there is an idle ME the next projection is inserted
178 
179  3) Readout match from ME and send to match calculator
180 
181  However, for the pipelining to work in HLS these blocks are executed in reverse order
182 
183  */
184 
185  bool print = getName() == "MP_L3PHIC" && iSector == 3;
186  print = false;
187 
188  phimin_ = phimin;
189 
190  Tracklet* oldTracklet = nullptr;
191 
192  unsigned int countme = 0;
193  unsigned int countall = 0;
194  unsigned int countsel = 0;
195  unsigned int countinputproj = 0;
196 
197  unsigned int iprojmem = 0;
198  while (iprojmem < inputprojs_.size() && inputprojs_[iprojmem]->nTracklets() == 0) {
199  iprojmem++;
200  }
201 
202  unsigned int iproj = 0;
203 
204  inputProjBuffer_.reset();
205 
206  for (const auto& inputproj : inputprojs_) {
207  countinputproj += inputproj->nTracklets();
208  }
209 
210  for (auto& matchengine : matchengines_) {
211  matchengine.reset();
212  }
213 
214  ProjectionTemp tmpProj_, tmpProj__;
215  bool good_ = false;
216  bool good__ = false;
217 
218  for (unsigned int istep = 0; istep < settings_.maxStep("MP"); istep++) {
219  // This print statement is useful for detailed comparison with the HLS code
220  // It prints out detailed status information for each clock step
221  /*
222  if (print) {
223  cout << "istep = "<<istep<<" projBuff: "<<inputProjBuffer_.rptr()<<" "<<inputProjBuffer_.wptr()<<" "<<projBuffNearFull;
224  unsigned int iMEU = 0;
225  for (auto& matchengine : matchengines_) {
226  cout <<" MEU"<<iMEU<<": "<<matchengine.rptr()<<" "<<matchengine.wptr()
227  <<" "<<matchengine.idle()<<" "<<matchengine.empty()
228  <<" "<<matchengine.TCID();
229  iMEU++;
230  }
231  cout << std::endl;
232  }
233  */
234 
235  //First do some caching of state at the start of the clock
236 
237  bool projdone = false;
238 
239  bool projBuffNearFull = inputProjBuffer_.nearfull();
240 
241  for (unsigned int iME = 0; iME < nMatchEngines_; iME++) {
242  matchengines_[iME].setAlmostFull();
243  }
244 
245  //Step 3
246  //Check if we have candidate match to process
247 
248  unsigned int iMEbest = 0;
249  int bestTCID = matchengines_[0].TCID();
250  bool meactive = matchengines_[0].active();
251  for (unsigned int iME = 1; iME < nMatchEngines_; iME++) {
252  meactive = meactive || matchengines_[iME].active();
253  int tcid = matchengines_[iME].TCID();
254  if (tcid < bestTCID) {
255  bestTCID = tcid;
256  iMEbest = iME;
257  }
258  }
259 
260  // check if the matche engine processing the smallest tcid has match
261 
262  if (!matchengines_[iMEbest].empty()) {
263  std::pair<Tracklet*, const Stub*> candmatch = matchengines_[iMEbest].read();
264 
265  const Stub* fpgastub = candmatch.second;
266  Tracklet* tracklet = candmatch.first;
267 
268  //Consistency check
269  if (oldTracklet != nullptr) {
270  //allow equal here since we can have more than one cadidate match per tracklet projection
271  //cout << "old new : "<<oldTracklet->TCID()<<" "<<tracklet->TCID()<<" "<<iMEbest<<endl;
272  assert(oldTracklet->TCID() <= tracklet->TCID());
273  }
274  oldTracklet = tracklet;
275 
276  bool match = matchCalculator(tracklet, fpgastub, print, istep);
277 
278  if (settings_.debugTracklet() && match) {
279  edm::LogVerbatim("Tracklet") << getName() << " have match";
280  }
281 
282  countall++;
283  if (match)
284  countsel++;
285  }
286 
287  //Step 2
288  //Check if we have ME that can process projection
289 
290  bool addedProjection = false;
291  for (unsigned int iME = 0; iME < nMatchEngines_; iME++) {
292  if (!matchengines_[iME].idle())
293  countme++;
294  //if match engine empty and we have queued projections add to match engine
295  if ((!addedProjection) && matchengines_[iME].idle() && (!inputProjBuffer_.empty())) {
296  ProjectionTemp tmpProj = inputProjBuffer_.read();
297  VMStubsMEMemory* stubmem = vmstubs_[0];
298 
299  if (settings_.debugTracklet()) {
300  edm::LogVerbatim("Tracklet") << getName() << " adding projection to match engine";
301  }
302 
303  int nbins = (1 << N_RZBITS);
304  if (layerdisk_ >= N_LAYER) {
305  nbins *= 2; //twice as many bins in disks (since there are two disks)
306  }
307 
308  matchengines_[iME].init(stubmem,
309  nbins,
310  tmpProj.slot(),
311  tmpProj.iphi(),
312  tmpProj.shift(),
313  tmpProj.projrinv(),
314  tmpProj.projfinerz(),
315  tmpProj.projfinephi(),
316  tmpProj.use(0, 0),
317  tmpProj.use(0, 1),
318  tmpProj.use(1, 0),
319  tmpProj.use(1, 1),
320  tmpProj.isPSseed(),
321  tmpProj.proj());
322  meactive = true;
323  addedProjection = true;
324  } else {
325  matchengines_[iME].step();
326  }
327  matchengines_[iME].processPipeline();
328  }
329 
330  //Step 1
331  //First step here checks if we have more input projections to put into
332  //the input puffer for projections
333 
334  if (good__) {
335  inputProjBuffer_.store(tmpProj__);
336  }
337 
338  good__ = good_;
339  tmpProj__ = tmpProj_;
340 
341  good_ = false;
342 
343  if (iprojmem < inputprojs_.size()) {
344  TrackletProjectionsMemory* projMem = inputprojs_[iprojmem];
345  if (!projBuffNearFull) {
346  if (settings_.debugTracklet()) {
347  edm::LogVerbatim("Tracklet") << getName() << " have projection in memory : " << projMem->getName();
348  }
349 
350  Tracklet* proj = projMem->getTracklet(iproj);
351 
352  FPGAWord fpgaphi = proj->proj(layerdisk_).fpgaphiproj();
353 
354  unsigned int iphi = (fpgaphi.value() >> (fpgaphi.nbits() - nvmbits_)) & (nvmbins_ - 1);
355 
356  constexpr int nextrabits = 2;
357  int overlapbits = nvmbits_ + nextrabits;
358 
359  unsigned int extrabits = fpgaphi.bits(fpgaphi.nbits() - overlapbits - nextrabits, nextrabits);
360 
361  unsigned int ivmPlus = iphi;
362 
363  int shift = 0;
364 
365  if (extrabits == ((1U << nextrabits) - 1) && iphi != ((1U << settings_.nbitsvmme(layerdisk_)) - 1)) {
366  shift = 1;
367  ivmPlus++;
368  }
369  unsigned int ivmMinus = iphi;
370  if (extrabits == 0 && iphi != 0) {
371  shift = -1;
372  ivmMinus--;
373  }
374 
375  int projrinv = -1;
376  if (barrel_) {
377  FPGAWord phider = proj->proj(layerdisk_).fpgaphiprojder();
378  projrinv = (1 << (nrinv_ - 1)) - 1 - (phider.value() >> (phider.nbits() - nrinv_));
379  } else {
380  //The next lines looks up the predicted bend based on:
381  // 1 - r projections
382  // 2 - phi derivative
383  // 3 - the sign - i.e. if track is forward or backward
384 
385  int rindex =
386  (proj->proj(layerdisk_).fpgarzproj().value() >> (proj->proj(layerdisk_).fpgarzproj().nbits() - nrbits_)) &
387  ((1 << nrbits_) - 1);
388 
389  int phiprojder = proj->proj(layerdisk_).fpgaphiprojder().value();
390 
391  int phiderindex = (phiprojder >> (proj->proj(layerdisk_).fpgaphiprojder().nbits() - nphiderbits_)) &
392  ((1 << nphiderbits_) - 1);
393 
394  int signindex = proj->proj(layerdisk_).fpgarzprojder().value() < 0;
395 
396  int bendindex = (signindex << (nphiderbits_ + nrbits_)) + (rindex << (nphiderbits_)) + phiderindex;
397 
398  projrinv = rinvbendlut_.lookup(bendindex);
399 
400  proj->proj(layerdisk_).setBendIndex(projrinv);
401  }
402  assert(projrinv >= 0);
403 
404  unsigned int projfinephi =
405  (fpgaphi.value() >> (fpgaphi.nbits() - (nvmbits_ + NFINEPHIBITS))) & ((1 << NFINEPHIBITS) - 1);
406 
407  unsigned int slot;
408  bool second;
409  int projfinerz;
410 
411  if (barrel_) {
412  slot = proj->proj(layerdisk_).fpgarzbin1projvm().value();
413  second = proj->proj(layerdisk_).fpgarzbin2projvm().value();
414  projfinerz = proj->proj(layerdisk_).fpgafinerzvm().value();
415  } else {
416  //The -1 here is due to not using the full range of bits. Should be fixed.
417  unsigned int ir = proj->proj(layerdisk_).fpgarzproj().value() >>
418  (proj->proj(layerdisk_).fpgarzproj().nbits() - nrprojbits_ - 1);
419  unsigned int word = diskRadius_.lookup(ir);
420 
421  slot = (word >> 1) & ((1 << N_RZBITS) - 1);
422  if (proj->proj(layerdisk_).fpgarzprojder().value() < 0) {
423  slot += (1 << N_RZBITS);
424  }
425  second = word & 1;
426  projfinerz = word >> 4;
427  }
428 
429  bool isPSseed = proj->PSseed();
430 
431  int nbins = (1 << N_RZBITS);
432  if (layerdisk_ >= N_LAYER) {
433  nbins *= 2; //twice as many bins in disks (since there are two disks)
434  }
435 
436  VMStubsMEMemory* stubmem = vmstubs_[0];
437  bool usefirstMinus = stubmem->nStubsBin(ivmMinus * nbins + slot) != 0;
438  bool usesecondMinus = (second && (stubmem->nStubsBin(ivmMinus * nbins + slot + 1) != 0));
439  bool usefirstPlus = ivmPlus != ivmMinus && (stubmem->nStubsBin(ivmPlus * nbins + slot) != 0);
440  bool usesecondPlus = ivmPlus != ivmMinus && (second && (stubmem->nStubsBin(ivmPlus * nbins + slot + 1) != 0));
441 
442  good_ = usefirstPlus || usesecondPlus || usefirstMinus || usesecondMinus;
443 
444  if (good_) {
445  ProjectionTemp tmpProj(proj,
446  slot,
447  projrinv,
448  projfinerz,
449  projfinephi,
450  ivmMinus,
451  shift,
452  usefirstMinus,
453  usefirstPlus,
454  usesecondMinus,
455  usesecondPlus,
456  isPSseed);
457  tmpProj_ = tmpProj;
458  }
459 
460  iproj++;
461  if (iproj == projMem->nTracklets()) {
462  iproj = 0;
463  do {
464  iprojmem++;
465  } while (iprojmem < inputprojs_.size() && inputprojs_[iprojmem]->nTracklets() == 0);
466  }
467 
468  } else {
469  projdone = true && !good_ && !good__;
470  }
471  }
472 
473  //
474  // Check if done
475  //
476  //
477  //
478 
479  if ((projdone && !meactive && inputProjBuffer_.rptr() == inputProjBuffer_.wptr()) ||
480  (istep == settings_.maxStep("MP") - 1)) {
481  if (settings_.writeMonitorData("MP")) {
482  globals_->ofstream("matchprocessor.txt") << getName() << " " << istep << " " << countall << " " << countsel
483  << " " << countme << " " << countinputproj << endl;
484  }
485  break;
486  }
487  }
488 
489  if (settings_.writeMonitorData("MC")) {
490  globals_->ofstream("matchcalculator.txt") << getName() << " " << countall << " " << countsel << endl;
491  }
492 }
Log< level::Info, true > LogVerbatim
constexpr unsigned int N_RZBITS
Definition: Settings.h:39
unsigned int maxStep(std::string module) const
Definition: Settings.h:125
unsigned int projrinv() const
std::vector< MatchEngineUnit > matchengines_
unsigned int projfinephi() const
Settings const & settings_
Definition: ProcessBase.h:40
Globals * globals_
Definition: ProcessBase.h:41
int lookup(unsigned int index) const
std::vector< TrackletProjectionsMemory * > inputprojs_
assert(be >=bs)
int TCID() const
Definition: Tracklet.h:214
U second(std::pair< T, U > const &p)
uint64_t word
bool use(unsigned int nextrzbin, unsigned int nextiphibin) const
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
Definition: Utilities.cc:47
int value() const
Definition: FPGAWord.h:24
std::string const & getName() const
Definition: MemoryBase.h:19
unsigned int nbitsvmme(unsigned int layerdisk) const
Definition: Settings.h:112
CircularBuffer< ProjectionTemp > inputProjBuffer_
bool writeMonitorData(std::string module) const
Definition: Settings.h:118
bool debugTracklet() const
Definition: Settings.h:194
bool matchCalculator(Tracklet *tracklet, const Stub *fpgastub, bool print, unsigned int istep)
unsigned int iphi() const
unsigned int slot() const
int nbits() const
Definition: FPGAWord.h:25
constexpr unsigned int NFINEPHIBITS
Definition: Settings.h:38
Tracklet * proj() const
unsigned int nMatchEngines_
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
static unsigned int const shift
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
std::vector< VMStubsMEMemory * > vmstubs_
unsigned int nStubsBin(unsigned int bin) const
unsigned int bits(unsigned int lsb, unsigned int nbit) const
Definition: FPGAWord.cc:74
std::string const & getName() const
Definition: ProcessBase.h:22
constexpr int N_LAYER
Definition: Settings.h:25

◆ matchCalculator()

bool MatchProcessor::matchCalculator ( Tracklet tracklet,
const Stub fpgastub,
bool  print,
unsigned int  istep 
)

Definition at line 494 of file MatchProcessor.cc.

References funct::abs(), trklet::Tracklet::addMatch(), trklet::Stub::alpha(), trklet::L1TStub::alphanorm(), trklet::Settings::alphashift(), cms::cuda::assert(), best_ideltaphi_barrel, best_ideltaphi_disk, best_ideltar_disk, best_ideltaz_barrel, trklet::Settings::bfield(), trklet::Settings::bookHistos(), trklet::Settings::c(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::constexpr(), curr_tracklet, trklet::Settings::debugTracklet(), trklet::Tracklet::disk(), trklet::Settings::doKF(), trklet::Settings::doMultipleMatches(), trklet::Settings::dphisectorHG(), trklet::Settings::drmax(), PVValHelper::dz, trklet::Settings::dzmax(), dzshift_, Exception, first_, fullmatches_, trklet::Tracklet::getISeed(), trklet::ProcessBase::getName(), trklet::ProcessBase::globals_, trklet::Settings::half2SmoduleWidth(), trklet::Globals::histograms(), compare::hists, ialphafactinner_, ialphafactouter_, icorrshift_, icorzshift_, createfilelist::int, hcalRecHitTable_cff::iphi, trklet::L1TStub::isPSmodule(), runTheMatrix::keep, trklet::Settings::kphi(), trklet::Settings::kphi1(), trklet::Settings::kr(), trklet::Settings::krprojshiftdisk(), trklet::Settings::kz(), trklet::Stub::l1tstub(), trklet::Tracklet::layer(), layerdisk_, trklet::TrackletLUT::lookup(), M_PI, trklet::Tracklet::match(), trklet::N_BITSMEMADDRESS, trklet::N_DSS_MOD, trklet::N_LAYER, trklet::ProcessBase::name_, trklet::FPGAWord::nbits(), next_tracklet, trklet::Globals::ofstream(), trklet::L1TStub::phi(), trklet::Stub::phi(), trklet::Stub::phiapprox(), phimatchcuttable_, phimin_, phiregion_, phishift_, amptDefault_cfi::proj, trklet::Tracklet::proj(), DiDispStaMuonMonitor_cfi::pt, trklet::L1TStub::r(), trklet::Stub::r(), trklet::L1TStub::r2(), trklet::Stub::rapprox(), rcut2Stable_, rcutPStable_, trklet::Settings::rDSSinner(), trklet::Settings::rDSSouter(), reco::reduceRange(), trklet::Tracklet::resid(), trklet::Tracklet::rinv(), trklet::Settings::rmean(), rphicut2Stable_, rphicutPStable_, trklet::ProcessBase::settings_, Validation_hcalonly_cfi::sign, trklet::Stub::stubindex(), trklet::Tracklet::stubtruthmatch(), trklet::Tracklet::t(), trklet::third, funct::true, trklet::Settings::useapprox(), trklet::FPGAWord::value(), trklet::Settings::writeMonitorData(), trklet::L1TStub::z(), trklet::Stub::z(), trklet::Stub::zapprox(), zmatchcuttable_, and trklet::Settings::zmean().

Referenced by execute().

494  {
495  const L1TStub* stub = fpgastub->l1tstub();
496 
497  if (layerdisk_ < N_LAYER) {
498  const Projection& proj = tracklet->proj(layerdisk_);
499  int ir = fpgastub->r().value();
500  int iphi = proj.fpgaphiproj().value();
501  int icorr = (ir * proj.fpgaphiprojder().value()) >> icorrshift_;
502  iphi += icorr;
503 
504  int iz = proj.fpgarzproj().value();
505  int izcor = (ir * proj.fpgarzprojder().value() + (1 << (icorzshift_ - 1))) >> icorzshift_;
506  iz += izcor;
507 
508  int ideltaz = fpgastub->z().value() - iz;
509  int ideltaphi = (fpgastub->phi().value() - iphi) << phishift_;
510 
511  //Floating point calculations
512 
513  double phi = stub->phi();
514  double r = stub->r();
515  double z = stub->z();
516 
517  if (settings_.useapprox()) {
518  double dphi = reco::reduceRange(phi - fpgastub->phiapprox(phimin_, 0.0));
519  assert(std::abs(dphi) < 0.001);
520  phi = fpgastub->phiapprox(phimin_, 0.0);
521  z = fpgastub->zapprox();
522  r = fpgastub->rapprox();
523  }
524 
525  if (phi < 0)
526  phi += 2 * M_PI;
527  phi -= phimin_;
528 
529  double dr = r - settings_.rmean(layerdisk_);
531 
532  double dphi = reco::reduceRange(phi - (proj.phiproj() + dr * proj.phiprojder()));
533 
534  double dz = z - (proj.rzproj() + dr * proj.rzprojder());
535 
536  double dphiapprox = reco::reduceRange(phi - (proj.phiprojapprox() + dr * proj.phiprojderapprox()));
537 
538  double dzapprox = z - (proj.rzprojapprox() + dr * proj.rzprojderapprox());
539 
540  int seedindex = tracklet->getISeed();
542  next_tracklet = tracklet;
543 
544  // Do we have a new tracklet?
545  bool newtracklet = (!first_ || next_tracklet != curr_tracklet);
546  first_ = newtracklet ? true : first_;
547  if (istep == 0)
548  best_ideltar_disk = (1 << (fpgastub->r().nbits() - 1)); // Set to the maximum possible
549  // If so, replace the "best" values with the cut tables
550  if (newtracklet) {
553  }
554 
555  assert(phimatchcuttable_.lookup(seedindex) > 0);
556  assert(zmatchcuttable_.lookup(seedindex) > 0);
557 
558  if (settings_.bookHistos()) {
559  bool truthmatch = tracklet->stubtruthmatch(stub);
560 
562  hists->FillLayerResidual(layerdisk_ + 1,
563  seedindex,
564  dphiapprox * settings_.rmean(layerdisk_),
565  ideltaphi * settings_.kphi1() * settings_.rmean(layerdisk_),
566  (ideltaz << dzshift_) * settings_.kz(),
567  dz,
568  truthmatch);
569  }
570 
571  if (settings_.writeMonitorData("Residuals")) {
572  double pt = 0.01 * settings_.c() * settings_.bfield() / std::abs(tracklet->rinv());
573 
574  globals_->ofstream("layerresiduals.txt")
575  << layerdisk_ + 1 << " " << seedindex << " " << pt << " "
576  << ideltaphi * settings_.kphi1() * settings_.rmean(layerdisk_) << " "
577  << dphiapprox * settings_.rmean(layerdisk_) << " "
578  << phimatchcuttable_.lookup(seedindex) * settings_.kphi1() * settings_.rmean(layerdisk_) << " "
579  << (ideltaz << dzshift_) * settings_.kz() << " " << dz << " "
580  << zmatchcuttable_.lookup(seedindex) * settings_.kz() << endl;
581  }
582 
583  bool imatch = (std::abs(ideltaphi) <= best_ideltaphi_barrel && (ideltaz << dzshift_ < best_ideltaz_barrel) &&
584  (ideltaz << dzshift_ >= -best_ideltaz_barrel));
585 
586  if (settings_.debugTracklet()) {
587  edm::LogVerbatim("Tracklet") << getName() << " imatch = " << imatch << " ideltaphi cut " << ideltaphi << " "
588  << phimatchcuttable_.lookup(seedindex) << " ideltaz<<dzshift cut "
589  << (ideltaz << dzshift_) << " " << zmatchcuttable_.lookup(seedindex);
590  }
591 
592  //This would catch significant consistency problems in the configuration - helps to debug if there are problems.
593  if (std::abs(dphi) > 0.5 * settings_.dphisectorHG() || std::abs(dphiapprox) > 0.5 * settings_.dphisectorHG()) {
594  throw cms::Exception("LogicError") << "WARNING dphi and/or dphiapprox too large : " << dphi << " " << dphiapprox
595  << endl;
596  }
597 
598  bool keep = true;
599  if (!settings_.doKF() || !settings_.doMultipleMatches()) {
600  // Case of allowing only one stub per track per layer (or no KF which implies the same).
601  if (imatch && tracklet->match(layerdisk_)) {
602  // Veto match if is not the best one for this tracklet (in given layer)
603  auto res = tracklet->resid(layerdisk_);
604  keep = abs(ideltaphi) < abs(res.fpgaphiresid().value());
605  imatch = keep;
606  }
607  }
608  // Update the "best" values
609  if (imatch) {
610  best_ideltaphi_barrel = std::abs(ideltaphi);
611  best_ideltaz_barrel = std::abs(ideltaz << dzshift_);
612  }
613 
614  if (imatch) {
615  tracklet->addMatch(layerdisk_,
616  ideltaphi,
617  ideltaz,
618  dphi,
619  dz,
620  dphiapprox,
621  dzapprox,
622  (phiregion_ << N_BITSMEMADDRESS) + fpgastub->stubindex().value(),
623  fpgastub);
624 
625  if (settings_.debugTracklet()) {
626  edm::LogVerbatim("Tracklet") << "Accepted full match in layer " << getName() << " " << tracklet;
627  }
628 
629  int iSeed = tracklet->getISeed();
630  assert(fullmatches_[iSeed] != nullptr);
631  fullmatches_[iSeed]->addMatch(tracklet, fpgastub);
632 
633  return true;
634  } else {
635  return false;
636  }
637  } else { //disk matches
638 
639  //check that stubs and projections in same half of detector
640  assert(stub->z() * tracklet->t() > 0.0);
641 
642  int sign = (tracklet->t() > 0.0) ? 1 : -1;
643  int disk = sign * (layerdisk_ - N_LAYER + 1);
644  assert(disk != 0);
645 
646  //Perform integer calculations here
647 
648  int iz = fpgastub->z().value();
649 
650  const Projection& proj = tracklet->proj(layerdisk_);
651 
652  int iphi = proj.fpgaphiproj().value();
653  int iphicorr = (iz * proj.fpgaphiprojder().value()) >> icorrshift_;
654 
655  iphi += iphicorr;
656 
657  int ir = proj.fpgarzproj().value();
658  int ircorr = (iz * proj.fpgarzprojder().value()) >> icorzshift_;
659  ir += ircorr;
660 
661  int ideltaphi = fpgastub->phi().value() - iphi;
662 
663  int irstub = fpgastub->r().value();
664  int ialphafact = 0;
665  if (!stub->isPSmodule()) {
666  assert(irstub < (int)N_DSS_MOD * 2);
667  if (layerdisk_ - N_LAYER <= 1) {
668  ialphafact = ialphafactinner_[irstub];
669  irstub = settings_.rDSSinner(irstub) / settings_.kr();
670  } else {
671  ialphafact = ialphafactouter_[irstub];
672  irstub = settings_.rDSSouter(irstub) / settings_.kr();
673  }
674  }
675 
676  constexpr int diff_bits = 1;
677  int ideltar = (irstub >> diff_bits) - ir;
678 
679  if (!stub->isPSmodule()) {
680  int ialpha = fpgastub->alpha().value();
681  int iphialphacor = ((ideltar * ialpha * ialphafact) >> settings_.alphashift());
682  ideltaphi += iphialphacor;
683  }
684 
685  //Perform floating point calculations here
686 
687  double phi = stub->phi();
688  double z = stub->z();
689  double r = stub->r();
690 
691  if (settings_.useapprox()) {
692  double dphi = reco::reduceRange(phi - fpgastub->phiapprox(phimin_, 0.0));
693  assert(std::abs(dphi) < 0.001);
694  phi = fpgastub->phiapprox(phimin_, 0.0);
695  z = fpgastub->zapprox();
696  r = fpgastub->rapprox();
697  }
698 
699  if (phi < 0)
700  phi += 2 * M_PI;
701  phi -= phimin_;
702 
703  double dz = z - sign * settings_.zmean(layerdisk_ - N_LAYER);
704 
705  if (std::abs(dz) > settings_.dzmax()) {
706  edm::LogProblem("Tracklet") << __FILE__ << ":" << __LINE__ << " " << name_ << " " << tracklet->getISeed();
707  edm::LogProblem("Tracklet") << "stub " << stub->z() << " disk " << disk << " " << dz;
709  }
710 
711  double phiproj = proj.phiproj() + dz * proj.phiprojder();
712  double rproj = proj.rzproj() + dz * proj.rzprojder();
713  double deltar = r - rproj;
714 
715  double dr = stub->r() - rproj;
716  double drapprox = stub->r() - (proj.rzprojapprox() + dz * proj.rzprojderapprox());
717 
718  double dphi = reco::reduceRange(phi - phiproj);
719 
720  double dphiapprox = reco::reduceRange(phi - (proj.phiprojapprox() + dz * proj.phiprojderapprox()));
721 
722  double drphi = dphi * stub->r();
723  double drphiapprox = dphiapprox * stub->r();
724 
725  if (!stub->isPSmodule()) {
726  double alphanorm = stub->alphanorm();
727  dphi += dr * alphanorm * settings_.half2SmoduleWidth() / stub->r2();
728  ;
729  dphiapprox += drapprox * alphanorm * settings_.half2SmoduleWidth() / stub->r2();
730 
731  drphi += dr * alphanorm * settings_.half2SmoduleWidth() / stub->r();
732  drphiapprox += dr * alphanorm * settings_.half2SmoduleWidth() / stub->r();
733  }
734 
735  int seedindex = tracklet->getISeed();
736 
737  int idrphicut = rphicutPStable_.lookup(seedindex);
738  int idrcut = rcutPStable_.lookup(seedindex);
739  if (!stub->isPSmodule()) {
740  idrphicut = rphicut2Stable_.lookup(seedindex);
741  idrcut = rcut2Stable_.lookup(seedindex);
742  }
743 
745  next_tracklet = tracklet;
746  // Do we have a new tracklet?
747  bool newtracklet = (!first_ || next_tracklet != curr_tracklet);
748  first_ = newtracklet ? true : first_;
749  // If so, replace the "best" values with the cut tables
750  if (newtracklet) {
751  best_ideltaphi_disk = idrphicut;
752  best_ideltar_disk = idrcut;
753  }
754 
755  double drphicut = idrphicut * settings_.kphi() * settings_.kr();
756  double drcut = idrcut * settings_.krprojshiftdisk();
757 
758  if (settings_.writeMonitorData("Residuals")) {
759  double pt = 0.01 * settings_.c() * settings_.bfield() / std::abs(tracklet->rinv());
760 
761  globals_->ofstream("diskresiduals.txt")
762  << layerdisk_ - N_LAYER + 1 << " " << stub->isPSmodule() << " " << tracklet->layer() << " "
763  << abs(tracklet->disk()) << " " << pt << " " << ideltaphi * settings_.kphi() * stub->r() << " " << drphiapprox
764  << " " << drphicut << " " << ideltar * settings_.krprojshiftdisk() << " " << deltar << " " << drcut << " "
765  << endl;
766  }
767 
768  bool match = (std::abs(drphi) < drphicut) && (std::abs(deltar) < drcut);
769  bool imatch = (std::abs(ideltaphi * irstub) < best_ideltaphi_disk) && (std::abs(ideltar) < best_ideltar_disk);
770 
771  if (settings_.debugTracklet()) {
772  edm::LogVerbatim("Tracklet") << "imatch match disk: " << imatch << " " << match << " " << std::abs(ideltaphi)
773  << " " << drphicut / (settings_.kphi() * stub->r()) << " " << std::abs(ideltar)
774  << " " << drcut / settings_.krprojshiftdisk() << " r = " << stub->r();
775  }
776 
777  bool keep = true;
778  if (!settings_.doKF() || !settings_.doMultipleMatches()) {
779  // Case of allowing only one stub per track per layer (or no KF which implies the same).
780  if (imatch && tracklet->match(layerdisk_)) {
781  // Veto match if is not the best one for this tracklet (in given layer)
782  auto res = tracklet->resid(layerdisk_);
783  keep = abs(ideltaphi) < abs(res.fpgaphiresid().value());
784  imatch = keep;
785  }
786  }
787  // Update the "best" values
788  if (imatch) {
789  best_ideltaphi_disk = std::abs(ideltaphi) * irstub;
790  best_ideltar_disk = std::abs(ideltar);
791  }
792 
793  if (imatch) {
794  if (settings_.debugTracklet()) {
795  edm::LogVerbatim("Tracklet") << "MatchCalculator found match in disk " << getName();
796  }
797 
798  if (std::abs(dphi) >= third * settings_.dphisectorHG()) {
799  edm::LogPrint("Tracklet") << "dphi " << dphi << " ISeed " << tracklet->getISeed();
800  }
802  assert(std::abs(dphiapprox) < third * settings_.dphisectorHG());
803 
804  tracklet->addMatch(layerdisk_,
805  ideltaphi,
806  ideltar,
807  drphi / stub->r(),
808  dr,
809  drphiapprox / stub->r(),
810  drapprox,
811  (phiregion_ << N_BITSMEMADDRESS) + fpgastub->stubindex().value(),
812  fpgastub);
813 
814  if (settings_.debugTracklet()) {
815  edm::LogVerbatim("Tracklet") << "Accepted full match in disk " << getName() << " " << tracklet;
816  }
817 
818  int iSeed = tracklet->getISeed();
819  assert(fullmatches_[iSeed] != nullptr);
820  fullmatches_[iSeed]->addMatch(tracklet, fpgastub);
821 
822  return true;
823  } else {
824  return false;
825  }
826  }
827 }
Log< level::Info, true > LogVerbatim
double kz() const
Definition: Settings.h:342
double phi() const
Definition: L1TStub.h:65
double t() const
Definition: Tracklet.h:123
double zapprox() const
Definition: Stub.cc:166
const FPGAWord & r() const
Definition: Stub.h:65
bool bookHistos() const
Definition: Settings.h:219
std::string name_
Definition: ProcessBase.h:38
const Residual & resid(unsigned int layerdisk)
Definition: Tracklet.h:110
int disk() const
Definition: Tracklet.cc:801
double kphi1() const
Definition: Settings.h:339
double rDSSinner(unsigned int iBin) const
Definition: Settings.h:183
constexpr T reduceRange(T x)
Definition: deltaPhi.h:18
double phiapprox(double phimin, double) const
Definition: Stub.cc:185
const FPGAWord & z() const
Definition: Stub.h:66
double dphisectorHG() const
Definition: Settings.h:320
Projection & proj(int layerdisk)
Definition: Tracklet.h:87
Settings const & settings_
Definition: ProcessBase.h:40
TrackletLUT phimatchcuttable_
double z() const
Definition: L1TStub.h:59
Globals * globals_
Definition: ProcessBase.h:41
int lookup(unsigned int index) const
double dzmax() const
Definition: Settings.h:138
constexpr unsigned int N_DSS_MOD
Definition: Settings.h:31
assert(be >=bs)
Definition: Electron.h:6
constexpr double third
Definition: Settings.h:46
unsigned int isPSmodule() const
Definition: L1TStub.h:103
void addMatch(unsigned int layerdisk, int ideltaphi, int ideltarz, double dphi, double drz, double dphiapprox, double drzapprox, int stubid, const trklet::Stub *stubptr)
Definition: Tracklet.cc:303
double half2SmoduleWidth() const
Definition: Settings.h:140
double rmean(unsigned int iLayer) const
Definition: Settings.h:173
double rinv() const
Definition: Tracklet.h:120
double rDSSouter(unsigned int iBin) const
Definition: Settings.h:186
std::vector< FullMatchMemory * > fullmatches_
double bfield() const
Definition: Settings.h:277
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int value() const
Definition: FPGAWord.h:24
bool doMultipleMatches() const
Definition: Settings.h:254
int alphashift() const
Definition: Settings.h:228
L1TStub * l1tstub()
Definition: Stub.h:83
bool writeMonitorData(std::string module) const
Definition: Settings.h:118
Log< level::Warning, true > LogPrint
double rapprox() const
Definition: Stub.cc:152
double zmean(unsigned int iDisk) const
Definition: Settings.h:176
const FPGAWord & stubindex() const
Definition: Stub.h:72
#define M_PI
TrackletLUT rphicutPStable_
bool debugTracklet() const
Definition: Settings.h:194
TrackletLUT rphicut2Stable_
double kr() const
Definition: Settings.h:344
double drmax() const
Definition: Settings.h:137
double alphanorm() const
Definition: L1TStub.cc:91
int ialphafactinner_[N_DSS_MOD *2]
bool stubtruthmatch(const L1TStub *stub)
Definition: Tracklet.cc:138
int nbits() const
Definition: FPGAWord.h:25
Definition: deltar.py:1
int getISeed() const
Definition: Tracklet.cc:820
double c() const
Definition: Settings.h:224
const FPGAWord & alpha() const
Definition: Stub.h:70
double r() const
Definition: L1TStub.h:60
bool match(unsigned int layerdisk)
Definition: Tracklet.h:105
std::ofstream & ofstream(std::string fname)
Definition: Globals.cc:44
HistBase *& histograms()
Definition: Globals.h:38
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
double krprojshiftdisk() const
Definition: Settings.h:441
const FPGAWord & phi() const
Definition: Stub.h:68
int layer() const
Definition: Tracklet.cc:792
double kphi() const
Definition: Settings.h:338
bool doKF() const
Definition: Settings.h:253
double r2() const
Definition: L1TStub.h:62
std::string const & getName() const
Definition: ProcessBase.h:22
TrackletLUT zmatchcuttable_
int ialphafactouter_[N_DSS_MOD *2]
bool useapprox() const
Definition: Settings.h:247
constexpr unsigned int N_BITSMEMADDRESS
Definition: Settings.h:43
Log< level::Error, true > LogProblem
constexpr int N_LAYER
Definition: Settings.h:25

Member Data Documentation

◆ allstubs_

AllStubsMemory* trklet::MatchProcessor::allstubs_
private

Definition at line 75 of file MatchProcessor.h.

Referenced by addInput().

◆ alphainner_

TrackletLUT trklet::MatchProcessor::alphainner_
private

Definition at line 62 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ alphaouter_

TrackletLUT trklet::MatchProcessor::alphaouter_
private

Definition at line 63 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ barrel_

bool trklet::MatchProcessor::barrel_
private

Definition at line 40 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ best_ideltaphi_barrel

int trklet::MatchProcessor::best_ideltaphi_barrel
private

Definition at line 96 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ best_ideltaphi_disk

int trklet::MatchProcessor::best_ideltaphi_disk
private

Definition at line 98 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ best_ideltar_disk

int trklet::MatchProcessor::best_ideltar_disk
private

Definition at line 99 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ best_ideltaz_barrel

int trklet::MatchProcessor::best_ideltaz_barrel
private

Definition at line 97 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ curr_tracklet

Tracklet* trklet::MatchProcessor::curr_tracklet
private

Definition at line 100 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ diskRadius_

TrackletLUT trklet::MatchProcessor::diskRadius_
private

Definition at line 67 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ dzshift_

int trklet::MatchProcessor::dzshift_
private

Definition at line 50 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ first_

bool trklet::MatchProcessor::first_
private

Definition at line 41 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ fullmatches_

std::vector<FullMatchMemory*> trklet::MatchProcessor::fullmatches_
private

Definition at line 83 of file MatchProcessor.h.

Referenced by addOutput(), and matchCalculator().

◆ ialphafactinner_

int trklet::MatchProcessor::ialphafactinner_[N_DSS_MOD *2]
private

Definition at line 79 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ ialphafactouter_

int trklet::MatchProcessor::ialphafactouter_[N_DSS_MOD *2]
private

Definition at line 80 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ icorrshift_

int trklet::MatchProcessor::icorrshift_
private

Definition at line 51 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ icorzshift_

int trklet::MatchProcessor::icorzshift_
private

Definition at line 52 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ inputProjBuffer_

CircularBuffer<ProjectionTemp> trklet::MatchProcessor::inputProjBuffer_
private

Definition at line 103 of file MatchProcessor.h.

Referenced by execute().

◆ inputprojs_

std::vector<TrackletProjectionsMemory*> trklet::MatchProcessor::inputprojs_
private

Definition at line 77 of file MatchProcessor.h.

Referenced by addInput(), and execute().

◆ layerdisk_

unsigned int trklet::MatchProcessor::layerdisk_
private

Definition at line 39 of file MatchProcessor.h.

Referenced by execute(), matchCalculator(), and MatchProcessor().

◆ luttable_

TrackletLUT trklet::MatchProcessor::luttable_
private

Definition at line 89 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ matchengines_

std::vector<MatchEngineUnit> trklet::MatchProcessor::matchengines_
private

Definition at line 94 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ next_tracklet

Tracklet* trklet::MatchProcessor::next_tracklet
private

Definition at line 101 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ nMatchEngines_

unsigned int trklet::MatchProcessor::nMatchEngines_
private

Definition at line 93 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nphiderbits_

int trklet::MatchProcessor::nphiderbits_
private

Definition at line 70 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nrbits_

int trklet::MatchProcessor::nrbits_
private

Definition at line 69 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nrinv_

int trklet::MatchProcessor::nrinv_
private

Definition at line 48 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nrprojbits_

int trklet::MatchProcessor::nrprojbits_
private

Definition at line 73 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nvm_

int trklet::MatchProcessor::nvm_
private

Definition at line 45 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ nvmbins_

int trklet::MatchProcessor::nvmbins_
private

Definition at line 47 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nvmbits_

int trklet::MatchProcessor::nvmbits_
private

Definition at line 46 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ phimatchcuttable_

TrackletLUT trklet::MatchProcessor::phimatchcuttable_
private

Definition at line 55 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ phimin_

double trklet::MatchProcessor::phimin_
private

Definition at line 91 of file MatchProcessor.h.

Referenced by execute(), and matchCalculator().

◆ phiregion_

unsigned int trklet::MatchProcessor::phiregion_
private

Definition at line 43 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ phishift_

int trklet::MatchProcessor::phishift_
private

Definition at line 53 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rcut2Stable_

TrackletLUT trklet::MatchProcessor::rcut2Stable_
private

Definition at line 61 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rcutPStable_

TrackletLUT trklet::MatchProcessor::rcutPStable_
private

Definition at line 60 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rinvbendlut_

TrackletLUT trklet::MatchProcessor::rinvbendlut_
private

Definition at line 86 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ rphicut2Stable_

TrackletLUT trklet::MatchProcessor::rphicut2Stable_
private

Definition at line 59 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rphicutPStable_

TrackletLUT trklet::MatchProcessor::rphicutPStable_
private

Definition at line 58 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rSSinner_

TrackletLUT trklet::MatchProcessor::rSSinner_
private

Definition at line 64 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ rSSouter_

TrackletLUT trklet::MatchProcessor::rSSouter_
private

Definition at line 65 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ vmstubs_

std::vector<VMStubsMEMemory*> trklet::MatchProcessor::vmstubs_
private

Definition at line 76 of file MatchProcessor.h.

Referenced by addInput(), and execute().

◆ zmatchcuttable_

TrackletLUT trklet::MatchProcessor::zmatchcuttable_
private

Definition at line 56 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().