ATLAS Offline Software
Public Types | Public Member Functions | Private Attributes | List of all members
CscRawDataCollectionIdHash Class Reference

Hash function for CSC Raw Data Collection. More...

#include <CscRawDataCollectionIdHash.h>

Collaboration diagram for CscRawDataCollectionIdHash:

Public Types

enum  { INVALID_ID = 0xFFFF }
 
typedef uint16_t ID
 

Public Member Functions

 CscRawDataCollectionIdHash ()
 
 ~CscRawDataCollectionIdHash ()
 
int operator() (const ID &id) const
 Convert ID to int. More...
 
int max () const
 return maximum number of IDs More...
 
ID identifier (int i) const
 reverse conversion More...
 
uint16_t subDetectorId (int i) const
 reverse conversion for SubDetectorID and ROD ID More...
 
uint16_t rodId (unsigned int i) const
 reverse conversion : ROD ID More...
 

Private Attributes

int m_size {0}
 total number of IDs More...
 
std::map< ID, int > m_lookup
 lookup table More...
 
std::vector< IDm_int2id
 reverse lookup More...
 
std::vector< uint16_t > m_int2subDetectorId
 reverse lookup for SubDetectorID and ROD ID More...
 
std::vector< uint16_t > m_int2rodId
 

Detailed Description

Hash function for CSC Raw Data Collection.

Author
Ketevi A. Assamagan

Definition at line 16 of file CscRawDataCollectionIdHash.h.

Member Typedef Documentation

◆ ID

Definition at line 20 of file CscRawDataCollectionIdHash.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
INVALID_ID 

Definition at line 39 of file CscRawDataCollectionIdHash.h.

39 {INVALID_ID = 0xFFFF};

Constructor & Destructor Documentation

◆ CscRawDataCollectionIdHash()

CscRawDataCollectionIdHash::CscRawDataCollectionIdHash ( )

Definition at line 12 of file CscRawDataCollectionIdHash.cxx.

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 }

◆ ~CscRawDataCollectionIdHash()

CscRawDataCollectionIdHash::~CscRawDataCollectionIdHash ( )
inline

Definition at line 23 of file CscRawDataCollectionIdHash.h.

23 {}

Member Function Documentation

◆ identifier()

CscRawDataCollectionIdHash::ID CscRawDataCollectionIdHash::identifier ( int  i) const

reverse conversion

Definition at line 41 of file CscRawDataCollectionIdHash.cxx.

42 {
43  if (index>=0 && index < m_size)
44  return m_int2id[index];
45 
46  // if invalid index
47  return INVALID_ID;
48 }

◆ max()

int CscRawDataCollectionIdHash::max ( ) const
inline

return maximum number of IDs

Definition at line 29 of file CscRawDataCollectionIdHash.h.

29 {return m_size;}

◆ operator()()

int CscRawDataCollectionIdHash::operator() ( const ID id) const

Convert ID to int.

return INVALID_ID if invalid ID

return -1 if invalid ID

Definition at line 76 of file CscRawDataCollectionIdHash.cxx.

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 }

◆ rodId()

uint16_t CscRawDataCollectionIdHash::rodId ( unsigned int  i) const

reverse conversion : ROD ID

Definition at line 63 of file CscRawDataCollectionIdHash.cxx.

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 }

◆ subDetectorId()

uint16_t CscRawDataCollectionIdHash::subDetectorId ( int  i) const

reverse conversion for SubDetectorID and ROD ID

reverse conversion : SubDetectorID

Definition at line 52 of file CscRawDataCollectionIdHash.cxx.

53 {
54  if (index>=0 && index < m_size)
55  return m_int2subDetectorId[index];
56 
57  // if invalid index
58  return INVALID_ID;
59 }

Member Data Documentation

◆ m_int2id

std::vector<ID> CscRawDataCollectionIdHash::m_int2id
private

reverse lookup

Definition at line 51 of file CscRawDataCollectionIdHash.h.

◆ m_int2rodId

std::vector<uint16_t> CscRawDataCollectionIdHash::m_int2rodId
private

Definition at line 56 of file CscRawDataCollectionIdHash.h.

◆ m_int2subDetectorId

std::vector<uint16_t> CscRawDataCollectionIdHash::m_int2subDetectorId
private

reverse lookup for SubDetectorID and ROD ID

Definition at line 55 of file CscRawDataCollectionIdHash.h.

◆ m_lookup

std::map<ID,int> CscRawDataCollectionIdHash::m_lookup
private

lookup table

Definition at line 47 of file CscRawDataCollectionIdHash.h.

◆ m_size

int CscRawDataCollectionIdHash::m_size {0}
private

total number of IDs

Definition at line 43 of file CscRawDataCollectionIdHash.h.


The documentation for this class was generated from the following files:
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
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
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
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::m_lookup
std::map< ID, int > m_lookup
lookup table
Definition: CscRawDataCollectionIdHash.h:47