62 const unsigned int tpcIdentifier(0x00001000);
63 const std::string
name(
"icarus_hw_readoutboard");
64 const std::string dburl(
"https://dbdata0vm.fnal.gov:9443/QE/hw/app/SQ/query?dbname=icarus_hardware_dev");
65 const std::string dataType(
"readout_boards");
72 using FlangeIDToCrateMap = std::map<size_t,std::string>;
74 FlangeIDToCrateMap flangeIDToCrateMap;
76 flangeIDToCrateMap[19] =
"WW01T";
77 flangeIDToCrateMap[68] =
"WW01M";
78 flangeIDToCrateMap[41] =
"WW01B";
79 flangeIDToCrateMap[11] =
"WW02";
80 flangeIDToCrateMap[17] =
"WW03";
81 flangeIDToCrateMap[36] =
"WW04";
82 flangeIDToCrateMap[18] =
"WW05";
83 flangeIDToCrateMap[58] =
"WW06";
84 flangeIDToCrateMap[71] =
"WW07";
85 flangeIDToCrateMap[14] =
"WW08";
86 flangeIDToCrateMap[25] =
"WW09";
87 flangeIDToCrateMap[34] =
"WW10";
88 flangeIDToCrateMap[67] =
"WW11";
89 flangeIDToCrateMap[33] =
"WW12";
90 flangeIDToCrateMap[87] =
"WW13";
91 flangeIDToCrateMap[10] =
"WW14";
92 flangeIDToCrateMap[59] =
"WW15";
93 flangeIDToCrateMap[95] =
"WW16";
94 flangeIDToCrateMap[22] =
"WW17";
95 flangeIDToCrateMap[91] =
"WW18";
96 flangeIDToCrateMap[61] =
"WW19";
97 flangeIDToCrateMap[55] =
"WW20T";
98 flangeIDToCrateMap[97] =
"WW20M";
99 flangeIDToCrateMap[100] =
"WW20B";
100 flangeIDToCrateMap[83] =
"WE01T";
101 flangeIDToCrateMap[85] =
"WE01M";
102 flangeIDToCrateMap[7] =
"WE01B";
103 flangeIDToCrateMap[80] =
"WE02";
104 flangeIDToCrateMap[52] =
"WE03";
105 flangeIDToCrateMap[32] =
"WE04";
106 flangeIDToCrateMap[70] =
"WE05";
107 flangeIDToCrateMap[74] =
"WE06";
108 flangeIDToCrateMap[46] =
"WE07";
109 flangeIDToCrateMap[81] =
"WE08";
110 flangeIDToCrateMap[63] =
"WE09";
111 flangeIDToCrateMap[30] =
"WE10";
112 flangeIDToCrateMap[51] =
"WE11";
113 flangeIDToCrateMap[90] =
"WE12";
114 flangeIDToCrateMap[23] =
"WE13";
115 flangeIDToCrateMap[93] =
"WE14";
116 flangeIDToCrateMap[92] =
"WE15";
117 flangeIDToCrateMap[88] =
"WE16";
118 flangeIDToCrateMap[73] =
"WE17";
119 flangeIDToCrateMap[1] =
"WE18";
120 flangeIDToCrateMap[66] =
"WE19";
121 flangeIDToCrateMap[48] =
"WE20T";
122 flangeIDToCrateMap[13] =
"WE20M";
123 flangeIDToCrateMap[56] =
"WE20B";
124 flangeIDToCrateMap[94] =
"EW01T";
125 flangeIDToCrateMap[77] =
"EW01M";
126 flangeIDToCrateMap[72] =
"EW01B";
127 flangeIDToCrateMap[65] =
"EW02";
128 flangeIDToCrateMap[4] =
"EW03";
129 flangeIDToCrateMap[89] =
"EW04";
130 flangeIDToCrateMap[37] =
"EW05";
131 flangeIDToCrateMap[76] =
"EW06";
132 flangeIDToCrateMap[49] =
"EW07";
133 flangeIDToCrateMap[60] =
"EW08";
134 flangeIDToCrateMap[21] =
"EW09";
135 flangeIDToCrateMap[6] =
"EW10";
136 flangeIDToCrateMap[62] =
"EW11";
137 flangeIDToCrateMap[2] =
"EW12";
138 flangeIDToCrateMap[29] =
"EW13";
139 flangeIDToCrateMap[44] =
"EW14";
140 flangeIDToCrateMap[9] =
"EW15";
141 flangeIDToCrateMap[31] =
"EW16";
142 flangeIDToCrateMap[98] =
"EW17";
143 flangeIDToCrateMap[38] =
"EW18";
144 flangeIDToCrateMap[99] =
"EW19";
145 flangeIDToCrateMap[53] =
"EW20T";
146 flangeIDToCrateMap[82] =
"EW20M";
147 flangeIDToCrateMap[35] =
"EW20B";
148 flangeIDToCrateMap[96] =
"EE01T";
149 flangeIDToCrateMap[28] =
"EE01M";
150 flangeIDToCrateMap[16] =
"EE01T";
151 flangeIDToCrateMap[69] =
"EE02";
152 flangeIDToCrateMap[20] =
"EE02";
153 flangeIDToCrateMap[79] =
"EE02";
154 flangeIDToCrateMap[50] =
"EE02";
155 flangeIDToCrateMap[45] =
"EE02";
156 flangeIDToCrateMap[84] =
"EE02";
157 flangeIDToCrateMap[42] =
"EE02";
158 flangeIDToCrateMap[39] =
"EE02";
159 flangeIDToCrateMap[26] =
"EE02";
160 flangeIDToCrateMap[64] =
"EE02";
161 flangeIDToCrateMap[43] =
"EE02";
162 flangeIDToCrateMap[47] =
"EE02";
163 flangeIDToCrateMap[15] =
"EE02";
164 flangeIDToCrateMap[3] =
"EE02";
165 flangeIDToCrateMap[27] =
"EE02";
166 flangeIDToCrateMap[24] =
"EE02";
167 flangeIDToCrateMap[40] =
"EE02";
168 flangeIDToCrateMap[75] =
"EE02";
169 flangeIDToCrateMap[86] =
"EE20T";
170 flangeIDToCrateMap[54] =
"EE20M";
171 flangeIDToCrateMap[8] =
"EE20B";
174 if (error)
throw(std::exception());
178 for(
int row = 1;
row < getNtuples(dataset);
row++)
181 Tuple tuple = getTuple(dataset,
row);
187 char fragmentBuffer[16];
189 getStringValue(tuple, 8, fragmentBuffer,
sizeof(fragmentBuffer), &error);
191 if (error)
throw std::runtime_error(
"Encountered error in trying to recover FragmentID from database");
193 std::string fragmentIDString(fragmentBuffer,4);
195 unsigned int fragmentID = std::stol(fragmentIDString,
nullptr,16);
197 if (!(fragmentID & tpcIdentifier))
continue;
199 if (fragmentBoardMap.find(fragmentID) == fragmentBoardMap.end())
201 unsigned int flangeID = getLongValue(tuple, 1, &error);
203 if (error)
throw std::runtime_error(
"Encountered error in trying to recover Board Flange ID from database");
205 fragmentBoardMap[fragmentID].first = flangeIDToCrateMap[flangeID];
208 unsigned int readoutID = getLongValue(tuple, 0, &error);
210 if (error)
throw std::runtime_error(
"Encountered error in trying to recover Board ReadoutID from database");
212 fragmentBoardMap[fragmentID].second.emplace_back(readoutID);
int GetDataset(const std::string name, const std::string url, const std::string &dataType, Dataset &dataSet)