From f9487d4043ccb0a0ec72437cd45aff09224f312c Mon Sep 17 00:00:00 2001
From: Gerhard Raven <gerhard.raven@nikhef.nl>
Date: Sat, 21 Apr 2018 17:37:05 +0200
Subject: [PATCH 1/2] Modernize MuonDet

- avoid copying `std::vector` unnecessarily
- prefer boost::lexical_cast over sprintf/sscanf
- prefer std::accumulate over explicit loop
---
 Det/MuonDet/MuonDet/MuonChamberGrid.h   | 34 +++++-------------
 Det/MuonDet/src/Lib/MuonChamberGrid.cpp | 48 ++++++++-----------------
 2 files changed, 24 insertions(+), 58 deletions(-)

diff --git a/Det/MuonDet/MuonDet/MuonChamberGrid.h b/Det/MuonDet/MuonDet/MuonChamberGrid.h
index 29af2870e9d..1a22f01c019 100644
--- a/Det/MuonDet/MuonDet/MuonChamberGrid.h
+++ b/Det/MuonDet/MuonDet/MuonChamberGrid.h
@@ -27,40 +27,24 @@ public:
   std::vector< std::pair<MuonFrontEndID, std::array<float,4> > > listOfPhysChannels(double x_enter,double y_enter,
 										   double x_exit,double y_exit);
 
-  double retLenght(int nLx,  std::vector<double> my_list);
+  double retLenght(int nLx,  const std::vector<double>& my_list);
 
   // Class ID of this class
-  inline static  const CLID& classID() {
-    return CLID_MuonChamberGrid;
-  };
+  static  const CLID& classID() { return CLID_MuonChamberGrid; };
 
-  inline unsigned int getNGrid(){
-    return m_number_of_grid;
-  }
+  unsigned int getNGrid(){ return m_number_of_grid; }
 
-  inline std::vector<int> getReadoutGrid(){
-    return m_readoutType;
-  }
+  const std::vector<int>& getReadoutGrid() { return m_readoutType; }
 
-  inline std::vector<int> getMapGrid(){
-    return m_mapType;
-  }
+  const std::vector<int>& getMapGrid() { return m_mapType; }
 
-  inline int getGrid1SizeX(){
-    return m_x_pad_rdout1.size();
-  }
+  int getGrid1SizeX(){ return m_x_pad_rdout1.size(); }
 
-  inline int getGrid1SizeY(){
-    return m_y_pad_rdout1.size();
-  }
+  int getGrid1SizeY(){ return m_y_pad_rdout1.size(); }
 
-  inline int getGrid2SizeX(){
-    return m_x_pad_rdout2.size();
-  }
+  int getGrid2SizeX(){ return m_x_pad_rdout2.size(); }
 
-  inline int getGrid2SizeY(){
-    return m_y_pad_rdout2.size();
-  }
+  int getGrid2SizeY(){ return m_y_pad_rdout2.size(); }
 
 
   StatusCode getPCCenter(MuonFrontEndID fe,
diff --git a/Det/MuonDet/src/Lib/MuonChamberGrid.cpp b/Det/MuonDet/src/Lib/MuonChamberGrid.cpp
index 0119ea0ccb2..ceb58c18d8e 100644
--- a/Det/MuonDet/src/Lib/MuonChamberGrid.cpp
+++ b/Det/MuonDet/src/Lib/MuonChamberGrid.cpp
@@ -8,7 +8,10 @@
 #include "MuonDet/MuonFrontEndID.h"
 #include <iostream>
 #include <vector>
-#include <math.h>
+#include <cmath>
+#include <cassert>
+#include "boost/lexical_cast.hpp"
+#include "boost/utility/string_ref.hpp"
 
 //-----------------------------------------------------------------------------
 // Implementation file for class : MuonChamberGrid
@@ -19,10 +22,10 @@
 //=============================================================================
 StatusCode MuonChamberGrid::initialize(){
 
-  char patt[400]; int Ngrid(0);
-  sprintf(patt,"%s",(this->name()).c_str());
-  sscanf(patt,"/G%d",&Ngrid);
-  m_number_of_grid = Ngrid;
+  boost::string_ref n = this->name();
+  assert( n.starts_with( "/G" ) );
+  n.remove_prefix(2);
+  m_number_of_grid = boost::lexical_cast<int>( n.data(), n.size() );
 
   m_x_pad_rdout1     = param< std::vector<double> >("xrd1");
   m_y_pad_rdout1     = param< std::vector<double> >("yrd1");
@@ -41,9 +44,6 @@ MuonChamberGrid::listOfPhysChannels(double x_enter,double y_enter,
   using GaudiUtils::operator<<; // for streaming std::vector
 
   std::vector< std::pair< MuonFrontEndID,std::array<float,4> > > keepTemporary;
-  std::pair< MuonFrontEndID,std::array<float,4> > tmpPair;
-  std::vector<double> x_rdout;
-  std::vector<double> y_rdout;
   double ParallelCutOff=0.0001;
 
   bool debug = false;
@@ -76,13 +76,8 @@ MuonChamberGrid::listOfPhysChannels(double x_enter,double y_enter,
     int PhNx,PhNy;
 
     //Readout choice
-    if(iRd) {
-      x_rdout = m_x_pad_rdout2;
-      y_rdout = m_y_pad_rdout2;
-    } else {
-      x_rdout = m_x_pad_rdout1;
-      y_rdout = m_y_pad_rdout1;
-    }
+    const std::vector<double>& x_rdout = ( iRd ? m_x_pad_rdout2 : m_x_pad_rdout1 );
+    const std::vector<double>& y_rdout = ( iRd ? m_y_pad_rdout2 : m_y_pad_rdout1 );
 
     //Physical channels settings related to the grid/readout
     PhNx = x_rdout.size();
@@ -153,16 +148,8 @@ MuonChamberGrid::listOfPhysChannels(double x_enter,double y_enter,
                        << nxChaExit<<std::endl;
 
     for (unsigned int Xloop=nxChaEntry;Xloop<=nxChaExit;Xloop++){
-      if(Xloop==nxChaEntry){
-        xBegin= xstart;
-      } else {
-        xBegin = retLenght(Xloop,x_rdout);
-      }
-      if(Xloop==nxChaExit){
-        xEnd= xstop;
-      }else{
-        xEnd = retLenght(Xloop+1,x_rdout);
-      }
+      xBegin = (Xloop==nxChaEntry ? xstart : retLenght(Xloop,x_rdout) );
+      xEnd   = (Xloop==nxChaExit  ? xstop  : retLenght(Xloop+1,x_rdout) );
 
       if(debug) std::cout<< "Linear Parameters bef p flag. Xbeg "
                          <<xBegin<<"; xEnd: "
@@ -195,7 +182,6 @@ MuonChamberGrid::listOfPhysChannels(double x_enter,double y_enter,
       for(inyLo = 0; inyLo < PhNy; inyLo++) {
         if(yBegin - tmpYLenght > ParallelCutOff) {
           tmpYLenght += y_rdout[inyLo];
-          //	  tmpYBegin =  inyLo+1;
           tmpYBegin =  inyLo;
         } else {
           break;
@@ -205,7 +191,6 @@ MuonChamberGrid::listOfPhysChannels(double x_enter,double y_enter,
       for(inyLo = 0; inyLo < PhNy; inyLo++) {
         if(yEnd - tmpYLenght > ParallelCutOff) {
           tmpYLenght += y_rdout[inyLo];
-          //	  tmpYEnd =  inyLo+1;
           tmpYEnd =  inyLo;
         } else {
           break;
@@ -304,17 +289,14 @@ MuonChamberGrid::listOfPhysChannels(double x_enter,double y_enter,
   return keepTemporary;
 }
 
-double MuonChamberGrid::retLenght(int nLx,  std::vector<double> my_list){
-  double lenght(0);
+double MuonChamberGrid::retLenght(int nLx, const std::vector<double>& my_list){
   int VctSize = my_list.size();
   if(nLx > VctSize) {
     nLx = VctSize;
     std::cout<<"MuonChamberGrid:: Vector index Out Of Range."<<std::endl;
   }
-  for(int inxLo = 0; inxLo < nLx; inxLo++) {
-    lenght += my_list[inxLo];
-  }
-  return lenght;
+  return std::accumulate( begin(my_list), std::next(begin(my_list),nLx),
+                          double{0} );
 }
 
 StatusCode MuonChamberGrid::getPCCenter(MuonFrontEndID fe,
-- 
GitLab


From f5caf81616cd66a3bff5ad7a972cdf2fe953018a Mon Sep 17 00:00:00 2001
From: Gerhard Raven <gerhard.raven@nikhef.nl>
Date: Sat, 21 Apr 2018 17:42:12 +0200
Subject: [PATCH 2/2] Modernize DetDesc

- remove inheritance from CommonMessaging in DetectorElement.
  It is not used (due to the fact that the automatic 'name' prefix
  in the output is not very usefull for DetectorElements.
- prefer boost::string_ref over std::string in interface to
  avoid creating temporary strings
- prefer compiler generated copy constructor
---
 Det/DetDesc/DetDesc/Condition.h             | 17 +---
 Det/DetDesc/DetDesc/DetectorElement.h       | 68 +++-----------
 Det/DetDesc/DetDesc/IConditionInfo.h        | 14 +--
 Det/DetDesc/DetDesc/IDetectorElement.h      |  2 +-
 Det/DetDesc/src/Lib/Condition.cpp           | 41 +++------
 Det/DetDesc/src/Lib/DetectorElement.cpp     |  1 -
 Det/DetDescSvc/src/UpdateManagerSvc.h       |  2 +-
 Ex/DetCondExample/src/CondDBTestAlgorithm.h |  2 +-
 Ex/DetCondExample/src/MultiDBTest.cpp       | 12 +--
 Ex/DetCondExample/src/MultiDBTest.h         |  6 +-
 Ex/DetCondExample/src/PopulateDB.h          | 16 ++--
 HC/HCDAQ/src/HCRawBankDecoderHlt.h          | 98 ++++++++++-----------
 Hlt/HltServices/src/HltConfigSvc.h          |  2 +-
 Kernel/LHCbAlgs/src/DQAcceptTool.h          |  4 +-
 Kernel/LHCbAlgs/src/DQFilter.h              |  2 +-
 15 files changed, 104 insertions(+), 183 deletions(-)

diff --git a/Det/DetDesc/DetDesc/Condition.h b/Det/DetDesc/DetDesc/Condition.h
index b4a5f594ab6..37575272aea 100644
--- a/Det/DetDesc/DetDesc/Condition.h
+++ b/Det/DetDesc/DetDesc/Condition.h
@@ -1,6 +1,7 @@
 #ifndef DETDESC_CONDITION_H
 #define DETDESC_CONDITION_H 1
 
+#include "boost/utility/string_ref.hpp"
 #include <string>
 
 // Base classes
@@ -19,15 +20,10 @@
  *  @author Sebastien Ponce
  *  @author Andrea Valassi
  */
-class Condition : public ParamValidDataObject {
-
- public:
+struct Condition : ParamValidDataObject {
 
   /// Default constructor
-  Condition();
-
-  /// Copy constructor
-  Condition (const Condition& obj);
+  Condition() = default;
 
   /// Update using another ValidDataObject: deep copy all contents,
   /// except for the properties of a generic DataObject
@@ -35,10 +31,7 @@ class Condition : public ParamValidDataObject {
   void update ( ValidDataObject& obj) override;
 
   /// Prepare an XML string representing the condition.
-  virtual std::string toXml(std::string name = "", bool header = false, int precision = 16) const;
-
-
- public:
+  virtual std::string toXml(boost::string_ref name = {}, bool header = false, int precision = 16) const;
 
   /**
    * This method initializes the condition. It should be overridden
@@ -47,8 +40,6 @@ class Condition : public ParamValidDataObject {
    */
   virtual StatusCode initialize();
 
- public:
-
   // Re-implemented from DataObject
 
   /// Class ID of this instance
diff --git a/Det/DetDesc/DetDesc/DetectorElement.h b/Det/DetDesc/DetDesc/DetectorElement.h
index 783c98bba35..04e38c4ed69 100644
--- a/Det/DetDesc/DetDesc/DetectorElement.h
+++ b/Det/DetDesc/DetDesc/DetectorElement.h
@@ -16,7 +16,6 @@
 
 #include "GaudiKernel/MsgStream.h"
 #include "GaudiKernel/SmartRef.h"
-#include "GaudiKernel/CommonMessaging.h"
 
 #include "DetDesc/Condition.h"
 #include "DetDesc/Services.h"
@@ -46,7 +45,7 @@ class IUpdateManagerSvc;
  *  @author Juan Palacios
 */
 
-class DetectorElement: public CommonMessaging<ParamValidDataObject>,
+class DetectorElement: public ParamValidDataObject,
                        virtual public IDetectorElement {
 
   friend class DataObjectFactory<DetectorElement> ;
@@ -79,7 +78,7 @@ public:
 
   const std::string& name () const override;
 
-  SmartIF<ISvcLocator>& serviceLocator() const override { return m_services->svcLocator(); }
+  IMessageSvc* msgSvc() const { return m_services->msgSvc(); }
 
   /// Check if the condition called 'name' is in the list of conditionrefs.
   bool hasCondition(const std::string &name) const override;
@@ -138,40 +137,40 @@ public:
 
   // another way to access: "pseudo-conversion"
   // cast to         IGeometryInfo*
-  inline operator       IGeometryInfo*() override;
+  operator       IGeometryInfo*() override { return m_de_iGeometry.get(); }
 
   // cast to   const IGeometryInfo*
-  inline operator const IGeometryInfo*() const override;
+  operator const IGeometryInfo*() const override { return m_de_iGeometry.get(); }
 
   // cast to         IAligment*
-  inline operator       IAlignment*   () override;
+  operator       IAlignment*   () override { return m_de_iAlignment.get(); }
 
   // cast to   const IAlignment*
-  inline operator const IAlignment*   () const override;
+  operator const IAlignment*   () const override { return m_de_iAlignment.get(); }
 
   // cast to         ICalibration*
-  inline operator       ICalibration* () override;
+  operator       ICalibration* () override { return m_de_iCalibration.get(); }
 
   // cast to   const ICalibration*
-  inline operator const ICalibration* () const override;
+  operator const ICalibration* () const override { return m_de_iCalibration.get(); }
 
   // cast to         IReadOut*
-  inline operator       IReadOut*     () override;
+  operator       IReadOut*     () override { return m_de_iReadOut.get(); }
 
   // cast to   const IReadOut*
-  inline operator const IReadOut*     () const override;
+  operator const IReadOut*     () const override { return m_de_iReadOut.get(); }
 
   // cast to         ISlowControl*
-  inline operator       ISlowControl* () override;
+  operator       ISlowControl* () override { return m_de_iSlowControl.get(); }
 
   // cast to   const ISlowControl*
-  inline operator const ISlowControl* () const override;
+  operator const ISlowControl* () const override { return m_de_iSlowControl.get(); }
 
   // cast to         IFastControl*
-  inline operator       IFastControl* () override;
+  inline operator       IFastControl* () override { return m_de_iFastControl.get(); }
 
   // cast to   const IFastControl*
-  inline operator const IFastControl* () const override;
+  inline operator const IFastControl* () const override { return m_de_iFastControl.get(); }
 
   // cast to         IGeometryInfo&
   // (potentially could throw DetectorElementException)
@@ -263,10 +262,8 @@ public:
   /// Used to create a link with a given name to the condition at 'path' in the detector data store.
   void createCondition(std::string &name, std::string &path);
 
-  //-- N. Gilardi; 2005.07.08 ---------------------------------------------
   /// Returns list of existing parameter vectors as a vector of their names
   virtual std::vector<std::string> conditionNames() const;
-  //-----------------------------------------------------------------------
 
   ///
   /// specific
@@ -411,43 +408,6 @@ inline IFastControl* DetectorElement::fastControl() {
   return m_de_iFastControl.get() ;
 }
 // "pseudo-casting" //////////////////////////////////////////////////////////
-inline DetectorElement::operator const IGeometryInfo*() const {
-  return m_de_iGeometry.get()    ;
-}
-inline DetectorElement::operator IGeometryInfo*() {
-  return m_de_iGeometry.get()    ;
-}
-
-inline DetectorElement::operator const IAlignment* () const {
-  return m_de_iAlignment.get()   ;
-}
-inline DetectorElement::operator IAlignment* () {
-  return m_de_iAlignment.get()   ;
-}
-inline DetectorElement::operator const ICalibration* () const {
-  return m_de_iCalibration.get() ;
-}
-inline DetectorElement::operator ICalibration* () {
-  return m_de_iCalibration.get() ;
-}
-inline DetectorElement::operator const IReadOut* () const {
-  return m_de_iReadOut.get()     ;
-}
-inline DetectorElement::operator IReadOut* () {
-  return m_de_iReadOut.get()     ;
-}
-inline DetectorElement::operator const ISlowControl* () const {
-  return m_de_iSlowControl.get() ;
-}
-inline DetectorElement::operator ISlowControl* () {
-  return m_de_iSlowControl.get() ;
-}
-inline DetectorElement::operator const IFastControl* () const {
-  return m_de_iFastControl.get() ;
-}
-inline DetectorElement::operator IFastControl* () {
-  return m_de_iFastControl.get() ;
-}
 //////////////////////////////////////////////////////////////////////////////
 inline DetectorElement::operator const IGeometryInfo&()    const
 {
diff --git a/Det/DetDesc/DetDesc/IConditionInfo.h b/Det/DetDesc/DetDesc/IConditionInfo.h
index 23312267682..c6bb3cc749f 100644
--- a/Det/DetDesc/DetDesc/IConditionInfo.h
+++ b/Det/DetDesc/DetDesc/IConditionInfo.h
@@ -4,9 +4,9 @@
 #include "GaudiKernel/IInterface.h"
 // Forward declarations
 struct IDetectorElement;
-class Condition;
+struct Condition;
 
-/** the unique interface identifier 
+/** the unique interface identifier
  * ( unique interface identifier , major & minor versions)
  */
 static const InterfaceID IID_IConditionInfo( "IConditionInfo" , 2 , 0 );
@@ -17,18 +17,18 @@ static const InterfaceID IID_IConditionInfo( "IConditionInfo" , 2 , 0 );
     An abstract interface to get the condition information of
     a detector element.
 
-    @author Andrea Valassi 
+    @author Andrea Valassi
     @date December 2001
 *///--------------------------------------------------------------------------
 
 struct IConditionInfo : virtual IInterface
 {
-  
-  /** retrieve the uniqie interface identifier 
-   *  @return the unique interface identifier 
+
+  /** retrieve the uniqie interface identifier
+   *  @return the unique interface identifier
    */
   static const InterfaceID& interfaceID() { return IID_IConditionInfo; }
-  
+
   /// Get a pointer to the detector element to which the ConditionInfo belongs
   virtual IDetectorElement* detElem() const = 0 ;
 
diff --git a/Det/DetDesc/DetDesc/IDetectorElement.h b/Det/DetDesc/DetDesc/IDetectorElement.h
index ae2683e330b..b2d33df3840 100644
--- a/Det/DetDesc/DetDesc/IDetectorElement.h
+++ b/Det/DetDesc/DetDesc/IDetectorElement.h
@@ -18,7 +18,7 @@ struct IReadOut;
 struct ISlowControl;
 struct IFastControl;
 
-class Condition;
+struct Condition;
 class ParamValidDataObject;
 
 /** the unique interface identifier
diff --git a/Det/DetDesc/src/Lib/Condition.cpp b/Det/DetDesc/src/Lib/Condition.cpp
index 4901c376fae..a7f3b102043 100644
--- a/Det/DetDesc/src/Lib/Condition.cpp
+++ b/Det/DetDesc/src/Lib/Condition.cpp
@@ -1,4 +1,4 @@
-#include <string> 
+#include <string>
 
 #include "DetDesc/Condition.h"
 
@@ -7,18 +7,7 @@
 
 //---------------------------------------------------------------------------
 
-/// Default constructor
-Condition::Condition() : ParamValidDataObject() {}
-
-//---------------------------------------------------------------------------
-
-/// Copy constructor
-Condition::Condition (const Condition& obj)
-  : IValidity(), ParamValidDataObject (obj) {}
-
-//---------------------------------------------------------------------------
-
-/// Update using another instance of this class: deep copy all 
+/// Update using another instance of this class: deep copy all
 /// contents, except for the properties of a generic DataObject
 void Condition::update ( ValidDataObject& obj )
 {
@@ -30,7 +19,7 @@ void Condition::update ( ValidDataObject& obj )
 //=========================================================================
 //  Prepare an XML string representing the condition
 //=========================================================================
-std::string Condition::toXml(std::string name, bool header, int precision) const{
+std::string Condition::toXml(boost::string_ref name, bool header, int precision) const{
   std::ostringstream xml;
   if (header) {
     // XML header
@@ -41,34 +30,26 @@ std::string Condition::toXml(std::string name, bool header, int precision) const
     // condition open
   }
   xml << "<condition classID=\"" << this->clID() << "\" name=\"";
-  
+
   if (name.empty()) {
-    if (registry()){
-      name = registry()->name();
-    } else {
-      name = "Condition";
-    }
-  }
-  if ( name[0] == '/' ) {
-    name = name.substr(1);
+      name = ( registry() ? registry()->name() : "Condition" );
   }
+  if ( name.front() == '/' ) name.remove_prefix(1);
+
   xml << name << "\">";
 
-  std::vector<std::string> pars;
-  std::vector<std::string>::const_iterator i;
   // loop over parameters
-  pars = paramNames();
-  for ( i = pars.begin(); i != pars.end(); ++i ){
-    xml << paramToString(*i, precision);
+  for ( const auto& i : paramNames() ) {
+    xml << paramToString(i, precision);
   }
-  
+
   // condition close
   xml << "</condition>";
   if (header) {
     // DDDB close
     xml << "</DDDB>";
   }
-  
+
   return xml.str();
 }
 //---------------------------------------------------------------------------
diff --git a/Det/DetDesc/src/Lib/DetectorElement.cpp b/Det/DetDesc/src/Lib/DetectorElement.cpp
index da2a5bd6133..8e1fe4ff241 100644
--- a/Det/DetDesc/src/Lib/DetectorElement.cpp
+++ b/Det/DetDesc/src/Lib/DetectorElement.cpp
@@ -31,7 +31,6 @@
 DetectorElement::DetectorElement( const std::string&   /* name */ )
 : m_services{ DetDesc::services() }
 {
-  setUpMessaging();
 }
 
 DetectorElement::~DetectorElement() = default;
diff --git a/Det/DetDescSvc/src/UpdateManagerSvc.h b/Det/DetDescSvc/src/UpdateManagerSvc.h
index 025bf235ca7..d766e90292c 100644
--- a/Det/DetDescSvc/src/UpdateManagerSvc.h
+++ b/Det/DetDescSvc/src/UpdateManagerSvc.h
@@ -32,7 +32,7 @@
 template <class TYPE> class SvcFactory;
 class IIncidentSvc;
 class IEventProcessor;
-class Condition;
+struct Condition;
 
 /** @class UpdateManagerSvc UpdateManagerSvc.h
  *
diff --git a/Ex/DetCondExample/src/CondDBTestAlgorithm.h b/Ex/DetCondExample/src/CondDBTestAlgorithm.h
index 55e56961ac7..dc02f67f289 100755
--- a/Ex/DetCondExample/src/CondDBTestAlgorithm.h
+++ b/Ex/DetCondExample/src/CondDBTestAlgorithm.h
@@ -7,7 +7,7 @@
 
 // Forward declarations
 class DataObject;
-class Condition;
+struct Condition;
 class IDetDataSvc;
 class AlignmentCondition;
 
diff --git a/Ex/DetCondExample/src/MultiDBTest.cpp b/Ex/DetCondExample/src/MultiDBTest.cpp
index 94be6d5ad82..841f22b2ae4 100755
--- a/Ex/DetCondExample/src/MultiDBTest.cpp
+++ b/Ex/DetCondExample/src/MultiDBTest.cpp
@@ -1,4 +1,4 @@
-// Include files 
+// Include files
 
 #include "DetDesc/Condition.h"
 #include "DetDesc/AlignmentCondition.h"
@@ -24,10 +24,6 @@ MultiDBTest::MultiDBTest( const std::string& name,
   : GaudiAlgorithm ( name , pSvcLocator ),
   m_cond1(NULL),m_cond2(NULL),m_align1(NULL)
 {}
-//=============================================================================
-// Destructor
-//=============================================================================
-MultiDBTest::~MultiDBTest() {}
 
 //=============================================================================
 // Initialization
@@ -37,7 +33,7 @@ StatusCode MultiDBTest::initialize() {
   if ( sc.isFailure() ) return sc;  // error printed already by GaudiAlgorithm
 
   debug() << "==> Initialize" << endmsg;
-  
+
   try {
 
     info() << "*** register conditions ***" << endmsg;
@@ -58,10 +54,10 @@ StatusCode MultiDBTest::initialize() {
 StatusCode MultiDBTest::execute() {
 
   info() << "*************** execute(): process new event ***************" << endmsg;
-  
+
   info() << "Cond1: " << m_cond1->validSince() << " -> " << m_cond1->validTill() << endmsg;
   info() << "       DB = " << m_cond1->paramAsString("Database") << endmsg;
-  
+
   info() << "Cond2: " << m_cond2->validSince() << " -> " << m_cond2->validTill() << endmsg;
   info() << "       DB = " << m_cond2->paramAsString("Database") << endmsg;
 
diff --git a/Ex/DetCondExample/src/MultiDBTest.h b/Ex/DetCondExample/src/MultiDBTest.h
index 7a85061ac12..6374924ea63 100755
--- a/Ex/DetCondExample/src/MultiDBTest.h
+++ b/Ex/DetCondExample/src/MultiDBTest.h
@@ -5,7 +5,7 @@
 // from Gaudi
 #include "GaudiAlg/GaudiAlgorithm.h"
 
-class Condition;
+struct Condition;
 class AlignmentCondition;
 
 /** @class MultiDBTest MultiDBTest.h
@@ -20,13 +20,9 @@ public:
   /// Standard constructor
   MultiDBTest( const std::string& name, ISvcLocator* pSvcLocator );
 
-  virtual ~MultiDBTest( ); ///< Destructor
-
   StatusCode initialize() override;    ///< Algorithm initialization
   StatusCode execute   () override;    ///< Algorithm execution
 
-protected:
-
 private:
 
   Condition *m_cond1, *m_cond2;
diff --git a/Ex/DetCondExample/src/PopulateDB.h b/Ex/DetCondExample/src/PopulateDB.h
index 9ce915cac18..a0f95c38f5a 100755
--- a/Ex/DetCondExample/src/PopulateDB.h
+++ b/Ex/DetCondExample/src/PopulateDB.h
@@ -1,4 +1,4 @@
-#ifndef POPULATEDB_H 
+#ifndef POPULATEDB_H
 #define POPULATEDB_H 1
 
 // Include files
@@ -9,17 +9,17 @@
 class ICondDBEditor;
 class ICondDBAccessSvc;
 class ICondDBObject;
-class Condition;
+struct Condition;
 
 /** @class PopulateDB PopulateDB.h
- *  
+ *
  *  Simple algorithm to populate the ConditionsDB.
  *
  *  @author Marco Clemencic
  *  @date   2005-06-22
  */
 class PopulateDB : public GaudiAlgorithm {
-public: 
+public:
   /// Standard constructor
   PopulateDB( const std::string& name, ISvcLocator* pSvcLocator );
 
@@ -29,7 +29,7 @@ public:
 private:
   /// Store sample data
   StatusCode i_condDBStoreSampleData();
-  
+
   StatusCode i_createHierarchy();
   StatusCode i_createCOLDVersion();
   StatusCode i_createHOTVersion();
@@ -41,16 +41,16 @@ private:
   /// Encode XML temperature data
   std::string i_encodeXmlTemperature( const double temperature,
                                       const std::string& objName ) const;
-  
+
   /// Encode XML paramVector
   std::string i_encodeXmlParamVector( const double par[3],
                                const std::string& objName,
                                const std::string& parName ) const;
-  
+
   /// Dump the contents of a CondDBFolder
   StatusCode i_dumpFolder( const std::string& folderName,
                            const std::string& tagName ) const;
-  
+
   /// Handle to the CondDBAccessSvc (to write the data in the CondDB)
   SmartIF<ICondDBEditor> m_dbEditor;
 
diff --git a/HC/HCDAQ/src/HCRawBankDecoderHlt.h b/HC/HCDAQ/src/HCRawBankDecoderHlt.h
index f0b052c6fd9..8987d56e560 100644
--- a/HC/HCDAQ/src/HCRawBankDecoderHlt.h
+++ b/HC/HCDAQ/src/HCRawBankDecoderHlt.h
@@ -1,49 +1,49 @@
-#ifndef HCRAWBANKDECODER_HLT_H
-#define HCRAWBANKDECODER_HLT_H 1
-
-// LHCb
-#include "DAQKernel/DecoderHistoAlgBase.h"
-
-class Condition;
-
-/** @class HCRawBankDecoderHlt.h
- *
- * Specialised decoder for Herschel raw banks for use in HLT1.
- *
- */
-
-class HCRawBankDecoderHlt : public Decoder::HistoAlgBase {
- public:
-  /// Standard constructor
-  HCRawBankDecoderHlt(const std::string& name, ISvcLocator* pSvcLocator);
-  /// Destructor
-  virtual ~HCRawBankDecoderHlt();
-
-  StatusCode initialize() override;  ///< Algorithm initialization
-  StatusCode execute() override;     ///< Algorithm execution
-
- private:
-  Condition* m_cond = nullptr;
-
-  /// TES location of output digits.
-  std::string m_digitLocation;
-
-  /// Crate number for B side stations.
-  unsigned int m_crateB = 0;
-  /// Crate number for F side stations.
-  unsigned int m_crateF = 1;
-
-  /// Masking flag for each channel.
-  
-  enum { nChannels = 64 };
-  std::bitset<2*nChannels> m_masked;
-  /// Station number for each channel.
-  std::array<unsigned int,2*nChannels> m_station;
-
-  /// Do the decoding.
-  bool decode( const LHCb::RawBank& bank, std::vector<int>& sums) const ;
-  /// Retrieve the mapping from the conditions database.
-  StatusCode cacheMapping();
-};
-
-#endif
+#ifndef HCRAWBANKDECODER_HLT_H
+#define HCRAWBANKDECODER_HLT_H 1
+
+// LHCb
+#include "DAQKernel/DecoderHistoAlgBase.h"
+
+struct Condition;
+
+/** @class HCRawBankDecoderHlt.h
+ *
+ * Specialised decoder for Herschel raw banks for use in HLT1.
+ *
+ */
+
+class HCRawBankDecoderHlt : public Decoder::HistoAlgBase {
+ public:
+  /// Standard constructor
+  HCRawBankDecoderHlt(const std::string& name, ISvcLocator* pSvcLocator);
+  /// Destructor
+  virtual ~HCRawBankDecoderHlt();
+
+  StatusCode initialize() override;  ///< Algorithm initialization
+  StatusCode execute() override;     ///< Algorithm execution
+
+ private:
+  Condition* m_cond = nullptr;
+
+  /// TES location of output digits.
+  std::string m_digitLocation;
+
+  /// Crate number for B side stations.
+  unsigned int m_crateB = 0;
+  /// Crate number for F side stations.
+  unsigned int m_crateF = 1;
+
+  /// Masking flag for each channel.
+
+  enum { nChannels = 64 };
+  std::bitset<2*nChannels> m_masked;
+  /// Station number for each channel.
+  std::array<unsigned int,2*nChannels> m_station;
+
+  /// Do the decoding.
+  bool decode( const LHCb::RawBank& bank, std::vector<int>& sums) const ;
+  /// Retrieve the mapping from the conditions database.
+  StatusCode cacheMapping();
+};
+
+#endif
diff --git a/Hlt/HltServices/src/HltConfigSvc.h b/Hlt/HltServices/src/HltConfigSvc.h
index e13a3488cbb..510ee359639 100644
--- a/Hlt/HltServices/src/HltConfigSvc.h
+++ b/Hlt/HltServices/src/HltConfigSvc.h
@@ -24,7 +24,7 @@ StatusCode parse( std::map<TCK,std::string>& result, const std::string& input );
 #include "GaudiAlg/IGenericTool.h"
 #include "GaudiKernel/ToolHandle.h"
 
-class Condition;
+struct Condition;
 
 /** @class HltConfig HltConfig.h
  *
diff --git a/Kernel/LHCbAlgs/src/DQAcceptTool.h b/Kernel/LHCbAlgs/src/DQAcceptTool.h
index affda013b79..b17de4f7288 100644
--- a/Kernel/LHCbAlgs/src/DQAcceptTool.h
+++ b/Kernel/LHCbAlgs/src/DQAcceptTool.h
@@ -10,7 +10,7 @@
 // Implemented interfaces
 #include "Kernel/IAccept.h" // IAccept
 
-class Condition;
+struct Condition;
 
 /** @class DQAcceptTool DQAcceptTool.h src/DQAcceptTool.h
   *
@@ -26,8 +26,6 @@ public:
   /// Standard constructor
   DQAcceptTool(const std::string& type, const std::string& name, const IInterface* parent);
 
-  virtual ~DQAcceptTool() = default; ///< Destructor
-
   /// Initialize the tool.
   StatusCode initialize() override;
 
diff --git a/Kernel/LHCbAlgs/src/DQFilter.h b/Kernel/LHCbAlgs/src/DQFilter.h
index 64f05e6e2a1..43bd140fce0 100644
--- a/Kernel/LHCbAlgs/src/DQFilter.h
+++ b/Kernel/LHCbAlgs/src/DQFilter.h
@@ -14,7 +14,7 @@
 #include "GaudiKernel/ToolHandle.h"
 #include "Kernel/IAccept.h"
 
-class Condition;
+struct Condition;
 class IIncidentSvc;
 
 /** @class DQFilter
-- 
GitLab