CMS 3D CMS Logo

EcalFedMap.cc
Go to the documentation of this file.
2 #include <iostream>
3 #include <cctype> // for toupper
4 #include <algorithm>
5 
7 
9  // EE-
10  fedToSliceMap_.insert(std::make_pair(601, "EE-07"));
11  fedToSliceMap_.insert(std::make_pair(602, "EE-08"));
12  fedToSliceMap_.insert(std::make_pair(603, "EE-09"));
13  fedToSliceMap_.insert(std::make_pair(604, "EE-01"));
14  fedToSliceMap_.insert(std::make_pair(605, "EE-02"));
15  fedToSliceMap_.insert(std::make_pair(606, "EE-03"));
16  fedToSliceMap_.insert(std::make_pair(607, "EE-04"));
17  fedToSliceMap_.insert(std::make_pair(608, "EE-05"));
18  fedToSliceMap_.insert(std::make_pair(609, "EE-06"));
19 
20  // EB-
21  fedToSliceMap_.insert(std::make_pair(610, "EB-01"));
22  fedToSliceMap_.insert(std::make_pair(611, "EB-02"));
23  fedToSliceMap_.insert(std::make_pair(612, "EB-03"));
24  fedToSliceMap_.insert(std::make_pair(613, "EB-04"));
25  fedToSliceMap_.insert(std::make_pair(614, "EB-05"));
26  fedToSliceMap_.insert(std::make_pair(615, "EB-06"));
27  fedToSliceMap_.insert(std::make_pair(616, "EB-07"));
28  fedToSliceMap_.insert(std::make_pair(617, "EB-08"));
29  fedToSliceMap_.insert(std::make_pair(618, "EB-09"));
30  fedToSliceMap_.insert(std::make_pair(619, "EB-10"));
31  fedToSliceMap_.insert(std::make_pair(620, "EB-11"));
32  fedToSliceMap_.insert(std::make_pair(621, "EB-12"));
33  fedToSliceMap_.insert(std::make_pair(622, "EB-13"));
34  fedToSliceMap_.insert(std::make_pair(623, "EB-14"));
35  fedToSliceMap_.insert(std::make_pair(624, "EB-15"));
36  fedToSliceMap_.insert(std::make_pair(625, "EB-16"));
37  fedToSliceMap_.insert(std::make_pair(626, "EB-17"));
38  fedToSliceMap_.insert(std::make_pair(627, "EB-18"));
39 
40  // EB+
41  fedToSliceMap_.insert(std::make_pair(628, "EB+01"));
42  fedToSliceMap_.insert(std::make_pair(629, "EB+02"));
43  fedToSliceMap_.insert(std::make_pair(630, "EB+03"));
44  fedToSliceMap_.insert(std::make_pair(631, "EB+04"));
45  fedToSliceMap_.insert(std::make_pair(632, "EB+05"));
46  fedToSliceMap_.insert(std::make_pair(633, "EB+06"));
47  fedToSliceMap_.insert(std::make_pair(634, "EB+07"));
48  fedToSliceMap_.insert(std::make_pair(635, "EB+08"));
49  fedToSliceMap_.insert(std::make_pair(636, "EB+09"));
50  fedToSliceMap_.insert(std::make_pair(637, "EB+10"));
51  fedToSliceMap_.insert(std::make_pair(638, "EB+11"));
52  fedToSliceMap_.insert(std::make_pair(639, "EB+12"));
53  fedToSliceMap_.insert(std::make_pair(640, "EB+13"));
54  fedToSliceMap_.insert(std::make_pair(641, "EB+14"));
55  fedToSliceMap_.insert(std::make_pair(642, "EB+15"));
56  fedToSliceMap_.insert(std::make_pair(643, "EB+16"));
57  fedToSliceMap_.insert(std::make_pair(644, "EB+17"));
58  fedToSliceMap_.insert(std::make_pair(645, "EB+18"));
59 
60  // EE+
61  fedToSliceMap_.insert(std::make_pair(646, "EE+07"));
62  fedToSliceMap_.insert(std::make_pair(647, "EE+08"));
63  fedToSliceMap_.insert(std::make_pair(648, "EE+09"));
64  fedToSliceMap_.insert(std::make_pair(649, "EE+01"));
65  fedToSliceMap_.insert(std::make_pair(650, "EE+02"));
66  fedToSliceMap_.insert(std::make_pair(651, "EE+03"));
67  fedToSliceMap_.insert(std::make_pair(652, "EE+04"));
68  fedToSliceMap_.insert(std::make_pair(653, "EE+05"));
69  fedToSliceMap_.insert(std::make_pair(654, "EE+06"));
70 
71  std::map<int, std::string>::iterator it;
72  for (it = fedToSliceMap_.begin(); it != fedToSliceMap_.end(); it++) {
73  // std::cout<< "fed: "<< (*it).first << " slice: " << (*it).second << std::endl;
74  sliceToFedMap_.insert(std::make_pair((*it).second, (*it).first));
75  }
76 
77  // std::map<std::string, int>::iterator ti;
78  // for (ti = sliceToFedMap_.begin();
79  // ti != sliceToFedMap_.end();
80  // ti++)
81  // {
82  // // std::cout<< "slice: "<< (*ti).first << " fed: " << (*ti).second << std::endl;
83  // }
84 }
85 
87  //std::cout << "received: " << fedNumber << std::endl;
88  std::map<int, std::string>::iterator found = fedToSliceMap_.find(fedNumber);
89 
90  if (found != fedToSliceMap_.end())
91  return (*found).second;
92  else
93  return std::string("invalid Fed");
94 }
95 
97  transform(slice.begin(), slice.end(), slice.begin(), toupper);
98 
99  std::map<std::string, int>::iterator found = sliceToFedMap_.find(slice);
100 
101  if (found != sliceToFedMap_.end())
102  return (*found).second;
103  else
104  return -999;
105 }
std::map< int, std::string > fedToSliceMap_
Definition: EcalFedMap.h:20
int getFedFromSlice(std::string)
Definition: EcalFedMap.cc:96
std::map< std::string, int > sliceToFedMap_
Definition: EcalFedMap.h:21
std::string getSliceFromFed(int)
Definition: EcalFedMap.cc:86
unsigned transform(const HcalDetId &id, unsigned transformCode)