File indexing completed on 2024-04-06 12:02:29
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "CondFormats/PPSObjects/interface/TotemDAQMapping.h"
0010 #include "DataFormats/CTPPSDetId/interface/CTPPSDetId.h"
0011 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0012 #include "FWCore/Utilities/interface/typelookup.h"
0013
0014 using namespace std;
0015
0016 void TotemVFATInfo::print(ostream &os, string subSystemName) const {
0017 symbolicID.print(os, subSystemName);
0018 if (subSystemName != "TotemTiming") {
0019 os << ", hw id=0x" << hex << hwID << dec;
0020 }
0021 os << endl;
0022 }
0023
0024
0025
0026 std::ostream &operator<<(std::ostream &s, const TotemVFATInfo &vi) {
0027 s << vi.symbolicID << ", hw id=0x" << hex << vi.hwID << dec;
0028
0029 return s;
0030 }
0031
0032
0033
0034 void TotemDAQMapping::insert(const TotemFramePosition &fp, const TotemVFATInfo &vi) {
0035 auto it = VFATMapping.find(fp);
0036 if (it != VFATMapping.end()) {
0037 edm::LogWarning("Totem") << "WARNING in DAQMapping::insert > Overwriting entry at " << fp << ". Previous: "
0038 << " " << VFATMapping[fp] << ","
0039 << " new: "
0040 << " " << vi << ". " << endl;
0041 }
0042
0043 VFATMapping[fp] = vi;
0044 }
0045
0046
0047 void TotemDAQMapping::insert(const TotemT2FramePosition &fp2, const TotemVFATInfo &vi) {
0048 const TotemFramePosition fp1(fp2.getRawPosition());
0049 auto it = VFATMapping.find(fp1);
0050 if (it != VFATMapping.end()) {
0051 edm::LogWarning("Totem") << "WARNING in DAQMapping::insert > Overwriting T2 entry at " << fp2 << ". Previous: "
0052 << " " << VFATMapping[fp1] << ","
0053 << " new: "
0054 << " " << vi << ". " << endl;
0055 }
0056
0057 VFATMapping[fp1] = vi;
0058 }
0059
0060
0061
0062 const TotemDAQMapping::TotemTimingPlaneChannelPair TotemDAQMapping::getTimingChannel(const uint8_t hwId) const {
0063 TotemTimingPlaneChannelPair pair;
0064 auto iterator = totemTimingChannelMap.find(hwId);
0065 if (iterator != totemTimingChannelMap.end())
0066 pair = iterator->second;
0067 return pair;
0068 }
0069
0070
0071
0072 void TotemDAQMapping::print(std::ostream &os, std::string subSystemName) const {
0073 os << "TotemDAQMapping VFAT mapping" << endl;
0074 for (auto &p : VFATMapping) {
0075 os << " " << p.first << " -> ";
0076 p.second.print(os, subSystemName);
0077 }
0078
0079 if (subSystemName == "TotemTiming" || subSystemName.empty()) {
0080 os << "TotemDAQMapping channel mapping" << endl;
0081 for (const auto &p : totemTimingChannelMap) {
0082 os << " "
0083 << " hw id=0x" << hex << (int)p.first << dec << " plane=" << p.second.plane << " channel=" << p.second.channel
0084 << endl;
0085 }
0086 }
0087 }
0088
0089 std::ostream &operator<<(std::ostream &os, TotemDAQMapping mapping) {
0090 mapping.print(os, "");
0091 return os;
0092 }
0093
0094
0095
0096 TYPELOOKUP_DATA_REG(TotemDAQMapping);