79 if (proglow) {
m_lowPt_program = std ::make_unique<CMAprogram>(*proglow); }
80 if (proghigh) {
m_highPt_program = std::make_unique<CMAprogram>(*proghigh); }
106 for (
int j = 0; j < 2; ++j)
112 for (
int j = 0; j < 2; ++j)
118 for (
int j = 0; j < 2; ++j)
142 m_id = std::make_unique<CMAidentity>(cma.
id());
180 for (
int j = 0; j < 2; ++j)
186 for (
int j = 0; j < 2; ++j)
192 for (
int j = 0; j < 2; ++j)
230 for (
int i = 0; i < rpc_to_read; ++i)
231 for (
int j = 0; j < 2; ++j)
239 for (
int i = 0; i < rpc_to_read; ++i)
240 for (
int j = 0; j < 2; ++j)
248 for (
int i = 0; i < rpc_to_read; ++i)
249 for (
int j = 0; j < 2; ++j)
255 return this->
id() == cma.
id();
259 return this->
id() == id;
295 unsigned int finish = 164;
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;
307 char(*displow)[90] =
new char[ln][90];
310 stream << std::endl <<
"Low Pt matrix connections:" << std::endl << std::endl;
314 for (
int i = 0; i < ln; ++i)
315 if (displow[i][0] !=
'\0') stream << displow[i] << std::endl;
320 stream << std::endl << std::endl <<
"Hi Pt matrix connections:" << std::endl << std::endl;
324 char(*disphi)[90] =
new char[ln][90];
329 for (
int i = 0; i < ln; ++i)
330 if (disphi[i][0] !=
'\0') stream << disphi[i] << std::endl;
335 for (
int i = 0; i < 80; ++i) stream << (
char)finish;
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;
354 std::ostringstream** disp =
new std::ostringstream*[ln];
356 for (
int i = 0; i < ln; ++i) disp[i] =
new std::ostringstream;
374 int shift = 6 * pivot_loop;
376 for (
int i = 0; i < shift; ++i) *disp[0] <<
" ";
377 for (
int i = 0; i < confirm_channels; ++i) *disp[0] << static_cast<char>(up);
381 for (
int j = 0; j < pivot_loop; ++j) {
382 if (j) *disp[i] <<
"|";
391 *disp[i] <<
static_cast<char>(left);
393 unsigned int no_coincidence =
':';
395 const bool* registers = program->
registers();
400 if (registers[third])
402 else if (registers[second])
404 else if (registers[first])
407 *disp[i] <<
static_cast<char>(no_coincidence);
412 *disp[i] <<
static_cast<char>(right);
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] <<
" ";
421 for (
int i = 0; i < confirm_channels; ++i) *disp[start_confirm] << static_cast<char>(down);
423 for (
int i = 0; i < conf_loop; ++i) {
424 int start = (i) ? start_confirm + i * 6 : start_confirm + 1;
426 for (
int ch = 1; ch <= confirm_channels; ++ch) *disp[start] << static_cast<char>(middle);
430 for (
int j = 0; j < 5; ++j)
432 if (conf[i][layer][ch] >= 0) {
433 *disp[start + j] << (conf[i][layer][ch] /
static_cast<int>(
pow(10., j))) % 10;
435 *disp[start + j] <<
"*";
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;
453 stream <<
" I/O " <<
m_params.pivotStation <<
",";
454 stream <<
m_params.lowPtStation <<
"," <<
m_params.highPtStation <<
" pivot ";
459 stream << std::setw(2) <<
pivot_stop_st() <<
">" << std::endl;
461 stream <<
"lowPt <" << std::setw(2);
465 stream << std::setw(2) <<
lowPt_stop_st() <<
">" << std::endl;
467 stream <<
"highPt<" << std::setw(2);
482 int max_channels = 0;
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";
495 int* strips =
nullptr;
500 strips =
reinterpret_cast<int*
>(
m_pivot);
503 strips =
reinterpret_cast<int*
>(
m_lowPt);
506 strips =
reinterpret_cast<int*
>(
m_highPt);
510 for (
int i = 0; i < nstrips; ++i)
511 if (strips[i] == cabling_code)
return this;
517 std::ostringstream disp;
519 <<
" " << msg <<
" between " <<
name() <<
" n. " <<
number() <<
" and " << cma->
name() <<
" n. " << cma->
number() << std::endl
525 std::ostringstream disp;
529 disp <<
"Low Pt cabling inconsistence (cabling from connector " <<
m_params.lowPtStartCo <<
" to connector " <<
m_params.lowPtStopCo
530 <<
") for" << std::endl
533 disp <<
"High Pt cabling inconsistence (cabling from connector " <<
m_params.highPtStartCo <<
" to connector "
534 <<
m_params.highPtStopCo <<
") for" << std::endl
541 std::ostringstream disp;
544 disp << this->
id() <<
" receives input from" << std::endl
545 <<
" RPC chamber n. " << num <<
" of station " << stat <<
" which has no Wired OR readout!";
550 std::ostringstream disp;
552 << this->
id() << str;
559 else if (stat ==
m_params.lowPtStation)
561 else if (stat ==
m_params.highPtStation)
584 int* strips =
nullptr;
591 strips =
reinterpret_cast<int*
>(
m_pivot);
595 strips =
reinterpret_cast<int*
>(
m_lowPt);
599 strips =
reinterpret_cast<int*
>(
m_highPt);
603 for (
int i = 0; i < nstrips; ++i) {
604 if (strips[i] == cab_code) {
606 ly = (i / channels) % 2;
615 int* strips =
nullptr;
618 if (ly >= 2)
return false;
623 strips =
reinterpret_cast<int*
>(
m_pivot);
627 strips =
reinterpret_cast<int*
>(
m_lowPt);
631 strips =
reinterpret_cast<int*
>(
m_highPt);
635 if (ch >= channels)
return false;
637 int position = WOR * (2 * channels) + ly * (channels) + ch;
639 if (*(strips + position) < 0)
return false;
641 code = *(strips + position);
647 short int num)
const {
648 if (Ch1 > Ch2)
return false;
673 default:
return false;
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);
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);
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;
720 for (
int i = 0; i < worlo; ++i) {
721 if (num / abs(num) == 1) {
722 unsigned short int piv = Ch1 + num;
724 for (
unsigned short int j = Ch1; j < piv; ++j) {
725 int pos = i * 2 * maxch + layer * maxch + j;
729 for (
unsigned short int j = piv; j <= Ch2; ++j) {
730 int pos = i * 2 * maxch + layer * maxch + j;
732 *(
map + pos - num) = *(
map + pos);
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;
742 int pos = i * 2 * maxch + layer * maxch + ch;
748 int pos = i * 2 * maxch + layer * maxch + piv - 1;
750 *(
map + pos + (int)abs(num)) = *(
map + pos);
753 }
while (piv > stop);
759 default:
return false;
766 std::list<unsigned int>& StripCodes)
const {
769 if (ijk == 0 || ijk == 1) {
771 int CabCode =
m_pivot[i][ijk][Channel];
773 int strip_number = CabCode % 100;
774 int rpc_z_index = (CabCode / 100) % 100;
775 int rpc_layer = (CabCode / 10000) % 10;
777 StripCodes.push_back(deco.
code());
783 if (ijk == 2 || ijk == 3) {
786 int CabCode =
m_highPt[i][0][Channel + 32 * (ijk % 2)];
788 int strip_number = CabCode % 100;
789 int rpc_z_index = (CabCode / 100) % 100;
790 int rpc_layer = (CabCode / 10000) % 10;
792 StripCodes.push_back(deco.
code());
798 int CabCode =
m_lowPt[i][0][Channel + 32 * (ijk % 2)];
800 int strip_number = CabCode % 100;
801 int rpc_z_index = (CabCode / 100) % 100;
802 int rpc_layer = (CabCode / 10000) % 10;
804 StripCodes.push_back(deco.
code());
811 if (ijk == 4 || ijk == 5) {
814 int CabCode =
m_highPt[i][1][Channel + 32 * (ijk % 2)];
816 int strip_number = CabCode % 100;
817 int rpc_z_index = (CabCode / 100) % 100;
818 int rpc_layer = (CabCode / 10000) % 10;
820 StripCodes.push_back(deco.
code());
826 int CabCode =
m_lowPt[i][1][Channel + 32 * (ijk % 2)];
828 int strip_number = CabCode % 100;
829 int rpc_z_index = (CabCode / 100) % 100;
830 int rpc_layer = (CabCode / 10000) % 10;
832 StripCodes.push_back(deco.
code());
841 int CabCode =
m_pivot[i][0][Channel];
843 int strip_number = CabCode % 100;
844 int rpc_z_index = (CabCode / 100) % 100;
845 int rpc_layer = (CabCode / 10000) % 10;
847 StripCodes.push_back(deco.
code());
857 int CabCode =
m_pivot[i][0][ch];
858 if (CabCode != -1)
return ch;
867 int CabCode =
m_pivot[i][0][ch];
868 if (CabCode != -1)
return ch;
877 int CabCode =
m_lowPt[i][0][ch];
878 if (CabCode != -1)
return ch;
887 int CabCode =
m_lowPt[i][0][ch];
888 if (CabCode != -1)
return ch;
898 if (CabCode != -1)
return ch;
908 if (CabCode != -1)
return ch;
constexpr int pow(int base, int exp) noexcept
const std::string & name() const
CMAinput whichCMAinput(int) const
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
int highPt_number_co() const
std::string no_wor_readout(int, int)
unsigned int last_lowPt_channel() const
void showDt(std::ostream &, int layer) const
int pivot_stop_st() const
void reset_highPt_cabling()
int pivot_stop_ch() const
unsigned int first_lowPt_channel() const
int highPt_stop_st() const
void showMt(char[][90], int, TrigType, int layer) const
CMAconfiguration m_conf_type
int pivot_station() const
static constexpr int confirm_channels
bool get_cabling(CMAinput, int, int, int, unsigned int &) const
int active_highPt_chs() const
int pivot_rpc_read() const
int(* m_lowPt)[2][confirm_channels]
int lowPt_start_co() const
virtual void Print(std::ostream &, bool) const override
bool correct(L1RPCcabCorrection type, CMAinput it, unsigned int layer, unsigned short int Ch1, unsigned short int Ch2, short int num) const
int(* m_pivot)[2][pivot_channels]
CMAparameters & operator=(const CMAparameters &)
int pivot_start_st() const
int highPt_start_st() const
unsigned int m_last_pivot_code
unsigned int m_last_lowPt_code
int highPt_stop_co() const
int lowPt_stop_st() const
const CMAidentity & id() const
int lowPt_start_st() const
int lowPt_number_co() const
void reset_lowPt_cabling()
int lowPt_rpc_read() const
unsigned int last_highPt_code() const
void reset_pivot_cabling()
CMAconfiguration conf_type() const
unsigned int m_first_pivot_code
std::string two_obj_error_message(const std::string &, CMAparameters *)
int active_lowPt_chs() const
int lowPt_stop_ch() const
const CMAparameters * test(CMAinput, int) const
int highPt_station() const
unsigned int last_lowPt_code() const
std::string noMoreChannels(const std::string &stat)
int lowPt_station() const
unsigned int first_highPt_code() const
bool get_channel(CMAinput, int, int &, int &) const
std::string error(const std::string &)
unsigned int first_lowPt_code() const
void create_highPt_map(int)
unsigned int m_first_highPt_code
const CMAprogram * lowPt_program() const
std::unique_ptr< CMAprogram > m_lowPt_program
std::unique_ptr< CMAidentity > m_id
int highPt_stop_ch() const
int highPt_start_ch() const
unsigned int m_last_highPt_code
int lowPt_start_ch() const
void create_pivot_map(int)
void create_lowPt_map(int)
std::unique_ptr< CMAprogram > m_highPt_program
unsigned int m_first_lowPt_code
unsigned int first_pivot_code() const
bool operator==(const CMAparameters &) const
unsigned int first_highPt_channel() const
int highPt_start_co() const
CMAparameters & operator+=(const CMAparameters &)
int active_pivot_chs() const
int lowPt_stop_co() const
unsigned int last_pivot_channel() const
CMAparameters(const parseParams &parse)
std::string no_confirm_error(int)
int highPt_rpc_read() const
int whichCMAstation(CMAinput input) const
int(* m_highPt)[2][confirm_channels]
int pivot_start_ch() const
static constexpr int pivot_channels
unsigned int first_pivot_channel() const
bool give_connection(int, int, CMAinput &, int &, int &) const
const CMAprogram * highPt_program() const
unsigned int last_highPt_channel() const
unsigned int last_pivot_code() const
const bool * registers(void) const
std::string error_header() const
CablingObject(const cablingParameters &, const std::string &)
CablingObject & operator=(const CablingObject &)=default
unsigned int code(void) const
void fill(H5::Group &out_file, size_t iterations)