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