73 throw std::runtime_error(
"Channel not found in OddPhiCMA::cable_CMA_channels");
84 int first_ch_cabled = 32;
85 int last_ch_cabled = -1;
87 std::vector<int> multiplicity(max_st);
93 int local_strip = max_st - (max_st - start);
94 int final_strip = max_st - (max_st - stop);
101 if (chs <= first_ch_cabled) first_ch_cabled = chs;
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] = 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 <<
"OddPhiCMA::cable_CMA_channels - out of bound array indices! Values:"
137 << first_ch_cabled <<
", " << last_ch_cabled
138 <<
" at " << __FILE__ <<
":" << __LINE__ ;
139 throw std::runtime_error(disp.str());
144 if (
m_pivot[ch][0][last_ch_cabled] >= 0)
break;
150 if (
m_pivot[ch][0][first_ch_cabled] >= 0)
break;
159 throw std::runtime_error(
"Channel not found in OddPhiCMA::cable_CMA_channels");
170 int first_ch_cabled = 64;
171 int last_ch_cabled = -1;
178 throw std::runtime_error(
"Channel not found in OddPhiCMA::cable_CMA_channels");
180 WiredOR* wor = (*found).second;
188 int local_strip = max_st - (max_st - start);
189 int final_strip = max_st - (max_st - stop);
191 int chs = (
id().
Ixx_index() == 0) ? 40 - max_st / 2 : 0;
195 if (E ==
'E' &&
id().Ixx_index() == 1) {
201 if (E ==
'E' &&
id().Ixx_index() == 0) {
208 if (chs <= first_ch_cabled) first_ch_cabled = chs;
214 if (local_strip > 0 && local_strip <= rpc_st) {
216 m_lowPt[
r][0][chs] = cham * 100 + local_strip - 1;
217 m_lowPt[
r][1][chs] = 10000 + cham * 100 + local_strip - 1;
219 m_lowPt[
r][1][chs] = cham * 100 + local_strip - 1;
220 m_lowPt[
r][0][chs] = 10000 + cham * 100 + local_strip - 1;
223 multiplicity[local_strip - 1] = 1;
225 multiplicity[local_strip - 1 + (max_st - rpc_st)] = 1;
229 }
while (--local_strip >= final_strip);
232 if (chs - 1 >= last_ch_cabled) last_ch_cabled = chs - 1;
241 if (last_ch_cabled < 0) {
242 throw std::runtime_error(std::string(
"RPC_CondCabling: OddPhiCMA - neg. array idx at ") +
243 __FILE__ +
":" + std::to_string(__LINE__));
247 if (
m_lowPt[ch][0][last_ch_cabled] >= 0)
break;
252 if (
m_lowPt[ch][0][first_ch_cabled] >= 0)
break;
262 throw std::runtime_error(
"Channel not found in OddPhiCMA::cable_CMA_channels");
273 int first_ch_cabled = 64;
274 int last_ch_cabled = -1;
281 throw std::runtime_error(
"Channel not found in OddPhiCMA::cable_CMA_channels");
291 int local_strip = max_st - (max_st - start);
292 int final_strip = max_st - (max_st - stop);
294 int chs = (
id().
Ixx_index() == 0) ? 40 - max_st / 2 : 0;
300 if (abs(sEta) == 8 && L ==
'L') isBOE =
true;
301 if (isBOE &&
id().Ixx_index() == 1) {
307 if (isBOE &&
id().Ixx_index() == 0) {
313 if (chs <= first_ch_cabled) first_ch_cabled = chs;
320 bool skipChannel =
false;
321 if (isBOE &&
id().Ixx_index() == 1 && ((chs > 3 && chs < 8) || (chs > 39 && chs < 44))) skipChannel =
true;
322 if (isBOE &&
id().Ixx_index() == 0 && ((chs > 19 && chs < 24) || (chs > 55 && chs < 60))) skipChannel =
true;
326 if (local_strip > 0 && local_strip <= rpc_st) {
328 m_highPt[
r][0][chs] = cham * 100 + local_strip - 1;
329 m_highPt[
r][1][chs] = 10000 + cham * 100 + local_strip - 1;
331 m_highPt[
r][1][chs] = cham * 100 + local_strip - 1;
332 m_highPt[
r][0][chs] = 10000 + cham * 100 + local_strip - 1;
335 multiplicity[local_strip - 1] = 1;
337 multiplicity[local_strip - 1 + (max_st - rpc_st)] = 1;
343 }
while (--local_strip >= final_strip);
346 if (chs - 1 >= last_ch_cabled) last_ch_cabled = chs - 1;
355 if (last_ch_cabled < 0) {
356 throw std::runtime_error(std::string(
"RPC_CondCabling: OddPhiCMA - neg. array idx at ") +
357 __FILE__ +
":" + std::to_string(__LINE__));
361 if (
m_highPt[ch][0][last_ch_cabled] >= 0)
break;
366 if (
m_highPt[ch][0][first_ch_cabled] >= 0)
break;
391 std::list<const EtaCMA*> CMAs =
setup.find_eta_CMAs_in_PAD(
id().PAD_index());
398 const EtaCMA* cmaFake = CMAs.back();
401 std::list<const EtaCMA*>::iterator
cm = CMAs.begin();
402 while (
cm != CMAs.end()) {
403 if (!(*cm)->pivot_station() || (*cm)->lowPt_start_ch() == -1)
cm = CMAs.erase(
cm);
407 int start_ch = (CMAs.size()) ? CMAs.front()->lowPt_start_ch() : cmaFake->
lowPt_start_ch();
408 int stop_ch = (CMAs.size()) ? CMAs.back()->lowPt_stop_ch() : cmaFake->
lowPt_stop_ch();
410 if (start_ch != -1 && stop_ch != -1) {
414 if (start->readoutWORs().empty()) {
418 if (stop->readoutWORs().empty()) {
444 std::list<const EtaCMA*> CMAs =
setup.find_eta_CMAs_in_PAD(
id().PAD_index());
451 const EtaCMA* cmaFake = CMAs.back();
454 std::list<const EtaCMA*>::iterator
cm = CMAs.begin();
455 while (
cm != CMAs.end()) {
456 if (!(*cm)->pivot_station() || (*cm)->highPt_start_ch() == -1)
cm = CMAs.erase(
cm);
460 int start_ch = (CMAs.size()) ? CMAs.front()->highPt_start_ch() : cmaFake->
highPt_start_ch();
461 int stop_ch = (CMAs.size()) ? CMAs.back()->highPt_stop_ch() : cmaFake->
highPt_stop_ch();
463 if (start_ch != -1 && stop_ch != -1) {
467 if (start->readoutWORs().empty()) {
471 if (stop->readoutWORs().empty()) {
572 std::string LVL1_configuration_repository;
573 LVL1_configuration_repository =
"ATLAS.121108";
577 SectorLogicSetup::SECTORlist::const_iterator it = sectors.begin();
580 sprintf(s_tag,
"s%02d", *it);
583 sprintf(t_tag,
"t%1d",
id().PAD_index());
585 char c_tag[4] = {
'_',
'c',
'0',
'\0'};
586 if (
id().phi_index() == 1) c_tag[2] =
'1';
588 std::ifstream CMAprogLow;
589 std::istringstream CMAprogLow_COOL;
591 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
597 if (p_trigroads ==
nullptr) {
598 while (!CMAprogLow.is_open() && it != sectors.end()) {
599 std::ostringstream namestr;
600 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
605 dir =
setup.online_database();
606 namestr << dir <<
"/" << s_tag <<
"_" << t_tag <<
"_pl" << c_tag <<
".txt" << std::ends;
608 namestr.str().copy(
name, namestr.str().length(), 0);
609 name[namestr.str().length()] = 0;
611 CMAprogLow.open(
name);
612 if (!CMAprogLow.is_open()) CMAprogLow.clear();
620 while (CMAprogLow_COOL.str().empty() && it != sectors.end()) {
621 std::ostringstream namestr;
622 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
626 namestr << s_tag <<
"_" << t_tag <<
"_pl" << c_tag <<
".txt" << std::ends;
627 namestr.str().copy(
name, namestr.str().length(), 0);
628 name[namestr.str().length()] = 0;
629 TrigRoadsMap::const_iterator itc;
630 itc = p_trigroads->find(
name);
631 if (itc != p_trigroads->end()) {
632 if (log.level() <= MSG::VERBOSE) {
633 log << MSG::VERBOSE <<
"OddPhiCMA low: key " <<
name <<
"found in the Trigger Road Map --> OK"
634 <<
", OddPhiCMA low: key " << itc->second.c_str() <<
endmsg;
636 CMAprogLow_COOL.str(itc->second.c_str());
637 if (log.level() <= MSG::VERBOSE) {
638 log << MSG::VERBOSE <<
"CMAPROGLOW " << CMAprogLow_COOL.str() <<
endmsg;
646 if (CMAprogLow.is_open()) {
647 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogLow,
true);
648 if (program->check()) {
650 if (
setup.cosmic()) {
654 for (
unsigned int i = 0; i < 3; ++i) {
656 if (log.level() <= MSG::DEBUG) {
657 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": low-pt: has threshold " << i
658 <<
" not programmed." <<
endmsg;
664 }
else if (!CMAprogLow_COOL.str().empty()) {
665 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogLow_COOL,
true);
666 if (program->check()) {
668 if (
setup.cosmic()) {
672 for (
unsigned int i = 0; i < 3; ++i) {
674 if (log.level() <= MSG::DEBUG) {
675 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": low-pt: has threshold " << i
676 <<
" not programmed." <<
endmsg;
681 CMAprogLow_COOL.str(
"");
682 }
else if (
name[0] !=
'\0') {
683 if (log.level() <= MSG::DEBUG) {
684 log << MSG::DEBUG <<
name <<
" not found! Putting a dummy configuration" <<
endmsg;
690 std::ifstream CMAprogHigh;
691 std::istringstream CMAprogHigh_COOL;
693 it = sectors.begin();
694 if (p_trigroads ==
nullptr) {
695 while (!CMAprogHigh.is_open() && it != sectors.end()) {
696 std::ostringstream namestr;
697 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
702 dir =
setup.online_database();
703 namestr << dir <<
"/" << s_tag <<
"_" << t_tag <<
"_ph" << c_tag <<
".txt" << std::ends;
705 namestr.str().copy(
name, namestr.str().length(), 0);
706 name[namestr.str().length()] = 0;
708 CMAprogHigh.open(
name);
709 if (!CMAprogHigh.is_open()) CMAprogHigh.clear();
717 while (CMAprogHigh_COOL.str().empty() && it != sectors.end()) {
718 std::ostringstream namestr;
719 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
723 namestr << s_tag <<
"_" << t_tag <<
"_ph" << c_tag <<
".txt" << std::ends;
724 namestr.str().copy(
name, namestr.str().length(), 0);
725 name[namestr.str().length()] = 0;
726 TrigRoadsMap::const_iterator itc;
727 itc = p_trigroads->find(
name);
728 if (itc != p_trigroads->end()) {
729 if (log.level() <= MSG::VERBOSE) {
730 log << MSG::VERBOSE <<
"OddPhiCMA high: key " <<
name <<
"found in the Trigger Road Map --> OK"
731 <<
", OddPhiCMA high: key " << itc->second.c_str() <<
endmsg;
733 CMAprogHigh_COOL.str(itc->second.c_str());
734 if (log.level() <= MSG::VERBOSE) {
735 log << MSG::VERBOSE <<
"CMAPROGHIGH " << CMAprogHigh_COOL.str() <<
endmsg;
744 if (CMAprogHigh.is_open()) {
745 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogHigh,
true);
746 if (program->check()) {
748 if (
setup.cosmic()) {
752 for (
unsigned int i = 0; i < 3; ++i) {
754 if (log.level() <= MSG::DEBUG) {
755 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": high-pt: has threshold " << i
756 <<
" not programmed." <<
endmsg;
762 }
else if (!CMAprogHigh_COOL.str().empty()) {
763 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogHigh_COOL,
true);
764 if (program->check()) {
766 if (
setup.cosmic()) {
770 for (
unsigned int i = 0; i < 3; ++i) {
772 if (log.level() <= MSG::DEBUG) {
773 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": high-pt: has threshold " << i
774 <<
" not programmed." <<
endmsg;
779 CMAprogHigh_COOL.str(
"");
780 }
else if (
name[0] !=
'\0') {
781 if (log.level() <= MSG::DEBUG) {
782 log << MSG::DEBUG <<
name <<
" not found! Putting a dummy configuration" <<
endmsg;