21 TrackletProcessorDisplaced::TrackletProcessorDisplaced(
string name,
Settings const& settings,
Globals* globals)
23 innerTable_(settings),
24 innerOverlapTable_(settings),
25 innerThirdTable_(settings) {
33 const unsigned layerdiskPosInName = 4;
34 const unsigned regionPosInName1 = 9;
39 unsigned int region =
name.substr(1)[regionPosInName1] -
'A';
61 for (
unsigned int ilayer = 0; ilayer <
N_LAYER; ilayer++) {
66 for (
unsigned int idisk = 0; idisk <
N_DISK; idisk++) {
82 constexpr
unsigned layerPosInName1 = 4;
83 constexpr
unsigned diskPosInName1 = 4;
84 constexpr
unsigned layer1PosInName1 = 4;
85 constexpr
unsigned disk1PosInName1 = 4;
86 constexpr
unsigned layer2PosInName1 = 6;
87 constexpr
unsigned disk2PosInName1 = 6;
89 string name1 =
name.substr(1);
91 layer_ = name1[layerPosInName1] -
'0';
93 disk_ = name1[diskPosInName1] -
'0';
96 layer1_ = name1[layer1PosInName1] -
'0';
98 disk1_ = name1[disk1PosInName1] -
'0';
100 layer2_ = name1[layer2PosInName1] -
'0';
102 disk2_ = name1[disk2PosInName1] -
'0';
107 int iTC = name1[regionPosInName1] -
'A';
109 if (name1.substr(3, 6) ==
"L3L4L2") {
112 }
else if (name1.substr(3, 6) ==
"L5L6L4") {
115 }
else if (name1.substr(3, 6) ==
"L2L3D1") {
118 }
else if (name1.substr(3, 6) ==
"D1D2L2") {
124 constexpr
int TCIndexMin = 128;
125 constexpr
int TCIndexMax = 191;
135 assert(outputProj !=
nullptr);
144 if (
output ==
"trackpar") {
151 if (
output.substr(0, 7) ==
"projout") {
156 constexpr
unsigned layerdiskPosInprojout = 8;
157 constexpr
unsigned phiPosInprojout = 12;
159 unsigned int layerdisk =
output[layerdiskPosInprojout] -
'1';
160 unsigned int phiregion =
output[phiPosInprojout] -
'A';
181 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find output : " <<
output;
190 if (
input ==
"thirdallstubin") {
196 if (
input ==
"firstallstubin") {
202 if (
input ==
"secondallstubin") {
208 if (
input.substr(0, 8) ==
"stubpair") {
215 if (
input ==
"thirdvmstubin") {
221 if (
input ==
"secondvmstubin") {
229 throw cms::Exception(
"BadConfig") << __FILE__ <<
" " << __LINE__ <<
" Could not find input : " <<
input;
249 assert(iInnerMem->nStubs() == iInnerMem->nStubs());
250 for (
unsigned int j = 0;
j < iInnerMem->nStubs();
j++) {
251 const Stub* firstallstub = iInnerMem->getStub(
j);
258 bool negdisk = (firstallstub->
disk().
value() < 0);
259 int indexz = (((1 << (firstallstub->
z().
nbits() - 1)) + firstallstub->
z().
value()) >>
266 indexr = firstallstub->
r().
value();
272 indexr = (((1 << (firstallstub->
r().
nbits() - 1)) + firstallstub->
r().
value()) >>
291 if (iSeed_ < Seed::L1D1 || iSeed_ >
Seed::L2D1) {
303 lutval += (lutval2 << 10);
309 FPGAWord binlookup(lutval, lutwidth,
true, __LINE__, __FILE__);
316 constexpr
int andlookupbits = 1023;
317 constexpr
int shiftzdiffmax = 7;
318 constexpr
int andnewbin = 127;
319 constexpr
int divbin = 8;
320 constexpr
int andzbinfirst = 7;
321 constexpr
int shiftstart = 1;
322 constexpr
int andlast = 1;
323 constexpr
int maxlast = 8;
325 int lookupbits = binlookup.
value() & andlookupbits;
326 int zdiffmax = (lookupbits >> shiftzdiffmax);
327 int newbin = (lookupbits & andnewbin);
328 int bin = newbin / divbin;
330 int zbinfirst = newbin & andzbinfirst;
341 for (
int ibin =
start; ibin <=
last; ibin++) {
346 <<
"In " <<
getName() <<
" have second stub(1) " << ibin <<
" " <<
j << endl;
354 if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
362 constexpr
int vmbitshift = 10;
363 constexpr
int andlookupbits_ = 1023;
364 constexpr
int andnewbin_ = 127;
365 constexpr
int divbin_ = 8;
366 constexpr
int shiftstart_ = 1;
367 constexpr
int andlast_ = 1;
369 int lookupbits_ = (
int)((binlookup.
value() >> vmbitshift) & andlookupbits_);
370 int newbin_ = (lookupbits_ & andnewbin_);
371 int bin_ = newbin_ / divbin_;
373 int start_ = (bin_ >> shiftstart_);
374 int last_ = start_ + (bin_ & andlast_);
378 <<
"Will look in zbins for third stub" << start_ <<
" to " << last_ << endl;
381 for (
int ibin_ = start_; ibin_ <= last_; ibin_++) {
390 const Stub* innerFPGAStub = firstallstub;
391 const Stub* middleFPGAStub = secondvmstub.
stub();
392 const Stub* outerFPGAStub = thirdvmstub.
stub();
408 <<
"TrackletCalculatorDisplaced execute " <<
getName() <<
"[" <<
iSector_ <<
"]";
413 throw cms::Exception(
"LogicError") << __FILE__ <<
" " << __LINE__ <<
" Invalid seeding!";
432 constexpr
int andlookupbits = 1023;
433 constexpr
int shiftzdiffmax = 7;
434 constexpr
int andnewbin = 127;
435 constexpr
int divbin = 8;
436 constexpr
int andzbinfirst = 7;
437 constexpr
int shiftstart = 1;
438 constexpr
int andlast = 1;
439 constexpr
int maxlast = 8;
441 int lookupbits = binlookup.
value() & andlookupbits;
442 int zdiffmax = (lookupbits >> shiftzdiffmax);
443 int newbin = (lookupbits & andnewbin);
444 int bin = newbin / divbin;
446 int zbinfirst = newbin & andzbinfirst;
457 for (
int ibin =
start; ibin <=
last; ibin++) {
469 if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
477 constexpr
int vmbitshift = 10;
478 constexpr
int andlookupbits_ = 1023;
479 constexpr
int andnewbin_ = 127;
480 constexpr
int divbin_ = 8;
481 constexpr
int shiftstart_ = 1;
482 constexpr
int andlast_ = 1;
484 int lookupbits_ = (
int)((binlookup.
value() >> vmbitshift) & andlookupbits_);
485 int newbin_ = (lookupbits_ & andnewbin_);
486 int bin_ = newbin_ / divbin_;
488 int start_ = (bin_ >> shiftstart_);
489 int last_ = start_ + (bin_ & andlast_);
491 for (
int ibin_ = start_; ibin_ <= last_; ibin_++) {
500 const Stub* innerFPGAStub = firstallstub;
501 const Stub* middleFPGAStub = secondvmstub.
stub();
502 const Stub* outerFPGAStub = thirdvmstub.
stub();
518 <<
"TrackletCalculatorDisplaced execute " <<
getName() <<
"[" <<
iSector_ <<
"]";
536 constexpr
int andlookupbits = 511;
537 constexpr
int shiftrdiffmax = 6;
538 constexpr
int andnewbin = 63;
539 constexpr
int divbin = 8;
540 constexpr
int andrbinfirst = 7;
541 constexpr
int shiftstart = 1;
542 constexpr
int andlast = 1;
543 constexpr
int maxlast = 8;
545 int lookupbits = binlookup.
value() & andlookupbits;
546 bool negdisk = firstallstub->
disk().
value() < 0;
547 int rdiffmax = (lookupbits >> shiftrdiffmax);
548 int newbin = (lookupbits & andnewbin);
549 int bin = newbin / divbin;
551 int rbinfirst = newbin & andrbinfirst;
559 for (
int ibin =
start; ibin <=
last; ibin++) {
564 <<
" in bin = " << ibin <<
" with " <<
outervmstubs_.at(
m)->nVMStubsBinned(ibin) <<
" stubs";
572 if (rbin < rbinfirst)
574 if (rbin - rbinfirst > rdiffmax)
578 constexpr
int vmbitshift = 10;
579 constexpr
int andlookupbits_ = 1023;
580 constexpr
int andnewbin_ = 127;
581 constexpr
int divbin_ = 8;
582 constexpr
int shiftstart_ = 1;
583 constexpr
int andlast_ = 1;
585 int lookupbits_ = (
int)((binlookup.
value() >> vmbitshift) & andlookupbits_);
586 int newbin_ = (lookupbits_ & andnewbin_);
587 int bin_ = newbin_ / divbin_;
589 int start_ = (bin_ >> shiftstart_);
590 int last_ = start_ + (bin_ & andlast_);
597 for (
int ibin_ = start_; ibin_ <= last_; ibin_++) {
606 const Stub* innerFPGAStub = firstallstub;
607 const Stub* middleFPGAStub = secondvmstub.
stub();
608 const Stub* outerFPGAStub = thirdvmstub.
stub();
624 <<
"TrackletCalculatorDisplaced execute " <<
getName() <<
"[" <<
iSector_ <<
"]";
unsigned int vmrlutrbits(unsigned int layerdisk) const
Log< level::Info, true > LogVerbatim
std::vector< AllStubsMemory * > middleallstubs_
const FPGAWord & r() const
double lutwidthtab(unsigned int inner, unsigned int iSeed) const
std::vector< AllStubsMemory * > innerallstubs_
const FPGAWord & z() const
std::string strbare() const
Settings const & settings_
int lookup(unsigned int index) const
std::vector< VMStubsTEMemory * > innervmstubs_
static std::string const input
unsigned int NLONGVMBINS() const
const FPGAWord & disk() const
const Stub * stub() const
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
void execute(unsigned int iSector, double phimin, double phimax)
const FPGAWord & vmbits() const
double lutwidthtabextended(unsigned int inner, unsigned int iSeed) const
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojdisks_
unsigned int layerdisk() const
void initLayerDisk(unsigned int pos, int &layer, int &disk)
unsigned int nallstubs(unsigned int layerdisk) const
bool debugTracklet() const
std::vector< StubPairsMemory * > stubpairs_
TrackletLUT innerThirdTable_
const std::string & stubword() const
TrackletLUT innerOverlapTable_
std::vector< AllStubsMemory * > outerallstubs_
void addOutput(MemoryBase *memory, std::string output) override
std::vector< VMStubsTEMemory * > outervmstubs_
std::string const & getName() const
void addOutputProjection(TrackletProjectionsMemory *&outputProj, MemoryBase *memory)
TrackletParametersMemory * trackletpars_
void initVMRTable(unsigned int layerdisk, VMRTableType type, int region=-1)
void addInput(MemoryBase *memory, std::string input) override
unsigned int vmrlutzbits(unsigned int layerdisk) const