34 m_oldSimulation = oldSimulation;
42 m_feet_thresholds[0] = 0;
43 m_feet_thresholds[1] = 1;
44 m_feet_thresholds[2] = 2;
46 if (padDebug & 1 <<
df) {
47 cout <<
" ==================== " << endl;
48 cout <<
" = Pad::Pad = " << endl;
49 cout <<
" ==================== " << endl;
50 cout <<
" m_run= " << m_run <<
" m_event= " << m_event <<
" padDebug= " << hex << padDebug << dec << endl;
51 cout <<
" Pad parameters: Subsystem: " << m_subsystem <<
" Sector: " << m_sector <<
" Pad address: " << m_padadd
52 <<
" LowHigh: " << m_lowhigh <<
" m_oldSimulation: " << m_oldSimulation << endl;
56 setDefaultConfiguration();
61 if (padDebug & 1 <<
df) cout <<
"Distructor of Pad called " << endl;
70 for (
m = 0;
m < 2;
m++) {
71 for (
k = 0;
k < 2;
k++) {
72 for (j = 0; j < 2; j++) {
73 for (
l = 0;
l < m_nBunMax;
l++) {
74 for (
i = 0;
i < 2;
i++) {
75 m_padIn[
m][
k][j][
l][
i] = 0;
82 for (
l = 0;
l < m_nBunMax;
l++) {
83 for (
k = 0;
k < 8;
k++) {
84 m_padStep2[
l][0][
k] = 0;
85 m_padStep2[
l][1][
k] = 0;
87 for (
k = 0;
k < 7;
k++) {
95 m_projectionLogic = 2;
99 m_thHitOuterPlane = 0;
101 m_hitInOuterPlane[0] = 0;
102 m_hitInOuterPlane[1] = 0;
103 m_hitInOuterPlane[2] = 0;
104 if (m_thHitOuterPlane) m_hitInOuterPlane[m_thHitOuterPlane - 1] = 1;
105 if (padDebug & 1 <<
df) {
106 cout <<
" Pad: m_hitInOuterPlane= " << m_hitInOuterPlane[0] <<
" " << m_hitInOuterPlane[1] <<
" " << m_hitInOuterPlane[2] <<
" "
108 cout <<
" Pad: projectionLogic= " << m_projectionLogic << endl;
114 m_projectionLogic = prologic;
116 cout <<
" Pad.setProjectionLogic; prologic= " << prologic <<
" not allowed; default value " << m_projectionLogic <<
" is retained "
132 if (lowhig > 1 || etaphi > 1 || locCMadd > 1 || BX >= m_nBunMax) {
133 cout <<
" Pad::load : lowhig=" << lowhig <<
" etaphi=" << etaphi <<
" locCMadd=" << locCMadd <<
" BX=" << BX <<
" not valid"
136 m_padIn[lowhig][etaphi][locCMadd][BX][0] = thres;
137 m_padIn[lowhig][etaphi][locCMadd][BX][1] = overl;
143 if (padDebug & 1 <<
df) cout <<
" execute PAD " << endl;
148 if (m_feet_on) makeFeet();
161 for (
m = 0;
m < 2;
m++) {
162 for (j = 0; j < 2; j++) {
163 for (
i = 0;
i < 2;
i++) {
164 for (
l = 0;
l < m_nBunMax;
l++) {
165 if (m_padIn[
m][j][
i][
l][0]) {
166 if (
m && m_hitInOuterPlane[m_padIn[
m][j][
i][
l][0] - 1]) {
167 m_padStep2[
l][
i][6] = 1;
170 thisThreshold = 3 *
m + m_padIn[
m][j][
i][
l][0];
172 if (thisThreshold > m_padStep2[
l][j][
i]) {
173 if (m_padStep2[
l][j][
i] == 0) m_padStep2[
l][j][7]++;
174 m_padStep2[
l][j][
i] = thisThreshold;
177 if (thisThreshold > m_padStep2[
l][j][2]) {
178 m_padStep2[
l][j][2] = thisThreshold;
179 m_padStep2[
l][j][3] =
i;
180 if (padDebug & 1 <<
df) {
181 cout <<
" Pad::threshold; padStep2 eta-phi " << j <<
" localAdd " <<
i <<
" Bunch " <<
l
182 <<
" threshold " << m_padStep2[
l][j][2] << endl;
185 m_padStep2[
l][j][4]++;
197 for (
l = 0;
l < m_nBunMax;
l++) {
198 for (j = 0; j < 2; j++) {
199 for (
i = 0;
i < 2;
i++) {
202 if (m_padIn[j][
i][1][
l][1] & 2) m_padStep2[
l][
i][5] = 1;
203 if (m_padIn[j][
i][0][
l][1] & 1) m_padStep2[
l][
i][5] = 1;
211 switch (m_projectionLogic) {
212 case 0: makeOutEta();
break;
213 case 1: makeOutPhi();
break;
214 case 2: makeOutEtaAndPhi();
break;
215 case 3: makeOutEtaOrPhi();
break;
216 default: cout <<
" Pad: problems with projectionLogic= " << m_projectionLogic << endl;
224 for (
l = 0;
l < m_nBunMax;
l++) {
225 if (m_padStep2[
l][0][2]) {
227 if (m_oldSimulation) {
228 m_padOut[
l][0] = 2 * m_padStep2[
l][0][3];
230 m_padOut[
l][0] = m_padStep2[
l][0][3];
232 m_padOut[
l][1] = m_padStep2[
l][0][2];
233 m_padOut[
l][2] = m_padStep2[
l][0][6];
234 if (m_padStep2[
l][0][5]) m_padOut[
l][4] = 1;
243 for (
l = 0;
l < m_nBunMax;
l++) {
244 if (m_padStep2[
l][1][2]) {
246 if (m_oldSimulation) {
247 m_padOut[
l][0] = m_padStep2[
l][1][3];
249 m_padOut[
l][0] = 2 * m_padStep2[
l][1][3];
251 m_padOut[
l][1] = m_padStep2[
l][1][2];
252 m_padOut[
l][2] = m_padStep2[
l][1][6];
253 if (m_padStep2[
l][1][5]) m_padOut[
l][3] = 1;
262 for (
l = 0;
l < m_nBunMax;
l++) {
263 if (m_padStep2[
l][0][2] && m_padStep2[
l][1][2]) {
265 if (m_oldSimulation) {
266 m_padOut[
l][0] = m_padStep2[
l][1][3] + 2 * m_padStep2[
l][0][3];
268 m_padOut[
l][0] = m_padStep2[
l][0][3] + 2 * m_padStep2[
l][1][3];
270 if (m_padStep2[
l][0][2] < m_padStep2[
l][1][2]) {
271 m_padOut[
l][1] = m_padStep2[
l][0][2];
272 m_padOut[
l][2] = m_padStep2[
l][0][6];
274 m_padOut[
l][1] = m_padStep2[
l][1][2];
275 m_padOut[
l][2] = m_padStep2[
l][1][6];
277 if (m_padStep2[
l][1][5]) m_padOut[
l][3] = 1;
278 if (m_padStep2[
l][0][5]) m_padOut[
l][4] = 1;
279 if (m_padStep2[
l][0][7] + m_padStep2[
l][1][7] > 2) m_padOut[
l][5] = 1;
287 for (
l = 0;
l < m_nBunMax;
l++) {
288 if (m_padStep2[
l][0][2] || m_padStep2[
l][1][2]) {
289 if (m_padStep2[
l][0][2] && !m_padStep2[
l][1][2]) {
291 }
else if (m_padStep2[
l][1][2] && !m_padStep2[
l][0][2]) {
302 for (
l = 0;
l < m_nBunMax;
l++) {
303 if (m_padOut[
l][1] > 0) m_padOut[
l][1] = m_feet_thresholds[m_padOut[
l][1] - 1] + 1;
312 char padOutText[7][6];
313 strcpy(padOutText[0],
"RoI");
314 strcpy(padOutText[1],
"Ptcod");
315 strcpy(padOutText[2],
"OPL");
316 strcpy(padOutText[3],
"OvPhi");
317 strcpy(padOutText[4],
"OvEta");
318 strcpy(padOutText[5],
"RoIAm");
319 strcpy(padOutText[6],
"BCDcn");
322 cout <<
" ************************************* " << endl;
323 cout <<
" * * " << endl;
324 cout <<
" * P A D D I S P L A Y * " << endl;
325 cout <<
" * * " << endl;
326 cout <<
" ************************************* " << endl;
328 cout <<
" P A R A M E T E R S: " << endl;
329 cout <<
" Subsystem " << m_subsystem << endl;
330 cout <<
" Sector " << m_sector << endl;
331 cout <<
" PAD addr " << m_padadd << endl;
332 cout <<
" Low-High " << m_lowhigh << endl;
333 cout <<
"m_oldSimulation:" << m_oldSimulation << endl;
334 cout <<
" feet_on:" << m_feet_on;
336 cout <<
" feet_thresholds:" << m_feet_thresholds[0] <<
"," << m_feet_thresholds[1] <<
"," << m_feet_thresholds[2] << endl;
340 cout <<
" D U M P padStep2 " << endl;
342 cout <<
"Projection Eta ";
344 cout <<
"Projection Phi " << endl;
346 cout <<
"---------------";
348 cout <<
"---------------" << endl;
350 cout <<
"C C t a n o O A";
352 cout <<
"C C t a n o O A" << endl;
354 cout <<
"M M h d u v P m";
356 cout <<
"M M h d u v P m" << endl;
358 cout <<
"0 1 r d m e L b";
360 cout <<
"0 1 r d m e L b" << endl;
364 cout <<
" e r r i" << endl;
367 for (j = 0; j < m_nBunMax; j++) {
368 cout <<
" Bunch Crossing Number " << j <<
" ";
369 for (
i = 0;
i < 2;
i++) {
370 cout <<
" " << m_padStep2[j][
i][0] <<
" " << m_padStep2[j][
i][1] <<
" " << m_padStep2[j][
i][2] <<
" " << m_padStep2[j][
i][3]
371 <<
" " << m_padStep2[j][
i][4] <<
" " << m_padStep2[j][
i][5] <<
" " << m_padStep2[j][
i][6] <<
" "
372 << m_padStep2[j][
i][7];
373 if (
i == 0) cout <<
" ";
383 cout <<
" D U M P PadOut " << endl;
384 for (
i = 0;
i < m_nBunMax;
i++) {
385 cout <<
" Pad: padOut Bunch=" <<
i <<
":";
386 for (j = 0; j < 7; j++) { cout <<
" " << padOutText[j] <<
" " << m_padOut[
i][j]; }
402 if (bunch < m_nBunMax) {
403 output = m_padOut[bunch][0];
405 cout <<
" getRoI; Error: bunch address " << bunch <<
" not consistent with m_nBunMax= " << m_nBunMax << endl;
412 if (bunch < m_nBunMax) {
413 output = m_padOut[bunch][1];
415 cout <<
" getPTCoding; Error: bunch address " << bunch <<
" not consistent with m_nBunMax= " << m_nBunMax << endl;
422 if (bunch < m_nBunMax) {
423 output = m_padOut[bunch][2];
425 cout <<
" getOPL; Error: bunch address " << bunch <<
" not consistent with m_nBunMax= " << m_nBunMax << endl;
432 if (bunch < m_nBunMax) {
433 output = m_padOut[bunch][3];
435 cout <<
" getOverlapPhi; Error: bunch address " << bunch <<
" not consistent with m_nBunMax= " << m_nBunMax << endl;
442 if (bunch < m_nBunMax) {
443 output = m_padOut[bunch][4];
445 cout <<
" getOverlapEta; Error: bunch address " << bunch <<
" not consistent with m_nBunMax= " << m_nBunMax << endl;
452 if (bunch < m_nBunMax) {
453 output = m_padOut[bunch][5];
455 cout <<
" getRoIAmbiguity; Error: bunch address " << bunch <<
" not consistent with m_nBunMax= " << m_nBunMax << endl;
462 if (bunch < m_nBunMax) {
463 output = m_padOut[bunch][6];
465 cout <<
" getBCIDCounter; Error: bunch address " << bunch <<
" not consistent with m_nBunMax= " << m_nBunMax << endl;