diff --git a/DataFormats/L1DTTrackFinder/BuildFile.xml b/DataFormats/L1DTTrackFinder/BuildFile.xml
index bd2a1d535a5e3..54b1c2a65f97d 100644
--- a/DataFormats/L1DTTrackFinder/BuildFile.xml
+++ b/DataFormats/L1DTTrackFinder/BuildFile.xml
@@ -3,4 +3,5 @@
+
diff --git a/DataFormats/L1TMuonPhase2/interface/KMTFTrack.h b/DataFormats/L1TMuonPhase2/interface/KMTFTrack.h
index 7e6197eea6d9e..a414b3458e169 100644
--- a/DataFormats/L1TMuonPhase2/interface/KMTFTrack.h
+++ b/DataFormats/L1TMuonPhase2/interface/KMTFTrack.h
@@ -10,30 +10,40 @@ namespace l1t {
class KMTFTrack;
typedef std::vector KMTFTrackCollection;
typedef BXVector KMTFTrackBxCollection;
+ typedef math::Error<5>::type CovarianceMatrix5dim;
+ typedef math::Error<2>::type CovarianceMatrix2dim;
class KMTFTrack : public reco::LeafCandidate {
public:
KMTFTrack()
: reco::LeafCandidate(-1, reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)),
unconstrainedP4_(reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)),
- covariance_(std::vector(6, 0.0)),
+ covariance_(std::vector(15, 0.0)),
+ covarianceNB_(std::vector(3, 0.0)),
curvVertex_(0),
ptC_(0),
phiVertex_(0),
dxy_(0),
+ zVertex_(0),
+ kSlopeVertex_(0),
curvMuon_(0),
ptU_(0),
phiMuon_(0),
phiBMuon_(0),
+ zMuon_(0),
+ kSlopeMuon_(0),
curv_(0),
phi_(0),
phiB_(0),
+ z_(0),
+ kSlope_(0),
coarseEta_(0),
approxPromptChi2_(0),
approxPromptErrChi2_(0),
approxDispChi2_(0),
approxDispErrChi2_(0),
hitPattern_(0),
+ thetaDigiPattern_(0),
step_(1),
sector_(0),
wheel_(0),
@@ -46,27 +56,35 @@ namespace l1t {
~KMTFTrack() override = default;
- KMTFTrack(const l1t::MuonStubRef& seed, int phi, int phiB)
+ KMTFTrack(const l1t::MuonStubRef& seed, int phi, int phiB, int z, int kSlope)
: reco::LeafCandidate(-1, reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)),
unconstrainedP4_(reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)),
- covariance_(std::vector(6, 0.0)),
+ covariance_(std::vector(15, 0.0)),
+ covarianceNB_(std::vector(3, 0.0)),
curvVertex_(0),
ptC_(0),
phiVertex_(0),
dxy_(0),
+ zVertex_(0),
+ kSlopeVertex_(0),
curvMuon_(0),
ptU_(0),
phiMuon_(0),
phiBMuon_(0),
+ zMuon_(0),
+ kSlopeMuon_(0),
curv_(0),
phi_(phi),
phiB_(phiB),
+ z_(z),
+ kSlope_(kSlope),
coarseEta_(0),
approxPromptChi2_(0),
approxPromptErrChi2_(0),
approxDispChi2_(0),
approxDispErrChi2_(0),
hitPattern_(0),
+ thetaDigiPattern_(0),
step_(seed->depthRegion()),
sector_(seed->phiRegion()),
wheel_(seed->etaRegion()),
@@ -80,6 +98,7 @@ namespace l1t {
residuals_.push_back(0);
residuals_.push_back(0);
residuals_.push_back(0);
+ residuals_.push_back(0);
}
reco::LeafCandidate::PolarLorentzVector displacedP4() const { return unconstrainedP4_; }
@@ -92,6 +111,10 @@ namespace l1t {
int phiAtMuon() const { return phiMuon_; }
//unconstrained phiB at station 1
int phiBAtMuon() const { return phiBMuon_; }
+ //unconstrained z at station 1
+ int zAtMuon() const { return zMuon_; }
+ //unconstrained kSLope at station 1
+ int kSlopeAtMuon() const { return kSlopeMuon_; }
//constrained pt
int ptPrompt() const { return ptC_; }
@@ -99,6 +122,10 @@ namespace l1t {
int curvatureAtVertex() const { return curvVertex_; }
//constrained phi at the vertex
int phiAtVertex() const { return phiVertex_; }
+ //constrained z at the vertex
+ int zAtVertex() const { return zVertex_; }
+ //constrained kSlope at the vertex
+ int kSlopeAtVertex() const { return kSlopeVertex_; }
//Impact parameter as calculated from the muon track
int dxy() const { return dxy_; }
//Unconstrained curvature at the Muon systen
@@ -107,6 +134,10 @@ namespace l1t {
int positionAngle() const { return phi_; }
//Unconstrained bending angle at the Muon systen
int bendingAngle() const { return phiB_; }
+
+ //global z and slope of stub
+ int zPosition() const { return z_; }
+ int kSlope() const { return kSlope_; }
//Coarse eta caluclated only using phi segments
int coarseEta() const { return coarseEta_; }
//Approximate Chi2 metrics
@@ -116,6 +147,7 @@ namespace l1t {
int approxDispErrChi2() const { return approxDispErrChi2_; }
int hitPattern() const { return hitPattern_; }
+ int thetaDigiPattern() const { return thetaDigiPattern_; }
//step;
int step() const { return step_; }
//sector;
@@ -156,8 +188,37 @@ namespace l1t {
return kalmanGain0_;
}
+ const std::vector& ThetaGain1D(unsigned int step) const {
+ switch (step) {
+ case 3:
+ return ThetaGain1D3_;
+ case 2:
+ return ThetaGain1D2_;
+ case 1:
+ return ThetaGain1D1_;
+ case 0:
+ return ThetaGain1D0_;
+ }
+ return ThetaGain1D0_;
+ }
+
+ const std::vector& ThetaGain(unsigned int step) const {
+ switch (step) {
+ case 3:
+ return ThetaGain3_;
+ case 2:
+ return ThetaGain2_;
+ case 1:
+ return ThetaGain1_;
+ case 0:
+ return ThetaGain0_;
+ }
+ return ThetaGain0_;
+ }
+
//get covariance
const std::vector& covariance() const { return covariance_; }
+ const std::vector& covarianceNB() const { return covarianceNB_; }
//get residual
int residual(uint i) const { return residuals_[i]; }
@@ -188,23 +249,29 @@ namespace l1t {
}
//Set coordinates general
- void setCoordinates(int step, int curv, int phi, int phiB) {
+ void setCoordinates(int step, int curv, int phi, int phiB, int z, int kSlope) {
step_ = step;
curv_ = curv;
phiB_ = phiB;
phi_ = phi;
+ z_ = z;
+ kSlope_ = kSlope;
}
- void setCoordinatesAtVertex(int curv, int phi, int dxy) {
+ void setCoordinatesAtVertex(int curv, int phi, int dxy, int z, int kSlope) {
curvVertex_ = curv;
phiVertex_ = phi;
dxy_ = dxy;
+ zVertex_ = z;
+ kSlopeVertex_ = kSlope;
}
- void setCoordinatesAtMuon(int curv, int phi, int phiB) {
+ void setCoordinatesAtMuon(int curv, int phi, int phiB, int z, int kSlope) {
curvMuon_ = curv;
phiMuon_ = phi;
phiBMuon_ = phiB;
+ zMuon_ = z;
+ kSlopeMuon_ = kSlope;
}
void setPt(int ptC, int ptU) {
@@ -215,6 +282,7 @@ namespace l1t {
void setCoarseEta(int eta) { coarseEta_ = eta; }
void setHitPattern(int pattern) { hitPattern_ = pattern; }
+ void setThetaDigiPattern(int theta_pattern) { thetaDigiPattern_ = theta_pattern; }
void setApproxChi2(int chi, int chiErr, bool prompt) {
if (prompt) {
@@ -305,14 +373,101 @@ namespace l1t {
}
}
+ void setThetaGain1D(unsigned int step,
+ unsigned int K,
+ int priorThetaPattern,
+ int seedStation,
+ int priorPhiPattern,
+ float G31,
+ float G32,
+ float G41,
+ float G42) {
+ std::vector* v1 = nullptr;
+ switch (step) {
+ case 3:
+ v1 = &ThetaGain1D3_;
+ break;
+ case 2:
+ v1 = &ThetaGain1D2_;
+ break;
+ case 1:
+ v1 = &ThetaGain1D1_;
+ break;
+ case 0:
+ v1 = &ThetaGain1D0_;
+ break;
+ default:
+ throw cms::Exception("WrongCondition") << "1D: Critical ERROR on setting the Theta gain\n";
+ }
+ v1->push_back(static_cast(K));
+ v1->push_back(static_cast(priorThetaPattern));
+ v1->push_back(static_cast(seedStation));
+ v1->push_back(static_cast(priorPhiPattern));
+ v1->push_back(G31);
+ v1->push_back(G32);
+ v1->push_back(G41);
+ v1->push_back(G42);
+ }
+
+ void setThetaGain(unsigned int step,
+ unsigned int K,
+ int priorThetaPattern,
+ int seedStation,
+ int priorPhiPattern,
+ float G32,
+ float G33,
+ float G42,
+ float G43) {
+ std::vector* v2 = nullptr;
+ switch (step) {
+ case 3:
+ v2 = &ThetaGain3_;
+ break;
+ case 2:
+ v2 = &ThetaGain2_;
+ break;
+ case 1:
+ v2 = &ThetaGain1_;
+ break;
+ case 0:
+ v2 = &ThetaGain0_;
+ break;
+ default:
+ throw cms::Exception("WrongCondition") << "Critical ERROR on setting the Theta gain\n";
+ }
+ v2->push_back(static_cast(K));
+ v2->push_back(static_cast(priorThetaPattern));
+ v2->push_back(static_cast(seedStation));
+ v2->push_back(static_cast(priorPhiPattern));
+ v2->push_back(G32);
+ v2->push_back(G33);
+ v2->push_back(G42);
+ v2->push_back(G43);
+ }
+
//set covariance
- void setCovariance(const CovarianceMatrix& c) {
+ void setCovariance(const CovarianceMatrix5dim& c) {
covariance_[0] = c(0, 0);
covariance_[1] = c(0, 1);
covariance_[2] = c(1, 1);
covariance_[3] = c(0, 2);
covariance_[4] = c(1, 2);
covariance_[5] = c(2, 2);
+ covariance_[6] = c(0, 3);
+ covariance_[7] = c(1, 3);
+ covariance_[8] = c(2, 3);
+ covariance_[9] = c(3, 3);
+ covariance_[10] = c(0, 4);
+ covariance_[11] = c(1, 4);
+ covariance_[12] = c(2, 4);
+ covariance_[13] = c(3, 4);
+ covariance_[14] = c(4, 4);
+ }
+
+ void setCovarianceNB(const CovarianceMatrix2dim& c) {
+ covarianceNB_[0] = c(0, 0);
+ covarianceNB_[1] = c(0, 1);
+ covarianceNB_[2] = c(1, 1);
}
//set fine eta
@@ -329,6 +484,7 @@ namespace l1t {
//Covariance matrix for studies
std::vector covariance_;
+ std::vector covarianceNB_;
l1t::MuonStubRefVector stubs_;
//vertex coordinates
@@ -336,17 +492,23 @@ namespace l1t {
int ptC_;
int phiVertex_;
int dxy_;
+ int zVertex_;
+ int kSlopeVertex_;
//muon coordinates
int curvMuon_;
int ptU_;
int phiMuon_;
int phiBMuon_;
+ int zMuon_;
+ int kSlopeMuon_;
//generic coordinates
int curv_;
int phi_;
int phiB_;
+ int z_;
+ int kSlope_;
//common coordinates
int coarseEta_;
@@ -358,6 +520,8 @@ namespace l1t {
//phi bitmask
int hitPattern_;
+ //bitmask pattern based on theta digi presence
+ int thetaDigiPattern_;
//propagation step
int step_;
@@ -393,6 +557,16 @@ namespace l1t {
std::vector kalmanGain3_;
std::vector residuals_;
+
+ std::vector ThetaGain1D0_;
+ std::vector ThetaGain1D1_;
+ std::vector ThetaGain1D2_;
+ std::vector ThetaGain1D3_;
+
+ std::vector ThetaGain0_;
+ std::vector ThetaGain1_;
+ std::vector ThetaGain2_;
+ std::vector ThetaGain3_;
};
} // namespace l1t
diff --git a/DataFormats/L1TMuonPhase2/src/classes_def.xml b/DataFormats/L1TMuonPhase2/src/classes_def.xml
index 4c34f5483adcf..45b0a62ee6246 100644
--- a/DataFormats/L1TMuonPhase2/src/classes_def.xml
+++ b/DataFormats/L1TMuonPhase2/src/classes_def.xml
@@ -22,7 +22,8 @@
-
+
+
diff --git a/L1Trigger/Phase2L1GMT/interface/KMTFCore.h b/L1Trigger/Phase2L1GMT/interface/KMTFCore.h
index 19291d1f53031..99cb6553f3522 100644
--- a/L1Trigger/Phase2L1GMT/interface/KMTFCore.h
+++ b/L1Trigger/Phase2L1GMT/interface/KMTFCore.h
@@ -2,6 +2,8 @@
Kalman Filter L1 Muon algorithm
Tyler Lam (UCLA)
Sep. 2021
+Delano Campos (UCLA)
+Feb. 2026
*/
#ifndef L1Trigger_Phase2L1GMT_KMTFCore_h
#define L1Trigger_Phase2L1GMT_KMTFCore_h
@@ -16,12 +18,25 @@ namespace Phase2L1GMT {
class KMTFCore {
public:
typedef ROOT::Math::SVector Vector2;
+ typedef ROOT::Math::SVector Vector3;
+ typedef ROOT::Math::SVector Vector4;
typedef ROOT::Math::SMatrix > CovarianceMatrix2;
+ typedef ROOT::Math::SMatrix > CovarianceMatrix3;
+ typedef ROOT::Math::SMatrix > CovarianceMatrix4;
typedef ROOT::Math::SMatrix Matrix32;
+ typedef ROOT::Math::SMatrix Matrix53;
typedef ROOT::Math::SMatrix Matrix23;
+ typedef ROOT::Math::SMatrix Matrix45;
+ typedef ROOT::Math::SMatrix Matrix54;
typedef ROOT::Math::SMatrix Matrix13;
+ typedef ROOT::Math::SMatrix Matrix35;
typedef ROOT::Math::SMatrix Matrix31;
typedef ROOT::Math::SMatrix Matrix33;
+ typedef ROOT::Math::SMatrix Matrix55;
+ typedef ROOT::Math::SMatrix Matrix15;
+ typedef ROOT::Math::SMatrix Matrix51;
+ typedef ROOT::Math::SMatrix Matrix52;
+ typedef ROOT::Math::SMatrix Matrix25;
KMTFCore(const edm::ParameterSet& settings);
@@ -44,12 +59,14 @@ namespace Phase2L1GMT {
void vertexConstraintOffline(l1t::KMTFTrack& track);
void vertexConstraintLUT(l1t::KMTFTrack& track);
int hitPattern(const l1t::KMTFTrack& track);
+ int thetaDigiPattern(const l1t::KMTFTrack& track);
int customBitmask(unsigned int bit1, unsigned int bit2, unsigned int bit3, unsigned int bit4);
bool getBit(int bitmask, int pos);
void setFourVectors(l1t::KMTFTrack& track);
bool estimateChiSquare(l1t::KMTFTrack& track, bool vertex);
void setRank(l1t::KMTFTrack& track, bool vertex);
int wrapAround(int value, int maximum);
+ int satKSlope(int k);
int encode(bool ownwheel, int sector, int tag);
std::pair getByCode(const std::vector& tracks, int mask);
uint twosCompToBits(int q);
@@ -115,9 +132,13 @@ namespace Phase2L1GMT {
//bits for fixed point precision
static const int PHIBSCALE = 16;
static const int PHIBSCALE_INT = 5;
+ static const int ZDELTAR_BITS = 14;
+ static const int ZDELTAR_BITSINT = 1;
static const int BITSCURV = 16;
static const int BITSPHI = 18;
static const int BITSPHIB = 17; // 12 bits *28 (+5 bits)
+ static const int BITSZ = 16;
+ static const int BITSKSLOPE = 16;
static const int BITSPARAM = 14;
static const int GAIN_0 = 9;
static const int GAIN_0INT = 6;
@@ -134,12 +155,26 @@ namespace Phase2L1GMT {
static const int GAIN2_4INT = 4;
static const int GAIN2_5 = 12;
static const int GAIN2_5INT = 0;
+
+ static const int GAINT_6 = 12; //new theta view gain bits.
+ static const int GAINT_6INT = 3;
+ static const int GAINT_7 = 12;
+ static const int GAINT_7INT = 3;
+ static const int GAINT_8 = 12;
+ static const int GAINT_8INT = 3;
+ static const int GAINT_9 = 12;
+ static const int GAINT_9INT = 3;
//STUFF NOT USED IN THE FIRMWARE BUT ONLY FOR DEBUGGING
///////////////////////////////////////////////////////
bool useOfflineAlgo_;
+ //used for z propagation
+ std::vector zdeltaR_;
+ //multiple scattering constants used in multiple scattering matrix to build RMS values
std::vector mScatteringPhi_;
std::vector mScatteringPhiB_;
+ std::vector mScatteringz_;
+ std::vector mScatteringkSlope_;
//point resolution for phi
double pointResolutionPhi_;
//point resolution for phiB
@@ -149,6 +184,10 @@ namespace Phase2L1GMT {
//double pointResolutionPhiB_;
//point resolution for vertex
double pointResolutionVertex_;
+ // point resolution for z
+ std::vector pointResolutionz_;
+ // point resolution for kSlope
+ std::vector pointResolutionkSlope_;
std::vector curvResolution1_;
std::vector curvResolution2_;
//Sorter
diff --git a/L1Trigger/Phase2L1GMT/interface/KMTFLUTs.h b/L1Trigger/Phase2L1GMT/interface/KMTFLUTs.h
index 42027a4c38e43..28a1f99c233a3 100644
--- a/L1Trigger/Phase2L1GMT/interface/KMTFLUTs.h
+++ b/L1Trigger/Phase2L1GMT/interface/KMTFLUTs.h
@@ -6,69 +6,94 @@
#include "TFile.h"
#include