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 std::pair< const Stub *, const Stub * > & peek () const
 
const std::pair< const Stub *, const Stub * > & read ()
 
void reset ()
 
void step ()
 
 TrackletEngineUnit (const Settings *const settings, unsigned int nbitsfinephi, unsigned int layerdisk2, unsigned int iSeed, unsigned int nbitsfinephiediff, unsigned int iAllStub, std::vector< bool > const &pttableinner, std::vector< bool > const &pttableouter, VMStubsTEMemory *outervmstubs)
 
 ~TrackletEngineUnit ()=default
 

Private Attributes

CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_
 
unsigned int iAllStub_
 
bool idle_
 
unsigned int ireg_
 
unsigned int iSeed_
 
unsigned int istub_
 
unsigned int layerdisk2_
 
unsigned int nbitsfinephi_
 
unsigned int nbitsfinephidiff_
 
unsigned int next_
 
unsigned int nreg_
 
unsigned int nstub_
 
VMStubsTEMemoryoutervmstubs_
 
std::vector< bool > pttableinner_
 
std::vector< bool > pttableouter_
 
const Settingssettings_
 
TEData tedata_
 

Detailed Description

Definition at line 27 of file TrackletEngineUnit.h.

Constructor & Destructor Documentation

◆ TrackletEngineUnit()

TrackletEngineUnit::TrackletEngineUnit ( const Settings *const  settings,
unsigned int  nbitsfinephi,
unsigned int  layerdisk2,
unsigned int  iSeed,
unsigned int  nbitsfinephiediff,
unsigned int  iAllStub,
std::vector< bool > const &  pttableinner,
std::vector< bool > const &  pttableouter,
VMStubsTEMemory outervmstubs 
)

Definition at line 8 of file TrackletEngineUnit.cc.

17  : settings_(settings), candpairs_(5) {
18  idle_ = true;
19  nbitsfinephi_ = nbitsfinephi;
20  layerdisk2_ = layerdisk2;
21  iSeed_ = iSeed;
22  nbitsfinephidiff_ = nbitsfinephidiff;
23  iAllStub_ = iAllStub;
24  pttableinner_ = pttableinner;
25  pttableouter_ = pttableouter;
26  outervmstubs_ = outervmstubs;
27 }

References iAllStub_, idle_, iSeed_, layerdisk2_, nbitsfinephi_, nbitsfinephidiff_, outervmstubs_, pttableinner_, and pttableouter_.

◆ ~TrackletEngineUnit()

trklet::TrackletEngineUnit::~TrackletEngineUnit ( )
default

Member Function Documentation

◆ empty()

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

Definition at line 43 of file TrackletEngineUnit.h.

43 { return candpairs_.empty(); }

References candpairs_.

◆ idle()

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

Definition at line 49 of file TrackletEngineUnit.h.

49 { 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_.

◆ peek()

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

Definition at line 47 of file TrackletEngineUnit.h.

47 { return candpairs_.peek(); }

References candpairs_.

◆ read()

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

Definition at line 45 of file TrackletEngineUnit.h.

45 { 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  candpairs_.reset();
41 }

References candpairs_, and idle_.

◆ step()

void TrackletEngineUnit::step ( )

Definition at line 43 of file TrackletEngineUnit.cc.

43  {
44  if (candpairs_.full())
45  return;
46 
47  int ibin = tedata_.start_ + next_;
48 
49  int nbins = (1 << NFINERZBITS);
50 
51  assert(istub_ < outervmstubs_->nVMStubsBinned(ireg_ * nbins + ibin));
52 
53  const VMStubTE& outervmstub = outervmstubs_->getVMStubTEBinned(ireg_ * nbins + ibin, istub_);
54  int rzbin = (outervmstub.vmbits().value() & (nbins - 1));
55 
56  FPGAWord iphiouterbin = outervmstub.finephi();
57 
58  assert(iphiouterbin == outervmstub.finephi());
59 
60  //New code to calculate lut value
61  int outerfinephi = iAllStub_ * (1 << (nbitsfinephi_ - settings_->nbitsallstubs(layerdisk2_))) +
62  ireg_ * (1 << settings_->nfinephi(1, iSeed_)) + iphiouterbin.value();
63  int idphi = outerfinephi - tedata_.innerfinephi_;
64  bool inrange = (idphi < (1 << (nbitsfinephidiff_ - 1))) && (idphi >= -(1 << (nbitsfinephidiff_ - 1)));
65  if (idphi < 0)
66  idphi = idphi + (1 << nbitsfinephidiff_);
67 
68  unsigned int firstDiskSeed = 4;
69  if (iSeed_ >= firstDiskSeed) { //Also use r-position
70  int ibinMask = 3; //Get two least sign. bits
71  int ir = ((ibin & ibinMask) << 1) + (rzbin >> (NFINERZBITS - 1));
72  int nrbits = 3;
73  idphi = (idphi << nrbits) + ir;
74  }
75 
76  if (next_ != 0)
77  rzbin += (1 << NFINERZBITS);
78  if ((rzbin < tedata_.rzbinfirst_) || (rzbin - tedata_.rzbinfirst_ > tedata_.rzdiffmax_)) {
79  if (settings_->debugTracklet()) {
80  edm::LogVerbatim("Tracklet") << " layer-disk stub pair rejected because rbin cut : " << rzbin << " "
82  }
83  } else {
84  FPGAWord outerbend = outervmstub.bend();
85 
86  int ptinnerindex = (idphi << tedata_.innerbend_.nbits()) + tedata_.innerbend_.value();
87  int ptouterindex = (idphi << outerbend.nbits()) + outerbend.value();
88 
89  if (!(inrange && pttableinner_[ptinnerindex] && pttableouter_[ptouterindex])) {
90  if (settings_->debugTracklet()) {
91  edm::LogVerbatim("Tracklet") << " Stub pair rejected because of stub pt cut bends : "
93  << benddecode(outerbend.value(), outervmstub.isPSmodule());
94  }
95  } else {
96  candpairs_.store(pair<const Stub*, const Stub*>(tedata_.stub_, outervmstub.stub()));
97  }
98  }
99  istub_++;
100  if (istub_ >= nstub_) {
101  istub_ = 0;
102  nreg_++;
103  if (nreg_ >= tedata_.regions_.size()) {
104  nreg_ = 0;
105  idle_ = true;
106  } else {
107  std::tie(next_, ireg_, nstub_) = tedata_.regions_[nreg_];
108  }
109  }
110 }

References cms::cuda::assert(), trklet::VMStubTE::bend(), trklet::benddecode(), candpairs_, trklet::Settings::debugTracklet(), trklet::VMStubTE::finephi(), trklet::VMStubsTEMemory::getVMStubTEBinned(), iAllStub_, idle_, trklet::TEData::innerbend_, trklet::TEData::innerfinephi_, ireg_, iSeed_, trklet::VMStubTE::isPSmodule(), trklet::Stub::isPSmodule(), istub_, layerdisk2_, LaserClient_cfi::nbins, trklet::FPGAWord::nbits(), trklet::Settings::nbitsallstubs(), nbitsfinephi_, nbitsfinephidiff_, next_, trklet::Settings::nfinephi(), trklet::NFINERZBITS, nreg_, nstub_, outervmstubs_, pttableinner_, pttableouter_, 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().

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

Member Data Documentation

◆ candpairs_

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

Definition at line 79 of file TrackletEngineUnit.h.

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

◆ iAllStub_

unsigned int trklet::TrackletEngineUnit::iAllStub_
private

Definition at line 64 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ idle_

bool trklet::TrackletEngineUnit::idle_
private

Definition at line 73 of file TrackletEngineUnit.h.

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

◆ ireg_

unsigned int trklet::TrackletEngineUnit::ireg_
private

Definition at line 69 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ iSeed_

unsigned int trklet::TrackletEngineUnit::iSeed_
private

Definition at line 61 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ istub_

unsigned int trklet::TrackletEngineUnit::istub_
private

Definition at line 68 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ layerdisk2_

unsigned int trklet::TrackletEngineUnit::layerdisk2_
private

Definition at line 60 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ nbitsfinephi_

unsigned int trklet::TrackletEngineUnit::nbitsfinephi_
private

Definition at line 59 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ nbitsfinephidiff_

unsigned int trklet::TrackletEngineUnit::nbitsfinephidiff_
private

Definition at line 62 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ next_

unsigned int trklet::TrackletEngineUnit::next_
private

Definition at line 70 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ nreg_

unsigned int trklet::TrackletEngineUnit::nreg_
private

Definition at line 67 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ nstub_

unsigned int trklet::TrackletEngineUnit::nstub_
private

Definition at line 71 of file TrackletEngineUnit.h.

Referenced by init(), and step().

◆ outervmstubs_

VMStubsTEMemory* trklet::TrackletEngineUnit::outervmstubs_
private

Definition at line 56 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ pttableinner_

std::vector<bool> trklet::TrackletEngineUnit::pttableinner_
private

Definition at line 75 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ pttableouter_

std::vector<bool> trklet::TrackletEngineUnit::pttableouter_
private

Definition at line 76 of file TrackletEngineUnit.h.

Referenced by step(), and TrackletEngineUnit().

◆ settings_

const Settings* trklet::TrackletEngineUnit::settings_
private

Definition at line 58 of file TrackletEngineUnit.h.

Referenced by step().

◆ tedata_

TEData trklet::TrackletEngineUnit::tedata_
private

Definition at line 57 of file TrackletEngineUnit.h.

Referenced by init(), and step().

trklet::TrackletEngineUnit::settings_
const Settings * settings_
Definition: TrackletEngineUnit.h:58
trklet::TEData::rzbinfirst_
int rzbinfirst_
Definition: TrackletEngineUnit.h:20
trklet::TEData::start_
int start_
Definition: TrackletEngineUnit.h:19
trklet::VMStubTE
Definition: VMStubTE.h:15
trklet::TEData::rzdiffmax_
int rzdiffmax_
Definition: TrackletEngineUnit.h:21
trklet::TrackletEngineUnit::pttableouter_
std::vector< bool > pttableouter_
Definition: TrackletEngineUnit.h:76
trklet::VMStubsTEMemory::getVMStubTEBinned
const VMStubTE & getVMStubTEBinned(unsigned int bin, unsigned int i) const
Definition: VMStubsTEMemory.h:36
trklet::TrackletEngineUnit::outervmstubs_
VMStubsTEMemory * outervmstubs_
Definition: TrackletEngineUnit.h:56
trklet::Settings::nbitsallstubs
unsigned int nbitsallstubs(unsigned int layerdisk) const
Definition: Settings.h:93
cms::cuda::assert
assert(be >=bs)
trklet::TrackletEngineUnit::idle_
bool idle_
Definition: TrackletEngineUnit.h:73
trklet::TrackletEngineUnit::tedata_
TEData tedata_
Definition: TrackletEngineUnit.h:57
trklet::TEData::innerbend_
FPGAWord innerbend_
Definition: TrackletEngineUnit.h:23
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::TrackletEngineUnit::pttableinner_
std::vector< bool > pttableinner_
Definition: TrackletEngineUnit.h:75
trklet::TEData::innerfinephi_
int innerfinephi_
Definition: TrackletEngineUnit.h:22
trklet::TrackletEngineUnit::nreg_
unsigned int nreg_
Definition: TrackletEngineUnit.h:67
trklet::TrackletEngineUnit::next_
unsigned int next_
Definition: TrackletEngineUnit.h:70
trklet::TrackletEngineUnit::nstub_
unsigned int nstub_
Definition: TrackletEngineUnit.h:71
LaserClient_cfi.nbins
nbins
Definition: LaserClient_cfi.py:51
trklet::FPGAWord
Definition: FPGAWord.h:9
trklet::TrackletEngineUnit::iAllStub_
unsigned int iAllStub_
Definition: TrackletEngineUnit.h:64
trklet::Settings::nfinephi
int nfinephi(unsigned int inner, unsigned int iSeed) const
Definition: Settings.h:122
trklet::VMStubTE::stub
const Stub * stub() const
Definition: VMStubTE.h:29
trklet::TrackletEngineUnit::ireg_
unsigned int ireg_
Definition: TrackletEngineUnit.h:69
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:59
trklet::TrackletEngineUnit::candpairs_
CircularBuffer< std::pair< const Stub *, const Stub * > > candpairs_
Definition: TrackletEngineUnit.h:79
trklet::TEData::stub_
const Stub * stub_
Definition: TrackletEngineUnit.h:18
trklet::NFINERZBITS
constexpr unsigned int NFINERZBITS
Definition: Settings.h:27
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
trklet::TrackletEngineUnit::iSeed_
unsigned int iSeed_
Definition: TrackletEngineUnit.h:61
trklet::TrackletEngineUnit::nbitsfinephidiff_
unsigned int nbitsfinephidiff_
Definition: TrackletEngineUnit.h:62
trklet::VMStubTE::finephi
const FPGAWord & finephi() const
Definition: VMStubTE.h:23
trklet::Settings::debugTracklet
bool debugTracklet() const
Definition: Settings.h:161
trklet::Stub::isPSmodule
bool isPSmodule() const
Definition: Stub.h:63
trklet::TEData::regions_
std::vector< std::tuple< int, int, int > > regions_
Definition: TrackletEngineUnit.h:24
trklet::benddecode
double benddecode(int ibend, bool isPS)
Definition: Util.h:106
trklet::TrackletEngineUnit::layerdisk2_
unsigned int layerdisk2_
Definition: TrackletEngineUnit.h:60
trklet::TrackletEngineUnit::istub_
unsigned int istub_
Definition: TrackletEngineUnit.h:68