CMS 3D CMS Logo

DTExpandMap.cc
Go to the documentation of this file.
1 
11 //----------------------
12 // This Class' Header --
13 //----------------------
15 
16 //-------------------------------
17 // Collaborating Class Headers --
18 //-------------------------------
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 #include <iostream>
24 #include <fstream>
25 #include <vector>
26 
27 class DTMapEntry {
28 public:
29  DTMapEntry();
30  DTMapEntry(int xk1, int xk2, int xk3, int xk4, int xk5, int xv1, int xv2, int xv3, int xv4, int xv5, int xv6);
31  ~DTMapEntry();
32  int k1;
33  int k2;
34  int k3;
35  int k4;
36  int k5;
37  int v1;
38  int v2;
39  int v3;
40  int v4;
41  int v5;
42  int v6;
43 };
44 
45 DTMapEntry::DTMapEntry() : k1(0), k2(0), k3(0), k4(0), k5(0), v1(0), v2(0), v3(0), v4(0), v5(0), v6(0) {}
46 
47 DTMapEntry::DTMapEntry(int xk1, int xk2, int xk3, int xk4, int xk5, int xv1, int xv2, int xv3, int xv4, int xv5, int xv6)
48  : k1(xk1), k2(xk2), k3(xk3), k4(xk4), k5(xk5), v1(xv1), v2(xv2), v3(xv3), v4(xv4), v5(xv5), v6(xv6) {}
49 
51 
52 void DTExpandMap::expandSteering(std::ifstream& file) {
53  std::vector<int> key;
54  int k1;
55  int k2;
56  int k3;
57  int k4;
58  int k5;
59  int v1;
60  int v2;
61  int v3;
62  int v4;
63  int v5;
64  int v6;
65 
66  std::vector<DTMapEntry> entryList;
67  while (file >> k1 >> k2 >> k3 >> k4 >> k5 >> v1 >> v2 >> v3 >> v4 >> v5 >> v6) {
68  std::vector<int> key;
69  key.push_back(k1);
70  key.push_back(k2);
71  key.push_back(k3);
72  key.push_back(k4);
73  key.push_back(k5);
74  DTMapEntry currentEntry(k1, k2, k3, k4, k5, v1, v2, v3, v4, v5, v6);
75  entryList.push_back(currentEntry);
76  }
77 
78  int ddu;
79  int ros;
80  int rch;
81  int tdc;
82  int tch;
83  int whe;
84  int sta;
85  int sec;
86  int rob;
87  int qua;
88  int lay;
89  int cel;
90  int mt1;
91  int mi1;
92  int mt2;
93  int mi2;
94  int def;
95  int wha;
96  int sea;
97  std::vector<DTMapEntry>::const_iterator iter = entryList.begin();
98  std::vector<DTMapEntry>::const_iterator iend = entryList.end();
99  std::vector<DTMapEntry>::const_iterator iros = entryList.end();
100  std::vector<DTMapEntry>::const_iterator irob = entryList.end();
101  while (iter != iend) {
102  const DTMapEntry& rosEntry(*iter++);
103  if (rosEntry.k1 > 0x3fffffff)
104  continue;
105  ddu = rosEntry.k1;
106  ros = rosEntry.k2;
107  whe = rosEntry.v1;
108  def = rosEntry.v2;
109  sec = rosEntry.v3;
110  rob = rosEntry.v4;
111  mt1 = rosEntry.v5;
112  mi1 = rosEntry.v6;
113  iros = entryList.begin();
114  while (iros != iend) {
115  wha = whe;
116  sea = sec;
117  const DTMapEntry& rchEntry(*iros++);
118  if ((rchEntry.k1 != mt1) || (rchEntry.k2 != mi1))
119  continue;
120  rch = rchEntry.k3;
121  if (rchEntry.v1 != def)
122  wha = rchEntry.v1;
123  sta = rchEntry.v2;
124  if (rchEntry.v3 != def)
125  sea = rchEntry.v3;
126  rob = rchEntry.v4;
127  mt2 = rchEntry.v5;
128  mi2 = rchEntry.v6;
129  irob = entryList.begin();
130  while (irob != iend) {
131  const DTMapEntry& robEntry(*irob++);
132  if ((robEntry.k1 != mt2) || (robEntry.k2 != mi2))
133  continue;
134  if (robEntry.k3 != rob) {
135  std::cout << "ROB mismatch " << rob << " " << robEntry.k3 << std::endl;
136  }
137  tdc = robEntry.k4;
138  tch = robEntry.k5;
139  qua = robEntry.v4;
140  lay = robEntry.v5;
141  cel = robEntry.v6;
142  std::cout << ddu << " " << ros << " " << rch << " " << tdc << " " << tch << " " << wha << " " << sta << " "
143  << sea << " " << qua << " " << lay << " " << cel << std::endl;
144  }
145  }
146  }
147 
148  return;
149 }
int def(FILE *, FILE *, int)
static void expandSteering(std::ifstream &file)
Definition: DTExpandMap.cc:52