diff --git a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx index 45a5ffa3c50c50c2dfb754d0df87415eff0b6391..648b819cc25f43378135568ea81dd082bf41fd3c 100644 --- a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx +++ b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.cxx @@ -5,11 +5,6 @@ #include "AthenaKernel/errorcheck.h" #include "AthLinks/ElementLink.h" -#define private public -# include "GeneratorObjects/McEventCollection.h" -#undef private -#include "GeneratorObjects/xAODTruthParticleLink.h" - #include "GaudiKernel/MsgStream.h" #include "GaudiKernel/DataSvc.h" #include "GaudiKernel/PhysicalConstants.h" @@ -46,14 +41,6 @@ namespace xAODMaker { xAODTruthCnvAlg::xAODTruthCnvAlg( const string& name, ISvcLocator* svcLoc ) : AthAlgorithm( name, svcLoc ), m_metaStore( "MetaDataStore", name ), m_inputMetaStore( "StoreGateSvc/InputMetaDataStore",name) { - declareProperty("AODContainerName", m_aodContainerKey="GEN_AOD" ); - declareProperty("xAODTruthEventContainerName", m_xaodTruthEventContainerKey="TruthEvents" ); - declareProperty("xAODTruthPileupEventContainerName", m_xaodTruthPUEventContainerKey="TruthPileupEvents" ); - /// @todo TruthParticle -> TruthParticles - declareProperty("xAODTruthParticleContainerName", m_xaodTruthParticleContainerKey="TruthParticles" ); - /// @todo TruthVertex -> TruthVertices - declareProperty("xAODTruthVertexContainerName", m_xaodTruthVertexContainerKey="TruthVertices" ); - declareProperty("TruthLinks", m_truthLinkContainerKey="xAODTruthLinks" ); declareProperty( "WriteAllPileUpTruth", m_doAllPileUp = false); declareProperty( "WriteInTimePileUpTruth", m_doInTimePileUp = false); declareProperty( "MetaObjectName", m_metaName = "TruthMetaData" ); @@ -96,7 +83,6 @@ namespace xAODMaker { ATH_CHECK(m_truthLinkContainerKey.initialize()); // if only redoing links - m_linksOnlyTruthEventContainerKey = m_xaodTruthEventContainerKey.key(); ATH_CHECK(m_linksOnlyTruthEventContainerKey.initialize(m_onlyRedoLinks)); // only if doing full truth diff --git a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h index 91564bdadb93accf0ec5b5f9cd7a3e094c835db0..9c5a1d1ef830e8ea8f87660e39821d98c644ae9a 100644 --- a/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h +++ b/Event/xAOD/xAODTruthCnv/src/xAODTruthCnvAlg.h @@ -7,6 +7,14 @@ #include "AthenaBaseComps/AthAlgorithm.h" +// The lines below I don't like. We should fix them when we update the +// the metadata to handles (ATLASRECTS-4162). +#define private public +# include "GeneratorObjects/McEventCollection.h" +#undef private + +#include "GeneratorObjects/xAODTruthParticleLink.h" + #include "xAODTruth/TruthEvent.h" #include "xAODTruth/TruthPileupEvent.h" #include "xAODTruth/TruthMetaDataContainer.h" @@ -25,9 +33,6 @@ namespace HepMC { class GenParticle; } -class McEventCollection; -class xAODTruthParticleLinkVector; - namespace xAODMaker { /// @brief Algorithm creating xAOD truth from HepMC @@ -67,17 +72,24 @@ namespace xAODMaker { static void fillParticle(xAOD::TruthParticle *tp, const HepMC::GenParticle *gp); /// The key of the input AOD truth container - SG::ReadHandleKey<McEventCollection> m_aodContainerKey; - + SG::ReadHandleKey<McEventCollection> m_aodContainerKey{ + this, "AODContainerName", "GEN_AOD", "The input McEvenCollection"}; + /// The key for the output xAOD truth containers - SG::WriteHandleKey<xAOD::TruthEventContainer> m_xaodTruthEventContainerKey; - SG::WriteHandleKey<xAOD::TruthPileupEventContainer> m_xaodTruthPUEventContainerKey; - SG::WriteHandleKey<xAOD::TruthParticleContainer> m_xaodTruthParticleContainerKey; - SG::WriteHandleKey<xAOD::TruthVertexContainer> m_xaodTruthVertexContainerKey; - SG::WriteHandleKey<xAODTruthParticleLinkVector> m_truthLinkContainerKey; - - // if only redoing links (uses same confuration as stadard TruthEvent) - SG::ReadHandleKey<xAOD::TruthEventContainer> m_linksOnlyTruthEventContainerKey; + SG::WriteHandleKey<xAOD::TruthEventContainer> m_xaodTruthEventContainerKey{ + this, "xAODTruthEventContainerName", "TruthEvents", "Output TruthEvents container"}; + SG::WriteHandleKey<xAOD::TruthPileupEventContainer> m_xaodTruthPUEventContainerKey{ + this, "xAODTruthPileupEventContainerName", "TruthPileupEvents", "Output TruthPileupEvents container"}; + SG::WriteHandleKey<xAOD::TruthParticleContainer> m_xaodTruthParticleContainerKey{ + this, "xAODTruthParticleContainerName", "TruthParticles", "Output TruthParticles container"}; + SG::WriteHandleKey<xAOD::TruthVertexContainer> m_xaodTruthVertexContainerKey{ + this, "xAODTruthVertexContainerName", "TruthVertices", "Output TruthVertices container"}; + SG::WriteHandleKey<xAODTruthParticleLinkVector> m_truthLinkContainerKey{ + this, "TruthLinks", "xAODTruthLinks", "Output xAODTruthLinks container"}; + + // if only redoing links + SG::ReadHandleKey<xAOD::TruthEventContainer> m_linksOnlyTruthEventContainerKey{ + this, "linksOnlyTruthEventContainerName", "TruthEvents", "Input TruthEvents container"}; /// Pile-up options bool m_doAllPileUp;