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.

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 }

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

◆ ~TrackletEngineUnit()

trklet::TrackletEngineUnit::~TrackletEngineUnit ( )
default

Member Function Documentation

◆ empty()

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

Definition at line 45 of file TrackletEngineUnit.h.

45 { return candpairs_.empty(); }

References candpairs_.

◆ idle()

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

Definition at line 51 of file TrackletEngineUnit.h.

51 { return idle_; }

References idle_.

◆ init()

void TrackletEngineUnit::init ( const TEData tedata)

Definition at line 29 of file TrackletEngineUnit.cc.

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 }

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

◆ innerStub()

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

Definition at line 63 of file TrackletEngineUnit.h.

63 { return tedata_.stub_; }

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

◆ peek()

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

Definition at line 49 of file TrackletEngineUnit.h.

49 { return candpairs_.peek(); }

References candpairs_.

◆ read()

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

Definition at line 47 of file TrackletEngineUnit.h.

47 { return candpairs_.read(); }

References candpairs_.

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

◆ reset()

void TrackletEngineUnit::reset ( void  )

Definition at line 38 of file TrackletEngineUnit.cc.

38  {
39  idle_ = true;
40  goodpair_ = false;
41  goodpair__ = false;
42  candpairs_.reset();
43 }

References candpairs_, goodpair_, goodpair__, and idle_.

◆ rptr()

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

Definition at line 59 of file TrackletEngineUnit.h.

59 { return candpairs_.rptr(); }

References candpairs_.

◆ setNearFull()

void trklet::TrackletEngineUnit::setNearFull ( )
inline

Definition at line 53 of file TrackletEngineUnit.h.

53 { nearfull_ = candpairs_.nearfull(); }

References candpairs_, and nearfull_.

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

◆ step()

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

Definition at line 45 of file TrackletEngineUnit.cc.

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 }

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().

◆ wptr()

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

Definition at line 61 of file TrackletEngineUnit.h.

61 { return candpairs_.wptr(); }

References 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().

trklet::TrackletEngineUnit::settings_
const Settings * settings_
Definition: TrackletEngineUnit.h:68
trklet::TEData::rzbinfirst_
int rzbinfirst_
Definition: TrackletEngineUnit.h:21
trklet::TEData::start_
int start_
Definition: TrackletEngineUnit.h:20
trklet::TrackletEngineUnit::goodpair__
bool goodpair__
Definition: TrackletEngineUnit.h:90
trklet::TrackletLUT::lookup
int lookup(unsigned int index) const
Definition: TrackletLUT.cc:900
trklet::VMStubTE
Definition: VMStubTE.h:15
trklet::TEData::rzdiffmax_
int rzdiffmax_
Definition: TrackletEngineUnit.h:22
trklet::TrackletEngineUnit::pttableinnernew_
const TrackletLUT * pttableinnernew_
Definition: TrackletEngineUnit.h:86
trklet::VMStubsTEMemory::getVMStubTEBinned
const VMStubTE & getVMStubTEBinned(unsigned int bin, unsigned int i) const
Definition: VMStubsTEMemory.h:38
trklet::TrackletEngineUnit::outervmstubs_
VMStubsTEMemory * outervmstubs_
Definition: TrackletEngineUnit.h:66
trklet::Settings::nbitsallstubs
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:106
cms::cuda::assert
assert(be >=bs)
trklet::TrackletEngineUnit::idle_
bool idle_
Definition: TrackletEngineUnit.h:84
trklet::TrackletEngineUnit::layerdisk1_
unsigned int layerdisk1_
Definition: TrackletEngineUnit.h:70
trklet::TrackletEngineUnit::tedata_
TEData tedata_
Definition: TrackletEngineUnit.h:67
trklet::TEData::innerbend_
FPGAWord innerbend_
Definition: TrackletEngineUnit.h:24
trklet::TrackletEngineUnit::nearfull_
bool nearfull_
Definition: TrackletEngineUnit.h:74
trklet::FPGAWord::nbits
int nbits() const
Definition: FPGAWord.h:25
trklet::VMStubTE::isPSmodule
bool isPSmodule() const
Definition: VMStubTE.h:31
trklet::VMStubTE::bend
const FPGAWord & bend() const
Definition: VMStubTE.h:25
trklet::Settings::benddecode
double benddecode(int ibend, int layerdisk, bool isPSmodule) const
Definition: Settings.h:402
trklet::TEData::innerfinephi_
int innerfinephi_
Definition: TrackletEngineUnit.h:23
trklet::TrackletEngineUnit::nreg_
unsigned int nreg_
Definition: TrackletEngineUnit.h:78
trklet::TrackletEngineUnit::next_
unsigned int next_
Definition: TrackletEngineUnit.h:81
trklet::TrackletEngineUnit::nstub_
unsigned int nstub_
Definition: TrackletEngineUnit.h:82
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
trklet::N_VMSTUBSMAX
constexpr unsigned int N_VMSTUBSMAX
Definition: Settings.h:38
trklet::FPGAWord
Definition: FPGAWord.h:9
trklet::TrackletEngineUnit::candpair_
std::pair< const Stub *, const Stub * > candpair_
Definition: TrackletEngineUnit.h:89
trklet::TrackletEngineUnit::iAllStub_
unsigned int iAllStub_
Definition: TrackletEngineUnit.h:75
trklet::Settings::nfinephi
int nfinephi(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:133
trklet::VMStubTE::stub
const Stub * stub() const
Definition: VMStubTE.h:29
trklet::TrackletEngineUnit::ireg_
unsigned int ireg_
Definition: TrackletEngineUnit.h:80
trklet::VMStubTE::vmbits
const FPGAWord & vmbits() const
Definition: VMStubTE.h:27
trklet::FPGAWord::value
int value() const
Definition: FPGAWord.h:24
trklet::TrackletEngineUnit::nbitsfinephi_
unsigned int nbitsfinephi_
Definition: TrackletEngineUnit.h:69
trklet::TrackletEngineUnit::candpairs_
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_
Definition: TrackletEngineUnit.h:93
trklet::TEData::stub_
const Stub * stub_
Definition: TrackletEngineUnit.h:19
trklet::NFINERZBITS
constexpr unsigned int NFINERZBITS
Definition: Settings.h:33
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
trklet::TrackletEngineUnit::iSeed_
unsigned int iSeed_
Definition: TrackletEngineUnit.h:72
trklet::TrackletEngineUnit::pttableouternew_
const TrackletLUT * pttableouternew_
Definition: TrackletEngineUnit.h:87
trklet::TrackletEngineUnit::nbitsfinephidiff_
unsigned int nbitsfinephidiff_
Definition: TrackletEngineUnit.h:73
trklet::VMStubTE::finephi
const FPGAWord & finephi() const
Definition: VMStubTE.h:23
trklet::Settings::debugTracklet
bool debugTracklet() const
Definition: Settings.h:182
trklet::Stub::isPSmodule
bool isPSmodule() const
Definition: Stub.h:71
trklet::TEData::regions_
std::vector< std::tuple< int, int, int > > regions_
Definition: TrackletEngineUnit.h:25
trklet::TrackletEngineUnit::goodpair_
bool goodpair_
Definition: TrackletEngineUnit.h:90
trklet::TrackletEngineUnit::candpair__
std::pair< const Stub *, const Stub * > candpair__
Definition: TrackletEngineUnit.h:89
trklet::TrackletEngineUnit::layerdisk2_
unsigned int layerdisk2_
Definition: TrackletEngineUnit.h:71
trklet::TrackletEngineUnit::istub_
unsigned int istub_
Definition: TrackletEngineUnit.h:79