Get file names from properties.
332 {
333
335 bool skipDbDictAccess =
m_geoDbTagSvc->getParamSvcName().empty();
336 std::string paramSvcName = skipDbDictAccess ?
"RDBAccessSvc" :
m_geoDbTagSvc->getParamSvcName();
340
341 if(skipDbDictAccess) {
342 ATH_MSG_WARNING(
"Unable to determine RDBAccessSvc backend. Using default dictionaries");
343
346 return StatusCode::SUCCESS;
347 }
348
351 std::string &dictTag) {
352 if (idDictSet->
size()) {
353 const IRDBRecord *idDictTable = (*idDictSet)[0];
354 const std::string dictName = idDictTable->
getString(
"DICT_NAME");
356 dictTag = idDictSet->
tagName();
357
358
361 }
363 << dictName << ", file: " << fileName
365 << ", dictionary tag: " << dictTag);
366
367 } else {
368 ATH_MSG_WARNING(
" no record set found for dictionary"<<idDictSet->
nodeName()<<
" - using default dictionary ");
369 }
370 };
371
372
373
374 auto getEmbeddedDict = [this](const std::string& dictName,
376 std::string &dictTag) -> bool
377 {
381 const IRDBRecord *dictRecord = (*rec)[0];
382 std::string dictString = dictRecord->
getString(
"CONTENTS");
383
384 std::string dictFileName = dictName+"-fromSQLite.xml";
385 std::ofstream dictFile;
386 dictFile.open(dictFileName);
387 dictFile << dictString;
388 dictFile.close();
389
391 dictTag.clear();
392
393 ATH_MSG_DEBUG(dictName <<
" read from the SQLite database as a BLOB");
394 return true;
395 }
396 return false;
397 };
398
399 bool useGeomDB = (
m_geoDbTagSvc->getSqliteReader() ==
nullptr);
400
401 std::string detTag{""}, detNode{""}, dictName{""};
402 DecodeVersionKey detectorKey("ATLAS");
404
405 bool embeddedDict{false};
406
407
409
410
411 detectorKey = DecodeVersionKey(
m_geoDbTagSvc.get(),
"InnerDetector");
412 ATH_MSG_DEBUG(
"From Version Tag: " << detectorKey.tag() <<
" at Node: "
413 << detectorKey.node());
414 detTag = detectorKey.tag();
415 detNode = detectorKey.node();
416 idDictSet =
m_rdbAccessSvc->getRecordsetPtr(
"DICTXDD", detTag, detNode);
417
418
419 if (idDictSet->
size()) {
420 const IRDBRecord *recordInDet = (*idDictSet)[0];
421 std::string InDetString = recordInDet->
getString(
"XMLCLOB");
422
423
424 std::ofstream blobFile;
425 blobFile.open("InDetIdDict.xml");
426 blobFile << InDetString << std::endl;
427 blobFile.close();
428 } else {
429 ATH_MSG_WARNING(
" no record set found for InDetIdentifier - using default dictionary ");
430 }
431 } else {
432
434 if(!embeddedDict) {
435
436 if (useGeomDB) {
437 detectorKey = DecodeVersionKey(
m_geoDbTagSvc.get(),
"InnerDetector");
438 ATH_MSG_DEBUG(
"From Version Tag: " << detectorKey.tag() <<
" at Node: " << detectorKey.node());
439 detTag = detectorKey.tag();
440 detNode = detectorKey.node();
441 }
442 idDictSet =
m_rdbAccessSvc->getRecordsetPtr(
"InDetIdentifier", detTag, detNode);
444 }
445 }
446
447
448
450 if(!embeddedDict) {
451
452 if (useGeomDB) {
454 ATH_MSG_DEBUG(
"From Version Tag: " << detectorKey.tag() <<
" at Node: " << detectorKey.node() );
455 detTag = detectorKey.tag();
456 detNode = detectorKey.node();
457 }
458 idDictSet =
m_rdbAccessSvc->getRecordsetPtr(
"LArIdentifier", detTag, detNode);
460 }
461
462
463
465 if(!embeddedDict) {
466
467 if (useGeomDB) {
468 detectorKey = DecodeVersionKey(
m_geoDbTagSvc.get(),
"TileCal");
469 ATH_MSG_DEBUG(
"From Version Tag: " << detectorKey.tag() <<
" at Node: " << detectorKey.node() );
470 detTag = detectorKey.tag();
471 detNode = detectorKey.node();
472 }
473 idDictSet =
m_rdbAccessSvc->getRecordsetPtr(
"TileIdentifier", detTag, detNode);
475 }
476
477
478
480 if(!embeddedDict) {
481
482 if (useGeomDB) {
483 detectorKey = DecodeVersionKey(
m_geoDbTagSvc.get(),
"Calorimeter");
484 ATH_MSG_DEBUG(
"From Version Tag: " << detectorKey.tag()<<
" at Node: " << detectorKey.node() );
485 detTag = detectorKey.tag();
486 detNode = detectorKey.node();
487 }
488 idDictSet =
m_rdbAccessSvc->getRecordsetPtr(
"CaloIdentifier", detTag, detNode);
490 }
491
493
494 if (caloNeighborTable->
size() == 0 && useGeomDB) {
495 caloNeighborTable =
m_rdbAccessSvc->getRecordsetPtr(
"CaloNeighborTable",
"CaloNeighborTable-00");
496 }
497
498 if (caloNeighborTable->
size()) {
500 }
501
502
503
505 if(!embeddedDict) {
506
507 if (useGeomDB) {
508 detectorKey = DecodeVersionKey(
m_geoDbTagSvc.get(),
"MuonSpectrometer");
509 ATH_MSG_DEBUG(
"From Version Tag: " << detectorKey.tag()<<
" at Node: " << detectorKey.node() );
510 detTag = detectorKey.tag();
511 detNode = detectorKey.node();
512 }
513 idDictSet =
m_rdbAccessSvc->getRecordsetPtr(
"MuonIdentifier", detTag, detNode);
515 }
516
517
518
520 if(!embeddedDict) {
521
522 if (useGeomDB) {
523 detectorKey = DecodeVersionKey(
m_geoDbTagSvc.get(),
"ForwardDetectors");
524 ATH_MSG_DEBUG(
"From Version Tag: " << detectorKey.tag() <<
" at Node: " << detectorKey.node() );
525 detTag = detectorKey.tag();
526 detNode = detectorKey.node();
527 }
528 idDictSet =
m_rdbAccessSvc->getRecordsetPtr(
"ForDetIdentifier", detTag, detNode);
529
530
531 if (idDictSet->
size() == 0 && useGeomDB) {
533 "ForDetIdentifier-00");
534 ATH_MSG_DEBUG(
" explicitly requesting ForDetIdentifier-00 tag for pre-forward "
535 "detector data ");
536 }
537
539 }
541 return StatusCode::SUCCESS;
542}
#define ATH_MSG_WARNING(x)
std::shared_ptr< IRDBRecordset > IRDBRecordset_ptr
virtual bool isFieldNull(const std::string &fieldName) const =0
Check if the field value is NULL.
virtual std::string tagName() const =0
virtual std::string nodeName() const =0
virtual unsigned int size() const =0
std::string m_muonIdDictTag
Tag of RDB record for Muon ids.
std::string m_tileIdDictTag
Tag of RDB record for Tile ids.
std::string m_forwardIdDictTag
Tag of RDB record for forwards det ids.
void collectCaloNeighbors(IRDBRecordset_ptr recordset)
A helper function for collecting calo neighbor file names from the database.
ServiceHandle< IRDBAccessSvc > m_rdbAccessSvc
std::string m_inDetIdDictTag
Tag of RDB record for InDet ids.
ServiceHandle< IGeoDbTagSvc > m_geoDbTagSvc
std::string m_larIdDictTag
Tag of RDB record for LAr ids.
std::string m_caloIdDictTag
Tag of RDB record for Calo ids.
std::string m_inDetIDTag
Internal InDet id tag.