Skip to content

Commit

Permalink
Merge pull request #46360 from cms-L1TK/L1TK-PR-14_2_X_2024-10-10-2300
Browse files Browse the repository at this point in the history
Several improvements to L1 tracking code
  • Loading branch information
cmsbuild authored Nov 15, 2024
2 parents 20f1fce + 8c1d039 commit 72084e7
Show file tree
Hide file tree
Showing 36 changed files with 801 additions and 1,132 deletions.
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
To run the L1 tracking & create a TTree of tracking performance:
To run the L1 tracking & create a TTree of tracking performance:

cmsRun L1TrackNtupleMaker_cfg.py

Expand Down
4 changes: 4 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/ProcessBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ namespace trklet {

//This function processes the name of a TE module to determine the layerdisks and iseed
void initLayerDisksandISeed(unsigned int& layerdisk1, unsigned int& layerdisk2, unsigned int& iSeed);
void initLayerDisksandISeedDisp(unsigned int& layerdisk1,
unsigned int& layerdisk2,
unsigned int& layerdisk3,
unsigned int& iSeed);

unsigned int getISeed(const std::string& name);

Expand Down
40 changes: 35 additions & 5 deletions L1Trigger/TrackFindingTracklet/interface/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ namespace trklet {

bool extended() const { return extended_; }
void setExtended(bool extended) { extended_ = extended; }
bool duplicateMPs() const { return duplicateMPs_; }
const std::array<bool, N_LAYER + N_DISK>& layersDisksDuplicatedEqualProjBalance() const {
return layersDisksDuplicatedEqualProjBalance_;
}
const std::array<bool, N_LAYER + N_DISK>& layersDisksDuplicatedWeightedProjBalance() const {
return layersDisksDuplicatedWeightedProjBalance_;
}
bool combined() const { return combined_; }
void setCombined(bool combined) { combined_ = combined; }
bool reduced() const { return reduced_; }
Expand Down Expand Up @@ -890,6 +897,7 @@ namespace trklet {
{"TB", 108},
{"MP", 108},
{"TP", 108},
{"TPD", 108},
{"TRE", 108},
{"DR", 108}}; //Specifies how many tracks allowed per bin in DR

Expand Down Expand Up @@ -1028,11 +1036,33 @@ namespace trklet {
bool reduced_{false}; // use reduced (Summer Chain) config
bool inventStubs_{false}; // invent seeding stub coordinates based on tracklet traj

// Use combined TP (TE+TC) and MP (PR+ME+MC) configuration (with prompt tracking)
bool combined_{false};
// N.B. To use combined modules with extended tracking, edit
// Tracklet_cfi.py to refer to *_hourglassExtendedCombined.dat,
// but leave combined_=false.
// Use combined TP (TE+TC) & MP (PR+ME+MC) config (with prompt tracking)
bool combined_{true};
// N.B. For extended tracking, this combined_ is overridden by python cfg
// to false, but combined modules are nonetheless used by default.
// If you don't want them, edit l1tTTTracksFromTrackletEmulation_cfi.py
// to refer to *_hourglassExtended.dat .

// Use chain with duplicated MPs for L3,L4 to reduce truncation issue
// Balances load from projections roughly in half for each of the two MPs
bool duplicateMPs_{false};

// Determines which layers, disks the MatchProcessor is duplicated for
// (note: in TCB by default always duplicated for phi B, C as truncation is significantly worse than A, D)
// All layers, disks disabled by default, also is overwritten by above duplicateMPs bool

// EqualProjBalancing is for layers for which the projections to each duplicated MP are split in half sequentially
std::array<bool, N_LAYER + N_DISK> layersDisksDuplicatedEqualProjBalance_{
{false, false, false, false, false, false, false, false, false, false, false}};

// Weighted proj balancing is for specifically L4, L5 where the split of the projections is weighted to account for
// Higher occupancy in the L1L2 seed to minimize truncation
std::array<bool, N_LAYER + N_DISK> layersDisksDuplicatedWeightedProjBalance_{
{false, false, false, false, false, false, false, false, false, false, false}};

// Example use where for L3, L4, L5, D2, D3, the layers/disks where truncation is worst
//std::array<bool, N_LAYER + N_DISK> layersDisksDuplicatedEqualProjBalance_{{0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0}};
//std::array<bool, N_LAYER + N_DISK> layersDisksDuplicatedWeightedProjBalance_{{0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0}};

std::string skimfile_{""}; //if not empty events will be written out in ascii format to this file

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ namespace trklet {
unsigned int NSector_; //Number of sectors
double rcrit_; //critical radius that defines the sector

bool duplicateMPs_; //if true write configuration with MPs duplicated for L3,L4
bool combinedmodules_; //if true write configuration for combined modules

bool extended_; //if true write configuration for extended configuration
Expand Down
4 changes: 3 additions & 1 deletion L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace trklet {

//In the VMR we used the position of the stub (r, z) to calculate the bin and fine rz position the stub has
//region only used for name - should be removed
void initVMRTable(unsigned int layerdisk, VMRTableType type, int region = -1);
void initVMRTable(unsigned int layerdisk, VMRTableType type, int region = -1, bool combined = true);

//Used in barrel to calculate the phi position of a stub at the nominal radis of the layer based on the stub radial
//psotion and bend
Expand All @@ -116,6 +116,8 @@ namespace trklet {

unsigned int size() const { return table_.size(); }

unsigned int nbits() const { return nbits_; }

private:
const Settings& settings_;
const tt::Setup* setup_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,10 @@ namespace trklet {

private:
int iTC_;
int iAllStub_;
unsigned int maxStep_;
int count_;
unsigned int layerdisk_;

int layer1_;
int layer2_;
int layer3_;
int disk1_;
int disk2_;
int disk3_;

unsigned int layerdisk1_;
unsigned int layerdisk2_;
unsigned int layerdisk3_;

int firstphibits_;
int secondphibits_;
Expand All @@ -59,20 +52,11 @@ namespace trklet {
int nbitszfinebintable_;
int nbitsrfinebintable_;

TrackletLUT innerTable_; //projection to next layer/disk
TrackletLUT innerOverlapTable_; //projection to disk from layer
TrackletLUT innerThirdTable_; //projection to disk1 for extended - iseed=10
TrackletLUT innerTable_; //projection to next layer/disk
TrackletLUT innerThirdTable_; //projection to third disk/layer

std::vector<StubPairsMemory*> stubpairs_;
/* std::vector<StubTripletsMemory*> stubtriplets_; */
std::vector<VMStubsTEMemory*> innervmstubs_;
std::vector<VMStubsTEMemory*> outervmstubs_;

StubTripletsMemory* stubtriplets_;

std::map<std::string, std::vector<std::vector<std::string> > > tmpSPTable_;
std::map<std::string, std::vector<std::map<std::string, unsigned> > > spTable_;
std::vector<bool> table_;
};

}; // namespace trklet
Expand Down
25 changes: 20 additions & 5 deletions L1Trigger/TrackFindingTracklet/interface/VMRouterCM.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,18 @@ namespace trklet {
class VMStubsTEMemory;

struct VMStubsTEPHICM {
VMStubsTEPHICM(unsigned int seednumber_, std::vector<VMStubsTEMemory*> vmstubmem_)
: seednumber(seednumber_), vmstubmem(vmstubmem_) {}

unsigned int seednumber; //seed number [0,11]
std::vector<VMStubsTEMemory*> vmstubmem; // m_vmstubmem[n] is the VMStubsTEMemory for the nth copy
VMStubsTEPHICM(unsigned int seednumber_,
unsigned int stubposition_,
const std::vector<std::vector<VMStubsTEMemory*> >& vmstubmem_)
: seednumber(seednumber_), stubposition(stubposition_), vmstubmem(vmstubmem_) {};

unsigned int seednumber; //seed number [0,11]
unsigned int stubposition; //stub position in the seed (only used by triplet seeds)

// The first index in the following 2D vector is only used in the case of
// the triplet seeds.
std::vector<std::vector<VMStubsTEMemory*> >
vmstubmem; // m_vmstubmem[iVM][n] is the VMStubsTEMemory for iVM and the nth copy
};

class VMRouterCM : public ProcessBase {
Expand Down Expand Up @@ -57,6 +64,14 @@ namespace trklet {
TrackletLUT meTable_; //used for ME and outer TE barrel
TrackletLUT diskTable_; //outer disk used by D1, D2, and D4

// The following tables are only used to replicate the behavior of the old
// VMRouter in the case of the triplet seeds.
TrackletLUT meTableOld_; //used for ME and outer TE barrel
TrackletLUT diskTableOld_; //outer disk used by D1, D2, and D4
TrackletLUT innerTable_; //projection to next layer/disk
TrackletLUT innerOverlapTable_; //projection to disk from layer
TrackletLUT innerThirdTable_; //projection to disk1 for extended - iseed=10

//The input stub memories
std::vector<InputLinkMemory*> stubinputs_;

Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/interface/VMStubsTEMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace trklet {

void resize(int nbins) { stubsbinnedvm_.resize(nbins); }

bool addVMStub(VMStubTE vmstub, int bin);
bool addVMStub(VMStubTE vmstub, int bin, int ivmte = 0, bool combined = true);

bool addVMStub(VMStubTE vmstub);

Expand Down
19 changes: 11 additions & 8 deletions L1Trigger/TrackFindingTracklet/plugins/L1FPGATrackProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ class L1FPGATrackProducer : public edm::one::EDProducer<edm::one::WatchRuns> {
bool readMoreMcTruth_;

/// File path for configuration files
#ifndef USEHYBRID
edm::FileInPath fitPatternFile;
#endif
edm::FileInPath memoryModulesFile;
edm::FileInPath processingModulesFile;
edm::FileInPath wiresFile;
Expand Down Expand Up @@ -254,7 +256,6 @@ L1FPGATrackProducer::L1FPGATrackProducer(edm::ParameterSet const& iConfig)

asciiEventOutName_ = iConfig.getUntrackedParameter<string>("asciiFileName", "");

fitPatternFile = iConfig.getParameter<edm::FileInPath>("fitPatternFile");
processingModulesFile = iConfig.getParameter<edm::FileInPath>("processingModulesFile");
memoryModulesFile = iConfig.getParameter<edm::FileInPath>("memoryModulesFile");
wiresFile = iConfig.getParameter<edm::FileInPath>("wiresFile");
Expand Down Expand Up @@ -282,7 +283,10 @@ L1FPGATrackProducer::L1FPGATrackProducer(edm::ParameterSet const& iConfig)
settings_.setReduced(reduced_);
settings_.setNHelixPar(nHelixPar_);

#ifndef USEHYBRID
fitPatternFile = iConfig.getParameter<edm::FileInPath>("fitPatternFile");
settings_.setFitPatternFile(fitPatternFile.fullPath());
#endif
settings_.setProcessingModulesFile(processingModulesFile.fullPath());
settings_.setMemoryModulesFile(memoryModulesFile.fullPath());
settings_.setWiresFile(wiresFile.fullPath());
Expand All @@ -308,10 +312,12 @@ L1FPGATrackProducer::L1FPGATrackProducer(edm::ParameterSet const& iConfig)
}

if (settings_.debugTracklet()) {
edm::LogVerbatim("Tracklet") << "fit pattern : " << fitPatternFile.fullPath()
<< "\n process modules : " << processingModulesFile.fullPath()
<< "\n memory modules : " << memoryModulesFile.fullPath()
<< "\n wires : " << wiresFile.fullPath();
edm::LogVerbatim("Tracklet")
#ifndef USEHYBRID
<< "fit pattern : " << fitPatternFile.fullPath()
#endif
<< "\n process modules : " << processingModulesFile.fullPath()
<< "\n memory modules : " << memoryModulesFile.fullPath() << "\n wires : " << wiresFile.fullPath();
if (extended_) {
edm::LogVerbatim("Tracklet") << "table_TED : " << tableTEDFile.fullPath()
<< "\n table_TRE : " << tableTREFile.fullPath();
Expand Down Expand Up @@ -750,9 +756,6 @@ void L1FPGATrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe
// trackQualityModel_->setBonusFeatures(hph.bonusFeatures());
// }

// test track word
//aTrack.testTrackWordBits();

// set track word again to set MVA variable from TTTrack into track word
aTrack.setTrackWordBits();
// test track word
Expand Down
97 changes: 0 additions & 97 deletions L1Trigger/TrackFindingTracklet/plugins/ProducerAS.cc

This file was deleted.

Loading

0 comments on commit 72084e7

Please sign in to comment.