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