Skip to content

Commit a9e05c0

Browse files
committed
quinnanm 2
1 parent e51e86a commit a9e05c0

File tree

17 files changed

+219
-197
lines changed

17 files changed

+219
-197
lines changed

L1Trigger/TrackFindingTracklet/interface/HitPatternHelper.h

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,20 @@ namespace hph {
6060
bool hphDebug() const { return hphDebug_; }
6161
bool useNewKF() const { return useNewKF_; }
6262
double chosenRofZ() const { return chosenRofZ_; }
63-
std::vector<double> etaRegions() const { return etaRegions_; }
64-
std::map<int, std::map<int, std::vector<int>>> layermap() const { return layermap_; }
63+
const std::vector<double>& etaRegions() const { return etaRegions_; }
64+
const std::map<int, std::map<int, std::vector<int>>>& layermap() const { return layermap_; }
6565
int nKalmanLayers() const { return nKalmanLayers_; }
6666
int etaRegion(double z0, double cot, bool useNewKF) const;
67-
int digiCot(double cot, int binEta) const;
68-
int digiZT(double z0, double cot, int binEta) const;
69-
const std::vector<int> layerEncoding(int binEta, int binZT, int binCot) const {
70-
//return layerEncoding_.layerEncoding(binEta, binZT, binCot);
71-
return std::vector<int>();
72-
}
73-
const std::map<int, const tt::SensorModule*> layerEncodingMap(int binEta, int binZT, int binCot) const {
74-
//return layerEncoding_.layerEncodingMap(binEta, binZT, binCot);
75-
return std::map<int, const tt::SensorModule*>();
67+
const std::vector<int>& layerEncoding(double zT) const { return layerEncoding_->layerEncoding(zT); }
68+
// LayerEncoding call filling numPS, num2S, numMissingPS and numMissingPS for given hitPattern and trajectory
69+
void analyze(
70+
int hitpattern, double cot, double z0, int& numPS, int& num2S, int& numMissingPS, int& numMissing2S) const {
71+
layerEncoding_->analyze(hitpattern, cot, z0, numPS, num2S, numMissingPS, numMissing2S);
7672
}
7773

7874
private:
79-
const tt::Setup setupTT_; // Helper class to store TrackTrigger configuration
80-
const trackerTFP::DataFormats dataFormats_;
81-
const trackerTFP::DataFormat dfcot_;
82-
const trackerTFP::DataFormat dfzT_;
83-
const trackerTFP::LayerEncoding layerEncoding_;
75+
const tt::Setup* setupTT_; // Helper class to store TrackTrigger configuration
76+
const trackerTFP::LayerEncoding* layerEncoding_;
8477
bool hphDebug_;
8578
bool useNewKF_;
8679
double chosenRofZNewKF_;
@@ -116,8 +109,10 @@ namespace hph {
116109
int numMissingInterior2() {
117110
return numMissingInterior2_;
118111
} //The number of missing interior layers (using hitpattern, layermap from Old KF and sensor modules)
119-
std::vector<int> binary() { return binary_; } //11-bit hitmask needed by TrackQuality.cc (0~5->L1~L6;6~10->D1~D5)
120-
std::vector<float> bonusFeatures() { return bonusFeatures_; } //bonus features for track quality
112+
const std::vector<int>& binary() {
113+
return binary_;
114+
} //11-bit hitmask needed by TrackQuality.cc (0~5->L1~L6;6~10->D1~D5)
115+
const std::vector<float>& bonusFeatures() { return bonusFeatures_; } //bonus features for track quality
121116

122117
int reducedId(
123118
int layerId); //Converts layer ID (1~6->L1~L6;11~15->D1~D5) to reduced layer ID (0~5->L1~L6;6~10->D1~D5)
@@ -130,11 +125,8 @@ namespace hph {
130125
std::vector<double> etaRegions_;
131126
std::map<int, std::map<int, std::vector<int>>> layermap_;
132127
int nKalmanLayers_;
133-
int etaBin_;
134-
int cotBin_;
135-
int zTBin_;
128+
double zT_;
136129
std::vector<int> layerEncoding_;
137-
std::map<int, const tt::SensorModule*> layerEncodingMap_;
138130
int numExpLayer_;
139131
int hitpattern_;
140132
int etaSector_;

L1Trigger/TrackFindingTracklet/interface/KalmanFilter.h

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,12 @@ namespace trklet {
105105
void calcSeeds();
106106
// Transform States into output products
107107
void conv(tt::StreamsStub& streamsStub, tt::StreamsTrack& streamsTrack);
108-
// adds a layer to states
109-
void addLayer();
110-
// adds a layer to states to build seeds
111-
void addSeedLayer();
112-
// Assign next combinatoric (i.e. not first in layer) stub to state
113-
void comb(State*& state);
108+
// adds a layer to states, bool indicating if in seeding process
109+
void addLayer(bool seed = false);
114110
// apply final cuts
115111
void finalize();
116112
// best state selection
117113
void accumulator();
118-
// updates state
119-
void update(State*& state) { setup_->kfUse5ParameterFit() ? update5(state) : update4(state); }
120114
// updates state using 4 paramter fit
121115
void update4(State*& state);
122116
// updates state using 5 parameter fit

L1Trigger/TrackFindingTracklet/interface/TrackFindingProcessor.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@
1313

1414
namespace trklet {
1515

16-
// Class to format final tfp output and to prodcue final TTTrackCollection
16+
/*! \class trklet::TrackFindingProcessor
17+
* \brief Class to format final tfp output and to prodcue final TTTrackCollection
18+
* \author Thomas Schuh
19+
* \date 2025, Apr
20+
*/
1721
class TrackFindingProcessor {
1822
public:
1923
TrackFindingProcessor(const tt::Setup* setup_,
@@ -31,17 +35,17 @@ namespace trklet {
3135
void produce(const std::vector<TTTrackRef>& inputs, tt::StreamsTrack& outputs) const;
3236

3337
private:
34-
//
38+
// number of bits used to describe one part of a track (96 bit)
3539
static constexpr int partial_width = 32;
36-
//
40+
// number of track parts arriving per clock tick (1 track per tick)
3741
static constexpr int partial_in = 3;
38-
//
42+
// number of track parts leaving per clock tick (TFP sends 2/3 tracks per clock and link)
3943
static constexpr int partial_out = 2;
40-
//
44+
// type describing one part of a track
4145
typedef std::bitset<partial_width> PartialFrame;
42-
//
46+
// type describing one part of a track together with its edm ref
4347
typedef std::pair<const TTTrackRef&, PartialFrame> PartialFrameTrack;
44-
//
48+
// type representing a track
4549
struct Track {
4650
Track(const tt::FrameTrack& frameTrack,
4751
const tt::Frame& frameTQ,

L1Trigger/TrackFindingTracklet/python/Customize_cff.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,40 +32,76 @@ def trackletConfig(process):
3232

3333
# configures KF simulation in emulation chain
3434
def oldKFConfig(process):
35+
#===== Use HYBRID TRACKING (Tracklet pattern reco + TMTT KF -- requires tracklet C++ too) =====
3536
process.ProducerKF.Hybrid = True
37+
# Emulate dead/inefficient modules using the StubKiller code, with stubs killed according to the scenarios of the Stress Test group.
38+
# (0=Don't kill any stubs; 1-5 = Scenarios described in StubKiller.cc)
3639
process.ProducerKF.DeadModuleOpts.KillScenario = 0
40+
# Modify TMTT tracking to try to recover tracking efficiency in presence of dead modules. (Does nothing if KillScenario = 0).
3741
process.ProducerKF.DeadModuleOpts.KillRecover = False
42+
# Min track Pt that Hough Transform must find. Also used by StubCuts.KillLowPtStubs and by EtaPhiSectors.UseStubPhi.
3843
process.ProducerKF.HTArraySpecRphi.HoughMinPt = 2.
44+
# Optionally skip track digitisation if done internally inside fitting code.
3945
process.ProducerKF.TrackDigi.KF_skipTrackDigi = True
46+
# Digitize stub coords? If not, use floating point coords.
4047
process.ProducerKF.StubDigitize.EnableDigitize = False
48+
# Use an FPGA-friendly approximation to determine track angle dphi from bend in GP?
4149
process.ProducerKF.GeometricProc.UseApproxB = True
50+
# Gradient term of linear equation for approximating B
4251
process.ProducerKF.GeometricProc.BApprox_gradient = 0.886454
52+
# Intercept term of linear equation for approximating B
4353
process.ProducerKF.GeometricProc.BApprox_intercept = 0.504148
54+
# Divisions of Tracker at GP.
4455
process.ProducerKF.PhiSectors.NumPhiSectors = 9
56+
# Divisions of Tracker at DTC
4557
process.ProducerKF.PhiSectors.NumPhiNonants = 9
58+
# Use phi of track at this radius for assignment of stubs to phi sectors & also for one of the axes of the r-phi HT. If ChosenRofPhi=0, then use track phi0. - Should be an integer multiple of the stub r digitisation granularity.
4659
process.ProducerKF.PhiSectors.ChosenRofPhi = 55.
60+
# Eta boundaries for 16 eta regions
4761
process.ProducerKF.EtaSectors.EtaRegions = [-2.4, -2.08, -1.68, -1.26, -0.90, -0.62, -0.41, -0.20, 0.0, 0.20, 0.41, 0.62, 0.90, 1.26, 1.68, 2.08, 2.4]
62+
# Use z of track at this radius for assignment of tracks to eta sectors & also for one of the axes of the r-z HT. Do not set to zero!
4863
process.ProducerKF.EtaSectors.ChosenRofZ = 50.0
64+
# Fit will reject fitted tracks unless it can assign at least this number of stubs to them.
4965
process.ProducerKF.TrackFitSettings.KalmanMinNumStubs = 4
66+
# Fit will attempt to add up to this nummber of stubs to each fitted tracks, but won't bother adding more.
5067
process.ProducerKF.TrackFitSettings.KalmanMaxNumStubs = 6
68+
# Allow the KF to skip this many layers in total per track.
5169
process.ProducerKF.TrackFitSettings.KalmanMaxSkipLayersHard = 1
70+
# For HT tracks with few stubs
5271
process.ProducerKF.TrackFitSettings.KalmanMaxSkipLayersEasy = 2
72+
# Max stubs an HT track can have to be "easy".
5373
process.ProducerKF.TrackFitSettings.KalmanMaxStubsEasy = 10
74+
# KF will consider at most this #stubs per layer to save time.
5475
process.ProducerKF.TrackFitSettings.KalmanMaxStubsPerLayer = 4
76+
# Multiple scattering term - inflate hit phi errors by this divided by Pt (0.00075 gives best helix resolution & 0.00450 gives best chi2 distribution).
5577
process.ProducerKF.TrackFitSettings.KalmanMultiScattTerm = 0.00075
78+
# Scale down chi2 in r-phi plane by this factor to improve electron performance (should be power of 2)
5679
process.ProducerKF.TrackFitSettings.KalmanChi2RphiScale = 8
80+
# Disable "maybe layer" to match with firmware
5781
process.ProducerKF.TrackFitSettings.KFUseMaybeLayers = True
82+
# Remove requirement of at least 2 PS layers per track.
5883
process.ProducerKF.TrackFitSettings.KalmanRemove2PScut = True
84+
#--- Cuts applied to KF states as a function of the last KF tracker layer they had a stub in.
85+
# (If "4" or "5" in name, cut only applies to 4 or 5 param helix fit).
5986
process.ProducerKF.TrackFitSettings.KFLayerVsPtToler = [999., 999., 0.1, 0.1, 0.05, 0.05, 0.05]
87+
# d0 cut only applied to 5 param helix fit.
6088
process.ProducerKF.TrackFitSettings.KFLayerVsD0Cut5 = [999., 999., 999., 10., 10., 10., 10.]
6189
process.ProducerKF.TrackFitSettings.KFLayerVsZ0Cut5 = [999., 999., 25.5, 25.5, 25.5, 25.5, 25.5]
6290
process.ProducerKF.TrackFitSettings.KFLayerVsZ0Cut4 = [999., 999., 15., 15., 15., 15., 15.]
91+
# Chi2 cuts should be retuned if KalmanMultiScattTerm value changed.
6392
process.ProducerKF.TrackFitSettings.KFLayerVsChiSq5 = [999., 999., 10., 30., 80., 120., 160.]
6493
process.ProducerKF.TrackFitSettings.KFLayerVsChiSq4 = [999., 999., 10., 30., 80., 120., 160.]
94+
# For 5-param helix fits, calculate also beam-constrained helix params after fit is complete, & use them for duplicate removal if DupTrkAlgFit=1.
6595
process.ProducerKF.TrackFitSettings.KalmanAddBeamConstr = False
96+
# Use approx calc to account for non-radial endcap 2S modules corresponding to current FW, with no special treatment for tilted modules.
6697
process.ProducerKF.TrackFitSettings.KalmanHOfw = False
98+
# Treat z uncertainty in tilted barrel modules correctly.
6799
process.ProducerKF.TrackFitSettings.KalmanHOtilted = True
100+
# Projection from (r,phi) to (z,phi) for endcap 2S modules. (0=disable correction, 1=correct with offset, 2=correct with non-diagonal stub covariance matrix). -- Option 1 is easier in FPGA, but only works if fit adds PS stubs before 2S ones.
68101
process.ProducerKF.TrackFitSettings.KalmanHOprojZcorr = 1
102+
# Alpha correction for non-radial 2S endcap strips. (0=disable correction, 1=correct with offset, 2=correct with non-diagonal stub covariance matrix). -- Option 1 is easier in FPGA, but only works if fit adds PS stubs before 2S ones.
69103
process.ProducerKF.TrackFitSettings.KalmanHOalpha = 0
104+
# Higher order circle explansion terms for low Pt.
70105
process.ProducerKF.TrackFitSettings.KalmanHOhelixExp = True
106+
# Larger number has more debug printout. "1" is useful for understanding why tracks are lost, best combined with TrackFitCheat=True.
71107
process.ProducerKF.TrackFitSettings.KalmanDebugLevel = 0

L1Trigger/TrackFindingTracklet/python/KalmanFilterFormats_cfi.py

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,49 +19,44 @@
1919
# numerical instabillity (negative C00, C11, C22, C33) requires smaller baseshifts of related variables (rx, Sxx, Kxx, Rxx, invRxx)
2020
# if a variable overflows an Exception will be thrown and the corresponding baseshift needs to be increased.
2121

22-
BaseShiftx0 = cms.int32( -1 ),
23-
BaseShiftx1 = cms.int32( -8 ),
24-
BaseShiftx2 = cms.int32( -1 ),
25-
BaseShiftx3 = cms.int32( -1 ),
22+
BaseShiftx0 = cms.int32( -1 ), # precision difference in powers of 2 between x0 and inv2R at KF output
23+
BaseShiftx1 = cms.int32( -8 ), # precision difference in powers of 2 between x1 and phiT at KF output
24+
BaseShiftx2 = cms.int32( -1 ), # precision difference in powers of 2 between x2 and cotTheta at KF output
25+
BaseShiftx3 = cms.int32( -1 ), # precision difference in powers of 2 between x3 and zT at KF output
2626

27-
BaseShiftr0 = cms.int32( -8 ),
28-
BaseShiftr1 = cms.int32( 0 ),
27+
BaseShiftr0 = cms.int32( -8 ), # precision difference in powers of 2 between phi residual and phiT
28+
BaseShiftr1 = cms.int32( 0 ), # precision difference in powers of 2 between z residual and zT
2929

30-
BaseShiftS00 = cms.int32( -4 ),
31-
BaseShiftS01 = cms.int32( -12 ),
32-
BaseShiftS12 = cms.int32( 0 ),
33-
BaseShiftS13 = cms.int32( -1 ),
30+
BaseShiftS00 = cms.int32( -4 ), # precision difference in powers of 2 between S00 and inv2R x phiT
31+
BaseShiftS01 = cms.int32( -12 ), # precision difference in powers of 2 between S01 and phiT x phiT
32+
BaseShiftS12 = cms.int32( 0 ), # precision difference in powers of 2 between S12 and cotTheta x zT
33+
BaseShiftS13 = cms.int32( -1 ), # precision difference in powers of 2 between S13 and zT x zT
3434

35-
BaseShiftR00 = cms.int32( -5 ),
36-
BaseShiftR11 = cms.int32( 6 ),
35+
BaseShiftR00 = cms.int32( -5 ), # precision difference in powers of 2 between R00 and phiT x phiT
36+
BaseShiftR11 = cms.int32( 6 ), # precision difference in powers of 2 between R11 and zT x zT
3737

3838
BaseShiftInvR00Approx = cms.int32( -30 ),
3939
BaseShiftInvR11Approx = cms.int32( -41 ),
4040
BaseShiftInvR00Cor = cms.int32( -24 ),
4141
BaseShiftInvR11Cor = cms.int32( -24 ),
42-
BaseShiftInvR00 = cms.int32( -30 ),
43-
BaseShiftInvR11 = cms.int32( -41 ),
42+
BaseShiftInvR00 = cms.int32( -30 ), # precision difference in powers of 2 between 1 / R00 and 1 / ( phiT x phiT )
43+
BaseShiftInvR11 = cms.int32( -41 ), # precision difference in powers of 2 between 1 / R11 and 1 / ( zT x zT )
4444

4545
BaseShiftS00Shifted = cms.int32( -1 ),
4646
BaseShiftS01Shifted = cms.int32( -7 ),
4747
BaseShiftS12Shifted = cms.int32( 4 ),
4848
BaseShiftS13Shifted = cms.int32( 4 ),
4949

50-
BaseShiftK00 = cms.int32( -7 ),
51-
BaseShiftK10 = cms.int32( -13 ),
52-
BaseShiftK21 = cms.int32( -13 ),
53-
BaseShiftK31 = cms.int32( -13 ),
50+
BaseShiftK00 = cms.int32( -7 ), # precision difference in powers of 2 between K00 and inv2R / phiT
51+
BaseShiftK10 = cms.int32( -13 ), # precision difference in powers of 2 between K10 and 1
52+
BaseShiftK21 = cms.int32( -13 ), # precision difference in powers of 2 between K21 and cotTheta / zT
53+
BaseShiftK31 = cms.int32( -13 ), # precision difference in powers of 2 between K31 and 1
5454

55-
BaseShiftC00 = cms.int32( 6 ),
56-
BaseShiftC01 = cms.int32( 1 ),
57-
BaseShiftC11 = cms.int32( -6 ),
58-
BaseShiftC22 = cms.int32( 5 ),
59-
BaseShiftC23 = cms.int32( 6 ),
60-
BaseShiftC33 = cms.int32( 5 ),
61-
62-
BaseShiftr02 = cms.int32( -2 ),
63-
BaseShiftr12 = cms.int32( 10 ),
64-
BaseShiftchi20 = cms.int32( -10 ),
65-
BaseShiftchi21 = cms.int32( -10 )
55+
BaseShiftC00 = cms.int32( 6 ), # precision difference in powers of 2 between C00 and inv2R * inv2R
56+
BaseShiftC01 = cms.int32( 1 ), # precision difference in powers of 2 between C01 and inv2R * phiT
57+
BaseShiftC11 = cms.int32( -6 ), # precision difference in powers of 2 between C11 and phiT * phiT
58+
BaseShiftC22 = cms.int32( 5 ), # precision difference in powers of 2 between C22 and cotTheta * cotTheta
59+
BaseShiftC23 = cms.int32( 6 ), # precision difference in powers of 2 between C23 and cotTheta * zT
60+
BaseShiftC33 = cms.int32( 5 ) # precision difference in powers of 2 between C33 and zT * zT
6661

6762
)

0 commit comments

Comments
 (0)