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"
9
11
12#include "eformat/SourceIdentifier.h"
13using eformat::helper::SourceIdentifier;
14
15// get source ID for a RDO
17{
18 // get Source ID
19 SourceIdentifier sid(static_cast<eformat::SubDetector>(rdo->subDetectorId()),
20 static_cast<uint16_t>(rdo->rodId()));
21
22 // return Source ID
23 return sid.code();
24}
25
26// get source ID for a RDO
27uint32_t Muon::TGC_Hid2RESrcID::getRodID(uint16_t subDetectorId, uint16_t rodId)
28{
29 // get Source ID
30 SourceIdentifier sid(static_cast<eformat::SubDetector>(subDetectorId), rodId);
31
32 // return Source ID
33 return sid.code();
34}
35
36// get source ID for an TgcDigitCollection
38 const MuonTGC_CablingSvc* cabling)
39{
40 int subDetectorId;
41 int rodId;
42 cabling->getReadoutIDfromElementID(offlineId,subDetectorId,rodId);
43
44 // get Source ID
45 SourceIdentifier sid(static_cast<eformat::SubDetector>(subDetectorId),
46 static_cast<uint16_t>(rodId));
47
48 // return Source ID
49 return sid.code();
50}
51
52// mapping SrcID from ROD to ROB
53uint32_t Muon::TGC_Hid2RESrcID::getRobID(uint32_t rod_id)
54{
55 // return Source ID.
56 // ROD source ID and ROB source ID are identical for TGC.
57 return rod_id;
58}
59
60// mapping SrcID from ROB to ROS
61uint32_t Muon::TGC_Hid2RESrcID::getRosID(uint32_t rob_id)
62{
63 // Change Module Type to ROS, moduleid = 0
64 SourceIdentifier id(rob_id);
65 SourceIdentifier id2(id.subdetector_id(),0);
66
67 // return Source ID
68 return id2.code();
69}
70
71// mapping SrcID from ROS to Det
72uint32_t Muon::TGC_Hid2RESrcID::getDetID(uint32_t ros_id)
73{
74 // ROS to DET
75 SourceIdentifier id(ros_id);
76 SourceIdentifier id2(id.subdetector_id(),0);
77
78 // return Source ID
79 return id2.code();
80}
81
82// fill all the ROB IDs
84{
85 TgcRdoIdHash rdoIdHash;
86 int rdoIdHash_max = rdoIdHash.max();
87 for(int i=0; i<rdoIdHash_max; i++) {
88 SourceIdentifier sid(static_cast<eformat::SubDetector>(rdoIdHash.subDetectorId(i)),
89 rdoIdHash.rodId(i));
90
91 m_robIDs.push_back(getRobID(sid.simple_code()));
92 }
93}
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