From 0db194a1b0667ad2fe2a64959a3aa3a2b00a196c Mon Sep 17 00:00:00 2001 From: Rafal Bielski <rafal.bielski@cern.ch> Date: Wed, 22 Apr 2020 00:11:40 +0200 Subject: [PATCH] ResultBuilder: Create legacy EventInfo from xAOD::EventInfo if it doesn't exist --- Trigger/TrigSteer/TrigSteering/CMakeLists.txt | 2 +- .../TrigSteering/src/ResultBuilder.cxx | 35 +++++++++++++------ 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/Trigger/TrigSteer/TrigSteering/CMakeLists.txt b/Trigger/TrigSteer/TrigSteering/CMakeLists.txt index 6ecf729df5d1..73a50b5d879c 100644 --- a/Trigger/TrigSteer/TrigSteering/CMakeLists.txt +++ b/Trigger/TrigSteer/TrigSteering/CMakeLists.txt @@ -15,7 +15,7 @@ atlas_add_library( TrigSteeringLib PUBLIC_HEADERS TrigSteering PRIVATE_INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${TDAQ-COMMON_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS} - LINK_LIBRARIES AthContainers AthenaBaseComps AthenaKernel AthenaMonitoringLib ByteStreamCnvSvcBaseLib EventInfo GaudiKernel L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigConfBase TrigConfHLTData TrigConfInterfaces TrigNavigationLib TrigSteeringEvent TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib xAODEventInfo TrigInterfacesLib + LINK_LIBRARIES AthContainers AthenaBaseComps AthenaKernel AthenaMonitoringLib ByteStreamCnvSvcBaseLib EventInfo EventInfoUtils GaudiKernel L1TopoAlgorithms L1TopoCoreSim L1TopoEvent L1TopoSimulationLib TrigConfBase TrigConfHLTData TrigConfInterfaces TrigNavigationLib TrigSteeringEvent TrigT1CaloEventLib TrigT1CaloToolInterfaces TrigT1Result TrigTimeAlgsLib xAODEventInfo TrigInterfacesLib PRIVATE_LINK_LIBRARIES ${Boost_LIBRARIES} ${CLHEP_LIBRARIES} ${ROOT_LIBRARIES} ${TDAQ-COMMON_LIBRARIES} AthenaMonitoringKernelLib L1TopoCommon L1TopoConfig TrigConfL1Data TrigMonitorBaseLib TrigSerializeResultLib TrigStorageDefinitions TrigT1Interfaces xAODTrigger ) atlas_add_component( TrigSteering diff --git a/Trigger/TrigSteer/TrigSteering/src/ResultBuilder.cxx b/Trigger/TrigSteer/TrigSteering/src/ResultBuilder.cxx index 67341734852d..271bcbba331a 100755 --- a/Trigger/TrigSteer/TrigSteering/src/ResultBuilder.cxx +++ b/Trigger/TrigSteer/TrigSteering/src/ResultBuilder.cxx @@ -13,6 +13,7 @@ #include "TrigSteeringEvent/PartialEventBuildingInfo.h" #include "TrigConfHLTData/HLTTriggerType.h" #include "EventInfo/EventInfo.h" +#include "EventInfoUtils/EventInfoFromxAOD.h" #include "TrigSteeringEvent/ScoutingInfo.h" #include "eformat/SourceIdentifier.h" @@ -511,16 +512,38 @@ ErrorCode ResultBuilder::fillTriggerInfo(const std::vector<SteeringChain*>& acti // recording //////////////////////////////////////////////////////////////////// + // Retrieve xAOD::EventInfo + const xAOD::EventInfo* constxEventInfo(0); + if (evtStore()->retrieve(constxEventInfo).isFailure()) { + ATH_MSG_FATAL("Can't get xAOD::EventInfo object"); + return HLT::FATAL; + } + + // Create old EventInfo if not present in the event store + StatusCode sc = StatusCode::SUCCESS; + if (!evtStore()->contains<EventInfo>("EventInfo")) { + sc = evtStore()->record<EventInfo>( + std::make_unique<EventInfo>( + new EventID(eventIDFromxAOD(constxEventInfo)), + new EventType(eventTypeFromxAOD(constxEventInfo)) + ), "EventInfo" + ); + if (sc.isFailure()) { + ATH_MSG_FATAL("Can't record EventInfo created from xAOD::EventInfo"); + return HLT::FATAL; + } + ATH_MSG_DEBUG("Recorded EventInfo created from xAOD::EventInfo"); + } // put it all to SG EventInfo object // get EventInfo const EventInfo* constEventInfo(0); - StatusCode sc = evtStore()->retrieve(constEventInfo); + sc = evtStore()->retrieve(constEventInfo); if(sc.isFailure()){ ATH_MSG_FATAL("Can't get EventInfo object for update of the StreamTag and TriggerInfo"); return HLT::FATAL; } - + ATH_MSG_DEBUG("Retrieved EventInfo for updating with EventID " << *(constEventInfo->event_ID())); ATH_MSG_VERBOSE("Updating TriggerInfo"); EventInfo* eventInfo = const_cast<EventInfo*>(constEventInfo); @@ -603,14 +626,6 @@ ErrorCode ResultBuilder::fillTriggerInfo(const std::vector<SteeringChain*>& acti //// Recording in xAODEventInfo //////////////////////////////// // put it all to SG xAOD::EventInfo object - - const xAOD::EventInfo* constxEventInfo(0); - sc = evtStore()->retrieve(constxEventInfo); - - if (sc.isFailure()) { - ATH_MSG_FATAL("Can't get xAOD::EventInfo object for update of the StreamTag"); - return HLT::FATAL; - } #if 0 -- GitLab