ATLAS Offline Software
CscRawDataCollectionIdHash.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 #include "GaudiKernel/Bootstrap.h"
10 
11 // default contructor
13 {
14  // initialize RPC cabling service
15  SmartIF<CSCcablingSvc> cabling{Gaudi::svcLocator()->service("CSCcablingSvc")};
16  if (!cabling) {
17  REPORT_MESSAGE_WITH_CONTEXT(MSG::ERROR, "CscRawDataCollectionIdHash")
18  << "Cannot get CSC cabling Service " << endmsg;
19  }
20 
21  // loop over all RODs
22  for (uint16_t id=0; id<cabling->maxId(); ++id)
23  {
24  // map
26  m_int2id.push_back(id);
27  // ROD ID
28  m_int2rodId.push_back( id%cabling->nROD() );
29  ++m_size;
30 
31  // SubDetectorID
32  if ( id < cabling->nROD() ) // C-side
33  m_int2subDetectorId.push_back(0x6A);
34  else // A-side
35  m_int2subDetectorId.push_back(0x69);
36  }
37 }
38 
39 
42 {
43  if (index>=0 && index < m_size)
44  return m_int2id[index];
45 
46  // if invalid index
47  return INVALID_ID;
48 }
49 
50 
53 {
54  if (index>=0 && index < m_size)
55  return m_int2subDetectorId[index];
56 
57  // if invalid index
58  return INVALID_ID;
59 }
60 
61 
64 {
65  //if (index>=0 && index < m_size)
66  // return m_int2rodId[index];
67 
68  if(index < m_int2rodId.size())
69  return m_int2rodId.at(index);
70  // if invalid index
71  return INVALID_ID;
72 }
73 
74 
77 {
78  std::map<ID,int>::const_iterator it = m_lookup.find(id);
79  if(it!=m_lookup.end())
80  return it->second;
81 
82  // if invalid ID
83  return INVALID_ID;
84 }
85 
CscRawDataCollectionIdHash::operator()
int operator()(const ID &id) const
Convert ID to int.
Definition: CscRawDataCollectionIdHash.cxx:76
CscRawDataCollectionIdHash::rodId
uint16_t rodId(unsigned int i) const
reverse conversion : ROD ID
Definition: CscRawDataCollectionIdHash.cxx:63
CscRawDataCollectionIdHash::m_size
int m_size
total number of IDs
Definition: CscRawDataCollectionIdHash.h:43
index
Definition: index.py:1
ReadCellNoiseFromCool.cabling
cabling
Definition: ReadCellNoiseFromCool.py:154
skel.it
it
Definition: skel.GENtoEVGEN.py:396
xAOD::uint16_t
setWord1 uint16_t
Definition: eFexEMRoI_v1.cxx:88
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
CscRawDataCollectionIdHash::identifier
ID identifier(int i) const
reverse conversion
Definition: CscRawDataCollectionIdHash.cxx:41
CscRawDataCollectionIdHash::ID
uint16_t ID
Definition: CscRawDataCollectionIdHash.h:20
CscRawDataCollection.h
REPORT_MESSAGE_WITH_CONTEXT
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:345
CscRawDataCollectionIdHash::CscRawDataCollectionIdHash
CscRawDataCollectionIdHash()
Definition: CscRawDataCollectionIdHash.cxx:12
id
SG::auxid_t id
Definition: Control/AthContainers/Root/debug.cxx:220
CscRawDataCollectionIdHash::m_int2subDetectorId
std::vector< uint16_t > m_int2subDetectorId
reverse lookup for SubDetectorID and ROD ID
Definition: CscRawDataCollectionIdHash.h:55
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CscRawDataCollectionIdHash.h
CscRawDataCollectionIdHash::m_int2id
std::vector< ID > m_int2id
reverse lookup
Definition: CscRawDataCollectionIdHash.h:51
CscRawDataCollectionIdHash::INVALID_ID
@ INVALID_ID
Definition: CscRawDataCollectionIdHash.h:39
CscRawDataCollectionIdHash::m_int2rodId
std::vector< uint16_t > m_int2rodId
Definition: CscRawDataCollectionIdHash.h:56
DeMoScan.index
string index
Definition: DeMoScan.py:364
CscRawDataCollectionIdHash::subDetectorId
uint16_t subDetectorId(int i) const
reverse conversion for SubDetectorID and ROD ID
Definition: CscRawDataCollectionIdHash.cxx:52
CscRawDataCollectionIdHash::m_lookup
std::map< ID, int > m_lookup
lookup table
Definition: CscRawDataCollectionIdHash.h:47
CSCcablingSvc.h