ATLAS Offline Software
Loading...
Searching...
No Matches
Nsw_CablingMap Class Reference

#include <Nsw_CablingMap.h>

Collaboration diagram for Nsw_CablingMap:

Public Member Functions

 Nsw_CablingMap (const Muon::IMuonIdHelperSvc *svc)
std::optional< IdentifiercorrectChannel (const Identifier &id, MsgStream &msg) const
bool addConnector (const Identifier &gapID, const NswZebraData &connector, MsgStream &msg)

Private Types

using LookUpMap = std::map<Identifier, NswZebraSet>

Private Attributes

const Muon::IMuonIdHelperSvcm_idHelperSvc {nullptr}
LookUpMap m_cablingMap {}

Detailed Description

Definition at line 18 of file Nsw_CablingMap.h.

Member Typedef Documentation

◆ LookUpMap

using Nsw_CablingMap::LookUpMap = std::map<Identifier, NswZebraSet>
private

Definition at line 43 of file Nsw_CablingMap.h.

Constructor & Destructor Documentation

◆ Nsw_CablingMap()

Nsw_CablingMap::Nsw_CablingMap ( const Muon::IMuonIdHelperSvc * svc)

Definition at line 16 of file Nsw_CablingMap.cxx.

17 : m_idHelperSvc{svc} {}
const Muon::IMuonIdHelperSvc * m_idHelperSvc
AthROOTErrorHandlerSvc * svc

Member Function Documentation

◆ addConnector()

bool Nsw_CablingMap::addConnector ( const Identifier & gapID,
const NswZebraData & connector,
MsgStream & msg )

Definition at line 76 of file Nsw_CablingMap.cxx.

78 {
79 if (connector.firstChannel >= connector.lastChannel ||
80 !connector.shiftChannel) {
81 msg << MSG::ERROR << "Invalid zebra definition has been parsed for "
82 << m_idHelperSvc->toString(gapID) << ". " << connector << endmsg;
83 return false;
84 }
85 NswZebraSet& correctionSet = m_cablingMap[gapID];
86 if (correctionSet.count(connector.firstChannel) ||
87 correctionSet.count(connector.lastChannel)) {
88 msg << MSG::ERROR << "Zebra " << m_idHelperSvc->toString(gapID)
89 << " is already partially covered " << connector << endmsg;
90 return false;
91 }
92 msg << MSG::DEBUG << "Add new zebra connector " << connector << " to "
93 << m_idHelperSvc->toString(gapID) << "." << endmsg;
94 correctionSet.insert(connector);
95 return true;
96}
#define endmsg
std::set< NswZebraData, std::less<> > NswZebraSet
LookUpMap m_cablingMap
int16_t lastChannel
int16_t firstChannel
int16_t shiftChannel
MsgStream & msg
Definition testRead.cxx:32

◆ correctChannel()

std::optional< Identifier > Nsw_CablingMap::correctChannel ( const Identifier & id,
MsgStream & msg ) const

Definition at line 19 of file Nsw_CablingMap.cxx.

20 {
21 bool debug = msg.level() <= MSG::DEBUG;
22
23 const MmIdHelper& mmHelper{m_idHelperSvc->mmIdHelper()};
24 const sTgcIdHelper& sTgcHelper{m_idHelperSvc->stgcIdHelper()};
25 LookUpMap::const_iterator itr = m_cablingMap.find(m_idHelperSvc->layerId(id));
26 if (itr == m_cablingMap.end()) {
27 if (debug)
28 msg << MSG::DEBUG << "The gas gap " << m_idHelperSvc->toString(id)
29 << " has no known cabling correction" << endmsg;
30 return std::make_optional<Identifier>(id);
31 }
32 const NswZebraSet& correctionSet{itr->second};
33 const int channel = m_idHelperSvc->isMM(id) ? mmHelper.channel(id) :
34 sTgcHelper.channel(id);
35 NswZebraSet::const_iterator zebra_conn = correctionSet.find(channel);
36 if (zebra_conn == correctionSet.end()) {
37 if (debug)
38 msg << MSG::DEBUG << "The zebra connector associated to "
39 << m_idHelperSvc->toString(id)
40 << " was mounted correctly -> no correction needed " << endmsg;
41 return std::make_optional<Identifier>(id);
42 }
43 const int newChannel = channel + zebra_conn->shiftChannel;
44 if (newChannel < zebra_conn->firstChannel ||
45 newChannel > zebra_conn->lastChannel) {
46 if (debug)
47 msg << MSG::DEBUG << "The associated channel "
48 << m_idHelperSvc->toString(id)
49 << " is shifted outside of the zebra connector range: "
50 << newChannel << ". Mask the channel." << endmsg;
51 return std::nullopt;
52 }
53 if (m_idHelperSvc->isMM(id)) {
54 const Identifier newId = mmHelper.channelID(id,
55 mmHelper.multilayer(id),
56 mmHelper.gasGap(id),
57 newChannel);
58 if (debug)
59 msg << MSG::DEBUG << "The input identifier "
60 << m_idHelperSvc->toString(id) << " is shifted to a new one "
61 << m_idHelperSvc->toString(newId) << endmsg;
62 return std::make_optional<Identifier>(std::move(newId));
63 }
64 const Identifier newId = sTgcHelper.channelID(id,
65 sTgcHelper.multilayer(id),
66 sTgcHelper.gasGap(id),
67 sTgcHelper.channelType(id),
68 newChannel);
69 if (debug)
70 msg << MSG::DEBUG << "The input identifier "
71 << m_idHelperSvc->toString(id) << " is shifted to a new one "
72 << m_idHelperSvc->toString(newId) << endmsg;
73
74 return std::make_optional<Identifier>(std::move(newId));
75}
const bool debug
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channel) const
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
int multilayer(const Identifier &id) const
int multilayer(const Identifier &id) const
int channelType(const Identifier &id) const
int channel(const Identifier &id) const override
int gasGap(const Identifier &id) const override
get the hashes
Identifier channelID(int stationName, int stationEta, int stationPhi, int multilayer, int gasGap, int channelType, int channel) const

Member Data Documentation

◆ m_cablingMap

LookUpMap Nsw_CablingMap::m_cablingMap {}
private

Definition at line 44 of file Nsw_CablingMap.h.

44{};

◆ m_idHelperSvc

const Muon::IMuonIdHelperSvc* Nsw_CablingMap::m_idHelperSvc {nullptr}
private

Definition at line 38 of file Nsw_CablingMap.h.

38{nullptr};

The documentation for this class was generated from the following files: