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

#include <SCT_CablingData.h>

Collaboration diagram for SCT_CablingData:

Public Types

enum  { NUMBER_OF_HASHES =8176 }
 

Public Member Functions

 SCT_CablingData ()
 constructor More...
 
 ~SCT_CablingData ()=default
 destructor More...
 
 SCT_CablingData (const SCT_CablingData &)=default
 Default copy constructor. More...
 
SCT_CablingDataoperator= (const SCT_CablingData &)=default
 Default assignment operator. More...
 
 SCT_CablingData (SCT_CablingData &&)=default
 Default move constructor. More...
 
SCT_CablingDataoperator= (SCT_CablingData &&)=default
 Default move assignment operator. More...
 
void invalidate ()
 Invalidate all data members. More...
 
void invalidateHashesForOnlineIds ()
 Invalidate m_onlineId2HashArray. More...
 
bool setHashForOnlineId (const IdentifierHash &hash, const SCT_OnlineId &onlineId)
 Set m_onlineId2HashArray. More...
 
IdentifierHash getHashFromOnlineId (const SCT_OnlineId &onlineId) const
 Get IdentifierHash from SCT_OnlineId. More...
 
void invalidateOnlineIdsForHashes ()
 Invalidate m_hash2OnlineIdArray. More...
 
bool setOnlineIdForHash (const SCT_OnlineId &onlineId, const IdentifierHash &hash)
 Set m_hash2OnlineIdArray. More...
 
SCT_OnlineId getOnlineIdFromHash (const IdentifierHash &hash) const
 Get SCT_OnlineId from IdentifierHash. More...
 
void invalidateHashesForSerialNumbers ()
 Invalidate m_sn2HashMap. More...
 
bool setHashForSerialNumber (const IdentifierHash &hash, const SCT_SerialNumber &sn)
 Set m_sn2HashMap. More...
 
IdentifierHash getHashFromSerialNumber (const SCT_SerialNumber &sn) const
 Get IdentifierHash from SCT_SerialNumber. More...
 
void invalidateSerialNumbersForHashes ()
 Invalidate m_hash2SnArray. More...
 
bool setSerialNumberForHash (const SCT_SerialNumber &sn, const IdentifierHash &hash)
 Set m_hash2SnArray. More...
 
SCT_SerialNumber getSerialNumberFromHash (const IdentifierHash &hash) const
 Get SCT_SerialNumber from IdentifierHash. More...
 
void invalidateRods ()
 Invalidate m_rodIdSet. More...
 
void setRod (const std::uint32_t &rod)
 Set m_rodIdSet. More...
 
void getRods (std::vector< std::uint32_t > &usersVector) const
 Get a vector of all RODs. More...
 
unsigned int getHashEntries () const
 Return the size of m_sn2HashMap. More...
 

Private Attributes

std::array< IdentifierHash, SCT_OnlineId::NUMBER_OF_INDICESm_onlineId2HashArray
 Array for onlineId to hash. More...
 
std::array< SCT_OnlineId, NUMBER_OF_HASHESm_hash2OnlineIdArray
 Array for hash to onlineId; hash goes from 0-8175. More...
 
std::map< SCT_SerialNumber, IdentifierHashm_sn2HashMap
 Data map for serial number to hash. More...
 
std::array< SCT_SerialNumber, NUMBER_OF_HASHESm_hash2SnArray
 Array for hash to serial number. More...
 
std::set< std::uint32_t > m_rodIdSet
 Set of robIds. More...
 

Static Private Attributes

static const IdentifierHash s_invalidHash {}
 Invalid IdentifierHash. More...
 
static const SCT_OnlineId s_invalidId {}
 Invalid SCT_OnlineId. More...
 
static const SCT_SerialNumber s_invalidSn {}
 Invalid SCT_SerialNumber. More...
 

Detailed Description

A class to hold the data necessary for SCT_CablingTool. This class is filled by SCT_CablingCondAlgFromCoraCool or SCT_CablingCondAlgFromText for SCT_CablingTool.

Definition at line 35 of file SCT_CablingData.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
NUMBER_OF_HASHES 

Definition at line 92 of file SCT_CablingData.h.

92 {NUMBER_OF_HASHES=8176}; // In SCT, we have 8176 wafers.

Constructor & Destructor Documentation

◆ SCT_CablingData() [1/3]

SCT_CablingData::SCT_CablingData ( )

constructor

Definition at line 22 of file SCT_CablingData.cxx.

22  {
23  invalidate();
24 }

◆ ~SCT_CablingData()

SCT_CablingData::~SCT_CablingData ( )
default

destructor

◆ SCT_CablingData() [2/3]

SCT_CablingData::SCT_CablingData ( const SCT_CablingData )
default

Default copy constructor.

◆ SCT_CablingData() [3/3]

SCT_CablingData::SCT_CablingData ( SCT_CablingData &&  )
default

Default move constructor.

Member Function Documentation

◆ getHashEntries()

unsigned int SCT_CablingData::getHashEntries ( ) const

Return the size of m_sn2HashMap.

Definition at line 110 of file SCT_CablingData.cxx.

110  {
111  return m_sn2HashMap.size();
112 }

◆ getHashFromOnlineId()

IdentifierHash SCT_CablingData::getHashFromOnlineId ( const SCT_OnlineId onlineId) const

Get IdentifierHash from SCT_OnlineId.

Definition at line 46 of file SCT_CablingData.cxx.

46  {
47  const unsigned int indx{onlineId.index()};
48  if (indx==SCT_OnlineId::INVALID_INDEX) {
49  return s_invalidHash;
50  }
51  return m_onlineId2HashArray[indx];
52 }

◆ getHashFromSerialNumber()

IdentifierHash SCT_CablingData::getHashFromSerialNumber ( const SCT_SerialNumber sn) const

Get IdentifierHash from SCT_SerialNumber.

Definition at line 77 of file SCT_CablingData.cxx.

77  {
78  std::map<SCT_SerialNumber, IdentifierHash>::const_iterator it{m_sn2HashMap.find(sn)};
79  if (it==m_sn2HashMap.end()) return s_invalidHash;
80  return it->second;
81 }

◆ getOnlineIdFromHash()

SCT_OnlineId SCT_CablingData::getOnlineIdFromHash ( const IdentifierHash hash) const

Get SCT_OnlineId from IdentifierHash.

Definition at line 65 of file SCT_CablingData.cxx.

65  {
66  return hash.is_valid()? m_hash2OnlineIdArray[hash] : s_invalidId;
67 }

◆ getRods()

void SCT_CablingData::getRods ( std::vector< std::uint32_t > &  usersVector) const

Get a vector of all RODs.

Definition at line 106 of file SCT_CablingData.cxx.

106  {
107  std::copy(m_rodIdSet.begin(), m_rodIdSet.end(), std::back_inserter(usersVector));
108 }

◆ getSerialNumberFromHash()

SCT_SerialNumber SCT_CablingData::getSerialNumberFromHash ( const IdentifierHash hash) const

Get SCT_SerialNumber from IdentifierHash.

Definition at line 94 of file SCT_CablingData.cxx.

94  {
95  return hash.is_valid() ? m_hash2SnArray[even(hash)] : s_invalidSn;
96 }

◆ invalidate()

void SCT_CablingData::invalidate ( )

Invalidate all data members.

Definition at line 26 of file SCT_CablingData.cxx.

◆ invalidateHashesForOnlineIds()

void SCT_CablingData::invalidateHashesForOnlineIds ( )

Invalidate m_onlineId2HashArray.

Definition at line 34 of file SCT_CablingData.cxx.

34  {
36 }

◆ invalidateHashesForSerialNumbers()

void SCT_CablingData::invalidateHashesForSerialNumbers ( )

Invalidate m_sn2HashMap.

Definition at line 69 of file SCT_CablingData.cxx.

69  {
70  m_sn2HashMap.clear();
71 }

◆ invalidateOnlineIdsForHashes()

void SCT_CablingData::invalidateOnlineIdsForHashes ( )

Invalidate m_hash2OnlineIdArray.

Definition at line 54 of file SCT_CablingData.cxx.

54  {
56 }

◆ invalidateRods()

void SCT_CablingData::invalidateRods ( )

Invalidate m_rodIdSet.

Definition at line 98 of file SCT_CablingData.cxx.

98  {
99  m_rodIdSet.clear();
100 }

◆ invalidateSerialNumbersForHashes()

void SCT_CablingData::invalidateSerialNumbersForHashes ( )

Invalidate m_hash2SnArray.

Definition at line 83 of file SCT_CablingData.cxx.

83  {
85 }

◆ operator=() [1/2]

SCT_CablingData& SCT_CablingData::operator= ( const SCT_CablingData )
default

Default assignment operator.

◆ operator=() [2/2]

SCT_CablingData& SCT_CablingData::operator= ( SCT_CablingData &&  )
default

Default move assignment operator.

◆ setHashForOnlineId()

bool SCT_CablingData::setHashForOnlineId ( const IdentifierHash hash,
const SCT_OnlineId onlineId 
)

Set m_onlineId2HashArray.

Definition at line 38 of file SCT_CablingData.cxx.

38  {
39  //compute the index for insertion to the onlineId/Hash array
40  const unsigned int indx{onlineId.index()};
41  if (m_onlineId2HashArray[indx].is_valid()) return false; //don't insert if theres already a valid hash there
42  m_onlineId2HashArray[indx] = hash;
43  return true;
44 }

◆ setHashForSerialNumber()

bool SCT_CablingData::setHashForSerialNumber ( const IdentifierHash hash,
const SCT_SerialNumber sn 
)

Set m_sn2HashMap.

Definition at line 73 of file SCT_CablingData.cxx.

73  {
74  return m_sn2HashMap.insert(std::make_pair(sn, hash)).second;
75 }

◆ setOnlineIdForHash()

bool SCT_CablingData::setOnlineIdForHash ( const SCT_OnlineId onlineId,
const IdentifierHash hash 
)

Set m_hash2OnlineIdArray.

Definition at line 58 of file SCT_CablingData.cxx.

58  {
59  if (m_hash2OnlineIdArray[hash].is_valid()) return false; //don't insert if there's already a valid online id there
60  //insert to hash/onlineId array
61  m_hash2OnlineIdArray[hash] = onlineId;
62  return true;
63 }

◆ setRod()

void SCT_CablingData::setRod ( const std::uint32_t &  rod)

Set m_rodIdSet.

Definition at line 102 of file SCT_CablingData.cxx.

102  {
103  m_rodIdSet.insert(rod);
104 }

◆ setSerialNumberForHash()

bool SCT_CablingData::setSerialNumberForHash ( const SCT_SerialNumber sn,
const IdentifierHash hash 
)

Set m_hash2SnArray.

Definition at line 87 of file SCT_CablingData.cxx.

87  {
88  const IdentifierHash evenHash{even(hash)};
89  if (m_hash2SnArray[evenHash]!=s_invalidSn) return false; //don't insert if there's already a valid online id there
90  m_hash2SnArray[evenHash] = sn;
91  return true;
92 }

Member Data Documentation

◆ m_hash2OnlineIdArray

std::array<SCT_OnlineId, NUMBER_OF_HASHES> SCT_CablingData::m_hash2OnlineIdArray
private

Array for hash to onlineId; hash goes from 0-8175.

Definition at line 96 of file SCT_CablingData.h.

◆ m_hash2SnArray

std::array<SCT_SerialNumber, NUMBER_OF_HASHES> SCT_CablingData::m_hash2SnArray
private

Array for hash to serial number.

Definition at line 98 of file SCT_CablingData.h.

◆ m_onlineId2HashArray

std::array<IdentifierHash, SCT_OnlineId::NUMBER_OF_INDICES> SCT_CablingData::m_onlineId2HashArray
private

Array for onlineId to hash.

Definition at line 95 of file SCT_CablingData.h.

◆ m_rodIdSet

std::set<std::uint32_t> SCT_CablingData::m_rodIdSet
private

Set of robIds.

Definition at line 99 of file SCT_CablingData.h.

◆ m_sn2HashMap

std::map<SCT_SerialNumber, IdentifierHash> SCT_CablingData::m_sn2HashMap
private

Data map for serial number to hash.

Definition at line 97 of file SCT_CablingData.h.

◆ s_invalidHash

const IdentifierHash SCT_CablingData::s_invalidHash {}
staticprivate

Invalid IdentifierHash.

Definition at line 101 of file SCT_CablingData.h.

◆ s_invalidId

const SCT_OnlineId SCT_CablingData::s_invalidId {}
staticprivate

Invalid SCT_OnlineId.

Definition at line 102 of file SCT_CablingData.h.

◆ s_invalidSn

const SCT_SerialNumber SCT_CablingData::s_invalidSn {}
staticprivate

Invalid SCT_SerialNumber.

Definition at line 103 of file SCT_CablingData.h.


The documentation for this class was generated from the following files:
SCT_CablingData::m_hash2SnArray
std::array< SCT_SerialNumber, NUMBER_OF_HASHES > m_hash2SnArray
Array for hash to serial number.
Definition: SCT_CablingData.h:98
SCT_CablingData::s_invalidSn
static const SCT_SerialNumber s_invalidSn
Invalid SCT_SerialNumber.
Definition: SCT_CablingData.h:103
skel.it
it
Definition: skel.GENtoEVGEN.py:396
SCT_OnlineId::INVALID_INDEX
@ INVALID_INDEX
Definition: SCT_OnlineId.h:57
SCT_CablingData::invalidateHashesForOnlineIds
void invalidateHashesForOnlineIds()
Invalidate m_onlineId2HashArray.
Definition: SCT_CablingData.cxx:34
SCT_CablingData::m_onlineId2HashArray
std::array< IdentifierHash, SCT_OnlineId::NUMBER_OF_INDICES > m_onlineId2HashArray
Array for onlineId to hash.
Definition: SCT_CablingData.h:95
SCT_CablingData::invalidateSerialNumbersForHashes
void invalidateSerialNumbersForHashes()
Invalidate m_hash2SnArray.
Definition: SCT_CablingData.cxx:83
SCT_CablingData::m_rodIdSet
std::set< std::uint32_t > m_rodIdSet
Set of robIds.
Definition: SCT_CablingData.h:99
SCT_CablingData::invalidateOnlineIdsForHashes
void invalidateOnlineIdsForHashes()
Invalidate m_hash2OnlineIdArray.
Definition: SCT_CablingData.cxx:54
SCT_CablingData::m_sn2HashMap
std::map< SCT_SerialNumber, IdentifierHash > m_sn2HashMap
Data map for serial number to hash.
Definition: SCT_CablingData.h:97
SCT_CablingData::invalidateRods
void invalidateRods()
Invalidate m_rodIdSet.
Definition: SCT_CablingData.cxx:98
RunTileMonitoring.rod
rod
Definition: RunTileMonitoring.py:134
SCT_OnlineId::index
unsigned int index() const
Return an index in the range 0-9215, calculated from parts of the onlineId.
Definition: SCT_OnlineId.cxx:112
SCT_CablingData::s_invalidId
static const SCT_OnlineId s_invalidId
Invalid SCT_OnlineId.
Definition: SCT_CablingData.h:102
SCT_CablingData::invalidate
void invalidate()
Invalidate all data members.
Definition: SCT_CablingData.cxx:26
SCT_CablingData::invalidateHashesForSerialNumbers
void invalidateHashesForSerialNumbers()
Invalidate m_sn2HashMap.
Definition: SCT_CablingData.cxx:69
SCT_CablingData::m_hash2OnlineIdArray
std::array< SCT_OnlineId, NUMBER_OF_HASHES > m_hash2OnlineIdArray
Array for hash to onlineId; hash goes from 0-8175.
Definition: SCT_CablingData.h:96
CaloCondBlobAlgs_fillNoiseFromASCII.hash
dictionary hash
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:109
SCT_CablingData::NUMBER_OF_HASHES
@ NUMBER_OF_HASHES
Definition: SCT_CablingData.h:92
SCT_CablingData::s_invalidHash
static const IdentifierHash s_invalidHash
Invalid IdentifierHash.
Definition: SCT_CablingData.h:101
calibdata.copy
bool copy
Definition: calibdata.py:27
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