Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates to L1 tracking (improved use of stub bend etc.) #40335

Merged
merged 32 commits into from
Jun 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
3a634da
Find best MC match (#174)
bryates Jun 22, 2022
295a73e
Add possibility to invent seeding stubs coordinates before DR (#170)
sarafiorendi Jun 24, 2022
a2849c8
MC/MP LUTs (#176)
bryates Aug 15, 2022
c7c8339
MP best match (#180)
bryates Aug 15, 2022
6392209
fix for stubs with identical position but different bends. (#183)
tschuh Sep 7, 2022
bff95fe
Move module loop to setup (#175)
Jingyan95 Sep 22, 2022
9e89897
Update FitTrack.cc
tomalin Oct 4, 2022
a9a4fff
Added option to print digi format (#187)
tomalin Oct 13, 2022
e0a6507
Atownse2 calc bend cuts (#178)
atownse2 Oct 26, 2022
8b7574d
kf bug fixes, f/w sync. (#188)
tschuh Oct 28, 2022
ed50147
MP disk projection LUT (#185)
bryates Nov 2, 2022
4dc5a44
Produce combined module MemPrint & LUT files for reduced project (#189)
tomalin Nov 9, 2022
03725db
tiny fix of start_of_orbit_bit. (#190)
tschuh Nov 9, 2022
305d6df
Duplicate Removal with overlapping rinv bins (#181)
dally96 Nov 16, 2022
217f4af
Fix missing ESProducts in HPH
tomalin Jan 4, 2023
e8c8587
Fix to set nbits_ for the VMRME/TE files (#196) (#198)
tomalin Jan 20, 2023
4f95bd3
Update L1Trigger/TrackFindingTracklet/src/TrackletLUT.cc
tomalin Apr 6, 2023
c6ea514
Update L1Trigger/TrackFindingTracklet/src/TrackletLUT.cc
tomalin Apr 6, 2023
bf60e52
Update L1Trigger/TrackFindingTracklet/src/PurgeDuplicate.cc
tomalin Apr 6, 2023
e6b8892
Update L1Trigger/TrackFindingTracklet/src/MatchCalculator.cc
bryates Apr 6, 2023
65982fa
Update L1Trigger/TrackFindingTracklet/src/TrackletLUT.cc
bryates Apr 6, 2023
a8358f1
Update L1Trigger/TrackFindingTracklet/src/TrackletLUT.cc
bryates Apr 6, 2023
53bb196
Fix bug in PR review comment suggestion
tomalin Apr 6, 2023
760d5d6
Fxied crash by just using `idrcut`
Apr 6, 2023
b76bdd4
Fixed `idrcut` in MP and MC
Apr 6, 2023
98a168f
Removed uneeded lines
Apr 12, 2023
cf78e63
PR comment concerning Hitpatternhelper
Jingyan95 Apr 17, 2023
0c3107d
Update sample in cfg.py
Jingyan95 Apr 17, 2023
dc53680
Applied official code formatting
tomalin May 9, 2023
3b717fa
Merge branch 'master' into L1TK-PR-12_6_0_pre5
tomalin May 9, 2023
dd84d9d
Merge branch 'master' into L1TK-PR-12_6_0_pre5
tomalin May 12, 2023
9f23b96
Removed unused lines of code
tomalin Jun 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions L1Trigger/TrackFindingTMTT/test/tmtt_tf_analysis_cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,12 @@

process = cms.Process("Demo")

GEOMETRY = "D76"
GEOMETRY = "D88"

if GEOMETRY == "D49":
if GEOMETRY == "D88":
print("using geometry " + GEOMETRY + " (tilted)")
process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D49_cff')
elif GEOMETRY == "D76":
print("using geometry " + GEOMETRY + " (tilted)")
process.load('Configuration.Geometry.GeometryExtended2026D76Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D76_cff')
process.load('Configuration.Geometry.GeometryExtended2026D88Reco_cff')
process.load('Configuration.Geometry.GeometryExtended2026D88_cff')
else:
print("this is not a valid geometry!!!")

Expand All @@ -42,10 +38,7 @@
#from MCsamples.Scripts.getCMSdata_cfi import *
#from MCsamples.Scripts.getCMSlocaldata_cfi import *

if GEOMETRY == "D49":
inputMC = ["/store/relval/CMSSW_11_3_0_pre3/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_113X_mcRun4_realistic_v3_2026D49PU200_rsb-v1/00000/00260a30-734a-4a3a-a4b0-f836ce5502c6.root"]

elif GEOMETRY == "D76":
if GEOMETRY == "D88":
# Read data from card files (defines getCMSdataFromCards()):
#from MCsamples.RelVal_1130_D76.PU200_TTbar_14TeV_cfi import *
#inputMC = getCMSdataFromCards()
Expand All @@ -59,7 +52,7 @@
#inputMC=getCMSdata(dataName)

# Or read specified .root file:
inputMC = ["/store/relval/CMSSW_11_3_0_pre6/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_113X_mcRun4_realistic_v6_2026D76PU200-v1/00000/00026541-6200-4eed-b6f8-d3a1fd720e9c.root"]
inputMC = ["/store/relval/CMSSW_12_6_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_125X_mcRun4_realistic_v2_2026D88PU200-v1/2590000/00b3d04b-4c7b-4506-8d82-9538fb21ee19.root"]

else:
print("this is not a valid geometry!!!")
Expand Down
19 changes: 19 additions & 0 deletions L1Trigger/TrackFindingTracklet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
To run L1 tracking & create TTree of tracking performance:

cmsRun L1TrackNtupleMaker_cfg.py

By setting variable L1TRKALGO inside this script, you can change the
L1 tracking algo used.

For the baseline HYBRID algo, which runs Tracklet pattern reco followed
by KF track fit, TrackFindingTracklet/interface/Settings.h configures the pattern reco, (although some
parameters there are overridden by l1tTTTracksFromTrackletEmulation_cfi.py).
The KF fit is configued by the constructor of TrackFindingTMTT/src/Settings.cc.

The ROOT macros L1TrackNtuplePlot.C & L1TrackQualityPlot.C make tracking
performance & BDT track quality performance plots from the TTree.
Both can be run via makeHists.csh .

The optional "NewKF" track fit, (which is not yet baseline, as no duplicate
track removal is compatible with it), is configured via
TrackTrigger/python/ProducerSetup_cfi.py, (which also configures the DTC).
3 changes: 3 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/FitTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ namespace trklet {
void trackFitChisq(Tracklet* tracklet, std::vector<const Stub*>&, std::vector<std::pair<int, int>>&);

// used if USEHYBRID is defined
// tracklet = input track cand, updated with fitted helix info.
// returns trackstublist = pointers to Stubs on track.
// returns stubidslist = (layer, unique stub index in layer).
void trackFitKF(Tracklet* tracklet,
std::vector<const Stub*>& trackstublist,
std::vector<std::pair<int, int>>& stubidslist);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@
#include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
#include "Geometry/CommonTopologies/interface/PixelGeomDetUnit.h"
#include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
#include "L1Trigger/TrackTrigger/interface/HitPatternHelperRcd.h"
#include "L1Trigger/TrackFindingTracklet/interface/HitPatternHelperRcd.h"
#include "L1Trigger/TrackTrigger/interface/Setup.h"
#include "L1Trigger/TrackerTFP/interface/DataFormats.h"
#include "L1Trigger/TrackerTFP/interface/LayerEncoding.h"

#include <bitset>
#include <iostream>
Expand All @@ -42,27 +44,42 @@ namespace hph {
//Class that stores configuration for HitPatternHelper
class Setup {
public:
Setup() {}
Setup(const edm::ParameterSet& iConfig, const tt::Setup& setupTT);
Setup(const edm::ParameterSet& iConfig,
const tt::Setup& setupTT,
const trackerTFP::DataFormats& dataFormats,
const trackerTFP::LayerEncoding& layerEncoding);
~Setup() {}

bool hphDebug() const { return iConfig_.getParameter<bool>("hphDebug"); }
bool useNewKF() const { return iConfig_.getParameter<bool>("useNewKF"); }
double deltaTanL() const { return iConfig_.getParameter<double>("deltaTanL"); }
double chosenRofZ() const { return setupTT_.chosenRofZ(); }
std::vector<double> etaRegions() const { return setupTT_.boundarieEta(); }
std::vector<tt::SensorModule> sensorModules() const { return setupTT_.sensorModules(); }
bool hphDebug() const { return hphDebug_; }
bool useNewKF() const { return useNewKF_; }
double chosenRofZ() const { return chosenRofZ_; }
std::vector<double> etaRegions() const { return etaRegions_; }
std::map<int, std::map<int, std::vector<int>>> layermap() const { return layermap_; }
int nKalmanLayers() const { return nKalmanLayers_; }
static auto smallerID(std::pair<int, bool> lhs, std::pair<int, bool> rhs) { return lhs.first < rhs.first; }
static auto equalID(std::pair<int, bool> lhs, std::pair<int, bool> rhs) { return lhs.first == rhs.first; }
int etaRegion(double z0, double cot, bool useNewKF) const;
int digiCot(double cot, int binEta) const;
int digiZT(double z0, double cot, int binEta) const;
const std::vector<int>& layerEncoding(int binEta, int binZT, int binCot) const {
return layerEncoding_.layerEncoding(binEta, binZT, binCot);
}
const std::map<int, const tt::SensorModule*>& layerEncodingMap(int binEta, int binZT, int binCot) const {
return layerEncoding_.layerEncodingMap(binEta, binZT, binCot);
}

private:
edm::ParameterSet iConfig_;
edm::ParameterSet oldKFPSet_;
const tt::Setup setupTT_; // Helper class to store TrackTrigger configuration
std::vector<std::pair<int, bool>>
layerIds_; // layer IDs (1~6->L1~L6;11~15->D1~D5) and whether or not they are from tracker barrel
// Only needed by Old KF
const trackerTFP::DataFormats dataFormats_;
const trackerTFP::DataFormat dfcot_;
const trackerTFP::DataFormat dfzT_;
const trackerTFP::LayerEncoding layerEncoding_;
bool hphDebug_;
bool useNewKF_;
double chosenRofZNewKF_;
std::vector<double> etaRegionsNewKF_;
double chosenRofZ_;
std::vector<double> etaRegions_;
std::map<int, std::map<int, std::vector<int>>> layermap_; // Hard-coded layermap in Old KF
int nEtaRegions_; // # of eta regions
int nKalmanLayers_; // # of maximum KF layers allowed
Expand All @@ -71,7 +88,6 @@ namespace hph {
//Class that returns decoded information from hitpattern
class HitPatternHelper {
public:
HitPatternHelper() {}
HitPatternHelper(const Setup* setup, int hitpattern, double cot, double z0);
~HitPatternHelper() {}

Expand All @@ -94,36 +110,36 @@ namespace hph {
return numMissingInterior2_;
} //The number of missing interior layers (using hitpattern, layermap from Old KF and sensor modules)
std::vector<int> binary() { return binary_; } //11-bit hitmask needed by TrackQuality.cc (0~5->L1~L6;6~10->D1~D5)
static auto smallerID(tt::SensorModule lhs, tt::SensorModule rhs) { return lhs.layerId() < rhs.layerId(); }
static auto equalID(tt::SensorModule lhs, tt::SensorModule rhs) { return lhs.layerId() == rhs.layerId(); }
std::vector<float> bonusFeatures() { return bonusFeatures_; } //bonus features for track quality

int ReducedId(
int reducedId(
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)
int findLayer(int layerId); //Search for a layer ID from sensor modules

private:
int etaSector_;
int hitpattern_;
const Setup* setup_;
bool hphDebug_;
bool useNewKF_;
std::vector<double> etaRegions_;
std::map<int, std::map<int, std::vector<int>>> layermap_;
int nKalmanLayers_;
int etaBin_;
int cotBin_;
int zTBin_;
std::vector<int> layerEncoding_;
std::map<int, const tt::SensorModule*> layerEncodingMap_;
int numExpLayer_;
int hitpattern_;
int etaSector_;
int numMissingLayer_;
int numMissingPS_;
int numMissing2S_;
int numPS_;
int num2S_;
int numMissingInterior1_;
int numMissingInterior2_;
double cot_;
double z0_;
const Setup* setup_;
std::vector<tt::SensorModule> layers_; //Sensor modules that particles are expected to hit
std::vector<int> binary_;
bool hphDebug_;
bool useNewKF_;
float chosenRofZ_;
float deltaTanL_; // Uncertainty added to tanL (cot) when layermap in new KF is determined
std::vector<double> etaRegions_;
int nKalmanLayers_;
std::map<int, std::map<int, std::vector<int>>> layermap_;
std::vector<float> bonusFeatures_;
};

} // namespace hph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
#define L1Trigger_TrackTrigger_interface_HitPatternHelperRcd_h

#include "FWCore/Framework/interface/DependentRecordImplementation.h"

#include "L1Trigger/TrackTrigger/interface/SetupRcd.h"

#include "L1Trigger/TrackerTFP/interface/DataFormatsRcd.h"
#include "L1Trigger/TrackerTFP/interface/LayerEncodingRcd.h"
#include "FWCore/Utilities/interface/mplVector.h"

namespace hph {

typedef edm::mpl::Vector<tt::SetupRcd> Rcds;
typedef edm::mpl::Vector<tt::SetupRcd, trackerTFP::DataFormatsRcd, trackerTFP::LayerEncodingRcd> Rcds;

// record of hph::SetupRcd
class SetupRcd : public edm::eventsetup::DependentRecordImplementation<SetupRcd, Rcds> {};
Expand Down
8 changes: 8 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/L1TStub.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,15 @@ namespace trklet {
std::vector<int> tps() const { return tps_; }

void setAllStubIndex(unsigned int index) { allstubindex_ = index; }
void setUniqueIndex(unsigned int index) { uniqueindex_ = index; }
void setCoords(double x, double y, double z) {
x_ = x;
y_ = y;
z_ = z;
}

unsigned int allStubIndex() const { return allstubindex_; }
unsigned int uniqueIndex() const { return uniqueindex_; }

unsigned int strip() const { return strip_; }

Expand Down Expand Up @@ -134,6 +141,7 @@ namespace trklet {
double pt_;
double bend_;
unsigned int allstubindex_;
unsigned int uniqueindex_;
unsigned int isPSmodule_;
unsigned int isFlipped_;
bool tiltedBarrel_;
Expand Down
4 changes: 4 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/MatchCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ namespace trklet {
TrackletLUT rphicut2Stable_;
TrackletLUT rcutPStable_;
TrackletLUT rcut2Stable_;
TrackletLUT alphainner_;
TrackletLUT alphaouter_;
TrackletLUT rSSinner_;
TrackletLUT rSSouter_;

int ialphafactinner_[N_DSS_MOD * 2];
int ialphafactouter_[N_DSS_MOD * 2];
Expand Down
14 changes: 7 additions & 7 deletions L1Trigger/TrackFindingTracklet/interface/MatchEngineUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,13 @@ namespace trklet {
//Various manually pipelined variables
//Each _ represents a layer of pipelining
//e.g., good__ is set and one iteration later good___ is updated
VMStubME vmstub__, vmstub___;
bool isPSseed__, isPSseed___;
bool good__, good___;
int projfinerz__, projfinerz___;
int projfinephi__, projfinephi___;
int projrinv__, projrinv___;
Tracklet *proj__, *proj___;
VMStubME vmstub__, vmstub__t, vmstub___;
bool isPSseed__, isPSseed__t, isPSseed___;
bool good__, good__t, good___;
int projfinerz__, projfinerz__t, projfinerz___;
int projfinephi__, projfinephi__t, projfinephi___;
int projrinv__, projrinv__t, projrinv___;
Tracklet *proj__, *proj__t, *proj___;

//save the candidate matches
CircularBuffer<std::pair<Tracklet*, const Stub*>> candmatches_;
Expand Down
16 changes: 16 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/MatchProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,19 @@ namespace trklet {
TrackletLUT rphicut2Stable_;
TrackletLUT rcutPStable_;
TrackletLUT rcut2Stable_;
TrackletLUT alphainner_;
TrackletLUT alphaouter_;
TrackletLUT rSSinner_;
TrackletLUT rSSouter_;

TrackletLUT diskRadius_;

int nrbits_;
int nphiderbits_;

//Number of r bits for the projection to use in LUT for disk
int nrprojbits_;

AllStubsMemory* allstubs_;
std::vector<VMStubsMEMemory*> vmstubs_;
std::vector<TrackletProjectionsMemory*> inputprojs_;
Expand All @@ -83,6 +92,13 @@ namespace trklet {
unsigned int nMatchEngines_;
std::vector<MatchEngineUnit> matchengines_;

int best_ideltaphi_barrel;
int best_ideltaz_barrel;
int best_ideltaphi_disk;
int best_ideltar_disk;
Tracklet* curr_tracklet;
Tracklet* next_tracklet;

CircularBuffer<ProjectionTemp> inputProjBuffer_;
};

Expand Down
19 changes: 18 additions & 1 deletion L1Trigger/TrackFindingTracklet/interface/PurgeDuplicate.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,24 @@ namespace trklet {
void execute(std::vector<Track>& outputtracks_, unsigned int iSector);

private:
double getPhiRes(Tracklet* curTracklet, const Stub* curStub);
double getPhiRes(Tracklet* curTracklet, const Stub* curStub) const;
bool isSeedingStub(int, int, int) const;
std::string l1tinfo(const L1TStub*, std::string) const;
std::pair<int, int> findLayerDisk(const Stub*) const;
// calculate stub coordinates based on tracklet trajectory for prompt tracking
std::vector<double> getInventedCoords(unsigned int, const Stub*, const Tracklet*) const;
// calculate stub coordinates based on tracklet trajectory for extended tracking
std::vector<double> getInventedCoordsExtended(unsigned int, const Stub*, const Tracklet*) const;
// return stub with invented x,y,z coords, if it's a seeding one for this tracklet
std::vector<const Stub*> getInventedSeedingStub(unsigned int,
const Tracklet*,
const std::vector<const Stub*>&) const;
// return the regular rinvbins which contain the input tracklet
unsigned int findVarRInvBin(const Tracklet* trk) const;
// return the overlap rinvbins which contain the input tracklet
std::vector<unsigned int> findOverlapRInvBins(const Tracklet* trk) const;
// sort the tracklets into the correct bin by comparing the overlap rinv bin(s) the tracklets are in to the current bin
bool isTrackInBin(const std::vector<unsigned int>& vec, unsigned int num) const;

std::vector<Track*> inputtracks_;
std::vector<std::vector<const Stub*>> inputstublists_;
Expand Down
3 changes: 2 additions & 1 deletion L1Trigger/TrackFindingTracklet/interface/SLHCEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ namespace trklet {
double z,
double bend,
double strip,
std::vector<int> tpstt);
std::vector<int> tpstt,
int stubindex);

const L1TStub& lastStub() const { return stubs_.back(); }

Expand Down
Loading