From 8b6da211eade1145ee90655d0647a061c7525bcf Mon Sep 17 00:00:00 2001
From: Gerhard Raven <gerhard.raven@nikhef.nl>
Date: Tue, 27 Oct 2020 10:15:20 +0100
Subject: [PATCH] Consolidate EventPacker components

* amalgamate component headers into their corresponding source files
* do not mention SmartRef<T> type when it is not neccessary
---
 .../component/ChargedProtoParticleMapper.cpp  |  81 ++++-
 .../component/ChargedProtoParticleMapper.h    |  98 ------
 .../src/component/ConversionDODMapper.cpp     | 138 +++++++-
 .../src/component/ConversionDODMapper.h       | 139 --------
 .../EventPacker/src/component/DumpTracks.cpp  |  33 +-
 Event/EventPacker/src/component/DumpTracks.h  |  43 ---
 .../src/component/PackCaloHypo.cpp            |  31 +-
 .../EventPacker/src/component/PackCaloHypo.h  |  43 ---
 .../EventPacker/src/component/PackCluster.cpp |  34 +-
 Event/EventPacker/src/component/PackCluster.h |  45 ---
 .../src/component/PackDecReport.cpp           |  33 +-
 .../EventPacker/src/component/PackDecReport.h |  41 ---
 .../src/component/PackMCParticle.cpp          |  28 +-
 .../src/component/PackMCParticle.h            |  39 ---
 .../src/component/PackMCVertex.cpp            |  30 +-
 .../EventPacker/src/component/PackMCVertex.h  |  39 ---
 .../component/PackParticlesAndVertices.cpp    | 296 ++++++++++++++++-
 .../src/component/PackParticlesAndVertices.h  | 302 ------------------
 .../src/component/PackProtoParticle.cpp       |  41 ++-
 .../src/component/PackProtoParticle.h         |  43 ---
 .../src/component/PackRecVertex.cpp           |  28 +-
 .../EventPacker/src/component/PackRecVertex.h |  41 ---
 .../src/component/PackSTCluster.cpp           |  30 +-
 .../EventPacker/src/component/PackSTCluster.h |  43 ---
 Event/EventPacker/src/component/PackTrack.cpp |  31 +-
 Event/EventPacker/src/component/PackTrack.h   |  44 ---
 .../src/component/PackTwoProngVertex.cpp      |  23 +-
 .../src/component/PackTwoProngVertex.h        |  38 ---
 .../src/component/PackUTCluster.cpp           |  30 +-
 .../EventPacker/src/component/PackUTCluster.h |  43 ---
 .../src/component/PackVeloCluster.cpp         |  31 +-
 .../src/component/PackVeloCluster.h           |  43 ---
 .../src/component/ReadPackedDst.cpp           |  87 ++++-
 .../EventPacker/src/component/ReadPackedDst.h |  85 -----
 .../src/component/TrackClustersMapper.cpp     |  76 ++++-
 .../src/component/TrackClustersMapper.h       |  84 -----
 .../src/component/UnpackCaloHypo.cpp          |  40 ++-
 .../src/component/UnpackCaloHypo.h            |  38 ---
 .../src/component/UnpackCluster.cpp           |  63 +++-
 .../EventPacker/src/component/UnpackCluster.h |  72 -----
 .../src/component/UnpackDecReport.cpp         |  32 +-
 .../src/component/UnpackDecReport.h           |  40 ---
 .../src/component/UnpackMCParticle.cpp        |  34 +-
 .../src/component/UnpackMCParticle.h          |  42 ---
 .../src/component/UnpackMCVertex.cpp          |  36 ++-
 .../src/component/UnpackMCVertex.h            |  42 ---
 .../component/UnpackParticlesAndVertices.cpp  | 257 ++++++++++++++-
 .../component/UnpackParticlesAndVertices.h    | 275 ----------------
 .../src/component/UnpackRecVertex.cpp         |  27 +-
 .../src/component/UnpackRecVertex.h           |  40 ---
 .../src/component/UnpackSTCluster.cpp         |  31 +-
 .../src/component/UnpackSTCluster.h           |  43 ---
 .../EventPacker/src/component/UnpackTrack.cpp |  39 ++-
 Event/EventPacker/src/component/UnpackTrack.h |  44 ---
 .../src/component/UnpackTrackFunctional.cpp   |  64 ++--
 .../src/component/UnpackTrackFunctional.h     |  41 ---
 .../src/component/UnpackTwoProngVertex.cpp    |  24 +-
 .../src/component/UnpackTwoProngVertex.h      |  38 ---
 .../src/component/UnpackUTCluster.cpp         |  27 +-
 .../src/component/UnpackUTCluster.h           |  43 ---
 .../src/component/UnpackVeloCluster.cpp       |  27 +-
 .../src/component/UnpackVeloCluster.h         |  43 ---
 .../src/component/WritePackedDst.h            |   0
 Event/EventPacker/src/lib/PackedCaloAdc.cpp   |   6 -
 .../EventPacker/src/lib/PackedCaloCluster.cpp |   6 -
 Event/EventPacker/src/lib/PackedCaloDigit.cpp |   6 -
 Event/EventPacker/src/lib/PackedCaloHypo.cpp  |  15 +-
 .../EventPacker/src/lib/PackedEventChecks.cpp |   4 +-
 .../EventPacker/src/lib/PackedFlavourTag.cpp  |  12 +-
 Event/EventPacker/src/lib/PackedMCCaloHit.cpp |   9 +-
 Event/EventPacker/src/lib/PackedMCHit.cpp     |  13 +-
 .../src/lib/PackedMCRichDigitSummary.cpp      |   9 +-
 Event/EventPacker/src/lib/PackedMCRichHit.cpp |   8 +-
 .../src/lib/PackedMCRichOpticalPhoton.cpp     |   9 +-
 .../src/lib/PackedMCRichSegment.cpp           |  17 +-
 .../EventPacker/src/lib/PackedMCRichTrack.cpp |  11 +-
 Event/EventPacker/src/lib/PackedMuonPID.cpp   |  12 +-
 .../lib/PackedPartToRelatedInfoRelation.cpp   |   5 -
 Event/EventPacker/src/lib/PackedParticle.cpp  |  15 +-
 .../src/lib/PackedProtoParticle.cpp           |  24 +-
 Event/EventPacker/src/lib/PackedRecVertex.cpp |   6 +-
 Event/EventPacker/src/lib/PackedRichPID.cpp   |   9 +-
 Event/EventPacker/src/lib/PackedTrack.cpp     |   7 -
 Event/EventPacker/src/lib/PackedVertex.cpp    |  13 +-
 .../src/lib/PackedWeightsVector.cpp           |   6 -
 Event/EventPacker/src/lib/StandardPacker.cpp  |   8 +-
 86 files changed, 1597 insertions(+), 2469 deletions(-)
 delete mode 100644 Event/EventPacker/src/component/ChargedProtoParticleMapper.h
 delete mode 100644 Event/EventPacker/src/component/ConversionDODMapper.h
 delete mode 100644 Event/EventPacker/src/component/DumpTracks.h
 delete mode 100644 Event/EventPacker/src/component/PackCaloHypo.h
 delete mode 100644 Event/EventPacker/src/component/PackCluster.h
 delete mode 100644 Event/EventPacker/src/component/PackDecReport.h
 delete mode 100644 Event/EventPacker/src/component/PackMCParticle.h
 delete mode 100644 Event/EventPacker/src/component/PackMCVertex.h
 delete mode 100644 Event/EventPacker/src/component/PackParticlesAndVertices.h
 delete mode 100644 Event/EventPacker/src/component/PackProtoParticle.h
 delete mode 100644 Event/EventPacker/src/component/PackRecVertex.h
 delete mode 100644 Event/EventPacker/src/component/PackSTCluster.h
 delete mode 100644 Event/EventPacker/src/component/PackTrack.h
 delete mode 100644 Event/EventPacker/src/component/PackTwoProngVertex.h
 delete mode 100644 Event/EventPacker/src/component/PackUTCluster.h
 delete mode 100644 Event/EventPacker/src/component/PackVeloCluster.h
 delete mode 100644 Event/EventPacker/src/component/ReadPackedDst.h
 delete mode 100644 Event/EventPacker/src/component/TrackClustersMapper.h
 delete mode 100644 Event/EventPacker/src/component/UnpackCaloHypo.h
 delete mode 100644 Event/EventPacker/src/component/UnpackCluster.h
 delete mode 100644 Event/EventPacker/src/component/UnpackDecReport.h
 delete mode 100644 Event/EventPacker/src/component/UnpackMCParticle.h
 delete mode 100644 Event/EventPacker/src/component/UnpackMCVertex.h
 delete mode 100644 Event/EventPacker/src/component/UnpackParticlesAndVertices.h
 delete mode 100644 Event/EventPacker/src/component/UnpackRecVertex.h
 delete mode 100644 Event/EventPacker/src/component/UnpackSTCluster.h
 delete mode 100644 Event/EventPacker/src/component/UnpackTrack.h
 delete mode 100644 Event/EventPacker/src/component/UnpackTrackFunctional.h
 delete mode 100644 Event/EventPacker/src/component/UnpackTwoProngVertex.h
 delete mode 100644 Event/EventPacker/src/component/UnpackUTCluster.h
 delete mode 100644 Event/EventPacker/src/component/UnpackVeloCluster.h
 delete mode 100644 Event/EventPacker/src/component/WritePackedDst.h

diff --git a/Event/EventPacker/src/component/ChargedProtoParticleMapper.cpp b/Event/EventPacker/src/component/ChargedProtoParticleMapper.cpp
index 07e110a091b..c48dcd2261b 100644
--- a/Event/EventPacker/src/component/ChargedProtoParticleMapper.cpp
+++ b/Event/EventPacker/src/component/ChargedProtoParticleMapper.cpp
@@ -8,11 +8,11 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// Include files
+#include "Event/PackedProtoParticle.h"
+#include "MapperToolBase.h"
 #include <iterator>
-// local
-#include "ChargedProtoParticleMapper.h"
+#include <map>
+#include <string>
 
 // ----------------------------------------------------------------------------
 // Implementation file for class: ParticlesAndVerticesMapper
@@ -20,6 +20,79 @@
 // 17/01/2012: Marco Clemencic
 // ----------------------------------------------------------------------------
 
+/** @class ChargedProtoParticleMapper ChargedProtoParticleMapper.h
+ *
+ *  Tool for mappings for charged ProtoParticles
+ *
+ * @author Chris Jones
+ * @date 16/04/2013
+ */
+class ChargedProtoParticleMapper : public MapperToolBase {
+
+public:
+  /// Standard constructor
+  ChargedProtoParticleMapper( const std::string& type, const std::string& name, const IInterface* parent );
+
+public:
+  /** Returns the correctly configured and name instance of the
+   *  Clusters unpacker, for the given path
+   */
+  Gaudi::Utils::TypeNameString algorithmForPath( const std::string& path ) override;
+
+public:
+  /** Instruct the DataOnDemandSvc to create DataObjects for the
+   *  intermediate levels of a path we can handle.
+   */
+  std::string nodeTypeForPath( const std::string& path ) override;
+
+private:
+  /// Add a path to the node type mappings
+  void addPath( const std::string& path );
+
+  /// Check if a given path is in the list of data locations created
+  bool pathIsHandled( const std::string& path ) const {
+    // See if we have an entry for this path
+    NodeTypeMap::const_iterator it = m_nodeTypeMap.find( fixPath( path ) );
+    return ( it != m_nodeTypeMap.end() );
+  }
+
+  /// Check the node mappings are updated for the given path stream
+  void updateNodeTypeMap( const std::string& path );
+
+  /// Get the location of the packed ProtoParticles for the given stream
+  std::string packedProtoLocation( const std::string& stream ) const {
+    return stream + "/" + LHCb::PackedProtoParticleLocation::Charged;
+  }
+
+  /// Get the location of the packed ProtoParticles for the given stream
+  std::string protoLocation( const std::string& stream ) const {
+    return stream + "/" + LHCb::ProtoParticleLocation::Charged;
+  }
+
+private:
+  /// Map to say which stream roots have been configured
+  std::map<std::string, bool> m_streamsDone;
+
+  /// Mapping between TES path and node type
+  typedef std::map<std::string, std::string> NodeTypeMap;
+  NodeTypeMap                                m_nodeTypeMap;
+
+  /// List of track types for PID recalibration
+  std::vector<std::string> m_tkTypes;
+
+  /// List of hypo types for PID recalibration
+  std::vector<std::string> m_pidTypes;
+
+  /// ANN PID recalibration tuning
+  std::string m_pidTune;
+
+  /// String match regex for the Brunel application version for rerunning the ANNPID
+  std::string m_regex;
+
+  /// Outputlevel for unpackers created
+  int m_unpackersOutputLevel;
+};
+
 // ============================================================================
 // Standard constructor, initializes variables
 // ============================================================================
diff --git a/Event/EventPacker/src/component/ChargedProtoParticleMapper.h b/Event/EventPacker/src/component/ChargedProtoParticleMapper.h
deleted file mode 100644
index d97fcb4f66e..00000000000
--- a/Event/EventPacker/src/component/ChargedProtoParticleMapper.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef SRC_ChargedProtoParticleMapper_H
-#define SRC_ChargedProtoParticleMapper_H 1
-
-#include <map>
-#include <string>
-
-// base class
-#include "MapperToolBase.h"
-
-// Event model
-#include "Event/PackedProtoParticle.h"
-
-class IJobOptionsSvc;
-
-/** @class ChargedProtoParticleMapper ChargedProtoParticleMapper.h
- *
- *  Tool for mappings for charged ProtoParticles
- *
- * @author Chris Jones
- * @date 16/04/2013
- */
-class ChargedProtoParticleMapper : public MapperToolBase {
-
-public:
-  /// Standard constructor
-  ChargedProtoParticleMapper( const std::string& type, const std::string& name, const IInterface* parent );
-
-public:
-  /** Returns the correctly configured and name instance of the
-   *  Clusters unpacker, for the given path
-   */
-  Gaudi::Utils::TypeNameString algorithmForPath( const std::string& path ) override;
-
-public:
-  /** Instruct the DataOnDemandSvc to create DataObjects for the
-   *  intermediate levels of a path we can handle.
-   */
-  std::string nodeTypeForPath( const std::string& path ) override;
-
-private:
-  /// Add a path to the node type mappings
-  void addPath( const std::string& path );
-
-  /// Check if a given path is in the list of data locations created
-  inline bool pathIsHandled( const std::string& path ) const {
-    // See if we have an entry for this path
-    NodeTypeMap::const_iterator it = m_nodeTypeMap.find( fixPath( path ) );
-    return ( it != m_nodeTypeMap.end() );
-  }
-
-  /// Check the node mappings are updated for the given path stream
-  void updateNodeTypeMap( const std::string& path );
-
-  /// Get the location of the packed ProtoParticles for the given stream
-  std::string packedProtoLocation( const std::string& stream ) const {
-    return stream + "/" + LHCb::PackedProtoParticleLocation::Charged;
-  }
-
-  /// Get the location of the packed ProtoParticles for the given stream
-  std::string protoLocation( const std::string& stream ) const {
-    return stream + "/" + LHCb::ProtoParticleLocation::Charged;
-  }
-
-private:
-  /// Map to say which stream roots have been configured
-  std::map<std::string, bool> m_streamsDone;
-
-  /// Mapping between TES path and node type
-  typedef std::map<std::string, std::string> NodeTypeMap;
-  NodeTypeMap                                m_nodeTypeMap;
-
-  /// List of track types for PID recalibration
-  std::vector<std::string> m_tkTypes;
-
-  /// List of hypo types for PID recalibration
-  std::vector<std::string> m_pidTypes;
-
-  /// ANN PID recalibration tuning
-  std::string m_pidTune;
-
-  /// String match regex for the Brunel application version for rerunning the ANNPID
-  std::string m_regex;
-
-  /// Outputlevel for unpackers created
-  int m_unpackersOutputLevel;
-};
-
-#endif // SRC_ChargedProtoParticleMapper_H
diff --git a/Event/EventPacker/src/component/ConversionDODMapper.cpp b/Event/EventPacker/src/component/ConversionDODMapper.cpp
index 0c066fbd8b5..bc21f9f735f 100644
--- a/Event/EventPacker/src/component/ConversionDODMapper.cpp
+++ b/Event/EventPacker/src/component/ConversionDODMapper.cpp
@@ -8,6 +8,12 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
+// ----------------------------------------------------------------------------
+// Implementation file for class: ConversionDODMapper
+//
+// 17/01/2012: Marco Clemencic
+// ----------------------------------------------------------------------------
+
 // Local parser for vector<pair<string,string> >
 // Must be done very early.
 #include "GaudiKernel/ParsersFactory.h"
@@ -19,18 +25,129 @@ namespace Gaudi {
   } // namespace Parsers
 } // namespace Gaudi
 
-// Include files
-#include <iterator>
-// From Gaudi
 #include "GaudiKernel/IJobOptionsSvc.h"
-// local
-#include "ConversionDODMapper.h"
+#include "MapperToolBase.h"
+#include <iterator>
+#include <regex>
+
+/** @class ConversionDODMapper ConversionDODMapper.h
+ *
+ * Tool for automatic conversions in the transient store.
+ *
+ * Implements the IDODAlgMapper interface to dynamically instruct the DataOnDemandSvc
+ * to call conversion algorithms that will convert some input object in the T.S.
+ * the the requested one.
+ *
+ * The Tool must be configured with a list of path transformation rules
+ * (property "Transformations") in the form of pairs of strings, where the first
+ * one is a regular expression matching a possible path to produce and the
+ * second one is the format of the corresponding source path.
+ * E.g.: to generate the entries in ".../Phys/..." from the corresponding path
+ * in ".../pPhys/...", tha pair to use is ("(.*)/Phys/(.*)", "$1/pPhys/$2").
+ *
+ * In addition to the path transformation rules, a mapping from source ClassID
+ * to the name of the converter algorithm must be set via the property
+ * "Algorithms".
+ *
+ * It is possible to change the default OutputLevel for all the instances of an
+ * algorithm type triggered by the tool using the property
+ * "AlgorithmsOutputLevels", which is a map from algorithm class name to
+ * MSG::Level.
+ *
+ * @author Marco Clemencic
+ * @date 17/01/2012
+ */
+class ConversionDODMapper : public MapperToolBase {
+
+public:
+  /// Standard constructor
+  ConversionDODMapper( const std::string& type, const std::string& name, const IInterface* parent );
+
+  /// Initialize the tool instance.
+  StatusCode initialize() override;
+
+public:
+  /// Return the algorithm type/name to produce the requested entry.
+  ///
+  /// For the given path in the transient store, try to transform it to a source
+  /// location and, if it is possible, load the source object to find the type
+  /// of the conversion algorithm.
+  /// A unique name for the algorithm instance is chosen and the JobOptionsSvc
+  /// is fed with the InputName and OutputName properties for that instance.
+  ///
+  /// Then the TypeNameString of the algorithm instance is returned.
+  ///
+  /// @see IDODAlgMapper
+  Gaudi::Utils::TypeNameString algorithmForPath( const std::string& path ) override;
+
+public:
+  /// Instruct the DataOnDemandSvc to create the DataObjects for the
+  /// intermediate levels of a path we can handle.
+  ///
+  /// If the requested path can be transformed via the known rules and the
+  /// source object is a trivial DataObject, we tell the DataOnDemandSvc to
+  /// create the node.
+  ///
+  /// @see IDODNodeMapper
+  std::string nodeTypeForPath( const std::string& path ) override;
+
+private:
+  /// Convert a string using the configured mapping rules.
+  /// All the rules are tried until one matches. If there is no match an empty
+  /// string is returned.
+  std::string transform( const std::string& input ) const;
+
+  /// Helper function to get the source candidate.
+  DataObject* candidate( const std::string& path ) const;
+
+private:
+  /// @{
+  /// Data members corresponding to properties
+  typedef std::vector<std::pair<std::string, std::string>> RulesMapProp;
+  RulesMapProp                                             m_pathTransfRules; ///!< Transformations
+
+  typedef std::map<CLID, std::string> AlgForTypeMap;
+  AlgForTypeMap                       m_algTypes; ///!< Algorithms
+
+  typedef std::map<std::string, unsigned int> OutLevelsMap;
+  OutLevelsMap                                m_algOutLevels; ///!< AlgorithmsOutputLevels
+
+  std::string m_inputOptionName;  ///< Job option name for inputs
+  std::string m_outputOptionName; ///< Job option name for outputs
+  /// @}
+
+private:
+  /// Helper class to manage the regex translation rules.
+  class Rule {
+  public:
+    /// Constructor.
+    inline Rule( const std::string& _regexp, const std::string& _format ) : regexp( _regexp ), format( _format ) {}
+
+    /// Apply the conversion rule to the input string.
+    /// If the regex does not match the input, an empty string is returned.
+    inline std::string apply( const std::string& input ) const {
+      return std::regex_replace( input, regexp, format,
+                                 std::regex_constants::match_default | std::regex_constants::format_no_copy );
+    }
+
+    /// Helper to create a Rule from a pair of strings.
+    inline static Rule make( const std::pair<std::string, std::string>& p ) { return Rule( p.first, p.second ); }
+
+  private:
+    /// Regular expression object.
+    std::regex regexp;
+
+    /// Format string (see std documentation).
+    std::string format;
+  };
+
+  ///@{
+  /// List of translation rules
+  typedef std::list<Rule> RulesList;
+  RulesList               m_rules;
+  ///@}
+};
 
-// ----------------------------------------------------------------------------
-// Implementation file for class: ConversionDODMapper
-//
-// 17/01/2012: Marco Clemencic
-// ----------------------------------------------------------------------------
 DECLARE_COMPONENT( ConversionDODMapper )
 
 // ============================================================================
@@ -50,7 +167,6 @@ ConversionDODMapper::ConversionDODMapper( const std::string& type, const std::st
                    "of a specific converter algorithm type" );
   declareProperty( "InputOptionName", m_inputOptionName = "InputName" );
   declareProperty( "OutputOptionName", m_outputOptionName = "OutputName" );
-  // setProperty( "OutputLevel", 1 );
 }
 
 // ============================================================================
diff --git a/Event/EventPacker/src/component/ConversionDODMapper.h b/Event/EventPacker/src/component/ConversionDODMapper.h
deleted file mode 100644
index 9d148bf7774..00000000000
--- a/Event/EventPacker/src/component/ConversionDODMapper.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef SRC_CONVERSIONDODMAPPER_H
-#define SRC_CONVERSIONDODMAPPER_H 1
-
-// base class
-#include "MapperToolBase.h"
-
-#include <regex>
-
-class IJobOptionsSvc;
-
-/** @class ConversionDODMapper ConversionDODMapper.h
- *
- * Tool for automatic conversions in the transient store.
- *
- * Implements the IDODAlgMapper interface to dynamically instruct the DataOnDemandSvc
- * to call conversion algorithms that will convert some input object in the T.S.
- * the the requested one.
- *
- * The Tool must be configured with a list of path transformation rules
- * (property "Transformations") in the form of pairs of strings, where the first
- * one is a regular expression matching a possible path to produce and the
- * second one is the format of the corresponding source path.
- * E.g.: to generate the entries in ".../Phys/..." from the corresponding path
- * in ".../pPhys/...", tha pair to use is ("(.*)/Phys/(.*)", "$1/pPhys/$2").
- *
- * In addition to the path transformation rules, a mapping from source ClassID
- * to the name of the converter algorithm must be set via the property
- * "Algorithms".
- *
- * It is possible to change the default OutputLevel for all the instances of an
- * algorithm type triggered by the tool using the property
- * "AlgorithmsOutputLevels", which is a map from algorithm class name to
- * MSG::Level.
- *
- * @author Marco Clemencic
- * @date 17/01/2012
- */
-class ConversionDODMapper : public MapperToolBase {
-
-public:
-  /// Standard constructor
-  ConversionDODMapper( const std::string& type, const std::string& name, const IInterface* parent );
-
-  /// Initialize the tool instance.
-  StatusCode initialize() override;
-
-public:
-  /// Return the algorithm type/name to produce the requested entry.
-  ///
-  /// For the given path in the transient store, try to transform it to a source
-  /// location and, if it is possible, load the source object to find the type
-  /// of the conversion algorithm.
-  /// A unique name for the algorithm instance is chosen and the JobOptionsSvc
-  /// is fed with the InputName and OutputName properties for that instance.
-  ///
-  /// Then the TypeNameString of the algorithm instance is returned.
-  ///
-  /// @see IDODAlgMapper
-  Gaudi::Utils::TypeNameString algorithmForPath( const std::string& path ) override;
-
-public:
-  /// Instruct the DataOnDemandSvc to create the DataObjects for the
-  /// intermediate levels of a path we can handle.
-  ///
-  /// If the requested path can be transformed via the known rules and the
-  /// source object is a trivial DataObject, we tell the DataOnDemandSvc to
-  /// create the node.
-  ///
-  /// @see IDODNodeMapper
-  std::string nodeTypeForPath( const std::string& path ) override;
-
-private:
-  /// Convert a string using the configured mapping rules.
-  /// All the rules are tried until one matches. If there is no match an empty
-  /// string is returned.
-  std::string transform( const std::string& input ) const;
-
-  /// Helper function to get the source candidate.
-  DataObject* candidate( const std::string& path ) const;
-
-private:
-  /// @{
-  /// Data members corresponding to properties
-  typedef std::vector<std::pair<std::string, std::string>> RulesMapProp;
-  RulesMapProp                                             m_pathTransfRules; ///!< Transformations
-
-  typedef std::map<CLID, std::string> AlgForTypeMap;
-  AlgForTypeMap                       m_algTypes; ///!< Algorithms
-
-  typedef std::map<std::string, unsigned int> OutLevelsMap;
-  OutLevelsMap                                m_algOutLevels; ///!< AlgorithmsOutputLevels
-
-  std::string m_inputOptionName;  ///< Job option name for inputs
-  std::string m_outputOptionName; ///< Job option name for outputs
-  /// @}
-
-private:
-  /// Helper class to manage the regex translation rules.
-  class Rule {
-  public:
-    /// Constructor.
-    inline Rule( const std::string& _regexp, const std::string& _format ) : regexp( _regexp ), format( _format ) {}
-
-    /// Apply the conversion rule to the input string.
-    /// If the regex does not match the input, an empty string is returned.
-    inline std::string apply( const std::string& input ) const {
-      return std::regex_replace( input, regexp, format,
-                                 std::regex_constants::match_default | std::regex_constants::format_no_copy );
-    }
-
-    /// Helper to create a Rule from a pair of strings.
-    inline static Rule make( const std::pair<std::string, std::string>& p ) { return Rule( p.first, p.second ); }
-
-  private:
-    /// Regular expression object.
-    std::regex regexp;
-
-    /// Format string (see std documentation).
-    std::string format;
-  };
-
-  ///@{
-  /// List of translation rules
-  typedef std::list<Rule> RulesList;
-  RulesList               m_rules;
-  ///@}
-};
-
-#endif // SRC_CONVERSIONDODMAPPER_H
diff --git a/Event/EventPacker/src/component/DumpTracks.cpp b/Event/EventPacker/src/component/DumpTracks.cpp
index 2236abc61ea..bab75740c04 100644
--- a/Event/EventPacker/src/component/DumpTracks.cpp
+++ b/Event/EventPacker/src/component/DumpTracks.cpp
@@ -8,13 +8,9 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// Event Model
 #include "Event/Track.h"
-
-// local
-#include "DumpTracks.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include <string>
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : DumpTracks
@@ -22,6 +18,31 @@
 // 2004-07-14 : Marco Cattaneo
 //-----------------------------------------------------------------------------
 
+/** @class DumpTracks DumpTracks.h
+ *  Dump all tracks in an event.
+ *  Amount printed depends on OutputLevel:
+ *    INFO: prints size of container
+ *   DEBUG: prints also first "NumberOfObjectsToPrint" Tracks and States
+ *          (default is 5)
+ * VERBOSE: prints all Tracks and States
+ *
+ *  @author Marco Cattaneo
+ *  @date   2004-07-14
+ */
+class DumpTracks : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  DumpTracks( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  unsigned int                                            m_numObjects;     ///< Number of objects to print
+  std::string                                             m_tracksLocation; ///< Location of tracks container
+  mutable Gaudi::Accumulators::StatCounter<unsigned long> m_tracks{this, "#Tracks"};
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( DumpTracks )
 
diff --git a/Event/EventPacker/src/component/DumpTracks.h b/Event/EventPacker/src/component/DumpTracks.h
deleted file mode 100644
index c382b5ddb7a..00000000000
--- a/Event/EventPacker/src/component/DumpTracks.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef DUMPTRACKS_H
-#define DUMPTRACKS_H 1
-
-// Include files
-#include "GaudiAlg/GaudiAlgorithm.h"
-#include <string>
-
-/** @class DumpTracks DumpTracks.h
- *  Dump all tracks in an event.
- *  Amount printed depends on OutputLevel:
- *    INFO: prints size of container
- *   DEBUG: prints also first "NumberOfObjectsToPrint" Tracks and States
- *          (default is 5)
- * VERBOSE: prints all Tracks and States
- *
- *  @author Marco Cattaneo
- *  @date   2004-07-14
- */
-class DumpTracks : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  DumpTracks( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  unsigned int                                            m_numObjects;     ///< Number of objects to print
-  std::string                                             m_tracksLocation; ///< Location of tracks container
-  mutable Gaudi::Accumulators::StatCounter<unsigned long> m_tracks{this, "#Tracks"};
-};
-
-#endif // DUMPTRACKS_H
diff --git a/Event/EventPacker/src/component/PackCaloHypo.cpp b/Event/EventPacker/src/component/PackCaloHypo.cpp
index 578a333aa74..19dda5f846f 100644
--- a/Event/EventPacker/src/component/PackCaloHypo.cpp
+++ b/Event/EventPacker/src/component/PackCaloHypo.cpp
@@ -8,16 +8,37 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// local
-#include "PackCaloHypo.h"
-
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackCaloHypo
 //
 // 2008-11-12 : Olivier Callot
 //-----------------------------------------------------------------------------
+#include "Event/PackedCaloHypo.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+
+/** @class PackCaloHypo PackCaloHypo.h
+ *
+ *  Pack a CaloHypo container
+ *
+ *  @author Olivier Callot
+ *  @date   2008-11-12
+ */
+class PackCaloHypo : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackCaloHypo( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;
+  std::string m_outputName;
+  bool        m_alwaysOutput;  ///< Flag to turn on the creation of output, even when input is missing
+  bool        m_deleteInput;   ///< Flag to turn on the removal of the input data after packing
+  bool        m_enableCheck;   ///< Flag to turn on automatic unpacking and checking of the output post-packing
+  bool        m_clearRegistry; ///< Flag to turn on the clearing of the registry if the input data is not kept
+};
 
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( PackCaloHypo )
diff --git a/Event/EventPacker/src/component/PackCaloHypo.h b/Event/EventPacker/src/component/PackCaloHypo.h
deleted file mode 100644
index 981b1e48836..00000000000
--- a/Event/EventPacker/src/component/PackCaloHypo.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKCALOHYPO_H
-#define PACKCALOHYPO_H 1
-
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-#include "Event/PackedCaloHypo.h"
-
-/** @class PackCaloHypo PackCaloHypo.h
- *
- *  Pack a CaloHypo container
- *
- *  @author Olivier Callot
- *  @date   2008-11-12
- */
-class PackCaloHypo : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackCaloHypo( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;
-  std::string m_outputName;
-  bool        m_alwaysOutput;  ///< Flag to turn on the creation of output, even when input is missing
-  bool        m_deleteInput;   ///< Flag to turn on the removal of the input data after packing
-  bool        m_enableCheck;   ///< Flag to turn on automatic unpacking and checking of the output post-packing
-  bool        m_clearRegistry; ///< Flag to turn on the clearing of the registry if the input data is not kept
-};
-
-#endif // PACKCALOHYPO_H
diff --git a/Event/EventPacker/src/component/PackCluster.cpp b/Event/EventPacker/src/component/PackCluster.cpp
index 05f61d7ff2a..bfabbaefceb 100644
--- a/Event/EventPacker/src/component/PackCluster.cpp
+++ b/Event/EventPacker/src/component/PackCluster.cpp
@@ -8,12 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// from Gaudi
+#include "Event/PackedCluster.h"
 #include "Event/Track.h"
-
-// local
-#include "PackCluster.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include <sstream>
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackCluster
@@ -21,6 +19,32 @@
 // 2012-03-05 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class PackCluster PackCluster.h
+ *
+ *  Pack the cluster on the tracks of a specified container.
+ *
+ *  @author Olivier Callot
+ *  @date   2012-03-05
+ */
+class PackCluster : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackCluster( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;   ///< Input Track location
+  std::string m_outputName;  ///< Output location for packed clusters
+  std::string m_veloClusLoc; ///< Velo clusters location
+  std::string m_ttClusLoc;   ///< TT clusters location
+  std::string m_utClusLoc;   ///< UT clusters location
+  std::string m_itClusLoc;   ///< IT clusters location
+
+  bool m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( PackCluster )
 
diff --git a/Event/EventPacker/src/component/PackCluster.h b/Event/EventPacker/src/component/PackCluster.h
deleted file mode 100644
index 75ac8c19bd8..00000000000
--- a/Event/EventPacker/src/component/PackCluster.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKCLUSTER_H
-#define PACKCLUSTER_H 1
-
-#include <sstream>
-
-#include "Event/PackedCluster.h"
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class PackCluster PackCluster.h
- *
- *  Pack the cluster on the tracks of a specified container.
- *
- *  @author Olivier Callot
- *  @date   2012-03-05
- */
-class PackCluster : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackCluster( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;   ///< Input Track location
-  std::string m_outputName;  ///< Output location for packed clusters
-  std::string m_veloClusLoc; ///< Velo clusters location
-  std::string m_ttClusLoc;   ///< TT clusters location
-  std::string m_utClusLoc;   ///< UT clusters location
-  std::string m_itClusLoc;   ///< IT clusters location
-
-  bool m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-};
-
-#endif // PACKCLUSTER_H
diff --git a/Event/EventPacker/src/component/PackDecReport.cpp b/Event/EventPacker/src/component/PackDecReport.cpp
index 1eb946ce1c9..a7b693cf1ec 100644
--- a/Event/EventPacker/src/component/PackDecReport.cpp
+++ b/Event/EventPacker/src/component/PackDecReport.cpp
@@ -8,17 +8,11 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// from Gaudi
-#include "GaudiKernel/LinkManager.h"
-
 #include "Event/HltDecReports.h"
 #include "Event/PackedDecReport.h"
 #include "Event/StandardPacker.h"
-
-// local
-#include "PackDecReport.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "GaudiKernel/LinkManager.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackDecReport
@@ -26,6 +20,29 @@
 // 2012-01-20 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class PackDecReport PackDecReport.h
+ *
+ *  Packs DecReports
+ *
+ *  @author Olivier Callot
+ *  @date   2012-01-20
+ */
+class PackDecReport : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackDecReport( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;
+  std::string m_outputName;
+  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+  bool        m_filter;
+  bool        m_deleteInput; ///< Flag to turn on the removal of the inoput data after packing
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( PackDecReport )
 
diff --git a/Event/EventPacker/src/component/PackDecReport.h b/Event/EventPacker/src/component/PackDecReport.h
deleted file mode 100644
index b5cb629b420..00000000000
--- a/Event/EventPacker/src/component/PackDecReport.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKDECREPORT_H
-#define PACKDECREPORT_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class PackDecReport PackDecReport.h
- *
- *  Packs DecReports
- *
- *  @author Olivier Callot
- *  @date   2012-01-20
- */
-class PackDecReport : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackDecReport( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;
-  std::string m_outputName;
-  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-  bool        m_filter;
-  bool        m_deleteInput; ///< Flag to turn on the removal of the inoput data after packing
-};
-
-#endif // PACKDECREPORT_H
diff --git a/Event/EventPacker/src/component/PackMCParticle.cpp b/Event/EventPacker/src/component/PackMCParticle.cpp
index 71ae36668bd..9d5b427e62e 100644
--- a/Event/EventPacker/src/component/PackMCParticle.cpp
+++ b/Event/EventPacker/src/component/PackMCParticle.cpp
@@ -8,14 +8,11 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// STL
-#include <algorithm>
-
 #include "Event/MCParticle.h"
 #include "Event/PackedMCParticle.h"
 #include "Event/StandardPacker.h"
-// local
-#include "PackMCParticle.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include <algorithm>
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackMCParticle
@@ -23,6 +20,27 @@
 // 2005-03-18 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class PackMCParticle PackMCParticle.h
+ *  Pack the MCParticles
+ *
+ *  @author Olivier Callot
+ *  @date   2005-03-18
+ */
+class PackMCParticle : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackMCParticle( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;
+  std::string m_outputName;
+  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+  bool        m_deleteInput;  ///< Flag to turn on the removal of the input data after packing
+};
+
 DECLARE_COMPONENT( PackMCParticle )
 
 //=============================================================================
diff --git a/Event/EventPacker/src/component/PackMCParticle.h b/Event/EventPacker/src/component/PackMCParticle.h
deleted file mode 100644
index b4d2a7374d0..00000000000
--- a/Event/EventPacker/src/component/PackMCParticle.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKMCPARTICLE_H
-#define PACKMCPARTICLE_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class PackMCParticle PackMCParticle.h
- *  Pack the MCParticles
- *
- *  @author Olivier Callot
- *  @date   2005-03-18
- */
-class PackMCParticle : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackMCParticle( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;
-  std::string m_outputName;
-  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-  bool        m_deleteInput;  ///< Flag to turn on the removal of the input data after packing
-};
-
-#endif // PACKMCPARTICLE_H
diff --git a/Event/EventPacker/src/component/PackMCVertex.cpp b/Event/EventPacker/src/component/PackMCVertex.cpp
index f46babce07f..f08bb2c070b 100644
--- a/Event/EventPacker/src/component/PackMCVertex.cpp
+++ b/Event/EventPacker/src/component/PackMCVertex.cpp
@@ -8,16 +8,11 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// from Boost
-#include "boost/numeric/conversion/bounds.hpp"
-
 #include "Event/MCVertex.h"
 #include "Event/PackedMCVertex.h"
 #include "Event/StandardPacker.h"
-// local
-#include "PackMCVertex.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "boost/numeric/conversion/bounds.hpp"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackMCVertex
@@ -25,6 +20,27 @@
 // 2005-03-18 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class PackMCVertex PackMCVertex.h
+ *  Pack the MCVertices
+ *
+ *  @author Olivier Callot
+ *  @date   2005-03-18
+ */
+class PackMCVertex : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackMCVertex( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;
+  std::string m_outputName;
+  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+  bool        m_deleteInput;  ///< Flag to turn on the removal of the input data after packing
+};
+
 DECLARE_COMPONENT( PackMCVertex )
 
 //=============================================================================
diff --git a/Event/EventPacker/src/component/PackMCVertex.h b/Event/EventPacker/src/component/PackMCVertex.h
deleted file mode 100644
index 6bec5f04054..00000000000
--- a/Event/EventPacker/src/component/PackMCVertex.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKMCVERTEX_H
-#define PACKMCVERTEX_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class PackMCVertex PackMCVertex.h
- *  Pack the MCVertices
- *
- *  @author Olivier Callot
- *  @date   2005-03-18
- */
-class PackMCVertex : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackMCVertex( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;
-  std::string m_outputName;
-  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-  bool        m_deleteInput;  ///< Flag to turn on the removal of the input data after packing
-};
-
-#endif // PACKMCVERTEX_H
diff --git a/Event/EventPacker/src/component/PackParticlesAndVertices.cpp b/Event/EventPacker/src/component/PackParticlesAndVertices.cpp
index 79db968c61d..31520be0841 100644
--- a/Event/EventPacker/src/component/PackParticlesAndVertices.cpp
+++ b/Event/EventPacker/src/component/PackParticlesAndVertices.cpp
@@ -8,16 +8,295 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// local
-#include "PackParticlesAndVertices.h"
-
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackParticlesAndVertices
 //
 // 2012-01-23 : Olivier Callot
 //-----------------------------------------------------------------------------
+#include "Event/FlavourTag.h"
+#include "Event/MCParticle.h"
+#include "Event/MuonPID.h"
+#include "Event/PackedFlavourTag.h"
+#include "Event/PackedMuonPID.h"
+#include "Event/PackedPartToRelatedInfoRelation.h"
+#include "Event/PackedParticle.h"
+#include "Event/PackedProtoParticle.h"
+#include "Event/PackedRecVertex.h"
+#include "Event/PackedRelations.h"
+#include "Event/PackedRichPID.h"
+#include "Event/PackedTrack.h"
+#include "Event/PackedVertex.h"
+#include "Event/Particle.h"
+#include "Event/ProtoParticle.h"
+#include "Event/RecVertex.h"
+#include "Event/RelatedInfoMap.h"
+#include "Event/RichPID.h"
+#include "Event/StandardPacker.h"
+#include "Event/Track.h"
+#include "Event/Vertex.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "GaudiKernel/IDataManagerSvc.h"
+#include "GaudiKernel/SmartIF.h"
+#include "Kernel/LHCbID.h"
+#include "Kernel/Particle2LHCbIDs.h"
+#include "Relations/Relation1D.h"
+#include "Relations/RelationWeighted1D.h"
+#include <sstream>
+
+/** @class PackParticlesAndVertices PackParticlesAndVertices.h
+ *
+ *  Packs Particles, Vertices and related information.
+ *
+ *  If one always wants to create the packed locations, regardless of whether there
+ *  are any related objects to be packed, one should set the `AlwaysCreateOutput` to
+ *  true and set the `AlwaysCreateContainers` list to the desired locations.
+ *
+ *  For example, the following configures the tool to always create the packed
+ *  particles location:
+ *
+ *  @code
+ *  from Configurables import PackParticlesAndVertices
+ *  input_stream = '/Event'
+ *  ppvs = PackParticlesAndVertices()
+ *  ppvs.InputStream = input_stream
+ *  ppvs.AlwaysCreateOutput = True
+ *  ppvs.AlwaysCreateContainers = [
+ *      '{0}/pPhys/Particles'.format(input_stream)
+ *  ]
+ *  @endcode
+ *
+ *  @author Olivier Callot
+ *  @date   2012-01-23
+ */
+class PackParticlesAndVertices : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackParticlesAndVertices( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+  StatusCode initialize() override; ///< Initialize the algorithm instance.
+
+private:
+  // Relation types
+  typedef LHCb::Relation1D<LHCb::Particle, LHCb::VertexBase>                      P2VRELATION;
+  typedef LHCb::Relation1D<LHCb::Particle, LHCb::MCParticle>                      P2MCPRELATION;
+  typedef LHCb::Relation1D<LHCb::Particle, int>                                   Part2IntRelations;
+  typedef LHCb::Relation1D<LHCb::Particle, LHCb::RelatedInfoMap>                  Part2InfoRelations;
+  typedef LHCb::RelationWeighted1D<LHCb::ProtoParticle, LHCb::MCParticle, double> Proto2MCPRelation;
+
+  // things for working
+  typedef std::vector<IRegistry*>                  Leaves;
+  typedef std::map<CLID, std::vector<std::string>> ClassIDTESMap;
+
+private:
+  /// Test if a TES container is Veto'ed from being packed
+  bool isVetoed( const std::string& id ) const;
+
+  /// Test if an output location should always be created
+  bool alwaysCreate( const std::string& id ) const;
+
+  /// Build the ClassID to TES location(s) map
+  void buildTESMap( const DataObject* obj, ClassIDTESMap& tesmap ) const;
+
+  /// Pack a Particle container
+  void packAParticleContainer( const LHCb::Particles* parts, LHCb::PackedParticles& pparts ) const;
+
+  /// Pack a ProtoParticle container
+  void packAProtoParticleContainer( const LHCb::ProtoParticles* protos, LHCb::PackedProtoParticles& pprotos ) const;
+
+  /// Pack a MuonPID container
+  void packAMuonPIDContainer( const LHCb::MuonPIDs* pids, LHCb::PackedMuonPIDs& ppids ) const;
+
+  /// Pack a RichPID container
+  void packARichPIDContainer( const LHCb::RichPIDs* pids, LHCb::PackedRichPIDs& ppids ) const;
+
+  /// Pack a Track container
+  void packATrackContainer( const LHCb::Tracks* tracks, LHCb::PackedTracks& ptracks ) const;
+
+  /// pack a vertex container
+  void packAVertexContainer( const LHCb::Vertices* verts, LHCb::PackedVertices& pverts ) const;
+
+  /// Pack a FlavourTag container
+  void packAFTContainer( const LHCb::FlavourTags* fts, LHCb::PackedFlavourTags& pfts ) const;
+
+  /// Pack a RecVertex container
+  void packARecVertexContainer( const LHCb::RecVertices* rverts, LHCb::PackedRecVertices& prverts ) const;
+
+  /// Pack a 'SmartRef to SmartRef' relations container
+  template <typename RELATION>
+  void packAP2PRelationContainer( const RELATION* rels, LHCb::PackedRelations& prels ) const;
+
+  /// Pack a 'SmartRef to SmartRef' weighted relations container
+  template <typename RELATION>
+  void packAP2PRelationContainer( const RELATION* rels, LHCb::PackedWeightedRelations& prels ) const;
+
+  /// Pack a 'SmartRef to int' relations container
+  template <typename RELATION>
+  void packAP2IntRelationContainer( const RELATION* rels, LHCb::PackedRelations& prels ) const;
+
+  /// Pack a 'SmartRef to RelatedInfoMap' relations container
+  void packAP2RelatedInfoRelationContainer( const Part2InfoRelations* rels, LHCb::PackedRelatedInfoRelations& prels,
+                                            const std::string& location ) const;
+
+  /// Get an objects location in the TES
+  std::string objectLocation( const DataObject& pObj ) const {
+    return ( pObj.registry() ? pObj.registry()->identifier() : "" );
+  }
+
+  /// Copy data object version
+  template <typename INPUT, typename OUTPUT>
+  void saveVersion( const INPUT& in, OUTPUT& out ) const {
+    const int i_ver = in.version();
+    const int o_ver = out.version();
+    // sanity check
+    if ( UNLIKELY( o_ver != 0 && o_ver != i_ver ) ) {
+      std::ostringstream mess;
+      mess << objectLocation( in ) << " version " << i_ver << " != current packed version " << o_ver;
+      Warning( mess.str() ).ignore();
+    }
+    out.setVersion( i_ver );
+  }
+
+private:
+  std::string m_inputStream;  ///< Input stream root
+  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+  bool        m_deleteInput;  ///< Delete the containers after packing if true.
+  bool        m_enableCheck;  ///< Flag to turn on automatic unpacking and checking of the output post-packing
+  std::vector<std::string> m_vetoedConts; ///< Vetoed containers. Will not be packed.
+  std::vector<std::string> m_createConts; ///< Always create these containers
+  StandardPacker           m_pack;        ///< Standard packer
+};
+
+//=============================================================================
+// Declaration of the Algorithm Factory
+DECLARE_COMPONENT( PackParticlesAndVertices )
+//=============================================================================
+
+//=========================================================================
+//  Pack a 'SmartRef to SmartRef' relations container
+//=========================================================================
+template <typename RELATION>
+void PackParticlesAndVertices::packAP2PRelationContainer( const RELATION* rels, LHCb::PackedRelations& prels ) const {
+  // Make a new packed data object and save
+  prels.relations().emplace_back( LHCb::PackedRelation() );
+  LHCb::PackedRelation& prel = prels.relations().back();
+
+  // reference to original container and key
+  prel.container = m_pack.reference64( &prels, rels, 0 );
+
+  // First object
+  prel.start = prels.sources().size();
+
+  // reserve size
+  const auto newSize = prels.sources().size() + rels->relations().size();
+  prels.sources().reserve( newSize );
+  prels.dests().reserve( newSize );
+
+  // Loop over relations
+  for ( const auto& R : rels->relations() ) {
+    prels.sources().emplace_back( m_pack.reference64( &prels, R.from()->parent(), R.from()->key() ) );
+    prels.dests().emplace_back( m_pack.reference64( &prels, R.to()->parent(), R.to()->key() ) );
+  }
+
+  // last object
+  prel.end = prels.sources().size();
+
+  // Clear the registry address of the unpacked container, to prevent reloading
+  if ( !m_deleteInput ) rels->registry()->setAddress( 0 );
+}
+
+//=========================================================================
+//  Pack a 'SmartRef to SmartRef' relations container
+//=========================================================================
+template <typename RELATION>
+void PackParticlesAndVertices::packAP2PRelationContainer( const RELATION*                rels,
+                                                          LHCb::PackedWeightedRelations& prels ) const {
+  // Make a new packed data object and save
+  prels.relations().emplace_back( LHCb::PackedRelation() );
+  LHCb::PackedRelation& prel = prels.relations().back();
+
+  // reference to original container and key
+  prel.container = m_pack.reference64( &prels, rels, 0 );
+
+  // First object
+  prel.start = prels.sources().size();
+
+  // reserve size
+  const auto newSize = prels.sources().size() + rels->relations().size();
+  prels.sources().reserve( newSize );
+  prels.dests().reserve( newSize );
+  prels.weights().reserve( newSize );
+
+  // Loop over relations
+  for ( const auto& R : rels->relations() ) {
+    prels.sources().emplace_back( m_pack.reference64( &prels, R.from()->parent(), R.from()->key() ) );
+    prels.dests().emplace_back( m_pack.reference64( &prels, R.to()->parent(), R.to()->key() ) );
+    prels.weights().emplace_back( R.weight() );
+  }
+
+  // last object
+  prel.end = prels.sources().size();
+
+  // Clear the registry address of the unpacked container, to prevent reloading
+  if ( !m_deleteInput ) rels->registry()->setAddress( 0 );
+}
+
+//=========================================================================
+//  Pack a 'SmartRef to int' relations container
+//=========================================================================
+template <typename RELATION>
+void PackParticlesAndVertices::packAP2IntRelationContainer( const RELATION* rels, LHCb::PackedRelations& prels ) const {
+  // Make a new packed data object and save
+  prels.relations().emplace_back( LHCb::PackedRelation() );
+  LHCb::PackedRelation& prel = prels.relations().back();
+
+  // reference to original container and key
+  prel.container = m_pack.reference64( &prels, rels, 0 );
+
+  // First object
+  prel.start = prels.sources().size();
+
+  // reserve size
+  const auto newSize = prels.sources().size() + rels->relations().size();
+  prels.sources().reserve( newSize );
+  prels.dests().reserve( newSize );
+
+  // Loop over relations
+  for ( const auto& R : rels->relations() ) {
+    prels.sources().emplace_back( m_pack.reference64( &prels, R.from()->parent(), R.from()->key() ) );
+    prels.dests().emplace_back( R.to() );
+  }
+
+  // last object
+  prel.end = prels.sources().size();
+
+  // Clear the registry address of the unpacked container, to prevent reloading
+  if ( !m_deleteInput ) rels->registry()->setAddress( 0 );
+}
+
+//==============================================================================
+// Test if a TES location is veto'ed
+//==============================================================================
+bool PackParticlesAndVertices::isVetoed( const std::string& id ) const {
+  const bool vetoed = ( std::find( m_vetoedConts.begin(), m_vetoedConts.end(), id ) != m_vetoedConts.end() );
+  if ( msgLevel( MSG::DEBUG ) ) {
+    if ( vetoed ) {
+      debug() << "  --> VETO'ed  ... " << id << endmsg;
+    } else {
+      debug() << "  --> Selected ... " << id << endmsg;
+    }
+  }
+  return vetoed;
+}
+
+//==============================================================================
+// Test if an output TES location should always be created
+//==============================================================================
+bool PackParticlesAndVertices::alwaysCreate( const std::string& id ) const {
+  return m_alwaysOutput && ( std::find( m_createConts.begin(), m_createConts.end(), id ) != m_createConts.end() );
+}
 
 //=============================================================================
 // Standard constructor, initializes variables
@@ -899,10 +1178,3 @@ void PackParticlesAndVertices::packAP2RelatedInfoRelationContainer(
   // Clear the registry address of the unpacked container, to prevent reloading
   if ( !m_deleteInput ) { rels->registry()->setAddress( 0 ); }
 }
-
-//=============================================================================
-
-// Declaration of the Algorithm Factory
-DECLARE_COMPONENT( PackParticlesAndVertices )
-
-//=============================================================================
diff --git a/Event/EventPacker/src/component/PackParticlesAndVertices.h b/Event/EventPacker/src/component/PackParticlesAndVertices.h
deleted file mode 100644
index 935e514c2d4..00000000000
--- a/Event/EventPacker/src/component/PackParticlesAndVertices.h
+++ /dev/null
@@ -1,302 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKPARTICLESANDVERTICES_H
-#define PACKPARTICLESANDVERTICES_H 1
-
-#include <sstream>
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-#include "GaudiKernel/IDataManagerSvc.h"
-#include "GaudiKernel/SmartIF.h"
-
-#include "Event/StandardPacker.h"
-#include "Kernel/Particle2LHCbIDs.h"
-
-#include "Relations/Relation1D.h"
-#include "Relations/RelationWeighted1D.h"
-
-#include "Kernel/LHCbID.h"
-
-#include "Event/PackedFlavourTag.h"
-#include "Event/PackedMuonPID.h"
-#include "Event/PackedPartToRelatedInfoRelation.h"
-#include "Event/PackedParticle.h"
-#include "Event/PackedProtoParticle.h"
-#include "Event/PackedRecVertex.h"
-#include "Event/PackedRelations.h"
-#include "Event/PackedRichPID.h"
-#include "Event/PackedTrack.h"
-#include "Event/PackedVertex.h"
-
-#include "Event/FlavourTag.h"
-#include "Event/MCParticle.h"
-#include "Event/MuonPID.h"
-#include "Event/Particle.h"
-#include "Event/ProtoParticle.h"
-#include "Event/RecVertex.h"
-#include "Event/RelatedInfoMap.h"
-#include "Event/RichPID.h"
-#include "Event/Track.h"
-#include "Event/Vertex.h"
-
-/** @class PackParticlesAndVertices PackParticlesAndVertices.h
- *
- *  Packs Particles, Vertices and related information.
- *
- *  If one always wants to create the packed locations, regardless of whether there
- *  are any related objects to be packed, one should set the `AlwaysCreateOutput` to
- *  true and set the `AlwaysCreateContainers` list to the desired locations.
- *
- *  For example, the following configures the tool to always create the packed
- *  particles location:
- *
- *  @code
- *  from Configurables import PackParticlesAndVertices
- *  input_stream = '/Event'
- *  ppvs = PackParticlesAndVertices()
- *  ppvs.InputStream = input_stream
- *  ppvs.AlwaysCreateOutput = True
- *  ppvs.AlwaysCreateContainers = [
- *      '{0}/pPhys/Particles'.format(input_stream)
- *  ]
- *  @endcode
- *
- *  @author Olivier Callot
- *  @date   2012-01-23
- */
-class PackParticlesAndVertices : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackParticlesAndVertices( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-  StatusCode initialize() override; ///< Initialize the algorithm instance.
-
-private:
-  // Relation types
-  typedef LHCb::Relation1D<LHCb::Particle, LHCb::VertexBase>                      P2VRELATION;
-  typedef LHCb::Relation1D<LHCb::Particle, LHCb::MCParticle>                      P2MCPRELATION;
-  typedef LHCb::Relation1D<LHCb::Particle, int>                                   Part2IntRelations;
-  typedef LHCb::Relation1D<LHCb::Particle, LHCb::RelatedInfoMap>                  Part2InfoRelations;
-  typedef LHCb::RelationWeighted1D<LHCb::ProtoParticle, LHCb::MCParticle, double> Proto2MCPRelation;
-
-  // things for working
-  typedef std::vector<IRegistry*>                  Leaves;
-  typedef std::map<CLID, std::vector<std::string>> ClassIDTESMap;
-
-private:
-  /// Test if a TES container is Veto'ed from being packed
-  bool isVetoed( const std::string& id ) const;
-
-  /// Test if an output location should always be created
-  bool alwaysCreate( const std::string& id ) const;
-
-  /// Build the ClassID to TES location(s) map
-  void buildTESMap( const DataObject* obj, ClassIDTESMap& tesmap ) const;
-
-  /// Pack a Particle container
-  void packAParticleContainer( const LHCb::Particles* parts, LHCb::PackedParticles& pparts ) const;
-
-  /// Pack a ProtoParticle container
-  void packAProtoParticleContainer( const LHCb::ProtoParticles* protos, LHCb::PackedProtoParticles& pprotos ) const;
-
-  /// Pack a MuonPID container
-  void packAMuonPIDContainer( const LHCb::MuonPIDs* pids, LHCb::PackedMuonPIDs& ppids ) const;
-
-  /// Pack a RichPID container
-  void packARichPIDContainer( const LHCb::RichPIDs* pids, LHCb::PackedRichPIDs& ppids ) const;
-
-  /// Pack a Track container
-  void packATrackContainer( const LHCb::Tracks* tracks, LHCb::PackedTracks& ptracks ) const;
-
-  /// pack a vertex container
-  void packAVertexContainer( const LHCb::Vertices* verts, LHCb::PackedVertices& pverts ) const;
-
-  /// Pack a FlavourTag container
-  void packAFTContainer( const LHCb::FlavourTags* fts, LHCb::PackedFlavourTags& pfts ) const;
-
-  /// Pack a RecVertex container
-  void packARecVertexContainer( const LHCb::RecVertices* rverts, LHCb::PackedRecVertices& prverts ) const;
-
-  /// Pack a 'SmartRef to SmartRef' relations container
-  template <typename RELATION>
-  void packAP2PRelationContainer( const RELATION* rels, LHCb::PackedRelations& prels ) const;
-
-  /// Pack a 'SmartRef to SmartRef' weighted relations container
-  template <typename RELATION>
-  void packAP2PRelationContainer( const RELATION* rels, LHCb::PackedWeightedRelations& prels ) const;
-
-  /// Pack a 'SmartRef to int' relations container
-  template <typename RELATION>
-  void packAP2IntRelationContainer( const RELATION* rels, LHCb::PackedRelations& prels ) const;
-
-  /// Pack a 'SmartRef to RelatedInfoMap' relations container
-  void packAP2RelatedInfoRelationContainer( const Part2InfoRelations* rels, LHCb::PackedRelatedInfoRelations& prels,
-                                            const std::string& location ) const;
-
-  /// Get an objects location in the TES
-  inline std::string objectLocation( const DataObject& pObj ) const {
-    return ( pObj.registry() ? pObj.registry()->identifier() : "" );
-  }
-
-  /// Copy data object version
-  template <typename INPUT, typename OUTPUT>
-  void saveVersion( const INPUT& in, OUTPUT& out ) const {
-    const int i_ver = in.version();
-    const int o_ver = out.version();
-    // sanity check
-    if ( UNLIKELY( o_ver != 0 && o_ver != i_ver ) ) {
-      std::ostringstream mess;
-      mess << objectLocation( in ) << " version " << i_ver << " != current packed version " << o_ver;
-      Warning( mess.str() ).ignore();
-    }
-    out.setVersion( i_ver );
-  }
-
-private:
-  std::string m_inputStream;  ///< Input stream root
-  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-  bool        m_deleteInput;  ///< Delete the containers after packing if true.
-  bool        m_enableCheck;  ///< Flag to turn on automatic unpacking and checking of the output post-packing
-  std::vector<std::string> m_vetoedConts; ///< Vetoed containers. Will not be packed.
-  std::vector<std::string> m_createConts; ///< Always create these containers
-  StandardPacker           m_pack;        ///< Standard packer
-};
-
-//=========================================================================
-//  Pack a 'SmartRef to SmartRef' relations container
-//=========================================================================
-template <typename RELATION>
-inline void PackParticlesAndVertices::packAP2PRelationContainer( const RELATION*        rels,
-                                                                 LHCb::PackedRelations& prels ) const {
-  // Make a new packed data object and save
-  prels.relations().emplace_back( LHCb::PackedRelation() );
-  LHCb::PackedRelation& prel = prels.relations().back();
-
-  // reference to original container and key
-  prel.container = m_pack.reference64( &prels, rels, 0 );
-
-  // First object
-  prel.start = prels.sources().size();
-
-  // reserve size
-  const auto newSize = prels.sources().size() + rels->relations().size();
-  prels.sources().reserve( newSize );
-  prels.dests().reserve( newSize );
-
-  // Loop over relations
-  for ( const auto& R : rels->relations() ) {
-    prels.sources().emplace_back( m_pack.reference64( &prels, R.from()->parent(), R.from()->key() ) );
-    prels.dests().emplace_back( m_pack.reference64( &prels, R.to()->parent(), R.to()->key() ) );
-  }
-
-  // last object
-  prel.end = prels.sources().size();
-
-  // Clear the registry address of the unpacked container, to prevent reloading
-  if ( !m_deleteInput ) rels->registry()->setAddress( 0 );
-}
-
-//=========================================================================
-//  Pack a 'SmartRef to SmartRef' relations container
-//=========================================================================
-template <typename RELATION>
-inline void PackParticlesAndVertices::packAP2PRelationContainer( const RELATION*                rels,
-                                                                 LHCb::PackedWeightedRelations& prels ) const {
-  // Make a new packed data object and save
-  prels.relations().emplace_back( LHCb::PackedRelation() );
-  LHCb::PackedRelation& prel = prels.relations().back();
-
-  // reference to original container and key
-  prel.container = m_pack.reference64( &prels, rels, 0 );
-
-  // First object
-  prel.start = prels.sources().size();
-
-  // reserve size
-  const auto newSize = prels.sources().size() + rels->relations().size();
-  prels.sources().reserve( newSize );
-  prels.dests().reserve( newSize );
-  prels.weights().reserve( newSize );
-
-  // Loop over relations
-  for ( const auto& R : rels->relations() ) {
-    prels.sources().emplace_back( m_pack.reference64( &prels, R.from()->parent(), R.from()->key() ) );
-    prels.dests().emplace_back( m_pack.reference64( &prels, R.to()->parent(), R.to()->key() ) );
-    prels.weights().emplace_back( R.weight() );
-  }
-
-  // last object
-  prel.end = prels.sources().size();
-
-  // Clear the registry address of the unpacked container, to prevent reloading
-  if ( !m_deleteInput ) rels->registry()->setAddress( 0 );
-}
-
-//=========================================================================
-//  Pack a 'SmartRef to int' relations container
-//=========================================================================
-template <typename RELATION>
-inline void PackParticlesAndVertices::packAP2IntRelationContainer( const RELATION*        rels,
-                                                                   LHCb::PackedRelations& prels ) const {
-  // Make a new packed data object and save
-  prels.relations().emplace_back( LHCb::PackedRelation() );
-  LHCb::PackedRelation& prel = prels.relations().back();
-
-  // reference to original container and key
-  prel.container = m_pack.reference64( &prels, rels, 0 );
-
-  // First object
-  prel.start = prels.sources().size();
-
-  // reserve size
-  const auto newSize = prels.sources().size() + rels->relations().size();
-  prels.sources().reserve( newSize );
-  prels.dests().reserve( newSize );
-
-  // Loop over relations
-  for ( const auto& R : rels->relations() ) {
-    prels.sources().emplace_back( m_pack.reference64( &prels, R.from()->parent(), R.from()->key() ) );
-    prels.dests().emplace_back( R.to() );
-  }
-
-  // last object
-  prel.end = prels.sources().size();
-
-  // Clear the registry address of the unpacked container, to prevent reloading
-  if ( !m_deleteInput ) rels->registry()->setAddress( 0 );
-}
-
-//==============================================================================
-// Test if a TES location is veto'ed
-//==============================================================================
-inline bool PackParticlesAndVertices::isVetoed( const std::string& id ) const {
-  const bool vetoed = ( std::find( m_vetoedConts.begin(), m_vetoedConts.end(), id ) != m_vetoedConts.end() );
-  if ( msgLevel( MSG::DEBUG ) ) {
-    if ( vetoed ) {
-      debug() << "  --> VETO'ed  ... " << id << endmsg;
-    } else {
-      debug() << "  --> Selected ... " << id << endmsg;
-    }
-  }
-  return vetoed;
-}
-
-//==============================================================================
-// Test if an output TES location should always be created
-//==============================================================================
-inline bool PackParticlesAndVertices::alwaysCreate( const std::string& id ) const {
-  return m_alwaysOutput && ( std::find( m_createConts.begin(), m_createConts.end(), id ) != m_createConts.end() );
-}
-
-#endif // PACKPARTICLESANDVERTICES_H
diff --git a/Event/EventPacker/src/component/PackProtoParticle.cpp b/Event/EventPacker/src/component/PackProtoParticle.cpp
index 284fc14436a..9ba7e0152b9 100644
--- a/Event/EventPacker/src/component/PackProtoParticle.cpp
+++ b/Event/EventPacker/src/component/PackProtoParticle.cpp
@@ -8,10 +8,6 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// local
-#include "PackProtoParticle.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackProtoParticle
@@ -19,6 +15,37 @@
 // 2008-11-13 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+#include "Event/PackedProtoParticle.h"
+#include "Event/ProtoParticle.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+
+/** @class PackProtoParticle PackProtoParticle.h
+ *  Pack a protoparticle container
+ *
+ *  @author Olivier Callot
+ *  @date   2008-11-13
+ */
+class PackProtoParticle : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackProtoParticle( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;
+  std::string m_outputName;
+  bool        m_alwaysOutput;  ///< Flag to turn on the creation of output, even when input is missing
+  bool        m_deleteInput;   ///< Flag to turn on the removal of the input data after packing
+  bool        m_enableCheck;   ///< Flag to turn on automatic unpacking and checking of the output post-packing
+  bool        m_clearRegistry; ///< Flag to turn on the clearing of the registry if the input data is not kept
+};
+//=============================================================================
+
+// Declaration of the Algorithm Factory
+DECLARE_COMPONENT( PackProtoParticle )
+
 //=============================================================================
 // Standard constructor, initializes variables
 //=============================================================================
@@ -30,7 +57,6 @@ PackProtoParticle::PackProtoParticle( const std::string& name, ISvcLocator* pSvc
   declareProperty( "DeleteInput", m_deleteInput = false );
   declareProperty( "EnableCheck", m_enableCheck = false );
   declareProperty( "ClearRegistry", m_clearRegistry = true );
-  // setProperty( "OutputLevel", 1 );
 }
 
 //=============================================================================
@@ -100,8 +126,3 @@ StatusCode PackProtoParticle::execute() {
 }
 
 //=============================================================================
-
-// Declaration of the Algorithm Factory
-DECLARE_COMPONENT( PackProtoParticle )
-
-//=============================================================================
diff --git a/Event/EventPacker/src/component/PackProtoParticle.h b/Event/EventPacker/src/component/PackProtoParticle.h
deleted file mode 100644
index b6882d41044..00000000000
--- a/Event/EventPacker/src/component/PackProtoParticle.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKPROTOPARTICLE_H
-#define PACKPROTOPARTICLE_H 1
-
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-#include "Event/PackedProtoParticle.h"
-#include "Event/ProtoParticle.h"
-
-/** @class PackProtoParticle PackProtoParticle.h
- *  Pack a protoparticle container
- *
- *  @author Olivier Callot
- *  @date   2008-11-13
- */
-class PackProtoParticle : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackProtoParticle( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;
-  std::string m_outputName;
-  bool        m_alwaysOutput;  ///< Flag to turn on the creation of output, even when input is missing
-  bool        m_deleteInput;   ///< Flag to turn on the removal of the input data after packing
-  bool        m_enableCheck;   ///< Flag to turn on automatic unpacking and checking of the output post-packing
-  bool        m_clearRegistry; ///< Flag to turn on the clearing of the registry if the input data is not kept
-};
-
-#endif // PACKPROTOPARTICLE_H
diff --git a/Event/EventPacker/src/component/PackRecVertex.cpp b/Event/EventPacker/src/component/PackRecVertex.cpp
index b1ae36b147e..6f3947f2114 100644
--- a/Event/EventPacker/src/component/PackRecVertex.cpp
+++ b/Event/EventPacker/src/component/PackRecVertex.cpp
@@ -8,13 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
 #include "Event/PackedRecVertex.h"
 #include "Event/RecVertex.h"
 #include "Event/StandardPacker.h"
-// local
-#include "PackRecVertex.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackRecVertex
@@ -22,6 +19,29 @@
 // 2008-11-14 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class PackRecVertex PackRecVertex.h
+ *
+ *  Pack the RecVertex
+ *
+ *  @author Olivier Callot
+ *  @date   2008-11-14
+ */
+class PackRecVertex : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackRecVertex( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string  m_inputName;
+  std::string  m_outputName;
+  bool         m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+  bool         m_deleteInput;  ///< Flag to turn on the removal of the input data after packing
+  unsigned int m_version;      ///< Version schema number
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( PackRecVertex )
 
diff --git a/Event/EventPacker/src/component/PackRecVertex.h b/Event/EventPacker/src/component/PackRecVertex.h
deleted file mode 100644
index cc1a88414db..00000000000
--- a/Event/EventPacker/src/component/PackRecVertex.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKRECVERTEX_H
-#define PACKRECVERTEX_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class PackRecVertex PackRecVertex.h
- *
- *  Pack the RecVertex
- *
- *  @author Olivier Callot
- *  @date   2008-11-14
- */
-class PackRecVertex : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackRecVertex( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string  m_inputName;
-  std::string  m_outputName;
-  bool         m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-  bool         m_deleteInput;  ///< Flag to turn on the removal of the input data after packing
-  unsigned int m_version;      ///< Version schema number
-};
-
-#endif // PACKRECVERTEX_H
diff --git a/Event/EventPacker/src/component/PackSTCluster.cpp b/Event/EventPacker/src/component/PackSTCluster.cpp
index 697b0509476..190da13137c 100644
--- a/Event/EventPacker/src/component/PackSTCluster.cpp
+++ b/Event/EventPacker/src/component/PackSTCluster.cpp
@@ -8,11 +8,35 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-#include "PackSTCluster.h"
+#include "Event/PackedCluster.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 
-DECLARE_COMPONENT( PackSTCluster )
+/** @class PackSTCluster PackSTCluster.h
+ *
+ *  Pack the LHCb::STCluster objects from a specified container.
+ */
+class PackSTCluster : public GaudiAlgorithm {
+
+public:
+  using GaudiAlgorithm::GaudiAlgorithm;
+
+  StatusCode execute() override;
+
+private:
+  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::STClusterLocation::TTClusters};
+
+  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::PackedClusterLocation::TT};
 
-PackSTCluster::PackSTCluster( const std::string& name, ISvcLocator* svcLocator ) : GaudiAlgorithm( name, svcLocator ) {}
+  /// Flag to turn on the removal of the input data after packing
+  Gaudi::Property<bool> m_deleteInput{this, "DeleteInput", false};
+
+  /// Flag to turn on the creation of output, even when input is missing
+  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
+
+  Gaudi::Accumulators::StatCounter<> m_nbPackedSTClusters{this, "# PackedSTClusters"};
+};
+
+DECLARE_COMPONENT( PackSTCluster )
 
 StatusCode PackSTCluster::execute() {
   if ( msgLevel( MSG::DEBUG ) ) { debug() << "==> Execute" << endmsg; }
diff --git a/Event/EventPacker/src/component/PackSTCluster.h b/Event/EventPacker/src/component/PackSTCluster.h
deleted file mode 100644
index 70c2f79fb43..00000000000
--- a/Event/EventPacker/src/component/PackSTCluster.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKSTCLUSTER_H
-#define PACKSTCLUSTER_H 1
-
-#include "Event/PackedCluster.h"
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class PackSTCluster PackSTCluster.h
- *
- *  Pack the LHCb::STCluster objects from a specified container.
- */
-class PackSTCluster : public GaudiAlgorithm {
-
-public:
-  PackSTCluster( const std::string& name, ISvcLocator* svcLocator );
-
-  StatusCode execute() override;
-
-private:
-  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::STClusterLocation::TTClusters};
-
-  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::PackedClusterLocation::TT};
-
-  /// Flag to turn on the removal of the input data after packing
-  Gaudi::Property<bool> m_deleteInput{this, "DeleteInput", false};
-
-  /// Flag to turn on the creation of output, even when input is missing
-  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
-
-  Gaudi::Accumulators::StatCounter<> m_nbPackedSTClusters{this, "# PackedSTClusters"};
-};
-
-#endif // PACKSTCLUSTER_H
diff --git a/Event/EventPacker/src/component/PackTrack.cpp b/Event/EventPacker/src/component/PackTrack.cpp
index 2133078bf24..36d5077c7ac 100644
--- a/Event/EventPacker/src/component/PackTrack.cpp
+++ b/Event/EventPacker/src/component/PackTrack.cpp
@@ -8,12 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
+#include "Event/PackedTrack.h"
 #include "Event/StandardPacker.h"
 #include "Event/Track.h"
-
-// local
-#include "PackTrack.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackTrack
@@ -21,6 +19,31 @@
 // 2008-11-12 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class PackTrack PackTrack.h
+ *
+ *  Pack a track container
+ *
+ *  @author Olivier Callot
+ *  @date   2008-11-12
+ */
+class PackTrack : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackTrack( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;    ///< Input location
+  std::string m_outputName;   ///< Output location
+  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+  bool        m_deleteInput;  ///< Flag to turn on the removal of the input data after packing
+  bool        m_enableCheck;  ///< Flag to turn on automatic unpacking and checking of the output post-packing
+
+  Gaudi::Accumulators::StatCounter<> m_nbPackedTracks{this, "# PackedTracks"};
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( PackTrack )
 
diff --git a/Event/EventPacker/src/component/PackTrack.h b/Event/EventPacker/src/component/PackTrack.h
deleted file mode 100644
index d1b8d79a354..00000000000
--- a/Event/EventPacker/src/component/PackTrack.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKTRACK_H
-#define PACKTRACK_H 1
-
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-#include "Event/PackedTrack.h"
-
-/** @class PackTrack PackTrack.h
- *
- *  Pack a track container
- *
- *  @author Olivier Callot
- *  @date   2008-11-12
- */
-class PackTrack : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackTrack( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;    ///< Input location
-  std::string m_outputName;   ///< Output location
-  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-  bool        m_deleteInput;  ///< Flag to turn on the removal of the input data after packing
-  bool        m_enableCheck;  ///< Flag to turn on automatic unpacking and checking of the output post-packing
-
-  Gaudi::Accumulators::StatCounter<> m_nbPackedTracks{this, "# PackedTracks"};
-};
-
-#endif // PACKTRACK_H
diff --git a/Event/EventPacker/src/component/PackTwoProngVertex.cpp b/Event/EventPacker/src/component/PackTwoProngVertex.cpp
index bca121d3504..df3f6e7cc9d 100644
--- a/Event/EventPacker/src/component/PackTwoProngVertex.cpp
+++ b/Event/EventPacker/src/component/PackTwoProngVertex.cpp
@@ -11,8 +11,7 @@
 #include "Event/PackedTwoProngVertex.h"
 #include "Event/StandardPacker.h"
 #include "Event/TwoProngVertex.h"
-// local
-#include "PackTwoProngVertex.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : PackTwoProngVertex
@@ -20,6 +19,26 @@
 // 2009-01-21 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class PackTwoProngVertex PackTwoProngVertex.h
+ *  Pack a two prong vertex.
+ *
+ *  @author Olivier Callot
+ *  @date   2009-01-21
+ */
+class PackTwoProngVertex : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  PackTwoProngVertex( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;
+  std::string m_outputName;
+  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( PackTwoProngVertex )
 
diff --git a/Event/EventPacker/src/component/PackTwoProngVertex.h b/Event/EventPacker/src/component/PackTwoProngVertex.h
deleted file mode 100644
index 2a7dd2b7e20..00000000000
--- a/Event/EventPacker/src/component/PackTwoProngVertex.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKTWOPRONGVERTEX_H
-#define PACKTWOPRONGVERTEX_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class PackTwoProngVertex PackTwoProngVertex.h
- *  Pack a two prong vertex.
- *
- *  @author Olivier Callot
- *  @date   2009-01-21
- */
-class PackTwoProngVertex : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  PackTwoProngVertex( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;
-  std::string m_outputName;
-  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-};
-
-#endif // PACKTWOPRONGVERTEX_H
diff --git a/Event/EventPacker/src/component/PackUTCluster.cpp b/Event/EventPacker/src/component/PackUTCluster.cpp
index dcabc032d0d..0647df736ea 100644
--- a/Event/EventPacker/src/component/PackUTCluster.cpp
+++ b/Event/EventPacker/src/component/PackUTCluster.cpp
@@ -8,11 +8,35 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-#include "PackUTCluster.h"
+#include "Event/PackedCluster.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 
-DECLARE_COMPONENT( PackUTCluster )
+/** @class PackUTCluster PackUTCluster.h
+ *
+ *  Pack the LHCb::UTCluster objects from a specified container.
+ */
+class PackUTCluster : public GaudiAlgorithm {
+
+public:
+  using GaudiAlgorithm::GaudiAlgorithm;
+
+  StatusCode execute() override;
+
+private:
+  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::UTClusterLocation::UTClusters};
+
+  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::PackedClusterLocation::UT};
 
-PackUTCluster::PackUTCluster( const std::string& name, ISvcLocator* svcLocator ) : GaudiAlgorithm( name, svcLocator ) {}
+  /// Flag to turn on the removal of the input data after packing
+  Gaudi::Property<bool> m_deleteInput{this, "DeleteInput", false};
+
+  /// Flag to turn on the creation of output, even when input is missing
+  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
+
+  Gaudi::Accumulators::StatCounter<> m_nbPackedUTClusters{this, "# PackedUTClusters"};
+};
+
+DECLARE_COMPONENT( PackUTCluster )
 
 StatusCode PackUTCluster::execute() {
   if ( msgLevel( MSG::DEBUG ) ) { debug() << "==> Execute" << endmsg; }
diff --git a/Event/EventPacker/src/component/PackUTCluster.h b/Event/EventPacker/src/component/PackUTCluster.h
deleted file mode 100644
index 586f465942c..00000000000
--- a/Event/EventPacker/src/component/PackUTCluster.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKUTCLUSTER_H
-#define PACKUTCLUSTER_H 1
-
-#include "Event/PackedCluster.h"
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class PackUTCluster PackUTCluster.h
- *
- *  Pack the LHCb::UTCluster objects from a specified container.
- */
-class PackUTCluster : public GaudiAlgorithm {
-
-public:
-  PackUTCluster( const std::string& name, ISvcLocator* svcLocator );
-
-  StatusCode execute() override;
-
-private:
-  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::UTClusterLocation::UTClusters};
-
-  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::PackedClusterLocation::UT};
-
-  /// Flag to turn on the removal of the input data after packing
-  Gaudi::Property<bool> m_deleteInput{this, "DeleteInput", false};
-
-  /// Flag to turn on the creation of output, even when input is missing
-  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
-
-  Gaudi::Accumulators::StatCounter<> m_nbPackedUTClusters{this, "# PackedUTClusters"};
-};
-
-#endif // PACKUTCLUSTER_H
diff --git a/Event/EventPacker/src/component/PackVeloCluster.cpp b/Event/EventPacker/src/component/PackVeloCluster.cpp
index c48557f1432..69fbf29010c 100644
--- a/Event/EventPacker/src/component/PackVeloCluster.cpp
+++ b/Event/EventPacker/src/component/PackVeloCluster.cpp
@@ -8,12 +8,35 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-#include "PackVeloCluster.h"
+#include "Event/PackedCluster.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 
-DECLARE_COMPONENT( PackVeloCluster )
+/** @class PackVeloCluster PackVeloCluster.h
+ *
+ *  Pack the LHCb::VeloCluster objects from a specified container.
+ */
+class PackVeloCluster : public GaudiAlgorithm {
+
+public:
+  using GaudiAlgorithm::GaudiAlgorithm;
+
+  StatusCode execute() override;
+
+private:
+  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::VeloClusterLocation::Default};
+
+  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::PackedClusterLocation::Velo};
 
-PackVeloCluster::PackVeloCluster( const std::string& name, ISvcLocator* svcLocator )
-    : GaudiAlgorithm( name, svcLocator ) {}
+  /// Flag to turn on the removal of the input data after packing
+  Gaudi::Property<bool> m_deleteInput{this, "DeleteInput", false};
+
+  /// Flag to turn on the creation of output, even when input is missing
+  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
+
+  Gaudi::Accumulators::StatCounter<> m_nbPackedSTClusters{this, "# PackedSTClusters"};
+};
+
+DECLARE_COMPONENT( PackVeloCluster )
 
 StatusCode PackVeloCluster::execute() {
   if ( msgLevel( MSG::DEBUG ) ) { debug() << "==> Execute" << endmsg; }
diff --git a/Event/EventPacker/src/component/PackVeloCluster.h b/Event/EventPacker/src/component/PackVeloCluster.h
deleted file mode 100644
index 75ce55c0df9..00000000000
--- a/Event/EventPacker/src/component/PackVeloCluster.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef PACKVELOCLUSTER_H
-#define PACKVELOCLUSTER_H 1
-
-#include "Event/PackedCluster.h"
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class PackVeloCluster PackVeloCluster.h
- *
- *  Pack the LHCb::VeloCluster objects from a specified container.
- */
-class PackVeloCluster : public GaudiAlgorithm {
-
-public:
-  PackVeloCluster( const std::string& name, ISvcLocator* svcLocator );
-
-  StatusCode execute() override;
-
-private:
-  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::VeloClusterLocation::Default};
-
-  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::PackedClusterLocation::Velo};
-
-  /// Flag to turn on the removal of the input data after packing
-  Gaudi::Property<bool> m_deleteInput{this, "DeleteInput", false};
-
-  /// Flag to turn on the creation of output, even when input is missing
-  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
-
-  Gaudi::Accumulators::StatCounter<> m_nbPackedSTClusters{this, "# PackedSTClusters"};
-};
-
-#endif // PACKVELOCLUSTER_H
diff --git a/Event/EventPacker/src/component/ReadPackedDst.cpp b/Event/EventPacker/src/component/ReadPackedDst.cpp
index b5ade60dd71..daa7f71c2fc 100644
--- a/Event/EventPacker/src/component/ReadPackedDst.cpp
+++ b/Event/EventPacker/src/component/ReadPackedDst.cpp
@@ -1,5 +1,5 @@
 /*****************************************************************************\
-* (c) Copyright 2000-2020 CERN for the benefit of the LHCb Collaboration      *
+* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
 *                                                                             *
 * This software is distributed under the terms of the GNU General Public      *
 * Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
@@ -8,16 +8,6 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// from Gaudi
-#include "GaudiKernel/IOpaqueAddress.h"
-#include "GaudiKernel/SmartIF.h"
-
-// Kernel
-#include "Event/StandardPacker.h"
-
-// Event
 #include "Event/ODIN.h"
 #include "Event/PackedCaloCluster.h"
 #include "Event/PackedCaloHypo.h"
@@ -31,12 +21,20 @@
 #include "Event/PackedVertex.h"
 #include "Event/PackedWeightsVector.h"
 #include "Event/ProcStatus.h"
+#include "Event/RawBank.h"
 #include "Event/RawEvent.h"
 #include "Event/RecHeader.h"
 #include "Event/RecSummary.h"
-
-// local
-#include "ReadPackedDst.h"
+#include "Event/StandardPacker.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "GaudiAlg/IGenericTool.h"
+#include "GaudiKernel/IAddressCreator.h"
+#include "GaudiKernel/IDataManagerSvc.h"
+#include "GaudiKernel/IOpaqueAddress.h"
+#include "GaudiKernel/LinkManager.h"
+#include "GaudiKernel/SmartIF.h"
+#include "GaudiKernel/ToolHandle.h"
+#include "Kernel/STLExtensions.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : ReadPackedDst
@@ -44,6 +42,67 @@
 // 2009-01-19 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class ReadPackedDst ReadPackedDst.h
+ *  This is the unpacker of DAQEVent containing the DST data
+ *
+ *  @author Olivier Callot
+ *  @date   2009-01-19
+ */
+class ReadPackedDst : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  ReadPackedDst( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode initialize() override; ///< Algorithm initialization
+  StatusCode finalize() override;   ///< Algorithm finalization
+  StatusCode execute() override;    ///< Algorithm execution
+
+protected:
+  //== extract a string from the buffer
+  std::string stringFromData() {
+    unsigned int len = *m_data++;
+    m_size--;
+    if ( 0 == len ) return "";
+    len = len / 4 + 1;
+    std::string value( (char*)m_data );
+    m_data += len;
+    m_size -= len;
+    return value;
+  }
+
+  //== extract an int from the buffer
+  int nextInt() {
+    m_size--;
+    return *m_data++;
+  }
+
+  //== Extract the linkMgr information and set the version
+  void processLinks( DataObject* obj, unsigned char version ) {
+    DataObject*  dummy   = 0;
+    unsigned int nbLinks = *m_data++;
+    m_size--;
+    for ( unsigned int kk = 0; nbLinks > kk; ++kk ) {
+      std::string name = stringFromData();
+      obj->linkMgr()->addLink( name, dummy );
+    }
+    obj->setVersion( version );
+  }
+
+  //== Fill a vector of objects CLASS from the buffer and the blobs.
+  template <class CLASS>
+  void getFromBlob( std::vector<CLASS>& vect, LHCb::span<const LHCb::RawBank*> blobs );
+
+private:
+  std::string              m_inputLocation;
+  std::string              m_postfix;
+  const unsigned int*      m_data = nullptr;
+  int                      m_size{0};
+  ToolHandle<IGenericTool> m_odinDecoder;
+  SmartIF<IAddressCreator> m_addrCreator;
+  SmartIF<IDataManagerSvc> m_evtMgr;
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( ReadPackedDst )
 
diff --git a/Event/EventPacker/src/component/ReadPackedDst.h b/Event/EventPacker/src/component/ReadPackedDst.h
deleted file mode 100644
index 14d78556f62..00000000000
--- a/Event/EventPacker/src/component/ReadPackedDst.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef READPACKEDDST_H
-#define READPACKEDDST_H 1
-
-#include "Event/RawBank.h"
-#include "Kernel/STLExtensions.h"
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-#include "GaudiAlg/IGenericTool.h"
-#include "GaudiKernel/IAddressCreator.h"
-#include "GaudiKernel/IDataManagerSvc.h"
-#include "GaudiKernel/LinkManager.h"
-#include "GaudiKernel/SmartIF.h"
-#include "GaudiKernel/ToolHandle.h"
-
-/** @class ReadPackedDst ReadPackedDst.h
- *  This is the unpacker of DAQEVent containing the DST data
- *
- *  @author Olivier Callot
- *  @date   2009-01-19
- */
-class ReadPackedDst : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  ReadPackedDst( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode initialize() override; ///< Algorithm initialization
-  StatusCode finalize() override;   ///< Algorithm finalization
-  StatusCode execute() override;    ///< Algorithm execution
-
-protected:
-  //== extract a string from the buffer
-  std::string stringFromData() {
-    unsigned int len = *m_data++;
-    m_size--;
-    if ( 0 == len ) return "";
-    len = len / 4 + 1;
-    std::string value( (char*)m_data );
-    m_data += len;
-    m_size -= len;
-    return value;
-  }
-
-  //== extract an int from the buffer
-  int nextInt() {
-    m_size--;
-    return *m_data++;
-  }
-
-  //== Extract the linkMgr information and set the version
-  void processLinks( DataObject* obj, unsigned char version ) {
-    DataObject*  dummy   = 0;
-    unsigned int nbLinks = *m_data++;
-    m_size--;
-    for ( unsigned int kk = 0; nbLinks > kk; ++kk ) {
-      std::string name = stringFromData();
-      obj->linkMgr()->addLink( name, dummy );
-    }
-    obj->setVersion( version );
-  }
-
-  //== Fill a vector of objects CLASS from the buffer and the blobs.
-  template <class CLASS>
-  void getFromBlob( std::vector<CLASS>& vect, LHCb::span<const LHCb::RawBank*> blobs );
-
-private:
-  std::string              m_inputLocation;
-  std::string              m_postfix;
-  const unsigned int*      m_data = nullptr;
-  int                      m_size{0};
-  ToolHandle<IGenericTool> m_odinDecoder;
-  SmartIF<IAddressCreator> m_addrCreator;
-  SmartIF<IDataManagerSvc> m_evtMgr;
-};
-#endif // READPACKEDDST_H
diff --git a/Event/EventPacker/src/component/TrackClustersMapper.cpp b/Event/EventPacker/src/component/TrackClustersMapper.cpp
index 5783cf91117..102ea7f2085 100644
--- a/Event/EventPacker/src/component/TrackClustersMapper.cpp
+++ b/Event/EventPacker/src/component/TrackClustersMapper.cpp
@@ -8,11 +8,11 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// Include files
+#include "Event/PackedCluster.h"
+#include "MapperToolBase.h"
 #include <iterator>
-// local
-#include "TrackClustersMapper.h"
+#include <map>
+#include <string>
 
 // ----------------------------------------------------------------------------
 // Implementation file for class: ParticlesAndVerticesMapper
@@ -20,6 +20,69 @@
 // 17/01/2012: Marco Clemencic
 // ----------------------------------------------------------------------------
 
+/** @class TrackClustersMapper TrackClustersMapper.h
+ *
+ *  Tool for mappings for Track clusters
+ *
+ * @author Chris Jones
+ * @date 26/03/2012
+ */
+class TrackClustersMapper : public MapperToolBase {
+
+public:
+  /// Standard constructor
+  TrackClustersMapper( const std::string& type, const std::string& name, const IInterface* parent );
+
+public:
+  /** Returns the correctly configured and name instance of the
+   *  Clusters unpacker, for the given path
+   */
+  Gaudi::Utils::TypeNameString algorithmForPath( const std::string& path ) override;
+
+public:
+  /** Instruct the DataOnDemandSvc to create DataObjects for the
+   *  intermediate levels of a path we can handle.
+   */
+  std::string nodeTypeForPath( const std::string& path ) override;
+
+private:
+  /// Add a path to the node type mappings
+  void addPath( const std::string& path );
+
+  /// Check if a given path is in the list of data locations created
+  inline bool pathIsHandled( const std::string& path ) const {
+    // See if we have an entry for this path
+    const auto it = m_nodeTypeMap.find( fixPath( path ) );
+    return ( it != m_nodeTypeMap.end() );
+  }
+
+  /// Check the node mappings are updated for the given path stream
+  void updateNodeTypeMap( const std::string& path );
+
+  /// Get the location of the packed clusters for the given stream
+  std::string packedClustersLocation( const std::string& stream ) const {
+    return stream + "/" + LHCb::PackedClusterLocation::Default;
+  }
+
+private:
+  /// Map to say which stream roots have been configured
+  std::map<std::string, bool> m_streamsDone;
+
+  /// Mapping between TES path and node type
+  typedef std::map<std::string, std::string> NodeTypeMap;
+  NodeTypeMap                                m_nodeTypeMap;
+
+  /// Unpacker class type
+  std::string m_unpackerType;
+
+  /// Outputlevel for unpackers created
+  int m_unpackersOutputLevel;
+};
+
+// ============================================================================
+
+DECLARE_COMPONENT( TrackClustersMapper )
+
 // ============================================================================
 // Standard constructor, initializes variables
 // ============================================================================
@@ -27,7 +90,6 @@ TrackClustersMapper::TrackClustersMapper( const std::string& type, const std::st
     : MapperToolBase( type, name, parent ) {
   declareProperty( "UnpackerType", m_unpackerType = "UnpackCluster" );
   declareProperty( "UnpackerOutputLevel", m_unpackersOutputLevel = -1 );
-  // setProperty( "OutputLevel", 1 );
 }
 
 // ============================================================================
@@ -128,7 +190,3 @@ void TrackClustersMapper::addPath( const std::string& path ) {
 }
 
 // ============================================================================
-
-DECLARE_COMPONENT( TrackClustersMapper )
-
-// ============================================================================
diff --git a/Event/EventPacker/src/component/TrackClustersMapper.h b/Event/EventPacker/src/component/TrackClustersMapper.h
deleted file mode 100644
index 933a2a4d7a4..00000000000
--- a/Event/EventPacker/src/component/TrackClustersMapper.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef SRC_TrackClustersMapper_H
-#define SRC_TrackClustersMapper_H 1
-
-#include <map>
-#include <string>
-
-// base class
-#include "MapperToolBase.h"
-
-// Event model
-#include "Event/PackedCluster.h"
-
-class IJobOptionsSvc;
-
-/** @class TrackClustersMapper TrackClustersMapper.h
- *
- *  Tool for mappings for Track clusters
- *
- * @author Chris Jones
- * @date 26/03/2012
- */
-class TrackClustersMapper : public MapperToolBase {
-
-public:
-  /// Standard constructor
-  TrackClustersMapper( const std::string& type, const std::string& name, const IInterface* parent );
-
-public:
-  /** Returns the correctly configured and name instance of the
-   *  Clusters unpacker, for the given path
-   */
-  Gaudi::Utils::TypeNameString algorithmForPath( const std::string& path ) override;
-
-public:
-  /** Instruct the DataOnDemandSvc to create DataObjects for the
-   *  intermediate levels of a path we can handle.
-   */
-  std::string nodeTypeForPath( const std::string& path ) override;
-
-private:
-  /// Add a path to the node type mappings
-  void addPath( const std::string& path );
-
-  /// Check if a given path is in the list of data locations created
-  inline bool pathIsHandled( const std::string& path ) const {
-    // See if we have an entry for this path
-    const auto it = m_nodeTypeMap.find( fixPath( path ) );
-    return ( it != m_nodeTypeMap.end() );
-  }
-
-  /// Check the node mappings are updated for the given path stream
-  void updateNodeTypeMap( const std::string& path );
-
-  /// Get the location of the packed clusters for the given stream
-  std::string packedClustersLocation( const std::string& stream ) const {
-    return stream + "/" + LHCb::PackedClusterLocation::Default;
-  }
-
-private:
-  /// Map to say which stream roots have been configured
-  std::map<std::string, bool> m_streamsDone;
-
-  /// Mapping between TES path and node type
-  typedef std::map<std::string, std::string> NodeTypeMap;
-  NodeTypeMap                                m_nodeTypeMap;
-
-  /// Unpacker class type
-  std::string m_unpackerType;
-
-  /// Outputlevel for unpackers created
-  int m_unpackersOutputLevel;
-};
-
-#endif // SRC_TrackClustersMapper_H
diff --git a/Event/EventPacker/src/component/UnpackCaloHypo.cpp b/Event/EventPacker/src/component/UnpackCaloHypo.cpp
index aece166d198..6f357c42371 100644
--- a/Event/EventPacker/src/component/UnpackCaloHypo.cpp
+++ b/Event/EventPacker/src/component/UnpackCaloHypo.cpp
@@ -8,11 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
+#include "Event/CaloHypo.h"
+#include "Event/PackedCaloHypo.h"
 #include "Event/StandardPacker.h"
-
-// local
-#include "UnpackCaloHypo.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : UnpackCaloHypo
@@ -20,6 +19,31 @@
 // 2008-11-14 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @brief Unpack a PackedCaloHypo container to CaloHypos.
+ *
+ *  @author Olivier Callot
+ *  @date   2008-11-14
+ */
+class UnpackCaloHypo : public GaudiAlgorithm {
+
+public:
+  using GaudiAlgorithm::GaudiAlgorithm;
+  StatusCode execute() override;
+
+private:
+  DataObjectReadHandle<LHCb::PackedCaloHypos> m_packedHypos{this, "InputName", LHCb::PackedCaloHypoLocation::Electrons};
+  DataObjectWriteHandle<LHCb::CaloHypos>      m_hypos{this, "OutputName", LHCb::CaloHypoLocation::Electrons};
+  Gaudi::Property<bool>                       m_alwaysOutput{this, "AlwaysCreateOutput", false,
+                                       "Flag to turn on the creation of output, even when input is missing"};
+};
+
+//=============================================================================
+
+// Declaration of the Algorithm Factory
+DECLARE_COMPONENT( UnpackCaloHypo )
+
+//=============================================================================
+
 StatusCode UnpackCaloHypo::execute() {
   if ( msgLevel( MSG::DEBUG ) ) debug() << "==> Execute" << endmsg;
 
@@ -33,15 +57,9 @@ StatusCode UnpackCaloHypo::execute() {
   auto* newCaloHypos = m_hypos.put( std::make_unique<LHCb::CaloHypos>() );
 
   // unpack
-  const LHCb::CaloHypoPacker packer( this );
-  packer.unpack( *dst, *newCaloHypos );
+  LHCb::CaloHypoPacker{this}.unpack( *dst, *newCaloHypos );
 
   return StatusCode::SUCCESS;
 }
 
 //=============================================================================
-
-// Declaration of the Algorithm Factory
-DECLARE_COMPONENT( UnpackCaloHypo )
-
-//=============================================================================
diff --git a/Event/EventPacker/src/component/UnpackCaloHypo.h b/Event/EventPacker/src/component/UnpackCaloHypo.h
deleted file mode 100644
index b8c5b03554b..00000000000
--- a/Event/EventPacker/src/component/UnpackCaloHypo.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKCALOHYPO_H
-#define UNPACKCALOHYPO_H 1
-
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-#include "Event/CaloHypo.h"
-#include "Event/PackedCaloHypo.h"
-
-/** @brief Unpack a PackedCaloHypo container to CaloHypos.
- *
- *  @author Olivier Callot
- *  @date   2008-11-14
- */
-class UnpackCaloHypo : public GaudiAlgorithm {
-
-public:
-  using GaudiAlgorithm::GaudiAlgorithm;
-  StatusCode execute() override;
-
-private:
-  DataObjectReadHandle<LHCb::PackedCaloHypos> m_packedHypos{this, "InputName", LHCb::PackedCaloHypoLocation::Electrons};
-  DataObjectWriteHandle<LHCb::CaloHypos>      m_hypos{this, "OutputName", LHCb::CaloHypoLocation::Electrons};
-  Gaudi::Property<bool>                       m_alwaysOutput{this, "AlwaysCreateOutput", false,
-                                       "Flag to turn on the creation of output, even when input is missing"};
-};
-
-#endif // UNPACKCALOHYPO_H
diff --git a/Event/EventPacker/src/component/UnpackCluster.cpp b/Event/EventPacker/src/component/UnpackCluster.cpp
index c69f33ff392..15b2cb3b4b2 100644
--- a/Event/EventPacker/src/component/UnpackCluster.cpp
+++ b/Event/EventPacker/src/component/UnpackCluster.cpp
@@ -8,11 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
+#include "Event/PackedCluster.h"
 #include "Event/STCluster.h"
 #include "Event/VeloCluster.h"
-// local
-#include "UnpackCluster.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : UnpackCluster
@@ -20,6 +19,60 @@
 // 2012-03-06 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class UnpackCluster UnpackCluster.h
+ *  UNpack the clusters for Velo and ST
+ *
+ *  @author Olivier Callot
+ *  @date   2012-03-06
+ */
+class UnpackCluster : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  UnpackCluster( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  /// Create and access Velo clusters on demand
+  LHCb::VeloClusters* vClus() {
+    if ( !m_vClus ) { put( m_vClus = new LHCb::VeloClusters(), LHCb::VeloClusterLocation::Default + m_extension ); }
+    return m_vClus;
+  }
+
+  /// Create and access TT Clusters on demand
+  LHCb::STClusters* ttClus() {
+    if ( !m_ttClus ) { put( m_ttClus = new LHCb::STClusters(), LHCb::STClusterLocation::TTClusters + m_extension ); }
+    return m_ttClus;
+  }
+
+  /// Create and access UT Clusters on demand
+  LHCb::UTClusters* utClus() {
+    if ( !m_utClus ) { put( m_utClus = new LHCb::UTClusters(), LHCb::UTClusterLocation::UTClusters + m_extension ); }
+    return m_utClus;
+  }
+
+  /// Create and access IT Clusters on demand
+  LHCb::STClusters* itClus() {
+    if ( !m_itClus ) { put( m_itClus = new LHCb::STClusters(), LHCb::STClusterLocation::ITClusters + m_extension ); }
+    return m_itClus;
+  }
+
+private:
+  std::string m_inputName;    ///< Input name of packed clusters
+  std::string m_extension;    ///< Name extension (for testing)
+  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+
+  /// Check to prevent recursive calls to this, due to the multiple possible outputs
+  bool m_running = false;
+
+  // Cache pointers to containers, for on-demand creation
+  LHCb::VeloClusters* m_vClus  = nullptr; ///< Velo clusters
+  LHCb::STClusters*   m_ttClus = nullptr; ///< TT Clusters
+  LHCb::UTClusters*   m_utClus = nullptr; ///< UT Clusters
+  LHCb::STClusters*   m_itClus = nullptr; ///< IT Clusters
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( UnpackCluster )
 
@@ -39,8 +92,8 @@ UnpackCluster::UnpackCluster( const std::string& name, ISvcLocator* pSvcLocator
 //=============================================================================
 namespace {
   template <class TYPE>
-  inline bool compareKeys( const TYPE* a, const TYPE* b ) {
-    return ( a->key() < b->key() );
+  bool compareKeys( const TYPE* a, const TYPE* b ) {
+    return a->key() < b->key();
   }
 } // namespace
 
diff --git a/Event/EventPacker/src/component/UnpackCluster.h b/Event/EventPacker/src/component/UnpackCluster.h
deleted file mode 100644
index 56ead2fed8e..00000000000
--- a/Event/EventPacker/src/component/UnpackCluster.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKCLUSTER_H
-#define UNPACKCLUSTER_H 1
-
-// from Gaudi
-#include "Event/PackedCluster.h"
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class UnpackCluster UnpackCluster.h
- *  UNpack the clusters for Velo and ST
- *
- *  @author Olivier Callot
- *  @date   2012-03-06
- */
-class UnpackCluster : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  UnpackCluster( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  /// Create and access Velo clusters on demand
-  LHCb::VeloClusters* vClus() {
-    if ( !m_vClus ) { put( m_vClus = new LHCb::VeloClusters(), LHCb::VeloClusterLocation::Default + m_extension ); }
-    return m_vClus;
-  }
-
-  /// Create and access TT Clusters on demand
-  LHCb::STClusters* ttClus() {
-    if ( !m_ttClus ) { put( m_ttClus = new LHCb::STClusters(), LHCb::STClusterLocation::TTClusters + m_extension ); }
-    return m_ttClus;
-  }
-
-  /// Create and access UT Clusters on demand
-  LHCb::UTClusters* utClus() {
-    if ( !m_utClus ) { put( m_utClus = new LHCb::UTClusters(), LHCb::UTClusterLocation::UTClusters + m_extension ); }
-    return m_utClus;
-  }
-
-  /// Create and access IT Clusters on demand
-  LHCb::STClusters* itClus() {
-    if ( !m_itClus ) { put( m_itClus = new LHCb::STClusters(), LHCb::STClusterLocation::ITClusters + m_extension ); }
-    return m_itClus;
-  }
-
-private:
-  std::string m_inputName;    ///< Input name of packed clusters
-  std::string m_extension;    ///< Name extension (for testing)
-  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-
-  /// Check to prevent recursive calls to this, due to the multiple possible outputs
-  bool m_running = false;
-
-  // Cache pointers to containers, for on-demand creation
-  LHCb::VeloClusters* m_vClus  = nullptr; ///< Velo clusters
-  LHCb::STClusters*   m_ttClus = nullptr; ///< TT Clusters
-  LHCb::UTClusters*   m_utClus = nullptr; ///< UT Clusters
-  LHCb::STClusters*   m_itClus = nullptr; ///< IT Clusters
-};
-
-#endif // UNPACKCLUSTER_H
diff --git a/Event/EventPacker/src/component/UnpackDecReport.cpp b/Event/EventPacker/src/component/UnpackDecReport.cpp
index 9c6a366b6cb..4fc802e71bb 100644
--- a/Event/EventPacker/src/component/UnpackDecReport.cpp
+++ b/Event/EventPacker/src/component/UnpackDecReport.cpp
@@ -8,17 +8,11 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// from Gaudi
-#include "GaudiKernel/LinkManager.h"
-
 #include "Event/HltDecReports.h"
 #include "Event/PackedDecReport.h"
 #include "Event/StandardPacker.h"
-
-// local
-#include "UnpackDecReport.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "GaudiKernel/LinkManager.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : UnpackDecReport
@@ -26,6 +20,28 @@
 // 2012-01-23 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class UnpackDecReport UnpackDecReport.h
+ *
+ *  Unpacks DecReports
+ *
+ *  @author Olivier Callot
+ *  @date   2012-01-23
+ */
+class UnpackDecReport : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  UnpackDecReport( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;
+  std::string m_outputName;
+
+  bool m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( UnpackDecReport )
 
diff --git a/Event/EventPacker/src/component/UnpackDecReport.h b/Event/EventPacker/src/component/UnpackDecReport.h
deleted file mode 100644
index 95367b31352..00000000000
--- a/Event/EventPacker/src/component/UnpackDecReport.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKDECREPORT_H
-#define UNPACKDECREPORT_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class UnpackDecReport UnpackDecReport.h
- *
- *  Unpacks DecReports
- *
- *  @author Olivier Callot
- *  @date   2012-01-23
- */
-class UnpackDecReport : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  UnpackDecReport( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;
-  std::string m_outputName;
-
-  bool m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-};
-
-#endif // UNPACKDECREPORT_H
diff --git a/Event/EventPacker/src/component/UnpackMCParticle.cpp b/Event/EventPacker/src/component/UnpackMCParticle.cpp
index c501e890450..b7f5b0271cd 100644
--- a/Event/EventPacker/src/component/UnpackMCParticle.cpp
+++ b/Event/EventPacker/src/component/UnpackMCParticle.cpp
@@ -8,13 +8,11 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-#include "UnpackMCParticle.h"
-
 #include "Event/MCParticle.h"
 #include "Event/PackedMCParticle.h"
 #include "Event/StandardPacker.h"
-
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "GaudiKernel/DataHandle.h"
 #include <algorithm>
 #include <memory>
 
@@ -24,6 +22,28 @@
 // 2005-03-18 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/**
+ * The algorithm provides access to previously packed MC particles at a TES location.
+ * It reads a location of packed MC particles and converts them to LHCb::MCParticle
+ * together with the associated LHCb::MCVertex which is unpacked by the algorithm UnpackMCVertex
+ *
+ *  @author Olivier Callot
+ *  @date   2005-03-18
+ */
+class UnpackMCParticle : public GaudiAlgorithm {
+
+public:
+  using GaudiAlgorithm::GaudiAlgorithm;
+  StatusCode execute() override;
+
+private:
+  DataObjectReadHandle<LHCb::PackedMCParticles> m_packedMCParticles{this, "InputName",
+                                                                    LHCb::PackedMCParticleLocation::Default};
+  DataObjectWriteHandle<LHCb::MCParticles>      m_MCParticles{this, "OutputName", LHCb::MCParticleLocation::Default};
+  Gaudi::Property<bool>                         m_alwaysOutput{this, "AlwaysCreateOutput", false,
+                                       "Flag to turn on the creation of output, even when input is missing"};
+};
+
 DECLARE_COMPONENT( UnpackMCParticle )
 
 StatusCode UnpackMCParticle::execute() {
@@ -69,8 +89,7 @@ StatusCode UnpackMCParticle::execute() {
     int hintID( 0 ), key( 0 );
     if ( ( 0 == pVer && pack.hintAndKey32( src.originVertex, dst, newMCParticles, hintID, key ) ) ||
          ( 0 != pVer && pack.hintAndKey64( src.originVertex, dst, newMCParticles, hintID, key ) ) ) {
-      SmartRef<LHCb::MCVertex> ref( newMCParticles, hintID, key );
-      part->setOriginVertex( ref );
+      part->setOriginVertex( {newMCParticles, hintID, key} );
     } else {
       Error( "Corrupt MCParticle Origin MCVertex SmartRef detected" ).ignore();
     }
@@ -90,9 +109,8 @@ StatusCode UnpackMCParticle::execute() {
         if ( ( 0 == pVer && pack.hintAndKey32( I, dst, newMCParticles, hintID, key ) ) ||
              ( 0 != pVer && pack.hintAndKey64( I, dst, newMCParticles, hintID, key ) ) ) {
           // Construct the smart ref
-          SmartRef<LHCb::MCVertex> ref( newMCParticles, hintID, key );
           // save
-          part->addToEndVertices( ref );
+          part->addToEndVertices( {newMCParticles, hintID, key} );
         } else {
           Error( "Corrupt MCParticle End MCVertex SmartRef detected" ).ignore();
         }
diff --git a/Event/EventPacker/src/component/UnpackMCParticle.h b/Event/EventPacker/src/component/UnpackMCParticle.h
deleted file mode 100644
index 878a1242633..00000000000
--- a/Event/EventPacker/src/component/UnpackMCParticle.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKMCPARTICLE_H
-#define UNPACKMCPARTICLE_H 1
-
-#include "Event/MCParticle.h"
-#include "Event/PackedMCParticle.h"
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-#include "GaudiKernel/DataHandle.h"
-
-/**
- * The algorithm provides access to previously packed MC particles at a TES location.
- * It reads a location of packed MC particles and converts them to LHCb::MCParticle
- * together with the associated LHCb::MCVertex which is unpacked by the algorithm UnpackMCVertex
- *
- *  @author Olivier Callot
- *  @date   2005-03-18
- */
-class UnpackMCParticle : public GaudiAlgorithm {
-
-public:
-  using GaudiAlgorithm::GaudiAlgorithm;
-  StatusCode execute() override;
-
-private:
-  DataObjectReadHandle<LHCb::PackedMCParticles> m_packedMCParticles{this, "InputName",
-                                                                    LHCb::PackedMCParticleLocation::Default};
-  DataObjectWriteHandle<LHCb::MCParticles>      m_MCParticles{this, "OutputName", LHCb::MCParticleLocation::Default};
-  Gaudi::Property<bool>                         m_alwaysOutput{this, "AlwaysCreateOutput", false,
-                                       "Flag to turn on the creation of output, even when input is missing"};
-};
-
-#endif // UNPACKMCPARTICLE_H
diff --git a/Event/EventPacker/src/component/UnpackMCVertex.cpp b/Event/EventPacker/src/component/UnpackMCVertex.cpp
index a81963eed3b..1d0268c38b1 100644
--- a/Event/EventPacker/src/component/UnpackMCVertex.cpp
+++ b/Event/EventPacker/src/component/UnpackMCVertex.cpp
@@ -8,13 +8,11 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-#include "UnpackMCVertex.h"
-
 #include "Event/MCVertex.h"
 #include "Event/PackedMCVertex.h"
 #include "Event/StandardPacker.h"
-
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "GaudiKernel/DataHandle.h"
 #include <algorithm>
 #include <memory>
 
@@ -24,6 +22,28 @@
 // 2005-03-18 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/**
+ * The algorithm provides access to previously packed MC vertices at a TES location.
+ * It reads a location of packed MC vertices and converts them to LHCb::MCVertex
+ * together with the associated LHCb::MCParticle which is unpacked by the algorithm UnpackMCParticle
+ *
+ *  @author Olivier Callot
+ *  @date   2005-03-18
+ */
+class UnpackMCVertex : public GaudiAlgorithm {
+
+public:
+  using GaudiAlgorithm::GaudiAlgorithm;
+  StatusCode execute() override;
+
+private:
+  DataObjectReadHandle<LHCb::PackedMCVertices> m_packedMCVertices{this, "InputName",
+                                                                  LHCb::PackedMCVertexLocation::Default};
+  DataObjectWriteHandle<LHCb::MCVertices>      m_MCVertices{this, "OutputName", LHCb::MCVertexLocation::Default};
+  Gaudi::Property<bool>                        m_alwaysOutput{this, "AlwaysCreateOutput", false,
+                                       "Flag to turn on the creation of output, even when input is missing"};
+};
+
 DECLARE_COMPONENT( UnpackMCVertex )
 
 StatusCode UnpackMCVertex::execute() {
@@ -56,8 +76,7 @@ StatusCode UnpackMCVertex::execute() {
     if ( -1 != src.mother ) {
       if ( ( 0 == pVer && pack.hintAndKey32( src.mother, dst, newMCVertices, hintID, key ) ) ||
            ( 0 != pVer && pack.hintAndKey64( src.mother, dst, newMCVertices, hintID, key ) ) ) {
-        SmartRef<LHCb::MCParticle> ref( newMCVertices, hintID, key );
-        vert->setMother( ref );
+        vert->setMother( {newMCVertices, hintID, key} );
       } else {
         Error( "Corrupt MCVertex Mother MCParticle SmartRef detected" ).ignore();
       }
@@ -77,10 +96,7 @@ StatusCode UnpackMCVertex::execute() {
         hintID = key = 0;
         if ( ( 0 == pVer && pack.hintAndKey32( I, dst, newMCVertices, hintID, key ) ) ||
              ( 0 != pVer && pack.hintAndKey64( I, dst, newMCVertices, hintID, key ) ) ) {
-          // Construct the smart ref
-          SmartRef<LHCb::MCParticle> ref( newMCVertices, hintID, key );
-          // save
-          vert->addToProducts( ref );
+          vert->addToProducts( {newMCVertices, hintID, key} );
         } else {
           Error( "Corrupt MCVertex Daughter MCParticle SmartRef detected" ).ignore();
         }
diff --git a/Event/EventPacker/src/component/UnpackMCVertex.h b/Event/EventPacker/src/component/UnpackMCVertex.h
deleted file mode 100644
index 81f5adb8522..00000000000
--- a/Event/EventPacker/src/component/UnpackMCVertex.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKMCVERTEX_H
-#define UNPACKMCVERTEX_H 1
-
-#include "Event/MCVertex.h"
-#include "Event/PackedMCVertex.h"
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-#include "GaudiKernel/DataHandle.h"
-
-/**
- * The algorithm provides access to previously packed MC vertices at a TES location.
- * It reads a location of packed MC vertices and converts them to LHCb::MCVertex
- * together with the associated LHCb::MCParticle which is unpacked by the algorithm UnpackMCParticle
- *
- *  @author Olivier Callot
- *  @date   2005-03-18
- */
-class UnpackMCVertex : public GaudiAlgorithm {
-
-public:
-  using GaudiAlgorithm::GaudiAlgorithm;
-  StatusCode execute() override;
-
-private:
-  DataObjectReadHandle<LHCb::PackedMCVertices> m_packedMCVertices{this, "InputName",
-                                                                  LHCb::PackedMCVertexLocation::Default};
-  DataObjectWriteHandle<LHCb::MCVertices>      m_MCVertices{this, "OutputName", LHCb::MCVertexLocation::Default};
-  Gaudi::Property<bool>                        m_alwaysOutput{this, "AlwaysCreateOutput", false,
-                                       "Flag to turn on the creation of output, even when input is missing"};
-};
-
-#endif // UNPACKMCVERTEX_H
diff --git a/Event/EventPacker/src/component/UnpackParticlesAndVertices.cpp b/Event/EventPacker/src/component/UnpackParticlesAndVertices.cpp
index 9f7c899351b..86edf7c5a00 100644
--- a/Event/EventPacker/src/component/UnpackParticlesAndVertices.cpp
+++ b/Event/EventPacker/src/component/UnpackParticlesAndVertices.cpp
@@ -8,10 +8,32 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
+#include "Event/FlavourTag.h"
+#include "Event/MCParticle.h"
+#include "Event/MuonPID.h"
+#include "Event/PackedFlavourTag.h"
+#include "Event/PackedMuonPID.h"
+#include "Event/PackedPartToRelatedInfoRelation.h"
+#include "Event/PackedParticle.h"
+#include "Event/PackedProtoParticle.h"
+#include "Event/PackedRecVertex.h"
+#include "Event/PackedRelations.h"
+#include "Event/PackedRichPID.h"
+#include "Event/PackedTrack.h"
+#include "Event/PackedVertex.h"
+#include "Event/Particle.h"
+#include "Event/ProtoParticle.h"
 #include "Event/RecVertex.h"
-// local
-#include "UnpackParticlesAndVertices.h"
+#include "Event/RelatedInfoMap.h"
+#include "Event/RichPID.h"
+#include "Event/StandardPacker.h"
+#include "Event/Track.h"
+#include "Event/Vertex.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
+#include "Kernel/Particle2LHCbIDs.h"
+#include "Relations/Relation1D.h"
+#include "Relations/RelationWeighted1D.h"
+#include <memory>
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : UnpackParticlesAndVertices
@@ -19,6 +41,235 @@
 // 2012-01-23 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class UnpackParticlesAndVertices UnpackParticlesAndVertices.h
+ *
+ *  Unpacks all Packed Particles and related objects
+ *
+ *  @author Olivier Callot
+ *  @date   2012-01-23
+ */
+class UnpackParticlesAndVertices : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  UnpackParticlesAndVertices( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  template <class FROM, class TO, class FROMCONT, class TOCONT>
+  void unpackP2PRelations( const std::string& location );
+
+  template <class FROM, class TO, class FROMCONT, class TOCONT, class WEIGHT>
+  void unpackP2PWeightedRelations( const std::string& location );
+
+  template <class FROM, class TO, class FROMCONT>
+  void unpackP2IntRelations( const std::string& location );
+
+private:
+  std::string m_inputStream; ///< Input stream root
+
+  std::string m_postFix;
+
+  StandardPacker m_pack{this}; ///< Standard Packer
+
+  /// Track packer
+  const LHCb::TrackPacker m_trackPacker{this};
+  /// Muon PID packer
+  const LHCb::MuonPIDPacker m_muonPacker{this};
+  /// Rich PID packer
+  const LHCb::RichPIDPacker m_richPacker{this};
+  /// ProtoParticle packer
+  const LHCb::ProtoParticlePacker m_protoPacker{this};
+  /// Particle Packer
+  const LHCb::ParticlePacker m_partPacker{this};
+  /// Vertex Packer
+  const LHCb::VertexPacker m_vertPacker{this};
+  /// Flavour Tag Packer
+  const LHCb::FlavourTagPacker m_ftPacker{this};
+  /// Rec Vertex Packer
+  const LHCb::RecVertexPacker m_rvPacker{this};
+  /// Related Info Packer
+  const LHCb::RelatedInfoRelationsPacker m_rInfoPacker{this};
+
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedTracks{this, "# UnPacked Tracks"};
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedMuonPIDs{this, "# UnPacked MuonPIDs"};
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedRichPIDs{this, "# UnPacked RichPIDs"};
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedProtoParticles{this, "# UnPacked ProtoParticles"};
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedParticles{this, "# UnPacked Particles"};
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedVertices{this, "# UnPacked Vertices"};
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedFlavourTags{this, "# UnPacked FlavourTags"};
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedRecVertices{this, "# UnPacked RecVertices"};
+};
+
+template <class FROM, class TO, class FROMCONT, class TOCONT>
+void UnpackParticlesAndVertices::unpackP2PRelations( const std::string& location ) {
+  typedef LHCb::Relation1D<FROM, TO> RELATION;
+
+  unsigned int nbRelContainer( 0 ), nbRel( 0 );
+
+  RELATION*                    rels  = nullptr;
+  const LHCb::PackedRelations* prels = getIfExists<LHCb::PackedRelations>( location );
+  if ( nullptr != prels ) {
+    for ( const auto& prel : prels->relations() ) {
+      int                indx          = prel.container >> 32;
+      const std::string& containerName = prels->linkMgr()->link( indx )->path() + m_postFix;
+      rels                             = new RELATION();
+      rels->setVersion( prels->version() );
+      put( rels, containerName );
+      ++nbRelContainer;
+      FROMCONT*   srcContainer = nullptr;
+      int         prevSrcLink  = -1;
+      DataObject* dstContainer = nullptr;
+      int         prevDstLink  = -1;
+      for ( int kk = prel.start; prel.end > kk; ++kk ) {
+        int srcLink( 0 ), srcKey( 0 );
+        m_pack.indexAndKey64( prels->sources()[kk], srcLink, srcKey );
+        if ( srcLink != prevSrcLink || !srcContainer ) {
+          prevSrcLink                = srcLink;
+          const std::string& srcName = prels->linkMgr()->link( srcLink )->path();
+          // srcContainer = get<FROMCONT>( srcName );
+          srcContainer = getIfExists<FROMCONT>( srcName );
+          if ( !srcContainer ) {
+            Error( "Unpack('" + location + "'): missing source '" + srcName + "', skip link" ).ignore();
+            continue;
+          }
+        }
+        FROM* from = srcContainer->object( srcKey );
+        int   dstLink( 0 ), dstKey( 0 );
+        m_pack.indexAndKey64( prels->dests()[kk], dstLink, dstKey );
+        if ( dstLink != prevDstLink || !dstContainer ) {
+          prevDstLink                = dstLink;
+          const std::string& dstName = prels->linkMgr()->link( dstLink )->path();
+          // dstContainer = get<DataObject>( dstName );
+          dstContainer = getIfExists<DataObject>( dstName );
+          if ( !dstContainer ) {
+            Error( "Unpack('" + location + "'): missing destination '" + dstName + "', skip link" ).ignore();
+            continue;
+          }
+        }
+        TOCONT* _to = dynamic_cast<TOCONT*>( dstContainer );
+        TO*     to  = ( _to ? _to->object( dstKey ) : nullptr );
+        if ( !to )
+          info() << "Unknown objec: Container type " << ( dstContainer->clID() >> 16 ) << "+"
+                 << ( dstContainer->clID() & 0xFFFF ) << " key " << dstKey << endmsg;
+        auto sc = rels->relate( from, to );
+        if ( !sc ) { Error( "Problem forming relation" ).ignore(); }
+        ++nbRel;
+      }
+    }
+  }
+
+  if ( msgLevel( MSG::DEBUG ) ) {
+    debug() << "Retrieved " << nbRel << " relations in " << nbRelContainer << " containers"
+            << " from " << location << endmsg;
+  }
+}
+
+template <class FROM, class TO, class FROMCONT, class TOCONT, class WEIGHT>
+void UnpackParticlesAndVertices::unpackP2PWeightedRelations( const std::string& location ) {
+  typedef LHCb::RelationWeighted1D<FROM, TO, WEIGHT> RELATION;
+
+  unsigned int nbRelContainer( 0 ), nbRel( 0 );
+
+  RELATION*                            rels  = nullptr;
+  const LHCb::PackedWeightedRelations* prels = getIfExists<LHCb::PackedWeightedRelations>( location );
+  if ( nullptr != prels ) {
+    for ( const auto& prel : prels->relations() ) {
+      int                indx          = prel.container >> 32;
+      const std::string& containerName = prels->linkMgr()->link( indx )->path() + m_postFix;
+      rels                             = new RELATION();
+      rels->setVersion( prels->version() );
+      put( rels, containerName );
+      ++nbRelContainer;
+      FROMCONT*   srcContainer = nullptr;
+      int         prevSrcLink  = -1;
+      DataObject* dstContainer = nullptr;
+      int         prevDstLink  = -1;
+      for ( int kk = prel.start; prel.end > kk; ++kk ) {
+        int srcLink( 0 ), srcKey( 0 );
+        m_pack.indexAndKey64( prels->sources()[kk], srcLink, srcKey );
+        if ( srcLink != prevSrcLink || !srcContainer ) {
+          prevSrcLink                = srcLink;
+          const std::string& srcName = prels->linkMgr()->link( srcLink )->path();
+          srcContainer               = getIfExists<FROMCONT>( srcName );
+          if ( !srcContainer ) {
+            Error( "Unpack('" + location + "'): missing source '" + srcName + "', skip link" ).ignore();
+            continue;
+          }
+        }
+        FROM* from = srcContainer->object( srcKey );
+        int   dstLink( 0 ), dstKey( 0 );
+        m_pack.indexAndKey64( prels->dests()[kk], dstLink, dstKey );
+        if ( dstLink != prevDstLink || !dstContainer ) {
+          prevDstLink                = dstLink;
+          const std::string& dstName = prels->linkMgr()->link( dstLink )->path();
+          dstContainer               = getIfExists<DataObject>( dstName );
+          if ( !dstContainer ) {
+            Error( "Unpack('" + location + "'): missing destination '" + dstName + "', skip link" ).ignore();
+            continue;
+          }
+        }
+        const WEIGHT wgt = prels->weights()[kk];
+        TOCONT*      _to = dynamic_cast<TOCONT*>( dstContainer );
+        TO*          to  = ( _to ? _to->object( dstKey ) : nullptr );
+        if ( !to )
+          info() << "Unknown objec: Container type " << ( dstContainer->clID() >> 16 ) << "+"
+                 << ( dstContainer->clID() & 0xFFFF ) << " key " << dstKey << endmsg;
+        auto sc = rels->relate( from, to, wgt );
+        if ( !sc ) { Error( "Problem forming weighted relation" ).ignore(); }
+        ++nbRel;
+      }
+    }
+  }
+
+  if ( msgLevel( MSG::DEBUG ) ) {
+    debug() << "Retrieved " << nbRel << " relations in " << nbRelContainer << " containers"
+            << " from " << location << endmsg;
+  }
+}
+
+template <class FROM, class TO, class FROMCONT>
+void UnpackParticlesAndVertices::unpackP2IntRelations( const std::string& location ) {
+  typedef LHCb::Relation1D<FROM, TO> RELATION;
+
+  unsigned int nbRelContainer( 0 ), nbRel( 0 );
+
+  LHCb::PackedRelations* prels = getIfExists<LHCb::PackedRelations>( location );
+  if ( nullptr != prels ) {
+    for ( auto itR = prels->relations().begin(); prels->relations().end() != itR; ++itR ) {
+      const LHCb::PackedRelation& prel          = *itR;
+      const int                   indx          = prel.container >> 32;
+      const std::string&          containerName = prels->linkMgr()->link( indx )->path() + m_postFix;
+      RELATION*                   rels          = new RELATION();
+      rels->setVersion( prels->version() );
+      put( rels, containerName );
+      ++nbRelContainer;
+      FROMCONT* srcContainer = nullptr;
+      int       prevSrcLink  = -1;
+      for ( int kk = prel.start; prel.end > kk; ++kk ) {
+        int srcLink( 0 ), srcKey( 0 );
+        m_pack.indexAndKey64( prels->sources()[kk], srcLink, srcKey );
+        if ( srcLink != prevSrcLink ) {
+          prevSrcLink                = srcLink;
+          const std::string& srcName = prels->linkMgr()->link( srcLink )->path();
+          srcContainer               = get<FROMCONT>( srcName );
+        }
+        FROM* from = srcContainer->object( srcKey );
+        TO    to   = (TO)prels->dests()[kk];
+        auto  sc   = rels->relate( from, to );
+        if ( !sc ) { Error( "Problem forming relation" ).ignore(); }
+        ++nbRel;
+      }
+    }
+  }
+
+  if ( msgLevel( MSG::DEBUG ) ) {
+    debug() << "Retrieved " << nbRel << " relations in " << nbRelContainer << " containers"
+            << " from " << location << endmsg;
+  }
+}
+
 //=============================================================================
 // Standard constructor, initializes variables
 //=============================================================================
diff --git a/Event/EventPacker/src/component/UnpackParticlesAndVertices.h b/Event/EventPacker/src/component/UnpackParticlesAndVertices.h
deleted file mode 100644
index 3d2f99cc1bc..00000000000
--- a/Event/EventPacker/src/component/UnpackParticlesAndVertices.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKPARTICLESANDVERTICES_H
-#define UNPACKPARTICLESANDVERTICES_H 1
-
-#include <memory>
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-#include "Kernel/Particle2LHCbIDs.h"
-
-#include "Relations/Relation1D.h"
-#include "Relations/RelationWeighted1D.h"
-
-#include "Event/PackedFlavourTag.h"
-#include "Event/PackedMuonPID.h"
-#include "Event/PackedPartToRelatedInfoRelation.h"
-#include "Event/PackedParticle.h"
-#include "Event/PackedProtoParticle.h"
-#include "Event/PackedRecVertex.h"
-#include "Event/PackedRelations.h"
-#include "Event/PackedRichPID.h"
-#include "Event/PackedTrack.h"
-#include "Event/PackedVertex.h"
-#include "Event/StandardPacker.h"
-
-#include "Event/FlavourTag.h"
-#include "Event/MCParticle.h"
-#include "Event/MuonPID.h"
-#include "Event/Particle.h"
-#include "Event/ProtoParticle.h"
-#include "Event/RecVertex.h"
-#include "Event/RelatedInfoMap.h"
-#include "Event/RichPID.h"
-#include "Event/Track.h"
-#include "Event/Vertex.h"
-
-/** @class UnpackParticlesAndVertices UnpackParticlesAndVertices.h
- *
- *  Unpacks all Packed Particles and related objects
- *
- *  @author Olivier Callot
- *  @date   2012-01-23
- */
-class UnpackParticlesAndVertices : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  UnpackParticlesAndVertices( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  template <class FROM, class TO, class FROMCONT, class TOCONT>
-  void unpackP2PRelations( const std::string& location );
-
-  template <class FROM, class TO, class FROMCONT, class TOCONT, class WEIGHT>
-  void unpackP2PWeightedRelations( const std::string& location );
-
-  template <class FROM, class TO, class FROMCONT>
-  void unpackP2IntRelations( const std::string& location );
-
-private:
-  std::string m_inputStream; ///< Input stream root
-
-  std::string m_postFix;
-
-  StandardPacker m_pack{this}; ///< Standard Packer
-
-  /// Track packer
-  const LHCb::TrackPacker m_trackPacker{this};
-  /// Muon PID packer
-  const LHCb::MuonPIDPacker m_muonPacker{this};
-  /// Rich PID packer
-  const LHCb::RichPIDPacker m_richPacker{this};
-  /// ProtoParticle packer
-  const LHCb::ProtoParticlePacker m_protoPacker{this};
-  /// Particle Packer
-  const LHCb::ParticlePacker m_partPacker{this};
-  /// Vertex Packer
-  const LHCb::VertexPacker m_vertPacker{this};
-  /// Flavour Tag Packer
-  const LHCb::FlavourTagPacker m_ftPacker{this};
-  /// Rec Vertex Packer
-  const LHCb::RecVertexPacker m_rvPacker{this};
-  /// Related Info Packer
-  const LHCb::RelatedInfoRelationsPacker m_rInfoPacker{this};
-
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedTracks{this, "# UnPacked Tracks"};
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedMuonPIDs{this, "# UnPacked MuonPIDs"};
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedRichPIDs{this, "# UnPacked RichPIDs"};
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedProtoParticles{this, "# UnPacked ProtoParticles"};
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedParticles{this, "# UnPacked Particles"};
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedVertices{this, "# UnPacked Vertices"};
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedFlavourTags{this, "# UnPacked FlavourTags"};
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedRecVertices{this, "# UnPacked RecVertices"};
-};
-
-template <class FROM, class TO, class FROMCONT, class TOCONT>
-inline void UnpackParticlesAndVertices::unpackP2PRelations( const std::string& location ) {
-  typedef LHCb::Relation1D<FROM, TO> RELATION;
-
-  unsigned int nbRelContainer( 0 ), nbRel( 0 );
-
-  RELATION*                    rels  = nullptr;
-  const LHCb::PackedRelations* prels = getIfExists<LHCb::PackedRelations>( location );
-  if ( nullptr != prels ) {
-    for ( const auto& prel : prels->relations() ) {
-      int                indx          = prel.container >> 32;
-      const std::string& containerName = prels->linkMgr()->link( indx )->path() + m_postFix;
-      rels                             = new RELATION();
-      rels->setVersion( prels->version() );
-      put( rels, containerName );
-      ++nbRelContainer;
-      FROMCONT*   srcContainer = nullptr;
-      int         prevSrcLink  = -1;
-      DataObject* dstContainer = nullptr;
-      int         prevDstLink  = -1;
-      for ( int kk = prel.start; prel.end > kk; ++kk ) {
-        int srcLink( 0 ), srcKey( 0 );
-        m_pack.indexAndKey64( prels->sources()[kk], srcLink, srcKey );
-        if ( srcLink != prevSrcLink || !srcContainer ) {
-          prevSrcLink                = srcLink;
-          const std::string& srcName = prels->linkMgr()->link( srcLink )->path();
-          // srcContainer = get<FROMCONT>( srcName );
-          srcContainer = getIfExists<FROMCONT>( srcName );
-          if ( !srcContainer ) {
-            Error( "Unpack('" + location + "'): missing source '" + srcName + "', skip link" ).ignore();
-            continue;
-          }
-        }
-        FROM* from = srcContainer->object( srcKey );
-        int   dstLink( 0 ), dstKey( 0 );
-        m_pack.indexAndKey64( prels->dests()[kk], dstLink, dstKey );
-        if ( dstLink != prevDstLink || !dstContainer ) {
-          prevDstLink                = dstLink;
-          const std::string& dstName = prels->linkMgr()->link( dstLink )->path();
-          // dstContainer = get<DataObject>( dstName );
-          dstContainer = getIfExists<DataObject>( dstName );
-          if ( !dstContainer ) {
-            Error( "Unpack('" + location + "'): missing destination '" + dstName + "', skip link" ).ignore();
-            continue;
-          }
-        }
-        TOCONT* _to = dynamic_cast<TOCONT*>( dstContainer );
-        TO*     to  = ( _to ? _to->object( dstKey ) : nullptr );
-        if ( !to )
-          info() << "Unknown objec: Container type " << ( dstContainer->clID() >> 16 ) << "+"
-                 << ( dstContainer->clID() & 0xFFFF ) << " key " << dstKey << endmsg;
-        auto sc = rels->relate( from, to );
-        if ( !sc ) { Error( "Problem forming relation" ).ignore(); }
-        ++nbRel;
-      }
-    }
-  }
-
-  if ( msgLevel( MSG::DEBUG ) ) {
-    debug() << "Retrieved " << nbRel << " relations in " << nbRelContainer << " containers"
-            << " from " << location << endmsg;
-  }
-}
-
-template <class FROM, class TO, class FROMCONT, class TOCONT, class WEIGHT>
-inline void UnpackParticlesAndVertices::unpackP2PWeightedRelations( const std::string& location ) {
-  typedef LHCb::RelationWeighted1D<FROM, TO, WEIGHT> RELATION;
-
-  unsigned int nbRelContainer( 0 ), nbRel( 0 );
-
-  RELATION*                            rels  = nullptr;
-  const LHCb::PackedWeightedRelations* prels = getIfExists<LHCb::PackedWeightedRelations>( location );
-  if ( nullptr != prels ) {
-    for ( const auto& prel : prels->relations() ) {
-      int                indx          = prel.container >> 32;
-      const std::string& containerName = prels->linkMgr()->link( indx )->path() + m_postFix;
-      rels                             = new RELATION();
-      rels->setVersion( prels->version() );
-      put( rels, containerName );
-      ++nbRelContainer;
-      FROMCONT*   srcContainer = nullptr;
-      int         prevSrcLink  = -1;
-      DataObject* dstContainer = nullptr;
-      int         prevDstLink  = -1;
-      for ( int kk = prel.start; prel.end > kk; ++kk ) {
-        int srcLink( 0 ), srcKey( 0 );
-        m_pack.indexAndKey64( prels->sources()[kk], srcLink, srcKey );
-        if ( srcLink != prevSrcLink || !srcContainer ) {
-          prevSrcLink                = srcLink;
-          const std::string& srcName = prels->linkMgr()->link( srcLink )->path();
-          srcContainer               = getIfExists<FROMCONT>( srcName );
-          if ( !srcContainer ) {
-            Error( "Unpack('" + location + "'): missing source '" + srcName + "', skip link" ).ignore();
-            continue;
-          }
-        }
-        FROM* from = srcContainer->object( srcKey );
-        int   dstLink( 0 ), dstKey( 0 );
-        m_pack.indexAndKey64( prels->dests()[kk], dstLink, dstKey );
-        if ( dstLink != prevDstLink || !dstContainer ) {
-          prevDstLink                = dstLink;
-          const std::string& dstName = prels->linkMgr()->link( dstLink )->path();
-          dstContainer               = getIfExists<DataObject>( dstName );
-          if ( !dstContainer ) {
-            Error( "Unpack('" + location + "'): missing destination '" + dstName + "', skip link" ).ignore();
-            continue;
-          }
-        }
-        const WEIGHT wgt = prels->weights()[kk];
-        TOCONT*      _to = dynamic_cast<TOCONT*>( dstContainer );
-        TO*          to  = ( _to ? _to->object( dstKey ) : nullptr );
-        if ( !to )
-          info() << "Unknown objec: Container type " << ( dstContainer->clID() >> 16 ) << "+"
-                 << ( dstContainer->clID() & 0xFFFF ) << " key " << dstKey << endmsg;
-        auto sc = rels->relate( from, to, wgt );
-        if ( !sc ) { Error( "Problem forming weighted relation" ).ignore(); }
-        ++nbRel;
-      }
-    }
-  }
-
-  if ( msgLevel( MSG::DEBUG ) ) {
-    debug() << "Retrieved " << nbRel << " relations in " << nbRelContainer << " containers"
-            << " from " << location << endmsg;
-  }
-}
-
-template <class FROM, class TO, class FROMCONT>
-inline void UnpackParticlesAndVertices::unpackP2IntRelations( const std::string& location ) {
-  typedef LHCb::Relation1D<FROM, TO> RELATION;
-
-  unsigned int nbRelContainer( 0 ), nbRel( 0 );
-
-  LHCb::PackedRelations* prels = getIfExists<LHCb::PackedRelations>( location );
-  if ( nullptr != prels ) {
-    for ( auto itR = prels->relations().begin(); prels->relations().end() != itR; ++itR ) {
-      const LHCb::PackedRelation& prel          = *itR;
-      const int                   indx          = prel.container >> 32;
-      const std::string&          containerName = prels->linkMgr()->link( indx )->path() + m_postFix;
-      RELATION*                   rels          = new RELATION();
-      rels->setVersion( prels->version() );
-      put( rels, containerName );
-      ++nbRelContainer;
-      FROMCONT* srcContainer = nullptr;
-      int       prevSrcLink  = -1;
-      for ( int kk = prel.start; prel.end > kk; ++kk ) {
-        int srcLink( 0 ), srcKey( 0 );
-        m_pack.indexAndKey64( prels->sources()[kk], srcLink, srcKey );
-        if ( srcLink != prevSrcLink ) {
-          prevSrcLink                = srcLink;
-          const std::string& srcName = prels->linkMgr()->link( srcLink )->path();
-          srcContainer               = get<FROMCONT>( srcName );
-        }
-        FROM* from = srcContainer->object( srcKey );
-        TO    to   = (TO)prels->dests()[kk];
-        auto  sc   = rels->relate( from, to );
-        if ( !sc ) { Error( "Problem forming relation" ).ignore(); }
-        ++nbRel;
-      }
-    }
-  }
-
-  if ( msgLevel( MSG::DEBUG ) ) {
-    debug() << "Retrieved " << nbRel << " relations in " << nbRelContainer << " containers"
-            << " from " << location << endmsg;
-  }
-}
-
-#endif // UNPACKPARTICLESANDVERTICES_H
diff --git a/Event/EventPacker/src/component/UnpackRecVertex.cpp b/Event/EventPacker/src/component/UnpackRecVertex.cpp
index 430a9d480f0..763af577c13 100644
--- a/Event/EventPacker/src/component/UnpackRecVertex.cpp
+++ b/Event/EventPacker/src/component/UnpackRecVertex.cpp
@@ -8,12 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// from Gaudi
+#include "Event/PackedRecVertex.h"
+#include "Event/RecVertex.h"
 #include "Event/StandardPacker.h"
-// local
-#include "UnpackRecVertex.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : UnpackRecVertex
@@ -21,6 +19,25 @@
 // 2008-11-17 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @brief Unpack a PackedRecVertex container to RecVertices.
+ *
+ *  @author Olivier Callot
+ *  @date   2008-11-17
+ */
+class UnpackRecVertex : public GaudiAlgorithm {
+
+public:
+  using GaudiAlgorithm::GaudiAlgorithm;
+  StatusCode execute() override;
+
+private:
+  DataObjectReadHandle<LHCb::PackedRecVertices> m_packedVertices{this, "InputName",
+                                                                 LHCb::PackedRecVertexLocation::Primary};
+  DataObjectWriteHandle<LHCb::RecVertices>      m_vertices{this, "OutputName", LHCb::RecVertexLocation::Primary};
+  Gaudi::Property<bool>                         m_alwaysOutput{this, "AlwaysCreateOutput", false,
+                                       "Flag to turn on the creation of output, even when input is missing"};
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( UnpackRecVertex )
 
diff --git a/Event/EventPacker/src/component/UnpackRecVertex.h b/Event/EventPacker/src/component/UnpackRecVertex.h
deleted file mode 100644
index a9730bffbfd..00000000000
--- a/Event/EventPacker/src/component/UnpackRecVertex.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKRECVERTEX_H
-#define UNPACKRECVERTEX_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-#include "Event/PackedRecVertex.h"
-#include "Event/RecVertex.h"
-
-/** @brief Unpack a PackedRecVertex container to RecVertices.
- *
- *  @author Olivier Callot
- *  @date   2008-11-17
- */
-class UnpackRecVertex : public GaudiAlgorithm {
-
-public:
-  using GaudiAlgorithm::GaudiAlgorithm;
-  StatusCode execute() override;
-
-private:
-  DataObjectReadHandle<LHCb::PackedRecVertices> m_packedVertices{this, "InputName",
-                                                                 LHCb::PackedRecVertexLocation::Primary};
-  DataObjectWriteHandle<LHCb::RecVertices>      m_vertices{this, "OutputName", LHCb::RecVertexLocation::Primary};
-  Gaudi::Property<bool>                         m_alwaysOutput{this, "AlwaysCreateOutput", false,
-                                       "Flag to turn on the creation of output, even when input is missing"};
-};
-
-#endif // UNPACKRECVERTEX_H
diff --git a/Event/EventPacker/src/component/UnpackSTCluster.cpp b/Event/EventPacker/src/component/UnpackSTCluster.cpp
index 62422d4d430..5e5e8701988 100644
--- a/Event/EventPacker/src/component/UnpackSTCluster.cpp
+++ b/Event/EventPacker/src/component/UnpackSTCluster.cpp
@@ -8,9 +8,34 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
+#include "Event/PackedCluster.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 #include <string>
 
-#include "UnpackSTCluster.h"
+/** @class UnpackSTCluster UnpackSTCluster.h
+ *
+ *  Unpack the LHCb::STCluster objects from a specified container.
+ *
+ *  This is a single-container-type version of UnpackCluster, and assumes a
+ *  single input -> output mapping.
+ */
+class UnpackSTCluster : public GaudiAlgorithm {
+
+public:
+  UnpackSTCluster( const std::string& name, ISvcLocator* svcLocator );
+
+  StatusCode execute() override;
+
+private:
+  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::PackedClusterLocation::TT};
+
+  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::STClusterLocation::TTClusters};
+
+  /// Flag to turn on the creation of output, even when input is missing
+  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
+
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedSTClusters{this, "# UnpackedSTClusters"};
+};
 
 DECLARE_COMPONENT( UnpackSTCluster )
 
@@ -20,8 +45,8 @@ UnpackSTCluster::UnpackSTCluster( const std::string& name, ISvcLocator* svcLocat
 // explicit comparison for cluster sorting (hidden in anonymous namespace)
 namespace {
   template <class TYPE>
-  inline bool compareKeys( const TYPE* a, const TYPE* b ) {
-    return ( a->key() < b->key() );
+  bool compareKeys( const TYPE* a, const TYPE* b ) {
+    return a->key() < b->key();
   }
 } // namespace
 
diff --git a/Event/EventPacker/src/component/UnpackSTCluster.h b/Event/EventPacker/src/component/UnpackSTCluster.h
deleted file mode 100644
index 3c59b93989d..00000000000
--- a/Event/EventPacker/src/component/UnpackSTCluster.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKSTCLUSTER_H
-#define UNPACKSTCLUSTER_H 1
-
-#include "Event/PackedCluster.h"
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class UnpackSTCluster UnpackSTCluster.h
- *
- *  Unpack the LHCb::STCluster objects from a specified container.
- *
- *  This is a single-container-type version of UnpackCluster, and assumes a
- *  single input -> output mapping.
- */
-class UnpackSTCluster : public GaudiAlgorithm {
-
-public:
-  UnpackSTCluster( const std::string& name, ISvcLocator* svcLocator );
-
-  StatusCode execute() override;
-
-private:
-  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::PackedClusterLocation::TT};
-
-  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::STClusterLocation::TTClusters};
-
-  /// Flag to turn on the creation of output, even when input is missing
-  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
-
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedSTClusters{this, "# UnpackedSTClusters"};
-};
-
-#endif // UNPACKSTCLUSTER_H
diff --git a/Event/EventPacker/src/component/UnpackTrack.cpp b/Event/EventPacker/src/component/UnpackTrack.cpp
index 90307dffa3a..9e38bcb5fc2 100644
--- a/Event/EventPacker/src/component/UnpackTrack.cpp
+++ b/Event/EventPacker/src/component/UnpackTrack.cpp
@@ -8,20 +8,40 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// Include files
-
-// from Gaudi
+#include "Event/PackedTrack.h"
 #include "Event/StandardPacker.h"
-
-// local
-#include "UnpackTrack.h"
-
+#include "Event/Track.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 //-----------------------------------------------------------------------------
 // Implementation file for class : UnpackTrack
 //
 // 2008-11-14 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class UnpackTrack UnpackTrack.h
+ *
+ *  Unpack the PackedTrack
+ *
+ *  @author Olivier Callot
+ *  @date   2008-11-14
+ */
+class UnpackTrack : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  UnpackTrack( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;      ///< Input location
+  std::string m_outputName;     ///< Output location
+  bool        m_alwaysOutput;   ///< Flag to turn on the creation of output, even when input is missing
+  std::string m_ancestorFor;    ///< Container name for which ancestors shoudl be built
+  std::string m_ancestorSource; ///< Container where ancestors are.
+  mutable Gaudi::Accumulators::StatCounter<unsigned long> m_unpackedTracks{this, "# Unpacked Tracks"};
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( UnpackTrack )
 
@@ -60,11 +80,8 @@ StatusCode UnpackTrack::execute() {
   auto* newTracks = new LHCb::Tracks();
   put( newTracks, m_outputName );
 
-  // Track Packer
-  const LHCb::TrackPacker packer( this );
-
   // Unpack the tracks
-  packer.unpack( *dst, *newTracks );
+  LHCb::TrackPacker{this}.unpack( *dst, *newTracks );
 
   //== If one needs to build ancestors, get the location of the ancestor's container
   const auto* targetTracks = ( m_inputName != m_ancestorFor ? nullptr : getIfExists<LHCb::Tracks>( m_ancestorSource ) );
diff --git a/Event/EventPacker/src/component/UnpackTrack.h b/Event/EventPacker/src/component/UnpackTrack.h
deleted file mode 100644
index cfd1a424829..00000000000
--- a/Event/EventPacker/src/component/UnpackTrack.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKTRACK_H
-#define UNPACKTRACK_H 1
-
-// Include files
-// from Gaudi
-#include "Event/PackedTrack.h"
-#include "Event/Track.h"
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class UnpackTrack UnpackTrack.h
- *
- *  Unpack the PackedTrack
- *
- *  @author Olivier Callot
- *  @date   2008-11-14
- */
-class UnpackTrack : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  UnpackTrack( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;      ///< Input location
-  std::string m_outputName;     ///< Output location
-  bool        m_alwaysOutput;   ///< Flag to turn on the creation of output, even when input is missing
-  std::string m_ancestorFor;    ///< Container name for which ancestors shoudl be built
-  std::string m_ancestorSource; ///< Container where ancestors are.
-  mutable Gaudi::Accumulators::StatCounter<unsigned long> m_unpackedTracks{this, "# Unpacked Tracks"};
-};
-
-#endif // UNPACKTRACK_H
diff --git a/Event/EventPacker/src/component/UnpackTrackFunctional.cpp b/Event/EventPacker/src/component/UnpackTrackFunctional.cpp
index 059cff3b4ea..bf7b087cb51 100644
--- a/Event/EventPacker/src/component/UnpackTrackFunctional.cpp
+++ b/Event/EventPacker/src/component/UnpackTrackFunctional.cpp
@@ -8,12 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// from Gaudi
+#include "Event/PackedTrack.h"
 #include "Event/StandardPacker.h"
-
-// local
-#include "UnpackTrackFunctional.h"
+#include "Event/Track.h"
+#include "GaudiAlg/Transformer.h"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : UnpackTrackFunctional
@@ -21,34 +19,32 @@
 // 2008-11-14 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class UnpackTrackFunctional UnpackTrackFunctional.h
+ *
+ *  Unpack the PackedTrack
+ *
+ *  @author Olivier Callot
+ *  @date   2008-11-14
+ */
+class UnpackTrackFunctional final : public Gaudi::Functional::Transformer<LHCb::Tracks( const LHCb::PackedTracks& )> {
+
+public:
+  /// Standard constructor
+  UnpackTrackFunctional( const std::string& name, ISvcLocator* pSvcLocator )
+      : Transformer( name, pSvcLocator, KeyValue{"InputName", LHCb::PackedTrackLocation::Default},
+                     KeyValue{"OutputName", LHCb::TrackLocation::Default} ) {}
+
+  /// Functional operator
+  LHCb::Tracks operator()( const LHCb::PackedTracks& in ) const override {
+    LHCb::Tracks out;
+    LHCb::TrackPacker{this}.unpack( in, out );
+    m_unpackedTracks += out.size();
+    return out;
+  }
+
+private:
+  mutable Gaudi::Accumulators::AveragingCounter<unsigned long> m_unpackedTracks{this, "# Unpacked Tracks"};
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( UnpackTrackFunctional )
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-UnpackTrackFunctional::UnpackTrackFunctional( const std::string& name, ISvcLocator* pSvcLocator )
-    : Transformer( name, pSvcLocator, KeyValue{"InputName", LHCb::PackedTrackLocation::Default},
-                   KeyValue{"OutputName", LHCb::TrackLocation::Default} ) {
-  // setProperty( "OutputLevel", 1 );
-}
-
-//=============================================================================
-// Main execution
-//=============================================================================
-LHCb::Tracks UnpackTrackFunctional::operator()( const LHCb::PackedTracks& dst ) const {
-  // Make new unpacked tracks
-  LHCb::Tracks newTracks;
-
-  // Track Packer
-  const LHCb::TrackPacker packer( this );
-
-  // Unpack the tracks
-  packer.unpack( dst, newTracks );
-
-  m_unpackedTracks += newTracks.size();
-
-  return newTracks;
-}
-
-//=============================================================================
diff --git a/Event/EventPacker/src/component/UnpackTrackFunctional.h b/Event/EventPacker/src/component/UnpackTrackFunctional.h
deleted file mode 100644
index e512a229b3b..00000000000
--- a/Event/EventPacker/src/component/UnpackTrackFunctional.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UnpackTrackFunctional_H
-#define UnpackTrackFunctional_H 1
-
-// Include files
-// from Gaudi
-#include "Event/PackedTrack.h"
-#include "Event/Track.h"
-#include "GaudiAlg/GaudiAlgorithm.h"
-#include "GaudiAlg/Transformer.h"
-
-/** @class UnpackTrackFunctional UnpackTrackFunctional.h
- *
- *  Unpack the PackedTrack
- *
- *  @author Olivier Callot
- *  @date   2008-11-14
- */
-class UnpackTrackFunctional final : public Gaudi::Functional::Transformer<LHCb::Tracks( const LHCb::PackedTracks& )> {
-
-public:
-  /// Standard constructor
-  UnpackTrackFunctional( const std::string& name, ISvcLocator* pSvcLocator );
-
-  /// Functional operator
-  LHCb::Tracks operator()( const LHCb::PackedTracks& pTracks ) const override;
-
-private:
-  mutable Gaudi::Accumulators::AveragingCounter<unsigned long> m_unpackedTracks{this, "# Unpacked Tracks"};
-};
-
-#endif // UnpackTrackFunctional
diff --git a/Event/EventPacker/src/component/UnpackTwoProngVertex.cpp b/Event/EventPacker/src/component/UnpackTwoProngVertex.cpp
index 226fe24fb39..5bce754d6fa 100644
--- a/Event/EventPacker/src/component/UnpackTwoProngVertex.cpp
+++ b/Event/EventPacker/src/component/UnpackTwoProngVertex.cpp
@@ -11,15 +11,33 @@
 #include "Event/PackedTwoProngVertex.h"
 #include "Event/StandardPacker.h"
 #include "Event/TwoProngVertex.h"
-// local
-#include "UnpackTwoProngVertex.h"
-
+#include "GaudiAlg/GaudiAlgorithm.h"
 //-----------------------------------------------------------------------------
 // Implementation file for class : UnpackTwoProngVertex
 //
 // 2009-01-21 : Olivier Callot
 //-----------------------------------------------------------------------------
 
+/** @class UnpackTwoProngVertex UnpackTwoProngVertex.h
+ *  Unoack the Two Prong vertex class
+ *
+ *  @author Olivier Callot
+ *  @date   2009-01-21
+ */
+class UnpackTwoProngVertex : public GaudiAlgorithm {
+
+public:
+  /// Standard constructor
+  UnpackTwoProngVertex( const std::string& name, ISvcLocator* pSvcLocator );
+
+  StatusCode execute() override; ///< Algorithm execution
+
+private:
+  std::string m_inputName;
+  std::string m_outputName;
+  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
+};
+
 // Declaration of the Algorithm Factory
 DECLARE_COMPONENT( UnpackTwoProngVertex )
 
diff --git a/Event/EventPacker/src/component/UnpackTwoProngVertex.h b/Event/EventPacker/src/component/UnpackTwoProngVertex.h
deleted file mode 100644
index fd86b997bdc..00000000000
--- a/Event/EventPacker/src/component/UnpackTwoProngVertex.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKTWOPRONGVERTEX_H
-#define UNPACKTWOPRONGVERTEX_H 1
-
-// Include files
-// from Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class UnpackTwoProngVertex UnpackTwoProngVertex.h
- *  Unoack the Two Prong vertex class
- *
- *  @author Olivier Callot
- *  @date   2009-01-21
- */
-class UnpackTwoProngVertex : public GaudiAlgorithm {
-
-public:
-  /// Standard constructor
-  UnpackTwoProngVertex( const std::string& name, ISvcLocator* pSvcLocator );
-
-  StatusCode execute() override; ///< Algorithm execution
-
-private:
-  std::string m_inputName;
-  std::string m_outputName;
-  bool        m_alwaysOutput; ///< Flag to turn on the creation of output, even when input is missing
-};
-
-#endif // UNPACKTWOPRONGVERTEX_H
diff --git a/Event/EventPacker/src/component/UnpackUTCluster.cpp b/Event/EventPacker/src/component/UnpackUTCluster.cpp
index 33e69fd3137..1feed8f1445 100644
--- a/Event/EventPacker/src/component/UnpackUTCluster.cpp
+++ b/Event/EventPacker/src/component/UnpackUTCluster.cpp
@@ -8,9 +8,34 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
+#include "Event/PackedCluster.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 #include <string>
 
-#include "UnpackUTCluster.h"
+/** @class UnpackUTCluster UnpackUTCluster.h
+ *
+ *  Unpack the LHCb::UTCluster objects from a specified container.
+ *
+ *  This is a single-container-type version of UnpackCluster, and assumes a
+ *  single input -> output mapping.
+ */
+class UnpackUTCluster : public GaudiAlgorithm {
+
+public:
+  UnpackUTCluster( const std::string& name, ISvcLocator* svcLocator );
+
+  StatusCode execute() override;
+
+private:
+  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::PackedClusterLocation::UT};
+
+  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::UTClusterLocation::UTClusters};
+
+  /// Flag to turn on the creation of output, even when input is missing
+  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
+
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedUTClusters{this, "# UnpackedUTClusters"};
+};
 
 DECLARE_COMPONENT( UnpackUTCluster )
 
diff --git a/Event/EventPacker/src/component/UnpackUTCluster.h b/Event/EventPacker/src/component/UnpackUTCluster.h
deleted file mode 100644
index d32d40f08f1..00000000000
--- a/Event/EventPacker/src/component/UnpackUTCluster.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKUTCLUSTER_H
-#define UNPACKUTCLUSTER_H 1
-
-#include "Event/PackedCluster.h"
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class UnpackUTCluster UnpackUTCluster.h
- *
- *  Unpack the LHCb::UTCluster objects from a specified container.
- *
- *  This is a single-container-type version of UnpackCluster, and assumes a
- *  single input -> output mapping.
- */
-class UnpackUTCluster : public GaudiAlgorithm {
-
-public:
-  UnpackUTCluster( const std::string& name, ISvcLocator* svcLocator );
-
-  StatusCode execute() override;
-
-private:
-  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::PackedClusterLocation::UT};
-
-  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::UTClusterLocation::UTClusters};
-
-  /// Flag to turn on the creation of output, even when input is missing
-  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
-
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedUTClusters{this, "# UnpackedUTClusters"};
-};
-
-#endif // UNPACKUTCLUSTER_H
diff --git a/Event/EventPacker/src/component/UnpackVeloCluster.cpp b/Event/EventPacker/src/component/UnpackVeloCluster.cpp
index 4489d0f6d42..5bb9eb37f4c 100644
--- a/Event/EventPacker/src/component/UnpackVeloCluster.cpp
+++ b/Event/EventPacker/src/component/UnpackVeloCluster.cpp
@@ -8,9 +8,34 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
+#include "Event/PackedCluster.h"
+#include "GaudiAlg/GaudiAlgorithm.h"
 #include <string>
 
-#include "UnpackVeloCluster.h"
+/** @class UnpackVeloCluster UnpackVeloCluster.h
+ *
+ *  Unpack the LHCb::VeloCluster objects from a specified container.
+ *
+ *  This is a single-container-type version of UnpackCluster, and assumes a
+ *  single input -> output mapping.
+ */
+class UnpackVeloCluster : public GaudiAlgorithm {
+
+public:
+  UnpackVeloCluster( const std::string& name, ISvcLocator* svcLocator );
+
+  StatusCode execute() override;
+
+private:
+  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::PackedClusterLocation::Velo};
+
+  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::VeloClusterLocation::Default};
+
+  /// Flag to turn on the creation of output, even when input is missing
+  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
+
+  mutable Gaudi::Accumulators::StatCounter<> m_unpackedVeloClusters{this, "# UnpackedVeloClusters"};
+};
 
 DECLARE_COMPONENT( UnpackVeloCluster )
 
diff --git a/Event/EventPacker/src/component/UnpackVeloCluster.h b/Event/EventPacker/src/component/UnpackVeloCluster.h
deleted file mode 100644
index 3b504c9a642..00000000000
--- a/Event/EventPacker/src/component/UnpackVeloCluster.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*****************************************************************************\
-* (c) Copyright 2000-2018 CERN for the benefit of the LHCb Collaboration      *
-*                                                                             *
-* This software is distributed under the terms of the GNU General Public      *
-* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING".   *
-*                                                                             *
-* In applying this licence, CERN does not waive the privileges and immunities *
-* granted to it by virtue of its status as an Intergovernmental Organization  *
-* or submit itself to any jurisdiction.                                       *
-\*****************************************************************************/
-#ifndef UNPACKVELOCLUSTER_H
-#define UNPACKVELOCLUSTER_H 1
-
-#include "Event/PackedCluster.h"
-
-#include "GaudiAlg/GaudiAlgorithm.h"
-
-/** @class UnpackVeloCluster UnpackVeloCluster.h
- *
- *  Unpack the LHCb::VeloCluster objects from a specified container.
- *
- *  This is a single-container-type version of UnpackCluster, and assumes a
- *  single input -> output mapping.
- */
-class UnpackVeloCluster : public GaudiAlgorithm {
-
-public:
-  UnpackVeloCluster( const std::string& name, ISvcLocator* svcLocator );
-
-  StatusCode execute() override;
-
-private:
-  Gaudi::Property<std::string> m_inputName{this, "InputName", LHCb::PackedClusterLocation::Velo};
-
-  Gaudi::Property<std::string> m_outputName{this, "OutputName", LHCb::VeloClusterLocation::Default};
-
-  /// Flag to turn on the creation of output, even when input is missing
-  Gaudi::Property<bool> m_alwaysOutput{this, "AlwaysCreateOutput", false};
-
-  mutable Gaudi::Accumulators::StatCounter<> m_unpackedVeloClusters{this, "# UnpackedVeloClusters"};
-};
-
-#endif // UNPACKVELOCLUSTER_H
diff --git a/Event/EventPacker/src/component/WritePackedDst.h b/Event/EventPacker/src/component/WritePackedDst.h
deleted file mode 100644
index e69de29bb2d..00000000000
diff --git a/Event/EventPacker/src/lib/PackedCaloAdc.cpp b/Event/EventPacker/src/lib/PackedCaloAdc.cpp
index ec093005edd..41cbda3a78e 100644
--- a/Event/EventPacker/src/lib/PackedCaloAdc.cpp
+++ b/Event/EventPacker/src/lib/PackedCaloAdc.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedCaloAdc.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
diff --git a/Event/EventPacker/src/lib/PackedCaloCluster.cpp b/Event/EventPacker/src/lib/PackedCaloCluster.cpp
index e91ff50eb33..54038e23374 100644
--- a/Event/EventPacker/src/lib/PackedCaloCluster.cpp
+++ b/Event/EventPacker/src/lib/PackedCaloCluster.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedCaloCluster.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
diff --git a/Event/EventPacker/src/lib/PackedCaloDigit.cpp b/Event/EventPacker/src/lib/PackedCaloDigit.cpp
index f86d4df0210..8024345176f 100644
--- a/Event/EventPacker/src/lib/PackedCaloDigit.cpp
+++ b/Event/EventPacker/src/lib/PackedCaloDigit.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedCaloDigit.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
diff --git a/Event/EventPacker/src/lib/PackedCaloHypo.cpp b/Event/EventPacker/src/lib/PackedCaloHypo.cpp
index c0782fcc7d6..044ede90a7f 100644
--- a/Event/EventPacker/src/lib/PackedCaloHypo.cpp
+++ b/Event/EventPacker/src/lib/PackedCaloHypo.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedCaloHypo.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
@@ -176,8 +170,7 @@ void CaloHypoPacker::unpack( const PackedDataVector& phypos, DataVector& hypos )
         const auto reference = *( phypos.refs().begin() + kk );
         if ( ( 0 != ver && m_pack.hintAndKey64( reference, &phypos, &hypos, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( reference, &phypos, &hypos, hintID, key ) ) ) {
-          SmartRef<LHCb::CaloDigit> ref( &hypos, hintID, key );
-          hypo->addToDigits( ref );
+          hypo->addToDigits( {&hypos, hintID, key} );
         } else {
           parent().Error( "Corrupt CaloHypo CaloDigit SmartRef detected." ).ignore();
         }
@@ -186,8 +179,7 @@ void CaloHypoPacker::unpack( const PackedDataVector& phypos, DataVector& hypos )
         const auto reference = *( phypos.refs().begin() + kk );
         if ( ( 0 != ver && m_pack.hintAndKey64( reference, &phypos, &hypos, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( reference, &phypos, &hypos, hintID, key ) ) ) {
-          SmartRef<LHCb::CaloCluster> ref( &hypos, hintID, key );
-          hypo->addToClusters( ref );
+          hypo->addToClusters( {&hypos, hintID, key} );
         } else {
           parent().Error( "Corrupt CaloHypo CaloCluster SmartRef detected." ).ignore();
         }
@@ -196,8 +188,7 @@ void CaloHypoPacker::unpack( const PackedDataVector& phypos, DataVector& hypos )
         const auto reference = *( phypos.refs().begin() + kk );
         if ( ( 0 != ver && m_pack.hintAndKey64( reference, &phypos, &hypos, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( reference, &phypos, &hypos, hintID, key ) ) ) {
-          SmartRef<LHCb::CaloHypo> ref( &hypos, hintID, key );
-          hypo->addToHypos( ref );
+          hypo->addToHypos( {&hypos, hintID, key} );
         } else {
           parent().Error( "Corrupt CaloHypo CaloHypo SmartRef detected." ).ignore();
         }
diff --git a/Event/EventPacker/src/lib/PackedEventChecks.cpp b/Event/EventPacker/src/lib/PackedEventChecks.cpp
index 904110b3916..557789c5864 100644
--- a/Event/EventPacker/src/lib/PackedEventChecks.cpp
+++ b/Event/EventPacker/src/lib/PackedEventChecks.cpp
@@ -8,12 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// STL
+#include "Event/PackedEventChecks.h"
 #include <cmath>
 #include <sstream>
 
-#include "Event/PackedEventChecks.h"
-
 using namespace DataPacking;
 
 //-----------------------------------------------------------------------------
diff --git a/Event/EventPacker/src/lib/PackedFlavourTag.cpp b/Event/EventPacker/src/lib/PackedFlavourTag.cpp
index caaf31c31c5..3bb17d4f61a 100644
--- a/Event/EventPacker/src/lib/PackedFlavourTag.cpp
+++ b/Event/EventPacker/src/lib/PackedFlavourTag.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedFlavourTag.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
@@ -104,8 +98,7 @@ void FlavourTagPacker::unpack( const PackedData& pft, Data& ft, const PackedData
     if ( -1 != pft.taggedB ) {
       int hintID( 0 ), key( 0 );
       if ( m_pack.hintAndKey64( pft.taggedB, &pfts, &fts, hintID, key ) ) {
-        SmartRef<LHCb::Particle> ref( &fts, hintID, key );
-        ft.setTaggedB( ref );
+        ft.setTaggedB( {&fts, hintID, key} );
       } else {
         parent().Error( "Corrupt FlavourTag Particle SmartRef found" ).ignore();
       }
@@ -131,8 +124,7 @@ void FlavourTagPacker::unpack( const PackedData& pft, Data& ft, const PackedData
       for ( auto iP = ptagger.firstTagP; iP < ptagger.lastTagP; ++iP ) {
         int hintID( 0 ), key( 0 );
         if ( m_pack.hintAndKey64( pfts.taggeringPs()[iP], &pfts, &fts, hintID, key ) ) {
-          SmartRef<LHCb::Particle> ref( &fts, hintID, key );
-          tagger.addToTaggerParts( ref );
+          tagger.addToTaggerParts( {&fts, hintID, key} );
         } else {
           parent().Error( "Corrupt FlavourTag Tagging Particle SmartRef found" ).ignore();
         }
diff --git a/Event/EventPacker/src/lib/PackedMCCaloHit.cpp b/Event/EventPacker/src/lib/PackedMCCaloHit.cpp
index 9d60537e56f..d42f61d68d1 100644
--- a/Event/EventPacker/src/lib/PackedMCCaloHit.cpp
+++ b/Event/EventPacker/src/lib/PackedMCCaloHit.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedMCCaloHit.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
@@ -55,8 +49,7 @@ void MCCaloHitPacker::unpack( const PackedDataVector& phits, DataVector& hits )
         int hintID( 0 ), key( 0 );
         if ( ( 0 != ver && m_pack.hintAndKey64( phit.mcParticle, &phits, &hits, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( phit.mcParticle, &phits, &hits, hintID, key ) ) ) {
-          SmartRef<LHCb::MCParticle> ref( &hits, hintID, key );
-          hit->setParticle( ref );
+          hit->setParticle( {&hits, hintID, key} );
         } else {
           parent().Error( "Corrupt MCCaloHit MCParticle SmartRef detected." ).ignore();
         }
diff --git a/Event/EventPacker/src/lib/PackedMCHit.cpp b/Event/EventPacker/src/lib/PackedMCHit.cpp
index ba0c87047a8..7431e2e4dd1 100644
--- a/Event/EventPacker/src/lib/PackedMCHit.cpp
+++ b/Event/EventPacker/src/lib/PackedMCHit.cpp
@@ -8,18 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// STL
-#include <sstream>
-
-// local
 #include "Event/PackedMCHit.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
-#include "GaudiKernel/GaudiException.h"
+#include <sstream>
 
 using namespace LHCb;
 
@@ -71,8 +63,7 @@ void MCHitPacker::unpack( const PackedDataVector& phits, DataVector& hits ) cons
         int hintID( 0 ), key( 0 );
         if ( ( 0 != ver && m_pack.hintAndKey64( phit.mcParticle, &phits, &hits, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( phit.mcParticle, &phits, &hits, hintID, key ) ) ) {
-          SmartRef<LHCb::MCParticle> ref( &hits, hintID, key );
-          hit->setMCParticle( ref );
+          hit->setMCParticle( {&hits, hintID, key} );
         } else {
           parent().Error( "Corrupt MCHit MCParticle SmartRef detected." ).ignore();
         }
diff --git a/Event/EventPacker/src/lib/PackedMCRichDigitSummary.cpp b/Event/EventPacker/src/lib/PackedMCRichDigitSummary.cpp
index 0abdb76e69f..df9ae585beb 100644
--- a/Event/EventPacker/src/lib/PackedMCRichDigitSummary.cpp
+++ b/Event/EventPacker/src/lib/PackedMCRichDigitSummary.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedMCRichDigitSummary.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
@@ -55,8 +49,7 @@ void MCRichDigitSummaryPacker::unpack( const PackedDataVector& psums, DataVector
         int hintID( 0 ), key( 0 );
         if ( ( 0 != ver && m_pack.hintAndKey64( psum.mcParticle, &psums, &sums, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( psum.mcParticle, &psums, &sums, hintID, key ) ) ) {
-          SmartRef<LHCb::MCParticle> ref( &sums, hintID, key );
-          sum->setMCParticle( ref );
+          sum->setMCParticle( {&sums, hintID, key} );
         } else {
           parent().Error( "Corrupt MCRichDigitSummary MCParticle SmartRef detected." ).ignore();
         }
diff --git a/Event/EventPacker/src/lib/PackedMCRichHit.cpp b/Event/EventPacker/src/lib/PackedMCRichHit.cpp
index 97a6436a72e..1c80d6c9f3b 100644
--- a/Event/EventPacker/src/lib/PackedMCRichHit.cpp
+++ b/Event/EventPacker/src/lib/PackedMCRichHit.cpp
@@ -8,13 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// local
 #include "Event/PackedMCRichHit.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
@@ -61,8 +56,7 @@ void MCRichHitPacker::unpack( const PackedDataVector& phits, DataVector& hits )
         int hintID( 0 ), key( 0 );
         if ( ( 0 != ver && m_pack.hintAndKey64( phit.mcParticle, &phits, &hits, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( phit.mcParticle, &phits, &hits, hintID, key ) ) ) {
-          SmartRef<LHCb::MCParticle> ref( &hits, hintID, key );
-          hit->setMCParticle( ref );
+          hit->setMCParticle( {&hits, hintID, key} );
         } else {
           parent().Error( "Corrupt MCRichHit MCParticle SmartRef detected." ).ignore();
         }
diff --git a/Event/EventPacker/src/lib/PackedMCRichOpticalPhoton.cpp b/Event/EventPacker/src/lib/PackedMCRichOpticalPhoton.cpp
index febc571eeb9..c2ca0fe4c84 100644
--- a/Event/EventPacker/src/lib/PackedMCRichOpticalPhoton.cpp
+++ b/Event/EventPacker/src/lib/PackedMCRichOpticalPhoton.cpp
@@ -8,15 +8,9 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// local
 #include "Event/PackedMCRichOpticalPhoton.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
 
-// Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
 using namespace LHCb;
 
 void MCRichOpticalPhotonPacker::pack( const DataVector& phots, PackedDataVector& pphots ) const {
@@ -112,8 +106,7 @@ void MCRichOpticalPhotonPacker::unpack( const PackedDataVector& pphots, DataVect
         int hintID( 0 ), key( 0 );
         if ( ( 0 != ver && m_pack.hintAndKey64( pphot.mcrichhit, &pphots, &phots, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( pphot.mcrichhit, &pphots, &phots, hintID, key ) ) ) {
-          SmartRef<LHCb::MCRichHit> ref( &phots, hintID, key );
-          phot->setMcRichHit( ref );
+          phot->setMcRichHit( {&phots, hintID, key} );
         } else {
           parent().Error( "Corrupt MCRichOpticalPhoton MCRichHit SmartRef detected." ).ignore();
         }
diff --git a/Event/EventPacker/src/lib/PackedMCRichSegment.cpp b/Event/EventPacker/src/lib/PackedMCRichSegment.cpp
index 9b914f7c26f..d7a8d0d7b53 100644
--- a/Event/EventPacker/src/lib/PackedMCRichSegment.cpp
+++ b/Event/EventPacker/src/lib/PackedMCRichSegment.cpp
@@ -8,13 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// local
 #include "Event/PackedMCRichSegment.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
@@ -104,8 +99,7 @@ void MCRichSegmentPacker::unpack( const PackedDataVector& psegs, DataVector& seg
       if ( -1 != pseg.mcParticle ) {
         if ( ( 0 != ver && m_pack.hintAndKey64( pseg.mcParticle, &psegs, &segs, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( pseg.mcParticle, &psegs, &segs, hintID, key ) ) ) {
-          SmartRef<LHCb::MCParticle> refa( &segs, hintID, key );
-          seg->setMcParticle( refa );
+          seg->setMcParticle( {&segs, hintID, key} );
         } else {
           parent().Error( "Corrupt MCRichSegment MCParticle SmartRef detected." ).ignore();
         }
@@ -114,8 +108,7 @@ void MCRichSegmentPacker::unpack( const PackedDataVector& psegs, DataVector& seg
       if ( -1 != pseg.mcRichTrack ) {
         if ( ( 0 != ver && m_pack.hintAndKey64( pseg.mcRichTrack, &psegs, &segs, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( pseg.mcRichTrack, &psegs, &segs, hintID, key ) ) ) {
-          SmartRef<LHCb::MCRichTrack> refb( &segs, hintID, key );
-          seg->setMCRichTrack( refb );
+          seg->setMCRichTrack( {&segs, hintID, key} );
         } else {
           parent().Error( "Corrupt MCRichSegment MCRichTrack SmartRef detected." ).ignore();
         }
@@ -124,8 +117,7 @@ void MCRichSegmentPacker::unpack( const PackedDataVector& psegs, DataVector& seg
       for ( const auto& P : pseg.mcPhotons ) {
         if ( ( 0 != ver && m_pack.hintAndKey64( P, &psegs, &segs, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( P, &psegs, &segs, hintID, key ) ) ) {
-          SmartRef<LHCb::MCRichOpticalPhoton> ref( &segs, hintID, key );
-          seg->addToMCRichOpticalPhotons( ref );
+          seg->addToMCRichOpticalPhotons( {&segs, hintID, key} );
         } else {
           parent().Error( "Corrupt MCRichSegment MCRichOpticalPhoton SmartRef detected." ).ignore();
         }
@@ -134,8 +126,7 @@ void MCRichSegmentPacker::unpack( const PackedDataVector& psegs, DataVector& seg
       for ( const auto& H : pseg.mcHits ) {
         if ( ( 0 != ver && m_pack.hintAndKey64( H, &psegs, &segs, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( H, &psegs, &segs, hintID, key ) ) ) {
-          SmartRef<LHCb::MCRichHit> ref( &segs, hintID, key );
-          seg->addToMCRichHits( ref );
+          seg->addToMCRichHits( {&segs, hintID, key} );
         } else {
           parent().Error( "Corrupt MCRichSegment MCRichHit SmartRef detected." ).ignore();
         }
diff --git a/Event/EventPacker/src/lib/PackedMCRichTrack.cpp b/Event/EventPacker/src/lib/PackedMCRichTrack.cpp
index 43f70882471..3643fb7ded1 100644
--- a/Event/EventPacker/src/lib/PackedMCRichTrack.cpp
+++ b/Event/EventPacker/src/lib/PackedMCRichTrack.cpp
@@ -8,13 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// local
 #include "Event/PackedMCRichTrack.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
@@ -58,8 +53,7 @@ void MCRichTrackPacker::unpack( const PackedDataVector& ptracks, DataVector& tra
       for ( const auto& S : ptrack.mcSegments ) {
         if ( ( 0 != ver && m_pack.hintAndKey64( S, &ptracks, &tracks, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( S, &ptracks, &tracks, hintID, key ) ) ) {
-          SmartRef<LHCb::MCRichSegment> ref( &tracks, hintID, key );
-          track->addToMcSegments( ref );
+          track->addToMcSegments( {&tracks, hintID, key} );
         } else {
           parent().Error( "Corrupt MCRichTrack MCRichSegment SmartRef detected." ).ignore();
         }
@@ -68,8 +62,7 @@ void MCRichTrackPacker::unpack( const PackedDataVector& ptracks, DataVector& tra
       if ( -1 != ptrack.mcParticle ) {
         if ( ( 0 != ver && m_pack.hintAndKey64( ptrack.mcParticle, &ptracks, &tracks, hintID, key ) ) ||
              ( 0 == ver && m_pack.hintAndKey32( ptrack.mcParticle, &ptracks, &tracks, hintID, key ) ) ) {
-          SmartRef<LHCb::MCParticle> ref( &tracks, hintID, key );
-          track->setMcParticle( ref );
+          track->setMcParticle( {&tracks, hintID, key} );
         } else {
           parent().Error( "Corrupt MCRichTrack MCParticle SmartRef detected." ).ignore();
         }
diff --git a/Event/EventPacker/src/lib/PackedMuonPID.cpp b/Event/EventPacker/src/lib/PackedMuonPID.cpp
index 357ac279999..8720a6870be 100644
--- a/Event/EventPacker/src/lib/PackedMuonPID.cpp
+++ b/Event/EventPacker/src/lib/PackedMuonPID.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedMuonPID.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
@@ -80,8 +74,7 @@ void MuonPIDPacker::unpack( const PackedData& ppid, Data& pid, const PackedDataV
       int hintID( 0 ), key( 0 );
       if ( ( 1 < ver && m_pack.hintAndKey64( ppid.idtrack, &ppids, &pids, hintID, key ) ) ||
            ( 1 >= ver && m_pack.hintAndKey32( ppid.idtrack, &ppids, &pids, hintID, key ) ) ) {
-        SmartRef<LHCb::Track> ref( &pids, hintID, key );
-        pid.setIDTrack( ref );
+        pid.setIDTrack( {&pids, hintID, key} );
       } else {
         parent().Error( "Corrupt MuonPID Track SmartRef detected." ).ignore();
       }
@@ -90,8 +83,7 @@ void MuonPIDPacker::unpack( const PackedData& ppid, Data& pid, const PackedDataV
       int hintID( 0 ), key( 0 );
       if ( ( 1 < ver && m_pack.hintAndKey64( ppid.mutrack, &ppids, &pids, hintID, key ) ) ||
            ( 1 >= ver && m_pack.hintAndKey32( ppid.mutrack, &ppids, &pids, hintID, key ) ) ) {
-        SmartRef<LHCb::Track> ref( &pids, hintID, key );
-        pid.setMuonTrack( ref );
+        pid.setMuonTrack( {&pids, hintID, key} );
       } else {
         parent().Error( "Corrupt MuonPID MuTrack SmartRef detected." ).ignore();
       }
diff --git a/Event/EventPacker/src/lib/PackedPartToRelatedInfoRelation.cpp b/Event/EventPacker/src/lib/PackedPartToRelatedInfoRelation.cpp
index 7473f8bc477..e2596bec5a0 100644
--- a/Event/EventPacker/src/lib/PackedPartToRelatedInfoRelation.cpp
+++ b/Event/EventPacker/src/lib/PackedPartToRelatedInfoRelation.cpp
@@ -8,13 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
 #include "Event/PackedPartToRelatedInfoRelation.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
diff --git a/Event/EventPacker/src/lib/PackedParticle.cpp b/Event/EventPacker/src/lib/PackedParticle.cpp
index e8ac046d341..512721f3e7f 100644
--- a/Event/EventPacker/src/lib/PackedParticle.cpp
+++ b/Event/EventPacker/src/lib/PackedParticle.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedParticle.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
@@ -206,8 +200,7 @@ void ParticlePacker::unpack( const PackedData& ppart, Data& part, const PackedDa
     if ( -1 != ppart.vertex ) {
       int hintID( 0 ), key( 0 );
       if ( m_pack.hintAndKey64( ppart.vertex, &pparts, &parts, hintID, key ) ) {
-        SmartRef<LHCb::Vertex> ref( &parts, hintID, key );
-        part.setEndVertex( ref );
+        part.setEndVertex( {&parts, hintID, key} );
       } else {
         parent().Error( "Corrupt Particle Vertex SmartRef found" ).ignore();
       }
@@ -217,8 +210,7 @@ void ParticlePacker::unpack( const PackedData& ppart, Data& part, const PackedDa
     if ( -1 != ppart.proto ) {
       int hintID( 0 ), key( 0 );
       if ( m_pack.hintAndKey64( ppart.proto, &pparts, &parts, hintID, key ) ) {
-        SmartRef<LHCb::ProtoParticle> ref( &parts, hintID, key );
-        part.setProto( ref );
+        part.setProto( {&parts, hintID, key} );
       } else {
         parent().Error( "Corrupt Particle ProtoParticle SmartRef found" ).ignore();
       }
@@ -228,8 +220,7 @@ void ParticlePacker::unpack( const PackedData& ppart, Data& part, const PackedDa
     for ( auto iiD = ppart.firstDaughter; iiD < ppart.lastDaughter; ++iiD ) {
       int hintID( 0 ), key( 0 );
       if ( m_pack.hintAndKey64( pparts.daughters()[iiD], &pparts, &parts, hintID, key ) ) {
-        SmartRef<LHCb::Particle> ref( &parts, hintID, key );
-        part.addToDaughters( ref );
+        part.addToDaughters( {&parts, hintID, key} );
       } else {
         parent().Error( "Corrupt Particle Daughter Particle SmartRef found" ).ignore();
       }
diff --git a/Event/EventPacker/src/lib/PackedProtoParticle.cpp b/Event/EventPacker/src/lib/PackedProtoParticle.cpp
index c07e3e7f328..e6262e6f4ba 100644
--- a/Event/EventPacker/src/lib/PackedProtoParticle.cpp
+++ b/Event/EventPacker/src/lib/PackedProtoParticle.cpp
@@ -8,20 +8,11 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// STL
-#include <sstream>
-
-// local
 #include "Event/PackedProtoParticle.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
-
-// Boost
 #include <boost/numeric/conversion/bounds.hpp>
+#include <sstream>
 
 using namespace LHCb;
 
@@ -70,7 +61,7 @@ void ProtoParticlePacker::pack( const Data& proto, PackedData& pproto, PackedDat
 
     //== Store the CaloHypos
     pproto.firstHypo = pprotos.refs().size();
-    for ( const SmartRef<LHCb::CaloHypo>& caloH : proto.calo() ) {
+    for ( const auto& caloH : proto.calo() ) {
       pprotos.refs().push_back( UNLIKELY( 0 == ver ) ? m_pack.reference32( &pprotos, caloH->parent(), caloH->key() )
                                                      : m_pack.reference64( &pprotos, caloH->parent(), caloH->key() ) );
       if ( parent().msgLevel( MSG::VERBOSE ) )
@@ -125,8 +116,7 @@ void ProtoParticlePacker::unpack( const PackedData& pproto, Data& proto, const P
     if ( -1 != pproto.track ) {
       if ( ( 0 != ver && m_pack.hintAndKey64( pproto.track, &pprotos, &protos, hintID, key ) ) ||
            ( 0 == ver && m_pack.hintAndKey32( pproto.track, &pprotos, &protos, hintID, key ) ) ) {
-        SmartRef<LHCb::Track> ref( &protos, hintID, key );
-        proto.setTrack( ref );
+        proto.setTrack( {&protos, hintID, key} );
         if ( parent().msgLevel( MSG::VERBOSE ) ) {
           parent().verbose() << " -> Track PackedRef " << pproto.track << " hintID " << hintID << " key " << key
                              << " -> SmartRef " << proto.track();
@@ -141,8 +131,7 @@ void ProtoParticlePacker::unpack( const PackedData& pproto, Data& proto, const P
     if ( -1 != pproto.richPID ) {
       if ( ( 0 != ver && m_pack.hintAndKey64( pproto.richPID, &pprotos, &protos, hintID, key ) ) ||
            ( 0 == ver && m_pack.hintAndKey32( pproto.richPID, &pprotos, &protos, hintID, key ) ) ) {
-        SmartRef<LHCb::RichPID> ref( &protos, hintID, key );
-        proto.setRichPID( ref );
+        proto.setRichPID( {&protos, hintID, key} );
         if ( parent().msgLevel( MSG::VERBOSE ) ) {
           parent().verbose() << " -> RichPID PackedRef " << pproto.richPID << " hintID " << hintID << " key " << key
                              << " -> SmartRef " << proto.richPID();
@@ -157,8 +146,7 @@ void ProtoParticlePacker::unpack( const PackedData& pproto, Data& proto, const P
     if ( -1 != pproto.muonPID ) {
       if ( ( 0 != ver && m_pack.hintAndKey64( pproto.muonPID, &pprotos, &protos, hintID, key ) ) ||
            ( 0 == ver && m_pack.hintAndKey32( pproto.muonPID, &pprotos, &protos, hintID, key ) ) ) {
-        SmartRef<LHCb::MuonPID> ref( &protos, hintID, key );
-        proto.setMuonPID( ref );
+        proto.setMuonPID( {&protos, hintID, key} );
         if ( parent().msgLevel( MSG::VERBOSE ) ) {
           parent().verbose() << " -> MuonPID PackedRef " << pproto.muonPID << " hintID " << hintID << " key " << key
                              << " -> SmartRef " << proto.muonPID();
@@ -185,7 +173,7 @@ void ProtoParticlePacker::unpack( const PackedData& pproto, Data& proto, const P
       }
     }
 
-    for ( int kk = pproto.firstExtra; pproto.lastExtra > kk; ++kk ) {
+    for ( int kk = pproto.firstExtra; kk < pproto.lastExtra; ++kk ) {
       const auto& info = *( pprotos.extras().begin() + kk );
       proto.addInfo( info.first, m_pack.fltPacked( info.second ) );
     }
diff --git a/Event/EventPacker/src/lib/PackedRecVertex.cpp b/Event/EventPacker/src/lib/PackedRecVertex.cpp
index 4f96b605e5b..c865b828a83 100644
--- a/Event/EventPacker/src/lib/PackedRecVertex.cpp
+++ b/Event/EventPacker/src/lib/PackedRecVertex.cpp
@@ -8,13 +8,9 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedRecVertex.h"
-#include "Event/PackerUtils.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
+#include "Event/PackerUtils.h"
 
 using namespace LHCb;
 
diff --git a/Event/EventPacker/src/lib/PackedRichPID.cpp b/Event/EventPacker/src/lib/PackedRichPID.cpp
index 3c42d70c7a5..03268c268f3 100644
--- a/Event/EventPacker/src/lib/PackedRichPID.cpp
+++ b/Event/EventPacker/src/lib/PackedRichPID.cpp
@@ -8,15 +8,9 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-// local
 #include "Event/PackedRichPID.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
 
-// Gaudi
-#include "GaudiAlg/GaudiAlgorithm.h"
-
 using namespace LHCb;
 
 void RichPIDPacker::pack( const Data& pid, PackedData& ppid, PackedDataVector& ppids ) const {
@@ -71,8 +65,7 @@ void RichPIDPacker::unpack( const PackedData& ppid, Data& pid, const PackedDataV
       // Smart ref packing changed to 64 bit in packing version 3 onwards
       if ( ( ver >= 3 && m_pack.hintAndKey64( ppid.track, &ppids, &pids, hintID, key ) ) ||
            ( ver < 3 && m_pack.hintAndKey32( ppid.track, &ppids, &pids, hintID, key ) ) ) {
-        SmartRef<LHCb::Track> ref( &pids, hintID, key );
-        pid.setTrack( ref );
+        pid.setTrack( {&pids, hintID, key} );
       } else {
         parent().Error( "Corrupt RichPID Track SmartRef detected." ).ignore();
       }
diff --git a/Event/EventPacker/src/lib/PackedTrack.cpp b/Event/EventPacker/src/lib/PackedTrack.cpp
index 292b228f167..f64d38a1ee2 100644
--- a/Event/EventPacker/src/lib/PackedTrack.cpp
+++ b/Event/EventPacker/src/lib/PackedTrack.cpp
@@ -8,16 +8,9 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedTrack.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
-
 using namespace LHCb;
 
 //-----------------------------------------------------------------------------
diff --git a/Event/EventPacker/src/lib/PackedVertex.cpp b/Event/EventPacker/src/lib/PackedVertex.cpp
index fe496388dd6..37f5b2e7c97 100644
--- a/Event/EventPacker/src/lib/PackedVertex.cpp
+++ b/Event/EventPacker/src/lib/PackedVertex.cpp
@@ -8,18 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// STL
-#include <algorithm>
-
-// local
 #include "Event/PackedVertex.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
+#include <algorithm>
 
 using namespace LHCb;
 
@@ -102,8 +94,7 @@ void VertexPacker::unpack( const PackedData& pvert, Data& vert, const PackedData
       const auto& iP = pverts.outgoingParticles()[iiP];
       int         hintID( 0 ), key( 0 );
       if ( m_pack.hintAndKey64( iP, &pverts, &verts, hintID, key ) ) {
-        SmartRef<LHCb::Particle> ref( &verts, hintID, key );
-        vert.addToOutgoingParticles( ref );
+        vert.addToOutgoingParticles( {&verts, hintID, key} );
       } else {
         parent().Error( "Corrupt Vertex Particle SmartRef found" ).ignore();
       }
diff --git a/Event/EventPacker/src/lib/PackedWeightsVector.cpp b/Event/EventPacker/src/lib/PackedWeightsVector.cpp
index 610ad0ee2d2..b7adc7e2af5 100644
--- a/Event/EventPacker/src/lib/PackedWeightsVector.cpp
+++ b/Event/EventPacker/src/lib/PackedWeightsVector.cpp
@@ -8,14 +8,8 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/PackedWeightsVector.h"
-
-// Checks
 #include "Event/PackedEventChecks.h"
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
 using namespace LHCb;
diff --git a/Event/EventPacker/src/lib/StandardPacker.cpp b/Event/EventPacker/src/lib/StandardPacker.cpp
index c89502a24ee..fd41e759fb4 100644
--- a/Event/EventPacker/src/lib/StandardPacker.cpp
+++ b/Event/EventPacker/src/lib/StandardPacker.cpp
@@ -8,16 +8,10 @@
 * granted to it by virtue of its status as an Intergovernmental Organization  *
 * or submit itself to any jurisdiction.                                       *
 \*****************************************************************************/
-
-// local
 #include "Event/StandardPacker.h"
-
-// STL
-#include <sstream>
-
-// Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 #include "GaudiKernel/GaudiException.h"
+#include <sstream>
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : StandardPacker
-- 
GitLab