82 int first_ch_cabled = 32;
83 int last_ch_cabled = -1;
85 std::vector<int> multiplicity(max_st);
91 int local_strip = start - (max_st - rpc_st);
92 int final_strip = stop - (max_st - rpc_st);
95 chs += (local_strip >= 0) ? 0 : abs(local_strip) + 1;
100 if (chs <= first_ch_cabled) first_ch_cabled = chs;
102 if (local_strip <= 0) local_strip = 1;
108 if (local_strip > 0 && local_strip <= rpc_st) {
110 m_pivot[i][0][chs] = cham * 100 + local_strip - 1;
111 m_pivot[i][1][chs] = 10000 + cham * 100 + local_strip - 1;
113 m_pivot[i][1][chs] = cham * 100 + local_strip - 1;
114 m_pivot[i][0][chs] = 10000 + cham * 100 + local_strip - 1;
116 multiplicity[local_strip - 1 + (max_st - rpc_st)] = 1;
119 }
while (++local_strip <= final_strip);
121 if (chs - 1 >= last_ch_cabled) last_ch_cabled = chs - 1;
135 std::ostringstream disp;
136 disp <<
"EvenPhiCMA::cable_CMA_channels - out of bound array indices (m_pivot)! Values:"
137 << first_ch_cabled <<
", " << last_ch_cabled
138 <<
" at " << __FILE__ <<
":" << __LINE__ ;
139 throw std::runtime_error(disp.str());
143 if (
m_pivot[ch][0][first_ch_cabled] >= 0)
break;
148 if (
m_pivot[ch][0][last_ch_cabled] >= 0)
break;
166 int first_ch_cabled = 64;
167 int last_ch_cabled = -1;
174 WiredOR* wor = (*found).second;
182 int local_strip = start - (max_st - rpc_st);
183 int final_strip = stop - (max_st - rpc_st);
185 int chs = (
id().
Ixx_index() == 0) ? 40 - max_st / 2 : 0;
190 if (E ==
'E') isBME =
true;
192 if (isBME &&
id().Ixx_index() == 1) {
198 if (isBME &&
id().Ixx_index() == 0) {
205 chs += (local_strip >= 0) ? 0 : abs(local_strip) + 1;
211 if (chs <= first_ch_cabled) first_ch_cabled = chs;
213 if (local_strip <= 0) local_strip = 1;
219 if (local_strip > 0 && local_strip <= rpc_st) {
221 m_lowPt[
r][0][chs] = cham * 100 + local_strip - 1;
222 m_lowPt[
r][1][chs] = 10000 + cham * 100 + local_strip - 1;
224 m_lowPt[
r][1][chs] = cham * 100 + local_strip - 1;
225 m_lowPt[
r][0][chs] = 10000 + cham * 100 + local_strip - 1;
228 multiplicity[local_strip - 1] = 1;
230 multiplicity[local_strip - 1 + (max_st - rpc_st)] = 1;
234 }
while (++local_strip <= final_strip);
237 if (chs - 1 >= last_ch_cabled) last_ch_cabled = chs - 1;
252 std::ostringstream disp;
253 disp <<
"EvenPhiCMA::cable_CMA_channels - out of bound array indices (m_lowPt)! Values:"
254 << first_ch_cabled <<
", " << last_ch_cabled
255 <<
" at " << __FILE__ <<
":" << __LINE__ ;
256 throw std::runtime_error(disp.str());
260 if (
m_lowPt[ch][0][first_ch_cabled] >= 0)
break;
265 if (
m_lowPt[ch][0][last_ch_cabled] >= 0)
break;
284 int first_ch_cabled = 64;
285 int last_ch_cabled = -1;
292 WiredOR* wor = (*found).second;
301 int local_strip = start - (max_st - rpc_st);
302 int final_strip = stop - (max_st - rpc_st);
304 int chs = (
id().
Ixx_index() == 0) ? 40 - max_st / 2 : 0;
310 if (abs(sEta) == 8 && L ==
'L') isBOE =
true;
311 if (isBOE &&
id().Ixx_index() == 1) {
317 if (isBOE &&
id().Ixx_index() == 0) {
323 chs += (local_strip >= 0) ? 0 : abs(local_strip) + 1;
328 if (chs <= first_ch_cabled) first_ch_cabled = chs;
330 if (local_strip <= 0) local_strip = 1;
336 bool skipChannel =
false;
337 if (isBOE &&
id().Ixx_index() == 1 && ((chs > 3 && chs < 8) || (chs > 39 && chs < 44))) skipChannel =
true;
338 if (isBOE &&
id().Ixx_index() == 0 && ((chs > 19 && chs < 24) || (chs > 55 && chs < 60))) skipChannel =
true;
342 if (local_strip > 0 && local_strip <= rpc_st) {
344 m_highPt[
r][0][chs] = cham * 100 + local_strip - 1;
345 m_highPt[
r][1][chs] = 10000 + cham * 100 + local_strip - 1;
347 m_highPt[
r][1][chs] = cham * 100 + local_strip - 1;
348 m_highPt[
r][0][chs] = 10000 + cham * 100 + local_strip - 1;
352 multiplicity[local_strip - 1] = 1;
354 multiplicity[local_strip - 1 + (max_st - rpc_st)] = 1;
358 }
while (++local_strip <= final_strip);
361 if (chs - 1 >= last_ch_cabled) last_ch_cabled = chs - 1;
376 std::ostringstream disp;
377 disp <<
"EvenPhiCMA::cable_CMA_channels - out of bound array indices (m_highPt)! Values:"
378 << first_ch_cabled <<
", " << last_ch_cabled
379 <<
" at " << __FILE__ <<
":" << __LINE__ ;
380 throw std::runtime_error(disp.str());
384 if (
m_highPt[ch][0][first_ch_cabled] >= 0)
break;
389 if (
m_highPt[ch][0][last_ch_cabled] >= 0)
break;
414 std::list<const EtaCMA*> CMAs =
setup.find_eta_CMAs_in_PAD(
id().PAD_index());
421 const EtaCMA* cmaFake = CMAs.back();
424 std::list<const EtaCMA*>::iterator
cm = CMAs.begin();
425 while (
cm != CMAs.end()) {
426 if (!(*cm)->pivot_station() || (*cm)->lowPt_start_ch() == -1)
cm = CMAs.erase(
cm);
430 int start_ch = (CMAs.size()) ? CMAs.front()->lowPt_start_ch() : cmaFake->
lowPt_start_ch();
431 int stop_ch = (CMAs.size()) ? CMAs.back()->lowPt_stop_ch() : cmaFake->
lowPt_stop_ch();
433 if (start_ch != -1 && stop_ch != -1) {
437 if (start->readoutWORs().empty()) {
441 if (stop->readoutWORs().empty()) {
467 std::list<const EtaCMA*> CMAs =
setup.find_eta_CMAs_in_PAD(
id().PAD_index());
474 const EtaCMA* cmaFake = CMAs.back();
477 std::list<const EtaCMA*>::iterator
cm = CMAs.begin();
478 while (
cm != CMAs.end()) {
479 if (!(*cm)->pivot_station() || (*cm)->highPt_start_ch() == -1)
cm = CMAs.erase(
cm);
483 int start_ch = (CMAs.size()) ? CMAs.front()->highPt_start_ch() : cmaFake->
highPt_start_ch();
484 int stop_ch = (CMAs.size()) ? CMAs.back()->highPt_stop_ch() : cmaFake->
highPt_stop_ch();
486 if (start_ch != -1 && stop_ch != -1) {
490 if (start->readoutWORs().empty()) {
494 if (stop->readoutWORs().empty()) {
593 std::string LVL1_configuration_repository;
594 LVL1_configuration_repository =
"ATLAS.data";
598 SectorLogicSetup::SECTORlist::const_iterator it = sectors.begin();
601 sprintf(s_tag,
"s%02d", *it);
604 sprintf(t_tag,
"t%1d",
id().PAD_index());
606 char c_tag[4] = {
'_',
'c',
'0',
'\0'};
607 if (
id().phi_index() == 1) c_tag[2] =
'1';
609 std::ifstream CMAprogLow;
610 std::istringstream CMAprogLow_COOL;
612 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
615 const std::map<std::string, std::string>* p_trigroads =
setup.GetPtoTrigRoads();
618 if (p_trigroads ==
nullptr) {
619 while (!CMAprogLow.is_open() && it != sectors.end()) {
620 std::ostringstream namestr;
621 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
626 dir =
setup.online_database();
627 namestr << dir <<
"/" << s_tag <<
"_" << t_tag <<
"_pl" << c_tag <<
".txt" << std::ends;
629 namestr.str().copy(
name, namestr.str().length(), 0);
630 name[namestr.str().length()] = 0;
632 CMAprogLow.open(
name);
633 if (!CMAprogLow.is_open()) CMAprogLow.clear();
641 while (CMAprogLow_COOL.str().empty() && it != sectors.end()) {
642 std::ostringstream namestr;
643 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
647 namestr << s_tag <<
"_" << t_tag <<
"_pl" << c_tag <<
".txt" << std::ends;
648 namestr.str().copy(
name, namestr.str().length(), 0);
649 name[namestr.str().length()] = 0;
650 std::map<std::string, std::string>::const_iterator itc;
651 itc = p_trigroads->find(
name);
652 if (itc != p_trigroads->end()) {
653 if (log.level() <= MSG::VERBOSE) {
654 log << MSG::VERBOSE <<
"EvenPhiCMA low: key " <<
name <<
"found in the Trigger Road Map --> OK"
655 <<
", EvenPhiCMA low: key " << itc->second.c_str() <<
endmsg;
657 CMAprogLow_COOL.str(itc->second.c_str());
658 if (log.level() <= MSG::VERBOSE) {
659 log << MSG::VERBOSE <<
"LBTAG-CMAPROGLOWO " << CMAprogLow_COOL.str() <<
endmsg;
667 if (CMAprogLow.is_open()) {
668 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogLow,
true);
669 if (program->check()) {
671 if (
setup.cosmic()) {
675 for (
unsigned int i = 0; i < 3; ++i) {
677 if (log.level() <= MSG::DEBUG) {
678 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": low-pt: has threshold " << i
679 <<
" not programmed." <<
endmsg;
685 }
else if (!CMAprogLow_COOL.str().empty()) {
686 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogLow_COOL,
true);
687 if (program->check()) {
689 if (
setup.cosmic()) {
693 for (
unsigned int i = 0; i < 3; ++i) {
695 if (log.level() <= MSG::DEBUG) {
696 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": low-pt: has threshold " << i
697 <<
" not programmed." <<
endmsg;
702 CMAprogLow_COOL.str(
"");
703 }
else if (
name[0] !=
'\0') {
704 if (log.level() <= MSG::DEBUG) {
705 log << MSG::DEBUG <<
name <<
" not found! Putting a dummy configuration" <<
endmsg;
711 std::ifstream CMAprogHigh;
712 std::istringstream CMAprogHigh_COOL;
714 it = sectors.begin();
716 if (p_trigroads ==
nullptr) {
717 while (!CMAprogHigh.is_open() && it != sectors.end()) {
718 std::ostringstream namestr;
719 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
724 dir =
setup.online_database();
725 namestr << dir <<
"/" << s_tag <<
"_" << t_tag <<
"_ph" << c_tag <<
".txt" << std::ends;
727 namestr.str().copy(
name, namestr.str().length(), 0);
728 name[namestr.str().length()] = 0;
730 CMAprogHigh.open(
name);
731 if (!CMAprogHigh.is_open()) CMAprogHigh.clear();
739 it = sectors.begin();
740 while (CMAprogHigh_COOL.str().empty() && it != sectors.end()) {
741 std::ostringstream namestr;
742 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
746 namestr << s_tag <<
"_" << t_tag <<
"_ph" << c_tag <<
".txt" << std::ends;
747 namestr.str().copy(
name, namestr.str().length(), 0);
748 name[namestr.str().length()] = 0;
749 std::map<std::string, std::string>::const_iterator itc;
750 itc = p_trigroads->find(
name);
751 if (itc != p_trigroads->end()) {
752 if (log.level() <= MSG::VERBOSE) {
753 log << MSG::VERBOSE <<
"EvenPhiCMA high: key " <<
name <<
"found in the Trigger Road Map --> OK"
754 <<
", EvenPhiCMA high: key " << itc->second.c_str() <<
endmsg;
756 CMAprogHigh_COOL.str(itc->second.c_str());
757 if (log.level() <= MSG::DEBUG) {
758 log << MSG::DEBUG <<
"CMAPROGHIGH " << CMAprogHigh_COOL.str() <<
endmsg;
767 if (CMAprogHigh.is_open()) {
768 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogHigh,
true);
769 if (program->check()) {
771 if (
setup.cosmic()) {
775 for (
unsigned int i = 0; i < 3; ++i) {
777 if (log.level() <= MSG::DEBUG) {
778 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": high-pt: has threshold " << i
779 <<
" not programmed." <<
endmsg;
785 }
else if (!CMAprogHigh_COOL.str().empty()) {
786 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogHigh_COOL,
true);
787 if (program->check()) {
789 if (
setup.cosmic()) {
793 for (
unsigned int i = 0; i < 3; ++i) {
795 if (log.level() <= MSG::DEBUG) {
796 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": high-pt: has threshold " << i
797 <<
" not programmed." <<
endmsg;
802 CMAprogHigh_COOL.str(
"");
803 }
else if (
name[0] !=
'\0') {
804 if (log.level() <= MSG::DEBUG) {
805 log << MSG::DEBUG <<
name <<
" not found! Putting a dummy configuration" <<
endmsg;