ATLAS Offline Software
Loading...
Searching...
No Matches
IOVDbCrestTag Class Reference

#include <IOVDbCrestTag.h>

Inheritance diagram for IOVDbCrestTag:
Collaboration diagram for IOVDbCrestTag:

Classes

struct  Resident

Public Types

enum class  source_t { COOLDB =0 , CRESTDB }

Public Member Functions

 IOVDbCrestTag (IOVDbConn *conn, const IOVDbParser &folderprop, MsgStream &msg, IClassIDSvc *clidsvc, IIOVDbMetaDataTool *metadatatool, chai::Database &db, const std::string &crestTagName)
 ~IOVDbCrestTag ()
const std::string & key () const override
const source_t & source () const override
IOVDbConn * conn () override
bool multiVersion () const override
bool timeStamp () const override
bool tagOverride () const override
bool retrieved () const override
bool noOverride () const override
IOVDbNamespace::FolderType folderType () const override
bool readMeta () const override
bool writeMeta () const override
bool fromMetaDataOnly () const override
bool extensible () const override
bool dropped () const override
bool iovOverridden () const override
const std::string & joTag () const override
const std::string & resolvedTag () const override
const std::string & eventStore () const override
CLID clid () const override
unsigned long long bytesRead () const override
float readTime () const override
const IOVRange & currentRange () const override
void useFileMetaData () override
void setFolderDescription (const std::string &description) override
void setTagOverride (const std::string &tag, const bool setFlag) override
void setWriteMeta () override
void setIOVOverride (const unsigned int run, const unsigned int lumiblock, const unsigned int time) override
void setDropped (const bool dropped) override
cool::ValidityKey iovTime (const IOVTime &reftime) const override
bool isResident (const cool::ValidityKey reftime) const override
bool loadAt (const cool::ValidityKey vkey) override
void reset () override
bool getAddress (const cool::ValidityKey reftime, IAddressCreator *persSvc, const unsigned int poolSvcContext, std::unique_ptr< IOpaqueAddress > &address, IOVRange &range, bool &poolPayloadRequested) override
void summary () override
std::unique_ptr< SG::TransientAddress > preload (ITagInfoMgr *tagInfoMgr, const unsigned int cacheRun, const unsigned int cacheTime) override
std::string dumpChannelsAsJson (cool::ValidityKey reftime) const
void printState () override
bool loadCacheIfDbChanged (const cool::ValidityKey vkey, const cool::IDatabasePtr &dbPtr, const ServiceHandle< IIOVSvc > &iovSvc) override
bool msgLvl (const MSG::Level lvl) const
 Test the output level.
MsgStream & msg () const
 The standard message stream.
MsgStream & msg (const MSG::Level lvl) const
 The standard message stream.
void setLevel (MSG::Level lvl)
 Change the current logging level.
const std::string & folderName () const

Protected Attributes

std::string m_foldername
 Folder name, as it appears in COOL or as a CREST tag label.
std::string m_key
 SG key where data is loaded (unique).

Private Member Functions

IOVDbNamespace::FolderType determineFolderType () const
std::unique_ptr< SG::TransientAddress > createTransientAddress (const std::vector< std::string > &symlinks)
bool addMetaAttrList (const coral::AttributeList &atrlist, const IOVRange &range)
bool addMetaAttrListColl (const CondAttrListCollection *coll)
bool channelInSelection (cool::ChannelId chan) const
void initMessaging () const
 Initialize our message level and MessageSvc.

Private Attributes

IClassIDSvc * p_clidSvc {nullptr}
IIOVDbMetaDataTool * p_metaDataTool {nullptr}
IOVDbConn * m_conn {nullptr}
 Unused for CREST I/O; kept for per-connection usage counting.
chai::Database * m_db {nullptr}
 Non-owning pointer to the shared chai::Database.
chai::TagPtr m_tag
 Resolved in preload(). Stays null for a metadata-only folder.
std::string m_folderDescription
bool m_timestamp {false}
 Indexed by timestamp (else runLB), from tag->getIovType().
bool m_tagoverride {false}
 Unused on the CREST path. Present to satisfy IOVDbConditionsSource.
bool m_notagoverride {false}
 Unused on the CREST path. Present to satisfy IOVDbConditionsSource.
bool m_writemeta {false}
bool m_useFileMetaData {false}
bool m_fromMetaDataOnly {false}
bool m_extensible {false}
bool m_named {false}
bool m_iovoverridden {false}
bool m_jokey {false}
bool m_dropped {false}
cool::ValidityKey m_iovoverride {0}
IOVDbNamespace::FolderType m_foldertype {IOVDbNamespace::UNKNOWN}
std::string m_jotag
 Explicit <tag>/<ctag> from job options. Used only for /TagInfo.
std::string m_resolvedTagName
 The CREST tag name actually used for lookup.
std::string m_eventstore
std::string m_addrheader
std::string m_typename
CLID m_clid {0}
unsigned int m_ncacheread {0}
unsigned int m_ndbread {0}
unsigned int m_nobjread {0}
unsigned long long m_nbytesread {0}
float m_readtime {0}
unsigned int m_nchan {0}
std::vector< cool::ChannelId > m_channums
std::vector< std::string > m_channames
std::vector< std::pair< cool::ChannelId, cool::ChannelId > > m_chanrange
bool m_retrieved {false}
IOVRange m_currange
coral::AttributeListSpecification * m_cachespec {nullptr}
std::optional< Resident > m_resident
std::string m_nm
 Message source name.
boost::thread_specific_ptr< MsgStream > m_msg_tls
 MsgStream instance (a std::cout like with print-out levels).
std::atomic< IMessageSvc * > m_imsg { nullptr }
 MessageSvc pointer.
std::atomic< MSG::Level > m_lvl { MSG::NIL }
 Current logging level.
std::atomic_flag m_initialized ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
 Messaging initialized (initMessaging).

Detailed Description

Definition at line 51 of file IOVDbCrestTag.h.

Member Enumeration Documentation

◆ source_t

enum class IOVDbConditionsSource::source_t
stronginherited
Enumerator
COOLDB 
CRESTDB 

Definition at line 36 of file IOVDbConditionsSource.h.

36 {
37 COOLDB=0,
38 CRESTDB,
39 };

Constructor & Destructor Documentation

◆ IOVDbCrestTag()

IOVDbCrestTag::IOVDbCrestTag ( IOVDbConn * conn,
const IOVDbParser & folderprop,
MsgStream & msg,
IClassIDSvc * clidsvc,
IIOVDbMetaDataTool * metadatatool,
chai::Database & db,
const std::string & crestTagName )

Definition at line 43 of file IOVDbCrestTag.cxx.

45 :
46 AthMessaging("IOVDbCrestTag"),
47 p_clidSvc(clidsvc),
48 p_metaDataTool(metadatatool),
49 m_conn(conn),
50 m_db(&db),
51 m_resolvedTagName(crestTagName)
52{
53 setLevel(msg.level());
54 m_foldername = folderprop.folderName();
55 m_key = folderprop.key();
56 m_jokey = folderprop.hasKey();
57 m_eventstore = folderprop.eventStoreName();
58 m_notagoverride = folderprop.noTagOverride();
59 ATH_MSG_DEBUG("Created CREST folder " << m_foldername << " tag " << m_resolvedTagName);
60 if (m_notagoverride) {
61 ATH_MSG_INFO("Inputfile tag override disabled for " << m_foldername);
62 }
63
64 // <tag> is not used to resolve the CREST tag but is still recorded into
65 // m_jotag for fillTagInfo(). <ctag> is the fallback when there is no <tag>.
66 if (!folderprop.tag().empty()) {
67 ATH_MSG_INFO("<tag> is ignored on the CREST path for folder " << m_foldername
68 << ". Use <ctag> to override the CREST tag name instead");
70 } else {
71 std::string ctag;
72 if (folderprop.getKey("ctag","",ctag) && !ctag.empty()) {
74 }
75 }
76
77 // No CHAI equivalent of COOL's server-side channelSelection. Parsed here
78 // and applied client-side by channelInSelection().
79 std::string chanspec;
80 if (folderprop.getKey("channelSelection","",chanspec) && !chanspec.empty()) {
82 }
83
84 if (folderprop.overridesIov(msg)) {
85 m_iovoverridden = true;
87 }
88
91 ATH_MSG_INFO("Read from meta data only for folder " << m_foldername);
92 }
93
94 m_extensible = folderprop.extensible();
95 if (m_extensible) {
96 ATH_MSG_INFO("Extensible folder " << m_foldername);
97 }
98}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_INFO(x,...)
void setLevel(MSG::Level lvl)
Change the current logging level.
AthMessaging()
Default constructor:
MsgStream & msg() const
The standard message stream.
std::string m_foldername
Folder name, as it appears in COOL or as a CREST tag label.
std::string m_key
SG key where data is loaded (unique).
std::string m_eventstore
IOVDbConn * m_conn
Unused for CREST I/O; kept for per-connection usage counting.
IIOVDbMetaDataTool * p_metaDataTool
cool::ValidityKey m_iovoverride
bool m_notagoverride
Unused on the CREST path. Present to satisfy IOVDbConditionsSource.
IOVDbConn * conn() override
IClassIDSvc * p_clidSvc
chai::Database * m_db
Non-owning pointer to the shared chai::Database.
std::vector< std::pair< cool::ChannelId, cool::ChannelId > > m_chanrange
std::string m_jotag
Explicit <tag>/<ctag> from job options. Used only for /TagInfo.
std::string m_resolvedTagName
The CREST tag name actually used for lookup.
std::string key() const
bool onlyReadMetadata() const
bool getKey(const std::string &key, const std::string &devvalue, std::string &value) const
original 'getKey' method, now implemented using 'at'
std::string eventStoreName() const
bool hasKey() const
unsigned long long iovOverrideValue(MsgStream &msg) const
bool overridesIov(MsgStream &msg) const
return true if this description overrides the timestamp or runlumi
bool extensible() const
bool noTagOverride() const
std::string folderName() const
give the folder name contained in the parsed description
std::string tag() const
std::vector< std::pair< IntType, IntType > > parseChannelSpec(const std::string &chanspecString)
Parse a channel specification string of the format ":3, 65:67,100:120, 130: " into a vector of pairs.
std::string spaceStrip(const std::string &input)
Trim leading and trailing spaces,return a new trimmed string.

◆ ~IOVDbCrestTag()

IOVDbCrestTag::~IOVDbCrestTag ( )

Definition at line 100 of file IOVDbCrestTag.cxx.

100 {
101 if (m_cachespec != nullptr) {
102 m_cachespec->release();
103 }
104}
coral::AttributeListSpecification * m_cachespec

Member Function Documentation

◆ addMetaAttrList()

bool IOVDbCrestTag::addMetaAttrList ( const coral::AttributeList & atrlist,
const IOVRange & range )
private

Definition at line 451 of file IOVDbCrestTag.cxx.

451 {
452 CondAttrListCollection tmpColl(!m_timestamp);
453 tmpColl.add(0xFFFF, atrlist);
454 tmpColl.add(0xFFFF, range);
455 return addMetaAttrListColl(&tmpColl);
456}
bool m_timestamp
Indexed by timestamp (else runLB), from tag->getIovType().
bool addMetaAttrListColl(const CondAttrListCollection *coll)

◆ addMetaAttrListColl()

bool IOVDbCrestTag::addMetaAttrListColl ( const CondAttrListCollection * coll)
private

Definition at line 458 of file IOVDbCrestTag.cxx.

458 {
459 if (!coll) {
460 return false;
461 }
462 CondAttrListCollection* flmdColl = new CondAttrListCollection(*coll);
463 if (StatusCode::SUCCESS != p_metaDataTool->addPayload(m_foldername, flmdColl)) {
464 ATH_MSG_ERROR("addMetaAttrList: Failed to write metadata for folder " << m_foldername);
465 return false;
466 }
467 ATH_MSG_DEBUG("addMetaAttrList: write metadata for folder " << m_foldername);
468 return true;
469}
#define ATH_MSG_ERROR(x,...)

◆ bytesRead()

unsigned long long IOVDbCrestTag::bytesRead ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 263 of file IOVDbCrestTag.h.

263{ return m_nbytesread; }
unsigned long long m_nbytesread

◆ channelInSelection()

bool IOVDbCrestTag::channelInSelection ( cool::ChannelId chan) const
private

Definition at line 471 of file IOVDbCrestTag.cxx.

471 {
472 if (m_chanrange.empty()) {
473 return true;
474 }
475 for (const auto& range : m_chanrange) {
476 if (chan >= range.first && chan <= range.second) {
477 return true;
478 }
479 }
480 return false;
481}

◆ clid()

CLID IOVDbCrestTag::clid ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 261 of file IOVDbCrestTag.h.

261{ return m_clid; }

◆ conn()

IOVDbConn * IOVDbCrestTag::conn ( )
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 225 of file IOVDbCrestTag.h.

225{ return m_conn; }

◆ createTransientAddress()

std::unique_ptr< SG::TransientAddress > IOVDbCrestTag::createTransientAddress ( const std::vector< std::string > & symlinks)
private

Definition at line 191 of file IOVDbCrestTag.cxx.

191 {
192 auto tad = std::make_unique<SG::TransientAddress>(m_clid, m_key);
193 for (const auto& linkname : symlinks) {
194 if (not linkname.empty()) {
195 CLID sclid = 0;
196 if (StatusCode::SUCCESS == p_clidSvc->getIDOfTypeName(linkname, sclid)) {
197 tad->setTransientID(sclid);
198 ATH_MSG_DEBUG("Setup symlink " << linkname << " CLID " << sclid << " for folder " << m_foldername);
199 } else {
200 ATH_MSG_ERROR("Could not get clid for symlink: " << linkname);
201 return nullptr;
202 }
203 }
204 }
205 return tad;
206}
uint32_t CLID
The Class ID type.

◆ currentRange()

const IOVRange & IOVDbCrestTag::currentRange ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 267 of file IOVDbCrestTag.h.

267{ return m_currange; }
IOVRange m_currange

◆ determineFolderType()

IOVDbNamespace::FolderType IOVDbCrestTag::determineFolderType ( ) const
private

Definition at line 157 of file IOVDbCrestTag.cxx.

157 {
158 // Check for CoraCool (not supported in CREST)
159 if (m_folderDescription.find("<coracool>") != std::string::npos) {
160 ATH_MSG_FATAL("Folder " << m_foldername << " is CoraCool and is not representable with CREST");
162 }
163
165
166 // If the type is CondAttrListVec, and is not CoraCool, it must be a CoolVector
167 if (typeName == "CondAttrListVec") {
169 }
170
171 // A string type "PoolRef" column in field 0 indicates a POOL-compatible tag
172 const auto& fields = m_tag->getFieldSpec();
173 const bool poolCompatible = ((fields.size() > 0) && (fields[0].name == "PoolRef") &&
174 (fields[0].type == chai::String));
175 if (poolCompatible) {
176 const auto& channels = m_tag->getChannelSpec().channels();
177 const bool onlyChannelZero = (channels.size() == 1 && channels[0].id == 0);
178 return onlyChannelZero ? IOVDbNamespace::PoolRef : IOVDbNamespace::PoolRefColl;
179 }
180
181 // CondAttrListCollection -> AttrListColl
182 if (typeName == "CondAttrListCollection") {
184 }
185
186 // Otherwise AttrList
188}
#define ATH_MSG_FATAL(x,...)
chai::TagPtr m_tag
Resolved in preload(). Stays null for a metadata-only folder.
std::string m_folderDescription
bool poolCompatible(const cool::IRecordSpecification &rspec)
Is the folder type compatible with Pool storage type?
std::string parseTypename(const std::string &description)
Extract the typename from a folder description.

◆ dropped()

bool IOVDbCrestTag::dropped ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 251 of file IOVDbCrestTag.h.

251{ return m_dropped; }

◆ dumpChannelsAsJson()

std::string IOVDbCrestTag::dumpChannelsAsJson ( cool::ValidityKey reftime) const

Definition at line 697 of file IOVDbCrestTag.cxx.

697 {
698 std::ostringstream os;
699 os << "[";
700 std::string sep;
701 if (isResident(reftime) && !std::holds_alternative<std::monostate>(m_resident->payload)) {
702 const cool::ValidityKey since = m_resident->since;
703 const cool::ValidityKey until = m_resident->until;
704 if (m_foldertype == CoolVector) {
705 const auto& payloadResult = std::get<chai::PayloadResult<chai::VectorContainer>>(m_resident->payload);
706 for (const auto channelId : payloadResult.payload.channelIds()) {
707 const auto& rows = payloadResult.payload.rows(channelId);
708 if (rows.empty()) {
709 continue;
710 }
711 std::ostringstream payload;
712 payload << "[";
713 std::string rowSep;
714 for (const auto& row : rows) {
715 const coral::AttributeList al = ChaiCoralConverter::toAttributeList(*m_cachespec, *row);
718 }
719 payload << "]";
720 os << sep << IOVDbNamespace::s_openJson << "\"" << channelId << "\" : "
722 << "\"since\" : " << since << IOVDbNamespace::s_delimiterJson
723 << "\"until\" : " << until << IOVDbNamespace::s_delimiterJson
724 << "\"payload\" : " << payload.str()
727 }
728 } else {
729 const auto& payloadResult = std::get<chai::PayloadResult<chai::Container>>(m_resident->payload);
730 for (const auto channelId : payloadResult.payload.channelIds()) {
731 const coral::AttributeList al =
732 ChaiCoralConverter::toAttributeList(*m_cachespec, payloadResult.payload[channelId]);
733 os << sep << IOVDbNamespace::s_openJson << "\"" << channelId << "\" : "
735 << "\"since\" : " << since << IOVDbNamespace::s_delimiterJson
736 << "\"until\" : " << until << IOVDbNamespace::s_delimiterJson
737 << "\"payload\" : [" << IOVDbNamespace::jsonAttributeList(al) << "]"
740 }
741 }
742 }
743 os << "]";
744 return os.str();
745}
static Double_t al
static coral::AttributeList toAttributeList(const coral::AttributeListSpecification &spec, const chai::Values &values)
Convert one channel's CHAI Values to a coral::AttributeList, one attribute per field in spec order.
IOVDbNamespace::FolderType m_foldertype
std::optional< Resident > m_resident
bool isResident(const cool::ValidityKey reftime) const override
std::string jsonAttributeList(const coral::AttributeList &atrlist)
Produce a representation of a coral::AttributeList as a json string.
static const std::string s_delimiterJson
json standard delimiter ', '
static const std::string s_closeJson
json close tag, '}'
static const std::string s_openJson
json open tag, '{'

◆ eventStore()

const std::string & IOVDbCrestTag::eventStore ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 259 of file IOVDbCrestTag.h.

259{ return m_eventstore; }

◆ extensible()

bool IOVDbCrestTag::extensible ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 249 of file IOVDbCrestTag.h.

249{ return m_extensible; }

◆ folderName()

const std::string & IOVDbConditionsSource::folderName ( ) const
inlineinherited

Definition at line 62 of file IOVDbConditionsSource.h.

62{return m_foldername;};

◆ folderType()

IOVDbNamespace::FolderType IOVDbCrestTag::folderType ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 237 of file IOVDbCrestTag.h.

237{ return m_foldertype; }

◆ fromMetaDataOnly()

bool IOVDbCrestTag::fromMetaDataOnly ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 247 of file IOVDbCrestTag.h.

247{ return m_fromMetaDataOnly; }

◆ getAddress()

bool IOVDbCrestTag::getAddress ( const cool::ValidityKey reftime,
IAddressCreator * persSvc,
const unsigned int poolSvcContext,
std::unique_ptr< IOpaqueAddress > & address,
IOVRange & range,
bool & poolPayloadRequested )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 483 of file IOVDbCrestTag.cxx.

486 {
487 ++m_ncacheread;
488 std::string strAddress;
489 // Owned here until released into the address object below, to avoid leaking in case of failure
490 std::unique_ptr<AthenaAttributeList> attrList;
491 std::unique_ptr<CondAttrListCollection> attrListColl;
492 std::unique_ptr<CondAttrListVec> attrListVec;
493
494 // Read from metadata if flag is set
495 if (m_useFileMetaData) {
496 IOVDbNamespace::SafeReadFromFileMetaData readFromMetaData(m_foldername, p_metaDataTool, reftime, m_timestamp);
497 if (not readFromMetaData.isValid()) {
498 ATH_MSG_ERROR("read:Could not find IOVPayloadContainer for folder " << m_foldername);
499 return false;
500 }
501 m_foldertype = readFromMetaData.folderType();
502 m_nobjread += readFromMetaData.numberOfObjects();
503 poolPayloadReq = readFromMetaData.poolPayloadRequested();
504 strAddress = readFromMetaData.stringAddress();
505 range = readFromMetaData.range();
506 attrList.reset(readFromMetaData.attributeList());
507 attrListColl.reset(readFromMetaData.attrListCollection());
508 ATH_MSG_DEBUG("Read file metadata for folder " << m_foldername << " foldertype is " << m_foldertype);
509 }
510
511 // Otherwise convert the resident CHAI payload directly
512 else {
513 if (!m_resident) {
514 ATH_MSG_ERROR("No resident payload for folder " << m_foldername << " at IOV " << reftime);
515 return false;
516 }
518
519 unsigned int nchan = 0;
520 std::optional<coral::AttributeList> singleAl;
521 try {
522 switch (m_foldertype) {
523 case AttrList:
524 case PoolRef: {
525 // A single-channel folder with no payload is an error
526 if (std::holds_alternative<std::monostate>(m_resident->payload)) {
527 ATH_MSG_ERROR("Empty resident for single-channel folder " << m_foldername);
528 return false;
529 }
530 const auto& payloadResult = std::get<chai::PayloadResult<chai::Container>>(m_resident->payload);
531 // Only channel 0 is read, as on the COOL path. Any other populated channel is ignored
532 if (!payloadResult.payload.hasChannel(0)) {
533 ATH_MSG_ERROR("No channel 0 for single-channel folder " << m_foldername << " currentTime "
534 << reftime << " (" << payloadResult.payload.channelIds().size()
535 << " channels populated)");
536 return false;
537 }
538 nchan = 1;
539 // Convert CHAI payload to attribute list
540 singleAl.emplace(ChaiCoralConverter::toAttributeList(*m_cachespec, payloadResult.payload[0]));
541 if (m_foldertype == AttrList) {
542 attrList = std::make_unique<AthenaAttributeList>(*singleAl);
543 strAddress = "POOLContainer_AthenaAttributeList][CLID=x";
544 } else {
545 strAddress = (*singleAl)["PoolRef"].data<std::string>();
546 }
547 break;
548 }
549 case AttrListColl:
550 case PoolRefColl: {
551 attrListColl = std::make_unique<CondAttrListCollection>(!m_timestamp);
552 // Empty resident means zero channels. Just leave it empty, matching IOVDbFolder.
553 if (!std::holds_alternative<std::monostate>(m_resident->payload)) {
554 const auto& payloadResult = std::get<chai::PayloadResult<chai::Container>>(m_resident->payload);
555 const auto channelIds = payloadResult.payload.channelIds();
556 for (const auto channelId : channelIds) {
557 const auto chan = static_cast<cool::ChannelId>(channelId);
558 if (!channelInSelection(chan)) {
559 continue;
560 }
561 // Convert each row to an attribute list and add to collection
562 attrListColl->addShared(chan, ChaiCoralConverter::toAttributeList(*m_cachespec, payloadResult.payload[channelId]));
563 attrListColl->add(chan, range);
564 ++nchan;
565 }
566 }
567 if (m_named) {
568 auto nitr = m_channames.begin();
569 for (auto chitr = m_channums.begin(); chitr != m_channums.end(); ++chitr, ++nitr) {
570 attrListColl->add(*chitr, *nitr);
571 }
572 }
573 strAddress = "POOLContainer_CondAttrListCollection][CLID=x";
574 break;
575 }
576 case CoolVector: {
577 attrListVec = std::make_unique<CondAttrListVec>(!m_timestamp);
578 // Empty resident means zero channels. Just leave it empty, matching IOVDbFolder.
579 if (!std::holds_alternative<std::monostate>(m_resident->payload)) {
580 const auto& payloadResult = std::get<chai::PayloadResult<chai::VectorContainer>>(m_resident->payload);
581 const auto channelIds = payloadResult.payload.channelIds();
582 for (const auto channelId : channelIds) {
583 const auto chan = static_cast<cool::ChannelId>(channelId);
584 if (!channelInSelection(chan)) {
585 continue;
586 }
587 // Convert each set of rows (per channel ID) to an attribute list vec
588 const auto rows = ChaiCoralConverter::toAttributeListVec(*m_cachespec, payloadResult.payload.rows(channelId));
589 attrListVec->addSlice(range, chan, rows, 0, rows.size());
590 ++nchan;
591 }
592 }
593 strAddress = "POOLContainer_CondAttrListVec][CLID=x";
594 break;
595 }
596 default:
597 ATH_MSG_ERROR("Unhandled folder type " << m_foldertype << " for folder " << m_foldername);
598 return false;
599 }
600 } catch (const std::exception& e) {
601 ATH_MSG_ERROR("Conversion failed for folder " << m_foldername << ": " << e.what());
602 return false;
603 }
604
606 if (!addMetaAttrList(*singleAl, range)) {
607 return false;
608 }
609 }
610
611 // CoolVector folders cannot be written to file metadata
613 ATH_MSG_ERROR("Writing of CoolVector folders to file metadata not implemented");
614 return false;
615 }
616
617 // Don't change wording here, getProblemFoldersFromLogs.py relies on this.
618 ATH_MSG_DEBUG("Retrieved object: folder " << m_foldername << " at IOV " << reftime
619 << " channels " << nchan << " has range " << range);
620 }
621
623 m_retrieved = true;
624
626 if (!addMetaAttrListColl(attrListColl.get())) {
627 return false;
628 }
629 }
630
631 strAddress = m_addrheader + strAddress;
632 IOpaqueAddress* addrp = nullptr;
633 if (StatusCode::SUCCESS != persSvc->createAddress(0, 0, strAddress, addrp)) {
634 ATH_MSG_ERROR("Could not get IOpaqueAddress from string address " << strAddress);
635 return false;
636 }
637 address = std::unique_ptr<IOpaqueAddress>(addrp);
638 GenericAddress* gAddr = dynamic_cast<GenericAddress*>(address.get());
639 if (!gAddr) {
640 ATH_MSG_ERROR("Could not cast IOpaqueAddress to GenericAddress");
641 return false;
642 }
643 if (m_foldertype == AttrListColl) {
644 auto addr = std::make_unique<CondAttrListCollAddress>(*gAddr);
645 addr->setAttrListColl(attrListColl.release());
646 address = std::move(addr);
647 } else if (m_foldertype == PoolRefColl || m_foldertype == PoolRef) {
648 auto addr = std::make_unique<CondAttrListCollAddress>(gAddr->svcType(),
649 gAddr->clID(), gAddr->par()[0],
650 gAddr->par()[1], poolSvcContext,
651 gAddr->ipar()[1]);
652 if (m_foldertype == PoolRefColl) {
653 addr->setAttrListColl(attrListColl.release());
654 }
655 address = std::move(addr);
656 poolPayloadReq = true;
657 } else if (m_foldertype == AttrList) {
658 auto addr = std::make_unique<AthenaAttrListAddress>(*gAddr);
659 addr->setAttrList(attrList.release());
660 address = std::move(addr);
661 } else if (m_foldertype == CoolVector) {
662 auto addr = std::make_unique<CondAttrListVecAddress>(*gAddr);
663 addr->setAttrListVec(attrListVec.release());
664 address = std::move(addr);
665 }
666 return true;
667}
static std::vector< coral::AttributeList > toAttributeListVec(const coral::AttributeListSpecification &spec, const std::vector< chai::ValuesPtr > &rows)
Convert one channel's CHAI vector-payload rows to a coral::AttributeList per row, in row order,...
std::vector< cool::ChannelId > m_channums
unsigned int m_ncacheread
bool addMetaAttrList(const coral::AttributeList &atrlist, const IOVRange &range)
std::vector< std::string > m_channames
bool channelInSelection(cool::ChannelId chan) const
unsigned int m_nobjread
std::string m_addrheader
IOVRange makeRange(const cool::ValidityKey since, const cool::ValidityKey until, const bool timeIsEpoch)
Make an IOVRange from two validity keys.

◆ initMessaging()

void AthMessaging::initMessaging ( ) const
privateinherited

Initialize our message level and MessageSvc.

This method should only be called once.

Definition at line 39 of file AthMessaging.cxx.

40{
42 // If user did not set an explicit level, set a default
43 if (m_lvl == MSG::NIL) {
44 m_lvl = m_imsg ?
45 static_cast<MSG::Level>( m_imsg.load()->outputLevel(m_nm) ) :
46 MSG::INFO;
47 }
48}
std::string m_nm
Message source name.
std::atomic< IMessageSvc * > m_imsg
MessageSvc pointer.
std::atomic< MSG::Level > m_lvl
Current logging level.
IMessageSvc * getMessageSvc(bool quiet=false)
int outputLevel(const IMessageSvc *ims, const std::string &source)

◆ iovOverridden()

bool IOVDbCrestTag::iovOverridden ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 253 of file IOVDbCrestTag.h.

253{ return m_iovoverridden; }

◆ iovTime()

cool::ValidityKey IOVDbCrestTag::iovTime ( const IOVTime & reftime) const
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 146 of file IOVDbCrestTag.cxx.

146 {
147 if (m_iovoverridden) {
148 return m_iovoverride;
149 }
150 return (m_timestamp ? reftime.timestamp() : reftime.re_time());
151}
uint64_t timestamp() const noexcept
Definition IOVTime.h:109
uint64_t re_time() const noexcept
Definition IOVTime.h:108

◆ isResident()

bool IOVDbCrestTag::isResident ( const cool::ValidityKey reftime) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 269 of file IOVDbCrestTag.h.

269 {
270 // Unlike IOVDbFolder::isResident's strict ">", the bounds here are the IOV's
271 // own [since, until), so reftime landing on since counts as resident.
272 // Otherwise every such vkey forces a redundant CHAI refetch.
273 return m_resident && reftime>=m_resident->since && reftime<m_resident->until;
274}

◆ joTag()

const std::string & IOVDbCrestTag::joTag ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 255 of file IOVDbCrestTag.h.

255{ return m_jotag; }

◆ key()

const std::string & IOVDbCrestTag::key ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 219 of file IOVDbCrestTag.h.

219{ return m_key; }

◆ loadAt()

bool IOVDbCrestTag::loadAt ( const cool::ValidityKey vkey)
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 348 of file IOVDbCrestTag.cxx.

348 {
349 TStopwatch cachetimer;
350 // A bad EventInfo timestamp can produce vkey==0xFFFF... which a floor
351 // lookup would resolve to the last IOV. Reset to 0 with a warning.
352 cool::ValidityKey vkey = requestedVkey;
353 if (vkey > cool::ValidityKeyMax) {
354 ATH_MSG_WARNING("Requested validity key " << vkey << " is out of range, reset to 0");
355 vkey = 0;
356 }
357 ATH_MSG_DEBUG("Load cache for folder " << m_foldername << " validitykey " << vkey);
358
359 m_resident.reset();
360
361 // An IOVTime above cool::ValidityKeyMax is invalid so clamp at the max
362 const auto clampedKey = [this](uint64_t key, const char* which) {
363 if (key > cool::ValidityKeyMax) {
364 ATH_MSG_WARNING("CREST " << which << " " << key << " for folder " << m_foldername
365 << " exceeds cool::ValidityKeyMax; clamped");
366 return cool::ValidityKeyMax;
367 }
368 return static_cast<cool::ValidityKey>(key);
369 };
370
371 unsigned int nchan = 0;
372 try {
373 // Caches the payload and returns the channel count
374 auto storeResident = [this, &clampedKey](auto&& payloadResult) {
375 if (m_cachespec == nullptr) {
376 m_cachespec = ChaiCoralConverter::toCoralSpec(payloadResult.payload.fieldSpec());
377 }
378 const unsigned int channelCount = payloadResult.payload.channelIds().size();
379 m_nbytesread += ChaiCoralConverter::payloadSize(payloadResult.payload);
380 const cool::ValidityKey sinceKey = clampedKey(payloadResult.since, "since");
381 const cool::ValidityKey untilKey = payloadResult.until.has_value()
382 ? clampedKey(*payloadResult.until, "until") : cool::ValidityKeyMax;
383 m_resident = Resident{sinceKey, untilKey, std::move(payloadResult)};
384 return channelCount;
385 };
386
387 // CHAI needs to know if it's a vector or scalar payload to call the correct getXPayloadAt method.
388 // This is what actually loads the payload at the desired time and caches it.
389 nchan = m_tag->isVectorPayload() ? storeResident(m_tag->getVectorPayloadAt(vkey))
390 : storeResident(m_tag->getPayloadAt(vkey));
391 } catch (const chai::NotFoundError& e) {
392 // IOVDbFolder returns an empty collection when a collection-type folder has
393 // zero matching objects and when the query time precedes the first IOV.
394 // Any other NotFoundError is a real error.
395 const bool isCollectionType = (m_foldertype == AttrListColl || m_foldertype == PoolRefColl || m_foldertype == CoolVector);
396
397 if (isCollectionType) {
398 try {
399 // getIovs() is lazy, so begin() fetches only the first page and returns the first element
400 auto iovs = m_tag->getIovs(0);
401 auto firstIt = iovs.begin();
402 if (firstIt != iovs.end() && firstIt->getSince() > vkey) {
403 const cool::ValidityKey firstSince = clampedKey(firstIt->getSince(), "first since");
404 ATH_MSG_WARNING("No covering IOV for folder " << m_foldername << " validityKey " << vkey
405 << " (tag " << m_resolvedTagName << "'s first IOV starts at "
406 << firstSince << "); treating the folder as empty");
407 m_resident = Resident{cool::ValidityKeyMin, firstSince, std::monostate{}};
408 ++m_ndbread;
409 const float timeinc = cachetimer.RealTime();
410 m_readtime += timeinc;
411 ATH_MSG_DEBUG("Cache retrieve done for " << m_foldername
412 << " with 0 channels (no coverage) " << "in " << std::fixed << std::setw(8)
413 << std::setprecision(2) << timeinc << " s");
414 return true;
415 }
416 } catch (const std::exception& probeErr) {
417 // A failure here is not the empty-collection case. Fall through to the real error below.
418 ATH_MSG_DEBUG("Coverage probe for " << m_foldername << " failed: " << probeErr.what());
419 }
420 }
421 ATH_MSG_ERROR("No covering IOV for folder " << m_foldername << " validityKey " << vkey << ": " << e.what());
422 reset();
423 return false;
424 } catch (const chai::Error& e) {
425 ATH_MSG_ERROR("CHAI error for folder " << m_foldername << ": " << e.what());
426 reset();
427 return false;
428 } catch (const std::exception& e) {
429 ATH_MSG_ERROR("Failed for folder " << m_foldername << ": " << e.what());
430 reset();
431 return false;
432 }
433
434 ++m_ndbread;
435 m_nobjread += nchan;
436 const float timeinc = cachetimer.RealTime();
437 m_readtime += timeinc;
438 ATH_MSG_DEBUG("Cache retrieve done for " << m_foldername << " with " << nchan
439 << " channels stored in " << std::fixed << std::setw(8) << std::setprecision(2)
440 << timeinc << " s");
441 return true;
442}
#define ATH_MSG_WARNING(x,...)
static unsigned int payloadSize(const chai::Container &container)
Total byte size of every populated channel in a scalar payload.
static coral::AttributeListSpecification * toCoralSpec(const chai::FieldSpec &fields)
Build a coral::AttributeListSpecification from a CHAI FieldSpec, one attribute per field in field ord...
void reset() override
const std::string & key() const override
unsigned int m_ndbread
which(filename, env=os.environ)
UNIX-style which ---------------------------------------------------------—.
Definition unixtools.py:39

◆ loadCacheIfDbChanged()

bool IOVDbCrestTag::loadCacheIfDbChanged ( const cool::ValidityKey vkey,
const cool::IDatabasePtr & dbPtr,
const ServiceHandle< IIOVSvc > & iovSvc )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 444 of file IOVDbCrestTag.cxx.

446 {
447 // COOL-specific online-reload path. No-op for CREST.
448 return true;
449}

◆ msg() [1/2]

MsgStream & AthMessaging::msg ( ) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 167 of file AthMessaging.h.

168{
169 MsgStream* ms = m_msg_tls.get();
170 if (!ms) {
171 if (!m_initialized.test_and_set()) initMessaging();
172 ms = new MsgStream(m_imsg,m_nm);
173 m_msg_tls.reset( ms );
174 }
175
176 ms->setLevel (m_lvl);
177 return *ms;
178}
boost::thread_specific_ptr< MsgStream > m_msg_tls
MsgStream instance (a std::cout like with print-out levels).
void initMessaging() const
Initialize our message level and MessageSvc.

◆ msg() [2/2]

MsgStream & AthMessaging::msg ( const MSG::Level lvl) const
inlineinherited

The standard message stream.

Returns a reference to the default message stream May not be invoked before sysInitialize() has been invoked.

Definition at line 182 of file AthMessaging.h.

183{ return msg() << lvl; }

◆ msgLvl()

bool AthMessaging::msgLvl ( const MSG::Level lvl) const
inlineinherited

Test the output level.

Parameters
lvlThe message level to test against
Returns
boolean Indicating if messages at given level will be printed
Return values
trueMessages at level "lvl" will be printed

Definition at line 151 of file AthMessaging.h.

152{
153 // If user did not set explicit message level we have to initialize
154 // the messaging and retrieve the default via the MessageSvc.
155 if (m_lvl==MSG::NIL && !m_initialized.test_and_set()) initMessaging();
156
157 if (m_lvl <= lvl) {
158 msg() << lvl;
159 return true;
160 } else {
161 return false;
162 }
163}

◆ multiVersion()

bool IOVDbCrestTag::multiVersion ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 227 of file IOVDbCrestTag.h.

227{ return false; }

◆ noOverride()

bool IOVDbCrestTag::noOverride ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 233 of file IOVDbCrestTag.h.

233{ return m_notagoverride; }

◆ preload()

std::unique_ptr< SG::TransientAddress > IOVDbCrestTag::preload ( ITagInfoMgr * tagInfoMgr,
const unsigned int cacheRun,
const unsigned int cacheTime )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 209 of file IOVDbCrestTag.cxx.

209 {
210 if (not m_useFileMetaData) {
211 if (m_resolvedTagName.empty()) {
212 ATH_MSG_FATAL("Folder " << m_foldername << " has no CREST tag and is not read from file metadata");
213 return nullptr;
214 }
215
216 // Attempt to resolve the tag and set the folder description
217 try {
218 m_tag = m_db->getTag(m_resolvedTagName);
219 } catch (const std::exception& e) {
220 ATH_MSG_FATAL("Failed to resolve CHAI tag '" << m_resolvedTagName
221 << "' for folder " << m_foldername << ": " << e.what());
222 return nullptr;
223 }
224 m_folderDescription = m_tag->getNodeDescription();
225
226 // The tag's IovType is the source of truth for the timebase. Fill in a missing
227 // <timeStamp> in the node description, but refuse an existing one on another axis.
228 switch (m_tag->getIovType()) {
229 case chai::TagIovType::Time:
230 case chai::TagIovType::RunNumberLumiBlock: {
231 const std::string token = chai::iovTypeToNodeDescTimeStampToken(m_tag->getIovType());
233 // COOL's run-event means run-lumi: a same-axis token is kept as written
235 chai::timeStampTokenAxis(correction.foundToken) == chai::iovTypeAxis(m_tag->getIovType())) {
236 correction.description = m_folderDescription;
238 }
240 ATH_MSG_FATAL("Folder " << m_foldername << "'s CREST description for tag "
241 << m_tag->getName() << " disagrees with the tag's IovType ('"
242 << chai::iovTypeToString(m_tag->getIovType()) << "'); description says '"
243 << m_folderDescription << "', tag's IovType wants '" << token
244 << "'. Fix the description on the CREST server");
245 return nullptr;
247 ATH_MSG_INFO("Folder " << m_foldername << "'s CREST description for tag "
248 << m_tag->getName() << " has no <timeStamp> element; inserting '" << token
249 << "' from the tag's IovType");
250 }
251 m_folderDescription = std::move(correction.description);
252 break;
253 }
254 default:
255 ATH_MSG_FATAL("Tag " << m_tag->getName() << " for folder " << m_foldername
256 << " has unsupported IovType '" << chai::iovTypeToString(m_tag->getIovType())
257 << "' (expected 'time' or 'run-lumi')");
258 return nullptr;
259 }
260 }
261
262 // Otherwise the folder description was already set from file metadata
263 ATH_MSG_DEBUG("Folder description for " << m_foldername << ": " << m_folderDescription);
264
265 if (m_writemeta) {
266 if (StatusCode::SUCCESS != p_metaDataTool->registerFolder(m_foldername, m_folderDescription)) {
267 ATH_MSG_ERROR("Failed to register folder " << m_foldername << " for meta-data write");
268 return nullptr;
269 }
270 }
271
272 // Read timestamp-indexing straight from the description string so this
273 // works even when no chai::Tag is resolved (a metadata-only folder).
274 IOVDbParser folderpar(m_folderDescription, msg());
275 m_timestamp = folderpar.timebaseIs_nsOfEpoch();
276
277 // Reported here rather than in the constructor because the timebase
278 // decides how the override key reads
279 if (m_iovoverridden) {
280 if (m_timestamp) {
281 ATH_MSG_INFO("Override timestamp to " << m_iovoverride << " for folder " << m_foldername);
282 } else {
284 ATH_MSG_INFO("Override run/LB number to [" << run << ":" << lumi << "] for folder " << m_foldername);
285 }
286 }
287
288 // File metadata carries no CREST tag to derive the timebase from.
289 // A missing <timeStamp> defaults to run-lumi and logs a WARNING.
290 if (m_useFileMetaData && !folderpar.at("timeStamp").second) {
291 ATH_MSG_WARNING("Folder " << m_foldername
292 << "'s file metadata has no <timeStamp> element. Defaulting to run-lumi, "
293 << "which is wrong if the folder's CREST tag is time-indexed");
294 }
295
296 IOVDbNamespace::FolderAddressSpec resolved;
298 return nullptr;
299 }
300
301 m_key = std::move(resolved.key);
302 m_named = resolved.named;
303 m_addrheader = std::move(resolved.addrheader);
304 m_typename = std::move(resolved.typeName);
305 m_clid = resolved.clid;
306
307 if (not m_useFileMetaData) {
308 // Get all channel IDs and names from the tag's channel spec
309 const auto& channels = m_tag->getChannelSpec().channels();
310 m_channums.clear();
311 m_channames.clear();
312 for (const auto& ch : channels) {
313 m_channums.push_back(static_cast<cool::ChannelId>(ch.id));
314 m_channames.push_back(ch.name);
315 }
316
319 return nullptr;
320 }
321
322 // The node description and the tag's isVectorPayload() flag must agree on vector vs scalar
323 if ((m_foldertype == IOVDbNamespace::CoolVector) != m_tag->isVectorPayload()) {
324 ATH_MSG_FATAL("Folder " << m_foldername << " (tag " << m_tag->getName()
325 << ") disagrees on vector-ness between its node description (typeName-derived "
326 << "folder type " << IOVDbNamespace::folderTypeName(m_foldertype)
327 << ") and its CHAI tag metadata (isVectorPayload()="
328 << (m_tag->isVectorPayload() ? "true" : "false") << ")");
329 return nullptr;
330 }
331 }
332
333 // For folders read from metadata, folder-type identification is
334 // done in getAddress(). Channel number/name info is never read.
335 m_nchan = m_channums.size();
336 ATH_MSG_DEBUG("Folder identified as type " << m_foldertype);
337
338 // Get the transient address while handling any symlinks
339 const auto& linknameVector = folderpar.symLinks();
340 auto tad{createTransientAddress(linknameVector)};
341 if (not tad) {
342 ATH_MSG_WARNING("Transient address is null in " << __func__);
343 return nullptr;
344 }
345 return tad;
346}
std::unique_ptr< SG::TransientAddress > createTransientAddress(const std::vector< std::string > &symlinks)
unsigned int m_nchan
IOVDbNamespace::FolderType determineFolderType() const
std::string m_typename
std::string folderTypeName(const FolderType f)
Give a string name for the folder type.
std::pair< unsigned long long, unsigned long long > runLumiFromIovTime(const unsigned long long iovTime)
Return a [run,lumi] pair from an IOV time.
TimeStampCorrectionResult correctTimeStampElement(const std::string &description, const std::string &token)
Force a folder/node description's <timeStamp> element to the given token ("time" or "run-lumi"),...
bool resolveFolderAddress(MsgStream &log, const IOVDbParser &parsedDescription, const std::string &folderName, bool jokey, const std::string &currentKey, IClassIDSvc *clidSvc, FolderAddressSpec &result)
correction(mu, runmode, campaign, run=None)
Definition zlumi_mc_cf.py:4
std::string addrheader
Address header string from the description. Empty if it has none.
bool named
Folder has named channels.
std::string typeName
Primary type name, read from the description.
std::string key
SG key (unchanged unless the description overrides it).
CLID clid
CLID, read from the description or resolved via IClassIDSvc.
int run(int argc, char *argv[])

◆ printState()

void IOVDbCrestTag::printState ( )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 679 of file IOVDbCrestTag.cxx.

679 {
680 ATH_MSG_DEBUG("folder cache printout -------------------");
681 if (m_resident) {
682 unsigned int nchan = 0;
683 if (!std::holds_alternative<std::monostate>(m_resident->payload)) {
685 ? std::get<chai::PayloadResult<chai::VectorContainer>>(m_resident->payload).payload.channelIds().size()
686 : std::get<chai::PayloadResult<chai::Container>>(m_resident->payload).payload.channelIds().size();
687 }
688 ATH_MSG_DEBUG(m_foldername << "\tsince: " << m_resident->since << "\tuntil: "
689 << m_resident->until << "\tchannels: " << nchan);
690 } else {
691 ATH_MSG_DEBUG(m_foldername << "\tno resident payload");
692 }
693 ATH_MSG_DEBUG("current range: " << m_currange);
694 ATH_MSG_DEBUG("folder cache printout -------------------");
695}

◆ readMeta()

bool IOVDbCrestTag::readMeta ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 243 of file IOVDbCrestTag.h.

243{ return m_useFileMetaData; }

◆ readTime()

float IOVDbCrestTag::readTime ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 265 of file IOVDbCrestTag.h.

265{ return m_readtime; }

◆ reset()

void IOVDbCrestTag::reset ( )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 153 of file IOVDbCrestTag.cxx.

153 {
154 m_resident.reset();
155}

◆ resolvedTag()

const std::string & IOVDbCrestTag::resolvedTag ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 257 of file IOVDbCrestTag.h.

257{ return m_resolvedTagName; }

◆ retrieved()

bool IOVDbCrestTag::retrieved ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 235 of file IOVDbCrestTag.h.

235{ return m_retrieved; }

◆ setDropped()

void IOVDbCrestTag::setDropped ( const bool dropped)
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 276 of file IOVDbCrestTag.h.

bool dropped() const override

◆ setFolderDescription()

void IOVDbCrestTag::setFolderDescription ( const std::string & description)
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 239 of file IOVDbCrestTag.h.

239 {
241}
std::string description
glabal timer - how long have I taken so far?
Definition hcg.cxx:93

◆ setIOVOverride()

void IOVDbCrestTag::setIOVOverride ( const unsigned int run,
const unsigned int lumiblock,
const unsigned int time )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 127 of file IOVDbCrestTag.cxx.

127 {
128 if (m_iovoverridden) {
129 return;
130 }
131 if (m_timestamp) {
132 if (time != 0) {
134 ATH_MSG_INFO("Override timestamp to " << m_iovoverride << " for folder " << m_foldername);
135 m_iovoverridden = true;
136 }
137 } else {
138 if (run != 0 || lumiblock != 0) {
140 ATH_MSG_INFO("Override run/LB number to [" << run << ":" << lumiblock << "] for folder " << m_foldername);
141 m_iovoverridden = true;
142 }
143 }
144}
unsigned long long iovTimeFromSeconds(const unsigned long long seconds)
Create a long long time in ns from s.
unsigned long long iovTimeFromRunLumi(const unsigned long long run, const unsigned long long lumi)
Create a long long representing the IOV from run, lumi.

◆ setLevel()

void AthMessaging::setLevel ( MSG::Level lvl)
inherited

Change the current logging level.

Use this rather than msg().setLevel() for proper operation with MT.

Definition at line 28 of file AthMessaging.cxx.

29{
30 m_lvl = lvl;
31}

◆ setTagOverride()

void IOVDbCrestTag::setTagOverride ( const std::string & tag,
const bool setFlag )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 114 of file IOVDbCrestTag.cxx.

114 {
115 // Never reached for CREST tags (IOVDbSvc::processTagInfo skips them).
116 // CREST tags come from the GlobalTag mapping or <ctag>, not TagInfo.
117 if (setFlag) {
118 m_tagoverride = true;
119 }
121}
bool m_tagoverride
Unused on the CREST path. Present to satisfy IOVDbConditionsSource.

◆ setWriteMeta()

void IOVDbCrestTag::setWriteMeta ( )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 123 of file IOVDbCrestTag.cxx.

123 {
124 m_writemeta = true;
125}

◆ source()

const IOVDbCrestTag::source_t & IOVDbCrestTag::source ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 220 of file IOVDbCrestTag.h.

220 {
221 static constexpr source_t s_source{source_t::CRESTDB};
222 return s_source;
223}

◆ summary()

void IOVDbCrestTag::summary ( )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 669 of file IOVDbCrestTag.cxx.

669 {
671 << ") db-read " << m_ndbread << "/" << m_ncacheread << " objs/chan/bytes "
672 << m_nobjread << "/" << m_nchan << "/" << m_nbytesread << " (( " << std::fixed
673 << std::setw(8) << std::setprecision(2) << m_readtime << " ))s");
674 if (m_ncacheread == 0 && m_ndbread > 0) {
675 ATH_MSG_WARNING("Folder " << m_foldername << " is requested but no data retrieved");
676 }
677}

◆ tagOverride()

bool IOVDbCrestTag::tagOverride ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 231 of file IOVDbCrestTag.h.

231{ return m_tagoverride; }

◆ timeStamp()

bool IOVDbCrestTag::timeStamp ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 229 of file IOVDbCrestTag.h.

229{ return m_timestamp; }

◆ useFileMetaData()

void IOVDbCrestTag::useFileMetaData ( )
overridevirtual

Implements IOVDbConditionsSource.

Definition at line 106 of file IOVDbCrestTag.cxx.

106 {
107 m_useFileMetaData = true;
108 if (m_conn != nullptr) {
109 m_conn->decUsage();
110 m_conn = nullptr;
111 }
112}

◆ writeMeta()

bool IOVDbCrestTag::writeMeta ( ) const
inlineoverridevirtual

Implements IOVDbConditionsSource.

Definition at line 245 of file IOVDbCrestTag.h.

245{ return m_writemeta; }

Member Data Documentation

◆ ATLAS_THREAD_SAFE

std::atomic_flag m_initialized AthMessaging::ATLAS_THREAD_SAFE = ATOMIC_FLAG_INIT
mutableprivateinherited

Messaging initialized (initMessaging).

Definition at line 141 of file AthMessaging.h.

◆ m_addrheader

std::string IOVDbCrestTag::m_addrheader
private

Definition at line 191 of file IOVDbCrestTag.h.

◆ m_cachespec

coral::AttributeListSpecification* IOVDbCrestTag::m_cachespec {nullptr}
private

Definition at line 214 of file IOVDbCrestTag.h.

214{nullptr};

◆ m_channames

std::vector<std::string> IOVDbCrestTag::m_channames
private

Definition at line 203 of file IOVDbCrestTag.h.

◆ m_channums

std::vector<cool::ChannelId> IOVDbCrestTag::m_channums
private

Definition at line 202 of file IOVDbCrestTag.h.

◆ m_chanrange

std::vector<std::pair<cool::ChannelId, cool::ChannelId> > IOVDbCrestTag::m_chanrange
private

Definition at line 207 of file IOVDbCrestTag.h.

◆ m_clid

CLID IOVDbCrestTag::m_clid {0}
private

Definition at line 193 of file IOVDbCrestTag.h.

193{0};

◆ m_conn

IOVDbConn* IOVDbCrestTag::m_conn {nullptr}
private

Unused for CREST I/O; kept for per-connection usage counting.

Definition at line 167 of file IOVDbCrestTag.h.

167{nullptr};

◆ m_currange

IOVRange IOVDbCrestTag::m_currange
private

Definition at line 210 of file IOVDbCrestTag.h.

◆ m_db

chai::Database* IOVDbCrestTag::m_db {nullptr}
private

Non-owning pointer to the shared chai::Database.

Definition at line 168 of file IOVDbCrestTag.h.

168{nullptr};

◆ m_dropped

bool IOVDbCrestTag::m_dropped {false}
private

Definition at line 184 of file IOVDbCrestTag.h.

184{false};

◆ m_eventstore

std::string IOVDbCrestTag::m_eventstore
private

Definition at line 190 of file IOVDbCrestTag.h.

◆ m_extensible

bool IOVDbCrestTag::m_extensible {false}
private

Definition at line 180 of file IOVDbCrestTag.h.

180{false};

◆ m_folderDescription

std::string IOVDbCrestTag::m_folderDescription
private

Definition at line 171 of file IOVDbCrestTag.h.

◆ m_foldername

std::string IOVDbConditionsSource::m_foldername
protectedinherited

Folder name, as it appears in COOL or as a CREST tag label.

Definition at line 123 of file IOVDbConditionsSource.h.

◆ m_foldertype

IOVDbNamespace::FolderType IOVDbCrestTag::m_foldertype {IOVDbNamespace::UNKNOWN}
private

Definition at line 186 of file IOVDbCrestTag.h.

◆ m_fromMetaDataOnly

bool IOVDbCrestTag::m_fromMetaDataOnly {false}
private

Definition at line 179 of file IOVDbCrestTag.h.

179{false};

◆ m_imsg

std::atomic<IMessageSvc*> AthMessaging::m_imsg { nullptr }
mutableprivateinherited

MessageSvc pointer.

Definition at line 135 of file AthMessaging.h.

135{ nullptr };

◆ m_iovoverridden

bool IOVDbCrestTag::m_iovoverridden {false}
private

Definition at line 182 of file IOVDbCrestTag.h.

182{false};

◆ m_iovoverride

cool::ValidityKey IOVDbCrestTag::m_iovoverride {0}
private

Definition at line 185 of file IOVDbCrestTag.h.

185{0};

◆ m_jokey

bool IOVDbCrestTag::m_jokey {false}
private

Definition at line 183 of file IOVDbCrestTag.h.

183{false};

◆ m_jotag

std::string IOVDbCrestTag::m_jotag
private

Explicit <tag>/<ctag> from job options. Used only for /TagInfo.

Definition at line 188 of file IOVDbCrestTag.h.

◆ m_key

std::string IOVDbConditionsSource::m_key
protectedinherited

SG key where data is loaded (unique).

Definition at line 124 of file IOVDbConditionsSource.h.

◆ m_lvl

std::atomic<MSG::Level> AthMessaging::m_lvl { MSG::NIL }
mutableprivateinherited

Current logging level.

Definition at line 138 of file AthMessaging.h.

138{ MSG::NIL };

◆ m_msg_tls

boost::thread_specific_ptr<MsgStream> AthMessaging::m_msg_tls
mutableprivateinherited

MsgStream instance (a std::cout like with print-out levels).

Definition at line 132 of file AthMessaging.h.

◆ m_named

bool IOVDbCrestTag::m_named {false}
private

Definition at line 181 of file IOVDbCrestTag.h.

181{false};

◆ m_nbytesread

unsigned long long IOVDbCrestTag::m_nbytesread {0}
private

Definition at line 198 of file IOVDbCrestTag.h.

198{0};

◆ m_ncacheread

unsigned int IOVDbCrestTag::m_ncacheread {0}
private

Definition at line 195 of file IOVDbCrestTag.h.

195{0};

◆ m_nchan

unsigned int IOVDbCrestTag::m_nchan {0}
private

Definition at line 201 of file IOVDbCrestTag.h.

201{0};

◆ m_ndbread

unsigned int IOVDbCrestTag::m_ndbread {0}
private

Definition at line 196 of file IOVDbCrestTag.h.

196{0};

◆ m_nm

std::string AthMessaging::m_nm
privateinherited

Message source name.

Definition at line 129 of file AthMessaging.h.

◆ m_nobjread

unsigned int IOVDbCrestTag::m_nobjread {0}
private

Definition at line 197 of file IOVDbCrestTag.h.

197{0};

◆ m_notagoverride

bool IOVDbCrestTag::m_notagoverride {false}
private

Unused on the CREST path. Present to satisfy IOVDbConditionsSource.

Definition at line 175 of file IOVDbCrestTag.h.

175{false};

◆ m_readtime

float IOVDbCrestTag::m_readtime {0}
private

Definition at line 199 of file IOVDbCrestTag.h.

199{0};

◆ m_resident

std::optional<Resident> IOVDbCrestTag::m_resident
private

Definition at line 216 of file IOVDbCrestTag.h.

◆ m_resolvedTagName

std::string IOVDbCrestTag::m_resolvedTagName
private

The CREST tag name actually used for lookup.

Definition at line 189 of file IOVDbCrestTag.h.

◆ m_retrieved

bool IOVDbCrestTag::m_retrieved {false}
private

Definition at line 209 of file IOVDbCrestTag.h.

209{false};

◆ m_tag

chai::TagPtr IOVDbCrestTag::m_tag
private

Resolved in preload(). Stays null for a metadata-only folder.

Definition at line 169 of file IOVDbCrestTag.h.

◆ m_tagoverride

bool IOVDbCrestTag::m_tagoverride {false}
private

Unused on the CREST path. Present to satisfy IOVDbConditionsSource.

Definition at line 174 of file IOVDbCrestTag.h.

174{false};

◆ m_timestamp

bool IOVDbCrestTag::m_timestamp {false}
private

Indexed by timestamp (else runLB), from tag->getIovType().

Definition at line 172 of file IOVDbCrestTag.h.

172{false};

◆ m_typename

std::string IOVDbCrestTag::m_typename
private

Definition at line 192 of file IOVDbCrestTag.h.

◆ m_useFileMetaData

bool IOVDbCrestTag::m_useFileMetaData {false}
private

Definition at line 178 of file IOVDbCrestTag.h.

178{false};

◆ m_writemeta

bool IOVDbCrestTag::m_writemeta {false}
private

Definition at line 177 of file IOVDbCrestTag.h.

177{false};

◆ p_clidSvc

IClassIDSvc* IOVDbCrestTag::p_clidSvc {nullptr}
private

Definition at line 165 of file IOVDbCrestTag.h.

165{nullptr};

◆ p_metaDataTool

IIOVDbMetaDataTool* IOVDbCrestTag::p_metaDataTool {nullptr}
private

Definition at line 166 of file IOVDbCrestTag.h.

166{nullptr};

The documentation for this class was generated from the following files: