diff --git a/Event/xAOD/xAODCoreCnv/CMakeLists.txt b/Event/xAOD/xAODCoreCnv/CMakeLists.txt index d8ebff324602ceebced566842cf229d056f34b6a..d351dd74f77f9f91c99c533208239b3f31078314 100644 --- a/Event/xAOD/xAODCoreCnv/CMakeLists.txt +++ b/Event/xAOD/xAODCoreCnv/CMakeLists.txt @@ -1,28 +1,23 @@ -# $Id$ -################################################################################ -# Package: xAODCoreCnv -################################################################################ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration -# Declare the package name: +# Declare the package's name. atlas_subdir( xAODCoreCnv ) -# Declare the package's dependencies: -atlas_depends_on_subdirs( - PRIVATE - Control/AthContainers - Control/AthContainersInterfaces - Control/AthLinks - Control/AthenaBaseComps - Control/AthenaKernel - Control/SGTools - Event/xAOD/xAODCore - GaudiKernel ) +# External(s). +find_package( ROOT COMPONENTS Core ) + +# Component(s) in the package. +atlas_add_library( xAODCoreCnvLib + xAODCoreCnv/*.h + INTERFACE + PUBLIC_HEADERS xAODCoreCnv + LINK_LIBRARIES GaudiKernel ) -# Component(s) in the package: atlas_add_component( xAODCoreCnv src/*.h src/*.cxx src/components/*.cxx - LINK_LIBRARIES AthContainers AthLinks AthenaBaseComps AthenaKernel SGTools - xAODCore GaudiKernel ) + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthContainers AthLinks AthenaBaseComps + AthenaKernel SGTools xAODCore GaudiKernel xAODCoreCnvLib ) -# Install files from the package: +# Install files from the package. atlas_install_joboptions( share/*.py ) diff --git a/Event/xAOD/xAODCoreCnv/share/ROOTHeaderLoaderSvcTest_jobOptions.py b/Event/xAOD/xAODCoreCnv/share/ROOTHeaderLoaderSvcTest_jobOptions.py new file mode 100644 index 0000000000000000000000000000000000000000..02eba950bd764377ff7cd925cbe109dc4b699c5a --- /dev/null +++ b/Event/xAOD/xAODCoreCnv/share/ROOTHeaderLoaderSvcTest_jobOptions.py @@ -0,0 +1,15 @@ +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +# +# Small/simple job testing the behaviour of xAODMaker::ROOTHeaderLoaderSvc. +# + +# Set up the service. +from AthenaCommon.AppMgr import ServiceMgr +ServiceMgr += CfgMgr.xAODMaker__ROOTHeaderLoaderSvc( 'ROOTHeaderLoaderSvc', + HeaderNames = [ + 'xAODEgamma/PhotonContainer.h', + 'xAODTrigEgamma/TrigPhotonContainer.h' ] ) +theApp.CreateSvc += [ 'xAODMaker::ROOTHeaderLoaderSvc/ROOTHeaderLoaderSvc' ] + +# Some final tweaking: +theApp.EvtMax = 1 diff --git a/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.cxx b/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.cxx new file mode 100644 index 0000000000000000000000000000000000000000..786d242625c04ba08c57253ca00f7d8e06c2da02 --- /dev/null +++ b/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.cxx @@ -0,0 +1,46 @@ +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// + +// Local include(s). +#include "ROOTHeaderLoaderSvc.h" + +// ROOT include(s). +#include <TInterpreter.h> +#include <TString.h> +#include <TROOT.h> + +namespace xAODMaker { + + StatusCode ROOTHeaderLoaderSvc::initialize() { + + // Load all the configured headers. + for( const std::string& headerName : m_headerNames.value() ) { + ATH_MSG_INFO( "Loading header \"" << headerName << "\"" ); + ATH_CHECK( loadHeader( headerName ) ); + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + + StatusCode + ROOTHeaderLoaderSvc::loadHeader( const std::string& headerName ) const { + + // Load the requested header. + Int_t errorCode = 0; + gROOT->ProcessLine( TString::Format( "#include \"%s\"", + headerName.c_str() ), + &errorCode ); + + // Check if the call succeeded. + if( errorCode != TInterpreter::kNoError ) { + ATH_MSG_FATAL( "Failed to load header \"" << headerName << "\"" ); + return StatusCode::FAILURE; + } + + // Return gracefully. + return StatusCode::SUCCESS; + } + +} // namespace xAODMaker diff --git a/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.h b/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..b1ef589977622ada4593a2390a4c010038876b94 --- /dev/null +++ b/Event/xAOD/xAODCoreCnv/src/ROOTHeaderLoaderSvc.h @@ -0,0 +1,59 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// +#ifndef XAODCORECNV_ROOTHEADERLOADERSVC_H +#define XAODCORECNV_ROOTHEADERLOADERSVC_H + +// Local include(s). +#include "xAODCoreCnv/IROOTHeaderLoaderSvc.h" + +// Framework include(s). +#include "AthenaBaseComps/AthService.h" +#include "GaudiKernel/Property.h" + +// System include(s). +#include <string> +#include <vector> + +namespace xAODMaker { + + /// Service implementing @c xAODMaker::IROOTHeaderLoaderSvc + /// + /// The service simply relies on @c TROOT::ProcessLine(...) to execute + /// '#include "headerName.h"' commands. Forcing ROOT to interpret those + /// headers during the job's initialisation. Allowing us to work around + /// ATR-21753 / ROOT-10940. + /// + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class ROOTHeaderLoaderSvc : public extends< AthService, + IROOTHeaderLoaderSvc > { + + public: + // Inherit the base class's constructor(s). + using extends::extends; + + /// Function initialising the service + virtual StatusCode initialize() override; + + /// @name Implementation of the @c xAODMaker::IEventFormatSvc interface + /// @{ + + /// (Force-)Load one particular header + virtual StatusCode + loadHeader( const std::string& headerName ) const override; + + /// @} + + private: + /// Names of the headers to auto-load during initialisation + Gaudi::Property< std::vector< std::string > > m_headerNames{ this, + "HeaderNames", {}, + "Names of the headers to auto-load during initialisation" }; + + }; // class ROOTHeaderLoaderSvc + +} // namespace xAODMaker + +#endif // XAODCORECNV_ROOTHEADERLOADERSVC_H diff --git a/Event/xAOD/xAODCoreCnv/src/components/xAODCoreCnv_entries.cxx b/Event/xAOD/xAODCoreCnv/src/components/xAODCoreCnv_entries.cxx index 372f2e6a2a9c9c37d27401ed7bfeca55810958ae..b9c62416b7f8bd5df0d1292028f723f7a7fc946e 100644 --- a/Event/xAOD/xAODCoreCnv/src/components/xAODCoreCnv_entries.cxx +++ b/Event/xAOD/xAODCoreCnv/src/components/xAODCoreCnv_entries.cxx @@ -1,6 +1,11 @@ +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// + #include "../AuxStoreWrapper.h" #include "../ElementLinkResetAlg.h" +#include "../ROOTHeaderLoaderSvc.h" DECLARE_COMPONENT( xAODMaker::AuxStoreWrapper ) DECLARE_COMPONENT( xAODMaker::ElementLinkResetAlg ) - +DECLARE_COMPONENT( xAODMaker::ROOTHeaderLoaderSvc ) diff --git a/Event/xAOD/xAODCoreCnv/xAODCoreCnv/IROOTHeaderLoaderSvc.h b/Event/xAOD/xAODCoreCnv/xAODCoreCnv/IROOTHeaderLoaderSvc.h new file mode 100644 index 0000000000000000000000000000000000000000..a9846bc315d345d14167f9ba6ce8f1fd1eb681c0 --- /dev/null +++ b/Event/xAOD/xAODCoreCnv/xAODCoreCnv/IROOTHeaderLoaderSvc.h @@ -0,0 +1,34 @@ +// Dear emacs, this is -*- c++ -*- +// +// Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration +// +#ifndef XAODCORECNV_IROOTHEADERLOADERSVC_H +#define XAODCORECNV_IROOTHEADERLOADERSVC_H + +// Framework include(s). +#include "GaudiKernel/IService.h" +#include "GaudiKernel/StatusCode.h" + +namespace xAODMaker { + + /// Interface to a helper service used for force-loading headers into ROOT + /// + /// This interface may never actually be used by anyone, but I didn't want + /// to introduce a service that would not have any interface whatsoever... + /// + /// @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> + /// + class IROOTHeaderLoaderSvc : public virtual IService { + + public: + /// Declare an interface ID for the class + DeclareInterfaceID( xAODMaker::IROOTHeaderLoaderSvc, 1, 0 ); + + /// (Force-)Load one particular header + virtual StatusCode loadHeader( const std::string& headerName ) const = 0; + + }; // class IROOTHeaderLoaderSvc + +} // namespace xAODMaker + +#endif // XAODCORECNV_IROOTHEADERLOADERSVC_H diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py b/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py index 1478eb45848f6df0ba64b2fb74c0582fab9bb515..dbcd0275982f8d342a28660db28c63eec7533398 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/decodeBS.py @@ -76,3 +76,15 @@ if len(ItemList) == 0: ItemList += [ 'xAOD::TrigCompositeAuxContainer#*' ] StreamESD.ItemList = list(set(ItemList)) outSequence += StreamESD + +# Set up a temporary workaround for ROOT-10940 / ATR-21753. +from AthenaCommon.AppMgr import theApp, ServiceMgr as svcMgr +from xAODCoreCnv.xAODCoreCnvConf import xAODMaker__ROOTHeaderLoaderSvc +svcMgr += xAODMaker__ROOTHeaderLoaderSvc( 'ROOTHeaderLoaderSvc', + HeaderNames = [ 'xAODEgamma/PhotonContainer.h', + 'xAODTrigEgamma/TrigPhotonContainer.h', + 'xAODMuon/MuonContainer.h', + 'xAODTrigMuon/L2StandAloneMuonContainer.h', + 'xAODJet/JetContainer.h', + 'xAODTau/TauJetContainer.h' ] ) +theApp.CreateSvc += [ 'xAODMaker::ROOTHeaderLoaderSvc/ROOTHeaderLoaderSvc' ] diff --git a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py index 8d4cc9c5028a88da83b6224973ac74526c931275..90c6ec6935797664d56cb5a1d7a0d865d07255f7 100644 --- a/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py +++ b/Trigger/TriggerCommon/TriggerJobOpts/share/runHLT_standalone.py @@ -83,7 +83,7 @@ for option in defaultOptions: if option in globals(): setattr(opt, option, globals()[option]) print(' %20s = %s' % (option, getattr(opt, option))) - else: + else: print(' %20s = (Default) %s' % (option, getattr(opt, option))) @@ -194,7 +194,7 @@ ConfigFlags.Trigger.enableL1CaloLegacy = opt.enableL1CaloLegacy # To turn off HLT for athena running TriggerFlags.doHLT = bool(opt.doHLT) - + # To extract the Trigger configuration TriggerFlags.Online.doDBConfig = bool(opt.doDBConfig) if opt.trigBase is not None: @@ -247,7 +247,7 @@ TriggerFlags.doCalo = opt.doCalo modifierList=[] from TrigConfigSvc.TrigConfMetaData import TrigConfMetaData meta = TrigConfMetaData() - + for mod in dir(TriggerJobOpts.Modifiers): if not hasattr(getattr(TriggerJobOpts.Modifiers,mod),'preSetup'): continue @@ -361,7 +361,7 @@ else: topSequence.SGInputLoader.Load += [( 'xAOD::EventInfo' , 'StoreGateSvc+EventInfo' )] # ---------------------------------------------------------------- -# Detector geometry +# Detector geometry # ---------------------------------------------------------------- # Always enable AtlasFieldSvc from AthenaCommon.DetFlags import DetFlags @@ -407,12 +407,12 @@ if globalflags.InputFormat.is_pool(): import AthenaPoolCnvSvc.ReadAthenaPool # noqa svcMgr.AthenaPoolCnvSvc.PoolAttributes = [ "DEFAULT_BUFFERSIZE = '2048'" ] svcMgr.PoolSvc.AttemptCatalogPatch=True - # enable transient BS + # enable transient BS if TriggerFlags.doTransientByteStream(): log.info("setting up transient BS") include( "TriggerJobOpts/jobOfragment_TransBS_standalone.py" ) - - + + # ---------------------------------------------------------------- # ByteStream input # ---------------------------------------------------------------- @@ -425,6 +425,17 @@ elif globalflags.InputFormat.is_bytestream() and not ConfigFlags.Trigger.Online. from ByteStreamCnvSvc.ByteStreamConfig import ByteStreamReadCfg CAtoGlobalWrapper(ByteStreamReadCfg, ConfigFlags) +# Set up a temporary workaround for ROOT-10940 / ATR-21753. +from xAODCoreCnv.xAODCoreCnvConf import xAODMaker__ROOTHeaderLoaderSvc +svcMgr += xAODMaker__ROOTHeaderLoaderSvc( 'ROOTHeaderLoaderSvc', + HeaderNames = [ 'xAODEgamma/PhotonContainer.h', + 'xAODTrigEgamma/TrigPhotonContainer.h', + 'xAODMuon/MuonContainer.h', + 'xAODTrigMuon/L2StandAloneMuonContainer.h', + 'xAODJet/JetContainer.h', + 'xAODTau/TauJetContainer.h' ] ) +theApp.CreateSvc += [ 'xAODMaker::ROOTHeaderLoaderSvc/ROOTHeaderLoaderSvc' ] + # --------------------------------------------------------------- # Trigger config # --------------------------------------------------------------- @@ -503,7 +514,7 @@ if not opt.createHLTMenuExternally: if (opt.selectChains): menu.selectChainsForTesting = opt.selectChains - # generating the HLT structure requires + # generating the HLT structure requires # the L1Decoder to be defined in the topSequence menu.generateMT() @@ -544,7 +555,7 @@ if hasattr(svcMgr.THistSvc, "Output"): #------------------------------------------------------------- # Conditions overrides -#------------------------------------------------------------- +#------------------------------------------------------------- if len(opt.condOverride)>0: for folder,tag in opt.condOverride.iteritems(): log.warning('Overriding folder %s with tag %s', folder, tag)