Skip to content

Commit

Permalink
Include commit from fw_synch_210611 (cms-sw#86)
Browse files Browse the repository at this point in the history
* Fixes to remove unused TPROJ memory and fix problem with VMR LUT in L6

* apply code-formats and code-checks

Co-authored-by: Anders <aryd@cern.ch>
  • Loading branch information
2 people authored and Tova Holmes committed Sep 28, 2021
1 parent dac7a8a commit 045e4ec
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 24 deletions.
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/interface/MatchEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace trklet {
void addOutput(MemoryBase* memory, std::string output) override;
void addInput(MemoryBase* memory, std::string input) override;

void execute();
void execute(unsigned int iSector);

private:
VMStubsMEMemory* vmstubs_;
Expand Down
50 changes: 33 additions & 17 deletions L1Trigger/TrackFindingTracklet/interface/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -767,21 +767,37 @@ namespace trklet {
{"TRE", 108}};

// If set to true this will generate debub printout in text files
std::unordered_map<std::string, bool> writeMonitorData_{{"IL", false}, {"TE", false},
{"CT", false}, {"HitPattern", false},
{"ChiSq", false}, {"Seeds", false},
{"FT", false}, {"Residuals", false},
{"StubBend", false}, {"MC", false},
{"MP", false}, {"ME", false},
{"AP", false}, {"VMP", false},
{"TrackProjOcc", false}, {"TC", false},
{"Pars", false}, {"TPars", false},
{"TPD", false}, {"TrackletPars", false},
{"TED", false}, {"TP", false},
{"TRE", false}, {"VMR", false},
{"StubsLayer", false}, {"StubsLayerSector", false},
{"HitEff", false}, {"MatchEff", false},
{"IFit", false}, {"AS", false}};
std::unordered_map<std::string, bool> writeMonitorData_{{"IL", false},
{"TE", false},
{"CT", false},
{"HitPattern", false},
{"ChiSq", false},
{"Seeds", false},
{"FT", false},
{"Residuals", false},
{"StubBend", false},
{"MC", false},
{"MP", false},
{"ME", false},
{"AP", false},
{"VMP", false},
{"TrackProjOcc", false},
{"TC", false},
{"Pars", false},
{"TPars", false},
{"TPD", false},
{"TrackletPars", false},
{"TED", false},
{"TP", false},
{"TRE", false},
{"VMR", false},
{"StubsLayer", false},
{"StubsLayerSector", false},
{"HitEff", false},
{"MatchEff", false},
{"IFit", false},
{"AS", false},
{"WriteEmptyProj", false}};

std::array<double, N_DSS_MOD> rDSSinner_mod_{{68.9391, 78.7750, 85.4550, 96.3150, 102.3160}};
std::array<double, N_DSS_MOD> rDSSouter_mod_{{66.4903, 76.7750, 84.4562, 94.9920, 102.3160}};
Expand Down Expand Up @@ -835,8 +851,8 @@ namespace trklet {
int nrinvBitsTable_{3}; //number of bits for tabulating rinv dependence

unsigned int MEBinsBits_{3};
unsigned int MEBinsDisks_{8}; //on each side
unsigned int maxStubsPerBin_{16};
unsigned int MEBinsDisks_{8}; //on each side
unsigned int maxStubsPerBin_{15}; //16 causes overflow!

// Options for chisq fit
bool exactderivatives_{false};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ namespace trklet {
public:
TrackletProjectionsMemory(std::string name, Settings const& settings);

~TrackletProjectionsMemory() override = default;
~TrackletProjectionsMemory() override {
if (settings_.writeMonitorData("WriteEmptyProj") && (!hasProj_)) {
edm::LogPrint("Tracklet") << "Empty Projection Memory : " << getName() << std::endl;
}
};

void addProj(Tracklet* tracklet);

Expand All @@ -34,6 +38,7 @@ namespace trklet {
private:
std::vector<Tracklet*> tracklets_;

bool hasProj_;
int layer_;
int disk_;
};
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/TrackFindingTracklet/src/MatchEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ void MatchEngine::addInput(MemoryBase* memory, string input) {
throw cms::Exception("BadConfig") << __FILE__ << " " << __LINE__ << " could not find input: " << input;
}

void MatchEngine::execute() {
void MatchEngine::execute(unsigned int iSector) {
unsigned int countall = 0;
unsigned int countpass = 0;

bool print = (getName() == "ME_L3PHIC20");
bool print = (iSector == 3 && getName() == "ME_L3PHIC20");
print = false;

constexpr unsigned int kNBitsBuffer = 3;
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/src/Sector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ void Sector::executePR() {

void Sector::executeME() {
for (auto& i : ME_) {
i->execute();
i->execute(isector_);
}
}

Expand Down
38 changes: 37 additions & 1 deletion L1Trigger/TrackFindingTracklet/src/TrackletConfigBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,33 @@ std::pair<double, double> TrackletConfigBuilder::seedPhiRange(double rproj, unsi
}

void TrackletConfigBuilder::buildProjections() {
set<string> emptyProjStandard = {
"TPROJ_L1L2H_L3PHIB", "TPROJ_L1L2E_L3PHIC", "TPROJ_L1L2K_L3PHIC", "TPROJ_L1L2H_L3PHID", "TPROJ_L1L2F_L5PHIA",
"TPROJ_L1L2G_L5PHID", "TPROJ_L1L2A_L6PHIA", "TPROJ_L1L2J_L6PHIB", "TPROJ_L1L2C_L6PHIC", "TPROJ_L1L2L_L6PHID",
"TPROJ_L3L4D_D1PHIB", "TPROJ_L2L3A_D1PHIC", "TPROJ_L3L4A_D1PHIC", "TPROJ_L1L2G_D2PHIA", "TPROJ_L1D1D_D2PHIA",
"TPROJ_L1D1E_D2PHIA", "TPROJ_L1L2J_D2PHIB", "TPROJ_L3L4D_D2PHIB", "TPROJ_L1D1A_D2PHIB", "TPROJ_L1D1F_D2PHIB",
"TPROJ_L1D1G_D2PHIB", "TPROJ_L1L2C_D2PHIC", "TPROJ_L2L3A_D2PHIC", "TPROJ_L3L4A_D2PHIC", "TPROJ_L1D1B_D2PHIC",
"TPROJ_L1D1C_D2PHIC", "TPROJ_L1D1H_D2PHIC", "TPROJ_L2D1A_D2PHIC", "TPROJ_L1L2F_D2PHID", "TPROJ_L1D1D_D2PHID",
"TPROJ_L1D1E_D2PHID", "TPROJ_L1L2G_D3PHIA", "TPROJ_L1D1D_D3PHIA", "TPROJ_L1D1E_D3PHIA", "TPROJ_L1L2J_D3PHIB",
"TPROJ_L1D1A_D3PHIB", "TPROJ_L1D1F_D3PHIB", "TPROJ_L1D1G_D3PHIB", "TPROJ_L1L2C_D3PHIC", "TPROJ_L2L3A_D3PHIC",
"TPROJ_L1D1B_D3PHIC", "TPROJ_L1D1C_D3PHIC", "TPROJ_L1D1H_D3PHIC", "TPROJ_L2D1A_D3PHIC", "TPROJ_L1L2F_D3PHID",
"TPROJ_L1D1D_D3PHID", "TPROJ_L1D1E_D3PHID", "TPROJ_L1L2G_D4PHIA", "TPROJ_L1D1D_D4PHIA", "TPROJ_L1D1E_D4PHIA",
"TPROJ_L1L2J_D4PHIB", "TPROJ_L1D1G_D4PHIB", "TPROJ_L1L2C_D4PHIC", "TPROJ_L2L3A_D4PHIC", "TPROJ_L1D1B_D4PHIC",
"TPROJ_L2D1A_D4PHIC", "TPROJ_L1L2F_D4PHID", "TPROJ_L1D1D_D4PHID", "TPROJ_L1D1E_D5PHIA", "TPROJ_L1D1G_D5PHIB",
"TPROJ_L1D1B_D5PHIC", "TPROJ_L1D1D_D5PHID"};

set<string> emptyProjCombined = {
"TPROJ_L1L2J_L6PHIB", "TPROJ_L1L2C_L6PHIC", "TPROJ_L1L2G_D1PHIA", "TPROJ_L1L2J_D1PHIB", "TPROJ_L2L3D_D1PHIB",
"TPROJ_L3L4D_D1PHIB", "TPROJ_L1L2C_D1PHIC", "TPROJ_L2L3A_D1PHIC", "TPROJ_L3L4A_D1PHIC", "TPROJ_L1L2F_D1PHID",
"TPROJ_L1L2G_D2PHIA", "TPROJ_L1D1E_D2PHIA", "TPROJ_L1L2J_D2PHIB", "TPROJ_L2L3D_D2PHIB", "TPROJ_L3L4D_D2PHIB",
"TPROJ_L1D1G_D2PHIB", "TPROJ_L1L2C_D2PHIC", "TPROJ_L2L3A_D2PHIC", "TPROJ_L3L4A_D2PHIC", "TPROJ_L1D1B_D2PHIC",
"TPROJ_L2D1A_D2PHIC", "TPROJ_L1L2F_D2PHID", "TPROJ_L1D1D_D2PHID", "TPROJ_L1L2G_D3PHIA", "TPROJ_L1D1E_D3PHIA",
"TPROJ_L1L2J_D3PHIB", "TPROJ_L2L3D_D3PHIB", "TPROJ_L1D1G_D3PHIB", "TPROJ_L1L2C_D3PHIC", "TPROJ_L2L3A_D3PHIC",
"TPROJ_L1D1B_D3PHIC", "TPROJ_L2D1A_D3PHIC", "TPROJ_L1L2F_D3PHID", "TPROJ_L1D1D_D3PHID", "TPROJ_L1L2G_D4PHIA",
"TPROJ_L1D1E_D4PHIA", "TPROJ_L1L2J_D4PHIB", "TPROJ_L2L3D_D4PHIB", "TPROJ_L1D1G_D4PHIB", "TPROJ_L1L2C_D4PHIC",
"TPROJ_L2L3A_D4PHIC", "TPROJ_L1D1B_D4PHIC", "TPROJ_L2D1A_D4PHIC", "TPROJ_L1L2F_D4PHID", "TPROJ_L1D1D_D4PHID",
"TPROJ_L1D1E_D5PHIA", "TPROJ_L1D1G_D5PHIB", "TPROJ_L1D1B_D5PHIC", "TPROJ_L1D1D_D5PHID"};

for (unsigned int iseed = 0; iseed < N_SEED_PROMPT; iseed++) {
std::vector<std::vector<unsigned int> >& TCs = TC_[iseed];

Expand All @@ -228,7 +255,16 @@ void TrackletConfigBuilder::buildProjections() {
std::pair<double, double> phiRange = seedPhiRange(rproj, iseed, iTC);
if (phiRange.first < allStubs_[ilayer][iReg].second && phiRange.second > allStubs_[ilayer][iReg].first) {
std::pair<unsigned int, unsigned int> tmp(iseed, iTC); //seedindex and TC
projections_[ilayer][iReg].push_back(tmp);
string projName = TPROJName(iseed, iTC, ilayer, iReg);
if (combinedmodules_) {
if (emptyProjCombined.find(projName) == emptyProjCombined.end()) {
projections_[ilayer][iReg].push_back(tmp);
}
} else {
if (emptyProjStandard.find(projName) == emptyProjStandard.end()) {
projections_[ilayer][iReg].push_back(tmp);
}
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion L1Trigger/TrackFindingTracklet/src/TrackletLUT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,8 @@ void TrackletLUT::initVMRTable(unsigned int layerdisk, VMRTableType type, int re
} else {
if (type == VMRTableType::me) {
//This if a hack where the same memory is used in both ME and TE modules
if (layerdisk == 1 || layerdisk == 2 || layerdisk == 3 || layerdisk == 4) {
if (layerdisk == LayerDisk::L2 || layerdisk == LayerDisk::L3 || layerdisk == LayerDisk::L4 ||
layerdisk == LayerDisk::L6) {
positive_ = false;
name_ = "VMTableOuter" + TrackletConfigBuilder::LayerName(layerdisk) + ".tab";
writeTable();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ TrackletProjectionsMemory::TrackletProjectionsMemory(string name, Settings const
size_t pos = find_nth(name, 0, "_", 1);
assert(pos != string::npos);
initLayerDisk(pos + 1, layer_, disk_);
hasProj_ = false;
}

void TrackletProjectionsMemory::addProj(Tracklet* tracklet) {
Expand All @@ -29,6 +30,7 @@ void TrackletProjectionsMemory::addProj(Tracklet* tracklet) {
assert(itracklet != tracklet);
}

hasProj_ = true;
tracklets_.push_back(tracklet);
}

Expand Down

0 comments on commit 045e4ec

Please sign in to comment.