From 5112686d9723a5d0563c14d3a520719522e874a2 Mon Sep 17 00:00:00 2001 From: Charles Leggett <charles.g.leggett@gmail.com> Date: Mon, 23 Jan 2017 22:00:14 +0100 Subject: [PATCH] make EventInfoCnvTool::convert(...) const, initialize static maps (xAODEventInfoCnv-00-00-26) * make EventInfoCnvTool::convert(...) const, make the static flag maps const, file-scope * tag xAODEventInfoCnv-00-00-26 M src/EventInfoCnvTool.cxx M src/EventInfoCnvTool.h Former-commit-id: bc0085e37f3e4159cd85150ee90477722c9a8a3e --- .../xAODEventInfoCnv/src/EventInfoCnvTool.cxx | 48 +++++++++---------- .../xAODEventInfoCnv/src/EventInfoCnvTool.h | 8 ++-- 2 files changed, 27 insertions(+), 29 deletions(-) diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.cxx index dfa160d5a7a..1af754b18bc 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 727101 2016-03-01 15:56:08Z krasznaa $ +// $Id: EventInfoCnvTool.cxx 793565 2017-01-23 22:00:14Z leggett $ // Gaudi/Athena include(s): #include "AthenaKernel/errorcheck.h" @@ -23,6 +23,27 @@ namespace xAODMaker { + // maps to copy the flags + static const std::map< xAOD::EventInfo::EventFlagSubDet, + EventInfo::EventFlagSubDet > subDetMap = + { {xAOD::EventInfo::Pixel, EventInfo::Pixel}, + {xAOD::EventInfo::SCT, EventInfo::SCT}, + {xAOD::EventInfo::TRT, EventInfo::TRT}, + {xAOD::EventInfo::LAr, EventInfo::LAr}, + {xAOD::EventInfo::Tile, EventInfo::Tile}, + {xAOD::EventInfo::Muon, EventInfo::Muon}, + {xAOD::EventInfo::ForwardDet, EventInfo::ForwardDet}, + {xAOD::EventInfo::Core, EventInfo::Core}, + {xAOD::EventInfo::Background, EventInfo::Background}, + {xAOD::EventInfo::Lumi, EventInfo::Lumi} }; + + static const std::map< EventInfo::EventFlagErrorState, + xAOD::EventInfo::EventFlagErrorState > errorStateMap = + { { EventInfo::NotSet, xAOD::EventInfo::NotSet }, + { EventInfo::Warning, xAOD::EventInfo::Warning }, + { EventInfo::Error, xAOD::EventInfo::Error} + }; + /// Hard-coded location of the beam position information static const std::string INDET_BEAMPOS = "/Indet/Beampos"; @@ -113,7 +134,7 @@ namespace xAODMaker { StatusCode EventInfoCnvTool::convert( const EventInfo* aod, xAOD::EventInfo* xaod, bool pileUpInfo, - bool copyPileUpLinks ) { + bool copyPileUpLinks ) const { if( ! aod ) { ATH_MSG_WARNING( "Null pointer received for input!" ); @@ -204,29 +225,6 @@ namespace xAODMaker { } } - // Construct the maps for the flag copying: - static std::map< xAOD::EventInfo::EventFlagSubDet, - EventInfo::EventFlagSubDet > subDetMap; - if( ! subDetMap.size() ) { - subDetMap[ xAOD::EventInfo::Pixel ] = EventInfo::Pixel; - subDetMap[ xAOD::EventInfo::SCT ] = EventInfo::SCT; - subDetMap[ xAOD::EventInfo::TRT ] = EventInfo::TRT; - subDetMap[ xAOD::EventInfo::LAr ] = EventInfo::LAr; - subDetMap[ xAOD::EventInfo::Tile ] = EventInfo::Tile; - subDetMap[ xAOD::EventInfo::Muon ] = EventInfo::Muon; - subDetMap[ xAOD::EventInfo::ForwardDet ] = EventInfo::ForwardDet; - subDetMap[ xAOD::EventInfo::Core ] = EventInfo::Core; - subDetMap[ xAOD::EventInfo::Background ] = EventInfo::Background; - subDetMap[ xAOD::EventInfo::Lumi ] = EventInfo::Lumi; - } - static std::map< EventInfo::EventFlagErrorState, - xAOD::EventInfo::EventFlagErrorState > errorStateMap; - if( ! errorStateMap.size() ) { - errorStateMap[ EventInfo::NotSet ] = xAOD::EventInfo::NotSet; - errorStateMap[ EventInfo::Warning ] = xAOD::EventInfo::Warning; - errorStateMap[ EventInfo::Error ] = xAOD::EventInfo::Error; - } - // Copy the sub-detector flags: std::map< xAOD::EventInfo::EventFlagSubDet, EventInfo::EventFlagSubDet >::const_iterator sd_itr = diff --git a/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h b/Event/xAOD/xAODEventInfoCnv/src/EventInfoCnvTool.h index 5d048af20b3..201eabe7e62 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 727531 2016-03-03 17:44:38Z krasznaa $ +// $Id: EventInfoCnvTool.h 793565 2017-01-23 22:00:14Z leggett $ #ifndef XAODEVENTINFOCNV_EVENTINFOCNVTOOL_H #define XAODEVENTINFOCNV_EVENTINFOCNVTOOL_H @@ -34,8 +34,8 @@ namespace xAODMaker { * * @author Attila Krasznahorkay <Attila.Krasznahorkay@cern.ch> * - * $Revision: 727531 $ - * $Date: 2016-03-03 18:44:38 +0100 (Thu, 03 Mar 2016) $ + * $Revision: 793565 $ + * $Date: 2017-01-23 23:00:14 +0100 (Mon, 23 Jan 2017) $ */ class EventInfoCnvTool : public AthAlgTool, public virtual IEventInfoCnvTool { @@ -52,7 +52,7 @@ namespace xAODMaker { virtual StatusCode convert( const EventInfo* aod, xAOD::EventInfo* xaod, bool pileUpInfo = false, - bool copyPileUpLinks = true ); + bool copyPileUpLinks = true ) const; private: #ifndef XAOD_ANALYSIS -- GitLab