60 auto pDTTFMasks = std::make_unique<L1MuDTTFMasks>();
67 std::vector<std::string> crateMaskColumns;
68 crateMaskColumns.push_back(
"WEDGE_CRATE_1");
69 crateMaskColumns.push_back(
"WEDGE_CRATE_2");
70 crateMaskColumns.push_back(
"WEDGE_CRATE_3");
71 crateMaskColumns.push_back(
"WEDGE_CRATE_4");
72 crateMaskColumns.push_back(
"WEDGE_CRATE_5");
73 crateMaskColumns.push_back(
"WEDGE_CRATE_6");
74 crateMaskColumns.push_back(
"WEDGE_CRATE_1_E");
75 crateMaskColumns.push_back(
"WEDGE_CRATE_2_E");
76 crateMaskColumns.push_back(
"WEDGE_CRATE_3_E");
77 crateMaskColumns.push_back(
"WEDGE_CRATE_4_E");
78 crateMaskColumns.push_back(
"WEDGE_CRATE_5_E");
79 crateMaskColumns.push_back(
"WEDGE_CRATE_6_E");
84 "DTTF_RUN_SETTINGS.ID",
89 edm::LogError(
"L1-O2O") <<
"Problem with L1MuDTTFMasks key " << objectKey;
90 return std::unique_ptr<L1MuDTTFMasks>();
94 unsigned long crateMaskL[6];
95 unsigned long crateMaskR[6];
96 unsigned long krateMaskL[6];
97 unsigned long krateMaskR[6];
98 for (
int icrate = 0; icrate < 6; ++icrate) {
100 crateMaskResults.
fillVariable(crateMaskColumns[icrate], crateMask);
102 crateMaskL[icrate] = std::strtol(crateMask.c_str(), &pEnd, 16);
103 crateMaskR[icrate] = std::strtol(pEnd, (
char**)
nullptr, 16);
105 crateMaskResults.
fillVariable(crateMaskColumns[icrate + 6], crateMask);
106 krateMaskL[icrate] = std::strtol(crateMask.c_str(), &pEnd, 16);
107 krateMaskR[icrate] = std::strtol(pEnd, (
char**)
nullptr, 16);
109 std::cout <<
"Crate " << icrate <<
" masks"
110 <<
" L: " << std::hex << crateMaskL[icrate] <<
" " << std::hex << krateMaskL[icrate] <<
" R: " << std::hex
111 << crateMaskR[icrate] <<
" " << std::hex << krateMaskR[icrate] << std::endl;
115 std::string sectorNames[12] = {
"R",
"L",
"R",
"L",
"L",
"R",
"L",
"R",
"R",
"L",
"R",
"L"};
118 int crateNumbers[12] = {3, 3, 4, 4, 5, 5, 2, 2, 1, 1, 0, 0};
121 int wheelNumbers[6] = {-3, -2, -1, 1, 2, 3};
124 std::string wheelNames[6] = {
"N2",
"N1",
"N0",
"P0",
"P1",
"P2"};
127 std::map<std::string, unsigned int> crateMaskBitmap;
128 crateMaskBitmap.insert(std::make_pair(
"N2", 24));
129 crateMaskBitmap.insert(std::make_pair(
"N1", 20));
130 crateMaskBitmap.insert(std::make_pair(
"N0", 16));
131 crateMaskBitmap.insert(std::make_pair(
"P0", 8));
132 crateMaskBitmap.insert(std::make_pair(
"P1", 4));
133 crateMaskBitmap.insert(std::make_pair(
"P2", 0));
135 std::map<std::string, unsigned int> krateMaskBitmap;
136 krateMaskBitmap.insert(std::make_pair(
"N2", 16));
137 krateMaskBitmap.insert(std::make_pair(
"N1", 12));
138 krateMaskBitmap.insert(std::make_pair(
"P0", 8));
139 krateMaskBitmap.insert(std::make_pair(
"P1", 4));
140 krateMaskBitmap.insert(std::make_pair(
"P2", 0));
143 for (
int isc = 0; isc < 12; ++isc) {
144 int crateNumber = crateNumbers[isc];
145 unsigned long crateMask = crateMaskL[crateNumber];
146 if (sectorNames[isc] ==
"R")
147 crateMask = crateMaskR[crateNumber];
148 unsigned long krateMask = krateMaskL[crateNumber];
149 if (sectorNames[isc] ==
"R")
150 krateMask = krateMaskR[crateNumber];
151 std::cout <<
"isc " << isc <<
" icr " << crateNumber << std::endl;
154 for (
int iwh = 0; iwh < 6; ++iwh) {
155 std::string sectorWheelName = sectorNames[isc] + wheelNames[iwh];
157 unsigned int maskBit = 30;
158 std::map<std::string, unsigned int>::const_iterator itr = crateMaskBitmap.find(wheelNames[iwh]);
159 if (itr != crateMaskBitmap.end())
160 maskBit = itr->second;
162 unsigned long phtfEnabled = (crateMask >> maskBit) & 0xF;
164 if (wheelNames[iwh] ==
"P2")
165 phtfEnabled += (crateMask >> 24) & 0x10;
166 if (wheelNames[iwh] ==
"N2")
167 phtfEnabled += (crateMask >> 25) & 0x10;
169 std::cout <<
"Bits " <<
std::dec << maskBit <<
" (" << sectorWheelName <<
") of mask " << std::hex << crateMask
170 <<
" is " << std::hex << phtfEnabled << std::endl;
172 int nwh = wheelNumbers[iwh];
174 unsigned long chmask = phtfEnabled & 0x1;
175 std::cout <<
" INREC_CHDIS_ST1 " << 1 - chmask;
176 pDTTFMasks->set_inrec_chdis_st1(nwh, isc, 1 - chmask);
177 chmask = (phtfEnabled >> 1) & 0
x1;
178 std::cout <<
" INREC_CHDIS_ST2 " << 1 - chmask;
179 pDTTFMasks->set_inrec_chdis_st2(nwh, isc, 1 - chmask);
180 chmask = (phtfEnabled >> 2) & 0
x1;
181 std::cout <<
" INREC_CHDIS_ST3 " << 1 - chmask;
182 pDTTFMasks->set_inrec_chdis_st3(nwh, isc, 1 - chmask);
183 chmask = (phtfEnabled >> 3) & 0
x1;
184 std::cout <<
" INREC_CHDIS_ST4 " << 1 - chmask;
185 pDTTFMasks->set_inrec_chdis_st4(nwh, isc, 1 - chmask);
186 chmask = (phtfEnabled >> 4) & 0
x1;
187 std::cout <<
" INREC_CHDIS_CSC " << 1 - chmask << std::endl;
188 pDTTFMasks->set_inrec_chdis_csc(nwh, isc, 1 - chmask);
190 if (wheelNames[iwh] ==
"N0")
194 itr = krateMaskBitmap.find(wheelNames[iwh]);
195 if (itr != krateMaskBitmap.end())
196 maskBit = itr->second;
198 unsigned long ettfEnabled = (krateMask >> maskBit) & 0x7;
200 std::cout <<
"Bits " <<
std::dec << maskBit <<
" (" << sectorWheelName <<
") of mask " << std::hex << krateMask
201 <<
" is " << std::hex << ettfEnabled << std::endl;
203 chmask = ettfEnabled & 0x1;
204 std::cout <<
" ETSOC_CHDIS_ST1 " << 1 - chmask;
205 pDTTFMasks->set_etsoc_chdis_st1(nwh, isc, 1 - chmask);
206 chmask = (ettfEnabled >> 1) & 0
x1;
207 std::cout <<
" ETSOC_CHDIS_ST2 " << 1 - chmask;
208 pDTTFMasks->set_etsoc_chdis_st2(nwh, isc, 1 - chmask);
209 chmask = (ettfEnabled >> 2) & 0
x1;
210 std::cout <<
" ETSOC_CHDIS_ST3 " << 1 - chmask << std::endl;
211 pDTTFMasks->set_etsoc_chdis_st3(nwh, isc, 1 - chmask);