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_
 
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_, 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 }
void initBendMatch(unsigned int layerdisk)
Definition: TrackletLUT.cc:888
double kz() const
Definition: Settings.h:336
double kphiderdisk() const
Definition: Settings.h:429
void initmatchcut(unsigned int layerdisk, MatchType type, unsigned int region)
Definition: TrackletLUT.cc:189
double rDSSinner(unsigned int iBin) const
Definition: Settings.h:181
std::vector< MatchEngineUnit > matchengines_
double kphider() const
Definition: Settings.h:428
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:789
Settings const & settings_
Definition: ProcessBase.h:40
TrackletLUT phimatchcuttable_
double krder() const
Definition: Settings.h:431
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:430
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:113
double half2SmoduleWidth() const
Definition: Settings.h:138
unsigned int nzbitsstub(unsigned int layerdisk) const
Definition: Settings.h:89
unsigned int nphibitsstub(unsigned int layerdisk) const
Definition: Settings.h:90
int ilog2(double factor)
Definition: Util.h:121
double rDSSouter(unsigned int iBin) const
Definition: Settings.h:184
std::vector< FullMatchMemory * > fullmatches_
IMATH_TrackletCalculator * ITC_L1L2()
Definition: Globals.h:48
int alphashift() const
Definition: Settings.h:226
unsigned int nbitsvmme(unsigned int layerdisk) const
Definition: Settings.h:110
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:114
TrackletLUT rphicut2Stable_
int ialphafactinner_[N_DSS_MOD *2]
unsigned int nvmme(unsigned int layerdisk) const
Definition: Settings.h:111
unsigned int nMatchEngines_
int nbitsalpha() const
Definition: Settings.h:227
double krbarrel() const
Definition: Settings.h:339
double krprojshiftdisk() const
Definition: Settings.h:435
void initProjectionDiskRadius(int nrbits)
Definition: TrackletLUT.cc:841
double kphi() const
Definition: Settings.h:332
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 140 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().

140  {
141  if (settings_.writetrace()) {
142  edm::LogVerbatim("Tracklet") << "In " << name_ << " adding input from " << memory->getName() << " to input "
143  << input;
144  }
145  if (input == "allstubin") {
146  auto* tmp = dynamic_cast<AllStubsMemory*>(memory);
147  assert(tmp != nullptr);
148  allstubs_ = tmp;
149  return;
150  }
151  if (input == "vmstubin") {
152  auto* tmp = dynamic_cast<VMStubsMEMemory*>(memory);
153  assert(tmp != nullptr);
154  vmstubs_.push_back(tmp); //to allow more than one stub in? vmstubs_=tmp;
155  return;
156  }
157  if (input == "projin") {
158  auto* tmp = dynamic_cast<TrackletProjectionsMemory*>(memory);
159  assert(tmp != nullptr);
160  inputprojs_.push_back(tmp);
161  return;
162  }
163  throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " could not find input: " << input;
164 }
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:193
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 123 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().

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

◆ execute()

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

Definition at line 166 of file MatchProcessor.cc.

References cms::cuda::assert(), barrel_, trklet::FPGAWord::bits(), 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(), trklet::Tracklet::TCID(), mitigatedMETSequence_cff::U, trklet::ProjectionTemp::use(), trklet::FPGAWord::value(), vmstubs_, and trklet::Settings::writeMonitorData().

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

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

Referenced by addInput().

◆ alphainner_

TrackletLUT trklet::MatchProcessor::alphainner_
private

Definition at line 61 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ alphaouter_

TrackletLUT trklet::MatchProcessor::alphaouter_
private

Definition at line 62 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 95 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ best_ideltaphi_disk

int trklet::MatchProcessor::best_ideltaphi_disk
private

Definition at line 97 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ best_ideltar_disk

int trklet::MatchProcessor::best_ideltar_disk
private

Definition at line 98 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ best_ideltaz_barrel

int trklet::MatchProcessor::best_ideltaz_barrel
private

Definition at line 96 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ curr_tracklet

Tracklet* trklet::MatchProcessor::curr_tracklet
private

Definition at line 99 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ diskRadius_

TrackletLUT trklet::MatchProcessor::diskRadius_
private

Definition at line 66 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ dzshift_

int trklet::MatchProcessor::dzshift_
private

Definition at line 49 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ fullmatches_

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

Definition at line 82 of file MatchProcessor.h.

Referenced by addOutput(), and matchCalculator().

◆ ialphafactinner_

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

Definition at line 78 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ ialphafactouter_

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

Definition at line 79 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ icorrshift_

int trklet::MatchProcessor::icorrshift_
private

Definition at line 50 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ icorzshift_

int trklet::MatchProcessor::icorzshift_
private

Definition at line 51 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ inputProjBuffer_

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

Definition at line 102 of file MatchProcessor.h.

Referenced by execute().

◆ inputprojs_

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

Definition at line 76 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 88 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ matchengines_

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

Definition at line 93 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ next_tracklet

Tracklet* trklet::MatchProcessor::next_tracklet
private

Definition at line 100 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ nMatchEngines_

unsigned int trklet::MatchProcessor::nMatchEngines_
private

Definition at line 92 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nphiderbits_

int trklet::MatchProcessor::nphiderbits_
private

Definition at line 69 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nrbits_

int trklet::MatchProcessor::nrbits_
private

Definition at line 68 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nrinv_

int trklet::MatchProcessor::nrinv_
private

Definition at line 47 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nrprojbits_

int trklet::MatchProcessor::nrprojbits_
private

Definition at line 72 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nvm_

int trklet::MatchProcessor::nvm_
private

Definition at line 44 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ nvmbins_

int trklet::MatchProcessor::nvmbins_
private

Definition at line 46 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ nvmbits_

int trklet::MatchProcessor::nvmbits_
private

Definition at line 45 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ phimatchcuttable_

TrackletLUT trklet::MatchProcessor::phimatchcuttable_
private

Definition at line 54 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ phimin_

double trklet::MatchProcessor::phimin_
private

Definition at line 90 of file MatchProcessor.h.

Referenced by execute(), and matchCalculator().

◆ phiregion_

unsigned int trklet::MatchProcessor::phiregion_
private

Definition at line 42 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ phishift_

int trklet::MatchProcessor::phishift_
private

Definition at line 52 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rcut2Stable_

TrackletLUT trklet::MatchProcessor::rcut2Stable_
private

Definition at line 60 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rcutPStable_

TrackletLUT trklet::MatchProcessor::rcutPStable_
private

Definition at line 59 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rinvbendlut_

TrackletLUT trklet::MatchProcessor::rinvbendlut_
private

Definition at line 85 of file MatchProcessor.h.

Referenced by execute(), and MatchProcessor().

◆ rphicut2Stable_

TrackletLUT trklet::MatchProcessor::rphicut2Stable_
private

Definition at line 58 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rphicutPStable_

TrackletLUT trklet::MatchProcessor::rphicutPStable_
private

Definition at line 57 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().

◆ rSSinner_

TrackletLUT trklet::MatchProcessor::rSSinner_
private

Definition at line 63 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ rSSouter_

TrackletLUT trklet::MatchProcessor::rSSouter_
private

Definition at line 64 of file MatchProcessor.h.

Referenced by MatchProcessor().

◆ vmstubs_

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

Definition at line 75 of file MatchProcessor.h.

Referenced by addInput(), and execute().

◆ zmatchcuttable_

TrackletLUT trklet::MatchProcessor::zmatchcuttable_
private

Definition at line 55 of file MatchProcessor.h.

Referenced by matchCalculator(), and MatchProcessor().