9#include "GaudiKernel/MsgStream.h"
14 OfflineOnlineMap::const_iterator it =
m_RDOmap.find(compactID);
15 if (it ==
m_RDOmap.end())
return false;
17 if (!
index)
return false;
22 if (hashID >=
m_HashVec.size())
return false;
24 if (!
index)
return false;
30 OfflineOnlineMap::const_iterator it =
m_RDOmap.find(compactID);
31 if (it ==
m_RDOmap.end())
return false;
33 if (!
index)
return false;
38 if (hashID >=
m_HashVec.size())
return false;
40 if (!
index)
return false;
46 OfflineOnlineMap::const_iterator it =
m_RDOmap.find(compactID);
47 if (it ==
m_RDOmap.end())
return false;
49 if (!
index)
return false;
54 if (hashID >=
m_HashVec.size())
return false;
56 if (!
index)
return false;
62 OfflineOnlineMap::const_iterator it =
m_RDOmap.find(compactID);
63 if (it ==
m_RDOmap.end())
return false;
65 if (!
index)
return false;
70 if (hashID >=
m_HashVec.size())
return false;
72 if (!
index)
return false;
78 OfflineOnlineMap::const_iterator it =
m_RDOmap.find(compactID);
79 if (it ==
m_RDOmap.end())
return false;
81 if (!
index)
return false;
86 if (hashID >=
m_HashVec.size())
return false;
88 if (!
index)
return false;
94 OfflineOnlineMap::const_iterator it =
m_RDOmap.find(compactID);
95 if (it ==
m_RDOmap.end())
return false;
97 if (!
index)
return false;
102 if (hashID >=
m_HashVec.size())
return false;
104 if (!
index)
return false;
120 std::map<Identifier, int>::const_iterator it =
m_lookup.find(
id);
121 if (it !=
m_lookup.end()) {
return (*it).second; }
132 if ((subsystem_id != 0x66 && subsystem_id != 0x65) || (rod_id >= 16))
return std::vector<IdentifierHash>();
133 return m_rod2hash[(subsystem_id == 0x66) ? 0 : 1][rod_id];
137 unsigned short int side;
138 unsigned short int RODid;
141 uint32_t rod = RODid;
142 return (sub << 16) | rod;
148 StatusCode
sc = StatusCode::SUCCESS;
149 unsigned int hash = (
unsigned int)rdoHashId;
151 if (hash >=
m_HashVec.size()) {
return StatusCode::FAILURE; }
153 unsigned short int rob_id =
m_HashVec[hash]->ROBid();
154 unsigned short int side =
m_HashVec[hash]->side();
156 robId = (side << 16) | rob_id;
162 StatusCode
sc = StatusCode::SUCCESS;
167 uint32_t robid = 0xffffffff;
169 robIdVec.push_back(robid);
173 std::sort(robIdVec.begin(), robIdVec.end());
174 robIdVec.erase(unique(robIdVec.begin(), robIdVec.end()), robIdVec.end());
180 const int cabling_code)
const {
187 int doubletZ,
int doubletPhi,
int gasGap,
int measuresPhi,
int strip)
const {
188 unsigned long int code = 0;
190 unsigned long int etaPhiView = 2;
191 unsigned long int phi1_16 = 2. * stationPhi;
192 if (
largeSector(stationName)) phi1_16 = phi1_16 - 1;
193 int logicSector = (phi1_16 - 1) * 2 + doubletPhi - 2;
194 if (logicSector < 0) logicSector = 31;
195 if (measuresPhi > 0) etaPhiView = 1;
196 if (stationEta >= 0) logicSector += 32;
198 unsigned long int cabStat = doubletR;
199 if (stationName.substr(0, 2) ==
"BO") {
200 cabStat = 2 + cabStat;
201 if (cabStat > 3) cabStat = 2;
202 }
else if (stationName.substr(0, 3) ==
"BML") {
203 if (abs(stationEta) == 7 || (abs(stationEta) == 6 && stationPhi == 7)) {
207 if (stationName.substr(0,3)==
"BIS" && logicSector>31) logicSector+=1;
209 if (logicSector < 0 || logicSector > 63) {
return 999999; }
212 if (zIndexInCablingStation > 99)
return 0;
213 int cablingStation = cabStat;
215 unsigned long int gg = gasGap - 1;
222 int zIndexInCablingStation,
int strip) {
223 unsigned long int code = 0;
224 code = etaPhiView * 100000000 + logicSector * 1000000 + cablingStation * 100000 + gasGap * 10000 + zIndexInCablingStation * 100 +
231 if (stName ==
"BML" ||
241 int doubletR,
int doubletZ,
int cabStat)
const {
242 unsigned int zIndexInCablingStation = 999;
243 int cablingStation = -1;
246 if (sectType < 1 || sectType >
m_MaxType + 1) {
return 99999; }
249 for (
unsigned int jStat = 1; jStat < 4; ++jStat) {
250 if (cablingStation != -1)
break;
251 for (
unsigned int jCham = 0; jCham < 20; ++jCham) {
253 if (rpcC ==
nullptr)
continue;
255 if ((rpcC->
chamber_name()).substr(0, 3) != stationName) {
continue; }
256 if (rpcC->
stationEta() != abs(stationEta)) {
continue; }
257 if (rpcC->
doubletR() != doubletR) {
continue; }
258 if (rpcC->
doubletZ() != doubletZ) {
continue; }
259 cablingStation = jStat;
260 zIndexInCablingStation = jCham;
264 if (cablingStation < 1 || cablingStation > 3 || (cabStat != cablingStation)) {
return 99999; }
266 return zIndexInCablingStation;
270 unsigned short int PADId,
unsigned short int CMAId,
unsigned short ijk,
271 unsigned short int Channel,
const RpcIdHelper* rpcId)
const {
272 std::list<unsigned int> CodeList;
274 int logic_sector = SectorId + SubsystemId * 32;
275 unsigned short int Ixx = CMAId & 1;
276 unsigned short int ep = (CMAId >> 1) & 1;
277 unsigned short int lh = (CMAId >> 2) & 1;
279 ep = (ep == 1) ? 0 : 1;
288 CodeList = s.give_strip_code(PHI, logic_sector, lh, ijk, Channel);
291 CodeList = s.give_strip_code(ETA, logic_sector, lh, ijk, Channel);
294 std::list<RPCofflineId> offlineIdList;
295 std::list<unsigned int>::const_iterator it = CodeList.begin();
296 while (it != CodeList.end()) {
300 int RPC_strip = decode.strip_number();
301 int RPC_chamber = decode.rpc_z_index();
302 int RPC_layer = decode.rpc_layer();
303 int RPC_station = decode.lvl1_station();
304 int sector = (decode.logic_sector()) % 32;
310 thisRpcId.
stationPhi = (sector == 31) ? 1 : (sector + 1) / 4 + 1;
314 thisRpcId.
gasGap = RPC_layer + 1;
315 thisRpcId.
measuresPhi =
static_cast<int>(decode.view());
316 thisRpcId.
strip = RPC_strip + 1;
318 offlineIdList.push_back(std::move(thisRpcId));
323 std::list<Identifier> ids;
324 std::list<RPCofflineId>::const_iterator
iterator = offlineIdList.begin();
325 while (
iterator != offlineIdList.end()) {
327 rpcId->
channelID((*iterator).stationName, (*iterator).stationEta, (*iterator).stationPhi, (*iterator).doubletR,
328 (*iterator).doubletZ, (*iterator).doubletPhi, (*iterator).gasGap, (*iterator).measuresPhi, (*iterator).strip);
337 StatusCode
sc = StatusCode::SUCCESS;
341 PRD_RDO_Map::const_iterator it =
m_PRD_RDO_map.find(prdHashId);
345 for (
IdentifierHash rdoId : (*it).second) rdoHashVec.push_back(rdoId);
351 std::vector<IdentifierHash>& rdoHashVec)
const {
352 StatusCode
sc = StatusCode::SUCCESS;
355 std::set<IdentifierHash> requestedRdoHashSet;
359 PRD_RDO_Map::const_iterator it =
m_PRD_RDO_map.find(prdHashId);
362 requestedRdoHashSet.insert((*it).second.begin(), (*it).second.end());
366 for (
IdentifierHash rdoHashId : requestedRdoHashSet) { rdoHashVec.push_back(rdoHashId); }
372 StatusCode
sc = StatusCode::SUCCESS;
375 std::set<IdentifierHash> requestedRdoHashSet;
377 for (uint32_t robId : robIdVec) {
382 requestedRdoHashSet.insert((*it).second.begin(), (*it).second.end());
386 for (
IdentifierHash rdoHashId : requestedRdoHashSet) { rdoHashVec.push_back(rdoHashId); }
392 StatusCode
sc = StatusCode::SUCCESS;
396 PRD_ROB_Map::const_iterator it =
m_PRD_ROB_map.find(prdHashId);
400 for (uint32_t robId : (*it).second) robIdVec.push_back(robId);
406 unsigned short int& cma_mask,
unsigned short int& feet_th0,
unsigned short int& feet_th1,
407 unsigned short int& feet_th2)
const {
421 unsigned int& padIdHash)
const {
422 unsigned short int PADId = (RoIId) / 4;
424 int key = SubsystemId * 10000 + SectorId * 100 + PADId;
427 RDOmap::const_iterator it =
m_RDOs.find(key);
428 if (it ==
m_RDOs.end())
return false;
433 padIdHash =
index.hash();
441 unsigned int EtaLowBorder = 0;
442 unsigned int EtaHighBorder = 0;
443 unsigned int PhiLowBorder = 0;
444 unsigned int PhiHighBorder = 0;
445 bool ok =
give_RoI_borders(SubsystemId, SectorId, RoIId, EtaLowBorder, EtaHighBorder, PhiLowBorder, PhiHighBorder);
457 unsigned int& EtaLowBorder,
unsigned int& EtaHighBorder,
unsigned int& PhiLowBorder,
458 unsigned int& PhiHighBorder)
const {
459 int logic_sector = SectorId + SubsystemId * 32;
460 int PadId = (RoIId) / 4;
461 int PadRoI = (RoIId) % 4;
462 int PhiIxx = PadRoI / 2;
463 int EtaIxx = PadRoI % 2;
472 if (!s.give_RoI_borders(ETA, PHI, EtaLowBorder, EtaHighBorder, PhiLowBorder, PhiHighBorder)) {
474 if (log.level() <= MSG::WARNING)
476 <<
"give_RoI_borders() - failed to call give_RoI_borders() on SectorLogicSetup, borders not set, return false..." <<
endmsg;
480 EtaLowBorder += logic_sector * 1000000;
481 EtaHighBorder += logic_sector * 1000000;
482 PhiLowBorder += logic_sector * 1000000;
483 PhiHighBorder += logic_sector * 1000000;
492 if (rpc_strip.
strip > 48) rpc_strip.
strip = 48;
497 if (rpc_strip.
strip > 36) rpc_strip.
strip = 36;
508 if (!decode) {
return rpcId; }
509 int RPC_logic_sector = decode.logic_sector();
510 int RPC_strip = decode.strip_number();
511 int RPC_chamber = decode.rpc_z_index();
512 int RPC_layer = decode.rpc_layer();
513 int RPC_station = decode.lvl1_station();
514 int sector = (decode.logic_sector()) % 32;
523 rpcId.
stationPhi = (sector == 31) ? 1 : (sector + 1) / 4 + 1;
527 rpcId.
gasGap = RPC_layer + 1;
528 rpcId.
measuresPhi =
static_cast<int>(decode.view());
529 rpcId.
strip = RPC_strip + 1;
535 unsigned int& EtaLowBorder,
unsigned int& EtaHighBorder,
unsigned int& PhiLowBorder,
536 unsigned int& PhiHighBorder)
const {
537 int logic_sector = SectorId + SubsystemId * 32;
538 int PadId = (RoIId) / 4;
539 int PadRoI = (RoIId) % 4;
540 int PhiIxx = PadRoI / 2;
541 int EtaIxx = PadRoI % 2;
550 if (!s.give_LowPt_borders(ETA, PHI, EtaLowBorder, EtaHighBorder, PhiLowBorder, PhiHighBorder)) {
565 if (EtaLowBorder == 0 || EtaHighBorder == 0 || PhiLowBorder == 0 || PhiHighBorder == 0)
return false;
567 EtaLowBorder += logic_sector * 1000000;
568 EtaHighBorder += logic_sector * 1000000;
569 PhiLowBorder += logic_sector * 1000000;
570 PhiHighBorder += logic_sector * 1000000;
578 unsigned int EtaLowBorder = 0;
579 unsigned int EtaHighBorder = 0;
580 unsigned int PhiLowBorder = 0;
581 unsigned int PhiHighBorder = 0;
582 bool ok =
give_LowPt_borders(SubsystemId, SectorId, RoIId, EtaLowBorder, EtaHighBorder, PhiLowBorder, PhiHighBorder);
593 unsigned int& EtaLowBorder,
unsigned int& EtaHighBorder,
unsigned int& PhiLowBorder,
594 unsigned int& PhiHighBorder)
const {
595 int logic_sector = SectorId + SubsystemId * 32;
596 int PadId = (RoIId) / 4;
597 int PadRoI = (RoIId) % 4;
598 int PhiIxx = PadRoI / 2;
599 int EtaIxx = PadRoI % 2;
608 if (!s.give_HighPt_borders(ETA, PHI, EtaLowBorder, EtaHighBorder, PhiLowBorder, PhiHighBorder)) {
623 if (EtaLowBorder == 0 || EtaHighBorder == 0 || PhiLowBorder == 0 || PhiHighBorder == 0)
return false;
625 EtaLowBorder += logic_sector * 1000000;
626 EtaHighBorder += logic_sector * 1000000;
627 PhiLowBorder += logic_sector * 1000000;
628 PhiHighBorder += logic_sector * 1000000;
636 unsigned int EtaLowBorder = 0;
637 unsigned int EtaHighBorder = 0;
638 unsigned int PhiLowBorder = 0;
639 unsigned int PhiHighBorder = 0;
640 bool ok =
give_HighPt_borders(SubsystemId, SectorId, RoIId, EtaLowBorder, EtaHighBorder, PhiLowBorder, PhiHighBorder);
659 if (side >= 2)
return false;
660 if (sector >= 32)
return false;
661 if (padId >= 10)
return false;
663 return id.is_valid();
669 for (
size_t i = 0; i < ids.size(); i++) {
m_lookup.emplace(ids[i], i); }
Header file for AthHistogramAlgorithm.
std::list< const CMAparameters * > CMAlist
This is a "hash" representation of an Identifier.
std::string stationName() const
int phiReadoutPannels() const
const std::string & chamber_name() const
const RPCchamber * find_chamber(int, int) const
StatusCode giveROB_fromRDO(const IdentifierHash rdoHashId, uint32_t &robId) const
virtual bool give_Pad_Parameters(unsigned short int logic_sector, unsigned short int PADId, bool &feet, bool &eta_and_phi, unsigned short int &cma_mask, unsigned short int &feet_th0, unsigned short int &feet_th1, unsigned short int &feet_th2) const
int operator()(const Identifier &id) const
std::list< Identifier > give_strip_id(unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int PADId, unsigned short int CMAId, unsigned short ijk, unsigned short int Channel, const RpcIdHelper *rpcId) const
static constexpr unsigned MAX_LOGICSECTOR
Identifier strip_OffId_fromCode(unsigned long int strip_code, const RpcIdHelper *rpcId) const
std::vector< IdentifierHash > m_rod2hash[2][16]
bool give_RODid(const Identifier &compactID, unsigned short int &id) const
bool give_LowPt_borders(unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int RoIId, unsigned int &EtaLowBorder, unsigned int &EtaHighBorder, unsigned int &PhiLowBorder, unsigned int &PhiHighBorder) const
ROB_RDO_Map m_ROB_RDO_map
std::map< int, RDOindex, std::less< int > > RDOmap
bool giveOfflineId(const unsigned short int side, const unsigned short int sector, const unsigned short int padId, Identifier &id) const
StatusCode giveRDO_fromPRD(const IdentifierHash prdHashId, std::vector< IdentifierHash > &rdoHashVec) const
unsigned int computeZIndexInCablingStation(const std::string &stationName, int logicSector, int stationEta, int doubletR, int doubletZ, int cabStat) const
std::vector< Identifier > m_int2id
bool give_RoI_borders_id(unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int RoIId, Identifier &EtaLowBorder_id, Identifier &EtaHighBorder_id, Identifier &PhiLowBorder_id, Identifier &PhiHighBorder_id, const RpcIdHelper *rpcId) const
static bool largeSector(const std::string &stName)
StatusCode giveROB_fromPRD(const IdentifierHash prdHashId, std::vector< uint32_t > &robIdVec) const
PRD_RDO_Map m_PRD_RDO_map
bool give_HighPt_borders_id(unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int RoIId, Identifier &EtaLowBorder_id, Identifier &EtaHighBorder_id, Identifier &PhiLowBorder_id, Identifier &PhiHighBorder_id, const RpcIdHelper *rpcId) const
bool give_PADid(const Identifier &compactID, unsigned short int &id) const
void setLookup(const std::vector< Identifier > &ids)
const RDOmap & give_RDOs(void) const
const CMAparameters::CMAlist give_CMAs(const int logic_sector, const ViewType side, const int station, const int cabling_code) const
RPCofflineId strip_id_fromCode(unsigned long int strip_code) const
bool give_side(const Identifier &compactID, unsigned short int &id) const
StatusCode giveRDO_fromROB(const std::vector< uint32_t > &robIdVec, std::vector< IdentifierHash > &rdoHashVec) const
Identifier protected_strip_OffId_fromCode(unsigned long int strip_code, const RpcIdHelper *rpcId) const
bool give_RoI_borders(unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int RoIId, unsigned int &EtaLowBorder, unsigned int &EtaHighBorder, unsigned int &PhiLowBorder, unsigned int &PhiHighBorder) const
static constexpr unsigned MAX_PADID
Identifier identifier(int i) const
RPCPadParameters m_RPCPadParameters_array[MAX_LOGICSECTOR][MAX_PADID]
unsigned long int strip_code_fromOffId(const std::string &stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
bool give_SLid(const Identifier &compactID, unsigned short int &id) const
bool give_ROBid(const Identifier &compactID, unsigned short int &id) const
std::map< Identifier, int > m_lookup
PRD_ROB_Map m_PRD_ROB_map
bool give_PAD_address(unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int RoIId, unsigned int &padIdHash) const
const std::vector< uint32_t > & giveFullListOfRobIds() const
bool give_RXid(const Identifier &compactID, unsigned short int &id) const
Identifier m_offline_id[2][32][10]
static unsigned long int strip_code_fromOffline(int etaPhiView, int logicSector, int cablingStation, int gasGap, int zIndexInCablingStation, int strip)
std::vector< IdentifierHash > rod2hash(uint16_t subsystem, uint16_t rod) const
OfflineOnlineHashMap m_HashVec
bool give_HighPt_borders(unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int RoIId, unsigned int &EtaLowBorder, unsigned int &EtaHighBorder, unsigned int &PhiLowBorder, unsigned int &PhiHighBorder) const
OfflineOnlineMap m_RDOmap
void setIds(const std::vector< Identifier > &int2id)
std::vector< uint32_t > m_fullListOfRobIds
bool give_LowPt_borders_id(unsigned short int SubsystemId, unsigned short int SectorId, unsigned short int RoIId, Identifier &EtaLowBorder_id, Identifier &EtaHighBorder_id, Identifier &PhiLowBorder_id, Identifier &PhiHighBorder_id, const RpcIdHelper *rpcId) const
uint32_t hash2source(unsigned int h) const
Identifier channelID(int stationName, int stationEta, int stationPhi, int doubletR, int doubletZ, int doubletPhi, int gasGap, int measuresPhi, int strip) const
singleton-like access to IMessageSvc via open function and helper
IMessageSvc * getMessageSvc(bool quiet=false)
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.