CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 //---------------
22 // C++ Headers --
23 //---------------
24 #include <iostream>
25 #include <fstream>
26 #include <vector>
27 
28 class DTMapEntry {
29 
30  public:
31 
32  DTMapEntry();
33  DTMapEntry( int xk1, int xk2, int xk3, int xk4, int xk5,
34  int xv1, int xv2, int xv3, int xv4, int xv5, int xv6 );
35  ~DTMapEntry();
36  int k1;
37  int k2;
38  int k3;
39  int k4;
40  int k5;
41  int v1;
42  int v2;
43  int v3;
44  int v4;
45  int v5;
46  int v6;
47 
48 };
49 
51  k1( 0 ),
52  k2( 0 ),
53  k3( 0 ),
54  k4( 0 ),
55  k5( 0 ),
56  v1( 0 ),
57  v2( 0 ),
58  v3( 0 ),
59  v4( 0 ),
60  v5( 0 ),
61  v6( 0 ) {
62 }
63 
64 DTMapEntry::DTMapEntry( int xk1, int xk2, int xk3, int xk4, int xk5,
65  int xv1, int xv2, int xv3, int xv4, int xv5,
66  int xv6 ):
67  k1( xk1 ),
68  k2( xk2 ),
69  k3( xk3 ),
70  k4( xk4 ),
71  k5( xk5 ),
72  v1( xv1 ),
73  v2( xv2 ),
74  v3( xv3 ),
75  v4( xv4 ),
76  v5( xv5 ),
77  v6( xv6 ) {
78 }
79 
81 }
82 
83 void DTExpandMap::expandSteering( std::ifstream& file ) {
84 
85  std::vector<int> key;
86  int k1;
87  int k2;
88  int k3;
89  int k4;
90  int k5;
91  int v1;
92  int v2;
93  int v3;
94  int v4;
95  int v5;
96  int v6;
97 
98  std::vector<DTMapEntry> entryList;
99  while ( file >> k1 >> k2 >> k3 >> k4 >> k5
100  >> v1 >> v2 >> v3 >> v4 >> v5 >> v6 ) {
101  std::vector<int> key;
102  key.push_back( k1 );
103  key.push_back( k2 );
104  key.push_back( k3 );
105  key.push_back( k4 );
106  key.push_back( k5 );
107  DTMapEntry currentEntry( k1, k2, k3, k4, k5,
108  v1, v2, v3, v4, v5, v6 );
109  entryList.push_back( currentEntry );
110  }
111 
112  int ddu;
113  int ros;
114  int rch;
115  int tdc;
116  int tch;
117  int whe;
118  int sta;
119  int sec;
120  int rob;
121  int qua;
122  int lay;
123  int cel;
124  int mt1;
125  int mi1;
126  int mt2;
127  int mi2;
128  int def;
129  int wha;
130  int sea;
131  std::vector<DTMapEntry>::const_iterator iter = entryList.begin();
132  std::vector<DTMapEntry>::const_iterator iend = entryList.end();
133  std::vector<DTMapEntry>::const_iterator iros = entryList.end();
134  std::vector<DTMapEntry>::const_iterator irob = entryList.end();
135  while ( iter != iend ) {
136  const DTMapEntry& rosEntry( *iter++ );
137  if ( rosEntry.k1 > 0x3fffffff ) continue;
138  ddu = rosEntry.k1;
139  ros = rosEntry.k2;
140  whe = rosEntry.v1;
141  def = rosEntry.v2;
142  sec = rosEntry.v3;
143  rob = rosEntry.v4;
144  mt1 = rosEntry.v5;
145  mi1 = rosEntry.v6;
146  iros = entryList.begin();
147  while ( iros != iend ) {
148  wha = whe;
149  sea = sec;
150  const DTMapEntry& rchEntry( *iros++ );
151  if ( ( rchEntry.k1 != mt1 ) ||
152  ( rchEntry.k2 != mi1 ) ) continue;
153  rch = rchEntry.k3;
154  if ( rchEntry.v1 != def ) wha = rchEntry.v1;
155  sta = rchEntry.v2;
156  if ( rchEntry.v3 != def ) sea = rchEntry.v3;
157  rob = rchEntry.v4;
158  mt2 = rchEntry.v5;
159  mi2 = rchEntry.v6;
160  irob = entryList.begin();
161  while ( irob != iend ) {
162  const DTMapEntry& robEntry( *irob++ );
163  if ( ( robEntry.k1 != mt2 ) ||
164  ( robEntry.k2 != mi2 ) ) continue;
165  if ( robEntry.k3 != rob ) {
166  std::cout << "ROB mismatch " << rob << " "
167  << robEntry.k3 << std::endl;
168  }
169  tdc = robEntry.k4;
170  tch = robEntry.k5;
171  qua = robEntry.v4;
172  lay = robEntry.v5;
173  cel = robEntry.v6;
174  std::cout << ddu << " "
175  << ros << " "
176  << rch << " "
177  << tdc << " "
178  << tch << " "
179  << wha << " "
180  << sta << " "
181  << sea << " "
182  << qua << " "
183  << lay << " "
184  << cel << std::endl;
185  }
186  }
187  }
188 
189  return;
190 
191 }
192 
193 
static void expandSteering(std::ifstream &file)
Definition: DTExpandMap.cc:83
list key
Definition: combine.py:13
tuple cout
Definition: gather_cfg.py:121
JetCorrectorParameters::Definitions def
Definition: classes.h:10