ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCablings
MuonCablingData
src
TwinTubeMap.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include <
MuonCablingData/TwinTubeMap.h
>
5
6
namespace
Muon
{
7
using
TubeLayer
=
HedgehogBoard::TubeLayer
;
8
TwinTubeMap::TwinTubeMap
(
const
IMuonIdHelperSvc
* idHelperSvc):
9
AthMessaging
{
"TwinTubeMap"
},
10
m_idHelperSvc
{idHelperSvc} {
11
}
12
bool
TwinTubeMap::isTwinTubeLayer
(
const
Identifier
& channelId)
const
{
13
ATH_MSG_VERBOSE
(
"Check whether "
<<
m_idHelperSvc
->toStringDetEl(channelId)<<
" is a twin tube layer"
);
14
const
IdentifierHash
detHash{
m_idHelperSvc
->detElementHash(channelId)};
15
Storage::const_iterator itr =
m_twinTubesPerRE
.find(detHash);
16
return
itr !=
m_twinTubesPerRE
.end();
17
}
18
19
Identifier
TwinTubeMap::twinId
(
const
Identifier
& channelId)
const
{
20
ATH_MSG_VERBOSE
(
"Fetch the twin tube id for "
<<
m_idHelperSvc
->toString(channelId));
21
const
IdentifierHash
detHash{
m_idHelperSvc
->detElementHash(channelId)};
22
Storage::const_iterator twinItr =
m_twinTubesPerRE
.find(detHash);
23
if
(twinItr !=
m_twinTubesPerRE
.end()) {
24
const
HedgehogTray
& tray{twinItr->second};
25
const
MdtIdHelper
& idHelper{
m_idHelperSvc
->mdtIdHelper()};
26
TubeLayer
in{};
27
in.
tube
= idHelper.
tube
(channelId);
28
in.
layer
= idHelper.
tubeLayer
(channelId);
29
30
const
uint8_t boardNum = ( (in.
tube
-1) - (in.
tube
-1) % tray.
nTubesPerLay
) / tray.
nTubesPerLay
;
31
if
(boardNum >= tray.
cards
.size() || !tray.
cards
[boardNum]) {
32
return
channelId;
33
}
34
const
TubeLayer
out = tray.
cards
[boardNum]->twinPair(in);
35
if
(in != out) {
36
const
Identifier
twinId
= idHelper.
channelID
(channelId,idHelper.
multilayer
(channelId),
37
out.layer, out.tube + tray.
nTubesPerLay
*boardNum);
38
ATH_MSG_VERBOSE
(
"The matching twin tube is "
<<
m_idHelperSvc
->toString(
twinId
));
39
return
twinId
;
40
}
41
}
42
return
channelId;
43
}
44
StatusCode
TwinTubeMap::addHedgeHogBoard
(
const
Identifier
& detElId,
const
HedgehogBoardPtr
& board,
const
uint16_t slot) {
45
ATH_MSG_DEBUG
(
"Add new hedgehog board for "
<<
m_idHelperSvc
->toStringDetEl(detElId)<<
" "
<<(*board)
46
<<
", slot: "
<<
static_cast<
int
>
(slot));
47
const
IdentifierHash
detHash{
m_idHelperSvc
->detElementHash(detElId)};
48
HedgehogTray
& tray{
m_twinTubesPerRE
[detHash]};
50
if
(!tray.
nTubesPerLay
) {
51
const
int
nTubLayers =
m_idHelperSvc
->mdtIdHelper().tubeLayerMax(detElId);
52
tray.
nTubesPerLay
= board->numTubesPerLayer();
53
if
(nTubLayers != board->numTubeLayers()) {
54
ATH_MSG_FATAL
(
"The new hedgehog board "
<<(*board)<<
" does not match in terms of tube layers"
55
<<nTubLayers<<
" "
<<
m_idHelperSvc
->toStringDetEl(detElId));
56
return
StatusCode::FAILURE;
57
}
58
}
else
if
(tray.
nTubesPerLay
!= board->numTubesPerLayer()){
59
ATH_MSG_FATAL
(
"Cannot at new hedgeog board in "
<<
m_idHelperSvc
->toStringDetEl(detElId)
60
<<
"Number of tubes per layer does not match. "
<<
static_cast<
int
>
(tray.
nTubesPerLay
)<<
" vs. "
61
<<
static_cast<
int
>
(board->numTubesPerLayer()));
62
return
StatusCode::FAILURE;
63
}
64
66
if
(board.use_count() < 3) {
67
for
(uint8_t lay = 1 ; lay<= board->numTubeLayers(); ++lay) {
68
for
(uint8_t tube = 1; tube<=board->numTubesPerLayer(); ++tube) {
69
TubeLayer
in{};
70
in.
layer
= lay;
71
in.
tube
= tube;
72
const
TubeLayer
out = board->twinPair(in);
73
const
TubeLayer
twinTwin = board->twinPair(out);
74
if
(twinTwin != in) {
75
ATH_MSG_FATAL
(
"Back & forth mapping of "
<<std::endl<<(*board)<<std::endl
76
<<
" failed. Started with "
<<in<<
" via "
<<out<<
" & ended in "
<<twinTwin);
77
return
StatusCode::FAILURE;
78
}
79
}
80
}
81
}
82
if
(tray.
cards
.size() <= slot) {
83
tray.
cards
.resize(slot +1);
84
}
85
tray.
cards
[slot] = board;
86
return
StatusCode::SUCCESS;
87
}
88
double
TwinTubeMap::hvDelayTime
(
const
Identifier
& channelId)
const
{
89
ATH_MSG_VERBOSE
(
"Fetch the hv delay time for "
<<
m_idHelperSvc
->toString(channelId));
90
const
IdentifierHash
detHash{
m_idHelperSvc
->detElementHash(channelId)};
91
Storage::const_iterator twinItr =
m_twinTubesPerRE
.find(detHash);
92
if
(twinItr !=
m_twinTubesPerRE
.end()) {
93
const
HedgehogTray
& tray{twinItr->second};
94
const
MdtIdHelper
& idHelper{
m_idHelperSvc
->mdtIdHelper()};
95
const
uint8_t tube = idHelper.
tube
(channelId);
96
const
uint8_t boardNum = (tube - tube % tray.
nTubesPerLay
) / tray.
nTubesPerLay
;
97
if
(boardNum < tray.
cards
.size() && tray.
cards
[boardNum] && tray.
cards
[boardNum]->hasHVDelayTime()) {
98
ATH_MSG_VERBOSE
(
"Specific delay time set to "
<<tray.
cards
[boardNum]->hvDelayTime());
99
return
tray.
cards
[boardNum]->hvDelayTime();
100
}
101
}
102
return
m_defaultHVDelay
;
103
}
104
void
TwinTubeMap::setDefaultHVDelay
(
const
double
hvDelay) {
105
ATH_MSG_DEBUG
(
"Set the default HV delay to "
<<hvDelay<<
" ns."
);
106
m_defaultHVDelay
= hvDelay;
107
}
108
109
}
110
111
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition
AthMsgStreamMacros.h:28
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
TwinTubeMap.h
AthMessaging::AthMessaging
AthMessaging(IMessageSvc *msgSvc, const std::string &name)
Constructor.
Definition
AthMessaging.cxx:13
IdentifierHash
This is a "hash" representation of an Identifier.
Definition
IdentifierHash.h:25
MdtIdHelper
Definition
MdtIdHelper.h:61
MdtIdHelper::multilayer
int multilayer(const Identifier &id) const
Access to components of the ID.
Definition
MdtIdHelper.cxx:726
MdtIdHelper::tube
int tube(const Identifier &id) const
Definition
MdtIdHelper.cxx:730
MdtIdHelper::tubeLayer
int tubeLayer(const Identifier &id) const
Definition
MdtIdHelper.cxx:728
MdtIdHelper::channelID
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int tubeLayer, int tube) const
Definition
MdtIdHelper.cxx:663
Muon::IMuonIdHelperSvc
Interface for Helper service that creates muon Identifiers and can be used to print Identifiers.
Definition
IMuonIdHelperSvc.h:27
Muon::TwinTubeMap::m_idHelperSvc
const IMuonIdHelperSvc * m_idHelperSvc
Definition
TwinTubeMap.h:39
Muon::TwinTubeMap::hvDelayTime
double hvDelayTime(const Identifier &channelId) const
Returns the HV time delay for a given twin tube pair.
Definition
TwinTubeMap.cxx:88
Muon::TwinTubeMap::isTwinTubeLayer
bool isTwinTubeLayer(const Identifier &channelId) const
Returns whether the multilayer is equipped with twin-tubes or not.
Definition
TwinTubeMap.cxx:12
Muon::TwinTubeMap::twinId
Identifier twinId(const Identifier &channelId) const
Returns the Identifier of the mapped twin tube.
Definition
TwinTubeMap.cxx:19
Muon::TwinTubeMap::addHedgeHogBoard
StatusCode addHedgeHogBoard(const Identifier &detElId, const HedgehogBoardPtr &board, const uint16_t slot)
Add a new hedgehog board with twin tube mapping.
Definition
TwinTubeMap.cxx:44
Muon::TwinTubeMap::HedgehogBoardPtr
HedgehogBoard::HedgehogBoardPtr HedgehogBoardPtr
Definition
TwinTubeMap.h:18
Muon::TwinTubeMap::m_defaultHVDelay
double m_defaultHVDelay
Definition
TwinTubeMap.h:48
Muon::TwinTubeMap::m_twinTubesPerRE
Storage m_twinTubesPerRE
Definition
TwinTubeMap.h:46
Muon::TwinTubeMap::setDefaultHVDelay
void setDefaultHVDelay(const double hvDelay)
Sets the default HV delay.
Definition
TwinTubeMap.cxx:104
Muon::TwinTubeMap::TwinTubeMap
TwinTubeMap(const IMuonIdHelperSvc *idHelperSvc)
Definition
TwinTubeMap.cxx:8
Identifier
Definition
IdentifierFieldParser.cxx:14
Muon
NRpcCablingAlg reads raw condition data and writes derived condition data to the condition store.
Definition
TrackSystemController.h:46
Muon::TubeLayer
HedgehogBoard::TubeLayer TubeLayer
Definition
HedgehogBoard.cxx:27
Muon::HedgehogBoard::TubeLayer
Helper struct to return a tube & tube layer pair.
Definition
HedgehogBoard.h:57
Muon::HedgehogBoard::TubeLayer::tube
uint8_t tube
Tube number [1- 24/numTubeLayers()].
Definition
HedgehogBoard.h:59
Muon::HedgehogBoard::TubeLayer::layer
uint8_t layer
Layer number [1- numTubeLayers()].
Definition
HedgehogBoard.h:61
Muon::TwinTubeMap::HedgehogTray
Definition
TwinTubeMap.h:41
Muon::TwinTubeMap::HedgehogTray::cards
std::vector< HedgehogBoardPtr > cards
Definition
TwinTubeMap.h:43
Muon::TwinTubeMap::HedgehogTray::nTubesPerLay
uint8_t nTubesPerLay
Definition
TwinTubeMap.h:42
Generated on
for ATLAS Offline Software by
1.17.0