 |
ATLAS Offline Software
|
Go to the documentation of this file.
18 #include "GaudiKernel/IIncidentSvc.h"
19 #include "GaudiKernel/FileIncident.h"
26 const std::string&
name,
29 , m_metaDataStore (
"StoreGateSvc/MetaDataStore",
name)
30 , m_inputStore (
"StoreGateSvc/InputMetaDataStore",
name)
31 , m_overrideRunNumber(false)
32 , m_overrideMinMaxRunNumber(false)
37 , m_modifyFolders(false)
55 incSvc->addListener(
this,
"FirstInputFile", 60);
65 return(StatusCode::SUCCESS);
73 return StatusCode::SUCCESS;
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");
100 return StatusCode::SUCCESS;
105 return StatusCode::SUCCESS;
110 return StatusCode::SUCCESS;
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());
201 std::string
folderDescr =
"<timeStamp>run-event</timeStamp><addrHeader><address_header service_type=\"256\" clid=\"1238547719\" /> </addrHeader><typeName>CondAttrListCollection</typeName>" ;
210 const std::string& folderDescription)
const
213 std::scoped_lock guard(
m_mutex );
219 return(StatusCode::FAILURE);
225 return StatusCode::SUCCESS;
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;
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;
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() <<
" "
360 std::ostringstream
stream;
365 return StatusCode::SUCCESS;
381 ,
const std::string& folderDescription)
const
392 <<
". Created a new instance");
394 if (!
sc.isSuccess()) {
403 if (!
sc.isSuccess()) {
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;
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;
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)
const AttributeList & attributeList(ChanNum chanNum) const
attribute list for a given channel number
This class is a container for the payload of conditions data. It is intended to be used to store cond...
const std::string & chanName(ChanNum chanNum) const
find name for particular channel
static constexpr uint32_t MAXEVENT
name_size_type name_size() const
number of Chan/Name pairs
size_type size() const
number of Chan/AttributeList pairs
payloadVec::const_iterator const_iterator
const_iterator end() const
End of payload vector.
const IOVRange & iovRange(ChanNum chanNum) const
IOVRange list for a given channel number.
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.