ATLAS Offline Software
SCT_Chip.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
5 */
6 
13 #ifndef SCT_ConditionTools_SCT_Chip_h
14 #define SCT_ConditionTools_SCT_Chip_h
15 
16 #include <bitset>
17 #include <cstdint>
18 #include <iomanip>
19 #include <iostream>
20 #include <string>
21 #include <vector>
22 
27 class SCT_Chip {
28 
30  friend std::ostream& operator<<(std::ostream& output, const SCT_Chip& chip);
31 
32 public:
33 
35  SCT_Chip();
37  SCT_Chip(short id, short config, uint32_t mask0, uint32_t mask1, uint32_t mask2, uint32_t mask3);
39  ~SCT_Chip() = default;
40 
42  inline short id() const {return m_id;}
44  inline short inPort() const {return m_in;}
46  inline short outPort() const {return m_out;}
48  inline bool isEnd() const {return m_end;}
50  inline bool isMaster() const {return m_master;}
52  inline bool canBeMaster() const {return (m_id == 0 || m_id == 6);}
53 
55  inline bool slaveConfiguredAsMaster() const {return (!canBeMaster() && isMaster());}
56 
58  bool initializeMaskFromInts(uint32_t mask0, uint32_t mask1, uint32_t mask2, uint32_t mask3);
60  bool initializeMaskFromString(const std::string & maskString);
62  bool channelIsMasked (const unsigned int channelNumber) const;
64  unsigned int numberOfMaskedChannels() const;
66  void appendBadStripsToVector(std::vector<int> & maskedChannelVector) const;
67 
68 private:
69 
71  enum {nSubwords = 4, lenSubword = 32, nBitsMask = 128, nBitsConfig = 16};
72 
74  enum {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};
77 
78  short m_id;
79  std::bitset<nBitsConfig> m_config;
80  short m_in;
81  short m_out;
82  bool m_end;
83  bool m_master;
84  std::bitset<nBitsMask> m_mask;
85 };
86 
88 inline std::ostream& operator<<(std::ostream& output, const SCT_Chip& chip) {
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 }
96 
97 #endif // SCT_ConditionTools_SCT_Chip_h
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::id
short id() const
Chip Id.
Definition: SCT_Chip.h:42
SCT_Chip::m_end
bool m_end
Is chip an end.
Definition: SCT_Chip.h:82
operator<<
std::ostream & operator<<(std::ostream &output, const SCT_Chip &chip)
Output stream for printing chip information.
Definition: SCT_Chip.h:88
xAOD::uint32_t
setEventNumber uint32_t
Definition: EventInfo_v1.cxx:127
SCT_Chip::ACC_BIT
@ ACC_BIT
Definition: SCT_Chip.h:75
SCT_Chip
Class which stores infomration on the SCT chips: id, config, mask.
Definition: SCT_Chip.h:27
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::appendBadStripsToVector
void appendBadStripsToVector(std::vector< int > &maskedChannelVector) const
Append masked channels' numbers to a user-supplied vector.
Definition: SCT_Chip.cxx:80
SCT_Chip::CAL_BIT
@ CAL_BIT
Definition: SCT_Chip.h:74
SCT_Chip::initializeMaskFromString
bool initializeMaskFromString(const std::string &maskString)
Initialize channel mask from a string.
Definition: SCT_Chip.cxx:45
SCT_Chip::isEnd
bool isEnd() const
Is chip an end.
Definition: SCT_Chip.h:48
SCT_Chip::nSubwords
@ nSubwords
Definition: SCT_Chip.h:71
config
Definition: PhysicsAnalysis/AnalysisCommon/AssociationUtils/python/config.py:1
SCT_Chip::numberOfMaskedChannels
unsigned int numberOfMaskedChannels() const
Number of masked channels.
Definition: SCT_Chip.cxx:75
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::operator<<
friend std::ostream & operator<<(std::ostream &output, const SCT_Chip &chip)
Outputstream operator for chip.
Definition: SCT_Chip.h:88
SCT_Chip::m_mask
std::bitset< nBitsMask > m_mask
Chip strip mask.
Definition: SCT_Chip.h:84
SCT_Chip::SCT_Chip
SCT_Chip()
Default constructor.
Definition: SCT_Chip.cxx:10
SCT_Chip::nBitsMask
@ nBitsMask
Definition: SCT_Chip.h:71
SCT_Chip::outPort
short outPort() const
Active output port.
Definition: SCT_Chip.h:46
SCT_Chip::IN_BIT
@ IN_BIT
Definition: SCT_Chip.h:75
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
SCT_Chip::inPort
short inPort() const
Active input port.
Definition: SCT_Chip.h:44
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::slaveConfiguredAsMaster
bool slaveConfiguredAsMaster() const
Is this a slave chip mistakenly configured as a master.
Definition: SCT_Chip.h:55
SCT_Chip::TR_BIT
@ TR_BIT
Definition: SCT_Chip.h:74
SCT_Chip::lenSubword
@ lenSubword
Definition: SCT_Chip.h:71
SCT_Chip::~SCT_Chip
~SCT_Chip()=default
Default destructor.