ATLAS Offline Software
SCT_ReadoutData.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_ConditionData_SCT_ReadoutData_h
14 #define SCT_ConditionData_SCT_ReadoutData_h
15 
16 // Athena
20 
21 // C++ STL
22 #include <bitset>
23 #include <memory>
24 #include <vector>
25 
26 class Identifier;
27 
32 namespace SCT_Parameters {
34 }
35 
41  : public AthMessaging
42 {
43 public:
44 
45  SCT_ReadoutData(IMessageSvc* msgSvc=nullptr);
46  ~SCT_ReadoutData() = default;
47 
49  SCT_ReadoutData(const SCT_ReadoutData&) = delete;
52 
55  return m_chipMap[chip.id()].input(chip.inPort());
56  }
57 
60  return m_chipMap[chip.id()].output(chip.outPort());
61  }
62 
64  void setChipIn(const SCT_Chip& chip, int link) {
65  m_chipInReadout.set(chip.id());
66  if (link==0) m_chipsOnLink0.push_back(chip.id());
67  if (link==1) m_chipsOnLink1.push_back(chip.id());
68  }
69 
71  void setChipOut(const SCT_Chip& chip) {
72  m_chipInReadout.reset(chip.id());
73  }
74 
76  bool isChipReadOut(const SCT_Chip& chip) const {
77  return m_chipInReadout.test(chip.id());
78  }
79 
81  void setModuleType(const Identifier& moduleId, int bec);
82 
84  void setChipMap();
85 
87  void checkLink(int link);
88 
90  bool hasConnectedInput(const SCT_Chip& chip) const;
91 
93  bool isEndBeingTalkedTo(const SCT_Chip& chip) const;
94 
96  void maskChipsNotInReadout();
97 
99  bool followReadoutUpstream(int link, const SCT_Chip& chip, int remainingDepth = 12);
100 
102  bool isLinkStandard(int link) const;
103 
105  void printStatus(const Identifier& moduleId) const;
106 
108  void setChips(std::vector<SCT_Chip>& chips);
109 
111  void setLinkStatus(bool link0ok, bool link1ok);
112 
114  void clearChipReadout();
115 
116 private:
117 
119  std::vector<SCT_Chip>* m_chips{nullptr};
120  std::vector<SCT_PortMap> m_chipMap{};
121  bool m_linkActive[2]{false, false};
122  std::bitset<SCT_Parameters::NChips> m_chipInReadout{};
124  std::vector<int> m_chipsOnLink0{};
125  std::vector<int> m_chipsOnLink1{};
126 };
127 
128 #endif // SCT_ConditionData_SCT_ReadoutData_h
SCT_ReadoutData::checkLink
void checkLink(int link)
Check which chips are in the readout for a particular link and if the readout is sane.
Definition: SCT_ReadoutData.cxx:118
SCT_ReadoutData::isEndBeingTalkedTo
bool isEndBeingTalkedTo(const SCT_Chip &chip) const
Chip is an end but is being talked to.
Definition: SCT_ReadoutData.cxx:162
SCT_Parameters::ModuleType
ModuleType
Enums for module and chip type.
Definition: SCT_ReadoutData.h:33
SCT_ReadoutData::m_chipInReadout
std::bitset< SCT_Parameters::NChips > m_chipInReadout
Bitset indicating whether a chip is readout or not.
Definition: SCT_ReadoutData.h:122
SCT_Chip::id
short id() const
Chip Id.
Definition: SCT_Chip.h:42
SCT_PortMap.h
Header file for the SCT_PortMap class.
SCT_ReadoutData::clearChipReadout
void clearChipReadout()
Set all chips out of readout and clear both links to start.
Definition: SCT_ReadoutData.cxx:318
ParticleGun_SamplingFraction.bec
int bec
Definition: ParticleGun_SamplingFraction.py:89
SCT_ReadoutData::setChipIn
void setChipIn(const SCT_Chip &chip, int link)
Set chip in readout and which link it is on.
Definition: SCT_ReadoutData.h:64
SCT_ReadoutData::m_chipsOnLink0
std::vector< int > m_chipsOnLink0
The chips read out on link 0.
Definition: SCT_ReadoutData.h:124
SCT_Chip
Class which stores infomration on the SCT chips: id, config, mask.
Definition: SCT_Chip.h:27
SCT_ReadoutData::SCT_ReadoutData
SCT_ReadoutData(const SCT_ReadoutData &)=delete
No copy ctor.
SCT_ReadoutData::setChips
void setChips(std::vector< SCT_Chip > &chips)
Set SCT_Chip vectors.
Definition: SCT_ReadoutData.cxx:306
SCT_ReadoutData::operator=
SCT_ReadoutData & operator=(const SCT_ReadoutData &)=delete
No assignment operator.
SCT_ReadoutData::inputChip
SCT_Parameters::ChipType inputChip(const SCT_Chip &chip) const
Find the ID of the input chip for chip.
Definition: SCT_ReadoutData.h:54
SCT_ReadoutData::isLinkStandard
bool isLinkStandard(int link) const
is the readout for a particular link sane
Definition: SCT_ReadoutData.cxx:250
SCT_Parameters::ENDCAP
@ ENDCAP
Definition: SCT_ReadoutData.h:33
SCT_Parameters::MODIFIED_1
@ MODIFIED_1
Definition: SCT_ReadoutData.h:33
SCT_Parameters::BARREL
@ BARREL
Definition: SCT_ReadoutData.h:33
SCT_Chip.h
SCT_ReadoutData::m_chips
std::vector< SCT_Chip > * m_chips
Private data.
Definition: SCT_ReadoutData.h:119
SCT_ReadoutData::SCT_ReadoutData
SCT_ReadoutData(IMessageSvc *msgSvc=nullptr)
Definition: SCT_ReadoutData.cxx:38
SCT_ReadoutData::followReadoutUpstream
bool followReadoutUpstream(int link, const SCT_Chip &chip, int remainingDepth=12)
Follow the readout to the input side.
Definition: SCT_ReadoutData.cxx:192
SCT_ReadoutData::setModuleType
void setModuleType(const Identifier &moduleId, int bec)
Set the module type.
Definition: SCT_ReadoutData.cxx:43
StdJOSetup.msgSvc
msgSvc
Provide convenience handles for various services.
Definition: StdJOSetup.py:36
SCT_Chip::outPort
short outPort() const
Active output port.
Definition: SCT_Chip.h:46
SCT_ReadoutData::m_chipMap
std::vector< SCT_PortMap > m_chipMap
Vector of port mapping from the chips in an SCT module.
Definition: SCT_ReadoutData.h:120
SCT_Parameters::MODIFIED_0
@ MODIFIED_0
Definition: SCT_ReadoutData.h:33
SCT_ReadoutData::setLinkStatus
void setLinkStatus(bool link0ok, bool link1ok)
Set link status.
Definition: SCT_ReadoutData.cxx:312
AthMessaging
Class to provide easy MsgStream access and capabilities.
Definition: AthMessaging.h:55
SCT_ReadoutData::hasConnectedInput
bool hasConnectedInput(const SCT_Chip &chip) const
Chip has a correctly connected input.
Definition: SCT_ReadoutData.cxx:137
SCT_ReadoutData::m_linkActive
bool m_linkActive[2]
Links status for link 0 and 1.
Definition: SCT_ReadoutData.h:121
SCT_Chip::inPort
short inPort() const
Active input port.
Definition: SCT_Chip.h:44
SCT_Parameters::ChipType
ChipType
Definition: SCT_PortMap.h:18
SCT_ReadoutData::setChipMap
void setChipMap()
Fill the chip mapping.
Definition: SCT_ReadoutData.cxx:56
SCT_ReadoutData
Definition: SCT_ReadoutData.h:42
SCT_ReadoutData::outputChip
SCT_Parameters::ChipType outputChip(const SCT_Chip &chip) const
Find the ID of the output chip for chip.
Definition: SCT_ReadoutData.h:59
AthMessaging.h
SCT_ReadoutData::~SCT_ReadoutData
~SCT_ReadoutData()=default
SCT_ReadoutData::maskChipsNotInReadout
void maskChipsNotInReadout()
Mask the chips that are not in the readout.
Definition: SCT_ReadoutData.cxx:180
SCT_Parameters
Enums for chip type.
Definition: SCT_PortMap.h:17
SCT_ReadoutData::isChipReadOut
bool isChipReadOut(const SCT_Chip &chip) const
Test if chip is in readout or not.
Definition: SCT_ReadoutData.h:76
SCT_ReadoutData::printStatus
void printStatus(const Identifier &moduleId) const
Print readout status.
Definition: SCT_ReadoutData.cxx:272
SCT_ReadoutData::m_type
SCT_Parameters::ModuleType m_type
The type of this module (Barrel, Modified Barrel (0 or 1), Endcap)
Definition: SCT_ReadoutData.h:123
SCT_ReadoutData::setChipOut
void setChipOut(const SCT_Chip &chip)
Set chip out of readout and reset link.
Definition: SCT_ReadoutData.h:71
SCT_ReadoutData::m_chipsOnLink1
std::vector< int > m_chipsOnLink1
Definition: SCT_ReadoutData.h:125
Identifier
Definition: IdentifierFieldParser.cxx:14