Skip to content

Commit

Permalink
Minor corrections to pin names and removal of duplicate code (cms-sw#78)
Browse files Browse the repository at this point in the history
* Fix to compiler warning and removal of hardoded value in MatchCalculator

* Updates to fix names of pins to make unique

Co-authored-by: Anders Ryd <ryd@Anderss-MacBook-Pro.local>
  • Loading branch information
aryd and Anders Ryd committed May 3, 2021
1 parent 15d2ee6 commit 66b7337
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 23 deletions.
17 changes: 2 additions & 15 deletions L1Trigger/TrackFindingTracklet/src/MatchCalculator.cc
Expand Up @@ -290,22 +290,9 @@ void MatchCalculator::execute(double phioffset) {
<< ideltaz * fact_ * settings_.kz() << " " << dz << " " << zmatchcut_[seedindex] * settings_.kz() << endl;
}

bool imatch = false;
if (std::abs(dphi) < 0.2 && std::abs(dphiapprox) < 0.2) { //Changed the Asserts into if statements
if (settings_.writeMonitorData("Residuals")) {
double pt = 0.01 * settings_.c() * settings_.bfield() / std::abs(tracklet->rinv());
bool imatch = (std::abs(ideltaphi) <= (int)phimatchcut_[seedindex]) &&
(std::abs(ideltaz * fact_) <= (int)zmatchcut_[seedindex]);

globals_->ofstream("layerresiduals.txt")
<< layerdisk_ + 1 << " " << seedindex << " " << pt << " "
<< ideltaphi * settings_.kphi1() * settings_.rmean(layerdisk_) << " "
<< dphiapprox * settings_.rmean(layerdisk_) << " "
<< phimatchcut_[seedindex] * settings_.kphi1() * settings_.rmean(layerdisk_) << " "
<< ideltaz * fact_ * settings_.kz() << " " << dz << " " << zmatchcut_[seedindex] * settings_.kz() << endl;
}

imatch = (std::abs(ideltaphi) <= (int)phimatchcut_[seedindex]) &&
(std::abs(ideltaz * fact_) <= (int)zmatchcut_[seedindex]);
}
if (settings_.debugTracklet()) {
edm::LogVerbatim("Tracklet") << getName() << " imatch = " << imatch << " ideltaphi cut " << ideltaphi << " "
<< phimatchcut_[seedindex] << " ideltaz*fact cut " << ideltaz * fact_ << " "
Expand Down
13 changes: 9 additions & 4 deletions L1Trigger/TrackFindingTracklet/src/TrackletConfigBuilder.cc
Expand Up @@ -772,7 +772,7 @@ void TrackletConfigBuilder::writeASMemories(std::ostream& os, std::ostream& memo
}

if (ext == "") {
ext = "_" + iTCStr(iTC);
ext = "_" + LayerName(l1)+iTCStr(iTC);
}

if (iSeed < 4) { //Barrel seeding
Expand Down Expand Up @@ -914,13 +914,13 @@ void TrackletConfigBuilder::writeVMSMemories(std::ostream& os, std::ostream& mem
memories << "VMStubsME: VMSME_" << LayerName(ilayer) << "PHI" << iTCStr(iReg) << iVMME + 1 << "n1 [18]"
<< std::endl;
os << "VMSME_" << LayerName(ilayer) << "PHI" << iTCStr(iReg) << iVMME + 1 << "n1"
<< " input=> VMR_" << LayerName(ilayer) << "PHI" << iTCStr(iReg) << ".vmstuboutPHI" << iTCStr(iReg)
<< " input=> VMR_" << LayerName(ilayer) << "PHI" << iTCStr(iReg) << ".vmstuboutMEPHI" << iTCStr(iReg)
<< iVMME + 1 << " output=> ME_" << LayerName(ilayer) << "PHI" << iTCStr(iReg) << iVMME + 1 << ".vmstubin"
<< std::endl;
}
}

//Next write VMS memories used by MatchCalculator
//Next write VMS memories used by TrackletEngine
for (unsigned int iSeed = 0; iSeed < N_SEED_PROMPT; iSeed++) {
for (unsigned int innerouterseed = 0; innerouterseed < 2; innerouterseed++) {
//FIXME - code could be cleaner
Expand Down Expand Up @@ -959,11 +959,16 @@ void TrackletConfigBuilder::writeVMSMemories(std::ostream& os, std::ostream& mem

if (!used)
continue;

string inorout = "I";
if (innerouterseed == 1 )
inorout = "O";

nmem++;
memories << "VMStubsTE: VMSTE_" << LayerName(ilayer) << "PHI" << iRegStr(iReg, iSeed) << iVMTE + 1 << "n"
<< nmem << " [18]" << std::endl;
os << "VMSTE_" << LayerName(ilayer) << "PHI" << iRegStr(iReg, iSeed) << iVMTE + 1 << "n" << nmem
<< " input=> VMR_" << LayerName(ilayer) << "PHI" << iTCStr(iReg) << ".vmstuboutPHI" << iTCStr(iReg)
<< " input=> VMR_" << LayerName(ilayer) << "PHI" << iTCStr(iReg) << ".vmstuboutTE"<<inorout<<"PHI" << iRegStr(iReg,iSeed)
<< iVMTE + 1 << " output=> TE_" << LayerName(l1) << "PHI" << iRegStr(TE1 / NVMTE1, iSeed) << TE1 + 1
<< "_" << LayerName(l2) << "PHI" << iRegStr(TE2 / NVMTE2, iSeed) << TE2 + 1;
if (innerouterseed == 0) {
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/src/TripletEngine.cc
Expand Up @@ -466,7 +466,7 @@ void TripletEngine::writeTables() {
tableName << "table/table_" << name_ << ".txt";

fout.open(tableName.str(), ofstream::out);
for (const auto &entry : table_)
for (const auto entry : table_)
fout << entry << endl;
fout.close();

Expand Down
3 changes: 2 additions & 1 deletion L1Trigger/TrackFindingTracklet/src/VMRouter.cc
Expand Up @@ -41,7 +41,8 @@ void VMRouter::addOutput(MemoryBase* memory, string output) {
return;
}

if (output.substr(0, 12) == "vmstuboutPHI") {
if (output.substr(0, 12) == "vmstuboutPHI" || output.substr(0, 14) == "vmstuboutMEPHI" ||
output.substr(0, 15) == "vmstuboutTEIPHI" ||output.substr(0, 15) == "vmstuboutTEOPHI" ) {
char seedtype = memory->getName().substr(11, 1)[0];
unsigned int pos = 12;
int vmbin = memory->getName().substr(pos, 1)[0] - '0';
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/TrackFindingTracklet/src/imath.cc
Expand Up @@ -420,13 +420,13 @@ bool VarFlag::passes() {
bool passes = true;
for (const auto &cut_var : passes0) {
bool local_passes = false;
for (const auto &pass : cut_var.second)
for (const auto pass : cut_var.second)
local_passes = local_passes || pass;
passes = passes && local_passes;
}
for (const auto &cut_var : passes1) {
bool local_passes = false;
for (const auto &pass : cut_var.second)
for (const auto pass : cut_var.second)
local_passes = local_passes || pass;
passes = passes && local_passes;
}
Expand Down

0 comments on commit 66b7337

Please sign in to comment.