Skip to content

Commit

Permalink
Merge pull request #45117 from SegmentLinking/CMSSW_14_1_0_pre3_LST_X…
Browse files Browse the repository at this point in the history
…_LSTCore_realfiles

CMSSW Integration of LST
  • Loading branch information
cmsbuild authored Nov 19, 2024
2 parents 1b383b0 + 04a1165 commit 48600da
Show file tree
Hide file tree
Showing 146 changed files with 42,757 additions and 5 deletions.
4 changes: 4 additions & 0 deletions Configuration/ProcessModifiers/python/trackingIters01_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets the iterative tracking to use a minimal set of iterations, first two
trackingIters01 = cms.Modifier()
5 changes: 5 additions & 0 deletions Configuration/ProcessModifiers/python/trackingLST_cff.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import FWCore.ParameterSet.Config as cms

# This modifier sets the LST (Phase-2 line segment tracking) used for track building
trackingLST = cms.Modifier()

2 changes: 2 additions & 0 deletions Configuration/PyReleaseValidation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ The offsets currently in use are:
* 0.7: trackingMkFit modifier
* 0.701: DisplacedRegionalStep tracking iteration for Run-3
* 0.702: trackingMkFit modifier for Phase-2 (initialStep only)
* 0.703: LST tracking (Phase-2 only), initialStep+HighPtTripletStep only, on CPU
* 0.704: LST tracking (Phase-2 only), initialStep+HighPtTripletStep only, on GPU
* 0.75: HLT phase-2 timing menu
* 0.751: HLT phase-2 timing menu Alpaka variant
* 0.752: HLT phase-2 timing menu ticl_v5 variant
Expand Down
3 changes: 3 additions & 0 deletions Configuration/PyReleaseValidation/python/relval_Run4.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
numWFIB.extend([31234.0]) #Run4D114
numWFIB.extend([32034.0]) #Run4D115

# Temporary placement for LST workflow to workaround PR conflicts - to be formatted and placed in an upcoming PR
numWFIB.extend([24834.703]) #Run4D98 LST tracking (initialStep+HighPtTripletStep only)

#Additional sample for short matrix and IB
#Default Phase-2 Det NoPU
numWFIB.extend([prefixDet+34.911]) #DD4hep XML
Expand Down
2 changes: 2 additions & 0 deletions Configuration/PyReleaseValidation/python/relval_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
# Run4, Alpaka-based noPU
29634.402, 29634.403, 29634.404, 29634.406,
29661.402,
# Run4, Alpaka-based noPU GPU LST tracking D98
24834.704,

# Run4, Alpaka-based PU
29834.402, 29834.403, 29834.404
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,56 @@ def condition_(self, fragment, stepList, key, hasHarvest):
'--procModifiers': 'trackingMkFitCommon,trackingMkFitInitialStep'
}

# LST on CPU, initialStep+highPtTripletStep-only tracking-only
class UpgradeWorkflow_lstOnCPUIters01TrackingOnly(UpgradeWorkflowTracking):
def setup__(self, step, stepName, stepDict, k, properties):
if 'Reco' in step: stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
elif 'HARVEST' in step: stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@trackingOnlyValidation+@trackingOnlyDQM'}, stepDict[step][k]])
elif 'ALCA' in step: stepDict[stepName][k] = None
def condition_(self, fragment, stepList, key, hasHarvest):
return ('Run4' in key)
upgradeWFs['lstOnCPUIters01TrackingOnly'] = UpgradeWorkflow_lstOnCPUIters01TrackingOnly(
steps = [
'RecoGlobal',
'HARVESTGlobal',
# Add ALCA steps explicitly, so that they can be properly removed
'ALCA',
'ALCAPhase2'
],
PU = [],
suffix = '_lstOnCPUIters01TrackingOnly',
offset = 0.703,
)
upgradeWFs['lstOnCPUIters01TrackingOnly'].step3 = upgradeWFs['trackingOnly'].step3 | {
'--procModifiers': 'trackingIters01,trackingLST',
'--accelerators' : 'cpu'
}

# LST on GPU, initialStep+highPtTripletStep-only tracking-only
class UpgradeWorkflow_lstOnGPUIters01TrackingOnly(UpgradeWorkflowTracking):
def setup__(self, step, stepName, stepDict, k, properties):
if 'Reco' in step: stepDict[stepName][k] = merge([self.step3, stepDict[step][k]])
elif 'HARVEST' in step: stepDict[stepName][k] = merge([{'-s': 'HARVESTING:@trackingOnlyValidation+@trackingOnlyDQM'}, stepDict[step][k]])
elif 'ALCA' in step: stepDict[stepName][k] = None
def condition_(self, fragment, stepList, key, hasHarvest):
return ('Run4' in key)
upgradeWFs['lstOnGPUIters01TrackingOnly'] = UpgradeWorkflow_lstOnGPUIters01TrackingOnly(
steps = [
'RecoGlobal',
'HARVESTGlobal',
# Add ALCA steps explicitly, so that they can be properly removed
'ALCA',
'ALCAPhase2'
],
PU = [],
suffix = '_lstOnGPUIters01TrackingOnly',
offset = 0.704,
)
upgradeWFs['lstOnGPUIters01TrackingOnly'].step3 = upgradeWFs['trackingOnly'].step3 | {
'--procModifiers': 'trackingIters01,trackingLST',
'--accelerators' : 'gpu-*'
}

#DeepCore seeding for JetCore iteration workflow
class UpgradeWorkflow_seedingDeepCore(UpgradeWorkflow):
def setup_(self, step, stepName, stepDict, k, properties):
Expand Down
10 changes: 10 additions & 0 deletions RecoTracker/ConversionSeedGenerators/python/ConversionStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,16 @@
oldClusterRemovalInfo = 'detachedQuadStepClusters',
overrideTrkQuals = 'detachedQuadStepSelector:detachedQuadStepTrk'
))
from Configuration.ProcessModifiers.trackingIters01_cff import trackingIters01
trackingIters01.toModify(convClusters,
trajectories = "highPtTripletStepTracks",
oldClusterRemovalInfo = "highPtTripletStepClusters",
overrideTrkQuals = "highPtTripletStepSelector:highPtTripletStep"
)
from Configuration.ProcessModifiers.trackingLST_cff import trackingLST
(trackingIters01 & trackingPhase2PU140 & trackingLST).toModify(convClusters,
overrideTrkQuals = ""
)

_convLayerPairsStripOnlyLayers = ['TIB1+TID1_pos',
'TIB1+TID1_neg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
ttrhBuilderName = "WithAngleAndTemplate",
chi2EstimatorName = "duplicateTrackCandidatesChi2Est"
)
from Configuration.ProcessModifiers.trackingIters01_cff import trackingIters01
trackingIters01.toModify(duplicateTrackCandidates, source = "earlyGeneralTracks")

import RecoTracker.TrackProducer.TrackProducer_cfi
mergedDuplicateTracks = RecoTracker.TrackProducer.TrackProducer_cfi.TrackProducer.clone(
Expand Down Expand Up @@ -44,6 +46,10 @@
candidateSource = "duplicateTrackCandidates:candidates",
candidateComponents = "duplicateTrackCandidates:candidateMap"
)
trackingIters01.toModify(generalTracks,
originalSource = "earlyGeneralTracks",
originalMVAVals = "earlyGeneralTracks:MVAValues"
)

generalTracksTask = cms.Task(
duplicateTrackCandidates,
Expand Down
20 changes: 20 additions & 0 deletions RecoTracker/FinalTrackSelectors/python/earlyGeneralTracks_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,16 @@ def _extend_displacedGeneral(x):
makeReKeyedSeeds = cms.untracked.bool(False)
)
)
from Configuration.ProcessModifiers.trackingIters01_cff import trackingIters01
trackingIters01.toModify(earlyGeneralTracks,
TrackProducers = ['initialStepTracks', 'highPtTripletStepTracks'],
hasSelector = [1,1],
indivShareFrac = [1,0.16],
selectedTrackQuals = ['initialStepSelector:initialStep',
'highPtTripletStepSelector:highPtTripletStep'
],
setsToMerge = {0: dict(tLists = [0,1])}
)
from Configuration.ProcessModifiers.vectorHits_cff import vectorHits
def _extend_pixelLess(x):
x.TrackProducers += ['pixelLessStepTracks']
Expand All @@ -118,3 +128,13 @@ def _extend_pixelLess(x):
x.setsToMerge[0].tLists += [6]
(trackingPhase2PU140 & vectorHits).toModify(earlyGeneralTracks, _extend_pixelLess)

from Configuration.ProcessModifiers.trackingLST_cff import trackingLST
(trackingPhase2PU140 & trackingLST).toModify(earlyGeneralTracks,
TrackProducers = ['highPtTripletStepLSTpTracks', 'highPtTripletStepLSTT5Tracks'],
hasSelector = [1,0],
indivShareFrac = [0.1,0.1],
selectedTrackQuals = ['highPtTripletStepSelector:highPtTripletStep',
'highPtTripletStepSelectorLSTT5:highPtTripletStepLSTT5'
],
setsToMerge = {0: dict(tLists = [0,1])}
)
56 changes: 56 additions & 0 deletions RecoTracker/IterativeTracking/python/HighPtTripletStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@
phase2clustersToSkip = 'highPtTripletStepClusters'
)

from Configuration.ProcessModifiers.trackingLST_cff import trackingLST
from RecoTracker.LST.lstOutputConverter_cfi import lstOutputConverter as _lstOutputConverter
(trackingPhase2PU140 & trackingLST).toReplaceWith(highPtTripletStepTrackCandidates, _lstOutputConverter.clone())

#For FastSim phase1 tracking
import FastSimulation.Tracking.TrackCandidateProducer_cfi
_fastSim_highPtTripletStepTrackCandidates = FastSimulation.Tracking.TrackCandidateProducer_cfi.trackCandidateProducer.clone(
Expand All @@ -280,6 +284,25 @@
from Configuration.Eras.Modifier_phase2_timing_layer_cff import phase2_timing_layer
phase2_timing_layer.toModify(highPtTripletStepTracks, TrajectoryInEvent = True)

highPtTripletStepLSTpTracks = highPtTripletStepTracks.clone(
src = 'highPtTripletStepTrackCandidates:pTCsLST'
)
highPtTripletStepLSTT5Tracks = highPtTripletStepTracks.clone(
src = 'highPtTripletStepTrackCandidates:t5TCsLST'
)
_highPtTripletStepTracks_LST = RecoTracker.FinalTrackSelectors.trackListMerger_cfi.trackListMerger.clone(
TrackProducers = ['highPtTripletStepLSTpTracks',
'highPtTripletStepLSTT5Tracks'],
hasSelector = [1,0],
indivShareFrac = [0.1,0.1],
selectedTrackQuals = ['highPtTripletStepSelector:highPtTripletStep',
'highPtTripletStepSelectorLSTT5:highPtTripletStepLSTT5'],
copyExtras = True,
copyMVA = False,
setsToMerge = [cms.PSet( tLists=cms.vint32(0,1), pQual=cms.bool(True) )]
)
(trackingPhase2PU140 & trackingLST).toReplaceWith(highPtTripletStepTracks, _highPtTripletStepTracks_LST)

# Final selection
from RecoTracker.FinalTrackSelectors.TrackMVAClassifierPrompt_cfi import *
highPtTripletStep = TrackMVAClassifierPrompt.clone(
Expand Down Expand Up @@ -357,6 +380,28 @@
from Configuration.ProcessModifiers.vectorHits_cff import vectorHits
vectorHits.toModify(highPtTripletStepSelector.trackSelectors[2], minNumberLayers = 3, minNumber3DLayers = 3, d0_par1 = ( 0.5, 4.0 ), dz_par1 = ( 0.6, 4.0 ))

(trackingPhase2PU140 & trackingLST).toModify(highPtTripletStepSelector, src = 'highPtTripletStepLSTpTracks')
# Passthrough selector to satisfy the TrackListMerger requirement for selector values
highPtTripletStepSelectorLSTT5 = RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.multiTrackSelector.clone(
src = 'highPtTripletStepLSTT5Tracks',
trackSelectors = [
RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.looseMTS.clone(
name = 'highPtTripletStepLSTT5Loose',
minHitsToBypassChecks = 0
), #end of pset
RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.tightMTS.clone(
name = 'highPtTripletStepLSTT5Tight',
preFilterName = 'highPtTripletStepLSTT5Loose',
minHitsToBypassChecks = 0
),
RecoTracker.FinalTrackSelectors.multiTrackSelector_cfi.highpurityMTS.clone(
name = 'highPtTripletStepLSTT5',
preFilterName = 'highPtTripletStepLSTT5Tight',
minHitsToBypassChecks = 0
),
] #end of vpset
) #end of clone

# Final sequence
HighPtTripletStepTask = cms.Task(highPtTripletStepClusters,
highPtTripletStepSeedLayers,
Expand All @@ -378,6 +423,17 @@
_HighPtTripletStep_Phase2PU140 = cms.Sequence(_HighPtTripletStepTask_Phase2PU140)
trackingPhase2PU140.toReplaceWith(HighPtTripletStepTask, _HighPtTripletStepTask_Phase2PU140)

_HighPtTripletStepTask_LST = HighPtTripletStepTask.copy()
from RecoLocalTracker.Phase2TrackerRecHits.Phase2TrackerRecHits_cfi import siPhase2RecHits
from RecoTracker.LST.lstSeedTracks_cff import lstInitialStepSeedTracks,lstHighPtTripletStepSeedTracks
from RecoTracker.LST.lstPixelSeedInputProducer_cfi import lstPixelSeedInputProducer
from RecoTracker.LST.lstPhase2OTHitsInputProducer_cfi import lstPhase2OTHitsInputProducer
from RecoTracker.LST.lstProducerTask_cff import *

_HighPtTripletStepTask_LST.add(siPhase2RecHits, lstInitialStepSeedTracks, lstHighPtTripletStepSeedTracks, lstPixelSeedInputProducer, lstPhase2OTHitsInputProducer,
lstProducerTask, highPtTripletStepLSTpTracks, highPtTripletStepLSTT5Tracks, highPtTripletStepSelectorLSTT5)
(trackingPhase2PU140 & trackingLST).toReplaceWith(HighPtTripletStepTask, _HighPtTripletStepTask_LST)

# fast tracking mask producer
from FastSimulation.Tracking.FastTrackerRecHitMaskProducer_cfi import maskProducerFromClusterRemover
highPtTripletStepMasks = maskProducerFromClusterRemover(highPtTripletStepClusters)
Expand Down
3 changes: 3 additions & 0 deletions RecoTracker/IterativeTracking/python/LowPtQuadStep_cff.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
for _eraName, _postfix, _era in _cfg.nonDefaultEras():
_era.toReplaceWith(lowPtQuadStepClusters, _cfg.clusterRemoverForIter('LowPtQuadStep', _eraName, _postfix))

from Configuration.ProcessModifiers.trackingLST_cff import trackingLST
# with LST, this is the first iteration with proper cluster masking
trackingLST.toModify(lowPtQuadStepClusters, oldClusterRemovalInfo = "")

# SEEDING LAYERS
import RecoTracker.TkSeedingLayers.PixelLayerQuadruplets_cfi
Expand Down
17 changes: 12 additions & 5 deletions RecoTracker/IterativeTracking/python/iterativeTkConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,20 @@

_iterations_trackingPhase1.append('JetCoreRegionalStep')

_iterations_trackingPhase2PU140 = [
_iterations_trackingPhase2PU140_VS = cms.PSet(names = cms.vstring(
"InitialStep",
"HighPtTripletStep",
"LowPtQuadStep",
"LowPtTripletStep",
"DetachedQuadStep",
"PixelPairStep",
]
))
from Configuration.ProcessModifiers.vectorHits_cff import vectorHits
vectorHits.toModify(_iterations_trackingPhase2PU140, func=lambda x: x.append('PixelLessStep'))
vectorHits.toModify(_iterations_trackingPhase2PU140_VS.names, func=lambda x: x.append('PixelLessStep'))
from Configuration.ProcessModifiers.trackingIters01_cff import trackingIters01
trackingIters01.toModify(_iterations_trackingPhase2PU140_VS, names = ["InitialStep", "HighPtTripletStep"])
# apply all procModifiers before this
_iterations_trackingPhase2PU140 = _iterations_trackingPhase2PU140_VS.names.value()

from Configuration.ProcessModifiers.jetCoreInPhase2_cff import jetCoreInPhase2
jetCoreInPhase2.toModify(_iterations_trackingPhase2PU140, func=lambda x: x.append('JetCoreRegionalStep'))
Expand All @@ -76,10 +80,13 @@
"MuonSeededStepOutIn",
]
#Phase2
_iterations_muonSeeded_trackingPhase2PU140 = [
_iterations_muonSeeded_trackingPhase2PU140_VS = cms.PSet(names = cms.vstring(
"MuonSeededStepInOut",
"MuonSeededStepOutIn",
]
))
trackingIters01.toModify(_iterations_muonSeeded_trackingPhase2PU140_VS, names = [])
_iterations_muonSeeded_trackingPhase2PU140 = _iterations_muonSeeded_trackingPhase2PU140_VS.names.value()

_multipleSeedProducers = {
"MixedTripletStep": ["A", "B"],
"TobTecStep": ["Pair", "Tripl"],
Expand Down
9 changes: 9 additions & 0 deletions RecoTracker/LST/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<use name="DataFormats/Common"/>
<use name="alpaka"/>
<use name="DataFormats/TrackerRecHit2D"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<use name="RecoTracker/LSTCore"/>
<flags ALPAKA_BACKENDS="1"/>
<export>
<lib name="1"/>
</export>
40 changes: 40 additions & 0 deletions RecoTracker/LST/interface/LSTOutput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef RecoTracker_LST_interface_LSTOutput_h
#define RecoTracker_LST_interface_LSTOutput_h

#include <memory>
#include <vector>

#include "RecoTracker/LSTCore/interface/Common.h"

class LSTOutput {
public:
LSTOutput() = default;
LSTOutput(std::vector<std::vector<unsigned int>> const hitIdx,
std::vector<unsigned int> const len,
std::vector<int> const seedIdx,
std::vector<short> const trackCandidateType)
: hitIdx_(std::move(hitIdx)),
len_(std::move(len)),
seedIdx_(std::move(seedIdx)),
trackCandidateType_(std::move(trackCandidateType)) {}

using LSTTCType = lst::LSTObjType;

// Hit indices of each of the LST track candidates.
std::vector<std::vector<unsigned int>> const& hitIdx() const { return hitIdx_; }
// Number of hits of each of the LST track candidates.
std::vector<unsigned int> const& len() const { return len_; }
// Index of the pixel track associated to each of the LST track candidates.
// If not associated to a pixel track, which is the case for T5s, it defaults to -1.
std::vector<int> const& seedIdx() const { return seedIdx_; }
// LSTTCType from RecoTracker/LSTCore/interface/Common.h
std::vector<short> const& trackCandidateType() const { return trackCandidateType_; }

private:
std::vector<std::vector<unsigned int>> hitIdx_;
std::vector<unsigned int> len_;
std::vector<int> seedIdx_;
std::vector<short> trackCandidateType_;
};

#endif
33 changes: 33 additions & 0 deletions RecoTracker/LST/interface/LSTPhase2OTHitsInput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef RecoTracker_LST_interface_LSTPhase2OTHitsInput_h
#define RecoTracker_LST_interface_LSTPhase2OTHitsInput_h

#include <memory>
#include <vector>

#include "DataFormats/TrackerRecHit2D/interface/Phase2TrackerRecHit1D.h"

class LSTPhase2OTHitsInput {
public:
LSTPhase2OTHitsInput() = default;
LSTPhase2OTHitsInput(std::vector<unsigned int> const detId,
std::vector<float> const x,
std::vector<float> const y,
std::vector<float> const z,
std::vector<TrackingRecHit const*> const hits)
: detId_(std::move(detId)), x_(std::move(x)), y_(std::move(y)), z_(std::move(z)), hits_(std::move(hits)) {}

std::vector<unsigned int> const& detId() const { return detId_; }
std::vector<float> const& x() const { return x_; }
std::vector<float> const& y() const { return y_; }
std::vector<float> const& z() const { return z_; }
std::vector<TrackingRecHit const*> const& hits() const { return hits_; }

private:
std::vector<unsigned int> detId_;
std::vector<float> x_;
std::vector<float> y_;
std::vector<float> z_;
std::vector<TrackingRecHit const*> hits_;
};

#endif
Loading

0 comments on commit 48600da

Please sign in to comment.