ATLAS Offline Software
Loading...
Searching...
No Matches
TGC_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 "TGC_Hid2RESrcID.h"
6
7#include "MuonRDO/TgcRdo.h"
10#include "eformat/SourceIdentifier.h"
11using eformat::helper::SourceIdentifier;
12
13// get source ID for a RDO
15 // get Source ID
16 SourceIdentifier sid(
17 static_cast<eformat::SubDetector>(rdo->subDetectorId()),
18 static_cast<uint16_t>(rdo->rodId()));
19
20 // return Source ID
21 return sid.code();
22}
23
24// get source ID for a RDO
25uint32_t Muon::TGC_Hid2RESrcID::getRodID(uint16_t subDetectorId,
26 uint16_t rodId) {
27 // get Source ID
28 SourceIdentifier sid(static_cast<eformat::SubDetector>(subDetectorId),
29 rodId);
30
31 // return Source ID
32 return sid.code();
33}
34
35// get source ID for an TgcDigitCollection
37 const TgcCablingMap* cabling) {
38 int subDetectorId;
39 int rodId;
40 cabling->getReadoutIDfromElementID(offlineId, subDetectorId, rodId);
41
42 // get Source ID
43 SourceIdentifier sid(static_cast<eformat::SubDetector>(subDetectorId),
44 static_cast<uint16_t>(rodId));
45
46 // return Source ID
47 return sid.code();
48}
49
50// mapping SrcID from ROD to ROB
51uint32_t Muon::TGC_Hid2RESrcID::getRobID(uint32_t rod_id) {
52 // return Source ID.
53 // ROD source ID and ROB source ID are identical for TGC.
54 return rod_id;
55}
56
57// mapping SrcID from ROB to ROS
58uint32_t Muon::TGC_Hid2RESrcID::getRosID(uint32_t rob_id) {
59 // Change Module Type to ROS, moduleid = 0
60 SourceIdentifier id(rob_id);
61 SourceIdentifier id2(id.subdetector_id(), 0);
62
63 // return Source ID
64 return id2.code();
65}
66
67// mapping SrcID from ROS to Det
68uint32_t Muon::TGC_Hid2RESrcID::getDetID(uint32_t ros_id) {
69 // ROS to DET
70 SourceIdentifier id(ros_id);
71 SourceIdentifier id2(id.subdetector_id(), 0);
72
73 // return Source ID
74 return id2.code();
75}
76
77// fill all the ROB IDs
79 TgcRdoIdHash rdoIdHash;
80 int rdoIdHash_max = rdoIdHash.max();
81 for (int i = 0; i < rdoIdHash_max; i++) {
82 SourceIdentifier sid(
83 static_cast<eformat::SubDetector>(rdoIdHash.subDetectorId(i)),
84 rdoIdHash.rodId(i));
85
86 m_robIDs.push_back(getRobID(sid.simple_code()));
87 }
88}
HWIdentifier id2
static uint32_t getRobID(uint32_t rod_id)
Make a ROB Source ID from a ROD source ID.
static uint32_t getRodID(const TgcRdo *rdo)
Make a ROD Source ID for TGC RDO.
static uint32_t getRosID(uint32_t rob_id)
Make a ROS Source ID from a ROB source ID.
static uint32_t getDetID(uint32_t ros_id)
Make a SubDetector ID from ROS source ID.
std::vector< uint32_t > m_robIDs
void fillAllRobIds()
Fill all the ROB IDs.
uint16_t rodId(int i) const
reverse conversion : ROD ID
int max() const
return maximum number of IDs
uint16_t subDetectorId(int i) const
reverse conversion for SubDetectorID and ROD ID
uint16_t rodId() const
Definition TgcRdo.h:138
uint16_t subDetectorId() const
Definition TgcRdo.h:134