83 int first_ch_cabled = 32;
84 int last_ch_cabled = -1;
86 std::vector<int> multiplicity(max_st);
92 int local_strip = start - (max_st - rpc_st);
93 int final_strip = stop - (max_st - rpc_st);
96 chs += (local_strip >= 0) ? 0 : abs(local_strip) + 1;
101 if (chs <= first_ch_cabled) first_ch_cabled = chs;
103 if (local_strip <= 0) local_strip = 1;
109 if (local_strip > 0 && local_strip <= rpc_st) {
111 m_pivot[i][0][chs] = cham * 100 + local_strip - 1;
112 m_pivot[i][1][chs] = 10000 + cham * 100 + local_strip - 1;
114 m_pivot[i][1][chs] = cham * 100 + local_strip - 1;
115 m_pivot[i][0][chs] = 10000 + cham * 100 + local_strip - 1;
117 multiplicity[local_strip - 1 + (max_st - rpc_st)] = 1;
120 }
while (++local_strip <= final_strip);
122 if (chs - 1 >= last_ch_cabled) last_ch_cabled = chs - 1;
136 std::ostringstream disp;
137 disp <<
"EvenPhiCMA::cable_CMA_channels - out of bound array indices (m_pivot)! Values:"
138 << first_ch_cabled <<
", " << last_ch_cabled
139 <<
" at " << __FILE__ <<
":" << __LINE__ ;
140 throw std::runtime_error(disp.str());
144 if (
m_pivot[ch][0][first_ch_cabled] >= 0)
break;
149 if (
m_pivot[ch][0][last_ch_cabled] >= 0)
break;
167 int first_ch_cabled = 64;
168 int last_ch_cabled = -1;
175 WiredOR* wor = (*found).second;
183 int local_strip = start - (max_st - rpc_st);
184 int final_strip = stop - (max_st - rpc_st);
186 int chs = (
id().
Ixx_index() == 0) ? 40 - max_st / 2 : 0;
191 if (E ==
'E') isBME =
true;
193 if (isBME &&
id().Ixx_index() == 1) {
199 if (isBME &&
id().Ixx_index() == 0) {
206 chs += (local_strip >= 0) ? 0 : abs(local_strip) + 1;
212 if (chs <= first_ch_cabled) first_ch_cabled = chs;
214 if (local_strip <= 0) local_strip = 1;
220 if (local_strip > 0 && local_strip <= rpc_st) {
222 m_lowPt[
r][0][chs] = cham * 100 + local_strip - 1;
223 m_lowPt[
r][1][chs] = 10000 + cham * 100 + local_strip - 1;
225 m_lowPt[
r][1][chs] = cham * 100 + local_strip - 1;
226 m_lowPt[
r][0][chs] = 10000 + cham * 100 + local_strip - 1;
229 multiplicity[local_strip - 1] = 1;
231 multiplicity[local_strip - 1 + (max_st - rpc_st)] = 1;
235 }
while (++local_strip <= final_strip);
238 if (chs - 1 >= last_ch_cabled) last_ch_cabled = chs - 1;
253 std::ostringstream disp;
254 disp <<
"EvenPhiCMA::cable_CMA_channels - out of bound array indices (m_lowPt)! Values:"
255 << first_ch_cabled <<
", " << last_ch_cabled
256 <<
" at " << __FILE__ <<
":" << __LINE__ ;
257 throw std::runtime_error(disp.str());
261 if (
m_lowPt[ch][0][first_ch_cabled] >= 0)
break;
266 if (
m_lowPt[ch][0][last_ch_cabled] >= 0)
break;
285 int first_ch_cabled = 64;
286 int last_ch_cabled = -1;
293 WiredOR* wor = (*found).second;
302 int local_strip = start - (max_st - rpc_st);
303 int final_strip = stop - (max_st - rpc_st);
305 int chs = (
id().
Ixx_index() == 0) ? 40 - max_st / 2 : 0;
311 if (abs(sEta) == 8 && L ==
'L') isBOE =
true;
312 if (isBOE &&
id().Ixx_index() == 1) {
318 if (isBOE &&
id().Ixx_index() == 0) {
324 chs += (local_strip >= 0) ? 0 : abs(local_strip) + 1;
329 if (chs <= first_ch_cabled) first_ch_cabled = chs;
331 if (local_strip <= 0) local_strip = 1;
337 bool skipChannel =
false;
338 if (isBOE &&
id().Ixx_index() == 1 && ((chs > 3 && chs < 8) || (chs > 39 && chs < 44))) skipChannel =
true;
339 if (isBOE &&
id().Ixx_index() == 0 && ((chs > 19 && chs < 24) || (chs > 55 && chs < 60))) skipChannel =
true;
343 if (local_strip > 0 && local_strip <= rpc_st) {
345 m_highPt[
r][0][chs] = cham * 100 + local_strip - 1;
346 m_highPt[
r][1][chs] = 10000 + cham * 100 + local_strip - 1;
348 m_highPt[
r][1][chs] = cham * 100 + local_strip - 1;
349 m_highPt[
r][0][chs] = 10000 + cham * 100 + local_strip - 1;
353 multiplicity[local_strip - 1] = 1;
355 multiplicity[local_strip - 1 + (max_st - rpc_st)] = 1;
359 }
while (++local_strip <= final_strip);
362 if (chs - 1 >= last_ch_cabled) last_ch_cabled = chs - 1;
377 std::ostringstream disp;
378 disp <<
"EvenPhiCMA::cable_CMA_channels - out of bound array indices (m_highPt)! Values:"
379 << first_ch_cabled <<
", " << last_ch_cabled
380 <<
" at " << __FILE__ <<
":" << __LINE__ ;
381 throw std::runtime_error(disp.str());
385 if (
m_highPt[ch][0][first_ch_cabled] >= 0)
break;
390 if (
m_highPt[ch][0][last_ch_cabled] >= 0)
break;
415 std::list<const EtaCMA*> CMAs =
setup.find_eta_CMAs_in_PAD(
id().PAD_index());
422 const EtaCMA* cmaFake = CMAs.back();
425 std::list<const EtaCMA*>::iterator
cm = CMAs.begin();
426 while (
cm != CMAs.end()) {
427 if (!(*cm)->pivot_station() || (*cm)->lowPt_start_ch() == -1)
cm = CMAs.erase(
cm);
431 int start_ch = (CMAs.size()) ? CMAs.front()->lowPt_start_ch() : cmaFake->
lowPt_start_ch();
432 int stop_ch = (CMAs.size()) ? CMAs.back()->lowPt_stop_ch() : cmaFake->
lowPt_stop_ch();
434 if (start_ch != -1 && stop_ch != -1) {
438 if (start->readoutWORs().empty()) {
442 if (stop->readoutWORs().empty()) {
468 std::list<const EtaCMA*> CMAs =
setup.find_eta_CMAs_in_PAD(
id().PAD_index());
475 const EtaCMA* cmaFake = CMAs.back();
478 std::list<const EtaCMA*>::iterator
cm = CMAs.begin();
479 while (
cm != CMAs.end()) {
480 if (!(*cm)->pivot_station() || (*cm)->highPt_start_ch() == -1)
cm = CMAs.erase(
cm);
484 int start_ch = (CMAs.size()) ? CMAs.front()->highPt_start_ch() : cmaFake->
highPt_start_ch();
485 int stop_ch = (CMAs.size()) ? CMAs.back()->highPt_stop_ch() : cmaFake->
highPt_stop_ch();
487 if (start_ch != -1 && stop_ch != -1) {
491 if (start->readoutWORs().empty()) {
495 if (stop->readoutWORs().empty()) {
594 std::string LVL1_configuration_repository;
595 LVL1_configuration_repository =
"ATLAS.data";
599 SectorLogicSetup::SECTORlist::const_iterator it = sectors.begin();
602 sprintf(s_tag,
"s%02d", *it);
605 sprintf(t_tag,
"t%1d",
id().PAD_index());
607 char c_tag[4] = {
'_',
'c',
'0',
'\0'};
608 if (
id().phi_index() == 1) c_tag[2] =
'1';
610 std::ifstream CMAprogLow;
611 std::istringstream CMAprogLow_COOL;
613 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
619 if (p_trigroads ==
nullptr) {
620 while (!CMAprogLow.is_open() && it != sectors.end()) {
621 std::ostringstream namestr;
622 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
627 dir =
setup.online_database();
628 namestr << dir <<
"/" << s_tag <<
"_" << t_tag <<
"_pl" << c_tag <<
".txt" << std::ends;
630 namestr.str().copy(
name, namestr.str().length(), 0);
631 name[namestr.str().length()] = 0;
633 CMAprogLow.open(
name);
634 if (!CMAprogLow.is_open()) CMAprogLow.clear();
642 while (CMAprogLow_COOL.str().empty() && it != sectors.end()) {
643 std::ostringstream namestr;
644 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
648 namestr << s_tag <<
"_" << t_tag <<
"_pl" << c_tag <<
".txt" << std::ends;
649 namestr.str().copy(
name, namestr.str().length(), 0);
650 name[namestr.str().length()] = 0;
651 TrigRoadsMap::const_iterator itc;
652 itc = p_trigroads->find(
name);
653 if (itc != p_trigroads->end()) {
654 if (log.level() <= MSG::VERBOSE) {
655 log << MSG::VERBOSE <<
"EvenPhiCMA low: key " <<
name <<
"found in the Trigger Road Map --> OK"
656 <<
", EvenPhiCMA low: key " << itc->second.c_str() <<
endmsg;
658 CMAprogLow_COOL.str(itc->second.c_str());
659 if (log.level() <= MSG::VERBOSE) {
660 log << MSG::VERBOSE <<
"LBTAG-CMAPROGLOWO " << CMAprogLow_COOL.str() <<
endmsg;
668 if (CMAprogLow.is_open()) {
669 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogLow,
true);
670 if (program->check()) {
672 if (
setup.cosmic()) {
676 for (
unsigned int i = 0; i < 3; ++i) {
678 if (log.level() <= MSG::DEBUG) {
679 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": low-pt: has threshold " << i
680 <<
" not programmed." <<
endmsg;
686 }
else if (!CMAprogLow_COOL.str().empty()) {
687 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogLow_COOL,
true);
688 if (program->check()) {
690 if (
setup.cosmic()) {
694 for (
unsigned int i = 0; i < 3; ++i) {
696 if (log.level() <= MSG::DEBUG) {
697 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": low-pt: has threshold " << i
698 <<
" not programmed." <<
endmsg;
703 CMAprogLow_COOL.str(
"");
704 }
else if (
name[0] !=
'\0') {
705 if (log.level() <= MSG::DEBUG) {
706 log << MSG::DEBUG <<
name <<
" not found! Putting a dummy configuration" <<
endmsg;
712 std::ifstream CMAprogHigh;
713 std::istringstream CMAprogHigh_COOL;
715 it = sectors.begin();
717 if (p_trigroads ==
nullptr) {
718 while (!CMAprogHigh.is_open() && it != sectors.end()) {
719 std::ostringstream namestr;
720 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
725 dir =
setup.online_database();
726 namestr << dir <<
"/" << s_tag <<
"_" << t_tag <<
"_ph" << c_tag <<
".txt" << std::ends;
728 namestr.str().copy(
name, namestr.str().length(), 0);
729 name[namestr.str().length()] = 0;
731 CMAprogHigh.open(
name);
732 if (!CMAprogHigh.is_open()) CMAprogHigh.clear();
740 it = sectors.begin();
741 while (CMAprogHigh_COOL.str().empty() && it != sectors.end()) {
742 std::ostringstream namestr;
743 for (
int i = 0; i < 200; ++i)
name[i] =
'\0';
747 namestr << s_tag <<
"_" << t_tag <<
"_ph" << c_tag <<
".txt" << std::ends;
748 namestr.str().copy(
name, namestr.str().length(), 0);
749 name[namestr.str().length()] = 0;
750 TrigRoadsMap::const_iterator itc;
751 itc = p_trigroads->find(
name);
752 if (itc != p_trigroads->end()) {
753 if (log.level() <= MSG::VERBOSE) {
754 log << MSG::VERBOSE <<
"EvenPhiCMA high: key " <<
name <<
"found in the Trigger Road Map --> OK"
755 <<
", EvenPhiCMA high: key " << itc->second.c_str() <<
endmsg;
757 CMAprogHigh_COOL.str(itc->second.c_str());
758 if (log.level() <= MSG::DEBUG) {
759 log << MSG::DEBUG <<
"CMAPROGHIGH " << CMAprogHigh_COOL.str() <<
endmsg;
768 if (CMAprogHigh.is_open()) {
769 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogHigh,
true);
770 if (program->check()) {
772 if (
setup.cosmic()) {
776 for (
unsigned int i = 0; i < 3; ++i) {
778 if (log.level() <= MSG::DEBUG) {
779 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": high-pt: has threshold " << i
780 <<
" not programmed." <<
endmsg;
786 }
else if (!CMAprogHigh_COOL.str().empty()) {
787 std::unique_ptr<CMAprogram> program = std::make_unique<CMAprogram>(CMAprogHigh_COOL,
true);
788 if (program->check()) {
790 if (
setup.cosmic()) {
794 for (
unsigned int i = 0; i < 3; ++i) {
796 if (log.level() <= MSG::DEBUG) {
797 log << MSG::DEBUG << s_tag <<
": " <<
id() <<
": high-pt: has threshold " << i
798 <<
" not programmed." <<
endmsg;
803 CMAprogHigh_COOL.str(
"");
804 }
else if (
name[0] !=
'\0') {
805 if (log.level() <= MSG::DEBUG) {
806 log << MSG::DEBUG <<
name <<
" not found! Putting a dummy configuration" <<
endmsg;