diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt b/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt index 5d0c581411c3c8749a8df8e15b8d0363bfe4d038..a0fc4e69540e2710599a92bdf24ec3764e91c61f 100644 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/CMakeLists.txt @@ -36,7 +36,7 @@ function (athenapooltest_run_test testName jo pattern) @ONLY ) atlas_add_test( ${testName} SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/athenapooltest_${testName}.sh - ENVIRONMENT "ATLAS_REFERENCE_TAG=AthenaPoolTest/AthenaPoolTest-01-00-08" + ENVIRONMENT "ATLAS_REFERENCE_TAG=AthenaPoolTest/AthenaPoolTest-01-00-09" POST_EXEC_SCRIPT "${CMAKE_CURRENT_SOURCE_DIR}/test/post_check_with_select.sh ${testName} ${pattern}" PROPERTIES TIMEOUT 900 ) @@ -49,7 +49,7 @@ endfunction (athenapooltest_run_test) # Write/read out some simple objects: athenapooltest_run_test( AthenaPoolTestWrite AthenaPoolTestWrite - "^..AthenaPoolTestD" ) + "^AthenaPoolTestD" ) athenapooltest_run_test( AthenaPoolTestRead AthenaPoolTestRead "AthenaPoolTestD" DEPENDS AthenaPoolTestWrite ) diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/EventInfoRead.py b/AtlasTest/DatabaseTest/AthenaPoolTest/share/EventInfoRead.py index b6bdd78b9e4e9de91014f53cdedb1479bbf0c71b..5aec601d4d925d939bfceb6bb5b2100ca0428e00 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/EventInfoRead.py +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/EventInfoRead.py @@ -93,9 +93,6 @@ AthenaEventLoopMgr.OutputLevel = INFO EventInfoReader.OutputLevel = DEBUG svcMgr.TagInfoMgr.OutputLevel = DEBUG -svcMgr.IOVDbSvc.OutputLevel = DEBUG -svcMgr.IOVSvc.OutputLevel = DEBUG -#svcMgr.DetectorStore.Dump = TRUE # No stats printout diff --git a/AtlasTest/DatabaseTest/AthenaPoolTest/share/EventInfoWriteStep3.py b/AtlasTest/DatabaseTest/AthenaPoolTest/share/EventInfoWriteStep3.py index 9a865ec791c1215097119717bc743e288f021daa..d64d87ed7cccfd7b43cfc890b73420fd9be6d3d4 100755 --- a/AtlasTest/DatabaseTest/AthenaPoolTest/share/EventInfoWriteStep3.py +++ b/AtlasTest/DatabaseTest/AthenaPoolTest/share/EventInfoWriteStep3.py @@ -121,7 +121,7 @@ svcMgr.TagInfoMgr.OutputLevel = DEBUG #-------------------------------------------------------------- from IOVDbMetaDataTools.IOVDbMetaDataToolsConf import IOVDbMetaDataTool ToolSvc += IOVDbMetaDataTool( "IOVDbMetaDataTool" ) -IOVDbMetaDataTool.OutputLevel = DEBUG +IOVDbMetaDataTool.OutputLevel = INFO # No stats printout include( "AthenaPoolTest/NoStats_jobOptions.py" ) diff --git a/Event/EventInfoMgt/src/TagInfoMgr.cxx b/Event/EventInfoMgt/src/TagInfoMgr.cxx index dc50fbc4fad928af2f18d62bebe232c92cd7a708..78fcae24d6cedc1b4f90ee557b76052f13b6c176 100755 --- a/Event/EventInfoMgt/src/TagInfoMgr.cxx +++ b/Event/EventInfoMgt/src/TagInfoMgr.cxx @@ -123,10 +123,10 @@ StatusCode TagInfoMgr::initialize() ATH_MSG_DEBUG( "TagInfoKey " << m_tagInfoKey); if (msgLvl(MSG::DEBUG)) { - msg(MSG::DEBUG) << "ExtraTagValuePairs " << endmsg; - for (auto& tv : m_extraTagValuePairs) { - msg(MSG::DEBUG) << " Value/tag pair: " << tv.first << " " << tv.second << endmsg; - } + ATH_MSG_DEBUG( "ExtraTagValuePairs " ); + for (auto& tv : m_extraTagValuePairs) { + ATH_MSG_DEBUG( " Value/tag pair: " << tv.first << " " << tv.second ); + } } // To copy TagInfo to EventInfo, we set listener to the @@ -138,10 +138,9 @@ StatusCode TagInfoMgr::initialize() // file meta data incSvc->addListener( this, "BeginRun", pri); - // Add BeginInputFile to trigger refilling meta data store after a new input - // file - priority has to be < 50 to be run after IOVDbMetaDataTool, which - // has mergeing into the output file medat data the input meta data of the - // new file. + // Add BeginInputFile to trigger refilling meta data store after a new input file - priority has + // to be < 50 to be run after IOVDbMetaDataTool (triggered by MetaDataSvc), which has mergeing + // into the output file medat data the input meta data of the new file. incSvc->addListener(this, "BeginInputFile", 50); // return StatusCode::SUCCESS; @@ -288,13 +287,11 @@ TagInfoMgr::fillTagInfo(const CondAttrListCollection* tagInfoCond, TagInfo* tagI EventType::NameTagPairVec pairs1; evtH->event_type()->get_detdescr_tags(pairs1); - if (msgLvl(MSG::DEBUG)) { - if(pairs1.size()) { - ATH_MSG_DEBUG( "fillTagInfo: Pairs from EventType:"); - } - else { - ATH_MSG_DEBUG( "fillTagInfo: EventInfo/EventType has no tags"); - } + if(pairs1.size()) { + ATH_MSG_DEBUG( "fillTagInfo: Pairs from EventType:"); + } + else { + ATH_MSG_DEBUG( "fillTagInfo: EventInfo/EventType has no tags"); } for (unsigned int i = 0; i < pairs1.size(); ++i) { ATH_MSG_DEBUG( "fillTagInfo: " << pairs1[i].first << " : " @@ -342,10 +339,8 @@ TagInfoMgr::fillTagInfo(const CondAttrListCollection* tagInfoCond, TagInfo* tagI } // Dump out contents of TagInfo - if (msgLvl(MSG::DEBUG)) { - ATH_MSG_DEBUG( "fillTagInfo: print out tags before adding extra tags"); - ATH_MSG_DEBUG(tagInfo->str()); - } + ATH_MSG_DEBUG( "fillTagInfo: print out tags before adding extra tags"); + ATH_MSG_DEBUG(tagInfo->str()); // Add in any extra tag value pairs if specified @@ -364,10 +359,8 @@ TagInfoMgr::fillTagInfo(const CondAttrListCollection* tagInfoCond, TagInfo* tagI } // Dump out contents of TagInfo - if (msgLvl(MSG::DEBUG)) { - ATH_MSG_DEBUG( "fillTagInfo: print out tags"); - ATH_MSG_DEBUG(tagInfo->str()); - } + ATH_MSG_DEBUG( "fillTagInfo: print out tags"); + ATH_MSG_DEBUG(tagInfo->str()); return StatusCode::SUCCESS; @@ -394,23 +387,19 @@ TagInfoMgr::fillMetaData (const TagInfo* tagInfo, const CondAttrListCollection ATH_MSG_DEBUG( "entering fillMetaData"); // Get run number for IOV - EventIDBase::number_type runNumber = 0; - const EventIDBase* evid = EventIDFromStore( m_storeGate ); - if( evid ) { - runNumber = evid->run_number(); + EventIDBase::number_type runNumber = EventIDBase::UNDEFNUM; + + if( m_currentRun != EventIDBase::UNDEFNUM ) { + runNumber = m_currentRun; + } + else if( m_conditionsRun != EventIDBase::UNDEFNUM ) { + // For HLT use the conditionsRun retrieved from the first BeginRun incident + runNumber = m_conditionsRun; } else { - // For simulation, we may be in the initialization phase and - // must get the run number from the event selector - if (StatusCode::SUCCESS != getRunNumber (runNumber)) { - // For HLT use the conditionsRun retrieved from the first BeginRun incident - if( m_conditionsRun != EventIDBase::UNDEFNUM ) { - runNumber = m_conditionsRun; - } else { - ATH_MSG_ERROR( "fillMetaData: Could not get event info neither via retrieve nor from the EventSelectror"); - return (StatusCode::FAILURE); - } - } + ATH_MSG_ERROR( "fillMetaData: Could not get event info neither via retrieve nor from the EventSelector"); + return (StatusCode::FAILURE); } + // Copy tags to AttributeList coral::AttributeList attrList; EventType::NameTagPairVec pairs; @@ -480,65 +469,6 @@ TagInfoMgr::fillMetaData (const TagInfo* tagInfo, const CondAttrListCollection } -StatusCode -TagInfoMgr::getRunNumber (unsigned int& runNumber) -{ - // check if EventSelector is being used to override run numbers if - // so, we return the runNumber from the properties of the - // EventSelector - - // Get run number parameter from the EventSelector - ATH_MSG_DEBUG( "getRunNumber: check if tag is set in jobOpts"); - // Get name of event selector from the application manager to - // make sure we get the one for MC signal events - IProperty* propertyServer(0); - StatusCode sc = serviceLocator()->service("ApplicationMgr", propertyServer); - if (sc != StatusCode::SUCCESS ) { - ATH_MSG_ERROR( "getRunNumber: Cannot get ApplicationMgr "); - return StatusCode::FAILURE; - } - StringProperty property("EvtSel", ""); - sc = propertyServer->getProperty(&property); - if (!sc.isSuccess()) { - ATH_MSG_ERROR( "getRunNumber: unable to get EvtSel: found " << property.value()); - return StatusCode::FAILURE; - } - // Get EventSelector for ApplicationMgr - std::string eventSelector = property.value(); - sc = serviceLocator()->service(eventSelector, propertyServer); - if (sc != StatusCode::SUCCESS ) { - ATH_MSG_ERROR( "getRunNumber: Cannot get EventSelector " << eventSelector); - return StatusCode::FAILURE; - } - BooleanProperty overrideRunNumber = BooleanProperty("OverrideRunNumber", false); - sc = propertyServer->getProperty(&overrideRunNumber); - if (!sc.isSuccess()) { - // Not all EventSelectors have this property, but we should - // not get here if the ES is not one for simulation => return failure - ATH_MSG_WARNING( "getRunNumber: unable to get OverrideRunNumber property from EventSelector "); - return StatusCode::FAILURE; - } - if (overrideRunNumber.value()) { - IntegerProperty runNumberProp = IntegerProperty("RunNumber", 0); - sc = propertyServer->getProperty(&runNumberProp); - if (!sc.isSuccess()) { - ATH_MSG_ERROR( "getRunNumber: unable to get RunNumber from EventSelector: found " - << runNumberProp.value()); - return StatusCode::FAILURE; - } - else { - runNumber = runNumberProp.value(); - ATH_MSG_DEBUG( "getRunNumber: Run number: " - << runNumber << " obtained from " - << eventSelector); - } - } - else { - ATH_MSG_ERROR( "getRunNumber: OverrideRunNumber from EventSelector is false "); - return StatusCode::FAILURE; - } - return StatusCode::SUCCESS; -} void @@ -549,7 +479,10 @@ TagInfoMgr::handle(const Incident& inc) { ** ** 1) For the first begin run, we retrieve the TagInfo and set ** up IOVDbSvc so that is can use TagInfo to define its - ** hierarchical tags. + ** hierarchical tags. + ** The member m_currentRun is saved to be used for the IOV + ** in fillMetaData. + ** ** Note: the detector store 'retrieve' of the TagInfo will call ** TagInfoMgr::createObj to do the first creation and filling it ** accordingly. And this also fills the output file metadata with @@ -557,11 +490,15 @@ TagInfoMgr::handle(const Incident& inc) { ** ** 2) Then whenever a new file is opened (BeginInputFile), we ** use the TagInfo object from the detector store to "re-fill" - ** and override the newly merged TagInfo meta data in the output + ** and overwrite the newly merged TagInfo meta data in the output ** meta data store. We receive BeginInputFile AFTER the ** IOVDbMetaDataTool has done this automatic merging, so that we ** can safely overwrite with the desired TagInfo information for ** this job/run. + ** As well, if there is a second BeginRun during the processing, + ** here we update m_currentRun and overwrite again the TagInfo in the + ** meta store with the new run which will just extend the IOV of the + ** TagInfo meta data. ** **/ @@ -587,15 +524,18 @@ TagInfoMgr::handle(const Incident& inc) { // can't use a ref here! const EventIDBase eventID = inc.context().eventID(); - if (msgLvl(MSG::DEBUG)) { - msg() << MSG::DEBUG << "handle: First BeginRun incident - Event ID: [" - << eventID.run_number() << "," - << eventID.event_number() << ":" - << eventID.time_stamp() << "] "; - if( m_conditionsRun != EventIDBase::UNDEFNUM ) { - msg() << MSG::DEBUG <<"conditionsRun = " << m_conditionsRun; - } - msg() << MSG::DEBUG << endmsg; + // Set current run number to be used for fillMetaData + m_currentRun = eventID.run_number(); + + ATH_MSG_DEBUG( "handle: First BeginRun incident - Event ID: [" + << eventID.run_number() << "," + << eventID.lumi_block() << ":" + << eventID.time_stamp() << "] "); + if( m_conditionsRun != EventIDBase::UNDEFNUM ) { + ATH_MSG_DEBUG( "handle: conditionsRun = " << m_conditionsRun); + } + if( m_currentRun != EventIDBase::UNDEFNUM ) { + ATH_MSG_DEBUG( "handle: currentRun = " << m_currentRun); } // For the moment, we must set IOVDbSvc into the BeginRun @@ -646,40 +586,70 @@ TagInfoMgr::handle(const Incident& inc) { ATH_MSG_DEBUG( "handle: TagInfo successfully processed by IOVDbSvc to register callback"); } } - else if (inc.type() == "BeginInputFile" && !m_isFirstBeginRun) { - // For a new file incident, we must "refill" the - // meta data store with the current value of the TagInfo - // folder in the detector store. + else if ((inc.type() == IncidentType::BeginInputFile || inc.type() == IncidentType::BeginRun) + && !m_isFirstBeginRun) { + + // For a new file incident or a subsequent begin run incident, we must "refill" the meta + // data store with the current value of the TagInfo folder in the detector store. + + if (inc.type() == IncidentType::BeginRun) { + + // For begin run, reset the current run number + + // get conditionsRun from the Context - can be used if no EventID in the SG (for HLT) + m_conditionsRun = Atlas::getExtendedEventContext(inc.context()).conditionsRun(); + + // Get current run number + const EventIDBase eventID = inc.context().eventID(); + // Set current run number to be used for fillMetaData + m_currentRun = eventID.run_number(); + + ATH_MSG_DEBUG( "handle: secondary BeginRun incident - Event ID: [" + << eventID.run_number() << "," + << eventID.lumi_block() << ":" + << eventID.time_stamp() << "] "); + if( m_conditionsRun != EventIDBase::UNDEFNUM ) { + ATH_MSG_DEBUG( "handle: conditionsRun = " << m_conditionsRun); + } + if( m_currentRun != EventIDBase::UNDEFNUM ) { + ATH_MSG_DEBUG( "handle: currentRun = " << m_currentRun); + } + } + + // Return if /TagInfo does NOT exists const CondAttrListCollection* attrListColl = 0; if (m_detStore->contains<CondAttrListCollection>("/TagInfo")) { if (m_detStore->retrieve( attrListColl, "/TagInfo" ).isFailure() ) { - ATH_MSG_ERROR( "handle - BeginInputFile: No TagInfo meta data in DetectorStore"); - throw GaudiException( "BeginInputFile - No TagInfo meta data in DetectorStore", "TagInfoMgr::handle", StatusCode::FAILURE ); + ATH_MSG_ERROR( "handle - " << inc.type() << ": No TagInfo meta data in DetectorStore"); + std::string excStr { inc.type() + " - No TagInfo meta data in DetectorStore" }; + throw GaudiException( excStr , "TagInfoMgr::handle", StatusCode::FAILURE ); } else { - ATH_MSG_DEBUG( "handle - BeginInputFile: Retrieved TagInfo meta data from detStore"); + ATH_MSG_DEBUG( "handle - " << inc.type() << ": Retrieved TagInfo meta data from detStore"); } } else { - ATH_MSG_DEBUG( "handle - BeginInputFile: det store does NOT contain AttrListColl for TagInfo"); + ATH_MSG_DEBUG( "handle - " << inc.type() << ": det store does NOT contain AttrListColl for TagInfo"); return; } const TagInfo* tagInfo = 0; if (m_detStore->retrieve( tagInfo, m_tagInfoKeyValue ).isFailure() ) { - ATH_MSG_ERROR( "handle - BeginInputFile: Could not retrieve TagInfo object from the detector store"); - throw GaudiException( "BeginInputFile - Could not retrieve TagInfo object from the detector store", "TagInfoMgr::handle", StatusCode::FAILURE ); + ATH_MSG_ERROR( "handle - " << inc.type() << ": Could not retrieve TagInfo object from the detector store"); + std::string excStr { inc.type() + " - Could not retrieve TagInfo object from the detector store" }; + throw GaudiException( excStr, "TagInfoMgr::handle", StatusCode::FAILURE ); } // Copy TagInfo to meta data store for writing to file meta data if (StatusCode::SUCCESS != fillMetaData(tagInfo, attrListColl)) { - ATH_MSG_ERROR( "handle - BeginInputFile: Unable to write TagInfo to MetaDataStore !"); - throw GaudiException( "BeginInputFile - Unable to write TagInfo to MetaDataStore !", "TagInfoMgr::handle", StatusCode::FAILURE ); + ATH_MSG_ERROR( "handle - " << inc.type() << ": Unable to write TagInfo to MetaDataStore !"); + std::string excStr { inc.type() + " - Unable to write TagInfo to MetaDataStore !" }; + throw GaudiException( excStr, "TagInfoMgr::handle", StatusCode::FAILURE ); } else { - ATH_MSG_DEBUG( "handle - BeginInputFile: Wrote TagInfo to MetaDataStore "); + ATH_MSG_DEBUG( "handle - " << inc.type() << ": Wrote TagInfo to MetaDataStore "); } } } @@ -845,13 +815,8 @@ TagInfoMgr::createObj(IOpaqueAddress* addr, DataObject*& dataObj) { // most likely not used anymore. RDS 08/2012). if (attrListColl && attrListColl->size() == 0) { tagInfo = std::make_unique<TagInfo>(m_lastTagInfo); - if (msgLvl(MSG::DEBUG)) { - ATH_MSG_DEBUG( "createObj: recreate tagInfo from saved info"); - if (msgLevel()>=MSG::DEBUG) { - MsgStream log1(Athena::getMessageSvc(), "TagInfo"); - tagInfo->printTags(log1); - } - } + ATH_MSG_DEBUG( "createObj: recreate tagInfo from saved info"); + ATH_MSG_DEBUG(tagInfo->str()); } else { tagInfo = std::make_unique<TagInfo>(); @@ -859,10 +824,8 @@ TagInfoMgr::createObj(IOpaqueAddress* addr, DataObject*& dataObj) { ATH_MSG_DEBUG( "createObj: Unable to fill TagInfo !"); return StatusCode::FAILURE; } - if (msgLvl(MSG::DEBUG)) { - if (attrListColl) ATH_MSG_DEBUG( "createObj: Filled TagInfo from file meta data "); - else ATH_MSG_DEBUG( "createObj: Filled TagInfo from input event "); - } + if (attrListColl) ATH_MSG_DEBUG( "createObj: Filled TagInfo from file meta data "); + else ATH_MSG_DEBUG( "createObj: Filled TagInfo from input event "); } // Copy TagInfo to meta data store for writing to file meta data @@ -877,9 +840,8 @@ TagInfoMgr::createObj(IOpaqueAddress* addr, DataObject*& dataObj) { // Do standard conversion to data object dataObj = SG::asStorable(std::move(tagInfo)); - if (msgLvl(MSG::DEBUG)) { - ATH_MSG_DEBUG( "createObj: created new TagInfo object "); - } + ATH_MSG_DEBUG( "createObj: created new TagInfo object "); + return StatusCode::SUCCESS; } diff --git a/Event/EventInfoMgt/src/TagInfoMgr.h b/Event/EventInfoMgt/src/TagInfoMgr.h index 32aab1c333270b9b4c3a9441fbccb0f61470c0f2..17e14a62ebcc45ae2d3fee442a15b0ab92565381 100755 --- a/Event/EventInfoMgt/src/TagInfoMgr.h +++ b/Event/EventInfoMgt/src/TagInfoMgr.h @@ -175,7 +175,6 @@ private: TagInfoMgr(); TagInfoMgr(const TagInfoMgr&); TagInfoMgr &operator=(const TagInfoMgr&); - StatusCode getRunNumber (unsigned int& runNumber); /////////////////////////////////////////////////////////////////// // Private data: @@ -226,6 +225,9 @@ private: /// conditionsRun from the first BeginRun incident (HLT) EventIDBase::number_type m_conditionsRun { EventIDBase::UNDEFNUM }; + /// current run number from BeginRun incident + EventIDBase::number_type m_currentRun { EventIDBase::UNDEFNUM }; + /// IOVRange of last TagInfo added to the file meta data IOVRange m_lastIOVRange { IOVRange(IOVTime(), IOVTime()) }; diff --git a/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldCacheCondAlg.h b/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldCacheCondAlg.h index c1426976d4076c9abbd189f09d04aad80d99ecf6..f80106f3460fdc7aefd00aa05a1e33def2e25d41 100644 --- a/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldCacheCondAlg.h +++ b/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldCacheCondAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -32,7 +32,6 @@ namespace MagField { StatusCode initialize() override final; StatusCode execute(const EventContext& ctx) const override final; - StatusCode finalize() override final; private: @@ -49,7 +48,7 @@ namespace MagField { EventIDRange m_condObjOutputRange {EventIDRange(EventIDBase(0,0), EventIDBase(EventIDBase::UNDEFNUM-1, EventIDBase::UNDEFEVT-1))}; }; StatusCode updateCurrentFromConditions(const EventContext& ctx, Cache& cache) const; - StatusCode updateCurrentFromParameters(Cache& cache) const; + StatusCode updateCurrentFromParameters(const EventContext& ctx, Cache& cache) const; void scaleField(Cache& cache, const MagField::AtlasFieldMap* fieldMap) const; // threshold below which currents are considered zero diff --git a/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldMapCondAlg.h b/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldMapCondAlg.h index 616ebd10ecb77d78ec0f3a9055736a35d99422f3..ee3ffa2f76348c37f6baf3adb028a2ff17d5ee93 100644 --- a/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldMapCondAlg.h +++ b/MagneticField/MagFieldServices/MagFieldServices/AtlasFieldMapCondAlg.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ @@ -33,7 +33,6 @@ namespace MagField { StatusCode start() override final; StatusCode initialize() override final; StatusCode execute(const EventContext& ctx) const override final; - StatusCode finalize() override final; private: diff --git a/MagneticField/MagFieldServices/src/AtlasFieldCacheCondAlg.cxx b/MagneticField/MagFieldServices/src/AtlasFieldCacheCondAlg.cxx index 703e82d3d9aa89543d6658d2527d721b2ad7332b..74cff53bab650ed8ad98a57d60a8dc53b518a68b 100644 --- a/MagneticField/MagFieldServices/src/AtlasFieldCacheCondAlg.cxx +++ b/MagneticField/MagFieldServices/src/AtlasFieldCacheCondAlg.cxx @@ -35,7 +35,6 @@ MagField::AtlasFieldCacheCondAlg::~AtlasFieldCacheCondAlg()= default; StatusCode MagField::AtlasFieldCacheCondAlg::initialize() { - ATH_MSG_INFO ("Initialize"); // CondSvc ATH_CHECK( m_condSvc.retrieve() ); @@ -92,7 +91,7 @@ MagField::AtlasFieldCacheCondAlg::execute(const EventContext& ctx) const { ATH_CHECK( updateCurrentFromConditions(ctx, cache) ); } else { - ATH_CHECK( updateCurrentFromParameters(cache) ); + ATH_CHECK( updateCurrentFromParameters(ctx, cache) ); } // Must read map cond object to get previously created map @@ -129,7 +128,8 @@ MagField::AtlasFieldCacheCondAlg::execute(const EventContext& ctx) const { } ATH_MSG_INFO ( "execute: initialized AtlasFieldCacheCondObj and cache with SFs - sol/tor " - << cache.m_solScaleFactor << "/" << cache.m_torScaleFactor ); + << cache.m_solScaleFactor << "/" << cache.m_torScaleFactor + << ", EventRange " << cache.m_condObjOutputRange ); if (fieldMap) { ATH_MSG_INFO ( "execute: solenoid zone id " << fieldMap->solenoidZoneId()); } @@ -143,7 +143,6 @@ MagField::AtlasFieldCacheCondAlg::execute(const EventContext& ctx) const { StatusCode MagField::AtlasFieldCacheCondAlg::updateCurrentFromConditions(const EventContext& ctx, Cache& cache) const { - ATH_MSG_INFO ( "UpdateCurrentFromConditions " ); // readin current value SG::ReadCondHandle<CondAttrListCollection> readHandle {m_currInputKey, ctx}; @@ -234,10 +233,9 @@ MagField::AtlasFieldCacheCondAlg::updateCurrentFromConditions(const EventContext StatusCode -MagField::AtlasFieldCacheCondAlg::updateCurrentFromParameters(Cache& cache) const +MagField::AtlasFieldCacheCondAlg::updateCurrentFromParameters(const EventContext& ctx, Cache& cache) const { - ATH_MSG_INFO( "updateCurrentFromParameters" ); // take the current values from JobOptions double solcur{m_useSoleCurrent}; double torcur{m_useToroCurrent}; @@ -251,8 +249,17 @@ MagField::AtlasFieldCacheCondAlg::updateCurrentFromParameters(Cache& cache) cons } cache.m_solenoidCurrent = solcur; cache.m_toroidCurrent = torcur; - ATH_MSG_INFO("updateCurrentFromParameters: Update from job options: Range of input/output is " << cache.m_condObjOutputRange); - ATH_MSG_INFO("updateCurrentFromParameters: Currents taken from jobOption parameters " ); + + // in case of reading from DB or from FILE, the EventID range is always the current run + EventIDBase start, stop; + start.set_run_number(ctx.eventID().run_number()); + start.set_lumi_block(0); + stop.set_run_number(ctx.eventID().run_number()+1); + stop.set_lumi_block(0); + cache.m_condObjOutputRange = EventIDRange(start,stop); + + ATH_MSG_INFO("updateCurrentFromParameters: Update from job options: Range of input/output is " << cache.m_condObjOutputRange); + return StatusCode::SUCCESS; } @@ -294,13 +301,3 @@ MagField::AtlasFieldCacheCondAlg::scaleField(Cache& cache, const MagField::Atlas << cache.m_toroidCurrent << "," << ((fieldMap) ? fieldMap->toroidCurrent() : 0)); } } - - - - - -StatusCode -MagField::AtlasFieldCacheCondAlg::finalize() { - ATH_MSG_INFO ( " in finalize " ); - return StatusCode::SUCCESS; -} diff --git a/MagneticField/MagFieldServices/src/AtlasFieldMapCondAlg.cxx b/MagneticField/MagFieldServices/src/AtlasFieldMapCondAlg.cxx index c6cca3294f8483083387590681ea0249b4cff767..460fb0b2cdd52edc89a4680b4e0151e15f572e21 100644 --- a/MagneticField/MagFieldServices/src/AtlasFieldMapCondAlg.cxx +++ b/MagneticField/MagFieldServices/src/AtlasFieldMapCondAlg.cxx @@ -38,7 +38,6 @@ MagField::AtlasFieldMapCondAlg::~AtlasFieldMapCondAlg()= default; StatusCode MagField::AtlasFieldMapCondAlg::initialize() { - ATH_MSG_INFO ("Initialize"); // CondSvc ATH_CHECK( m_condSvc.retrieve() ); @@ -59,7 +58,7 @@ MagField::AtlasFieldMapCondAlg::initialize() { ATH_MSG_INFO ( "Initialize: Key " << m_mapCondObjOutputKey.fullKey() << " has been succesfully registered " ); if (m_useMapsFromCOOL) { - ATH_MSG_INFO ( "Initialize: Will update the field map from conditions"); // + ATH_MSG_INFO ( "Initialize: Will update the field map from conditions"); } else { ATH_MSG_INFO ( "Initialize: Will update the field map from jobOpt file name"); @@ -82,7 +81,7 @@ MagField::AtlasFieldMapCondAlg::start() { StatusCode MagField::AtlasFieldMapCondAlg::execute(const EventContext& ctx) const { - ATH_MSG_DEBUG ( "execute: entering "); + ATH_MSG_DEBUG ( "execute: entering " << ctx.eventID() ); // Check if output conditions object with field map object is still valid, if not replace it // with new map @@ -104,9 +103,7 @@ MagField::AtlasFieldMapCondAlg::execute(const EventContext& ctx) const { else { ATH_MSG_INFO ( "execute: no map read (currents == 0"); } - - - + // Save newly created map in conditions object, and record it in the conditions store, with its // own range auto fieldMapCondObj = std::make_unique<AtlasFieldMapCondObj>(); @@ -119,7 +116,7 @@ MagField::AtlasFieldMapCondAlg::execute(const EventContext& ctx) const { << " into Conditions Store"); return StatusCode::FAILURE; } - ATH_MSG_INFO ( "execute: recored AtlasFieldMapCondObj with field map"); + ATH_MSG_INFO ( "execute: recorded AtlasFieldMapCondObj with EventRange " << cache.m_mapCondObjOutputRange ); return StatusCode::SUCCESS; } @@ -200,13 +197,16 @@ MagField::AtlasFieldMapCondAlg::updateFieldMap(const EventContext& ctx, Cache& c cache.m_mapSoleCurrent = m_mapSoleCurrent; cache.m_mapToroCurrent = m_mapToroCurrent; - // Create a range from 0 to inf in terms of run, LB - const EventIDBase::number_type UNDEFNUM = EventIDBase::UNDEFNUM; - const EventIDBase::event_number_t UNDEFEVT = EventIDBase::UNDEFEVT; - EventIDRange rangeW (EventIDBase (0, UNDEFEVT, UNDEFNUM, 0, 0), - EventIDBase (UNDEFNUM-1, UNDEFEVT, UNDEFNUM, UNDEFNUM, 0)); - cache.m_mapCondObjOutputRange = rangeW; - ATH_MSG_INFO("updateFieldMap: useMapsFromCOOL == false, using default range " << rangeW); + // Create a range for the current run + EventIDBase start, stop; + start.set_run_number(ctx.eventID().run_number()); + start.set_lumi_block(0); + stop.set_run_number(ctx.eventID().run_number()+1); + stop.set_lumi_block(0); + cache.m_mapCondObjOutputRange = EventIDRange(start,stop); + + ATH_MSG_INFO("updateFieldMap: useMapsFromCOOL == false, using default range " + << cache.m_mapCondObjOutputRange); } // We allow to set currents via the TagInfoMgr which adds tags to the TagInfo object - only allowed for offline @@ -312,10 +312,3 @@ MagField::AtlasFieldMapCondAlg::updateFieldMap(const EventContext& ctx, Cache& c return StatusCode::SUCCESS; } - - -StatusCode -MagField::AtlasFieldMapCondAlg::finalize() { - ATH_MSG_INFO ( " in finalize " ); - return StatusCode::SUCCESS; -}