Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating Stub Format for VMSMERouter Changes #279

Merged
merged 24 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b1e6517
Andrews KF crash fix (#263)
tomalin Mar 23, 2024
3fae98f
Add z0 resolution to performance printout (#264)
tomalin Mar 24, 2024
ee50448
DR: fix displaced track bug & disable binning (#266)
tomalin Mar 28, 2024
db108e7
DUMMY COMMIT BEFORE PR TO CENTRAL CMSSW
tomalin Mar 28, 2024
99ffbb9
Run combined modules by default (#265)
tomalin Mar 29, 2024
f5a8118
Numerical stability fix (#269)
aehart Apr 2, 2024
f4e51ce
Fix inventStubs bug in duplicate removal (#271)
tomalin Apr 8, 2024
ca46e84
Manually incorporating DTC stub, TT stub changes to CMSSW 14 dev branch
mlarson02 May 21, 2024
4758a36
First pass at removing non-combined modules
aryd Dec 27, 2023
c4a8c5d
Removed unused iMath code
aryd Dec 27, 2023
3368d92
Avoid stale pointers on subsequent events
Feb 28, 2024
d46656e
Cleaner MP pointer checks
Feb 28, 2024
8131c53
First code for a ProjectionCalculator module
aryd Jan 26, 2024
4f0e15a
Set of changes to make a configuration that uses the Projection Calcu…
aryd Mar 8, 2024
a9d917f
Fix mistake in code merging
aryd Mar 10, 2024
8d510d2
Changes needed for the VMSME Router module
aryd May 1, 2024
c4fafbb
Fully implementing VMSMERouter, VMRouterCM no longer producing VMMEStubs
mlarson02 May 21, 2024
38c9f38
Manually incorporating DTC stub, TT stub changes to CMSSW 14 dev branch
mlarson02 May 21, 2024
d84665a
Readding TCBase, VMSMER compatible w/ updated stub format
mlarson02 May 21, 2024
874a688
Merge branch 'ProjectionCalculator_without_IMATH_and_noncombined' int…
mlarson02 May 21, 2024
41c3e31
Addressing comments, fixing code format
mlarson02 May 23, 2024
e833919
Removing unneeded diskpswrittenr variable
mlarson02 May 23, 2024
02276dc
Removing unneeded + 1 to rbits in TP
mlarson02 Jun 7, 2024
c52e649
Updates to make sure we don't have missing projections
aryd Jun 11, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTMTT/src/KFbase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ namespace tmtt {
matRinv = TMatrixD(TMatrixD::kInverted, matR);
} else {
// Protection against rare maths instability.
const TMatrixD unitMatrix(TMatrixD::kUnit, TMatrixD(nHelixPar_, nHelixPar_));
const TMatrixD unitMatrix(TMatrixD::kUnit, TMatrixD(2, 2));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to these changes?

const double big = 9.9e9;
matRinv = big * unitMatrix;
}
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
To run the L1 tracking & create a TTree of tracking performance:
To run the L1 tracking & create a TTree of tracking performance:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove extra space


cmsRun L1TrackNtupleMaker_cfg.py

Expand Down
22 changes: 15 additions & 7 deletions L1Trigger/TrackFindingTracklet/interface/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ namespace trklet {
void setTableTEDFile(std::string tableTEDFileName) { tableTEDFile_ = tableTEDFileName; }
void setTableTREFile(std::string tableTREFileName) { tableTREFile_ = tableTREFileName; }

unsigned int nndbitsstub(unsigned int layerdisk) const { return nndbitsstub_[layerdisk]; }
unsigned int nzbitsstub(unsigned int layerdisk) const { return nzbitsstub_[layerdisk]; }
unsigned int nphibitsstub(unsigned int layerdisk) const { return nphibitsstub_[layerdisk]; }
unsigned int nrbitsstub(unsigned int layerdisk) const { return nrbitsstub_[layerdisk]; }
Expand Down Expand Up @@ -170,12 +171,11 @@ namespace trklet {
double rphicut2S(unsigned int iSeed, unsigned int idisk) const { return rphicut2S_[idisk][iSeed]; }
double rcut2S(unsigned int iSeed, unsigned int idisk) const { return rcut2S_[idisk][iSeed]; }


unsigned int irmean(unsigned int iLayer) const { return irmean_[iLayer]; }
double rmean(unsigned int iLayer) const { return irmean_[iLayer] * rmaxdisk_ / 4096; }
double rmax(unsigned int iLayer) const { return rmean(iLayer) + drmax(); }
double rmin(unsigned int iLayer) const { return rmean(iLayer) - drmax(); }
unsigned int izmean(unsigned int iDisk) const { return izmean_[iDisk]; }
unsigned int izmean(unsigned int iDisk) const { return izmean_[iDisk]; }
double zmean(unsigned int iDisk) const { return izmean_[iDisk] * zlength_ / 2048; }
double zmax(unsigned int iDisk) const { return zmean(iDisk) + dzmax(); }
double zmin(unsigned int iDisk) const { return zmean(iDisk) - dzmax(); }
Expand Down Expand Up @@ -344,7 +344,9 @@ namespace trklet {

double kz() const { return 2.0 * zlength_ / (1 << nzbitsstub_[0]); }
double kz(unsigned int layerdisk) const { return 2.0 * zlength_ / (1 << nzbitsstub_[layerdisk]); }
double kr() const { return rmaxdisk_ / (1 << nrbitsstub_[N_LAYER]); }
double kr() const {
return rmaxdisk_ / (1 << (nrbitsstub_[N_LAYER] + 1));
} // + 1 required to offset artificial decrease in # of diskps r bits from 12 -> 11 to make space for negDisk bit
double krbarrel() const { return 2.0 * drmax() / (1 << nrbitsstub_[0]); }

double maxrinv() const { return maxrinv_; }
Expand Down Expand Up @@ -527,9 +529,10 @@ namespace trklet {
std::array<unsigned int, N_LAYER> irmean_{{851, 1269, 1784, 2347, 2936, 3697}};
std::array<unsigned int, N_DISK> izmean_{{2239, 2645, 3163, 3782, 4523}};

std::array<unsigned int, N_LAYER + N_DISK> nndbitsstub_{{0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1}};
std::array<unsigned int, N_LAYER + N_DISK> nzbitsstub_{{12, 12, 12, 8, 8, 8, 7, 7, 7, 7, 7}};
std::array<unsigned int, N_LAYER + N_DISK> nphibitsstub_{{14, 14, 14, 17, 17, 17, 14, 14, 14, 14, 14}};
std::array<unsigned int, N_LAYER + N_DISK> nrbitsstub_{{7, 7, 7, 7, 7, 7, 12, 12, 12, 12, 12}};
std::array<unsigned int, N_LAYER + N_DISK> nrbitsstub_{{7, 7, 7, 7, 7, 7, 11, 11, 11, 11, 11}};

unsigned int nrbitsprojderdisk_{9};
unsigned int nbitsphiprojderL123_{10};
Expand Down Expand Up @@ -1051,18 +1054,23 @@ namespace trklet {
double stripLength_PS_{0.1467};
double stripLength_2S_{5.0250};

// The DR binning below disabled, as doesn't match latest FW.

//Following values are used for duplicate removal
//Rinv bins were optimised to ensure a similar number of tracks in each bin prior to DR
//Rinv bin edges for 6 bins.
std::vector<double> rinvBins_{-rinvcut(), -0.004968, -0.003828, 0, 0.003828, 0.004968, rinvcut()};
//std::vector<double> rinvBins_{-rinvcut(), -0.004968, -0.003828, 0, 0.003828, 0.004968, rinvcut()};
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes related to this updated?

std::vector<double> rinvBins_{-rinvcut(), rinvcut()};
//Phi bin edges for 2 bins.
std::vector<double> phiBins_{0, dphisectorHG() / 2, dphisectorHG()};
//std::vector<double> phiBins_{0, dphisectorHG() / 2, dphisectorHG()};
std::vector<double> phiBins_{0, dphisectorHG()};
//Overlap size for the overlap rinv bins in DR
double rinvOverlapSize_{0.0004};
//Overlap size for the overlap phi bins in DR
double phiOverlapSize_{M_PI / 360};
//The maximum number of tracks that are compared to all the other tracks per rinv bin
int numTracksComparedPerBin_{32};
//int numTracksComparedPerBin_{32};
int numTracksComparedPerBin_{9999};

double sensorSpacing_2S_{0.18};
};
Expand Down
17 changes: 10 additions & 7 deletions L1Trigger/TrackFindingTracklet/interface/Stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ namespace trklet {
return r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + bend_.str();
} else {
if (isPSmodule()) {
return r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + bend_.str();
return negdisk_.str() + "|" + r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + bend_.str();
} else {
return "000" + r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + alpha_.str() + "|" + bend_.str();
return negdisk_.str() + "|" + "00" + r_.str() + "|" + z_.str() + "|" + phi_.str() + "|" + alpha_.str() + "|" +
bend_.str();
}
}
}
Expand All @@ -43,11 +44,7 @@ namespace trklet {
unsigned int nbitsfinephi = 8;
FPGAWord finephi(
phicorr_.bits(phicorr_.nbits() - nbitsfinephi, nbitsfinephi), nbitsfinephi, true, __LINE__, __FILE__);
if (layer_.value() == -1) {
return str() + "|" + negdisk_.str() + "|" + stubindex_.str() + "|" + finephi.str();
} else {
return str() + "|" + stubindex_.str() + "|" + finephi.str();
}
return str() + "|" + stubindex_.str() + "|" + finephi.str();
}

FPGAWord allStubIndex() const { return stubindex_; }
Expand All @@ -62,6 +59,10 @@ namespace trklet {

const FPGAWord& bend() const { return bend_; }

const int rvalue() const {
return (layerdisk_ < N_LAYER) ? r_.value() : (r_.value() > 10) ? r_.value() + (1 << r_offset_bits) : r_.value();
}

const FPGAWord& r() const { return r_; }
const FPGAWord& z() const { return z_; }
const FPGAWord& negdisk() const { return negdisk_; }
Expand Down Expand Up @@ -103,6 +104,8 @@ namespace trklet {

FPGAWord stubindex_;

int r_offset_bits;

L1TStub* l1tstub_;
Settings const& settings_;
};
Expand Down
2 changes: 2 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/Tracklet.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,8 @@ namespace trklet {

unsigned int PSseed() const { return ((layer() == 1) || (layer() == 2) || (disk() != 0)) ? 1 : 0; }

// Seed type:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this added?

// L1L2=0,L2L3=1,L3L4=2,L5L6=3,D1D2=4,D3D4=5,L1D1=6,L2D1=7
unsigned int seedIndex() const { return seedIndex_; }

private:
Expand Down
20 changes: 15 additions & 5 deletions L1Trigger/TrackFindingTracklet/plugins/L1FPGATrackProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ class L1FPGATrackProducer : public edm::one::EDProducer<edm::one::WatchRuns> {
bool readMoreMcTruth_;

/// File path for configuration files
#ifndef USEHYBRID
edm::FileInPath fitPatternFile;
#endif
edm::FileInPath memoryModulesFile;
edm::FileInPath processingModulesFile;
edm::FileInPath wiresFile;
Expand Down Expand Up @@ -255,7 +257,6 @@ L1FPGATrackProducer::L1FPGATrackProducer(edm::ParameterSet const& iConfig)

asciiEventOutName_ = iConfig.getUntrackedParameter<string>("asciiFileName", "");

fitPatternFile = iConfig.getParameter<edm::FileInPath>("fitPatternFile");
processingModulesFile = iConfig.getParameter<edm::FileInPath>("processingModulesFile");
memoryModulesFile = iConfig.getParameter<edm::FileInPath>("memoryModulesFile");
wiresFile = iConfig.getParameter<edm::FileInPath>("wiresFile");
Expand All @@ -282,8 +283,15 @@ L1FPGATrackProducer::L1FPGATrackProducer(edm::ParameterSet const& iConfig)
settings_.setExtended(extended_);
settings_.setReduced(reduced_);
settings_.setNHelixPar(nHelixPar_);
// combined_ must be false for extended tracking, regardless of whether
// combined modules are used or not.
if (extended_)
settings_.setCombined(false);

#ifndef USEHYBRID
fitPatternFile = iConfig.getParameter<edm::FileInPath>("fitPatternFile");
settings_.setFitPatternFile(fitPatternFile.fullPath());
#endif
settings_.setProcessingModulesFile(processingModulesFile.fullPath());
settings_.setMemoryModulesFile(memoryModulesFile.fullPath());
settings_.setWiresFile(wiresFile.fullPath());
Expand All @@ -309,10 +317,12 @@ L1FPGATrackProducer::L1FPGATrackProducer(edm::ParameterSet const& iConfig)
}

if (settings_.debugTracklet()) {
edm::LogVerbatim("Tracklet") << "fit pattern : " << fitPatternFile.fullPath()
<< "\n process modules : " << processingModulesFile.fullPath()
<< "\n memory modules : " << memoryModulesFile.fullPath()
<< "\n wires : " << wiresFile.fullPath();
edm::LogVerbatim("Tracklet")
#ifndef USEHYBRID
<< "fit pattern : " << fitPatternFile.fullPath()
#endif
<< "\n process modules : " << processingModulesFile.fullPath()
<< "\n memory modules : " << memoryModulesFile.fullPath() << "\n wires : " << wiresFile.fullPath();
if (extended_) {
edm::LogVerbatim("Tracklet") << "table_TED : " << tableTEDFile.fullPath()
<< "\n table_TRE : " << tableTREFile.fullPath();
Expand Down
4 changes: 4 additions & 0 deletions L1Trigger/TrackFindingTracklet/python/Customize_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ def reducedConfig(process):
process.l1tTTTracksFromTrackletEmulation.memoryModulesFile = 'L1Trigger/TrackFindingTracklet/data/reduced_memorymodules.dat'
process.l1tTTTracksFromTrackletEmulation.processingModulesFile = 'L1Trigger/TrackFindingTracklet/data/reduced_processingmodules.dat'
process.l1tTTTracksFromTrackletEmulation.wiresFile = 'L1Trigger/TrackFindingTracklet/data/reduced_wires.dat'

# configures pure tracklet algorithm (as opposed to Hybrid algorithm)
def trackletConfig(process):
process.l1tTTTracksFromTrackletEmulation.fitPatternFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/fitpattern.txt')
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@
Extended = cms.bool(False),
Reduced = cms.bool(False),
Hnpar = cms.uint32(4),
# (if running on CRAB use "../../fitpattern.txt" etc instead)
fitPatternFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/fitpattern.txt'),
memoryModulesFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/memorymodules_hourglassExtended.dat'),
processingModulesFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/processingmodules_hourglassExtended.dat'),
wiresFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/wires_hourglassExtended.dat'),
# These 3 files only used for extended or reduced mode.
memoryModulesFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/memorymodules_hourglassExtendedCombined.dat'),
processingModulesFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/processingmodules_hourglassExtendedCombined.dat'),
wiresFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/wires_hourglassExtendedCombined.dat'),
# Quality Flag and Quality params
TrackQuality = cms.bool(True),
TrackQualityPSet = cms.PSet(TrackQualityParams),
Expand All @@ -39,4 +38,4 @@
# Quality Flag and Quality params
TrackQuality = cms.bool(False),
TrackQualityPSet = cms.PSet(TrackQualityParams)
)
)
5 changes: 4 additions & 1 deletion L1Trigger/TrackFindingTracklet/src/FitTrack.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ void FitTrack::trackFitKF(Tracklet* tracklet,
}
}
}
#endif

#else // Code for pure Tracklet algo.

void FitTrack::trackFitChisq(Tracklet* tracklet, std::vector<const Stub*>&, std::vector<std::pair<int, int>>&) {
if (globals_->trackDerTable() == nullptr) {
Expand Down Expand Up @@ -788,6 +789,8 @@ void FitTrack::trackFitChisq(Tracklet* tracklet, std::vector<const Stub*>&, std:
0);
}

#endif

void FitTrack::trackFitFake(Tracklet* tracklet, std::vector<const Stub*>&, std::vector<std::pair<int, int>>&) {
tracklet->setFitPars(tracklet->rinvapprox(),
tracklet->phi0approx(),
Expand Down
12 changes: 9 additions & 3 deletions L1Trigger/TrackFindingTracklet/src/MatchProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,12 @@ void MatchProcessor::execute(unsigned int iSector, double phimin) {
unsigned int countsel = 0;
unsigned int countinputproj = 0;

//for (unsigned int i=0; i<inputprojs_.size(); i++) {
// for (unsigned int p=0; p<inputprojs_[i]->nPage(); p++) {
// std::cout << "ProjOcc: " << inputprojs_[i]->getName() << " " << p << " " << inputprojs_[i]->nTracklets(p) << std::endl;
// }
//}

unsigned int iprojmem = 0;
unsigned int page = 0;
while (iprojmem < inputprojs_.size() && inputprojs_[iprojmem]->nTracklets(page) == 0) {
Expand Down Expand Up @@ -511,7 +517,7 @@ bool MatchProcessor::matchCalculator(Tracklet* tracklet, const Stub* fpgastub, b

if (layerdisk_ < N_LAYER) {
const Projection& proj = tracklet->proj(layerdisk_);
int ir = fpgastub->r().value();
int ir = fpgastub->rvalue();
int iphi = proj.fpgaphiproj().value();
int icorr = (ir * proj.fpgaphiprojder().value()) >> icorrshift_;
iphi += icorr;
Expand Down Expand Up @@ -675,7 +681,7 @@ bool MatchProcessor::matchCalculator(Tracklet* tracklet, const Stub* fpgastub, b

int ideltaphi = fpgastub->phi().value() - iphi;

int irstub = fpgastub->r().value();
int irstub = fpgastub->rvalue();
int ialphafact = 0;
if (!stub->isPSmodule()) {
assert(irstub < (int)N_DSS_MOD * 2);
Expand Down Expand Up @@ -780,7 +786,7 @@ bool MatchProcessor::matchCalculator(Tracklet* tracklet, const Stub* fpgastub, b
}

bool match = (std::abs(drphi) < drphicut) && (std::abs(deltar) < drcut);
bool imatch = (std::abs(ideltaphi * irstub) < best_ideltaphi_disk) && (std::abs(ideltar) < best_ideltar_disk);
bool imatch = (std::abs(ideltaphi * irstub) < idrphicut) && (std::abs(ideltar) < idrcut);

if (settings_.debugTracklet()) {
edm::LogVerbatim("Tracklet") << "imatch match disk: " << imatch << " " << match << " " << std::abs(ideltaphi)
Expand Down
6 changes: 5 additions & 1 deletion L1Trigger/TrackFindingTracklet/src/Projection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ void Projection::init(Settings const& settings,
if (layerdisk < N_LAYER) {
fpgarzproj_.set(irzproj, settings.nzbitsstub(layerdisk), false, __LINE__, __FILE__);
} else {
fpgarzproj_.set(irzproj, settings.nrbitsstub(layerdisk), false, __LINE__, __FILE__);
fpgarzproj_.set(irzproj,
settings.nrbitsstub(layerdisk) + 1,
false,
__LINE__,
__FILE__); // + 1 to account for artificially reduced nrbits from r value offset for diskps stubs
}

if (layerdisk < N_LAYER) {
Expand Down
Loading