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

Reduced configuration #87

Merged
merged 18 commits into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
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
8 changes: 6 additions & 2 deletions L1Trigger/TrackFindingTracklet/interface/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ namespace trklet {
void setExtended(bool extended) { extended_ = extended; }
bool combined() const { return combined_; }
void setCombined(bool combined) { combined_ = combined; }
bool reduced() const { return reduced_; }
void setReduced(bool reduced) { reduced_ = reduced; }

double bfield() const { return bfield_; }
void setBfield(double bfield) { bfield_ = bfield; }
Expand Down Expand Up @@ -751,7 +753,8 @@ namespace trklet {
unsigned int maxstepoffset_{0};

//Number of processing steps for one event (108=18TM*240MHz/40MHz)
std::unordered_map<std::string, unsigned int> maxstep_{{"IR", 156}, //IR will run at a higher clock speed to handle
//IR should be set to 108 to match the FW for the summer chain, but ultimately should be at 156
std::unordered_map<std::string, unsigned int> maxstep_{{"IR", 108}, //IR will run at a higher clock speed to handle
tomalin marked this conversation as resolved.
Show resolved Hide resolved
//input links running at 25 Gbits/s
{"VMR", 108},
{"TE", 107},
Expand Down Expand Up @@ -882,14 +885,15 @@ namespace trklet {
// This is a temporary fix for compatibilty with HLS. We will need to implement multiple match
// printing in emulator eventually, possibly after CMSSW-integration inspired rewrites
// Use false when generating HLS files, use true when doing full hybrid tracking
bool doMultipleMatches_{true};
bool doMultipleMatches_{false};
tomalin marked this conversation as resolved.
Show resolved Hide resolved

// if true, run a dummy fit, producing TTracks directly from output of tracklet pattern reco stage
bool fakefit_{false};

unsigned int nHelixPar_{4}; // 4 or 5 param helix fit
bool extended_{false}; // turn on displaced tracking
bool combined_{false}; // use combined TP (TE+TC) and MP (PR+ME+MC) configuration
bool reduced_{false}; // use reduced (Summer Chain) config
tomalin marked this conversation as resolved.
Show resolved Hide resolved

std::string skimfile_{""}; //if not empty events will be written out in ascii format to this file

Expand Down
3 changes: 3 additions & 0 deletions L1Trigger/TrackFindingTracklet/plugins/L1FPGATrackProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class L1FPGATrackProducer : public edm::one::EDProducer<edm::one::WatchRuns> {

unsigned int nHelixPar_;
bool extended_;
bool reduced_;

bool trackQuality_;
std::unique_ptr<TrackQuality> trackQualityModel_;
Expand Down Expand Up @@ -224,6 +225,7 @@ L1FPGATrackProducer::L1FPGATrackProducer(edm::ParameterSet const& iConfig)
wiresFile = iConfig.getParameter<edm::FileInPath>("wiresFile");

extended_ = iConfig.getParameter<bool>("Extended");
reduced_ = iConfig.getParameter<bool>("Reduced");
nHelixPar_ = iConfig.getParameter<unsigned int>("Hnpar");

if (extended_) {
Expand All @@ -239,6 +241,7 @@ L1FPGATrackProducer::L1FPGATrackProducer(edm::ParameterSet const& iConfig)
// --------------------------------------------------------------------------------

settings.setExtended(extended_);
settings.setReduced(reduced_);
settings.setNHelixPar(nHelixPar_);

settings.setFitPatternFile(fitPatternFile.fullPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@
L1HybridTracks = cms.Sequence(offlineBeamSpot*TTTracksFromTrackletEmulation)
L1HybridTracksWithAssociators = cms.Sequence(offlineBeamSpot*TTTracksFromTrackletEmulation*TrackTriggerAssociatorTracks)

# extended hybrid emulation
# extended hybrid (=displaced tracking) emulation
TTTrackAssociatorFromPixelDigisExtended = TTTrackAssociatorFromPixelDigis.clone(
TTTracks = cms.VInputTag(cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks") )
)

L1ExtendedHybridTracks = cms.Sequence(offlineBeamSpot*TTTracksFromExtendedTrackletEmulation)
L1ExtendedHybridTracksWithAssociators = cms.Sequence(offlineBeamSpot*TTTracksFromExtendedTrackletEmulation*TTTrackAssociatorFromPixelDigisExtended)

# both (prompt + extended) hybrid emulation
# both (prompt + extended) hybrid emulation
L1PromptExtendedHybridTracks = cms.Sequence(offlineBeamSpot*TTTracksFromTrackletEmulation*TTTracksFromExtendedTrackletEmulation)
L1PromptExtendedHybridTracksWithAssociators = cms.Sequence(offlineBeamSpot*TTTracksFromTrackletEmulation*TrackTriggerAssociatorTracks*TTTracksFromExtendedTrackletEmulation*TTTrackAssociatorFromPixelDigisExtended)

# reduced hybrid (=summer chain) emuluation
TTTrackAssociatorFromPixelDigisReduced = TTTrackAssociatorFromPixelDigis.clone(
TTTracks = cms.VInputTag(cms.InputTag("TTTracksFromReducedTrackletEmulation", "Level1TTTracks") )
)
L1ReducedHybridTracks = cms.Sequence(offlineBeamSpot*TTTracksFromReducedTrackletEmulation)
L1ReducedHybridTracksWithAssociators = cms.Sequence(offlineBeamSpot*TTTracksFromReducedTrackletEmulation*TTTrackAssociatorFromPixelDigisReduced)

11 changes: 10 additions & 1 deletion L1Trigger/TrackFindingTracklet/python/Tracklet_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@

TTTracksFromTrackletEmulation = cms.EDProducer("L1FPGATrackProducer",
TTStubSource = cms.InputTag("TTStubsFromPhase2TrackerDigis","StubAccepted"),
InputTagTTDTC = cms.InputTag("TrackerDTCProducer", "StubAccepted"),
InputTagTTDTC = cms.InputTag("TrackerDTCProducer", "StubAccepted"),
readMoreMcTruth = cms.bool(True),
MCTruthClusterInputTag = cms.InputTag("TTClusterAssociatorFromPixelDigis", "ClusterAccepted"),
MCTruthStubInputTag = cms.InputTag("TTStubAssociatorFromPixelDigis", "StubAccepted"),
TrackingParticleInputTag = cms.InputTag("mix", "MergedTrackTruth"),
BeamSpotSource = cms.InputTag("offlineBeamSpot"),
asciiFileName = cms.untracked.string(""),
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'),
Expand All @@ -24,6 +25,7 @@

TTTracksFromExtendedTrackletEmulation = TTTracksFromTrackletEmulation.clone(
Extended = cms.bool(True),
Reduced = cms.bool(False),
Hnpar = cms.uint32(5),
# specifying where the TrackletEngineDisplaced(TED)/TripletEngine(TRE) tables are located
tableTEDFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/table_TED/table_TED_D1PHIA1_D2PHIA1.txt'),
Expand All @@ -32,4 +34,11 @@
TrackQuality = cms.bool(False),
TrackQualityPSet = cms.PSet(TrackQualityParams)
)
TTTracksFromReducedTrackletEmulation = TTTracksFromTrackletEmulation.clone(
tomalin marked this conversation as resolved.
Show resolved Hide resolved
Reduced = cms.bool(True),
# specifying where the reduced configuration files are
memoryModulesFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/reduced_memorymodules.dat'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

How will you make files data/reduced*.dat available? Will you put them in a fork of https://github.com/cms-data/L1Trigger-TrackTrigger.git ? N.B. They can go in our development branch, but should never go into central CMSSW, since the summer chain is temporary.

Copy link
Author

Choose a reason for hiding this comment

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

See the PR in the initial comment:
cms-L1TK/L1Trigger-TrackFindingTracklet#1

processingModulesFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/reduced_processingmodules.dat'),
wiresFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/reduced_wires.dat'),
)

1 change: 1 addition & 0 deletions L1Trigger/TrackFindingTracklet/src/InputLinkMemory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ void InputLinkMemory::writeStubs(bool first, unsigned int iSector) {

for (unsigned int j = 0; j < stubs_.size(); j++) {
string stub = stubs_[j]->str();
out_ << "0x";
out_ << std::setfill('0') << std::setw(2);
out_ << hex << j << dec;
out_ << " " << stub << " " << trklet::hexFormat(stub) << endl;
Expand Down
3 changes: 2 additions & 1 deletion L1Trigger/TrackFindingTracklet/src/InputRouter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void InputRouter::execute() {
iadd++;
}
}
assert(iadd == 1);
if (!(settings_.reduced()))
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the comment at L69 is wrong. Surely the InputRouter writes to the InputLinkMemory, not the AllStubs memories? And why is L77 required. In your reduced chain, do some InputRouter write to no output memories? This would seem odd.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@trholmes any answer to this comment?

assert(iadd == 1);
}
}
3 changes: 2 additions & 1 deletion L1Trigger/TrackFindingTracklet/src/Sector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ bool Sector::addStub(L1TStub stub, string dtc) {
nadd++;
}

assert(nadd == 1);
if (!(settings_.reduced()))
assert(nadd == 1);

return true;
}
Expand Down
1 change: 1 addition & 0 deletions L1Trigger/TrackFindingTracklet/src/TrackletEngine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ void TrackletEngine::execute() {
if (settings_.debugTracklet())
edm::LogVerbatim("Tracklet") << "Adding stub pair in " << getName();

assert(stubpairs_ != nullptr);
stubpairs_->addStubPair(innervmstub, outervmstub);
countpass++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void TrackletEventProcessor::init(Settings const& theSettings) {

sector_ = make_unique<Sector>(*settings_, globals_.get());

if (settings_->extended()) {
if (settings_->extended() || settings_->reduced()) {
ifstream inmem(settings_->memoryModulesFile().c_str());
assert(inmem.good());

Expand Down
12 changes: 7 additions & 5 deletions L1Trigger/TrackFindingTracklet/src/VMRouter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,16 @@ void VMRouter::execute() {
FPGAWord(stub->bend().value(), nbendbits, true, __LINE__, __FILE__),
allStubIndex);

assert(vmstubsMEPHI_[ivmPlus] != nullptr);
vmstubsMEPHI_[ivmPlus]->addStub(vmstub, vmbin);
if (!(settings_.reduced()))
assert(vmstubsMEPHI_[ivmPlus] != nullptr);
if (vmstubsMEPHI_[ivmPlus] != nullptr)
vmstubsMEPHI_[ivmPlus]->addStub(vmstub, vmbin);
if (settings_.debugTracklet()) {
edm::LogVerbatim("Tracklet") << getName() << " adding stub to " << vmstubsMEPHI_[ivmPlus]->getName()
<< " ivmPlus" << ivmPlus << " bin=" << vmbin;
}

if (ivmMinus != ivmPlus) {
assert(vmstubsMEPHI_[ivmMinus] != nullptr);
if (ivmMinus != ivmPlus && vmstubsMEPHI_[ivmMinus] != nullptr) {
vmstubsMEPHI_[ivmMinus]->addStub(vmstub, vmbin);
if (settings_.debugTracklet()) {
edm::LogVerbatim("Tracklet") << getName() << " adding stub to " << vmstubsMEPHI_[ivmMinus]->getName()
Expand Down Expand Up @@ -363,7 +364,8 @@ void VMRouter::execute() {

unsigned int nmem = ivmstubTEPHI.vmstubmem[ivmte].size();

assert(nmem > 0);
if (!(settings_.reduced()))
assert(nmem > 0);

for (unsigned int l = 0; l < nmem; l++) {
if (settings_.debugTracklet()) {
Expand Down
42 changes: 27 additions & 15 deletions L1Trigger/TrackFindingTracklet/test/L1TrackNtupleMaker_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
############################################################

GEOMETRY = "D76"
# Set L1 tracking algorithm:
# 'HYBRID' (baseline, 4par fit) or 'HYBRID_DISPLACED' (extended, 5par fit).
# Set L1 tracking algorithm:
# 'HYBRID' (baseline, 4par fit) or 'HYBRID_DISPLACED' (extended, 5par fit).
# 'HYBRID_REDUCED' to use the "Summer Chain" configuration with reduced inputs
# (Or legacy algos 'TMTT' or 'TRACKLET').
L1TRKALGO = 'HYBRID'
L1TRKALGO = 'HYBRID'

WRITE_DATA = False

Expand All @@ -31,11 +32,11 @@
process.MessageLogger.L1track = dict(limit = -1)
process.MessageLogger.Tracklet = dict(limit = -1)

if GEOMETRY == "D49":
if GEOMETRY == "D49":
print("using geometry " + GEOMETRY + " (tilted)")
process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D49_cff')
elif GEOMETRY == "D76":
elif GEOMETRY == "D76":
print("using geometry " + GEOMETRY + " (tilted)")
process.load('Configuration.Geometry.GeometryExtended2026D76Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D76_cff')
Expand Down Expand Up @@ -83,8 +84,10 @@
else:

print("this is not a valid geometry!!!")

process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(*inputMC))
# Use skipEvents to select particular single events for test vectors
#process.source = cms.Source("PoolSource", fileNames = cms.untracked.vstring(*inputMC), skipEvents = cms.untracked.uint32(11))

process.TFileService = cms.Service("TFileService", fileName = cms.string('TTbar_PU200_'+GEOMETRY+'.root'), closeFileFast = cms.untracked.bool(True))
process.Timing = cms.Service("Timing", summaryOnly = cms.untracked.bool(True))
Expand All @@ -96,15 +99,15 @@

process.load('L1Trigger.TrackTrigger.TrackTrigger_cff')

# remake stubs?
# remake stubs?
#from L1Trigger.TrackTrigger.TTStubAlgorithmRegister_cfi import *
#process.load("SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff")

#from SimTracker.TrackTriggerAssociation.TTClusterAssociation_cfi import *
#TTClusterAssociatorFromPixelDigis.digiSimLinks = cms.InputTag("simSiPixelDigis","Tracker")

#process.TTClusterStub = cms.Path(process.TrackTriggerClustersStubs)
#process.TTClusterStubTruth = cms.Path(process.TrackTriggerAssociatorClustersStubs)
#process.TTClusterStubTruth = cms.Path(process.TrackTriggerAssociatorClustersStubs)


# DTC emulation
Expand Down Expand Up @@ -144,8 +147,17 @@
L1TRK_NAME = "TTTracksFromExtendedTrackletEmulation"
L1TRK_LABEL = "Level1TTTracks"
L1TRUTH_NAME = "TTTrackAssociatorFromPixelDigisExtended"

# LEGACY ALGORITHM (EXPERTS ONLY): TRACKLET

# HYBRID: prompt tracking, reduced chain
elif (L1TRKALGO == 'HYBRID_REDUCED'):
process.TTTracksEmulation = cms.Path(process.L1ReducedHybridTracks)
process.TTTracksEmulationWithTruth = cms.Path(process.L1ReducedHybridTracksWithAssociators)
NHELIXPAR = 4
L1TRK_NAME = "TTTracksFromReducedTrackletEmulation"
L1TRK_LABEL = "Level1TTTracks"
L1TRUTH_NAME = "TTTrackAssociatorFromPixelDigisReduced"

# LEGACY ALGORITHM (EXPERTS ONLY): TRACKLET
elif (L1TRKALGO == 'TRACKLET'):
print("\n WARNING: This is not the baseline algorithm! Prefer HYBRID or HYBRID_DISPLACED!")
print("\n To run the Tracklet-only algorithm, ensure you have commented out 'CXXFLAGS=-DUSEHYBRID' in BuildFile.xml & recompiled! \n")
Expand All @@ -156,7 +168,7 @@
L1TRK_LABEL = "Level1TTTracks"
L1TRUTH_NAME = "TTTrackAssociatorFromPixelDigis"

# LEGACY ALGORITHM (EXPERTS ONLY): TMTT
# LEGACY ALGORITHM (EXPERTS ONLY): TMTT
elif (L1TRKALGO == 'TMTT'):
print("\n WARNING: This is not the baseline algorithm! Prefer HYBRID or HYBRID_DISPLACED! \n")
process.load("L1Trigger.TrackFindingTMTT.TMTrackProducer_Ultimate_cff")
Expand All @@ -182,7 +194,7 @@
# Define the track ntuple process, MyProcess is the (unsigned) PDGID corresponding to the process which is run
# e.g. single electron/positron = 11
# single pion+/pion- = 211
# single muon+/muon- = 13
# single muon+/muon- = 13
# pions in jets = 6
# taus = 15
# all TPs = 1
Expand All @@ -201,7 +213,7 @@
TP_maxEta = cms.double(2.5), # only save TPs with |eta| < X
TP_maxZ0 = cms.double(30.0), # only save TPs with |z0| < X cm
L1TrackInputTag = cms.InputTag(L1TRK_NAME, L1TRK_LABEL), # TTTrack input
MCTruthTrackInputTag = cms.InputTag(L1TRUTH_NAME, L1TRK_LABEL), # MCTruth input
MCTruthTrackInputTag = cms.InputTag(L1TRUTH_NAME, L1TRK_LABEL), # MCTruth input
# other input collections
L1StubInputTag = cms.InputTag("TTStubsFromPhase2TrackerDigis","StubAccepted"),
MCTruthClusterInputTag = cms.InputTag("TTClusterAssociatorFromPixelDigis", "ClusterAccepted"),
Expand All @@ -223,7 +235,7 @@
# use this if you want to re-run the stub making
# process.schedule = cms.Schedule(process.TTClusterStub,process.TTClusterStubTruth,process.dtc,process.TTTracksEmulationWithTruth,process.ana)

# use this if cluster/stub associators not available
# use this if cluster/stub associators not available
# process.schedule = cms.Schedule(process.TTClusterStubTruth,process.dtc,process.TTTracksEmulationWithTruth,process.ana)

# use this to only run tracking + track associator
Expand All @@ -250,4 +262,4 @@

process.pd = cms.EndPath(process.writeDataset)
process.schedule.append(process.pd)