From 5f56c52f5ea42a58ac8c67045920a984373e33b1 Mon Sep 17 00:00:00 2001
From: Atlas-Software Librarian <Atlas-Software.Librarian@cern.ch>
Date: Fri, 8 Apr 2016 17:00:48 +0200
Subject: [PATCH] 'CMakeLists.txt' (xAODEventInfoCnv-00-00-22)

	* Moved the IEventInfoCnvTool.h header to xAODCnvInterfaces. The
	  header in this package now just forwards the call to that package,
	  while printing a warning.
	* Updated all the source files to use the interface from its new
	  location.
	* Tagging as xAODEventInfoCnv-00-00-22

2016-03-01 Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
	* Added an extra argument to IEventInfoCnvTool::convert, to allow
	  the caller to completely turn off the sub-event creation for the
	  output object. This was a request for the pileup simulation.
	* Tagging as xAODEventInfoCnv-00-00-21

2016-01-20 Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
	* Updated the converter code to create the xAOD::EventInfo::SubEvent
	  objects correctly. (Was missing the index parameter in the constructor
	  calls.)
	* Tagging as xAODEventInfoCnv-00-00-20

2015-07-13 Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
...
(Long ChangeLog diff - truncated)
---
 Event/xAOD/xAODEventInfoCnv/CMakeLists.txt    | 36 +++++++++
 Event/xAOD/xAODEventInfoCnv/cmt/requirements  | 15 ++--
 .../python/xAODEventInfoCreator.py            |  6 +-
 .../share/xAODEventInfoCnv_jobOptions.py      |  6 +-
 .../share/xAODEventInfoReader_jobOptions.py   |  4 +-
 .../xAODEventInfoCnv/src/EventInfoCnvAlg.cxx  | 77 +++++++++++++++----
 .../xAODEventInfoCnv/src/EventInfoCnvAlg.h    |  8 +-
 .../xAODEventInfoCnv/src/EventInfoCnvTool.cxx | 25 ++++--
 .../xAODEventInfoCnv/src/EventInfoCnvTool.h   | 23 ++++--
 .../src/EventInfoReaderAlg.cxx                | 21 ++++-
 .../xAODEventInfoCnv/IEventInfoCnvTool.h      | 48 ++----------
 11 files changed, 182 insertions(+), 87 deletions(-)
 create mode 100644 Event/xAOD/xAODEventInfoCnv/CMakeLists.txt

diff --git a/Event/xAOD/xAODEventInfoCnv/CMakeLists.txt b/Event/xAOD/xAODEventInfoCnv/CMakeLists.txt
new file mode 100644
index 00000000000..cbd0339bace
--- /dev/null
+++ b/Event/xAOD/xAODEventInfoCnv/CMakeLists.txt
@@ -0,0 +1,36 @@
+################################################################################
+# Package: xAODEventInfoCnv
+################################################################################
+
+# Declare the package name:
+atlas_subdir( xAODEventInfoCnv )
+
+# Declare the package's dependencies:
+atlas_depends_on_subdirs( PUBLIC
+                          Event/xAOD/xAODCnvInterfaces
+                          InnerDetector/InDetConditions/InDetBeamSpotService
+                          LumiBlock/LumiBlockComps
+                          PRIVATE
+                          Control/AthenaBaseComps
+                          Control/AthenaKernel
+                          Database/AthenaPOOL/AthenaPoolUtilities
+                          Event/EventInfo
+                          Event/xAOD/xAODEventInfo
+                          GaudiKernel )
+
+# External dependencies:
+find_package( CLHEP )
+find_package( Eigen )
+
+# Component(s) in the package:
+atlas_add_component( xAODEventInfoCnv
+                     src/*.cxx
+                     src/components/*.cxx
+                     INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
+                     LINK_LIBRARIES ${EIGEN_LIBRARIES} ${CLHEP_LIBRARIES} xAODCnvInterfaces LumiBlockCompsLib AthenaBaseComps AthenaKernel AthenaPoolUtilities EventInfo xAODEventInfo GaudiKernel )
+
+# Install files from the package:
+atlas_install_headers( xAODEventInfoCnv )
+atlas_install_python_modules( python/*.py )
+atlas_install_joboptions( share/*.py )
+
diff --git a/Event/xAOD/xAODEventInfoCnv/cmt/requirements b/Event/xAOD/xAODEventInfoCnv/cmt/requirements
index 9a739268639..2e9c84682c0 100644
--- a/Event/xAOD/xAODEventInfoCnv/cmt/requirements
+++ b/Event/xAOD/xAODEventInfoCnv/cmt/requirements
@@ -1,24 +1,29 @@
 package xAODEventInfoCnv
-# $Id: requirements 670837 2015-05-29 10:17:08Z krasznaa $
+# $Id: requirements 727531 2016-03-03 17:44:38Z krasznaa $
 
 author Attila Krasznahorkay
 
 public
 
 use AtlasPolicy          AtlasPolicy-*
-use GaudiInterface       GaudiInterface-*       External
 
-use xAODEventInfo        xAODEventInfo-*        Event/xAOD
+use xAODCnvInterfaces    xAODCnvInterfaces-*    Event/xAOD
 
 private
 
+use GaudiInterface       GaudiInterface-*       External
+
 use AthenaBaseComps      AthenaBaseComps-*      Control
 use AthenaKernel         AthenaKernel-*         Control
 
 use AthenaPoolUtilities  AthenaPoolUtilities-*  Database/AthenaPOOL
-use InDetBeamSpotService InDetBeamSpotService-* InnerDetector/InDetConditions
-use LumiBlockComps       LumiBlockComps-*       LumiBlock
 
+#use InDetBeamSpotService InDetBeamSpotService-* InnerDetector/InDetConditions
+use_ifndef pplist="XAOD_ANALYSIS" pkg="InnerDetector/InDetConditions/InDetBeamSpotService"
+#use LumiBlockComps       LumiBlockComps-*       LumiBlock
+use_ifndef pplist="XAOD_ANALYSIS" pkg="LumiBlock/LumiBlockComps"
+
+use xAODEventInfo        xAODEventInfo-*        Event/xAOD
 use EventInfo            EventInfo-*            Event
 
 end_private
diff --git a/Event/xAOD/xAODEventInfoCnv/python/xAODEventInfoCreator.py b/Event/xAOD/xAODEventInfoCnv/python/xAODEventInfoCreator.py
index aa7cf2e7548..17488c5769e 100644
--- a/Event/xAOD/xAODEventInfoCnv/python/xAODEventInfoCreator.py
+++ b/Event/xAOD/xAODEventInfoCnv/python/xAODEventInfoCreator.py
@@ -1,12 +1,13 @@
 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 
-# $Id: xAODEventInfoCreator.py 634394 2014-12-08 11:10:34Z krasznaa $
+# $Id: xAODEventInfoCreator.py 682548 2015-07-13 13:57:15Z krasznaa $
 
 # Import the configurable(s):
 from xAODEventInfoCnv.xAODEventInfoCnvConf import *
 
 ## Helper function for creating xAOD::EventInfo
-def xAODEventInfoCreator( sequence = None, stream = None, key = "" ):
+def xAODEventInfoCreator( sequence = None, stream = None, key = "",
+                          outkey = "EventInfo" ):
     """
     Helper function that schedules the algorithm for creating an xAOD::EventInfo
     object out of the AOD's EventInfo one.
@@ -41,7 +42,6 @@ def xAODEventInfoCreator( sequence = None, stream = None, key = "" ):
         pass
 
     # Add the converter algorithm:
-    outkey = "EventInfo"
     alg = xAODMaker__EventInfoCnvAlg()
     alg.AODKey = key
     alg.xAODKey = outkey
diff --git a/Event/xAOD/xAODEventInfoCnv/share/xAODEventInfoCnv_jobOptions.py b/Event/xAOD/xAODEventInfoCnv/share/xAODEventInfoCnv_jobOptions.py
index adfd27fb7d6..e89107e6d53 100644
--- a/Event/xAOD/xAODEventInfoCnv/share/xAODEventInfoCnv_jobOptions.py
+++ b/Event/xAOD/xAODEventInfoCnv/share/xAODEventInfoCnv_jobOptions.py
@@ -1,4 +1,4 @@
-# $Id: xAODEventInfoCnv_jobOptions.py 631751 2014-11-28 09:59:20Z krasznaa $
+# $Id: xAODEventInfoCnv_jobOptions.py 682548 2015-07-13 13:57:15Z krasznaa $
 
 # Set up the reading of a file:
 FNAME = "AOD.pool.root"
@@ -15,13 +15,13 @@ xaodStream = MSMgr.NewPoolRootStream( "StreamXAOD", "xAOD.pool.root" )
 
 # Create the xAOD EventInfo object:
 from xAODEventInfoCnv.xAODEventInfoCreator import xAODEventInfoCreator
-xAODEventInfoCreator()
+xAODEventInfoCreator( outkey = "EventInfoTest" )
 
 # Check what happened to the stream:
 xaodStream.Print()
 
 # Do some additional tweaking:
 from AthenaCommon.AppMgr import theApp
-theApp.EvtMax = -1
+theApp.EvtMax = 10
 ServiceMgr.MessageSvc.OutputLevel = INFO
 ServiceMgr.MessageSvc.defaultLimit = 1000000
diff --git a/Event/xAOD/xAODEventInfoCnv/share/xAODEventInfoReader_jobOptions.py b/Event/xAOD/xAODEventInfoCnv/share/xAODEventInfoReader_jobOptions.py
index 3a2dff7d812..256e9a96d7c 100644
--- a/Event/xAOD/xAODEventInfoCnv/share/xAODEventInfoReader_jobOptions.py
+++ b/Event/xAOD/xAODEventInfoCnv/share/xAODEventInfoReader_jobOptions.py
@@ -1,4 +1,4 @@
-# $Id: xAODEventInfoReader_jobOptions.py 592116 2014-04-09 12:04:38Z krasznaa $
+# $Id: xAODEventInfoReader_jobOptions.py 682548 2015-07-13 13:57:15Z krasznaa $
 
 # Set up the reading of a file:
 FNAME = "xAOD.pool.root"
@@ -11,7 +11,7 @@ theJob = AlgSequence()
 
 # Add the EventInfo reader algorithm:
 from xAODEventInfoCnv.xAODEventInfoCnvConf import xAODReader__EventInfoReaderAlg
-alg = xAODReader__EventInfoReaderAlg()
+alg = xAODReader__EventInfoReaderAlg( SGKey = "EventInfoTest" )
 alg.OutputLevel = 2
 theJob += alg
 
diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.cxx b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.cxx
index e2951454675..fe14e8ba247 100644
--- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.cxx
+++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.cxx
@@ -2,7 +2,10 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: EventInfoCnvAlg.cxx 644234 2015-02-04 17:24:51Z leggett $
+// $Id: EventInfoCnvAlg.cxx 727101 2016-03-01 15:56:08Z krasznaa $
+
+// System include(s):
+#include <memory>
 
 // Gaudi/Athena include(s):
 #include "AthenaKernel/errorcheck.h"
@@ -62,16 +65,20 @@ namespace xAODMaker {
       }
 
       // Create the xAOD object(s):
-      xAOD::EventAuxInfo* aux = new xAOD::EventAuxInfo();
-      xAOD::EventInfo* xaod = new xAOD::EventInfo();
-      xaod->setStore( aux );
+      std::unique_ptr< xAOD::EventAuxInfo > aux( new xAOD::EventAuxInfo() );
+      std::unique_ptr< xAOD::EventInfo > xaod( new xAOD::EventInfo() );
+      xaod->setStore( aux.get() );
 
       // Do the translation:
-      CHECK( m_cnvTool->convert( aod, xaod ) );
+      CHECK( m_cnvTool->convert( aod, xaod.get() ) );
+
+      // Before the record, keep a pointer to the EventInfo object, to be able
+      // to add ElementLinks to it afterwards.
+      xAOD::EventInfo* ei = xaod.get();
 
       // Record the xAOD object(s):
-      CHECK( evtStore()->record( aux, m_xaodKey + "Aux." ) );
-      CHECK( evtStore()->record( xaod, m_xaodKey ) );
+      CHECK( evtStore()->record( std::move( aux ), m_xaodKey + "Aux." ) );
+      CHECK( evtStore()->record( std::move( xaod ), m_xaodKey ) );
 
       // Check if this is a PileUpEventInfo object:
       const PileUpEventInfo* paod =
@@ -82,9 +89,34 @@ namespace xAODMaker {
       }
 
       // Create an EventInfoContainer for the pileup events:
-      xAOD::EventInfoContainer* puei = new xAOD::EventInfoContainer();
-      xAOD::EventInfoAuxContainer* puaux = new xAOD::EventInfoAuxContainer();
-      puei->setStore( puaux );
+      std::unique_ptr< xAOD::EventInfoContainer >
+         puei( new xAOD::EventInfoContainer() );
+      std::unique_ptr< xAOD::EventInfoAuxContainer >
+         puaux( new xAOD::EventInfoAuxContainer() );
+      puei->setStore( puaux.get() );
+
+      // Sub-events for the main EventInfo object:
+      std::vector< xAOD::EventInfo::SubEvent > subEvents;
+
+      // A map translating between the AOD and xAOD pileup event types:
+      static std::map< PileUpEventInfo::SubEvent::pileup_type,
+                       xAOD::EventInfo::PileUpType > pileupTypeMap;
+      if( ! pileupTypeMap.size() ) {
+#define DECLARE_SE_TYPE( TYPE )                                         \
+         pileupTypeMap[ PileUpTimeEventIndex::TYPE ] = xAOD::EventInfo::TYPE
+
+         DECLARE_SE_TYPE( Unknown );
+         DECLARE_SE_TYPE( Signal );
+         DECLARE_SE_TYPE( MinimumBias );
+         DECLARE_SE_TYPE( Cavern );
+         DECLARE_SE_TYPE( HaloGas );
+         DECLARE_SE_TYPE( ZeroBias );
+
+#undef DECLARE_SE_TYPE
+      }
+
+      // A convenience type declaration:
+      typedef ElementLink< xAOD::EventInfoContainer > EiLink;
 
       // Create xAOD::EventInfo objects for each pileup EventInfo object:
       PileUpEventInfo::SubEvent::const_iterator pu_itr = paod->beginSubEvt();
@@ -94,12 +126,31 @@ namespace xAODMaker {
          xAOD::EventInfo* ei = new xAOD::EventInfo();
          puei->push_back( ei );
          // Fill it with information:
-         CHECK( m_cnvTool->convert( pu_itr->pSubEvt, ei, true ) );
+         CHECK( m_cnvTool->convert( pu_itr->pSubEvt, ei, true, false ) );
+         // And now add a sub-event to the temporary list:
+         auto typeItr = pileupTypeMap.find( pu_itr->type() );
+         xAOD::EventInfo::PileUpType type = xAOD::EventInfo::Unknown;
+         if( typeItr == pileupTypeMap.end() ) {
+            ATH_MSG_WARNING( "PileUpType not recognised: " << pu_itr->type() );
+         } else {
+            type = typeItr->second;
+         }
+         subEvents.push_back( xAOD::EventInfo::SubEvent( pu_itr->time(),
+                                                         pu_itr->index(),
+                                                         type,
+                                                         EiLink( "PileUp" +
+                                                                 m_xaodKey,
+                                                                 puei->size() -
+                                                                 1 ) ) );
       }
 
+      // And now update the main EventInfo object with the sub-events:
+      ei->setSubEvents( subEvents );
+
       // Record the xAOD object(s):
-      CHECK( evtStore()->record( puaux, "PileUp" + m_xaodKey + "Aux." ) );
-      CHECK( evtStore()->record( puei, "PileUp" + m_xaodKey ) );
+      CHECK( evtStore()->record( std::move( puaux ),
+                                 "PileUp" + m_xaodKey + "Aux." ) );
+      CHECK( evtStore()->record( std::move( puei ), "PileUp" + m_xaodKey ) );
 
       // Return gracefully:
       return StatusCode::SUCCESS;
diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.h b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.h
index 8820094c6f0..86a320af551 100644
--- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.h
+++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvAlg.h
@@ -4,7 +4,7 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: EventInfoCnvAlg.h 634394 2014-12-08 11:10:34Z krasznaa $
+// $Id: EventInfoCnvAlg.h 727531 2016-03-03 17:44:38Z krasznaa $
 #ifndef XAODEVENTINFOCNV_EVENTINFOCNVALG_H
 #define XAODEVENTINFOCNV_EVENTINFOCNVALG_H
 
@@ -16,7 +16,7 @@
 #include "GaudiKernel/ToolHandle.h"
 
 // Local include(s):
-#include "xAODEventInfoCnv/IEventInfoCnvTool.h"
+#include "xAODCnvInterfaces/IEventInfoCnvTool.h"
 
 namespace xAODMaker {
 
@@ -28,8 +28,8 @@ namespace xAODMaker {
     *
     * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
     *
-    * $Revision: 634394 $
-    * $Date: 2014-12-08 12:10:34 +0100 (Mon, 08 Dec 2014) $
+    * $Revision: 727531 $
+    * $Date: 2016-03-03 18:44:38 +0100 (Thu, 03 Mar 2016) $
     */
    class EventInfoCnvAlg : public AthAlgorithm {
 
diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx
index e28d0ac57b4..dfa160d5a7a 100644
--- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx
+++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: EventInfoCnvTool.cxx 670837 2015-05-29 10:17:08Z krasznaa $
+// $Id: EventInfoCnvTool.cxx 727101 2016-03-01 15:56:08Z krasznaa $
 
 // Gaudi/Athena include(s):
 #include "AthenaKernel/errorcheck.h"
@@ -36,17 +36,20 @@ namespace xAODMaker {
                                        const std::string& name,
                                        const IInterface* parent )
       : AthAlgTool( type, name, parent ),
+#ifndef XAOD_ANALYSIS
         m_beamCondSvc( "BeamCondSvc", name ),
-        m_beamCondSvcAvailable( false ),
         m_lumiTool( "LuminosityTool" ),
+#endif
+        m_beamCondSvcAvailable( false ),
         m_lumiToolAvailable( false ) {
 
       // Declare the interface(s) provided by the tool:
       declareInterface< IEventInfoCnvTool >( this );
-
+#ifndef XAOD_ANALYSIS
       // Declare the tool's properties:
       declareProperty( "BeamCondSvc", m_beamCondSvc );
       declareProperty( "LuminosityTool", m_lumiTool );
+#endif
    }
 
    StatusCode EventInfoCnvTool::initialize() {
@@ -54,6 +57,7 @@ namespace xAODMaker {
       // Greet the user:
       ATH_MSG_INFO( "Initializing - Package version: " << PACKAGE_VERSION );
 
+#ifndef XAOD_ANALYSIS
       // Check if the beam position will be available or not:
       if( detStore()->contains< AthenaAttributeList >( INDET_BEAMPOS ) ) {
          m_beamCondSvcAvailable = true;
@@ -86,6 +90,10 @@ namespace xAODMaker {
       if( m_lumiToolAvailable ) {
          CHECK( m_lumiTool.retrieve() );
       }
+#else
+      //do nothing, lumi and beam conditions not available
+      
+#endif
 
       // Return gracefully:
       return StatusCode::SUCCESS;
@@ -98,12 +106,14 @@ namespace xAODMaker {
     * @param aod The AOD's EventInfo object
     * @param xaod The xAOD::EventInfo object to fill
     * @param pileUpInfo <code>true</code> for pile-up EventInfo objects
+    * @param copyPileUpLinks Allows to turn the ElementLink creation on or off
     * @returns <code>StatusCode::SUCCESS</code> if all went fine,
     *          something else if not
     */
    StatusCode EventInfoCnvTool::convert( const EventInfo* aod,
                                          xAOD::EventInfo* xaod,
-                                         bool pileUpInfo ) {
+                                         bool pileUpInfo,
+                                         bool copyPileUpLinks ) {
 
       if( ! aod ) {
          ATH_MSG_WARNING( "Null pointer received for input!" );
@@ -176,6 +186,7 @@ namespace xAODMaker {
       // Copy/calculate the pileup information:
       if( ! pileUpInfo ) {
          if( m_lumiToolAvailable ) {
+#ifndef XAOD_ANALYSIS
             float actualMu = 0.0;
             const float muToLumi = m_lumiTool->muToLumi();
             if( std::abs( muToLumi ) > 0.00001 ) {
@@ -184,6 +195,7 @@ namespace xAODMaker {
             xaod->setActualInteractionsPerCrossing( actualMu );
             xaod->setAverageInteractionsPerCrossing(
                m_lumiTool->lbAverageInteractionsPerCrossing() );
+#endif
          } else {
             xaod->setActualInteractionsPerCrossing(
                aod->actualInteractionsPerCrossing() );
@@ -250,7 +262,7 @@ namespace xAODMaker {
       // Check if it is a PileUpEventInfo object:
       const PileUpEventInfo* puei =
          dynamic_cast< const PileUpEventInfo* >( aod );
-      if( puei ) {
+      if( puei && copyPileUpLinks ) {
          // Construct the map for the SubEvent translation:
          static std::map< PileUpEventInfo::SubEvent::pileup_type,
                           xAOD::EventInfo::PileUpType > subTypeMap;
@@ -292,6 +304,7 @@ namespace xAODMaker {
 
             // Add the new object
             subEvents.push_back( xAOD::EventInfo::SubEvent( itr->time(),
+                                                            itr->index(),
                                                             type, link ) );
          }
 
@@ -299,6 +312,7 @@ namespace xAODMaker {
          xaod->setSubEvents( subEvents );
       }
 
+#ifndef XAOD_ANALYSIS
       // Fill the beam spot variables if the necessary service is available:
       if( m_beamCondSvcAvailable && ( ! pileUpInfo ) ) {
          xaod->setBeamPos( m_beamCondSvc->beamPos()[ Amg::x ],
@@ -312,6 +326,7 @@ namespace xAODMaker {
          xaod->setBeamTiltYZ( m_beamCondSvc->beamTilt( 1 ) );
          xaod->setBeamStatus( m_beamCondSvc->beamStatus() );
       }
+#endif
 
       // Finish with some printout:
       ATH_MSG_VERBOSE( "Finished conversion" << *xaod );
diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h
index 6b94f332571..5d048af20b3 100644
--- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h
+++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h
@@ -4,7 +4,7 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: EventInfoCnvTool.h 670837 2015-05-29 10:17:08Z krasznaa $
+// $Id: EventInfoCnvTool.h 727531 2016-03-03 17:44:38Z krasznaa $
 #ifndef XAODEVENTINFOCNV_EVENTINFOCNVTOOL_H
 #define XAODEVENTINFOCNV_EVENTINFOCNVTOOL_H
 
@@ -13,14 +13,16 @@
 #include "GaudiKernel/ServiceHandle.h"
 #include "GaudiKernel/ToolHandle.h"
 
+#ifndef XAOD_ANALYSIS
 // Beam condition include(s):
 #include "InDetBeamSpotService/IBeamCondSvc.h"
 
 // Luminosity include(s):
 #include "LumiBlockComps/ILuminosityTool.h"
+#endif
 
-// Local include(s):
-#include "xAODEventInfoCnv/IEventInfoCnvTool.h"
+// xAOD include(s):
+#include "xAODCnvInterfaces/IEventInfoCnvTool.h"
 
 namespace xAODMaker {
 
@@ -32,8 +34,8 @@ namespace xAODMaker {
     *
     * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
     *
-    * $Revision: 670837 $
-    * $Date: 2015-05-29 12:17:08 +0200 (Fri, 29 May 2015) $
+    * $Revision: 727531 $
+    * $Date: 2016-03-03 18:44:38 +0100 (Thu, 03 Mar 2016) $
     */
    class EventInfoCnvTool : public AthAlgTool,
                             public virtual IEventInfoCnvTool {
@@ -49,16 +51,21 @@ namespace xAODMaker {
       /// Function that fills an existing xAOD::EventInfo object with data
       virtual StatusCode convert( const EventInfo* aod,
                                   xAOD::EventInfo* xaod,
-                                  bool pileUpInfo = false );
+                                  bool pileUpInfo = false,
+                                  bool copyPileUpLinks = true );
 
    private:
+#ifndef XAOD_ANALYSIS
       /// Connection to the beam spot service
       ServiceHandle< IBeamCondSvc > m_beamCondSvc;
+      /// Connection to the luminosity tool
+      ToolHandle< ILuminosityTool > m_lumiTool;
+#endif
+
       /// Internal flag for the availability of the beam conditions service
       bool m_beamCondSvcAvailable;
 
-      /// Connection to the luminosity tool
-      ToolHandle< ILuminosityTool > m_lumiTool;
+      
       /// Internal flag for the availability of the luminosity tool
       bool m_lumiToolAvailable;
 
diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoReaderAlg.cxx b/Event/xAOD/xAODEventInfoCnv/src/EventInfoReaderAlg.cxx
index 37456c742fd..05c46cfee2a 100644
--- a/Event/xAOD/xAODEventInfoCnv/src/EventInfoReaderAlg.cxx
+++ b/Event/xAOD/xAODEventInfoCnv/src/EventInfoReaderAlg.cxx
@@ -2,7 +2,7 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: EventInfoReaderAlg.cxx 592116 2014-04-09 12:04:38Z krasznaa $
+// $Id: EventInfoReaderAlg.cxx 682548 2015-07-13 13:57:15Z krasznaa $
 
 // EDM include(s):
 #include "xAODEventInfo/EventInfo.h"
@@ -88,6 +88,25 @@ namespace xAODReader {
          ATH_MSG_DEBUG( "mcEventWeights = " << ei->mcEventWeights() );
       }
 
+      // Check if it has sub-events:
+      try {
+         const auto& subEvents = ei->subEvents();
+         int counter = 0;
+         for( const xAOD::EventInfo::SubEvent& se : subEvents ) {
+            ATH_MSG_DEBUG( "SubEvent #" << counter++ );
+            ATH_MSG_DEBUG( "   time = " << se.time() );
+            ATH_MSG_DEBUG( "   type = " << se.typeName() );
+            const xAOD::EventInfo* sei = se.ptr();
+            if( sei ) {
+               ATH_MSG_DEBUG( "   runNumber = " << sei->runNumber() );
+               ATH_MSG_DEBUG( "   eventNumber = " << sei->eventNumber() );
+               ATH_MSG_DEBUG( "   bcid = " << sei->bcid() );
+            }
+         }
+      } catch( const std::exception& ) {
+         // Nope, it doesn't...
+      }
+
       // Return gracefully:
       return StatusCode::SUCCESS;
    }
diff --git a/Event/xAOD/xAODEventInfoCnv/xAODEventInfoCnv/IEventInfoCnvTool.h b/Event/xAOD/xAODEventInfoCnv/xAODEventInfoCnv/IEventInfoCnvTool.h
index c2803d8f184..79fb8c0dd26 100644
--- a/Event/xAOD/xAODEventInfoCnv/xAODEventInfoCnv/IEventInfoCnvTool.h
+++ b/Event/xAOD/xAODEventInfoCnv/xAODEventInfoCnv/IEventInfoCnvTool.h
@@ -4,52 +4,14 @@
   Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
 */
 
-// $Id: IEventInfoCnvTool.h 594319 2014-04-25 17:39:50Z krasznaa $
+// $Id: IEventInfoCnvTool.h 727531 2016-03-03 17:44:38Z krasznaa $
 #ifndef XAODEVENTINFOCNV_IEVENTINFOCNVTOOL_H
 #define XAODEVENTINFOCNV_IEVENTINFOCNVTOOL_H
 
-// Gaudi/Athena include(s):
-#include "GaudiKernel/IAlgTool.h"
+// Warn the user that this header should not be used anymore:
+#warning "Please use header xAODCnvInterfaces/IEventInfoCnvTool.h instead"
 
-// xAOD include(s):
-#include "xAODEventInfo/EventInfo.h"
-
-// Forward declaration(s):
-class EventInfo;
-
-namespace xAODMaker {
-
-   /// The interface provided by IEventInfoCnvTool
-   static const InterfaceID
-   IID_IEventInfoCnvTool( "xAODMaker::IEventInfoCnvTool", 1, 0 );
-
-   /**
-    *  @short Interface for the tool creating xAOD::EventInfo from an AOD
-    *
-    *         This interface is implemented by the tool that converts the
-    *         EventInfo object from an existing POOL/BS file into
-    *         an xAOD::EventInfo object.
-    *
-    * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch>
-    *
-    * $Revision: 594319 $
-    * $Date: 2014-04-25 19:39:50 +0200 (Fri, 25 Apr 2014) $
-    */
-   class IEventInfoCnvTool : public virtual IAlgTool {
-
-   public:
-      /// Function that fills an existing xAOD::EventInfo object with data
-      virtual StatusCode convert( const EventInfo* aod,
-                                  xAOD::EventInfo* xaod,
-                                  bool pileUpInfo = false ) = 0;
-
-      /// Gaudi interface definition
-      static const InterfaceID& interfaceID() {
-         return IID_IEventInfoCnvTool;
-      }
-
-   }; // class IEventInfoCnvTool
-
-} // namespace xAODMaker
+// Include the real header:
+#include "xAODCnvInterfaces/IEventInfoCnvTool.h"
 
 #endif // XAODEVENTINFOCNV_IEVENTINFOCNVTOOL_H
-- 
GitLab