 |
ATLAS Offline Software
|
This is an interface to a tool used to manage the IOV Meta Data for a given object in the Meta Data Store.
More...
#include <IOVDbMetaDataTool.h>
This is an interface to a tool used to manage the IOV Meta Data for a given object in the Meta Data Store.
Definition at line 39 of file IOVDbMetaDataTool.h.
◆ StoreGateSvc_t
◆ IOVDbMetaDataTool()
IOVDbMetaDataTool::IOVDbMetaDataTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~IOVDbMetaDataTool()
IOVDbMetaDataTool::~IOVDbMetaDataTool |
( |
| ) |
|
|
virtual |
◆ addPayload()
Add an IOV and Payload for a particular folder - replaces payloads if there is an IOV overlap.
Definition at line 230 of file IOVDbMetaDataTool.cxx.
234 std::scoped_lock guard(
m_mutex );
241 ATH_MSG_DEBUG(
"Retrieved IOVMetaDataContainer from MetaDataStore for folder "
245 ATH_MSG_ERROR(
"addPayload: Could not find IOVMetaDataContainer in MetaDataStore for folder "
247 <<
". One must have previously called registerFolder. ");
248 return StatusCode::FAILURE;
264 <<
" (may be duplicate payload).");
273 std::ostringstream
stream;
278 return StatusCode::SUCCESS;
◆ beginInputFile()
Function called when a new input file is opened.
Definition at line 94 of file IOVDbMetaDataTool.cxx.
100 return StatusCode::SUCCESS;
◆ checkOverrideRunNumber()
void IOVDbMetaDataTool::checkOverrideRunNumber |
( |
| ) |
|
|
private |
check if we should override the run number in the incoming meta data
Definition at line 116 of file IOVDbMetaDataTool.cxx.
136 ATH_MSG_DEBUG(
"checkOverrideRunNumber: check if tag is set in jobOpts");
140 SmartIF<IProperty> appMgr{serviceLocator()->service(
"ApplicationMgr")};
142 ATH_MSG_ERROR(
"checkOverrideRunNumber: Cannot get ApplicationMgr ");
145 StringProperty property(
"EvtSel",
"");
147 if (!
sc.isSuccess()) {
148 ATH_MSG_ERROR(
"checkOverrideRunNumber: unable to get EvtSel: found " << property.value());
153 SmartIF<IProperty> evtSel{serviceLocator()->service(
eventSelector)};
160 BooleanProperty overrideRunNumber(
"OverrideRunNumberFromInput",
false);
161 sc = evtSel->getProperty(&overrideRunNumber);
162 if (!
sc.isSuccess()) {
164 ATH_MSG_DEBUG(
"resetRunNumber: unable to get OverrideRunNumberFromInput property from EventSelector ");
170 IntegerProperty
runNumber(
"RunNumber", 0);
172 if (!
sc.isSuccess()) {
173 ATH_MSG_ERROR(
"checkOverrideRunNumber: unable to get RunNumber from EventSelector: found "
179 IntegerProperty oldRunNumber(
"OldRunNumber", 0);
180 sc = evtSel->getProperty(&oldRunNumber);
181 if (!
sc.isSuccess()) {
182 ATH_MSG_ERROR(
"checkOverrideRunNumber: unable to get OldRunNumber from EventSelector: found "
183 << oldRunNumber.value());
◆ endInputFile()
Function called when the currently open input file got completely processed.
Definition at line 103 of file IOVDbMetaDataTool.cxx.
105 return StatusCode::SUCCESS;
◆ finalize()
StatusCode IOVDbMetaDataTool::finalize |
( |
| ) |
|
|
overridevirtual |
◆ findMetaDataContainer()
◆ getMetaDataContainer()
return meta data container from the meta data store
Definition at line 380 of file IOVDbMetaDataTool.cxx.
392 <<
". Created a new instance");
394 if (!
sc.isSuccess()) {
403 if (!
sc.isSuccess()) {
◆ handle()
void IOVDbMetaDataTool::handle |
( |
const Incident & |
incident | ) |
|
|
overridevirtual |
Incident service handle listening for BeginInputFile and EndInputFile.
Definition at line 78 of file IOVDbMetaDataTool.cxx.
80 const FileIncident* fileInc =
dynamic_cast<const FileIncident*
>(&inc);
81 if(!fileInc)
throw std::runtime_error(
"Unable to get FileName from FirstInputFile incident");
83 const std::string
fileName = fileInc->fileName();
90 if(!
sc.isSuccess())
throw std::runtime_error(
"Could not process input file meta data");
◆ initialize()
StatusCode IOVDbMetaDataTool::initialize |
( |
| ) |
|
|
overridevirtual |
Initialize AlgTool.
Definition at line 48 of file IOVDbMetaDataTool.cxx.
55 incSvc->addListener(
this,
"FirstInputFile", 60);
65 return(StatusCode::SUCCESS);
◆ lock_shared()
virtual void IOVDbMetaDataTool::lock_shared |
( |
| ) |
const |
|
inlinefinaloverridevirtual |
◆ metaDataStop()
StatusCode IOVDbMetaDataTool::metaDataStop |
( |
| ) |
|
|
overridevirtual |
Function called when the tool should write out its metadata.
Definition at line 108 of file IOVDbMetaDataTool.cxx.
110 return StatusCode::SUCCESS;
◆ modifyPayload()
Modify a Payload for a particular folder - replaces one of the internal attributes.
Modify a Payload for a particular folder - replaces one of the internal attributes
Definition at line 284 of file IOVDbMetaDataTool.cxx.
294 bool modifyAttr =
false;
295 std::string attributeName;
298 for (
unsigned int i = 0;
i <
folders.size(); ++
i) {
303 ATH_MSG_DEBUG(
"modifyPayload: remove attribute " << attributeName);
311 return StatusCode::SUCCESS;
314 bool iovSizeIsZero = coll->iov_size() == 0;
315 IOVRange testIOV = coll->minRange();
327 unsigned int nchans = coll->size();
328 bool hasChanNames = (coll->name_size() == nchans);
334 for (
unsigned int iatt = 0; iatt < oldAttrList.size(); ++iatt) {
336 if (attributeName == oldAttrList[iatt].specification().name()) {
337 ATH_MSG_DEBUG(
"modifyPayload: skipping attribute name " << oldAttrList[iatt].specification().
name());
342 newAttrList.extend(oldAttrList[iatt].specification().
name(),
343 oldAttrList[iatt].specification().
type());
344 const coral::Attribute& oldAttr = oldAttrList[iatt];
345 coral::Attribute& newAttr = newAttrList[oldAttrList[iatt].specification().name()];
349 << oldAttrList[iatt].specification().
name() <<
" "
353 if (!iovSizeIsZero) coll1->
add(
chan, coll->iovRange(
chan));
354 if(hasChanNames)coll1->
add(
chan, coll->chanName(
chan));
360 std::ostringstream
stream;
365 return StatusCode::SUCCESS;
◆ overrideIOV()
override IOV with new run number
Definition at line 592 of file IOVDbMetaDataTool.cxx.
604 bool iovSizeIsZero = coll->
iov_size() == 0;
609 if (
start.isRunEvent() &&
stop.isRunEvent()) {
618 return StatusCode::SUCCESS;
623 <<
" iovSizeIsZero: " << (
int)iovSizeIsZero
624 <<
" newRange " << newRange);
637 unsigned int nchans = coll->
size();
650 ATH_MSG_DEBUG(
"overrideIOV: after overriding the IOV of collection");
651 std::ostringstream
stream;
658 return StatusCode::SUCCESS;
◆ processInputFileMetaData()
StatusCode IOVDbMetaDataTool::processInputFileMetaData |
( |
const std::string & |
fileName | ) |
|
|
overridevirtual |
Explicit call to process IOV meta data from the input meta data store, transferring it to the main meta data store.
Normally, this method is called at the BeginInputFile incident. However, this explicit call allows the transfer to occur during the initialization phase, which occurs before BeginInputFile incident.
Definition at line 413 of file IOVDbMetaDataTool.cxx.
416 std::scoped_lock guard(
m_mutex );
425 if (!
sc.isSuccess()) {
426 ATH_MSG_DEBUG(
"processInputFileMetaData: Could not retrieve IOVMetaDataContainer objects from InputMetaDataStore - cannot process input file meta data");
427 return StatusCode::SUCCESS;
430 ATH_MSG_DEBUG(
"processInputFileMetaData: Retrieved from IOVMetaDataContainer(s) from InputMetaDataStore");
433 unsigned int ncolls = 0;
434 unsigned int ndupColls = 0;
435 for (; cont != contEnd; ++cont) {
437 , cont->folderDescription());
441 std::list<SG::ObjectWithVersion<IOVMetaDataContainer> > allVersions;
443 if (!
sc.isSuccess()) {
451 ATH_MSG_DEBUG(
"processInputFileMetaData: New container: payload size " <<
payload->size() <<
" version key " <<
obj.versionedKey);
456 ATH_MSG_VERBOSE(
"Before merge, payload minRange for folder " << cont->folderName());
457 if (payloadMaster && payloadMaster->
size()) {
461 unsigned int iPayload = 0;
462 for (; itColl != itCollEnd; ++itColl, ++iPayload) {
464 << (*itColl)->size());
478 std::ostringstream
stream;
479 for (; itColl1 != itCollEnd1; ++itColl1) (*itColl1)->dump(
stream);
490 for (; itColl != itCollEnd; ++itColl) {
502 ATH_MSG_ERROR(
"processInputFileMetaData: Could not modify the payload for folder " << contMaster->
folderName());
503 return StatusCode::FAILURE;
507 if (!contMaster->
merge(coll)) {
519 ATH_MSG_DEBUG(
"processInputFileMetaData: Merged together containers for folder " << cont->folderName() <<
" ncoll/ndup "
520 << ncolls <<
" " << ndupColls);
524 if (payloadMaster && payloadMaster->
size()) {
529 if ((*itColl)->minRange().start().isTimestamp()) lastStop =
IOVTime(0);
531 bool hasError =
false;
532 for (; itColl != itCollEnd; ++itColl) {
533 if ((*itColl)->minRange().start() < lastStop) hasError =
true;
534 lastStop = (*itColl)->minRange().stop();
537 ATH_MSG_ERROR(
"processInputFileMetaData: error after merge of file meta data. " );
540 ATH_MSG_ERROR(
"processInputFileMetaData: MinRange for meta data folders ");
541 unsigned int iPayload = 0;
542 itColl = payloadMaster->
begin();
543 for (; itColl != itCollEnd; ++itColl, ++iPayload) {
544 ATH_MSG_ERROR(iPayload <<
" " << (*itColl)->minRange() <<
" " << (*itColl)->size());
552 ATH_MSG_VERBOSE(
"processInputFileMetaData: After merge, payload minRange ");
557 unsigned int iPayload = 0;
558 for (; itColl != itCollEnd; ++itColl, ++iPayload) {
560 << (*itColl)->size());
568 ATH_MSG_DEBUG(
"processInputFileMetaData: Input payload " << cont->folderName());
569 std::ostringstream streamInp;
572 for (; itColl != itCollEnd; ++itColl) (*itColl)->dump(streamInp);
575 std::ostringstream streamOut;
578 for (; itColl != itCollEnd; ++itColl) (*itColl)->dump(streamOut);
584 ATH_MSG_DEBUG(
"processInputFileMetaData: Total number of attribute collections merged together " << ncolls
585 <<
" Number of duplicate collections " << ndupColls);
586 return StatusCode::SUCCESS;
◆ registerFolder() [1/2]
StatusCode IOVDbMetaDataTool::registerFolder |
( |
const std::string & |
folderName | ) |
const |
|
overridevirtual |
Register folder in the IOV Db MetaData without folder description - uses default folder description for CondAttrListCollection.
Definition at line 197 of file IOVDbMetaDataTool.cxx.
201 std::string
folderDescr =
"<timeStamp>run-event</timeStamp><addrHeader><address_header service_type=\"256\" clid=\"1238547719\" /> </addrHeader><typeName>CondAttrListCollection</typeName>" ;
◆ registerFolder() [2/2]
StatusCode IOVDbMetaDataTool::registerFolder |
( |
const std::string & |
folderName, |
|
|
const std::string & |
folderDescription |
|
) |
| const |
|
overridevirtual |
Register folder in the IOV Db MetaData - done once at initialize.
Definition at line 209 of file IOVDbMetaDataTool.cxx.
213 std::scoped_lock guard(
m_mutex );
219 return(StatusCode::FAILURE);
225 return StatusCode::SUCCESS;
◆ unlock_shared()
virtual void IOVDbMetaDataTool::unlock_shared |
( |
| ) |
const |
|
inlinefinaloverridevirtual |
◆ m_attributesToBeRemoved
StringArrayProperty IOVDbMetaDataTool::m_attributesToBeRemoved {this, "AttributesToBeRemoved", {"RandomSeedOffset"}} |
|
private |
◆ m_filesProcessed
std::set<std::string> IOVDbMetaDataTool::m_filesProcessed |
|
private |
◆ m_foldersToBeModified
StringArrayProperty IOVDbMetaDataTool::m_foldersToBeModified {this, "FoldersToBeModified", {"/Simulation/Parameters"}} |
|
private |
◆ m_inputStore
◆ m_maxRunNumber
unsigned int IOVDbMetaDataTool::m_maxRunNumber |
|
private |
◆ m_metaDataStore
◆ m_minMaxRunNumbers
UnsignedIntegerArrayProperty IOVDbMetaDataTool::m_minMaxRunNumbers {this, "MinMaxRunNumbers", {}, "Min/max run numbers for overriding meta data IOV"} |
|
private |
◆ m_minRunNumber
unsigned int IOVDbMetaDataTool::m_minRunNumber |
|
private |
◆ m_modifyFolders
bool IOVDbMetaDataTool::m_modifyFolders |
|
private |
◆ m_mutex
std::shared_mutex IOVDbMetaDataTool::m_mutex |
|
mutableprivate |
◆ m_newRunNumber
unsigned int IOVDbMetaDataTool::m_newRunNumber |
|
private |
◆ m_oldRunNumber
unsigned int IOVDbMetaDataTool::m_oldRunNumber |
|
private |
◆ m_overrideMinMaxRunNumber
bool IOVDbMetaDataTool::m_overrideMinMaxRunNumber |
|
private |
◆ m_overrideRunNumber
bool IOVDbMetaDataTool::m_overrideRunNumber |
|
private |
The documentation for this class was generated from the following files:
void resetMinRange()
Reset minRange according to the IOVs of the contained channels.
const IOVRange & minRange() const
Current minimal IOVRange.
iov_size_type iov_size() const
number of Chan/IOV pairs
Validity Range object. Holds two IOVTimes (start and stop)
static constexpr uint32_t MAXRUN
void addNewStop(const IOVTime &stop)
Add new stop time to minRange - make sure that stop is <= to new stop
const std::string & key() const
Get the key string with which the current object was stored.
const IOVTime & start() const
bool isInRange(const IOVTime &t) const
void addNewStart(const IOVTime &start)
Add new start time to minRange - make sure that start is >= to new start.
#define ATH_MSG_VERBOSE(x)
This class is a collection of AttributeLists where each one is associated with a channel number....
size_type size() const
size of payload vector
const IOVTime & stop() const
const_iterator begin() const
Begin of payload vector.
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
void dump() const
Dump our contents to std::cout.
::StatusCode StatusCode
StatusCode definition for legacy code.
ChanNum chanNum(unsigned int index) const
channel number for index: (index = 0 to size-1)
This class is a container for the payload of conditions data. It is intended to be used to store cond...
static constexpr uint32_t MAXEVENT
size_type size() const
number of Chan/AttributeList pairs
payloadVec::const_iterator const_iterator
const_iterator end() const
End of payload vector.
coral::AttributeList AttributeList
associate a data object with its VersionedKey The object is held by a ReadHandle to delay its retriev...
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.