CMS 3D CMS Logo

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

#include <TrackletEngineUnit.h>

Public Member Functions

bool empty () const
 
bool idle () const
 
void init (const TEData &tedata)
 
const StubinnerStub () const
 
const std::pair< const Stub *, const Stub * > & peek () const
 
const std::pair< const Stub *, const Stub * > & read ()
 
void reset ()
 
int rptr () const
 
void setNearFull ()
 
void step (bool print, int istep, int iTE)
 
 TrackletEngineUnit (const Settings *const settings, unsigned int nbitsfinephi, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int iSeed, unsigned int nbitsfinephiediff, unsigned int iAllStub, const TrackletLUT *pttableinnernew, const TrackletLUT *pttableouternew, VMStubsTEMemory *outervmstubs)
 
int wptr () const
 
 ~TrackletEngineUnit ()=default
 

Private Attributes

std::pair< const Stub *, const Stub * > candpair_
 
std::pair< const Stub *, const Stub * > candpair__
 
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_
 
bool goodpair_
 
bool goodpair__
 
unsigned int iAllStub_
 
bool idle_
 
unsigned int ireg_
 
unsigned int iSeed_
 
unsigned int istub_
 
unsigned int layerdisk1_
 
unsigned int layerdisk2_
 
unsigned int nbitsfinephi_
 
unsigned int nbitsfinephidiff_
 
bool nearfull_
 
unsigned int next_
 
unsigned int nreg_
 
unsigned int nstub_
 
VMStubsTEMemoryoutervmstubs_
 
const TrackletLUTpttableinnernew_
 
const TrackletLUTpttableouternew_
 
const Settingssettings_
 
TEData tedata_
 

Detailed Description

Definition at line 28 of file TrackletEngineUnit.h.

Constructor & Destructor Documentation

◆ TrackletEngineUnit()

TrackletEngineUnit::TrackletEngineUnit ( const Settings *const  settings,
unsigned int  nbitsfinephi,
unsigned int  layerdisk1,
unsigned int  layerdisk2,
unsigned int  iSeed,
unsigned int  nbitsfinephiediff,
unsigned int  iAllStub,
const TrackletLUT pttableinnernew,
const TrackletLUT pttableouternew,
VMStubsTEMemory outervmstubs 
)

Definition at line 8 of file TrackletEngineUnit.cc.

References iAllStub_, idle_, iSeed_, layerdisk1_, layerdisk2_, nbitsfinephi_, nbitsfinephidiff_, and outervmstubs_.

18  : settings_(settings), pttableinnernew_(pttableinnernew), pttableouternew_(pttableouternew), candpairs_(3) {
19  idle_ = true;
20  nbitsfinephi_ = nbitsfinephi;
21  layerdisk2_ = layerdisk2;
22  layerdisk1_ = layerdisk1;
23  iSeed_ = iSeed;
24  nbitsfinephidiff_ = nbitsfinephidiff;
25  iAllStub_ = iAllStub;
26  outervmstubs_ = outervmstubs;
27 }
const TrackletLUT * pttableinnernew_
const TrackletLUT * pttableouternew_
VMStubsTEMemory * outervmstubs_
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_

◆ ~TrackletEngineUnit()

trklet::TrackletEngineUnit::~TrackletEngineUnit ( )
default

Member Function Documentation

◆ empty()

bool trklet::TrackletEngineUnit::empty ( void  ) const
inline

Definition at line 45 of file TrackletEngineUnit.h.

References candpairs_.

45 { return candpairs_.empty(); }
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_

◆ idle()

bool trklet::TrackletEngineUnit::idle ( ) const
inline

Definition at line 51 of file TrackletEngineUnit.h.

References idle_.

◆ init()

void TrackletEngineUnit::init ( const TEData tedata)

Definition at line 29 of file TrackletEngineUnit.cc.

References cms::cuda::assert(), idle_, ireg_, istub_, next_, nreg_, nstub_, trklet::TEData::regions_, and tedata_.

29  {
30  tedata_ = tedata;
31  nreg_ = 0;
32  istub_ = 0;
33  idle_ = false;
34  assert(!tedata_.regions_.empty());
35  std::tie(next_, ireg_, nstub_) = tedata_.regions_[0];
36 }
assert(be >=bs)
std::vector< std::tuple< int, int, int > > regions_

◆ innerStub()

const Stub* trklet::TrackletEngineUnit::innerStub ( ) const
inline

Definition at line 63 of file TrackletEngineUnit.h.

References trklet::TEData::stub_, and tedata_.

63 { return tedata_.stub_; }
const Stub * stub_

◆ peek()

const std::pair<const Stub*, const Stub*>& trklet::TrackletEngineUnit::peek ( ) const
inline

Definition at line 49 of file TrackletEngineUnit.h.

References candpairs_.

49 { return candpairs_.peek(); }
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_

◆ read()

const std::pair<const Stub*, const Stub*>& trklet::TrackletEngineUnit::read ( )
inline

Definition at line 47 of file TrackletEngineUnit.h.

References candpairs_.

Referenced by trklet::TrackletProcessor::execute(), and edmIntegrityCheck.PublishToFileSystem::get().

47 { return candpairs_.read(); }
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_

◆ reset()

void TrackletEngineUnit::reset ( void  )

Definition at line 38 of file TrackletEngineUnit.cc.

References candpairs_, goodpair_, goodpair__, and idle_.

38  {
39  idle_ = true;
40  goodpair_ = false;
41  goodpair__ = false;
42  candpairs_.reset();
43 }
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_

◆ rptr()

int trklet::TrackletEngineUnit::rptr ( ) const
inline

Definition at line 59 of file TrackletEngineUnit.h.

References candpairs_.

59 { return candpairs_.rptr(); }
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_

◆ setNearFull()

void trklet::TrackletEngineUnit::setNearFull ( )
inline

Definition at line 53 of file TrackletEngineUnit.h.

References candpairs_, and nearfull_.

Referenced by trklet::TrackletProcessor::execute().

53 { nearfull_ = candpairs_.nearfull(); }
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_

◆ step()

void TrackletEngineUnit::step ( bool  print,
int  istep,
int  iTE 
)

Definition at line 45 of file TrackletEngineUnit.cc.

References cms::cuda::assert(), trklet::VMStubTE::bend(), trklet::Settings::benddecode(), candpair_, candpair__, candpairs_, trklet::Settings::debugTracklet(), trklet::VMStubTE::finephi(), trklet::VMStubsTEMemory::getVMStubTEBinned(), goodpair_, goodpair__, iAllStub_, idle_, trklet::TEData::innerbend_, trklet::TEData::innerfinephi_, ireg_, iSeed_, trklet::VMStubTE::isPSmodule(), trklet::Stub::isPSmodule(), istub_, layerdisk1_, layerdisk2_, trklet::TrackletLUT::lookup(), trklet::N_VMSTUBSMAX, LaserClient_cfi::nbins, trklet::FPGAWord::nbits(), trklet::Settings::nbitsallstubs(), nbitsfinephi_, nbitsfinephidiff_, nearfull_, next_, trklet::Settings::nfinephi(), trklet::NFINERZBITS, nreg_, nstub_, outervmstubs_, pttableinnernew_, pttableouternew_, trklet::TEData::regions_, trklet::TEData::rzbinfirst_, trklet::TEData::rzdiffmax_, settings_, trklet::TEData::start_, trklet::VMStubTE::stub(), trklet::TEData::stub_, tedata_, trklet::FPGAWord::value(), and trklet::VMStubTE::vmbits().

45  {
46  if (goodpair__) {
47  candpairs_.store(candpair__);
48  }
49 
52 
53  goodpair_ = false;
54 
55  if (idle_ || nearfull_) {
56  return;
57  }
58 
59  int ibin = tedata_.start_ + next_;
60 
61  int nbins = (1 << NFINERZBITS);
62 
63  assert(istub_ < outervmstubs_->nVMStubsBinned(ireg_ * nbins + ibin));
64 
65  const VMStubTE& outervmstub = outervmstubs_->getVMStubTEBinned(ireg_ * nbins + ibin, istub_);
66  int rzbin = (outervmstub.vmbits().value() & (nbins - 1));
67 
68  FPGAWord iphiouterbin = outervmstub.finephi();
69 
70  assert(iphiouterbin == outervmstub.finephi());
71 
72  //New code to calculate lut value
73  int outerfinephi = iAllStub_ * (1 << (nbitsfinephi_ - settings_->nbitsallstubs(layerdisk2_))) +
74  ireg_ * (1 << settings_->nfinephi(1, iSeed_)) + iphiouterbin.value();
75  int idphi = outerfinephi - tedata_.innerfinephi_;
76 
77  bool inrange = (idphi < (1 << (nbitsfinephidiff_ - 1))) && (idphi >= -(1 << (nbitsfinephidiff_ - 1)));
78 
79  idphi = idphi & ((1 << nbitsfinephidiff_) - 1);
80 
81  unsigned int firstDiskSeed = 4;
82  if (iSeed_ >= firstDiskSeed) { //Also use r-position
83  int ibinMask = 3; //Get two least sign. bits
84  int ir = ((ibin & ibinMask) << 1) + (rzbin >> (NFINERZBITS - 1));
85  int nrbits = 3;
86  idphi = (idphi << nrbits) + ir;
87  }
88 
89  if (next_ != 0)
90  rzbin += (1 << NFINERZBITS);
91 
92  if ((rzbin < tedata_.rzbinfirst_) || (rzbin - tedata_.rzbinfirst_ > tedata_.rzdiffmax_)) {
93  if (settings_->debugTracklet()) {
94  edm::LogVerbatim("Tracklet") << " layer-disk stub pair rejected because rbin cut : " << rzbin << " "
96  }
97  } else {
98  FPGAWord outerbend = outervmstub.bend();
99 
100  int ptinnerindex = (idphi << tedata_.innerbend_.nbits()) + tedata_.innerbend_.value();
101  int ptouterindex = (idphi << outerbend.nbits()) + outerbend.value();
102 
103  if (!(inrange && pttableinnernew_->lookup(ptinnerindex) && pttableouternew_->lookup(ptouterindex))) {
104  if (settings_->debugTracklet()) {
105  edm::LogVerbatim("Tracklet") << " Stub pair rejected because of stub pt cut bends : "
106  << settings_->benddecode(
108  << " "
109  << settings_->benddecode(outerbend.value(), layerdisk2_, outervmstub.isPSmodule());
110  }
111  } else {
112  candpair_ = pair<const Stub*, const Stub*>(tedata_.stub_, outervmstub.stub());
113  goodpair_ = true;
114  }
115  }
116 
117  istub_++;
119  if (istub_ >= nstub_) {
120  istub_ = 0;
121  nreg_++;
122  if (nreg_ >= tedata_.regions_.size()) {
123  nreg_ = 0;
124  idle_ = true;
125  } else {
126  std::tie(next_, ireg_, nstub_) = tedata_.regions_[nreg_];
127  }
128  }
129 }
Log< level::Info, true > LogVerbatim
const VMStubTE & getVMStubTEBinned(unsigned int bin, unsigned int i) const
bool isPSmodule() const
Definition: VMStubTE.h:31
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:437
const FPGAWord & bend() const
Definition: VMStubTE.h:25
std::pair< const Stub *, const Stub * > candpair__
int lookup(unsigned int index) const
std::pair< const Stub *, const Stub * > candpair_
constexpr unsigned int N_VMSTUBSMAX
Definition: Settings.h:42
assert(be >=bs)
const Stub * stub() const
Definition: VMStubTE.h:29
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:113
const TrackletLUT * pttableinnernew_
const FPGAWord & vmbits() const
Definition: VMStubTE.h:27
int value() const
Definition: FPGAWord.h:24
const TrackletLUT * pttableouternew_
constexpr unsigned int NFINERZBITS
Definition: Settings.h:37
const FPGAWord & finephi() const
Definition: VMStubTE.h:23
bool debugTracklet() const
Definition: Settings.h:192
int nbits() const
Definition: FPGAWord.h:25
bool isPSmodule() const
Definition: Stub.h:71
int nfinephi(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:140
const Stub * stub_
VMStubsTEMemory * outervmstubs_
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_
std::vector< std::tuple< int, int, int > > regions_

◆ wptr()

int trklet::TrackletEngineUnit::wptr ( ) const
inline

Definition at line 61 of file TrackletEngineUnit.h.

References candpairs_.

61 { return candpairs_.wptr(); }
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_

Member Data Documentation

◆ candpair_

std::pair<const Stub*, const Stub*> trklet::TrackletEngineUnit::candpair_
private

Definition at line 89 of file TrackletEngineUnit.h.

Referenced by step().

◆ candpair__

std::pair<const Stub*, const Stub*> trklet::TrackletEngineUnit::candpair__
private

Definition at line 89 of file TrackletEngineUnit.h.

Referenced by step().

◆ candpairs_

CircularBuffer<std::pair<const Stub*, const Stub*> > trklet::TrackletEngineUnit::candpairs_
private

Definition at line 93 of file TrackletEngineUnit.h.

Referenced by empty(), peek(), read(), reset(), rptr(), setNearFull(), step(), and wptr().

◆ goodpair_

bool trklet::TrackletEngineUnit::goodpair_
private

Definition at line 90 of file TrackletEngineUnit.h.

Referenced by reset(), and step().

◆ goodpair__

bool trklet::TrackletEngineUnit::goodpair__
private

Definition at line 90 of file TrackletEngineUnit.h.

Referenced by reset(), and step().

◆ iAllStub_

unsigned int trklet::TrackletEngineUnit::iAllStub_
private

Definition at line 75 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ idle_

bool trklet::TrackletEngineUnit::idle_
private

Definition at line 84 of file TrackletEngineUnit.h.

Referenced by idle(), init(), reset(), step(), and TrackletEngineUnit().

◆ ireg_

unsigned int trklet::TrackletEngineUnit::ireg_
private

Definition at line 80 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ iSeed_

unsigned int trklet::TrackletEngineUnit::iSeed_
private

Definition at line 72 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ istub_

unsigned int trklet::TrackletEngineUnit::istub_
private

Definition at line 79 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ layerdisk1_

unsigned int trklet::TrackletEngineUnit::layerdisk1_
private

Definition at line 70 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ layerdisk2_

unsigned int trklet::TrackletEngineUnit::layerdisk2_
private

Definition at line 71 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ nbitsfinephi_

unsigned int trklet::TrackletEngineUnit::nbitsfinephi_
private

Definition at line 69 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ nbitsfinephidiff_

unsigned int trklet::TrackletEngineUnit::nbitsfinephidiff_
private

Definition at line 73 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ nearfull_

bool trklet::TrackletEngineUnit::nearfull_
private

Definition at line 74 of file TrackletEngineUnit.h.

Referenced by setNearFull(), and step().

◆ next_

unsigned int trklet::TrackletEngineUnit::next_
private

Definition at line 81 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ nreg_

unsigned int trklet::TrackletEngineUnit::nreg_
private

Definition at line 78 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ nstub_

unsigned int trklet::TrackletEngineUnit::nstub_
private

Definition at line 82 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ outervmstubs_

VMStubsTEMemory* trklet::TrackletEngineUnit::outervmstubs_
private

Definition at line 66 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ pttableinnernew_

const TrackletLUT* trklet::TrackletEngineUnit::pttableinnernew_
private

Definition at line 86 of file TrackletEngineUnit.h.

Referenced by step().

◆ pttableouternew_

const TrackletLUT* trklet::TrackletEngineUnit::pttableouternew_
private

Definition at line 87 of file TrackletEngineUnit.h.

Referenced by step().

◆ settings_

const Settings* trklet::TrackletEngineUnit::settings_
private

Definition at line 68 of file TrackletEngineUnit.h.

Referenced by step().

◆ tedata_

TEData trklet::TrackletEngineUnit::tedata_
private

Definition at line 67 of file TrackletEngineUnit.h.

Referenced by init(), innerStub(), and step().