ATLAS Offline Software
Loading...
Searching...
No Matches
RPC_Hid2RESrcID.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
5#include "RPC_Hid2RESrcID.h"
6
7#include <cassert>
8#include <stdexcept>
9
10#include "eformat/SourceIdentifier.h"
11
12using eformat::helper::SourceIdentifier;
13
14// implementation of RpcPad to RESrcID conversion.
15// Ketevi A. Assamagan
16// Jan-16-2003, BNL
17
19
20RPC_Hid2RESrcID::RPC_Hid2RESrcID(int specialROBNumber) : m_rpcIdHelper(nullptr), m_specialROBNumber(specialROBNumber) {}
21
22void RPC_Hid2RESrcID::set(const RpcIdHelper* rpdId) { m_rpcIdHelper = rpdId; }
23
24// This method is used by the RDO converter only
25uint32_t RPC_Hid2RESrcID::getRodID(const Identifier& offlineId, const RpcCablingCondData* readCdo) const {
26 // this method returns a RESrcID for the ROD, for a
27 // given RPC pad ID offline ID
28
29 unsigned short int RODid;
30 unsigned short int Iside;
31 unsigned short int SLid;
32
33 if (readCdo->give_RODid(offlineId, RODid) && readCdo->give_side(offlineId, Iside) && readCdo->give_SLid(offlineId, SLid)) {
34 uint8_t rodIndex = (uint8_t)RODid;
35 uint16_t side = Iside;
36
37 eformat::SubDetector detid =
38 (side == eformat::MUON_RPC_BARREL_A_SIDE) ? eformat::MUON_RPC_BARREL_A_SIDE : eformat::MUON_RPC_BARREL_C_SIDE;
39
40 SourceIdentifier sid(detid, rodIndex);
41 uint32_t rod_id = sid.code();
42
43 // TEMP FIXME temp fix for the sector 13 pulse tests ---- added fix for M3
44 if ((m_specialROBNumber > 0)) {
45 if (side == 0x65 && (SLid == 23 || SLid == 24)) {
46 // rod_id=0x650001;
47 rod_id = m_specialROBNumber;
48 } else if (side == 0x65 && SLid == 7) {
49 rod_id = 0x650001;
50 } else if (side == 0x65 && SLid == 8) {
51 rod_id = 0x650002;
52 if (m_specialROBNumber == 0x650001) rod_id = 0x650001; // fix for M3 with runnumber up to 11533 (SFI)
53 } else {
54 rod_id = 0xffffffff;
55 }
56 }
57
58 return rod_id;
59 }
60
61 return 0xffffffff;
62}
63
64uint32_t RPC_Hid2RESrcID::getRodID(const int& side, const int& slogic, const int& padId, const RpcCablingCondData* readCdo) {
65 // this method returns a RESrcID for the ROD, for a given RPC pad ID
66 const RpcCablingCondData::RDOmap& pad_map = readCdo->give_RDOs();
67 int key = side * 10000 + slogic * 100 + padId;
68 RDOindex index = (*pad_map.find(key)).second;
69 uint8_t rodIndex = (uint8_t)index.RODid();
70
71 eformat::SubDetector detid = (side == 1) ? eformat::MUON_RPC_BARREL_A_SIDE : eformat::MUON_RPC_BARREL_C_SIDE;
72
73 SourceIdentifier sid(detid, rodIndex);
74 uint32_t rod_id = sid.code();
75
76 return rod_id;
77}
78
79uint32_t RPC_Hid2RESrcID::getRodID(const int& sector) {
80 // this method returns a RESrcID for the ROD, for a given RPC pad ID
81 uint8_t rodIndex = (uint8_t)((sector % 32) / 2);
82 int side = (sector < 32) ? 0 : 1;
83
84 eformat::SubDetector detid = (side == 1) ? eformat::MUON_RPC_BARREL_A_SIDE : eformat::MUON_RPC_BARREL_C_SIDE;
85
86 SourceIdentifier sid(detid, rodIndex);
87 uint32_t rod_id = sid.code();
88
89 return rod_id;
90}
91
92uint32_t RPC_Hid2RESrcID::getRodID(const uint16_t& side, const uint16_t& rodIndex) {
93 // this method returns a RESrcID for the ROD, for a given RPC pad ID
94 eformat::SubDetector detid = (side == 1) ? eformat::MUON_RPC_BARREL_A_SIDE : eformat::MUON_RPC_BARREL_C_SIDE;
95 SourceIdentifier sid(detid, rodIndex);
96 uint32_t rod_id = sid.code();
97 return rod_id;
98}
99
102uint32_t RPC_Hid2RESrcID::getRobID(const uint32_t rod_id) { return rod_id; }
103
106uint32_t RPC_Hid2RESrcID::getRosID(const uint32_t rob_id) {
107 // Change Module Type to ROS, moduleid = 0
108 SourceIdentifier id(rob_id);
109 SourceIdentifier id2(id.subdetector_id(), 0);
110 return id2.code();
111}
112
115uint32_t RPC_Hid2RESrcID::getDetID(const uint32_t ros_id) {
116 // ROS to DET
117 SourceIdentifier id(ros_id);
118 SourceIdentifier id2(id.subdetector_id(), 0);
119 return id2.code();
120}
HWIdentifier id2
uint32_t getRodID(const Identifier &offlineId, const RpcCablingCondData *readCdo) const
static uint32_t getDetID(const uint32_t ros_id)
mapping SrcID from ROS to Det
static uint32_t getRosID(const uint32_t rob_id)
mapping SrcID from ROB to ROS
static uint32_t getRobID(const uint32_t rod_id)
mapping SrcID from ROD to ROB (called in ByteStreamCnvSvcBase/FullEventAssembler.icc)
const RpcIdHelper * m_rpcIdHelper
void set(const RpcIdHelper *rpdId)
bool give_RODid(const Identifier &compactID, unsigned short int &id) const
std::map< int, RDOindex, std::less< int > > RDOmap
const RDOmap & give_RDOs(void) const
bool give_side(const Identifier &compactID, unsigned short int &id) const
bool give_SLid(const Identifier &compactID, unsigned short int &id) const
Definition index.py:1