7 #define BOOST_BIND_GLOBAL_PLACEHOLDERS // silence Boost pragma message (fixed in Boost 1.76)
8 #include <boost/property_tree/json_parser.hpp>
20 size_t outerIndex = 0;
21 for (
const boost::property_tree::ptree::value_type& outer_elem :
node){
23 std::vector<float>
buff(outer_elem.second.size());
25 for (
const boost::property_tree::ptree::value_type& inner_elem : outer_elem.second) {
26 buff[
index] = inner_elem.second.get_value<
float>();
30 if (outer_elem.first.length() > 0) {
31 theLut[std::stoi(outer_elem.first)] = std::move(
buff);
33 theLut[outerIndex] = std::move(
buff);
43 for (
const boost::property_tree::ptree::value_type& outer_elem :
node){
45 std::map<unsigned short,std::pair<unsigned short, unsigned short>>
buff;
46 for (
const boost::property_tree::ptree::value_type& inner_elem : outer_elem.second) {
47 std::vector<unsigned short> codeBuff;
48 for (
const boost::property_tree::ptree::value_type& code_elem : inner_elem.second) {
49 codeBuff.push_back( code_elem.second.get_value<
unsigned short>() );
51 if ( codeBuff.size() != 2 ) {
55 buff[std::stoi(inner_elem.first)] = { codeBuff[0], codeBuff[1] } ;
58 theLut[std::stoi(outer_elem.first)] = std::move(
buff);
65 const std::string& side1LUTFileName) {
68 boost::property_tree::read_json(side0LUTFileName.c_str(), root0);
70 boost::property_tree::read_json(side1LUTFileName.c_str(), root1);
106 const std::string& ecfFileName,
107 const std::string& side0LUTFileName,
108 const std::string& side1LUTFileName) {
134 std::unordered_map<L1TopoLUTKey, std::map<float, unsigned short>,
L1TopoLUTKeyHasher> sector_eta_indices, sector_phi_indices;
137 if (!
inFile)
return false;
141 unsigned short sectorID;
143 double eta_min, eta_max;
144 double phi_min, phi_max;
147 if (
inFile.eof()) {
break; }
171 unsigned short ieta = 0;
172 unsigned short iphi = 0;
181 iphi |= (sectorID & 0x3F) << 2;
185 iphi = (roi & 0x3) << 1;
186 iphi |= (sectorID & 0x1F) << 3;
194 unsigned short etaPhiSubWord = ((ieta&0xF) << 9) | ((sectorID&0x1F) << 3) | (iphi&0x7);
214 m_errors.push_back(
"Duplicate key found in L1TopoLUT: "+
key.info());
225 const unsigned short& sectorID,
226 const unsigned short& roi)
const {
238 unsigned short etaPhiSubWord = ((ieta&0xF) << 9) | ((sector&0x1F) << 3) | (iphi&0x7);
239 unsigned short retval = 0;
253 float retval = std::numeric_limits<float>::quiet_NaN();
264 std::stringstream ess;
265 ess <<
"[TrigT1MuctpiPhase1/L1TopoLUT] Unknown muon subsystem value: " <<
subsystem;
266 throw std::out_of_range(ess.str());
269 std::stringstream ess;
270 ess <<
"[TrigT1MuctpiPhase1/L1TopoLUT] Failed to look up eta value for subsystem=" <<
subsystem
271 <<
", side="<< (
side?
"A":
"C")
272 <<
", sectorID="<< sectorID
274 <<
"\n (caught exception: " <<
e.what() <<
")";
275 throw std::out_of_range(ess.str());
284 float retval = std::numeric_limits<float>::quiet_NaN();
295 std::stringstream ess;
296 ess <<
"[TrigT1MuctpiPhase1/L1TopoLUT] Unknown muon subsystem value: " <<
subsystem;
297 throw std::out_of_range(ess.str());
300 std::stringstream ess;
301 ess <<
"[TrigT1MuctpiPhase1/L1TopoLUT] Failed to look up phi value for subsystem=" <<
subsystem
302 <<
", side="<< (
side?
"A":
"C")
303 <<
", sectorID="<< sectorID
305 <<
"\n (caught exception: " <<
e.what() <<
")";
306 throw std::out_of_range(ess.str());