ATLAS Offline Software
Loading...
Searching...
No Matches
MuonMDT_CablingMap.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef MUONMDT_CABLING_MUONMDT_CABLINGMAP_H
6#define MUONMDT_CABLING_MUONMDT_CABLINGMAP_H
7
8
9
12#include <set>
13#include <memory>
14#include <map>
15#include <vector>
16#include <cstdint>
17/**********************************************
18 *
19 * @brief MDT map data object
20 *
21 **********************************************/
22
23class MdtMezzanineType;
24class MdtIdHelper;
25class IdentifierHash;
26class Identifier;
27
29 public:
31 using MezzanineTypes = std::map<uint8_t, std::unique_ptr<MdtMezzanineType>>;
32 using TdcOffSet = std::set<MdtTdcOffSorter, std::less<>>;
33 using TdcOnlSet = std::vector<MdtTdcOnlSorter>;
34
40 // larger number of tubes. The csm caches the up to 2 CSM associated
41 // with this object
43 TdcOffSet::const_iterator begin() const { return cards.begin(); }
44 TdcOffSet::const_iterator end() const { return cards.end(); }
45 TdcOffSet::const_iterator begin() { return cards.begin(); }
46 TdcOffSet::const_iterator end() { return cards.end(); }
47
51 std::array<MdtCablingOnData, 2> csm{};
52 };
53
54 using OffToOnlMap = std::map<MdtCablingOffData, MdtOffChModule>;
62 struct MdtTdcModule {
63 TdcOnlSet::const_iterator begin() const { return all_modules.begin(); }
64 TdcOnlSet::const_iterator end() const { return all_modules.end(); }
65 TdcOnlSet::const_iterator begin() { return all_modules.begin(); }
66 TdcOnlSet::const_iterator end() { return all_modules.end(); }
67
69
71 };
72 using OnlToOffMap = std::map<MdtCablingOnData, MdtTdcModule>;
73
75 /* mapping from hashid to ROB identifier as Subdetector+Rodid */
76 using ChamberToROBMap = std::map<IdentifierHash, uint32_t>;
77 using ROBToChamberMap = std::map<uint32_t, std::vector<IdentifierHash>>;
78 using ListOfROB = std::vector<uint32_t>;
82
84 bool addMezzanineLine(const int type, const int layer, const int sequence,
85 MsgStream& log);
86
88 bool addMezanineLayout(std::unique_ptr<MdtMezzanineCard> card,
89 MsgStream& log);
90
91 enum class DataSource { JSON, LegacyCOOL };
95 bool addMezzanine(CablingData cabling_data, DataSource source,
96 MsgStream& log);
97
99 bool getOfflineId(CablingData& cabling_data, MsgStream& log) const;
100
102 bool getOnlineId(CablingData& cabling_data, MsgStream& log) const;
106 bool convert(const CablingData& cabling_data, Identifier& id,
107 bool check_valid = true) const;
110 bool convert(const Identifier& id, CablingData& cabling_data) const;
111
113 uint32_t getROBId(const IdentifierHash& stationCode, MsgStream& log) const;
116 ListOfROB getROBId(const std::vector<IdentifierHash>& mdtHashVector,
117 MsgStream& log) const;
118
120 std::vector<IdentifierHash> getMultiLayerHashVec(
121 const std::vector<uint32_t>& ROBId_list, MsgStream& log) const;
122
124 const std::vector<IdentifierHash>& getMultiLayerHashVec(
125 const uint32_t ROBI, MsgStream& log) const;
126
128 const ListOfROB& getAllROBId() const;
129
131 const OnlToOffMap& getOnlineConvMap() const;
133 const OffToOnlMap& getOfflineConvMap() const;
134
135 bool finalize_init(MsgStream& log);
136
139 bool getStationCode(const CablingData& map_data, IdentifierHash& mdtHashId,
140 MsgStream& log) const;
143 bool getMultiLayerCode(const CablingData& map_data, Identifier& multiLayer,
144 IdentifierHash& mdtHashId, MsgStream& log) const;
145
148 unsigned int csmNumOnChamber(const CablingData& map_data,
149 MsgStream& log) const;
152 bool has2CsmML() const;
155 MezzCardPtr getHedgeHogMapping(uint8_t mezzCardId) const;
156
157 private:
159 bool addChamberToROBMap(const CablingData& cabling_data, MsgStream& log);
160
162 const MdtIdHelper* m_mdtIdHelper{nullptr};
163
167
170 std::vector<std::unique_ptr<MdtTdcMap>> m_tdcs{};
171
174
177
183 bool m_2CSM_cham{false};
184
186 using MezzCardList = std::vector<MezzCardPtr>;
190 MezzCardPtr legacyHedgehogCard(CablingData& cabling, MsgStream& msg) const;
191};
192
193CLASS_DEF(MuonMDT_CablingMap, 51038731, 1)
194#include "AthenaKernel/CondCont.h"
196
197#endif
macros to associate a CLID to a type
#define CLASS_DEF(NAME, CID, VERSION)
associate a clid and a version to a type eg
MuonMDT_CablingMap::DataSource DataSource
MuonMDT_CablingMap::MezzCardPtr MezzCardPtr
Hold mapping of ranges to condition objects.
Definition CondCont.h:889
This is a "hash" representation of an Identifier.
std::shared_ptr< const MdtMezzanineCard > MezzCardPtr
std::vector< MezzCardPtr > MezzCardList
List of mezzanine cards.
unsigned int csmNumOnChamber(const CablingData &map_data, MsgStream &log) const
Returns whether the channel belongs to the first or second mounted CSM card.
ROBToChamberMap m_ROBToMultiLayer
map returning a detector element hashes associated with a given ROD
const ListOfROB & getAllROBId() const
return the ROD id of a given chamber
MezzCardPtr getHedgeHogMapping(uint8_t mezzCardId) const
MuonMDT_CablingMap(const MuonMDT_CablingMap &)=delete
std::vector< MdtTdcOnlSorter > TdcOnlSet
ChamberToROBMap m_chamberToROB
map returning the RODid for a given chamber ID
const OnlToOffMap & getOnlineConvMap() const
Returns the map to convert the online -> offline identifiers.
const OffToOnlMap & getOfflineConvMap() const
Returns hte map to convert the offline -> online identifiers.
std::map< MdtCablingOffData, MdtOffChModule > OffToOnlMap
std::map< uint8_t, std::unique_ptr< MdtMezzanineType > > MezzanineTypes
typedef to implement the list of mezzanine types
MdtCablingData CablingData
bool getOnlineId(CablingData &cabling_data, MsgStream &log) const
return the online id given the offline id
bool addMezanineLayout(std::unique_ptr< MdtMezzanineCard > card, MsgStream &log)
Adds a new mezzanine card mapping.
bool m_2CSM_cham
Switch to check whether the layout has chambers with 2 CSM chips.
const MdtIdHelper * m_mdtIdHelper
Pointer to the MdtIdHelper.
bool getOfflineId(CablingData &cabling_data, MsgStream &log) const
return the offline id given the online id
ChamberToROBMap m_multilayerToROB
map raturning the RODid for a given multi layer ID
std::vector< uint32_t > ListOfROB
bool addChamberToROBMap(const CablingData &cabling_data, MsgStream &log)
private function to add a chamber to the ROD map
std::map< uint32_t, std::vector< IdentifierHash > > ROBToChamberMap
uint32_t getROBId(const IdentifierHash &stationCode, MsgStream &log) const
return the ROD id of a given chamber, given the hash id
std::vector< IdentifierHash > getMultiLayerHashVec(const std::vector< uint32_t > &ROBId_list, MsgStream &log) const
return a vector of HashId lists for a given list of ROD's
std::set< MdtTdcOffSorter, std::less<> > TdcOffSet
bool convert(const CablingData &cabling_data, Identifier &id, bool check_valid=true) const
converts the cabling data into an identifier.
bool addMezzanine(CablingData cabling_data, DataSource source, MsgStream &log)
Add a new fully configured mezzanine card.
bool getStationCode(const CablingData &map_data, IdentifierHash &mdtHashId, MsgStream &log) const
Transforms the identifier to an IdentifierHash corresponding to the module.
MuonMDT_CablingMap & operator=(const MuonMDT_CablingMap &right)=delete
assignment and copy constructor operator (hidden)
std::map< IdentifierHash, uint32_t > ChamberToROBMap
typedef to implement the csm mapping to ROB
MezzCardPtr legacyHedgehogCard(CablingData &cabling, MsgStream &msg) const
In the legacy data format several transformations on the hedgehog layout were applied during the fina...
MdtMezzanineCard::MezzCardPtr MezzCardPtr
bool addMezzanineLine(const int type, const int layer, const int sequence, MsgStream &log)
Add a new line describing a mezzanine type.
bool finalize_init(MsgStream &log)
std::vector< std::unique_ptr< MdtTdcMap > > m_tdcs
std::map< MdtCablingOnData, MdtTdcModule > OnlToOffMap
ListOfROB m_listOfROB
full list of ROBs
bool has2CsmML() const
Returns if the cabling map has found multilayers connected to 2 CSM cards.
bool getMultiLayerCode(const CablingData &map_data, Identifier &multiLayer, IdentifierHash &mdtHashId, MsgStream &log) const
Transforms the identifier to an IdentifierHash corresponding to the multilayer In this case,...
Helper struct to search through the std::set if a conversion from online -> offline is needed.
Definition MdtTdcMap.h:100
Helper struct to group the Mezzanine cards mounted on each multilayer The object provides the followi...
TdcOffSet cards
Mezzanine cards mounted on the chamber.
TdcOffSet::const_iterator begin()
TdcOffSet::const_iterator begin() const
TdcOffSet::const_iterator end()
TdcOffSet::const_iterator end() const
std::array< MdtCablingOnData, 2 > csm
The up to 2 CSMs to which the cards are connected.
The online -> offline conversion needs to treat two cases tdcId && channelId == 0xFF: ** Decode the s...
TdcOnlSet::const_iterator begin() const
TdcOnlSet::const_iterator end() const
TdcOnlSet::const_iterator begin()
TdcOnlSet::const_iterator end()
MsgStream & msg
Definition testRead.cxx:32