diff --git a/Event/xAOD/xAODMetaDataCnv/CMakeLists.txt b/Event/xAOD/xAODMetaDataCnv/CMakeLists.txt index b9cdc1b3092564a5bee8112c898f546937d2d910..480b16fc6a00810e009fc78a6b7453b530c16dc3 100644 --- a/Event/xAOD/xAODMetaDataCnv/CMakeLists.txt +++ b/Event/xAOD/xAODMetaDataCnv/CMakeLists.txt @@ -8,43 +8,46 @@ atlas_subdir( xAODMetaDataCnv ) # Extra dependencies, based on the environment that we're in: if( NOT XAOD_STANDALONE ) - set( extra_deps - GaudiKernel - PRIVATE - Control/AthenaKernel - Database/AthenaPOOL/AthenaPoolUtilities - Event/EventInfo ) + set( + extra_deps + GaudiKernel + PRIVATE + Control/AthenaKernel + Database/AthenaPOOL/AthenaPoolUtilities + Event/EventInfo + ) endif() # Declare the package's dependencies: atlas_depends_on_subdirs( - PUBLIC - Control/AthToolSupport/AsgTools - Event/xAOD/xAODMetaData - ${extra_deps} ) + PUBLIC + Control/AthToolSupport/AsgTools + Event/xAOD/xAODMetaData + ${extra_deps} +) # Build the package differently in standalone and Athena modes: if( XAOD_STANDALONE ) - # The main library is an installed one in this case: - atlas_add_library( xAODMetaDataCnv - xAODMetaDataCnv/*.h Root/*.cxx - PUBLIC_HEADERS xAODMetaDataCnv - LINK_LIBRARIES AsgTools xAODMetaData ) + # The main library is an installed one in this case: + atlas_add_library( xAODMetaDataCnv + xAODMetaDataCnv/*.h Root/*.cxx + PUBLIC_HEADERS xAODMetaDataCnv + LINK_LIBRARIES AsgTools xAODMetaData ) - # Plus we also build a dictionary: - atlas_add_dictionary( xAODMetaDataCnvDict - xAODMetaDataCnv/xAODMetaDataCnvDict.h - xAODMetaDataCnv/selection.xml - LINK_LIBRARIES xAODMetaDataCnv ) + # Plus we also build a dictionary: + atlas_add_dictionary( xAODMetaDataCnvDict + xAODMetaDataCnv/xAODMetaDataCnvDict.h + xAODMetaDataCnv/selection.xml + LINK_LIBRARIES xAODMetaDataCnv ) else() - # The main library is a component one in this case: - atlas_add_component( xAODMetaDataCnv - xAODMetaDataCnv/*.h src/*.cxx Root/*.cxx src/components/*.cxx - LINK_LIBRARIES AsgTools xAODMetaData GaudiKernel AthenaKernel - AthenaPoolUtilities EventInfo ) + # The main library is a component one in this case: + atlas_add_component( xAODMetaDataCnv + xAODMetaDataCnv/*.h src/*.cxx Root/*.cxx src/components/*.cxx + LINK_LIBRARIES AsgTools xAODMetaData GaudiKernel AthenaKernel + AthenaPoolUtilities EventInfo ) endif() diff --git a/Event/xAOD/xAODMetaDataCnv/Root/FileMetaDataTool.cxx b/Event/xAOD/xAODMetaDataCnv/Root/FileMetaDataTool.cxx index 9671c9e90b300978033497fc6c171c24a289896a..352fa3ff7aa019e4ac958ef54ef541ed1a60af4c 100644 --- a/Event/xAOD/xAODMetaDataCnv/Root/FileMetaDataTool.cxx +++ b/Event/xAOD/xAODMetaDataCnv/Root/FileMetaDataTool.cxx @@ -1,32 +1,31 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: FileMetaDataTool.cxx 683697 2015-07-17 09:12:14Z krasznaa $ - // Local include(s): #include "xAODMetaDataCnv/FileMetaDataTool.h" namespace xAODMaker { - FileMetaDataTool::FileMetaDataTool( const std::string& name ) - : asg::AsgMetadataTool( name ), - m_md(), m_mdAux(), m_beginFileIncidentSeen( false ) { - - declareProperty( "InputKey", m_inputKey = "FileMetaData" ); - declareProperty( "OutputKey", m_outputKey = "FileMetaData" ); +FileMetaDataTool::FileMetaDataTool(const std::string& name) + : asg::AsgMetadataTool(name) + , m_md() + , m_mdAux() + , m_beginFileIncidentSeen(false) { + declareProperty("InputKey", m_inputKey = "FileMetaData"); + declareProperty("OutputKey", m_outputKey = "FileMetaData"); #ifndef XAOD_STANDALONE - declareInterface< ::IMetaDataTool >( this ); -#endif // XAOD_STANDALONE - } - - StatusCode FileMetaDataTool::initialize() { + declareInterface< ::IMetaDataTool >(this); +#endif // XAOD_STANDALONE + } +StatusCode + FileMetaDataTool::initialize() { // Greet the user: - ATH_MSG_DEBUG( "Initialising xAODMaker::FileMetaDataTool" ); - ATH_MSG_DEBUG( " InputKey = " << m_inputKey ); - ATH_MSG_DEBUG( " OutputKey = " << m_outputKey ); + ATH_MSG_DEBUG("Initialising xAODMaker::FileMetaDataTool"); + ATH_MSG_DEBUG(" InputKey = " << m_inputKey); + ATH_MSG_DEBUG(" OutputKey = " << m_outputKey); // Reset the member variable(s): m_md.reset(); @@ -35,80 +34,82 @@ namespace xAODMaker { // Return gracefully: return StatusCode::SUCCESS; - } + } - StatusCode FileMetaDataTool::endInputFile() { +StatusCode + FileMetaDataTool::endInputFile() { // Return gracefully: return StatusCode::SUCCESS; - } - StatusCode FileMetaDataTool::beginInputFile() { + } +StatusCode + FileMetaDataTool::beginInputFile() { // Whatever happens, we've seen the incident: m_beginFileIncidentSeen = true; // If the input file doesn't have any file-level metadata, then // finish right away: - if( ! inputMetaStore()->contains< xAOD::FileMetaData >( m_inputKey ) ) { - return StatusCode::SUCCESS; + if (!inputMetaStore()->contains< xAOD::FileMetaData >(m_inputKey)) { + return StatusCode::SUCCESS; } // Retrieve the input object: const xAOD::FileMetaData* input = 0; - ATH_CHECK( inputMetaStore()->retrieve( input, m_inputKey ) ); + ATH_CHECK(inputMetaStore()->retrieve(input, m_inputKey)); // Create the output objects if they don't exist yet: - if( ( ! m_md.get() ) && ( ! m_mdAux.get() ) ) { - ATH_MSG_DEBUG( "Creating output objects" ); - m_md.reset( new xAOD::FileMetaData() ); - m_mdAux.reset( new xAOD::FileMetaDataAuxInfo() ); - m_md->setStore( m_mdAux.get() ); - - // Copy the payload of the input object: - *( m_md.get() ) = *input; + if ((!m_md.get()) && (!m_mdAux.get())) { + ATH_MSG_DEBUG("Creating output objects"); + m_md.reset(new xAOD::FileMetaData()); + m_mdAux.reset(new xAOD::FileMetaDataAuxInfo()); + m_md->setStore(m_mdAux.get()); + + // Copy the payload of the input object: + *(m_md.get()) = *input; } // Make sure that the objects are compatible: - if( *( m_md.get() ) != *input ) { - ATH_MSG_ERROR( "Processing input files with differing conditions" ); - ATH_MSG_ERROR( "Consistent xAOD::FileMetaData can't be provided for " - "the output" ); - return StatusCode::FAILURE; + if (*(m_md.get()) != *input) { + ATH_MSG_ERROR("Processing input files with differing conditions"); + ATH_MSG_ERROR("Consistent xAOD::FileMetaData can't be provided for " + "the output"); + return StatusCode::FAILURE; } // Return gracefully: return StatusCode::SUCCESS; - } - - StatusCode FileMetaDataTool::beginEvent() { + } +StatusCode + FileMetaDataTool::beginEvent() { // In case we missed the BeginInputFile incident for the first input file, // make sure that we still run the appropriate function. - if( ! m_beginFileIncidentSeen ) { - ATH_CHECK( beginInputFile() ); + if (!m_beginFileIncidentSeen) { + ATH_CHECK(beginInputFile()); } // Return gracefully: return StatusCode::SUCCESS; - } - - StatusCode FileMetaDataTool::metaDataStop() { + } +StatusCode + FileMetaDataTool::metaDataStop() { // Don't be offended if the metadata already exists in the output: - if( outputMetaStore()->contains< xAOD::FileMetaData >( m_outputKey ) ) { - ATH_MSG_DEBUG( "xAOD::FileMetaData already in the output" ); - return StatusCode::SUCCESS; + if (outputMetaStore()->contains< xAOD::FileMetaData >(m_outputKey)) { + ATH_MSG_DEBUG("xAOD::FileMetaData already in the output"); + return StatusCode::SUCCESS; } // Record the metadata, if any was found on the input: - if( m_md.get() && m_mdAux.get() ) { - ATH_MSG_DEBUG( "Recoding file level metadata" ); - ATH_CHECK( outputMetaStore()->record( m_md.release(), m_outputKey ) ); - ATH_CHECK( outputMetaStore()->record( m_mdAux.release(), - m_outputKey + "Aux." ) ); + if (m_md.get() && m_mdAux.get()) { + ATH_MSG_DEBUG("Recoding file level metadata"); + ATH_CHECK(outputMetaStore()->record(m_md.release(), m_outputKey)); + ATH_CHECK(outputMetaStore()->record(m_mdAux.release(), + m_outputKey + "Aux.")); } // Return gracefully: return StatusCode::SUCCESS; - } + } -} // namespace xAODMaker +} // namespace xAODMaker diff --git a/Event/xAOD/xAODMetaDataCnv/share/FileMetaDataCreatorTool_jobOptions.py b/Event/xAOD/xAODMetaDataCnv/share/FileMetaDataCreatorTool_jobOptions.py index 9235869dfc9fa383cee3f17879f9d79ca17bd3a3..21d0dcfefac729a314e212520430aeb79ad47b42 100644 --- a/Event/xAOD/xAODMetaDataCnv/share/FileMetaDataCreatorTool_jobOptions.py +++ b/Event/xAOD/xAODMetaDataCnv/share/FileMetaDataCreatorTool_jobOptions.py @@ -1,34 +1,50 @@ -# $Id: FileMetaDataCreatorTool_jobOptions.py 670279 2015-05-27 15:18:27Z krasznaa $ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration # # Test jobO for exercising xAODMaker::FileMetaDataCreatorTool to create # the file-level metadata. # +from AthenaCommon import CfgMgr +from AthenaCommon.AppMgr import ServiceMgr as svcMgr +from AthenaCommon.AppMgr import ToolSvc +from AthenaCommon.AthenaCommonFlags import athenaCommonFlags +from RecExConfig.RecFlags import rec +from OutputStreamAthenaPool.MultipleStreamManager import MSMgr # Set up the reading of an input file: -INFILE = "AOD.pool.root" -from AthenaCommon.AthenaCommonFlags import athenaCommonFlags -athenaCommonFlags.FilesInput = [ INFILE ] +INFILE = ( + "/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/CommonInputs/" + "data16_13TeV.00311321.physics_Main.recon.AOD.r9264/" + "AOD.11038520._000001.pool.root.1" +) + +athenaCommonFlags.FilesInput = [INFILE] athenaCommonFlags.EvtMax = 10 # Turn off most of what RecExCommon does: -from RecExConfig.RecFlags import rec -rec.doCBNT.set_Value_and_Lock( False ) -rec.doWriteAOD.set_Value_and_Lock( False ) -rec.doWriteTAG.set_Value_and_Lock( False ) -rec.AutoConfiguration = [ "everything" ] + +rec.doCBNT.set_Value_and_Lock(False) +rec.doWriteAOD.set_Value_and_Lock(False) +rec.doWriteTAG.set_Value_and_Lock(False) +rec.AutoConfiguration = ["everything"] # Read the file using RecExCommon: -include( "RecExCommon/RecExCommon_topOptions.py" ) +include("RecExCommon/RecExCommon_topOptions.py") # Set up the metadata tool: -ToolSvc += CfgMgr.xAODMaker__FileMetaDataCreatorTool( "FileMetaDataCreatorTool", - OutputLevel = 2 ) -svcMgr.MetaDataSvc.MetaDataTools += [ ToolSvc.FileMetaDataCreatorTool ] +ToolSvc += CfgMgr.xAODMaker__FileMetaDataCreatorTool( + "FileMetaDataCreatorTool", OutputLevel=2 +) +svcMgr.MetaDataSvc.MetaDataTools += [ToolSvc.FileMetaDataCreatorTool] # Set up the writing of an output file: -from OutputStreamAthenaPool.MultipleStreamManager import MSMgr -stream = MSMgr.NewPoolRootStream( "StreamDAOD", "DxAOD.pool.root" ) -stream.AddItem( [ "xAOD::EventInfo#EventInfo", - "xAOD::EventAuxInfo#EventInfoAux." ] ) -stream.AddMetaDataItem( [ "xAOD::FileMetaData#FileMetaData", - "xAOD::FileMetaDataAuxInfo#FileMetaDataAux." ] ) + +stream = MSMgr.NewPoolRootStream("StreamDAOD", "DxAOD.pool.root") +stream.AddItem( + ["xAOD::EventInfo#EventInfo", "xAOD::EventAuxInfo#EventInfoAux."] +) +stream.AddMetaDataItem( + [ + "xAOD::FileMetaData#FileMetaData", + "xAOD::FileMetaDataAuxInfo#FileMetaDataAux.", + ] +) diff --git a/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataCreatorTool.cxx b/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataCreatorTool.cxx index a4397199a8436e9a87280a1330c04e66c74b02db..f7cecdc30cc0fdb257d479b6c990cf0da681ccff 100644 --- a/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataCreatorTool.cxx +++ b/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataCreatorTool.cxx @@ -1,9 +1,7 @@ /* - Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: FileMetaDataCreatorTool.cxx 685407 2015-07-24 16:15:06Z cranshaw $ - // System include(s): #include <algorithm> #include <sstream> @@ -18,255 +16,260 @@ namespace xAODMaker { - /// The folder in DetectorStore that we get the information from - static const std::string FOLDER_NAME = "/TagInfo"; - static const std::string SIMFOLDER_NAME = "/Simulation/Parameters"; +/// The folder in DetectorStore that we get the information from +static const char FOLDER_NAME[] = "/TagInfo"; +static const char SIMFOLDER_NAME[] = "/Simulation/Parameters"; /// Helper macro to execute the setter functions correctly -#define CHECK_BOOL( EXP ) \ - do { \ - try { \ - if( ! EXP ) { \ - ATH_MSG_ERROR( "Failed to execute: " << #EXP ); \ - return StatusCode::FAILURE; \ - } \ - } catch( const std::exception& ex ) { \ - ATH_MSG_INFO( "Couldn't extract attribute with command: " \ - << #EXP ); \ - } \ - } while( 0 ) - - FileMetaDataCreatorTool::FileMetaDataCreatorTool( const std::string& name ) - : asg::AsgMetadataTool( name ), - m_md(), m_mdAux() { - - declareProperty( "OutputKey", m_outputKey = "FileMetaData" ); - } - - StatusCode FileMetaDataCreatorTool::start() { +#define CHECK_BOOL(EXP) \ +do { \ + try { \ + if (!EXP) { \ + ATH_MSG_ERROR("Failed to execute: " << #EXP); \ + return StatusCode::FAILURE; \ + } \ + } catch(const std::exception& ex) { \ + ATH_MSG_INFO("Couldn't extract attribute with command: " \ + << #EXP); \ + } \ +} while (0) + +FileMetaDataCreatorTool::FileMetaDataCreatorTool(const std::string& name) + : asg::AsgMetadataTool(name) + , m_md() + , m_mdAux() { + declareProperty("OutputKey", m_outputKey = "FileMetaData"); + } + +StatusCode + FileMetaDataCreatorTool::start() { const DataHandle< CondAttrListCollection > dummy; - StatusCode sc = detStore()-> - regFcn( &xAODMaker::FileMetaDataCreatorTool::update, - this, dummy, FOLDER_NAME, true ); + StatusCode sc = detStore()->regFcn( + &xAODMaker::FileMetaDataCreatorTool::update, + this, + dummy, + FOLDER_NAME, + true); + if (sc.isFailure()) { - ATH_MSG_WARNING("Unable to register callback for " << FOLDER_NAME); - //return StatusCode::FAILURE; + ATH_MSG_WARNING("Unable to register callback for " << FOLDER_NAME); + // return StatusCode::FAILURE; } - if (detStore()->contains< AthenaAttributeList >(SIMFOLDER_NAME) ) { + + if (detStore()->contains< AthenaAttributeList >(SIMFOLDER_NAME)) { const DataHandle< AthenaAttributeList > dummy2; - sc = detStore()->regFcn( &xAODMaker::FileMetaDataCreatorTool::update, - this, dummy2, SIMFOLDER_NAME, true ); + sc = detStore()->regFcn( + &xAODMaker::FileMetaDataCreatorTool::update, + this, + dummy2, + SIMFOLDER_NAME, + true); + if (sc.isFailure()) { ATH_MSG_WARNING("Unable to register callback for " << SIMFOLDER_NAME); - //return StatusCode::FAILURE; + // return StatusCode::FAILURE; } - } - else { + } else { ATH_MSG_INFO("Processing file with no " << SIMFOLDER_NAME); } return StatusCode::SUCCESS; - } - - StatusCode FileMetaDataCreatorTool::initialize() { + } +StatusCode + FileMetaDataCreatorTool::initialize() { // Greet the user: - ATH_MSG_DEBUG( "Initialising - Package version: " << PACKAGE_VERSION ); - ATH_MSG_DEBUG( " OutputKey = " << m_outputKey ); + ATH_MSG_DEBUG("Initialising - Package version: " << PACKAGE_VERSION); + ATH_MSG_DEBUG(" OutputKey = " << m_outputKey); // Return gracefully: return StatusCode::SUCCESS; - } - - StatusCode FileMetaDataCreatorTool::beginInputFile() { + } +StatusCode + FileMetaDataCreatorTool::beginInputFile() { // Create the output objects if they don't exist yet: - if( ( ! m_md.get() ) && ( ! m_mdAux.get() ) ) { - ATH_MSG_DEBUG( "Creating output objects" ); - m_md.reset( new xAOD::FileMetaData() ); - m_mdAux.reset( new xAOD::FileMetaDataAuxInfo() ); - m_md->setStore( m_mdAux.get() ); + if ((!m_md.get()) && (!m_mdAux.get())) { + ATH_MSG_DEBUG("Creating output objects"); + m_md.reset(new xAOD::FileMetaData()); + m_mdAux.reset(new xAOD::FileMetaDataAuxInfo()); + m_md->setStore(m_mdAux.get()); } - ATH_MSG_DEBUG( "DetectorStore contents:\n\n" << detStore()->dump() ); + ATH_MSG_DEBUG("DetectorStore contents:\n\n" << detStore()->dump()); // Return gracefully: return StatusCode::SUCCESS; - } + } - StatusCode FileMetaDataCreatorTool::endInputFile() { +StatusCode + FileMetaDataCreatorTool::endInputFile() { // Return gracefully: return StatusCode::SUCCESS; - } - - StatusCode FileMetaDataCreatorTool::metaDataStop() { + } +StatusCode + FileMetaDataCreatorTool::metaDataStop() { // Don't be offended if the metadata already exists in the output: - if( outputMetaStore()->contains< xAOD::FileMetaData >( m_outputKey ) ) { - ATH_MSG_DEBUG( "xAOD::FileMetaData already in the output" ); - return StatusCode::SUCCESS; + if (outputMetaStore()->contains< xAOD::FileMetaData >(m_outputKey)) { + ATH_MSG_DEBUG("xAOD::FileMetaData already in the output"); + return StatusCode::SUCCESS; } + SG::ConstIterator<EventStreamInfo> esi_h1; SG::ConstIterator<EventStreamInfo> esi_h2; - StatusCode sc = outputMetaStore()->retrieve(esi_h1,esi_h2); + StatusCode sc = outputMetaStore()->retrieve(esi_h1, esi_h2); if (sc.isSuccess() && esi_h1 != esi_h2) { - if (esi_h1->getProcessingTags().size()==1) { - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::dataType, - *(esi_h1->getProcessingTags().begin()) ) ); + if (esi_h1->getProcessingTags().size() == 1) { + CHECK_BOOL(m_md->setValue( + xAOD::FileMetaData::dataType, + *(esi_h1->getProcessingTags().begin()))); } else { - ATH_MSG_WARNING("Found multiple output process tags"); - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::dataType,"multiple") ); + ATH_MSG_WARNING("Found multiple output process tags"); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::dataType, "multiple")); } - if (esi_h1->getEventTypes().size()==1) { - float id = esi_h1->getEventTypes().begin()->mc_channel_number(); - CHECK_BOOL(m_md->setValue( xAOD::FileMetaData::mcProcID,id)); + if (esi_h1->getEventTypes().size() == 1) { + float id = esi_h1->getEventTypes().begin()->mc_channel_number(); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::mcProcID, id)); } else { - ATH_MSG_WARNING("Found multiple eventtypes"); - CHECK_BOOL(m_md->setValue( xAOD::FileMetaData::mcProcID,float(0.0))); + ATH_MSG_WARNING("Found multiple eventtypes"); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::mcProcID, 0.0f)); } } // Record the metadata, if any was found on the input: - if( m_md.get() && m_mdAux.get() ) { - ATH_MSG_DEBUG( "Recoding file level metadata" ); - ATH_CHECK( outputMetaStore()->record( m_md.release(), m_outputKey ) ); - ATH_CHECK( outputMetaStore()->record( m_mdAux.release(), - m_outputKey + "Aux." ) ); + if (m_md.get() && m_mdAux.get()) { + ATH_MSG_DEBUG("Recoding file level metadata"); + ATH_CHECK(outputMetaStore()->record(m_md.release(), m_outputKey)); + ATH_CHECK(outputMetaStore()->record(m_mdAux.release(), + m_outputKey + "Aux.")); } // Return gracefully: return StatusCode::SUCCESS; - } - - StatusCode - FileMetaDataCreatorTool::update( IOVSVC_CALLBACK_ARGS_K( keys ) ) { + } - ATH_MSG_DEBUG( "update() invoked for key(s): " << keys ); +StatusCode + FileMetaDataCreatorTool::update(IOVSVC_CALLBACK_ARGS_K(keys)) { + ATH_MSG_DEBUG("update() invoked for key(s): " << keys); // Bail if the requested folder is not amongst the keys: - if( std::find( keys.begin(), keys.end(), FOLDER_NAME ) == keys.end() && - std::find( keys.begin(), keys.end(), SIMFOLDER_NAME ) == keys.end() ) { - ATH_MSG_WARNING( "Update callback received without the \"" - << FOLDER_NAME << "\" key" ); - return StatusCode::SUCCESS; + if (std::find(keys.begin(), keys.end(), FOLDER_NAME) == keys.end() + && std::find(keys.begin(), keys.end(), SIMFOLDER_NAME) == keys.end()) { + ATH_MSG_WARNING("Update callback received without the \"" + << FOLDER_NAME << "\" key"); + return StatusCode::SUCCESS; } // Retrieve the needed metadata: - if (std::find( keys.begin(), keys.end(), FOLDER_NAME ) != keys.end()) { - const CondAttrListCollection* tagInfo = 0; - ATH_CHECK( detStore()->retrieve( tagInfo, FOLDER_NAME ) ); - - ATH_MSG_DEBUG( "Retrieved object: " << FOLDER_NAME ); - - // Make sure that it has some the expected size: - if( tagInfo->size() > 1 ) { - ATH_MSG_WARNING( "Collection with >1 size received for \"" - << FOLDER_NAME << "\"" ); - } - if( ! tagInfo->size() ) { - ATH_MSG_ERROR( "Empty collection received for \"" - << FOLDER_NAME << "\"" ); - return StatusCode::FAILURE; - } - // Access the first, and only channel of the object: - const CondAttrListCollection::AttributeList& al = - tagInfo->attributeList( 0 ); - - if (al.exists("AtlasRelease")) { - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::productionRelease, al[ "AtlasRelease" ].data< std::string >() ) ); - } - else { - ATH_MSG_WARNING("Did not find AtlasRelease in TagInfo setting to none"); - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::productionRelease, - "none" ) ); - } - if (al.exists("AMITag")) { - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::amiTag, - al[ "AMITag" ].data< std::string >() ) ); - } - else { - ATH_MSG_WARNING("Did not find AMITag in TagInfo setting to none"); - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::amiTag, - "none" ) ); - } - if (al.exists("GeoAtlas")) { - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::geometryVersion, - al[ "GeoAtlas" ].data< std::string >() ) ); - } - else { - ATH_MSG_WARNING("Did not find GeoAtlas in TagInfo setting to none"); - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::geometryVersion, - "none" ) ); - } - if (al.exists("IOVDbGlobalTag")) { - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::conditionsTag, - al[ "IOVDbGlobalTag" ].data< std::string >() ) ); - } - else { - ATH_MSG_WARNING("Did not find IOVDbGlobalTag in TagInfo setting to none"); - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::conditionsTag, - "none" ) ); - } - - // Convert the beam energy to float. (If it exists.) - if (al.exists("beam_energy")) { - try { - const std::string beamEnergyStr = - al[ "beam_energy" ].data< std::string >(); - char* endptr = 0; - float beamEnergy = strtof( beamEnergyStr.c_str(), &endptr ); - if( endptr ) { - if( ! m_md->setValue( xAOD::FileMetaData::beamEnergy, - beamEnergy ) ) { - ATH_MSG_ERROR( "Failed to set the beam energy" ); - return StatusCode::FAILURE; - } + if (std::find(keys.begin(), keys.end(), FOLDER_NAME) != keys.end()) { + const CondAttrListCollection* tagInfo = 0; + ATH_CHECK(detStore()->retrieve(tagInfo, FOLDER_NAME)); + + ATH_MSG_DEBUG("Retrieved object: " << FOLDER_NAME); + + // Make sure that it has some the expected size: + if (tagInfo->size() > 1) { + ATH_MSG_WARNING("Collection with >1 size received for \"" + << FOLDER_NAME << "\""); + } + if (!tagInfo->size()) { + ATH_MSG_ERROR("Empty collection received for \"" + << FOLDER_NAME << "\""); + return StatusCode::FAILURE; + } + // Access the first, and only channel of the object: + const CondAttrListCollection::AttributeList& al = + tagInfo->attributeList(0); + + if (al.exists("AtlasRelease")) { + CHECK_BOOL(m_md->setValue( + xAOD::FileMetaData::productionRelease, + al[ "AtlasRelease" ].data< std::string >())); + } else { + ATH_MSG_WARNING("Did not find AtlasRelease in TagInfo setting to none"); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::productionRelease, "none")); + } + + if (al.exists("AMITag")) { + CHECK_BOOL(m_md->setValue( + xAOD::FileMetaData::amiTag, + al["AMITag"].data< std::string >())); + } else { + ATH_MSG_WARNING("Did not find AMITag in TagInfo setting to none"); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::amiTag, "none")); + } + + if (al.exists("GeoAtlas")) { + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::geometryVersion, + al["GeoAtlas"].data< std::string >())); + } else { + ATH_MSG_WARNING("Did not find GeoAtlas in TagInfo setting to none"); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::geometryVersion, "none")); + } + + if (al.exists("IOVDbGlobalTag")) { + CHECK_BOOL(m_md->setValue( + xAOD::FileMetaData::conditionsTag, + al["IOVDbGlobalTag"].data< std::string >())); + } else { + ATH_MSG_WARNING("Did not find IOVDbGlobalTag in TagInfo setting to none"); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::conditionsTag, "none")); + } + + // Convert the beam energy to float. (If it exists.) + if (al.exists("beam_energy")) { + try { + const std::string beamEnergyStr = al["beam_energy"].data< std::string >(); + char* endptr = 0; + float beamEnergy = strtof(beamEnergyStr.c_str(), &endptr); + if (endptr) { + if (!m_md->setValue(xAOD::FileMetaData::beamEnergy, beamEnergy)) { + ATH_MSG_ERROR("Failed to set the beam energy"); + return StatusCode::FAILURE; } - } catch( const std::exception& ex ) { - ATH_MSG_INFO( "Couldn't set the beam energy" ); - } - } - else { - ATH_MSG_WARNING("Did not find beam_energy in TagInfo setting to -1"); - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::beamEnergy, -1.0f ) ); - } - - if (al.exists("beam_type")) { - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::beamType, - al[ "beam_type" ].data< std::string >() ) ); - } - else { - ATH_MSG_WARNING("Did not find beam_type in TagInfo setting to none"); - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::beamType, - "none" ) ); - } + } + } catch(const std::exception& ex) { + ATH_MSG_INFO("Couldn't set the beam energy"); + } + } else { + ATH_MSG_WARNING("Did not find beam_energy in TagInfo setting to -1"); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::beamEnergy, -1.0f)); + } + + if (al.exists("beam_type")) { + CHECK_BOOL(m_md->setValue( + xAOD::FileMetaData::beamType, + al["beam_type"].data< std::string >())); + } else { + ATH_MSG_WARNING("Did not find beam_type in TagInfo setting to none"); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::beamType, "none")); + } } - if (std::find( keys.begin(), keys.end(), SIMFOLDER_NAME ) != keys.end()) { - const AthenaAttributeList* simInfo = 0; - ATH_CHECK( detStore()->retrieve( simInfo, SIMFOLDER_NAME ) ); - - if (simInfo->exists("SimulationFlavour")) { - std::string flavor = (*simInfo)[ "SimulationFlavour" ].data< std::string >(); - if (flavor == "default") flavor = "FullSim"; - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::simFlavour, - flavor ) ); - } - else { - ATH_MSG_ERROR("Unable to retrieve SimulationFlavour from " << SIMFOLDER_NAME); - } - - if (simInfo->exists("IsEventOverlayInputSim")) { - bool isDataOverlay = (*simInfo)[ "IsEventOverlayInputSim" ].data< std::string >()=="True"; - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::isDataOverlay, - isDataOverlay ) ); - } - else { - ATH_MSG_INFO("Unable to retrieve IsEventOverlayInputSim from " << SIMFOLDER_NAME << " - assuming not data overlay"); - CHECK_BOOL( m_md->setValue( xAOD::FileMetaData::isDataOverlay, false ) ); - } + + if (std::find(keys.begin(), keys.end(), SIMFOLDER_NAME) != keys.end()) { + const AthenaAttributeList* simInfo = 0; + ATH_CHECK(detStore()->retrieve(simInfo, SIMFOLDER_NAME)); + + if (simInfo->exists("SimulationFlavour")) { + std::string flavor = (*simInfo)["SimulationFlavour"].data< std::string >(); + if (flavor == "default") flavor = "FullSim"; + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::simFlavour, flavor)); + } else { + ATH_MSG_ERROR("Unable to retrieve SimulationFlavour from " << SIMFOLDER_NAME); + } + + if (simInfo->exists("IsEventOverlayInputSim")) { + bool isDataOverlay = (*simInfo)["IsEventOverlayInputSim"].data< std::string >() == "True"; + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::isDataOverlay, isDataOverlay)); + } else { + ATH_MSG_INFO("Unable to retrieve IsEventOverlayInputSim from " + << SIMFOLDER_NAME << " - assuming not data overlay"); + CHECK_BOOL(m_md->setValue(xAOD::FileMetaData::isDataOverlay, false)); + } } // Return gracefully: return StatusCode::SUCCESS; - } + } -} // namespace xAODMaker +} // namespace xAODMaker diff --git a/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataCreatorTool.h b/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataCreatorTool.h index 433f97de011368fadc8973e7f0f1778358daa1fd..144431f39f522a614fbafe3e9f004f3327d1c2bc 100644 --- a/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataCreatorTool.h +++ b/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataCreatorTool.h @@ -1,10 +1,7 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: FileMetaDataCreatorTool.h 676522 2015-06-18 22:17:03Z cranshaw $ #ifndef XAODMETADATACNV_FILEMETADATACREATORTOOL_H #define XAODMETADATACNV_FILEMETADATACREATORTOOL_H @@ -24,40 +21,40 @@ namespace xAODMaker { - /// Tool creating or propagating xAOD::FileMetaData information - /// - /// This Athena-only tool can be used to create xAOD::FileMetaData - /// information out of the non-ROOT-readable metadata available in - /// the input. - /// - /// Or, if the input file already has xAOD::FileMetaData payload, - /// it is taken as is, and copied to the output. - /// - /// The class uses asg::AsgMetadataTool as a base class for convenience, - /// but it's not a dual-use tool. (Hence the header is hidden from the - /// outside world.) - /// - /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - /// - /// $Revision: 676522 $ - /// $Date: 2015-06-19 00:17:03 +0200 (Fri, 19 Jun 2015) $ - /// - class FileMetaDataCreatorTool : public asg::AsgMetadataTool, - public virtual ::IMetaDataTool { - - /// Declare the correct constructor for Athena - ASG_TOOL_CLASS( FileMetaDataCreatorTool, IMetaDataTool ) - - public: +/// Tool creating or propagating xAOD::FileMetaData information +/// +/// This Athena-only tool can be used to create xAOD::FileMetaData +/// information out of the non-ROOT-readable metadata available in +/// the input. +/// +/// Or, if the input file already has xAOD::FileMetaData payload, +/// it is taken as is, and copied to the output. +/// +/// The class uses asg::AsgMetadataTool as a base class for convenience, +/// but it's not a dual-use tool. (Hence the header is hidden from the +/// outside world.) +/// +/// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> +/// +/// $Revision: 676522 $ +/// $Date: 2015-06-19 00:17:03 +0200 (Fri, 19 Jun 2015) $ +/// +class FileMetaDataCreatorTool + : public asg::AsgMetadataTool + , public virtual ::IMetaDataTool { + /// Declare the correct constructor for Athena + ASG_TOOL_CLASS(FileMetaDataCreatorTool, IMetaDataTool) + + public: /// Regular AsgTool constructor - FileMetaDataCreatorTool( const std::string& name = - "FileMetaDataCreatorTool" ); + FileMetaDataCreatorTool(const std::string& name = + "FileMetaDataCreatorTool"); /// Function initialising the tool virtual StatusCode initialize(); virtual StatusCode start(); - protected: + protected: /// @name Functions called by the AsgMetadataTool base class /// @{ @@ -78,9 +75,9 @@ namespace xAODMaker { /// @} - private: + private: /// Function called by the DetectorStore when the metadata is updated - StatusCode update( IOVSVC_CALLBACK_ARGS_P( I, keys ) ); + StatusCode update(IOVSVC_CALLBACK_ARGS_P(I, keys)); /// Key of the metadata object for the output file std::string m_outputKey; @@ -89,9 +86,8 @@ namespace xAODMaker { std::unique_ptr< xAOD::FileMetaData > m_md; /// The output auxiliary object std::unique_ptr< xAOD::FileMetaDataAuxInfo > m_mdAux; +}; // class FileMetaDataCreatorTool - }; // class FileMetaDataCreatorTool - -} // namespace xAODMaker +} // namespace xAODMaker -#endif // XAODMETADATACNV_FILEMETADATACREATORTOOL_H +#endif // XAODMETADATACNV_FILEMETADATACREATORTOOL_H diff --git a/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataMarkUpTool.cxx b/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataMarkUpTool.cxx index 4df951f99e2279eb86a4c9509100fbef7ddb4354..17c31e3c70f6362b9186728c0b06c5e2fa57ecca 100644 --- a/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataMarkUpTool.cxx +++ b/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataMarkUpTool.cxx @@ -2,11 +2,10 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ -// $Id: FileMetaDataMarkUpTool.cxx 685407 2015-07-24 16:15:06Z cranshaw $ - // System include(s): #include <algorithm> #include <sstream> +#include <vector> // Athena metadata EDM: #include "EventInfo/EventStreamInfo.h" @@ -17,92 +16,107 @@ namespace xAODMaker { /// Helper macro to execute the setter functions correctly -#define CHECK_BOOL( EXP ) \ - do { \ - try { \ - if( ! EXP ) { \ - ATH_MSG_ERROR( "Failed to execute: " << #EXP ); \ - return StatusCode::FAILURE; \ - } \ - } catch( const std::exception& ex ) { \ - ATH_MSG_INFO( "Couldn't extract attribute with command: " \ - << #EXP ); \ - } \ - } while( 0 ) - - FileMetaDataMarkUpTool::FileMetaDataMarkUpTool( const std::string& name ) - : asg::AsgMetadataTool( name ) { - - declareProperty( "Key", m_outputKey = "" ); - } - - StatusCode FileMetaDataMarkUpTool::initialize() { - return(StatusCode::SUCCESS); - } - - StatusCode FileMetaDataMarkUpTool::postInitialize() { - return(StatusCode::SUCCESS); - } - - StatusCode FileMetaDataMarkUpTool::preExecute() { - return(StatusCode::SUCCESS); - } - - StatusCode FileMetaDataMarkUpTool::preStream() { - return(StatusCode::SUCCESS); - } - - StatusCode FileMetaDataMarkUpTool::postExecute() { - return(StatusCode::SUCCESS); - } - - StatusCode FileMetaDataMarkUpTool::preFinalize() { - ATH_MSG_DEBUG("in preFinalize()"); - std::vector<std::string> fmd_keys; - outputMetaStore()->keys<xAOD::FileMetaData>( fmd_keys ); - if (fmd_keys.size() != 1) { - return(StatusCode::SUCCESS); - } - if (!outputMetaStore()->transientContains<xAOD::FileMetaData>( *(fmd_keys.begin()) )) { - return(StatusCode::SUCCESS); +#define CHECK_BOOL(EXP) \ + do { \ + try { \ + if (!EXP) { \ + ATH_MSG_ERROR("Failed to execute: " << #EXP); \ + return StatusCode::FAILURE; \ + } \ + } catch(const std::exception& ex) { \ + ATH_MSG_INFO("Couldn't extract attribute with command: " \ + << #EXP); \ + } \ + } while (0) + + FileMetaDataMarkUpTool::FileMetaDataMarkUpTool(const std::string& name) + : asg::AsgMetadataTool(name) { + declareProperty("Key", m_outputKey = ""); } - xAOD::FileMetaData* fmd = nullptr; - StatusCode sc = outputMetaStore()->retrieve(fmd, *(fmd_keys.begin()) ); - if (!sc.isSuccess()) { - return(StatusCode::SUCCESS); - } - const EventStreamInfo* esi = nullptr; - sc = outputMetaStore()->retrieve(esi, m_outputKey); - if (sc.isSuccess()) { - ATH_MSG_DEBUG( "Setting xAOD::FileMetaData from output EventStreamInfo object " << m_outputKey ); - if (esi->getProcessingTags().size()==1) { - CHECK_BOOL( fmd->setValue( xAOD::FileMetaData::dataType, - *(esi->getProcessingTags().begin()) ) ); - } else { - CHECK_BOOL( fmd->setValue( xAOD::FileMetaData::dataType, m_outputKey ) ); - } - if (esi->getEventTypes().size()==1) { + + StatusCode + FileMetaDataMarkUpTool::initialize() { + return StatusCode::SUCCESS; + } + + StatusCode + FileMetaDataMarkUpTool::postInitialize() { + return StatusCode::SUCCESS; + } + + StatusCode + FileMetaDataMarkUpTool::preExecute() { + return StatusCode::SUCCESS; + } + + StatusCode + FileMetaDataMarkUpTool::preStream() { + return StatusCode::SUCCESS; + } + + StatusCode + FileMetaDataMarkUpTool::postExecute() { + return StatusCode::SUCCESS; + } + + StatusCode + FileMetaDataMarkUpTool::preFinalize() { + ATH_MSG_DEBUG("in preFinalize()"); + + std::vector<std::string> fmd_keys; + outputMetaStore()->keys<xAOD::FileMetaData>(fmd_keys); + if (fmd_keys.size() != 1) { + return StatusCode::SUCCESS; + } + + if (!outputMetaStore()->transientContains< xAOD::FileMetaData >( + *(fmd_keys.begin()))) { + return StatusCode::SUCCESS; + } + + xAOD::FileMetaData* fmd = nullptr; + StatusCode sc = outputMetaStore()->retrieve(fmd, *(fmd_keys.begin())); + if (!sc.isSuccess()) { + return StatusCode::SUCCESS; + } + + const EventStreamInfo* esi = nullptr; + sc = outputMetaStore()->retrieve(esi, m_outputKey); + if (sc.isSuccess()) { + ATH_MSG_DEBUG("Setting xAOD::FileMetaData from output " + << "EventStreamInfo object " << m_outputKey); + if (esi->getProcessingTags().size() == 1) { + CHECK_BOOL(fmd->setValue(xAOD::FileMetaData::dataType, + *(esi->getProcessingTags().begin()))); + } else { + CHECK_BOOL(fmd->setValue(xAOD::FileMetaData::dataType, m_outputKey)); + } + if (esi->getEventTypes().size() == 1) { float id = esi->getEventTypes().begin()->mc_channel_number(); - CHECK_BOOL( fmd->setValue( xAOD::FileMetaData::mcProcID, id) ); - } + CHECK_BOOL(fmd->setValue(xAOD::FileMetaData::mcProcID, id)); + } + } + return StatusCode::SUCCESS; } - return(StatusCode::SUCCESS); - } - StatusCode FileMetaDataMarkUpTool::finalize() { - return(StatusCode::SUCCESS); - } + StatusCode + FileMetaDataMarkUpTool::finalize() { + return StatusCode::SUCCESS; + } - StatusCode FileMetaDataMarkUpTool::start() { - return StatusCode::SUCCESS; - } + StatusCode + FileMetaDataMarkUpTool::start() { + return StatusCode::SUCCESS; + } - StatusCode FileMetaDataMarkUpTool::beginInputFile() { - return StatusCode::SUCCESS; - } + StatusCode + FileMetaDataMarkUpTool::beginInputFile() { + return StatusCode::SUCCESS; + } - StatusCode FileMetaDataMarkUpTool::metaDataStop() { - return StatusCode::SUCCESS; - } + StatusCode + FileMetaDataMarkUpTool::metaDataStop() { + return StatusCode::SUCCESS; + } -} // namespace xAODMaker +} // namespace xAODMaker diff --git a/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataMarkUpTool.h b/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataMarkUpTool.h index 8e804b5541673f58016f83b9fe820a091332b3c6..50ce08e07e99ef6ff7e05702888926d8fadc9eba 100644 --- a/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataMarkUpTool.h +++ b/Event/xAOD/xAODMetaDataCnv/src/FileMetaDataMarkUpTool.h @@ -1,10 +1,7 @@ // Dear emacs, this is -*- c++ -*- - /* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: FileMetaDataMarkUpTool.h 676522 2015-06-18 22:17:03Z cranshaw $ #ifndef XAODMETADATACNV_FILEMETADATAMARKUPTOOL_H #define XAODMETADATACNV_FILEMETADATAMARKUPTOOL_H @@ -23,70 +20,69 @@ namespace xAODMaker { - /// Tool creating or propagating xAOD::FileMetaData information - /// - /// This Athena-only tool can be used to create xAOD::FileMetaData - /// information out of the non-ROOT-readable metadata available in - /// the input. - /// - /// Or, if the input file already has xAOD::FileMetaData payload, - /// it is taken as is, and copied to the output. - /// - /// The class uses asg::AsgMetadataTool as a base class for convenience, - /// but it's not a dual-use tool. (Hence the header is hidden from the - /// outside world.) - /// - /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - /// - /// $Revision: 676522 $ - /// $Date: 2015-06-19 00:17:03 +0200 (Fri, 19 Jun 2015) $ - /// - class FileMetaDataMarkUpTool : public asg::AsgMetadataTool, - public virtual ::IAthenaOutputTool { - - /// Declare the correct constructor for Athena - ASG_TOOL_CLASS( FileMetaDataMarkUpTool, IAthenaOutputTool ) - - public: +/// Tool creating or propagating xAOD::FileMetaData information +/// +/// This Athena-only tool can be used to create xAOD::FileMetaData +/// information out of the non-ROOT-readable metadata available in +/// the input. +/// +/// Or, if the input file already has xAOD::FileMetaData payload, +/// it is taken as is, and copied to the output. +/// +/// The class uses asg::AsgMetadataTool as a base class for convenience, +/// but it's not a dual-use tool. (Hence the header is hidden from the +/// outside world.) +/// +/// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> +/// +/// $Revision: 676522 $ +/// $Date: 2015-06-19 00:17:03 +0200 (Fri, 19 Jun 2015) $ +/// +class FileMetaDataMarkUpTool + : public asg::AsgMetadataTool + , public virtual ::IAthenaOutputTool { + /// Declare the correct constructor for Athena + ASG_TOOL_CLASS(FileMetaDataMarkUpTool, IAthenaOutputTool) + + public: /// Regular AsgTool constructor - FileMetaDataMarkUpTool( const std::string& name = - "FileMetaDataMarkUpTool" ); + explicit FileMetaDataMarkUpTool( + const std::string& name = "FileMetaDataMarkUpTool"); /// Required of all IAthenaOutputTools: /// Called by AthenaOutputStream::initialize() (via ToolSvc retrieve()). - virtual StatusCode initialize() override; + StatusCode initialize() override; /// Called at the end of AthenaOutputStream::initialize(). - virtual StatusCode postInitialize() override; + StatusCode postInitialize() override; /// Called at the beginning of AthenaOutputStream::execute(). - virtual StatusCode preExecute() override; + StatusCode preExecute() override; /// Called before actually streaming objects. - virtual StatusCode preStream() override; + StatusCode preStream() override; /// Called at the end of AthenaOutputStream::execute(). - virtual StatusCode postExecute() override; + StatusCode postExecute() override; /// Called at the beginning of AthenaOutputStream::finalize(). - virtual StatusCode preFinalize() override; + StatusCode preFinalize() override; /// Called at the end of AthenaOutputStream::finalize() (via release()). - virtual StatusCode finalize() override; - virtual StatusCode start() override; + StatusCode finalize() override; + StatusCode start() override; - protected: + protected: /// @name Functions called by the AsgMetadataTool base class /// @{ /// Function collecting the metadata from a new input file - virtual StatusCode beginInputFile() override; + StatusCode beginInputFile() override; /// Function writing the collected metadata to the output - virtual StatusCode metaDataStop() override; + StatusCode metaDataStop() override; /// @} - private: + private: /// Key of the metadata object for the output file std::string m_outputKey; +}; // class FileMetaDataMarkUpTool - }; // class FileMetaDataMarkUpTool - -} // namespace xAODMaker +} // namespace xAODMaker -#endif // XAODMETADATACNV_FILEMETADATAMARKUPTOOL_H +#endif // XAODMETADATACNV_FILEMETADATAMARKUPTOOL_H diff --git a/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/FileMetaDataTool.h b/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/FileMetaDataTool.h index 01e15dc64ab5e12983e468ab6f2e5c814068f051..3c3c718a93e53bfea98b4908fcf274a70d68f914 100644 --- a/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/FileMetaDataTool.h +++ b/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/FileMetaDataTool.h @@ -1,10 +1,7 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ - -// $Id: FileMetaDataTool.h 683697 2015-07-17 09:12:14Z krasznaa $ #ifndef XAODMETADATACNV_FILEMETADATATOOL_H #define XAODMETADATACNV_FILEMETADATATOOL_H @@ -16,7 +13,7 @@ #include "AsgTools/AsgMetadataTool.h" #ifndef XAOD_STANDALONE # include "AthenaKernel/IMetaDataTool.h" -#endif // XAOD_STANDALONE +#endif // XAOD_STANDALONE // EDM include(s): #include "xAODMetaData/FileMetaData.h" @@ -24,37 +21,37 @@ namespace xAODMaker { - /// Tool taking care of propagating xAOD::FileMetaData information - /// - /// This dual-use tool can be used both in Athena and in AnalysisBase - /// to propagate the generic file-level metadata from the processed - /// input files to an output file. - /// - /// It relies on the input already containing the information in an - /// xAOD format. - /// - /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> - /// - /// $Revision: 683697 $ - /// $Date: 2015-07-17 11:12:14 +0200 (Fri, 17 Jul 2015) $ - /// - class FileMetaDataTool : public asg::AsgMetadataTool +/// Tool taking care of propagating xAOD::FileMetaData information +/// +/// This dual-use tool can be used both in Athena and in AnalysisBase +/// to propagate the generic file-level metadata from the processed +/// input files to an output file. +/// +/// It relies on the input already containing the information in an +/// xAOD format. +/// +/// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> +/// +/// $Revision: 683697 $ +/// $Date: 2015-07-17 11:12:14 +0200 (Fri, 17 Jul 2015) $ +/// +class FileMetaDataTool + : public asg::AsgMetadataTool #ifndef XAOD_STANDALONE - , public virtual ::IMetaDataTool -#endif // XAOD_STANDALONE - { - + , public virtual ::IMetaDataTool +#endif // XAOD_STANDALONE +{ /// Declare the correct constructor for Athena - ASG_TOOL_CLASS0( FileMetaDataTool ) + ASG_TOOL_CLASS0(FileMetaDataTool) - public: + public: /// Regular AsgTool constructor - FileMetaDataTool( const std::string& name = "FileMetaDataTool" ); + explicit FileMetaDataTool(const std::string& name = "FileMetaDataTool"); /// Function initialising the tool virtual StatusCode initialize(); - protected: + protected: /// @name Functions called by the AsgMetadataTool base class /// @{ @@ -71,15 +68,15 @@ namespace xAODMaker { virtual StatusCode metaDataStop(); #ifndef XAOD_STANDALONE - /// Function collecting the metadata from a new input file - virtual StatusCode beginInputFile(const SG::SourceID&) {return beginInputFile();} + /// Function collecting the metadata from a new input file + virtual StatusCode beginInputFile(const SG::SourceID&) {return beginInputFile();} - /// Function collecting the metadata from a new input file - virtual StatusCode endInputFile(const SG::SourceID&) {return endInputFile();} -#endif // XAOD_STANDALONE + /// Function collecting the metadata from a new input file + virtual StatusCode endInputFile(const SG::SourceID&) {return endInputFile();} +#endif // XAOD_STANDALONE /// @} - private: + private: /// Key of the metadata object in the input file std::string m_inputKey; /// Key of the metadata object for the output file @@ -93,9 +90,8 @@ namespace xAODMaker { /// Internal flag for keeping track of whether a BeginInputFile incident /// was seen already bool m_beginFileIncidentSeen; +}; // class FileMetaDataTool - }; // class FileMetaDataTool - -} // namespace xAODMaker +} // namespace xAODMaker -#endif // XAODMETADATACNV_FILEMETADATATOOL_H +#endif // XAODMETADATACNV_FILEMETADATATOOL_H diff --git a/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/xAODMetaDataCnvAthena.h b/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/xAODMetaDataCnvAthena.h index d379b0346bd90e76871244c14fde7de228ae2da2..aa05a376f510c6da2959f819ab92bf3d64e62077 100644 --- a/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/xAODMetaDataCnvAthena.h +++ b/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/xAODMetaDataCnvAthena.h @@ -1,7 +1,6 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: xAODMetaDataCnvAthena.h 670279 2015-05-27 15:18:27Z krasznaa $ diff --git a/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/xAODMetaDataCnvDict.h b/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/xAODMetaDataCnvDict.h index 557f9d7cbec4c2c753e31a063e29bb5978a4a61f..2ba9da9f9e3d628009e0dbecae315998de5d261d 100644 --- a/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/xAODMetaDataCnvDict.h +++ b/Event/xAOD/xAODMetaDataCnv/xAODMetaDataCnv/xAODMetaDataCnvDict.h @@ -1,7 +1,6 @@ // Dear emacs, this is -*- c++ -*- - /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ // $Id: xAODMetaDataCnvDict.h 683697 2015-07-17 09:12:14Z krasznaa $