From 11e1b584b3e91017f21bce7557f9e23e45b38077 Mon Sep 17 00:00:00 2001
From: amete <serhanmete@gmail.com>
Date: Fri, 21 Aug 2020 11:35:44 +0200
Subject: [PATCH] Remove IAuxStoreCompression and its implementation in
 AuxContainerBase. This interface is no longer needed because we don't store
 the lossy float compression information in the transient object but rather in
 the event store, per stream.

---
 .../AthContainers/AthContainersDict.h         |  1 -
 .../AthContainers/AthContainers/selection.xml |  1 -
 .../AthContainers/src/copyAuxStoreThinned.cxx |  1 -
 .../IAuxStoreCompression.h                    | 56 ----------------
 .../AthenaServices/src/AthenaOutputStream.cxx | 20 +-----
 Event/xAOD/xAODCore/Root/AuxContainerBase.cxx | 64 -------------------
 .../xAOD/xAODCore/xAODCore/AuxContainerBase.h | 24 ++-----
 7 files changed, 6 insertions(+), 161 deletions(-)
 delete mode 100644 Control/AthContainersInterfaces/AthContainersInterfaces/IAuxStoreCompression.h

diff --git a/Control/AthContainers/AthContainers/AthContainersDict.h b/Control/AthContainers/AthContainers/AthContainersDict.h
index 977507fa6244..aa50fc28d6a7 100644
--- a/Control/AthContainers/AthContainers/AthContainersDict.h
+++ b/Control/AthContainers/AthContainers/AthContainersDict.h
@@ -15,7 +15,6 @@
 #include "AthContainersInterfaces/IConstAuxStore.h"
 #include "AthContainersInterfaces/IAuxStoreIO.h"
 #include "AthContainersInterfaces/IAuxStoreHolder.h"
-#include "AthContainersInterfaces/IAuxStoreCompression.h"
 #include "AthContainersInterfaces/IAuxSetOption.h"
 #include "AthContainers/AuxStoreInternal.h"
 #include "AthContainers/OwnershipPolicy.h"
diff --git a/Control/AthContainers/AthContainers/selection.xml b/Control/AthContainers/AthContainers/selection.xml
index 81d36541e2d6..7e3e9d10b685 100644
--- a/Control/AthContainers/AthContainers/selection.xml
+++ b/Control/AthContainers/AthContainers/selection.xml
@@ -23,7 +23,6 @@
   <class name="DataLink<SG::IConstAuxStore>" />
   <class name="SG::IAuxStoreIO"/>
   <class name="SG::IAuxStoreHolder"/>
-  <class name="SG::IAuxStoreCompression"/>
   <class name="SG::IAuxTypeVectorFactory"/>
   <class name="SG::AuxStoreInternal" id="77039D3D-4E24-46C1-B5D1-9AD5F17D3B09">
     <field name="m_vecs" transient="true"/>
diff --git a/Control/AthContainers/src/copyAuxStoreThinned.cxx b/Control/AthContainers/src/copyAuxStoreThinned.cxx
index 3af0822cd6d2..41bca876a473 100644
--- a/Control/AthContainers/src/copyAuxStoreThinned.cxx
+++ b/Control/AthContainers/src/copyAuxStoreThinned.cxx
@@ -15,7 +15,6 @@
 #include "AthContainersInterfaces/IConstAuxStore.h"
 #include "AthContainersInterfaces/IAuxStore.h"
 #include "AthContainersInterfaces/IAuxStoreIO.h"
-#include "AthContainersInterfaces/IAuxStoreCompression.h"
 #include "AthenaKernel/ThinningDecisionBase.h"
 #include "CxxUtils/no_sanitize_undefined.h"
 #include "CxxUtils/FloatCompressor.h"
diff --git a/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxStoreCompression.h b/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxStoreCompression.h
deleted file mode 100644
index bdaccc9d0123..000000000000
--- a/Control/AthContainersInterfaces/AthContainersInterfaces/IAuxStoreCompression.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
-*/
-
-
-#ifndef ATHCONTAINERSINTERFACES_IAUXSTORECOMPRESSION_H
-#define ATHCONTAINERSINTERFACES_IAUXSTORECOMPRESSION_H
-
-
-#include "AthContainersInterfaces/AuxTypes.h"
-#include <typeinfo>
-#include <set>
-#include <vector>
-
-namespace SG {
-
-
-class IAuxStoreCompression
-{
-public:
-  /// Destructor
-  virtual ~IAuxStoreCompression() {}
-
-  /// Set the list of variables to be compressed
-  virtual void
-  setCompressedAuxIDs ( const std::vector< std::set< std::string > >& /*attr*/ ) = 0;
-
-  /// Get the list of variables to be compressed
-  virtual SG::auxid_set_t
-  getCompressedAuxIDs( const bool& /*highComp*/ ) const = 0;
-
-  /// Get compressed value given a float
-  virtual float
-  getCompressedValue( const float& /*val*/, const bool& /*highComp*/ ) const = 0;
-
-  /// Set the number of bits for the float compression
-  virtual void
-  setCompressionBits ( const std::vector< unsigned int >& /*nbits*/ ) = 0;
-
-  /// Get the number of bits for the float compression
-  virtual unsigned int
-  getCompressionBits ( const bool& /*highComp*/ ) const = 0;
-
-}; // class IAuxStoreCompression
-
-
-} // namespace SG
-
-
-#ifndef XAOD_STANDALONE
-#include "AthenaKernel/CLASS_DEF.h"
-CLASS_DEF( SG::IAuxStoreCompression, 55263982, 1 )
-#endif
-
-
-#endif // not ATHCONTAINERSINTERFACES_IAUXSTOREIO_H
diff --git a/Control/AthenaServices/src/AthenaOutputStream.cxx b/Control/AthenaServices/src/AthenaOutputStream.cxx
index 8771351fa2f6..b0f8578f187a 100644
--- a/Control/AthenaServices/src/AthenaOutputStream.cxx
+++ b/Control/AthenaServices/src/AthenaOutputStream.cxx
@@ -33,7 +33,6 @@
 
 #include "AthContainersInterfaces/IAuxStore.h"
 #include "AthContainersInterfaces/IAuxStoreIO.h"
-#include "AthContainersInterfaces/IAuxStoreCompression.h"
 #include "OutputStreamSequencerSvc.h"
 #include "MetaDataSvc.h"
 #include "SelectionVetoes.h"
@@ -715,7 +714,7 @@ void AthenaOutputStream::addItemObjects(const SG::FolderItem& item,
    // CompressionList follows the same logic as the ItemList
    // We find the matching keys, read the string after "Aux.",
    // tokenize by "." and build an std::set of these to be
-   // communicated to IAuxStoreCompression down below
+   // communicated to ThinningInfo down below
    std::vector<unsigned int> comp_bits{ m_compressionBitsHigh, m_compressionBitsLow };
    std::vector<std::set<std::string>> comp_attr;
    comp_attr.resize(2);
@@ -917,22 +916,7 @@ void AthenaOutputStream::addItemObjects(const SG::FolderItem& item,
                                              vetoes);
                   }
 
-                  // Here comes the compression logic using SG::IAuxStoreCompression
-                  // similar to that of SG::IAuxStoreIO above
-                  SG::IAuxStoreCompression* auxcomp( nullptr );
-                  try {
-                    SG::fromStorable( itemProxy->object(), auxcomp, true );
-                  } catch( const std::exception& ) {
-                    ATH_MSG_DEBUG( "Error in casting object with CLID "
-                                   << itemProxy->clID() << " to SG::IAuxStoreCompression*" );
-                    auxcomp = nullptr;
-                  }
-                  if ( auxcomp ) {
-                    auxcomp->setCompressedAuxIDs( comp_attr );
-                    auxcomp->setCompressionBits( comp_bits );
-                  }
-
-                  // New Compression Logic
+                  // Here comes the compression logic using ThinningInfo
                   SG::IAuxStore* auxstore( nullptr );
                   try {
                     SG::fromStorable( itemProxy->object(), auxstore, true );
diff --git a/Event/xAOD/xAODCore/Root/AuxContainerBase.cxx b/Event/xAOD/xAODCore/Root/AuxContainerBase.cxx
index 37216aa05634..6e405fb48ec5 100644
--- a/Event/xAOD/xAODCore/Root/AuxContainerBase.cxx
+++ b/Event/xAOD/xAODCore/Root/AuxContainerBase.cxx
@@ -638,70 +638,6 @@ namespace xAOD {
    //
    /////////////////////////////////////////////////////////////////////////////
 
-   /////////////////////////////////////////////////////////////////////////////
-   //
-   //           Implementation of the SG::IAuxStoreCompression functions
-   //
-
-   void
-   AuxContainerBase::setCompressedAuxIDs( const std::vector< std::set< std::string > >& attributes ) {
-
-      // Guard against multi-threaded execution:
-      guard_t guard( m_mutex );
-
-      m_compression.setCompressedAuxIDs( attributes );
-   }
-
-   AuxContainerBase::auxid_set_t
-   AuxContainerBase::getCompressedAuxIDs( const bool& highComp ) const {
-
-      // Guard against multi-threaded execution:
-      guard_t guard( m_mutex );
-
-      return m_compression.getCompressedAuxIDs( getWritableAuxIDs(), highComp );
-   }
-
-   float
-   AuxContainerBase::getCompressedValue( const float& value, const bool& highComp ) const {
-
-      // Guard against multi-threaded execution:
-      guard_t guard( m_mutex );
-
-      // Two main modes are supported: High and Low Compression
-      const unsigned int idx = highComp ? AuxCompression::High : AuxCompression::Low;
-
-      // This part could be nicer if we were to rewrite CxxUtils::FloatCompressor
-      // to accept the number of bits in the call to reduceFloatPrecision instead
-      // of the constructor
-      static const unsigned int high_bits = m_compression.getCompressionBits(true);
-      static const unsigned int low_bits = m_compression.getCompressionBits(false);
-      static const std::vector< CxxUtils::FloatCompressor >
-      myFloatCompressors { CxxUtils::FloatCompressor(high_bits), CxxUtils::FloatCompressor(low_bits) };
-
-      return myFloatCompressors[ idx ].reduceFloatPrecision( value );
-   }
-
-   void
-   AuxContainerBase::setCompressionBits( const std::vector< unsigned int >& nbits ) {
-
-      // Guard against multi-threaded execution:
-      guard_t guard( m_mutex );
-
-      m_compression.setCompressionBits( nbits );
-   }
-
-   unsigned int
-   AuxContainerBase::getCompressionBits( const bool& highComp ) const {
-
-      // Guard against multi-threaded execution:
-      guard_t guard( m_mutex );
-
-      return m_compression.getCompressionBits( highComp );
-   }
-
-   //
-   /////////////////////////////////////////////////////////////////////////////
-
    const char* AuxContainerBase::name() const {
 
       return m_name.c_str();
diff --git a/Event/xAOD/xAODCore/xAODCore/AuxContainerBase.h b/Event/xAOD/xAODCore/xAODCore/AuxContainerBase.h
index b7778c25aab2..ee12ff2011ca 100644
--- a/Event/xAOD/xAODCore/xAODCore/AuxContainerBase.h
+++ b/Event/xAOD/xAODCore/xAODCore/AuxContainerBase.h
@@ -13,7 +13,6 @@
 #include "AthContainersInterfaces/IAuxStore.h"
 #include "AthContainersInterfaces/IAuxStoreIO.h"
 #include "AthContainersInterfaces/IAuxStoreHolder.h"
-#include "AthContainersInterfaces/IAuxStoreCompression.h"
 #include "AthContainers/AuxTypeRegistry.h"
 #include "AthContainers/tools/threading.h"
 #include "AthContainers/PackedContainer.h"
@@ -48,8 +47,7 @@ namespace xAOD {
    ///
    class AuxContainerBase : public SG::IAuxStore,
                             public SG::IAuxStoreIO,
-                            public SG::IAuxStoreHolder,
-                            public SG::IAuxStoreCompression
+                            public SG::IAuxStoreHolder
 #ifndef XAOD_STANDALONE
                           , public ILockable
 #endif // not XAOD_STANDALONE
@@ -158,20 +156,6 @@ namespace xAOD {
 
       /// @}
 
-      /// @name Functions implementing the SG::IAuxStoreCompression interface
-      /// @{
-
-      virtual void setCompressedAuxIDs ( const std::vector< std::set< std::string > >& attributes ) override;
-
-      virtual SG::auxid_set_t getCompressedAuxIDs( const bool& highComp = true ) const override;
-
-      virtual float getCompressedValue ( const float& value, const bool& highComp = true ) const override;
-
-      virtual void setCompressionBits ( const std::vector< unsigned int >& nbits ) override;
-
-      virtual unsigned int getCompressionBits ( const bool& highComp = true ) const override;
-      /// @}
-
       /// @name Functions managing the instance name of the container
       /// @{
 
@@ -243,12 +227,12 @@ namespace xAOD {
 
 // Declare a class ID for the class:
 #include "xAODCore/CLASS_DEF.h"
-CLASS_DEF( xAOD::AuxContainerBase, 1225080690, 2 )
+CLASS_DEF( xAOD::AuxContainerBase, 1225080690, 3 )
 
 // Describe the inheritance of the class:
 #include "xAODCore/BaseInfo.h"
-SG_BASES4( xAOD::AuxContainerBase, SG::IAuxStore, SG::IAuxStoreIO,
-           SG::IAuxStoreHolder, SG::IAuxStoreCompression );
+SG_BASES3( xAOD::AuxContainerBase, SG::IAuxStore, SG::IAuxStoreIO,
+           SG::IAuxStoreHolder );
 
 // Include the template implementation:
 #include "AuxContainerBase.icc"
-- 
GitLab