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

Update L1 tracking for HL-LHC (replacement of #34028) #34215

Merged
merged 21 commits into from Jul 7, 2021
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 12 additions & 14 deletions L1Trigger/TrackFindingTMTT/interface/KFTrackletTrack.h
Expand Up @@ -45,7 +45,12 @@ namespace tmtt {
unsigned int nHelixParam,
unsigned int iPhiSec,
unsigned int iEtaReg,
bool accepted = true)
bool accepted = true,
bool done_bcon = false,
float qOverPt_bcon = 0.,
float d0_bcon = 0.,
float phi0_bcon = 0.,
float chi2rphi_bcon = 0.)
: l1track3D_(l1track3D),
stubs_(stubs),
hitPattern_(hitPattern),
Expand All @@ -56,11 +61,11 @@ namespace tmtt {
tanLambda_(tanLambda),
chi2rphi_(chi2rphi),
chi2rz_(chi2rz),
done_bcon_(false),
qOverPt_bcon_(qOverPt),
d0_bcon_(d0),
phi0_bcon_(phi0),
chi2rphi_bcon_(chi2rphi),
done_bcon_(done_bcon),
qOverPt_bcon_(qOverPt_bcon),
d0_bcon_(d0_bcon),
phi0_bcon_(phi0_bcon),
chi2rphi_bcon_(chi2rphi_bcon),
nHelixParam_(nHelixParam),
iPhiSec_(iPhiSec),
iEtaReg_(iEtaReg),
Expand All @@ -70,14 +75,6 @@ namespace tmtt {
numIterations_(0),
accepted_(accepted) {}

//--- Optionally std::set track helix params & chi2 if beam-spot constraint is used (for 5-parameter fit).
void setBeamConstr(float qOverPt_bcon, float phi0_bcon, float chi2rphi_bcon) {
done_bcon_ = true;
qOverPt_bcon_ = qOverPt_bcon;
d0_bcon_ = 0.0, phi0_bcon_ = phi0_bcon;
chi2rphi_bcon_ = chi2rphi_bcon;
}

//--- Set/get additional info about fitted track that is specific to individual track fit algorithms (KF, LR, chi2)
//--- and is used for debugging/histogramming purposes.

Expand Down Expand Up @@ -131,6 +128,7 @@ namespace tmtt {
float invPt_bcon() const { return std::abs(qOverPt_bcon_); }
float pt_bcon() const { return 1. / (1.0e-6 + this->invPt_bcon()); }
float phi0_bcon() const { return phi0_bcon_; }
float d0_bcon() const { return d0_bcon_; }

// Phi and z coordinates at which track crosses "chosenR" values used by r-phi HT and rapidity sectors respectively.
// (Optionally with beam-spot constraint applied).
Expand Down
11 changes: 9 additions & 2 deletions L1Trigger/TrackFindingTMTT/interface/L1fittedTrack.h
Expand Up @@ -111,11 +111,12 @@ namespace tmtt {
~L1fittedTrack() override = default;

//--- Optionally std::set track helix params & chi2 if beam-spot constraint is used (for 5-parameter fit).
void setBeamConstr(float qOverPt_bcon, float phi0_bcon, float chi2rphi_bcon) {
void setBeamConstr(float qOverPt_bcon, float phi0_bcon, float chi2rphi_bcon, bool accepted) {
done_bcon_ = true;
qOverPt_bcon_ = qOverPt_bcon;
d0_bcon_ = 0.0, phi0_bcon_ = phi0_bcon;
chi2rphi_bcon_ = chi2rphi_bcon;
accepted_ = accepted;
}

//--- Set/get additional info about fitted track that is specific to individual track fit algorithms (KF, LR, chi2)
Expand Down Expand Up @@ -161,7 +162,12 @@ namespace tmtt {
nHelixParam(),
iPhiSec(),
iEtaReg(),
accepted());
accepted(),
done_bcon(),
qOverPt_bcon(),
d0_bcon(),
phi0_bcon(),
chi2rphi_bcon());
return trk_;
}

Expand Down Expand Up @@ -247,6 +253,7 @@ namespace tmtt {
return 1. / (small + this->invPt_bcon());
}
float phi0_bcon() const { return phi0_bcon_; }
float d0_bcon() const { return d0_bcon_; }

// Phi and z coordinates at which track crosses "chosenR" values used by r-phi HT and rapidity sectors respectively.
// (Optionally with beam-spot constraint applied).
Expand Down
10 changes: 9 additions & 1 deletion L1Trigger/TrackFindingTMTT/src/KFbase.cc
Expand Up @@ -102,7 +102,15 @@ namespace tmtt {
if (nHelixPar_ == 5) {
double chi2rphi_bcon = 0.;
TVectorD trackPars_bcon = trackParams_BeamConstr(cand, chi2rphi_bcon);
fitTrk.setBeamConstr(trackPars_bcon[QOVERPT], trackPars_bcon[PHI0], chi2rphi_bcon);

// Check scaled chi2 cut
vector<double> kfLayerVsChiSqCut = settings_->kfLayerVsChiSq5();
double chi2scaled = chi2rphi_bcon / settings_->kalmanChi2RphiScale() + fitTrk.chi2rz();
bool accepted = true;
if (chi2scaled > kfLayerVsChiSqCut[cand->nStubLayers()])
accepted = false;

fitTrk.setBeamConstr(trackPars_bcon[QOVERPT], trackPars_bcon[PHI0], chi2rphi_bcon, accepted);
}
}

Expand Down
1 change: 1 addition & 0 deletions L1Trigger/TrackFindingTMTT/src/Settings.cc
Expand Up @@ -42,6 +42,7 @@ namespace tmtt {
//kalmanDebugLevel_(2), // Good for debugging
kalmanMinNumStubs_(4),
kalmanMaxNumStubs_(6),
kalmanAddBeamConstr_(false), // Apply post-fit beam-spot constraint to 5-param fit
kalmanRemove2PScut_(true),
kalmanMaxSkipLayersHard_(1), // On "hard" input tracks
kalmanMaxSkipLayersEasy_(2), // On "easy" input tracks
Expand Down
37 changes: 37 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/AllInnerStubsMemory.h
@@ -0,0 +1,37 @@
#ifndef L1Trigger_TrackFindingTracklet_interface_AllInnerStubsMemory_h
#define L1Trigger_TrackFindingTracklet_interface_AllInnerStubsMemory_h

#include "L1Trigger/TrackFindingTracklet/interface/MemoryBase.h"

#include <utility>
#include <string>
#include <vector>

namespace trklet {

class Settings;
class Stub;
class L1TStub;

class AllInnerStubsMemory : public MemoryBase {
public:
AllInnerStubsMemory(std::string name, Settings const& settings);

~AllInnerStubsMemory() override = default;

void addStub(const Stub* stub) { stubs_.push_back(stub); }

unsigned int nStubs() const { return stubs_.size(); }

const Stub* getStub(unsigned int i) const { return stubs_[i]; }

void clean() override { stubs_.clear(); }

void writeStubs(bool first, unsigned int iSector);

private:
std::vector<const Stub*> stubs_;
};

}; // namespace trklet
#endif
Expand Up @@ -13,7 +13,7 @@ namespace trklet {

class AllProjectionsMemory : public MemoryBase {
public:
AllProjectionsMemory(std::string name, Settings const& settings, unsigned int iSector);
AllProjectionsMemory(std::string name, Settings const& settings);

~AllProjectionsMemory() override = default;

Expand All @@ -25,7 +25,7 @@ namespace trklet {

void clean() override { tracklets_.clear(); }

void writeAP(bool first);
void writeAP(bool first, unsigned int iSector);

private:
std::vector<Tracklet*> tracklets_;
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/TrackFindingTracklet/interface/AllStubsMemory.h
Expand Up @@ -15,7 +15,7 @@ namespace trklet {

class AllStubsMemory : public MemoryBase {
public:
AllStubsMemory(std::string name, Settings const& settings, unsigned int iSector);
AllStubsMemory(std::string name, Settings const& settings);

~AllStubsMemory() override = default;

Expand All @@ -27,7 +27,7 @@ namespace trklet {

void clean() override { stubs_.clear(); }

void writeStubs(bool first);
void writeStubs(bool first, unsigned int iSector);

private:
std::vector<const Stub*> stubs_;
Expand Down
39 changes: 0 additions & 39 deletions L1Trigger/TrackFindingTracklet/interface/Cabling.h

This file was deleted.

Expand Up @@ -16,7 +16,7 @@ namespace trklet {

class CandidateMatchMemory : public MemoryBase {
public:
CandidateMatchMemory(std::string name, Settings const& settings, unsigned int iSector);
CandidateMatchMemory(std::string name, Settings const& settings);

~CandidateMatchMemory() override = default;

Expand All @@ -28,7 +28,7 @@ namespace trklet {

void clean() override { matches_.clear(); }

void writeCM(bool first);
void writeCM(bool first, unsigned int iSector);

private:
std::vector<std::pair<std::pair<Tracklet*, int>, const Stub*> > matches_;
Expand Down
10 changes: 10 additions & 0 deletions L1Trigger/TrackFindingTracklet/interface/CircularBuffer.h
Expand Up @@ -28,6 +28,11 @@ namespace trklet {
//Almost full if writer ptr incremented by 1 or 2 is same as read ptr
bool almostfull() const { return (((wptr_ + 1) % size_) == rptr_) || (((wptr_ + 2) % size_) == rptr_); }

//near full if writer ptr incremented by 1, 2, or 3 is same as read ptr
bool nearfull() const {
return (((wptr_ + 1) % size_) == rptr_) || (((wptr_ + 2) % size_) == rptr_) || (((wptr_ + 3) % size_) == rptr_);
}

//Empty buffer is write ptr is same as read ptr
bool empty() const { return wptr_ == rptr_; }

Expand All @@ -47,8 +52,13 @@ namespace trklet {
assert(!full());
buffer_[wptr_++] = element;
wptr_ = wptr_ % size_;
assert(wptr_ != rptr_);
}

//these are needed for comparison of emulation with HLS FW
unsigned int rptr() const { return rptr_; }
unsigned int wptr() const { return wptr_; }

private:
std::vector<T> buffer_;

Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/TrackFindingTracklet/interface/CleanTrackMemory.h
Expand Up @@ -12,7 +12,7 @@ namespace trklet {

class CleanTrackMemory : public MemoryBase {
public:
CleanTrackMemory(std::string name, Settings const& settings, unsigned int iSector, double phimin, double phimax);
CleanTrackMemory(std::string name, Settings const& settings, double phimin, double phimax);

~CleanTrackMemory() override = default;

Expand All @@ -22,7 +22,7 @@ namespace trklet {

void clean() override { tracks_.clear(); }

void writeCT(bool first);
void writeCT(bool first, unsigned int iSector);

private:
double phimin_;
Expand Down
46 changes: 0 additions & 46 deletions L1Trigger/TrackFindingTracklet/interface/DTC.h

This file was deleted.

34 changes: 0 additions & 34 deletions L1Trigger/TrackFindingTracklet/interface/DTCLink.h

This file was deleted.