Install fatal handler with default options.
This is meant to be easy to call from python via ctypes.
42 {
43
45
46
48 m_cablingService = cablingService;
49 if (!m_cablingService) {
51 return StatusCode::FAILURE;
52 }
53
54
55 CHECK( m_detStore.retrieve() );
56
57
59 CHECK( m_detStore->retrieve(caloID) );
60
61 const TileID* tileID(
nullptr);
62 CHECK( m_detStore->retrieve(tileID) );
63
65 CHECK( m_detStore->retrieve(tileTBID) );
66
68 CHECK( m_detStore->retrieve(tileHWID) );
69
70
75
76
77 if (m_connectedDrawers.size() > 1) {
78
79 for (
int ros = 1;
ros < 5; ++
ros) {
82 }
83 }
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) {
93 if (ros >= 1 && ros < 5 && drawer >= 0 && drawer < 64) {
95 msg(MSG::INFO) <<
" 0x" << frag;
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 }
118 msg(MSG::INFO) <<
" " << MSG::hex;
119 }
120 }
121 }
122 }
124 }
125
126 SmartIF<IGeoModelSvc> geoModel{service("GeoModelSvc")};
127 if (!geoModel) {
129 } else {
130
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
152
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 );
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 );
166 } else {
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 " );
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 );
183 ATH_MSG_INFO(
"Cabling for RUN3 ATLAS geometry is set via jobOptions " );
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 );
195 ATH_MSG_INFO(
"Cabling for RUN3 ATLAS geometry is set via jobOptions " );
199 } else {
200 ATH_MSG_INFO(
"Using cabling type " << m_cablingType <<
" from jobOptions " );
201 }
202
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 );
218 } else {
219 ATH_MSG_WARNING(
"Old ATLAS geometry detected - most probably it's a mistake: " << atlasVersion );
220
223 else
225 }
226 }
227
228 ATH_MSG_INFO(
"Setting Cabling type to " << m_cablingType );
230 ATH_MSG_DEBUG(
"Maximum number of gains: " << m_cablingService->getMaxChannels());
231
232
233
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 {
240
242 IdContext chContext = tileHWID->channel_context();
243
244 for (
unsigned int cell = 0;
cell < nCellMax; ++
cell) {
246
247 if (caloDDE) {
249 int nchan = (tileID->is_tile_gapscin(cell_id)) ? 1 : 2;
251
252 bool disconnected = true;
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
264 && (pmtHash[0] != oldPmtHash[0] || pmtHash[1] != oldPmtHash[1])) {
265
267 << " id= " << tileID->to_string(cell_id, -2)
268 << " from (" << oldPmtHash[0] << "," << oldPmtHash[1]
269 << ") to (" << pmtHash[0] << "," << pmtHash[1] << ")" );
270
271 }
272
274 if (msgLvl(MSG::VERBOSE)) {
275 if (disconnected) {
276
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);
280 else
281 msg(MSG::VERBOSE) <<
" invalid";
282 if (nchan > 1) {
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 }
289 }
290 }
291 }
292 }
293
294 ATH_MSG_VERBOSE(
"Total: " << m_disconnectedCells.size() <<
" disconnected cells");
295 }
296
297 if (msgLvl(MSG::VERBOSE)) {
298
299
300 std::cout << "===============================" << std::endl;
301
302 for (
int ros = 1;
ros < 5; ++
ros) {
306
307 HWIdentifier hwid1 = tileHWID->channel_id(ros, drawer, 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);
316 Identifier id2 = m_cablingService->h2s_pmt_id(hwid2);
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
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);
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);
365 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
367 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
368 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
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
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);
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);
403 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
405 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
406 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
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
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);
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);
439 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
441 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
442 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
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
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);
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);
475 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
477 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
478 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
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
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);
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);
511 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
513 if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
514 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
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
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);
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);
547 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
549 if (id2 != id1) std::cout << " id1!=id2=" << tileTBID->to_string(id2);
550 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
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
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);
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);
585 Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
587 if (id2 != id1) std::cout << " id1!=id2=" << tileTBID->to_string(id2);
588 HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
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
613
614 return StatusCode::SUCCESS;
615}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
#define CHECK(...)
Evaluate an expression and check for errors.
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 subcalo_hash() const
cell subcalo hash
IdentifierHash onl1() const
cell online identifier 1
Helper class for offline TT identifiers.
This class saves the "context" of an expanded identifier (ExpandedIdentifier) for compact or hash ver...
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 fillH2SIdCache(void)
void setTileID(const TileID *tileID)
bool setCablingType(TileCablingType type)
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.
Helper class for TileCal offline identifiers.
Helper class for TileCal offline identifiers of ancillary testbeam detectors and MBTS.
int count(std::string s, const std::string ®x)
count how many occurances of a regx are in a string