![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
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_processedFirstInputFileIncident(false)
32 , m_overrideRunNumber(false)
33 , m_overrideMinMaxRunNumber(false)
38 , m_modifyFolders(false)
41 declareInterface<IIOVDbMetaDataTool>(
this);
42 declareInterface<IMetaDataTool>(
this);
69 incSvc->addListener(
this,
"FirstInputFile", 60);
79 return(StatusCode::SUCCESS);
87 return StatusCode::SUCCESS;
94 const FileIncident* fileInc =
dynamic_cast<const FileIncident*
>(&inc);
95 if(!fileInc)
throw std::runtime_error(
"Unable to get FileName from FirstInputFile incident");
97 const std::string
fileName = fileInc->fileName();
105 if(!
sc.isSuccess())
throw std::runtime_error(
"Could not process input file meta data");
113 ATH_MSG_DEBUG(
"The first BeginInputFile incident is fired along with the FirstInputFile incident so we skip the processing of the Input File MetaData ");
114 return StatusCode::SUCCESS;
123 return StatusCode::SUCCESS;
128 return StatusCode::SUCCESS;
154 ATH_MSG_DEBUG(
"checkOverrideRunNumber: check if tag is set in jobOpts");
158 IProperty* propertyServer(0);
159 StatusCode sc = serviceLocator()->service(
"ApplicationMgr", propertyServer);
160 if (
sc != StatusCode::SUCCESS ) {
161 ATH_MSG_ERROR(
"checkOverrideRunNumber: Cannot get ApplicationMgr ");
164 StringProperty property(
"EvtSel",
"");
165 sc = propertyServer->getProperty(&property);
166 if (!
sc.isSuccess()) {
167 ATH_MSG_ERROR(
"checkOverrideRunNumber: unable to get EvtSel: found " << property.value());
173 if (
sc != StatusCode::SUCCESS ) {
179 BooleanProperty overrideRunNumber = IntegerProperty(
"OverrideRunNumberFromInput",
false);
180 sc = propertyServer->getProperty(&overrideRunNumber);
181 if (!
sc.isSuccess()) {
183 ATH_MSG_DEBUG(
"resetRunNumber: unable to get OverrideRunNumberFromInput property from EventSelector ");
189 IntegerProperty
runNumber = IntegerProperty(
"RunNumber", 0);
191 if (!
sc.isSuccess()) {
192 ATH_MSG_ERROR(
"checkOverrideRunNumber: unable to get RunNumber from EventSelector: found "
198 runNumber = IntegerProperty(
"OldRunNumber", 0);
200 if (!
sc.isSuccess()) {
201 ATH_MSG_ERROR(
"checkOverrideRunNumber: unable to get OldRunNumber from EventSelector: found "
220 std::string folderDescr =
"<timeStamp>run-event</timeStamp><addrHeader><address_header service_type=\"256\" clid=\"1238547719\" /> </addrHeader><typeName>CondAttrListCollection</typeName>" ;
229 const std::string& folderDescription)
const
232 std::scoped_lock guard(
m_mutex );
238 return(StatusCode::FAILURE);
244 return StatusCode::SUCCESS;
253 std::scoped_lock guard(
m_mutex );
260 ATH_MSG_DEBUG(
"Retrieved IOVMetaDataContainer from MetaDataStore for folder "
264 ATH_MSG_ERROR(
"addPayload: Could not find IOVMetaDataContainer in MetaDataStore for folder "
266 <<
". One must have previously called registerFolder. ");
267 return StatusCode::FAILURE;
283 <<
" (may be duplicate payload).");
292 std::ostringstream
stream;
297 return StatusCode::SUCCESS;
313 bool modifyAttr =
false;
314 std::string attributeName;
317 for (
unsigned int i = 0;
i <
folders.size(); ++
i) {
322 ATH_MSG_DEBUG(
"modifyPayload: remove attribute " << attributeName);
330 return StatusCode::SUCCESS;
333 bool iovSizeIsZero = coll->
iov_size() == 0;
346 unsigned int nchans = coll->
size();
347 bool hasChanNames = (coll->
name_size() == nchans);
353 for (
unsigned int iatt = 0; iatt < oldAttrList.size(); ++iatt) {
355 if (attributeName == oldAttrList[iatt].specification().name()) {
356 ATH_MSG_DEBUG(
"modifyPayload: skipping attribute name " << oldAttrList[iatt].specification().
name());
361 newAttrList.extend(oldAttrList[iatt].specification().
name(),
362 oldAttrList[iatt].specification().
type());
363 const coral::Attribute& oldAttr = oldAttrList[iatt];
364 coral::Attribute& newAttr = newAttrList[oldAttrList[iatt].specification().name()];
368 << oldAttrList[iatt].specification().
name() <<
" "
379 std::ostringstream
stream;
384 return StatusCode::SUCCESS;
400 ,
const std::string& folderDescription)
const
411 <<
". Created a new instance");
413 if (!
sc.isSuccess()) {
422 if (!
sc.isSuccess()) {
435 std::scoped_lock guard(
m_mutex );
444 if (!
sc.isSuccess()) {
445 ATH_MSG_DEBUG(
"processInputFileMetaData: Could not retrieve IOVMetaDataContainer objects from InputMetaDataStore - cannot process input file meta data");
446 return StatusCode::SUCCESS;
449 ATH_MSG_DEBUG(
"processInputFileMetaData: Retrieved from IOVMetaDataContainer(s) from InputMetaDataStore");
452 unsigned int ncolls = 0;
453 unsigned int ndupColls = 0;
454 for (; cont != contEnd; ++cont) {
456 , cont->folderDescription());
460 std::list<SG::ObjectWithVersion<IOVMetaDataContainer> > allVersions;
462 if (!
sc.isSuccess()) {
470 ATH_MSG_DEBUG(
"processInputFileMetaData: New container: payload size " <<
payload->size() <<
" version key " <<
obj.versionedKey);
475 ATH_MSG_VERBOSE(
"Before merge, payload minRange for folder " << cont->folderName());
476 if (payloadMaster && payloadMaster->
size()) {
480 unsigned int iPayload = 0;
481 for (; itColl != itCollEnd; ++itColl, ++iPayload) {
483 << (*itColl)->size());
497 std::ostringstream
stream;
498 for (; itColl1 != itCollEnd1; ++itColl1) (*itColl1)->dump(
stream);
509 for (; itColl != itCollEnd; ++itColl) {
521 ATH_MSG_ERROR(
"processInputFileMetaData: Could not modify the payload for folder " << contMaster->
folderName());
522 return StatusCode::FAILURE;
526 if (!contMaster->
merge(coll)) {
538 ATH_MSG_DEBUG(
"processInputFileMetaData: Merged together containers for folder " << cont->folderName() <<
" ncoll/ndup "
539 << ncolls <<
" " << ndupColls);
543 if (payloadMaster && payloadMaster->
size()) {
548 if ((*itColl)->minRange().start().isTimestamp()) lastStop =
IOVTime(0);
550 bool hasError =
false;
551 for (; itColl != itCollEnd; ++itColl) {
552 if ((*itColl)->minRange().start() < lastStop) hasError =
true;
553 lastStop = (*itColl)->minRange().stop();
556 ATH_MSG_ERROR(
"processInputFileMetaData: error after merge of file meta data. " );
559 ATH_MSG_ERROR(
"processInputFileMetaData: MinRange for meta data folders ");
560 unsigned int iPayload = 0;
561 itColl = payloadMaster->
begin();
562 for (; itColl != itCollEnd; ++itColl, ++iPayload) {
563 ATH_MSG_ERROR(iPayload <<
" " << (*itColl)->minRange() <<
" " << (*itColl)->size());
571 ATH_MSG_VERBOSE(
"processInputFileMetaData: After merge, payload minRange ");
576 unsigned int iPayload = 0;
577 for (; itColl != itCollEnd; ++itColl, ++iPayload) {
579 << (*itColl)->size());
587 ATH_MSG_DEBUG(
"processInputFileMetaData: Input payload " << cont->folderName());
588 std::ostringstream streamInp;
591 for (; itColl != itCollEnd; ++itColl) (*itColl)->dump(streamInp);
594 std::ostringstream streamOut;
597 for (; itColl != itCollEnd; ++itColl) (*itColl)->dump(streamOut);
603 ATH_MSG_DEBUG(
"processInputFileMetaData: Total number of attribute collections merged together " << ncolls
604 <<
" Number of duplicate collections " << ndupColls);
605 return StatusCode::SUCCESS;
623 bool iovSizeIsZero = coll->
iov_size() == 0;
628 if (
start.isRunEvent() &&
stop.isRunEvent()) {
637 return StatusCode::SUCCESS;
642 <<
" iovSizeIsZero: " << (
int)iovSizeIsZero
643 <<
" newRange " << newRange);
656 unsigned int nchans = coll->
size();
669 ATH_MSG_DEBUG(
"overrideIOV: after overriding the IOV of collection");
670 std::ostringstream
stream;
677 return StatusCode::SUCCESS;
void resetMinRange()
Reset minRange according to the IOVs of the contained channels.
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
IOVRange minRange() const
Current minimal IOVRange.
void addNewStop(const IOVTime &stop)
Add new stop time to minRange - make sure that stop is <= to new stop
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
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
bool msgLvl(const MSG::Level lvl) 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.