3 #define BOOST_BIND_GLOBAL_PLACEHOLDERS // silence Boost pragma message (fixed in Boost 1.76)
4 #include <boost/property_tree/json_parser.hpp>
16 size_t outerIndex = 0;
17 for (
const boost::property_tree::ptree::value_type& outer_elem :
node){
19 std::vector<float>
buff(outer_elem.second.size());
21 for (
const boost::property_tree::ptree::value_type& inner_elem : outer_elem.second) {
22 buff[
index] = inner_elem.second.get_value<
float>();
26 if (outer_elem.first.length() > 0) {
27 theLut[std::stoi(outer_elem.first)] =
buff;
29 theLut[outerIndex] =
buff;
39 for (
const boost::property_tree::ptree::value_type& outer_elem :
node){
41 std::map<unsigned short,std::pair<unsigned short, unsigned short>>
buff;
42 for (
const boost::property_tree::ptree::value_type& inner_elem : outer_elem.second) {
43 std::vector<unsigned short> codeBuff;
44 for (
const boost::property_tree::ptree::value_type& code_elem : inner_elem.second) {
45 codeBuff.push_back( code_elem.second.get_value<
unsigned short>() );
47 if ( codeBuff.size() != 2 ) {
51 buff[std::stoi(inner_elem.first)] = { codeBuff[0], codeBuff[1] } ;
54 theLut[std::stoi(outer_elem.first)] =
buff;
61 const std::string& side1LUTFileName) {
64 boost::property_tree::read_json(side0LUTFileName.c_str(), root0);
66 boost::property_tree::read_json(side1LUTFileName.c_str(), root1);
102 const std::string& ecfFileName,
103 const std::string& side0LUTFileName,
104 const std::string& side1LUTFileName) {
130 std::unordered_map<L1TopoLUTKey, std::map<float, unsigned short>,
L1TopoLUTKeyHasher> sector_eta_indices, sector_phi_indices;
133 if (!
inFile)
return false;
137 unsigned short sectorID;
139 double eta_min, eta_max;
140 double phi_min, phi_max;
143 if (
inFile.eof()) {
break; }
166 unsigned short ieta = 0;
167 unsigned short iphi = 0;
176 iphi |= (sectorID & 0x3F) << 2;
180 iphi = (roi & 0x3) << 1;
181 iphi |= (sectorID & 0x1F) << 3;
189 unsigned short etaPhiSubWord = ((ieta&0xF) << 9) | ((sectorID&0x1F) << 3) | (iphi&0x7);
209 m_errors.push_back(
"Duplicate key found in L1TopoLUT: "+
key.info());
220 const unsigned short& sectorID,
221 const unsigned short& roi)
const {
233 unsigned short etaPhiSubWord = ((ieta&0xF) << 9) | ((sector&0x1F) << 3) | (iphi&0x7);
234 unsigned short retval = 0;
248 float retval = std::numeric_limits<float>::quiet_NaN();
259 std::stringstream ess;
260 ess <<
"[TrigT1MuctpiPhase1/L1TopoLUT] Unknown muon subsystem value: " <<
subsystem;
261 throw std::out_of_range(ess.str());
264 std::stringstream ess;
265 ess <<
"[TrigT1MuctpiPhase1/L1TopoLUT] Failed to look up eta value for subsystem=" <<
subsystem
266 <<
", side="<< (
side?
"A":
"C")
267 <<
", sectorID="<< sectorID
269 <<
"\n (caught exception: " <<
e.what() <<
")";
270 throw std::out_of_range(ess.str());
279 float retval = std::numeric_limits<float>::quiet_NaN();
290 std::stringstream ess;
291 ess <<
"[TrigT1MuctpiPhase1/L1TopoLUT] Unknown muon subsystem value: " <<
subsystem;
292 throw std::out_of_range(ess.str());
295 std::stringstream ess;
296 ess <<
"[TrigT1MuctpiPhase1/L1TopoLUT] Failed to look up phi value for subsystem=" <<
subsystem
297 <<
", side="<< (
side?
"A":
"C")
298 <<
", sectorID="<< sectorID
300 <<
"\n (caught exception: " <<
e.what() <<
")";
301 throw std::out_of_range(ess.str());