ATLAS Offline Software
Loading...
Searching...
No Matches
HedgehogBoard.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
5#include <cassert>
6#include <iostream>
7#include <iomanip>
8
9
10namespace Muon {
11 std::ostream& operator<<(std::ostream& ostr, const Muon::HedgehogBoard& board) {
12 ostr<<"boardID: "<<static_cast<int>(board.boardId())<<", ";
13 ostr<<"nLayers: "<<static_cast<int>(board.numTubeLayers())<<", ";
14 ostr<<"nTubesPerLay: "<<static_cast<int>(board.numTubesPerLayer())<<", ";
15 ostr<<"mapping: "<<std::endl;
16 for (uint8_t lay = board.numTubeLayers(); lay > 0; --lay) {
17 if (!(lay % 2))
18 ostr << " ";
19 for (uint8_t tube = 1; tube <= board.numTubesPerLayer(); ++tube) {
20 ostr << std::setw(5) << static_cast<int>(board.pairPin(lay, tube));
21 }
22 ostr << std::endl;
23 }
24 return ostr;
25 }
26
29 const uint8_t nTubeLay,
30 const uint16_t boardId):
32 m_nTubeLay{nTubeLay},
33 m_id{boardId} {
34 assert(nTubeLay == 3 || nTubeLay == 4);
35 m_nTubePerLay = m_hedgePins.size() / nTubeLay;
36 }
37 bool HedgehogBoard::operator<(const HedgehogBoard& other) const {
38 return boardId() < other.boardId();
39 }
40 uint16_t HedgehogBoard::boardId() const { return m_id; }
41 uint8_t HedgehogBoard::numTubeLayers() const { return m_nTubeLay; }
44 uint8_t HedgehogBoard::pinNumber(const TubeLayer& tubeLay) const {
45 return pinNumber(tubeLay.layer, tubeLay.tube);
46 }
47 uint8_t HedgehogBoard::pinNumber(uint8_t layer, uint8_t tube) const {
48 uint8_t pin = (layer-1) * m_nTubePerLay + (tube -1) % m_nTubePerLay;
49 assert(pin < m_hedgePins.size());
50 return pin;
51 }
52 uint8_t HedgehogBoard::pairPin(const TubeLayer& tubeLay) const {
53 return m_hedgePins[pinNumber(tubeLay)];
54 }
55 uint8_t HedgehogBoard::pairPin(uint8_t layer, uint8_t tube) const {
56 return m_hedgePins[pinNumber(layer, tube)];
57 }
58
60 return twinPair(tubeLay.layer, tubeLay.tube);
61 }
62 TubeLayer HedgehogBoard::twinPair(uint8_t layer, uint8_t tube) const {
63 const uint8_t pin = pinNumber(layer, tube);
64 const uint8_t twin = m_hedgePins[pin];
66 if (pin != twin) {
67 result.layer = (twin - twin%m_nTubePerLay) / m_nTubePerLay + 1;
68 result.tube = (twin % m_nTubePerLay) + 1;
69 } else {
70 result.tube = tube;
71 result.layer = layer;
72 }
73 return result;
74 }
75 void HedgehogBoard::setHVDelayTime(const double hvTime) {
76 m_hvDelay = std::make_optional<double>(hvTime);
77 }
79 return m_hvDelay.has_value();
80 }
82 return m_hvDelay.value_or(0.);
83 }
84}
Helper struct to represent the High-voltage pins and a possible connection between them.
uint16_t boardId() const
Returns the identifier of the hedgehog board.
uint8_t pinNumber(const TubeLayer &tubeLay) const
Returns the pinNumber of the tubeLayer.
uint8_t pairPin(const TubeLayer &tubeLay) const
Returns the number of the pin that's twin to the tubeLayer If the pin is not short circuited,...
std::optional< double > m_hvDelay
std::array< uint8_t, nChPerBoard > Mapping
const Mapping & data() const
Returns the underlying map.
uint8_t numTubeLayers() const
Returns the number of tube layers 3 or 4.
bool hasHVDelayTime() const
Returns whether the HedgehogBoard has a specifc delay time.
double hvDelayTime() const
Returns the HV delay time.
HedgehogBoard()=default
Default constructor.
TubeLayer twinPair(const TubeLayer &tubeLay) const
Returns the tube & layer short circuited with the given tubeLayer.
void setHVDelayTime(const double hvTime)
Define a HV delay in the time of arrival between the primary & twin electronics signal.
bool operator<(const HedgehogBoard &other) const
Ordering of hedgehog boards, performed by Identifier.
uint8_t numTubesPerLayer() const
Returns the number of tubes per layer.
STL class.
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
HedgehogBoard::TubeLayer TubeLayer
std::ostream & operator<<(std::ostream &ostr, const Muon::HedgehogBoard &board)
Helper struct to return a tube & tube layer pair.
uint8_t tube
Tube number [1- 24/numTubeLayers()].
uint8_t layer
Layer number [1- numTubeLayers()].