Skip to content

Commit

Permalink
Reduced configuration (cms-sw#87)
Browse files Browse the repository at this point in the history
* Modified code to support a reduced config (the summer chain)

* Updates from running code checker.

* Reverted to standard configuration options.

* Reverted to standard configuration options.

* Settings used to make TV for event 1912

* Reverted to default settings for PR.

* Made some of the TV changes in issue 85, and created output TVs 2021-08-04-TTbar-SimpleFWHarmonization.

* Clarified comments

* Include commit from fw_synch_210611 (cms-sw#86)

* Fixes to remove unused TPROJ memory and fix problem with VMR LUT in L6

* apply code-formats and code-checks

Co-authored-by: Anders <[email protected]>

* Returning to standard config.

* Returning to standard config.

* Returning to standard config.

* Update geometry and MC files (cms-sw#91)

* Included reduced variable in non-reduced setups for consistency.

* Updated settings to match default configuration rather than HLS compatibility

* Added comment about reduced config files

Co-authored-by: Tova Holmes <[email protected]>
Co-authored-by: Louise Skinnari <[email protected]>
Co-authored-by: Anders <[email protected]>
Co-authored-by: Ian Tomalin <[email protected]>
  • Loading branch information
5 people committed Jun 10, 2022
1 parent 7a31481 commit 8b12ba0
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 26 deletions.
4 changes: 4 additions & 0 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,6 +753,7 @@ namespace trklet {
unsigned int maxstepoffset_{0};

//Number of processing steps for one event (108=18TM*240MHz/40MHz)
//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", 156}, //IR will run at a higher clock speed to handle
//input links running at 25 Gbits/s
{"VMR", 108},
Expand Down Expand Up @@ -890,6 +893,7 @@ namespace trklet {
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

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 @@ -165,6 +165,7 @@ class L1FPGATrackProducer : public edm::one::EDProducer<edm::one::WatchRuns> {

unsigned int nHelixPar_;
bool extended_;
bool reduced_;

bool trackQuality_;
std::unique_ptr<L1TrackQuality> trackQualityModel_;
Expand Down Expand Up @@ -231,6 +232,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 @@ -247,6 +249,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 @@ -14,15 +14,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)

13 changes: 12 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,13 @@
TrackQuality = cms.bool(False),
TrackQualityPSet = cms.PSet(TrackQualityParams)
)
# The included files correspond to the reduced "Summer Chain" configuration
# These files can be modified to emulate any other reduced configuration
TTTracksFromReducedTrackletEmulation = TTTracksFromTrackletEmulation.clone(
Reduced = cms.bool(True),
# specifying where the reduced configuration files are
memoryModulesFile = cms.FileInPath('L1Trigger/TrackFindingTracklet/data/reduced_memorymodules.dat'),
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()))
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 @@ -32,11 +33,11 @@
process.MessageLogger.Tracklet = dict(limit = -1)
process.MessageLogger.TrackTriggerHPH = 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 @@ -84,8 +85,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 @@ -97,15 +100,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 @@ -145,8 +148,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 @@ -157,7 +169,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 @@ -183,7 +195,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 @@ -202,7 +214,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 @@ -224,7 +236,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 @@ -251,4 +263,4 @@

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

0 comments on commit 8b12ba0

Please sign in to comment.