48 m_cablingService = cablingService;
49 if (!m_cablingService) {
51 return StatusCode::FAILURE;
55 CHECK( m_detStore.retrieve() );
59 CHECK( m_detStore->retrieve(caloID) );
61 const TileID* tileID(
nullptr);
62 CHECK( m_detStore->retrieve(tileID) );
65 CHECK( m_detStore->retrieve(tileTBID) );
68 CHECK( m_detStore->retrieve(tileHWID) );
77 if (m_connectedDrawers.size() > 1) {
79 for (
int ros = 1; ros < 5; ++ros) {
80 for (
int drawer = 0; drawer < 64; ++drawer) {
86 msg(MSG::INFO) <<
"Connected drawer list:" << MSG::hex;
87 for (
unsigned int dr = 1; dr < m_connectedDrawers.size(); dr += 2) {
88 int frag1 = std::strtol(m_connectedDrawers[dr - 1].
data(),
nullptr, 0);
89 int frag2 = std::strtol(m_connectedDrawers[dr].
data(),
nullptr, 0);
90 for (
int frag = frag1; frag <= frag2; ++frag) {
92 int drawer = frag & 0xFF;
93 if (ros >= 1 && ros < 5 && drawer >= 0 && drawer < 64) {
95 msg(MSG::INFO) <<
" 0x" << frag;
97 sprintf(module,
"%2.2d", drawer + 1);
100 msg(MSG::INFO) <<
"/LBA" <<
module;
103 msg(MSG::INFO) <<
"/LBC" <<
module;
106 msg(MSG::INFO) <<
"/EBA" <<
module;
109 msg(MSG::INFO) <<
"/EBC" <<
module;
112 msg(MSG::INFO) <<
"/XXX" <<
module;
118 msg(MSG::INFO) <<
" " << MSG::hex;
126 SmartIF<IGeoModelSvc> geoModel{service(
"GeoModelSvc")};
131 std::string atlasVersion = geoModel->atlasVersion();
132 int ctb = atlasVersion.compare(0, 9,
"ATLAS-CTB");
133 int geo = atlasVersion.compare(0,9,
"ATLAS-GEO");
134 int run1 = atlasVersion.compare(0,8,
"ATLAS-R1");
135 int ibl = atlasVersion.compare(0,9,
"ATLAS-IBL");
136 int run2 = atlasVersion.compare(0,8,
"ATLAS-R2");
137 int run3 = atlasVersion.compare(0,8,
"ATLAS-R3");
138 int run4 = atlasVersion.compare(0,13,
"ATLAS-P2-RUN4");
139 int upg = atlasVersion.compare(0,7,
"ATLAS-P") ;
140 int comm = atlasVersion.compare(0,10,
"ATLAS-Comm");
142 bool upgradeA = (tileID->
cell_hash_max() == MAX_TILE_CELLS_UPGRADEA);
143 bool upgradeBC = (tileID->
cell_hash_max() == MAX_TILE_CELLS_UPGRADEBC);
144 bool upgradeABC = (tileID->
cell_hash_max() == MAX_TILE_CELLS_UPGRADEABC);
147 bool nothing_found = (ctb*geo*run1*ibl*run2*run3*run4*upg*comm != 0);
156 ATH_MSG_INFO(
"RUN2 ATLAS geometry flag detected for geometry: " << atlasVersion );
158 ATH_MSG_INFO(
"RUN2 ATLAS UpgradeA geometry flag detected for geometry: " << atlasVersion );
160 }
else if (upgradeBC) {
161 ATH_MSG_INFO(
"RUN2 ATLAS UpgradeBC geometry flag detected for geometry: " << atlasVersion );
163 }
else if (upgradeABC) {
164 ATH_MSG_INFO(
"RUN2 ATLAS UpgradeABC geometry flag detected for geometry: " << atlasVersion );
168 ATH_MSG_INFO(
"Cabling for RUN2 (2014-2017) ATLAS geometry is set via jobOptions " );
170 ATH_MSG_INFO(
"Cabling for RUN2a (2018) ATLAS geometry is set via jobOptions " );
175 ATH_MSG_INFO(
"Using cabling type " << m_cablingType <<
" from jobOptions " );
181 ATH_MSG_INFO(
"RUN3 ATLAS geometry flag detected for geometry: " << atlasVersion );
183 ATH_MSG_INFO(
"Cabling for RUN3 ATLAS geometry is set via jobOptions " );
188 ATH_MSG_INFO(
"Using cabling type " << m_cablingType <<
" from jobOptions " );
193 ATH_MSG_INFO(
"RUN4 ATLAS geometry flag detected for geometry: " << atlasVersion );
195 ATH_MSG_INFO(
"Cabling for RUN3 ATLAS geometry is set via jobOptions " );
200 ATH_MSG_INFO(
"Using cabling type " << m_cablingType <<
" from jobOptions " );
204 ATH_MSG_INFO(
"Cabling for RUN3 ATLAS geometry is set via jobOptions " );
206 ATH_MSG_INFO(
"Cabling for RUN2 (2014-2017) ATLAS geometry is set via jobOptions " );
208 ATH_MSG_INFO(
"Cabling for RUN2a (2018) ATLAS geometry is set via jobOptions " );
209 }
else if (ctb == 0) {
210 ATH_MSG_INFO(
"CTB geometry detected: " << atlasVersion );
212 }
else if (geo == 0 || run1 == 0 || ibl == 0 || run2 == 0 || upg == 0) {
213 ATH_MSG_INFO(
"RUN1 ATLAS geometry detected: " << atlasVersion );
215 }
else if (comm == 0) {
216 ATH_MSG_INFO(
"RUN1 ATLAS Commissioning geometry detected: " << atlasVersion );
219 ATH_MSG_WARNING(
"Old ATLAS geometry detected - most probably it's a mistake: " << atlasVersion );
228 ATH_MSG_INFO(
"Setting Cabling type to " << m_cablingType );
230 ATH_MSG_DEBUG(
"Maximum number of gains: " << m_cablingService->getMaxChannels());
235 if (m_detStore->retrieve(tileMgr).isFailure()) {
236 ATH_MSG_WARNING(
"Unable to retrieve TileDetDescrManager from DetectorStore" );
237 ATH_MSG_WARNING(
"Will not set Tile online hash ID in CaloDetDescrElements" );
244 for (
unsigned int cell = 0; cell < nCellMax; ++cell) {
252 bool disconnected =
true;
253 for (
int pmt = 0; pmt < nchan; ++pmt) {
255 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
256 tileHWID->
get_hash(hw1, pmtHash[pmt], &chContext);
258 disconnected &= (
id2 != id1);
260 if (disconnected) m_disconnectedCells.push_back(cell_id);
264 && (pmtHash[0] != oldPmtHash[0] || pmtHash[1] != oldPmtHash[1])) {
267 <<
" id= " << tileID->
to_string(cell_id, -2)
268 <<
" from (" << oldPmtHash[0] <<
"," << oldPmtHash[1]
269 <<
") to (" << pmtHash[0] <<
"," << pmtHash[1] <<
")" );
274 if (msgLvl(MSG::VERBOSE)) {
277 msg(MSG::VERBOSE) <<
"cell_id " << tileID->
to_string(cell_id, -2) <<
" ch_id";
279 msg(MSG::VERBOSE) <<
" " << tileHWID->
to_string(m_cablingService->s2h_channel_id(tileID->
pmt_id(cell_id, 0)), -1);
281 msg(MSG::VERBOSE) <<
" invalid";
284 msg(MSG::VERBOSE) <<
" " << tileHWID->
to_string(m_cablingService->s2h_channel_id(tileID->
pmt_id(cell_id, 1)), -1);
286 msg(MSG::VERBOSE) <<
" invalid";
294 ATH_MSG_VERBOSE(
"Total: " << m_disconnectedCells.size() <<
" disconnected cells");
297 if (msgLvl(MSG::VERBOSE)) {
300 std::cout <<
"===============================" << std::endl;
302 for (
int ros = 1; ros < 5; ++ros) {
303 for (
int drawer = 0; drawer < 64; ++drawer) {
305 for (
int channel = 0; channel < 48; ++channel) {
309 std::cout <<
" hw1=" << tileHWID->
to_string(hwid1, -1);
310 Identifier id1 = m_cablingService->h2s_pmt_id(hwid1);
312 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
313 HWIdentifier hwid2 = m_cablingService->s2h_channel_id(id1);
315 if (hwid2 != hwid1) std::cout <<
" hw1!=hw2=" << tileHWID->
to_string(hwid2, -1);
317 if (
id2.is_valid()) {
319 std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
321 std::cout << ((tileTBID->
eta(id1)>1) ?
" E4'" :
" MBTS");
325 if (drIdx1 != drIdx2) {
326 std::cout <<
" ERROR in drawer index " << drIdx1 <<
" != " << drIdx2
328 << std::hex <<
" 0x" << hwid1 <<
" 0x"
331 std::cout <<
" drawer index " << drIdx2;
334 std::cout <<
" id2=invalid";
337 std::cout <<
" hw2=invalid";
340 std::cout <<
" id1=invalid";
343 std::cout <<
" hw1=invalid";
345 std::cout << std::endl;
351 std::cout <<
"=== D4 cells in special EB ====" << std::endl;
353 int d4module[4] = { 14, 15, 18, 19 };
354 for (
int side = -1; side < 2; side += 2) {
355 for (
int imod = 0; imod < 4; ++imod) {
356 int module = d4module[imod] - 1;
357 for (
int pmt = 0; pmt < 2; ++pmt) {
361 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
362 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
364 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
366 if (
id2.is_valid()) {
367 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
370 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
372 std::cout <<
" hw2=invalid";
375 std::cout <<
" id2=invalid";
378 std::cout <<
" hw1=invalid";
381 std::cout <<
" id1=invalid";
383 std::cout << std::endl;
389 std::cout <<
"=== C10 cells in special EB ===" << std::endl;
391 int c10module[8] = { 39, 40, 41, 42, 55, 56, 57, 58 };
392 for (
int side = -1; side < 2; side += 2) {
393 for (
int imod = 0; imod < 8; ++imod) {
394 int module = c10module[imod] - 1;
395 for (
int pmt = 0; pmt < 2; ++pmt) {
399 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
400 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
402 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
404 if (
id2.is_valid()) {
405 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
408 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
410 std::cout <<
" hw2=invalid";
413 std::cout <<
" id2=invalid";
416 std::cout <<
" hw1=invalid";
419 std::cout <<
" id1=invalid";
421 std::cout << std::endl;
427 std::cout <<
"========= E1 cells =========" << std::endl;
429 for (
int side = -1; side < 2; side += 2) {
430 for (
int module = 0;
module < 64; ++module) {
431 for (
int tower = 10; tower < 11; tower += 1) {
435 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
436 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
438 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
440 if (
id2.is_valid()) {
441 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
444 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
446 std::cout <<
" hw2=invalid";
449 std::cout <<
" id2=invalid";
452 std::cout <<
" hw1=invalid";
455 std::cout <<
" id1=invalid";
457 std::cout << std::endl;
463 std::cout <<
"========= E2 cells =========" << std::endl;
465 for (
int side = -1; side < 2; side += 2) {
466 for (
int module = 0;
module < 64; ++module) {
467 for (
int tower = 11; tower < 12; tower += 1) {
471 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
472 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
474 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
476 if (
id2.is_valid()) {
477 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
480 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
482 std::cout <<
" hw2=invalid";
485 std::cout <<
" id2=invalid";
488 std::cout <<
" hw1=invalid";
491 std::cout <<
" id1=invalid";
493 std::cout << std::endl;
499 std::cout <<
"========= E3,E4 cells =========" << std::endl;
501 for (
int side = -1; side < 2; side += 2) {
502 for (
int module = 0;
module < 64; ++module) {
503 for (
int tower = 13; tower < 16; tower += 2) {
507 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
508 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
510 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
512 if (
id2.is_valid()) {
513 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
516 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
518 std::cout <<
" hw2=invalid";
521 std::cout <<
" id2=invalid";
524 std::cout <<
" hw1=invalid";
527 std::cout <<
" id1=invalid";
529 std::cout << std::endl;
535 std::cout <<
"========= MBTS cells ==========" << std::endl;
537 for (
int side = -1; side < 2; side += 2) {
538 for (
int module = 0;
module < 8; ++module) {
539 for (
int tower = 0; tower < 2; ++tower) {
543 std::cout <<
" id1=" << tileTBID->
to_string(id1);
544 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
546 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
548 if (
id2.is_valid()) {
552 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
554 std::cout <<
" hw2=invalid";
557 std::cout <<
" id2=invalid";
560 std::cout <<
" hw1=invalid";
563 std::cout <<
" id1=invalid";
565 std::cout << std::endl;
573 std::cout <<
"========= E4' cells ==========" << std::endl;
575 for (
int side = -1; side < 0; side += 2) {
576 for (
int module = 0;
module < 4; ++module) {
577 for (
int tower = 2; tower < 3; ++tower) {
581 std::cout <<
" id1=" << tileTBID->
to_string(id1);
582 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
584 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
586 if (
id2.is_valid()) {
590 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
592 std::cout <<
" hw2=invalid";
595 std::cout <<
" id2=invalid";
598 std::cout <<
" hw1=invalid";
601 std::cout <<
" id1=invalid";
603 std::cout << std::endl;
609 std::cout <<
"===============================" << std::endl;
614 return StatusCode::SUCCESS;