Skip to content

Commit

Permalink
MP fix disk deltar (cms-sw#200)
Browse files Browse the repository at this point in the history
* Fixed ideltar calcualtion to match HLS

* Minor fixes

* Ran code-format, replaced numerical constant

---------

Co-authored-by: bryates <brent.yates@email.ucr.edu>
  • Loading branch information
2 people authored and Zhenbin Wu committed Feb 14, 2024
1 parent 9740d0e commit 821201b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/src/MatchEngineUnit.cc
Expand Up @@ -122,7 +122,7 @@ void MatchEngineUnit::processPipeline() {
int diskps = (!barrel_) && isPSmodule;

//here we always use the larger number of bits for the bend
unsigned int index = (diskps << (N_BENDBITS_2S + NRINVBITS)) + (projrinv___ << nbits) + vmstub___.bend().value();
unsigned int index = (diskps << (nbits + NRINVBITS)) + (projrinv___ << nbits) + vmstub___.bend().value();

//Check if stub z position consistent
int idrz = stubfinerz - projfinerz___;
Expand Down
9 changes: 5 additions & 4 deletions L1Trigger/TrackFindingTracklet/src/MatchProcessor.cc
Expand Up @@ -352,7 +352,7 @@ void MatchProcessor::execute(unsigned int iSector, double phimin) {

unsigned int iphi = (fpgaphi.value() >> (fpgaphi.nbits() - nvmbits_)) & (nvmbins_ - 1);

int nextrabits = 2;
constexpr int nextrabits = 2;
int overlapbits = nvmbits_ + nextrabits;

unsigned int extrabits = fpgaphi.bits(fpgaphi.nbits() - overlapbits - nextrabits, nextrabits);
Expand Down Expand Up @@ -435,7 +435,7 @@ void MatchProcessor::execute(unsigned int iSector, double phimin) {
VMStubsMEMemory* stubmem = vmstubs_[0];
bool usefirstMinus = stubmem->nStubsBin(ivmMinus * nbins + slot) != 0;
bool usesecondMinus = (second && (stubmem->nStubsBin(ivmMinus * nbins + slot + 1) != 0));
bool usefirstPlus = ivmPlus != ivmMinus && stubmem->nStubsBin(ivmPlus * nbins + slot) != 0;
bool usefirstPlus = ivmPlus != ivmMinus && (stubmem->nStubsBin(ivmPlus * nbins + slot) != 0);
bool usesecondPlus = ivmPlus != ivmMinus && (second && (stubmem->nStubsBin(ivmPlus * nbins + slot + 1) != 0));

good_ = usefirstPlus || usesecondPlus || usefirstMinus || usesecondMinus;
Expand Down Expand Up @@ -583,7 +583,7 @@ bool MatchProcessor::matchCalculator(Tracklet* tracklet, const Stub* fpgastub, b
// Update the "best" values
if (imatch) {
best_ideltaphi_barrel = std::abs(ideltaphi);
best_ideltaz_barrel = std::abs(ideltaz);
best_ideltaz_barrel = std::abs(ideltaz << dzshift_);
}

if (settings_.debugTracklet()) {
Expand Down Expand Up @@ -671,7 +671,8 @@ bool MatchProcessor::matchCalculator(Tracklet* tracklet, const Stub* fpgastub, b
}
}

int ideltar = (irstub * settings_.kr()) / settings_.krprojshiftdisk() - ir;
constexpr int diff_bits = 1;
int ideltar = (irstub >> diff_bits) - ir;

if (!stub->isPSmodule()) {
int ialpha = fpgastub->alpha().value();
Expand Down

0 comments on commit 821201b

Please sign in to comment.