Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:04:34

0001 #include "DataFormats/L1TMuon/interface/L1MuKBMTrack.h"
0002 
0003 L1MuKBMTrack::L1MuKBMTrack() : reco::LeafCandidate(-1, reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)) {}
0004 
0005 L1MuKBMTrack::~L1MuKBMTrack() {}
0006 
0007 L1MuKBMTrack::L1MuKBMTrack(const L1MuKBMTCombinedStubRef& seed, int phi, int phiB)
0008     : reco::LeafCandidate(-1, reco::LeafCandidate::PolarLorentzVector(0.1, 0.0, 0.0, 0.105)),
0009       covariance_(6, 0.0),
0010       phi_(phi),
0011       phiB_(phiB),
0012       step_(seed->stNum()),
0013       sector_(seed->scNum()),
0014       wheel_(seed->whNum()),
0015       quality_(seed->quality()),
0016       bx_(seed->bxNum()),
0017       rank_(seed->bxNum()) {
0018   stubs_.push_back(seed);
0019   residuals_.push_back(0);
0020   residuals_.push_back(0);
0021   residuals_.push_back(0);
0022 }
0023 
0024 int L1MuKBMTrack::curvatureAtMuon() const { return curvMuon_; }
0025 int L1MuKBMTrack::phiAtMuon() const { return phiMuon_; }
0026 int L1MuKBMTrack::phiBAtMuon() const { return phiBMuon_; }
0027 
0028 int L1MuKBMTrack::curvatureAtVertex() const { return curvVertex_; }
0029 
0030 int L1MuKBMTrack::phiAtVertex() const { return phiVertex_; }
0031 
0032 int L1MuKBMTrack::dxy() const { return dxy_; }
0033 
0034 int L1MuKBMTrack::curvature() const { return curv_; }
0035 
0036 int L1MuKBMTrack::positionAngle() const { return phi_; }
0037 
0038 int L1MuKBMTrack::bendingAngle() const { return phiB_; }
0039 
0040 int L1MuKBMTrack::coarseEta() const { return coarseEta_; }
0041 
0042 int L1MuKBMTrack::approxChi2() const { return approxChi2_; }
0043 int L1MuKBMTrack::trackCompatibility() const { return trackCompatibility_; }
0044 
0045 int L1MuKBMTrack::hitPattern() const { return hitPattern_; }
0046 
0047 int L1MuKBMTrack::step() const { return step_; }
0048 int L1MuKBMTrack::sector() const { return sector_; }
0049 int L1MuKBMTrack::wheel() const { return wheel_; }
0050 
0051 int L1MuKBMTrack::quality() const { return quality_; }
0052 
0053 float L1MuKBMTrack::ptUnconstrained() const { return ptUnconstrained_; }
0054 
0055 int L1MuKBMTrack::fineEta() const { return fineEta_; }
0056 
0057 bool L1MuKBMTrack::hasFineEta() const { return hasFineEta_; }
0058 
0059 int L1MuKBMTrack::bx() const { return bx_; }
0060 
0061 int L1MuKBMTrack::rank() const { return rank_; }
0062 
0063 const L1MuKBMTCombinedStubRefVector& L1MuKBMTrack::stubs() const { return stubs_; }
0064 
0065 int L1MuKBMTrack::residual(uint i) const { return residuals_[i]; }
0066 
0067 void L1MuKBMTrack::setCoordinates(int step, int curv, int phi, int phiB) {
0068   step_ = step;
0069   curv_ = curv;
0070   phiB_ = phiB;
0071   phi_ = phi;
0072 }
0073 
0074 void L1MuKBMTrack::setCoordinatesAtVertex(int curv, int phi, int dxy) {
0075   curvVertex_ = curv;
0076   phiVertex_ = phi;
0077   dxy_ = dxy;
0078 }
0079 
0080 void L1MuKBMTrack::setCoordinatesAtMuon(int curv, int phi, int phiB) {
0081   curvMuon_ = curv;
0082   phiMuon_ = phi;
0083   phiBMuon_ = phiB;
0084 }
0085 
0086 void L1MuKBMTrack::setCoarseEta(int eta) { coarseEta_ = eta; }
0087 
0088 void L1MuKBMTrack::setHitPattern(int pattern) { hitPattern_ = pattern; }
0089 
0090 void L1MuKBMTrack::setApproxChi2(int chi) { approxChi2_ = chi; }
0091 void L1MuKBMTrack::setTrackCompatibility(int chi) { trackCompatibility_ = chi; }
0092 
0093 void L1MuKBMTrack::setPtEtaPhi(double pt, double eta, double phi) {
0094   PolarLorentzVector v(pt, eta, phi, 0.105);
0095   setP4(v);
0096 }
0097 void L1MuKBMTrack::setPtUnconstrained(float pt) { ptUnconstrained_ = pt; }
0098 
0099 void L1MuKBMTrack::addStub(const L1MuKBMTCombinedStubRef& stub) {
0100   if (stub->quality() < quality_)
0101     quality_ = stub->quality();
0102   stubs_.push_back(stub);
0103 }
0104 
0105 void L1MuKBMTrack::setFineEta(int eta) {
0106   fineEta_ = eta;
0107   hasFineEta_ = true;
0108 }
0109 
0110 void L1MuKBMTrack::setRank(int rank) { rank_ = rank; }
0111 
0112 void L1MuKBMTrack::setKalmanGain(
0113     unsigned int step, unsigned int K, float a1, float a2, float a3, float a4, float a5, float a6) {
0114   switch (step) {
0115     case 3:
0116       kalmanGain3_.push_back(K);
0117       kalmanGain3_.push_back(a1);
0118       kalmanGain3_.push_back(a2);
0119       kalmanGain3_.push_back(a3);
0120       kalmanGain3_.push_back(a4);
0121       kalmanGain3_.push_back(a5);
0122       kalmanGain3_.push_back(a6);
0123       break;
0124     case 2:
0125       kalmanGain2_.push_back(K);
0126       kalmanGain2_.push_back(a1);
0127       kalmanGain2_.push_back(a2);
0128       kalmanGain2_.push_back(a3);
0129       kalmanGain2_.push_back(a4);
0130       kalmanGain2_.push_back(a5);
0131       kalmanGain2_.push_back(a6);
0132       break;
0133     case 1:
0134       kalmanGain1_.push_back(K);
0135       kalmanGain1_.push_back(a1);
0136       kalmanGain1_.push_back(a2);
0137       kalmanGain1_.push_back(a3);
0138       kalmanGain1_.push_back(a4);
0139       kalmanGain1_.push_back(a5);
0140       kalmanGain1_.push_back(a6);
0141       break;
0142     case 0:
0143       kalmanGain0_.push_back(K);
0144       kalmanGain0_.push_back(a1);
0145       kalmanGain0_.push_back(a2);
0146       kalmanGain0_.push_back(a3);
0147       break;
0148 
0149     default:
0150       printf("Critical ERROR on setting the Klamn gain\n");
0151   }
0152 }
0153 
0154 void L1MuKBMTrack::setResidual(uint i, int val) { residuals_[i] = val; }
0155 
0156 const std::vector<float>& L1MuKBMTrack::kalmanGain(unsigned int step) const {
0157   switch (step) {
0158     case 3:
0159       return kalmanGain3_;
0160     case 2:
0161       return kalmanGain2_;
0162     case 1:
0163       return kalmanGain1_;
0164     case 0:
0165       return kalmanGain0_;
0166   }
0167   return kalmanGain0_;
0168 }
0169 
0170 const std::vector<double>& L1MuKBMTrack::covariance() const { return covariance_; }
0171 
0172 bool L1MuKBMTrack::overlapTrack(const L1MuKBMTrack& other) const {
0173   for (const auto& s1 : stubs_) {
0174     for (const auto& s2 : other.stubs()) {
0175       if (s1->scNum() == s2->scNum() && s1->whNum() == s2->whNum() && s1->stNum() == s2->stNum() &&
0176           s1->tag() == s2->tag())
0177         return true;
0178     }
0179   }
0180   return false;
0181 }
0182 
0183 void L1MuKBMTrack::setCovariance(const CovarianceMatrix& c) {
0184   covariance_[0] = c(0, 0);
0185   covariance_[1] = c(0, 1);
0186   covariance_[2] = c(1, 1);
0187   covariance_[3] = c(0, 2);
0188   covariance_[4] = c(1, 2);
0189   covariance_[5] = c(2, 2);
0190 }