ATLAS Offline Software
TileCablingSvc.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 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  const IGeoModelSvc* geoModel = nullptr;
146  StatusCode sc = service("GeoModelSvc", geoModel);
147  if (sc.isFailure()) {
148  ATH_MSG_ERROR( "Could not locate GeoModelSvc" );
149  } else {
150  // check the DetDescr version
151  std::string atlasVersion = geoModel->atlasVersion();
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");
161 
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);
165 
166  // choose which geometries are true RUN2 geometries to apply run2 cabling
167  bool nothing_found = (ctb*geo*run1*ibl*run2*run3*run4*upg*comm != 0);
168  GeoModel::GeoConfig geoConfig = geoModel->geoConfig();
169  bool RUN2 = (nothing_found && geoConfig==GeoModel::GEO_RUN2) || (run2 == 0);
170  bool RUN3 = (nothing_found && geoConfig==GeoModel::GEO_RUN3) || (run3 == 0);
171  bool RUN4 = (nothing_found && geoConfig==GeoModel::GEO_RUN4) || (run4 == 0);
172  //|| (ibl == 0 || upg == 0);
173 
174  if (RUN2) {
175 
176  ATH_MSG_INFO( "RUN2 ATLAS geometry flag detected for geometry: " << atlasVersion );
177  if (upgradeA) {
178  ATH_MSG_INFO( "RUN2 ATLAS UpgradeA geometry flag detected for geometry: " << atlasVersion );
179  m_cablingType = TileCablingService::UpgradeA;
180  } else if (upgradeBC) {
181  ATH_MSG_INFO( "RUN2 ATLAS UpgradeBC geometry flag detected for geometry: " << atlasVersion );
182  m_cablingType = TileCablingService::UpgradeBC;
183  } else if (upgradeABC) {
184  ATH_MSG_INFO( "RUN2 ATLAS UpgradeABC geometry flag detected for geometry: " << atlasVersion );
185  m_cablingType = TileCablingService::UpgradeABC;
186  } else {
187  if (m_cablingType == TileCablingService::RUN2Cabling) {
188  ATH_MSG_INFO( "Cabling for RUN2 (2014-2017) ATLAS geometry is set via jobOptions " );
189  } else if (m_cablingType == TileCablingService::RUN2aCabling) {
190  ATH_MSG_INFO( "Cabling for RUN2a (2018) ATLAS geometry is set via jobOptions " );
191  } else if (m_cablingType < TileCablingService::RUN2Cabling) {
192  ATH_MSG_INFO( "Setting RUN2 (2014-2017) cabling" );
193  m_cablingType = TileCablingService::RUN2Cabling;
194  } else {
195  ATH_MSG_INFO( "Using cabling type " << m_cablingType << " from jobOptions " );
196  }
197  }
198 
199  } else if (RUN3) {
200 
201  ATH_MSG_INFO( "RUN3 ATLAS geometry flag detected for geometry: " << atlasVersion );
202  if (m_cablingType == TileCablingService::RUN3Cabling) {
203  ATH_MSG_INFO( "Cabling for RUN3 ATLAS geometry is set via jobOptions " );
204  } else if ( m_cablingType < TileCablingService::RUN2Cabling) {
205  ATH_MSG_INFO( "Setting RUN3 cabling" );
206  m_cablingType = TileCablingService::RUN3Cabling;
207  } else {
208  ATH_MSG_INFO( "Using cabling type " << m_cablingType << " from jobOptions " );
209  }
210 
211  } else if (RUN4) {
212 
213  ATH_MSG_INFO( "RUN4 ATLAS geometry flag detected for geometry: " << atlasVersion );
214  if (m_cablingType == TileCablingService::RUN3Cabling) {
215  ATH_MSG_INFO( "Cabling for RUN3 ATLAS geometry is set via jobOptions " );
216  } else if ( m_cablingType < TileCablingService::RUN3Cabling) {
217  ATH_MSG_INFO( "Setting RUN3 cabling" );
218  m_cablingType = TileCablingService::RUN3Cabling;
219  } else {
220  ATH_MSG_INFO( "Using cabling type " << m_cablingType << " from jobOptions " );
221  }
222 
223  } else if (m_cablingType == TileCablingService::RUN3Cabling) {
224  ATH_MSG_INFO( "Cabling for RUN3 ATLAS geometry is set via jobOptions " );
225  } else if (m_cablingType == TileCablingService::RUN2Cabling) {
226  ATH_MSG_INFO( "Cabling for RUN2 (2014-2017) ATLAS geometry is set via jobOptions " );
227  } else if (m_cablingType == TileCablingService::RUN2aCabling) {
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 );
231  m_cablingType = TileCablingService::TestBeam;
232  } else if (geo == 0 || run1 == 0 || ibl == 0 || run2 == 0 || upg == 0) {
233  ATH_MSG_INFO( "RUN1 ATLAS geometry detected: " << atlasVersion );
234  m_cablingType = TileCablingService::MBTSOnly;
235  } else if (comm == 0) {
236  ATH_MSG_INFO( "RUN1 ATLAS Commissioning geometry detected: " << atlasVersion );
237  m_cablingType = TileCablingService::MBTSOnly;
238  } else {
239  ATH_MSG_WARNING( "Old ATLAS geometry detected - most probably it's a mistake: " << atlasVersion );
240  // in this case change cabling type only if it is not set via jobOptions
241  if (m_cablingType < -1 || m_cablingType >= TileCablingService::UnknownCabling)
242  m_cablingType = TileCablingService::OldSim;
243  else
244  ATH_MSG_INFO( "Using cabling type from jobOptions " );
245  }
246  }
247 
248  ATH_MSG_INFO( "Setting Cabling type to " << m_cablingType );
249  ATH_CHECK( cablingService->setCablingType((TileCablingService::TileCablingType) m_cablingType) );
250  ATH_MSG_DEBUG( "Maximum number of gains: " << m_cablingService->getMaxChannels());
251 
252  // ------------ Setting TileCal channel hashes in CaloDDE -------------
253  // ---------- it can be done only after we set cabling type -----------
254  const TileDetDescrManager* tileMgr;
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" );
258  } else {
259  ATH_MSG_VERBOSE( "List of disconnected cells" );
260 
261  unsigned int nCellMax = tileMgr->tile_cell_size();
262  IdContext chContext = tileHWID->channel_context();
263 
264  for (unsigned int cell = 0; cell < nCellMax; ++cell) {
265  CaloDetDescrElement* caloDDE = tileMgr->get_cell_element(cell);
266 
267  if (caloDDE) {
268  Identifier cell_id = tileID->cell_id(caloDDE->subcalo_hash());
269  int nchan = (tileID->is_tile_gapscin(cell_id)) ? 1 : 2;
271 
272  bool disconnected = true;
273  for (int pmt = 0; pmt < nchan; ++pmt) {
274  Identifier id1 = tileID->pmt_id(cell_id, pmt);
275  HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
276  tileHWID->get_hash(hw1, pmtHash[pmt], &chContext);
277  Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
278  disconnected &= (id2 != id1);
279  }
280  if (disconnected) m_disconnectedCells.push_back(cell_id);
281 
282  IdentifierHash oldPmtHash[2] = { caloDDE->onl1(), caloDDE->onl2() };
283  if ((oldPmtHash[0] != TileHWID::NOT_VALID_HASH || oldPmtHash[1] != TileHWID::NOT_VALID_HASH)
284  && (pmtHash[0] != oldPmtHash[0] || pmtHash[1] != oldPmtHash[1])) {
285 
286  ATH_MSG_WARNING( "changing channel hash for cell hash= " << cell
287  << " id= " << tileID->to_string(cell_id, -2)
288  << " from (" << oldPmtHash[0] << "," << oldPmtHash[1]
289  << ") to (" << pmtHash[0] << "," << pmtHash[1] << ")" );
290 
291  }
292 
293  caloDDE->set_online(pmtHash[0], pmtHash[1]);
294  if (msgLvl(MSG::VERBOSE)) {
295  if (disconnected) {
296 
297  msg(MSG::VERBOSE) << "cell_id " << tileID->to_string(cell_id, -2) << " ch_id";
298  if (pmtHash[0] != TileHWID::NOT_VALID_HASH)
299  msg(MSG::VERBOSE) << " " << tileHWID->to_string(m_cablingService->s2h_channel_id(tileID->pmt_id(cell_id, 0)), -1);
300  else
301  msg(MSG::VERBOSE) << " invalid";
302  if (nchan > 1) {
303  if (pmtHash[1] != TileHWID::NOT_VALID_HASH)
304  msg(MSG::VERBOSE) << " " << tileHWID->to_string(m_cablingService->s2h_channel_id(tileID->pmt_id(cell_id, 1)), -1);
305  else
306  msg(MSG::VERBOSE) << " invalid";
307  }
308  msg(MSG::VERBOSE) << endmsg;
309  }
310  }
311  }
312  }
313 
314  ATH_MSG_VERBOSE( "Total: " << m_disconnectedCells.size() << " disconnected cells");
315  }
316 
317  if (msgLvl(MSG::VERBOSE)) {
318 
319  // checking all HWIDs
320  std::cout << "===============================" << std::endl;
321 
322  for (int ros = 1; ros < 5; ++ros) {
323  for (int drawer = 0; drawer < 64; ++drawer) {
324  int drIdx1 = TileCalibUtils::getDrawerIdx(ros, drawer);
325  for (int channel = 0; channel < 48; ++channel) {
326 
327  HWIdentifier hwid1 = tileHWID->channel_id(ros, drawer, channel);
328  if (hwid1.is_valid()) {
329  std::cout << " hw1=" << tileHWID->to_string(hwid1, -1);
330  Identifier id1 = m_cablingService->h2s_pmt_id(hwid1);
331  if (id1.is_valid()) {
332  std::cout << " id1=" << tileID->to_string(id1, -1);
333  HWIdentifier hwid2 = m_cablingService->s2h_channel_id(id1);
334  if (hwid2.is_valid()) {
335  if (hwid2 != hwid1) std::cout << " hw1!=hw2=" << tileHWID->to_string(hwid2, -1);
336  Identifier id2 = m_cablingService->h2s_pmt_id(hwid2);
337  if (id2.is_valid()) {
338  if (id2 != id1)
339  std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
340  else if (tileTBID->is_tiletb(id1))
341  std::cout << ((tileTBID->eta(id1)>1) ? " E4'" : " MBTS");
342  else
343  std::cout << " cell_hash " << tileID->cell_hash(tileID->cell_id(id1));
344  int drIdx2 = tileHWID->drawerIdx(hwid1);
345  if (drIdx1 != drIdx2) {
346  std::cout << " ERROR in drawer index " << drIdx1 << " != " << drIdx2
347  << " end-begin=" << (tileHWID->drawer_end() - tileHWID->drawer_begin())
348  << std::hex << " 0x" << hwid1 << " 0x"
349  << (*(tileHWID->drawer_begin() + drIdx1)) << std::dec;
350  } else {
351  std::cout << " drawer index " << drIdx2;
352  }
353  } else {
354  std::cout << " id2=invalid";
355  }
356  } else {
357  std::cout << " hw2=invalid";
358  }
359  } else {
360  std::cout << " id1=invalid";
361  }
362  } else {
363  std::cout << " hw1=invalid";
364  }
365  std::cout << std::endl;
366  }
367  }
368  }
369 
370  // checking D4 in few modules
371  std::cout << "=== D4 cells in special EB ====" << std::endl;
372 
373  int d4module[4] = { 14, 15, 18, 19 };
374  for (int side = -1; side < 2; side += 2) {
375  for (int imod = 0; imod < 4; ++imod) {
376  int module = d4module[imod] - 1;
377  for (int pmt = 0; pmt < 2; ++pmt) {
378 
379  Identifier id1 = tileID->pmt_id(3, side, module, 8, 2, pmt);
380  if (id1.is_valid()) {
381  std::cout << " id1=" << tileID->to_string(id1, -1);
382  HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
383  if (hw1.is_valid()) {
384  std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
385  Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
386  if (id2.is_valid()) {
387  if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
388  HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
389  if (hw2.is_valid()) {
390  if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
391  } else {
392  std::cout << " hw2=invalid";
393  }
394  } else {
395  std::cout << " id2=invalid";
396  }
397  } else {
398  std::cout << " hw1=invalid";
399  }
400  } else {
401  std::cout << " id1=invalid";
402  }
403  std::cout << std::endl;
404  }
405  }
406  }
407 
408  // checking C10 in few modules
409  std::cout << "=== C10 cells in special EB ===" << std::endl;
410 
411  int c10module[8] = { 39, 40, 41, 42, 55, 56, 57, 58 };
412  for (int side = -1; side < 2; side += 2) {
413  for (int imod = 0; imod < 8; ++imod) {
414  int module = c10module[imod] - 1;
415  for (int pmt = 0; pmt < 2; ++pmt) {
416 
417  Identifier id1 = tileID->pmt_id(3, side, module, 9, 1, pmt);
418  if (id1.is_valid()) {
419  std::cout << " id1=" << tileID->to_string(id1, -1);
420  HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
421  if (hw1.is_valid()) {
422  std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
423  Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
424  if (id2.is_valid()) {
425  if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
426  HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
427  if (hw2.is_valid()) {
428  if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
429  } else {
430  std::cout << " hw2=invalid";
431  }
432  } else {
433  std::cout << " id2=invalid";
434  }
435  } else {
436  std::cout << " hw1=invalid";
437  }
438  } else {
439  std::cout << " id1=invalid";
440  }
441  std::cout << std::endl;
442  }
443  }
444  }
445 
446  // checking E1
447  std::cout << "========= E1 cells =========" << std::endl;
448 
449  for (int side = -1; side < 2; side += 2) {
450  for (int module = 0; module < 64; ++module) {
451  for (int tower = 10; tower < 11; tower += 1) {
452 
453  Identifier id1 = tileID->pmt_id(3, side, module, tower, 3, 0);
454  if (id1.is_valid()) {
455  std::cout << " id1=" << tileID->to_string(id1, -1);
456  HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
457  if (hw1.is_valid()) {
458  std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
459  Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
460  if (id2.is_valid()) {
461  if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
462  HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
463  if (hw2.is_valid()) {
464  if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
465  } else {
466  std::cout << " hw2=invalid";
467  }
468  } else {
469  std::cout << " id2=invalid";
470  }
471  } else {
472  std::cout << " hw1=invalid";
473  }
474  } else {
475  std::cout << " id1=invalid";
476  }
477  std::cout << std::endl;
478  }
479  }
480  }
481 
482  // checking E2
483  std::cout << "========= E2 cells =========" << std::endl;
484 
485  for (int side = -1; side < 2; side += 2) {
486  for (int module = 0; module < 64; ++module) {
487  for (int tower = 11; tower < 12; tower += 1) {
488 
489  Identifier id1 = tileID->pmt_id(3, side, module, tower, 3, 0);
490  if (id1.is_valid()) {
491  std::cout << " id1=" << tileID->to_string(id1, -1);
492  HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
493  if (hw1.is_valid()) {
494  std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
495  Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
496  if (id2.is_valid()) {
497  if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
498  HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
499  if (hw2.is_valid()) {
500  if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
501  } else {
502  std::cout << " hw2=invalid";
503  }
504  } else {
505  std::cout << " id2=invalid";
506  }
507  } else {
508  std::cout << " hw1=invalid";
509  }
510  } else {
511  std::cout << " id1=invalid";
512  }
513  std::cout << std::endl;
514  }
515  }
516  }
517 
518  // checking E3,E4
519  std::cout << "========= E3,E4 cells =========" << std::endl;
520 
521  for (int side = -1; side < 2; side += 2) {
522  for (int module = 0; module < 64; ++module) {
523  for (int tower = 13; tower < 16; tower += 2) {
524 
525  Identifier id1 = tileID->pmt_id(3, side, module, tower, 3, 0);
526  if (id1.is_valid()) {
527  std::cout << " id1=" << tileID->to_string(id1, -1);
528  HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
529  if (hw1.is_valid()) {
530  std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
531  Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
532  if (id2.is_valid()) {
533  if (id2 != id1) std::cout << " id1!=id2=" << tileID->to_string(id2, -1);
534  HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
535  if (hw2.is_valid()) {
536  if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
537  } else {
538  std::cout << " hw2=invalid";
539  }
540  } else {
541  std::cout << " id2=invalid";
542  }
543  } else {
544  std::cout << " hw1=invalid";
545  }
546  } else {
547  std::cout << " id1=invalid";
548  }
549  std::cout << std::endl;
550  }
551  }
552  }
553 
554  // checking MBTS
555  std::cout << "========= MBTS cells ==========" << std::endl;
556 
557  for (int side = -1; side < 2; side += 2) {
558  for (int module = 0; module < 8; ++module) {
559  for (int tower = 0; tower < 2; ++tower) {
560 
561  Identifier id1 = tileTBID->channel_id(side, module, tower);
562  if (id1.is_valid()) {
563  std::cout << " id1=" << tileTBID->to_string(id1);
564  HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
565  if (hw1.is_valid()) {
566  std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
567  Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
568  if (id2.is_valid()) {
569  if (id2 != id1) std::cout << " id1!=id2=" << tileTBID->to_string(id2);
570  HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
571  if (hw2.is_valid()) {
572  if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
573  } else {
574  std::cout << " hw2=invalid";
575  }
576  } else {
577  std::cout << " id2=invalid";
578  }
579  } else {
580  std::cout << " hw1=invalid";
581  }
582  } else {
583  std::cout << " id1=invalid";
584  }
585  std::cout << std::endl;
586  }
587  }
588  }
589 
590  // checking E4'
591  if (m_cablingType == TileCablingService::RUN2Cabling || m_cablingType == TileCablingService::RUN2aCabling) {
592 
593  std::cout << "========= E4' cells ==========" << std::endl;
594 
595  for (int side = -1; side < 0; side += 2) {
596  for (int module = 0; module < 4; ++module) {
597  for (int tower = 2; tower < 3; ++tower) {
598 
599  Identifier id1 = tileTBID->channel_id(side, module, tower);
600  if (id1.is_valid()) {
601  std::cout << " id1=" << tileTBID->to_string(id1);
602  HWIdentifier hw1 = m_cablingService->s2h_channel_id(id1);
603  if (hw1.is_valid()) {
604  std::cout << " hw1=" << tileHWID->to_string(hw1, -1);
605  Identifier id2 = m_cablingService->h2s_pmt_id(hw1);
606  if (id2.is_valid()) {
607  if (id2 != id1) std::cout << " id1!=id2=" << tileTBID->to_string(id2);
608  HWIdentifier hw2 = m_cablingService->s2h_channel_id(id2);
609  if (hw2.is_valid()) {
610  if (hw2 != hw1) std::cout << " hwid1!=hwid2=" << tileHWID->to_string(hw2, -1);
611  } else {
612  std::cout << " hw2=invalid";
613  }
614  } else {
615  std::cout << " id2=invalid";
616  }
617  } else {
618  std::cout << " hw1=invalid";
619  }
620  } else {
621  std::cout << " id1=invalid";
622  }
623  std::cout << std::endl;
624  }
625  }
626  }
627  }
628 
629  std::cout << "===============================" << std::endl;
630  }
631 
632  if (m_useCache) cablingService->fillH2SIdCache();
633 
634  return StatusCode::SUCCESS;
635 }
636 
637 //
638 //_____________________________________________________________________________
640  ATH_MSG_DEBUG( "finalized" );
641  return StatusCode::SUCCESS;
642 }
TileCablingSvc::finalize
virtual StatusCode finalize() override
Definition: TileCablingSvc.cxx:639
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:196
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:48
ReadCellNoiseFromCool.cell
cell
Definition: ReadCellNoiseFromCool.py:53
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
TileTBID::is_tiletb
bool is_tiletb(const Identifier &id) const
Test ID if it is TileTBID.
Definition: TileTBID.cxx:86
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
IGeoModelSvc
Definition: IGeoModelSvc.h:17
GeoModel::GeoConfig
GeoConfig
Definition: IGeoDbTagSvc.h:17
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:477
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
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
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:134
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:564
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:543
TileDetDescrManager
Definition: TileDetDescrManager.h:33
TileID
Helper class for TileCal offline identifiers.
Definition: TileID.h:68
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
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
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:195
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:198
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
IGeoModelSvc::geoConfig
virtual GeoModel::GeoConfig geoConfig() const =0
TileCablingService::setCaloLVL1
void setCaloLVL1(const CaloLVL1_ID *tt_ID)
Definition: TileCablingService.h:184
TileCablingService::UpgradeABC
@ UpgradeABC
Definition: TileCablingService.h:94
TileHWID::NOT_VALID_HASH
@ NOT_VALID_HASH
Definition: TileHWID.h:314
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
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
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:49
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
Definition: IdentifierHash.h:38
Tile_Base_ID::cell_id
Identifier cell_id(const Identifier &any_id) const
Definition: Tile_Base_ID.cxx:581
IGeoModelSvc::atlasVersion
virtual const std::string & atlasVersion() const =0
IGeoModelSvc.h
IdContext
class IdContext
Definition: IdContext.h:34
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