CMS 3D CMS Logo

L1TMuonBarrelKalmanStubProcessor.cc
Go to the documentation of this file.
2 #include <cmath>
7 
9  minPhiQuality_(0),
10  minThetaQuality_(0),
11  minBX_(-3),
12  maxBX_(3)
13 {
14 
15 }
16 
17 
18 
20  minPhiQuality_(iConfig.getParameter<int>("minPhiQuality")),
21  minThetaQuality_(iConfig.getParameter<int>("minThetaQuality")),
22  minBX_(iConfig.getParameter<int>("minBX")),
23  maxBX_(iConfig.getParameter<int>("maxBX")),
24  etaLUT_minus_2_1(iConfig.getParameter<std::vector<int> >("etaLUT_minus_2_1")),
25  etaLUT_minus_2_2(iConfig.getParameter<std::vector<int> >("etaLUT_minus_2_2")),
26  etaLUT_minus_2_3(iConfig.getParameter<std::vector<int> >("etaLUT_minus_2_3")),
27  etaLUT_minus_1_1(iConfig.getParameter<std::vector<int> >("etaLUT_minus_1_1")),
28  etaLUT_minus_1_2(iConfig.getParameter<std::vector<int> >("etaLUT_minus_1_2")),
29  etaLUT_minus_1_3(iConfig.getParameter<std::vector<int> >("etaLUT_minus_1_3")),
30  etaLUT_0_1(iConfig.getParameter<std::vector<int> >("etaLUT_0_1")),
31  etaLUT_0_2(iConfig.getParameter<std::vector<int> >("etaLUT_0_2")),
32  etaLUT_0_3(iConfig.getParameter<std::vector<int> >("etaLUT_0_3")),
33  etaLUT_plus_1_1(iConfig.getParameter<std::vector<int> >("etaLUT_plus_1_1")),
34  etaLUT_plus_1_2(iConfig.getParameter<std::vector<int> >("etaLUT_plus_1_2")),
35  etaLUT_plus_1_3(iConfig.getParameter<std::vector<int> >("etaLUT_plus_1_3")),
36  etaLUT_plus_2_1(iConfig.getParameter<std::vector<int> >("etaLUT_plus_2_1")),
37  etaLUT_plus_2_2(iConfig.getParameter<std::vector<int> >("etaLUT_plus_2_2")),
38  etaLUT_plus_2_3(iConfig.getParameter<std::vector<int> >("etaLUT_plus_2_3")),
39  etaCoarseLUT_minus_2(iConfig.getParameter<std::vector<int> >("etaCoarseLUT_minus_2")),
40  etaCoarseLUT_minus_1(iConfig.getParameter<std::vector<int> >("etaCoarseLUT_minus_1")),
41  etaCoarseLUT_0(iConfig.getParameter<std::vector<int> >("etaCoarseLUT_0")),
42  etaCoarseLUT_plus_1(iConfig.getParameter<std::vector<int> >("etaCoarseLUT_plus_1")),
43  etaCoarseLUT_plus_2(iConfig.getParameter<std::vector<int> >("etaCoarseLUT_plus_2")),
44  verbose_(iConfig.getParameter<int>("verbose"))
45 {
46 
47 }
48 
49 
50 
52 
53 
54 
56  if (stub->code()<minPhiQuality_)
57  return false;
58  return true;
59 }
60 
61 std::pair<bool,bool> L1TMuonBarrelKalmanStubProcessor::isGoodThetaStub(const L1MuDTChambThDigi * stub,uint pos1,uint pos2 ) {
62 
63  bool seg1=true;
64  bool seg2=true;
65 
66  if (stub->quality(pos1)<minThetaQuality_)
67  seg1=false;
68  if (stub->quality(pos2)<minThetaQuality_)
69  seg2=false;
70  return std::make_pair(seg1,seg2);
71 }
72 
73 
76  int wheel = phiS->whNum();
77  int sector = phiS->scNum();
78  int station = phiS->stNum();
79  int phi = phiS->phi();
80  int phiB = phiS->phiB();
81  bool tag = (phiS->Ts2Tag()==1);
82  int bx=phiS->bxNum();
83  int quality=phiS->code();
84 
85  //coarse eta
86  int coarseEta;
87 
88 
89  if (wheel==0) {
90  coarseEta = etaCoarseLUT_0[station-1];
91  }
92  else if (wheel==1) {
93  coarseEta = etaCoarseLUT_plus_1[station-1];
94 
95  }
96  else if (wheel==2) {
97  coarseEta = etaCoarseLUT_plus_2[station-1];
98 
99  }
100  else if (wheel==-1) {
101  coarseEta = etaCoarseLUT_minus_1[station-1];
102 
103  }
104  else {
105  coarseEta = etaCoarseLUT_minus_2[station-1];
106  }
107 
108 
109 
110  //Now full eta
111  int qeta1=-1;
112  int qeta2=-1;
113  int eta1=0;
114  int eta2=0;
115 
116 
117  if (etaS) {
118  std::vector<int> eposition;
119  std::vector<int> equality;
120  for (uint i=0;i<7;++i) {
121  if (etaS->position(i)==0 || etaS->quality(i)<minThetaQuality_)
122  continue;
123  int p=0;
124  if (wheel==0) {
125  if (station==1)
126  p=(etaLUT_0_1[i]);
127  if (station==2)
128  p=(etaLUT_0_2[i]);
129  if (station==3)
130  p=(etaLUT_0_3[i]);
131  if (!(sector==0 || sector==3 || sector==4 || sector==7 ||sector==8 ||sector==11))
132  p=-p;
133  }
134  if (wheel==1) {
135  if (station==1)
136  p=(etaLUT_plus_1_1[i]);
137  if (station==2)
138  p=(etaLUT_plus_1_2[i]);
139  if (station==3)
140  p=(etaLUT_plus_1_3[i]);
141  }
142 
143  if (wheel==2) {
144  if (station==1)
145  p=(etaLUT_plus_2_1[i]);
146  if (station==2)
147  p=(etaLUT_plus_2_2[i]);
148  if (station==3)
149  p=(etaLUT_plus_2_3[i]);
150  }
151  if (wheel==-1) {
152  if (station==1)
153  p=(etaLUT_minus_1_1[i]);
154  if (station==2)
155  p=(etaLUT_minus_1_2[i]);
156  if (station==3)
157  p=(etaLUT_minus_1_3[i]);
158  }
159 
160  if (wheel==-2) {
161  if (station==1)
162  p=(etaLUT_minus_2_1[i]);
163  if (station==2)
164  p=(etaLUT_minus_2_2[i]);
165  if (station==3)
166  p=(etaLUT_minus_2_3[i]);
167  }
168  eposition.push_back(p);
169  equality.push_back(etaS->quality(i));
170 
171  }
172 
173 
174  if (!eposition.empty()) {
175  eta1=eposition[0];
176  qeta1=equality[0];
177  }
178  if (eposition.size()>=2) {
179  eta2=eposition[1];
180  qeta2=equality[1];
181  }
182 
183  }
184 
185  L1MuKBMTCombinedStub stub(wheel,sector,station,phi,phiB,tag,
186  bx,quality,coarseEta,eta1,eta2,qeta1,qeta2);
187 
188  return stub;
189 
190 }
191 
192 
193 
194 
195 
196 
199 
200 
201  //get the masks from th standard BMTF setup!
202  // const L1TMuonBarrelParamsRcd& bmtfParamsRcd = setup.get<L1TMuonBarrelParamsRcd>();
203  // bmtfParamsRcd.get(bmtfParamsHandle);
204  // const L1TMuonBarrelParams& bmtfParams = *bmtfParamsHandle.product();
205  // masks_ = bmtfParams.l1mudttfmasks;
206 
207 
208 
210  for (int bx=minBX_;bx<=maxBX_;bx++) {
211  for (int wheel=-2;wheel<=2;wheel++) {
212  for (uint sector=0;sector<12;sector++) {
213  for (uint station=0;station<5;station++) {
214  const L1MuDTChambPhDigi* high = phiContainer->chPhiSegm1(wheel,station,sector,bx);
215  const L1MuDTChambPhDigi* low = phiContainer->chPhiSegm2(wheel,station,sector,bx);
216  const L1MuDTChambThDigi* eta = etaContainer->chThetaSegm(wheel,station,sector,bx);
217 
218  //Temporary mask
219  if (station==1 && abs(wheel)==2)
220  continue;
221 
222  if (high && high->code()>=minPhiQuality_) {
223  out.push_back(buildStub(high,eta));
224  if (verbose_==1) {
225  printf("Original Stub phi: bx=%d wheel=%d sector=%d station=%d tag=%d phi=%d phiB=%d quality=%d\n",high->bxNum(),high->whNum(),high->scNum(),high->stNum(),high->Ts2Tag(),high->phi(),high->phiB(),high->code());
226  printf("New Stub phi: bx=%d wheel=%d sector=%d station=%d tag=%d phi=%d phiB=%d quality=%d coarse=%d eta1=%d,eta2=%d,qeta1=%d,qeta2=%d\n",out[out.size()-1].bxNum(),out[out.size()-1].whNum(),out[out.size()-1].scNum(),out[out.size()-1].stNum(),out[out.size()-1].tag(),out[out.size()-1].phi(),out[out.size()-1].phiB(),out[out.size()-1].quality(),out[out.size()-1].coarseEta(),out[out.size()-1].eta1(),out[out.size()-1].eta2(),out[out.size()-1].qeta1(),out[out.size()-1].qeta2());
227  }
228  }
229  if (low&&low->code()>=minPhiQuality_) {
230  out.push_back(buildStub(low,eta));
231  if (verbose_==1) {
232  printf("Original Stub phi: bx=%d wheel=%d sector=%d station=%d tag=%d phi=%d phiB=%d quality=%d\n",low->bxNum(),low->whNum(),low->scNum(),low->stNum(),low->Ts2Tag(),low->phi(),low->phiB(),low->code());
233  printf("New Stub phi: bx=%d wheel=%d sector=%d station=%d tag=%d phi=%d phiB=%d quality=%d coarse=%d eta1=%d,eta2=%d,qeta1=%d,qeta2=%d\n",out[out.size()-1].bxNum(),out[out.size()-1].whNum(),out[out.size()-1].scNum(),out[out.size()-1].stNum(),out[out.size()-1].tag(),out[out.size()-1].phi(),out[out.size()-1].phiB(),out[out.size()-1].quality(),out[out.size()-1].coarseEta(),out[out.size()-1].eta1(),out[out.size()-1].eta2(),out[out.size()-1].qeta1(),out[out.size()-1].qeta2());
234  }
235  }
236  }
237  }
238  }
239  }
240  return out;
241 }
242 
L1MuDTChambPhDigi const * chPhiSegm1(int wheel, int stat, int sect, int bx) const
L1MuDTChambPhDigi const * chPhiSegm2(int wheel, int stat, int sect, int bx) const
int quality(const int i) const
int position(const int i) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isGoodPhiStub(const L1MuDTChambPhDigi *)
std::pair< bool, bool > isGoodThetaStub(const L1MuDTChambThDigi *, uint pos1, uint pos2=0)
L1MuKBMTCombinedStub buildStub(const L1MuDTChambPhDigi *, const L1MuDTChambThDigi *)
def uint(string)
L1MuDTChambThDigi const * chThetaSegm(int wheel, int stat, int sect, int bx) const
L1MuKBMTCombinedStubCollection makeStubs(const L1MuDTChambPhContainer *, const L1MuDTChambThContainer *)
std::vector< L1MuKBMTCombinedStub > L1MuKBMTCombinedStubCollection