ATLAS Offline Software
Public Member Functions | Private Types | Private Attributes | List of all members
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 47 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} {}

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 }

◆ 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 }

Member Data Documentation

◆ m_cablingMap

LookUpMap Nsw_CablingMap::m_cablingMap {}
private

Definition at line 48 of file Nsw_CablingMap.h.

◆ m_idHelperSvc

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

Definition at line 42 of file Nsw_CablingMap.h.


The documentation for this class was generated from the following files:
NswZebraData::firstChannel
int16_t firstChannel
Definition: NswZebraData.h:20
Muon::IMuonIdHelperSvc::stgcIdHelper
virtual const sTgcIdHelper & stgcIdHelper() const =0
access to TgcIdHelper
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
NswZebraData::shiftChannel
int16_t shiftChannel
Definition: NswZebraData.h:22
Muon::IMuonIdHelperSvc::mmIdHelper
virtual const MmIdHelper & mmIdHelper() const =0
access to CscIdHelper
Nsw_CablingMap::m_cablingMap
LookUpMap m_cablingMap
Definition: Nsw_CablingMap.h:48
NswZebraSet
std::set< NswZebraData, std::less<> > NswZebraSet
Definition: NswZebraData.h:38
Identifier
Definition: DetectorDescription/Identifier/Identifier/Identifier.h:32
Muon::IMuonIdHelperSvc::layerId
virtual Identifier layerId(const Identifier &id) const =0
create a layer ID, returns tube id for the MDTs
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Handler::svc
AthROOTErrorHandlerSvc * svc
Definition: AthROOTErrorHandlerSvc.cxx:10
NswZebraData::lastChannel
int16_t lastChannel
Definition: NswZebraData.h:21
Muon::IMuonIdHelperSvc::isMM
virtual bool isMM(const Identifier &id) const =0
returns whether this is a MM Identifier or not
debug
const bool debug
Definition: MakeUncertaintyPlots.cxx:53
sTgcIdHelper
Definition: sTgcIdHelper.h:55
Nsw_CablingMap::m_idHelperSvc
const Muon::IMuonIdHelperSvc * m_idHelperSvc
Definition: Nsw_CablingMap.h:42
MmIdHelper
Definition: MmIdHelper.h:54
Muon::IMuonIdHelperSvc::toString
virtual std::string toString(const Identifier &id) const =0
print all fields to string
DEBUG
#define DEBUG
Definition: page_access.h:11
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7