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++) {
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") {
135 assert(outputProj !=
nullptr);
144 if (
output ==
"trackpar") {
151 if (
output.substr(0, 7) ==
"projout") {
156 constexpr unsigned layerdiskPosInprojout = 8;
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 countsel = 0;
251 assert(iInnerMem->nStubs() == iInnerMem->nStubs());
252 for (
unsigned int j = 0;
j < iInnerMem->nStubs();
j++) {
253 const Stub* firstallstub = iInnerMem->getStub(
j);
260 bool negdisk = (firstallstub->
disk().
value() < 0);
261 int indexz = (((1 << (firstallstub->
z().
nbits() - 1)) + firstallstub->
z().
value()) >>
268 indexr = firstallstub->
r().
value();
274 indexr = (((1 << (firstallstub->
r().
nbits() - 1)) + firstallstub->
r().
value()) >>
293 if (iSeed_ < Seed::L1D1 || iSeed_ >
Seed::L2D1) {
305 lutval += (lutval2 << 10);
311 FPGAWord binlookup(lutval, lutwidth,
true, __LINE__, __FILE__);
327 int lookupbits = binlookup.
value() & andlookupbits;
328 int zdiffmax = (lookupbits >> shiftzdiffmax);
329 int newbin = (lookupbits & andnewbin);
330 int bin = newbin / divbin;
332 int zbinfirst = newbin & andzbinfirst;
343 for (
int ibin =
start; ibin <=
last; ibin++) {
348 <<
"In " <<
getName() <<
" have second stub(1) " << ibin <<
" " <<
j << endl;
356 if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
371 int lookupbits_ = (
int)((binlookup.
value() >> vmbitshift) & andlookupbits_);
372 int newbin_ = (lookupbits_ & andnewbin_);
373 int bin_ = newbin_ / divbin_;
375 int start_ = (bin_ >> shiftstart_);
376 int last_ = start_ + (bin_ & andlast_);
380 <<
"Will look in zbins for third stub" << start_ <<
" to " << last_ << endl;
383 for (
int ibin_ = start_; ibin_ <= last_; ibin_++) {
394 const Stub* innerFPGAStub = firstallstub;
395 const Stub* middleFPGAStub = secondvmstub.
stub();
396 const Stub* outerFPGAStub = thirdvmstub.
stub();
412 <<
"TrackletCalculatorDisplaced execute " <<
getName() <<
"[" <<
iSector_ <<
"]";
418 LLLSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub, middleFPGAStub, middleStub);
424 throw cms::Exception(
"LogicError") << __FILE__ <<
" " << __LINE__ <<
" Invalid seeding!";
452 int lookupbits = binlookup.
value() & andlookupbits;
453 int zdiffmax = (lookupbits >> shiftzdiffmax);
454 int newbin = (lookupbits & andnewbin);
455 int bin = newbin / divbin;
457 int zbinfirst = newbin & andzbinfirst;
468 for (
int ibin =
start; ibin <=
last; ibin++) {
480 if (zbin < zbinfirst || zbin - zbinfirst > zdiffmax) {
495 int lookupbits_ = (
int)((binlookup.
value() >> vmbitshift) & andlookupbits_);
496 int newbin_ = (lookupbits_ & andnewbin_);
497 int bin_ = newbin_ / divbin_;
499 int start_ = (bin_ >> shiftstart_);
500 int last_ = start_ + (bin_ & andlast_);
502 for (
int ibin_ = start_; ibin_ <= last_; ibin_++) {
513 const Stub* innerFPGAStub = firstallstub;
514 const Stub* middleFPGAStub = secondvmstub.
stub();
515 const Stub* outerFPGAStub = thirdvmstub.
stub();
531 <<
"TrackletCalculatorDisplaced execute " <<
getName() <<
"[" <<
iSector_ <<
"]";
535 LLDSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub, middleFPGAStub, middleStub);
564 int lookupbits = binlookup.
value() & andlookupbits;
565 bool negdisk = firstallstub->
disk().
value() < 0;
566 int rdiffmax = (lookupbits >> shiftrdiffmax);
567 int newbin = (lookupbits & andnewbin);
568 int bin = newbin / divbin;
570 int rbinfirst = newbin & andrbinfirst;
578 for (
int ibin =
start; ibin <=
last; ibin++) {
583 <<
" in bin = " << ibin <<
" with " <<
outervmstubs_.at(
m)->nVMStubsBinned(ibin) <<
" stubs";
591 if (rbin < rbinfirst)
593 if (rbin - rbinfirst > rdiffmax)
604 int lookupbits_ = (
int)((binlookup.
value() >> vmbitshift) & andlookupbits_);
605 int newbin_ = (lookupbits_ & andnewbin_);
606 int bin_ = newbin_ / divbin_;
608 int start_ = (bin_ >> shiftstart_);
609 int last_ = start_ + (bin_ & andlast_);
616 for (
int ibin_ = start_; ibin_ <= last_; ibin_++) {
627 const Stub* innerFPGAStub = firstallstub;
628 const Stub* middleFPGAStub = secondvmstub.
stub();
629 const Stub* outerFPGAStub = thirdvmstub.
stub();
645 <<
"TrackletCalculatorDisplaced execute " <<
getName() <<
"[" <<
iSector_ <<
"]";
649 DDLSeeding(outerFPGAStub, outerStub, innerFPGAStub, innerStub, middleFPGAStub, middleStub);
669 globals_->
ofstream(
"trackletprocessordisplaced.txt") <<
getName() <<
" " << countall <<
" " << countsel << endl;
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_
bool writeMonitorData(std::string module) const
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::ofstream & ofstream(std::string fname)
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