6 #include "CoralBase/AttributeListSpecification.h"
10 , ISvcLocator* pSvcLocator )
25 return StatusCode::SUCCESS;
37 if(writeHandle.isValid()) {
38 ATH_MSG_DEBUG(
"CondHandle " << writeHandle.fullKey() <<
" is already valid."
39 <<
". In theory this should not be called, but may happen"
40 <<
" if multiple concurrent events are being processed out of order.");
42 return StatusCode::SUCCESS;
49 std::unique_ptr<TRTCond::HWMap> writeCdo=std::make_unique<TRTCond::HWMap>();
53 EventIDRange rangeBarrel, rangeEndcap;
57 return StatusCode::FAILURE;
61 return StatusCode::FAILURE;
67 if(writeHandle.record(rangeW,std::move(writeCdo)).isFailure()) {
69 <<
" with EventRange " << rangeW
70 <<
" into Conditions Store");
71 return StatusCode::FAILURE;
74 return StatusCode::SUCCESS;
92 const int nPadsPerSector = 42+65+100;
96 case 0: padOffset = 0;
break;
97 case 1: padOffset = 42;
break;
98 case 2: padOffset = 42+65;
break;
101 << sector <<
"," <<
module <<
"," << padNum);
106 hashedPad += sector*nPadsPerSector;
107 hashedPad += padNum + padOffset;
132 if ( wheel >= 0 && wheel < 6 ) wheelType = 0;
133 if ( wheel >= 6 && wheel < 14 ) wheelType = 1;
134 if ( wheelType == -1 ) {
139 const int nCellsPerSector = (6*4+8*2)*3;
140 int fourPlaneWheelNum;
141 if ( wheelType == 0 ) {
142 fourPlaneWheelNum =
layer + 4*wheel;
144 fourPlaneWheelNum =
layer + 24 + 2*(wheel-6);
147 hashedCell = cellNum + 3*fourPlaneWheelNum + sector*nCellsPerSector;
157 return StatusCode::SUCCESS;
166 std::map< std::string, std::vector<int> > fuseBoxPadMapEven;
167 std::map< std::string, std::vector<int> > fuseBoxPadMapOdd;
168 std::vector<int> theVector;
170 const int pads_1A1[ 9] = { 5, 7,13,21,23,30,38,39,41};
171 theVector = std::vector<int>( pads_1A1, pads_1A1+9 );
172 fuseBoxPadMapEven.insert( make_pair(
"1_A1", theVector) );
173 const int pads_1A2[ 6] = { 6, 8,15,16,22,24};
174 theVector = std::vector<int>( pads_1A2, pads_1A2+6 );
175 fuseBoxPadMapEven.insert( make_pair(
"1_A2", theVector) );
176 const int pads_1A3[ 6] = {14,29,31,32,40,42};
177 theVector = std::vector<int>( pads_1A3, pads_1A3+6 );
178 fuseBoxPadMapEven.insert( make_pair(
"1_A3", theVector) );
179 const int pads_1B1[ 9] = { 2, 4,11,12,19,34,35,36,37};
180 theVector = std::vector<int>( pads_1B1, pads_1B1+9 );
181 fuseBoxPadMapEven.insert( make_pair(
"1_B1", theVector) );
182 const int pads_1B2[ 6] = {17,25,26,27,28,33};
183 theVector = std::vector<int>( pads_1B2, pads_1B2+6 );
184 fuseBoxPadMapEven.insert( make_pair(
"1_B2", theVector) );
185 const int pads_1B3[ 6] = { 1, 3, 9,10,18,20};
186 theVector = std::vector<int>( pads_1B3, pads_1B3+6 );
187 fuseBoxPadMapEven.insert( make_pair(
"1_B3", theVector) );
188 const int pads_2A1[12] = { 6, 8,10,15,18,20,49,50,51,61,63,65};
189 theVector = std::vector<int>( pads_2A1, pads_2A1+12);
190 fuseBoxPadMapEven.insert( make_pair(
"2_A1", theVector) );
191 const int pads_2A2[11] = { 7, 9,16,17,19,27,52,53,60,62,64};
192 theVector = std::vector<int>( pads_2A2, pads_2A2+11);
193 fuseBoxPadMapEven.insert( make_pair(
"2_A2", theVector) );
194 const int pads_2A3[10] = {26,28,29,30,37,38,39,40,41,42};
195 theVector = std::vector<int>( pads_2A3, pads_2A3+10);
196 fuseBoxPadMapEven.insert( make_pair(
"2_A3", theVector) );
197 const int pads_2B1[10] = { 2, 4,12,13,24,46,55,57,58,59};
198 theVector = std::vector<int>( pads_2B1, pads_2B1+10);
199 fuseBoxPadMapEven.insert( make_pair(
"2_B1", theVector) );
200 const int pads_2B2[12] = { 1, 3, 5,11,14,21,43,44,45,47,54,56};
201 theVector = std::vector<int>( pads_2B2, pads_2B2+12);
202 fuseBoxPadMapEven.insert( make_pair(
"2_B2", theVector) );
203 const int pads_2B3[10] = {22,23,25,31,32,33,34,35,36,48};
204 theVector = std::vector<int>( pads_2B3, pads_2B3+10);
205 fuseBoxPadMapEven.insert( make_pair(
"2_B3", theVector) );
206 const int pads_3A1[10] = { 9,10,20,23,24,32,33,34,46,54};
207 theVector = std::vector<int>( pads_3A1, pads_3A1+10);
208 fuseBoxPadMapEven.insert( make_pair(
"3_A1", theVector) );
209 const int pads_3A2[10] = {70,72,73,82,84,86,92,93,96,99};
210 theVector = std::vector<int>( pads_3A2, pads_3A2+10);
211 fuseBoxPadMapEven.insert( make_pair(
"3_A2", theVector) );
212 const int pads_3A3[10] = { 8,11,12,21,22,31,35,36,43,44};
213 theVector = std::vector<int>( pads_3A3, pads_3A3+10);
214 fuseBoxPadMapEven.insert( make_pair(
"3_A3", theVector) );
215 const int pads_3A4[10] = {59,71,81,83,85,94,95,97,98,100};
216 theVector = std::vector<int>( pads_3A4, pads_3A4+10);
217 fuseBoxPadMapEven.insert( make_pair(
"3_A4", theVector) );
218 const int pads_3A5[10] = {45,47,48,55,56,57,58,60,68,69};
219 theVector = std::vector<int>( pads_3A5, pads_3A5+10);
220 fuseBoxPadMapEven.insert( make_pair(
"3_A5", theVector) );
221 const int pads_3B1[10] = {51,63,64,66,74,76,78,80,89,90};
222 theVector = std::vector<int>( pads_3B1, pads_3B1+10);
223 fuseBoxPadMapEven.insert( make_pair(
"3_B1", theVector) );
224 const int pads_3B2[10] = { 1, 4, 5, 6,14,15,18,25,27,28};
225 theVector = std::vector<int>( pads_3B2, pads_3B2+10);
226 fuseBoxPadMapEven.insert( make_pair(
"3_B2", theVector) );
227 const int pads_3B3[10] = {61,62,65,67,75,77,79,87,88,91};
228 theVector = std::vector<int>( pads_3B3, pads_3B3+10);
229 fuseBoxPadMapEven.insert( make_pair(
"3_B3", theVector) );
230 const int pads_3B4[10] = { 2, 3, 7,13,16,17,19,26,29,30};
231 theVector = std::vector<int>( pads_3B4, pads_3B4+10);
232 fuseBoxPadMapEven.insert( make_pair(
"3_B4", theVector) );
233 const int pads_3B5[10] = {37,38,39,40,41,42,49,50,52,53};
234 theVector = std::vector<int>( pads_3B5, pads_3B5+10);
235 fuseBoxPadMapEven.insert( make_pair(
"3_B5", theVector) );
237 const int* pads_1C1 = pads_1A1;
238 theVector = std::vector<int>( pads_1C1, pads_1C1+9 );
239 fuseBoxPadMapOdd.insert( make_pair(
"1_A1", theVector) );
240 const int* pads_1C2 = pads_1A3;
241 theVector = std::vector<int>( pads_1C2, pads_1C2+6 );
242 fuseBoxPadMapOdd.insert( make_pair(
"1_A2", theVector) );
243 const int* pads_1C3 = pads_1A2;
244 theVector = std::vector<int>( pads_1C3, pads_1C3+6 );
245 fuseBoxPadMapOdd.insert( make_pair(
"1_A3", theVector) );
246 const int* pads_1D1 = pads_1B1;
247 theVector = std::vector<int>( pads_1D1, pads_1D1+ 9);
248 fuseBoxPadMapOdd.insert( make_pair(
"1_B1", theVector) );
249 const int* pads_1D2 = pads_1B3;
250 theVector = std::vector<int>( pads_1D2, pads_1D2+ 6);
251 fuseBoxPadMapOdd.insert( make_pair(
"1_B2", theVector) );
252 const int* pads_1D3 = pads_1B2;
253 theVector = std::vector<int>( pads_1D3, pads_1D3+ 6);
254 fuseBoxPadMapOdd.insert( make_pair(
"1_B3", theVector) );
255 const int* pads_2C1 = pads_2A1;
256 theVector = std::vector<int>( pads_2C1, pads_2C1+12);
257 fuseBoxPadMapOdd.insert( make_pair(
"2_A1", theVector) );
258 const int* pads_2C2 = pads_2A2;
259 theVector = std::vector<int>( pads_2C2, pads_2C2+11);
260 fuseBoxPadMapOdd.insert( make_pair(
"2_A2", theVector) );
261 const int* pads_2C3 = pads_2A3;
262 theVector = std::vector<int>( pads_2C3, pads_2C3+10);
263 fuseBoxPadMapOdd.insert( make_pair(
"2_A3", theVector) );
264 const int* pads_2D1 = pads_2B1;
265 theVector = std::vector<int>( pads_2D1, pads_2D1+10);
266 fuseBoxPadMapOdd.insert( make_pair(
"2_B1", theVector) );
267 const int* pads_2D2 = pads_2B2;
268 theVector = std::vector<int>( pads_2D2, pads_2D2+12);
269 fuseBoxPadMapOdd.insert( make_pair(
"2_B2", theVector) );
270 const int* pads_2D3 = pads_2B3;
271 theVector = std::vector<int>( pads_2D3, pads_2D3+10);
272 fuseBoxPadMapOdd.insert( make_pair(
"2_B3", theVector) );
273 const int* pads_3C1 = pads_3A2;
274 theVector = std::vector<int>( pads_3C1, pads_3C1+10);
275 fuseBoxPadMapOdd.insert( make_pair(
"3_A1", theVector) );
276 const int* pads_3C2 = pads_3A1;
277 theVector = std::vector<int>( pads_3C2, pads_3C2+10);
278 fuseBoxPadMapOdd.insert( make_pair(
"3_A2", theVector) );
279 const int* pads_3C3 = pads_3A4;
280 theVector = std::vector<int>( pads_3C3, pads_3C3+10);
281 fuseBoxPadMapOdd.insert( make_pair(
"3_A3", theVector) );
282 const int* pads_3C4 = pads_3A3;
283 theVector = std::vector<int>( pads_3C4, pads_3C4+10);
284 fuseBoxPadMapOdd.insert( make_pair(
"3_A4", theVector) );
285 const int* pads_3C5 = pads_3A5;
286 theVector = std::vector<int>( pads_3C5, pads_3C5+10);
287 fuseBoxPadMapOdd.insert( make_pair(
"3_A5", theVector) );
288 const int* pads_3D1 = pads_3B2;
289 theVector = std::vector<int>( pads_3D1, pads_3D1+10);
290 fuseBoxPadMapOdd.insert( make_pair(
"3_B1", theVector) );
291 const int* pads_3D2 = pads_3B1;
292 theVector = std::vector<int>( pads_3D2, pads_3D2+10);
293 fuseBoxPadMapOdd.insert( make_pair(
"3_B2", theVector) );
294 const int* pads_3D3 = pads_3B4;
295 theVector = std::vector<int>( pads_3D3, pads_3D3+10);
296 fuseBoxPadMapOdd.insert( make_pair(
"3_B3", theVector) );
297 const int* pads_3D4 = pads_3B3;
298 theVector = std::vector<int>( pads_3D4, pads_3D4+10);
299 fuseBoxPadMapOdd.insert( make_pair(
"3_B4", theVector) );
300 const int* pads_3D5 = pads_3B5;
301 theVector = std::vector<int>( pads_3D5, pads_3D5+10 );
302 fuseBoxPadMapOdd.insert( make_pair(
"3_B5", theVector) );
303 std::string chanName;
304 chanName.reserve(40);
306 for (
int sector = 0; sector < 32; ++sector ) {
308 int side = (sector+1)%2;
310 const auto & fuseBoxPadMap = (
side == 1)? fuseBoxPadMapOdd : fuseBoxPadMapEven;
312 for (
const auto& [fuseBoxName, padVec] : fuseBoxPadMap){
313 int module = fuseBoxName.front() -
'0' - 1;
315 for (
const auto & pad: padVec ) {
318 ATH_MSG_INFO(
"channel request for invalid barrel HV pad.");
320 chanName =
"HVB_S" +
std::to_string(sector+1) +
"_M" + fuseBoxName +
"_OutputVoltage";
328 ATH_MSG_INFO(
"TRT Barrel HV-line/pad map successfully built - "
332 if(!readBarrelHandle.range(
range)) {
333 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << readBarrelHandle.key());
334 return StatusCode::FAILURE;
338 if ( DCSCondFolder ==
nullptr ) {
339 ATH_MSG_WARNING(
"Couldn't retrieve folder /TRT/DCS/HV/BARREL. Has it been loaded into IOVDbSvc?");
340 return StatusCode::FAILURE;
342 if ( DCSCondFolder->name_size() == 0 ) {
343 ATH_MSG_WARNING(
"CondAttrListCollection for folder /TRT/DCS/HV/BARREL is missing ");
344 return StatusCode::FAILURE;
350 for ( nameItr = DCSCondFolder->name_begin(); nameItr != DCSCondFolder->name_end(); ++nameItr ) {
351 int chanNum = (*nameItr).first;
352 std::string chanName = (*nameItr).second;
371 for (
int sector = 0; sector < 32; ++sector ) {
373 for (
int wheel = 0; wheel < 14; ++wheel ) {
376 if ( wheel >= 0 && wheel < 6 ) nLayers = 4;
377 if ( wheel >= 6 && wheel < 14 ) nLayers = 2;
380 std::stringstream lineName;
384 if ( sector%2 == 0 ) {
385 sectorLeft = sector+1;
386 sectorRight = sector+2;
389 sectorRight = sector+1;
391 lineName <<
"S" << sectorLeft <<
"S" << sectorRight <<
"_";
392 if ( sectorLeft%2 == 0 ) {
397 if ( wheel >= 0 && wheel < 6 ) lineName <<
"WA" << (wheel+1) <<
"_";
398 else lineName <<
"WB" << (wheel-5) <<
"_";
400 if ( wheel >= 0 && wheel < 6 ) {
401 if (
layer == 0 ) lineName <<
"1B";
402 if (
layer == 1 ) lineName <<
"1T";
403 if (
layer == 2 ) lineName <<
"2B";
404 if (
layer == 3 ) lineName <<
"2T";
406 if (
layer == 0 ) lineName <<
"B";
407 if (
layer == 1 ) lineName <<
"T";
409 lineName <<
"_OutputVoltage";
411 std::stringstream lineNameA;
412 std::stringstream lineNameC;
413 lineNameA <<
"HVA_" << lineName.str();
414 lineNameC <<
"HVC_" << lineName.str();
416 for (
int cellNum = 0; cellNum < 3; ++cellNum ) {
434 writeCdo->
setEndcapAName(hashedCellToFix,
"HVA_S7S8_WB7_B_OutputVoltage");
436 ATH_MSG_INFO(
"Endcap HV-line/pad maps successfully built - ECA: "
446 if(!readEndAHandle.range(rangeA)) {
447 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << readEndAHandle.key());
448 return StatusCode::FAILURE;
452 if ( DCSCondFolder ==
nullptr ) {
453 ATH_MSG_WARNING(
"Couldn't retrieve folder /TRT/DCS/HV/ENDCAPA. Has it been loaded into IOVDbSvc?");
454 return StatusCode::FAILURE;
456 if ( DCSCondFolder->name_size() == 0 ) {
457 ATH_MSG_WARNING(
"CondAttrListCollection for folder /TRT/DCS/HV/ENDCAPA is missing");
458 return StatusCode::FAILURE;
463 for ( nameItr = DCSCondFolder->name_begin(); nameItr != DCSCondFolder->name_end(); ++nameItr ) {
464 int chanNum = (*nameItr).first;
465 std::string chanName = (*nameItr).second;
477 if(!readEndCHandle.range(rangeC)) {
478 ATH_MSG_ERROR(
"Failed to retrieve validity range for " << readEndCHandle.key());
479 return StatusCode::FAILURE;
481 if ( DCSCondFolder1 ==
nullptr ) {
482 ATH_MSG_WARNING(
"Couldn't retrieve folder /TRT/DCS/HV/ENDCAPC. Has it been loaded into IOVDbSvc?");
483 return StatusCode::FAILURE;
485 if ( DCSCondFolder1->name_size() == 0 ) {
486 ATH_MSG_WARNING(
"CondAttrListCollection for folder /TRT/DCS/HV/ENDCAPC is missing");
487 return StatusCode::FAILURE;
492 for ( nameItr = DCSCondFolder1->name_begin(); nameItr != DCSCondFolder1->name_end(); ++nameItr ) {
493 int chanNum = (*nameItr).first;
494 std::string chanName = (*nameItr).second;