ATLAS Offline Software
Loading...
Searching...
No Matches
TileCablingSvc.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Gaudi includes
7
8// Athena includes
11
12// Calo includes
16#include "CaloDetDescr/CaloDetDescrElement.h"
17
18// Tile includes
23
24
25#include <cstdlib>
26
27
28//
29//_____________________________________________________________________________
30TileCablingSvc::TileCablingSvc(const std::string& name, ISvcLocator* pSvcLocator)
31 : AthService(name, pSvcLocator)
32 , m_cablingService(nullptr)
33 , m_detStore("DetectorStore", name)
34{
35 declareProperty("ConnectedDrawers", m_connectedDrawers, "List of connected drawer ranges: starts,end1,start2,end2,...");
36 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");
37 declareProperty("UseCache", m_useCache = true, "Use cache for channel_id to cell_id conversion");
38}
39
40//
41//_____________________________________________________________________________
42StatusCode TileCablingSvc::initialize ATLAS_NOT_THREAD_SAFE () {
43
44 ATH_MSG_DEBUG( "In initialize() " );
45
46 //=== creating cabling singleton
47 TileCablingService* cablingService = TileCablingService::getInstance_nc();
48 m_cablingService = cablingService;
49 if (!m_cablingService) {
50 ATH_MSG_ERROR( "Cannot get instance of TileCablingService" );
51 return StatusCode::FAILURE;
52 }
53
54 //===
55 CHECK( m_detStore.retrieve() );
56
57 //=== retrieve all helpers from detector store
58 const CaloLVL1_ID* caloID(nullptr);
59 CHECK( m_detStore->retrieve(caloID) );
60
61 const TileID* tileID(nullptr);
62 CHECK( m_detStore->retrieve(tileID) );
63
64 const TileTBID* tileTBID(nullptr);
65 CHECK( m_detStore->retrieve(tileTBID) );
66
67 const TileHWID* tileHWID(nullptr);
68 CHECK( m_detStore->retrieve(tileHWID) );
69
70 //=== Initialize TileCablingService singleton
71 cablingService->setCaloLVL1(caloID);
72 cablingService->setTileID(tileID);
73 cablingService->setTileTBID(tileTBID);
74 cablingService->setTileHWID(tileHWID);
75
76 //=== set connected drawers if non-empty list
77 if (m_connectedDrawers.size() > 1) {
78 //===disconnect all drawers first
79 for (int ros = 1; ros < 5; ++ros) {
80 for (int drawer = 0; drawer < 64; ++drawer) {
81 cablingService->setConnected(ros, drawer, false);
82 }
83 }
84 int count = 0;
85
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) {
91 int ros = frag >> 8;
92 int drawer = frag & 0xFF;
93 if (ros >= 1 && ros < 5 && drawer >= 0 && drawer < 64) {
94 cablingService->setConnected(ros, drawer, true);
95 msg(MSG::INFO) << " 0x" << frag;
96 char module[3];
97 sprintf(module, "%2.2d", drawer + 1);
98 switch (ros) {
99 case 1:
100 msg(MSG::INFO) << "/LBA" << module;
101 break;
102 case 2:
103 msg(MSG::INFO) << "/LBC" << module;
104 break;
105 case 3:
106 msg(MSG::INFO) << "/EBA" << module;
107 break;
108 case 4:
109 msg(MSG::INFO) << "/EBC" << module;
110 break;
111 default:
112 msg(MSG::INFO) << "/XXX" << module;
113 break;
114 }
115 if (++count > 3) {
116 count = 0;
117 msg(MSG::INFO) << endmsg;
118 msg(MSG::INFO) << " " << MSG::hex;
119 }
120 }
121 }
122 }
123 msg(MSG::INFO) << MSG::dec << endmsg;
124 }
125
126 SmartIF<IGeoModelSvc> geoModel{service("GeoModelSvc")};
127 if (!geoModel) {
128 ATH_MSG_ERROR( "Could not locate GeoModelSvc" );
129 } else {
130 // check the DetDescr version
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");
141
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);
145
146 // choose which geometries are true RUN2 geometries to apply run2 cabling
147 bool nothing_found = (ctb*geo*run1*ibl*run2*run3*run4*upg*comm != 0);
148 GeoModel::GeoConfig geoConfig = geoModel->geoConfig();
149 bool RUN2 = (nothing_found && geoConfig==GeoModel::GEO_RUN2) || (run2 == 0);
150 bool RUN3 = (nothing_found && geoConfig==GeoModel::GEO_RUN3) || (run3 == 0);
151 bool RUN4 = (nothing_found && geoConfig==GeoModel::GEO_RUN4) || (run4 == 0);
152 //|| (ibl == 0 || upg == 0);
153
154 if (RUN2) {
155
156 ATH_MSG_INFO( "RUN2 ATLAS geometry flag detected for geometry: " << atlasVersion );
157 if (upgradeA) {
158 ATH_MSG_INFO( "RUN2 ATLAS UpgradeA geometry flag detected for geometry: " << atlasVersion );
159 m_cablingType = TileCablingService::UpgradeA;
160 } else if (upgradeBC) {
161 ATH_MSG_INFO( "RUN2 ATLAS UpgradeBC geometry flag detected for geometry: " << atlasVersion );
162 m_cablingType = TileCablingService::UpgradeBC;
163 } else if (upgradeABC) {
164 ATH_MSG_INFO( "RUN2 ATLAS UpgradeABC geometry flag detected for geometry: " << atlasVersion );
165 m_cablingType = TileCablingService::UpgradeABC;
166 } else {
167 if (m_cablingType == TileCablingService::RUN2Cabling) {
168 ATH_MSG_INFO( "Cabling for RUN2 (2014-2017) ATLAS geometry is set via jobOptions " );
169 } else if (m_cablingType == TileCablingService::RUN2aCabling) {
170 ATH_MSG_INFO( "Cabling for RUN2a (2018) ATLAS geometry is set via jobOptions " );
171 } else if (m_cablingType < TileCablingService::RUN2Cabling) {
172 ATH_MSG_INFO( "Setting RUN2 (2014-2017) cabling" );
173 m_cablingType = TileCablingService::RUN2Cabling;
174 } else {
175 ATH_MSG_INFO( "Using cabling type " << m_cablingType << " from jobOptions " );
176 }
177 }
178
179 } else if (RUN3) {
180
181 ATH_MSG_INFO( "RUN3 ATLAS geometry flag detected for geometry: " << atlasVersion );
182 if (m_cablingType == TileCablingService::RUN3Cabling) {
183 ATH_MSG_INFO( "Cabling for RUN3 ATLAS geometry is set via jobOptions " );
184 } else if ( m_cablingType < TileCablingService::RUN2Cabling) {
185 ATH_MSG_INFO( "Setting RUN3 cabling" );
186 m_cablingType = TileCablingService::RUN3Cabling;
187 } else {
188 ATH_MSG_INFO( "Using cabling type " << m_cablingType << " from jobOptions " );
189 }
190
191 } else if (RUN4) {
192
193 ATH_MSG_INFO( "RUN4 ATLAS geometry flag detected for geometry: " << atlasVersion );
194 if (m_cablingType == TileCablingService::RUN3Cabling) {
195 ATH_MSG_INFO( "Cabling for RUN3 ATLAS geometry is set via jobOptions " );
196 } else if ( m_cablingType < TileCablingService::RUN3Cabling) {
197 ATH_MSG_INFO( "Setting RUN3 cabling" );
198 m_cablingType = TileCablingService::RUN3Cabling;
199 } else {
200 ATH_MSG_INFO( "Using cabling type " << m_cablingType << " from jobOptions " );
201 }
202
203 } else if (m_cablingType == TileCablingService::RUN3Cabling) {
204 ATH_MSG_INFO( "Cabling for RUN3 ATLAS geometry is set via jobOptions " );
205 } else if (m_cablingType == TileCablingService::RUN2Cabling) {
206 ATH_MSG_INFO( "Cabling for RUN2 (2014-2017) ATLAS geometry is set via jobOptions " );
207 } else if (m_cablingType == TileCablingService::RUN2aCabling) {
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 );
211 m_cablingType = TileCablingService::TestBeam;
212 } else if (geo == 0 || run1 == 0 || ibl == 0 || run2 == 0 || upg == 0) {
213 ATH_MSG_INFO( "RUN1 ATLAS geometry detected: " << atlasVersion );
214 m_cablingType = TileCablingService::MBTSOnly;
215 } else if (comm == 0) {
216 ATH_MSG_INFO( "RUN1 ATLAS Commissioning geometry detected: " << atlasVersion );
217 m_cablingType = TileCablingService::MBTSOnly;
218 } else {
219 ATH_MSG_WARNING( "Old ATLAS geometry detected - most probably it's a mistake: " << atlasVersion );
220 // in this case change cabling type only if it is not set via jobOptions
221 if (m_cablingType < -1 || m_cablingType >= TileCablingService::UnknownCabling)
222 m_cablingType = TileCablingService::OldSim;
223 else
224 ATH_MSG_INFO( "Using cabling type from jobOptions " );
225 }
226 }
227
228 ATH_MSG_INFO( "Setting Cabling type to " << m_cablingType );
229 ATH_CHECK( cablingService->setCablingType((TileCablingService::TileCablingType) m_cablingType) );
230 ATH_MSG_DEBUG( "Maximum number of gains: " << m_cablingService->getMaxChannels());
231
232 // ------------ Setting TileCal channel hashes in CaloDDE -------------
233 // ---------- it can be done only after we set cabling type -----------
234 const TileDetDescrManager* tileMgr;
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" );
238 } else {
239 ATH_MSG_VERBOSE( "List of disconnected cells" );
240
241 unsigned int nCellMax = tileMgr->tile_cell_size();
242 IdContext chContext = tileHWID->channel_context();
243
244 for (unsigned int cell = 0; cell < nCellMax; ++cell) {
245 CaloDetDescrElement* caloDDE = tileMgr->get_cell_element(cell);
246
247 if (caloDDE) {
248 Identifier cell_id = tileID->cell_id(caloDDE->subcalo_hash());
249 int nchan = (tileID->is_tile_gapscin(cell_id)) ? 1 : 2;
251
252 bool disconnected = true;
253 for (int pmt = 0; pmt < nchan; ++pmt) {
254 Identifier id1 = tileID->pmt_id(cell_id, pmt);
255 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
256 tileHWID->get_hash(hw1, pmtHash[pmt], &chContext);
257 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
258 disconnected &= (id2 != id1);
259 }
260 if (disconnected) m_disconnectedCells.push_back(cell_id);
261
262 IdentifierHash oldPmtHash[2] = { caloDDE->onl1(), caloDDE->onl2() };
263 if ((oldPmtHash[0] != TileHWID::NOT_VALID_HASH || oldPmtHash[1] != TileHWID::NOT_VALID_HASH)
264 && (pmtHash[0] != oldPmtHash[0] || pmtHash[1] != oldPmtHash[1])) {
265
266 ATH_MSG_WARNING( "changing channel hash for cell hash= " << cell
267 << " id= " << tileID->to_string(cell_id, -2)
268 << " from (" << oldPmtHash[0] << "," << oldPmtHash[1]
269 << ") to (" << pmtHash[0] << "," << pmtHash[1] << ")" );
270
271 }
272
273 caloDDE->set_online(pmtHash[0], pmtHash[1]);
274 if (msgLvl(MSG::VERBOSE)) {
275 if (disconnected) {
276
277 msg(MSG::VERBOSE) << "cell_id " << tileID->to_string(cell_id, -2) << " ch_id";
278 if (pmtHash[0] != TileHWID::NOT_VALID_HASH)
279 msg(MSG::VERBOSE) << " " << tileHWID->to_string(m_cablingService->s2h_channel_id(tileID->pmt_id(cell_id, 0)), -1);
280 else
281 msg(MSG::VERBOSE) << " invalid";
282 if (nchan > 1) {
283 if (pmtHash[1] != TileHWID::NOT_VALID_HASH)
284 msg(MSG::VERBOSE) << " " << tileHWID->to_string(m_cablingService->s2h_channel_id(tileID->pmt_id(cell_id, 1)), -1);
285 else
286 msg(MSG::VERBOSE) << " invalid";
287 }
288 msg(MSG::VERBOSE) << endmsg;
289 }
290 }
291 }
292 }
293
294 ATH_MSG_VERBOSE( "Total: " << m_disconnectedCells.size() << " disconnected cells");
295 }
296
297 if (msgLvl(MSG::VERBOSE)) {
298
299 // checking all HWIDs
300 std::cout << "===============================" << std::endl;
301
302 for (int ros = 1; ros < 5; ++ros) {
303 for (int drawer = 0; drawer < 64; ++drawer) {
304 int drIdx1 = TileCalibUtils::getDrawerIdx(ros, drawer);
305 for (int channel = 0; channel < 48; ++channel) {
306
307 HWIdentifier hwid1 = tileHWID->channel_id(ros, drawer, channel);
308 if (hwid1.is_valid()) {
309 std::cout << " hw1=" << tileHWID->to_string(hwid1, -1);
310 Identifier id1 = m_cablingService->h2s_pmt_id(hwid1);
311 if (id1.is_valid()) {
312 std::cout << " id1=" << tileID->to_string(id1, -1);
313 HWIdentifier hwid2 = m_cablingService->s2h_channel_id(id1);
314 if (hwid2.is_valid()) {
315 if (hwid2 != hwid1) std::cout << " hw1!=hw2=" << tileHWID->to_string(hwid2, -1);
316 Identifier id2 = m_cablingService->h2s_pmt_id(hwid2);
317 if (id2.is_valid()) {
318 if (id2 != id1)
319 std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
320 else if (tileTBID->is_tiletb(id1))
321 std::cout << ((tileTBID->eta(id1)>1) ? " E4'" : " MBTS");
322 else
323 std::cout << " cell_hash " << tileID->cell_hash(tileID->cell_id(id1));
324 int drIdx2 = tileHWID->drawerIdx(hwid1);
325 if (drIdx1 != drIdx2) {
326 std::cout << " ERROR in drawer index " << drIdx1 << " != " << drIdx2
327 << " end-begin=" << (tileHWID->drawer_end() - tileHWID->drawer_begin())
328 << std::hex << " 0x" << hwid1 << " 0x"
329 << (*(tileHWID->drawer_begin() + drIdx1)) << std::dec;
330 } else {
331 std::cout << " drawer index " << drIdx2;
332 }
333 } else {
334 std::cout << " id2=invalid";
335 }
336 } else {
337 std::cout << " hw2=invalid";
338 }
339 } else {
340 std::cout << " id1=invalid";
341 }
342 } else {
343 std::cout << " hw1=invalid";
344 }
345 std::cout << std::endl;
346 }
347 }
348 }
349
350 // checking D4 in few modules
351 std::cout << "=== D4 cells in special EB ====" << std::endl;
352
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) {
358
359 Identifier id1 = tileID->pmt_id(3, side, module, 8, 2, pmt);
360 if (id1.is_valid()) {
361 std::cout << " id1=" << tileID->to_string(id1, -1);
362 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
363 if (hw1.is_valid()) {
364 std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
365 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
366 if (id2.is_valid()) {
367 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
368 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
369 if (hw2.is_valid()) {
370 if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
371 } else {
372 std::cout << " hw2=invalid";
373 }
374 } else {
375 std::cout << " id2=invalid";
376 }
377 } else {
378 std::cout << " hw1=invalid";
379 }
380 } else {
381 std::cout << " id1=invalid";
382 }
383 std::cout << std::endl;
384 }
385 }
386 }
387
388 // checking C10 in few modules
389 std::cout << "=== C10 cells in special EB ===" << std::endl;
390
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) {
396
397 Identifier id1 = tileID->pmt_id(3, side, module, 9, 1, pmt);
398 if (id1.is_valid()) {
399 std::cout << " id1=" << tileID->to_string(id1, -1);
400 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
401 if (hw1.is_valid()) {
402 std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
403 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
404 if (id2.is_valid()) {
405 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
406 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
407 if (hw2.is_valid()) {
408 if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
409 } else {
410 std::cout << " hw2=invalid";
411 }
412 } else {
413 std::cout << " id2=invalid";
414 }
415 } else {
416 std::cout << " hw1=invalid";
417 }
418 } else {
419 std::cout << " id1=invalid";
420 }
421 std::cout << std::endl;
422 }
423 }
424 }
425
426 // checking E1
427 std::cout << "========= E1 cells =========" << std::endl;
428
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) {
432
433 Identifier id1 = tileID->pmt_id(3, side, module, tower, 3, 0);
434 if (id1.is_valid()) {
435 std::cout << " id1=" << tileID->to_string(id1, -1);
436 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
437 if (hw1.is_valid()) {
438 std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
439 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
440 if (id2.is_valid()) {
441 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
442 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
443 if (hw2.is_valid()) {
444 if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
445 } else {
446 std::cout << " hw2=invalid";
447 }
448 } else {
449 std::cout << " id2=invalid";
450 }
451 } else {
452 std::cout << " hw1=invalid";
453 }
454 } else {
455 std::cout << " id1=invalid";
456 }
457 std::cout << std::endl;
458 }
459 }
460 }
461
462 // checking E2
463 std::cout << "========= E2 cells =========" << std::endl;
464
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) {
468
469 Identifier id1 = tileID->pmt_id(3, side, module, tower, 3, 0);
470 if (id1.is_valid()) {
471 std::cout << " id1=" << tileID->to_string(id1, -1);
472 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
473 if (hw1.is_valid()) {
474 std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
475 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
476 if (id2.is_valid()) {
477 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
478 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
479 if (hw2.is_valid()) {
480 if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
481 } else {
482 std::cout << " hw2=invalid";
483 }
484 } else {
485 std::cout << " id2=invalid";
486 }
487 } else {
488 std::cout << " hw1=invalid";
489 }
490 } else {
491 std::cout << " id1=invalid";
492 }
493 std::cout << std::endl;
494 }
495 }
496 }
497
498 // checking E3,E4
499 std::cout << "========= E3,E4 cells =========" << std::endl;
500
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) {
504
505 Identifier id1 = tileID->pmt_id(3, side, module, tower, 3, 0);
506 if (id1.is_valid()) {
507 std::cout << " id1=" << tileID->to_string(id1, -1);
508 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
509 if (hw1.is_valid()) {
510 std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
511 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
512 if (id2.is_valid()) {
513 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
514 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
515 if (hw2.is_valid()) {
516 if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
517 } else {
518 std::cout << " hw2=invalid";
519 }
520 } else {
521 std::cout << " id2=invalid";
522 }
523 } else {
524 std::cout << " hw1=invalid";
525 }
526 } else {
527 std::cout << " id1=invalid";
528 }
529 std::cout << std::endl;
530 }
531 }
532 }
533
534 // checking MBTS
535 std::cout << "========= MBTS cells ==========" << std::endl;
536
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) {
540
541 Identifier id1 = tileTBID->channel_id(side, module, tower);
542 if (id1.is_valid()) {
543 std::cout << " id1=" << tileTBID->to_string(id1);
544 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
545 if (hw1.is_valid()) {
546 std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
547 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
548 if (id2.is_valid()) {
549 if (id2 != id1) std::cout << " id1!=id2=" << tileTBID->to_string(id2);
550 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
551 if (hw2.is_valid()) {
552 if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
553 } else {
554 std::cout << " hw2=invalid";
555 }
556 } else {
557 std::cout << " id2=invalid";
558 }
559 } else {
560 std::cout << " hw1=invalid";
561 }
562 } else {
563 std::cout << " id1=invalid";
564 }
565 std::cout << std::endl;
566 }
567 }
568 }
569
570 // checking E4'
571 if (m_cablingType == TileCablingService::RUN2Cabling || m_cablingType == TileCablingService::RUN2aCabling) {
572
573 std::cout << "========= E4' cells ==========" << std::endl;
574
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) {
578
579 Identifier id1 = tileTBID->channel_id(side, module, tower);
580 if (id1.is_valid()) {
581 std::cout << " id1=" << tileTBID->to_string(id1);
582 HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
583 if (hw1.is_valid()) {
584 std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
585 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
586 if (id2.is_valid()) {
587 if (id2 != id1) std::cout << " id1!=id2=" << tileTBID->to_string(id2);
588 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
589 if (hw2.is_valid()) {
590 if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
591 } else {
592 std::cout << " hw2=invalid";
593 }
594 } else {
595 std::cout << " id2=invalid";
596 }
597 } else {
598 std::cout << " hw1=invalid";
599 }
600 } else {
601 std::cout << " id1=invalid";
602 }
603 std::cout << std::endl;
604 }
605 }
606 }
607 }
608
609 std::cout << "===============================" << std::endl;
610 }
611
612 if (m_useCache) cablingService->fillH2SIdCache();
613
614 return StatusCode::SUCCESS;
615}
#define endmsg
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
HWIdentifier id2
StatusCode TileCablingSvc::initialize ATLAS_NOT_THREAD_SAFE()
Install fatal handler with default options.
This class groups all DetDescr information related to a CaloCell.
void set_online(const IdentifierHash onl1, const IdentifierHash onl2)
set cell online identifiers (Tile)
IdentifierHash onl2() const
cell online identifier 2
IdentifierHash onl1() const
cell online identifier 1
Helper class for offline TT identifiers.
Definition CaloLVL1_ID.h:66
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
Definition IdContext.h:26
This is a "hash" representation of an Identifier.
bool is_valid() const
Check if id is in a valid state.
void setConnected(int section, int side, int modMin, int modMax)
void setTileHWID(const TileHWID *tileHWID)
void setTileTBID(const TileTBID *tileTBID)
void setCaloLVL1(const CaloLVL1_ID *tt_ID)
void setTileID(const TileID *tileID)
bool setCablingType(TileCablingType type)
std::vector< std::string > m_connectedDrawers
const TileCablingService * m_cablingService
TileCablingSvc(const std::string &name, ISvcLocator *pSvcLocator)
ServiceHandle< StoreGateSvc > m_detStore
static unsigned int getDrawerIdx(unsigned int ros, unsigned int drawer)
Returns a drawer hash.
calo_element_vec_size tile_cell_size() const
CaloDetDescrElement * get_cell_element(unsigned int cell_hash) const
Helper class for TileCal online (hardware) identifiers.
Definition TileHWID.h:49
virtual IdentifierHash get_hash(const HWIdentifier &id) const
create hash id from compact ADC id without error checking
Definition TileHWID.cxx:540
std::vector< HWIdentifier >::const_iterator drawer_end() const
end iterator for drawer Identifiers
Definition TileHWID.h:294
@ NOT_VALID_HASH
Definition TileHWID.h:314
IdContext channel_context() const
idContext for channels
Definition TileHWID.cxx:478
int drawerIdx(const HWIdentifier &id) const
construct drawer index from HW identifier
Definition TileHWID.h:175
HWIdentifier channel_id(int ros, int drawer, int channel) const
channel HWIdentifer
Definition TileHWID.cxx:199
std::string to_string(const HWIdentifier &id, int level=0) const
extract all fields from HW identifier HWIdentifier get_all_fields ( const HWIdentifier & id,...
Definition TileHWID.cxx:50
std::vector< HWIdentifier >::const_iterator drawer_begin() const
begin iterator for drawer Identifiers
Definition TileHWID.h:290
Helper class for TileCal offline identifiers.
Definition TileID.h:67
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
bool is_tiletb(const Identifier &id) const
Test ID if it is TileTBID.
Definition TileTBID.cxx:87
std::string to_string(const Identifier &id, int level=0) const
extract all fields from TileTB identifier Identifier get_all_fields ( const Identifier & id,...
Definition TileTBID.cxx:49
Identifier channel_id(int type, int module, int channel) const
identifer for one channel of a Tile testbeam detector
Definition TileTBID.cxx:197
int eta(const Identifier &id) const
extract eta field from MBTS identifier
size_type cell_hash_max() const
IdentifierHash cell_hash(const Identifier &cell_id) const
fast conversion from ID to hash for cells
std::string to_string(const Identifier &id, int level=0) const
Identifier cell_id(const Identifier &any_id) const
Identifier pmt_id(const Identifier &any_id) const
bool is_tile_gapscin(const Identifier &id) const
int count(std::string s, const std::string &regx)
count how many occurances of a regx are in a string
Definition hcg.cxx:146
MsgStream & msg
Definition testRead.cxx:32