File indexing completed on 2024-04-06 12:02:31
0001 #include "CondFormats/RPCObjects/interface/RPCLBLink.h"
0002
0003 #include <ostream>
0004 #include <sstream>
0005
0006 RPCLBLink::RPCLBLink() : id_(0x0) {}
0007
0008 RPCLBLink::RPCLBLink(std::uint32_t const& id) : id_(id) {}
0009
0010 RPCLBLink::RPCLBLink(
0011 int region, int yoke, int sector, int side, int wheelordisk, int fibre, int radial, int linkboard, int connector)
0012 : id_(0x0) {
0013 setRegion(region);
0014 setYoke(yoke);
0015 setSector(sector);
0016 setSide(side);
0017 setWheelOrDisk(wheelordisk);
0018 setFibre(fibre);
0019 setRadial(radial);
0020 setLinkBoard(linkboard);
0021 setConnector(connector);
0022 }
0023
0024 std::uint32_t RPCLBLink::getMask() const {
0025 std::uint32_t mask(0x0);
0026 if (id_ & mask_region_)
0027 mask |= mask_region_;
0028 if (id_ & mask_yoke_)
0029 mask |= mask_yoke_;
0030 if (id_ & mask_sector_)
0031 mask |= mask_sector_;
0032 if (id_ & mask_side_)
0033 mask |= mask_side_;
0034 if (id_ & mask_wheelordisk_)
0035 mask |= mask_wheelordisk_;
0036 if (id_ & mask_fibre_)
0037 mask |= mask_fibre_;
0038 if (id_ & mask_radial_)
0039 mask |= mask_radial_;
0040 if (id_ & mask_linkboard_)
0041 mask |= mask_linkboard_;
0042 if (id_ & mask_connector_)
0043 mask |= mask_connector_;
0044 return mask;
0045 }
0046
0047 std::string RPCLBLink::getName() const {
0048
0049
0050
0051
0052
0053 int region(getRegion()), yoke(getYoke()), linkboard(getLinkBoard()), connector(getConnector());
0054
0055 std::ostringstream oss;
0056 oss << "LB_R";
0057 switch (region) {
0058 case 0:
0059 oss << 'B';
0060 break;
0061 case 1:
0062 oss << 'E';
0063 break;
0064 default:
0065 oss << '*';
0066 break;
0067 }
0068 (yoke > 0 ? oss << '+' << yoke : oss << yoke);
0069
0070 bf_stream(oss << "_S", min_sector_, mask_sector_, pos_sector_);
0071
0072 oss << '_';
0073 switch (region) {
0074 case 0:
0075 oss << 'B';
0076 break;
0077 case 1:
0078 oss << 'E';
0079 break;
0080 default:
0081 oss << '*';
0082 break;
0083 }
0084 switch (getSide()) {
0085 case 0:
0086 oss << 'N';
0087 break;
0088 case 1:
0089 oss << 'M';
0090 break;
0091 case 2:
0092 oss << 'P';
0093 break;
0094 default:
0095 oss << '*';
0096 break;
0097 }
0098 bf_stream(oss, min_wheelordisk_, mask_wheelordisk_, pos_wheelordisk_);
0099 switch (getFibre()) {
0100 case 0:
0101 oss << '1';
0102 break;
0103 case 1:
0104 oss << '2';
0105 break;
0106 case 2:
0107 oss << '3';
0108 break;
0109 case 3:
0110 oss << 'A';
0111 break;
0112 case 4:
0113 oss << 'B';
0114 break;
0115 case 5:
0116 oss << 'C';
0117 break;
0118 case 6:
0119 oss << 'D';
0120 break;
0121 case 7:
0122 oss << 'E';
0123 break;
0124 default:
0125 oss << '*';
0126 break;
0127 }
0128 switch (getRadial()) {
0129 case 0:
0130 oss << "ab";
0131 break;
0132 case 1:
0133 oss << "cd";
0134 break;
0135 default:
0136 oss << "";
0137 break;
0138 }
0139
0140 if (linkboard != wildcard_)
0141 oss << "_CH" << linkboard;
0142
0143 if (connector != wildcard_)
0144 oss << ":" << connector;
0145
0146 return oss.str();
0147 }
0148
0149 std::ostream& operator<<(std::ostream& ostream, RPCLBLink const& link) { return (ostream << link.getName()); }