Skip to content

Commit

Permalink
Added RecoTracker/LST package
Browse files Browse the repository at this point in the history
Co-authored-by: Manos Vourliotis <[email protected]>
Co-authored-by: Slava Krutelyov <[email protected]>
  • Loading branch information
3 people committed May 31, 2024
1 parent ca8271a commit 891eb11
Show file tree
Hide file tree
Showing 27 changed files with 1,290 additions and 6 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()

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
2 changes: 1 addition & 1 deletion RecoTracker/FinalTrackSelectors/plugins/TrackListMerger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ void TrackListMerger::produce(edm::Event& e, const edm::EventSetup& es) {
}

//DL here
if LIKELY (ngood > 1 && collsSize > 1)
if LIKELY (ngood > 0 && collsSize > 0)
for (unsigned int ltm = 0; ltm < listsToMerge_.size(); ltm++) {
int saveSelected[rSize];
bool notActive[collsSize];
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 @@ -107,6 +107,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 @@ -116,3 +126,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_cfi import lstInitialStepSeedTracks,lstHighPtTripletStepSeedTracks
from RecoTracker.LST.lstPixelSeedInputProducer_cfi import lstPixelSeedInputProducer
from RecoTracker.LST.lstPhase2OTHitsInputProducer_cfi import lstPhase2OTHitsInputProducer
from RecoTracker.LST.lstProducer_cff import *

_HighPtTripletStepTask_LST.add(siPhase2RecHits, lstInitialStepSeedTracks, lstHighPtTripletStepSeedTracks, lstPixelSeedInputProducer, lstPhase2OTHitsInputProducer,
lstProducer, lstModulesDevESProducer, 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
18 changes: 13 additions & 5 deletions RecoTracker/IterativeTracking/python/iterativeTkConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,21 @@

_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()

_iterations_muonSeeded = [
"MuonSeededStepInOut",
"MuonSeededStepOutIn",
Expand All @@ -72,10 +77,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
10 changes: 10 additions & 0 deletions RecoTracker/LST/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<use name="DataFormats/Common"/>
<use name="alpaka"/>
<use name="DataFormats/TrackerRecHit2D"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<use name="RecoTracker/LSTCore"/>
<flags CXXFLAGS="-DLST_IS_CMSSW_PACKAGE"/>
<flags ALPAKA_BACKENDS="1"/>
<export>
<lib name="1"/>
</export>
36 changes: 36 additions & 0 deletions RecoTracker/LST/interface/LSTOutput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#ifndef RecoTracker_LST_LSTOutput_h
#define RecoTracker_LST_LSTOutput_h

#include <memory>
#include <vector>

class LSTOutput {
public:
LSTOutput() = default;
~LSTOutput() = default;

enum LSTTCType { T5 = 4, pT3 = 5, pT5 = 7, pLS = 8 };

void setLSTOutputTraits(std::vector<std::vector<unsigned int>> hitIdx,
std::vector<unsigned int> len,
std::vector<int> seedIdx,
std::vector<short> trackCandidateType) {
hitIdx_ = hitIdx;
len_ = len;
seedIdx_ = seedIdx;
trackCandidateType_ = trackCandidateType;
}

std::vector<std::vector<unsigned int>> const& hitIdx() const { return hitIdx_; }
std::vector<unsigned int> const& len() const { return len_; }
std::vector<int> const& seedIdx() const { return seedIdx_; }
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
40 changes: 40 additions & 0 deletions RecoTracker/LST/interface/LSTPhase2OTHitsInput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#ifndef RecoTracker_LST_LSTPhase2OTHitsInput_h
#define RecoTracker_LST_LSTPhase2OTHitsInput_h

#include <memory>
#include <vector>

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

class LSTPhase2OTHitsInput {
public:
LSTPhase2OTHitsInput() = default;
~LSTPhase2OTHitsInput() = default;

void setLSTPhase2OTHitsTraits(std::vector<unsigned int> detId,
std::vector<float> x,
std::vector<float> y,
std::vector<float> z,
std::vector<TrackingRecHit const*> hits) {
detId_ = detId;
x_ = x;
y_ = y;
z_ = z;
hits_ = 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
78 changes: 78 additions & 0 deletions RecoTracker/LST/interface/LSTPixelSeedInput.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#ifndef RecoTracker_LST_LSTPixelSeedInput_h
#define RecoTracker_LST_LSTPixelSeedInput_h

#include <memory>
#include <vector>

class LSTPixelSeedInput {
public:
LSTPixelSeedInput() = default;
~LSTPixelSeedInput() = default;

void setLSTPixelSeedTraits(std::vector<float> px,
std::vector<float> py,
std::vector<float> pz,
std::vector<float> dxy,
std::vector<float> dz,
std::vector<float> ptErr,
std::vector<float> etaErr,
std::vector<float> stateTrajGlbX,
std::vector<float> stateTrajGlbY,
std::vector<float> stateTrajGlbZ,
std::vector<float> stateTrajGlbPx,
std::vector<float> stateTrajGlbPy,
std::vector<float> stateTrajGlbPz,
std::vector<int> q,
std::vector<std::vector<int>> hitIdx) {
px_ = px;
py_ = py;
pz_ = pz;
dxy_ = dxy;
dz_ = dz;
ptErr_ = ptErr;
etaErr_ = etaErr;
stateTrajGlbX_ = stateTrajGlbX;
stateTrajGlbY_ = stateTrajGlbY;
stateTrajGlbZ_ = stateTrajGlbZ;
stateTrajGlbPx_ = stateTrajGlbPx;
stateTrajGlbPy_ = stateTrajGlbPy;
stateTrajGlbPz_ = stateTrajGlbPz;
q_ = q;
hitIdx_ = hitIdx;
}

std::vector<float> const& px() const { return px_; }
std::vector<float> const& py() const { return py_; }
std::vector<float> const& pz() const { return pz_; }
std::vector<float> const& dxy() const { return dxy_; }
std::vector<float> const& dz() const { return dz_; }
std::vector<float> const& ptErr() const { return ptErr_; }
std::vector<float> const& etaErr() const { return etaErr_; }
std::vector<float> const& stateTrajGlbX() const { return stateTrajGlbX_; }
std::vector<float> const& stateTrajGlbY() const { return stateTrajGlbY_; }
std::vector<float> const& stateTrajGlbZ() const { return stateTrajGlbZ_; }
std::vector<float> const& stateTrajGlbPx() const { return stateTrajGlbPx_; }
std::vector<float> const& stateTrajGlbPy() const { return stateTrajGlbPy_; }
std::vector<float> const& stateTrajGlbPz() const { return stateTrajGlbPz_; }
std::vector<int> const& q() const { return q_; }
std::vector<std::vector<int>> const& hitIdx() const { return hitIdx_; }

private:
std::vector<float> px_;
std::vector<float> py_;
std::vector<float> pz_;
std::vector<float> dxy_;
std::vector<float> dz_;
std::vector<float> ptErr_;
std::vector<float> etaErr_;
std::vector<float> stateTrajGlbX_;
std::vector<float> stateTrajGlbY_;
std::vector<float> stateTrajGlbZ_;
std::vector<float> stateTrajGlbPx_;
std::vector<float> stateTrajGlbPy_;
std::vector<float> stateTrajGlbPz_;
std::vector<int> q_;
std::vector<std::vector<int>> hitIdx_;
};

#endif
Loading

0 comments on commit 891eb11

Please sign in to comment.