22 pttableinner_(settings),
23 pttableouter_(settings),
24 useregiontable_(settings),
25 innerTable_(settings),
26 innerOverlapTable_(settings) {
29 for (
unsigned int ilayer = 0; ilayer <
N_LAYER; ilayer++) {
34 for (
unsigned int idisk = 0; idisk <
N_DISK; idisk++) {
71 int nbins = 2.0 * (dphimax / dfinephi + 1.0);
92 TrackletLUT::VMRTableType::inneroverlap);
107 assert(outputProj !=
nullptr);
115 if (
output ==
"trackpar") {
122 if (
output.substr(0, 7) ==
"projout") {
127 unsigned int layerdisk =
output[8] -
'1';
128 unsigned int phiregion =
output[12] -
'A';
149 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find output : " <<
output;
158 if (
input ==
"outervmstubin") {
166 if (
tmp->getName()[11] ==
'X')
168 if (
tmp->getName()[11] ==
'Y')
170 if (
tmp->getName()[11] ==
'Z')
172 if (
tmp->getName()[11] ==
'W')
176 unsigned int iTP =
getName()[7] -
'A';
202 if (
input ==
"innerallstubin") {
212 tebuffer_ = tuple<CircularBuffer<TEData>,
unsigned int,
unsigned int,
unsigned int,
unsigned int>(
217 if (
input ==
"outerallstubin") {
223 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find input : " <<
input;
227 bool print = (iSector == 3) && (
getName() ==
"TP_L1L2D");
246 unsigned int countsel = 0;
248 unsigned int countteall = 0;
249 unsigned int stubpairs = 0;
251 unsigned int ninnerstubs = 0;
268 bool goodtedata =
false;
269 bool goodtedata__ =
false;
270 bool goodtedata___ =
false;
272 bool tebuffernearfull;
274 for (
unsigned int istep = 0; istep <
maxStep_; istep++) {
279 unsigned int& istub = std::get<1>(
tebuffer_);
280 unsigned int& imem = std::get<2>(
tebuffer_);
281 cout <<
"istep=" << istep <<
" TEBuffer: " << istub <<
" " << imem <<
" " << tedatabuffer.
rptr() <<
" " 282 << tedatabuffer.
wptr();
286 cout <<
" [" <<
k <<
" " << teunit.rptr() <<
" " << teunit.wptr() <<
" " << teunit.idle() <<
"]";
292 tebuffernearfull = tedatabuffer.
nearfull();
303 if (!teunit.empty()) {
308 if (teunitptr !=
nullptr) {
309 auto stubpair = teunitptr->
read();
316 const Stub* innerFPGAStub = stubpair.first;
319 const Stub* outerFPGAStub = stubpair.second;
355 bool notemptytebuffer = !tedatabuffer.
empty();
361 if (notemptytebuffer) {
363 notemptytebuffer =
false;
366 teunit.step(
print, istep, ite);
375 tedatabuffer.
store(tedata___);
379 unsigned int& istub = std::get<1>(
tebuffer_);
380 unsigned int& imem = std::get<2>(
tebuffer_);
381 unsigned int imemend = std::get<4>(
tebuffer_);
383 if ((!tebuffernearfull) && imem < imemend && istub <
innerallstubs_[imem]->nStubs()) {
392 bool negdisk = (stub->
disk().
value() < 0);
419 FPGAWord lookupbits(lutval, lutwidth,
true, __LINE__, __FILE__);
433 unsigned int useregindex = (innerfinephi << innerbend.
nbits()) + innerbend.
value();
436 unsigned int nrbits = 3;
437 int ir = ((
start & ((1 << (nrbits - 1)) - 1)) << 1) + (rzfinebinfirst >> (
NFINERZBITS - 1));
438 useregindex = (useregindex << nrbits) + ir;
453 for (
int ibin =
start; ibin <=
last; ibin++) {
455 if (!(usereg & (1 << ireg))) {
469 tedata.
regions_.emplace_back(tuple<int, int, int>(ibin -
start, ireg, nstubs));
470 countteall += nstubs;
486 }
else if ((!tebuffernearfull) && imem < imemend && istub == 0) {
490 goodtedata___ = goodtedata__;
491 goodtedata__ = goodtedata;
493 tedata___ = tedata__;
502 if (imem < imemend || (!tedatabuffer.
empty())) {
507 if (!(teunit.idle() && teunit.empty()))
void execute(unsigned int iSector, double phimin, double phimax)
unsigned int vmrlutrbits(unsigned int layerdisk) const
Log< level::Info, true > LogVerbatim
constexpr unsigned int N_RZBITS
const std::pair< const Stub *, const Stub * > & read()
unsigned int maxStep(std::string module) const
bool diskSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
const FPGAWord & r() const
double lutwidthtab(unsigned int inner, unsigned int iSeed) const
unsigned int rptr() const
unsigned int wptr() const
const FPGAWord & z() const
double dphisectorHG() const
void addInput(MemoryBase *memory, std::string input) override
void initLayerDisksandISeed(unsigned int &layerdisk1, unsigned int &layerdisk2, unsigned int &iSeed)
Settings const & settings_
TrackletLUT pttableinner_
int lookup(unsigned int index) const
const FPGAWord & bend() const
std::vector< AllStubsMemory * > outerallstubs_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
unsigned int nTracklets() const
void addOutputProjection(TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
TrackletLUT useregiontable_
static std::string const input
const FPGAWord & disk() const
unsigned int nbitszfinebintable_
std::vector< TrackletEngineUnit > teunits_
bool overlapSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
std::tuple< CircularBuffer< TEData >, unsigned int, unsigned int, unsigned int, unsigned int > tebuffer_
unsigned int nbitsallstubs(unsigned int layerdisk) const
double rmean(unsigned int iLayer) const
TrackletLUT innerOverlapTable_
unsigned int nbitsvmte(unsigned int inner, unsigned int iSeed) const
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
VMStubsTEMemory * outervmstubs_
TrackletParametersMemory * trackletpars_
void addOutput(MemoryBase *memory, std::string output) override
bool writeMonitorData(std::string module) const
double zmean(unsigned int iDisk) const
std::vector< AllInnerStubsMemory * > innerallstubs_
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
constexpr unsigned int NFINERZBITS
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
unsigned int nallstubs(unsigned int layerdisk) const
bool debugTracklet() const
unsigned int nVMStubs() const
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
unsigned int nbitsrfinebintable_
void initTPlut(bool fillInner, unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int nbitsfinephidiff, unsigned int iTP)
int nfinephi(unsigned int inner, unsigned int iSeed) const
void initTPregionlut(unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int iAllStub, unsigned int nbitsfinephidiff, unsigned int nbitsfinephi, const TrackletLUT &tplutinner, unsigned int iTP)
bool useSeed(unsigned int iSeed) const
const FPGAWord & phicorr() const
unsigned int nVMStubsBinned(unsigned int bin) const
TrackletLUT pttableouter_
unsigned int teunits(unsigned int iSeed) const
std::ofstream & ofstream(std::string fname)
double rmaxdiskvm() const
unsigned int ntrackletmax() const
unsigned int bits(unsigned int lsb, unsigned int nbit) const
std::string const & getName() const
void reset(double vett[256])
void initVMRTable(unsigned int layerdisk, VMRTableType type, int region=-1)
unsigned int vmrlutzbits(unsigned int layerdisk) const
bool barrelSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
double rmaxdiskl1overlapvm() const
std::vector< std::tuple< int, int, int > > regions_