Skip to content

Commit

Permalink
Cleanup of LUTs (#79)
Browse files Browse the repository at this point in the history
* Fix to compiler warning and removal of hardoded value in MatchCalculator

* Updates to fix names of pins to make unique

* Migrate to new format of table for phi correction memory

* Remove unused TETableBase class

* Cleanup of VMRouterTable

* Cleanup of LUT for bend consistency

* Cleanup of LUT used in MEU for bend consistency

* Cleanup code for disk bend table

* cleanup of code to generate table used by TE

* Cleanup of TP LUTs

* Cleanup of LUTs for MatchCalculator cuts

* Fix names of new LUT when writing to files

* Cleanup of writing LUTs for the combined modules

* Add code to write projection bend table for disk projections

* More cleanup to remove hard coded layer and seed numbers

* Cleanup of hardcoded numbers

* Remove few more hardcoded constants:

* Some further cleanup based on comments from Louise S.

Co-authored-by: Anders Ryd <ryd@Anderss-MacBook-Pro.local>
Co-authored-by: Louise Skinnari <louise.skinnari@cern.ch>
  • Loading branch information
3 people committed Jun 22, 2021
1 parent 62c7863 commit 70ea106
Show file tree
Hide file tree
Showing 44 changed files with 1,449 additions and 1,612 deletions.
12 changes: 3 additions & 9 deletions L1Trigger/TrackFindingTracklet/interface/Globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@

namespace trklet {

class TETableBase;
class TrackDerTable;
class ProjectionRouterBendTable;
class SLHCEvent;
class HistBase;
class Settings;
class VMRouterPhiCorrTable;
class TrackletLUT;
struct imathGlobals;
class IMATH_TrackletCalculator;
class IMATH_TrackletCalculatorDisk;
Expand All @@ -41,9 +39,7 @@ namespace trklet {

TrackDerTable*& trackDerTable() { return trackDerTable_; }

VMRouterPhiCorrTable*& phiCorr(unsigned int layer) { return thePhiCorr_[layer]; }

ProjectionRouterBendTable*& projectionRouterBendTable() { return projectionRouterBendTable_; }
TrackletLUT*& phiCorr(unsigned int layer) { return thePhiCorr_[layer]; }

std::map<std::string, std::vector<int> >& ILindex() { return ILindex_; }

Expand Down Expand Up @@ -98,14 +94,12 @@ namespace trklet {

TrackDerTable* trackDerTable_{nullptr};

ProjectionRouterBendTable* projectionRouterBendTable_{nullptr};

#ifdef USEHYBRID
std::unique_ptr<tmtt::Settings> tmttSettings_;
std::unique_ptr<tmtt::KFParamsComb> tmttKFParamsComb_;
#endif

std::array<VMRouterPhiCorrTable*, 6> thePhiCorr_{{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}};
std::array<TrackletLUT*, 6> thePhiCorr_{{nullptr, nullptr, nullptr, nullptr, nullptr, nullptr}};

std::map<std::string, std::vector<int> > ILindex_;

Expand Down
2 changes: 0 additions & 2 deletions L1Trigger/TrackFindingTracklet/interface/InputLinkMemory.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ namespace trklet {
class Settings;
class Globals;
class Stub;
class L1TStub;
class VMRouterPhiCorrTable;

class InputLinkMemory : public MemoryBase {
public:
Expand Down
16 changes: 9 additions & 7 deletions L1Trigger/TrackFindingTracklet/interface/MatchCalculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include "L1Trigger/TrackFindingTracklet/interface/ProcessBase.h"
#include "L1Trigger/TrackFindingTracklet/interface/Settings.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h"

#include <string>
#include <vector>
Expand Down Expand Up @@ -41,13 +42,14 @@ namespace trklet {
int icorzshift_;
int phi0shift_;

unsigned int phimatchcut_[N_SEED];
unsigned int zmatchcut_[N_SEED];
unsigned int rphicutPS_[N_SEED];
unsigned int rphicut2S_[N_SEED];
unsigned int rcutPS_[N_SEED];
unsigned int rcut2S_[N_SEED];

TrackletLUT phimatchcuttable_;
TrackletLUT zmatchcuttable_;

TrackletLUT rphicutPStable_;
TrackletLUT rphicut2Stable_;
TrackletLUT rcutPStable_;
TrackletLUT rcut2Stable_;

int ialphafactinner_[N_DSS_MOD * 2];
int ialphafactouter_[N_DSS_MOD * 2];

Expand Down
13 changes: 4 additions & 9 deletions L1Trigger/TrackFindingTracklet/interface/MatchEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define L1Trigger_TrackFindingTracklet_interface_MatchEngine_h

#include "L1Trigger/TrackFindingTracklet/interface/ProcessBase.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h"
#include <vector>

namespace trklet {
Expand Down Expand Up @@ -33,18 +34,12 @@ namespace trklet {
unsigned int layerdisk_;

bool barrel_;
int nvm_;
int nvmbits_;

unsigned int nfinephibits_; //number of fine phi bits in phi VM bin
unsigned int nrinv_; //number of bits for rinv in stub bend LUT

//used in the layers
std::vector<bool> table_;

//used in the disks
std::vector<bool> tablePS_;
std::vector<bool> table2S_;
//LUT for bend consistency
TrackletLUT luttable_;

};

}; // namespace trklet
Expand Down
10 changes: 6 additions & 4 deletions L1Trigger/TrackFindingTracklet/interface/MatchEngineUnit.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ namespace trklet {
class Settings;
class Stub;
class L1TStub;

class TrackletLUT;

class MatchEngineUnit {
public:
MatchEngineUnit(bool barrel, unsigned int layerdisk, std::vector<bool> table);
MatchEngineUnit(bool barrel, unsigned int layerdisk, const TrackletLUT& luttable);

~MatchEngineUnit() = default;

Expand Down Expand Up @@ -72,9 +73,10 @@ namespace trklet {
bool idle_;

unsigned int layerdisk_;

//LUT for bend consistency with rinv
const TrackletLUT& luttable_;

//used for bend consistency with rinv
std::vector<bool> table_;

//save the candidate matches
CircularBuffer<std::pair<Tracklet*, const Stub*>> candmatches_;
Expand Down
22 changes: 13 additions & 9 deletions L1Trigger/TrackFindingTracklet/interface/MatchProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "L1Trigger/TrackFindingTracklet/interface/TrackletProjectionsMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/VMStubsMEMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/AllStubsMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h"

#include <vector>

Expand Down Expand Up @@ -50,14 +51,14 @@ namespace trklet {
int icorzshift_;
int phishift_;

unsigned int phimatchcut_[N_SEED];
unsigned int zmatchcut_[N_SEED];

unsigned int rphicutPS_[N_SEED];
unsigned int rphicut2S_[N_SEED];
unsigned int rcutPS_[N_SEED];
unsigned int rcut2S_[N_SEED];
TrackletLUT phimatchcuttable_;
TrackletLUT zmatchcuttable_;

TrackletLUT rphicutPStable_;
TrackletLUT rphicut2Stable_;
TrackletLUT rcutPStable_;
TrackletLUT rcut2Stable_;

int nrbits_;
int nphiderbits_;

Expand All @@ -71,9 +72,12 @@ namespace trklet {
//Memory for the full matches
std::vector<FullMatchMemory*> fullmatches_;

//used for bend consistency with rinv
std::vector<bool> table_;
//disk projectionrinv table
TrackletLUT rinvbendlut_;

//LUT for bend consistency
TrackletLUT luttable_;

double phimin_;

unsigned int nMatchEngines_;
Expand Down
5 changes: 4 additions & 1 deletion L1Trigger/TrackFindingTracklet/interface/ProjectionRouter.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define L1Trigger_TrackFindingTracklet_interface_ProjectionRouter_h

#include "L1Trigger/TrackFindingTracklet/interface/ProcessBase.h"
#include "L1Trigger/TrackFindingTracklet/interface/ProjectionRouterBendTable.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletProjectionsMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/AllProjectionsMemory.h"
#include "L1Trigger/TrackFindingTracklet/interface/VMProjectionsMemory.h"
Expand All @@ -29,6 +29,9 @@ namespace trklet {

int nrbits_;
int nphiderbits_;

//disk projectionrinv table
TrackletLUT rinvbendlut_;

std::vector<TrackletProjectionsMemory*> inputproj_;

Expand Down

This file was deleted.

6 changes: 5 additions & 1 deletion L1Trigger/TrackFindingTracklet/interface/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace trklet {
constexpr unsigned int NFINERZBITS = 3; //number of bit for r or z within a r/z bin
constexpr unsigned int NFINEPHIBITS = 3; //number of bits for phi within a vm bin
constexpr unsigned int N_RZBITS = 3; //number of bit for the r/z bins
constexpr unsigned int N_PHIBITS = 3; //number of bit for the phi bins

constexpr unsigned int N_VMSTUBSMAX = 15; // maximum number of stubs in VM bin
constexpr unsigned int N_BITSMEMADDRESS = 7; // Number of bits for address in memories
Expand All @@ -44,7 +45,10 @@ namespace trklet {
constexpr double VMROUTERCUTZL1L3L5 = 95.0; //Max z for inner barrel layers
constexpr double VMROUTERCUTZL1 = 70.0; //Max z for L1 barrel seeding
constexpr double VMROUTERCUTRD1D3 = 55.0; //Max r for disk seeds


enum Seed { L1L2 = 0, L2L3, L3L4, L5L6, D1D2, D3D4, L1D1, L2D1, L2L3L4, L4L5L6, L2L3D1, D1D2L2 };
enum LayerDisk { L1 = 0, L2, L3, L4, L5, L6, D1, D2, D3, D4, D5 };

class Settings {
public:
Settings() {
Expand Down
34 changes: 0 additions & 34 deletions L1Trigger/TrackFindingTracklet/interface/TETableBase.h

This file was deleted.

58 changes: 30 additions & 28 deletions L1Trigger/TrackFindingTracklet/interface/TrackletConfigBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,36 @@ namespace trklet {
//This method writes out the configuration as files
void writeAll(std::ostream& wires, std::ostream& memories, std::ostream& modules);

//
// The next group of fcn formats a string to write out names of different
// memories and processing modules
//

//Seed string, eg. L1L2
std::string iSeedStr(unsigned int iSeed);

//Return unsigned as string
static std::string numStr(unsigned int i);

//Retunr iTC as string - ie A, B, C, etc
std::string iTCStr(unsigned int iTC);

//The region string A, B, C etc for layers and disks; X, Y, Z etc for overlap
std::string iRegStr(unsigned int iReg, unsigned int iSeed);

//TC Name
std::string TCName(unsigned int iSeed, unsigned int iTC);

//Name of layer or disk, e.g. L1 or D1
static std::string LayerName(unsigned int ilayer);

//Tracklet projection name
std::string TPROJName(unsigned int iSeed, unsigned int iTC, unsigned int ilayer, unsigned int ireg);

//Projection router name
std::string PRName(unsigned int ilayer, unsigned int ireg);


private:
//
// Method to initialize the regions and VM in each layer
Expand Down Expand Up @@ -77,34 +107,6 @@ namespace trklet {
//
double rinv(double r1, double phi1, double r2, double phi2);

//
// The next group of fcn formats a string to write out names of different
// memories and processing modules
//

//Seed string, eg. L1L2
std::string iSeedStr(unsigned int iSeed);

//Return unsigned as string
std::string numStr(unsigned int i);

//Retunr iTC as string - ie A, B, C, etc
std::string iTCStr(unsigned int iTC);

//The region string A, B, C etc for layers and disks; X, Y, Z etc for overlap
std::string iRegStr(unsigned int iReg, unsigned int iSeed);

//TC Name
std::string TCName(unsigned int iSeed, unsigned int iTC);

//Name of layer or disk, e.g. L1 or D1
std::string LayerName(unsigned int ilayer);

//Tracklet projection name
std::string TPROJName(unsigned int iSeed, unsigned int iTC, unsigned int ilayer, unsigned int ireg);

//Projection router name
std::string PRName(unsigned int ilayer, unsigned int ireg);

//StubPair Name
std::string SPName(unsigned int l1,
Expand Down
7 changes: 3 additions & 4 deletions L1Trigger/TrackFindingTracklet/interface/TrackletEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define L1Trigger_TrackFindingTracklet_interface_TrackletEngine_h

#include "L1Trigger/TrackFindingTracklet/interface/ProcessBase.h"
#include "L1Trigger/TrackFindingTracklet/interface/TrackletLUT.h"

#include <vector>
#include <string>
Expand All @@ -27,8 +28,6 @@ namespace trklet {

void setVMPhiBin();

void writeTETable();

private:
//Which seed type and which layer/disk is used
unsigned int iSeed_;
Expand All @@ -43,8 +42,8 @@ namespace trklet {
StubPairsMemory* stubpairs_;

//The stub pt (bend) lookup table for the inner and outer stub
std::vector<bool> pttableinner_;
std::vector<bool> pttableouter_;
TrackletLUT innerptlut_;
TrackletLUT outerptlut_;

//Number of phi bits used in the lookup table
unsigned int innerphibits_;
Expand Down
Loading

0 comments on commit 70ea106

Please sign in to comment.