ATLAS Offline Software
IOVDbMetaDataTool.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
16 #include "IOVDbMetaDataTool.h"
17 
18 #include "GaudiKernel/IIncidentSvc.h"
19 #include "GaudiKernel/FileIncident.h"
20 
21 #include "StoreGate/StoreGateSvc.h"
23 
24 
26  const std::string& name,
27  const IInterface* parent)
28  : base_class(type, name, parent)
29  , m_metaDataStore ("StoreGateSvc/MetaDataStore", name)
30  , m_inputStore ("StoreGateSvc/InputMetaDataStore", name)
31  , m_overrideRunNumber(false)
32  , m_overrideMinMaxRunNumber(false)
33  , m_newRunNumber(0)
34  , m_oldRunNumber(0)
35  , m_minRunNumber(0)
36  , m_maxRunNumber(0)
37  , m_modifyFolders(false)
38 {
39 }
40 
41 //--------------------------------------------------------------------------
43 {}
44 
45 
46 //--------------------------------------------------------------------------
47 
49 {
50  ATH_MSG_DEBUG("in initialize()");
51 
52  // Set to be listener for FirstInputFile
53  ServiceHandle<IIncidentSvc> incSvc("IncidentSvc", this->name());
54  ATH_CHECK(incSvc.retrieve());
55  incSvc->addListener(this, "FirstInputFile", 60); // pri has to be < 100 to be after MetaDataSvc.
56 
57  // locate the meta data stores
58  ATH_CHECK(m_metaDataStore.retrieve());
59  ATH_CHECK(m_inputStore.retrieve());
60 
61  // Check whether folders need to be modified
62  m_modifyFolders = (m_foldersToBeModified.value().size()>0);
63  ATH_MSG_DEBUG("initialize(): " << (m_modifyFolders ? "" : "No ") << "need to modify folders");
64 
65  return(StatusCode::SUCCESS);
66 }
67 
68 //--------------------------------------------------------------------------
69 
72 {
73  return StatusCode::SUCCESS;
74 }
75 
76 //--------------------------------------------------------------------------
77 
78 void IOVDbMetaDataTool::handle(const Incident& inc)
79 {
80  const FileIncident* fileInc = dynamic_cast<const FileIncident*>(&inc);
81  if(!fileInc) throw std::runtime_error("Unable to get FileName from FirstInputFile incident");
82 
83  const std::string fileName = fileInc->fileName();
84  ATH_MSG_DEBUG("handle() " << inc.type() << " for " << fileName);
85 
86  // Check if we need to override run number - only needed for simulation
88 
90  if(!sc.isSuccess()) throw std::runtime_error("Could not process input file meta data");
91  m_filesProcessed.insert(std::move(fileName));
92 }
93 
95 {
96  if (!m_filesProcessed.contains(sid)) {
98  m_filesProcessed.insert(sid);
99  }
100  return StatusCode::SUCCESS;
101 }
102 
104 {
105  return StatusCode::SUCCESS;
106 }
107 
109 {
110  return StatusCode::SUCCESS;
111 }
112 
113 //--------------------------------------------------------------------------
114 
115 void
117 {
118  ATH_MSG_DEBUG("begin checkOverrideRunNumber");
119 
120  // Check if override run numbers have been set by properties or by
121  // the EventSelector
122 
123  if (m_minMaxRunNumbers.value().size() > 0) {
125  m_minRunNumber = m_minMaxRunNumbers.value()[0];
126  if (m_minMaxRunNumbers.value().size() > 1) m_maxRunNumber = m_minMaxRunNumbers.value()[1];
128 
130 
131  ATH_MSG_INFO("checkOverrideRunNumber: overriding IOV for range - min: " << m_minRunNumber
132  << " max: " << m_maxRunNumber);
133  return;
134  }
135 
136  ATH_MSG_DEBUG("checkOverrideRunNumber: check if tag is set in jobOpts");
137 
138  // Get name of event selector from the application manager to
139  // make sure we get the one for MC signal events
140  SmartIF<IProperty> appMgr{serviceLocator()->service("ApplicationMgr")};
141  if (!appMgr) {
142  ATH_MSG_ERROR("checkOverrideRunNumber: Cannot get ApplicationMgr ");
143  return;
144  }
145  StringProperty property("EvtSel", "");
146  StatusCode sc = appMgr->getProperty(&property);
147  if (!sc.isSuccess()) {
148  ATH_MSG_ERROR("checkOverrideRunNumber: unable to get EvtSel: found " << property.value());
149  return;
150  }
151  // Get EventSelector for ApplicationMgr
152  const std::string eventSelector = property.value();
153  SmartIF<IProperty> evtSel{serviceLocator()->service(eventSelector)};
154  if (!evtSel) {
155  ATH_MSG_ERROR("checkOverrideRunNumber: Cannot get EventSelector " << eventSelector);
156  return;
157  }
158 
159  // Is flag set to override the run number?
160  BooleanProperty overrideRunNumber("OverrideRunNumberFromInput", false);
161  sc = evtSel->getProperty(&overrideRunNumber);
162  if (!sc.isSuccess()) {
163  // Not all EventSelectors have this property, so we must be tolerant
164  ATH_MSG_DEBUG("resetRunNumber: unable to get OverrideRunNumberFromInput property from EventSelector ");
165  return;
166  }
167  m_overrideRunNumber = overrideRunNumber.value();
168  if (m_overrideRunNumber) {
169  // New run number
170  IntegerProperty runNumber("RunNumber", 0);
171  sc = evtSel->getProperty(&runNumber);
172  if (!sc.isSuccess()) {
173  ATH_MSG_ERROR("checkOverrideRunNumber: unable to get RunNumber from EventSelector: found "
174  << runNumber.value());
175  return;
176  }
177  m_newRunNumber = runNumber.value();
178  // Old run number
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());
184  return;
185  }
186  m_oldRunNumber = oldRunNumber.value();
187 
188  ATH_MSG_DEBUG("checkOverrideRunNumber: Changing old to new run number: " << m_oldRunNumber
189  << " " << m_newRunNumber << " obtained from " << eventSelector);
190  }
191  else ATH_MSG_DEBUG("checkOverrideRunNumber: OverrideRunNumberFromInput not set for " << eventSelector);
192 }
193 
194 //--------------------------------------------------------------------------
195 
198 {
199  // Set the default folder description for a CondAttrListCollection
200  // which will be read back via IOVDbSvc
201  std::string folderDescr = "<timeStamp>run-event</timeStamp><addrHeader><address_header service_type=\"256\" clid=\"1238547719\" /> </addrHeader><typeName>CondAttrListCollection</typeName>" ;
202 
204 }
205 
206 //--------------------------------------------------------------------------
207 
210  const std::string& folderDescription) const
211 {
212  // lock the tool before getMetaDataContainer() call
213  std::scoped_lock guard( m_mutex );
214 
215  ATH_MSG_DEBUG("begin registerFolder ");
216 
217  if( ! getMetaDataContainer(folderName, folderDescription) ) {
218  ATH_MSG_ERROR("Unable to register folder " << folderName);
219  return(StatusCode::FAILURE);
220  }
221  else {
222  ATH_MSG_DEBUG("IOVMetaDataContainer for folder " << folderName << " has been registered ");
223  }
224 
225  return StatusCode::SUCCESS;
226 }
227 
228 //--------------------------------------------------------------------------
229 
232 {
233  // lock the tool while it is modifying the folder
234  std::scoped_lock guard( m_mutex );
235 
236  ATH_MSG_DEBUG("begin addPayload ");
237 
238  // Check if the folder has already been found
240  if(cont) {
241  ATH_MSG_DEBUG("Retrieved IOVMetaDataContainer from MetaDataStore for folder "
242  << folderName);
243  }
244  else {
245  ATH_MSG_ERROR("addPayload: Could not find IOVMetaDataContainer in MetaDataStore for folder "
246  << folderName
247  << ". One must have previously called registerFolder. ");
248  return StatusCode::FAILURE;
249  }
250 
251  // Override run number if requested
254  }
255 
256  // Add payload to container
257  bool success = cont->merge(payload);
258  if (success) {
259  ATH_MSG_DEBUG("Added new payload for folder " << folderName);
260  }
261  else {
262  ATH_MSG_DEBUG("Could not add new payload for folder "
263  << folderName
264  << " (may be duplicate payload).");
265 
266  // To Do: the function implicitly assumes ownership on the payload pointer
267  delete payload;
268  payload = nullptr;
269  }
270 
271  // Debug printout
272  if(payload && msgLvl(MSG::DEBUG)) {
273  std::ostringstream stream;
274  payload->dump(stream);
275  ATH_MSG_DEBUG(stream.str());
276  }
277 
278  return StatusCode::SUCCESS;
279 }
280 
281 //--------------------------------------------------------------------------
282 
285  CondAttrListCollection*& coll) const
286 {
287  // protected by lock in processInputFileMetaData()
288 
291  ATH_MSG_DEBUG("begin modifyPayload for folder " << folderName);
292 
293  // check if this folder needs to be modified
294  bool modifyAttr = false;
295  std::string attributeName;
296  const std::vector<std::string>& folders = m_foldersToBeModified.value();
297  const std::vector<std::string>& attrs = m_attributesToBeRemoved.value();
298  for (unsigned int i = 0; i < folders.size(); ++i) {
299  if (folderName == folders[i]) {
300  if (attrs.size() > i) {
301  attributeName = attrs[i];
302  modifyAttr = true;
303  ATH_MSG_DEBUG("modifyPayload: remove attribute " << attributeName);
304  break;
305  }
306  }
307  }
308 
309  if (!modifyAttr) {
310  ATH_MSG_DEBUG("modifyPayload: folder " << folderName << " OK ");
311  return StatusCode::SUCCESS;
312  }
313 
314  bool iovSizeIsZero = coll->iov_size() == 0;
315  IOVRange testIOV = coll->minRange();
316  IOVTime start = testIOV.start();
317  IOVTime stop = testIOV.stop();
318  // Set the IOV
320  if (iovSizeIsZero) {
321  // Only add in overall range if channels do not have
322  // IOVs - otherwise this is automatically calculated
323  coll1->addNewStart(start);
324  coll1->addNewStop (stop);
325  }
326  // Add in channels
327  unsigned int nchans = coll->size();
328  bool hasChanNames = (coll->name_size() == nchans);
329  for (unsigned int ichan = 0; ichan < nchans; ++ichan) {
331  // Now filter out the unwanted attribute
333  const CondAttrListCollection::AttributeList& oldAttrList = coll->attributeList(chan);
334  for (unsigned int iatt = 0; iatt < oldAttrList.size(); ++iatt) {
335  // skip the unwanted attribute
336  if (attributeName == oldAttrList[iatt].specification().name()) {
337  ATH_MSG_DEBUG("modifyPayload: skipping attribute name " << oldAttrList[iatt].specification().name());
338  continue;
339  }
340 
341  // copy the rest
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()];
346  newAttr = oldAttr;
347  // newAttr.setValue(oldAttr.data());
348  ATH_MSG_DEBUG("modifyPayload: copying attr name "
349  << oldAttrList[iatt].specification().name() << " "
350  /*<< newAttr*/);
351  }
352  coll1->add(chan, newAttrList);
353  if (!iovSizeIsZero) coll1->add(chan, coll->iovRange(chan));
354  if(hasChanNames)coll1->add(chan, coll->chanName(chan));
355  ATH_MSG_DEBUG("modifyPayload: copied attribute list for channel " << chan);
356  }
357  delete coll;
358  coll = coll1;
359  if (msgLvl(MSG::DEBUG)) {
360  std::ostringstream stream;
361  coll->dump(stream);
362  ATH_MSG_DEBUG(stream.str());
363  }
364 
365  return StatusCode::SUCCESS;
366 }
367 
368 //--------------------------------------------------------------------------
369 
372 {
373  // lock the tool before this call
374  // Return the folder if it is in the meta data store
375  return m_metaDataStore->tryRetrieve<IOVMetaDataContainer>(folderName);
376 }
377 
378 
381  , const std::string& folderDescription) const
382 {
383  // protected by locks in addPayload() and registerFolder()
384  ATH_MSG_DEBUG("begin getMetaDataContainer ");
385 
386  IOVMetaDataContainer* cont{nullptr};
387  // See if it is in the meta data store
389  // Container not found, add in new one
390  cont = new IOVMetaDataContainer(folderName, folderDescription);
391  ATH_MSG_DEBUG("No IOVMetaDataContainer in MetaDataStore for folder " << folderName
392  << ". Created a new instance");
393  StatusCode sc = m_metaDataStore->record(cont, folderName);
394  if (!sc.isSuccess()) {
395  ATH_MSG_ERROR("Could not record IOVMetaDataContainer in MetaDataStore for folder " << folderName);
396  delete cont;
397  cont = nullptr;
398  }
399  }
400  else {
401  ATH_MSG_DEBUG("IOVMetaDataContainer already in MetaDataStore for folder " << folderName);
402  StatusCode sc = m_metaDataStore->retrieve(cont, folderName);
403  if (!sc.isSuccess()) {
404  ATH_MSG_ERROR("Could not retrieve IOVMetaDataContainer in MetaDataStore for folder " << folderName);
405  cont = nullptr;
406  }
407  }
408  return cont;
409 }
410 
411 //--------------------------------------------------------------------------
412 
414 {
415  // lock the tool while it is processing input metadata
416  std::scoped_lock guard( m_mutex );
417 
418  ATH_MSG_DEBUG("processInputFileMetaData: file name " << fileName);
419 
420  // Retrieve all meta data containers from InputMetaDataStore
423 
424  StatusCode sc = m_inputStore->retrieve(cont, contEnd);
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;
428  }
429 
430  ATH_MSG_DEBUG("processInputFileMetaData: Retrieved from IOVMetaDataContainer(s) from InputMetaDataStore");
431 
432  // For each container, merge its contents into the MetaDataStore
433  unsigned int ncolls = 0;
434  unsigned int ndupColls = 0;
435  for (; cont != contEnd; ++cont) {
436  IOVMetaDataContainer* contMaster = getMetaDataContainer(cont->folderName()
437  , cont->folderDescription());
438 
439  // We assume that the folder is the same for all versions, and
440  // now we loop over versions for the payloads
441  std::list<SG::ObjectWithVersion<IOVMetaDataContainer> > allVersions;
442  sc = m_inputStore->retrieveAllVersions(allVersions, cont.key());
443  if (!sc.isSuccess()) {
444  ATH_MSG_ERROR("Could not retrieve all versions for " << cont.key());
445  return sc;
446  }
447 
448  for (SG::ObjectWithVersion<IOVMetaDataContainer>& obj : allVersions) {
449  const IOVPayloadContainer* payload = obj.dataObject->payloadContainer();
450 
451  ATH_MSG_DEBUG("processInputFileMetaData: New container: payload size " << payload->size() << " version key " << obj.versionedKey);
452 
453  // detailed printout before merge
454  if (msgLvl(MSG::VERBOSE)) {
455  const IOVPayloadContainer* payloadMaster = contMaster->payloadContainer();
456  ATH_MSG_VERBOSE("Before merge, payload minRange for folder " << cont->folderName());
457  if (payloadMaster && payloadMaster->size()) {
458  // Loop over AttrColls and print out minRange
459  IOVPayloadContainer::const_iterator itColl = payloadMaster->begin();
460  IOVPayloadContainer::const_iterator itCollEnd = payloadMaster->end();
461  unsigned int iPayload = 0;
462  for (; itColl != itCollEnd; ++itColl, ++iPayload) {
463  ATH_MSG_VERBOSE(iPayload << " " << (*itColl)->minRange() << " "
464  << (*itColl)->size());
465  }
466  }
467  else {
468  ATH_MSG_VERBOSE(" no payloads yet!");
469  }
470  }
471  }
472 
473  // Detailed printout
474  if (msgLvl(MSG::DEBUG)) {
475  ATH_MSG_DEBUG("processInputFileMetaData: Current payload before merge " << contMaster->folderName());
477  IOVPayloadContainer::const_iterator itCollEnd1 = contMaster->payloadContainer()->end();
478  std::ostringstream stream;
479  for (; itColl1 != itCollEnd1; ++itColl1) (*itColl1)->dump(stream);
480  ATH_MSG_DEBUG(stream.str());
481  }
482 
483  //
484  // Loop over CondAttrListCollections and do merge
485  //
486  for (SG::ObjectWithVersion<IOVMetaDataContainer>& obj : allVersions) {
487  const IOVPayloadContainer* payload = obj.dataObject->payloadContainer();
489  IOVPayloadContainer::const_iterator itCollEnd = payload->end();
490  for (; itColl != itCollEnd; ++itColl) {
491 
492  // Make a copy of the collection and merge it into
493  // master container in meta data store
494  CondAttrListCollection* coll = new CondAttrListCollection(**itColl);
495  // Override run number if requested
497  ATH_CHECK( overrideIOV(coll) );
498  }
499 
500  // first check if we need to modify the incoming payload
501  if (!modifyPayload (contMaster->folderName(), coll).isSuccess()) {
502  ATH_MSG_ERROR("processInputFileMetaData: Could not modify the payload for folder " << contMaster->folderName());
503  return StatusCode::FAILURE;
504  }
505 
506  ATH_MSG_VERBOSE("processInputFileMetaData: merge minRange: " << coll->minRange());
507  if (!contMaster->merge(coll)) {
508  // Did not merge it in - was a duplicate, so we need to delete it
509  delete coll;
510  ++ndupColls;
511  ATH_MSG_VERBOSE(" => not merged ");
512  }
513  else {
514  ++ncolls;
515  ATH_MSG_VERBOSE(" => merged ");
516  }
517 
518  }
519  ATH_MSG_DEBUG("processInputFileMetaData: Merged together containers for folder " << cont->folderName() << " ncoll/ndup "
520  << ncolls << " " << ndupColls);
521 
522  // Check for consistency after merge
523  const IOVPayloadContainer* payloadMaster = contMaster->payloadContainer();
524  if (payloadMaster && payloadMaster->size()) {
525  // Loop over AttrColls and print out minRange
526  IOVPayloadContainer::const_iterator itColl = payloadMaster->begin();
527  IOVPayloadContainer::const_iterator itCollEnd = payloadMaster->end();
528  IOVTime lastStop;
529  if ((*itColl)->minRange().start().isTimestamp()) lastStop = IOVTime(0);
530  else lastStop = IOVTime(0,0);
531  bool hasError = false;
532  for (; itColl != itCollEnd; ++itColl) {
533  if ((*itColl)->minRange().start() < lastStop) hasError = true;
534  lastStop = (*itColl)->minRange().stop();
535  }
536  if (hasError) {
537  ATH_MSG_ERROR("processInputFileMetaData: error after merge of file meta data. " );
538  ATH_MSG_ERROR("processInputFileMetaData: Filename " << fileName);
539  ATH_MSG_ERROR("processInputFileMetaData: folder " << contMaster->folderName());
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());
545  }
546  }
547  }
548 
549  // detailed printout after merge
550  if (msgLvl(MSG::VERBOSE)) {
551  const IOVPayloadContainer* payloadMaster = contMaster->payloadContainer();
552  ATH_MSG_VERBOSE("processInputFileMetaData: After merge, payload minRange ");
553  if (payloadMaster) {
554  // Loop over AttrColls and print out minRange
555  IOVPayloadContainer::const_iterator itColl = payloadMaster->begin();
556  IOVPayloadContainer::const_iterator itCollEnd = payloadMaster->end();
557  unsigned int iPayload = 0;
558  for (; itColl != itCollEnd; ++itColl, ++iPayload) {
559  ATH_MSG_VERBOSE(iPayload << " " << (*itColl)->minRange() << " "
560  << (*itColl)->size());
561  }
562  }
563  else { ATH_MSG_ERROR(" no payloads yet!"); }
564  }
565 
566  // Detailed printout
567  if (msgLvl(MSG::DEBUG)) {
568  ATH_MSG_DEBUG("processInputFileMetaData: Input payload " << cont->folderName());
569  std::ostringstream streamInp;
570  itColl = payload->begin();
571  itCollEnd = payload->end();
572  for (; itColl != itCollEnd; ++itColl) (*itColl)->dump(streamInp);
573  ATH_MSG_DEBUG(streamInp.str());
574  ATH_MSG_DEBUG("processInputFileMetaData: Output payload " << contMaster->folderName());
575  std::ostringstream streamOut;
576  itColl = contMaster->payloadContainer()->begin();
577  itCollEnd = contMaster->payloadContainer()->end();
578  for (; itColl != itCollEnd; ++itColl) (*itColl)->dump(streamOut);
579  ATH_MSG_DEBUG(streamOut.str());
580  }
581  }
582  }
583 
584  ATH_MSG_DEBUG("processInputFileMetaData: Total number of attribute collections merged together " << ncolls
585  << " Number of duplicate collections " << ndupColls);
586  return StatusCode::SUCCESS;
587 }
588 
589 //--------------------------------------------------------------------------
590 
593 {
594  ATH_MSG_DEBUG("overrideIOV ");
595 
596  // Override the IOV for run/event IOVs
597 
598  // (ONLY TRUE FOR OVERRIDE COMING IN VIA EVENTSELECTOR:)
599  // NOTE: we require that the old run number falls within the
600  // IOVRange of the incoming collection. We override ALL IOVs for
601  // ALL channels forcing the IOVRange to be (newRunNumber,1) to
602  // (newRunNumber+1,1)
603 
604  bool iovSizeIsZero = coll->iov_size() == 0;
605  IOVRange testIOV = coll->minRange();
606  IOVTime start = testIOV.start();
607  IOVTime stop = testIOV.stop();
608  IOVTime oldRun(m_oldRunNumber, 0);
609  if (start.isRunEvent() && stop.isRunEvent()) { // only for run/event
610  IOVRange newRange;
611  // Two ways of resetting
613  else if (m_overrideRunNumber) newRange = IOVRange(IOVTime(m_newRunNumber, 0), IOVTime(m_newRunNumber + 1, 0));
614 
615  if (m_overrideRunNumber && !testIOV.isInRange(oldRun)) {
616  // old run must be in the range
617  ATH_MSG_ERROR("overrideIOV: old run number does not match. Old run number " << m_oldRunNumber << " IOVRange: " << testIOV);
618  return StatusCode::SUCCESS;
619  }
620 
621  ATH_MSG_DEBUG("overrideIOV: overrideMinMaxRunNumber: " << (int)m_overrideMinMaxRunNumber
622  << " overrideRunNumber " << (int)m_overrideRunNumber
623  << " iovSizeIsZero: " << (int)iovSizeIsZero
624  << " newRange " << newRange);
625 
626  // Now over ride IOVs - two cases: 1) single IOV for full collection, 2) IOVs for individual channels.
627  // Must treat the reset of collection IOV differently
628  if (iovSizeIsZero) {
629  // Only add in overall range if channels do not have
630  // IOVs - otherwise this is automatically calculated
631  coll->resetMinRange(); // must first reset to 'full range' and then reduce the IOVRange accordingly
632  coll->addNewStart(newRange.start());
633  coll->addNewStop (newRange.stop());
634  }
635  else {
636  // Add in channels
637  unsigned int nchans = coll->size();
638  ATH_MSG_DEBUG("overrideIOV: nchans " << nchans);
639  for (unsigned int ichan = 0; ichan < nchans; ++ichan) {
640  // FIXME: O(N^2)!
642  coll->add(chan, newRange);
643  ATH_MSG_DEBUG("overrideIOV: overriding the IOV of collection chan " << chan);
644  }
645  // must reset the collection range AFTER the channels, because the collection range will be
646  // 'narrowed' to that of the channels
647  coll->resetMinRange();
648  }
649  if (msgLvl(MSG::DEBUG)) {
650  ATH_MSG_DEBUG("overrideIOV: after overriding the IOV of collection");
651  std::ostringstream stream;
652  coll->dump(stream);
653  ATH_MSG_DEBUG(stream.str());
654  }
655  }
656  else ATH_MSG_DEBUG("overrideIOV: IOV is not run/event ");
657 
658  return StatusCode::SUCCESS;
659 }
660 
CondAttrListCollection::resetMinRange
void resetMinRange()
Reset minRange according to the IOVs of the contained channels.
Definition: CondAttrListCollection.h:529
CondAttrListCollection::minRange
const IOVRange & minRange() const
Current minimal IOVRange.
Definition: CondAttrListCollection.h:438
IOVDbMetaDataTool.h
This is a tool used to manage the IOV Meta Data for a given object into the Meta Data Store.
IOVMetaDataContainer::payloadContainer
const IOVPayloadContainer * payloadContainer() const
Access to payload container.
Definition: IOVMetaDataContainer.h:141
python.PoolAttributeHelper.attrs
list attrs
Definition: PoolAttributeHelper.py:89
CondAttrListCollection::iov_size
iov_size_type iov_size() const
number of Chan/IOV pairs
Definition: CondAttrListCollection.h:350
IOVMetaDataContainer
This class is a container for conditions data. It is intended to be used to store conditions data fro...
Definition: IOVMetaDataContainer.h:37
IOVRange
Validity Range object. Holds two IOVTimes (start and stop)
Definition: IOVRange.h:30
IOVDbMetaDataTool::handle
virtual void handle(const Incident &incident) override
Incident service handle listening for BeginInputFile and EndInputFile.
Definition: IOVDbMetaDataTool.cxx:78
IOVDbMetaDataTool::getMetaDataContainer
IOVMetaDataContainer * getMetaDataContainer(const std::string &folderName, const std::string &folderDescription) const
return meta data container from the meta data store
Definition: IOVDbMetaDataTool.cxx:380
IOVTime::MAXRUN
static constexpr uint32_t MAXRUN
Definition: IOVTime.h:48
IOVDbMetaDataTool::m_metaDataStore
StoreGateSvc_t m_metaDataStore
Definition: IOVDbMetaDataTool.h:114
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
IOVDbMetaDataTool::metaDataStop
virtual StatusCode metaDataStop() override
Function called when the tool should write out its metadata.
Definition: IOVDbMetaDataTool.cxx:108
IOVDbMetaDataTool::m_attributesToBeRemoved
StringArrayProperty m_attributesToBeRemoved
Definition: IOVDbMetaDataTool.h:135
IOVMetaDataContainer::folderName
const std::string & folderName() const
Folder name.
Definition: IOVMetaDataContainer.h:127
CondAttrListCollection::addNewStop
void addNewStop(const IOVTime &stop)
Add new stop time to minRange - make sure that stop is <= to new stop
Definition: CondAttrListCollection.h:518
SG::detail::IteratorBase::key
const std::string & key() const
Get the key string with which the current object was stored.
Definition: SGIterator.cxx:155
IOVMetaDataContainer::merge
bool merge(CondAttrListCollection *payload)
Add in new payload.
Definition: IOVMetaDataContainer.cxx:14
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:13
defineDB.ichan
ichan
Definition: JetTagCalibration/share/defineDB.py:28
IOVRange::start
const IOVTime & start() const
Definition: IOVRange.h:38
IOVRange::isInRange
bool isInRange(const IOVTime &t) const
Definition: IOVRange.h:41
IOVDbMetaDataTool::m_minRunNumber
unsigned int m_minRunNumber
Definition: IOVDbMetaDataTool.h:127
IOVDbMetaDataTool::m_modifyFolders
bool m_modifyFolders
Definition: IOVDbMetaDataTool.h:136
IOVDbMetaDataTool::finalize
virtual StatusCode finalize() override
Finalize AlgTool.
Definition: IOVDbMetaDataTool.cxx:71
CondAttrListCollection::addNewStart
void addNewStart(const IOVTime &start)
Add new start time to minRange - make sure that start is >= to new start.
Definition: CondAttrListCollection.h:508
PixelModuleFeMask_create_db.stop
int stop
Definition: PixelModuleFeMask_create_db.py:76
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
CondAttrListCollection
This class is a collection of AttributeLists where each one is associated with a channel number....
Definition: CondAttrListCollection.h:52
IOVDbMetaDataTool::addPayload
virtual StatusCode addPayload(const std::string &folderName, CondAttrListCollection *payload) const override
Add an IOV and Payload for a particular folder - replaces payloads if there is an IOV overlap.
Definition: IOVDbMetaDataTool.cxx:230
IOVDbMetaDataTool::overrideIOV
StatusCode overrideIOV(CondAttrListCollection *&coll) const
override IOV with new run number
Definition: IOVDbMetaDataTool.cxx:592
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
python.CaloAddPedShiftConfig.type
type
Definition: CaloAddPedShiftConfig.py:42
IOVPayloadContainer::size
size_type size() const
size of payload vector
Definition: IOVPayloadContainer.h:121
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
IOVDbMetaDataTool::m_minMaxRunNumbers
UnsignedIntegerArrayProperty m_minMaxRunNumbers
Definition: IOVDbMetaDataTool.h:133
IOVRange::stop
const IOVTime & stop() const
Definition: IOVRange.h:39
IOVPayloadContainer::begin
const_iterator begin() const
Begin of payload vector.
Definition: IOVPayloadContainer.h:107
IOVTime
Basic time unit for IOVSvc. Hold time as a combination of run and event numbers.
Definition: IOVTime.h:33
CondAttrListCollection::dump
void dump() const
Dump our contents to std::cout.
Definition: CondAttrListCollection.h:557
IOVDbMetaDataTool::m_overrideMinMaxRunNumber
bool m_overrideMinMaxRunNumber
Definition: IOVDbMetaDataTool.h:121
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
ReadCellNoiseFromCool.chan
chan
Definition: ReadCellNoiseFromCool.py:52
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CondAttrListCollection::chanNum
ChanNum chanNum(unsigned int index) const
channel number for index: (index = 0 to size-1)
Definition: CondAttrListCollection.h:384
CondAttrListCollection::attributeList
const AttributeList & attributeList(ChanNum chanNum) const
attribute list for a given channel number
Definition: CondAttrListCollection.h:401
IOVDbMetaDataTool::modifyPayload
StatusCode modifyPayload(const std::string &folderName, CondAttrListCollection *&payload) const
Modify a Payload for a particular folder - replaces one of the internal attributes.
Definition: IOVDbMetaDataTool.cxx:284
IOVDbMetaDataTool::m_maxRunNumber
unsigned int m_maxRunNumber
Definition: IOVDbMetaDataTool.h:128
IOVDbMetaDataTool::m_foldersToBeModified
StringArrayProperty m_foldersToBeModified
Definition: IOVDbMetaDataTool.h:134
CondAttrListCollection::ChanNum
unsigned int ChanNum
Definition: CondAttrListCollection.h:55
IOVPayloadContainer
This class is a container for the payload of conditions data. It is intended to be used to store cond...
Definition: IOVPayloadContainer.h:35
IOVDbMetaDataTool::m_newRunNumber
unsigned int m_newRunNumber
Definition: IOVDbMetaDataTool.h:124
CondAttrListCollection::chanName
const std::string & chanName(ChanNum chanNum) const
find name for particular channel
Definition: CondAttrListCollection.h:426
IOVTime::MAXEVENT
static constexpr uint32_t MAXEVENT
Definition: IOVTime.h:51
IOVMetaDataContainer.h
This class is a container for conditions data. It is intended to be used to store conditions data fro...
IOVDbMetaDataTool::m_oldRunNumber
unsigned int m_oldRunNumber
Definition: IOVDbMetaDataTool.h:125
CondAttrListCollection::name_size
name_size_type name_size() const
number of Chan/Name pairs
Definition: CondAttrListCollection.h:377
CaloCellTimeCorrFiller.folderName
string folderName
Definition: CaloCellTimeCorrFiller.py:19
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
IOVDbMetaDataTool::m_mutex
std::shared_mutex m_mutex
Definition: IOVDbMetaDataTool.h:139
CondAttrListCollection::size
size_type size() const
number of Chan/AttributeList pairs
Definition: CondAttrListCollection.h:322
IOVDbMetaDataTool::endInputFile
virtual StatusCode endInputFile(const SG::SourceID &) override
Function called when the currently open input file got completely processed.
Definition: IOVDbMetaDataTool.cxx:103
PixelModuleFeMask_create_db.payload
string payload
Definition: PixelModuleFeMask_create_db.py:69
IOVDbMetaDataTool::m_inputStore
StoreGateSvc_t m_inputStore
Definition: IOVDbMetaDataTool.h:115
WriteLumiToCool.folderDescr
folderDescr
Definition: WriteLumiToCool.py:163
DeMoAtlasDataLoss.runNumber
string runNumber
Definition: DeMoAtlasDataLoss.py:64
IOVDbMetaDataTool::IOVDbMetaDataTool
IOVDbMetaDataTool(const std::string &type, const std::string &name, const IInterface *parent)
Definition: IOVDbMetaDataTool.cxx:25
IOVDbMetaDataTool::checkOverrideRunNumber
void checkOverrideRunNumber()
check if we should override the run number in the incoming meta data
Definition: IOVDbMetaDataTool.cxx:116
makeDTCalibBlob_pickPhase.folders
folders
Definition: makeDTCalibBlob_pickPhase.py:346
IOVPayloadContainer::const_iterator
payloadVec::const_iterator const_iterator
Definition: IOVPayloadContainer.h:39
IOVDbMetaDataTool::~IOVDbMetaDataTool
virtual ~IOVDbMetaDataTool()
Definition: IOVDbMetaDataTool.cxx:42
IOVDbMetaDataTool::registerFolder
virtual StatusCode registerFolder(const std::string &folderName, const std::string &folderDescription) const override
Register folder in the IOV Db MetaData - done once at initialize.
Definition: IOVDbMetaDataTool.cxx:209
SG::SourceID
std::string SourceID
Definition: AthenaKernel/AthenaKernel/SourceID.h:25
DEBUG
#define DEBUG
Definition: page_access.h:11
IOVPayloadContainer::end
const_iterator end() const
End of payload vector.
Definition: IOVPayloadContainer.h:114
LArNewCalib_DelayDump_OFC_Cali.eventSelector
eventSelector
Definition: LArNewCalib_DelayDump_OFC_Cali.py:112
IOVDbMetaDataTool::m_filesProcessed
std::set< std::string > m_filesProcessed
Definition: IOVDbMetaDataTool.h:131
IOVDbMetaDataTool::beginInputFile
virtual StatusCode beginInputFile(const SG::SourceID &) override
Function called when a new input file is opened.
Definition: IOVDbMetaDataTool.cxx:94
IOVDbMetaDataTool::m_overrideRunNumber
bool m_overrideRunNumber
Definition: IOVDbMetaDataTool.h:120
CondAttrListCollection::iovRange
const IOVRange & iovRange(ChanNum chanNum) const
IOVRange list for a given channel number.
Definition: CondAttrListCollection.h:414
IOVDbMetaDataTool::findMetaDataContainer
virtual IOVMetaDataContainer * findMetaDataContainer(const std::string &folderName) const override final
Definition: IOVDbMetaDataTool.cxx:371
CondAttrListCollection::AttributeList
coral::AttributeList AttributeList
Definition: CondAttrListCollection.h:56
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:13
jobOptions.fileName
fileName
Definition: jobOptions.SuperChic_ALP2.py:39
SG::ObjectWithVersion
associate a data object with its VersionedKey The object is held by a ReadHandle to delay its retriev...
Definition: SGVersionedKey.h:17
python.PyAthena.obj
obj
Definition: PyAthena.py:132
CondAttrListCollection::add
bool add(ChanNum chanNum, const AttributeList &attributeList)
Adding in chan/attrList pairs.
Definition: CondAttrListCollection.h:452
StoreGateSvc.h
SG::ConstIterator
Definition: SGIterator.h:164
IOVDbMetaDataTool::initialize
virtual StatusCode initialize() override
Initialize AlgTool.
Definition: IOVDbMetaDataTool.cxx:48
IOVDbMetaDataTool::processInputFileMetaData
virtual StatusCode processInputFileMetaData(const std::string &fileName) override
Explicit call to process IOV meta data from the input meta data store, transferring it to the main me...
Definition: IOVDbMetaDataTool.cxx:413
ServiceHandle< IIncidentSvc >