CMS 3D CMS Logo

TotemDAQMapping.cc
Go to the documentation of this file.
1 /****************************************************************************
2 *
3 * This is a part of TOTEM offline software.
4 * Authors:
5 * Maciej Wróbel (wroblisko@gmail.com)
6 *
7 ****************************************************************************/
8 
13 
14 using namespace std;
15 
16 void TotemVFATInfo::print(ostream &os, string subSystemName) const {
17  symbolicID.print(os, subSystemName);
18  if (subSystemName != "TotemTiming") {
19  os << ", hw id=0x" << hex << hwID << dec;
20  }
21  os << endl;
22 }
23 
24 //----------------------------------------------------------------------------------------------------
25 
26 std::ostream &operator<<(std::ostream &s, const TotemVFATInfo &vi) {
27  s << vi.symbolicID << ", hw id=0x" << hex << vi.hwID << dec;
28 
29  return s;
30 }
31 
32 //----------------------------------------------------------------------------------------------------
33 
35  auto it = VFATMapping.find(fp);
36  if (it != VFATMapping.end()) {
37  edm::LogWarning("Totem") << "WARNING in DAQMapping::insert > Overwriting entry at " << fp << ". Previous: "
38  << " " << VFATMapping[fp] << ","
39  << " new: "
40  << " " << vi << ". " << endl;
41  }
42 
43  VFATMapping[fp] = vi;
44 }
45 
46 //----------------------------------------------------------------------------------------------------
48  const TotemFramePosition fp1(fp2.getRawPosition());
49  auto it = VFATMapping.find(fp1);
50  if (it != VFATMapping.end()) {
51  edm::LogWarning("Totem") << "WARNING in DAQMapping::insert > Overwriting T2 entry at " << fp2 << ". Previous: "
52  << " " << VFATMapping[fp1] << ","
53  << " new: "
54  << " " << vi << ". " << endl;
55  }
56 
57  VFATMapping[fp1] = vi;
58 }
59 
60 //----------------------------------------------------------------------------------------------------
61 
64  auto iterator = totemTimingChannelMap.find(hwId);
65  if (iterator != totemTimingChannelMap.end())
66  pair = iterator->second;
67  return pair;
68 }
69 
70 //----------------------------------------------------------------------------------------------------
71 
72 void TotemDAQMapping::print(std::ostream &os, std::string subSystemName) const {
73  os << "TotemDAQMapping VFAT mapping" << endl;
74  for (auto &p : VFATMapping) {
75  os << " " << p.first << " -> ";
76  p.second.print(os, subSystemName);
77  }
78 
79  if (subSystemName == "TotemTiming" || subSystemName.empty()) {
80  os << "TotemDAQMapping channel mapping" << endl;
81  for (const auto &p : totemTimingChannelMap) {
82  os << " "
83  << " hw id=0x" << hex << (int)p.first << dec << " plane=" << p.second.plane << " channel=" << p.second.channel
84  << endl;
85  }
86  }
87 }
88 
89 std::ostream &operator<<(std::ostream &os, TotemDAQMapping mapping) {
90  mapping.print(os, "");
91  return os;
92 }
93 
94 //----------------------------------------------------------------------------------------------------
95 
TotemSymbID symbolicID
the symbolic id
void print(std::ostream &os, std::string subSystemName) const
void print(std::ostream &os, std::string subSystemName) const
void insert(const TotemFramePosition &fp, const TotemVFATInfo &vi)
The mapping between FramePosition and VFATInfo.
std::ostream & operator<<(std::ostream &out, const std::tuple< Types... > &value)
Definition: Utilities.h:32
Hw Id mapping for Totem Timing (dynamical mapping in Sampic)
unsigned int getRawPosition() const
the getters and setters below are deprecated
unsigned int hwID
the hardware ID (16 bit)
#define TYPELOOKUP_DATA_REG(_dataclass_)
Definition: typelookup.h:102
Log< level::Warning, false > LogWarning
Contains mappind data related to a VFAT.
const TotemTimingPlaneChannelPair getTimingChannel(const uint8_t hwId) const
Given the hardware ID, returns the corresponding Plane, Channel pair (TotemTimingPlaneChannelPair) ...