CMS 3D CMS Logo

DTPosNeg.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2008/08/15 13:46:37 $
5  * $Revision: 1.1 $
6  * \author Paolo Ronchese INFN Padova
7  *
8  */
9 
10 //-----------------------
11 // This Class' Header --
12 //-----------------------
14 
15 //-------------------------------
16 // Collaborating Class Headers --
17 //-------------------------------
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 #include <iostream>
24 
25 //-------------------
26 // Initializations --
27 //-------------------
28 bool DTPosNeg::initRequest = true;
29 std::map<int, int> DTPosNeg::geomMap;
30 
31 //----------------
32 // Constructors --
33 //----------------
35 
36 //--------------
37 // Destructor --
38 //--------------
40 
41 //--------------
42 // Operations --
43 //--------------
44 /*
45 DTPosNegCompare::operator()( const DTCCBId& idl,
46  const DTCCBId& idr ) {
47 
48 
49 }
50 */
51 
53  if (initRequest)
54  fillMap();
55  std::map<int, int>::const_iterator iter = geomMap.begin();
56  std::map<int, int>::const_iterator iend = geomMap.end();
57  while (iter != iend) {
58  const std::pair<int, int>& entry = *iter++;
59  int cha = entry.first;
60  int pnt = entry.second;
61  int whe;
62  int sec;
63  int sta;
64  decode(cha, whe, sec, sta);
65  int p_n;
66  int c_t;
67  decode(pnt, p_n, c_t);
68  if (whe >= 0)
69  std::cout << " ";
70  std::cout << whe << " ";
71  if (sec < 10)
72  std::cout << " ";
73  std::cout << sec << " " << sta << " " << p_n << " " << c_t << std::endl;
74  int pnc = getPN(whe, sec, sta);
75  int ctc = getCT(whe, sec, sta);
76  if ((pnc != p_n) || (ctc != c_t))
77  std::cout << "****************** " << pnc << " " << ctc << std::endl;
78  }
79  return;
80 }
81 
82 int DTPosNeg::getPN(int whe, int sec, int sta) {
83  int p_n;
84  int c_t;
85  decode(getData(whe, sec, sta), p_n, c_t);
86  return p_n;
87 }
88 
89 int DTPosNeg::getPN(const DTChamberId& cha) { return getPN(cha.wheel(), cha.sector(), cha.station()); }
90 
91 int DTPosNeg::getCT(int whe, int sec, int sta) {
92  int p_n;
93  int c_t;
94  decode(getData(whe, sec, sta), p_n, c_t);
95  return c_t;
96 }
97 
98 int DTPosNeg::getCT(const DTChamberId& cha) { return getCT(cha.wheel(), cha.sector(), cha.station()); }
99 
101  //std::cout << "DTPosNeg::fillMap()" << std::endl;
102  geomMap.clear();
103  // DTChamberId().rawId() ,
104 
105  // ---
106  geomMap.insert(std::pair<int, int>(idCode(-2, 1, 1), pnCode(1, 1)));
107  geomMap.insert(std::pair<int, int>(idCode(-2, 1, 2), pnCode(2, 2)));
108  geomMap.insert(std::pair<int, int>(idCode(-2, 1, 3), pnCode(0, 3)));
109  geomMap.insert(std::pair<int, int>(idCode(-2, 1, 4), pnCode(2, 4)));
110  geomMap.insert(std::pair<int, int>(idCode(-2, 2, 1), pnCode(1, 1)));
111  geomMap.insert(std::pair<int, int>(idCode(-2, 2, 2), pnCode(2, 2)));
112  geomMap.insert(std::pair<int, int>(idCode(-2, 2, 3), pnCode(0, 3)));
113  geomMap.insert(std::pair<int, int>(idCode(-2, 2, 4), pnCode(2, 4)));
114  geomMap.insert(std::pair<int, int>(idCode(-2, 3, 1), pnCode(1, 1)));
115  geomMap.insert(std::pair<int, int>(idCode(-2, 3, 2), pnCode(2, 2)));
116  geomMap.insert(std::pair<int, int>(idCode(-2, 3, 3), pnCode(0, 3)));
117  geomMap.insert(std::pair<int, int>(idCode(-2, 3, 4), pnCode(2, 4)));
118  geomMap.insert(std::pair<int, int>(idCode(-2, 4, 1), pnCode(1, 1)));
119  geomMap.insert(std::pair<int, int>(idCode(-2, 4, 2), pnCode(2, 2)));
120  geomMap.insert(std::pair<int, int>(idCode(-2, 4, 3), pnCode(0, 3)));
121  geomMap.insert(std::pair<int, int>(idCode(-2, 4, 4), pnCode(0, 6)));
122  geomMap.insert(std::pair<int, int>(idCode(-2, 5, 1), pnCode(1, 1)));
123  geomMap.insert(std::pair<int, int>(idCode(-2, 5, 2), pnCode(2, 2)));
124  geomMap.insert(std::pair<int, int>(idCode(-2, 5, 3), pnCode(0, 3)));
125  geomMap.insert(std::pair<int, int>(idCode(-2, 5, 4), pnCode(1, 4)));
126  geomMap.insert(std::pair<int, int>(idCode(-2, 6, 1), pnCode(1, 1)));
127  geomMap.insert(std::pair<int, int>(idCode(-2, 6, 2), pnCode(2, 2)));
128  geomMap.insert(std::pair<int, int>(idCode(-2, 6, 3), pnCode(0, 3)));
129  geomMap.insert(std::pair<int, int>(idCode(-2, 6, 4), pnCode(1, 4)));
130  geomMap.insert(std::pair<int, int>(idCode(-2, 7, 1), pnCode(1, 1)));
131  geomMap.insert(std::pair<int, int>(idCode(-2, 7, 2), pnCode(2, 2)));
132  geomMap.insert(std::pair<int, int>(idCode(-2, 7, 3), pnCode(0, 3)));
133  geomMap.insert(std::pair<int, int>(idCode(-2, 7, 4), pnCode(1, 4)));
134  geomMap.insert(std::pair<int, int>(idCode(-2, 8, 1), pnCode(1, 1)));
135  geomMap.insert(std::pair<int, int>(idCode(-2, 8, 2), pnCode(2, 2)));
136  geomMap.insert(std::pair<int, int>(idCode(-2, 8, 3), pnCode(0, 3)));
137  geomMap.insert(std::pair<int, int>(idCode(-2, 8, 4), pnCode(1, 4)));
138  geomMap.insert(std::pair<int, int>(idCode(-2, 9, 1), pnCode(1, 1)));
139  geomMap.insert(std::pair<int, int>(idCode(-2, 9, 2), pnCode(2, 2)));
140  geomMap.insert(std::pair<int, int>(idCode(-2, 9, 3), pnCode(0, 3)));
141  geomMap.insert(std::pair<int, int>(idCode(-2, 9, 4), pnCode(0, 5)));
142  geomMap.insert(std::pair<int, int>(idCode(-2, 10, 1), pnCode(1, 1)));
143  geomMap.insert(std::pair<int, int>(idCode(-2, 10, 2), pnCode(2, 2)));
144  geomMap.insert(std::pair<int, int>(idCode(-2, 10, 3), pnCode(0, 3)));
145  geomMap.insert(std::pair<int, int>(idCode(-2, 10, 4), pnCode(2, 7)));
146  geomMap.insert(std::pair<int, int>(idCode(-2, 11, 1), pnCode(1, 1)));
147  geomMap.insert(std::pair<int, int>(idCode(-2, 11, 2), pnCode(2, 2)));
148  geomMap.insert(std::pair<int, int>(idCode(-2, 11, 3), pnCode(0, 3)));
149  geomMap.insert(std::pair<int, int>(idCode(-2, 11, 4), pnCode(0, 5)));
150  geomMap.insert(std::pair<int, int>(idCode(-2, 12, 1), pnCode(1, 1)));
151  geomMap.insert(std::pair<int, int>(idCode(-2, 12, 2), pnCode(2, 2)));
152  geomMap.insert(std::pair<int, int>(idCode(-2, 12, 3), pnCode(0, 3)));
153  geomMap.insert(std::pair<int, int>(idCode(-2, 12, 4), pnCode(2, 4)));
154  geomMap.insert(std::pair<int, int>(idCode(-2, 13, 4), pnCode(0, 6)));
155  geomMap.insert(std::pair<int, int>(idCode(-2, 14, 4), pnCode(1, 7)));
156  geomMap.insert(std::pair<int, int>(idCode(-1, 1, 1), pnCode(1, 1)));
157  geomMap.insert(std::pair<int, int>(idCode(-1, 1, 2), pnCode(2, 2)));
158  geomMap.insert(std::pair<int, int>(idCode(-1, 1, 3), pnCode(0, 3)));
159  geomMap.insert(std::pair<int, int>(idCode(-1, 1, 4), pnCode(2, 4)));
160  geomMap.insert(std::pair<int, int>(idCode(-1, 2, 1), pnCode(1, 1)));
161  geomMap.insert(std::pair<int, int>(idCode(-1, 2, 2), pnCode(2, 2)));
162  geomMap.insert(std::pair<int, int>(idCode(-1, 2, 3), pnCode(0, 3)));
163  geomMap.insert(std::pair<int, int>(idCode(-1, 2, 4), pnCode(2, 4)));
164  geomMap.insert(std::pair<int, int>(idCode(-1, 3, 1), pnCode(1, 1)));
165  geomMap.insert(std::pair<int, int>(idCode(-1, 3, 2), pnCode(2, 2)));
166  geomMap.insert(std::pair<int, int>(idCode(-1, 3, 3), pnCode(0, 3)));
167  geomMap.insert(std::pair<int, int>(idCode(-1, 3, 4), pnCode(2, 4)));
168  geomMap.insert(std::pair<int, int>(idCode(-1, 4, 1), pnCode(1, 1)));
169  geomMap.insert(std::pair<int, int>(idCode(-1, 4, 2), pnCode(2, 2)));
170  geomMap.insert(std::pair<int, int>(idCode(-1, 4, 3), pnCode(0, 3)));
171  geomMap.insert(std::pair<int, int>(idCode(-1, 4, 4), pnCode(0, 6)));
172  geomMap.insert(std::pair<int, int>(idCode(-1, 5, 1), pnCode(1, 1)));
173  geomMap.insert(std::pair<int, int>(idCode(-1, 5, 2), pnCode(2, 2)));
174  geomMap.insert(std::pair<int, int>(idCode(-1, 5, 3), pnCode(0, 3)));
175  geomMap.insert(std::pair<int, int>(idCode(-1, 5, 4), pnCode(1, 4)));
176  geomMap.insert(std::pair<int, int>(idCode(-1, 6, 1), pnCode(1, 1)));
177  geomMap.insert(std::pair<int, int>(idCode(-1, 6, 2), pnCode(2, 2)));
178  geomMap.insert(std::pair<int, int>(idCode(-1, 6, 3), pnCode(0, 3)));
179  geomMap.insert(std::pair<int, int>(idCode(-1, 6, 4), pnCode(1, 4)));
180  geomMap.insert(std::pair<int, int>(idCode(-1, 7, 1), pnCode(1, 1)));
181  geomMap.insert(std::pair<int, int>(idCode(-1, 7, 2), pnCode(2, 2)));
182  geomMap.insert(std::pair<int, int>(idCode(-1, 7, 3), pnCode(0, 3)));
183  geomMap.insert(std::pair<int, int>(idCode(-1, 7, 4), pnCode(1, 4)));
184  geomMap.insert(std::pair<int, int>(idCode(-1, 8, 1), pnCode(1, 1)));
185  geomMap.insert(std::pair<int, int>(idCode(-1, 8, 2), pnCode(2, 2)));
186  geomMap.insert(std::pair<int, int>(idCode(-1, 8, 3), pnCode(0, 3)));
187  geomMap.insert(std::pair<int, int>(idCode(-1, 8, 4), pnCode(1, 4)));
188  geomMap.insert(std::pair<int, int>(idCode(-1, 9, 1), pnCode(1, 1)));
189  geomMap.insert(std::pair<int, int>(idCode(-1, 9, 2), pnCode(2, 2)));
190  geomMap.insert(std::pair<int, int>(idCode(-1, 9, 3), pnCode(0, 3)));
191  geomMap.insert(std::pair<int, int>(idCode(-1, 9, 4), pnCode(0, 5)));
192  geomMap.insert(std::pair<int, int>(idCode(-1, 10, 1), pnCode(1, 1)));
193  geomMap.insert(std::pair<int, int>(idCode(-1, 10, 2), pnCode(2, 2)));
194  geomMap.insert(std::pair<int, int>(idCode(-1, 10, 3), pnCode(0, 3)));
195  geomMap.insert(std::pair<int, int>(idCode(-1, 10, 4), pnCode(2, 7)));
196  geomMap.insert(std::pair<int, int>(idCode(-1, 11, 1), pnCode(1, 1)));
197  geomMap.insert(std::pair<int, int>(idCode(-1, 11, 2), pnCode(2, 2)));
198  geomMap.insert(std::pair<int, int>(idCode(-1, 11, 3), pnCode(0, 3)));
199  geomMap.insert(std::pair<int, int>(idCode(-1, 11, 4), pnCode(0, 5)));
200  geomMap.insert(std::pair<int, int>(idCode(-1, 12, 1), pnCode(1, 1)));
201  geomMap.insert(std::pair<int, int>(idCode(-1, 12, 2), pnCode(2, 2)));
202  geomMap.insert(std::pair<int, int>(idCode(-1, 12, 3), pnCode(0, 3)));
203  geomMap.insert(std::pair<int, int>(idCode(-1, 12, 4), pnCode(2, 4)));
204  geomMap.insert(std::pair<int, int>(idCode(-1, 13, 4), pnCode(0, 6)));
205  geomMap.insert(std::pair<int, int>(idCode(-1, 14, 4), pnCode(1, 7)));
206  geomMap.insert(std::pair<int, int>(idCode(0, 1, 1), pnCode(1, 1)));
207  geomMap.insert(std::pair<int, int>(idCode(0, 1, 2), pnCode(2, 2)));
208  geomMap.insert(std::pair<int, int>(idCode(0, 1, 3), pnCode(0, 3)));
209  geomMap.insert(std::pair<int, int>(idCode(0, 1, 4), pnCode(2, 4)));
210  geomMap.insert(std::pair<int, int>(idCode(0, 2, 1), pnCode(2, 1)));
211  geomMap.insert(std::pair<int, int>(idCode(0, 2, 2), pnCode(1, 2)));
212  geomMap.insert(std::pair<int, int>(idCode(0, 2, 3), pnCode(0, 3)));
213  geomMap.insert(std::pair<int, int>(idCode(0, 2, 4), pnCode(1, 4)));
214  geomMap.insert(std::pair<int, int>(idCode(0, 3, 1), pnCode(2, 1)));
215  geomMap.insert(std::pair<int, int>(idCode(0, 3, 2), pnCode(1, 2)));
216  geomMap.insert(std::pair<int, int>(idCode(0, 3, 3), pnCode(0, 3)));
217  geomMap.insert(std::pair<int, int>(idCode(0, 3, 4), pnCode(1, 4)));
218  geomMap.insert(std::pair<int, int>(idCode(0, 4, 1), pnCode(1, 1)));
219  geomMap.insert(std::pair<int, int>(idCode(0, 4, 2), pnCode(2, 2)));
220  geomMap.insert(std::pair<int, int>(idCode(0, 4, 3), pnCode(0, 3)));
221  geomMap.insert(std::pair<int, int>(idCode(0, 4, 4), pnCode(0, 6)));
222  geomMap.insert(std::pair<int, int>(idCode(0, 5, 1), pnCode(1, 1)));
223  geomMap.insert(std::pair<int, int>(idCode(0, 5, 2), pnCode(2, 2)));
224  geomMap.insert(std::pair<int, int>(idCode(0, 5, 3), pnCode(0, 3)));
225  geomMap.insert(std::pair<int, int>(idCode(0, 5, 4), pnCode(1, 4)));
226  geomMap.insert(std::pair<int, int>(idCode(0, 6, 1), pnCode(2, 1)));
227  geomMap.insert(std::pair<int, int>(idCode(0, 6, 2), pnCode(1, 2)));
228  geomMap.insert(std::pair<int, int>(idCode(0, 6, 3), pnCode(0, 3)));
229  geomMap.insert(std::pair<int, int>(idCode(0, 6, 4), pnCode(2, 4)));
230  geomMap.insert(std::pair<int, int>(idCode(0, 7, 1), pnCode(2, 1)));
231  geomMap.insert(std::pair<int, int>(idCode(0, 7, 2), pnCode(1, 2)));
232  geomMap.insert(std::pair<int, int>(idCode(0, 7, 3), pnCode(0, 3)));
233  geomMap.insert(std::pair<int, int>(idCode(0, 7, 4), pnCode(2, 4)));
234  geomMap.insert(std::pair<int, int>(idCode(0, 8, 1), pnCode(1, 1)));
235  geomMap.insert(std::pair<int, int>(idCode(0, 8, 2), pnCode(2, 2)));
236  geomMap.insert(std::pair<int, int>(idCode(0, 8, 3), pnCode(0, 3)));
237  geomMap.insert(std::pair<int, int>(idCode(0, 8, 4), pnCode(1, 4)));
238  geomMap.insert(std::pair<int, int>(idCode(0, 9, 1), pnCode(1, 1)));
239  geomMap.insert(std::pair<int, int>(idCode(0, 9, 2), pnCode(2, 2)));
240  geomMap.insert(std::pair<int, int>(idCode(0, 9, 3), pnCode(0, 3)));
241  geomMap.insert(std::pair<int, int>(idCode(0, 9, 4), pnCode(0, 5)));
242  geomMap.insert(std::pair<int, int>(idCode(0, 10, 1), pnCode(2, 1)));
243  geomMap.insert(std::pair<int, int>(idCode(0, 10, 2), pnCode(1, 2)));
244  geomMap.insert(std::pair<int, int>(idCode(0, 10, 3), pnCode(0, 3)));
245  geomMap.insert(std::pair<int, int>(idCode(0, 10, 4), pnCode(2, 7)));
246  geomMap.insert(std::pair<int, int>(idCode(0, 11, 1), pnCode(2, 1)));
247  geomMap.insert(std::pair<int, int>(idCode(0, 11, 2), pnCode(1, 2)));
248  geomMap.insert(std::pair<int, int>(idCode(0, 11, 3), pnCode(0, 3)));
249  geomMap.insert(std::pair<int, int>(idCode(0, 11, 4), pnCode(0, 5)));
250  geomMap.insert(std::pair<int, int>(idCode(0, 12, 1), pnCode(1, 1)));
251  geomMap.insert(std::pair<int, int>(idCode(0, 12, 2), pnCode(2, 2)));
252  geomMap.insert(std::pair<int, int>(idCode(0, 12, 3), pnCode(0, 3)));
253  geomMap.insert(std::pair<int, int>(idCode(0, 12, 4), pnCode(2, 4)));
254  geomMap.insert(std::pair<int, int>(idCode(0, 13, 4), pnCode(0, 6)));
255  geomMap.insert(std::pair<int, int>(idCode(0, 14, 4), pnCode(1, 7)));
256  geomMap.insert(std::pair<int, int>(idCode(1, 1, 1), pnCode(2, 1)));
257  geomMap.insert(std::pair<int, int>(idCode(1, 1, 2), pnCode(1, 2)));
258  geomMap.insert(std::pair<int, int>(idCode(1, 1, 3), pnCode(0, 3)));
259  geomMap.insert(std::pair<int, int>(idCode(1, 1, 4), pnCode(1, 4)));
260  geomMap.insert(std::pair<int, int>(idCode(1, 2, 1), pnCode(2, 1)));
261  geomMap.insert(std::pair<int, int>(idCode(1, 2, 2), pnCode(1, 2)));
262  geomMap.insert(std::pair<int, int>(idCode(1, 2, 3), pnCode(0, 3)));
263  geomMap.insert(std::pair<int, int>(idCode(1, 2, 4), pnCode(1, 4)));
264  geomMap.insert(std::pair<int, int>(idCode(1, 3, 1), pnCode(2, 1)));
265  geomMap.insert(std::pair<int, int>(idCode(1, 3, 2), pnCode(1, 2)));
266  geomMap.insert(std::pair<int, int>(idCode(1, 3, 3), pnCode(0, 3)));
267  geomMap.insert(std::pair<int, int>(idCode(1, 3, 4), pnCode(1, 4)));
268  geomMap.insert(std::pair<int, int>(idCode(1, 4, 1), pnCode(2, 1)));
269  geomMap.insert(std::pair<int, int>(idCode(1, 4, 2), pnCode(1, 2)));
270  geomMap.insert(std::pair<int, int>(idCode(1, 4, 3), pnCode(0, 3)));
271  geomMap.insert(std::pair<int, int>(idCode(1, 4, 4), pnCode(0, 6)));
272  geomMap.insert(std::pair<int, int>(idCode(1, 5, 1), pnCode(2, 1)));
273  geomMap.insert(std::pair<int, int>(idCode(1, 5, 2), pnCode(1, 2)));
274  geomMap.insert(std::pair<int, int>(idCode(1, 5, 3), pnCode(0, 3)));
275  geomMap.insert(std::pair<int, int>(idCode(1, 5, 4), pnCode(2, 4)));
276  geomMap.insert(std::pair<int, int>(idCode(1, 6, 1), pnCode(2, 1)));
277  geomMap.insert(std::pair<int, int>(idCode(1, 6, 2), pnCode(1, 2)));
278  geomMap.insert(std::pair<int, int>(idCode(1, 6, 3), pnCode(0, 3)));
279  geomMap.insert(std::pair<int, int>(idCode(1, 6, 4), pnCode(2, 4)));
280  geomMap.insert(std::pair<int, int>(idCode(1, 7, 1), pnCode(2, 1)));
281  geomMap.insert(std::pair<int, int>(idCode(1, 7, 2), pnCode(1, 2)));
282  geomMap.insert(std::pair<int, int>(idCode(1, 7, 3), pnCode(0, 3)));
283  geomMap.insert(std::pair<int, int>(idCode(1, 7, 4), pnCode(2, 4)));
284  geomMap.insert(std::pair<int, int>(idCode(1, 8, 1), pnCode(2, 1)));
285  geomMap.insert(std::pair<int, int>(idCode(1, 8, 2), pnCode(1, 2)));
286  geomMap.insert(std::pair<int, int>(idCode(1, 8, 3), pnCode(0, 3)));
287  geomMap.insert(std::pair<int, int>(idCode(1, 8, 4), pnCode(1, 4)));
288  geomMap.insert(std::pair<int, int>(idCode(1, 9, 1), pnCode(2, 1)));
289  geomMap.insert(std::pair<int, int>(idCode(1, 9, 2), pnCode(1, 2)));
290  geomMap.insert(std::pair<int, int>(idCode(1, 9, 3), pnCode(0, 3)));
291  geomMap.insert(std::pair<int, int>(idCode(1, 9, 4), pnCode(0, 5)));
292  geomMap.insert(std::pair<int, int>(idCode(1, 10, 1), pnCode(2, 1)));
293  geomMap.insert(std::pair<int, int>(idCode(1, 10, 2), pnCode(1, 2)));
294  geomMap.insert(std::pair<int, int>(idCode(1, 10, 3), pnCode(0, 3)));
295  geomMap.insert(std::pair<int, int>(idCode(1, 10, 4), pnCode(2, 7)));
296  geomMap.insert(std::pair<int, int>(idCode(1, 11, 1), pnCode(2, 1)));
297  geomMap.insert(std::pair<int, int>(idCode(1, 11, 2), pnCode(1, 2)));
298  geomMap.insert(std::pair<int, int>(idCode(1, 11, 3), pnCode(0, 3)));
299  geomMap.insert(std::pair<int, int>(idCode(1, 11, 4), pnCode(0, 5)));
300  geomMap.insert(std::pair<int, int>(idCode(1, 12, 1), pnCode(2, 1)));
301  geomMap.insert(std::pair<int, int>(idCode(1, 12, 2), pnCode(1, 2)));
302  geomMap.insert(std::pair<int, int>(idCode(1, 12, 3), pnCode(0, 3)));
303  geomMap.insert(std::pair<int, int>(idCode(1, 12, 4), pnCode(2, 4)));
304  geomMap.insert(std::pair<int, int>(idCode(1, 13, 4), pnCode(0, 6)));
305  geomMap.insert(std::pair<int, int>(idCode(1, 14, 4), pnCode(1, 7)));
306  geomMap.insert(std::pair<int, int>(idCode(2, 1, 1), pnCode(2, 1)));
307  geomMap.insert(std::pair<int, int>(idCode(2, 1, 2), pnCode(1, 2)));
308  geomMap.insert(std::pair<int, int>(idCode(2, 1, 3), pnCode(0, 3)));
309  geomMap.insert(std::pair<int, int>(idCode(2, 1, 4), pnCode(1, 4)));
310  geomMap.insert(std::pair<int, int>(idCode(2, 2, 1), pnCode(2, 1)));
311  geomMap.insert(std::pair<int, int>(idCode(2, 2, 2), pnCode(1, 2)));
312  geomMap.insert(std::pair<int, int>(idCode(2, 2, 3), pnCode(0, 3)));
313  geomMap.insert(std::pair<int, int>(idCode(2, 2, 4), pnCode(1, 4)));
314  geomMap.insert(std::pair<int, int>(idCode(2, 3, 1), pnCode(2, 1)));
315  geomMap.insert(std::pair<int, int>(idCode(2, 3, 2), pnCode(1, 2)));
316  geomMap.insert(std::pair<int, int>(idCode(2, 3, 3), pnCode(0, 3)));
317  geomMap.insert(std::pair<int, int>(idCode(2, 3, 4), pnCode(1, 4)));
318  geomMap.insert(std::pair<int, int>(idCode(2, 4, 1), pnCode(2, 1)));
319  geomMap.insert(std::pair<int, int>(idCode(2, 4, 2), pnCode(1, 2)));
320  geomMap.insert(std::pair<int, int>(idCode(2, 4, 3), pnCode(0, 3)));
321  geomMap.insert(std::pair<int, int>(idCode(2, 4, 4), pnCode(0, 6)));
322  geomMap.insert(std::pair<int, int>(idCode(2, 5, 1), pnCode(2, 1)));
323  geomMap.insert(std::pair<int, int>(idCode(2, 5, 2), pnCode(1, 2)));
324  geomMap.insert(std::pair<int, int>(idCode(2, 5, 3), pnCode(0, 3)));
325  geomMap.insert(std::pair<int, int>(idCode(2, 5, 4), pnCode(2, 4)));
326  geomMap.insert(std::pair<int, int>(idCode(2, 6, 1), pnCode(2, 1)));
327  geomMap.insert(std::pair<int, int>(idCode(2, 6, 2), pnCode(1, 2)));
328  geomMap.insert(std::pair<int, int>(idCode(2, 6, 3), pnCode(0, 3)));
329  geomMap.insert(std::pair<int, int>(idCode(2, 6, 4), pnCode(2, 4)));
330  geomMap.insert(std::pair<int, int>(idCode(2, 7, 1), pnCode(2, 1)));
331  geomMap.insert(std::pair<int, int>(idCode(2, 7, 2), pnCode(1, 2)));
332  geomMap.insert(std::pair<int, int>(idCode(2, 7, 3), pnCode(0, 3)));
333  geomMap.insert(std::pair<int, int>(idCode(2, 7, 4), pnCode(2, 4)));
334  geomMap.insert(std::pair<int, int>(idCode(2, 8, 1), pnCode(2, 1)));
335  geomMap.insert(std::pair<int, int>(idCode(2, 8, 2), pnCode(1, 2)));
336  geomMap.insert(std::pair<int, int>(idCode(2, 8, 3), pnCode(0, 3)));
337  geomMap.insert(std::pair<int, int>(idCode(2, 8, 4), pnCode(2, 4)));
338  geomMap.insert(std::pair<int, int>(idCode(2, 9, 1), pnCode(2, 1)));
339  geomMap.insert(std::pair<int, int>(idCode(2, 9, 2), pnCode(1, 2)));
340  geomMap.insert(std::pair<int, int>(idCode(2, 9, 3), pnCode(0, 3)));
341  geomMap.insert(std::pair<int, int>(idCode(2, 9, 4), pnCode(0, 5)));
342  geomMap.insert(std::pair<int, int>(idCode(2, 10, 1), pnCode(2, 1)));
343  geomMap.insert(std::pair<int, int>(idCode(2, 10, 2), pnCode(1, 2)));
344  geomMap.insert(std::pair<int, int>(idCode(2, 10, 3), pnCode(0, 3)));
345  geomMap.insert(std::pair<int, int>(idCode(2, 10, 4), pnCode(2, 7)));
346  geomMap.insert(std::pair<int, int>(idCode(2, 11, 1), pnCode(2, 1)));
347  geomMap.insert(std::pair<int, int>(idCode(2, 11, 2), pnCode(1, 2)));
348  geomMap.insert(std::pair<int, int>(idCode(2, 11, 3), pnCode(0, 3)));
349  geomMap.insert(std::pair<int, int>(idCode(2, 11, 4), pnCode(0, 5)));
350  geomMap.insert(std::pair<int, int>(idCode(2, 12, 1), pnCode(2, 1)));
351  geomMap.insert(std::pair<int, int>(idCode(2, 12, 2), pnCode(1, 2)));
352  geomMap.insert(std::pair<int, int>(idCode(2, 12, 3), pnCode(0, 3)));
353  geomMap.insert(std::pair<int, int>(idCode(2, 12, 4), pnCode(1, 4)));
354  geomMap.insert(std::pair<int, int>(idCode(2, 13, 4), pnCode(0, 6)));
355  geomMap.insert(std::pair<int, int>(idCode(2, 14, 4), pnCode(1, 7)));
356  //
357  initRequest = false;
358 }
359 
360 int DTPosNeg::idCode(int whe, int sec, int sta) { return ((((whe + 3) * 100) + sec) * 10) + sta; }
361 
362 int DTPosNeg::pnCode(int p, int t) { return (p * 1000) + t; }
363 
364 void DTPosNeg::decode(int code, int& whe, int& sec, int& sta) {
365  whe = (code / 1000) - 3;
366  sec = (code / 10) % 100;
367  sta = code % 10;
368  return;
369 }
370 
371 void DTPosNeg::decode(int code, int& p, int& t) {
372  p = code / 1000;
373  t = code % 1000;
374  return;
375 }
376 
377 int DTPosNeg::getData(int whe, int sec, int sta) {
378  if (initRequest)
379  fillMap();
380  std::map<int, int>::const_iterator iter = geomMap.find(idCode(whe, sec, sta));
381  std::map<int, int>::const_iterator iend = geomMap.end();
382  if (iter == iend)
383  return 999999;
384  return iter->second;
385 }
static int getPN(int whe, int sec, int sta)
Definition: DTPosNeg.cc:82
int station() const
Return the station number.
Definition: DTChamberId.h:45
static void decode(int code, int &whe, int &sec, int &sta)
Definition: DTPosNeg.cc:364
static void fillMap()
Definition: DTPosNeg.cc:100
static int pnCode(int p, int t)
Definition: DTPosNeg.cc:362
virtual ~DTPosNeg()
Definition: DTPosNeg.cc:39
DTPosNeg()
Definition: DTPosNeg.cc:34
static int getCT(int whe, int sec, int sta)
Definition: DTPosNeg.cc:91
static void dump()
dump map
Definition: DTPosNeg.cc:52
static int idCode(int whe, int sec, int sta)
Definition: DTPosNeg.cc:360
static int getData(int whe, int sec, int sta)
Definition: DTPosNeg.cc:377
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:42
int sector() const
Definition: DTChamberId.h:52
static bool initRequest
Definition: DTPosNeg.h:60
static std::map< int, int > geomMap
Definition: DTPosNeg.h:61