Skip to content

Commit

Permalink
LST integration in CMSSW up to b0c96de
Browse files Browse the repository at this point in the history
  • Loading branch information
VourMa committed Aug 9, 2023
1 parent e0f88d0 commit 05c3d73
Show file tree
Hide file tree
Showing 23 changed files with 1,111 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()

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
oldClusterRemovalInfo = 'detachedQuadStepClusters',
overrideTrkQuals = 'detachedQuadStepSelector:detachedQuadStepTrk'
))
from Configuration.ProcessModifiers.trackingIters01_cff import trackingIters01
trackingIters01.toModify(convClusters,
trajectories = "highPtTripletStepTracks",
oldClusterRemovalInfo = "highPtTripletStepClusters",
overrideTrkQuals = "highPtTripletStepSelector:highPtTripletStep"
)

_convLayerPairsStripOnlyLayers = ['TIB1+TID1_pos',
'TIB1+TID1_neg',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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 @@ -43,6 +45,10 @@
candidateSource = "duplicateTrackCandidates:candidates",
candidateComponents = "duplicateTrackCandidates:candidateMap"
)
trackingIters01.toModify(generalTracks,
originalSource = "earlyGeneralTracks",
originalMVAVals = "earlyGeneralTracks:MVAValues"
)

generalTracksTask = cms.Task(
duplicateTrackCandidates,
Expand Down
21 changes: 21 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,14 @@ def _extend_pixelLess(x):
x.setsToMerge[0].tLists += [6]
(trackingPhase2PU140 & vectorHits).toModify(earlyGeneralTracks, _extend_pixelLess)

def _dropIter(mod, iteration):
mod.TrackProducers.pop(iteration)
mod.hasSelector.pop(iteration)
mod.indivShareFrac.pop(iteration)
mod.selectedTrackQuals.pop(iteration)
mod.setsToMerge[0].tLists.pop(iteration)

from Configuration.ProcessModifiers.trackingLST_cff import trackingLST
# remove initialStep from earlyGeneralTracks inputs
(trackingPhase2PU140 & trackingLST).toModify(earlyGeneralTracks, func=lambda x:_dropIter(x,0))
(trackingPhase2PU140 & trackingLST).toModify(earlyGeneralTracks, indivShareFrac = {0: 1})
14 changes: 14 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 Down Expand Up @@ -378,6 +382,16 @@
_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.alpaka_cuda_asyncLSTProducer_cfi import alpaka_cuda_asyncLSTProducer
lstProducer = alpaka_cuda_asyncLSTProducer.clone()
_HighPtTripletStepTask_LST.add(siPhase2RecHits, lstInitialStepSeedTracks, lstHighPtTripletStepSeedTracks, lstPixelSeedInputProducer, lstPhase2OTHitsInputProducer, lstProducer)
(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
5 changes: 5 additions & 0 deletions RecoTracker/LST/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<use name="DataFormats/Common"/>
<use name="DataFormats/TrackerRecHit2D"/>
<export>
<lib name="RecoTrackerLST"/>
</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
36 changes: 36 additions & 0 deletions RecoTracker/LST/plugins/BuildFile.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<!-- host-only plugins -->
<library file="*.cc" name="RecoTrackerLSTPlugins">
<use name="DataFormats/TrackCandidate"/>
<use name="DataFormats/TrackReco"/>
<use name="DataFormats/TrackerRecHit2D"/>
<use name="DataFormats/TrajectorySeed"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="Geometry/TrackerGeometryBuilder"/>
<use name="MagneticField/Engine"/>
<use name="MagneticField/Records"/>
<use name="RecoTracker/LST"/>
<use name="RecoTracker/TkSeedingLayers"/>
<use name="RecoTracker/TkSeedGenerator"/>
<use name="TrackingTools/GeomPropagators"/>
<use name="TrackingTools/Records"/>
<use name="TrackingTools/TrajectoryState"/>
<use name="TrackingTools/TransientTrackingRecHit"/>
<use name="Validation/RecoTrack"/>
<flags EDM_PLUGIN="1"/>
</library>

<!-- alpaka-based portable plugins -->
<library file="alpaka/*.cc" name="RecoTrackerLSTPluginsPortable">
<use name="alpaka"/>
<use name="lst"/>
<use name="FWCore/Framework"/>
<use name="FWCore/ParameterSet"/>
<use name="FWCore/Utilities"/>
<use name="HeterogeneousCore/AlpakaCore"/>
<use name="HeterogeneousCore/AlpakaInterface"/>
<use name="RecoTracker/LST"/>
<flags ALPAKA_BACKENDS="cuda"/>
<flags EDM_PLUGIN="1"/>
</library>
Loading

0 comments on commit 05c3d73

Please sign in to comment.