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

Class which stores infomration on the SCT chips: id, config, mask. More...

#include <SCT_Chip.h>

Collaboration diagram for SCT_Chip:

Public Member Functions

 SCT_Chip ()
 Default constructor. More...
 
 SCT_Chip (short id, short config, uint32_t mask0, uint32_t mask1, uint32_t mask2, uint32_t mask3)
 Actual constructor: create chip from id, config and four 32-bit masks. More...
 
 ~SCT_Chip ()=default
 Default destructor. More...
 
short id () const
 Chip Id. More...
 
short inPort () const
 Active input port. More...
 
short outPort () const
 Active output port. More...
 
bool isEnd () const
 Is chip an end. More...
 
bool isMaster () const
 Is chip a master. More...
 
bool canBeMaster () const
 Can chip be a master (i.e position 0 or 6) More...
 
bool slaveConfiguredAsMaster () const
 Is this a slave chip mistakenly configured as a master. More...
 
bool initializeMaskFromInts (uint32_t mask0, uint32_t mask1, uint32_t mask2, uint32_t mask3)
 Initialize channel mask from four ins (as in DB) More...
 
bool initializeMaskFromString (const std::string &maskString)
 Initialize channel mask from a string. More...
 
bool channelIsMasked (const unsigned int channelNumber) const
 Gives status of channel at channelNumber. More...
 
unsigned int numberOfMaskedChannels () const
 Number of masked channels. More...
 
void appendBadStripsToVector (std::vector< int > &maskedChannelVector) const
 Append masked channels' numbers to a user-supplied vector. More...
 

Private Types

enum  { nSubwords = 4, lenSubword = 32, nBitsMask = 128, nBitsConfig = 16 }
 Enum for lengths of words. More...
 
enum  {
  RO_BIT = 0, CAL_BIT = 2, TR_BIT = 4, EDGE_BIT = 6,
  MASK_BIT = 7, ACC_BIT = 8, IN_BIT = 9, OUT_BIT = 10,
  MASTER_BIT = 11, END_BIT = 12, FEED_BIT = 13
}
 Enum describing the bits in the chip configuration. More...
 

Private Attributes

short m_id
 Chip Id. More...
 
std::bitset< nBitsConfigm_config
 Chip configuration mask. More...
 
short m_in
 Active input port. More...
 
short m_out
 Active output port. More...
 
bool m_end
 Is chip an end. More...
 
bool m_master
 Is chip a master. More...
 
std::bitset< nBitsMaskm_mask
 Chip strip mask. More...
 

Friends

std::ostream & operator<< (std::ostream &output, const SCT_Chip &chip)
 Outputstream operator for chip. More...
 

Detailed Description

Class which stores infomration on the SCT chips: id, config, mask.

Definition at line 27 of file SCT_Chip.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private

Enum for lengths of words.

Enumerator
nSubwords 
lenSubword 
nBitsMask 
nBitsConfig 

Definition at line 71 of file SCT_Chip.h.

71 {nSubwords = 4, lenSubword = 32, nBitsMask = 128, nBitsConfig = 16};

◆ anonymous enum

anonymous enum
private

Enum describing the bits in the chip configuration.

Enumerator
RO_BIT 
CAL_BIT 
TR_BIT 
EDGE_BIT 
MASK_BIT 
ACC_BIT 
IN_BIT 
OUT_BIT 
MASTER_BIT 
END_BIT 
FEED_BIT 

Definition at line 74 of file SCT_Chip.h.

74  {RO_BIT = 0, CAL_BIT = 2, TR_BIT = 4, EDGE_BIT = 6, MASK_BIT = 7,
75  ACC_BIT = 8, IN_BIT = 9, OUT_BIT = 10, MASTER_BIT = 11, END_BIT = 12,
76  FEED_BIT = 13};

Constructor & Destructor Documentation

◆ SCT_Chip() [1/2]

SCT_Chip::SCT_Chip ( )

Default constructor.

Definition at line 10 of file SCT_Chip.cxx.

10  :
11  m_id(0),
12  m_config(0),m_in(0),m_out(0),m_end(false),m_master(false) {
13  m_mask.set();
14 }

◆ SCT_Chip() [2/2]

SCT_Chip::SCT_Chip ( short  id,
short  config,
uint32_t  mask0,
uint32_t  mask1,
uint32_t  mask2,
uint32_t  mask3 
)

Actual constructor: create chip from id, config and four 32-bit masks.

Definition at line 17 of file SCT_Chip.cxx.

17  :
18  m_id(id),
19  m_config(config) {
20  m_in = m_config.test(IN_BIT) ? 1 : 0;
21  m_out = m_config.test(OUT_BIT) ? 1 : 0;
22  m_end = m_config.test(END_BIT);
23  m_master = !m_config.test(MASTER_BIT); // Master bit is 0 if master
24  initializeMaskFromInts(mask0, mask1, mask2, mask3);
25 }

◆ ~SCT_Chip()

SCT_Chip::~SCT_Chip ( )
default

Default destructor.

Member Function Documentation

◆ appendBadStripsToVector()

void SCT_Chip::appendBadStripsToVector ( std::vector< int > &  maskedChannelVector) const

Append masked channels' numbers to a user-supplied vector.

Definition at line 80 of file SCT_Chip.cxx.

80  {
81  for (unsigned int thisChann(0);thisChann != nBitsMask; ++thisChann){
82  if (channelIsMasked(thisChann)) maskedChannelVector.push_back(thisChann);
83  }
84 }

◆ canBeMaster()

bool SCT_Chip::canBeMaster ( ) const
inline

Can chip be a master (i.e position 0 or 6)

Definition at line 52 of file SCT_Chip.h.

52 {return (m_id == 0 || m_id == 6);}

◆ channelIsMasked()

bool SCT_Chip::channelIsMasked ( const unsigned int  channelNumber) const

Gives status of channel at channelNumber.

Definition at line 70 of file SCT_Chip.cxx.

70  {
71  return !(m_mask.test(channelNumber));
72 }

◆ id()

short SCT_Chip::id ( ) const
inline

Chip Id.

Definition at line 42 of file SCT_Chip.h.

42 {return m_id;}

◆ initializeMaskFromInts()

bool SCT_Chip::initializeMaskFromInts ( uint32_t  mask0,
uint32_t  mask1,
uint32_t  mask2,
uint32_t  mask3 
)

Initialize channel mask from four ins (as in DB)

Definition at line 28 of file SCT_Chip.cxx.

28  {
29  bool successfulInitialization(true);
30  uint32_t subWords[nSubwords]={mask0,mask1,mask2,mask3};
31  // Put the integers into 32 bit bitsets
32  std::bitset<lenSubword> subBinary;
33  for (unsigned int i{0}; i!=nSubwords; ++i) {
34  subBinary = subWords[i];
35  // Put the four bitsets together in one 128 bit bitset (private member data)
36  for (unsigned int j{0}; j!=lenSubword; ++j) {
37  m_mask[i*lenSubword+j]=subBinary[j];
38  }
39  }
40  return successfulInitialization;
41 }

◆ initializeMaskFromString()

bool SCT_Chip::initializeMaskFromString ( const std::string &  maskString)

Initialize channel mask from a string.

Definition at line 45 of file SCT_Chip.cxx.

45  {
46  bool successfulInitialization(true);
47  std::istringstream formatStream(maskString);
48  uint32_t subWords[nSubwords];
49 
50  // Parse into four 32-bit integers (there must be a better way!)
51  // As a very basic check, we enable exceptions on the hex conversion.
52  formatStream.exceptions(std::ios_base::badbit|std::ios_base::failbit);
53 
54  try{
55  formatStream >> std::hex >> subWords[nSubwords-1]
56  >> std::hex >> subWords[nSubwords-2]
57  >> std::hex >> subWords[nSubwords-3]
58  >> std::hex >> subWords[nSubwords-4];
59  } catch(const std::ios_base::failure&) {
60  std::cerr << "The SCT_ChipMask code has failed to convert the received string to a mask; the received string is: ";
61  std::cerr << maskString << std::endl;
62  successfulInitialization = false;
63  }
64 
65  initializeMaskFromInts(subWords[0], subWords[1], subWords[2], subWords[3]);
66  return successfulInitialization;
67 }

◆ inPort()

short SCT_Chip::inPort ( ) const
inline

Active input port.

Definition at line 44 of file SCT_Chip.h.

44 {return m_in;}

◆ isEnd()

bool SCT_Chip::isEnd ( ) const
inline

Is chip an end.

Definition at line 48 of file SCT_Chip.h.

48 {return m_end;}

◆ isMaster()

bool SCT_Chip::isMaster ( ) const
inline

Is chip a master.

Definition at line 50 of file SCT_Chip.h.

50 {return m_master;}

◆ numberOfMaskedChannels()

unsigned int SCT_Chip::numberOfMaskedChannels ( ) const

Number of masked channels.

Definition at line 75 of file SCT_Chip.cxx.

75  {
76  return nBitsMask - m_mask.count();
77 }

◆ outPort()

short SCT_Chip::outPort ( ) const
inline

Active output port.

Definition at line 46 of file SCT_Chip.h.

46 {return m_out;}

◆ slaveConfiguredAsMaster()

bool SCT_Chip::slaveConfiguredAsMaster ( ) const
inline

Is this a slave chip mistakenly configured as a master.

Definition at line 55 of file SCT_Chip.h.

55 {return (!canBeMaster() && isMaster());}

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  output,
const SCT_Chip chip 
)
friend

Outputstream operator for chip.

Definition at line 88 of file SCT_Chip.h.

88  {
89  output << "Chip " << std::setw(2) << chip.m_id << ":\t"
90  << (chip.m_master ? "MASTER" : "SLAVE") << (chip.m_end ? " END" : "")
91  << ", IN PORT = " << chip.m_in << ", OUT PORT = " << chip.m_out << "\n"
92  << "Config = " << chip.m_config << "\n"
93  << "Mask = " << chip.m_mask;
94  return output;
95 }

Member Data Documentation

◆ m_config

std::bitset<nBitsConfig> SCT_Chip::m_config
private

Chip configuration mask.

Definition at line 79 of file SCT_Chip.h.

◆ m_end

bool SCT_Chip::m_end
private

Is chip an end.

Definition at line 82 of file SCT_Chip.h.

◆ m_id

short SCT_Chip::m_id
private

Chip Id.

Definition at line 78 of file SCT_Chip.h.

◆ m_in

short SCT_Chip::m_in
private

Active input port.

Definition at line 80 of file SCT_Chip.h.

◆ m_mask

std::bitset<nBitsMask> SCT_Chip::m_mask
private

Chip strip mask.

Definition at line 84 of file SCT_Chip.h.

◆ m_master

bool SCT_Chip::m_master
private

Is chip a master.

Definition at line 83 of file SCT_Chip.h.

◆ m_out

short SCT_Chip::m_out
private

Active output port.

Definition at line 81 of file SCT_Chip.h.


The documentation for this class was generated from the following files:
SCT_Chip::MASTER_BIT
@ MASTER_BIT
Definition: SCT_Chip.h:75
SCT_Chip::OUT_BIT
@ OUT_BIT
Definition: SCT_Chip.h:75
SCT_Chip::m_out
short m_out
Active output port.
Definition: SCT_Chip.h:81
SCT_Chip::m_end
bool m_end
Is chip an end.
Definition: SCT_Chip.h:82
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SCT_Chip::ACC_BIT
@ ACC_BIT
Definition: SCT_Chip.h:75
SCT_Chip::m_id
short m_id
Chip Id.
Definition: SCT_Chip.h:78
SCT_Chip::channelIsMasked
bool channelIsMasked(const unsigned int channelNumber) const
Gives status of channel at channelNumber.
Definition: SCT_Chip.cxx:70
SCT_Chip::CAL_BIT
@ CAL_BIT
Definition: SCT_Chip.h:74
SCT_Chip::nSubwords
@ nSubwords
Definition: SCT_Chip.h:71
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
SCT_Chip::canBeMaster
bool canBeMaster() const
Can chip be a master (i.e position 0 or 6)
Definition: SCT_Chip.h:52
SCT_Chip::MASK_BIT
@ MASK_BIT
Definition: SCT_Chip.h:74
SCT_Chip::m_mask
std::bitset< nBitsMask > m_mask
Chip strip mask.
Definition: SCT_Chip.h:84
SCT_Chip::nBitsMask
@ nBitsMask
Definition: SCT_Chip.h:71
SCT_Chip::IN_BIT
@ IN_BIT
Definition: SCT_Chip.h:75
lumiFormat.i
int i
Definition: lumiFormat.py:85
SCT_Chip::isMaster
bool isMaster() const
Is chip a master.
Definition: SCT_Chip.h:50
SCT_Chip::FEED_BIT
@ FEED_BIT
Definition: SCT_Chip.h:76
SCT_Chip::END_BIT
@ END_BIT
Definition: SCT_Chip.h:75
merge.output
output
Definition: merge.py:17
SCT_Chip::nBitsConfig
@ nBitsConfig
Definition: SCT_Chip.h:71
SCT_Chip::m_config
std::bitset< nBitsConfig > m_config
Chip configuration mask.
Definition: SCT_Chip.h:79
SCT_Chip::m_in
short m_in
Active input port.
Definition: SCT_Chip.h:80
SCT_Chip::initializeMaskFromInts
bool initializeMaskFromInts(uint32_t mask0, uint32_t mask1, uint32_t mask2, uint32_t mask3)
Initialize channel mask from four ins (as in DB)
Definition: SCT_Chip.cxx:28
SCT_Chip::m_master
bool m_master
Is chip a master.
Definition: SCT_Chip.h:83
SCT_Chip::EDGE_BIT
@ EDGE_BIT
Definition: SCT_Chip.h:74
SCT_Chip::RO_BIT
@ RO_BIT
Definition: SCT_Chip.h:74
SCT_Chip::TR_BIT
@ TR_BIT
Definition: SCT_Chip.h:74
SCT_Chip::lenSubword
@ lenSubword
Definition: SCT_Chip.h:71