CMS 3D CMS Logo

DTBtiChipEquations.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: DTBtiChip
4 //
5 // Description: Implementation of DTBtiChip
6 // trigger algorithm
7 // (Equations' implementation)
8 //
9 //
10 // Author List:
11 // C. Grandi
12 // Modifications:
13 // 22/X/02 S. Vanini: redundant patterns added
14 // 9/XII/02 SV : equation in manual form
15 // 13/I/2003 SV equations in manual order
16 // 22/VI/04 SV: last trigger code update
17 //--------------------------------------------------
18 
19 //#include "Utilities/Configuration/interface/Architecture.h"
20 
21 //-----------------------
22 // This Class's Header --
23 //-----------------------
25 
26 //-------------------------------
27 // Collaborating Class Headers --
28 //-------------------------------
30 
31 //---------------
32 // C++ Headers --
33 //---------------
34 #include <iostream>
35 
36 using namespace std;
37 
39  //
40  // compute all sums and diffs
41  // nothing more than a table...
42  // numbering convention here is the same as the fortran version:
43  // sum number in the range [1,25]
44  // cell numbers in the range [1,9]
45  // --> sum(int,int,int) decreases the indices by 1
46  // sum (sum_number, first_cell, second_cell)
47  //
48 
49  if (config()->debug() > 3) {
50  cout << "DTBtiChip::computeSums called" << endl;
51  }
52 
53  sum(1, 2, 1);
54  sum(2, 3, 1);
55  sum(3, 4, 1);
56  sum(4, 6, 1);
57  sum(5, 8, 1);
58  sum(6, 3, 2);
59  sum(7, 4, 2);
60  sum(8, 5, 2);
61  sum(9, 4, 3);
62  sum(10, 5, 3);
63  sum(11, 6, 3);
64  sum(12, 8, 3);
65  sum(13, 5, 4);
66  sum(14, 6, 4);
67  sum(15, 7, 4);
68  sum(16, 9, 4);
69  sum(17, 6, 5);
70  sum(18, 7, 5);
71  sum(19, 8, 5);
72  sum(20, 7, 6);
73  sum(21, 8, 6);
74  sum(22, 9, 6);
75  sum(23, 8, 7);
76  sum(24, 9, 7);
77  sum(25, 9, 8);
78 }
79 
80 void DTBtiChip::sum(const int s, const int a, const int b) {
81  //
82  // fill the sums and difs arrays
83  // a and b are the cell numbers (in the range [1,9])
84  // s is the sum number (in the range [1,25])
85  //
86 
87  if (_thisStepUsedHit[a - 1] != nullptr && _thisStepUsedHit[b - 1] != nullptr) {
88  _sums[s - 1] = (float)(_thisStepUsedHit[a - 1]->jtrig() + _thisStepUsedHit[b - 1]->jtrig());
89  _difs[s - 1] = (float)(_thisStepUsedHit[a - 1]->jtrig() - _thisStepUsedHit[b - 1]->jtrig());
90  } else {
91  _sums[s - 1] = 1000;
92  _difs[s - 1] = 1000;
93  }
94 }
95 
97  reSumAr[2][2 + 2] = 0;
98  reSumAr[2][1 + 2] = 0;
99  reSumAr[2][0 + 2] = 0;
100  reSumAr[2][-1 + 2] = -1;
101  reSumAr[2][-2 + 2] = -1;
102 
103  reSumAr[1][2 + 2] = 1;
104  reSumAr[1][1 + 2] = 1;
105  reSumAr[1][0 + 2] = 0;
106  reSumAr[1][-1 + 2] = 0;
107  reSumAr[1][-2 + 2] = 0;
108 
109  reSumAr[0][2 + 2] = 1;
110  reSumAr[0][1 + 2] = 0;
111  reSumAr[0][0 + 2] = 0;
112  reSumAr[0][-1 + 2] = 0;
113  reSumAr[0][-2 + 2] = -1;
114 
115  reSumAr23[2][2 + 2] = 1;
116  reSumAr23[2][1 + 2] = 1;
117  reSumAr23[2][0 + 2] = 1;
118  reSumAr23[2][-1 + 2] = 0;
119  reSumAr23[2][-2 + 2] = 0;
120 
121  reSumAr23[1][2 + 2] = 1;
122  reSumAr23[1][1 + 2] = 1;
123  reSumAr23[1][0 + 2] = 0;
124  reSumAr23[1][-1 + 2] = 0;
125  reSumAr23[1][-2 + 2] = 0;
126 
127  reSumAr23[0][2 + 2] = 1;
128  reSumAr23[0][1 + 2] = 0;
129  reSumAr23[0][0 + 2] = 0;
130  reSumAr23[0][-1 + 2] = 0;
131  reSumAr23[0][-2 + 2] = -1;
132 }
133 
135  //
136  // Compute all K and X equations of DTBtiChip algorithm
137  // NB now Keq=Kman
138 
139  float K0 = config()->ST();
140  //cout <<"K0="<<K0<<endl;
141 
142  //enabled patterns....
143  int PTMS[32];
144  for (int i = 0; i < 32; i++) {
145  PTMS[i] = config()->PTMSflag(i);
146  }
147 
148  int i;
149  // redundant patterns added by Sara Vanini
150  i = 0; // 1324A --> 1L3L2R4L
151  if (PTMS[i]) {
152  _Keq[i][0] = _difs[1] + 2. * K0; //eq. AB
153  _Keq[i][1] = -_sums[5] + 2. * K0; //eq. BC
154  _Keq[i][2] = _sums[6]; //eq. CD
155  _Keq[i][3] = -(_sums[0] / 2.) + 2. * K0 + 0.01; //eq. AC
156  _Keq[i][4] = (_difs[8] / 2.) + K0 + 0.01; //eq. BD
157  //_Keq[i][5] = (_difs[2]/3.) + 4.*K0/3. + 0.51; //eq. AD
158  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(_difs[2]), 3.))) + int((double(_difs[2]) / 3.)); //eq. AD
159 
160  //patt 0 always uses Xbc, because Xad could be negative...
161  //when wire B is missing, TshiftB=0
162  //when hit B is gone out of shift register, Tshift=K0+1
163  float _difs_p0 = _difs[5];
164 
165  float TshiftB = 0;
166  float TshiftC = 0;
167  if (_thisStepUsedHit[3 - 1] == nullptr) {
168  if (_hits[3 - 1].empty())
169  TshiftB = 0;
170  if (!_hits[3 - 1].empty() && (*(_hits[3 - 1].begin()))->clockTime() <= -K0)
171  TshiftB = K0 + 1;
172  } else
173  TshiftB = _thisStepUsedHit[3 - 1]->jtrig();
174 
175  if (_thisStepUsedHit[2 - 1] == nullptr) {
176  if (_hits[2 - 1].empty())
177  TshiftC = 0;
178  if (!_hits[2 - 1].empty() && (*(_hits[2 - 1].begin()))->clockTime() <= -K0)
179  TshiftC = K0 + 1;
180  } else
181  TshiftC = _thisStepUsedHit[2 - 1]->jtrig();
182 
183  _difs_p0 = (float)(TshiftB - TshiftC);
184 
185  // Zotto's
186  _XeqAB_patt0 = (_sums[1] - K0) / 4.; //eq. AB
187  _Xeq[i][0] = (_difs_p0 + K0) / 4.; //eq. BC
188  _XeqCD_patt0 = (_difs[6] + K0) / 4.; //eq. CD
189  _XeqAC_patt0 = -(_difs[0]) / 4.; //eq. AC
190  _XeqBD_patt0 = (_sums[8]) / 4.; //eq. BD
191  _Xeq[i][1] = (_sums[2] - K0) / 4.; //eq. AD
192 
193  /*
194 // my eq
195  _XeqAB_patt0 = (_sums[1] - K0) / 4.; //eq. AB
196  _Xeq[i][0] = (_difs[5] + K0) / 4.; //eq. BC
197  _XeqCD_patt0 = (_difs[6] + K0) / 4.; //eq. CD
198  _XeqAC_patt0 = -(_difs[0]) / 4.; //eq. AC
199  _XeqBD_patt0 = (_sums[8]) / 4.; //eq. BD
200  _Xeq[i][1] = (_sums[2] - K0) / 4.; //eq. AD
201 */
202  }
203 
204  i = 1; // 1324B --> 1L3L2R4R
205  if (PTMS[i]) {
206  _Keq[i][0] = _difs[1] + 2. * K0;
207  _Keq[i][1] = -(_sums[5]) + 2. * K0;
208  _Keq[i][2] = -_difs[6] + 2. * K0;
209  _Keq[i][3] = -(_sums[0] / 2.) + 2. * K0 + 0.01;
210  _Keq[i][4] = -(_sums[8] / 2.) + 2. * K0 + 0.01;
211  //_Keq[i][5] = -(_sums[2]/3.) + 2.*K0 + 0.51;
212  _Keq[i][5] = ST2 + reSum23(0, int(fmod(double(-_sums[2]), 3.))) + int((double(-_sums[2]) / 3.));
213 
214  _Xeq[i][0] = (_difs[5] + K0) / 4.;
215  _Xeq[i][1] = (-_difs[2] + K0) / 4.;
216  }
217 
218  i = 2; // 1324C --> 1R3L2R4L
219  if (PTMS[i]) {
220  _Keq[i][0] = _sums[1];
221  _Keq[i][1] = -_sums[5] + 2. * K0;
222  _Keq[i][2] = _sums[6];
223  _Keq[i][3] = -(_difs[0] / 2.) + K0 + 0.01;
224  _Keq[i][4] = (_difs[8] / 2.) + K0 + 0.01;
225  //_Keq[i][5] = (_sums[2]/3.) + 2.*K0/3. + 0.51;
226  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(_sums[2]), 3.))) + int((double(_sums[2]) / 3.)); //eq. AD
227  /*
228 cout << "ST23 =" << ST23 << endl;
229 cout << "RE23 =" << RE23 << endl;
230 cout << "fmod(double(_sums[2]),3.) =" << fmod(double(_sums[2]),3.) << endl;
231 cout << "reSum23 = "<< reSum23( RE23 , fmod(double(_sums[2]),3.) ) << endl;
232 cout << "double(_sums[2])/3.="<<double(_sums[2])/3.<< endl;
233 cout << "int('') = " << int( (double(_sums[2])/3.) ) << endl;
234 */
235  _Xeq[i][0] = (_difs[5] + K0) / 4.;
236  _Xeq[i][1] = (_difs[2] + K0) / 4.;
237  }
238 
239  i = 3; // 1324D --> 1R3L2R4R
240  if (PTMS[i]) {
241  _Keq[i][0] = _sums[1];
242  _Keq[i][1] = -_sums[5] + 2. * K0;
243  _Keq[i][2] = -_difs[6] + 2. * K0;
244  _Keq[i][3] = -(_difs[0] / 2.) + K0 + 0.01;
245  _Keq[i][4] = -(_sums[8] / 2.) + 2. * K0 + 0.01;
246  //_Keq[i][5] = -(_difs[2]/3.) + 4.*K0/3.;
247  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(-_difs[2]), 3.))) + int((double(-_difs[2]) / 3.)); //eq. AD
248 
249  _Xeq[i][0] = (_difs[5] + K0) / 4.;
250  _Xeq[i][1] = (-_sums[2] + 3. * K0) / 4.;
251  }
252 
253  i = 4; // i = DTBtiChipEQMAP->index("1364A"); --> 1L3L6L4R
254  if (PTMS[i]) {
255  _Keq[i][0] = _difs[1] + 2. * K0;
256  _Keq[i][1] = _difs[10] + 2. * K0;
257  _Keq[i][2] = -(_sums[13]) + 2. * K0;
258  _Keq[i][3] = (_difs[3] / 2.) + 2. * K0 + 0.01;
259  _Keq[i][4] = -(_sums[8] / 2.) + 2. * K0 + 0.01;
260  //_Keq[i][5] = -(_sums[2]/3.) + 2.*K0 + 0.51;
261  _Keq[i][5] = ST2 + reSum23(0, int(fmod(double(-_sums[2]), 3.))) + int((double(-_sums[2]) / 3.));
262 
263  _Xeq[i][0] = (_sums[10] + K0) / 4.;
264  _Xeq[i][1] = (-_difs[2] + K0) / 4.;
265  }
266 
267  i = 5; // i = DTBtiChipEQMAP->index("1364B"); --> 1R3L6L4R
268  if (PTMS[i]) {
269  _Keq[i][0] = _sums[1];
270  _Keq[i][1] = _difs[10] + 2. * K0;
271  _Keq[i][2] = -_sums[13] + 2. * K0;
272  _Keq[i][3] = (_sums[3] / 2.) + K0 + 0.01;
273  _Keq[i][4] = -(_sums[8] / 2.) + 2. * K0 + 0.01;
274  //_Keq[i][5] = -(_difs[2]/3.) + 4.*K0/3.;
275  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(-_difs[2]), 3.))) + int((double(-_difs[2]) / 3.)); //eq. AD
276 
277  _Xeq[i][0] = (_sums[10] + K0) / 4.;
278  _Xeq[i][1] = (-_sums[2] + 3. * K0) / 4.;
279  }
280 
281  i = 6; // i = DTBtiChipEQMAP->index("1364C"); --> 1R3R6L4R
282  if (PTMS[i]) {
283  _Keq[i][0] = -_difs[1] + 2. * K0;
284  _Keq[i][1] = _sums[10];
285  _Keq[i][2] = -_sums[13] + 2. * K0;
286  _Keq[i][3] = (_sums[3] / 2.) + K0 + 0.01;
287  _Keq[i][4] = -(_difs[8] / 2.) + K0 + 0.01;
288  //_Keq[i][5] = -(_difs[2]/3.) + 4.*K0/3.;
289  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(-_difs[2]), 3.))) + int((double(-_difs[2]) / 3.)); //eq. AD
290 
291  _Xeq[i][0] = (_difs[10] + 3. * K0) / 4.;
292  _Xeq[i][1] = (-_sums[2] + 3. * K0) / 4.;
293  }
294 
295  i = 7; // i = DTBtiChipEQMAP->index("1368A"); --> 1R3R6L8L
296  if (PTMS[i]) {
297  _Keq[i][0] = -_difs[1] + 2. * K0;
298  _Keq[i][1] = (_sums[10]);
299  _Keq[i][2] = _difs[20] + 2. * K0;
300  _Keq[i][3] = (_sums[3] / 2.) + K0 + 0.01;
301  _Keq[i][4] = (_sums[11] / 2.) + K0 + 0.01;
302  //_Keq[i][5] = (_sums[4]/3.) + 4.*K0/3. + 0.51;
303  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(_sums[4]), 3.))) + int((double(_sums[4]) / 3.)); //eq. AD
304 
305  _Xeq[i][0] = (_difs[10] + 3. * K0) / 4.;
306  _Xeq[i][1] = (_difs[4] + 3. * K0) / 4.;
307  }
308 
309  i = 8; // i = DTBtiChipEQMAP->index("1368B"); --> 1R3R6R8L
310  if (PTMS[i]) {
311  _Keq[i][0] = -_difs[1] + 2. * K0;
312  _Keq[i][1] = -_difs[10] + 2. * K0;
313  _Keq[i][2] = (_sums[20]);
314  _Keq[i][3] = -(_difs[3] / 2.) + 2. * K0 + 0.01;
315  _Keq[i][4] = (_sums[11] / 2.) + K0 + 0.01;
316  //_Keq[i][5] = (_sums[4]/3.) + 4.*K0/3.;
317  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(_sums[4]), 3.))) + int((double(_sums[4]) / 3.)); //eq. AD
318 
319  _Xeq[i][0] = (-_sums[10] + 5. * K0) / 4.;
320  _Xeq[i][1] = (_difs[4] + 3. * K0) / 4.;
321  }
322 
323  i = 9; // i = DTBtiChipEQMAP->index("1368C"); --> 1R3L6L8L
324  if (PTMS[i]) {
325  _Keq[i][0] = (_sums[1]);
326  _Keq[i][1] = _difs[10] + 2. * K0;
327  _Keq[i][2] = _difs[20] + 2. * K0;
328  _Keq[i][3] = (_sums[3] / 2.) + K0 + 0.01;
329  _Keq[i][4] = (_difs[11] / 2.) + 2. * K0 + 0.01;
330  //_Keq[i][5] = (_sums[4]/3.) + 4.*K0/3.;
331  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(_sums[4]), 3.))) + int((double(_sums[4]) / 3.)); //eq. AD
332 
333  _Xeq[i][0] = (_sums[10] + K0) / 4.;
334  _Xeq[i][1] = (_difs[4] + 3. * K0) / 4.;
335  }
336 
337  i = 10; // i = DTBtiChipEQMAP->index("5324A"); --> 5L3L2R4L
338  if (PTMS[i]) {
339  _Keq[i][0] = -_difs[9];
340  _Keq[i][1] = -_sums[5] + 2. * K0;
341  _Keq[i][2] = _sums[6];
342  _Keq[i][3] = -(_sums[7] / 2.) + K0 + 0.01;
343  _Keq[i][4] = (_difs[8] / 2.) + K0 + 0.01;
344  //_Keq[i][5] = -(_difs[12]/3.) + 2.*K0/3.;
345  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(-_difs[12]), 3.))) + int((double(-_difs[12]) / 3.)); //eq. AD
346 
347  _Xeq[i][0] = (_difs[5] + K0) / 4.;
348  _Xeq[i][1] = (_sums[12] + K0) / 4.;
349  }
350 
351  i = 11; // i = DTBtiChipEQMAP->index("5324B"); --> 5L3R2R4L
352  if (PTMS[i]) {
353  _Keq[i][0] = -_sums[9] + 2. * K0;
354  _Keq[i][1] = _difs[5];
355  _Keq[i][2] = _sums[6];
356  _Keq[i][3] = -(_sums[7] / 2.) + K0 + 0.01;
357  _Keq[i][4] = (_sums[8] / 2. + 0.01);
358  //_Keq[i][5] = -(_difs[12]/3.) + 2.*K0/3.;
359  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(-_difs[12]), 3.))) + int((double(-_difs[12]) / 3.)); //eq. AD
360 
361  _Xeq[i][0] = (-_sums[5] + 3. * K0) / 4.;
362  _Xeq[i][1] = (_sums[12] + K0) / 4.;
363  }
364 
365  i = 12; // i = DTBtiChipEQMAP->index("5324C"); --> 5R3R2R4L
366  if (PTMS[i]) {
367  _Keq[i][0] = _difs[9];
368  _Keq[i][1] = _difs[5];
369  _Keq[i][2] = (_sums[6]);
370  _Keq[i][3] = (_difs[7] / 2.) + 0.01;
371  _Keq[i][4] = (_sums[8] / 2.) + 0.01;
372  _Keq[i][5] = (_sums[12] / 3.) + 0.51;
373 
374  _Xeq[i][0] = (-_sums[5] + 3. * K0) / 4.;
375  _Xeq[i][1] = (-_difs[12] + 3. * K0) / 4.;
376  }
377 
378  i = 13; // i = DTBtiChipEQMAP->index("5364A"); --> 5L3R6L4L
379  if (PTMS[i]) {
380  _Keq[i][0] = -_sums[9] + 2. * K0;
381  _Keq[i][1] = _sums[10];
382  _Keq[i][2] = -_difs[13];
383  _Keq[i][3] = (_difs[16] / 2.) + K0 + 0.01;
384  _Keq[i][4] = (_sums[8] / 2. + 0.01);
385  //_Keq[i][5] = -(_difs[12]/3.) + 2.*K0/3.;
386  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(-_difs[12]), 3.))) + int((double(-_difs[12]) / 3.)); //eq. AD
387 
388  _Xeq[i][0] = (_difs[10] + 3. * K0) / 4.;
389  _Xeq[i][1] = (_sums[12] + K0) / 4.;
390  }
391 
392  i = 14; // i = DTBtiChipEQMAP->index("5364B"); --> 5L3R6L4R
393  if (PTMS[i]) {
394  _Keq[i][0] = -_sums[9] + 2. * K0;
395  _Keq[i][1] = _sums[10];
396  _Keq[i][2] = -_sums[13] + 2. * K0;
397  _Keq[i][3] = (_difs[16] / 2.) + K0 + 0.01;
398  _Keq[i][4] = -(_difs[8] / 2.) + K0 + 0.01;
399  //_Keq[i][5] = -(_sums[12]/3.) + 4.*K0/3.;
400  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(-_sums[12]), 3.))) + int((double(-_sums[12]) / 3.));
401 
402  _Xeq[i][0] = (_difs[10] + 3. * K0) / 4.;
403  _Xeq[i][1] = (_difs[12] + 3. * K0) / 4.;
404  }
405 
406  i = 15; // i = DTBtiChipEQMAP->index("5364C"); --> 5R3R6L4L
407  if (PTMS[i]) {
408  _Keq[i][0] = _difs[9];
409  _Keq[i][1] = (_sums[10]);
410  _Keq[i][2] = -_difs[13];
411  _Keq[i][3] = (_sums[16] / 2. + 0.01);
412  _Keq[i][4] = (_sums[8] / 2. + 0.01);
413  _Keq[i][5] = (_sums[12] / 3.) + 0.51;
414 
415  _Xeq[i][0] = (_difs[10] + 3. * K0) / 4.;
416  _Xeq[i][1] = (-_difs[12] + 3. * K0) / 4.;
417  }
418 
419  i = 16; // i = DTBtiChipEQMAP->index("5364D"); --> 5R3R6L4R
420  if (PTMS[i]) {
421  _Keq[i][0] = _difs[9];
422  _Keq[i][1] = _sums[10];
423  _Keq[i][2] = -_sums[13] + 2. * K0;
424  _Keq[i][3] = (_sums[16] / 2. + 0.01);
425  _Keq[i][4] = -(_difs[8] / 2.) + K0 + 0.01;
426  //_Keq[i][5] = (_difs[12]/3.) + 2.*K0/3.;
427  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(_difs[12]), 3.))) + int((double(_difs[12]) / 3.)); //eq. AD
428 
429  _Xeq[i][0] = (_difs[10] + 3. * K0) / 4.;
430  _Xeq[i][1] = (-_sums[12] + 5. * K0) / 4.;
431  }
432 
433  i = 17; // i = DTBtiChipEQMAP->index("5368A"); --> 5L3R6L8L
434  if (PTMS[i]) {
435  _Keq[i][0] = -_sums[9] + 2. * K0;
436  _Keq[i][1] = _sums[10];
437  _Keq[i][2] = _difs[20] + 2. * K0;
438  _Keq[i][3] = (_difs[16] / 2.) + K0 + 0.01;
439  _Keq[i][4] = (_sums[11] / 2.) + K0 + 0.01;
440  //_Keq[i][5] = (_difs[18]/3.) + 4.*K0/3.;
441  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(_difs[18]), 3.))) + int((double(_difs[18]) / 3.)); //eq. AD
442 
443  _Xeq[i][0] = (_difs[10] + 3. * K0) / 4.;
444  _Xeq[i][1] = (_sums[18] + 3. * K0) / 4.;
445  }
446 
447  i = 18; // i = DTBtiChipEQMAP->index("5368B"); --> 5L3R6R8L
448  if (PTMS[i]) {
449  _Keq[i][0] = -_sums[9] + 2. * K0;
450  _Keq[i][1] = -_difs[10] + 2. * K0;
451  _Keq[i][2] = _sums[20];
452  _Keq[i][3] = -(_sums[16] / 2.) + 2. * K0 + 0.01;
453  _Keq[i][4] = (_sums[11] / 2.) + K0 + 0.01;
454  //_Keq[i][5] = (_difs[18]/3.) + 4.*K0/3.;
455  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(_difs[18]), 3.))) + int((double(_difs[18]) / 3.)); //eq. AD
456 
457  _Xeq[i][0] = (-_sums[10] + 5. * K0) / 4.;
458  _Xeq[i][1] = (_sums[18] + 3. * K0) / 4.;
459  }
460 
461  i = 19; // i = DTBtiChipEQMAP->index("5368C"); --> 5L3R6R8R
462  if (PTMS[i]) {
463  _Keq[i][0] = -(_sums[9]) + 2. * K0;
464  _Keq[i][1] = -_difs[10] + 2. * K0;
465  _Keq[i][2] = -_difs[20] + 2. * K0;
466  _Keq[i][3] = -(_sums[16] / 2.) + 2. * K0 + 0.01;
467  _Keq[i][4] = -(_difs[11] / 2.) + 2. * K0 + 0.01;
468  //_Keq[i][5] = -(_sums[18]/3.) + 2.*K0 + 0.51;
469  _Keq[i][5] = ST2 + reSum23(0, int(fmod(double(-_sums[18]), 3.))) + int((double(-_sums[18]) / 3.));
470 
471  _Xeq[i][0] = (-_sums[10] + 5. * K0) / 4.;
472  _Xeq[i][1] = (-_difs[18] + 5. * K0) / 4.;
473  }
474 
475  i = 20; // i = DTBtiChipEQMAP->index("5764A"); --> 5R7L6L4R
476  if (PTMS[i]) {
477  _Keq[i][0] = _sums[17];
478  _Keq[i][1] = -_difs[19];
479  _Keq[i][2] = -_sums[13] + 2. * K0;
480  _Keq[i][3] = (_sums[16] / 2. + 0.01);
481  _Keq[i][4] = -(_sums[14] / 2.) + K0 + 0.01;
482  //_Keq[i][5] = (_difs[12]/3.) + 2.*K0/3.;
483  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(_difs[12]), 3.))) + int((double(_difs[12]) / 3.)); //eq. AD
484 
485  _Xeq[i][0] = (_sums[19] + 3. * K0) / 4.;
486  _Xeq[i][1] = (-_sums[12] + 5. * K0) / 4.;
487  }
488 
489  i = 21; // i = DTBtiChipEQMAP->index("5764B"); --> 5R7L6R4R
490  if (PTMS[i]) {
491  _Keq[i][0] = _sums[17];
492  _Keq[i][1] = -_sums[19] + 2. * K0;
493  _Keq[i][2] = _difs[13];
494  _Keq[i][3] = -(_difs[16] / 2.) + K0 + 0.01;
495  _Keq[i][4] = -(_sums[14] / 2.) + K0 + 0.01;
496  //_Keq[i][5] = (_difs[12]/3.) + 2.*K0/3.;
497  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(_difs[12]), 3.))) + int((double(_difs[12]) / 3.)); //eq. AD
498 
499  _Xeq[i][0] = (_difs[19] + 5. * K0) / 4.;
500  _Xeq[i][1] = (-_sums[12] + 5. * K0) / 4.;
501  }
502 
503  i = 22; // i = DTBtiChipEQMAP->index("5764C"); --> 5R7L6L4L
504  if (PTMS[i]) {
505  _Keq[i][0] = (_sums[17]);
506  _Keq[i][1] = -_difs[19];
507  _Keq[i][2] = -_difs[13];
508  _Keq[i][3] = (_sums[16] / 2. + 0.01);
509  _Keq[i][4] = -(_difs[14] / 2.) + 0.01;
510  _Keq[i][5] = (_sums[12] / 3.) + 0.51;
511 
512  _Xeq[i][0] = (_sums[19] + 3. * K0) / 4.;
513  _Xeq[i][1] = (-_difs[12] + 3. * K0) / 4.;
514  }
515 
516  i = 23; // i = DTBtiChipEQMAP->index("9764A"); --> 9L7L6L4R
517  if (PTMS[i]) {
518  _Keq[i][0] = -_difs[23];
519  _Keq[i][1] = -_difs[19];
520  _Keq[i][2] = -(_sums[13]) + 2. * K0;
521  _Keq[i][3] = -(_difs[21] / 2.) + 0.01;
522  _Keq[i][4] = -(_sums[14] / 2.) + K0 + 0.01;
523  //_Keq[i][5] = -(_sums[15]/3.) + 2.*K0/3.;
524  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(-_sums[15]), 3.))) + int((double(-_sums[15]) / 3.)); //eq. AD
525 
526  _Xeq[i][0] = (_sums[19] + 3. * K0) / 4.;
527  _Xeq[i][1] = (_difs[15] + 5. * K0) / 4.;
528  }
529 
530  i = 24; // i = DTBtiChipEQMAP->index("9764B"); --> 9L7L6R4R
531  if (PTMS[i]) {
532  _Keq[i][0] = -_difs[23];
533  _Keq[i][1] = -(_sums[19]) + 2. * K0;
534  _Keq[i][2] = _difs[13];
535  _Keq[i][3] = -(_sums[21] / 2.) + K0 + 0.01;
536  _Keq[i][4] = -(_sums[14] / 2.) + K0 + 0.01;
537  //_Keq[i][5] = -(_sums[15]/3.) + 2.*K0/3.;
538  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(-_sums[15]), 3.))) + int((double(-_sums[15]) / 3.)); //eq. AD
539 
540  _Xeq[i][0] = (_difs[19] + 5. * K0) / 4.;
541  _Xeq[i][1] = (_difs[15] + 5. * K0) / 4.;
542  }
543 
544  i = 25; // i = DTBtiChipEQMAP->index("9764C"); --> 9L7R6R4R
545  if (PTMS[i]) {
546  _Keq[i][0] = -(_sums[23]) + 2. * K0;
547  _Keq[i][1] = _difs[19];
548  _Keq[i][2] = _difs[13];
549  _Keq[i][3] = -(_sums[21] / 2.) + K0 + 0.01;
550  _Keq[i][4] = (_difs[14] / 2.) + 0.01;
551  //_Keq[i][5] = -(_sums[15]/3.) + 2.*K0/3.;
552  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(-_sums[15]), 3.))) + int((double(-_sums[15]) / 3.)); //eq. AD
553 
554  _Xeq[i][0] = (-_sums[19] + 7. * K0) / 4.;
555  _Xeq[i][1] = (_difs[15] + 5. * K0) / 4.;
556  }
557 
558  i = 26; // int i = DTBtiChipEQMAP->index("5768A") --> 5L7L6R8L
559  if (PTMS[i]) {
560  _Keq[i][0] = _difs[17] + 2. * K0;
561  _Keq[i][1] = -_sums[19] + 2. * K0;
562  _Keq[i][2] = _sums[20];
563  _Keq[i][3] = -(_sums[16] / 2.) + 2. * K0 + 0.01;
564  _Keq[i][4] = (_difs[22] / 2.) + K0 + 0.01;
565  //_Keq[i][5] = (_difs[18]/3.) + 4.*K0/3.;
566  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(_difs[18]), 3.))) + int((double(_difs[18]) / 3.)); //eq. AD
567 
568  _Xeq[i][0] = (_difs[19] + 5. * K0) / 4.;
569  _Xeq[i][1] = (_sums[18] + 3. * K0) / 4.;
570  }
571 
572  i = 27; // i = DTBtiChipEQMAP->index("5768B"); --> 5L7L6R8R
573  if (PTMS[i]) {
574  _Keq[i][0] = _difs[17] + 2. * K0;
575  _Keq[i][1] = -(_sums[19]) + 2. * K0;
576  _Keq[i][2] = -_difs[20] + 2. * K0;
577  _Keq[i][3] = -(_sums[16] / 2.) + 2. * K0 + 0.01;
578  _Keq[i][4] = -(_sums[22] / 2.) + 2. * K0 + 0.01;
579  //_Keq[i][5] = -(_sums[18]/3.) + 2.*K0 + 0.51;
580  _Keq[i][5] = ST2 + reSum23(0, int(fmod(double(-_sums[18]), 3.))) + int((double(-_sums[18]) / 3.));
581 
582  _Xeq[i][0] = (_difs[19] + 5. * K0) / 4.;
583  _Xeq[i][1] = (-_difs[18] + 5. * K0) / 4.;
584  }
585 
586  i = 28; // i = DTBtiChipEQMAP->index("5768C"); --> 5R7L6R8L
587  if (PTMS[i]) {
588  _Keq[i][0] = _sums[17];
589  _Keq[i][1] = -_sums[19] + 2. * K0;
590  _Keq[i][2] = _sums[20];
591  _Keq[i][3] = -(_difs[16] / 2.) + K0 + 0.01;
592  _Keq[i][4] = (_difs[22] / 2.) + K0 + 0.01;
593  //_Keq[i][5] = (_sums[18]/3.) + 2.*K0/3.;
594  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(_sums[18]), 3.))) + int((double(_sums[18]) / 3.)); //eq. AD
595 
596  _Xeq[i][0] = (_difs[19] + 5. * K0) / 4.;
597  _Xeq[i][1] = (_difs[18] + 5. * K0) / 4.;
598  }
599 
600  i = 29; // i = DTBtiChipEQMAP->index("5768D"); --> 5R7L6R8R
601  if (PTMS[i]) {
602  _Keq[i][0] = _sums[17];
603  _Keq[i][1] = -_sums[19] + 2. * K0;
604  _Keq[i][2] = -_difs[20] + 2. * K0;
605  _Keq[i][3] = -(_difs[16] / 2.) + K0 + 0.01;
606  _Keq[i][4] = -(_sums[22] / 2.) + 2. * K0 + 0.01;
607  //_Keq[i][5] = -(_difs[18]/3.) + 4.*K0/3. ;
608  _Keq[i][5] = ST43 + reSum(RE43, int(fmod(double(-_difs[18]), 3.))) + int((double(-_difs[18]) / 3.)); //eq. AD
609 
610  _Xeq[i][0] = (_difs[19] + 5. * K0) / 4.;
611  _Xeq[i][1] = (-_sums[18] + 7. * K0) / 4.;
612  }
613 
614  i = 30; // 9768A --> 9L7L6R8L
615  if (PTMS[i]) {
616  _Keq[i][0] = -_difs[23];
617  _Keq[i][1] = -_sums[19] + 2. * K0;
618  _Keq[i][2] = _sums[20];
619  _Keq[i][3] = -(_sums[21] / 2.) + K0 + 0.01;
620  _Keq[i][4] = (_difs[22] / 2.) + K0 + 0.01;
621  //_Keq[i][5] = -(_difs[24]/3.) + 2.*K0/3. ;
622  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(-_difs[24]), 3.))) + int((double(-_difs[24]) / 3.)); //eq. AD
623 
624  _Xeq[i][0] = (_difs[19] + 5. * K0) / 4.;
625  _Xeq[i][1] = (_sums[24] + 5. * K0) / 4.;
626  }
627 
628  i = 31; // 9768B --> 9L7R6R8L
629  if (PTMS[i]) {
630  _Keq[i][0] = -_sums[23] + 2. * K0;
631  _Keq[i][1] = _difs[19];
632  _Keq[i][2] = _sums[20];
633  _Keq[i][3] = -(_sums[21] / 2.) + K0 + 0.01;
634  _Keq[i][4] = (_sums[22] / 2.) + 0.01;
635  //_Keq[i][5] = -(_difs[24]/3.) + 2.*K0/3.;
636  _Keq[i][5] = ST23 + reSum23(RE23, int(fmod(double(-_difs[24]), 3.))) + int((double(-_difs[24]) / 3.)); //eq. AD
637 
638  _Xeq[i][0] = (-_sums[19] + 7. * K0) / 4.;
639  _Xeq[i][1] = (_sums[24] + 5. * K0) / 4.;
640  }
641 
642  // debugging
643  if (config()->debug() > 3) {
644  cout << endl << " Step: " << currentStep() << endl;
645  for (i = 0; i < 32; i++) {
646  if (PTMS[i]) {
647  cout << "K Equation " << i << " --> ";
648  int j = 0;
649  for (j = 0; j < 6; j++) {
650  cout << _Keq[i][j] << " ";
651  }
652  cout << endl;
653  cout << "X Equation " << i << " --> ";
654  for (j = 0; j < 2; j++) {
655  cout << _Xeq[i][j] << " ";
656  }
657  if (i == 0) {
658  cout << _XeqAB_patt0 << " " << _XeqCD_patt0 << " ";
659  cout << _XeqAC_patt0 << " " << _XeqBD_patt0 << " ";
660  }
661  cout << endl;
662  }
663  }
664  }
665  // end debugging
666 }
mps_fire.i
i
Definition: mps_fire.py:355
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
DTBtiChip::reSumSet
void reSumSet()
Definition: DTBtiChipEquations.cc:96
L1DTConfigBti_cff.ST43
ST43
Definition: L1DTConfigBti_cff.py:73
gather_cfg.cout
cout
Definition: gather_cfg.py:144
DTBtiHit.h
DTBtiChip::computeEqs
void computeEqs()
Definition: DTBtiChipEquations.cc:134
alignCSCRings.s
s
Definition: alignCSCRings.py:92
debug
#define debug
Definition: HDRShower.cc:19
looper.config
config
Definition: looper.py:291
b
double b
Definition: hdecay.h:118
L1DTConfigBti_cff.RE43
RE43
Definition: L1DTConfigBti_cff.py:29
std::empty
constexpr auto empty(const C &c) -> decltype(c.empty())
Definition: cuda_cxx17.h:24
DTBtiChip::sum
void sum(const int s, const int a, const int b)
Definition: DTBtiChipEquations.cc:80
DTBtiChip.h
a
double a
Definition: hdecay.h:119
createfilelist.int
int
Definition: createfilelist.py:10
std
Definition: JetResolutionObject.h:76
DTBtiChip::computeSums
void computeSums()
Definition: DTBtiChipEquations.cc:38
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
begin
#define begin
Definition: vmac.h:32