CMS 3D CMS Logo

L1TMuonBarrelKalmanAlgo.h
Go to the documentation of this file.
1 /*
2 Kalman Filter L1 Muon algorithm
3 Michalis Bachtis (UCLA)
4 Sep. 2017
5 
6 */
7 
8 #ifndef L1TMuonBarrelKalmanAlgo_H
9 #define L1TMuonBarrelKalmanAlgo_H
10 
15 
17 public:
18  typedef ROOT::Math::SVector<double, 2> Vector2;
19  typedef ROOT::Math::SMatrix<double, 2, 2, ROOT::Math::MatRepSym<double, 2> > CovarianceMatrix2;
20  typedef ROOT::Math::SMatrix<double, 3, 2> Matrix32;
21  typedef ROOT::Math::SMatrix<double, 2, 3> Matrix23;
22  typedef ROOT::Math::SMatrix<double, 1, 3> Matrix13;
23  typedef ROOT::Math::SMatrix<double, 3, 1> Matrix31;
24  typedef ROOT::Math::SMatrix<double, 3, 3> Matrix33;
25 
27  std::pair<bool, L1MuKBMTrack> chain(const L1MuKBMTCombinedStubRef&, const L1MuKBMTCombinedStubRefVector&);
28 
30 
31  void addBMTFMuon(int, const L1MuKBMTrack&, std::unique_ptr<l1t::RegionalMuonCandBxCollection>&);
33 
34 private:
35  bool verbose_;
36  std::pair<bool, uint> match(const L1MuKBMTCombinedStubRef&, const L1MuKBMTCombinedStubRefVector&, int);
37  int correctedPhi(const L1MuKBMTCombinedStubRef&, int);
39  void propagate(L1MuKBMTrack&);
41  bool update(L1MuKBMTrack&, const L1MuKBMTCombinedStubRef&, int, int);
44  bool updateLUT(L1MuKBMTrack&, const L1MuKBMTCombinedStubRef&, int, int);
48  int hitPattern(const L1MuKBMTrack&);
49  int customBitmask(unsigned int, unsigned int, unsigned int, unsigned int);
50  bool getBit(int, int);
52  int phiAt2(const L1MuKBMTrack& track);
55  int rank(const L1MuKBMTrack&);
56  int wrapAround(int, int);
57  std::pair<bool, uint> getByCode(const L1MuKBMTrackCollection& tracks, int mask);
58  std::map<int, int> trackAddress(const L1MuKBMTrack&, int&);
59  int encode(bool ownwheel, int sector, bool tag);
60  uint twosCompToBits(int);
61  int fp_product(float, int, uint);
62 
64 
66  uint matchAbs(std::map<uint, uint>&, uint, uint);
67 
68  //LUT service
70  int ptLUT(int K);
71 
72  //Initial Curvature
73  std::vector<double> initK_;
74  std::vector<double> initK2_;
75 
76  //propagation coefficients
77  std::vector<double> eLoss_;
78  std::vector<double> aPhi_;
79  std::vector<double> aPhiB_;
80  std::vector<double> aPhiBNLO_;
81  std::vector<double> bPhi_;
82  std::vector<double> bPhiB_;
83  double phiAt2_;
84  std::vector<double> etaLUT0_;
85  std::vector<double> etaLUT1_;
86 
87  //Chi Square estimator input
90  std::vector<double> chiSquare_;
91  std::vector<int> chiSquareCutPattern_;
92  std::vector<int> chiSquareCutCurv_;
93  std::vector<int> chiSquareCut_;
94 
95  std::vector<double> trackComp_;
96  std::vector<double> trackCompErr1_;
97  std::vector<double> trackCompErr2_;
98  std::vector<int> trackCompPattern_;
99  std::vector<int> trackCompCutCurv_;
100  std::vector<int> trackCompCut_;
101  std::vector<int> chiSquareCutTight_;
102 
103  //bitmasks to run== diferent combinations for a given seed in a given station
104  std::vector<int> combos4_;
105  std::vector<int> combos3_;
106  std::vector<int> combos2_;
107  std::vector<int> combos1_;
108 
109  //bits for fixed point precision
110  static const int BITSCURV = 14;
111  static const int BITSPHI = 12;
112  static const int BITSPHIB = 13;
113  static const int BITSPARAM = 14;
114  static const int GAIN_0 = 9;
115  static const int GAIN_0INT = 6;
116  static const int GAIN_4 = 9;
117  static const int GAIN_4INT = 4;
118  static const int GAIN_V0 = 9;
119  static const int GAIN_V0INT = 3;
120 
121  static const int GAIN2_0 = 12;
122  static const int GAIN2_0INT = 8;
123  static const int GAIN2_1 = 12;
124  static const int GAIN2_1INT = 4;
125  static const int GAIN2_4 = 12;
126  static const int GAIN2_4INT = 4;
127  static const int GAIN2_5 = 12;
128  static const int GAIN2_5INT = 0;
129  //STUFF NOT USED IN THE FIRMWARE BUT ONLY FOR DEBUGGING
131 
133  std::vector<double> mScatteringPhi_;
134  std::vector<double> mScatteringPhiB_;
135  //point resolution for phi
137  //point resolution for phiB
139  std::vector<double> pointResolutionPhiBH_;
140  std::vector<double> pointResolutionPhiBL_;
141  //double pointResolutionPhiB_;
142  //point resolution for vertex
144 
145  //Sorter
146  class StubSorter {
147  public:
149 
151  if (correctedPhi(a) < correctedPhi(b))
152  return true;
153  return false;
154  }
155 
156  private:
157  int sec_;
159  if (stub->scNum() == sec_)
160  return stub->phi();
161  else if ((stub->scNum() == sec_ - 1) || (stub->scNum() == 11 && sec_ == 0))
162  return stub->phi() - 2144;
163  else if ((stub->scNum() == sec_ + 1) || (stub->scNum() == 0 && sec_ == 11))
164  return stub->phi() + 2144;
165  return 0;
166  }
167  };
168 };
169 #endif
std::vector< double > bPhiB_
int correctedPhiB(const L1MuKBMTCombinedStubRef &)
l1t::RegionalMuonCand convertToBMTF(const L1MuKBMTrack &track)
std::vector< double > aPhi_
std::vector< double > aPhiB_
std::vector< double > aPhiBNLO_
L1TMuonBarrelKalmanAlgo(const edm::ParameterSet &settings)
std::pair< bool, uint > match(const L1MuKBMTCombinedStubRef &, const L1MuKBMTCombinedStubRefVector &, int)
std::vector< double > mScatteringPhiB_
int phiAt2(const L1MuKBMTrack &track)
bool update(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &, int, int)
int rank(const L1MuKBMTrack &)
std::vector< int > trackCompPattern_
std::vector< edm::Ref< L1MuKBMTCombinedStubCollection > > L1MuKBMTCombinedStubRefVector
bool updateOffline1D(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
void estimateCompatibility(L1MuKBMTrack &)
bool updateLUT(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &, int, int)
void vertexConstraintLUT(L1MuKBMTrack &)
std::pair< bool, uint > getByCode(const L1MuKBMTrackCollection &tracks, int mask)
int fp_product(float, int, uint)
std::vector< double > chiSquare_
std::vector< double > pointResolutionPhiBH_
std::vector< double > initK2_
ROOT::Math::SMatrix< double, 1, 3 > Matrix13
std::vector< double > etaLUT0_
std::vector< double > trackComp_
std::vector< double > etaLUT1_
std::vector< double > mScatteringPhi_
L1TMuonBarrelKalmanLUTs * lutService_
void vertexConstraint(L1MuKBMTrack &)
int customBitmask(unsigned int, unsigned int, unsigned int, unsigned int)
int correctedPhi(const L1MuKBMTCombinedStubRef &stub)
std::vector< double > eLoss_
ROOT::Math::SMatrix< double, 3, 1 > Matrix31
bool estimateChiSquare(L1MuKBMTrack &)
void vertexConstraintOffline(L1MuKBMTrack &)
ROOT::Math::SMatrix< double, 2, 2, ROOT::Math::MatRepSym< double, 2 > > CovarianceMatrix2
uint matchAbs(std::map< uint, uint > &, uint, uint)
std::vector< int > chiSquareCutTight_
std::vector< double > bPhi_
std::vector< double > initK_
void updateEta(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
void setFloatingPointValues(L1MuKBMTrack &, bool)
L1MuKBMTrackCollection clean(const L1MuKBMTrackCollection &, uint)
int encode(bool ownwheel, int sector, bool tag)
std::vector< int > chiSquareCutPattern_
std::pair< bool, L1MuKBMTrack > chain(const L1MuKBMTCombinedStubRef &, const L1MuKBMTCombinedStubRefVector &)
void calculateEta(L1MuKBMTrack &track)
double b
Definition: hdecay.h:120
std::vector< int > chiSquareCut_
void addBMTFMuon(int, const L1MuKBMTrack &, std::unique_ptr< l1t::RegionalMuonCandBxCollection > &)
int hitPattern(const L1MuKBMTrack &)
ROOT::Math::SVector< double, 2 > Vector2
std::vector< L1MuKBMTrack > L1MuKBMTrackCollection
Definition: L1MuKBMTrack.h:15
double a
Definition: hdecay.h:121
ROOT::Math::SMatrix< double, 2, 3 > Matrix23
int correctedPhi(const L1MuKBMTCombinedStubRef &, int)
std::vector< double > trackCompErr1_
ROOT::Math::SMatrix< double, 3, 2 > Matrix32
std::vector< int > chiSquareCutCurv_
ROOT::Math::SMatrix< double, 3, 3 > Matrix33
std::vector< double > trackCompErr2_
bool updateOffline(L1MuKBMTrack &, const L1MuKBMTCombinedStubRef &)
bool operator()(const L1MuKBMTCombinedStubRef &a, const L1MuKBMTCombinedStubRef &b)
uint etaStubRank(const L1MuKBMTCombinedStubRef &)
std::vector< int > trackCompCutCurv_
std::map< int, int > trackAddress(const L1MuKBMTrack &, int &)
std::vector< double > pointResolutionPhiBL_