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;
233 unsigned int countall = 0;
234 unsigned int countall_ = 0;
235 unsigned int countsel = 0;
236 unsigned int countpass = 0;
237 unsigned int countpass_ = 0;
254 assert(iInnerMem->nStubs() == iInnerMem->nStubs());
255 for (
unsigned int j = 0;
j < iInnerMem->nStubs();
j++) {
256 const Stub* firstallstub = iInnerMem->getStub(
j);
263 bool negdisk = (firstallstub->
disk().
value() < 0);
264 int indexz = (((1 << (firstallstub->
z().
nbits() - 1)) + firstallstub->
z().
value()) >>
271 indexr = firstallstub->
r().
value();
277 indexr = (((1 << (firstallstub->
r().
nbits() - 1)) + firstallstub->
r().
value()) >>
296 if (iSeed_ < Seed::L1D1 || iSeed_ >
Seed::L2D1) {
308 lutval += (lutval2 << 10);
314 FPGAWord binlookup(lutval, lutwidth,
true, __LINE__, __FILE__);
321 constexpr
int andlookupbits = 1023;
322 constexpr
int shiftzdiffmax = 7;
323 constexpr
int andnewbin = 127;
324 constexpr
int divbin = 8;
325 constexpr
int andzbinfirst = 7;
326 constexpr
int shiftstart = 1;
327 constexpr
int andlast = 1;
328 constexpr
int maxlast = 8;
330 int lookupbits = binlookup.
value() & andlookupbits;
331 int zdiffmax = (lookupbits >> shiftzdiffmax);
332 int newbin = (lookupbits & andnewbin);
333 int bin = newbin / divbin;
335 int zbinfirst = newbin & andzbinfirst;
346 for (
int ibin =
start; ibin <=
last; ibin++) {
351 <<
"In " <<
getName() <<
" have second stub(1) " << ibin <<
" " <<
j << endl;
359 if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
369 constexpr
int vmbitshift = 10;
370 constexpr
int andlookupbits_ = 1023;
371 constexpr
int andnewbin_ = 127;
372 constexpr
int divbin_ = 8;
373 constexpr
int shiftstart_ = 1;
374 constexpr
int andlast_ = 1;
376 int lookupbits_ = (
int)((binlookup.
value() >> vmbitshift) & andlookupbits_);
377 int newbin_ = (lookupbits_ & andnewbin_);
378 int bin_ = newbin_ / divbin_;
380 int start_ = (bin_ >> shiftstart_);
381 int last_ = start_ + (bin_ & andlast_);
385 <<
"Will look in zbins for third stub" << start_ <<
" to " << last_ << endl;
388 for (
int ibin_ = start_; ibin_ <= last_; ibin_++) {
401 const Stub* innerFPGAStub = firstallstub;
402 const Stub* middleFPGAStub = secondvmstub.
stub();
403 const Stub* outerFPGAStub = thirdvmstub.
stub();
419 <<
"TrackletCalculatorDisplaced execute " <<
getName() <<
"[" <<
iSector_ <<
"]";
425 LLLSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub, middleFPGAStub, middleStub);
431 throw cms::Exception(
"LogicError") << __FILE__ <<
" " << __LINE__ <<
" Invalid seeding!";
450 constexpr
int andlookupbits = 1023;
451 constexpr
int shiftzdiffmax = 7;
452 constexpr
int andnewbin = 127;
453 constexpr
int divbin = 8;
454 constexpr
int andzbinfirst = 7;
455 constexpr
int shiftstart = 1;
456 constexpr
int andlast = 1;
457 constexpr
int maxlast = 8;
459 int lookupbits = binlookup.
value() & andlookupbits;
460 int zdiffmax = (lookupbits >> shiftzdiffmax);
461 int newbin = (lookupbits & andnewbin);
462 int bin = newbin / divbin;
464 int zbinfirst = newbin & andzbinfirst;
475 for (
int ibin =
start; ibin <=
last; ibin++) {
488 if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
496 constexpr
int vmbitshift = 10;
497 constexpr
int andlookupbits_ = 1023;
498 constexpr
int andnewbin_ = 127;
499 constexpr
int divbin_ = 8;
500 constexpr
int shiftstart_ = 1;
501 constexpr
int andlast_ = 1;
503 int lookupbits_ = (
int)((binlookup.
value() >> vmbitshift) & andlookupbits_);
504 int newbin_ = (lookupbits_ & andnewbin_);
505 int bin_ = newbin_ / divbin_;
507 int start_ = (bin_ >> shiftstart_);
508 int last_ = start_ + (bin_ & andlast_);
510 for (
int ibin_ = start_; ibin_ <= last_; ibin_++) {
523 const Stub* innerFPGAStub = firstallstub;
524 const Stub* middleFPGAStub = secondvmstub.
stub();
525 const Stub* outerFPGAStub = thirdvmstub.
stub();
541 <<
"TrackletCalculatorDisplaced execute " <<
getName() <<
"[" <<
iSector_ <<
"]";
545 LLDSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub, middleFPGAStub, middleStub);
565 constexpr
int andlookupbits = 511;
566 constexpr
int shiftrdiffmax = 6;
567 constexpr
int andnewbin = 63;
568 constexpr
int divbin = 8;
569 constexpr
int andrbinfirst = 7;
570 constexpr
int shiftstart = 1;
571 constexpr
int andlast = 1;
572 constexpr
int maxlast = 8;
574 int lookupbits = binlookup.
value() & andlookupbits;
575 bool negdisk = firstallstub->
disk().
value() < 0;
576 int rdiffmax = (lookupbits >> shiftrdiffmax);
577 int newbin = (lookupbits & andnewbin);
578 int bin = newbin / divbin;
580 int rbinfirst = newbin & andrbinfirst;
588 for (
int ibin =
start; ibin <=
last; ibin++) {
593 <<
" in bin = " << ibin <<
" with " <<
outervmstubs_.at(
m)->nVMStubsBinned(ibin) <<
" stubs";
603 if (rbin < rbinfirst)
605 if (rbin - rbinfirst > rdiffmax)
609 constexpr
int vmbitshift = 10;
610 constexpr
int andlookupbits_ = 1023;
611 constexpr
int andnewbin_ = 127;
612 constexpr
int divbin_ = 8;
613 constexpr
int shiftstart_ = 1;
614 constexpr
int andlast_ = 1;
616 int lookupbits_ = (
int)((binlookup.
value() >> vmbitshift) & andlookupbits_);
617 int newbin_ = (lookupbits_ & andnewbin_);
618 int bin_ = newbin_ / divbin_;
620 int start_ = (bin_ >> shiftstart_);
621 int last_ = start_ + (bin_ & andlast_);
628 for (
int ibin_ = start_; ibin_ <= last_; ibin_++) {
641 const Stub* innerFPGAStub = firstallstub;
642 const Stub* middleFPGAStub = secondvmstub.
stub();
643 const Stub* outerFPGAStub = thirdvmstub.
stub();
659 <<
"TrackletCalculatorDisplaced execute " <<
getName() <<
"[" <<
iSector_ <<
"]";
663 DDLSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub, middleFPGAStub, middleStub);
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_
bool accept(const edm::Event &event, const edm::TriggerResults &triggerTable, const std::string &triggerPath)
static std::string const input
unsigned int NLONGVMBINS() const
const FPGAWord & disk() const
bool LLDSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
const Stub * stub() const
std::vector< std::vector< TrackletProjectionsMemory * > > trackletprojlayers_
void execute(unsigned int iSector, double phimin, double phimax)
bool LLLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
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_
bool DDLSeeding(const Stub *innerFPGAStub, const L1TStub *innerStub, const Stub *middleFPGAStub, const L1TStub *middleStub, const Stub *outerFPGAStub, const L1TStub *outerStub)
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