diff --git a/Phys/KaliCalo/src/Cloner.cpp b/Phys/KaliCalo/src/Cloner.cpp
index 68b681bec638e84a2e0c79202916f9a56441ee2e..db779014568450e987f5a366109161259b7c1c40 100644
--- a/Phys/KaliCalo/src/Cloner.cpp
+++ b/Phys/KaliCalo/src/Cloner.cpp
@@ -1,76 +1,53 @@
 // ============================================================================
-// Include files 
+// Include files
 // ============================================================================
 // Local/Kali
 // ============================================================================
 #include "Destroyer.h"
 // ============================================================================
 /** @file Cloner.cpp
- *  ''Piecefull'' variant of Kali::Destroyer 
+ *  ''Piecefull'' variant of Kali::Destroyer
  *
- *  @see Kali::Destroyer 
+ *  @see Kali::Destroyer
  *  @author Vanya BELYAEV Ivan.Belyaev@cern.ch
  *  @date 2011-07-31
  */
 // ============================================================================
-namespace Kali 
+namespace Kali
 {
   // ==========================================================================
-  /** @class cloner 
+  /** @class cloner
    *
    *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
    *  @date 2011-07-31
    */
-  class Cloner : public Kali::Destroyer 
+  class Cloner : public Kali::Destroyer
   {
-    // ========================================================================
-    /// the friend factory for instantiation
-    friend class AlgFactory<Kali::Cloner> ;               // the friend factory
-    // ========================================================================
   public:
     // ========================================================================
-    /// the only one essential method 
+    /// the only one essential method
     StatusCode execute    () override;
     // ========================================================================
-  protected:
-    // ========================================================================
-    /** standard destructor 
-     *  @param name (INPUT) the algorithm instance name 
-     *  @param pSvc (INPUT) the pointer to Service Locator 
-     */
-    Cloner ( const std::string& name ,     //    the algorithm instance name 
-                ISvcLocator*       pSvc )     // the pointer to Service Locator 
-      : Destroyer ( name , pSvc ) 
-    {}
-    /// virtual & protected destructor 
-    virtual ~Cloner () {}                     // virtual & protected destructor 
-    // ========================================================================
-  private:
-    // ========================================================================
-    /// the default constructor is disabled 
-    Cloner ();                           // the default constructor is disabled 
-    /// the copy constructor is disabled 
-    Cloner ( const Cloner& );            //   the cpoy  constructor is disabled     
-    /// the assignement operator is disabled
-    Cloner & operator=( const Cloner& ); //         the assignement is disabled
+    /** standard destructor  */
+    using Destroyer::Destroyer;
     // ========================================================================
   };
   // ==========================================================================
-} //                                                      end of namespace Kali 
+} //                                                      end of namespace Kali
 // ============================================================================
-// the only one essential method 
+// the only one essential method
 // ============================================================================
-StatusCode Kali::Cloner::execute () 
-{ 
-  // collect all interetsing digits 
+StatusCode Kali::Cloner::execute ()
+{
+  // collect all interetsing digits
   LHCb::CaloDigit::Set     digits ;
-  // collect all interesting tracks 
+  // collect all interesting tracks
   TRACKS                   tracks ;
-  
-  // 
-  // collect info 
+
+  //
+  // collect info
   StatusCode sc = collect ( digits , tracks ) ;
-  if ( sc.isFailure() ) 
+  if ( sc.isFailure() )
   {
     Warning ("Error from collect", sc ).ignore() ;
     setFilterPassed ( false ) ;
@@ -81,7 +58,7 @@ StatusCode Kali::Cloner::execute ()
   //
   // copy/clone TES
   sc = copy ( digits , tracks ) ;
-  if ( sc.isFailure() ) 
+  if ( sc.isFailure() )
   {
     Warning ("Error from destroy", sc ).ignore() ;
     setFilterPassed ( false ) ;
@@ -90,12 +67,12 @@ StatusCode Kali::Cloner::execute ()
   //
   setFilterPassed  ( OK ) ;
   //
-  return StatusCode::SUCCESS ;        
-}    
+  return StatusCode::SUCCESS ;
+}
 // ===========================================================================
 // The factory:
 // ============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,Cloner)
+DECLARE_COMPONENT( Kali::Cloner )
 // ============================================================================
-// The END 
+// The END
 // ============================================================================
diff --git a/Phys/KaliCalo/src/DataMove.cpp b/Phys/KaliCalo/src/DataMove.cpp
index 4f42dd36e563cf32b9bae3a04ab43d9d9286a154..7f9312dded97db3c4a8c906a66a23c3169d77077 100644
--- a/Phys/KaliCalo/src/DataMove.cpp
+++ b/Phys/KaliCalo/src/DataMove.cpp
@@ -1,11 +1,7 @@
 // ============================================================================
-// Include files 
+// Include files
 // ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/AlgFactory.h"
-// ============================================================================
-// GaudiAlg 
+// GaudiAlg
 // ============================================================================
 #include "GaudiAlg/GaudiAlgorithm.h"
 // ============================================================================
@@ -18,40 +14,33 @@
 // ============================================================================
 #include "Kali.h"
 // ============================================================================
-namespace Kali 
+namespace Kali
 {
   // ==========================================================================
   /** @class DataMove
    *
-   *  simple data-mover, to recover TES structure 
+   *  simple data-mover, to recover TES structure
    *
    *  Unfortunately links in TES does not work :-(
    *
    *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
    *  @date 2011-07-31
-   */  
+   */
   class DataMove : public GaudiAlgorithm
   {
-    // ========================================================================
-    /// the friend factory for instantiation 
-    friend class AlgFactory<Kali::DataMove> ;
-    // ========================================================================
   public:
     // ========================================================================
-    /// the only one essential method 
+    /// the only one essential method
     StatusCode execute() override;
-    // ========================================================================
-  protected:
-    // ========================================================================
-    /** standard constructor 
-     *  @param name algorithm instance name 
-     *  @param psvc pointer to Service Locator 
+    /** standard constructor
+     *  @param name algorithm instance name
+     *  @param psvc pointer to Service Locator
      */
-    DataMove  ( const std::string& name ,  // algorithm instance name 
+    DataMove  ( const std::string& name ,  // algorithm instance name
                ISvcLocator*       pSvc )  // poiunetr to Service locator
-      : GaudiAlgorithm ( name , pSvc ) 
-      , m_locations (        ) 
-      , m_kaliHat   ( "Kali" ) 
+      : GaudiAlgorithm ( name , pSvc )
+      , m_locations (        )
+      , m_kaliHat   ( "Kali" )
     {
       //
       //
@@ -61,59 +50,48 @@ namespace Kali
       m_locations.push_back ( LHCb::CaloDigitLocation :: Ecal    ) ;
       m_locations.push_back ( LHCb::CaloDigitLocation :: Hcal    ) ;
       //
-      declareProperty 
-        ( "Locations" , 
-          m_locations , 
+      declareProperty
+        ( "Locations" ,
+          m_locations ,
           "The list of locations to be moved " ) ;
     }
-    /// virtual & protected destructor 
-    virtual ~DataMove() {}
-    // ========================================================================
-  private:
-    // ========================================================================
-    /// the default constructor is disabled 
-    DataMove () ;                        // the default constructor is disabled 
-    /// the copy constructor is disabled 
-    DataMove ( const DataMove& ) ;          // the copy constructor is disabled 
-    /// the assignement operato is disabled 
-    DataMove& operator=( const DataMove& ) ;     // the assignement is disabled 
     // ========================================================================
   private:
     // ========================================================================
     /// The list of locations to be created
-    std::vector<std::string> m_locations ; //     List of locations to be moved 
+    std::vector<std::string> m_locations ; //     List of locations to be moved
     /// Kali-hat in TES
     std::string              m_kaliHat   ; //                   Kali-hat in TES
     // ========================================================================
   } ;
   // ==========================================================================
-} //                                                      end of namespace Kali 
+} //                                                      end of namespace Kali
 // ============================================================================
-// the only one essential method 
+// the only one essential method
 // ============================================================================
-StatusCode Kali::DataMove::execute()  
+StatusCode Kali::DataMove::execute()
 {
-  //  
-  for (  std::vector<std::string>::const_iterator ites = m_locations.begin() ; 
-         m_locations.end() != ites ; ++ites ) 
+  //
+  for (  std::vector<std::string>::const_iterator ites = m_locations.begin() ;
+         m_locations.end() != ites ; ++ites )
   {
     std::string loc = Kali::kalify ( *ites , m_kaliHat ) ;
     //
-    if ( !exist<DataObject>( loc ) ) 
-    { 
+    if ( !exist<DataObject>( loc ) )
+    {
       Warning ( "Location does not exist: '" + loc + "'" , StatusCode::SUCCESS , 2 ).ignore() ;
-      continue ;                                                 // CONTINUE 
+      continue ;                                                 // CONTINUE
     }
     //
     DataObject* obj = get<DataObject> ( loc ) ;
-    // unregister it at "kali" location 
+    // unregister it at "kali" location
     StatusCode sc = evtSvc()->unregisterObject ( obj ) ;
-    if ( sc.isFailure() ) 
+    if ( sc.isFailure() )
     {
       Error ( "Unable unregister '" + loc + "'" , sc ).ignore() ;
-      continue ;                                              // CONTINUE 
+      continue ;                                              // CONTINUE
     }
-    // register it at "standard" location 
+    // register it at "standard" location
     put ( obj , *ites ) ;
   }
   //
@@ -125,7 +103,7 @@ StatusCode Kali::DataMove::execute()
 // ============================================================================
 // The Factory
 // ============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,DataMove)
+DECLARE_COMPONENT( Kali::DataMove )
 // ============================================================================
-//                                                                      The END 
+//                                                                      The END
 // ============================================================================
diff --git a/Phys/KaliCalo/src/Destroyer.cpp b/Phys/KaliCalo/src/Destroyer.cpp
index 877cd68d54130e990e4645a4decbc0846a84e96a..4e750be6143e4de9eac311e2b272a38ab844aa80 100644
--- a/Phys/KaliCalo/src/Destroyer.cpp
+++ b/Phys/KaliCalo/src/Destroyer.cpp
@@ -487,7 +487,7 @@ StatusCode Kali::Destroyer::execute ()
 // ===========================================================================
 // The factory:
 // ============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,Destroyer)
+DECLARE_COMPONENT( Kali::Destroyer )
 // ============================================================================
 // The END 
 // ============================================================================
diff --git a/Phys/KaliCalo/src/Destroyer.h b/Phys/KaliCalo/src/Destroyer.h
index 276f01c0bcb30ffc586925215eec16d73938779d..8cc05d5522bf2fcdc6ecc4b1f5f5804aece72248 100644
--- a/Phys/KaliCalo/src/Destroyer.h
+++ b/Phys/KaliCalo/src/Destroyer.h
@@ -1,23 +1,18 @@
-// $Id: Destroyer.cpp 122804 2011-05-04 17:53:14Z ibelyaev $
 // ============================================================================
-#ifndef KALI_DESTROYER_H 
-#define KALI_DESTROYER_H 1 
+#ifndef KALI_DESTROYER_H
+#define KALI_DESTROYER_H 1
 // ============================================================================
-// Include files 
+// Include files
 // ============================================================================
-// STD & STL 
+// STD & STL
 // ============================================================================
 #include <set>
 // ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/AlgFactory.h"
-// ============================================================================
-// GaudiAlg 
+// GaudiAlg
 // ============================================================================
 #include "GaudiAlg/GaudiAlgorithm.h"
 // ============================================================================
-// Event 
+// Event
 // ============================================================================
 #include "Event/CaloHypo.h"
 #include "Event/CaloCluster.h"
@@ -35,156 +30,135 @@
 // ============================================================================
 #include "Kali.h"
 // ============================================================================
-namespace Kali 
+namespace Kali
 {
   // ==========================================================================
   /** @class Destroyer
    *
-   *  the base class for TES manipulation in Kali 
+   *  the base class for TES manipulation in Kali
    *
    *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-   *  
+   *
    *                    $Revision$
    *  Last modification $Date$
    *                 by $Author$
    */
   class Destroyer : public GaudiAlgorithm
   {
-    // ========================================================================
-    /// the friend factory for instantiation
-    friend class AlgFactory<Kali::Destroyer> ;            // the friend factory
-    // ========================================================================
   public:
     // ========================================================================
-    /// initialize 
+    /// initialize
     StatusCode initialize () override;
-    /// the only one essential method 
+    /// the only one essential method
     StatusCode execute    () override;
-    /// finalize 
+    /// finalize
     StatusCode finalize   () override;
     // ========================================================================
   protected:
     // ========================================================================
     /// perform "kalification" of input TES location
-    std::string kalify ( const std::string& input ) const 
+    std::string kalify ( const std::string& input ) const
     { return Kali::kalify ( input , m_kaliHat ) ; }
     // ========================================================================
   protected:
     // ========================================================================
     typedef std::set<const LHCb::Track*> TRACKS ;
     // ========================================================================
-    /// collect all ``interesting'' digits & tracks 
-    StatusCode collect 
-    ( LHCb::CaloDigit::Set& digits , 
+    /// collect all ``interesting'' digits & tracks
+    StatusCode collect
+    ( LHCb::CaloDigit::Set& digits ,
       TRACKS&               tracks ) const ;
     // ========================================================================
-    /// destroy all ``non-interesting'' information 
-    StatusCode destroy 
-    ( LHCb::CaloDigit::Set& digits , 
+    /// destroy all ``non-interesting'' information
+    StatusCode destroy
+    ( LHCb::CaloDigit::Set& digits ,
       TRACKS&               tracks ) const ;
     // ========================================================================
-    /// copy all   ``interesting'' information 
-    StatusCode copy 
-    ( LHCb::CaloDigit::Set& digits , 
+    /// copy all   ``interesting'' information
+    StatusCode copy
+    ( LHCb::CaloDigit::Set& digits ,
       TRACKS&               tracks ) const ;
     // ========================================================================
-  protected:
+  public:
     // ========================================================================
-    /** standard destructor 
-     *  @param name (INPUT) the algorithm instance name 
-     *  @param pSvc (INPUT) the pointer to Service Locator 
+    /** standard destructor
+     *  @param name (INPUT) the algorithm instance name
+     *  @param pSvc (INPUT) the pointer to Service Locator
      */
-    Destroyer ( const std::string& name ,     //    the algorithm instance name 
-                ISvcLocator*       pSvc )     // the pointer to Service Locator 
-      : GaudiAlgorithm( name , pSvc ) 
+    Destroyer ( const std::string& name ,     //    the algorithm instance name
+                ISvcLocator*       pSvc )     // the pointer to Service Locator
+      : GaudiAlgorithm( name , pSvc )
       , m_particles ()
       , m_destroy   ( true    )
-      , m_kaliHat   ( "Kali"  ) 
+      , m_kaliHat   ( "Kali"  )
       , m_toolNames ()
       , m_tools ()
       , m_bremNames ()
-      , m_brems ()  
+      , m_brems ()
     {
       //
-      declareProperty 
-        ( "Particles" , 
-          m_particles , 
+      declareProperty
+        ( "Particles" ,
+          m_particles ,
           "The list of input TES locations for particles" );
       declareProperty
         ( "Destroy" ,
-          m_destroy , 
+          m_destroy ,
           "Destroy the content of TES containers" ) ->
-        declareUpdateHandler(&Destroyer::updateDestroy, this ) ; 
-      declareProperty 
-        ( "KaliHat" , 
-          m_kaliHat , 
+        declareUpdateHandler(&Destroyer::updateDestroy, this ) ;
+      declareProperty
+        ( "KaliHat" ,
+          m_kaliHat ,
           "Hat for Kali stuff in TES" );
      //
       m_toolNames.push_back ( "SpdEnergyForTrack/SpdDigits"   ) ;
       m_toolNames.push_back ( "PrsEnergyForTrack/PrsDigits"   ) ;
       m_toolNames.push_back ( "EcalEnergyForTrack/EcalDigits" ) ;
       m_toolNames.push_back ( "HcalEnergyForTrack/HcalDigits" ) ;
-      declareProperty 
-        ( "Digits4Track" , 
+      declareProperty
+        ( "Digits4Track" ,
           m_toolNames ,
           "Tools to collect the Calo-digits for the track" );
       m_bremNames.push_back ( "SpdEnergyForTrack/BremSpdDigits"   ) ;
       m_bremNames.push_back ( "PrsEnergyForTrack/BremPrsDigits"   ) ;
       m_bremNames.push_back ( "EcalEnergyForTrack/BremEcalDigits" ) ;
-      declareProperty 
-        ( "BremDigits4Track" , 
+      declareProperty
+        ( "BremDigits4Track" ,
           m_bremNames ,
           "Tools to collect the Brem-digits for the track" );
       // ======================================================================
     }
-    /// virtual & protected destructor 
-    virtual ~Destroyer() {}                   // virtual & protected destructor 
-    // ========================================================================
-  private:
-    // ========================================================================
-    /// the default constructor is disabled 
-    Destroyer ();                        // the default constructor is disabled 
-    /// the copy constructor is disabled 
-    Destroyer ( const Destroyer& );        // the cpoy  constructor is disabled     
-    /// the assignement operator is disabled 
-    Destroyer& operator=( const Destroyer& );    // the assignement is disabled
-    // ========================================================================
-  public:
-    // ========================================================================
     /// Update handler for the property
     void updateDestroy ( Property& /* p */ ) ;
     // ========================================================================
   private:
     // ========================================================================
     typedef std::vector<std::string> Locations ;
-    /// the list of input locations for particles 
-    Locations m_particles ;        // the list of input locations for particles 
-    /// flag to actually destroy TES 
-    bool      m_destroy   ;                    //  flag to actually destroy TES 
+    /// the list of input locations for particles
+    Locations m_particles ;        // the list of input locations for particles
+    /// flag to actually destroy TES
+    bool      m_destroy   ;                    //  flag to actually destroy TES
     /// Kali-hat in TES
     std::string m_kaliHat ;                    // Kali-hat in TES
     // ========================================================================
     typedef std::vector<std::string>              Names ;
     typedef std::vector<const ICaloDigits4Track*> Tools ;
-    /// the list of tools to accumulate the digits  
-    Names m_toolNames ;           // the list of tools to accumulate the digits  
-    /// the list of tools to accumulate the digits  
-    Tools m_tools     ;           // the list of tools to accumulate the digits  
-    /// tools for brem-digits collection 
-    Names m_bremNames ;                     // tools for brem-digits collection 
-    /// tools for brem-digits collection 
-    Tools m_brems     ;                     // tools for brem-digits collection 
+    /// the list of tools to accumulate the digits
+    Names m_toolNames ;           // the list of tools to accumulate the digits
+    /// the list of tools to accumulate the digits
+    Tools m_tools     ;           // the list of tools to accumulate the digits
+    /// tools for brem-digits collection
+    Names m_bremNames ;                     // tools for brem-digits collection
+    /// tools for brem-digits collection
+    Tools m_brems     ;                     // tools for brem-digits collection
     // ========================================================================
   };
   // ==========================================================================
 } //                                                      end of namespace Kali
 // ============================================================================
-//                                                                      The END 
+//                                                                      The END
 // ============================================================================
-#endif // KALI_DESTROYER_H 1 
+#endif // KALI_DESTROYER_H 1
 // ============================================================================
-// The END 
+// The END
 // ============================================================================
-
-  
-
diff --git a/Phys/KaliCalo/src/ElecPresel.cpp_ b/Phys/KaliCalo/src/ElecPresel.cpp_
index a5e75706ea84bbc9d4c1f1c948da8f248c7bb812..228f699169a7b1caa9aababb66c34d00f54d43cc 100644
--- a/Phys/KaliCalo/src/ElecPresel.cpp_
+++ b/Phys/KaliCalo/src/ElecPresel.cpp_
@@ -14,7 +14,6 @@
 #include "Event/MuonPID.h"
 // #include "Event/MuonID.h"
 // GaudiKernel
-#include "GaudiKernel/AlgFactory.h"
 #include "GaudiKernel/SmartDataPtr.h"
 #include "GaudiKernel/IDataProviderSvc.h"
 #include "GaudiKernel/IHistogramSvc.h"
@@ -36,7 +35,7 @@ using namespace LHCb;
 // ****************************************************
 // ****** Declaration of the Algorithm Factory ********
 // ****************************************************
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,ElecPresel );
+DECLARE_COMPONENT( Kali::ElecPresel );
 /////static const  AlgFactory<ElecPresel>          s_factory ;
 /////const        IAlgFactory& ElecPreselFactory = s_factory ;
 
@@ -53,22 +52,22 @@ Kali::ElecPresel::ElecPresel( const std::string& name,
   declareProperty( "EcalIsolation",  m_ECALisolation = 300.);
 //  declareProperty( "ProtoSource",  m_Input = ParticleLocation::Charged);
 // Locations in DET
-  declareProperty( "SpdLocation",  
+  declareProperty( "SpdLocation",
     m_Calos[ElecPreselDets::Spd]   = DeCalorimeterLocation::Spd);
-  declareProperty( "PrsLocation",  
+  declareProperty( "PrsLocation",
     m_Calos[ElecPreselDets::Prs]   = DeCalorimeterLocation::Prs);
-  declareProperty( "EcalLocation",  
+  declareProperty( "EcalLocation",
     m_Calos[ElecPreselDets::Ecal]  = DeCalorimeterLocation::Ecal);
-  declareProperty( "HcalLocation",  
+  declareProperty( "HcalLocation",
     m_Calos[ElecPreselDets::Hcal]  = DeCalorimeterLocation::Hcal);
 // Locations in RAW
-  declareProperty( "SpdLocation",  
+  declareProperty( "SpdLocation",
     m_Digits[ElecPreselDets::Spd]   = LHCb::CaloDigitLocation::Spd);
-  declareProperty( "PrsLocation",  
+  declareProperty( "PrsLocation",
     m_Digits[ElecPreselDets::Prs]   = LHCb::CaloDigitLocation::Prs);
-  declareProperty( "EcalLocation",  
+  declareProperty( "EcalLocation",
     m_Digits[ElecPreselDets::Ecal]  = LHCb::CaloDigitLocation::Ecal);
-  declareProperty( "HcalLocation",  
+  declareProperty( "HcalLocation",
     m_Digits[ElecPreselDets::Hcal]  = LHCb::CaloDigitLocation::Hcal);
 }
 
@@ -126,14 +125,14 @@ StatusCode Kali::ElecPresel::execute() {
   //  log << MSG::ERROR << "    not able to retrieve event" << endreq;
   //  return StatusCode::FAILURE;
   //}
-  
-// Retrieve Particles 
+
+// Retrieve Particles
   const  LHCb::Particle::ConstVector&  parts  = this->i_particles();
 //  ProtoParticles *protos = get<ProtoParticles>( m_Input );
 
   if (parts.size() == 0) return sc;
 // Start selection
-  m_NAllTracks = 0;  
+  m_NAllTracks = 0;
   for (LHCb::Particle::ConstVector::const_iterator iAll = parts.begin();
     iAll != parts.end(); iAll++) {
     if ((*iAll)->charge() == 0) continue;
@@ -143,7 +142,7 @@ StatusCode Kali::ElecPresel::execute() {
     if (track) {  // Track really exists
       State state = track->closestState (m_zShowerMax[2]);
       if (state.z() < 7500.) continue;
-      PropagateToZ (proto, m_zShowerMax[2]-zShowerLength[2], 
+      PropagateToZ (proto, m_zShowerMax[2]-zShowerLength[2],
                      &m_XYEcal[0][m_NAllTracks],&m_XYEcal[1][m_NAllTracks]);
       if (fabs(m_XYEcal[0][m_NAllTracks]) > 3878. ||
 	fabs(m_XYEcal[1][m_NAllTracks]) > 3151.) continue;
@@ -152,8 +151,8 @@ StatusCode Kali::ElecPresel::execute() {
       m_Mask[m_NAllTracks++] = 1;
     }
   }
-  
-  
+
+
   if (!m_NAllTracks) return sc;
 // Get pointers on Digits
   for (int i=0; i<4; i++) {
@@ -189,7 +188,7 @@ StatusCode Kali::ElecPresel::execute() {
 // Get RICH ID
           const LHCb::RichPID *rpid = m_AllProto[i]->richPID();
           int ele1=(rpid && (rpid->bestParticleID() == Rich::Electron)) ? 1 : 0;
-	  
+
 //          if ( vcharge > 1.7 || ele1 == 1) {
           if ( ele1 == 1) {
             if (!CheckHCal (m_AllProto[i])) continue;
@@ -209,9 +208,9 @@ StatusCode Kali::ElecPresel::execute() {
 //=============================================================================
 // Propagate ProtoParticle to specified Z
 //=============================================================================
-void Kali::ElecPresel::PropagateToZ(const ProtoParticle *proto, double z, 
+void Kali::ElecPresel::PropagateToZ(const ProtoParticle *proto, double z,
                                                    double *x, double *y) {
-  
+
   const Track *track = proto->track();
   State state = track->closestState (z);
 //  fprintf (stdout,"Where: %f, What: %f %f\n",z,state
@@ -228,7 +227,7 @@ void Kali::ElecPresel::PropagateToZ(const ProtoParticle *proto, double z,
 // HCAL
 //=============================================================================
 bool Kali::ElecPresel::CheckHCal (const ProtoParticle *proto) {
-  
+
   float ehcal = 0.;
   int iCharge = proto->charge();
 // Propagate to HCAL
@@ -249,7 +248,7 @@ bool Kali::ElecPresel::CheckHCal (const ProtoParticle *proto) {
    }
    return true;
 }
-  
+
 //=============================================================================
 //  Finalize
 //=============================================================================
diff --git a/Phys/KaliCalo/src/MakeDir.cpp b/Phys/KaliCalo/src/MakeDir.cpp
index 9595a860beed4bdea772dc920ec8ee2131219408..b82adaa5c9887705cb8566ec7222ab069dd50eec 100644
--- a/Phys/KaliCalo/src/MakeDir.cpp
+++ b/Phys/KaliCalo/src/MakeDir.cpp
@@ -1,12 +1,7 @@
-// $Id$
 // ============================================================================
-// Include files 
+// Include files
 // ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/AlgFactory.h"
-// ============================================================================
-// GaudiAlg 
+// GaudiAlg
 // ============================================================================
 #include "GaudiAlg/GaudiAlgorithm.h"
 // ============================================================================
@@ -14,48 +9,41 @@
 // ============================================================================
 #include "Kali.h"
 // ============================================================================
-namespace Kali 
+namespace Kali
 {
   // ==========================================================================
   class MakeDir : public GaudiAlgorithm
   {
-    // ========================================================================
-    /// the friend factory for instantiation 
-    friend class AlgFactory<Kali::MakeDir> ;
-    // ========================================================================
   public:
     // ========================================================================
-    /// the only one essential method 
-    StatusCode execute() override             // the only one essential method 
+    /// the only one essential method
+    StatusCode execute() override             // the only one essential method
     {
       //
-      for ( std::vector<std::string>::const_iterator item = 
-              m_locations1.begin() ; m_locations1.end() != item ; ++item ) 
+      for ( std::vector<std::string>::const_iterator item =
+              m_locations1.begin() ; m_locations1.end() != item ; ++item )
       {
-        if ( exist<DataObject>( Kali::kalify ( *item ) ) ) 
+        if ( exist<DataObject>( Kali::kalify ( *item ) ) )
         { put ( new DataObject() , *item ) ; }
       }
       //
-      for ( std::vector<std::string>::const_iterator item = 
-              m_locations2.begin() ; m_locations2.end() != item ; ++item ) 
+      for ( std::vector<std::string>::const_iterator item =
+              m_locations2.begin() ; m_locations2.end() != item ; ++item )
       {
-        put ( new DataObject() , *item ) ; 
+        put ( new DataObject() , *item ) ;
       }
       //
       return StatusCode::SUCCESS ;
-    } 
-    // ========================================================================
-  protected:
-    // ========================================================================
-    /** standard constructor 
-     *  @param name algorithm instance name 
-     *  @param psvc pointer to Service Locator 
+    }
+    /** standard constructor
+     *  @param name algorithm instance name
+     *  @param psvc pointer to Service Locator
      */
-    MakeDir  ( const std::string& name ,  // algorithm instance name 
+    MakeDir  ( const std::string& name ,  // algorithm instance name
                ISvcLocator*       pSvc )  // poiunetr to Service locator
-      : GaudiAlgorithm ( name , pSvc ) 
-      , m_locations1 () 
-      , m_locations2 () 
+      : GaudiAlgorithm ( name , pSvc )
+      , m_locations1 ()
+      , m_locations2 ()
     {
       //
       m_locations1.push_back ( "/Event/Rec/Track"  ) ;
@@ -68,26 +56,15 @@ namespace Kali
       m_locations2.push_back ( "/Event/Rec/ProtoP" ) ;
       m_locations2.push_back ( "/Event/Rec/Calo"   ) ;
       //
-      declareProperty 
-        ( "Locations1" , 
-          m_locations1  , 
+      declareProperty
+        ( "Locations1" ,
+          m_locations1  ,
           "The list of locations to be created" ) ;
-      declareProperty 
-        ( "Locations2" , 
-          m_locations2  , 
+      declareProperty
+        ( "Locations2" ,
+          m_locations2  ,
           "The list of locations to be created" ) ;
     }
-    /// virtual & protected destructor 
-    virtual ~MakeDir() {}
-    // ========================================================================
-  private:
-    // ========================================================================
-    /// the default constructor is disabled 
-    MakeDir () ;                         // the default constructor is disabled 
-    /// the copy constructor is disabled 
-    MakeDir ( const MakeDir& ) ;            // the copy constructor is disabled 
-    /// the assignement operato is disabled 
-    MakeDir& operator=( const MakeDir& ) ;       // the assignement is disabled 
     // ========================================================================
   private:
     // ========================================================================
@@ -97,13 +74,11 @@ namespace Kali
     // ========================================================================
   } ;
   // ==========================================================================
-} //                                                      end of namespace Kali 
+} //                                                      end of namespace Kali
 // ============================================================================
 // The Factory
 // ============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,MakeDir)
+DECLARE_COMPONENT( Kali::MakeDir )
 // ============================================================================
-// The END 
+// The END
 // ============================================================================
-
-
diff --git a/Phys/KaliCalo/src/MisCalibrateCalo.cpp b/Phys/KaliCalo/src/MisCalibrateCalo.cpp
index 7ea7f29ff06a364a2dfa17fb675ef10060258bc2..f616f16480732298a1e473941e944623b9f5602f 100644
--- a/Phys/KaliCalo/src/MisCalibrateCalo.cpp
+++ b/Phys/KaliCalo/src/MisCalibrateCalo.cpp
@@ -1,18 +1,16 @@
-// $Id$
 // =============================================================================
-// Include files 
+// Include files
 // =============================================================================
 // GaudiKernel
 // =============================================================================
 #include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/AlgFactory.h"
 #include "GaudiKernel/HashMap.h"
 // ============================================================================
 // LHcCbKernel
 // ============================================================================
 #include "Kernel/CaloCellIDHash.h"
 // ============================================================================
-// CaloUtils 
+// CaloUtils
 // ============================================================================
 #include "CaloUtils/CaloCellIDAsProperty.h"
 // =============================================================================
@@ -20,174 +18,156 @@
 // =============================================================================
 #include "GaudiAlg/GaudiAlgorithm.h"
 // =============================================================================
-// Event 
+// Event
 // =============================================================================
 #include "Event/CaloDigit.h"
 // =============================================================================
-// CaloDet 
+// CaloDet
 // =============================================================================
 #include "CaloDet/DeCalorimeter.h"
 // =============================================================================
 /** @namespace Kali
- *  helper namespace to keep classes and functions for Calorimeter 
+ *  helper namespace to keep classes and functions for Calorimeter
  *  Calibration
  *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
  *  @date 2009-07-31
- */ 
-namespace Kali 
+ */
+namespace Kali
 {
   // ===========================================================================
   /** @class MisCalibrateCalo
-   *  Helper class for (mis)calibration of Digits 
+   *  Helper class for (mis)calibration of Digits
    *  It is very useful for varius (mis)calibration purposes.
    *
    *  (Mis)Calibration coefficients are defined througgh map-like property:
-   * 
+   *
    *  @code
-   * 
+   *
    *  from Configurables import Kali__MisCalibrateCalo
    *
-   *  kali = Kali__MisCalibrateCalo( 'MisCalibrateEcal' ) 
-   *  kali.Coefficients = { 
+   *  kali = Kali__MisCalibrateCalo( 'MisCalibrateEcal' )
+   *  kali.Coefficients = {
    *      1451  : 1.2 ,
    *      1452  : 1.1 ,
    *      ..
    *      4551  : 1.2 ,
-   *      1451  : 1.2 
+   *      1451  : 1.2
    *  }
    *  @endcode
    *
-   *  Where map-index is either the full integer  
+   *  Where map-index is either the full integer
    *  representation of CaloCellID, or its 'index' part only
    *
    *  @see LHCb::CaloCellID
-   *  
+   *
    *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
    *  @date 2009-07-31
    */
   class MisCalibrateCalo : public GaudiAlgorithm
   {
-    // =========================================================================
-    /// the friend factory for instantiation
-    friend class AlgFactory<Kali::MisCalibrateCalo> ;
-    // =========================================================================
   public:
     // =========================================================================
-    /// standard initialization 
-    StatusCode initialize () override;                 // standard initialization 
-    /// execution 
-    StatusCode execute    () override;                 //               execution 
-    /// standard finalization 
+    /// standard initialization
+    StatusCode initialize () override;                 // standard initialization
+    /// execution
+    StatusCode execute    () override;                 //               execution
+    /// standard finalization
     StatusCode finalize   () override;                 //   standard finalization
-    // =========================================================================
-  protected:
-    // =========================================================================
     /** standard constructor
-     *  @param name algorithm instance name 
+     *  @param name algorithm instance name
      *  @param pSvc service locator
      */
-    MisCalibrateCalo 
-    ( const std::string& name ,                       // algorithm instance name 
+    MisCalibrateCalo
+    ( const std::string& name ,                       // algorithm instance name
       ISvcLocator*       pSvc ) ;                     //         service locator
-    /// virtual destructor 
-    virtual ~MisCalibrateCalo() {} 
-    // =========================================================================
-  private:
-    // =========================================================================
-    /// the default constructor is disabled 
-    MisCalibrateCalo () ;                 // the default constructor is disabled 
-    /// copy constructor is disabled 
-    MisCalibrateCalo ( const MisCalibrateCalo& ) ;        // no copy constructor
-    /// assignement is disabled 
-    MisCalibrateCalo& operator=( const MisCalibrateCalo& ) ;   // no assignement
     // =========================================================================
   public:
     // =========================================================================
-    /// property type 
-    // typedef std::map<int,double>   PMap ;                    // property type 
-    typedef std::map<LHCb::CaloCellID,double>   PMap ;          // property type 
-    /// the actual table of calibration coefficents 
+    /// property type
+    // typedef std::map<int,double>   PMap ;                    // property type
+    typedef std::map<LHCb::CaloCellID,double>   PMap ;          // property type
+    /// the actual table of calibration coefficents
     typedef GaudiUtils::HashMap<LHCb::CaloCellID,double> Table ;
     // =========================================================================
   protected:
     // =========================================================================
     void handleMap ( Property& /* p */ ) ;
     // =========================================================================
-    /// update the table of calibration coefficients 
+    /// update the table of calibration coefficients
     StatusCode updateTable ( const PMap& pmap )  ;
     // =========================================================================
   private:
     // =========================================================================
-    /// TES location of digits 
-    std::string m_location ;                           // TES location of digits 
-    /// the name of calorimeter 
-    std::string m_caloName ;                          // the name of calorimeter 
-    /// property: { int : double } 
-    PMap        m_pmap     ;                       // property: { int : double } 
+    /// TES location of digits
+    std::string m_location ;                           // TES location of digits
+    /// the name of calorimeter
+    std::string m_caloName ;                          // the name of calorimeter
+    /// property: { int : double }
+    PMap        m_pmap     ;                       // property: { int : double }
     // =========================================================================
   private:
     // =========================================================================
-    /// actual table { cell : double } 
-    Table       m_table    ;                   // actual table { cell : double } 
+    /// actual table { cell : double }
+    Table       m_table    ;                   // actual table { cell : double }
     // =========================================================================
   };
   // ===========================================================================
-} //                                                       end of namespace Kali 
+} //                                                       end of namespace Kali
 // =============================================================================
 /*  standard constructor
- *  @param name algorithm instance name 
+ *  @param name algorithm instance name
  *  @param pSvc service locator
  */
 // =============================================================================
-Kali::MisCalibrateCalo::MisCalibrateCalo 
-( const std::string& name ,                           // algorithm instance name 
+Kali::MisCalibrateCalo::MisCalibrateCalo
+( const std::string& name ,                           // algorithm instance name
   ISvcLocator*       pSvc )                           //         service locator
-  : GaudiAlgorithm ( name , pSvc ) 
+  : GaudiAlgorithm ( name , pSvc )
   , m_location     ( LHCb::CaloDigitLocation::Ecal )
-  , m_caloName     ( DeCalorimeterLocation::Ecal ) 
-  , m_pmap  () 
-  , m_table () 
+  , m_caloName     ( DeCalorimeterLocation::Ecal )
+  , m_pmap  ()
+  , m_table ()
 {
-  // 
-  if      ( std::string::npos != name.find ( "Ecal" ) ) 
+  //
+  if      ( std::string::npos != name.find ( "Ecal" ) )
   {
     m_location = LHCb::CaloDigitLocation ::Ecal ;
-    m_caloName = DeCalorimeterLocation   ::Ecal ;  
+    m_caloName = DeCalorimeterLocation   ::Ecal ;
   }
-  else if ( std::string::npos != name.find ( "Hcal" ) ) 
+  else if ( std::string::npos != name.find ( "Hcal" ) )
   {
     m_location = LHCb::CaloDigitLocation ::Hcal ;
-    m_caloName = DeCalorimeterLocation   ::Hcal ;  
+    m_caloName = DeCalorimeterLocation   ::Hcal ;
   }
-  else if ( std::string::npos != name.find ( "Spd"  ) ) 
+  else if ( std::string::npos != name.find ( "Spd"  ) )
   {
     m_location = LHCb::CaloDigitLocation ::Spd  ;
-    m_caloName = DeCalorimeterLocation   ::Spd  ;  
+    m_caloName = DeCalorimeterLocation   ::Spd  ;
   }
-  else if ( std::string::npos != name.find ( "Prs"  ) ) 
+  else if ( std::string::npos != name.find ( "Prs"  ) )
   {
     m_location = LHCb::CaloDigitLocation ::Prs  ;
-    m_caloName = DeCalorimeterLocation   ::Prs  ;  
+    m_caloName = DeCalorimeterLocation   ::Prs  ;
   }
   //
-  declareProperty 
+  declareProperty
     ( "Digits"        , m_location  ,
       "TES address of digits to be (mis)cailbrated" );
-  declareProperty 
+  declareProperty
     ( "Calorimeter"   , m_caloName  ,
       "Calorimeter to be used"      ) ;
-  declareProperty 
+  declareProperty
     ( "Coefficients"  , m_pmap ,
-      "Map of (mis)calibration coefficients" ) 
+      "Map of (mis)calibration coefficients" )
     -> declareUpdateHandler(&Kali::MisCalibrateCalo::handleMap , this ) ;
 }
 // =============================================================================
-// standard initialization 
+// standard initialization
 // =============================================================================
-StatusCode Kali::MisCalibrateCalo::initialize ()      // standard initialization 
+StatusCode Kali::MisCalibrateCalo::initialize ()      // standard initialization
 {
   StatusCode sc = GaudiAlgorithm::initialize () ;
-  if ( sc.isFailure() ) { return sc ; }                                // RETURN 
+  if ( sc.isFailure() ) { return sc ; }                                // RETURN
   //
   m_table.clear() ;
   updateTable ( m_pmap ) ;
@@ -195,7 +175,7 @@ StatusCode Kali::MisCalibrateCalo::initialize ()      // standard initialization
   return StatusCode::SUCCESS ;
 }
 // =============================================================================
-// standard finalization 
+// standard finalization
 // =============================================================================
 StatusCode Kali::MisCalibrateCalo::finalize  ()       //   standard finalization
 { return GaudiAlgorithm::finalize () ; }
@@ -204,22 +184,22 @@ StatusCode Kali::MisCalibrateCalo::finalize  ()       //   standard finalization
 // =============================================================================
 StatusCode Kali::MisCalibrateCalo::execute   ()                     // execution
 {
-  if ( m_table.empty() ) { return StatusCode::SUCCESS ; }              // RETURN 
+  if ( m_table.empty() ) { return StatusCode::SUCCESS ; }              // RETURN
   //
-  // get digits 
-  LHCb::CaloDigit::Container* digits = 
+  // get digits
+  LHCb::CaloDigit::Container* digits =
     get<LHCb::CaloDigit::Container>( m_location ) ;
-  //  
+  //
   StatEntity* cnt = 0 ;
   if ( msgLevel ( MSG::DEBUG ) ) { cnt = &counter("#scaled") ; }
   // loop over container
-  for ( LHCb::CaloDigit::Container::iterator idigit = digits->begin() ; 
-        digits->end() != idigit ; ++idigit ) 
+  for ( LHCb::CaloDigit::Container::iterator idigit = digits->begin() ;
+        digits->end() != idigit ; ++idigit )
   {
     LHCb::CaloDigit* digit = *idigit ;
-    if ( 0 == digit              ) { continue ; }                    // CONTINUE 
+    if ( 0 == digit              ) { continue ; }                    // CONTINUE
     Table::const_iterator ifind = m_table.find ( digit->cellID() ) ;
-    if (  ifind == m_table.end() ) { continue ; }                    // CONTINUE 
+    if (  ifind == m_table.end() ) { continue ; }                    // CONTINUE
     //
     const double scale = ifind->second ;
     //
@@ -231,43 +211,43 @@ StatusCode Kali::MisCalibrateCalo::execute   ()                     // execution
   return StatusCode::SUCCESS ;
 }
 // =============================================================================
-// update the table of cofficients 
+// update the table of cofficients
 // =============================================================================
 StatusCode Kali::MisCalibrateCalo::updateTable
-( const Kali::MisCalibrateCalo::PMap& pmap ) 
+( const Kali::MisCalibrateCalo::PMap& pmap )
 {
-  // get calorimeter 
+  // get calorimeter
   const DeCalorimeter* det = getDet<DeCalorimeter>( m_caloName ) ;
   //
   const int calo = CaloCellCode::CaloNumFromName ( m_caloName ) ;
-  Assert  (  0  <= calo , "Invalid Calo index" ) ; 
+  Assert  (  0  <= calo , "Invalid Calo index" ) ;
   const unsigned int icalo = calo ;
   //
-  for ( PMap::const_iterator item = pmap.begin() ; 
-        pmap.end() != item ; ++item ) 
+  for ( PMap::const_iterator item = pmap.begin() ;
+        pmap.end() != item ; ++item )
   {
-    // get ID 
+    // get ID
     LHCb::CaloCellID cellID ( item->first ) ;
     // redefine calo (if needed)
-    if ( icalo != cellID.calo() ) 
-    { 
+    if ( icalo != cellID.calo() )
+    {
       ++counter("suspicios cell") ;
-      cellID.setCalo ( icalo ) ; 
+      cellID.setCalo ( icalo ) ;
     }
     //
     // check the calo
     if ( !det->valid ( cellID ) )
     {
       ++counter ("invalid cell") ;
-      continue ; 
+      continue ;
     }
     //
-    if ( cellID.isPin() ) 
+    if ( cellID.isPin() )
     {
       ++counter ("pin cell") ;
-      continue ; 
+      continue ;
     }
-    // 
+    //
     const double scale = item->second ;
     //
     m_table[ cellID ] = scale ;
@@ -276,24 +256,24 @@ StatusCode Kali::MisCalibrateCalo::updateTable
   //
   info () << "Calibration coefficients are defined" << m_table.size() << endmsg ;
   //
-  if ( m_table.empty() ) 
+  if ( m_table.empty() )
   { return Warning ( "No calibration coefficients are defined" ) ; }
   //
   return StatusCode::SUCCESS ;
 }
 // ============================================================================
-// Handler for update property 
+// Handler for update property
 // ============================================================================
-void Kali::MisCalibrateCalo::handleMap ( Property& /* p */ ) 
+void Kali::MisCalibrateCalo::handleMap ( Property& /* p */ )
 {
-  // no action if not yet initialized 
+  // no action if not yet initialized
   if ( FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
-  // 
+  //
   m_table.clear() ;
   updateTable ( m_pmap ) ;
 }
 // =============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,MisCalibrateCalo)
+DECLARE_COMPONENT( Kali::MisCalibrateCalo )
 // =============================================================================
-// The END 
+// The END
 // =============================================================================
diff --git a/Phys/KaliCalo/src/Pi0.cpp b/Phys/KaliCalo/src/Pi0.cpp
index 84a84e3418306cdeab915733e4908f9c95066785..757f192ec2d7edf321c517da470dce3c80a7854c 100755
--- a/Phys/KaliCalo/src/Pi0.cpp
+++ b/Phys/KaliCalo/src/Pi0.cpp
@@ -60,19 +60,12 @@ namespace Kali
    */
   class Pi0 : public LoKi::Algo
   {
-    // ========================================================================
-    /// friend factory for instantiation
-    friend class AlgFactory<Kali::Pi0> ;    // friend factory for instantiation
-    // ========================================================================
   public:
     // ========================================================================
     /// the proper initialzation
     StatusCode initialize () override;          // the proper tinitialzation
     /// the main 'execution' method
     StatusCode analyse    () override;          //  the main 'execution' method
-    // ========================================================================
-  protected:
-    // ========================================================================
     /** standard constructor
      *  @param name (INPUT) the algorithm instance name
      *  @param pSvc (INPUT) the pointer to Service Locator
@@ -84,8 +77,8 @@ namespace Kali
       , m_mirror        ( false )
       , m_veto_dm       ( -1 * Gaudi::Units::MeV )
       , m_veto_chi2     ( -1  )
-      , m_numbers       ( "Counters/Kali" ) 
-      , m_counters      () 
+      , m_numbers       ( "Counters/Kali" )
+      , m_counters      ()
       , m_pi0CutExp     ( "PT > 200*MeV*(7-ETA)" )
       , m_pi0Cut        ( LoKi::BasicFunctors<const LHCb::Particle*>::BooleanConstant ( false ) )
       , m_spdDigitsTool (  0  )
@@ -151,17 +144,9 @@ namespace Kali
       Assert ( sc.isSuccess() , "Unable to set the proper ParticleCombiner" );
       //
     }
-    /// virtual & protected destructor
-    virtual ~Pi0() {}
     // ========================================================================
   private:
     // ========================================================================
-    /// the default constructor is disabled
-    Pi0 () ;                            //  the default constructor is disabled
-    /// the copy  constructor is disabled
-    Pi0 ( const Pi0& ) ;                //     the copy constructor is disabled
-    /// the assignement operator is disabled
-    Pi0& operator=( const Pi0& ) ;      // the assignement operator is disabled
     /// fill tuple method
     void fillTuple
     ( const Tuple& ,
@@ -177,7 +162,7 @@ namespace Kali
       const Gaudi::XYZPoint&  ,
       const Gaudi::XYZPoint&  ,
       const LHCb::CaloCluster* ,
-      const LHCb::CaloCluster* ,          
+      const LHCb::CaloCluster* ,
       const int               ) ;
     // ========================================================================
     double caloEnergy4Photon ( const Gaudi::LorentzVector&  p ) ;
@@ -207,11 +192,11 @@ namespace Kali
     double m_veto_chi2 ;                             // Delta-mass for pi0-veto
     /// TES-location of counters for Global Event Activity
     std::string              m_numbers  ; // counters for Global Event Activity
-    std::vector<std::string> m_counters ; // names for the counters 
+    std::vector<std::string> m_counters ; // names for the counters
     /// pi0-Cut functor
     std::string       m_pi0CutExp ;                    //       Pi0-Cut functor
-    /// pi0-Cut functor expression 
-    LoKi::Types::Cut  m_pi0Cut    ;               // pi0-Cut functor expression 
+    /// pi0-Cut functor expression
+    LoKi::Types::Cut  m_pi0Cut    ;               // pi0-Cut functor expression
     /// Tool for retrieving SPD digits info
     ICaloDigits4Track*  m_spdDigitsTool ; // Tool for retrieving SPD digits info
     // DeCalorimeter object for ECAL
@@ -361,7 +346,7 @@ void Kali::Pi0::fillTuple
   // Energies
   const double eRaw1 = clus1->position().e() ;
   const double eRaw2 = clus2->position().e() ;
-  
+
   tuple -> column ( "eClus1" , eRaw1 ) ;
   tuple -> column ( "eClus2" , eRaw2 ) ;
 
@@ -376,7 +361,7 @@ void Kali::Pi0::fillTuple
 
   tuple -> column ( "eSeed1" , eSeed1 ) ;
   tuple -> column ( "eSeed2" , eSeed2 ) ;
-  
+
   tuple -> write () ;
 }
 // ============================================================================
@@ -404,8 +389,8 @@ double Kali::Pi0::caloEnergy4Photon( const Gaudi::LorentzVector&  p )
 double Kali::Pi0::getSeedCellEnergy ( const LHCb::CaloCluster* cluster )
 {
   const LHCb::CaloCluster::Entries& entries = cluster->entries();
-  LHCb::CaloCluster::Entries::const_iterator iseed = 
-    LHCb::ClusterFunctors::locateDigit 
+  LHCb::CaloCluster::Entries::const_iterator iseed =
+    LHCb::ClusterFunctors::locateDigit
     ( entries.begin () ,entries.end   () , LHCb::CaloDigitStatus::SeedCell ) ;
   //
   if( entries.end() == iseed ) return 0.0;
@@ -431,15 +416,15 @@ StatusCode Kali::Pi0::initialize  ()                // the proper initialzation
   //
   setupHistos() ;
   //
-  LoKi::IHybridFactory* factory = 
+  LoKi::IHybridFactory* factory =
     tool<LoKi::IHybridFactory> ( "LoKi::Hybrid::Tool/HybridFactory:PUBLIC" ) ;
   sc = factory -> get ( m_pi0CutExp , m_pi0Cut ) ;
-  if ( sc.isFailure() ) 
-  { return Error ( "Unable to compile Pi0-Cut predicate" , sc ) ; }   
+  if ( sc.isFailure() )
+  { return Error ( "Unable to compile Pi0-Cut predicate" , sc ) ; }
   //
   // Load tool for SPD
-  m_spdDigitsTool = 
-    tool<ICaloDigits4Track>( "SpdEnergyForTrack" , this ) ; 
+  m_spdDigitsTool =
+    tool<ICaloDigits4Track>( "SpdEnergyForTrack" , this ) ;
   sc = Gaudi::Utils::setProperty ( m_spdDigitsTool , "AddNeighbours" , 1 ) ;
   if ( sc.isFailure() )
   { return Error ( "Unable to configure 'SpdEnergyForTrack' tool", sc ) ; }
@@ -469,83 +454,83 @@ StatusCode Kali::Pi0::analyse    ()            // the only one essential method
   // get all photons with
   Range all   = select ( "all_g" ,        "gamma" == ID       ) ;
   Range gamma = select ( "g"     , all , ( PT > ptCut_Gamma ) ) ;
-  
+
   counter ( "#gamma_all") += all   . size () ;
   counter ( "#gamma"    ) += gamma . size () ;
 
   Tuple tuple = nTuple ( "Pi0-Tuple" ) ;
-  
+
   const bool make_tuples = produceNTuples() ;
-  
+
   LHCb::CaloDigit::Set digits ;
-  
+
   typedef std::set<const LHCb::Particle*> Photons ;
   Photons                                 photons ;
-  
+
   const Gaudi::Numbers* numbers = 0 ;
   if ( exist<Gaudi::Numbers>( m_numbers ) )  { numbers = get <Gaudi::Numbers>( m_numbers ) ; }
   //
-  // global event activity: 
+  // global event activity:
   //
   typedef std::map<std::string,double> GecMap ;
   GecMap gec ;
   for ( std::vector<std::string>::const_iterator item = m_counters.begin() ;
-	m_counters.end() != item ; ++item ) 
+	m_counters.end() != item ; ++item )
     {
       gec [ *item ] = -1 ;
-      if ( 0 == numbers  ) { continue ; } 
+      if ( 0 == numbers  ) { continue ; }
       //
       const Gaudi::Numbers::Map& m = numbers->numbers() ;
       Gaudi::Numbers::Map::const_iterator ifind = m.find ( *item ) ;
       if ( m.end() == ifind )
-	{ 
+	{
 	  Warning ( "Gaudi::Numbers does nto contain item: " + (*item ) ) . ignore () ;
 	  continue ;
-	} 
+	}
       gec [ *item ] = ifind->second ;
     }
   //
   // statistics:
-  for ( GecMap::const_iterator igec = gec.begin() ; gec.end() != igec ; ++igec ) 
+  for ( GecMap::const_iterator igec = gec.begin() ; gec.end() != igec ; ++igec )
     { counter ( igec->first ) += igec->second ;  }
   //
   // the major loop
   //
   for ( Loop pi0 = loop( "g g" , "pi0" ) ; pi0 ; ++pi0 )
     {
-      
+
       const double              m12 = pi0->mass ( 1 , 2 ) ;
       const LoKi::LorentzVector p12 = pi0->p    ( 1 , 2 ) ;
-      
+
       const LHCb::Particle* g1 = pi0(1) ;
       if ( 0 == g1         ) { continue ; }  // CONTINUE
-      
+
       const LHCb::Particle* g2 = pi0(2) ;
       if ( 0 == g2         ) { continue ; }  // CONTINUE
-      
+
       // trick with "mirror-background" by Albert Puig
-      
+
       // invert the first photon :
       Gaudi::LorentzVector _p1 = g1->momentum() ;
       _p1.SetPx ( -_p1.Px () ) ;
       _p1.SetPy ( -_p1.Py () ) ;
       const Gaudi::LorentzVector fake = ( _p1 + g2->momentum() ) ;
-      
-      // create the fake pi0 
+
+      // create the fake pi0
       std::auto_ptr<LHCb::Particle> fakePi0 ( pi0.particle()->clone() ) ;
       fakePi0->setMomentum(fake) ;
-      
+
       bool good    =             ( m12      < 335 * MeV ) ;
       bool goodBkg = m_mirror && ( fake.M() < 335 * MeV ) ;
-      
+
       if ( (!good)  && (!goodBkg) ) { continue ; }   // CONTINUE!!!
-      
+
       double spd1e = seedEnergyFrom ( g1 , spd ) ;
-      if ( 0 < spd1e ) { continue ; }                // CONTINUE  
-      
+      if ( 0 < spd1e ) { continue ; }                // CONTINUE
+
       double spd2e = seedEnergyFrom ( g2 , spd ) ;
-      if ( 0 < spd2e ) { continue ; }                // CONITUNE 
-      
+      if ( 0 < spd2e ) { continue ; }                // CONITUNE
+
       // order the photons according energy in preshower
       double prs1e = energyFrom ( g1 , prs ) ;
       double prs2e = energyFrom ( g2 , prs ) ;
@@ -555,40 +540,40 @@ StatusCode Kali::Pi0::analyse    ()            // the only one essential method
 	  std::swap ( prs1e , prs2e ) ;
 	  std::swap ( spd1e , spd2e ) ;
 	}
-      
+
       const LHCb::CaloHypo* hypo1 = hypo ( g1 )  ;
-      if ( 0 == hypo1 ) { continue ; }                       // CONTINUE 
+      if ( 0 == hypo1 ) { continue ; }                       // CONTINUE
       const LHCb::CaloHypo* hypo2 = hypo ( g2 )  ;
-      if ( 0 == hypo2 ) { continue ; }                       // CONTINUE 
-      
+      if ( 0 == hypo2 ) { continue ; }                       // CONTINUE
+
       const LHCb::CaloCluster* cluster1 = cluster ( g1 )  ;
-      if ( 0 == cluster1 ) { continue ; }                    // CONITNUE 
+      if ( 0 == cluster1 ) { continue ; }                    // CONITNUE
       const LHCb::CaloCluster* cluster2 = cluster ( g2 )  ;
       if ( 0 == cluster2 ) { continue ; }                    // CONTINUE
-      
+
       /// apply pi0-cut:
       //if  ( !m_pi0Cut ( pi0 ) ) { continue ; }               // CONTINUE
       good    = good    && m_pi0Cut ( pi0           ) ;
       goodBkg = goodBkg && m_pi0Cut ( fakePi0.get() ) ;
       if ( (!good) && (!goodBkg) ) { continue ; }            // CONTINUE
-      
+
       const Gaudi::LorentzVector mom1 = g1->momentum() ;
       const Gaudi::LorentzVector mom2 = g2->momentum() ;
-      
+
       const double spd1e3x3 = caloEnergy4Photon ( g1 -> momentum () ) ;
       const double spd2e3x3 = caloEnergy4Photon ( g2 -> momentum () ) ;
-      
+
       // apply cut on 3x3 SPD
-      if ( spdCut < spd1e3x3 ) { continue ; }                 // CONTINUE 
-      if ( spdCut < spd2e3x3 ) { continue ; }                 // CONTINUE 
-      
+      if ( spdCut < spd1e3x3 ) { continue ; }                 // CONTINUE
+      if ( spdCut < spd2e3x3 ) { continue ; }                 // CONTINUE
+
       // pi0-veto ?
       bool veto = true ;
-      if ( 0 < m_veto_dm || 0 < m_veto_chi2 ) 
+      if ( 0 < m_veto_dm || 0 < m_veto_chi2 )
 	{ veto = pi0Veto ( g1 , g2 , all   , m_veto_dm , m_veto_chi2 ) ; }
       if ( !veto ) { continue ; }                                           // CONTINUE
-      
-      
+
+
       if ( good && m12 < 250 * MeV )
 	{
 	  if ( 0 != m_h1                                         ) { m_h1 -> fill ( m12 ) ; }
@@ -596,24 +581,24 @@ StatusCode Kali::Pi0::analyse    ()            // the only one essential method
 	  if ( 0 != m_h3 && prs1e < 10 * MeV && prs2e > 10 * MeV ) { m_h3 -> fill ( m12 ) ; }
 	  if ( 0 != m_h4 &&                     prs1e > 10 * MeV ) { m_h4 -> fill ( m12 ) ; }
 	}
-      
+
       // finally save good photons:
       photons.insert  ( g1 ) ;
       photons.insert  ( g2 ) ;
-      
-      if  ( !make_tuples ) { continue ; }                      // CONTINUE 
-      
+
+      if  ( !make_tuples ) { continue ; }                      // CONTINUE
+
       const LHCb::CaloCellID cell1 = cellID( g1 ) ;
       const LHCb::CaloCellID cell2 = cellID( g2 ) ;
-      
-      
+
+
       Gaudi::XYZPoint point1 ( hypo1->position()->x() ,
 			       hypo1->position()->y() ,
 			       hypo1->position()->z() );
       //
-      if ( good || goodBkg ) 
+      if ( good || goodBkg )
 	{
-	  for ( GecMap::const_iterator igec = gec.begin() ; gec.end() != igec ; ++igec ) 
+	  for ( GecMap::const_iterator igec = gec.begin() ; gec.end() != igec ; ++igec )
 	    { tuple->column ( igec->first , igec->second ) ; }
 	}
       // fill N-tuples
@@ -637,7 +622,7 @@ StatusCode Kali::Pi0::analyse    ()            // the only one essential method
 	}
       //
     }
-  
+
   for ( Photons::const_iterator iphoton = photons.begin() ;
         photons.end() != iphoton ; ++iphoton )
     {
@@ -645,17 +630,17 @@ StatusCode Kali::Pi0::analyse    ()            // the only one essential method
       LHCb::Particle ph (**iphoton) ;
       this->markTree( &ph  ) ;
     }
-  
+
   counter ( "#photons" ) += photons .size  () ;
-  
+
   setFilterPassed ( !photons.empty() ) ;
-  
+
   return StatusCode::SUCCESS ;
 }
 // ============================================================================
 // The factory:
 // ============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,Pi0)
+DECLARE_COMPONENT( Kali::Pi0 )
 // ============================================================================
 // The END
 // ============================================================================