File indexing completed on 2024-04-06 12:02:31
0001 #include "CondFormats/RPCObjects/interface/RPCAMCLink.h"
0002
0003 #include <ostream>
0004 #include <sstream>
0005
0006 RPCAMCLink::RPCAMCLink() : id_(0x0) {}
0007
0008 RPCAMCLink::RPCAMCLink(std::uint32_t const& id) : id_(id) {}
0009
0010 RPCAMCLink::RPCAMCLink(int fed, int amcnumber, int amcinput) : id_(0x0) {
0011 setFED(fed);
0012 setAMCNumber(amcnumber);
0013 setAMCInput(amcinput);
0014 }
0015
0016 std::uint32_t RPCAMCLink::getMask() const {
0017 std::uint32_t mask(0x0);
0018 if (id_ & mask_fed_)
0019 mask |= mask_fed_;
0020 if (id_ & mask_amcnumber_)
0021 mask |= mask_amcnumber_;
0022 if (id_ & mask_amcinput_)
0023 mask |= mask_amcinput_;
0024 return mask;
0025 }
0026
0027 std::string RPCAMCLink::getName() const {
0028 std::ostringstream oss;
0029 oss << "RPCAMCLink_";
0030 bf_stream(oss, min_fed_, mask_fed_, pos_fed_);
0031 if (id_ & (mask_amcnumber_ | mask_amcinput_)) {
0032 bf_stream(oss << '_', min_amcnumber_, mask_amcnumber_, pos_amcnumber_);
0033 if (id_ & mask_amcinput_) {
0034 bf_stream(oss << '_', min_amcinput_, mask_amcinput_, pos_amcinput_);
0035 }
0036 }
0037 return oss.str();
0038 }
0039
0040 std::ostream& operator<<(std::ostream& ostream, RPCAMCLink const& link) { return (ostream << link.getName()); }