File indexing completed on 2024-04-06 12:10:47
0001 #ifndef EventFilter_L1TRawToDigi_Omtf_LinkMappingRpc_H
0002 #define EventFilter_L1TRawToDigi_Omtf_LinkMappingRpc_H
0003
0004 #include <fstream>
0005 #include <string>
0006 #include <utility>
0007 #include <vector>
0008 #include <map>
0009
0010 #include "EventFilter/L1TRawToDigi/interface/OmtfEleIndex.h"
0011 #include "CondFormats/RPCObjects/interface/LinkBoardElectronicIndex.h"
0012 #include "CondFormats/RPCObjects/interface/RPCAMCLinkMap.h"
0013
0014 class RPCReadOutMapping;
0015
0016 namespace omtf {
0017
0018 class RpcLinkMap;
0019
0020 typedef std::map<EleIndex, LinkBoardElectronicIndex> MapEleIndex2LBIndex;
0021 MapEleIndex2LBIndex translateOmtf2Pact(const RpcLinkMap& omtfLnks, const RPCReadOutMapping* pactCabling);
0022
0023 struct lessLinkBoardElectronicIndex {
0024 bool operator()(const LinkBoardElectronicIndex& o1, const LinkBoardElectronicIndex& o2) const;
0025 };
0026 typedef std::map<LinkBoardElectronicIndex, std::pair<EleIndex, EleIndex>, lessLinkBoardElectronicIndex>
0027 MapLBIndex2EleIndex;
0028 MapLBIndex2EleIndex translatePact2Omtf(const RpcLinkMap& omtfLnks, const RPCReadOutMapping* pactCabling);
0029
0030 class RpcLinkMap {
0031 public:
0032 RpcLinkMap() {}
0033
0034 void init(const RPCAMCLinkMap& es);
0035
0036 void init(const std::string& fName);
0037
0038 const std::string& lbName(const std::string& board, unsigned int link) const {
0039 return link2lbName.at(board).at(link);
0040 }
0041
0042 unsigned int link(const std::string& board, const std::string& lbName) const {
0043 return lbName2link.at(board).at(lbName);
0044 }
0045
0046 std::vector<EleIndex> omtfEleIndex(const std::string& lbName) const;
0047
0048 private:
0049 std::map<std::string, std::map<unsigned int, std::string> > link2lbName;
0050 std::map<std::string, std::map<std::string, unsigned int> > lbName2link;
0051 std::map<std::string, std::vector<EleIndex> > lbName2OmtfIndex;
0052 };
0053
0054 }
0055 #endif