ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonCnv
MuonMDT_CnvTools
src
MDT_Hid2RESrcID.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
MDT_Hid2RESrcID.h
"
6
7
#include "
AthenaKernel/getMessageSvc.h
"
8
#include "
AtlasDetDescr/AtlasDetectorID.h
"
9
#include "GaudiKernel/Bootstrap.h"
10
#include "GaudiKernel/IMessageSvc.h"
11
#include "GaudiKernel/ISvcLocator.h"
12
#include "GaudiKernel/MsgStream.h"
13
#include "
StoreGate/StoreGateSvc.h
"
14
#include "eformat/SourceIdentifier.h"
15
16
using
eformat::helper::SourceIdentifier;
17
18
// implementation of RpcPad to RESrcID conversion.
19
// Ketevi A. Assamagan
20
// Jan-16-2003, BNL
21
//
22
// adapted for MdtCms by Michela Biglietti <biglietti@na.infn.it>
23
24
MDT_Hid2RESrcID::MDT_Hid2RESrcID
() :
m_mdtIdHelper
(nullptr),
m_specialROBNumber
(0),
m_readKey
(
"MuonMDT_CablingMap"
) {}
25
26
StatusCode
MDT_Hid2RESrcID::set
(
const
MdtIdHelper
* mdtId) {
27
// Initialize the cabling Service
28
m_mdtIdHelper
= mdtId;
29
ATH_CHECK
(
m_readKey
.initialize());
30
return
StatusCode::SUCCESS;
31
}
32
33
uint32_t
MDT_Hid2RESrcID::getRodID
(
const
Identifier
& offlineId)
const
{
34
// this method returns a RESrcID for the ROD, for a
35
// given MDT ID offline ID
36
37
MsgStream log(
Athena::getMessageSvc
(),
"MDT_Hid2RESrcID::getRodID"
);
38
39
log << MSG::DEBUG <<
"Getting RODId of the Station "
<< MSG::hex << offlineId << MSG::dec <<
endmsg
;
40
41
SG::ReadCondHandle<MuonMDT_CablingMap>
readHandle{
m_readKey
};
42
const
MuonMDT_CablingMap
* readCdo{*readHandle};
43
if
(!readCdo) {
44
// ATH_MSG_ERROR("Null pointer to the read conditions object");
45
log << MSG::ERROR <<
"Null pointer to the read conditions object"
<<
endmsg
;
46
return
0;
47
}
48
MuonMDT_CablingMap::CablingData
cabling_data{};
49
if
(!readCdo->
convert
(offlineId, cabling_data)) {
50
log << MSG::ERROR <<
" Invalid identifier given "
<<
endmsg
;
51
return
0;
52
}
53
bool
online = readCdo->
getOnlineId
(cabling_data, log);
54
55
if
(!online) {
56
log << MSG::DEBUG <<
"ROD Id of the Station "
<< MSG::hex <<
"0x"
<< offlineId <<
" not found"
<<
endmsg
;
57
cabling_data.mrod = 0xff;
58
}
else
{
59
log << MSG::DEBUG <<
"The ROD ID of the station "
60
<<
"is "
<< MSG::hex <<
"0x"
<< cabling_data.mrod << MSG::dec <<
endmsg
;
61
}
62
63
eformat::SubDetector detid = (eformat::SubDetector)cabling_data.subdetectorId;
64
65
// if (SubsystemId == eformat::MUON_MDT_BARREL_A_SIDE) {
66
// detid = eformat::MUON_MDT_BARREL_A_SIDE;
67
//}
68
// else if (SubsystemId == eformat::MUON_MDT_BARREL_C_SIDE) {
69
// detid = eformat::MUON_MDT_BARREL_C_SIDE;
70
//}
71
// else if (SubsystemId == eformat::MUON_MDT_ENDCAP_A_SIDE) {
72
// detid = eformat::MUON_MDT_ENDCAP_A_SIDE;
73
//}
74
// else if (SubsystemId == eformat::MUON_MDT_ENDCAP_C_SIDE) {
75
// detid = eformat::MUON_MDT_ENDCAP_C_SIDE;
76
//}
77
78
// uint8_t m = (uint8_t) MrodId;
79
SourceIdentifier sid(detid, cabling_data.mrod);
80
81
uint32_t rod_id = sid.code();
82
83
return
rod_id;
84
}
85
88
uint32_t
MDT_Hid2RESrcID::getRobID
(uint32_t rod_id) {
89
SourceIdentifier
id
= SourceIdentifier(rod_id);
90
SourceIdentifier id2 = SourceIdentifier(
id
.subdetector_id(),
id
.module_id());
91
// return id2.code();
92
93
// FIXME ! the rob ID in the first data taken is wrong !
94
// return 0x610003;
95
96
// After data will be fixed the correct version should be:
97
return
rod_id;
98
}
99
102
uint32_t
MDT_Hid2RESrcID::getRosID
(uint32_t rob_id) {
103
// Change Module Type to ROS, moduleid = 0
104
105
SourceIdentifier id(rob_id);
106
SourceIdentifier id2(
id
.subdetector_id(), 0);
107
return
id2.code();
108
}
109
112
uint32_t
MDT_Hid2RESrcID::getDetID
(uint32_t ros_id) {
113
// ROS to DET
114
115
SourceIdentifier id(ros_id);
116
SourceIdentifier id2(
id
.subdetector_id(), 0);
117
return
id2.code();
118
}
endmsg
#define endmsg
Definition
AnalysisConfig_Ntuple.cxx:61
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
AtlasDetectorID.h
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
MDT_Hid2RESrcID.h
StoreGateSvc.h
MDT_Hid2RESrcID::m_specialROBNumber
int m_specialROBNumber
Definition
MDT_Hid2RESrcID.h:61
MDT_Hid2RESrcID::getRosID
static uint32_t getRosID(uint32_t rob_id)
Make a ROS Source ID from a ROB source ID.
Definition
MDT_Hid2RESrcID.cxx:102
MDT_Hid2RESrcID::set
StatusCode set(const MdtIdHelper *mdtId)
intialize the cabling service
Definition
MDT_Hid2RESrcID.cxx:26
MDT_Hid2RESrcID::MDT_Hid2RESrcID
MDT_Hid2RESrcID()
constrcutor
Definition
MDT_Hid2RESrcID.cxx:24
MDT_Hid2RESrcID::m_mdtIdHelper
const MdtIdHelper * m_mdtIdHelper
Definition
MDT_Hid2RESrcID.h:59
MDT_Hid2RESrcID::getDetID
static uint32_t getDetID(uint32_t ros_id)
Make a SubDetector ID from ROS source ID.
Definition
MDT_Hid2RESrcID.cxx:112
MDT_Hid2RESrcID::getRodID
uint32_t getRodID(const Identifier &offlineId) const
Definition
MDT_Hid2RESrcID.cxx:33
MDT_Hid2RESrcID::getRobID
static uint32_t getRobID(uint32_t rod_id)
Make a ROB Source ID from a ROD source ID.
Definition
MDT_Hid2RESrcID.cxx:88
MDT_Hid2RESrcID::m_readKey
SG::ReadCondHandleKey< MuonMDT_CablingMap > m_readKey
Definition
MDT_Hid2RESrcID.h:63
MdtIdHelper
Definition
MdtIdHelper.h:61
MuonMDT_CablingMap
Definition
MuonMDT_CablingMap.h:28
MuonMDT_CablingMap::CablingData
MdtCablingData CablingData
Definition
MuonMDT_CablingMap.h:79
MuonMDT_CablingMap::getOnlineId
bool getOnlineId(CablingData &cabling_data, MsgStream &log) const
return the online id given the offline id
Definition
MuonMDT_CablingMap.cxx:317
MuonMDT_CablingMap::convert
bool convert(const CablingData &cabling_data, Identifier &id, bool check_valid=true) const
converts the cabling data into an identifier.
Definition
MuonMDT_CablingMap.cxx:44
SG::ReadCondHandle
Definition
ReadCondHandle.h:40
getMessageSvc.h
singleton-like access to IMessageSvc via open function and helper
Athena::getMessageSvc
IMessageSvc * getMessageSvc(bool quiet=false)
Definition
getMessageSvc.cxx:20
Identifier
Definition
IdentifierFieldParser.cxx:14
Generated on
for ATLAS Offline Software by
1.17.0