16 #include "CaloDetDescr/CaloDetDescrElement.h"
30 static const InterfaceID IID_TileCablingSvc(
"TileCablingSvc", 1, 0);
32 return IID_TileCablingSvc;
39 , m_cablingService(nullptr)
43 declareProperty(
"CablingType",
m_cablingType = -9,
"Cabling type: -1 - testbeam, 0 - old simulation, 1 - without MBTS, 2 - with MBTS instead of crack scin, 3 - MBTS in spare channels, 4 - RUN2 cabling, 5 - RUN2a cabling");
53 return AthService::queryInterface(riid, ppvInterface);
56 return StatusCode::SUCCESS;
67 m_cablingService = cablingService;
68 if (!m_cablingService) {
70 return StatusCode::FAILURE;
80 const TileID* tileID(
nullptr);
96 if (m_connectedDrawers.size() > 1) {
105 msg(MSG::INFO) <<
"Connected drawer list:" << MSG::hex;
106 for (
unsigned int dr = 1;
dr < m_connectedDrawers.size();
dr += 2) {
107 int frag1 = std::strtol(m_connectedDrawers[
dr - 1].
data(),
nullptr, 0);
108 int frag2 = std::strtol(m_connectedDrawers[
dr].
data(),
nullptr, 0);
109 for (
int frag = frag1; frag <= frag2; ++frag) {
112 if (
ros >= 1 && ros < 5 && drawer >= 0 &&
drawer < 64) {
114 msg(MSG::INFO) <<
" 0x" << frag;
137 msg(MSG::INFO) <<
" " << MSG::hex;
147 if (
sc.isFailure()) {
152 int ctb = atlasVersion.compare(0, 9,
"ATLAS-CTB");
153 int geo = atlasVersion.compare(0,9,
"ATLAS-GEO");
154 int run1 = atlasVersion.compare(0,8,
"ATLAS-R1");
155 int ibl = atlasVersion.compare(0,9,
"ATLAS-IBL");
156 int run2 = atlasVersion.compare(0,8,
"ATLAS-R2");
157 int run3 = atlasVersion.compare(0,8,
"ATLAS-R3");
158 int run4 = atlasVersion.compare(0,13,
"ATLAS-P2-RUN4");
159 int upg = atlasVersion.compare(0,7,
"ATLAS-P") ;
160 int comm = atlasVersion.compare(0,10,
"ATLAS-Comm");
162 bool upgradeA = (tileID->
cell_hash_max() == MAX_TILE_CELLS_UPGRADEA);
163 bool upgradeBC = (tileID->
cell_hash_max() == MAX_TILE_CELLS_UPGRADEBC);
164 bool upgradeABC = (tileID->
cell_hash_max() == MAX_TILE_CELLS_UPGRADEABC);
176 ATH_MSG_INFO(
"RUN2 ATLAS geometry flag detected for geometry: " << atlasVersion );
178 ATH_MSG_INFO(
"RUN2 ATLAS UpgradeA geometry flag detected for geometry: " << atlasVersion );
180 }
else if (upgradeBC) {
181 ATH_MSG_INFO(
"RUN2 ATLAS UpgradeBC geometry flag detected for geometry: " << atlasVersion );
183 }
else if (upgradeABC) {
184 ATH_MSG_INFO(
"RUN2 ATLAS UpgradeABC geometry flag detected for geometry: " << atlasVersion );
188 ATH_MSG_INFO(
"Cabling for RUN2 (2014-2017) ATLAS geometry is set via jobOptions " );
190 ATH_MSG_INFO(
"Cabling for RUN2a (2018) ATLAS geometry is set via jobOptions " );
195 ATH_MSG_INFO(
"Using cabling type " << m_cablingType <<
" from jobOptions " );
201 ATH_MSG_INFO(
"RUN3 ATLAS geometry flag detected for geometry: " << atlasVersion );
203 ATH_MSG_INFO(
"Cabling for RUN3 ATLAS geometry is set via jobOptions " );
208 ATH_MSG_INFO(
"Using cabling type " << m_cablingType <<
" from jobOptions " );
213 ATH_MSG_INFO(
"RUN4 ATLAS geometry flag detected for geometry: " << atlasVersion );
215 ATH_MSG_INFO(
"Cabling for RUN3 ATLAS geometry is set via jobOptions " );
220 ATH_MSG_INFO(
"Using cabling type " << m_cablingType <<
" from jobOptions " );
224 ATH_MSG_INFO(
"Cabling for RUN3 ATLAS geometry is set via jobOptions " );
226 ATH_MSG_INFO(
"Cabling for RUN2 (2014-2017) ATLAS geometry is set via jobOptions " );
228 ATH_MSG_INFO(
"Cabling for RUN2a (2018) ATLAS geometry is set via jobOptions " );
229 }
else if (ctb == 0) {
230 ATH_MSG_INFO(
"CTB geometry detected: " << atlasVersion );
232 }
else if (
geo == 0 ||
run1 == 0 || ibl == 0 ||
run2 == 0 || upg == 0) {
233 ATH_MSG_INFO(
"RUN1 ATLAS geometry detected: " << atlasVersion );
235 }
else if (
comm == 0) {
236 ATH_MSG_INFO(
"RUN1 ATLAS Commissioning geometry detected: " << atlasVersion );
239 ATH_MSG_WARNING(
"Old ATLAS geometry detected - most probably it's a mistake: " << atlasVersion );
248 ATH_MSG_INFO(
"Setting Cabling type to " << m_cablingType );
250 ATH_MSG_DEBUG(
"Maximum number of gains: " << m_cablingService->getMaxChannels());
255 if (
m_detStore->retrieve(tileMgr).isFailure()) {
256 ATH_MSG_WARNING(
"Unable to retrieve TileDetDescrManager from DetectorStore" );
257 ATH_MSG_WARNING(
"Will not set Tile online hash ID in CaloDetDescrElements" );
272 bool disconnected =
true;
275 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
278 disconnected &= (
id2 != id1);
280 if (disconnected) m_disconnectedCells.push_back(cell_id);
284 && (pmtHash[0] != oldPmtHash[0] || pmtHash[1] != oldPmtHash[1])) {
287 <<
" id= " << tileID->
to_string(cell_id, -2)
288 <<
" from (" << oldPmtHash[0] <<
"," << oldPmtHash[1]
289 <<
") to (" << pmtHash[0] <<
"," << pmtHash[1] <<
")" );
314 ATH_MSG_VERBOSE(
"Total: " << m_disconnectedCells.size() <<
" disconnected cells");
320 std::cout <<
"===============================" << std::endl;
329 std::cout <<
" hw1=" << tileHWID->
to_string(hwid1, -1);
330 Identifier id1 = m_cablingService->h2s_pmt_id(hwid1);
332 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
333 HWIdentifier hwid2 = m_cablingService->s2h_channel_id(id1);
335 if (hwid2 != hwid1) std::cout <<
" hw1!=hw2=" << tileHWID->
to_string(hwid2, -1);
339 std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
341 std::cout << ((tileTBID->
eta(id1)>1) ?
" E4'" :
" MBTS");
345 if (drIdx1 != drIdx2) {
346 std::cout <<
" ERROR in drawer index " << drIdx1 <<
" != " << drIdx2
348 << std::hex <<
" 0x" << hwid1 <<
" 0x"
351 std::cout <<
" drawer index " << drIdx2;
354 std::cout <<
" id2=invalid";
357 std::cout <<
" hw2=invalid";
360 std::cout <<
" id1=invalid";
363 std::cout <<
" hw1=invalid";
365 std::cout << std::endl;
371 std::cout <<
"=== D4 cells in special EB ====" << std::endl;
373 int d4module[4] = { 14, 15, 18, 19 };
375 for (
int imod = 0; imod < 4; ++imod) {
376 int module = d4module[imod] - 1;
381 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
382 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
384 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
387 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
390 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
392 std::cout <<
" hw2=invalid";
395 std::cout <<
" id2=invalid";
398 std::cout <<
" hw1=invalid";
401 std::cout <<
" id1=invalid";
403 std::cout << std::endl;
409 std::cout <<
"=== C10 cells in special EB ===" << std::endl;
411 int c10module[8] = { 39, 40, 41, 42, 55, 56, 57, 58 };
413 for (
int imod = 0; imod < 8; ++imod) {
414 int module = c10module[imod] - 1;
419 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
420 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
422 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
425 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
428 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
430 std::cout <<
" hw2=invalid";
433 std::cout <<
" id2=invalid";
436 std::cout <<
" hw1=invalid";
439 std::cout <<
" id1=invalid";
441 std::cout << std::endl;
447 std::cout <<
"========= E1 cells =========" << std::endl;
451 for (
int tower = 10; tower < 11; tower += 1) {
455 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
456 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
458 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
461 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
464 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
466 std::cout <<
" hw2=invalid";
469 std::cout <<
" id2=invalid";
472 std::cout <<
" hw1=invalid";
475 std::cout <<
" id1=invalid";
477 std::cout << std::endl;
483 std::cout <<
"========= E2 cells =========" << std::endl;
487 for (
int tower = 11; tower < 12; tower += 1) {
491 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
492 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
494 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
497 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
500 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
502 std::cout <<
" hw2=invalid";
505 std::cout <<
" id2=invalid";
508 std::cout <<
" hw1=invalid";
511 std::cout <<
" id1=invalid";
513 std::cout << std::endl;
519 std::cout <<
"========= E3,E4 cells =========" << std::endl;
523 for (
int tower = 13; tower < 16; tower += 2) {
527 std::cout <<
" id1=" << tileID->
to_string(id1, -1);
528 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
530 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
533 if (
id2 != id1) std::cout <<
" id1!=id2=" << tileID->
to_string(
id2, -1);
536 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
538 std::cout <<
" hw2=invalid";
541 std::cout <<
" id2=invalid";
544 std::cout <<
" hw1=invalid";
547 std::cout <<
" id1=invalid";
549 std::cout << std::endl;
555 std::cout <<
"========= MBTS cells ==========" << std::endl;
559 for (
int tower = 0; tower < 2; ++tower) {
563 std::cout <<
" id1=" << tileTBID->
to_string(id1);
564 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
566 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
572 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
574 std::cout <<
" hw2=invalid";
577 std::cout <<
" id2=invalid";
580 std::cout <<
" hw1=invalid";
583 std::cout <<
" id1=invalid";
585 std::cout << std::endl;
593 std::cout <<
"========= E4' cells ==========" << std::endl;
597 for (
int tower = 2; tower < 3; ++tower) {
601 std::cout <<
" id1=" << tileTBID->
to_string(id1);
602 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
604 std::cout <<
" hw1=" << tileHWID->
to_string(hw1, -1);
610 if (hw2 != hw1) std::cout <<
" hwid1!=hwid2=" << tileHWID->
to_string(hw2, -1);
612 std::cout <<
" hw2=invalid";
615 std::cout <<
" id2=invalid";
618 std::cout <<
" hw1=invalid";
621 std::cout <<
" id1=invalid";
623 std::cout << std::endl;
629 std::cout <<
"===============================" << std::endl;
634 return StatusCode::SUCCESS;
641 return StatusCode::SUCCESS;