17 using namespace trklet;
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';
130 if (output[7] ==
'L') {
139 if (output[7] ==
'D') {
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 countall = 0;
247 unsigned int countsel = 0;
249 unsigned int countteall = 0;
250 unsigned int stubpairs = 0;
252 unsigned int ntedata = 0;
254 unsigned int ninnerstubs = 0;
271 bool goodtedata =
false;
272 bool goodtedata__ =
false;
273 bool goodtedata___ =
false;
275 bool tebuffernearfull;
282 unsigned int& istub = std::get<1>(
tebuffer_);
283 unsigned int& imem = std::get<2>(
tebuffer_);
284 cout <<
"istep=" <<
istep <<
" TEBuffer: " << istub <<
" " << imem <<
" " << tedatabuffer.
rptr() <<
" "
285 << tedatabuffer.
wptr();
287 for (
auto& teunit : teunits_) {
289 cout <<
" [" << k <<
" " << teunit.rptr() <<
" " << teunit.wptr() <<
" " << teunit.idle() <<
"]";
295 tebuffernearfull = tedatabuffer.
nearfull();
304 for (
auto& teunit : teunits_) {
306 if (!teunit.empty()) {
311 if (teunitptr !=
nullptr) {
312 auto stubpair = teunitptr->
read();
320 const Stub* innerFPGAStub = stubpair.first;
323 const Stub* outerFPGAStub = stubpair.second;
333 accept =
barrelSeeding(innerFPGAStub, innerStub, outerFPGAStub, outerStub);
335 accept =
diskSeeding(innerFPGAStub, innerStub, outerFPGAStub, outerStub);
337 accept =
overlapSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub);
359 bool notemptytebuffer = !tedatabuffer.
empty();
362 for (
auto& teunit : teunits_) {
365 if (notemptytebuffer) {
367 notemptytebuffer =
false;
370 teunit.step(print,
istep, ite);
379 tedatabuffer.
store(tedata___);
383 unsigned int& istub = std::get<1>(
tebuffer_);
384 unsigned int& imem = std::get<2>(
tebuffer_);
385 unsigned int imemend = std::get<4>(
tebuffer_);
387 if ((!tebuffernearfull) && imem < imemend && istub <
innerallstubs_[imem]->nStubs()) {
396 bool negdisk = (stub->
disk().
value() < 0);
423 FPGAWord lookupbits(lutval, lutwidth,
true, __LINE__, __FILE__);
437 unsigned int useregindex = (innerfinephi << innerbend.
nbits()) + innerbend.
value();
440 unsigned int nrbits = 3;
441 int ir = ((start & ((1 << (nrbits - 1)) - 1)) << 1) + (rzfinebinfirst >> (
NFINERZBITS - 1));
442 useregindex = (useregindex << nrbits) + ir;
457 for (
int ibin = start; ibin <=
last; ibin++) {
459 if (!(usereg & (1 << ireg))) {
468 assert(ireg * nbins + ibin < outervmstubs_->nBin());
473 tedata.
regions_.emplace_back(tuple<int, int, int>(ibin - start, ireg, nstubs));
474 countteall += nstubs;
491 }
else if ((!tebuffernearfull) && imem < imemend && istub == 0) {
495 goodtedata___ = goodtedata__;
496 goodtedata__ = goodtedata;
498 tedata___ = tedata__;
507 if (imem < imemend || (!tedatabuffer.
empty())) {
511 for (
auto& teunit : teunits_) {
512 if (!(teunit.idle() && teunit.empty()))
void execute(unsigned int iSector, double phimin, double phimax)
Log< level::Info, true > LogVerbatim
constexpr unsigned int N_RZBITS
const FPGAWord & bend() const
const FPGAWord & disk() const
double dphisectorHG() const
unsigned int teunits(unsigned int iSeed) const
unsigned int vmrlutrbits(unsigned int layerdisk) const
const FPGAWord & phicorr() const
const std::pair< const Stub *, const Stub * > & read()
static std::vector< std::string > checklist log
bool diskSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
unsigned int vmrlutzbits(unsigned int layerdisk) const
unsigned int ntrackletmax() 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_
std::vector< AllStubsMemory * > outerallstubs_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
bool debugTracklet() const
void addOutputProjection(TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
TrackletLUT useregiontable_
static std::string const input
unsigned int nbitszfinebintable_
std::vector< TrackletEngineUnit > teunits_
double rmean(unsigned int iLayer) const
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 nVMStubsBinned(unsigned int bin) const
std::string const & getName() const
double zmean(unsigned int iDisk) const
std::string const & getName() const
unsigned int nTracklets() const
double rmaxdiskl1overlapvm() const
TrackletLUT innerOverlapTable_
unsigned int nvmte(unsigned int inner, unsigned int iSeed) const
unsigned int bits(unsigned int lsb, unsigned int nbit) const
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
unsigned int nallstubs(unsigned int layerdisk) const
VMStubsTEMemory * outervmstubs_
TrackletParametersMemory * trackletpars_
void addOutput(MemoryBase *memory, std::string output) override
unsigned int maxStep(std::string module) const
const FPGAWord & z() const
std::vector< AllInnerStubsMemory * > innerallstubs_
constexpr unsigned int NFINERZBITS
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
int lookup(unsigned int index) const
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
unsigned int nVMStubs() const
unsigned int nbitsrfinebintable_
void initTPlut(bool fillInner, unsigned int iSeed, unsigned int layerdisk1, unsigned int layerdisk2, unsigned int nbitsfinephidiff, unsigned int iTP)
unsigned int rptr() const
unsigned int nbitsallstubs(unsigned int layerdisk) 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)
TrackletLUT pttableouter_
std::ofstream & ofstream(std::string fname)
int nfinephi(unsigned int inner, unsigned int iSeed) const
const FPGAWord & r() const
bool useSeed(unsigned int iSeed) const
double lutwidthtab(unsigned int inner, unsigned int iSeed) const
void reset(double vett[256])
unsigned int nbitsvmte(unsigned int inner, unsigned int iSeed) const
double rmaxdiskvm() const
tuple size
Write out results.
void initVMRTable(unsigned int layerdisk, VMRTableType type, int region=-1)
unsigned int wptr() const
bool writeMonitorData(std::string module) const
bool barrelSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
std::vector< std::tuple< int, int, int > > regions_