ATLAS Offline Software
CMAparameters.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include <cmath>
8 
9 #include <iomanip>
10 #include <vector>
11 
14 
15 bool CMAparameters::isAtlas() const { return m_conf_type == Atlas; }
16 
17 const CMAidentity& CMAparameters::id() const { return *m_id; }
20 
25 
29 
33 
38 
43 
47 
51 
55 
56 unsigned int CMAparameters::first_pivot_code() const { return m_first_pivot_code; }
57 unsigned int CMAparameters::last_pivot_code() const { return m_last_pivot_code; }
58 unsigned int CMAparameters::first_lowPt_code() const { return m_first_lowPt_code; }
59 unsigned int CMAparameters::last_lowPt_code() const { return m_last_lowPt_code; }
60 unsigned int CMAparameters::first_highPt_code() const { return m_first_highPt_code; }
61 unsigned int CMAparameters::last_highPt_code() const { return m_last_highPt_code; }
62 
64 
67  m_params{parse},
68  m_id (std::make_unique<CMAidentity>(parse))
69 {
70 }
71 
73  : CablingObject(cma),
74  m_params{cma.m_params},
75  m_id (std::make_unique<CMAidentity>(cma.id()))
76 {
77  const CMAprogram* proglow = cma.lowPt_program();
78  const CMAprogram* proghigh = cma.highPt_program();
79  if (proglow) { m_lowPt_program = std ::make_unique<CMAprogram>(*proglow); }
80  if (proghigh) { m_highPt_program = std::make_unique<CMAprogram>(*proghigh); }
81 
82  m_highPt_start_st = cma.highPt_start_st();
83  m_highPt_start_ch = cma.highPt_start_ch();
84  m_highPt_stop_st = cma.highPt_stop_st();
85  m_highPt_stop_ch = cma.highPt_stop_ch();
86 
87  m_active_pivot_chs = cma.active_pivot_chs();
88  m_active_lowPt_chs = cma.active_lowPt_chs();
89  m_active_highPt_chs = cma.active_highPt_chs();
90 
91  m_pivot = nullptr;
92  m_lowPt = nullptr;
93  m_highPt = nullptr;
94 
95  reset_pivot_cabling();
96  reset_lowPt_cabling();
97  reset_highPt_cabling();
98 
99  m_pivot_rpc_read = cma.pivot_rpc_read();
100  m_lowPt_rpc_read = cma.lowPt_rpc_read();
101  m_highPt_rpc_read = cma.highPt_rpc_read();
102 
103  if (cma.m_pivot) {
104  m_pivot = new int[m_pivot_rpc_read][2][CMAparameters::pivot_channels];
105  for (int i = 0; i < m_pivot_rpc_read; ++i)
106  for (int j = 0; j < 2; ++j)
107  for (int k = 0; k < CMAparameters::pivot_channels; ++k) m_pivot[i][j][k] = cma.m_pivot[i][j][k];
108  }
109  if (cma.m_lowPt) {
110  m_lowPt = new int[m_lowPt_rpc_read][2][CMAparameters::confirm_channels];
111  for (int i = 0; i < m_lowPt_rpc_read; ++i)
112  for (int j = 0; j < 2; ++j)
113  for (int k = 0; k < CMAparameters::confirm_channels; ++k) m_lowPt[i][j][k] = cma.m_lowPt[i][j][k];
114  }
115  if (cma.m_highPt) {
116  m_highPt = new int[m_highPt_rpc_read][2][CMAparameters::confirm_channels];
117  for (int i = 0; i < m_highPt_rpc_read; ++i)
118  for (int j = 0; j < 2; ++j)
119  for (int k = 0; k < CMAparameters::confirm_channels; ++k) m_highPt[i][j][k] = cma.m_highPt[i][j][k];
120  }
121 
122  m_first_pivot_code = cma.first_pivot_code();
123  m_last_pivot_code = cma.last_pivot_code();
124  m_first_lowPt_code = cma.first_lowPt_code();
125  m_last_lowPt_code = cma.last_lowPt_code();
126  m_first_highPt_code = cma.first_highPt_code();
127  m_last_highPt_code = cma.last_highPt_code();
128 
129  m_conf_type = cma.conf_type();
130 }
131 
133  if (m_pivot) delete[] m_pivot;
134  if (m_lowPt) delete[] m_lowPt;
135  if (m_highPt) delete[] m_highPt;
136 }
137 
139  if (this != &cma) {
141  m_params = cma.m_params;
142  m_id = std::make_unique<CMAidentity>(cma.id());
143 
144  const CMAprogram* proglow = cma.lowPt_program();
145  const CMAprogram* proghigh = cma.highPt_program();
146  if (proglow) {
147  m_lowPt_program = std::make_unique<CMAprogram>(*proglow);
148  } else
149  m_lowPt_program.reset();
150  if (proghigh) {
151  m_highPt_program = std::make_unique<CMAprogram>(*proghigh);
152  } else
153  m_highPt_program.reset();
154 
159 
164 
168 
172 
176 
177  if (cma.m_pivot) {
179  for (int i = 0; i < m_pivot_rpc_read; ++i)
180  for (int j = 0; j < 2; ++j)
181  for (int k = 0; k < CMAparameters::pivot_channels; ++k) m_pivot[i][j][k] = cma.m_pivot[i][j][k];
182  }
183  if (cma.m_lowPt) {
185  for (int i = 0; i < m_lowPt_rpc_read; ++i)
186  for (int j = 0; j < 2; ++j)
187  for (int k = 0; k < CMAparameters::confirm_channels; ++k) m_lowPt[i][j][k] = cma.m_lowPt[i][j][k];
188  }
189  if (cma.m_highPt) {
191  for (int i = 0; i < m_highPt_rpc_read; ++i)
192  for (int j = 0; j < 2; ++j)
193  for (int k = 0; k < CMAparameters::confirm_channels; ++k) m_highPt[i][j][k] = cma.m_highPt[i][j][k];
194  }
195 
202 
203  m_conf_type = cma.conf_type();
204  }
205 
206  return *this;
207 }
208 
210  m_pivot_rpc_read = 0;
211  if (m_pivot) delete[] m_pivot;
212  m_pivot = nullptr;
213 }
214 
216  m_lowPt_rpc_read = 0;
217  if (m_lowPt) delete[] m_lowPt;
218  m_lowPt = nullptr;
219 }
220 
222  m_highPt_rpc_read = 0;
223  if (m_highPt) delete[] m_highPt;
224  m_highPt = nullptr;
225 }
226 
227 void CMAparameters::create_pivot_map(int rpc_to_read) {
228  if (!m_pivot) {
229  m_pivot = new int[rpc_to_read][2][pivot_channels];
230  for (int i = 0; i < rpc_to_read; ++i)
231  for (int j = 0; j < 2; ++j)
232  for (int k = 0; k < pivot_channels; ++k) m_pivot[i][j][k] = -1;
233  }
234 }
235 
236 void CMAparameters::create_lowPt_map(int rpc_to_read) {
237  if (!m_lowPt) {
238  m_lowPt = new int[rpc_to_read][2][confirm_channels];
239  for (int i = 0; i < rpc_to_read; ++i)
240  for (int j = 0; j < 2; ++j)
241  for (int k = 0; k < confirm_channels; ++k) m_lowPt[i][j][k] = -1;
242  }
243 }
244 
245 void CMAparameters::create_highPt_map(int rpc_to_read) {
246  if (!m_highPt) {
247  m_highPt = new int[rpc_to_read][2][confirm_channels];
248  for (int i = 0; i < rpc_to_read; ++i)
249  for (int j = 0; j < 2; ++j)
250  for (int k = 0; k < confirm_channels; ++k) m_highPt[i][j][k] = -1;
251  }
252 }
253 
254 bool CMAparameters::operator==(const CMAparameters& cma) const {
255  return this->id() == cma.id();
256 }
257 
258 bool CMAparameters::operator==(const CMAidentity& id) const {
259  return this->id() == id;
260 }
261 
267 
271 
275 
279 
282  if (m_lowPt_stop_st == -1) m_lowPt_stop_st = cma.lowPt_stop_st();
283  if (m_lowPt_stop_ch == -1) m_lowPt_stop_ch = cma.lowPt_stop_ch();
284 
289 
290  return *this;
291 }
292 
293 void CMAparameters::showDt(std::ostream& stream, int layer) const {
294  // Set the chracters used for matrix display
295  unsigned int finish = 164;
296 
297  if (!m_pivot) {
298  stream << std::endl << "Low Pt and Hi Pt not yet connected!" << std::endl;
299  for (int i = 0; i < 80; ++i) stream << (char)finish;
300  stream << std::endl;
301  return;
302  }
303 
304  // Set memory for the display
305  int ln = (m_lowPt_rpc_read > 0) ? (m_lowPt_rpc_read - 1) * 6 + 39 : 39;
306 
307  char(*displow)[90] = new char[ln][90];
308 
309  // Show Low Pt connections
310  stream << std::endl << "Low Pt matrix connections:" << std::endl << std::endl;
311  showMt(displow, ln, Low, layer);
312 
313  // Dumping memory on output stream
314  for (int i = 0; i < ln; ++i)
315  if (displow[i][0] != '\0') stream << displow[i] << std::endl;
316 
317  delete[] displow;
318 
319  // Show Hi Pt connections
320  stream << std::endl << std::endl << "Hi Pt matrix connections:" << std::endl << std::endl;
321 
322  ln = (m_highPt_rpc_read > 0) ? (m_highPt_rpc_read - 1) * 6 + 39 : 39;
323 
324  char(*disphi)[90] = new char[ln][90];
325 
326  showMt(disphi, ln, High, layer);
327 
328  // Dumping memory on output stream
329  for (int i = 0; i < ln; ++i)
330  if (disphi[i][0] != '\0') stream << disphi[i] << std::endl;
331 
332  delete[] disphi;
333 
334  stream << std::endl;
335  for (int i = 0; i < 80; ++i) stream << (char)finish;
336  stream << std::endl;
337 }
338 
339 void CMAparameters::showMt(char display[][90], int ln, TrigType type, int layer) const {
340  // Set the chracters used for matrix display
341  unsigned int up = 19;
342  unsigned int left = 22;
343  unsigned int right = 25;
344  unsigned int middle = 18;
345  unsigned int down = 24;
346 
347  // overwritting character using pipe and minus
348  left = 124;
349  right = 124;
350  up = 45;
351  down = 45;
352 
353  // Set input for the display
354  std::ostringstream** disp = new std::ostringstream*[ln];
355 
356  for (int i = 0; i < ln; ++i) disp[i] = new std::ostringstream;
357 
358  int pivot_loop = (m_pivot_rpc_read < 4) ? m_pivot_rpc_read : 3;
359  int conf_loop = 0;
360  int(*conf)[2][confirm_channels] = nullptr;
361 
362  const CMAprogram* program = nullptr;
363 
364  if (type == Low) {
365  conf_loop = m_lowPt_rpc_read;
366  conf = m_lowPt;
367  program = this->lowPt_program();
368  } else {
369  conf_loop = m_highPt_rpc_read;
370  conf = m_highPt;
371  program = this->highPt_program();
372  }
373 
374  int shift = 6 * pivot_loop;
375 
376  for (int i = 0; i < shift; ++i) *disp[0] << " ";
377  for (int i = 0; i < confirm_channels; ++i) (std::ostream&)*disp[0] << (char)up;
378 
379  for (int i = 1; i <= pivot_channels; ++i) {
380  // Display the cabling for the pivot plane
381  for (int j = 0; j < pivot_loop; ++j) {
382  if (j) *disp[i] << "|";
383  (*disp[i]).fill(48);
384  if (m_pivot[j][layer][pivot_channels - i] >= 0) {
385  *disp[i] << std::setw(5) << m_pivot[j][layer][pivot_channels - i];
386  } else
387  *disp[i] << "*****";
388  }
389 
390  // Display the trigger window for all tresholds
391  (std::ostream&)*disp[i] << (char)left;
392  for (int j = 0; j < confirm_channels; ++j) {
393  unsigned int no_coincidence = ':';
394  if (program) {
395  const bool* registers = program->registers();
396  int third = 2 * (pivot_channels * confirm_channels) + (pivot_channels - i) * confirm_channels + j;
397  int second = third - pivot_channels * confirm_channels;
399 
400  if (registers[third])
401  *disp[i] << "3";
402  else if (registers[second])
403  *disp[i] << "2";
404  else if (registers[first])
405  *disp[i] << "1";
406  else
407  (std::ostream&)*disp[i] << (char)no_coincidence;
408 
409  } else
410  *disp[i] << " ";
411  }
412  (std::ostream&)*disp[i] << (char)right;
413  }
414 
415  // Display the cabling for the confirm plane
416  int start_confirm = pivot_channels + 1;
417  for (int j = 0; j < shift; ++j) *disp[start_confirm] << " ";
418  for (int i = start_confirm + 1; i < start_confirm + conf_loop * 6; ++i)
419  for (int j = 0; j < shift; ++j) *disp[i] << " ";
420 
421  for (int i = 0; i < confirm_channels; ++i) (std::ostream&)*disp[start_confirm] << (char)down;
422 
423  for (int i = 0; i < conf_loop; ++i) {
424  int start = (i) ? start_confirm + i * 6 : start_confirm + 1;
425  if (i) {
426  for (int ch = 1; ch <= confirm_channels; ++ch) (std::ostream&)*disp[start] << (char)middle;
427  ++start;
428  }
429 
430  for (int j = 0; j < 5; ++j)
431  for (int ch = 0; ch < confirm_channels; ++ch) {
432  if (conf[i][layer][ch] >= 0) {
433  (std::ostream&)*disp[start + j] << (conf[i][layer][ch] / static_cast<int>(pow(10., j))) % 10;
434  } else
435  (std::ostream&)*disp[start + j] << "*";
436  }
437  }
438 
439  for (int i = 0; i < ln; ++i) {
440  std::string tmp = (*disp[i]).str();
441  tmp.copy(display[i], tmp.length(), 0);
442  display[i][tmp.length()] = 0;
443  delete disp[i];
444  }
445 
446  delete[] disp;
447 }
448 
449 void CMAparameters::Print(std::ostream& stream, bool detail, int layer) const
450 {
451  stream << id();
452 
453  stream << " I/O " << m_params.pivotStation << ",";
454  stream << m_params.lowPtStation << "," << m_params.highPtStation << " pivot ";
455  stream.fill(48);
456  stream << "<" << std::setw(2) << pivot_start_ch();
457  stream << ":" << std::setw(2) << pivot_start_st();
458  stream << " " << std::setw(2) << pivot_stop_ch() << ":";
459  stream << std::setw(2) << pivot_stop_st() << ">" << std::endl;
460  stream << " ";
461  stream << "lowPt <" << std::setw(2);
462 
463  stream << lowPt_start_ch() << ":" << std::setw(2) << lowPt_start_st();
464  stream << " " << std::setw(2) << lowPt_stop_ch() << ":";
465  stream << std::setw(2) << lowPt_stop_st() << ">" << std::endl;
466  stream << " ";
467  stream << "highPt<" << std::setw(2);
468 
469  stream << highPt_start_ch() << ":" << std::setw(2) << highPt_start_st();
470  stream << " " << std::setw(2) << highPt_stop_ch() << ":";
471  stream << std::setw(2) << highPt_stop_st() << ">" << std::endl;
472  stream.fill(32);
473  if (detail) showDt(stream, layer);
474 }
475 
476 void CMAparameters::Print(std::ostream& stream, bool detail) const
477 {
478  Print (stream, detail, 0);
479 }
480 
481 std::string CMAparameters::noMoreChannels(const std::string& stat) {
482  int max_channels = 0;
483  if (stat == "Pivot")
484  max_channels = pivot_channels;
485  else
486  max_channels = confirm_channels;
487 
488  std::ostringstream disp;
489  disp << "Error in Sector Type " << this->sector_type() << ":" << std::endl
490  << this->id() << " attempted to receive more than " << max_channels << " channels for " << stat << " side";
491  return disp.str();
492 }
493 
494 const CMAparameters* CMAparameters::test(CMAinput input, int cabling_code) const {
495  int* strips = nullptr;
496  int nstrips = 0;
497 
498  if (input == Pivot && m_pivot) {
499  nstrips = pivot_channels * m_pivot_rpc_read * 2;
500  strips = reinterpret_cast<int*>(m_pivot);
501  } else if (input == LowPt && m_lowPt) {
502  nstrips = confirm_channels * m_lowPt_rpc_read * 2;
503  strips = reinterpret_cast<int*>(m_lowPt);
504  } else if (input == HighPt && m_highPt) {
505  nstrips = confirm_channels * m_highPt_rpc_read * 2;
506  strips = reinterpret_cast<int*>(m_highPt);
507  } else
508  return nullptr;
509 
510  for (int i = 0; i < nstrips; ++i)
511  if (strips[i] == cabling_code) return this;
512 
513  return nullptr;
514 }
515 
516 std::string CMAparameters::two_obj_error_message(const std::string& msg, CMAparameters* cma) {
517  std::ostringstream disp;
518  disp << this->error_header()
519  << " " << msg << " between " << name() << " n. " << number() << " and " << cma->name() << " n. " << cma->number() << std::endl
520  << *this << *cma;
521  return disp.str();
522 }
523 
525  std::ostringstream disp;
526  disp << this->error_header();
527 
528  if (stat == lowPt_station()) {
529  disp << "Low Pt cabling inconsistence (cabling from connector " << m_params.lowPtStartCo << " to connector " << m_params.lowPtStopCo
530  << ") for" << std::endl
531  << *this;
532  } else if (stat == highPt_station()) {
533  disp << "High Pt cabling inconsistence (cabling from connector " << m_params.highPtStartCo << " to connector "
534  << m_params.highPtStopCo << ") for" << std::endl
535  << *this;
536  }
537  return disp.str();
538 }
539 
540 std::string CMAparameters::no_wor_readout(int num, int stat) {
541  std::ostringstream disp;
542  disp << this->error_header();
543 
544  disp << this->id() << " receives input from" << std::endl
545  << " RPC chamber n. " << num << " of station " << stat << " which has no Wired OR readout!";
546  return disp.str();
547 }
548 
549 std::string CMAparameters::error(const std::string& str) {
550  std::ostringstream disp;
551  disp << this->error_header()
552  << this->id() << str;
553  return disp.str();
554 }
555 
557  if (stat == m_params.pivotStation)
558  return Pivot;
559  else if (stat == m_params.lowPtStation)
560  return LowPt;
561  else if (stat == m_params.highPtStation)
562  return HighPt;
563  else
564  return NoInput;
565 }
566 
568  if (input == CMAinput::Pivot)
569  return m_params.pivotStation;
570  else if (input == CMAinput::LowPt)
571  return m_params.lowPtStation;
572  else if (input == CMAinput::HighPt)
573  return m_params.highPtStation;
574  else
575  return 0;
576 }
577 
578 bool CMAparameters::give_connection(int station, int cab_code, CMAinput& IO, int& ly, int& ch) const {
579  IO = whichCMAinput(station);
580  return get_channel(IO, cab_code, ly, ch);
581 }
582 
583 bool CMAparameters::get_channel(CMAinput IO, int cab_code, int& ly, int& ch) const {
584  int* strips = nullptr;
585  int nstrips = 0;
586  int channels = 0;
587 
588  if (IO == Pivot && m_pivot) {
590  nstrips = pivot_channels * m_pivot_rpc_read * 2;
591  strips = reinterpret_cast<int*>(m_pivot);
592  } else if (IO == LowPt && m_lowPt) {
594  nstrips = confirm_channels * m_lowPt_rpc_read * 2;
595  strips = reinterpret_cast<int*>(m_lowPt);
596  } else if (IO == HighPt && m_highPt) {
598  nstrips = confirm_channels * m_highPt_rpc_read * 2;
599  strips = reinterpret_cast<int*>(m_highPt);
600  } else
601  return false;
602 
603  for (int i = 0; i < nstrips; ++i) {
604  if (strips[i] == cab_code) {
605  ch = i % channels;
606  ly = (i / channels) % 2;
607  return true;
608  }
609  }
610 
611  return false;
612 }
613 
614 bool CMAparameters::get_cabling(CMAinput IO, int WOR, int ly, int ch, unsigned int& code) const {
615  int* strips = nullptr;
616  int channels = 0;
617 
618  if (ly >= 2) return false;
619 
620  if (IO == Pivot && m_pivot) {
622  if (WOR >= m_pivot_rpc_read) return false;
623  strips = reinterpret_cast<int*>(m_pivot);
624  } else if (IO == LowPt && m_lowPt) {
626  if (WOR >= m_lowPt_rpc_read) return false;
627  strips = reinterpret_cast<int*>(m_lowPt);
628  } else if (IO == HighPt && m_highPt) {
630  if (WOR >= m_highPt_rpc_read) return false;
631  strips = reinterpret_cast<int*>(m_highPt);
632  } else
633  return false;
634 
635  if (ch >= channels) return false;
636 
637  int position = WOR * (2 * channels) + ly * (channels) + ch;
638 
639  if (*(strips + position) < 0) return false;
640 
641  code = *(strips + position);
642 
643  return true;
644 }
645 
646 bool CMAparameters::correct(L1RPCcabCorrection type, CMAinput it, unsigned int layer, unsigned short int Ch1, unsigned short int Ch2,
647  short int num) const {
648  if (Ch1 > Ch2) return false;
649 
650  int worlo = 0;
651  int maxch = 0;
652  int* map = nullptr;
653 
654  switch (it) {
655  case Pivot:
656  map = reinterpret_cast<int*>(m_pivot);
657  maxch = pivot_channels;
658  worlo = m_pivot_rpc_read;
659  break;
660 
661  case LowPt:
662  map = reinterpret_cast<int*>(m_lowPt);
663  maxch = confirm_channels;
664  worlo = m_lowPt_rpc_read;
665  break;
666 
667  case HighPt:
668  map = reinterpret_cast<int*>(m_highPt);
669  maxch = confirm_channels;
670  worlo = m_highPt_rpc_read;
671  break;
672 
673  default: return false;
674  }
675 
676  switch (type) {
677  case Inversion:
678 
679  num = Ch2 - Ch1 + 1;
680  for (int i = 0; i < worlo; ++i) {
681  for (unsigned short int j = 0; j < num / 2; ++j) {
682  int pos1 = i * 2 * maxch + layer * maxch + Ch1 + j;
683  int pos2 = i * 2 * maxch + layer * maxch + Ch2 - j;
684  int tmp = *(map + pos1);
685  *(map + pos1) = *(map + pos2);
686  *(map + pos2) = tmp;
687  }
688  }
689 
690  break;
691 
692  case Swap:
693 
694  if (Ch1 + num - 1 >= Ch2) return false;
695  for (int i = 0; i < worlo; ++i) {
696  for (unsigned short int j = 0; j < num; ++j) {
697  int pos1 = i * 2 * maxch + layer * maxch + Ch1 + j;
698  int pos2 = i * 2 * maxch + layer * maxch + Ch2 + j;
699  int tmp = *(map + pos1);
700  *(map + pos1) = *(map + pos2);
701  *(map + pos2) = tmp;
702  }
703  }
704 
705  break;
706 
707  case Suppression:
708 
709  num = Ch2 - Ch1 + 1;
710  for (int i = 0; i < worlo; ++i) {
711  for (unsigned short int j = 0; j < num; ++j) {
712  int pos = i * 2 * maxch + layer * maxch + Ch1 + j;
713  *(map + pos) = -1;
714  }
715  }
716 
717  break;
718 
719  case Shift:
720  for (int i = 0; i < worlo; ++i) {
721  if (num / abs(num) == 1) {
722  unsigned short int piv = Ch1 + num;
723 
724  for (unsigned short int j = Ch1; j < piv; ++j) {
725  int pos = i * 2 * maxch + layer * maxch + j;
726  *(map + pos) = -1;
727  }
728 
729  for (unsigned short int j = piv; j <= Ch2; ++j) {
730  int pos = i * 2 * maxch + layer * maxch + j;
731 
732  *(map + pos - num) = *(map + pos);
733  *(map + pos) = -1;
734  }
735  }
736  if (num / abs(num) == -1) {
737  unsigned short int ch = Ch2;
738  short int piv = Ch2 - abs(num) + 1;
739  short int stop = Ch1 + num;
740  if (stop < 0) stop = 0;
741  do {
742  int pos = i * 2 * maxch + layer * maxch + ch;
743  *(map + pos) = -1;
744  --ch;
745  } while (ch > piv);
746 
747  do {
748  int pos = i * 2 * maxch + layer * maxch + piv - 1;
749 
750  *(map + pos + (int)abs(num)) = *(map + pos);
751  *(map + pos) = -1;
752  --piv;
753  } while (piv > stop);
754  }
755  }
756 
757  break;
758 
759  default: return false;
760  }
761 
762  return true;
763 }
764 
765 void CMAparameters::give_strip_code(unsigned int logic_sector, unsigned short int lh, unsigned short int ijk, unsigned short int Channel,
766  std::list<unsigned int>& StripCodes) const {
767  RPCdecoder deco;
768 
769  if (ijk == 0 || ijk == 1) {
770  for (int i = 0; i < m_pivot_rpc_read; ++i) {
771  int CabCode = m_pivot[i][ijk][Channel];
772  if (CabCode >= 0) {
773  int strip_number = CabCode % 100;
774  int rpc_z_index = (CabCode / 100) % 100;
775  int rpc_layer = (CabCode / 10000) % 10;
776  if (deco(this->id().type(), logic_sector, this->whichCMAstation(Pivot), rpc_layer, rpc_z_index, strip_number)) {
777  StripCodes.push_back(deco.code());
778  }
779  }
780  }
781  }
782 
783  if (ijk == 2 || ijk == 3) {
784  if (lh == 1) {
785  for (int i = 0; i < m_highPt_rpc_read; ++i) {
786  int CabCode = m_highPt[i][0][Channel + 32 * (ijk % 2)];
787  if (CabCode >= 0) {
788  int strip_number = CabCode % 100;
789  int rpc_z_index = (CabCode / 100) % 100;
790  int rpc_layer = (CabCode / 10000) % 10;
791  if (deco(this->id().type(), logic_sector, this->whichCMAstation(HighPt), rpc_layer, rpc_z_index, strip_number)) {
792  StripCodes.push_back(deco.code());
793  }
794  }
795  }
796  } else {
797  for (int i = 0; i < m_lowPt_rpc_read; ++i) {
798  int CabCode = m_lowPt[i][0][Channel + 32 * (ijk % 2)];
799  if (CabCode >= 0) {
800  int strip_number = CabCode % 100;
801  int rpc_z_index = (CabCode / 100) % 100;
802  int rpc_layer = (CabCode / 10000) % 10;
803  if (deco(this->id().type(), logic_sector, this->whichCMAstation(LowPt), rpc_layer, rpc_z_index, strip_number)) {
804  StripCodes.push_back(deco.code());
805  }
806  }
807  }
808  }
809  }
810 
811  if (ijk == 4 || ijk == 5) {
812  if (lh == 1) {
813  for (int i = 0; i < m_highPt_rpc_read; ++i) {
814  int CabCode = m_highPt[i][1][Channel + 32 * (ijk % 2)];
815  if (CabCode >= 0) {
816  int strip_number = CabCode % 100;
817  int rpc_z_index = (CabCode / 100) % 100;
818  int rpc_layer = (CabCode / 10000) % 10;
819  if (deco(this->id().type(), logic_sector, this->whichCMAstation(HighPt), rpc_layer, rpc_z_index, strip_number)) {
820  StripCodes.push_back(deco.code());
821  }
822  }
823  }
824  } else {
825  for (int i = 0; i < m_lowPt_rpc_read; ++i) {
826  int CabCode = m_lowPt[i][1][Channel + 32 * (ijk % 2)];
827  if (CabCode >= 0) {
828  int strip_number = CabCode % 100;
829  int rpc_z_index = (CabCode / 100) % 100;
830  int rpc_layer = (CabCode / 10000) % 10;
831  if (deco(this->id().type(), logic_sector, this->whichCMAstation(LowPt), rpc_layer, rpc_z_index, strip_number)) {
832  StripCodes.push_back(deco.code());
833  }
834  }
835  }
836  }
837  }
838 
839  if (ijk == 6) {
840  for (int i = 0; i < m_pivot_rpc_read; ++i) {
841  int CabCode = m_pivot[i][0][Channel];
842  if (CabCode >= 0) {
843  int strip_number = CabCode % 100;
844  int rpc_z_index = (CabCode / 100) % 100;
845  int rpc_layer = (CabCode / 10000) % 10;
846  if (deco(this->id().type(), logic_sector, this->whichCMAstation(Pivot), rpc_layer, rpc_z_index, strip_number)) {
847  StripCodes.push_back(deco.code());
848  }
849  }
850  }
851  }
852 }
853 
855  for (int ch = 0; ch < pivot_channels; ++ch) {
856  for (int i = 0; i < m_pivot_rpc_read; ++i) {
857  int CabCode = m_pivot[i][0][ch];
858  if (CabCode != -1) return ch;
859  }
860  }
861  return 999;
862 }
863 
864 unsigned int CMAparameters::last_pivot_channel() const {
865  for (int ch = pivot_channels - 1; ch >= 0; --ch) {
866  for (int i = 0; i < m_pivot_rpc_read; ++i) {
867  int CabCode = m_pivot[i][0][ch];
868  if (CabCode != -1) return ch;
869  }
870  }
871  return 999;
872 }
873 
875  for (int ch = 0; ch < confirm_channels; ++ch) {
876  for (int i = 0; i < m_lowPt_rpc_read; ++i) {
877  int CabCode = m_lowPt[i][0][ch];
878  if (CabCode != -1) return ch;
879  }
880  }
881  return 999;
882 }
883 
884 unsigned int CMAparameters::last_lowPt_channel() const {
885  for (int ch = confirm_channels - 1; ch >= 0; --ch) {
886  for (int i = 0; i < m_lowPt_rpc_read; ++i) {
887  int CabCode = m_lowPt[i][0][ch];
888  if (CabCode != -1) return ch;
889  }
890  }
891  return 999;
892 }
893 
895  for (int ch = 0; ch < confirm_channels; ++ch) {
896  for (int i = 0; i < m_highPt_rpc_read; ++i) {
897  int CabCode = m_highPt[i][0][ch];
898  if (CabCode != -1) return ch;
899  }
900  }
901  return 999;
902 }
903 
905  for (int ch = confirm_channels - 1; ch >= 0; --ch) {
906  for (int i = 0; i < m_highPt_rpc_read; ++i) {
907  int CabCode = m_highPt[i][0][ch];
908  if (CabCode != -1) return ch;
909  }
910  }
911  return 999;
912 }
CMAparameters::two_obj_error_message
std::string two_obj_error_message(const std::string &, CMAparameters *)
Definition: CMAparameters.cxx:516
CMAparameters::highPt_start_st
int highPt_start_st() const
Definition: CMAparameters.cxx:39
TrigType
TrigType
Definition: TRIGGERidentity.h:17
CMAparameters::defineParams::pivotStopChan
int pivotStopChan
RPC chamber to which the RPC strip belongs.
Definition: CMAparameters.h:39
CMAparameters::m_highPt_stop_st
int m_highPt_stop_st
Definition: CMAparameters.h:82
RPCdecoder
Definition: RPCdecoder.h:13
python.SystemOfUnits.second
int second
Definition: SystemOfUnits.py:120
CMAparameters::no_confirm_error
std::string no_confirm_error(int)
Definition: CMAparameters.cxx:524
CMAparameters::lowPt_station
int lowPt_station() const
Definition: CMAparameters.cxx:49
CMAparameters::active_pivot_chs
int active_pivot_chs() const
Definition: CMAparameters.cxx:44
DiTauMassTools::TauTypes::lh
@ lh
Definition: PhysicsAnalysis/TauID/DiTauMassTools/DiTauMassTools/HelperFunctions.h:49
sendEI_SPB.ch
ch
Definition: sendEI_SPB.py:35
CMAparameters::showMt
void showMt(char[][90], int, TrigType, int layer) const
Definition: CMAparameters.cxx:339
CMAparameters::whichCMAstation
int whichCMAstation(CMAinput input) const
Definition: CMAparameters.cxx:567
L1RPCcabCorrection
L1RPCcabCorrection
Definition: CMAparameters.h:19
CMAparameters::defineParams::lowPtStation
int lowPtStation
RPC station number giving input to pivot chs.
Definition: CMAparameters.h:34
CMAparameters::highPt_stop_co
int highPt_stop_co() const
Definition: CMAparameters.cxx:31
CMAparameters::highPt_start_ch
int highPt_start_ch() const
Definition: CMAparameters.cxx:40
CMAparameters::CMAconfiguration
CMAconfiguration
Definition: CMAparameters.h:23
CMAparameters::defineParams::pivotStation
int pivotStation
Definition: CMAparameters.h:33
CMAparameters::defineParams::highPtStartCo
int highPtStartCo
Number of connectors giving input to the matrix.
Definition: CMAparameters.h:46
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
CMAparameters::first_lowPt_channel
unsigned int first_lowPt_channel() const
Definition: CMAparameters.cxx:874
CMAparameters::highPt_rpc_read
int highPt_rpc_read() const
Definition: CMAparameters.cxx:54
LArBadChanBlobUtils::Channel
Identifier32::value_type Channel
Definition: LArBadChanBlobUtils.h:24
Pivot
@ Pivot
Definition: CMAparameters.h:18
Inversion
@ Inversion
Definition: CMAparameters.h:19
HighPt
@ HighPt
Definition: CMAparameters.h:18
CMAparameters::CMAparameters
CMAparameters(const parseParams &parse)
Definition: CMAparameters.cxx:65
CMAparameters::m_active_lowPt_chs
int m_active_lowPt_chs
Definition: CMAparameters.h:86
CMAparameters::lowPt_program
const CMAprogram * lowPt_program() const
Definition: CMAparameters.cxx:18
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
xAOD::char
char
Definition: TrigDecision_v1.cxx:38
parse
std::map< std::string, std::string > parse(const std::string &list)
Definition: egammaLayerRecalibTool.cxx:983
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
CMAparameters::last_pivot_channel
unsigned int last_pivot_channel() const
Definition: CMAparameters.cxx:864
skel.it
it
Definition: skel.GENtoEVGEN.py:423
CMAparameters::m_first_highPt_code
unsigned int m_first_highPt_code
Definition: CMAparameters.h:97
CMAparameters::highPt_stop_ch
int highPt_stop_ch() const
Definition: CMAparameters.cxx:42
CMAparameters::m_first_pivot_code
unsigned int m_first_pivot_code
Definition: CMAparameters.h:93
CMAparameters::defineParams::lowPtStartCo
int lowPtStartCo
RPC chamber to which the RPC strip belongs.
Definition: CMAparameters.h:42
LowPt
@ LowPt
Definition: CMAparameters.h:18
CMAparameters::lowPt_stop_co
int lowPt_stop_co() const
Definition: CMAparameters.cxx:27
CMAparameters::m_pivot_rpc_read
int m_pivot_rpc_read
Definition: CMAparameters.h:89
CMAparameters::m_id
std::unique_ptr< CMAidentity > m_id
Definition: CMAparameters.h:73
CMAparameters::get_cabling
bool get_cabling(CMAinput, int, int, int, unsigned int &) const
Definition: CMAparameters.cxx:614
detail
Definition: extract_histogram_tag.cxx:14
CMAparameters::test
const CMAparameters * test(CMAinput, int) const
Definition: CMAparameters.cxx:494
CMAparameters::id
const CMAidentity & id() const
Definition: CMAparameters.cxx:17
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
CMAparameters::m_conf_type
CMAconfiguration m_conf_type
Definition: CMAparameters.h:107
CMAparameters.h
CMAparameters::defineParams::pivotStartChan
int pivotStartChan
RPC station number giving input to High Pt ch.
Definition: CMAparameters.h:37
CMAparameters::last_lowPt_channel
unsigned int last_lowPt_channel() const
Definition: CMAparameters.cxx:884
CMAparameters::m_pivot
int(* m_pivot)[2][pivot_channels]
Definition: CMAparameters.h:100
CMAparameters::first_lowPt_code
unsigned int first_lowPt_code() const
Definition: CMAparameters.cxx:58
CMAparameters::defineParams::lowPtStopCo
int lowPtStopCo
First connector (global-addr) for LowPt confirm.
Definition: CMAparameters.h:43
CMAparameters::active_highPt_chs
int active_highPt_chs() const
Definition: CMAparameters.cxx:46
CablingObject::operator=
CablingObject & operator=(const CablingObject &)=default
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
CMAparameters::m_lowPt_rpc_read
int m_lowPt_rpc_read
Definition: CMAparameters.h:90
Swap
@ Swap
Definition: CMAparameters.h:19
CMAparameters::pivot_start_st
int pivot_start_st() const
Definition: CMAparameters.cxx:22
CMAparameters::highPt_number_co
int highPt_number_co() const
Definition: CMAparameters.cxx:32
CMAparameters::correct
bool correct(L1RPCcabCorrection type, CMAinput it, unsigned int layer, unsigned short int Ch1, unsigned short int Ch2, short int num) const
Definition: CMAparameters.cxx:646
CMAparameters::m_last_lowPt_code
unsigned int m_last_lowPt_code
Definition: CMAparameters.h:96
dq_defect_copy_defect_database.channels
def channels
Definition: dq_defect_copy_defect_database.py:56
CMAparameters::confirm_channels
static constexpr int confirm_channels
Definition: CMAparameters.h:70
CMAparameters::m_highPt_stop_ch
int m_highPt_stop_ch
Definition: CMAparameters.h:83
CMAparameters::lowPt_start_co
int lowPt_start_co() const
Definition: CMAparameters.cxx:26
CablingObject::station
int station() const
Definition: CablingObject.cxx:13
CMAparameters::lowPt_start_ch
int lowPt_start_ch() const
Definition: CMAparameters.cxx:35
RPCdecoder::code
unsigned int code(void) const
Definition: RPCdecoder.h:64
CMAparameters::m_highPt
int(* m_highPt)[2][confirm_channels]
Definition: CMAparameters.h:102
CMAparameters::m_lowPt_stop_st
int m_lowPt_stop_st
Definition: CMAparameters.h:77
CMAparameters::defineParams::lowPtNumCo
int lowPtNumCo
Last connector (global-addr) for LowPt confirm.
Definition: CMAparameters.h:44
CMAparameters::m_first_lowPt_code
unsigned int m_first_lowPt_code
Definition: CMAparameters.h:95
CMAparameters::first_highPt_code
unsigned int first_highPt_code() const
Definition: CMAparameters.cxx:60
CMAparameters::reset_highPt_cabling
void reset_highPt_cabling()
Definition: CMAparameters.cxx:221
python.ConfigurableDb.conf
def conf
Definition: ConfigurableDb.py:282
CMAparameters::defineParams::highPtStation
int highPtStation
RPC station number giving input to Low Pt ch.
Definition: CMAparameters.h:35
CMAparameters::m_active_pivot_chs
int m_active_pivot_chs
Definition: CMAparameters.h:85
CMAparameters::m_highPt_rpc_read
int m_highPt_rpc_read
Definition: CMAparameters.h:91
lumiFormat.i
int i
Definition: lumiFormat.py:92
CMAparameters::pivot_station
int pivot_station() const
Definition: CMAparameters.cxx:48
CMAparameters::m_active_highPt_chs
int m_active_highPt_chs
Definition: CMAparameters.h:87
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
CMAparameters::m_highPt_program
std::unique_ptr< CMAprogram > m_highPt_program
Definition: CMAparameters.h:105
PlotPulseshapeFromCool.input
input
Definition: PlotPulseshapeFromCool.py:106
RPCdecoder.h
CMAparameters::~CMAparameters
virtual ~CMAparameters()
Definition: CMAparameters.cxx:132
CablingObject::error_header
std::string error_header() const
Definition: CablingObject.cxx:22
CalibCoolCompareRT.up
up
Definition: CalibCoolCompareRT.py:109
BaseObject::name
std::string name() const
Definition: BaseObject.h:23
CMAparameters::m_params
defineParams m_params
Definition: CMAparameters.h:59
CMAparameters::m_last_highPt_code
unsigned int m_last_highPt_code
Definition: CMAparameters.h:98
CMAparameters::operator=
CMAparameters & operator=(const CMAparameters &)
Definition: CMAparameters.cxx:138
CMAparameters::m_lowPt_stop_ch
int m_lowPt_stop_ch
Definition: CMAparameters.h:78
CMAparameters::defineParams::pivotStopStation
int pivotStopStation
Definition: CMAparameters.h:40
CMAparameters::m_lowPt
int(* m_lowPt)[2][confirm_channels]
Definition: CMAparameters.h:101
CMAparameters::highPt_program
const CMAprogram * highPt_program() const
Definition: CMAparameters.cxx:19
CMAparameters::reset_lowPt_cabling
void reset_lowPt_cabling()
Definition: CMAparameters.cxx:215
CMAparameters::noMoreChannels
std::string noMoreChannels(const std::string &stat)
Definition: CMAparameters.cxx:481
CMAparameters::lowPt_start_st
int lowPt_start_st() const
Definition: CMAparameters.cxx:34
CMAparameters::create_lowPt_map
void create_lowPt_map(int)
Definition: CMAparameters.cxx:236
CMAparameters::last_lowPt_code
unsigned int last_lowPt_code() const
Definition: CMAparameters.cxx:59
CMAparameters::no_wor_readout
std::string no_wor_readout(int, int)
Definition: CMAparameters.cxx:540
DeMoUpdate.tmp
string tmp
Definition: DeMoUpdate.py:1167
CMAparameters::first_pivot_channel
unsigned int first_pivot_channel() const
Definition: CMAparameters.cxx:854
pyroot.display
display
Definition: pyroot.py:44
beamspotman.stat
stat
Definition: beamspotman.py:266
CMAparameters::defineParams::highPtNumCo
int highPtNumCo
Last connector (global-addr) for HiPt confirm.
Definition: CMAparameters.h:48
CMAinput
CMAinput
Definition: CMAparameters.h:18
CMAprogram
Definition: CMAprogram.h:11
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
CMAparameters::give_connection
bool give_connection(int, int, CMAinput &, int &, int &) const
Definition: CMAparameters.cxx:578
pmontree.code
code
Definition: pmontree.py:443
CMAparameters::create_highPt_map
void create_highPt_map(int)
Definition: CMAparameters.cxx:245
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
CMAparameters::last_pivot_code
unsigned int last_pivot_code() const
Definition: CMAparameters.cxx:57
CMAparameters::last_highPt_channel
unsigned int last_highPt_channel() const
Definition: CMAparameters.cxx:904
CMAparameters::defineParams::highPtStopCo
int highPtStopCo
First connector (global-addr) for HiPt confirm.
Definition: CMAparameters.h:47
CMAparameters::pivot_rpc_read
int pivot_rpc_read() const
Definition: CMAparameters.cxx:52
Low
@ Low
Definition: TRIGGERidentity.h:17
CMAparameters::isAtlas
bool isAtlas() const
Definition: CMAparameters.cxx:15
CMAparameters::m_highPt_start_ch
int m_highPt_start_ch
Definition: CMAparameters.h:81
CablingObject
Definition: CablingObject.h:10
CablingObject::number
int number() const
Definition: CablingObject.cxx:12
CMAparameters::reset_pivot_cabling
void reset_pivot_cabling()
Definition: CMAparameters.cxx:209
Suppression
@ Suppression
Definition: CMAparameters.h:19
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
CMAparameters::parseParams
Definition: CMAparameters.h:51
CMAparameters::lowPt_stop_st
int lowPt_stop_st() const
Definition: CMAparameters.cxx:36
CMAparameters::whichCMAinput
CMAinput whichCMAinput(int) const
Definition: CMAparameters.cxx:556
CMAparameters::lowPt_stop_ch
int lowPt_stop_ch() const
Definition: CMAparameters.cxx:37
CMAparameters::m_lowPt_start_ch
int m_lowPt_start_ch
Definition: CMAparameters.h:76
CMAparameters::Print
virtual void Print(std::ostream &, bool) const override
Definition: CMAparameters.cxx:476
CMAparameters::highPt_station
int highPt_station() const
Definition: CMAparameters.cxx:50
CMAidentity
Definition: CMAidentity.h:16
CMAparameters::first_highPt_channel
unsigned int first_highPt_channel() const
Definition: CMAparameters.cxx:894
CMAparameters
Definition: CMAparameters.h:21
python.CaloScaleNoiseConfig.str
str
Definition: CaloScaleNoiseConfig.py:78
CMAparameters::m_last_pivot_code
unsigned int m_last_pivot_code
Definition: CMAparameters.h:94
lumiFormat.fill
fill
Definition: lumiFormat.py:111
NoInput
@ NoInput
Definition: CMAparameters.h:18
High
@ High
Definition: TRIGGERidentity.h:17
CMAparameters::lowPt_number_co
int lowPt_number_co() const
Definition: CMAparameters.cxx:28
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
DeMoScan.first
bool first
Definition: DeMoScan.py:534
CMAparameters::highPt_stop_st
int highPt_stop_st() const
Definition: CMAparameters.cxx:41
CMAprogram.h
CMAparameters::m_highPt_start_st
int m_highPt_start_st
Definition: CMAparameters.h:80
CMAparameters::operator+=
CMAparameters & operator+=(const CMAparameters &)
Definition: CMAparameters.cxx:262
CMAparameters::m_lowPt_program
std::unique_ptr< CMAprogram > m_lowPt_program
Definition: CMAparameters.h:104
CMAparameters::active_lowPt_chs
int active_lowPt_chs() const
Definition: CMAparameters.cxx:45
CMAparameters::pivot_start_ch
int pivot_start_ch() const
Definition: CMAparameters.cxx:21
CMAparameters::showDt
void showDt(std::ostream &, int layer) const
Definition: CMAparameters.cxx:293
CMAparameters::conf_type
CMAconfiguration conf_type() const
Definition: CMAparameters.cxx:63
CMAparameters::error
std::string error(const std::string &)
Definition: CMAparameters.cxx:549
CMAparameters::get_channel
bool get_channel(CMAinput, int, int &, int &) const
Definition: CMAparameters.cxx:583
str
Definition: BTagTrackIpAccessor.cxx:11
CMAparameters::pivot_channels
static constexpr int pivot_channels
Definition: CMAparameters.h:69
CMAparameters::defineParams::pivotStartStation
int pivotStartStation
Definition: CMAparameters.h:38
CMAparameters::create_pivot_map
void create_pivot_map(int)
Definition: CMAparameters.cxx:227
CMAparameters::Atlas
@ Atlas
Definition: CMAparameters.h:23
CMAparameters::pivot_stop_ch
int pivot_stop_ch() const
Definition: CMAparameters.cxx:23
python.compareTCTs.ln
ln
Definition: compareTCTs.py:296
Shift
@ Shift
Definition: CMAparameters.h:19
CMAparameters::last_highPt_code
unsigned int last_highPt_code() const
Definition: CMAparameters.cxx:61
CMAparameters::highPt_start_co
int highPt_start_co() const
Definition: CMAparameters.cxx:30
CablingObject::sector_type
int sector_type() const
Definition: CablingObject.cxx:14
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
CMAparameters::pivot_stop_st
int pivot_stop_st() const
Definition: CMAparameters.cxx:24
CMAprogram::registers
const bool * registers(void) const
Definition: CMAprogram.h:119
CMAparameters::operator==
bool operator==(const CMAparameters &) const
Definition: CMAparameters.cxx:254
CMAparameters::m_lowPt_start_st
int m_lowPt_start_st
Definition: CMAparameters.h:75
CMAparameters::first_pivot_code
unsigned int first_pivot_code() const
Definition: CMAparameters.cxx:56
CMAparameters::give_strip_code
void give_strip_code(unsigned int logic_sector, unsigned short int lh, unsigned short int ijk, unsigned short int Channel, std::list< unsigned int > &StripCodes) const
Definition: CMAparameters.cxx:765
fitman.k
k
Definition: fitman.py:528
drawFromPickle.view
view
Definition: drawFromPickle.py:294
CMAparameters::lowPt_rpc_read
int lowPt_rpc_read() const
Definition: CMAparameters.cxx:53