From 7582795404594fcb45ffb3af9c2c5d83c5c013d3 Mon Sep 17 00:00:00 2001
From: eduardo-rodriguesgit <eduardo.rodrigues@cern.ch>
Date: Tue, 13 Mar 2018 16:27:11 +0100
Subject: [PATCH] Removal of Phys/KaliCalo from DaVinci.

---
 Phys/KaliCalo/CMakeLists.txt                  |  34 -
 Phys/KaliCalo/dict/KaliCalo.xml               |  17 -
 Phys/KaliCalo/dict/KaliCaloDict.h             |  37 -
 Phys/KaliCalo/doc/release.notes               | 625 -------------
 Phys/KaliCalo/grid/FirstPass.py               |  45 -
 Phys/KaliCalo/grid/GetLFNs.py                 |  62 --
 Phys/KaliCalo/grid/JobTemplate.py             |  37 -
 Phys/KaliCalo/grid/Kali.py                    |  48 -
 Phys/KaliCalo/grid/KaliDBMerger.py            |  61 --
 Phys/KaliCalo/grid/KaliFit.py                 |  17 -
 Phys/KaliCalo/grid/KaliPi0_200M_SP.py         |  78 --
 Phys/KaliCalo/grid/SecondPass.py              |  72 --
 .../CandidateMinimization/Calibrate.py        | 256 ------
 .../CombineLambdaMaps.py                      |  48 -
 .../CandidateMinimization/Commands.py         |  40 -
 .../CandidateMinimization/FillSelector.py     | 156 ----
 .../CandidateMinimization/FillTask.py         |  24 -
 .../CandidateMinimization/FitFunctions.py     | 175 ----
 .../KaliCalo/CandidateMinimization/FitTask.py |  25 -
 .../GetGlobalConstant.py                      |  99 ---
 .../KaliCalo/CandidateMinimization/Run.py     | 227 -----
 .../CandidateMinimization/__init__.py         |  41 -
 Phys/KaliCalo/python/KaliCalo/Cells.py        |  72 --
 .../KaliCalo/python/KaliCalo/Configuration.py | 837 ------------------
 .../python/KaliCalo/Data2009Reco07.py         |  65 --
 Phys/KaliCalo/python/KaliCalo/Det.py          |  88 --
 Phys/KaliCalo/python/KaliCalo/FakeCells.py    | 234 -----
 Phys/KaliCalo/python/KaliCalo/FitUtils.py     | 751 ----------------
 .../python/KaliCalo/Kali/FillSelectorBase.py  | 184 ----
 .../python/KaliCalo/Kali/FillTaskBase.py      | 234 -----
 .../python/KaliCalo/Kali/FitTaskBase.py       | 231 -----
 .../python/KaliCalo/Kali/HistoBase.py         | 361 --------
 .../python/KaliCalo/Kali/LambdaMap.py         | 227 -----
 .../KaliCalo/python/KaliCalo/Kali/__init__.py |  40 -
 Phys/KaliCalo/python/KaliCalo/KaliPi0.py      | 137 ---
 Phys/KaliCalo/python/KaliCalo/KaliPi0_1.py    | 104 ---
 .../KaliCalo/MassDistribution/Analyse.py      | 197 -----
 .../KaliCalo/MassDistribution/FillSelector.py | 178 ----
 .../KaliCalo/MassDistribution/FillTask.py     |  24 -
 .../KaliCalo/MassDistribution/FitFunctions.py | 221 -----
 .../KaliCalo/MassDistribution/FitTask.py      |  25 -
 .../python/KaliCalo/MassDistribution/Run.py   | 147 ---
 .../KaliCalo/MassDistribution/__init__.py     |  43 -
 Phys/KaliCalo/python/KaliCalo/Pi0.py          |  62 --
 Phys/KaliCalo/python/KaliCalo/Pi0_2.py        | 170 ----
 Phys/KaliCalo/python/KaliCalo/Pi0_3.py        | 142 ---
 Phys/KaliCalo/python/KaliCalo/ReadDB.py       |  44 -
 Phys/KaliCalo/python/KaliCalo/Utils.py        | 373 --------
 Phys/KaliCalo/python/KaliCalo/ZipShelve.py    | 306 -------
 Phys/KaliCalo/python/KaliCalo/__init__.py     |   0
 Phys/KaliCalo/root/CellCutter.cxx             | 132 ---
 Phys/KaliCalo/root/CellCutter.h               |  53 --
 Phys/KaliCalo/root/EcalMinimizer.cxx          |  32 -
 Phys/KaliCalo/root/EcalMinimizer.h            |  13 -
 Phys/KaliCalo/root/MinuitInterface.cxx        | 179 ----
 Phys/KaliCalo/root/MinuitInterface.h          |  93 --
 Phys/KaliCalo/root/PrsMinimizer.cxx           |  41 -
 Phys/KaliCalo/root/PrsMinimizer.h             |  13 -
 Phys/KaliCalo/src/Cloner.cpp                  | 101 ---
 Phys/KaliCalo/src/DataMove.cpp                | 131 ---
 Phys/KaliCalo/src/Destroyer.cpp               | 496 -----------
 Phys/KaliCalo/src/Destroyer.h                 | 190 ----
 Phys/KaliCalo/src/ElecPresel.cpp_             | 260 ------
 Phys/KaliCalo/src/ElecPresel.h                |  86 --
 Phys/KaliCalo/src/Kali.cpp                    |  36 -
 Phys/KaliCalo/src/Kali.h                      |  41 -
 Phys/KaliCalo/src/MakeDir.cpp                 | 109 ---
 Phys/KaliCalo/src/MisCalibrateCalo.cpp        | 299 -------
 Phys/KaliCalo/src/Pi0.cpp                     | 661 --------------
 69 files changed, 10687 deletions(-)
 delete mode 100644 Phys/KaliCalo/CMakeLists.txt
 delete mode 100644 Phys/KaliCalo/dict/KaliCalo.xml
 delete mode 100644 Phys/KaliCalo/dict/KaliCaloDict.h
 delete mode 100755 Phys/KaliCalo/doc/release.notes
 delete mode 100644 Phys/KaliCalo/grid/FirstPass.py
 delete mode 100644 Phys/KaliCalo/grid/GetLFNs.py
 delete mode 100644 Phys/KaliCalo/grid/JobTemplate.py
 delete mode 100644 Phys/KaliCalo/grid/Kali.py
 delete mode 100644 Phys/KaliCalo/grid/KaliDBMerger.py
 delete mode 100644 Phys/KaliCalo/grid/KaliFit.py
 delete mode 100644 Phys/KaliCalo/grid/KaliPi0_200M_SP.py
 delete mode 100644 Phys/KaliCalo/grid/SecondPass.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Calibrate.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/CombineLambdaMaps.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Commands.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FillSelector.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FillTask.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FitFunctions.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FitTask.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/GetGlobalConstant.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Run.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/CandidateMinimization/__init__.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Cells.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Configuration.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Data2009Reco07.py
 delete mode 100755 Phys/KaliCalo/python/KaliCalo/Det.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/FakeCells.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/FitUtils.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Kali/FillSelectorBase.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Kali/FillTaskBase.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Kali/FitTaskBase.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Kali/HistoBase.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Kali/LambdaMap.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Kali/__init__.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/KaliPi0.py
 delete mode 100755 Phys/KaliCalo/python/KaliCalo/KaliPi0_1.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/MassDistribution/Analyse.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/MassDistribution/FillSelector.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/MassDistribution/FillTask.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/MassDistribution/FitFunctions.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/MassDistribution/FitTask.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/MassDistribution/Run.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/MassDistribution/__init__.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Pi0.py
 delete mode 100755 Phys/KaliCalo/python/KaliCalo/Pi0_2.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/Pi0_3.py
 delete mode 100755 Phys/KaliCalo/python/KaliCalo/ReadDB.py
 delete mode 100755 Phys/KaliCalo/python/KaliCalo/Utils.py
 delete mode 100755 Phys/KaliCalo/python/KaliCalo/ZipShelve.py
 delete mode 100644 Phys/KaliCalo/python/KaliCalo/__init__.py
 delete mode 100644 Phys/KaliCalo/root/CellCutter.cxx
 delete mode 100644 Phys/KaliCalo/root/CellCutter.h
 delete mode 100644 Phys/KaliCalo/root/EcalMinimizer.cxx
 delete mode 100644 Phys/KaliCalo/root/EcalMinimizer.h
 delete mode 100644 Phys/KaliCalo/root/MinuitInterface.cxx
 delete mode 100644 Phys/KaliCalo/root/MinuitInterface.h
 delete mode 100644 Phys/KaliCalo/root/PrsMinimizer.cxx
 delete mode 100644 Phys/KaliCalo/root/PrsMinimizer.h
 delete mode 100644 Phys/KaliCalo/src/Cloner.cpp
 delete mode 100644 Phys/KaliCalo/src/DataMove.cpp
 delete mode 100644 Phys/KaliCalo/src/Destroyer.cpp
 delete mode 100644 Phys/KaliCalo/src/Destroyer.h
 delete mode 100644 Phys/KaliCalo/src/ElecPresel.cpp_
 delete mode 100644 Phys/KaliCalo/src/ElecPresel.h
 delete mode 100644 Phys/KaliCalo/src/Kali.cpp
 delete mode 100644 Phys/KaliCalo/src/Kali.h
 delete mode 100644 Phys/KaliCalo/src/MakeDir.cpp
 delete mode 100644 Phys/KaliCalo/src/MisCalibrateCalo.cpp
 delete mode 100755 Phys/KaliCalo/src/Pi0.cpp

diff --git a/Phys/KaliCalo/CMakeLists.txt b/Phys/KaliCalo/CMakeLists.txt
deleted file mode 100644
index fe9300416..000000000
--- a/Phys/KaliCalo/CMakeLists.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-################################################################################
-# Package: KaliCalo
-################################################################################
-gaudi_subdir(KaliCalo)
-
-gaudi_depends_on_subdirs(Calo/CaloUtils
-                         GaudiPython
-                         Phys/AnalysisPython
-                         Phys/LoKiAlgo
-                         Phys/LoKiArrayFunctors
-                         Phys/LoKiPhys
-                         Phys/DaVinci)
-
-find_package(Boost)
-find_package(ROOT)
-# hide warnings from some external projects
-include_directories(SYSTEM ${Boost_INCLUDE_DIRS} ${ROOT_INCLUDE_DIRS})
-
-
-find_package(pytools)
-
-gaudi_add_module(KaliCalo
-                 src/*.cpp
-                 INCLUDE_DIRS pytools
-                 LINK_LIBRARIES pytools CaloUtils GaudiPythonLib AnalysisPythonLib LoKiAlgo LoKiArrayFunctorsLib LoKiPhysLib)
-
-gaudi_add_dictionary(KaliCalo
-                     dict/KaliCaloDict.h
-                     dict/KaliCalo.xml
-                     INCLUDE_DIRS pytools
-                     LINK_LIBRARIES pytools CaloUtils GaudiPythonLib AnalysisPythonLib LoKiAlgo LoKiArrayFunctorsLib LoKiPhysLib
-                     OPTIONS " -U__MINGW32__ ")
-
-gaudi_install_python_modules()
diff --git a/Phys/KaliCalo/dict/KaliCalo.xml b/Phys/KaliCalo/dict/KaliCalo.xml
deleted file mode 100644
index 1935c3845..000000000
--- a/Phys/KaliCalo/dict/KaliCalo.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<!-- 
-     * $Id$ 
-     * ========================================================================
-     * CVS tag:$Name: not supported by cvs2svn $, version $Revision$ 
-     * ======================================================================== 
-     * @file
-     * The seleciton file to build Reflex dictionaries for Phys/KaliCalo package
-     * @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-     * @date 2010-03-25
-     * ========================================================================
--->
-
-<lcgdict>
-
-  <class name = "Kali_TPySelectorFix" />
-
-</lcgdict> 
diff --git a/Phys/KaliCalo/dict/KaliCaloDict.h b/Phys/KaliCalo/dict/KaliCaloDict.h
deleted file mode 100644
index 051ea2a4c..000000000
--- a/Phys/KaliCalo/dict/KaliCaloDict.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// $Id$
-// ============================================================================
-#ifndef KALI_KALICALODICT_H 
-#define KALI_KALICALODICT_H 1
-// ============================================================================
-// Include files 
-// ============================================================================
-// ROOT
-// ============================================================================
-#include "TPySelector.h"
-// ============================================================================
-/** @class TPySelectorFix 
- *  The temporary fix to allow the "normal" usage of instances of 
- *  TPySelector-derived classes 
- * The fix has been kindly provided by Wim Lavrijsen
- */
-class Kali_TPySelectorFix : public TPySelector 
-{
-  // ==========================================================================
-public:
-  // ==========================================================================
-  ClassDef(Kali_TPySelectorFix, 1) ;
-  // ==========================================================================
-public:
-  // ==========================================================================
-  /// constructor 
-  Kali_TPySelectorFix 
-  ( TTree*    tree = 0 , 
-    PyObject* self = 0 ) 
-    : TPySelector ( tree, self ) {}
-  // ==========================================================================
-};
-// ============================================================================
-// The END 
-// ============================================================================
-#endif // KALI_KALICALODICT_H
-// ============================================================================
diff --git a/Phys/KaliCalo/doc/release.notes b/Phys/KaliCalo/doc/release.notes
deleted file mode 100755
index 472894b61..000000000
--- a/Phys/KaliCalo/doc/release.notes
+++ /dev/null
@@ -1,625 +0,0 @@
-! -----------------------------------------------------------------------------
-! Package     : Phys/KaliCalo
-! Responsible : Olivier Deschamps
-! Purpose     : Collection of "physics" algorithms  for Calorimeter calibration
-! -----------------------------------------------------------------------------
-
-! 2016-11-29 - Daria Savrina
- - updated the list of test input data in Run.py for an easier tests
-
-!========================= KaliCalo v4r20 2016-06-13 ==========================
-
-! 2016-06-03 - Daria Savrina
- - Released criteria for "bad" cells (badParam function in python/KaliCalo/FitUtils.py)
- - In python/KaliCalo/Kali/FillSelectorBase.py updated beta parameters
-   to correspond to 2015-2016 data
-
-!========================= KaliCalo v4r19 2016-05-20 ==========================
-
-! 2016-05-06 - Daria Savrina
- - In Analyse.py make the coefficient for the cell to be equal 1. in case if
-   all three histograms in a corresponding set return bad parameters.
-
-! 2016-04-27 - Daria Savrina
- - added one more class of FakeCells, which returns the same CellID for all the
-   cells which are not on a list. For those, which are in the list it returns
-   their own CellIDs
-
-!========================= KaliCalo v4r18 2015-08-06 =========================
-
-! 2015-07-27 - Daria Savrina
- - corrected a typo in python/KaliCalo/Kali/FillTaskBase.py (to import the sets
-   module)
-
-!========================= KaliCalo v4r17 2015-02-26 =========================
-
-! 2015-02-26 - Eduardo Rodrigues
- - Package responsible updated.
-
-!========================= KaliCalo v4r16 2014-11-05 =========================
-
-! 2014-09-29 - Chris Jones
- - Update python/KaliCalo/KaliPi0.py to take input data from TestFileDB.
-
-!========================= KaliCalo v4r15 2014-07-28 =========================
-
-! 2014-07-23 - Olivier Deschamps
- - adapt to changes in ParticleMaker
-
-! 2014-04-14 - Rob Lambert
- - Make DaVinci dependency explicit (moved to DaVinci project) see task #50698
-
-!========================= KaliCalo v4r14p1 2014-04-02 =========================
-
-! 2014-02-21 - Chris Jones
- - Update EOS paths.
-
-!========================= KaliCalo v4r14 2013-06-13 =========================
-
-! 2013-05-09 - Chris Jones
- - Fix data paths in KaliPi0.py to read data from EOS instead of castor.
-
-!========================= KaliCalo v4r13p2 2013-05-07 =========================
-
-! 2013-02-27 - Chris Jones
- - Fix -pedantic compilation warnings
-
-!========================= KaliCalo v4r13p1 2012-11-30 =========================
-
-! 2012-11-29 - Marco Clemencic
- - Added CMake configuration file.
- - Modified requirements to simplify auto conversion to CMake.
-
-!========================= KaliCalo v4r13 2012-07-26 =========================
-
-! 2012-07-10 - Daria Savrina
- - removed post-configuration from KaliPi0Conf
-
-!========================= KaliCalo v4r12p2 2012-04-12 =========================
-
-! 2012-04-12 - Daria Savrina
- - import cpp from LoKiCore rather then from Bindings
-
-!========================= KaliCalo v4r12p1 2012-03-01 =========================
-
-! 2012-02-16 - Chris Jones
- - Adapt to changes in the DaVinci Configurable EnableUnpack property
-
-!========================= KaliCalo v4r12 2011-09-16 =========================
-! 2011-09-16 - Vanya Belyaev
- - fix in input/output persistency 
-
-! 2011-09-07 - Albert Puig
- - Updated CandidateMinimization method to be fully automatic.
-
-! 2011-08-08 - Daria Savrina
-
-- added a possibility not to write the fmDSTs (just translate an empty fmDST name)
-- added the cell groups defined by Jacques as one more FakeCells class
-
-! 2011-07-31 - Vanya Belyaev
-
- - try to preserve TES...
-      
-
-!========================= KaliCalo v4r11 2011-05-13 =========================
-! 2011-05-03 - Vanya Belyaev
- 
- - add information to fmDST about Global Event Activity 
-
-   1) LoKi::CounterAlg  runs af the first-pass, creates and fills Gaudi::Numbers 
-                        object with various GEA-information
-   2) TES-location for new object is "/Event/Counters/Kali"
-   3) This information is read by Kali::Pi0 algorithm and added to the n-tuple
-      the information is read eithe frmo TES (for first pass) or for fmDST 
-     (for the second pass)
-
-      Kali::Pi0 algorithm gets two new properties:  
-         - "CountersTES" - the TES location of GAE-counters
-                           e.g. it can be "standard" objects filled for microDST
-         - "Counters" - the list of counter to be copied from Gaudi::Numbers to n-tuple.
-             the default list is:
-            [ "nSpd", "nVelo" , "nLong" , "nPV" , "nOT" , 
-              "nITClusters"   , "nTTClusters"   ,
-              "nVeloClusters" , "nEcalClusters" , 
-              "nEcalDigits"   ] 
-
- 
-
- - cmt/requirements 
-   version increase to v4r11
-
-
-
-!========================== KaliCalo v4r10 2011-04-29 ==========================
-! 2011-04-15 - Daria Savrina
- - Added some lines to KaliPi0.py for running the tests on the SDSTs
- - Added a script to start the calibration with MassDistributionFit method:
-   /KaliCalo/MassDistribution/RunMassDistributionCalibration.py
-
-! 2011-04-15 - Vanya Belyaev
-
- - Pi0.cpp :
-   fix a memory leak problem: cloned fakePi0 is never deleted.
-   many thanks to Marco Cattaneo 
-
- - cmt/requirements 
-
-   version increase to v4r9p1.
-
-!========================== KaliCalo v4r9 2011-03-10 ==========================
-
-! 2011-02-24 - Daria Savrina
- - Added prefix "Phys/" for the InputLocations according to the DaVinci v28r0
-   needs
- - Fixed some typos in MassDistribution and Kali python modules
-
-! 2011-02-17 - Albert Puig
- - Changed references from GaudiPython.Parallel to GaudiMP.Parallel.
-
-! 2011-01-27 - Juan Palacios
- - KaliCalo.Configuration
-  . Remove PhysDesktop imports.
- - Increase to v4r8p1.
-
-!========================== KaliCalo v4r8 2011-01-19 ==========================
-
-! 2011-01-18 - Juan Palacios
- - Adapt to changes in DVAlgorithm.
- - Increase to v4r8.
- - REQUIRES Phys/DaVinciKernel v9r0 OR HIGHER!!!
-
-!========================== KaliCalo v4r7 2010-12-20 ==========================
-
-! 2010-12-15 - Albert Puig
-  - Bugfixed application of pi0 LoKi cut (it must be applied both on
-    signal and background)
-
-! 2010-12-02 - Daria Savrina
-  - Added /Event/Rec/Header to the fmDST item list for the correct work of time
-    decoder during the second pass. Replaced the test fmDSTs with the new ones
-    in KaliPi0.py script.
-
-! 2010-11-28 - Albert Puig
-  - Removed Kali.py to avoid name clashes.
-
-! 2010-11-22 - Albert Puig
-
-  - Completely reshuffled the python part to accomodate both CandidateMinimization
-    and MassDistribution calibration methods with common tools.
-
-!========================== KaliCalo v4r6 2010-11-06 ==========================
-
-! 2010-11-04 - Vanya Belyaev
-
- -  cmt/requirements 
-
-     version increment to v4r6 
-
-! 2010-11-04 - Vanya Belyaev
-
-   - fix the problem with ParticleCombier (use MomentumCombiner ) 
-   - rename "PtPi0" to "Pi0Cut"
-
-
-! 2010-11-04 Daria Savrina
-
-- Removed pi0 veto cut from the default configuration
-
-! 2010-11-03 - Albert Puig
-
-- Bugfix: Pi0PtCut must be got from the algorithm properties 
-
-! 2010-11-03 - Daria Savrina
-
-- Fixed a bug with passing of the event filter conditions to DaVinci
-
-! 2010-11-03 - Albert Puig
-
-- Added Cluster information in NTuple
-- Exposed switch for creation of NTuples for the Kali Configurable
-- Changed Pi0Pt Cut to LoKi expression
-
-!========================== KaliCalo v4r5 2010-10-05 ==========================
-
-! 2010-10-05 - Vanya Belyaev
-
- - move the defaul filter from Configurbale to firstPass function
- - fix Davinci sequences  
-
-! 2010-10-04 - Daria Savrina
-
- - added the default values for number of PV and SPD hits cuts to Configuration.py
-
-!========================== KaliCalo v4r4 2010-09-06 ==========================
-
-! 2010-08-09 - Vanya Belyaev
-
- - Pi0.cpp reshuffle a bit order of lines
-
-!========================== KaliCalo v4r3 2010-08-20 ==========================
-
-! 2010-08-08 - Vanya Belyaev
-
- - change the default upper edge for pi-hitsogram fits 
-
- - add the optional possibility to apply pi0-veto for the first pass 
-
- - add possibiilty to add even-filters for the first pass 
-
- - add the example  of the first pass: 
-
-     KaliPi0_1.py 
-
- - cmt/requirements 
-
-    version increment to v4r3 
- 
-
-!========================== KaliCalo v4r2p2 2010-05-24 ========================
-
-!========================== KaliCalo v4r2p1 2010-05-09 ========================
-
-! 2010-05-09 - Vanya Belyaev
-
- - python/KaiCalo/Coniguration.py
-
-    fix postConfigaction 
-
- - cmt/requirements 
-   
-    version increment to v4r2p1 
-
-!========================== KaliCalo v4r2 2010-05-02 ==========================
-
-! 2010-05-02 - Vanya Belyaev
-
- - one default fill only 3 hstograms
-
-  to work with 'mirror' bakcground one needs to create 
-     HistoMap as HistoMap ( background = True ) 
-
-  After bug fix with statistics, background is not needed anymore, 
-  and can be easily removed to speed up the program 
-
-! 2010-04-30 - Vanya Belyaev
-
- - TreeTask.
-     fix a major bug 
-
-! 2010-04-29 - Vanya Belyaev
-
- - use new 'recalngular-ring' fake cells 
-
-
-! 2010-04-28 - Vanya Belyaev
-
- - allow to use calibration data-base:
-
-         KaliDB = {
-	        'name' : 'name-of-data-base' ,
-		      'ecal' : 'the key for ecal coefficients in DB' ,
-		      'prs'  : 'the key for prs  coefficients in DB' 
-	       }
-
-		the 'ecal' & 'Coefficients'    are exclusive, 
-		the 'prs'  & 'PrsCoefficients' are exclusive
-	  
- - put the patch for the picking behaviour..
-
-! 2010-04-28 - Vanya Belyaev
-
- - src/Destroyer.cpp
-
-    temporary patch for backporting ranges...
-
-
-! 2010-04-26 - Vanya Belyaev
-
- - python/KaliCalo/KaliPi0.py 
-
-   . update the example to run on 2k+10 fmDSTs, produced  by Dasha 
-	
-
-! 2010-04-16 - Juan Palacios
-
- - src/Destroyer.cpp
-
-  . Access Particle::Range instead of Particle::Container.
-
- - cmt/requirements
-
-  . Increase to v4r2.
-
-! 2010-04-11 - Vanya Belyaev
-
- - few minor correctios to ZipShelve and Kali
-
-! 2010-04-09 - Vanya Belyaev
-
- - tiny correction in Pi0HistoFill.
-
-
-!========================== KaliCalo v4r1 2010-04-08 ==========================
-
-! 2010-04-06 - Vanya Belyaev
- - many minor fixes 
-
-
-! 2010-04-01 - Vanya Belyaev
-
- - many minor fixes for parallel processing 
-
-! 2010-03-28 - Vanya Belyaev
-
- - Pi0.cpp
-
-    apply cut oon spd-2x3 
-
-
-! 2010-03-26 - Vanya Belyaev
-
-  - make more efficient fit for the histograms 
-    fix few errors 
-
-
-! 2010-03-25 - Vanya Belyaev
- - there are serious problmems on Grid with LoadMAcro( "xxx.C++" ) 
-  thus: 
-   - remove root/*
-   - add dictionary
-
-! 2010-03-19 - Vanya Belyaev
-
- - more fixes & developments
-
-
-! 2010-03-18 - Vanya Belyaev
-
- - many minor fixes and developmemts for real data 
-
- - cmt/requirements 
-
-     version increment to v4r1 
-
-
-! 2010-03-16 - Vanya Belyaev
-
- - add the helper functions firstPass & secondPass
-
-   that returns already precionfigured instances of KaliPi0conf 
-
- - improve a little bit the fitting procedure 
-
-! 2010-03-12 - Albert Puig
-
- - Pi0.cpp
-     Corrected what was put in the ntuple as pi0 momentum. The sum of photon
-     momenta, as done previously, returned a bad pi0 momentum for background.
-     Changed to use p12 directly, which is correct in case of background.
-
-!========================== KaliCalo v4r0 2010-03-08 ==========================
-
-! 2010-02-25 - Vanya Belyaev
-
- - significant redesign of the framework
- - many changes into fitting 
- - new  (T)selector 
-
-    see new example for calibration with 2k+9 data:  Pi0_2.py
-
- - cmt/requirements
-
-    versio increment to v4r0 
-
-!========================== KaliCalo v3r3 2010-02-19 ==========================
-
-! 2010-02-19 - Vanya Belyaev
-
- - fix few bugs , 
-   add MakeDir algorithm 
-   remove KaliUtils 
-
-  
-! 2010-02-18 - Vanya Belyaev
-
- - Configurable.py
-   
-      Change the default data type & simulation flag.
-      From now the default values are:
-
-            Simulation : False 
-            DataType   : "2009:
-
-      Add possibility to re-recontruct charged particles, 
-      e.g. electrons using flag "RecoAll"
-
- - Pi0.cpp
-
-     polish a bit the monitoringh stuff.
-     change the type of spd1/spd2 varibales (from 'int' to 'double')
-
- - Destroyer.cpp
- 
-      Fix stupid bug...
-
- - cmt/requirements 
-
-     version increment to v3r3 
-
-
-!========================== KaliCalo v3r2 2010-02-02 ==========================
-
-! 2010-01-06 - Albert Puig
-
-- replaced "cosPhi" variable by distance between photons in cell units
-
-! 2009-12-15 - Albert Puig
-
-- changed energy units to MeV
-
-- changed PrintFreq to 10000 in KaliPi0.py
-
-- added property to make creating of monitoring histograms optional
-
-- added SPD information in Tuple
-
-- added 'grid' folder
-
-!========================== KaliCalo v3r1 2009-12-16 ==========================
-
-! 2009-12-12 - Dasha Savrina
-
-- changed the files for (pi0 -> gamma gamma) N-tuple processing
-
-! 2009-12-12 - Vanya Belyaev
-
- - Pi0.cpp
-
-     fix a stupid typo in the method name (prevent the proper initialization)
-
- - cmt/requirements 
-
-      version increment to v3r1 
-
-!========================== KaliCalo v3r0p2 2009-12-01 ========================
-
-! 2009-12-01 - Albert Puig
-
-- Added cosPhi between the two photons to the Pi0 ntuple.
-
-! 2009-11-30 - Vanya Belyaev
-
- - remove printout to stderr from KaliPi0 example (bug #59009)
-
-! 2009-11-30 - Juan PALACIOS
- - cmt/requirements
-  . Increase version to v3r0p2
-
-! 2009-11-27 - Albert Puig
-
-- modified Configuration.py to adapt tp PhysDesktop behavior related to PV
-
-!========================== KaliCalo v3r0p1 2009-11-19 ========================
-
-! 2009-11-18 - Vanya Belyaev
-
- - ElecPresel.cpp is disabled (hopefully temporarily) due to the 
-   compilation error for Win32 platform
-
-!========================== KaliCalo v3r0 2009-11-16 ==========================
-
-! 2009-11-01 - Vanya Belyaev
-
- - remove the specialized algorithsm Pi02
- - add property 'Mirror' to Kali::Pi0 algorithm      (Default is false ) 
- - add property 'Mirror' to KaliPi0Conf Configurable (Default is False )
-
-
-
-! 2009-10-31 - Vanya Belyaev
- 
-  - add single electrom selection code by Oleg 
-  - add pytho utilities and scripts 
-  - add algorithm to perform Albert's trick
-
- - cmt/requirements 
-   version increment to v3r0 
- 
-
-
-!========================== KaliCalo v2r2 2009-10-26 ==========================
-
-! 2009-10-25 - Vanya Belyaev
-
- - fix (???) the problem with configurables 
-
-! 2009-10-23 - Vanya Belyaev
-
- - remove the explicit imports from Configurables
-
-! 2009-10-15 - Patrick Koppenburg
- - HltType -> Hlt
-
-! 2009-10-02 - Vanya BELYAEV
-
- - MisCalibrate:
-
-     update for "new" LHCb  ( > v28r0 ) 
-
- - cmt/requirmeents 
-
-     version increment to v2r2 
-
-!========================== KaliCalo v2r1 2009-10-02 ==========================
-
-! 2009-10-02 - Vanya BELYAEV
-  
- - tag the verison, compatible with LHC_v28r0 
-  
-  but for the configurables "new" CaloReco is required 
-
-
-! 2009-10-01 - Vanya BELYAEV
-
- - root/calib.f , calibr.kumac  
-  
-       old "TSelector" and kumac for N-tupel processing 
-
-     to be converted to ROOT 
-
- - src/MisCailbrate 
-
-      make use of new parsing functions for CaloCellCode 
-    
-
-! 2009-09-28 - Vanya Belyaev
-
- - src/Pi0Calibr.cpp: 
-
-     rename the algorithm:  LoKi::Kali_Pi0 -> Kali::Pi0 
-
- - remove plain lines, use the regular Configurables, 
-	& improve the embedded documentation
- 
- - cmt/requirements
-
-   version increment to v2r1 
-
-!========================== KaliCalo v2r0 2009-09-18 ==========================
-
-! 2009-09-18 - Vanya BELYAEV
-
- -  many minor fixes 
-
-! 2009-07-31 - Vanya  BELYAEV
-
- - update the package for MC09
-
-   Two algorithms:
-
-     Pi0Calibr - fill n-tuple for pi0 calibration 
-                *AND* remove all "unused" digits for "(femto)KaliDst"
-
-     Kali::MisCalibrateCalo     
-               - simple algorithm to apply (mis)calibration coefficients
-                 to digits 
-
-    Configurtaion file:
-
-      python/KaliCalo/KailPi0.py 
-
-
-
- - cmt/requirements
-    version incremen to v2r0 
-
-!========================== KaliCalo v1r0 2005-06-13 ===================
-! 2005-05-31 - Vanya BELYAEV
- -  new package
-    now constains "iterative pi0" algorihtm and modified NeutralPPs... 
-    energy flow is expected *soon* 
-
-! -----------------------------------------------------------------------------
-! The END 
-! -----------------------------------------------------------------------------
diff --git a/Phys/KaliCalo/grid/FirstPass.py b/Phys/KaliCalo/grid/FirstPass.py
deleted file mode 100644
index c73fa2eaf..000000000
--- a/Phys/KaliCalo/grid/FirstPass.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env python
-# ============================================================================
-# @file FirstPass.py
-# @author Ricardo Vazquez Gomez (Ricardo.Vazquez.Gomez@cern.ch)
-# @author Albert Puig Navarro (Albert.Puig@cern.ch)
-# @date 2009-XII-12
-# ============================================================================
-"""Send a job to run over DSTs and generate fmDST. Must be run from Ganga, or
-otherwise JobTemplate won't work."""
-
-from optparse import OptionParser
-import os
-import sys
-
-# Hack
-sys.path.append('.')
-from JobTemplate import createJob
-
-if __name__=='__main__':
-  usage = "usage: ganga %prog [options] optionfile1 optionfile2 ..."
-  parser = OptionParser(usage=usage)
-  parser.add_option("-n", "--name", action="store", type="string", dest="name", default="fmDSTFirstPass", help="name of the job")
-  parser.add_option("-s", "--submit", action="store_true", dest="submit", default=False, help="submit job after creating it")
-  (options, args) = parser.parse_args()
-  
-  gridProxy.renew()
-  print "Creating job with name %s" %options.name
-  j = createJob(options.name)
-  paths = []
-  if not args:
-    paths = ['LFN:/lhcb/MC/MC09/DST/00005694/0000/00005694_00000012_1.dst']
-    j.inputdata = LHCbDataset(paths)
-  else:
-    # All arguments are considered as extra option files (e.g. datasets)
-    for arg in args:
-      paths.append(os.path.abspath(os.path.expandvars(arg)))
-    j.application.optsfile.extend(paths)
-  j.outputdata.files.append('KaliPi0.fmDST')
-  j.application.extraopts = "kali.PrintFreq=100000;"
-  if options.submit:
-    j.submit()
-    print "Your JobID is %s" %j.id
-
-# EOF
-
diff --git a/Phys/KaliCalo/grid/GetLFNs.py b/Phys/KaliCalo/grid/GetLFNs.py
deleted file mode 100644
index e4317f709..000000000
--- a/Phys/KaliCalo/grid/GetLFNs.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-# ============================================================================
-# @file GetLFNs.py
-# @author Albert Puig Navarro (Albert.Puig@cern.ch)
-# @date 2009-XII-16
-# ============================================================================
-"""Get OutputData LFN of a Ganga Job matching a certain regular expression and
-write them into a file"""
-
-import sys
-import os
-import re
-from optparse import OptionParser
-
-def getLFNs(job, regex):
-  """Generate a list of the LFNs of the ROOT Output Data of the given job
-  by selecting them using the given regular expression.
-
-  Example:
-  >> getTupleLFNs(job, 'fmDST')
-  ['LFN:/grid/KaliCalo.fmDST']
-  
-  @param job: job to get the output data from
-  @type job: GangaJob
-  @param regex: regular expression to use
-  @type regex: string
-  
-  @return: list of strings
-  
-  """
-  lfnList = []
-  myre = re.compile(regex)
-  subjobs = job.subjobs.select(status='completed')
-  for subjob in subjobs:
-      for output in subjob.backend.getOutputDataLFNs():
-          if myre.search(output.name):
-              lfnList.append('LFN:%s' %output.name)
-  return lfnList
-  
-if __name__=='__main__':  
-  # Warning: Can only be used using ganga!
-  usage = "usage: ganga %prog [options] output"
-  parser = OptionParser(usage=usage)
-  parser.add_option("-j", "--jobid", action="store", type="int", dest="jobid", default=-1, help="jobID to take the output data from")
-  parser.add_option("-r", "--regex", action="store", type="str", dest="regex", default=".*", help="regular expression to filter outputdata results")
-  (options, args) = parser.parse_args()
-
-  if options.jobid not in jobs.ids():
-    print "Unknown jobID %s" %options.jobid
-    sys.exit()
-  if len(args) != 1:
-    print "Wrong number of arguments"
-    print usage
-    sys.exit()
-  list = getLFNs(jobs(options.jobid), options.regex)
-  f = open(args[0], 'w')
-  for line in list:
-    f.write(line + '\n')
-  f.close()
-
-# EOF
-  
diff --git a/Phys/KaliCalo/grid/JobTemplate.py b/Phys/KaliCalo/grid/JobTemplate.py
deleted file mode 100644
index 7ab2ee201..000000000
--- a/Phys/KaliCalo/grid/JobTemplate.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/usr/bin/env python
-# ============================================================================
-# @file JobTemplat.py
-# @author Ricardo Vazquez Gomez (Ricardo.Vazquez.Gomez@cern.ch)
-# @author Albert Puig Navarro (Albert.Puig@cern.ch)
-# @date 2009-XII-12
-# ============================================================================
-"""Provide a base template for generating a Ganga Job for fmDST analysis."""
-
-import Ganga.GPI as GangaAPI
-
-Job = GangaAPI.Job
-DaVinci = GangaAPI.DaVinci
-Dirac = GangaAPI.Dirac
-DiracSplitter = GangaAPI.DiracSplitter 
-
-def createJob(name='KaliCalofmDST'):
-  """Create the job with default options.
-  
-  @param name: name of the job
-  @type name: string
-  
-  @return: Ganga Job
-  
-  """
-  j = Job(application=DaVinci(), backend=Dirac())
-  j.application.platform = 'slc4_ia32_gcc34'
-  j.application.optsfile = ['/afs/cern.ch/lhcb/software/releases/ANALYSIS/ANALYSIS_v3r13/Phys/KaliCalo/python/KaliCalo/KaliPi0.py']
-  j.application.masterpackage = 'Phys/KaliCalo'
-  j.application.version = 'v24r7'
-  j.name = name
-  j.outputdata = ['KaliPi0_Tuples.root']
-  j.splitter = DiracSplitter()
-  return j
-  
-# EOF
-
diff --git a/Phys/KaliCalo/grid/Kali.py b/Phys/KaliCalo/grid/Kali.py
deleted file mode 100644
index fe10dd3f3..000000000
--- a/Phys/KaliCalo/grid/Kali.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# =============================================================================
-
-import os
-
-print 'Hello!!!'
-
-if '__main__' == __name__ :
-
-    import ROOT 
-    from KaliCalo.Utils import POOLCatalogParser
-    import os
-    os.system ( ' ls -al ' )
-    parser = POOLCatalogParser()
-
-    lfns = parser.lfns()
-
-    pfns = parser.pfns()
-
-    print 'LFNs: ' , lfns
-    print 'PFNS: ' , pfns
-
-    ## try to do something useful: 
-
-    import KaliCalo.Kali as Kali 
-    
-    from   KaliCalo.Pi0FillHistos    import fillDataBase
-    from   GaudiKernel.SystemOfUnits import GeV
-    
-    lambdas = Kali.LambdaMap()
-    
-    histos, lambdas , badfiles = fillDataBase (
-        lambdas                   ,
-        pfns                      , 
-        dbase_name = 'kali_db.gz' , 
-        Unit = GeV 
-        )
-
-    os.system ( " ls -al " )
-    
-
-# =============================================================================
-# The END 
-# =============================================================================
-
-
-
diff --git a/Phys/KaliCalo/grid/KaliDBMerger.py b/Phys/KaliCalo/grid/KaliDBMerger.py
deleted file mode 100644
index 1df869c96..000000000
--- a/Phys/KaliCalo/grid/KaliDBMerger.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env  python
-# =============================================================================
-## @file grig/KaliDBMerger.py
-#  Helper merger script for to merge Kali-databases
-#  @author Vanya BELYAEV  Ivan.Belyaev@itep.ru
-#  @date 2010-03-25
-# =============================================================================
-"""
-Helper merger script for to merge Kali-databases
-"""
-#  Helper merger script for to merge Kali-databases
-# =============================================================================
-__author__  = " Vanya BELYAEV  Ivan.Belyaev@itep.ru "
-__date__    = " 2010-03-25 "
-__version__ = " CVS tag $Name: not supported by cvs2svn $, version $Revision$ "
-# =============================================================================
-__all__     = (
-    'mergefiles',
-    )
-# =============================================================================
-
-
-## the only one interesting function
-def mergefiles ( filelist , outputfile ) :
-    """
-    The only one interesting function: merge Kali-databases
-    """
-    
-    try :
-        
-        import KaliCalo.Kali as Kali
-        histos = Kali.HistoMap()
-        histos.read ( filelist   )
-        histos.save ( outputfile ) 
-        
-    except :
-        return -1 
-    
-    return 0 
-
-
-# =============================================================================
-if '__main__' == __main__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print ' all(%s) : '    %   __all__
-    
-    print '*'*120  
-
-
-
-# =============================================================================
-# The END 
-# =============================================================================
-
-
diff --git a/Phys/KaliCalo/grid/KaliFit.py b/Phys/KaliCalo/grid/KaliFit.py
deleted file mode 100644
index 2331fbbf9..000000000
--- a/Phys/KaliCalo/grid/KaliFit.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-
-import KaliCalo.Kali as Kali
-
-histos  = Kali.HistoMap  ()
-lambdas = Kali.LambdaMap ()
-
-mydir ='/afs/cern.ch/user/i/ibelyaev/cmtuser/DaVinci_v25r2p1/Phys/KaliCalo/cmt/'
-
-histos.read(mydir + 'histos_db.gz')
-
-from KaliCalo.Analyse import analyse
-
-analyse ( histos , lambdas )
-
-lambdas.save ( 'lambdas_db.gz')
-
diff --git a/Phys/KaliCalo/grid/KaliPi0_200M_SP.py b/Phys/KaliCalo/grid/KaliPi0_200M_SP.py
deleted file mode 100644
index 5f700c7f0..000000000
--- a/Phys/KaliCalo/grid/KaliPi0_200M_SP.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# $Id$ 
-# =============================================================================
-## @file  KaliCalo/KaliPi0_200M_SP.py
-#  The basic configuration to (re)run Ecal pi0-calibration:
-#    - reprocess miscalibrated 200M of fmDST, produced by Albert Puig 
-#  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
-#  @date   2010-03-28
-# =============================================================================
-"""
-The basic configuration to (re)run Ecal pi0-calibration:
-- reporcess miscalibrated 200M of fmDST, produced by Albert Puig 
-
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@nikhef.nl "
-__date__    = " 2010-03-28 "
-__version__ = " CVS Tag $Name: not supported by cvs2svn $, version $Revision$"
-# =============================================================================
-## the basic import
-from   Gaudi.Configuration       import *
-from   GaudiKernel.SystemOfUnits import MeV 
-from   KaliCalo.Configuration    import secondPass
-
-
-kali = secondPass (
-    ## IO 
-    NTuple           = "KaliPi0_SP.root"  , 
-    FemtoDST         = "KaliPi0_SP.fmDST" ,
-    ## general 
-    DataType         = 'MC09',
-    Simulation       =  True ,
-    PrintFreq        = 10000 ,
-    EvtMax           =    -1 
-    )
-
-# =============================================================================
-## the actual job steering 
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print '*'*120  
-
-    from GaudiPython.Bindings import AppMgr    
-    gaudi = AppMgr()
-    
-    evtSel = gaudi.evtSel()
-    evtSel.open('castor:/castor/cern.ch/grid/lhcb/user/a/apuignav/7318/7318685/KaliPi0.fmDST')
-    
-    gaudi.run( 100000 )
-
-    import KaliCalo.Pi0HistoFit as Fit
-    
-    import GaudiPython.GaudiAlgs 
-    pi0    = gaudi.algorithm('KaliPi0')
-    histos = pi0.Histos()
-    if histos :
-        keys = histos.keys()
-        keys.sort () 
-        for h in keys :
-            histo = histos[h]
-            if hasattr ( histo , 'dump' ) :
-                print histo.dump(40,20,True) 
-                st = Fit.fitPi0 ( histo ) 
-                print 'Fit: ', st, Fit.getPi0Params ( histo )
-                
-    gaudi.exit()
-    
-    
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/grid/SecondPass.py b/Phys/KaliCalo/grid/SecondPass.py
deleted file mode 100644
index 913421e0a..000000000
--- a/Phys/KaliCalo/grid/SecondPass.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-# ============================================================================
-# @file FirstPass.py
-# @author Ricardo Vazquez Gomez (Ricardo.Vazquez.Gomez@cern.ch)
-# @author Albert Puig Navarro (Albert.Puig@cern.ch)
-# @date 2009-XII-12
-# ============================================================================
-"""Send a job to run over fmDST."""
-
-import sys
-import os
-from optparse import OptionParser
-
-# Hack
-sys.path.append('.')
-from JobTemplate import createJob
-from GetLFNs import getLFNs
-
-def getFmDSTLFNs(job):
-  """Generate a list of the LFNs of the fmDST Output Data of the given job.
-  
-  @param jobID: jobID to get the fmDSTs from
-  @type jobID: int
-  
-  @return: list of strings
-  
-  """
-  fmDSTList = []
-  subjobs = job.subjobs.select(status='completed')
-  for subjob in subjobs:
-      for output in subjob.backend.getOutputDataLFNs():
-          if os.path.splitext(output.name)[1] == '.fmDST':
-              fmDSTList.append('LFN:%s' %output.name)
-  return fmDSTList
-  
-if __name__=='__main__':
-  usage = "usage: ganga %prog [options]"
-  parser = OptionParser(usage=usage)
-  parser.add_option("-n", "--name", action="store", type="string", dest="name", default="fmDSTSecondPass", help="name of the job")
-  parser.add_option("-j", "--jobid", action="store", type="int", dest="jobid", default=-1, help="jobID to take the input data from")
-  parser.add_option("-f", "--fmDST", action="store_true", dest="fmDST", default=False, help="keep the fmDST in the outputdata")
-  parser.add_option("-c", "--coefficients", action="store", type="string", dest="coef", default=None, help="filename to import coefficients from")
-  parser.add_option("-s", "--submit", action="store_true", dest="submit", default=False, help="submit job after creating it")
-  (options, args) = parser.parse_args()
-  
-  print "Creating job with name %s" %options.name
-  gridProxy.renew()
-  jobID = options.jobid
-  if not jobID in jobs.ids():
-    print "Job %s is unknown" %jobID
-    sys.exit()
-
-  j = createJob(options.name)
-  oldjob = jobs(jobID)
-  outputData = getLFNs(oldjob, "fmDST")
-  j.inputdata = LHCbDataset(outputData)
-  j.application.extraopts = "kali.PrintFreq=100000;kali.FirstPass=False;"
-  if options.coef:
-    f = open(options.coef)
-    coef = {}
-    for line in f.readlines():
-      cell, value = line.split()
-      coef[int(cell)] = float(value)
-    f.close()
-    j.application.extraopts += "kali.Coefficients=%s" %coef
-  if options.fmDST:
-    j.outputdata.files.append('KaliPi0.fmDST')
-  if options.submit:
-    j.submit()
-
-# EOF
-
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Calibrate.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Calibrate.py
deleted file mode 100644
index 3e1c2db83..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Calibrate.py
+++ /dev/null
@@ -1,256 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file Calibrate.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @date 2011-08-16
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-
-# General python imports
-import os
-import sys
-import glob
-import string
-import random
-from optparse import OptionParser
-kaliDir = os.path.expandvars("$KALICALOROOT")
-# ROOT
-from ROOT import *
-try:
-  sc = gROOT.LoadMacro(os.path.join(kaliDir, "root", "EcalMinimizer.cxx+"))
-  from ROOT import EcalMinimizer
-except:
-  print "Error importing EcalMinimizer!"
-  sys.exit(1)
-try:
-  sc = gROOT.LoadMacro(os.path.join(kaliDir, "root", "CellCutter.cxx+"))
-  from ROOT import CellCutter
-except:
-  print "Error importing CellCutter!"
-  sys.exit(1)         
-
-# Kali
-import KaliCalo.CandidateMinimization.Commands as Commands
-import KaliCalo.Kali.LambdaMap as LambdaMap
-import KaliCalo.FakeCells      as FakeCells
-import KaliCalo.Cells          as Cells
-from KaliCalo.Det              import getCalo
-
-def randomFilename(chars=string.hexdigits, length=16, prefix='', suffix=''):
-  while True:
-    filename = ''.join([random.choice(chars) for i in range(length)])
-    filename = prefix + filename + suffix
-    if not os.path.exists(filename):
-      return filename
-
-def getEcalCells():
-  ecal = getCalo()
-  cp = ecal.cellParams()
-  cells = []
-  for p in cp :
-    cell = p.cellID()
-    if ecal.valid ( cell ) and not cell.isPin() :
-      cells.append ( cell )
-  cells.sort()
-  return cells
-
-def decodeCellID( cellinfo ):
-  """
-  Decodes the CellID.index() information:
-    * 6 bits: col.
-    * 6 bits: row.
-    * 2 bits: area.
-    * 2 bits: calo.
-  """
-  def intToBinary( num , digits = None ):
-    out = ''
-    while num > 0:
-      j = num & 1
-      out = str(j) + out
-      num >>= 1
-    if digits and len(out) > digits:
-      print "Warning: Output is longer than 'digits'."
-      return out
-    if digits:
-      while True:
-        if len(out) < digits:
-          out = '0%s' %out
-        else:
-          break
-    return out
-
-  if not isinstance(cellinfo, int):
-    cellinfo = int(cellinfo)
-  bin = intToBinary( cellinfo , 16 )
-  #calo = int( bin[0:2] , 2 )
-  calo = 2
-  area = int( bin[2:4] , 2 )
-  row  = int( bin[4:10] , 2 )
-  col  = int( bin[10:16] , 2 )
-  return Cells.CellID( calo , area , row , col )
-
-def decodeCellIDs( cellList ):
-  output = []
-  ecal = getCalo()
-  for cell in cellList:
-    cellID = decodeCellID(cell)
-    if ecal.valid(cellID) and not cellID.isPin():
-      output.append(cellID)
-    else:
-      print "Non-valid cell -> %s" % cellID
-  return output
-
-castorDir = '/castor/cern.ch/grid/'
-
-CellID = FakeCells.CellID
-betas = [8.3, 8.8, 9.5]
-sigmas = [15.0, 15.0, 15.0]
-ecalCells = getEcalCells()
-
-if __name__ == '__main__':
-  parser = OptionParser()
-  parser.add_option("-l", "--lambdaFile",
-                    dest="lambdaFile", action="store", type="string", default="",
-                    help="FILE where input constants are stored", metavar="FILE")
-  # parser.add_option("-c", "--cellIDs",
-  #                   dest="cellIDs", action="store", type="string", default="",
-  #                   help="comma-separated list of CELLIDs to calibrate", metavar="CELLIDs")
-  parser.add_option("-c", "--cut",
-                    dest="cut", action="store", type="string", default="",
-                    help="activate cutting of cells from ntuples in FILE", metavar="FILE")
-  parser.add_option("-t", "--cellType",
-                    dest="cellType", action="store", type="string", default="SameCell",
-                    help="use CELLTYPE cell grouping", metavar="CELLTYPE")
-  parser.add_option("-o", "--outputDir",
-                    dest="outputDir", action="store", type="string", default="",
-                    help="DIR where to store output constants", metavar="DIR")
-  (options, args) = parser.parse_args()
-  if not args:
-    options, args = parser.parse_args(sys.stdin.readline().split())
-  # Check the lambdas dir and join lambdas (if any)
-  lambdas = LambdaMap.LambdaMap()
-  lambdaFile = options.lambdaFile
-  if os.path.exists(lambdaFile) and os.path.isfile(lambdaFile):
-    print "Found DB -> %s" % lambdaFile
-    lambdas.read(lambdaFile)
-  # Load the cell massager
-  CellMassager = getattr(FakeCells, options.cellType, None)
-  if not CellMassager:
-    print "Wrong Cell Massager!"
-    sys.exit(1)
-  CellMassager = CellMassager()
-  # Get a list of cells to add
-  if 0 == len(args):
-    print "No cell ID specified!"
-    sys.exit(1)
-  cellsToCalibrate = []
-  for inputNtuple in args: # CellIDs are comma separated
-    cellIndex = os.path.splitext(os.path.basename(inputNtuple))[0]
-    cellID = decodeCellID(cellIndex)
-    if not cellID == CellMassager(cellID):
-      print "Input cellID is not a massaged cell!! -> %s vs %s" % (cellID, CellMassager(cellID))
-      sys.exit(1)
-    cellsToCalibrate.append(cellID)
-  print "Cells to calibrate: %s" % ' '.join(map(str, cellsToCalibrate))
-  cellMap = {}
-  cellRel = {}
-  for cellID in ecalCells:
-    mCellID = CellMassager(cellID)
-    mOppCell = CellMassager(Cells.oppositeCell(cellID))
-    if not mCellID in cellMap:
-      cellMap[mCellID] = []
-    cellMap[mCellID].append(cellID)
-    if not mCellID in cellRel:
-      cellRel[mCellID] = []
-    cellRel[mCellID].append(mOppCell)
-  # We need to check all input ntuples
-  inputFiles = {'found': [], 'missing': []}
-  for arg in args:
-    if 0 == len(Commands.nsls(arg)):
-      inputFiles['missing'].append(arg)
-    else:
-      inputFiles['found'].append(arg)
-  if 0 != len(inputFiles['missing']): # There are missing input files
-    if os.path.exists(options.cut):
-      execfile(options.cut)
-      ntuples = ['castor://' + castorDir + t for t in tup]
-      cutter = CellCutter("", 100)
-      for ntuple in ntuples:
-        cutter.addFile(ntuple)    
-      for arg in inputFiles['missing']:
-        cellIndex = os.path.splitext(os.path.basename(arg))[0]
-        cellID = decodeCellID(cellIndex)
-        fName = 'castor://' + arg
-        print fName
-        for cID in ([cellID] + cellRel[cellID]):
-          for cell in cellMap[cID]:
-            cutter.addCell(cell.index(), fName)
-      print "Cutting"
-      cutter.cut(20.0)
-    else:
-      print "Missing files but no input ntuples specified!"
-      sys.exit(1)
-  # Get ntuples
-  inputFiles = inputFiles['missing'] + inputFiles['found']
-  if 0 == len(inputFiles):
-    print "No valid ntuples found"
-    sys.exit(1)
-  # Calibration
-  newLambdas = LambdaMap.LambdaMap()
-  for inputFile in inputFiles:
-    cellIndex = os.path.splitext(os.path.basename(inputFile))[0]
-    cellID = decodeCellID(cellIndex)    
-    fileList = std.vector('TString')()
-    fileList.push_back(inputFile)
-    # Configure Minuit
-    minuit = EcalMinimizer()
-    for area, beta in enumerate(betas):
-      minuit.setBeta(area, beta)
-    for area, sigma in enumerate(sigmas):
-      minuit.setSigma(area, sigma)
-    #minuit.setDebug()
-    minuit.loadFiles(fileList)    
-    myCells = [cellID] + [cell for cell in cellRel[cellID]]
-    minuit.configure(len(myCells)+1) # Own cell + opposite cells + fixed cells
-    # Add cells to calibrate
-    print "Adding cells to calibrate"
-    for cellVar in myCells:
-      varName = str(cellVar.index())
-      for cell in cellMap[cellVar]:
-        minuit.addCell(cell.all(), varName, lambdas[cell][-1])
-      minuit.setLimitedVar(varName, lambdas[cell][-1], lambdas[cell][-1]*0.95, lambdas[cell][-1]*1.05)
-    print "Adding fixed cells"
-    for cell in lambdas:
-      if not minuit.hasCell(cell.all()):
-        minuit.addCell(cell.all(), "fixed", lambdas[cell][-1])
-    sc = minuit.minimize()
-    # TODO: error handling
-    for cellVar in myCells:
-      varName = str(cellVar.index())
-      calib = minuit.getVarCalib(varName)
-      for cell in cellMap[cellVar]:
-        l = newLambdas[cell]
-        l[-1] = calib
-  print "We have %s new calibrated cells" % len(newLambdas.lambdas())
-  outputDir = os.path.abspath(options.outputDir)
-  if not os.path.exists(outputDir):
-    os.makedirs(outputDir)
-  fileName = randomFilename(length=8, suffix='lambda.gz')
-  #fileName = "%s.gz" % '-'.join([str(c.all()) for c in cellsToCalibrate.keys()])
-  fileName = os.path.join(outputDir, fileName)
-  print "Output lambdas -> %s" % fileName
-  print newLambdas.lambdas()
-  newLambdas.save(fileName)
-  lambdasFile = os.path.join(outputDir,"lambdas.input")
-  if not os.path.exists(lambdasFile):
-    with open(lambdasFile, 'w') as f:
-      f.write("")
-  with open(lambdasFile, 'a') as f:
-    f.write(" %s " % fileName)
-  print "Done!"
-  sys.exit(0)
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/CombineLambdaMaps.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/CombineLambdaMaps.py
deleted file mode 100644
index c63ed37a1..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/CombineLambdaMaps.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file CombineLambdaMaps.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @date 2011-08-19
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-
-from optparse import OptionParser
-import os
-import sys
-import glob
-
-from KaliCalo.Kali.LambdaMap import LambdaMap
-
-def combineLambdaMaps(*lMaps):
-  newLambdaMap = LambdaMap()
-  for lMap in lMaps:
-    for key in lMap:
-      if not newLambdaMap.has_key(key):
-        newLambdaMap._lambdas[key] = []
-      newLambdaMap._lambdas[key].extend(lMap[key])
-  return newLambdaMap
-
-if __name__ == '__main__':
-  parser = OptionParser()
-  parser.add_option("-o", "--outputFile",
-                    dest="outputFile", action="store", type="string", default=None,
-                    help="join specified constants in FILE", metavar="FILE")
-  (options, args) = parser.parse_args()
-  if not args:
-    (options, args) = parser.parse_args(sys.stdin.readline().split())
-  lambdaMaps = []
-  for arg in args:
-    for f in glob.glob(arg):
-      l = LambdaMap()
-      l.read(f)
-      lambdaMaps.append(l)
-  print "Found %s maps to combine" % len(lambdaMaps)
-  newL = combineLambdaMaps(*lambdaMaps)
-  if options.outputFile:
-    newL.save(options.outputFile)
-  sys.exit(0)
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Commands.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Commands.py
deleted file mode 100644
index 083d5b7cc..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Commands.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file Commands.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @date 2011-08-24
-# =============================================================================
-"""Shortcuts for frequently used commands."""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-
-import subprocess
-import os
-
-def runCommand(cmd, *args):
-  """Run given command with args on the command line.
-
-  @param cmd: command to execute
-  @type  cmd: string
-  @param args: arguments of the command
-  @type  args: list
-
-  @return: list of lines of the output
-
-  """
-  return [line for line in subprocess.Popen([cmd]+list(args), stdout=subprocess.PIPE).communicate()[0].split('\n') if line]
-
-def bsub(*args):
-  args = ['-q8nh'] + list(args)
-  out = runCommand('bsub', *args)
-  if len(out) > 1:
-    print out
-    return 0
-  out = out[0]
-  return int(out.split()[1].strip('<').strip('>'))
-    
-def nsls(dirName):
-  dirName = os.path.join(os.path.expandvars('$CASTOR_HOME'), dirName)
-  return runCommand('nsls', dirName)
-    
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FillSelector.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FillSelector.py
deleted file mode 100644
index 1de6547ec..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FillSelector.py
+++ /dev/null
@@ -1,156 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FillSelector.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @based on Vanya Belyaev's Pi0FillHistos.py
-# @date 2010-11-03
-# =============================================================================
-"""Implementation of FillPi0 for Candidate Minimization method for Pi0 calibration.
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-from math import sqrt
-
-import KaliCalo.Kali.FillSelectorBase     as FillBase
-from KaliCalo.Cells                       import CellID
-from KaliCalo.CandidateMinimization       import HistoMap
-
-class FillPi0( FillBase.FillPi0Base ):
-    ## the major method: processing of the tree
-    def Process( self, entry ):
-        """
-        Fills the histograms from a tree
-        """
-        # == getting the next entry from the tree
-        if self.GetEntry ( entry ) <= 0 :
-            return 0
-
-        # == for more convenience
-        bamboo=self.fChain
-
-        if not self._frequency :
-            entries  = bamboo.GetEntries()
-            entries  = int ( entries /  50.0 / 10000.0 ) * 10000
-            entries  = max ( entries , 100000 ) 
-            self._frequency = entries
-
-        # == printout
-        if 0 == entry % self._frequency :
-            self._print ( 'Process %d' % entry )
-
-        ## 3x3 spd ?? 
-        if bamboo.spd1 or bamboo.spd2 :
-            return 1
-
-        # == cell (category) number
-
-        ecalCell1 = CellID ( bamboo.ind1 ) 
-        ecalCell2 = CellID ( bamboo.ind2 )
-        ecalCell1.setCalo ( 2 )
-        ecalCell2.setCalo ( 2 )
-        
-        prsCell1 = CellID ( bamboo.ind1 )
-        prsCell2 = CellID ( bamboo.ind2 )
-        prsCell1.setCalo ( 1 )
-        prsCell2.setCalo ( 2 )
-        
-        area1 = ecalCell1.area()
-        area2 = ecalCell2.area()
-
-        background = bool(bamboo.bkg)
-
-        # "massage" cell-ID, e.g. group them
-        ecalCell1 = CellID ( self._cellFunc ( ecalCell1 ) )
-        ecalCell2 = CellID ( self._cellFunc ( ecalCell2 ) )
-        prsCell1  = CellID ( self._cellFunc ( prsCell1 ) )
-        prsCell2  = CellID ( self._cellFunc ( prsCell2 ) )
-
-        ## get the correction coefficients:
-        coefEcal1 = self._lambdas [ ecalCell1 ] [ -1 ] ## the last one is relevant here
-        coefEcal2 = self._lambdas [ ecalCell2 ] [ -1 ] ## the last one is relevant here 
-        coefPrs1  = self._lambdas [ prsCell1 ] [ -1 ] ## the last one is relevant here
-        coefPrs2  = self._lambdas [ prsCell2 ] [ -1 ] ## the last one is relevant here 
-
-        if not 0 < bamboo.m12 * self._Unit < 350 :
-            return 1                ## RETURN
-        if not bamboo.dist > 3                   :
-            return 1
-
-        ## get the histograms
-        histo1 = self._histos  [ ecalCell1 ].histos()        
-        histo2 = self._histos  [ ecalCell2 ].histos()  
-        ## get the counters
-        counter1 = self._histos  [ ecalCell1 ].counters() 
-        counter2 = self._histos  [ ecalCell2 ].counters() 
-        ## get 'per-area' histos
-        zone1 = CellID ( ecalCell1.calo() , area1 , self._gRow , self._gCol )
-        zone2 = CellID ( ecalCell2.calo() , area2 , self._gRow , self._gCol )
-        histoZone1    = self._histos  [ zone1 ].histos   () ## global 'per-zone' histos
-        histoZone2    = self._histos  [ zone2 ].histos   () ## global 'per-zone' histos
-        ## get per-area counters
-        counterZone1  = self._histos  [ zone1 ].counters () ## global 'per-zone' counters
-        counterZone2  = self._histos  [ zone2 ].counters () ## global 'per-zone' counter
-        ## globals
-        histoGlobal   = self._global.histos   ()          ## global histos 
-        counterGlobal = self._global.counters ()          ## global counters
-
-        ## Determine if we need to feel the prs<10 histogram
-        prsLT10 = ( max ( bamboo.prs1 , bamboo.prs2 ) * self._Unit < 10 )
-
-        # Calculate corrected mass
-        mass      = bamboo.m12 * self._Unit
-        corrMass  = mass
-        factor1   = bamboo.prs1 * self._betas[area1] * ( coefPrs1 - coefEcal1) + coefEcal1 * bamboo.g1E
-        factor2   = bamboo.prs2 * self._betas[area2] * ( coefPrs2 - coefEcal2) + coefEcal2 * bamboo.g2E
-        corrMass *= sqrt( ( factor1 * factor2 ) / ( bamboo.g1E * bamboo.g2E ) )        
-        
-        # Fill counters
-        pionNumber = (1-2*background)
-        counter1[0] += pionNumber
-        counter2[0] += pionNumber
-        counterZone1[0] += pionNumber
-        counterZone2[0] += pionNumber
-        counterGlobal[0] += pionNumber
-        if prsLT10:
-          counter1[1] += pionNumber
-          counter2[1] += pionNumber
-          counterZone1[1] += pionNumber
-          counterZone2[1] += pionNumber
-          counterGlobal[1] += pionNumber
-          
-        if corrMass > 250 :
-            return 1 
-        # Fill signal histo
-        hID = int( background ) * 2
-        histo1[ hID ].Fill ( corrMass )
-        histo2[ hID ].Fill ( corrMass )
-        histoZone1[ hID ].Fill ( corrMass )
-        histoZone2[ hID ].Fill ( corrMass )
-        histoGlobal[ hID ].Fill ( corrMass )
-        # Fill subtracted
-        histo1[ 4 ].Fill ( corrMass , pionNumber )
-        histo2[ 4 ].Fill ( corrMass , pionNumber )
-        histoZone1[ 4 ].Fill ( corrMass , pionNumber )
-        histoZone2[ 4 ].Fill ( corrMass , pionNumber )
-        histoGlobal[ 4 ].Fill ( corrMass , pionNumber )
-        # Fill prs<10 if necessary
-        if prsLT10:
-            histo1[ hID+1 ].Fill ( corrMass )
-            histo2[ hID+1 ].Fill ( corrMass )
-            histoZone1[ hID+1 ].Fill ( corrMass )
-            histoZone2[ hID+1 ].Fill ( corrMass )
-            histoGlobal[ hID+1 ].Fill ( corrMass )
-            histo1[ 5 ].Fill ( corrMass , pionNumber )
-            histo2[ 5 ].Fill ( corrMass , pionNumber )
-            histoZone1[ 5 ].Fill ( corrMass , pionNumber )
-            histoZone2[ 5 ].Fill ( corrMass , pionNumber )
-            histoGlobal[ 5 ].Fill ( corrMass , pionNumber )
-            
-        return 1
-    
-fillDataBase = FillBase.FillDatabase( FillPi0 , HistoMap )
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FillTask.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FillTask.py
deleted file mode 100644
index 50196c8b0..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FillTask.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FillTask.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @reshuffled from Vanya Belyaev's TreeTask.py
-# @date 2010-11-13
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-__all__ = [ 'FillTask' , 'fillDatabase' ]
-
-import KaliCalo.Kali.FillTaskBase                  as _FillTaskBase
-import KaliCalo.CandidateMinimization.FillSelector as _FillSelector
-
-#FillTask = FillTaskBase.FillTask
-
-fillDatabase = _FillTaskBase.FillHistos( _FillSelector.fillDataBase )
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FitFunctions.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FitFunctions.py
deleted file mode 100644
index d49b837d7..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FitFunctions.py
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FitFunctions.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @date 2010-11-13
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-import KaliCalo.FitUtils as Fit
-from KaliCalo.Kali       import pi0Mass
-
-pi0Func           = Fit.pi0Func
-pi0SubtractedFunc = Fit.pi0SubtractedFunc
-
-# Load pre-fit functionality
-_preFitBkg    = Fit._preFitBkg
-_preFitSignal = Fit._preFitSignal
-
-# =============================================================================
-## pre-fit historgam set 
-def preFitHistoSet ( histoset ) :
-    """
-    Pre-fit historgam set 
-    
-    """
-    _func = pi0Func
-    _func.SetParameter ( 0 , 100 )
-    _func.SetParameter ( 1 , pi0Mass )
-    _func.SetParameter ( 2 ,  10 )
-    _func.SetParameter ( 3 ,  10 )
-    _func.SetParameter ( 4 ,   0 )
-    _func.SetParameter ( 5 ,   0 )
-    
-    nFits = 0
-
-    # prefit background histograms
-    hAllBkg     = histoset [2]
-    hPrsLT10Bkg = histoset [3]
-    
-    st , nFit1 = _preFitBkg ( _func , hAllBkg )
-    st , nFit2 = _preFitBkg ( _func , hPrsLT10Bkg )
-    nFits += nFit1 
-    nFits += nFit2 
-
-    # now prefit signal
-    hAll     = histoset[2]
-    hPrsLT10 = histoset[1]
-
-    st1 , nFit1 = _preFitSignal ( _func , hAll , background = hAllBkg )
-    st2 , nFit2 = _preFitSignal ( _func , hPrsLT10 , background = hPrsLT10Bkg , signal = hAll )
-
-    nFits += nFit1 
-    nFits += nFit2 
-
-    return st1 , st2 , nFits
-
-#  Load fit functionality
-fitBkg     = Fit.fitBkg
-fitSignal  = Fit.fitSignal
-checkHisto = Fit.checkHisto
-
-# =============================================================================
-## fit the set of histograms
-def fitHistoSet ( histoset , set0 , force = False ) :
-    """
-    Fit historgram set.
-    
-    set0 = helper set to give starting values
-    """
-    histoset.result = None 
-    _func    = pi0Func
-    _funcSub = pi0SubtractedFunc
-    ## initialize number of hits
-    nFits = 0 
-    ## initialize histos
-    hAll        = histoset [0]
-    hAllBkg     = histoset [2]
-    hAllSub     = histoset [4]
-    hPrsLT10    = histoset [1]
-    hPrsLT10Bkg = histoset [3]
-    hPrsLT10Sub = histoset [5]
-    # initialize reference histos
-    refAll        = set0 [0]
-    refAllBkg     = set0 [2]
-    refAllSub     = set0 [4]
-    refPrsLT10    = set0 [1]
-    refPrsLT10Bkg = set0 [3]
-    refPrsLT10Sub = set0 [5]
-
-    ## start with background
-    if hAllBkg :
-        st , nFit1 = fitBkg ( _func , hAllBkg , background = refAllBkg )
-        nFits += nFit1
-    if hPrsLT10Bkg :
-        st , nFit2 = fitBkg ( _func , hPrsLT10Bkg , background = refPrsLT10Bkg )
-        nFits += nFit2
-
-    ## now the signal: all
-    sc0 = 0 # Status of the fit
-    ## use "own" background + reference signal
-    res0, nFit = fitSignal     ( _func , hAll , background = hAllBkg , signal = hAll )
-    nFits += nFit 
-    if ( not res0 or not checkHisto ( hAll ) ) and refAllBkg : 
-        sc0  = 1
-        ## use "reference signal & background
-        res0, nFit = fitSignal ( _func , hAll , background = refAllBkg , signal = refAll )    
-        nFits += nFit 
-    if not res0 or not checkHisto ( hAll ) :
-        sc0  = -1
-
-    ## prs < 10
-    sc1 = 0
-    ## use "own" background & signal prefits
-    res1 , nFit = fitSignal ( _func , hPrsLT10 , background = hPrsLT10Bkg , signal = hPrsLT10 )
-    nFits += nFit 
-    if not res1 or not checkHisto ( hPrsLT10 ) :
-        sc1  = 1 
-        ## use "own" background & reference signal 
-        res1 , nFit = fitSignal ( _func , hPrsLT10 , background = hPrsLT10Bkg , signal = refPrsLT10 )
-        nFits += nFit 
-    if ( not res1 or not checkHisto ( hPrsLT10 ) ) and refPrsLT10Bkg :
-        sc1  = 2 
-        ## use "reference" background & signal 
-        res1 , nFit = fitSignal ( _func , hPrsLT10 , background = refPrsLT10Bkg , signal = refPrsLT10 )
-        nFits += nFit 
-    if not res1 or not checkHisto ( hPrsLT10 ) :
-        sc1  = 3 
-        ## use "own" background & reference signal Prs+Prs 
-        res1, nFit = fitSignal ( _func , hPrsLT10 , background = hPrsLT10Bkg , signal = refAll )
-        nFits += nFit 
-    if ( not res1 or not checkHisto ( hPrsLT10 ) ) and r4 :
-        sc1  = 4 
-        ## use reference background & signal Prs+Prs 
-        res1 , nFit = fitSignal ( _func , hPrsLT10 , background = refPrsLT10Bkg , signal = refAll )
-        nFits += nFit 
-    if not res1 or not checkHisto ( hPrsLT10 ) :
-        sc1 = -1 
-            
-    # Subtracted all
-    sc2 = 0
-    res2 , nFit = fitSignal ( _funcSub , hAllSub , background = None, signal = hAllSub )
-    nFits += nFit
-    if not res2 or not checkHisto ( hAllSub ):
-        sc2 = 1
-        res1 , nFit = fitSignal ( _funcSub , hAllSub , background = None, signal = refAllSub )
-        nFits += nFit
-    if not res2 or not checkHisto ( hAllSub ):
-        sc2 = -1
-        
-    # Subtracted Prs<10
-    sc3 = 0
-    res3 , nFit = fitSignal ( _funcSub , hPrsLT10Sub , background = None, signal = hPrsLT10Sub )
-    nFits += nFit
-    if not res3 or not checkHisto ( hPrsLT10Sub ):
-        sc3 = 1
-        res1 , nFit = fitSignal ( _funcSub , hPrsLT10Sub , background = None, signal = refPrsLT10Sub )
-        nFits += nFit
-    if not res3 or not checkHisto ( hPrsLT10Sub ):
-        sc3 = -1
-        
-    # Return results
-    result =  ( sc0 , sc1 , sc2 , sc3 , nFits )
-    histoset.result = result 
-    return result 
-
-def simpleFit( histo ):
-  """Simple histogram fit."""
-  return Fit.fitPi0(histo)
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FitTask.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FitTask.py
deleted file mode 100644
index e820987b6..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/FitTask.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FitTask.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @reshuffled from Vanya Belyaev's FitTask.py
-# @date 2010-11-13
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-__all__ = [ 'FitTask' , 'fitHistos' ]
-
-import KaliCalo.Kali.FitTaskBase              as _FitTaskBase
-import KaliCalo.CandidateMinimization.FitFunctions as _FitFunctions
-
-FitTask = _FitTaskBase.FitTask
-
-fitHistos = _FitTaskBase.FitHistos( _FitFunctions.fitHistoSet    ,
-                                    _FitFunctions.preFitHistoSet )
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/GetGlobalConstant.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/GetGlobalConstant.py
deleted file mode 100644
index c2104bbb5..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/GetGlobalConstant.py
+++ /dev/null
@@ -1,99 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file GetGlobalConstant.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @date 2011-08-25
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-
-from optparse import OptionParser
-import os
-import sys
-from ROOT import *
-
-from KaliCalo.Kali.LambdaMap                  import LambdaMap
-from KaliCalo.CandidateMinimization.FillTask  import fillDatabase
-from KaliCalo.Det                             import getCalo
-from KaliCalo.Kali                            import pi0Mass
-import KaliCalo.FitUtils                      as FitUtils
-import KaliCalo.CandidateMinimization.FitFunctions as FitFunctions
-import KaliCalo.CandidateMinimization.FitTask as Task
-import KaliCalo.FakeCells                     as FakeCells
-import KaliCalo.Cells                         as Cells
-
-def getEcalCells():
-  ecal = getCalo()
-  cp = ecal.cellParams()
-  cells = []
-  for p in cp :
-    cell = p.cellID()
-    if ecal.valid ( cell ) and not cell.isPin() :
-      cells.append ( cell )
-  cells.sort()
-  return cells
-
-castorDir = '/castor/cern.ch/grid/'
-
-if __name__ == '__main__':
-  parser = OptionParser()
-  parser.add_option("-t", "--cellType",
-                    dest="cellType", action="store", type="string", default="global",
-                    help="use CELLTYPE cell grouping", metavar="CELLTYPE")  
-  parser.add_option("-o", "--outputDir",
-                    dest="outputDir", action="store", type="string", default="",
-                    help="DIR where to store output constants", metavar="DIR")
-  (options, args) = parser.parse_args()
-  if not args:
-    options, args = parser.parse_args(sys.stdin.readline().split())
-  ntuples = []
-  chain = TChain("KaliPi0/Pi0-Tuple")
-  for arg in args:
-    execfile(arg)
-    for f in ['castor:' + castorDir + t for t in tup]:
-      chain.AddFile(f)
-  lambdas  = LambdaMap()
-  histos = {}
-  if options.cellType == "global": # Only one constant
-    globalH = TH1F("globalH", "globalH", 250, 0, 250)
-    chain.Project("globalH", "m12", "max(prs1,prs2) < 10")
-    st, n = FitFunctions.simpleFit(globalH)
-    histos[0] = globalH
-    histos[1] = globalH
-    histos[2] = globalH
-  elif options.cellType == "area": # three constants
-    inner  = TH1F("inner", "inner", 250, 0, 250)
-    chain.Project("inner", "m12", "max(prs1,prs2)<10 && (ind1>8000 && ind2>8000)")
-    middle = TH1F("middle", "middle", 250, 0, 250)
-    chain.Project("middle", "m12", "max(prs1,prs2)<10 && (ind1<8000 && ind1>4000 && ind2<8000 && ind2>4000)")
-    outer  = TH1F("outer", "outer", 250, 0, 250)
-    chain.Project("outer", "m12", "max(prs1,prs2)<10 && (ind1<4000 && ind2<4000)")
-    st, n = FitFunctions.simpleFit(outer)
-    st, n = FitFunctions.simpleFit(middle)
-    st, n = FitFunctions.simpleFit(inner)
-    histos[0] = outer
-    histos[1] = middle
-    histos[2] = inner
-  else:
-    print "Unknown cell type -> %s" % options.cellType
-    sys.exit(1)
-  means = {}
-  means[2] = FitUtils.getPi0Params(histos[2])[1]
-  means[1] = FitUtils.getPi0Params(histos[1])[1]
-  means[0] = FitUtils.getPi0Params(histos[0])[1]
-  print "Found mean positions"
-  print "  Inner : %s" % means[2]
-  print "  Middle: %s" % means[1]
-  print "  Outer : %s" % means[0]
-  # Save results 
-  for cell in getEcalCells():
-    area = cell.area()
-    lams = lambdas[cell]
-    lams.append(pi0Mass/means[area].value())
-  lambdas.save(os.path.join(options.outputDir, 'lambdas.gz'))
-  sys.exit(0)
-  
-# EOF
-
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Run.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Run.py
deleted file mode 100644
index 881eb8654..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/Run.py
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file Run.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @date 2011-08-18
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-
-# General python imports
-import os
-import sys
-import glob
-from optparse import OptionParser
-import tempfile
-import subprocess
-import shutil
-import time
-
-kaliDir = os.path.expandvars("$KALICALOROOT")
-# ROOT
-from ROOT import *
-try:
-  sc = gROOT.LoadMacro(os.path.join(kaliDir, "root", "CellCutter.cxx+"))
-  from ROOT import CellCutter
-except:
-  print "Error importing CellCutter!"
-  sys.exit(1)
-# Kali
-import KaliCalo.CandidateMinimization.Commands as Commands
-import KaliCalo.Kali.LambdaMap as LambdaMap
-import KaliCalo.FakeCells      as FakeCells
-import KaliCalo.Cells          as Cells
-from   KaliCalo.Det            import getCalo
-
-def getEcalCells():
-  ecal = getCalo()
-  cp = ecal.cellParams()
-  cells = []
-  for p in cp :
-    cell = p.cellID()
-    if ecal.valid ( cell ) and not cell.isPin() :
-      cells.append ( cell )
-  cells.sort()
-  return cells
-
-gridCastorDir = 'castor:/castor/cern.ch/grid/'
-homeCastorDir = os.path.expandvars("castor:$CASTOR_HOME")
-
-CellID = FakeCells.CellID
-betas = [8.3, 8.8, 9.5]
-
-if __name__ == '__main__':
-  parser = OptionParser()
-  parser.add_option("-t", "--cellType",
-                    dest="cellType", action="store", type="string", default="SameCell",
-                    help="use CELLTYPE cell grouping", metavar="CELLTYPE")
-  parser.add_option("-n", "--nSteps",
-                    dest="nSteps", action="store", type="int", default=10,
-                    help="number of calibration STEPS to perform", metavar="STEPS")
-  (options, files) = parser.parse_args()
-  if not files:
-    options, files = parser.parse_args(sys.stdin.readline().split())
-  # Load the cell massager
-  CellMassager = getattr(FakeCells, options.cellType, None)
-  if not CellMassager:
-    print "Wrong Cell Massager!"
-    sys.exit(1)
-  CellMassager = CellMassager()
-  # Determine cell groups only with top cells (the others are opposite and considered by Calibrate.py)
-  cellsToCalibrate = {}
-  for cell in getEcalCells():
-    if cell.row() > 31:
-      mCell = CellMassager(cell)
-      if not mCell in cellsToCalibrate:
-        cellsToCalibrate[mCell] = []
-      cellsToCalibrate[mCell].append(cell)
-  print "We have %s vars to calibrate" %(len(cellsToCalibrate)*2)
-  #print "Cells to calibrate (true cellID) -> %s" % (', '.join([str(cellsToCalibrate[c][0].all()) for c in cellsToCalibrate]))
-  #print "Cells to calibrate (fake cell)   -> %s" % (', '.join([str(c) for c in cellsToCalibrate]))
-  #print "Cells to calibrate (file name)   -> %s" % (', '.join([str(c.all())+'.root' for c in cellsToCalibrate]))
-  # Cut cells
-  if not 'CaloCalib' in Commands.nsls(''):
-    Commands.runCommand('nsmkdir', '$CASTOR_HOME/CaloCalib')
-  for arg in files:
-    # Prepare output dir in Castor
-    calibName = os.path.splitext(os.path.basename(arg))[0]
-    if calibName.startswith('tup'):
-      calibName = calibName[3:]
-    print "Calib name: %s" % calibName
-    print "Creating dir structure"
-    #print "Cutting %s" % calibName
-    dirName = os.path.expandvars('$CASTOR_HOME/CaloCalib/%s' % calibName)
-    if calibName in Commands.nsls('CaloCalib'):
-      print "Calibration directory $CASTOR_HOME/CaloCalib/%s already exists." % calibName
-    else:
-      Commands.runCommand('nsmkdir', dirName)
-    # Prepare dir structure
-    outputDir = os.path.expandvars("$HOME/CaloCalib/%s/%s" % (options.cellType, calibName))
-    # castorDir = 'castor:' + os.path.expandvars("$CASTOR_HOME/CaloCalib/%s" % calibName)
-    castorDir = os.path.expandvars("$CASTOR_HOME/CaloCalib/%s" % calibName)
-    if not os.path.exists(outputDir):
-      os.makedirs(outputDir)
-    masterDir = os.path.join(outputDir, 'master')
-    if not os.path.exists(masterDir):
-      os.makedirs(masterDir)
-    for i in range(options.nSteps + 1):
-      dirName = os.path.join(outputDir, str(i))
-      if not os.path.exists(dirName):
-        os.makedirs(dirName)
-        for subDir in ['input', 'output', 'lambda']:
-          subDirName = os.path.join(dirName, subDir)
-          if not os.path.exists(subDirName):
-            os.makedirs(subDirName)
-    # Create inputs
-    print "Now submit jobs"
-    prevJob = 0
-    fmt = "%30s %s\n"
-    for i in range(options.nSteps):
-      step = i+1
-      if step == 1:
-        print "First step, global correction"
-        if not os.path.exists(os.path.join(outputDir, '0', 'lambda', 'lambdas.gz')):
-          args = ['-t', 'area',
-                  '-o', os.path.join(outputDir, '0', 'lambda'),
-                  arg]
-          jobOptions = ' '.join(args)
-          with open(os.path.join(outputDir, '0', 'input', 'input.lambdas'), 'w') as f:
-            f.write(jobOptions)
-          script = """#!/bin/tcsh
-kinit -R
-aklog
-SetupProject DaVinci v28r5
-python %s < %s
-exit $?
-""" % ( os.path.expandvars("$KALICALOROOT/python/KaliCalo/CandidateMinimization/GetGlobalConstant.py"),
-        os.path.join(outputDir, '0', 'input', 'input.lambdas') )
-          scriptPath = os.path.join(outputDir, '0', 'input', 'cut.csh')
-          with open(scriptPath, 'w') as f:
-            f.write(script)
-          os.chmod(scriptPath, int('777', 8))
-          globalArgs = ['-Q', 'all ~0',
-                        '-J', 'Calib%sGlobalConstant' % calibName,
-                        #'-o/dev/null',
-                        '-o', os.path.join(outputDir, '0', 'output', 'GlobalConstants'),
-                        scriptPath]
-          print globalArgs
-          prevJob = Commands.bsub(*globalArgs)
-          with open(os.path.join(masterDir, 'jobIDs'), 'a') as f:
-            f.write(fmt % ('GlobalConstant', prevJob))
-      if os.path.exists(os.path.join(outputDir, str(step), 'lambda', 'lambdas.gz')): # The step has finalized
-        print "Step %s of %s is done, skipping..." %(step, calibName)
-        continue
-      print "Step %s" % step
-      inputDir = os.path.join(outputDir, str(step), 'input')
-      inputNumber = 0
-      # Divide the cells to calibrate into 50 evenly distributed jobs, so we have ~510 jobs in the end
-      for cellsToCalib in (cellsToCalibrate.keys()[i::50] for i in range(50)):
-        args = ['-l%s' % os.path.join(outputDir, str(step-1), 'lambda', 'lambdas.gz'),
-                '-c%s' % arg,
-                '-t%s' % options.cellType,
-                '-o%s' % os.path.join(outputDir, str(step), 'lambda'),
-               ]
-        args.extend([os.path.join(castorDir, str(mCellName.all())+'.root') for mCellName in cellsToCalib])
-        jobOptions = ' '.join(args)
-        with open(os.path.join(inputDir, 'input.%s' % inputNumber), 'w') as f:
-          f.write(jobOptions)
-        inputNumber += 1
-      calibArgs = ['-Q', "all ~0",
-                   '-J', 'Calib%sStep%s[1-%s]' % (calibName, step, len(cellsToCalib)),
-                #   "-i%s" % os.path.join(inputDir, 'input.%I'),
-                   "-oo%s" % os.path.join(outputDir, str(step), 'output', 'output.%I') ]
-      if prevJob:
-        calibArgs.extend(['-w', 'done(%s)' %prevJob])
-      script = """#!/bin/tcsh
-kinit -R
-aklog
-SetupProject DaVinci v28r5
-echo "My index is "$LSB_JOBINDEX
-python %s < %s
-exit $?
-""" % ( os.path.expandvars("$KALICALOROOT/python/KaliCalo/CandidateMinimization/Calibrate.py"),
-        os.path.join(inputDir, 'input.$LSB_JOBINDEX' ))
-      with open(os.path.join(inputDir, 'calibrate.csh' ), 'w') as f:
-        f.write(script)
-      os.chmod(os.path.join(inputDir, 'calibrate.csh' ), int('777', 8))
-      calibArgs.append(os.path.join(inputDir, 'calibrate.csh' ))
-      print calibArgs
-      prevJob = Commands.bsub(*calibArgs)
-      if 0 == prevJob:
-        print "Error submitting"
-        sys.exit(1)
-      with open(os.path.join(masterDir, 'jobIDs'), 'a') as f:
-        f.write(fmt % ('Step%s' % step, prevJob))
-      with open(os.path.join(inputDir, 'input.lambdas'), 'w') as f:
-        f.write(' '.join(['-o%s' % os.path.join(outputDir, str(step), 'lambda', 'lambdas.gz'), os.path.join(outputDir, str(step), 'lambda','*.gz')]))
-      #time.sleep(10)
-      joinArgs = ['-Q', "all ~0",
-                  #"-i%s" % os.path.join(inputDir, 'input.lambdas'),
-                  "-o%s" % os.path.join(outputDir, str(step), 'output', 'output.lambdas'), 
-                  '-w', "done(%s)" % prevJob,
-                 ]#os.path.expandvars("$KALICALOROOT/python/KaliCalo/CandidateMinimization/CombineLambdaMaps.py")]
-      script = """#!/bin/tcsh
-kinit -R
-aklog
-SetupProject DaVinci v28r5
-python %s < %s
-exit $?
-""" % ( os.path.expandvars("$KALICALOROOT/python/KaliCalo/CandidateMinimization/CombineLambdaMaps.py"),
-        os.path.join(inputDir, 'input.lambdas'))
-      with open(os.path.join(inputDir, 'combine.csh'), 'w') as f:
-        f.write(script)
-      os.chmod(os.path.join(inputDir, 'combine.csh'), int('777', 8))
-      joinArgs.append(os.path.join(inputDir, 'combine.csh'))
-      print joinArgs
-      prevJob = Commands.bsub(*joinArgs)
-      if 0 == prevJob:
-        print "Error submitting"
-        sys.exit(1)
-      with open(os.path.join(masterDir, 'jobIDs'), 'a') as f:
-        f.write(fmt % ('Combine%s' % step, prevJob))
-  sys.exit(0)
-
-# EOF
-
diff --git a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/__init__.py b/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/__init__.py
deleted file mode 100644
index a24216d31..000000000
--- a/Phys/KaliCalo/python/KaliCalo/CandidateMinimization/__init__.py
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file __init__.py
-# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-# @reshuffled by Albert Puig (Albert.Puig@cern.ch)
-# @date 2010-11-09
-# =============================================================================
-"""
-"""
-
-__author__  = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__    = "$Date$"
-__version__ = "$Revision$"
-
-__all__ = ['Histos', 'HistoMap']
-
-from KaliCalo.Kali.HistoBase import HistosBase as _HistosBase
-from KaliCalo.Kali.HistoBase import HistoMapBase as _HistoMapBase
-
-class Histos( _HistosBase ):
-    def __init__ ( self, cellID , background ):
-        histoList = [ 'All' , 'PrsLT10' , 'All_BG' , 'PrsLT10_BG' , 'All_Subtracted' , 'PrsLT10_Subtracted' ]
-        _HistosBase.__init__ ( self , cellID , histoList , 2 )
-        
-class HistoMap( _HistoMapBase ):
-    def __init__ ( self, background = True , *args ):
-        _HistoMapBase.__init__ ( self , Histos , background , *args )
-
-# =============================================================================
-## get the histograms fomr data base (databases)
-def  getHistosFromDB ( dbases ) :
-    """
-    Get the histograms from data base (databases)
-    """
-    if issubclass ( type ( dbases ) , HistoMap ) :
-        return dbases
-    histos = HistoMap()
-    histos.updateFromDB ( dbases )
-    return histos
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/Cells.py b/Phys/KaliCalo/python/KaliCalo/Cells.py
deleted file mode 100644
index 82acc3618..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Cells.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python
-# ======================================================================
-## @file KaliCalo/Cells.py
-#  Utilities for cells 
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-04-29
-# ======================================================================
-"""
-Utilities for cells 
-"""
-# ======================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__    = " 2010-04-29 "
-__version__ = " CVS tag $Name: not supported by cvs2svn $ , version $Revision$ "
-__all__     = (
-    'CellID'     , 
-    'GlobalRow'  ,
-    'GlobalCol'  ,
-    #
-    'EcalZone'   ,
-    'InnerZone'  ,
-    'MiddleZone' ,
-    'OuterZone'  ,
-    'Zones'      ,
-    #
-    'oppositeCell'
-    )
-# ======================================================================
-import ROOT
-from GaudiPython.Bindings import gbl as cpp
-LHCb       = cpp.LHCb
-## decorate CaloCellID class 
-import CaloUtils.CellID
-
-GlobalRow = 31
-GlobalCol = 31 
-
-CellID = LHCb.CaloCellID 
-
-EcalZone   = CellID ( 'Ecal' , 'PinArea', GlobalRow , GlobalCol ) ## the whole Ecal 
-## inner  zone only 
-InnerZone  = CellID ( 'Ecal' , 'Inner'  , GlobalRow , GlobalCol ) ## inner  zone only 
-## middle zone only 
-MiddleZone = CellID ( 'Ecal' , 'Middle' , GlobalRow , GlobalCol ) ## middle zone only 
-## Outer  zone only 
-OuterZone  = CellID ( 'Ecal' , 'Outer'  , GlobalRow , GlobalCol ) ## Outer  zone only 
-
-Zones      = (
-    OuterZone  ,
-    MiddleZone , 
-    InnerZone  ,
-    EcalZone   
-    )
-
-def oppositeCell(cell):
-  return CellID( cell.calo(), cell.area(), ( GlobalRow - cell.row() ) + 32, ( GlobalCol - cell.col() ) + 32 )
-
-# =============================================================================
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print ' dir(%s) : %s ' % ( __name__    , dir() )
-    print '*'*120  
-          
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/Configuration.py b/Phys/KaliCalo/python/KaliCalo/Configuration.py
deleted file mode 100644
index 379297543..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Configuration.py
+++ /dev/null
@@ -1,837 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# $Id$
-# =============================================================================
-# @file  KaliCalo/Configuration.py
-#
-# The basic configuration for Calorimeter Calibration
-#
-# The application produces:
-# 
-#  - ROOT NTuple for analysis
-#  - 'femto-DST' output, suibale for fast reprocessing 
-#  - monitoring histograms
-#
-# The usage is fairly trivial:
-#
-#    # configure the application:
-#
-#    from Gaudi.Configuration import * 
-#    from Configurables       import KaliPi0Conf
-#
-#    KaliPi0Conf (
-#    FirstPass = True    ,  ## set for the first pass on DST
-#    EvtMax    = 10000      ## number of events to process
-#    )
-#
-#    # define input data :
-#    EventSelector(
-#    Input = [ .. ] 
-#    )
-#
-# Or one can rely on helper functions:
-#
-#     from KaliPi0.Configuration import firstPass, secondPass  
-#
-#
-#     kali = firstPass ( EvtMax = 1000 )
-#
-#     # define input data :
-#     EventSelector(
-#     Input = [ .. ] 
-#     )
-#
-# @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
-# @date   2009-09-28
-#
-#                   $Revision$
-# Last modification $Date$
-#                by $Author$
-#
-# =============================================================================
-"""
-The basic configuration to (re)run Ecal pi0-calibration
-
-The application produces:
-
- - ROOT NTuple for analysis
- - 'femto-DST' output, suibale for fast reprocessing 
- - monitoring histograms
-
-The usage is fairly trivial:
-
-    # configure the application:
-
-    from Gaudi.Configuration import * 
-    from Configurables       import KaliPi0Conf
-
-    KaliPi0Conf (
-    FirstPass = True    ,  ## set for the first pass on DST
-    EvtMax    = 10000      ## number of events to process
-    )
-
-    # define input data :
-    EventSelector(
-    Input = [ .. ] 
-    )
-
-Or one can rely on helper functions:
-
-     from KaliPi0.Configuration import firstPass, secondPass  
-
-     kali = firstPass ( EvtMax = 1000 )
-
-     # define input data :
-     EventSelector(
-     Input = [ .. ] 
-     )
-
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@nikhef.nl "
-__date__    = " 2009-09-28 "
-__version__ = " version $Revision$ "
-# =============================================================================
-# the only one  "vizible" symbol 
-__all__  = (
-    'KaliPi0Conf' ,                         ## the only one vizible symbol
-    'firstPass'   , ## helper symbol to create the preconfigured application
-    'secondPass'    ## helper symbol to create the preconfigured application
-    )
-# =============================================================================
-from Gaudi.Configuration       import *
-from LHCbKernel.Configuration  import *
-from GaudiKernel.SystemOfUnits import GeV,MeV 
-import logging
-
-_log = logging.getLogger('KaliCalo')
-
-# =============================================================================
-## @class KaliPi0Conf
-#  Configurable for Calorimeter Iterative Calibration with pi0
-#  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
-#  @date 2008-09-28
-class  KaliPi0Conf(LHCbConfigurableUser):
-    """
-    The main Configurable for Calorimeter Iterative Calibration with pi0
-
-    The application produces:
-    
-    - ROOT NTuple for analysis
-    - 'femto-DST' output, suibale for fast reprocessing 
-    - monitoring histograms
-    
-    The usage is fairly trivial:
-
-    # configuration of application:
-    form Gaudi.Configuration import *  
-    from Configurables       import KaliPi0Conf
-
-    KaliPi0Conf (
-    FirstPass = True    ,  ## set for the first pass on DST
-    EvtMax    = 10000      ## number of events to process
-    )
-
-    # event input:
-    EventSelector(
-    Input = [ .. ] 
-    )
-
-
-    - Some reasonable configurations for (x)DST input ('First Pass')
-    
-    
-    1. FirstPass = True , UseTracks = True  , UseSpd = False
-    The 'standard' Calorimeter reconstruction, probably the best S/B condition
-    
-    2. FirstPass = True , UseTracks = True  , UseSpd = True
-    The high pi0-efficiency (Track|Spd), the best usage of (x)DST
-    
-    3. FirstPass = True , UseTracks = False , UseSpd = True
-    The fast recontruction, moderate S/B ratio, suitable for 'on-line' emulation
-    
-    4. FirstPass = True , UseTracks = False , UseSpd = False 
-    Very fast recontruction, the highest efficiency and the worst S/B ratio, suitable for 'on-line' emulation
-
-
-    - The reasonable configurations for femto-DST input ('Second Pass') 
-            
-    a. FirstPass = False , UseTracks = False , UseSpd = True
-    The fast recontruction, moderate S/B ratio
-    
-    b. FirstPass = False , UseTracks = False , UseSpd = False
-    Very fast recontruction, the worst S/B ratio
-
-    
-    """
-    
-    ## Explicitly Used Configurables
-    __used_configurables__ = [
-        'OffLineCaloRecoConf' ,
-        'OffLineCaloPIDsConf' ,
-        'GlobalRecoConf'      ,
-        'DaVinci'
-        ]
-
-    ## the own slots 
-    __slots__ = {
-        ## Own flags:
-        'FirstPass'             : False ## The first (specific) pass on (x)DST ?
-        , 'DestroyTES'          : True  ## Destroy TES containers : List of Input Partcle Containers
-        , 'DestroyList'         : ['KaliPi0' ]  ## The list of input TES-location for Destroyer
-        , 'OtherAlgs'           : []    ## List of "other" algorithms to be run, e.g. electorn calibration
-        , 'Mirror'              : False ## Use Albert's trick for combinatorial background evaluation
-        , 'Histograms'          : False ## Create monitoring histograms
-        , 'RecoAll'             : False ## Global Recontruction ?
-        ## for first pass only
-        , 'Pi0VetoDeltaMass'    : -1    ## mass-window for pi0-veto 
-        , 'Pi0VetoChi2'         : -1    ## chi2        for pi0-veto
-        , 'Filter'              : ''    ## event filter
-        ## mis/re-calibration
-        , 'KaliDB'              : {}    ## the map of { 'dbase' : 'bbase_name' , 'ecal' : 'key for Ecal' , 'prs' : 'key for Prs'}
-        , 'Coefficients'        : {}    ## The map of (mis)calibration coefficients
-        , 'PrsCoefficients'     : {}    ## The map of (mis)calibration coefficients for Prs 
-        ## ``Physics''
-        , 'PtGamma'             : 300 * MeV ## Pt-cut for photons 
-        , 'Pi0Cut'              : " PT > 200 * MeV * ( 7 - ETA ) " ## Cut for pi0  
-        , 'SpdCut'              : 0.1 * MeV ## Spd-cuts for photons 
-        ## CaloReco Flags:
-        , 'UseTracks'           : True  ## Use Tracks for the first pass ?
-        , 'UseSpd'              : True  ## Use Spd as neutrality criteria ?
-        , 'UsePrs'              : False ## Use Prs for photon selection ?
-        , 'ForceDigits'         : False ## Force Digits witgh Cluster Recontruction
-        ## IO-related 
-        , 'NTuple'              : 'KaliPi0_Tuples.root' ## The output NTuple-file
-        , 'Histos'              : 'KaliPi0_Histos.root' ## The output Histo-file
-        , 'FemtoDST'            : 'KaliPi0.fmDST'       ## The output femto-DST
-        ## forwarded to DaVinci & other configurables 
-        , 'EvtMax'              :  -1    ## Number of events to run (DaVinci)             
-        , 'DataType'            : '2009' ## Data type               (DaVinci)
-        , 'Simulation'          : False  ## Simulation              (DaVinci) 
-        , 'MeasureTime'         : True   ## Measure the time for sequencers
-        , 'OutputLevel'         : INFO   ## The global output level
-        , 'PrintFreq'           : 100000 ## The print frequency
-        , 'NTupleProduce'       : True   ## Produce NTuples
-        }
-    ## documentation lines 
-    _propertyDocDct = {
-        ## Own flags 
-        'FirstPass'             : """ The first (specific) pass on (x)DST ?"""
-        , 'DestroyTES'          : """ Destroy TES containers """
-        , 'DestroyList'         : """ The list of input TES-locations for Destroyer """
-        , 'OtherAlgs'           : """ The list of 'other' algorithm to run, e.g. electron calibration """
-        , 'Mirror'              : """ Use Albert's trick for combinatorial background evaluation """ 
-        , 'Histograms'          : """ Activate monitoring histograms creation """
-        , 'RecoAll'             : """ Global Reconstruction? """
-        ## the first pass only 
-        , 'Pi0VetoDeltaMass'    : """ Mass-window for pi0-veto """
-        , 'Pi0VetoChi2'         : """ Chi2        for pi0-veto """ 
-        , 'Filter'              : """ Void-filter to be used   """ 
-        ## mis/re-calibration        
-        , 'KaliDB'              : """ The map of { 'name' : 'bbase_name' , 'ecal' : 'key for Ecal' , 'prs' : 'key for Prs'} """
-        , 'Coefficients'        : """ The map of (mis)calibration coefficients """
-        , 'PrsCoefficients'     : """ The map of (mis)calibration coefficients for Prs """
-        ## ``Physics''
-        , 'PtGamma'             : """ Pt-cut for photons """
-        , 'Pi0Cut'              : """ Cut for pi0 (LoKi/Bender expression)""" 
-        , 'SpdCut'              : """ Spd-cuts for photons """ 
-        ## CaloReco flags 
-        , 'UseTracks'           : """ Use Tracks for the first pass ? """
-        , 'UseSpd'              : """ Use Spd as neutrality criteria ? """
-        , 'UsePrs'              : """ Use Prs for photon selection ? """
-        , 'ForceDigits'         : """ Force Digits witgh Cluster Recontruction """
-        ## IO-related 
-        , 'NTuple'              : """ The output NTuple-file """ 
-        , 'Histos'              : """ The output Histo-file """
-        , 'FemtoDST'            : """ The output femto-DST """
-        ## DaVinci & Co configuration: 
-        , 'EvtMax'              : """ Number of events to run (DaVinci) """
-        , 'DataType'            : """ Data type               (DaVinci) """
-        , 'Simulation'          : """ Simulation              (DaVinci) """
-        , 'MeasureTime'         : """ Measure the time for sequencers """
-        , 'OutputLevel'         : """ The global output level """
-        , 'NTupleProduce'       : """ Produce calibration NTuples """
-        }
- 
-    ## 1. General Calorimeter Reconstruction Confifuration
-    def caloConf ( self ) :
-        """        
-        Define the General Calorimeter Recontruction Configuration
-
-        """
-        ## General Calorimeter Reconstruction Configuration
-
-        from Configurables  import OffLineCaloRecoConf
-        from Configurables  import OffLineCaloPIDsConf
-        from Configurables  import CaloDstUnPackConf 
-
-        if self.getProp( 'FirstPass' ) and self.getProp( 'UseTracks' ) :
-
-            OffLineCaloRecoConf (
-                EnableRecoOnDemand = True  ,
-                UseTracks          = True  ,        ## Use Tracks For First Pass
-                UseSpd             = self.getProp ( 'UseSpd'      ) ,
-                ## UsePrs             = self.getProp ( 'UsePrs'      ) ,
-                ForceDigits        = self.getProp ( 'ForceDigits' ) ,
-                MeasureTime        = self.getProp ( 'MeasureTime' ) ,
-                OutputLevel        = self.getProp ( 'OutputLevel' ) )
-                
-        else :
-            
-            OffLineCaloRecoConf (
-                EnableRecoOnDemand = True  ,
-                UseTracks          = False ,         ## do not use tracks!
-                UseSpd             = self.getProp ( 'UseSpd'      ) ,
-                ## UsePrs             = self.getProp ( 'UsePrs'      ) ,
-                ForceDigits        = self.getProp ( 'ForceDigits' ) ,
-                MeasureTime        = self.getProp ( 'MeasureTime' ) ,
-                OutputLevel        = self.getProp ( 'OutputLevel' ) )
-        
-        OffLineCaloPIDsConf (
-            EnablePIDsOnDemand = True                         ,
-            MeasureTime        = self.getProp ( 'MeasureTime' ) ,
-            OutputLevel        = self.getProp ( 'OutputLevel' ) )
-
-
-        
-    ## 2. (Optional) CaloDigit (mis)calibration
-    def misCali ( self ) :
-        """
-        
-        (Optional) CaloDigit (mis)calibration
-        
-        """
-        lst = []
-        ##
-        
-        import KaliCalo.Kali      as Kali
-        import KaliCalo.ZipShelve as ZipShelve
-        
-        ecal  = {}
-        prs   = {}
-
-        ## DBASE has been specified 
-        if self.getProp('KaliDB') :
-            kali_db = self.getProp('KaliDB')
-            if not kali_db.has_key('name') :
-                raise AttributeError, "KaliDB property has no 'name' atribute "
-            # open data base 
-            dbase = ZipShelve.open ( kali_db['name'] , 'r' )
-            if kali_db.has_key ( 'ecal') : ecal = dbase[ kali_db [ 'ecal'] ]
-            if kali_db.has_key ( 'prs' ) : prs  = dbase[ kali_db [ 'prs' ] ]
-            dbase.close()
-            
-        ##
-        if ecal and self.getProp ( 'Coefficients' ) :
-            raise ArrtibuteError, 'Ecal coefficients & data base key are exclusive ' 
-        if self.getProp ( 'Coefficients' ) :
-            ecal = self.getProp ( 'Coefficients' )
-        ##
-        if prs and self.getProp ( 'PrsCoefficients' ) :
-            raise ArrtibuteError, 'Prs coefficients & data base key are exclusive ' 
-        if self.getProp ( 'PrsCoefficients' ) :
-            prs = self.getProp ( 'PrsCoefficients' )
-
-        if ecal :
-            ## fix to allow 'pickable' configuration 
-            _ecal = {}
-            for key in ecal :
-                newkey = ( 'Ecal' , key.areaName () , int(key.row()) , int(key.col ()) ) 
-                _ecal [ newkey ] = ecal [ key ]
-            from Configurables import Kali__MisCalibrateCalo
-            alg = Kali__MisCalibrateCalo ( "KaliEcal" , Coefficients = _ecal )
-            lst += [ alg ]
-            
-        ##
-        if prs :
-            ## fix to allow 'pickable' configuration 
-            _prs = {}
-            for key in prs :
-                newkey = ( 'Prs' , key.areaName () , int(key.row()) , int(key.col ()) ) 
-                _prs [ newkey ] = prs [ key ] 
-            from Configurables import Kali__MisCalibrateCalo
-            alg = Kali__MisCalibrateCalo ( "KaliPrs" , Coefficients = _prs )
-            lst += [ alg ]
-        #
-        return lst 
-        
-    ## 3. "Light-mode" for Neutral ProtoParticles: no PIDs 
-    def protos ( self ) :
-        """
-        'Light-mode' for Neutral ProtoParticles: no PIDs
-        """
-        ## 3. "Light-mode" for Neutral ProtoParticles: no PIDs         
-        from GlobalReco.GlobalRecoConf import NeutralProtoPAlg
-        _log.warning("KaliPi0: \"Light\"-mode is activated for Neutral ProtoParticles") 
-        return  NeutralProtoPAlg (
-            "NeutralProtoPMaker"  , 
-            LightMode      = True ,                  ## "ligght-mode", no PIDs
-            HyposLocations = [ 'Rec/Calo/Photons']   ## only single photons 
-            )
-    
-    ## 4. Specific settings for Photon Maker
-    def photons ( self ) : 
-        """
-        Specific settings for Photon Maker
-        """
-        ## 4. Specific settings for Phtoton Maker 
-        from ParticleMaker.ParticleMakerConf import PhotonMakerAlg, PhotonMaker
-        
-        maker =  PhotonMakerAlg (
-            'StdLooseAllPhotons' ,
-            DecayDescriptor = 'Gamma'
-            )
-
-        maker.addTool ( PhotonMaker , name = 'PhotonMaker' )
-        photon = maker.PhotonMaker
-        photon.ConfidenceLevelBase   = []
-        photon.ConfidenceLevelSwitch = []
-        photon.ConvertedPhotons   = True 
-        photon.UnconvertedPhotons = True 
-        photon.PtCut              = 250
-        
-        maker.InputPrimaryVertices = 'None' ## NB: it saves a lot of CPU time 
-        _log.warning ( "KaliPi0: PID-info is disabled for PhotonMaker") 
-        _log.warning ( "KaliPi0: Primary Vertices are disabled for StdLooseAllPhotons") 
-        
-        return maker 
-
-    ## 5. The configuration for Kali-Pi0 algorithm
-    def kaliPi0 ( self ) :
-        """
-        The configuration for Kali-Pi0 algorithm
-        """
-        from Configurables import Kali__Pi0
-        
-        kali = Kali__Pi0 (
-            "KaliPi0"                                       ,
-            ## specific cuts :
-            Cuts = { 'PtGamma' : self.getProp ( 'PtGamma' ) ,
-                     'SpdCut'  : self.getProp ( 'SpdCut'  ) } ,
-            ## cut for pi0 :
-            Pi0Cut         = self.getProp ( 'Pi0Cut' )      ,
-            ## general configuration 
-            NTupleLUN      = "KALIPI0"                      ,
-            HistoPrint     = True                           ,
-            NTuplePrint    = True                           ,
-            Inputs         = [ 'Phys/StdLooseAllPhotons' ]  ,
-            OutputLevel    = self.getProp ( 'OutputLevel' ) ,
-            Mirror         = self.getProp ( 'Mirror'      ) , 
-            HistoProduce   = self.getProp ( 'Histograms'  ) ,
-            NTupleProduce  = self.getProp ( 'NTupleProduce' )
-            )
-        
-        if self.getProp ('Mirror' ) :
-            _log.warning ("KaliPi0: Albert's trick is   activated") 
-        else :
-            _log.warning ("KaliPi0: Albert's trick is deactivated")
-            
-        if self.getProp('FemtoDST'):
-            _log.warning ("KaliPi0: FemtoDSTs will be produced")
-        else:
-            _log.warning ("KaliPi0: NO FemtoDSTs will be produced!!!")
-
-        if self.getProp ( 'Histograms' ) :
-            _log.warning ( "KaliPi0: Monitoring histograms are   activated") 
-        else :
-            _log.warning ( "KaliPi0: Monitoring histograms are deactivated")
-
-        if self.getProp ( 'NTupleProduce' ) :
-            _log.warning ( "KaliPi0: Creation of calibration NTuples is   activated")
-        else :
-            _log.warning ( "KaliPi0: Creation of calibration NTuples is deactivated")
-            
-        if self.getProp ( 'FirstPass' ) :
-            
-            if 0 <= self.getProp ('Pi0VetoDeltaMass') :
-                _dm   = self.getProp ( 'Pi0VetoDeltaMass' ) 
-                _log.warning ("KaliPi0: Pi0Veto is activated DM   =%s" % _dm   ) 
-                kali.Pi0VetoDeltaMass = _dm
-                
-            if 0 <= self.getProp ('Pi0VetoChi2') :
-                _chi2 = self.getProp ( 'Pi0VeloChi2' ) 
-                _log.warning ("KaliPi0: Pi0Veto is activated CHI2 =%s" % _chi2 ) 
-                kali.Pi0VetoChi2      = _chi2
-                
-        kali.InputPrimaryVertices = 'None'  ## NB: it saves a lot of CPU time!
-        _log.warning("KaliPi0: Primary Vertices are disabled for Kali") 
-        
-        return kali 
-
-    ## 7. The configuration of femtoDST
-    def fmDst ( self ) :
-        """
-        The configuration of femto-DST
-        """
-        from Gaudi.Configuration import OutputStream
-        
-        items =  [
-            # general 
-            "/Event#1"                 ,
-            "/Event/DAQ#1"             ,
-            "/Event/DAQ/ODIN#1"        ,
-            # event header for time decoder
-            "/Event/Rec#1"             ,
-            "/Event/Rec/Header#1"      ,
-            ## GEC counters 
-            "/Event/Counters#1"        , 
-            "/Event/Counters/Kali#1"
-            ]
-        calos = [
-            # calorimeter 
-            "/Event/Raw#1"             , 
-            "/Event/Raw/Spd#1"         ,
-            "/Event/Raw/Spd/Digits#1"  ,
-            "/Event/Raw/Prs#1"         ,
-            "/Event/Raw/Prs/Digits#1"  ,
-            "/Event/Raw/Ecal#1"        ,
-            "/Event/Raw/Ecal/Digits#1" ,
-            "/Event/Raw/Hcal#1"        ,
-            "/Event/Raw/Hcal/Digits#1" 
-            ]
-        tracks = [
-            # tracks, e.g. for electrons  
-            "/Event/Rec#1"             ,
-            "/Event/Rec/Track#1"       ,
-            "/Event/Rec/Track/Best#1"  ,
-            ] 
-        
-        if not self.getProp ( 'DestroyTES' ) :
-            calos  = [ i.replace('/Event/Raw', '/Event/Kali/Raw') for i in calos  ]
-            tracks = [ i.replace('/Event/Rec', '/Event/Kali/Rec') for i in tracks ]
-
-        item_list  = items + calos + tracks 
-        
-        writer = OutputStream (
-            'FMDST' , 
-            ItemList    = item_list ,
-            # 
-            AcceptAlgs  = self.getProp ( 'DestroyList' ) ,
-            RequireAlgs =              [ 'Destroyer'   ] ,
-            )
-
-        
-        from GaudiConf.IOHelper import IOHelper
-        ioh = IOHelper()
-
-        return ioh.outputAlgs ( self.getProp ( 'FemtoDST' ) ,
-                                writer                      ,
-                                writeFSR = False            )
-    
-                    
-    ## Apply the configuration
-    def __apply_configuration__ (self):
-        """
-        Apply the configuration:
-
-        - General CaloReconstruction settings
-        - (Optional) CaloDigit (mis)calibration
-        - Light-mode for Neutral ProtoParticle Maker
-        - Specific setting for Photon Maker
-        - KaliPi0 itself
-        - Configuration of DaVinci 
-        - FemtoDST output stream
-        - NTuples & Histos
-        
-        """
-        _log.info ( "KaliPi0Conf: Applying KaliPi0 configuration" )
-        _log.info (  self )
-
-        ## 1. General Calorimeter Reconstruction configuration 
-        self.caloConf() 
-
-        ## 2. (Optional) CaloDigit (mis)calibration 
-        misKali = self.misCali ()
-        
-        ## 3. "Light-Mode" for Neutral ProtoParticle maker
-        proto   = self.protos  ()
-        
-        ## 4. Specific settings for Photon Maker
-        photon  = self.photons ()
-        
-        ## 5. The configuration for Kali-Pi0 algorithm
-        kali    = self.kaliPi0 ()
-
-        ## 6. The general configuration of DaVinci
-        from Configurables import GaudiSequencer,DaVinciInit
-
-        kaliSeq = GaudiSequencer ( 'KaliSeq' )
-        
-        kaliSeq.MeasureTime = self.getProp ( 'MeasureTime' )
-        kaliSeq.OutputLevel = self.getProp ( 'OutputLevel' )
-
-        kaliSeq.Members = [ ]
-        
-        if not not misKali : kaliSeq.Members += misKali 
-            
-        if self.getProp ( 'RecoAll' ) : 
-            from Configurables import GlobalRecoConf
-            kaliReco = GaudiSequencer("KaliReco")
-            kaliSeq.Members += [ kaliReco ] 
-            GlobalRecoConf ( TrackTypes    = [ 'Long'] ,
-                             RecoSequencer = kaliReco  )
-
-        if self.getProp ( 'FirstPass') :
-            from Configurables import LoKi__CounterAlg as CounterAlg
-            cnt = CounterAlg( 
-                'KaliCounters'   , 
-                Location  = "Counters/Kali" , 
-                Preambulo = [ "from LoKiTracks.decorators import *"],
-                Variables = {
-                    "nSpd"          : "CONTAINS ( 'Raw/Spd/Digits' )                " ,
-                    "nVelo"         : "TrNUM    ( 'Rec/Track/Best' , TrVELO       ) " ,
-                    "nLong"         : "TrNUM    ( 'Rec/Track/Best' , TrLONG       ) " ,
-                    "nPV"           : "CONTAINS ( 'Rec/Vertex/Primary'    ) "         ,
-                    "nOT"           : "CONTAINS ( 'Raw/OT/Times'          ) "         ,
-                    "nITClusters"   : "CONTAINS ( 'Raw/IT/Clusters'       ) "         ,
-                    "nTTClusters"   : "CONTAINS ( 'Raw/TT/Clusters'       ) "         ,
-                    "nVeloClusters" : "CONTAINS ( 'Raw/Velo/Clusters'     ) "         ,
-                    "nEcalClusters" : "CONTAINS ( 'Rec/Calo/EcalClusters' ) "         ,
-                    "nEcalDigits"   : "CONTAINS ( 'Raw/Ecal/Digits'       ) "         ,
-                    }
-                )
-            kaliSeq.Members += [ cnt ] 
-
-        if not not proto   : kaliSeq.Members += [ proto  ]
-        if not not photon  : kaliSeq.Members += [ photon ]
-
-        kaliSeq.Members += [ kali ]
-
-        ## collect the actual sequence of algorithms:
-        algs = []
-        
-        if not self.getProp ( 'FirstPass') :
-            from Configurables import Kali__MakeDir
-            algs += [ Kali__MakeDir  ( 'DirMaker' ) ]
-            from Configurables import Kali__DataMove
-            algs += [ Kali__DataMove ( 'DataMove' ) ]
-            
-        algs += [ kaliSeq ]
-
-        # run 'Other' algorithms ? 
-        if self.getProp('OtherAlgs') : algs += self.getProp('OtherAlgs') 
-        
-        ## 7. Destroy TES if needed 
-        if self.getProp ( 'DestroyTES' ) or self.getProp ( 'DestroyList' ) :
-            from Configurables import Kali__Destroyer, Kali__Cloner
-            tesList = [ 'Phys/' + loc + '/Particles' for loc in self.getProp('DestroyList') ]
-
-            
-            Processor = Kali__Destroyer if self.getProp ( 'DestroyTES' ) else Kali__Cloner 
-            destroyer = Processor (
-                'Destroyer'                             ,
-                Particles = tesList                     , 
-                Destroy   = self.getProp('DestroyTES' )  
-                )
-            from Configurables import  ( SpdEnergyForTrack  ,
-                                         PrsEnergyForTrack  , 
-                                         EcalEnergyForTrack ,
-                                         HcalEnergyForTrack )
-            
-            destroyer.addTool ( SpdEnergyForTrack  , 'SpdDigits'  )
-            destroyer.addTool ( PrsEnergyForTrack  , 'PrsDigits'  )
-            destroyer.addTool ( EcalEnergyForTrack , 'EcalDigits' )
-            destroyer.addTool ( HcalEnergyForTrack , 'HcalDigits' )
-
-            destroyer.addTool ( SpdEnergyForTrack  , 'BremSpdDigits'  )
-            destroyer.addTool ( PrsEnergyForTrack  , 'BremPrsDigits'  )
-            destroyer.addTool ( EcalEnergyForTrack , 'BremEcalDigits' )
-
-            destroyer.SpdDigits      .AddNeighbours = 1   ## 3x3
-            destroyer.PrsDigits      .AddNeighbours = 2   ## 5x5 
-            destroyer.EcalDigits     .AddNeighbours = 3   ## 7x7 
-            destroyer.HcalDigits     .AddNeighbours = 1   ## 3x3 
-
-            destroyer.Digits4Track = [
-                destroyer.SpdDigits   ,
-                destroyer.PrsDigits   ,
-                destroyer.EcalDigits  ,
-                destroyer.HcalDigits  
-                ]
-            
-            destroyer.BremSpdDigits  .AddNeighbours = 2   ## 3x3
-            destroyer.BremPrsDigits  .AddNeighbours = 2   ## 5x5 
-            destroyer.BremEcalDigits .AddNeighbours = 3   ## 7x7
-            
-            destroyer.Digits4Track = [
-                destroyer.BremSpdDigits   ,
-                destroyer.BremPrsDigits   ,
-                destroyer.BremEcalDigits  
-                ]
-            
-            algs += [ destroyer ]
-            
-        if self.getProp( 'DestroyTES' ) :
-            _log.warning ( "KaliPi0: TES containers will be destroyed " )
-        else :
-            _log.warning ( "KaliPi0: TES containers will be copied    " )        
-            
-
-        from Configurables import DaVinci
-
-        # unpacking is enabled only for first pass on DST 
-        unPack = self.getProp (  'FirstPass' )
-
-        fltrs  = []
-        if self.getProp('FirstPass' ) :
-            _fltr = self.getProp('Filter')
-            if _fltr :
-                from Configurables import LoKi__VoidFilter as Filter
-                fltr = Filter ( 'KaliFilter' ,
-                                Code = _fltr )
-                fltr.Preambulo += [
-                    "from LoKiTracks.decorators  import *" , 
-                    "from LoKiCore.functions     import *"
-                    ]
-                fltrs.append(fltr)    
-                _log.warning('KaliCalo: Event Filter is used \n%s' % _fltr )
-                
-                
-        dv = DaVinci (
-            EventPreFilters = fltrs                         ,
-            UserAlgorithms  = algs                          ,
-            DataType        = self.getProp ( 'DataType'   ) ,
-            Simulation      = self.getProp ( 'Simulation' ) ,
-            EvtMax          = self.getProp ( 'EvtMax'     ) ,
-            PrintFreq       = self.getProp ( 'PrintFreq'  ) ,
-            Lumi            = False                         ,
-            EnableUnpack    = []
-            )
-        if unPack : dv.EnableUnpack = ["Reconstruction"]
-        
-        ## 7. The configuration of femtoDST
-        if self.getProp('FemtoDST'):
-            fmDST = self.fmDst()
-            from Gaudi.Configuration import ApplicationMgr 
-            
-            ApplicationMgr ( OutStream = fmDST )     
-            
-        ## 8. The configuration of NTuples & Monitoring Histograms   
-        from Gaudi.Configuration import NTupleSvc, HistogramPersistencySvc
-        output = NTupleSvc().Output
-        
-        NTupleSvc ().Output += [
-            "KALIPI0 DATAFILE='%s' TYPE='ROOT' OPT='NEW'" % self.getProp('NTuple')
-            ]
-
-        if ( self.getProp ( 'Histograms' ) ): 
-          HistogramPersistencySvc ( OutputFile = self.getProp('Histos') ) 
-
-        ## 9. the final decoration
-        from Configurables import DataOnDemandSvc
-        #dod = DataOnDemandSvc  ( Dump = True )
-        dod = DataOnDemandSvc  ( Dump = False )
-
-        ## 10. postConfig
-        if not self.getProp('FirstPass'):
-            appendPostConfigAction ( action )
-
-
-
-## =============================================================================
-## define "typical" first pass configuration  
-def firstPass ( **args ) :
-    """
-    Define ``typical'' first pass configuration
-
-    Usage:
-    
-    >>> kali = firstPass ( ..... )
-    
-    """
-    
-    kali = KaliPi0Conf (
-        ##
-        FirstPass        = True ,
-        ##
-        UseTracks        = args.pop ( 'UseTracks'        , True     ) ,
-        UseSpd           = args.pop ( 'UseSpd'           , True     ) ,
-        UsePrs           = args.pop ( 'UsePrs'           , False    ) ,
-        Mirror           = args.pop ( 'Mirror'           , True     ) , 
-        Histograms       = args.pop ( 'Histograms'       , True     ) ,
-        ##
-        Pi0VetoDeltaMass = args.pop ( 'Pi0VetoDeltaMass' ,  -1      ) ,
-        Pi0VetoChi2      = args.pop ( 'Pi0VetoChi2'      ,  -1      ) ,
-        ##
-        Filter           = args.pop ( 'Filter'           , """
-        ( 200 > monitor ( CONTAINS ( 'Raw/Spd/Digits'    ) , '#SPD'   , 1 ) ) & 
-        ( 2.  > monitor ( CONTAINS ( 'Rec/Vertex/Primary') , '#PV'    , 1 ) )
-        """ ) , ## event filter
-        **args
-        )
-    
-    return kali
-    
-## =============================================================================
-## define "typical" second pass configuration  
-def secondPass ( **args ) :
-    """
-    Define ``typical'' second pass configuration
-    
-    Usage:
-    
-    >>> kali = firstPass ( ..... )
-    
-    """
-    kali = KaliPi0Conf (
-        ##
-        FirstPass  = False ,
-        ##
-        UseTracks  = args.pop ( 'UseTracks'  , False ) ,
-        UseSpd     = args.pop ( 'UseSpd'     , False ) ,
-        UsePrs     = args.pop ( 'UsePrs'     , False ) ,
-        Mirror     = args.pop ( 'Mirror'     , True  ) , 
-        Histograms = args.pop ( 'Histograms' , True  ) ,
-        **args 
-        )
-    
-    return kali
-        
-
-# =============================================================================
-## Reset DV-init sequence. IMPORTANT: It saves a lot of CPU time!!!
-def  action ( ) :
-    """
-    Reset DV-init sequence. IMPORTANT: It saves a lot of CPU time!!!
-    """
-
-    from Gaudi.Configuration import allConfigurables
-
-    ## reser DaVinci sequences:
-    for seq in ( 'DaVinciInitSeq'      ,
-                 'DaVinciEventInitSeq' ,
-                 'DaVinviEventInitSeq' ,
-                 'MonitoringSeq'       ,
-                 'LumiSeq'             ,
-                 'IntegratorSeq'       ) : 
-        if not seq in allConfigurables : continue
-        iseq = getConfigurable ( seq )
-        if iseq and hasattr ( iseq , 'Members' ) :
-            iseq.Members = []
-            _log.warning ( 'KaliPi0Conf: Sequence %s is cleared ' % seq )
-
-## temporary solve the problem with atexit/__del__ for AppMgr 
-def _KaliAtExit_ () :
-    """
-    Temporary solve the problme with atexit/__del__ for AppMgr 
-    """
-    from GaudiPython.Bindings import _gaudi 
-    if not not _gaudi : _gaudi.exit()
-
-
-import atexit
-atexit.register ( _KaliAtExit_ )
-
-# =============================================================================
-if '__main__' == __name__ :
-    
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print '*'*120  
-    
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/Data2009Reco07.py b/Phys/KaliCalo/python/KaliCalo/Data2009Reco07.py
deleted file mode 100644
index 915a6329c..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Data2009Reco07.py
+++ /dev/null
@@ -1,65 +0,0 @@
-#-- GAUDI jobOptions generated on Thu Feb 11 16:28:46 2010
-#-- Contains event types : 
-#--   90000000 - 57 files - 381107 events - 11.26 GBytes
-
-from Gaudi.Configuration import * 
-
-EventSelector().Input   = [
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000008_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000015_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000022_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000024_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000025_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000030_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000037_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000044_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000049_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000050_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000051_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000135_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000137_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000138_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000139_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000140_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000141_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000142_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000146_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000148_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000149_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000151_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000152_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000153_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000154_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000156_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000158_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000159_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000160_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000161_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000162_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000163_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000164_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000165_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000167_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000168_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000170_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000171_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000172_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000173_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000174_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000175_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000176_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000178_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000180_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000181_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000182_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000183_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000185_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000188_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000190_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000191_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000193_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000194_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000195_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000196_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'",
-"   DATAFILE='castor://castorlhcb.cern.ch:9002//castor/cern.ch/grid/lhcb/data/2009/DST/00005842/0000/00005842_00000197_1.dst?svcClass=lhcbmdst&castorVersion=2' TYP='POOL_ROOTTREE' OPT='READ'"]
-##FileCatalog().Catalogs = [ 'xmlcatalog_file:reco07.xml' ]
diff --git a/Phys/KaliCalo/python/KaliCalo/Det.py b/Phys/KaliCalo/python/KaliCalo/Det.py
deleted file mode 100755
index 6d0d6ab4d..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Det.py
+++ /dev/null
@@ -1,88 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-## @file KaliCalo/Det.py
-#
-#  Helper script to extract list of cellIDs
-#
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date   2010-03-18
-# =============================================================================
-"""
-
-Helper script to extract list of Ecal cell IDs
-
-"""
-# =============================================================================
-__author__   = " Vanya BELYAEV Ivan.Belyaev@itep.ru   "
-__date__     = " 2010-03-18 "
-__version__  = " CVS Tag $Name: not supported by cvs2svn $, version $Revision$ "
-# =============================================================================
-from   GaudiPython.Bindings import gbl as cpp
-import CaloUtils.CellID
-LHCb          = cpp.LHCb
-DeCalorimeter = cpp.DeCalorimeter
-
-# =============================================================================
-## get DeCalorimeter
-def getCalo ( calo = '/dd/Structure/LHCb/DownstreamRegion/Ecal' ,
-              DataType = '2010' ,  **args ) :
-    """
-    Get DeCalorimeter by name
-
-    >>> name = ...              ## the name of DeCalorimeter 
-    
-    >>> calo = getCalo ( name ) ## get the calorimeter
-    
-    """
-
-    from GaudiPython.Bindings import AppMgr
-    from GaudiPython.Bindings import _gaudi
-    if not _gaudi :
-        from DaVinci.Configuration import DaVinci
-        dv = DaVinci ( DataType = DataType , **args )
-        g = AppMgr()
-        g.initialize() 
-    
-    gaudi   = AppMgr()
-    detSvc  = gaudi.detSvc()
-    return detSvc[ calo ] 
-
-    
-# =============================================================================
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print '*'*120  
-
-
-    ecal = getCalo()
-
-    cp = ecal.cellParams()
-
-    cells = []
-
-    for p in cp :
-        cell = p.cellID()
-        if ecal.valid ( cell ) and not cell.isPin() :
-            cells.append ( cell )
-
-    cells.sort()
-    
-    import KaliCalo.ZipShelve as ZipShelve
-    dbase = ZipShelve.open( 'ecal_db.gz' )
-    dbase ['AllEcalCells'] = cells
-    dbase.close()
-
-    
-    
-    
-# =============================================================================
-# The END 
-# =============================================================================
-
-
diff --git a/Phys/KaliCalo/python/KaliCalo/FakeCells.py b/Phys/KaliCalo/python/KaliCalo/FakeCells.py
deleted file mode 100644
index 3540d7758..000000000
--- a/Phys/KaliCalo/python/KaliCalo/FakeCells.py
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/usr/bin/env python
-# ======================================================================
-## @file KaliCalo/Kali.py
-#  'fake-cells' for grouping
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-04-28
-# ======================================================================
-"""
-``Fake-cells'' for grouping
-"""
-# ======================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__    = " 2010-04-28 "
-__version__ = " CVS tag $Name: not supported by cvs2svn $ , version $Revision$ "
-# ======================================================================
-from KaliCalo.Cells import CellID, GlobalRow, GlobalCol
-import math
-# ======================================================================
-## the simplest 'cell-func'
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-04-28
-class SameCell(object) :
-    """
-    The simplest 'cell-func'
-    """
-    def __call__ ( self , cell ) : return CellID ( cell ) 
-
-
-# =============================================================================
-## "Ring"-zones 
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-04-28
-class Rings(object) :
-    """
-    'Ring' zones 
-    """
-    def __call__ ( self , cell ) :
-        i  = cell.row()
-        j  = cell.col()
-        i -= 31.5 
-        j -= 31.5
-        
-        row  = int ( math.sqrt ( i*i + j*j ) ) + 1 
-        k1   =  0 if  ( 0 > i ) else 1
-        k2   =  0 if  ( 0 > j ) else 2
-        
-        col  =  1 + k1 + k2
-        
-        if row == GlobalRow and col == GlobalCol : 
-            col += 4 
-        
-        return CellID ( cell.calo() ,
-                        cell.area() ,
-                        row , col   ) 
-
-# =============================================================================
-## "Rectangular rings"
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-04-28
-class RectRings( object ) :
-    """
-    'Rectangular ring' zones 
-    """
-    def __call__ ( self , cell ) :
-
-        k1 = 0
-        k2 = 0
-        k3 = 0
-        i  = cell.row()
-        j  = cell.col()
-
-        
-        if 32 <= i :
-            i -= 32
-            k1 =  1
-        else : i = 32 - i
-        
-        if 32 <= j :
-            j -= 32
-            k2 =  2 
-        else : j = 32 - i 
-            
-        newrow = max ( i , j )
-        
-        if i < j and newrow > 16 : k3 = 4
-
-        row = 1 + newrow
-        col = 1 + k1 + k2 + k3
-        
-        if row == GlobalRow and col == GlobalCol : 
-            col += 8
-                
-        return CellID ( cell.calo() ,
-                        cell.area() ,
-                        row ,
-                        col ) 
-
-
-class IndividualCells (object):
-    """
-    To calibrate only a limited number of cells
-    """
-    def __init__ (self, cellslist):
-        self._cellslist = cellslist
-        
-    def __call__ (self, cell):
-        ## if a cell is in the list of cells to be calibrated
-        ## just return its address as it is
-        if cell in self._cellslist: return CellID(cell.calo(),
-                                                  cell.area(),
-                                                  cell.row(),
-                                                  cell.col())
-        ## else, return a fake cell address (same for all
-        ## cells not in the list)
-        else:
-            self._cellslist.sort()
-            for cl in self._cellslist:
-                fcl = CellID(cl.calo(),cl.area(),cl.row()+5,cl.col()+5)
-                if not fcl in self._cellslist: break
-            return fcl
-        
-# =============================================================================
-## "JacquesCells"
-#  @author Daria SAVRINA Daria.Savrina@cern.ch 
-#  @date 2011-08-08
-class JacquesCells( object ) :
-    """
-    Zones defined by Jacque for ageing compensation
-    """
-    def __call__ ( self , cell ) :
-
-        i  = cell.row()   
-        j  = cell.col()
-        a  = cell.area()
-            
-        ## Inner
-        if a == 2:
-            col = 1
-            row = int(i-14)/12
-                           
-        ## Middle
-        if a == 1:
-            col = j - 31.5
-            row = i - 32
-
-            col = abs(col)       ## symmetric
-            col = int(col)/16    ## 4 groups
-
-            row = int(row)/12      ## 4 groups
-            row = row+2
-            
-        ## Outer
-        if a == 0:
-            col = j - 31.5
-            row = i - 31.5 
-        
-            col = abs(col)
-            col = int(col)/8
-        
-            if abs(row) < 10: row = math.copysign(1,row)
-            else: row = math.copysign(2,row)
-            row = int(row+2)
-    
-        return CellID ( cell.calo() ,
-                        a ,
-                        row ,
-                        col )
-
-# =============================================================================
-## "Global Calo"
-#  @author Albert PUIG (albert.puig@cern.ch)
-#  @date 2011-08-25
-class GlobalCalo( object ) :
-    """
-    Return one cell for the whole calorimeter
-    """
-    def __call__ ( self , cell ) :
-        return CellID ( 'Ecal' , 'PinArea', GlobalRow , GlobalCol )
-
-# =============================================================================
-## "Calo Area"
-#  @author Albert PUIG (albert.puig@cern.ch)
-#  @date 2011-08-25
-class CaloArea( object ) :
-    """
-    Return one cell per zone
-    """
-    def __call__ ( self , cell ) :
-      a  = cell.area()
-      if 2 == a:
-          cellID  = CellID ( 'Ecal' , 'Inner'  , GlobalRow , GlobalCol ) ## inner  zone only 
-      elif 1 == a:
-          cellID = CellID ( 'Ecal' , 'Middle' , GlobalRow , GlobalCol ) ## middle zone only 
-      elif 0 == a:
-          cellID  = CellID ( 'Ecal' , 'Outer'  , GlobalRow , GlobalCol ) ## Outer  zone only
-      return cellID
-
-
-# =============================================================================
-## ``Un-group'' the cells
-# @param calib the map of claibration coefficientf for ``grouped'' cells
-# @param fakeCell the grouping function
-# @param ecalCells the fulllist of Eca cells
-# @return the calibration map for ``un-grouped'' cells
-def unGroup ( calib , fakeCell , ecalCells ) :
-    """
-    ``Un-group'' the cells
-    """
-    result = {}
-    for cell in ecalCells :
-
-        ## get the group (``fake cell'') 
-        fCell = fakeCell ( cell  )
-        
-        if calib.has_key ( fCell ) :
-            result[ cell ] = calib[ fCell ]
-
-    return result 
-    
-# =============================================================================
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print ' dir(%s) : %s ' % ( __name__    , dir() )
-    print '*'*120  
-          
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/FitUtils.py b/Phys/KaliCalo/python/KaliCalo/FitUtils.py
deleted file mode 100644
index 6b865d88f..000000000
--- a/Phys/KaliCalo/python/KaliCalo/FitUtils.py
+++ /dev/null
@@ -1,751 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FitUtils.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @reshuffled from Vanya Belyaev's Pi0HistoFit.py
-# @date 2010-11-13
-# =============================================================================
-"""A module for helping with the fitting of histograms with pi0-mass"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-# =============================================================================
-from ROOT  import TH1F, TF1
-from math  import sqrt, pi,exp
-from array import array
-
-
-## few helper math utilities 
-import LHCbMath.Types
-import GaudiPython.HistoUtils 
-import KaliCalo.Kali as Kali
-
-VE      = Kali.VE 
-pi0Mass = Kali.pi0Mass
-
-# =============================================================================
-## The function to fit pi0-mass distribution
-class Pi0Fit:
-    """
-    The function to fit pi0-mass distribution
-    """
-    ## Set the proper normalization 
-    def __init__ ( self ) :
-        """
-        Set the proper normalization 
-        """
-        self.norm = sqrt(2.0*pi) 
-
-    def __call__ ( self , x , par ) :
-
-        num   = float ( abs ( par[0] ) )
-        num   = abs   ( num    ) 
-        m0    = float ( par[1] )
-        sigma = float ( par[2] )
-
-        x0    = float ( x[0] ) 
-
-        dm      = ( x0 - m0 ) / sigma 
-        signal  = num/self.norm/sigma*exp(-0.5*dm*dm)
-
-        bck   = abs ( float ( par[3] ) ) 
-        slope =       float ( par[4] )
-        curv  =       float ( par[5] )
-        dm0   = x0 - pi0Mass
-        
-        background  = bck * ( 1.  + slope * dm0 * ( 1.0 + curv * dm0 )  ) 
-        background *= sqrt ( x0 / pi0Mass ) 
-        
-        return signal + background 
-
-pi0Func = TF1('Pi0Fit', Pi0Fit() , 0.0 , 250.0 , 6 )
-
-# =============================================================================
-## The function to fit subtracted pi0-mass distribution
-class Pi0FitSubtracted:
-    """
-    The function to fit subtracted pi0-mass distribution
-    """
-    ## Set the proper normalization 
-    def __init__ ( self ) :
-        """
-        Set the proper normalization 
-        """
-        self.norm = sqrt(2.0*pi) 
-
-    def __call__ ( self , x , par ) :
-
-        num   = float ( abs ( par[0] ) )
-        num   = abs   ( num    ) 
-        m0    = float ( par[1] )
-        sigma = float ( par[2] )
-
-        x0    = float ( x[0] ) 
-
-        dm      = ( x0 - m0 ) / sigma 
-        signal  = num/self.norm/sigma*exp(-0.5*dm*dm)
-
-        bck   = abs ( float ( par[3] ) ) 
-        slope =       float ( par[4] )
-        curv  =       0 # No curvature
-        dm0   = x0 - pi0Mass
-        
-        background  = bck * ( 1.  + slope * dm0 * ( 1.0 + curv * dm0 )  ) 
-        background *= sqrt ( x0 / pi0Mass ) 
-        
-        return signal + background 
-        
-pi0SubtractedFunc = TF1('Pi0FitSubtracted', Pi0FitSubtracted() , 0.0 , 250.0 , 6 )
-
-for func in [ pi0Func , pi0SubtractedFunc ]:
-    func.SetParNames  (
-        "N_{#pi^{0}}"      ,
-        "m_{#pi^{0}}"      ,
-        "#sigma_{#pi^{0}}" ,
-        "Background"       ,
-        "Slope"            ,
-        "Curvature"  
-        )  
-
-    func.SetParameter ( 0 , 100 )
-    func.SetParameter ( 1 , pi0Mass )
-    func.SetParameter ( 2 ,  10 )
-    func.SetParameter ( 3 ,  10 )
-    func.SetParameter ( 4 ,   0 )
-    func.SetParameter ( 5 ,   0 )
-
-
-## ============================================================================
-## initialize parameters 
-_low    =  50.000
-_high   = 240.000
-_mass0  = pi0Mass
-_sigma0 =  13.001
-_slope0 =   0.001 
-_curve0 =   0.000
-
-_good_l   = 120 
-_good_r   = 150 
-_weight_s = 0.4
-_weight_b = 1.0 - _weight_s
-
-_low_sigma  =   5.2
-_high_sigma =  20.0
-_low_mass   = 120.0 
-_high_mass  = 150.0 
-
-## ============================================================================
-## get the fitted pi0 parameters 
-def getPi0Params ( histo ) :
-    """
-    Get the fitted pi0 parameters 
-    """
-    if not hasattr ( histo , 'GetFunction' ) :
-        if hasattr ( histo , 'toROOT' ) :
-            histo = histo.toROOT()
-            return getPi0Params ( histo )
-        
-    _func = histo.GetFunction('Pi0Fit')
-    if not _func :
-        _func = histo.GetFunction('Pi0FitSubtracted')
-        if not _func :
-            return None
-    
-    return ( VE ( _func.GetParameter ( 0 ) , _func.GetParError ( 0 ) ** 2 ) ,
-             VE ( _func.GetParameter ( 1 ) , _func.GetParError ( 1 ) ** 2 ) ,
-             VE ( _func.GetParameter ( 2 ) , _func.GetParError ( 2 ) ** 2 ) , 
-             VE ( _func.GetParameter ( 3 ) , _func.GetParError ( 3 ) ** 2 ) , 
-             VE ( _func.GetParameter ( 4 ) , _func.GetParError ( 4 ) ** 2 ) , 
-             VE ( _func.GetParameter ( 5 ) , _func.GetParError ( 5 ) ** 2 ) ) 
-
-
-# =============================================================================
-## simple check if the parameter is fixed 
-def isFixed ( func , par ) :
-    """
-    Simple check if the parametr is fixed
-    """
-    pare = func.GetParError( par )
-    return True if 0 == pare else False
-    
-# =============================================================================
-## adjust parameters 0, 2 &  3 
-def adjust03 ( func ) :
-    """
-    adjust parameters 0 & 3
-    """
-    par0 = func.GetParameter( 0 )
-    if 0 > par0 : func.SetParameter ( 0 , abs ( par0 ) )
-    par2 = func.GetParameter( 2 )
-    if 0 > par2 : func.SetParameter ( 2 , abs ( par2 ) )
-    par3 = func.GetParameter( 3 )
-    if 0 > par3 : func.SetParameter ( 3 , abs ( par3 ) )
-
-# =============================================================================
-## adjust parameters 1 , 2  
-def adjust12 ( func , mass , sigma , fixMass = False , fixSigma = False ) :
-    """
-    adjust parameters 1 & 2
-    """
-    sigma = abs ( sigma )
-
-    par1  = func.GetParameter( 1 )
-    par1  = abs  ( par1  )
-
-    par1  = min  ( par1  , _high_mass )
-    par1  = max  ( par1  , _low_mass  )
-
-    if fixMass : func.FixParameter ( 1 , par1 )
-    else       : func.SetParameter ( 1 , par1 )
-
-    par2  = func.GetParameter( 2 )
-    par2  = abs  ( par2  )
-
-    par2  = min  ( par2  , _high_sigma )
-    par2  = max  ( par2  , _low_sigma  )
-
-    if fixSigma : func.FixParameter ( 2 , par2 )
-    else        : func.SetParameter ( 2 , par2 )
-
-    return par1,par2 
-
-# =============================================================================
-## good sigma ? 
-def goodSigma ( sigma ) :
-    """ Good sigma ? """
-    return _low_sigma <= sigma <= _high_sigma
-# =============================================================================
-## good mass? 
-def goodMass  ( mass  ) :
-    """ Good mass? """
-    return _low_mass <= mass   <= _high_mass
-
-# =============================================================================
-## get the histo integral 
-def sumHisto ( histo , iL = -2**64 , iH = 2**64 ) :
-    """
-    Get the histo integral
-    """
-    sum  = 0 
-    for iB in range ( 1 , min ( iH + 1 , histo.GetNbinsX() + 1 ) ) :
-        if iL <= iB <= iH :
-            sum += histo.GetBinContent( iB )
-    return sum 
-
-# ==============================================================================
-## get fraction of bins with 'small' content 
-def smallBins ( histo , limit = 6 , low = _low , high = _high )  :
-    """
-    get fractions of bins with 'small' content
-    """
-    n0 = 0
-    nb = 0
-    nbins = histo.GetNbinsX() 
-    for iB in range ( 1 , nbins + 1 ) :
-        c = histo.GetBinContent ( iB )
-        v = histo.GetBinCenter  ( iB ) 
-        if not low <= v <= high : continue 
-        nb +=1 
-        if c < limit : n0 += 1
-
-    nb = max ( nb , 1 ) 
-    return float(n0)/nb
-
-
-# =============================================================================
-# get ``signal-to-backgrund'' ratio
-def s2b ( histo , r = 2.5 ) :
-    """
-    get ``signal-to-background'' ratio in +-2.5 sigma interga
-    """
-    ## AIDA ??
-    if hasattr ( histo , 'toROOT' ) : return s2b ( histo.toROOT() , r )
-    #
-    par = getPi0Params ( histo )
-    #
-    m = par[1].value()
-    s = par[2].value()
-    r = abs ( r )
-    #
-    iL     = histo.FindBin ( m - r * s )
-    iR     = histo.FindBin ( m + r * s )
-    #
-    return par[0]/(par[3]*(iR-iL+1))
-
-# =============================================================================
-## bad parameters ? 
-def badParam ( mass  , sigma , num , corr ) :
-    """
-    Bad parameters ?
-    """
-
-    # bad mass ?
-    if 20 < abs ( mass.value() - pi0Mass ) : return True
-
-    # bad sigma?
-    if not 5 <= sigma.value() < 20         : return True
-
-    # bad number ?
-    if  num.value() < 25                   : return True
-
-    # bad number ?
-    if  num.value() / num.error () < 3.5   : return True
-
-    # bad precision ?
-    if not 0.00001 < corr.error() <= 0.05  : return True
-
-    return False
-
-## ============================================================================
-## pre-fit background histogram 
-def _preFitBkg ( func , histo , background = None , options = ''  ) :
-    """
-    pre-fit background histogram
-    """
-
-    if not hasattr ( histo , 'Fit' ) :
-        if hasattr ( histo , 'toROOT' ) :
-            histo = histo.toROOT()
-            return _preFitBkg  ( func , histo , background )
-        
-    if background :
-        if hasattr ( background , 'toROOT' ) :
-            background = background.toROOT()
-            return _preFitBkg  ( func , histo , background )
-
-    opts = '0QS'
-    if 0.20 < smallBins ( histo ) : opts += 'L'
-    
-    entries = histo.GetEntries()
-    
-    func.FixParameter ( 0 , 0       )
-    func.FixParameter ( 1 , _mass0  )
-    func.FixParameter ( 2 , _sigma0 )
-    ##
-    func.ReleaseParameter(3)
-    func.ReleaseParameter(4) 
-    func.ReleaseParameter(5)
-    ##
-    slope0 = _slope0
-    curve0 = _curve0 
-    if background and 50 < sumHisto ( background ) : 
-        b = getPi0Params ( background )
-        if b : 
-            slope0 = b[4].value()
-            curve0 = b[5].value()
-    ##
-    if entries < 20 :        
-        func.FixParameter ( 4 , slope0 )
-        func.FixParameter ( 5 , curve0 )
-    else :
-        func.SetParameter ( 4 , slope0 )
-        func.SetParameter ( 5 , curve0 )
-    
-    ##
-    iL     = histo.FindBin ( _mass0 - 3.0 * _sigma0 )
-    iR     = histo.FindBin ( _mass0 + 3.0 * _sigma0 )
-    backg0 = 0.5 *  abs ( histo.GetBinContent ( iL ) +
-                          histo.GetBinContent ( iR ) )
-    
-    nFit = 0 
-    ##
-    func.SetParameter ( 3 , backg0 )
-    st = histo.Fit( func, opts ,'',_low,_high)
-    nFit += 1 
-    if 0 != st.Status() and not isFixed ( func , 5 ) : 
-        func.FixParameter ( 5 , curve0 ) 
-        func.SetParameter ( 3 , backg0 )
-        adjust03 ( func ) 
-        st = histo.Fit( func, opts ,'',_low,_high)
-        nFit += 1 
-    if 0 != st.Status() and not isFixed ( func , 4  ) : 
-        func.FixParameter ( 4 , slope0 ) 
-        func.SetParameter ( 3 , backg0 )
-        adjust03 ( func ) 
-        st = histo.Fit ( func, opts ,'',_low,_high )        
-        nFit += 1 
-    if 0 != st.Status() :
-        pars = getPi0Params  ( histo )
-        print 'BACKGROUND: backg =%20s slope=%20s curve=%20s %8d %25s ' % (
-            pars[3] ,
-            pars[4] ,
-            pars[5] ,
-            int ( histo.GetEntries ( ) ) , 
-            histo.GetName  () 
-            )
-    if options :
-        adjust03 ( func ) 
-        st = histo.Fit ( func, opts.replace('0','').replace('Q','') + options ,'',_low,_high )
-        nFit += 1 
-            
-    ##
-    func.ReleaseParameter(3)
-    func.ReleaseParameter(4) 
-    func.ReleaseParameter(5)
-    
-    histo.GetFunction( func.GetName() ).ResetBit( 1<<9 )
-        
-    return  0 == st.Status() , nFit  
-
-# =============================================================================
-## pre-fit background histogram 
-def fitBkg ( func , histo , background = None , options = ''  ) :
-    """
-    Fit background histogram
-    """
-    return _preFitBkg ( func       ,
-                        histo      ,
-                        background ,
-                        options    ) 
-
-# =============================================================================
-## pre-fit signal histogram 
-def _preFitSignal ( func              ,
-                    histo             ,
-                    background = None ,
-                    signal     = None ,
-                    options    = ''   ) :
-    """
-    pre-fit signal histogram
-    """
-    if not hasattr ( histo , 'Fit' ) :
-        if hasattr ( histo , 'toROOT' ) :
-            histo = histo.toROOT()
-            return _preFitSignal  ( func , histo , background , signal )
-        
-    if background :
-        if hasattr ( background , 'toROOT' ) :
-            background = background.toROOT()
-            return _preFitSignal  ( func , histo , background , signal )
-        
-    if signal     : 
-        if hasattr ( signal , 'toROOT' ) :
-            signal = signal.toROOT()
-            return _preFitSignal  ( func , histo , background , signal )
-    
-    func.ReleaseParameter ( 0 )
-    func.ReleaseParameter ( 1 )
-    func.ReleaseParameter ( 2 )
-    func.ReleaseParameter ( 3 )
-    func.ReleaseParameter ( 4 )
-    func.ReleaseParameter ( 5 )
-    ##
-    num0   = 100 
-    mass0  = _mass0 
-    sigma0 = _sigma0
-    
-    iL     = histo.FindBin ( mass0 - 3.0 * sigma0 )
-    iR     = histo.FindBin ( mass0 + 3.0 * sigma0 )
-    backg0 = 0.5 *  abs ( histo.GetBinContent ( iL ) +
-                          histo.GetBinContent ( iR ) )  
-
-    num0  = sumHisto ( histo , iL , iR ) - backg0 * ( iR - iL + 1 ) 
-    num0  = abs ( num0 )
-
-    opts = '0QS'
-    if 0.20 < smallBins ( histo ) : opts += 'L'
-
-    slope0 = _slope0 
-    curve0 = _curve0
-
-    if signal and background :
-
-        
-        s = getPi0Params ( signal     )
-        b = getPi0Params ( background )
-
-        if s and b :
-            mass0   = s[1].value()
-            sigma0  = s[2].value()
-            slope0  = s[4].mean(b[4]).value() 
-            curve0  = s[5].mean(b[5]).value() 
-        elif s : 
-            mass0   = s[1].value()
-            sigma0  = s[2].value()
-            slope0  = s[4].value() 
-            curve0  = s[5].value()
-        elif b : 
-            slope0  = b[4].value() 
-            curve0  = b[5].value()
-        
-    elif signal and 50 < sumHisto ( signal ) :
-        
-        s = getPi0Params( signal )
-        mass0   = s[1] . value ()
-        sigma0  = s[2] . value ()
-        slope0  = s[4] . value ()
-        curve0  = s[5] . value ()
-        
-    elif  background and 50 < sumHisto ( background ) :
-        
-        b = getPi0Params ( background )
-        if b : 
-            slope0  = b[4] . value () 
-            curve0  = b[5] . value () 
-
-    if not 7   <= sigma0 <=  20 : sigma0 = _sigma0
-    if not 0   <= backg0        : backg0 = 0.0
-    if not 120 <= mass0  <= 150 : mass0  = _mass0 
-    
-    ## number of fits
-    nFit = 0 
-    ##     
-    func.SetParameter ( 0 , num0   )
-    
-    ## 1. fix signal & background
-    func.FixParameter ( 1 , mass0  )
-    func.FixParameter ( 2 , sigma0 )
-    func.FixParameter ( 4 , slope0 )
-    func.FixParameter ( 5 , curve0 )
-    st    = histo.Fit ( func, opts ,'', _low , _high )
-    nFit += 1 
-    ## 2. Release signal parameter 
-    func.ReleaseParameter ( 1 )
-    func.ReleaseParameter ( 2 )
-    ## adjust 
-    adjust03 ( func )
-    st    = histo.Fit ( func, opts ,'', _low , _high )
-    nFit += 1 
-    if 0 != st.Status() and not isFixed ( func , 2 )  : 
-        adjust12 ( func , mass0 , sigma0 ) 
-        func.FixParameter ( 2 , sigma0 )
-        adjust03 ( func ) 
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1 
-    ##
-    ## adjust 
-    adjust12 ( func , mass0 , sigma0 ) 
-    adjust03 ( func ) 
-    st = histo.Fit ( func, opts ,'', _low , _high )
-    nFit += 1 
-    ##
-    ## 3. fix the signal and fit for background 
-    mass1  = func.GetParameter ( 1 )
-    sigma1 = func.GetParameter ( 2 )
-    ## adjustment 
-    mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-    ##    
-    func.FixParameter ( 1 , mass1  )
-    func.FixParameter ( 2 , sigma1 )
-    func.ReleaseParameter ( 4 ) 
-    func.ReleaseParameter ( 5 )
-    ## adjust
-    adjust03 ( func ) 
-    st = histo.Fit ( func, opts ,'', _low , _high )
-    nFit += 1    
-    if 0 != st.Status() and not isFixed ( func , 5 )  : 
-        func.FixParameter ( 5 , curve0 )
-        adjust03 ( func ) 
-        mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-    if 0 != st.Status() and not isFixed ( func , 4 ) :
-        func.FixParameter ( 4 , slope0 )
-        mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-        adjust03 ( func ) 
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1 
-    ##
-    slope1 =  func.GetParameter ( 4 )
-    curve1 =  func.GetParameter ( 5 )
-    ##
-    func.ReleaseParameter ( 1 )
-    func.ReleaseParameter ( 2 )
-    func.FixParameter ( 4 , slope1 )
-    func.FixParameter ( 5 , curve1  )
-    ##
-    mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-    adjust03 ( func )
-    ##
-    ## 4. fit it!
-    st = histo.Fit ( func, opts ,'', _low , _high )
-    nFit += 1 
-    if 0 == st.Status() :
-        adjust03 ( func ) 
-        mass_x,sigma_x = adjust12 ( func , mass0 , sigma0 ) 
-        func.ReleaseParameter ( 4 )
-        func.ReleaseParameter ( 5 )
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-    if 0 != st.Status() and not isFixed ( func , 5 ) : 
-        func.FixParameter ( 5 , curve1 )
-        mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-        adjust03 ( func ) 
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-    if 0 != st.Status() and not isFixed ( func , 4 ) : 
-        func.FixParameter ( 4 , slope1 )
-        mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-        adjust03 ( func ) 
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-    ##
-    par0 = func.GetParameter ( 0 ) 
-    if abs ( par0 ) > histo.GetEntries () :
-        func.SetParameter ( 0 , histo.GetEntries() ) 
-        func.SetParameter ( 3 , backg0 ) 
-        func.SetParameter ( 1 , mass1  )
-        if not isFixed ( func , 4 ) : func.FixParameter ( 4 , slope0 )
-        if not isFixed ( func , 5 ) : func.FixParameter ( 5 , curve0 )
-        mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-        adjust03 ( func ) 
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-    ##
-    if 0 != st.Status () : 
-        mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-        adjust03 ( func ) 
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1 
-    ##
-    if 0 != st.Status() and not isFixed ( func , 5 ) : 
-        func.FixParameter ( 5 , curve1 ) 
-        mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-        adjust03 ( func ) 
-        func.SetParameter( 1 , mass0 )
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1 
-    if  0 != st.Status() and not isFixed ( func , 4 ) :
-        func.FixParameter ( 4 , slope1 ) 
-        mass1,sigma1 = adjust12 ( func , mass0 , sigma0 ) 
-        adjust03 ( func ) 
-        func.SetParameter( 1 , mass0 )
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1 
-        
-##     if 0 != st.Status () :
-##         if background :
-##             b = getPi0Params( background )
-##             if not b :
-##                 ok, nfitsb = fitBkg ( func , background )
-##                 nFit += nfitsb 
-##                 if ok  :
-##                     ok , nfits2 = _preFitSignal ( func       ,
-##                                                   histo      ,
-##                                                   background ,
-##                                                   signal     ,
-##                                                   options    )
-##                     nFits += nfits2
-##                     if ok : return ok , nFits 
-
-    ## the last adjustment: sigma and width
-    if 0 != st.Status() or not goodSigma ( func.GetParameter ( 2 ) ) : 
-        mass1 , sigma1 = adjust12 ( func , mass0 , sigma0 , fixSigma = True )
-        adjust03 ( func ) 
-        func.SetParameter( 1 , mass0 )        
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-
-    if 0 != st.Status() or not goodSigma ( func.GetParameter ( 2 ) ) : 
-        mass1 , sigma1 = adjust12 ( func , mass0 , sigma0 , fixMass = True )
-        if not isFixed ( func , 2 ) : func.FixParameter ( 2 , sigma1 ) 
-        if not isFixed ( func , 4 ) : func.FixParameter ( 4 , slope0 ) 
-        if not isFixed ( func , 5 ) : func.FixParameter ( 5 , curve0 )
-        adjust03 ( func )
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-        func.ReleaseParameter ( 1 )        
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-            
-    ## the really last adjustment: adjust everything ...
-    if 0 != st.Status() or not goodSigma ( func.GetParameter ( 2 ) ) : 
-        mass1 , sigma1 = adjust12 ( func , mass0 , sigma0 , fixSigma = True )
-        adjust03 ( func ) 
-        if not isFixed ( func , 3 ) : func.FixParameter ( 3 , backg0 ) 
-        if not isFixed ( func , 4 ) : func.FixParameter ( 4 , slope0 ) 
-        if not isFixed ( func , 5 ) : func.FixParameter ( 5 , curve0 )
-        func.FixParameter ( 2 , sigma0 )        
-        func.SetParameter ( 1 , mass0  )        
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-
-    ## the really last adjustment: adjust everything ... 
-    if 0 != st.Status() or not goodSigma ( func.GetParameter ( 2 ) ) : 
-        func.FixParameter ( 2 , _sigma0 )
-        func.SetParameter ( 1 ,   mass0 )
-        st = histo.Fit ( func, opts ,'', _low , _high )
-        nFit += 1
-        
-    if 0 != st.Status() : 
-        pars = getPi0Params  ( histo )
-        print 'SIGNAL    : signal=%20s mass =%20s sigma=%20s %8d %25s ' % (
-            pars[0] ,
-            pars[1] ,
-            pars[2] ,
-            int ( histo.GetEntries () ) , 
-            histo.GetName  () 
-            )
-        print 'SIGNAL    : backgr=%20s slope=%20s curve=%20s ' % (
-            pars[3] ,
-            pars[4] ,
-            pars[5] )
-        print 'SIGNAL    : backgr=%20s slope=%20s curve=%20s ' % (
-            backg0  ,
-            slope0  ,
-            curve0  )
-        print ' FIXED?   : ' , ( isFixed ( func , 0 ) ,
-                                 isFixed ( func , 1 ) ,
-                                 isFixed ( func , 2 ) ,
-                                 isFixed ( func , 3 ) ,
-                                 isFixed ( func , 4 ) ,
-                                 isFixed ( func , 5 ) )
-                               
-    if options :
-        adjust03 ( func ) 
-        st = histo.Fit ( func, opts.replace('0','').replace('Q','') + options ,'', _low , _high )
-        nFit += 1 
-
-    histo.GetFunction( func.GetName() ).ResetBit( 1<<9 )
-
-    return  0 == st.Status() , nFit 
-
-# =============================================================================
-## Fit signal histogram 
-def fitSignal ( func  ,
-                histo ,
-                background = None ,
-                signal     = None ,
-                options    = ''   ) :
-    """
-    Fit signal histogram
-    """
-    return _preFitSignal ( func       ,
-                           histo      ,
-                           background ,
-                           signal     ,
-                           options    )
-
-## ============================================================================
-## Fit signal histogram
-def fitPi0 ( histo ,
-             background = None ,
-             signal     = None ,
-             options    = ''   ) :
-    """
-    Fit signal histogram
-    """
-    _func = pi0Func
-    
-    return fitSignal ( _func , histo , background , signal , options ) 
-    
-
-# =============================================================================
-## check if the fit results are ``reasonable''
-def checkHisto ( histo ) :
-    """
-    check if the fit results are ``reasonable''
-    """
-
-    pars = getPi0Params ( histo )
-    if pars[0].value() > histo.GetEntries()     : return False
-    if pars[1].value() > _mass0 + 2.5 * _sigma0 : return False
-    if pars[1].value() < _mass0 - 2.5 * _sigma0 : return False
-    if pars[2].value() > _high_sigma            : return False
-    if pars[2].value() < _low_sigma             : return False
-    ##
-    return True
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/Kali/FillSelectorBase.py b/Phys/KaliCalo/python/KaliCalo/Kali/FillSelectorBase.py
deleted file mode 100644
index 297c41b87..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Kali/FillSelectorBase.py
+++ /dev/null
@@ -1,184 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FillSelectorBase.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @based on Vanya Belyaev's Pi0FillHistos.py
-# @date 2010-11-03
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-import copy
-
-from GaudiKernel.SystemOfUnits import MeV 
-from GaudiPython.Bindings import gbl as cpp
-
-from KaliCalo.Kali.HistoBase import HistoMapBase
-from  KaliCalo.Utils         import RootFile 
-
-import KaliCalo.Cells     as Cells
-import KaliCalo.FakeCells as FakeCells
-
-TPySelectorFix = cpp.Kali_TPySelectorFix
-
-# =============================================================================
-## ROOT 'selector' for filling the histograms
-class FillPi0Base( TPySelectorFix  ):
-    """
-    ROOT selector for filling the histograms
-    """
-
-    ## constructor form histogram map and map of coefficients
-    #  @param histos   the map of histograms
-    #  @param lambdas  the map of calibration coefficients
-    #  @param cellFunc the function used for grouping the cells
-    def __init__ ( self                             ,
-                   histos                           ,
-                   lambdas                          ,
-                   cellFunc = FakeCells.SameCell () ,
-                   betas    = [ 7.92 , 10.06 , 10.23 ]   ,
-                   Unit     = MeV                   ) :  
-        
-        TPySelectorFix.__init__ ( self , None , self ) ## initialize the base 
-        self._histos  = histos  ## the histogram map
-        self._lambdas = lambdas ## the map of coefficients
-
-        self._global     = self._histos [ Cells.EcalZone   ]
-        self._inner      = self._histos [ Cells.InnerZone  ]
-        self._middle     = self._histos [ Cells.MiddleZone ]
-        self._outer      = self._histos [ Cells.OuterZone  ]
-        self._cellFunc   = cellFunc
-        self._betas      = copy.deepcopy ( betas )
-        self._Unit       = Unit
-        self._frequency  = 0
-        self._background = histos._background 
-        self._print('__init__')
-        
-        self._gRow      = Cells.GlobalRow
-        self._gCol      = Cells.GlobalCol
-        
-    def _print ( self , phase ) :
-        print 'py: Phase(%-16s) : %9d %9d %9d %s' % (
-            phase                          ,
-            len ( self._histos           ) ,
-            len ( self._lambdas          ) ,
-            self._histos.entries()         ,
-            self._global.entries()
-            )
-
-    ## get all coefficients 
-    def lambdas  ( self ) :
-        return self._lambdas 
-
-    ## get all histograms 
-    def histos  ( self ) :
-        return self._histos  
-
-    ## the major method: processing of the tree
-    def Process        ( self, entry ) : raise NotImplementedError ( "Kali.FillPi0 cannot be used directly" )
-    def Begin          ( self        ) : self._print ( 'Begin'          ) 
-    def SlaveBegin     ( self, tree  ) : self._print ( 'SlaveBegin'     ) 
-    def SlaveTerminate ( self        ) : self._print ( 'SlaveTerminate' )
-    def Terminate      ( self        ) : self._print ( 'Terminate'      )
-
-class FillDatabase(object):
-    def __init__(self, FillSelector, HistoMapClass):
-        if not issubclass( FillSelector , FillPi0Base ):
-            raise Exception ( "Specified Fill Selector is not a subclass of FillPi0" )
-        self._FillSelector  = FillSelector
-        if not issubclass( HistoMapClass , HistoMapBase ):
-            raise Exception ( "Specified HistoMap class is not a subclass of Kali.HistoMapBase" )
-        self._HistoMapClass = HistoMapClass
-
-    ## ============================================================================
-    ## fill data base with histos and lambdas   
-    def __call__( self,
-                  lambdas                             , 
-                  file_names                          ,
-                  tree_name   = "KaliPi0/Pi0-Tuple"   ,
-                  dbase_name  = 'kali_db.gz'          ,
-                  cellFunc    = FakeCells.SameCell () ,
-                  Unit        = MeV                   ) :
-
-        """
-        Fill data base with histos and lambdas
-        """
-        FillSelector  = self._FillSelector
-        HistoMapClass = self._HistoMapClass
-
-        ## check files
-        if issubclass ( type ( file_names ) , str ) :
-            file_names = [ file_names ]
-
-        histos   = HistoMapClass ()
-
-        badfiles = set()
-
-        for file_name in file_names :
-  
-            f = RootFile ( file_name , safe = False )
-
-            if not f.isOK () :
-                badfiles.add  ( file_name )
-                continue 
-
-            ## get the tree 
-            tree = f.Get( tree_name )
-            if not tree       :
-                raise NameError("Unable to get  ROOT TTree('%s')" % tree_name )
-
-            print 'Tree has %10d entries, %s/%s ' %  ( long ( tree.GetEntries () ) ,
-                                                       tree.GetName    () ,
-                                                       f.GetName       () )
-
-            ## fill the histograms 
-            histos,lambdas = self.fillHistos ( tree         ,
-                                               histos       ,
-                                               lambdas      ,
-                                               cellFunc     ,
-                                               Unit         )
-
-            del f 
-
-        ## update data base
-        if dbase_name:
-            print 'Save Histos to DB:', dbase_name 
-            histos.save ( dbase_name ) 
-
-        return (histos,lambdas,badfiles)
-      
-    ## ============================================================================
-    ## fill the histograms from the tree 
-    def fillHistos ( self                              ,
-                     tree                              ,
-                     histomap                          ,
-                     lambdamap                         ,
-                     cellFunc  = FakeCells.SameCell () ,
-                     Unit      = MeV                   ) :  
-        """
-        Fill the histograms from the tree 
-        """
-        FillSelector = self._FillSelector
-        ## instantiate the selector
-        selector = FillSelector ( histomap    ,
-                                  lambdamap   ,
-                                  cellFunc    ,
-                                  Unit = Unit )  
-
-        print '#entries in tree: %10d ' % tree.GetEntries() 
-        ##tree.Process ( selector , '' , 20000 )
-        tree.Process ( selector )
-
-        lambdas = selector.lambdas ()
-        histos  = selector.histos  ()
-
-        print ' histos  : ', len ( histos  ) , histos.entries() 
-        print ' lambdas : ', len ( lambdas )
-
-        return ( histos , lambdas )  
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/Kali/FillTaskBase.py b/Phys/KaliCalo/python/KaliCalo/Kali/FillTaskBase.py
deleted file mode 100644
index fb989815b..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Kali/FillTaskBase.py
+++ /dev/null
@@ -1,234 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FillTaskBase.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @based on Vanya Belyaev's TreeTask.py
-# @date 2010-11-11
-# =============================================================================
-"""
-The helper class for parallel filling of historgams using GaudiMP.Parallel
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__    = " $Date$"
-__version__ = " $Revision$"
-
-__all__     = [ "FillTask" , "FillHistos" ]
-
-# =============================================================================
-import os
-import tempfile
-import sets
-
-import GaudiMP.Parallel          as     Parallel
-from   GaudiKernel.SystemOfUnits import MeV
-
-from KaliCalo.FakeCells           import SameCell
-# =============================================================================
-
-## @class FillTask 
-#  The helper class for parallel filling of histograms using GaudiMP.Parallel
-#  @see GaudiPyhon.Parallel
-#  @see GaudiPyhon.Parallel.Task
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-03-27
-class FillTask ( Parallel.Task ) :
-    """
-    The helper class for parallel filling of historgams
-    using GaudiMP.Parallel
-    
-    @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-    @date 2010-03-28
-    """
-    
-    ## constructor from lambda-map 
-    def __init__ ( self         ,
-                   fillDatabase ,
-                   lambdas      ,
-                   cellFunc     , 
-                   Unit = MeV   ) : 
-        
-        ## initialize the base class 
-        Parallel.Task.__init__ ( self )
-        self._fillDatabase = fillDatabase
-        self._lambdas      = lambdas
-        self._Unit         = Unit  
-        self._cellFunc     = cellFunc
-            
-    ## local initialization 
-    def initializeLocal ( self ) :
-        """
-        Local initialization
-        """
-        print 'FillTask : Start parallel processing (local)'
-        self.output = [ None , sets.Set() ]
-                        
-    ## local initialization 
-    def initializeRemote ( self ) :
-        """
-        Remote initialization
-        """
-        host = os.environ['HOSTNAME']
-        #
-        print 'FillTask : Start parallel processing (%s) ' % host
-        return Parallel.Task.initializeRemote ( self ) 
-        
-    ## process the list of histo sets 
-    def process  ( self , file_pair ) :
-        
-        """
-        Process the list of histo-sets 
-        """
-        host = os.environ['HOSTNAME']
-        #
-        print 'FillTask: Start processing at ', host
-        
-        files,dbase = file_pair 
-        
-        histos, lambdas, badfiles = self._fillDatabase (
-            self._lambdas               ,
-            file_names = files          ,
-            dbase_name = None           ,
-            cellFunc   = self._cellFunc ,
-            Unit       = self._Unit     )
-
-        histos.save ( dbase )
-
-        self.output[0] = dbase
-        for b in badfiles :
-            self.output[1].add (  b )
-
-        if hasattr ( self , 'histos' ) :
-            print 'I have HISTOS attribute!!!' , len ( self.histos ) , self.histos.entries()
-            
-        print 'FillTask: End   processing at ', host, histos.entries() 
-            
-    ## finalization of the task 
-    def finalize ( self ) :
-        """
-        Finalization of the task
-        """
-        if hasattr ( self , 'histos' )  : 
-            print 'FillTask.finalize TOTAL: ' , self.histos.entries()
-        else :
-            print 'FillTask.finalize'
-    
-
-    ## merge the result form the different processes 
-    def _mergeResults ( self, result ) :
-        """
-        merge the results from the different processes
-        """
-        import os 
-        if not hasattr ( self , 'histos' ) :
-            self.histos = self._fillDatabase._HistoMapClass ()        
-        if os.path.exists ( result[0] ) :
-            ## self.histos.read( result[0] )
-            self.histos.updateFromDB ( result[0] )
-            os.remove ( result[0] )
-            print 'MERGE : ', result[0], self.histos.entries()
-        else :
-            print 'NON_EXISTING PATH', result[0] 
-        for f in result[1] : self.output[1].add ( f ) 
-            
-    def _resetOutput ( self ) :
-        self.output[1].clear() 
-
-# ==============================================================================
-## Fill for the histograms     
-class FillHistos( object ):
-    def __init__ ( self , fillDatabase ):
-        self._fillDatabase = fillDatabase
-
-    def __call__( self ,
-                  lambdas                           ,
-                  file_names                        ,
-                  manager    = None                 , 
-                  cellFunc   = SameCell ()          , 
-                  **args                          ) :
-        if manager :
-            return self.__fill_p_Histos (
-                    lambdas                           ,
-                    file_names                        ,
-                    manager  = manager                ,
-                    cellFunc = cellFunc               , 
-                    **args                            )
-        else         :
-            return self.__fill_s_Histos   (
-                    lambdas               ,
-                    file_names            ,
-                    cellFunc = cellFunc   ,
-                    **args                )
-
-    # ==============================================================================
-    ## perform the regular ``sequential'' fill for the histograms 
-    def __fill_s_Histos ( self                         ,
-                          lambdas                      ,
-                          file_names                   ,
-                          cellFunc                     ,
-                          dbase_name = 'kali_s_db.gz'  ,
-                          Unit       = MeV             ,
-                          **args                       ) :
-        """
-        Perform the regular ``sequential'' fill for the histograms 
-        """
-
-        histomap, lambdas, badfiles = self._fillDatabase (
-                                lambdas                  ,
-                                file_names               ,
-                                dbase_name  = dbase_name ,
-                                cellFunc    = cellFunc   ,
-                                Unit        = Unit       , 
-                                **args )
-
-        return histomap,badfiles
-
-    # ==============================================================================
-    ## perform the parallel fill for the histograms 
-    def __fill_p_Histos ( self                         ,
-                          lambdas                      ,
-                          file_names                   ,
-                          manager                      ,
-                          cellFunc                     ,   
-                          dbase_name = 'kali_p_db.gz'  ,
-                          Unit       = MeV             ) :
-        """
-        Perform the ``parallel'' fill for the histograms 
-        """
-
-        if issubclass ( type ( file_names ) , str ) :
-            file_names = [ file_names ] 
-            
-        tmpdir = None
-        if 'cluster' == manager.mode :  
-            tmpdir = os.path.abspath('./')
-
-        task = FillTask ( self._fillDatabase  ,
-                          lambdas             ,
-                          cellFunc = cellFunc ,
-                          Unit     = Unit     ) 
-
-        ## prepare the names for temporary files 
-        tmps = set()
-        while len ( tmps ) < len ( file_names ) :
-            tmp = tempfile.mktemp ( dir    = tmpdir    ,
-                                    prefix = 'tmp_'    ,
-                                    suffix = '_zdb.gz' )
-            if not os.path.exists ( tmp ) :
-                tmps.add ( tmp ) 
-
-
-        file_pairs = zip ( file_names , tmps )
-
-        status = manager.process ( task , file_pairs ) 
-
-        histomap  = task.histos
-        badfiles  = task.output[1] 
-
-        if dbase_name :
-            print 'Save histos in ', dbase_name 
-            histomap.save ( dbase_name )
-
-        return histomap,badfiles
-        
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/Kali/FitTaskBase.py b/Phys/KaliCalo/python/KaliCalo/Kali/FitTaskBase.py
deleted file mode 100644
index 8f206b505..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Kali/FitTaskBase.py
+++ /dev/null
@@ -1,231 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FitTaskBase.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @based on Vanya Belyaev's TreeTask.py
-# @date 2010-11-13
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-"""
-The helper class for parallel fitting using GaudiMP.Parallel
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__    = " 2010-03-27 "
-__version__ = " CVS Tag $Name: not supported by cvs2svn $ , version $Revision$ "
-__all__     = (
-    "FitTask"   ,
-    "fitHistos"
-    )
-# =============================================================================
-import GaudiMP.Parallel as Parallel
-import KaliCalo.Cells   as Cells
-# =============================================================================
-## @class FitTask 
-#  The helper class for parallel fitting using GaudiMP.Parallel
-#  @see GaudiMP.Parallel
-#  @see GaudiMP.Parallel.Task
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-03-27
-class FitTask ( Parallel.Task ) :
-    """
-    The helper class for parallel fitting using GaudiMP.Parallel
-
-    
-    @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-    @date 2010-03-27
-    """
-    
-    ## constructor from histo-map
-    def __init__ ( self   , histos , fitFunction , preFitFunction ) :
-
-        ## initializae the base class 
-        Parallel.Task.__init__ ( self )
-        
-        ## store the fit function
-        self._fitFunction = fitFunction
-        
-        ## get all references 
-        self.__all    = histos [ Cells.EcalZone   ]
-        self.__inner  = histos [ Cells.InnerZone  ]
-        self.__middle = histos [ Cells.MiddleZone ]
-        self.__outer  = histos [ Cells.OuterZone  ]
-        
-        ## ensure than references are (pre)fit properly: 
-        preFitFunction ( self.__all )
-        
-        fitFunction ( self.__inner  , self.__all , True )
-        fitFunction ( self.__middle , self.__all , True )
-        fitFunction ( self.__outer  , self.__all , True )
-
-    ## local initialization 
-    def initializeLocal ( self ) :
-        """
-        Local initialization
-        """
-        print 'FitTask: Start parallel processing (local)'
-        self.output = {}
-        
-    ## local initialization 
-    def initializeRemote ( self ) :
-        """
-        Remote initialization
-        """
-        import os
-        host = os.environ['HOSTNAME']
-        #
-        print 'FitTask: Start parallel processing (%s)' % host 
-        return Parallel.Task.initializeRemote ( self )
-    
-    def _resetOutput ( self ) :
-        self.output ={}
-        
-    ## process the list of histo sets 
-    def process  ( self , histogroup ) :
-
-        """
-        Process the list of histo-sets 
-        """
-        histos, igroup = histogroup
-        
-        import os
-        host = os.environ['HOSTNAME']
-        #
-        print 'FitTask: Start of processing at ', host , igroup , len ( histos ) 
-
-        for histoset in histos :
-            
-            key = histoset.cellID()
-            
-            if key in ( Cells.EcalZone   ,
-                        Cells.InnerZone  ,
-                        Cells.MiddleZone ,
-                        Cells.OuterZone  ) : continue 
-            
-            if   key.area() == Cells.InnerZone.area() : 
-                result = self._fitFunction ( histoset , self.__inner  )
-            elif key.area() == Cells.MiddleZone.area() : 
-                result = self._fitFunction ( histoset , self.__middle )
-            elif key.area() == Cells.OuterZone.area() : 
-                result = self._fitFunction ( histoset , self.__outer  )
-            else :
-                result = self._fitFunction ( histoset , self.__all    )
-
-            self.output [ key ] = histoset
-            
-        print 'FitTask: End   of processing at ', host , igroup , len(self.output) 
-
-    ## finalization of the task 
-    def finalize ( self ) :
-        """
-        Finalization of the task
-        """
-        print 'FitTask: finalize TOTAL: ' , len(self.output)
-
-    ## merge the result form the different processes 
-    def _mergeResults ( self, result ) :
-        """
-        merge the result form the different processes
-        """
-        self.output.update ( result ) 
-        print 'FIT-MERGE: ', len ( self.output ) 
-
-# ==============================================================================
-## perform the fit for the histograms 
-class FitHistos( object ):
-    def __init__ ( self , fitFunction, preFitFunction ):
-        self.fitFunction    = fitFunction
-        self.preFitFunction = preFitFunction
-        
-    def __call__ ( self              ,
-                   histomap          ,
-                   manager   = None  ,
-                   nHistos   = 60    ) :
-
-        """
-        perform the paralell fit for the histograms
-        """
-
-        if manager :
-            histomap = self.__fit_p_Histos ( histomap , manager , nHistos )
-        else :
-            histomap = self.__fit_s_Histos ( histomap )
-            
-        print ' #fitHistos: ', len(histomap)
-        return histomap  
-
-    # ==============================================================================
-    ## perform the fit for the histograms 
-    def __fit_p_Histos ( self           ,
-                         histomap       ,
-                         manager        ,
-                         nHistos   = 60 ) :
-        """
-        Perform the ``parallel'' fit for the histograms 
-        """
-        task = FitTask ( histomap , self.fitFunction , self.preFitFunction ) 
-
-        data = histomap.split ( nHistos )
-
-        status = manager.process ( task , data ) 
-
-        for key in task.output :
-            histomap.insert ( task.output[key] )
-
-        return histomap
-        
-    # ==============================================================================
-    ## perform the regular (sequential) fit for the histograms 
-    def __fit_s_Histos ( self , histomap ) :
-        """
-        Perform the regular (sequential) fit for the histograms 
-        """
-
-        ## get 'All-Ecal' histograms 
-        hA = histomap [ Cells.EcalZone   ]
-
-        ## (pre) fit them! 
-        self.preFitFunction ( hA )
-
-        ## inner area 
-        hI = histomap [ Cells.InnerZone  ]
-        ## middle area 
-        hM = histomap [ Cells.MiddleZone ]
-        ## outer area 
-        hO = histomap [ Cells.OuterZone  ]
-
-        ## fit them!!
-        print 'FitInner  : ' , self.fitFunction ( hI , hA , True )
-        print 'FitMiddle : ' , self.fitFunction ( hM , hA , True )
-        print 'FitOuter  : ' , self.fitFunction ( hO , hA , True )
-
-        keys = histomap.keys()    
-        keys.sort()
-        for key in Cells.Zones  :
-            keys.remove ( key     )
-            keys.insert ( 0 , key ) 
-
-        for key in keys :
-            hs = histomap[ key ]
-
-            if key in Cells.Zones :
-              continue
-
-            if   key.area() == Cells.InnerZone.area() : 
-                result = self.fitFunction ( hs , hI )
-            elif key.area() == Cells.MiddleZone.area() : 
-                result = self.fitFunction ( hs , hM )
-            elif key.area() == Cells.OuterZone.area() : 
-                result = self.fitFunction ( hs , hO )
-            else :
-                result = self.fitFunction ( hs , hA )
-
-        return histomap 
-        
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/Kali/HistoBase.py b/Phys/KaliCalo/python/KaliCalo/Kali/HistoBase.py
deleted file mode 100644
index 668b7f231..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Kali/HistoBase.py
+++ /dev/null
@@ -1,361 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file Histos.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @date 2010-10-28
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-from ROOT import *
-
-from KaliCalo.Kali import Counter
-from KaliCalo.Kali import VE
-
-# =============================================================================
-## Helper class to hold the histogams associated with the given CellID
-class HistosBase(object):
-    """
-    Helper class to hold the histogams associated with the given CellID
-    
-    """
-    def __init__ ( self , cellID , histo_suffixes, nCounters ) :
-        self._cellID     = cellID
-        self._histos     = self._make_histos_ ( cellID , histo_suffixes )
-        
-        self._counters = [ Counter() for i in range( nCounters ) ]
-        
-    ## get the list of booked histograms 
-    def histos  ( self      )  :
-        """
-        Get the list of booked histograms
-        """
-        return self._histos
-    
-    ## get the list of booked counters 
-    def counters   ( self  )  :
-        """
-        get the list of booked counters
-        """
-        return self._counters 
-    
-    ## get beta*Eprs/Egamma factors 
-    def kappas ( self ) :
-        """
-        Get beta*Eprs/Egamma factors
-        """
-        return tuple( [ VE ( counter.flagMean() , counter.flagMeanErr() ** 2 )
-                        for counter in self._counters ] )
-                 
-    ## get the booked histogram     
-    def histo   ( self , ID )  :
-        """
-        Get the booked histogram
-        """
-        return self._histos [ ID ]
-    
-    ## retrieve CellID for the histogram set 
-    def cellID  ( self ) :
-        """
-        retrieve CellID for the histogram set 
-        
-        """
-        return self._cellID
-    
-    ## reset all histograms 
-    def reset   ( self ) :
-        """
-        reset all histograms
-        """
-        for h in self._histos : h.Reset()
-        
-    ## get the list with numbers of entries for the histograms 
-    def entries ( self ) :
-        """
-        get the list with the number of entries for the histograms 
-        """
-        return [ int ( h.GetEntries() ) for h in self._histos ] 
-
-    ## add another set of histograms 
-    def __iadd__  ( self , other ) :
-        if self.cellID().index() != other.cellID().index() :
-            print self.cellID() , other.cellID()
-            raise TypeError(" *= Mismatch in CellID"   )
-        len_h = min ( len( self.histos   () ) , len ( other.histos   () ) ) 
-        len_c = min ( len( self.counters () ) , len ( other.counters () ) ) 
-        ## add histograms
-        for i in range ( 0 , len_h ) :
-            self._histos[ i ].Add ( other._histos[ i ] )
-        for i in range ( 0 , len_c ) :
-            self._counters[ i ] += ( other._counters [ i ] )
-
-        return self 
-
-    ## get the histogram by index 
-    def __getitem__ ( self , index ) :
-        """
-        get the histogram by index
-        """
-        return self._histos[ index ]
-    
-    ## book all nesesary histograms 
-    def _make_histos_ ( self , cellID , histo_suffixes ) :
-        """
-        Book all nesesary histograms
-        """
-        lst  = []
-        for suffix in histo_suffixes:
-            if suffix:
-              suffix = "_%s" % suffix
-            lst += [ self._make_histo_ ( cellID , suffix    ) ]        
-        return lst
-
-    ## get the number of histograms 
-    def __len__  (self ) :
-        return len( self._histos )
-        
-    ## Book one histogram
-    def _make_histo_  ( self , cellID , suffix ) :
-        """
-        Book one histogram
-        """
-        id  = str(cellID)
-        id  = id.replace ( '(','' )
-        id  = id.replace ( ')','' )
-        id  = id.replace ( "'",'' )
-        id  = id.replace ( '"','' )
-        id  = id.replace ( ' ','' )
-        id  = id.replace ( ',','_')
-        id += suffix
-        
-        ## h = ROOT.TH1D(
-        h = TH1F (
-            id                      , ## the name 
-            str(cellID)+'__'+suffix , ## the title 
-            250                     , ## bins 
-            0                       , ## low edge 
-            250                     ) ## high edge
-
-        h.SetDirectory(0)
-        return h 
-
-## ============================================================================
-## Helper class to hold the map of { cellID : histos }
-class HistoMapBase(object) :
-    """
-    Helper class to hold the map of { cellID : histos }
-    """
-
-    ## constructor 
-    def __init__ ( self , histoClass , background = False , *args ) :
-        """
-        Constructor, empty histogram map 
-        """
-        self._histoClass = histoClass
-        self._histos     = {}
-        self._background = background 
-        
-    ## Get item from the map. Create the entry for missing key.
-    def __getitem__ ( self , cellID ) :
-        """
-        Get item from the map. Create the entry for missing key.
-
-        >>> m = ... #
-        >>> histos = m[ cellID ]
-        
-        """        
-        _hs = self._histos.get( cellID , None )
-        if not _hs :
-            self._histos [ cellID ] = self._histoClass ( cellID , self._background )
-            _hs = self._histos[ cellID ]
-        return _hs
-
-    ## insert the histos 
-    def insert ( self , histos ) :
-        """
-        insert the histos
-        """
-        self._histos[ histos.cellID() ] = histos 
-            
-        
-    ## Save histograms to data base 
-    def save ( self , dbasename , prefix = '' , **args ) :
-        """
-        Save histograms to data base 
-        """
-        import KaliCalo.ZipShelve as ZipShelve 
-        dbase = ZipShelve.open  ( dbasename , **args )
-        for key in self : 
-            pattern = prefix + 'Histo '
-            dbase [ pattern + str(key) ] = self [ key ]
-        dbase.close()
-        ## 
-        return len ( self ) , self.entries() 
-        
-    ## update the histograms form database/databases
-    def updateFromDB ( self , dbasenames , prefix = '' , **args ) :
-        """
-        Update the histograms from (zipped) data base
-        """
-        if issubclass ( type ( dbasenames ) , str ) :
-            dbasenames = [ dbasenames ]
-            
-        import KaliCalo.ZipShelve as ZipShelve
-
-        for dbasename in dbasenames :
-            dbase = ZipShelve.open  ( dbasename , 'r' , **args )                    
-            for key in dbase :
-                pattern = prefix + 'Histo '
-                if 0 != key.find ( pattern )                : continue
-                o = dbase[key]
-                if not issubclass ( type(o)  , HistosBase ) : continue
-                
-                if self._histos.has_key ( o.cellID() ) : 
-                    self._histos [ o.cellID() ] += o
-                else :                 
-                    self._histos [ o.cellID() ]  = o
-            dbase.close()
-
-        return len ( self ) , self.entries() 
-        
-    ## read the histograms from zipped data base 
-    def read ( self , dbases , prefix = '' ) :
-        """
-        Read the histograms from zipped data base(s)
-        """
-        ## reset all histos 
-        self._histos = {}
-        ##
-        return self.updateFromDB ( dbases , prefix )
-    
-    ## delete the entry form the map
-    def __delitem__ ( self , cellID ) :
-        """
-        Delete the entry form the map
-
-        >>> m = ... ## get the map
-        >>> del m [ cellID ]
-        
-        """
-        if self._histos.has_key ( cellID ) :
-            del self._histos[ cellID ]
-
-    ## iteration 
-    def __iter__    ( self ) :
-        """
-        Iteration over the storage
-
-        >>> m = ... # get the storage
-        >>> for key in m : print key
-        
-        """
-        for key in self._histos :
-            yield key
-
-    ## update with another histogram set
-    def __iadd__ ( self , other ) :
-        """
-        Update with another histogram set
-        """
-        for key in other._histos :
-            
-            if not self._histos.has_key ( key ) :
-                self._histos [ key ]  = other._histos[ key ]
-            else :
-                self._histos [ key ] += other._histos[ key ]
-                
-        return self 
-    
-    ## Get the number of items/keys 
-    def __len__     ( self ) :
-        """
-        Get the number of items/keys :
-
-        >>> len ( m ) 
-        
-        """
-        return len ( self._histos )
-
-    ## get all keys 
-    def keys    ( self ) :
-        """
-        Get all keys
-        """
-        return self._histos.keys()
-    
-    ## reset all histograms 
-    def reset   ( self ) :
-        """
-        Reset all booked histograms
-        """
-        for h in self._histos : self._histos[h].reset()
-        
-    ## get the total number of entries for the histograms 
-    def entries ( self ) :
-        """
-        get the total number of entries for the histograms 
-        """
-        lst =  [ sum ( self._histos[k].entries() ) for k in self._histos ]
-        return sum ( lst )
-
-    ## Get the dictionary of histos
-    def get ( self , func ) :
-        """
-        Get the dictionary of histos
-        """
-        _entries = {}
-        for key in self :
-            if func ( self[key] ) :
-                _entries [ key ] = self[key]
-        return _entries
-    
-    ## split histograms into groups (e.g. for parallel processing)
-    def split ( self , num = 60 ) :
-         """
-         split histograms into groups (e.g. for parallel processing)
-         """
-         if num > len ( self ) : return self.split ( int(num/2) )
-         if 0 >= num           : num = 1    
-         #
-         result = []
-         group  = []
-         #
-         keys = self.keys ()
-         keys.sort()
-         for key in keys :
-             if len ( group ) == num :
-                 result.append ( ( group , len ( result ) ) )
-                 group = []
-             group += [ self[key] ]
-             
-         if group : result.append ( ( group , len ( result ) ) )
-         
-         if 20 < len( self ) and len ( result ) < 10 and 2 < num : 
-             return self.split ( int ( num / 2 ) )
-             
-         ## require at least two groups 
-         if 0 < len ( self ) and len ( result ) < 2 and 2 < num :
-             return self.split ( int ( num / 2 ) )
-         
-         return result
-
-# =============================================================================
-if '__main__' == __name__ :
-
-   ## make printout of the own documentations 
-   print '*'*120
-   print                      __doc__
-   print ' Author  : %s ' %   __author__    
-   print ' Version : %s ' %   __version__
-   print ' Date    : %s ' %   __date__
-   print ' dir(%s) : %s ' % ( __name__    , dir() )
-   print '*'*120  
-
-
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/Kali/LambdaMap.py b/Phys/KaliCalo/python/KaliCalo/Kali/LambdaMap.py
deleted file mode 100644
index 99584d49b..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Kali/LambdaMap.py
+++ /dev/null
@@ -1,227 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file LambdaMap.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @date 2010-10-28
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-# =============================================================================    
-import KaliCalo.Cells   as Cells
-from KaliCalo.Kali  import Counter, VE
-Zones = Cells.Zones
-# =============================================================================    
-## Helper class to hold the map of { cellID : lambdas }
-class LambdaMap(object) :
-    """
-    Helper class to hold the map of { cellID : lambdas }
-    """
-
-    ## constructor 
-    def __init__ ( self , *args ) :
-        """
-        Constructor, empty histogram map 
-        """
-        self._lambdas = {}
-
-    ## Get item from the map. Create the entry for missing key.
-    def __getitem__ ( self , cellID ) :
-        """
-        Get item from the map. Create the entry for missing key.
-
-        >>> m = ... #
-        >>> lambdas = m[ cellID ]
-        
-        """        
-        _ls = self._lambdas.get( cellID , None )
-        if not _ls :
-            self._lambdas [ cellID ] = [ 1.0 ] 
-            _ls = self._lambdas[ cellID ]
-        return _ls
-
-    def __delitem__ ( self , cellID ) :
-        """
-        Delete the entry from the map
-        
-        >>> m = ... ## get the map
-        >>> del m [ cellID ]
-        
-        """
-        if self._lambdas.has_key ( cellID ) :
-            del self._lambdas[ cellID ]
-
-    ## check the presence of the certain key 
-    def has_key ( self , key ) :
-        """
-        check the presence of the certain key
-        """
-        return self._lambdas.has_key ( key )
-    
-    ## Save lambdas to data base 
-    def save ( self , dbasename , prefix = '' , **args ) :
-        """
-        Save histograms to data base 
-        """
-        import KaliCalo.ZipShelve as ZipShelve 
-        dbase = ZipShelve.open  ( dbasename , **args )
-        for key in self : 
-            pattern = prefix + 'Lambdas '
-            dbase [ pattern + str(key) ] = ( key , self [ key ] )
-        dbase.close()
-        return len ( self )
-        
-    ## read the histograms from zipped data base 
-    def read ( self , dbasename , prefix = ''  , **args ) :
-        """
-        Read the histograms from zipped data base
-        """
-        ## reset all histos 
-        self._lambdas = {}
-        ## 
-        import KaliCalo.ZipShelve as ZipShelve
-        dbase = ZipShelve.open  ( dbasename , 'r' , **args )
-        for key in dbase :
-            pattern = prefix + 'Lambdas '
-            if 0 != key.find ( pattern )            : continue
-            o = dbase[key]
-            self._lambdas [ o[0] ] = o[1]
-
-        dbase.close() 
-        return len ( self )
-
-    ## Construct the map from the subsequent iterations
-    def __imul__    ( self , other ) :
-        """
-        Construct the map from the subsequent iterations
-        """
-        for key in self :
-            if key in Zones             : continue 
-            if not other.has_key( key ) : continue
-            lams = self[key]
-            if not lams                 : continue 
-            lam  = float( lams[-1] ) 
-            olams = other[key]
-            for ol in olams:
-                lams.append ( lam * ol )
-
-        return self
-        
-
-    ## iteration 
-    def __iter__    ( self ) :
-        """
-        Iteration over the storage
-
-        >>> m = ... # get the storage
-        >>> for key in m : print key
-        
-        """
-        for key in self._lambdas :
-            yield key
-
-    ## get the map { cellID : lambda } 
-    def lambdas ( self ) :
-        """
-        Get the map { cellID : lambda }
-        """
-        _ls = {}
-        for key in self._lambdas :
-            if key in Zones : continue 
-            lams = self._lambdas[key]
-            if 1.0 == lams[ -1 ] : continue 
-            _ls [ key ] = self._lambdas[key][-1]
-        return _ls
-    
-    ## get the mean+-rms value for correction coefficients:
-    def mean        ( self ) :
-        """
-        get the mean value for correction coefficients
-        Attention: missing keys do nto contribute! 
-        """
-        if not self : return VE ( 1 , 0 )
-        
-        cnt = Counter()
-        for key in  self._lambdas :
-            if key in Zones : continue 
-            lam = self._lambdas[key][-1]
-            cnt += lam
-        return VE ( cnt.flagMean() , cnt.flagRMS()**2 ) 
-
-    ## get the delta of "last" measurement 
-    def delta ( self , last = 1 , prev = 1 ) :
-        """
-        Get the delta of measurements
-        """
-        cnt = Counter()
-        for key in self._lambdas :
-            if key in Zones : continue 
-            lam = self._lambdas[key]
-            if len ( lam ) <  last + prev : continue
-            d = float( lam[ -last ] ) / lam[ -(last+prev) ] 
-            cnt += ( d - 1.0 ) 
-        return cnt 
-
-    ## get list of cells with 'large' corrections 
-    def large ( self , delta ) :
-        """
-        get list of cells with 'large' corrections
-        """
-        result = []
-        for key in self._lambdas :
-            if key in Zones : continue 
-            lam = self._lambdas[key]
-            if len ( lam ) < 2 : continue
-            d = abs ( float( lam[-1] ) / lam[-2] - 1.0 )  
-            if d > delta : result.append  ( key )
-        return result 
-        
-    ## Get the number of items/keys 
-    def __len__     ( self ) :
-        """
-        Get the number of items/keys :
-
-        >>> len ( m ) 
-        
-        """
-        return len ( self._lambdas )
-
-    ## produce short report 
-    def report ( self , values = ( 0.150 , 0.099 , 0.090  ,
-                                   0.080 , 0.070 , 0.060  ,
-                                   0.050 , 0.040 , 0.030  ,
-                                   0.020 , 0.010 , 0.005 ) ) :
-        """
-        Produce short report
-        """
-        _m  = self.mean  ()
-        _d  = self.delta ()
-        print ' Lambdas : ' , _m
-        print ' Deltas  : ( %.4f +- %.4f )  %.4f   %.4f ' % (
-            _d.flagMean () ,
-            _d.flagRMS  () ,
-            _d.flagMin  () ,
-            _d.flagMax  () )
-        for v in values :
-            print ' > %3g%% : %d ' % ( v*100 , len ( self.large  ( v ) ) )    
-
-# =============================================================================
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print ' dir(%s) : %s ' % ( __name__    , dir() )
-    print '*'*120  
-
-          
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/Kali/__init__.py b/Phys/KaliCalo/python/KaliCalo/Kali/__init__.py
deleted file mode 100644
index 7ecc692ec..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Kali/__init__.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-# ======================================================================
-# @file KaliCalo/Kali/__init__.py
-# Set of useful utilities & classes
-#     for pi0 Ecal calibration
-# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-# @reshuffled by Albert Puig (Albert.Puig@cern.ch)
-# @date 2010-03-17
-# ======================================================================
-"""
-Set of useful utilities & classes
-for ``iterative pi0'' Ecal calibration
-"""
-# ======================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__    = " 2010-03-17 "
-__version__ = " CVS tag $Name: not supported by cvs2svn $ , version $Revision$ "
-# ======================================================================
-
-__all__ = [ 'Counter' , 'VE' , 'HistosBase', 'HistoMapBase' , 'HistoMap' , 'LambdaMap' , 'pi0Mass' ]
-
-from LoKiCore.basic import cpp as _cpp
-
-Counter    = _cpp.StatEntity
-VE         = _cpp.Gaudi.Math.ValueWithError
-
-def _ve_str_ ( self , fmt = '( %.3g +- %.3g )' ) :
-    return fmt % ( self.value() , self.error() )
-
-def _ve_abs_ ( self ) :
-    return VE ( abs( self.value() ) , self.cov2() )
-
-VE.__str__  = _ve_str_
-VE.__repr__ = _ve_str_
-VE.__abs__  = _ve_abs_
-
-# Pi0 mass
-pi0Mass = 134.9766
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/KaliPi0.py b/Phys/KaliCalo/python/KaliCalo/KaliPi0.py
deleted file mode 100644
index aea10ecfa..000000000
--- a/Phys/KaliCalo/python/KaliCalo/KaliPi0.py
+++ /dev/null
@@ -1,137 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# $Id$ 
-# =============================================================================
-## @file  KaliCalo/KaliCaloPi0.py
-#  The basic configuration to (re)run Ecal pi0-calibration
-#  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
-#  @date   2009-09-17
-# =============================================================================
-"""
-The basic configuration to (re)run Ecal pi0-calibration
-
-One reads the input data (presumably DST or fmDST),
-(re) recontruct Calorimeter, and produces two major outputs:
-
- -  root file with N-tuple for 'pi0-calibration'
- - 'femtoDST' which contains only 'interesting' digits
-
-Usage:
- 
-  > gaudirun.py KaliPi0.py InputDataFiles.py
-
-Or (suitable for tests)
-
-  > python ./KaliPi0.py
-
-Or even:
-
-  > ./KaliPi0.py
-
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@nikhef.nl "
-__date__    = " 2009-09-17 "
-__version__ = " CVS Tag $Name: not supported by cvs2svn $, version $Revision$"
-# =============================================================================
-## the basic import
-from   Gaudi.Configuration       import *
-from   GaudiKernel.SystemOfUnits import MeV 
-from   KaliCalo.Configuration    import firstPass, secondPass
-import KaliCalo.Kali             as Kali 
-import KaliCalo.ZipShelve        as ZipShelve 
-
-##kali = firstPass (
-##    ## ``Physics''
-##    PtGamma          = 250 * MeV ,
-##    Pi0Cut           = "PT > 550 * MeV" ,
-##    ## IO 
-##    NTuple           = "KaliPi0_Tuples_2k+10.root" , 
-##    FemtoDST         = "KaliPi0_2k+10.fmDST"       ,
-##    ## general 
-##    DataType         = '2010',
-##    PrintFreq        =  5000 ,
-##    EvtMax           =  -1
-##    )
-
-kali = secondPass (
-    ## 
-    DestroyTES = False , 
-    ## ``Physics''
-    PtGamma          = 250 * MeV ,
-    Pi0Cut           = "PT > 550 * MeV",
-    ## IO 
-    NTuple           = "KaliPi0_Tuples_2k+11.root" , 
-    FemtoDST         = "KaliPi0_2k+11.fmDST"   ,
-    ## general 
-    DataType         = '2010',
-    PrintFreq        =  1000 ,
-    EvtMax           =  -1
-    )
-
-from Configurables import CondDB
-CondDB ( UseLatestTags = ['2012'] )
-
-
-# =============================================================================
-## the actual job steering 
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print '*'*120  
-    
-    #### === run with test SDSTs as an input
-    ##from Configurables import DaVinci
-    ##DaVinci().InputType = 'SDST'                            # use SDSTs as an input
-    #### SDSTs for Stripping tests, 2010 data, mu = 2.7
-    ##importOptions('$STRIPPINGSELECTIONSROOT/tests/data/RUN_81430_RealData+Reco08-Stripping12_90000000_SDST.py')
-    
-    #eos      = 'root://eoslhcb.cern.ch//eos/lhcb/grid/prod'
-    #pattern  = '/lhcb/LHCb/Collision11/FMDST/00011385/0000/00011385_00000%03d_1.fmdst'
-    #pattern  = '/lhcb/LHCb/Collision12/FMDST/00021391/0000/00021391_00000%03d_1.fmdst'
-
-    from PRConfig import TestFileDB
-    from GaudiConf.IOHelper import IOHelper
-    
-    IOHelper().inputFiles ( TestFileDB.test_file_db["2012_CaloFemtoDST"].filenames )
-    
-    #evtSel.open ( 'KaliPi0_2k+11.fmdst_test')
-
-    from GaudiPython.Bindings import AppMgr    
-    gaudi = AppMgr()
-    
-    ## === OR with test fmDSTs
-    
-    evtSel = gaudi.evtSel()
-        
-    ## run over events
-    gaudi.run(5000)
-    
-    from   KaliCalo.FitUtils import fitPi0, getPi0Params, s2b   
-    import GaudiPython.GaudiAlgs 
-    pi0    = gaudi.algorithm('KaliPi0')
-    histos = pi0.Histos()
-    if histos :
-        keys = histos.keys()
-        keys.sort () 
-        for h in keys :
-            histo = histos[h]
-            if hasattr ( histo , 'dump' ) :
-                print histo.dump(60,25,True) 
-                st = fitPi0 ( histo ) 
-                print 'Fit    : ' , st
-                print 'N(pi0) : ' , getPi0Params ( histo )[0] 
-                print 'Mass   : ' , getPi0Params ( histo )[1] 
-                print 'Sigma  : ' , getPi0Params ( histo )[2] 
-                print 'S/B    : ' , s2b ( histo.toROOT() ) 
-                
-    gaudi.exit()
-    
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/KaliPi0_1.py b/Phys/KaliCalo/python/KaliCalo/KaliPi0_1.py
deleted file mode 100755
index 6dbddb140..000000000
--- a/Phys/KaliCalo/python/KaliCalo/KaliPi0_1.py
+++ /dev/null
@@ -1,104 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# $Id$ 
-# =============================================================================
-## @file  KaliCalo/KaliCaloPi0.py
-#  The basic configuration to (re)run Ecal pi0-calibration
-#  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
-#  @date   2009-09-17
-# =============================================================================
-"""
-The basic configuration to (re)run Ecal pi0-calibration
-
-One reads the input data (presumably DST or fmDST),
-(re) recontruct Calorimeter, and produces two major outputs:
-
- -  root file with N-tuple for 'pi0-calibration'
- - 'femtoDST' which contains only 'interesting' digits
-
-Usage:
- 
-  > gaudirun.py KaliPi0.py InputDataFiles.py
-
-Or (suitable for tests)
-
-  > python ./KaliPi0_1.py
-
-Or even:
-
-  > ./KaliPi0_1.py
-
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@nikhef.nl "
-__date__    = " 2010-08-07 "
-__version__ = " $Revision$"
-# =============================================================================
-## the basic import
-from   Gaudi.Configuration       import *
-from   GaudiKernel.SystemOfUnits import MeV 
-from   KaliCalo.Configuration    import firstPass, secondPass
-import KaliCalo.Kali             as Kali 
-import KaliCalo.ZipShelve        as ZipShelve 
-
-kali = firstPass (
-    ## ``Physics''
-    PtGamma          = 250 * MeV ,
-    ##     ## IO 
-    NTuple           = "KaliPi0_Tuples_2k+10.root" , 
-    FemtoDST         = "KaliPi0_2k+10.fmDST"       ,
-    ## general 
-    DataType         = '2010'   ,
-    EvtMax           =  -1 
-    )
-
-# =============================================================================
-## the actual job steering 
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print '*'*120  
-    
-    
-    files    = [
-        '/lhcb/data/2010/MINIBIAS.DST/00007959/0000/00007959_00000%03d_1.minibias.dst' % n for n in range ( 1 , 211 )
-        ]
-    
-    from GaudiPython.Bindings import AppMgr    
-    gaudi = AppMgr()
-    
-    evtSel = gaudi.evtSel()
-    
-    castor   =  'castor:/castor/cern.ch/grid'
-    evtSel.open ( [ castor + f for f in files ] )
-    
-    gaudi.run( 1000 ) 
-    
-    from   KaliCalo.Pi0HistoFit import fitPi0 , getPi0Params, s2b   
-    import GaudiPython.GaudiAlgs 
-    pi0    = gaudi.algorithm('KaliPi0')
-    histos = pi0.Histos()
-    if histos :
-        keys = histos.keys()
-        keys.sort () 
-        for h in keys :
-            histo = histos[h]
-            if hasattr ( histo , 'dump' ) :
-                print histo.dump(40,20,True) 
-                st = fitPi0 ( histo ) 
-                print 'Fit    : ' , st
-                print 'N(pi0) : ' , getPi0Params ( histo )[0] 
-                print 'Mass   : ' , getPi0Params ( histo )[1] 
-                print 'Sigma  : ' , getPi0Params ( histo )[2] 
-                print 'S/B    : ' , s2b          ( histo ) 
-                
-    gaudi.exit()
-    
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/MassDistribution/Analyse.py b/Phys/KaliCalo/python/KaliCalo/MassDistribution/Analyse.py
deleted file mode 100644
index e44f30692..000000000
--- a/Phys/KaliCalo/python/KaliCalo/MassDistribution/Analyse.py
+++ /dev/null
@@ -1,197 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-## @file KaliCalo/Analyse.py
-#  The main ``analyse'' for Kali
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-03-20
-# =============================================================================
-"""
-The main ``analyse'' for Kali
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyev@itep.ru "
-__date__    = " 2010-03-20 "
-__version__ = " CVS tag $Name: not supported by cvs2svn $, version $Revision$ "
-# =============================================================================
-__all__     = (
-    "analyse" ,
-    )
-# =============================================================================
-import KaliCalo.Cells                    as Cells
-import KaliCalo.FitUtils                 as FitUtils
-import KaliCalo.Kali                     as Kali
-import KaliCalo.MassDistribution.FitTask as Task
-from   KaliCalo.MassDistribution     import getHistosFromDB 
-import random
-    
-# =============================================================================
-## Analyse the histograms 
-def  analyse ( histomap          ,
-               lambdamap         ,
-               fitted    = False , 
-               manager   = None  ,
-               nHistos   = 60    ) :    
-    """
-    Analyse the histograms 
-    """
-    histomap = getHistosFromDB ( histomap )
-    
-    if not fitted :
-        histomap = Task.fitHistos (
-            histomap ,
-            manager  ,
-            nHistos  )                 
-
-    keys = histomap.keys()    
-    keys.sort()
-    for key in Cells.Zones  :
-        if key in keys : keys.remove ( key     )
-        keys.insert ( 0 , key ) 
-        
-    import sets
-    
-    badCells    = sets.Set()
-    notFitCells = sets.Set()
-    lowCells    = sets.Set()
-    
-    ikey  = 0
-    nFits = 0
-    iCnt  = Kali.Counter() 
-    for key in keys :
-
-        ikey += 1
-        
-        if max ( histomap[key].entries() ) < 100 :
-            lowCells.add  ( key ) 
-            continue
-        
-        hs     = histomap[key]
-        
-        if key in Cells.Zones :
-            
-            r0 = FitUtils.getPi0Params ( hs[0] )
-            r1 = FitUtils.getPi0Params ( hs[1] )
-            r2 = FitUtils.getPi0Params ( hs[2] )
-
-            if r0 and r1 and r2 :  
-                print ' MASS : %-24.24s %-24.24s %-24.24s ' % ( r0[1] , r1[1] , r2[1] ) , key 
-                print ' SIGMA: %-24.24s %-24.24s %-24.24s ' % ( r0[2] , r1[2] , r2[2] ) , key 
-                print ' NUM0 : %-24.24s %-24.24s %-24.24s ' % ( r0[0] , r1[0] , r2[0] ) , key
-                print ' S/B  : %-24.24s %-24.24s %-24.24s ' % ( FitUtils.s2b ( hs[0] ) ,
-                                                                FitUtils.s2b ( hs[1] ) ,
-                                                                FitUtils.s2b ( hs[2] ) ) , key
-                print '  '
-            else :
-                print 'No fit information available for ZONE: ', key 
-                
-            continue 
-
-        result = None
-        if   hasattr ( hs , 'result' ) : result = hs.result
-        
-        if not result : 
-            ## print ' no reliable fits for ',key
-            notFitCells.add ( key ) 
-            continue 
-
-        iCnt  += result[-1] 
-        
-        r0 = FitUtils.getPi0Params ( hs[0] )
-        r1 = FitUtils.getPi0Params ( hs[1] )
-        r2 = FitUtils.getPi0Params ( hs[2] )
-
-        r0 = r0 if 0 <= result[0] else None
-        r1 = r1 if 0 <= result[1] else None
-        r2 = r2 if 0 <= result[2] else None
-        
-        if r0 and r0[2].value() < 5 :
-            print r0 , hs[0].GetName() 
-
-        if not r0 and not r1 and not r2 :
-            notFitCells.add ( key ) 
-            continue 
-        
-        alpha = 1.0
-
-        mass  = Kali.VE ( 135 , 135**2 )
-        sigma = Kali.VE (  12 ,  12**2 ) 
-        corr  = Kali.VE (   1 ,   1**2 )
-        num   = Kali.VE (   1 ,   1**2 )
-
-        Used = False
-        
-        if r0 and ( 5 <= r0[2].value() <= 20 ) and  ( 15 <= abs ( r0[0].value() ) ) :
-            m      = r0[1]
-            deltam = r0[1]-135.0 
-            corr1  = 1.0 - alpha*deltam/r0[1]
-            s      = r0[2]
-            if 0.00001 < corr1.error() < 0.50 :  
-                corr   = corr.mean  ( corr1 )
-                mass   = mass.mean  ( m     )
-                if s.error() > 0.00001     : sigma  = sigma.mean ( s )
-                else                       : sigma.setValue ( s.value() ) 
-                num    = abs ( r0[0] )
-                Used   = True 
-
-        use = FitUtils.badParam  ( mass , sigma , num , corr ) or not Used 
-        if r1 and use : 
-            m      = r1[1]
-            deltam = r1[1]-135.0 
-            corr2  = 1.0 - alpha*deltam/r1[1]
-            s      = r1[2]
-            if 0.00001 < corr2.error() < 0.50 :  
-                corr   = corr.mean  ( corr2 )
-                mass   = mass.mean  ( m     )
-                if s.error() > 0.00001 : sigma  = sigma.mean ( s )  
-                num   += abs ( r1[0] ) 
-                Used   = True
-                
-        use = FitUtils.badParam  ( mass , sigma , num , corr ) or not Used 
-        if r2 and use : 
-            m      = r2[1]
-            deltam = r2[1]-135.0 
-            hc     = hs.kappas() 
-            kappa  = hc[1]
-            corr3  = 1.0 - alpha*deltam/r2[1]/(1.0-kappa) 
-            s      = r2[2]
-            if 0.00001 < corr3.error() < 0.50 :  
-                corr   = corr.mean ( corr3 )
-                mass   = mass.mean ( m     )
-                if s.error() > 0.00001 : sigma  = sigma.mean ( s )  
-                num   += abs ( r2[0] )
-                Used   = True
-
-        if FitUtils.badParam  ( mass , sigma , num , corr ) or not Used :
-            badCells.add ( key )
-            continue                          ## NEXT CELL  
-
-        lams = lambdamap[key]
-
-        ## do not allow too large corrections per one step 
-        if corr.value() < 0.90 : corr.setValue ( 0.90 )
-        if corr.value() > 1.10 : corr.setValue ( 1.10 )
-        
-        lam  = corr*lams[-1]
-        lams.append ( lam.value() )
-
-        nFits = Kali.VE( iCnt.flagMean() , iCnt.flagRMS() )
-        
-        mx = 100.0 / len ( histomap )
-        if random.uniform( 0 , 1.0 ) < mx and r0 and r1 and r2 :
-            print ' ' 
-            print ' KEY   :' , key , ikey , len ( histomap ) , result , iCnt.flag() , nFits 
-            print ' NUM0  : %-24.24s %-24.24s %-24.24s ' % ( r0[0] , r1[0] , r2[0] ) 
-            print ' MASS  : %-24.24s %-24.24s %-24.24s ' % ( r0[1] , r1[1] , r2[1] ) , corr , [  '%.3f' % l for l in lambdamap[key] ] 
-            print ' SIGMA : %-24.24s %-24.24s %-24.24s ' % ( r0[2] , r1[2] , r2[2] ) 
-            print ' S/B   : %-24.24s %-24.24s %-24.24s ' % ( FitUtils.s2b ( hs[0] ) ,
-                                                             FitUtils.s2b ( hs[1] ) ,
-                                                             FitUtils.s2b ( hs[2] ) ) 
-            
-    return (badCells,lowCells,notFitCells)  
-
-
-
-
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/MassDistribution/FillSelector.py b/Phys/KaliCalo/python/KaliCalo/MassDistribution/FillSelector.py
deleted file mode 100644
index 72f3bbc84..000000000
--- a/Phys/KaliCalo/python/KaliCalo/MassDistribution/FillSelector.py
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FillSelector.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @based on Vanya Belyaev's Pi0FillHistos.py
-# @date 2010-11-03
-# =============================================================================
-"""Implementation of FillSelector for Mass Distribution method for Pi0 calibration.
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-__all__ = [ 'FillPi0' , 'fillDataBase' ]
-
-from math import sqrt
-
-import KaliCalo.Kali.FillSelectorBase as FillBase
-
-from KaliCalo.MassDistribution import HistoMap
-from KaliCalo.Cells            import CellID
-
-class FillPi0( FillBase.FillPi0Base ):
-    def Process( self, entry ):
-        """
-        Fills the histograms from a tree
-        """
-        # == getting the next entry from the tree
-        if self.GetEntry ( entry ) <= 0 : return 0
-      
-        # == for more convenience
-        bamboo=self.fChain
-      
-        if not self._frequency :
-            entries  = bamboo.GetEntries()
-            entries  = int ( entries /  50.0 / 10000.0 ) * 10000
-            entries  = max ( entries , 100000 ) 
-            self._frequency = entries
-          
-        # == printout
-        if 0 == entry % self._frequency:
-            self._print ( 'Process %d' % entry )
-          
-        ## 3x3 spd ?? 
-        ## if bamboo.spd1 and bamboo.spd2 : return 1
-        if bamboo.spd1 or bamboo.spd2 : return 1
-      
-        # == cell (category) number
-      
-        ic1 = CellID ( bamboo.ind1 ) 
-        ic2 = CellID ( bamboo.ind2 )
-      
-        ic1.setCalo ( 2 )
-        ic2.setCalo ( 2 )
-
-        area1 = ic1.area()
-        area2 = ic2.area()
-
-        background = 1 == bamboo.bkg
-
-        if background and not self._background : return 1 
-
-        #
-        # "massage" cell-ID, e.g. group them
-        # 
-        ic1 = CellID ( self._cellFunc ( ic1 ) ) 
-        ic2 = CellID ( self._cellFunc ( ic2 ) ) 
-
-        ## get the correction coefficients:
-        lam1 = self._lambdas [ ic1 ] [ -1 ] ## the last one is relevant here
-        lam2 = self._lambdas [ ic2 ] [ -1 ] ## the last one is relevant here 
-
-        # == caculating the corrected mass
-        corrMass = bamboo.m12 * sqrt( lam1 * lam2 ) * self._Unit
-        if not 0 < corrMass < 350 : return 1                ## RETURN
-
-        ## get the histograms for the first cell 
-        hs1  = self._histos  [ ic1 ].histos()        
-        ## get the histograms and for the first cell 
-        hs2  = self._histos  [ ic2 ].histos()  
-      
-        hc1  = self._histos  [ ic1 ].counters()        
-        hc2  = self._histos  [ ic2 ].counters()        
-
-
-        ## get 'per-area' histos
-        iz1 = CellID ( ic1.calo() , area1 , self._gRow , self._gCol )
-        iz2 = CellID ( ic2.calo() , area2 , self._gRow , self._gCol )
-        hz1  = self._histos  [ iz1 ].histos   () ## global 'per-zone' histos
-        hz2  = self._histos  [ iz2 ].histos   () ## global 'per-zone' histos
-        cz1  = self._histos  [ iz1 ].counters () ## global 'per-zone' histos
-        cz2  = self._histos  [ iz2 ].counters () ## global 'per-zone' histos
-        ## everything 
-        hgl  = self._global.histos   ()          ## global histos 
-        cgl  = self._global.counters ()          ## global counters
-      
-        ## 
-
-        ok1 = False 
-        ok2 = False 
-        ok3 = False
-      
-        if   max ( bamboo.prs1 , bamboo.prs2 ) * self._Unit < 10 : ok1 = True 
-        elif min ( bamboo.prs1 , bamboo.prs2 ) * self._Unit > 10 : ok3 = True
-        else:
-            ok2 = True 
-
-      
-        if ok2 :
-            corrMass  = bamboo.m12 * self._Unit
-            factor2   = self._betas[area2] * bamboo.prs2/bamboo.g2E
-            corrMass *= sqrt ( lam1 )
-            corrMass *= sqrt ( lam2 + ( 1 - lam2 ) * factor2 )
-            if abs ( corrMass - 135. ) < 20 :
-                hc2[0]   += factor2
-                cz2[0]   += factor2
-                cgl[0]   += factor2
-              
-        elif ok3 :
-            corrMass  = bamboo.m12 * self._Unit
-            factor1   = self._betas[area1] * bamboo.prs1/bamboo.g1E
-            factor2   = self._betas[area2] * bamboo.prs2/bamboo.g2E
-            corrMass *= sqrt ( lam1 + ( 1 - lam1 ) * factor1 )
-            corrMass *= sqrt ( lam2 + ( 1 - lam2 ) * factor2 ) 
-            if abs ( corrMass - 135. ) < 20 :
-                hc1[1]   += factor1 
-                cz1[1]   += factor1
-                cgl[1]   += factor1                
-                hc2[1]   += factor2
-                cz2[1]   += factor2
-                cgl[1]   += factor2                
-
-        if corrMass > 250  : return 1 
-
-        if not background :
-
-            if   ok1 : 
-                hs1 [ 0 ].Fill ( corrMass )
-                hs2 [ 0 ].Fill ( corrMass )
-                hz1 [ 0 ].Fill ( corrMass )
-                hz2 [ 0 ].Fill ( corrMass )
-                hgl [ 0 ].Fill ( corrMass )
-            elif ok2 :
-                hs1 [ 1 ].Fill ( corrMass )
-                hz1 [ 1 ].Fill ( corrMass )
-                hgl [ 1 ].Fill ( corrMass )
-            elif ok3 :
-                hs1 [ 2 ].Fill ( corrMass )
-                hs2 [ 2 ].Fill ( corrMass )
-                hz1 [ 2 ].Fill ( corrMass )
-                hz2 [ 2 ].Fill ( corrMass )
-                hgl [ 2 ].Fill ( corrMass )
-              
-        else :
-
-            if   ok1 : 
-                hs1 [ 3 ].Fill ( corrMass )
-                hs2 [ 3 ].Fill ( corrMass )
-                hz1 [ 3 ].Fill ( corrMass )
-                hz2 [ 3 ].Fill ( corrMass )
-                hgl [ 3 ].Fill ( corrMass )
-            elif ok2 : 
-                hs1 [ 4 ].Fill ( corrMass )
-                hz1 [ 4 ].Fill ( corrMass )
-                hgl [ 4 ].Fill ( corrMass )
-            elif ok3 : 
-                hs1 [ 5 ].Fill ( corrMass )
-                hs2 [ 5 ].Fill ( corrMass )
-                hz1 [ 5 ].Fill ( corrMass )
-                hz2 [ 5 ].Fill ( corrMass )
-                hgl [ 5 ].Fill ( corrMass )
-      
-        return 1
-
-fillDataBase = FillBase.FillDatabase( FillPi0 , HistoMap )
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/MassDistribution/FillTask.py b/Phys/KaliCalo/python/KaliCalo/MassDistribution/FillTask.py
deleted file mode 100644
index f38254fd7..000000000
--- a/Phys/KaliCalo/python/KaliCalo/MassDistribution/FillTask.py
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FillTask.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @reshuffled from Vanya Belyaev's TreeTask.py
-# @date 2010-11-11
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-__all__ = [ 'FillTask' , 'fillDatabase' ]
-
-import KaliCalo.Kali.FillTaskBase             as _FillTaskBase
-import KaliCalo.MassDistribution.FillSelector as _FillSelector
-
-#FillTask = _FillTaskBase.FillTaskBase
-
-fillDatabase = _FillTaskBase.FillHistos( _FillSelector.fillDataBase )
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/MassDistribution/FitFunctions.py b/Phys/KaliCalo/python/KaliCalo/MassDistribution/FitFunctions.py
deleted file mode 100644
index 269bbd869..000000000
--- a/Phys/KaliCalo/python/KaliCalo/MassDistribution/FitFunctions.py
+++ /dev/null
@@ -1,221 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FitFunctions.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @reshuffled from Vanya Belyaev's FitTask.py and Pi0HistoFit.py
-# @date 2010-11-13
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-import KaliCalo.FitUtils as Fit
-from KaliCalo.Kali       import pi0Mass
-
-pi0Func       = Fit.pi0Func
-
-# Load pre-fit functionality
-_preFitBkg    = Fit._preFitBkg
-_preFitSignal = Fit._preFitSignal
-
-# =============================================================================
-## pre-fit historgam set 
-def preFitHistoSet ( histoset ) :
-    """
-    Pre-fit historgam set 
-    
-    """
-    _func = pi0Func
-    _func.SetParameter ( 0 , 100 )
-    _func.SetParameter ( 1 , pi0Mass )
-    _func.SetParameter ( 2 ,  10 )
-    _func.SetParameter ( 3 ,  10 )
-    _func.SetParameter ( 4 ,   0 )
-    _func.SetParameter ( 5 ,   0 )
-    
-    # start from background historgam
-    h3 = None
-    h4 = None
-    h5 = None
-    
-    nFits = 0
-
-    if len( histoset ) >= 6 :
-        
-        h3 = histoset [3]
-        h4 = histoset [4]
-        h5 = histoset [5]
-
-        st , nFit1 = _preFitBkg ( _func , h3 )
-        st , nFit2 = _preFitBkg ( _func , h4 )
-        st , nFit3 = _preFitBkg ( _func , h5 )
-        nFits += nFit1 
-        nFits += nFit2 
-        nFits += nFit3
-    
-    # go to signal :
-    h2 = histoset[2]
-    h1 = histoset[1]
-    h0 = histoset[0]
-
-    st1 , nFit1 = _preFitSignal ( _func , h2 , background = h5 )
-    st2 , nFit2 = _preFitSignal ( _func , h1 , background = h4 , signal = h2 )
-    st3 , nFit3 = _preFitSignal ( _func , h0 , background = h3 , signal = h1 )
-
-    nFits += nFit1 
-    nFits += nFit2 
-    nFits += nFit3
-
-    return st1,st2,st3, nFits
-
-#  Load fit functionality
-fitBkg     = Fit.fitBkg
-fitSignal  = Fit.fitSignal
-checkHisto = Fit.checkHisto
-
-# =============================================================================
-## fit the set of histograms
-def fitHistoSet ( histoset , set0 , force = False ) :
-    """
-    Fit historgram set 
-    """
-    histoset.result = None 
-
-    _func = pi0Func
-
-    nFits = 0 
-
-    h0 = histoset  [0]
-    h1 = histoset  [1]
-    h2 = histoset  [2]
-
-    h3 = None
-    h4 = None
-    h5 = None
-    if len ( histoset ) >= 6 : 
-        h3 = histoset  [3]
-        h4 = histoset  [4]
-        h5 = histoset  [5]
-
-
-    r0 =      set0 [0]
-    r1 =      set0 [1]
-    r2 =      set0 [2]
-
-    r3 = None
-    r4 = None
-    r5 = None
-    if len ( set0 ) >= 6 : 
-        r3 =      set0 [3]
-        r4 =      set0 [4]
-        r5 =      set0 [5]
-
-    ## start for background:
-    if h5 :
-        st , nFit1 = fitBkg ( _func , h5 , background = r5 )
-        nFits += nFit1
-    if h4 :
-        st , nFit2 = fitBkg ( _func , h4 , background = r4 )
-        nFits += nFit2
-    if h3 : 
-        st , nFit3 = fitBkg ( _func , h3 , background = r3 )
-        nFits += nFit3
-
-    ok0 = 0 
-    ## play with signal:
-
-    ## Prs+Prs
-
-    ## use "own" background + reference signal
-    res0, nFit = fitSignal     ( _func , h2 , background = h5 , signal = r2 )
-    nFits += nFit 
-    if ( not res0 or not checkHisto ( h2 ) ) and r5 : 
-        ok0  = 1 
-        ## use "reference signal & background
-        res0, nFit = fitSignal ( _func , h2 , background = r5 , signal = r2 )    
-        nFits += nFit 
-    if not res0 or not checkHisto ( h2 ) :
-        ok0  = -1
-        if not force :
-            result =  (-2,-2,ok0, nFits)
-            histoset.result = result
-            return result 
-
-    ## no-Prs +Prs 
-    ok1 = 0
-
-    ## use "own" background & signal 
-    res1 , nFit = fitSignal     ( _func , h1 , background = h4 , signal = h2 )
-    nFits += nFit 
-    if not res1 or not checkHisto ( h1 ) :
-        ok1  = 1 
-        ## use "own" background & reference signal 
-        res1 , nFit = fitSignal ( _func , h1 , background = h4 , signal = r1 )
-        nFits += nFit 
-    if ( not res1 or not checkHisto ( h1 ) ) and r4 :
-        ok1  = 2 
-        ## use "reference" background & signal 
-        res1 , nFit = fitSignal ( _func , h1 , background = r4 , signal = r1 )
-        nFits += nFit 
-    if not res1 or not checkHisto ( h1 ) :
-        ok1  = 3 
-        ## use "own" background & reference signal Prs+Prs 
-        res1, nFit = fitSignal ( _func , h1 , background = h4 , signal = r2 )
-        nFits += nFit 
-    if ( not res1 or not checkHisto ( h1 ) ) and r4 :
-        ok1  = 4 
-        ## use reference background & signal Prs+Prs 
-        res1 , nFit = fitSignal ( _func , h1 , background = r4 , signal = r2 )
-        nFits += nFit 
-    if not res1 or not checkHisto ( h1 ) :
-        ok1  = -1 
-        if not force :
-            result =  (-2,ok1,ok0, nFits)
-            histoset.result = result 
-            return result 
-
-    ## no-Prs+no-Prs 
-    ok2 = 0
-    ## use own background and signal (Prs+no-Prs)
-    res2 , nFit =  fitSignal    ( _func , h0 , background = h3 , signal = h1 )
-    nFits += nFit
-    if ( not res2 or not checkHisto ( h0 ) ) and r3 :
-        ok2 = 1 
-        ## use reference background and own signal (Prs+Prs)
-        res2 , nFit = fitSignal ( _func , h0 , background = r3 , signal = h2 )
-        nFits += nFit
-    if not res2 or not checkHisto ( h0 ) :
-        ok2 = 2 
-        ## use own background and reference signal (Prs+no-Prs)
-        res2 , nFit = fitSignal ( _func , h0 , background = h3 , signal = r1 )
-        nFits += nFit
-    if ( not res2 or not checkHisto ( h0 ) ) and r3 :
-        ok2 = 3 
-        ## use reference background and reference signal (Prs+no-Prs)
-        res2 , nFit = fitSignal ( _func , h0 , background = r3 , signal = r1 )
-        nFits += nFit
-    if not res2 or not checkHisto ( h0 ) :
-        ok2 = 4 
-        ## use own background and reference signal (Prs+Prs)
-        res2 , nFit = fitSignal ( _func , h0 , background = h3 , signal = r2 )
-        nFits += nFit
-    if ( not res2 or not checkHisto ( h0 ) ) and r3 :
-        ok2 = 5 
-        ## use reference background and reference signal (Prs+Prs)
-        res2 , nFit = fitSignal ( _func , h0 , background = r3 , signal = r2 )
-        nFits += nFit
-    if not res2 or not checkHisto ( h0 ) :
-        ok2 = -1 
-        if not force :
-            result =  (ok2,ok1,ok0, nFits)
-            histoset.result = result 
-            return result 
-
-    result =  (ok2,ok1,ok0, nFits)
-    histoset.result = result 
-    return result 
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/MassDistribution/FitTask.py b/Phys/KaliCalo/python/KaliCalo/MassDistribution/FitTask.py
deleted file mode 100644
index 63873e856..000000000
--- a/Phys/KaliCalo/python/KaliCalo/MassDistribution/FitTask.py
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file FitTask.py
-# @author Albert Puig Navarro (albert.puig@cern.ch)
-# @reshuffled from Vanya Belyaev's FitTask.py
-# @date 2010-11-13
-# =============================================================================
-"""
-"""
-
-__author__ = "Albert Puig (albert.puig@cern.ch)"
-__date__ = "$Date$"
-__version__ = "$Revision$"
-
-__all__ = [ 'FitTask' , 'fitHistos' ]
-
-import KaliCalo.Kali.FitTaskBase              as _FitTaskBase
-import KaliCalo.MassDistribution.FitFunctions as _FitFunctions
-
-FitTask = _FitTaskBase.FitTask
-
-fitHistos = _FitTaskBase.FitHistos( _FitFunctions.fitHistoSet    ,
-                                    _FitFunctions.preFitHistoSet )
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/MassDistribution/Run.py b/Phys/KaliCalo/python/KaliCalo/MassDistribution/Run.py
deleted file mode 100644
index 4ff2f8307..000000000
--- a/Phys/KaliCalo/python/KaliCalo/MassDistribution/Run.py
+++ /dev/null
@@ -1,147 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file KaliCalo/MassDistribution/RunMassDistributionCalibration.py
-# A way to start the calibration with the Mass Distribution Fit method
-# @author Daria Savrina (dsavrina@mail.cern.ch)
-# @date 2011-04-15
-# =============================================================================
-"""
-A file which starts the full calibration process with the Mass Distribution Fit
-Method.
-
-Usage:
-> python RunMassDistributionCalibration.py
-"""
-from KaliCalo.MassDistribution.FillTask import fillDatabase
-from KaliCalo.MassDistribution.Analyse import analyse
-    
-import KaliCalo.Kali as Kali
-import KaliCalo.Kali.LambdaMap as LambdaMap
-import KaliCalo.ZipShelve as ZipShelve 
-import KaliCalo.FakeCells as FakeCells
-import os
-
-import sys
-sys.path += ['.']
-
-## input Kali nTuples
-localdir = '/afs/cern.ch/user/d/dsavrina/public/testKaliCalo/'
-pattern  =  'Kali-hltf0101-0-%i.root'
-files = [ localdir+pattern%i for i in range(0,6) ] ## there are eleven files
-
-FilledHistoPath = 'FilledHistograms%i.gz'        ## path to save the filled histogram map
-FittedHistoPath = 'FittedHistograms%i.gz'        ## path to save the fitted histogram map
-LambdasPath = 'Lambdas%i.gz'                     ## path to save the calibration coefficients
-ProblemsPath = 'ProblematicCells%i.gz'           ## path to save the problematic cells info
-
-if '__main__' == __name__ :
-    
-    ## setup parallel processing
-    from GaudiMP.Parallel import WorkManager
-    manager = WorkManager( ppservers = () , ncpus = 7 )
-    
-    lambdas  = LambdaMap.LambdaMap()
-    fakeCell = FakeCells.SameCell ()  ## use 
-    
-    deltas  = [] 
-
-    import sys
-    
-    output = sys.stdout
-    
-    ## make 10 "primary" iterations
-    for i in range ( 0 , 10 ) :
-        
-        output.flush()
-        
-	## ==============================
-        ## fill the histograms
-	## ==============================
-        histos, badfiles = fillDatabase (  ## recieve a map of filled histograms and list of incorrect files
-            lambdas                        ## map of the calibration coefficients
-            , files                        ## input nTuples
-            , manager = manager            ## parallel processing manager
-            )
-
-	## save the filled histograms
-        print 'SAVE local_zdb.gz'
-        if os.path.exists ( FilledHistoPath%i ) :
-            os.remove ( FilledHistoPath%i )
-        histos.save (FilledHistoPath%i)
-        
-        print 'HISTOS', len(histos), histos.entries()
-        output.flush()
-        
-	## ==============================
-        ## fit the histograms
-	## ==============================
-        bad,low,nfit = analyse (         ## recieve a dictionary of the bad, not fit histograms and the ones with low statistics
-            histos            ,          ## map of the filled histograms
-            lambdas           ,          ## map of the calibration coefficients
-            fitted  = False   ,          ## not fitted yet
-            manager = manager ,          ## parallel processing manager
-            nHistos = 60                 ## number of histograms per core/machine
-            ) 
-        
-	## save the fitted histograms
-        print 'SAVE fit_zdb.gz'
-        if os.path.exists ( FittedHistoPath%i ) :
-            os.remove ( FittedHistoPath%i )
-        histos.save (FittedHistoPath%i)
-            
-	## save the obtained coefficients
-        print 'SAVE lambdas_zdb.gz'
-        lambdas.save ( LambdasPath%i)
-        lambdas.save ( LambdasPath%i )
-
-        ## Report problematic cells:
-        dbase = ZipShelve.open ( ProblemsPath%i )
-
-        ## Print out and save the problematic cells
-        print 'BAD-CELLS : #', len ( bad  ) 
-        dbase['BadCells' ] = bad
-        for b in bad  :            
-            print 'BadCell : ', b , histos[b].entries()
-            key = 'BadCell ' + str(b)
-            dbase [key] = histos[b]            
-        
-        print 'LOW-CELLS : #', len ( low  ) 
-        dbase['LowCells' ] = low
-        for b in low  :
-            print 'LowCell : ', b , histos[b].entries()
-            key = 'LowCell ' + str(b)
-            dbase [key] = histos[b]
-                
-        print 'NFIT-CELLS: #', len ( nfit ) 
-        dbase['NFitCells'] = nfit
-        for b in nfit :
-            print 'nFitCell: ', b , histos[b].entries()
-            key = 'nFitCell ' + str(b)
-            dbase [key] = histos[b]
-
-
-        ## print out the statistics of the coefficients variation
-        large = lambdas.large ( 0.15 )
-        print '# of >15% ' , len(large)
-        dbase['Large_15%'] = large
-
-        large = lambdas.large ( 0.10 )
-        print '# of >10% ' , len(large)
-        dbase['Large_10%'] = large
-        
-        large = lambdas.large ( 0.05 )
-        print '# of > 5% ' , len(large)
-        dbase['Large_5%'] = large
-        
-        large = lambdas.large ( 0.02 )
-        print '# of > 2% ' , len(large)
-        dbase['Large_2%'] = large
-
-        large = lambdas.large ( 0.01 )
-        print '# of > 1% ' , len(large)
-
-        print 'DB keys: '
-        for key in dbase : print key
-        dbase.close()
-        
-        output.flush()
diff --git a/Phys/KaliCalo/python/KaliCalo/MassDistribution/__init__.py b/Phys/KaliCalo/python/KaliCalo/MassDistribution/__init__.py
deleted file mode 100644
index aecd04726..000000000
--- a/Phys/KaliCalo/python/KaliCalo/MassDistribution/__init__.py
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-# @file __init__.py
-# @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-# @reshuffled by Albert Puig (Albert.Puig@cern.ch)
-# @date 2010-11-09
-# =============================================================================
-"""
-"""
-
-__author__  = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__    = "$Date$"
-__version__ = "$Revision$"
-
-__all__ = ['Histos', 'HistoMap', 'getHistosFromDB']
-
-from KaliCalo.Kali.HistoBase import HistosBase as _HistosBase
-from KaliCalo.Kali.HistoBase import HistoMapBase as _HistoMapBase
-
-class Histos( _HistosBase):
-    def __init__ ( self, cellID , background = False ):
-        histoList = [ '_LL' , '_LG' , '_GG' ]
-        if background:
-          histoList.extend( [ '_LL_BG' , '_LG_BG' , '_GG_BG' ] )
-        _HistosBase.__init__ ( self , cellID , histoList , 2 )
-        
-class HistoMap( _HistoMapBase ):
-    def __init__ ( self, background = False , *args ):
-        _HistoMapBase.__init__ ( self , Histos , background , *args )
-
-# =============================================================================
-## get the histograms fomr data base (databases)
-def  getHistosFromDB ( dbases ) :
-    """
-    Get the histograms from data base (databases)
-    """
-    if issubclass ( type ( dbases ) , HistoMap ) :
-        return dbases
-    histos = HistoMap()
-    histos.updateFromDB ( dbases )
-    return histos
-
-# EOF
diff --git a/Phys/KaliCalo/python/KaliCalo/Pi0.py b/Phys/KaliCalo/python/KaliCalo/Pi0.py
deleted file mode 100644
index b19e2134f..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Pi0.py
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-"""
-A script for iterative (pi0->gamma gamma) ECAL calibration (primary iterations)
-
-Run:
-> python Pi0.py
-
-niter is the desired number of iterations (10 by default)
-alam   is the dictionary of the calibration coefficients, cell IDs are used as
-       the dictionary keys
-pi0mas is the dictionary of the pi0 mass histograms, cell IDs are used as the
-       dictionary keys
-"""
-# =============================================================================
-from ROOT import TFile, TH1F
-
-# ========================== some nessesary variables =========================
-niter=10                               # number of iterations
-alam = {}                              # dictionary of the calibration coefficients
-pi0mass={}                             # dictionary of the pi0 mass histograms
-Nbad=0                                 # number of cells with too few statistics
-
-from Pi0FillHistos import MyPySelector
-from Pi0HistoFit import HiFit
-
-# =============================== opening a file ==============================
-#== opening a file
-fil=TFile("KaliPi0_Tuples.root")
-
-#== extracting a tree
-Bamboo=fil.Get("KaliPi0/Pi0-Tuple")
-
-# =========================== starting the iterations =========================
-for i in range(niter):
-    print '='*20, "iteration number", i, '='*20
-
-    # sending the correction coefficients to the selector
-    MyPySelector().CoefGet(alam, pi0mass)
-
-    # processing the tree to fill the histograms
-    Bamboo.Process("TPySelector","Pi0FillHistos")
-
-    # getting the mass histograms
-    pi0mass,alam=MyPySelector().HiReturn()
-
-    # fitting the histograms and getting a dictionary of the fit coefficients
-    alam=HiFit(pi0mass,alam)
-
-f = open('Coefficients.txt','w')
-print >> f, alam
-
-for j in alam.keys():
-    if(alam[j]==1.0): Nbad+=1
-
-print "Cells calibrated", len(alam) - Nbad
-print Nbad, "cells have too few events for calibration"
-print "The others have no events at all"
-
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/Pi0_2.py b/Phys/KaliCalo/python/KaliCalo/Pi0_2.py
deleted file mode 100755
index 98ac926e9..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Pi0_2.py
+++ /dev/null
@@ -1,170 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-## @file KaliPi0/Pi0_2.py
-# 
-# A script for iterative (pi0->gamma gamma) ECAL calibration (primary iterations)
-# 
-# Run:
-# 
-# > python Pi0.py
-#
-# =============================================================================
-"""
-A script for iterative (pi0->gamma gamma) ECAL calibration (primary iterations)
-
-Run:
-
-> python Pi0_2.py
-
-niter is the desired number of iterations (10 by default)
-alam   is the dictionary of the calibration coefficients, cell IDs are used as
-       the dictionary keys
-pi0mas is the dictionary of the pi0 mass histograms, cell IDs are used as the
-       dictionary keys
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__    = " 2010-02-?? "
-__version__ = " CVS tag $Name: not supported by cvs2svn $, version $Revision$ "
-# =============================================================================
-import ROOT, math 
-c1 = ROOT.TCanvas()
-
-import KaliCalo.Kali        as Kali 
-import KaliCalo.ZipShelve   as ZipShelve 
-
-from KaliCalo.Pi0FillHistos import fillHistos
-from KaliCalo.Analyse       import analyse
-
-    
-# =============================================================================    
-## Define 'fake' cell (useful) for grouping 
-def fakeCell ( c ) :
-    """
-    Define 'fake' cell (useful) for grouping 
-    """
-    i = c.row()
-    j = c.col()
-    
-    z   = math.sqrt ( (i-31.5)**2 + (j-31.5)**2 )
-    z  -= 5
-    z   = abs ( z )
-    z   = int ( z / 4 )
-    
-    nc  = Kali.CellID ( c.calo () , c.area () , z , 1 )
-    
-    return nc 
-
-
-# =============================================================================
-def buildTable ( lams  ,
-                 cells ,
-                 func  ) :
-
-    results = {}
-    for cell in cells :
-        newCell = Kali.CellID ( func ( cell ) )
-        if lams.has_key ( newCell ) :
-            results [ cell ] = lams [ newCell ]
-            
-    return results 
-    
-# =============================================================================
-
-
-# =============================================================================
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print '*'*120
-
-    
-    fname      = "KaliPi0_Tuples_2k+9-Loose.root" 
-
-    f    = ROOT.TFile( fname )
-    tree = f.Get ("KaliPi0/Pi0-Tuple" )
-    
-    histos, lambdas = fillHistos ( tree , cellFunc = fakeCell )
-    
-    analyse ( histos , lambdas )
-
-    import shelve
-
-    bad = []
-    low = [] 
-    ## iterate ?
-    for n in range  ( 0 , 10 ) :
-    ##for n in range  ( 0 , 0 ) :
-        
-        print ' ITERATION : ', n
-        histos.reset() 
-        histos, lambdas = fillHistos (
-            tree     , 
-            histos   ,
-            lambdas  ,
-            fakeCell 
-            )
-        
-        bad, low = analyse ( histos , lambdas )
-        print " Bad/low cells: %d/%d " % ( len ( bad ) , len ( low ) )  
-
-        lams = lambdas.lambdas()
-
-        print 'Calibration Coefficients '
-        keys = lams.keys()
-        keys.sort() 
-        for key in Kali.Zones  :
-            if key in keys : 
-                keys.remove ( key     )
-                keys.insert ( 0 , key )
-            
-        for key in keys :
-            if key in Kali.Zones :
-                hs     = histomap[key].histos() 
-                r0 = Fit.getPi0Params ( hs[0] )
-                r1 = Fit.getPi0Params ( hs[1] )
-                r2 = Fit.getPi0Params ( hs[2] )
-                print ' MASS : %.20s %.20s %.20s ' % ( r0[1] , r1[1] , r2[1] ) , key 
-                print ' SIGMA: %.20s %.20s %.20s ' % ( r0[2] , r1[2] , r2[2] ) , key 
-                print ' NUM0 : %.20s %.20s %.20s ' % ( r0[0] , r1[0] , r2[0] ) , key
-                print ' S/B  : %.20s %.20s %.20s ' % ( r0[0] / r0[3] ,
-                                                       r1[0] / r1[3] ,
-                                                       r2[0] / r2[3] ) , key
-                continue
-            
-            print ' %-25s %9.4g  ' % ( key , lams[key] ) , [ ' %.3f ' % l for l in lambdas[key] ]
-
-
-
-    dbase_name = 'Ecal_2k+9-Loose-details-zdb' 
-    histos.save  ( dbase_name )
-    lambdas.save ( dbase_name )
-    
-    
-    
-    celldb = shelve.open ( 'cells_db', 'r' )
-    cells  = celldb['AllCells']
-    
-    lams   = lambdas.lambdas()
-    map    = buildTable ( lams     ,
-                          cells    ,
-                          fakeCell )         
-    prsdbase = ZipShelve.open ('prs-2k+9_zdb') 
-    prs = prsdbase['Prs-2k+9']
-    
-    dbase_r_name = 'Ecal_2k+9-Loose-results-zdb'
-    dbase = ZipShelve.open ( dbase_r_name )
-    dbase [ 'Ecal'   ] = map
-    dbase [ 'Prs'    ] = prs
-    dbase ['BadCells'] = bad
-    dbase ['LowCells'] = low
-    
-    
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/Pi0_3.py b/Phys/KaliCalo/python/KaliCalo/Pi0_3.py
deleted file mode 100644
index 2dfa76b92..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Pi0_3.py
+++ /dev/null
@@ -1,142 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-## @file KaliPi0/Pi0_3.py
-# 
-# A script for iterative (pi0->gamma gamma) ECAL calibration (primary iterations)
-# 
-# Run:
-# 
-# > python Pi0.py
-#
-# =============================================================================
-"""
-A script for iterative (pi0->gamma gamma) ECAL calibration (primary iterations)
-
-Run:
-
-> python Pi0_3.py
-
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__    = " 2010-03-20 "
-__version__ = " CVS tag $Name: not supported by cvs2svn $, version $Revision$ "
-# =============================================================================
-import ROOT, math 
-c1 = ROOT.TCanvas()
-
-import KaliCalo.Kali as Kali 
-
-from   KaliCalo.Pi0FillHistos    import fillDataBase
-from   KaliCalo.Analyse          import analyse
-from   GaudiKernel.SystemOfUnits import GeV
-    
-# =============================================================================
-def buildTable ( lams  ,
-                 cells ,
-                 func  ) :
-
-    results = {}
-    for cell in cells :
-        newCell = Kali.CellID ( func ( cell ) )
-        if lams.has_key ( newCell ) :
-            results [ cell ] = lams [ newCell ]
-            
-    return results 
-    
-# =============================================================================
-
-def fakeCell ( cell ) :
-
-    nc = Kali.CellID ( cell.calo () ,
-                       cell.area () ,
-                       cell.row  () , 1 ) 
-    return  nc
-    
-# =============================================================================
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print '*'*120  
-    
-    import KaliCalo.ZipShelve as ZipShelve 
-    
-    lfns = [ 'LFN:/lhcb/user/a/apuignav/6966/6966779/KaliPi0_Tuples.root',
-             'LFN:/lhcb/user/a/apuignav/6966/6966780/KaliPi0_Tuples.root',
-             'LFN:/lhcb/user/a/apuignav/6966/6966781/KaliPi0_Tuples.root',
-             'LFN:/lhcb/user/a/apuignav/6966/6966782/KaliPi0_Tuples.root'
-             ] 
-
-    castor = '/castor/cern.ch/user/i/ibelyaev/Kali/MC09_Miscalib_Tuples_2/'
-    
-    files = [ '6966779.KaliPi0_Tuples.root',
-              '6966780.KaliPi0_Tuples.root',
-              '6966781.KaliPi0_Tuples.root',
-              '6966782.KaliPi0_Tuples.root'
-              ] 
-
-    files = [ castor + f for f in files ]
-    
-    lambdas = Kali.LambdaMap()
-
-    bad, low = [],[]
-
-    dbase_name_1 = 'details_zdb'
-    dbase_name_2 = 'results_zdb'
-    
-    for niter in range ( 0 , 1 ) :
-        
-        histos, lambdas , badfiles = fillDataBase (
-            lambdas                   ,
-            files[:2]                 , 
-            dbase_name = 'kali_db.gz' , 
-            Unit = GeV 
-            )
-        
-        if badfiles : print ' Bad files: ', badfiles 
-        
-##         ## bad,low =  analyse ( histos , lambdas )
-##         bad,low = [], [] ## analyse ( histos , lambdas )
-        
-##         if bad      : print 'Bad cells           ', len(bad) 
-##         if low      : print 'Low occupancy cells ', len(low) 
-
-##         lams = lambdas.lambdas()
-        
-##         print 'Calibration Coefficients '
-##         keys = lams.keys()
-##         keys.sort() 
-##         for key in Kali.Zones  :
-##             if key in keys : 
-##                 keys.remove ( key     )
-##                 keys.insert ( 0 , key )
-##         for key in keys :
-##             if key in Kali.Zones :
-##                 hs     = histomap[key].histos() 
-##                 r0 = Fit.getPi0Params ( hs[0] )
-##                 r1 = Fit.getPi0Params ( hs[1] )
-##                 r2 = Fit.getPi0Params ( hs[2] )
-##                 print ' MASS : %.20s %.20s %.20s ' % ( r0[1] , r1[1] , r2[1] ) , key 
-##                 print ' SIGMA: %.20s %.20s %.20s ' % ( r0[2] , r1[2] , r2[2] ) , key 
-##                 print ' NUM0 : %.20s %.20s %.20s ' % ( r0[0] , r1[0] , r2[0] ) , key
-##                 print ' S/B  : %.20s %.20s %.20s ' % ( r0[0] / r0[3] ,
-##                                                        r1[0] / r1[3] ,
-##                                                        r2[0] / r2[3] ) , key
-##                 continue
-            
-##             print ' %-25s %9.4g  ' % ( key , lams[key] ) , [ ' %.3f ' % l for l in lambdas[key] ]
-
-        
-##        dbase = ZipShelve.open ( dbase_results_1 )
-##        dbase [ 'Ecal'] = lambdas
-##        dbase.close()
-
-        
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/ReadDB.py b/Phys/KaliCalo/python/KaliCalo/ReadDB.py
deleted file mode 100755
index 7da80e1af..000000000
--- a/Phys/KaliCalo/python/KaliCalo/ReadDB.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-## @file KaliCalo/ReadDB.py
-#  helper module to read local ``Kali'' data base 
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-03-18
-# =============================================================================
-"""
-helper module to read local ``Kali'' data base 
-"""
-# =============================================================================
-__author__  = " Vanya BELYAEV Ivan.Belyaev@nikhef.nl "
-__date__    = " 2009-09-17 "
-__version__ = " CVS Tag $Name: not supported by cvs2svn $, version $Revision$"
-# =============================================================================
-import ROOT
-import shelve 
-import CaloUtils.CellID, LHCbMath.Types, KaliCalo.Kali
-
-
-dbase_name = 'Ecal_2k+10_Mar_18_db'
-
-dbase = shelve.open( dbase_name , 'r')
-
-for key in dbase : print key
-
-print dbase_name
-
-
-# =============================================================================
-if '__main__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print '*'*120  
-
-
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/Utils.py b/Phys/KaliCalo/python/KaliCalo/Utils.py
deleted file mode 100755
index d93fad363..000000000
--- a/Phys/KaliCalo/python/KaliCalo/Utils.py
+++ /dev/null
@@ -1,373 +0,0 @@
-#!/usr/bin/env python
-# =============================================================================
-## @file KaliCalo/Utils.py
-#
-#  Set of useful utilities for Kali framework
-#
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-03-23
-# =============================================================================
-"""
-Set of useful utilities for Kali framework
-"""
-# =============================================================================
-__author__   = " Vanya BELYAEV Ivan.Belyaev@itep.ru "
-__date__     = " 2010-03-23 "
-__version__  = " CVS tag $Name: not supported by cvs2svn $, version $Revision$ "
-__all__      = (
-    "RootFile"          ,
-    "POOLCatalogParser" ,
-    "InputDataList"
-    )
-# =============================================================================
-import ROOT 
-import os
-import re
-
-# =============================================================================
-## @class RootFile
-#
-#  "Smart-Open for ROOT files"
-#
-#  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-#  @date 2010-03-23
-# 
-class RootFile  ( object ) :
-    """
-    SmartOpen for ROOT files
-    
-    @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-    @date   2010-03-23
-    
-    >>> f = RootFile ( name , 'READ' , safe = False )
-    
-    
-    """
-        
-    ## constructor from filename 
-    def __init__ ( self , filename , opts = 'READ' , safe = True )  :
-        
-        self._remove = False 
-        self._file   = None
-
-        filename = filename.replace ('lfn:','LFN:')
-        
-        ## test various LFN patterns 
-        for lfn in ( 'LFN:'        ,
-                     '/lhcb/user/' ,
-                     '/lhcb/data/' ,
-                     '/lhcb/MC/'   ) :
-            
-            pos = filename.find ( lfn )
-            if 0 != pos : continue
-
-            ## 1. try to open using PFN -> LFN converter 
-            if self.__open_pfn  ( filename ) : break 
-            
-            ## 2. try to copy file from GRID 
-            if self.__open_grid ( filename ) : break 
-
-        ## open as local file 
-        if not self._file :
-            try : 
-                ## castor?  
-                if 0 == filename.find ( '/castor' ) : filename = 'castor:' + filename
-                self._file   = ROOT.TFile().Open ( filename , opts  )
-                self._remove = False 
-            except :
-                self._file   = None
-                self._remove = False
-                
-        if safe and not self.isOK () :
-            raise NameError ('Unable to open properly %s ' % filename )
-
-    # Open PFN using LFN -> PFN converter 
-    def __open_pfn  ( self , filename , catalogue  = None ) :
-        """
-        Open PFN using LFN -> PFN converter based on local POOL catalogue  
-        """
-        if not catalogue :
-            calalogue = POOLCatalogParser()
-
-        try :
-            pfn = catalogue.pfn ( filename )
-            if pfn : 
-                self._remove = False
-                self._file   = ROOT.TFile().Open ( pfn )
-            if not self.isOK () :
-                raise NameError ('Unable to open properly %s ' % filename )
-        except :
-            self._remove = False
-            self._file   = None 
-
-        return self.isOK() 
-                
-    ## open file from GRID
-    def __open_grid ( self , filename ) :
-        """
-        Copy the file from the grid into local temporary directory and open it
-        """
-        name    = filename.split('/')[-1]  ## assume it is LFN
-
-        import os,tempfile
-        
-        ## build the temporary directory: 
-        tmpdir    = tempfile.mkdtemp()
-        
-        ## create the name for the temporary file
-        tmpfile   = tempfile.mktemp( suffix = '.root' )            
-        
-        ## construct the name for the temporary file in temporary
-        localfile = tmpdir + os.sep + name
-        
-        try :
-            
-            ## command to copy file from the grid 
-            command = ' ( cd %s && dirac-dms-get-file %s ) '
-            command = command % ( tmpdir , filename )
-
-            import popen2
-            cout, cin, cerr = popen2.popen3 ( command )
-            for line in cerr : print ' STDERR: ', line
-            
-            if not os.path.exists ( localfile ) :
-                raise NameError ("Unable to get from GRID " + filename ) 
-
-            ## rename the file 
-            os.rename ( locafile , tmpfile )
-            
-            if not os.path.exists ( tmpfile ) :
-                raise NameError ("Unable to get from GRID " + filename ) 
-            
-            self._remove = True 
-            self._file   = ROOT.TFile ( tmpfile , 'READ' )
-            
-            if not self.isOK () :
-                raise NameError ('Unable to open properly %s ' % filename )
-            
-        except:
-            ## clear the temporary file in case of error 
-            if os.path.exists ( tmpfile   ) : os.remove ( tmpfile   )
-            self._remove = False 
-            self._file   = None 
-        finally:
-            ##  clean the temporary locations 
-            if os.path.exists ( localfile ) : os.remove ( localfile )
-            if os.path.exists ( tmpdir    ) : os.rmdir  ( tmpdir    ) 
-
-        return self.isOK ()
-    
-    ## ok ?
-    def isOK ( self ) :
-        """
-        Ok?
-        """
-        return True if self._file and self._file.IsOpen() else False
-    
-    ## get something from the file 
-    def Get    ( self , what ) :
-        """
-        Get something from the file
-        """
-        if not self.isOK() : return None 
-        return self._file.Get ( what )
-
-    ## get the name 
-    def GetName ( self ) :
-        """
-        get the name
-        """
-        if not self.isOK() : return None 
-        return self._file.GetName() 
-        
-    ## close root file 
-    def close ( self ) :
-        """
-        Close Root file 
-        """
-        fname = None
-        if self._file :
-            try : 
-                fname = self._file.GetName() 
-                if self._file and self._file.IsOpen()  :
-                    print 'Close ROOT File ', self._file.GetName() 
-                    ROOT.gROOT.GetListOfFiles().Remove ( self._file ) 
-                    self._file.Close('R')
-                del self._file
-            except : pass 
-
-        self._file = None
-        if fname and self._remove :
-            print 'Delete ROOT file ', fname 
-            try: 
-                os.remove ( fname )
-            except :
-                pass 
-
-    ## close the file         
-    def Close   ( self ) :
-        """
-        Close the file
-        """
-        return self.close () 
-    ## 
-    def __del__ ( self ) : return self.close () 
-
-            
-
-# =============================================================================
-## @class   POOLCatalogParser
-#  Parser for POOL XML-catalogue.
-#  The code is based on the original PoolFileCatalogParser code by Albert Puig
-#  @author Vanya  BELYAEV Ivan.Belyaev@itep.ru
-#  @author Albert PUIG    Albert.Puig@cern.ch
-#  @date 2010-03-23
-class POOLCatalogParser (object) :
-    """
-    Parser for POOL XML-catalogue.
-    The code is based on the original PoolFileCatalogParser code by Albert Puig
-    
-    @author Vanya  BELYAEV Ivan.Belyaev@itep.ru
-    @author Albert PUIG    Albert.Puig@cern.ch
-    
-    """
-    ## standard constructor from the catalogue name 
-    def __init__ ( self , catalog = './pool_xml_catalog.xml' ) :
-        """
-        Standard constructor from the catalogue name
-        """
-
-        ## guid -> LFN 
-        self._lfns = {}
-        ## lfn  -> PFNs 
-        self._pfns = {}
-
-        try :
-            
-            from xml.dom import minidom
-            
-            files  = [] 
-            xmldoc = minidom.parse ( catalog )
-            main   = xmldoc .childNodes
-            for node in main :
-                if node.localName == "POOLFILECATALOG" :
-                    files += self.__find ( node , 'File' )
-
-            for item in files :
-                guid     = item.getAttribute('ID').encode('ascii')
-                logicals = self.__find ( item , 'logical' )
-                for logical in logicals :
-                    lfn = self.__find ( logical , 'lfn' ) [0]
-                    lfn = lfn.attributes['name']
-                    lfn = lfn.childNodes[0].data.encode('ascii')
-                    self._lfns [ guid ] = 'LFN:'+lfn
-                
-                physicals = self.__find( item , 'physical' )
-                for physical in physicals :
-                    pfn = self.__find ( physical , 'pfn' ) [0]
-                    pfn = pfn.attributes['name']
-                    pfn = pfn.childNodes[0].data.encode('ascii')
-                
-                    lfn = self._lfns[ guid ] 
-                    if self._pfns.has_key ( lfn ) : self._pfns[ lfn ].append ( pfn )
-                    else                          : self._pfns[ lfn ] = [ pfn ]
-                    
-        except IOError :
-            
-            print 'POOLCatalogParse: Unable to parse catalog "%s" ' % catalog
-            self._lfns = {} 
-            self._pfns = {}
-            
-            pass
-        
-        if not self._lfns :
-            print 'POOLCatalogParse: Empty list of LFNs : "%s"' % catalog
-        if not self._pfns :
-            print 'POOLCatalogParse: Empty list of PFNs : "%s"' % catalog
-
-
-    ## get the list of LFNs 
-    def lfns ( self ) :
-        """
-        Get the list of LFNs
-        """
-        s = []
-        for key in self._lfns : s.append ( self._lfns[key]  )
-        s.sort() 
-        import sets
-        s = sets.Set( s ) 
-        return list ( s ) 
-
-    ## get the list of PFNs
-    def pfns ( self ) :
-        """
-        Get the list of PFNs
-        """
-        s = []
-        for key in self._pfns: s += self._pfns[key]  
-        s.sort()
-        import sets
-        s = sets.Set( s ) 
-        return list ( s ) 
-
-    ## get PFN for certain LFN
-    def pfn ( self , lfn ) :
-        """
-        Get PFN for certain LFN
-        """
-        lfn = lfn.replace ('lfn:','LFN:')
-        if self._pfns.has_key ( lfn ) : return self._pfns[ lfn ][0]
-        if 0 != lfn.find  ( 'LFN:' )  :
-            return self.pfn ( 'LFN:' + lfn )
-        ##
-        return None
-
-    ## get subnodes by name 
-    def __find ( self , node , name ) :
-        """
-        Get subnodes by name
-        """
-        out = []
-        for item in node.childNodes :
-            if item.localName == name :
-                out.append  ( item ) 
-        return out 
-
-# =============================================================================
-## @class   InputDataList
-#  Parser for InputData in "EventSelector"-style. Extracts filenames.
-#  @author Albert PUIG    Albert.Puig@cern.ch
-#  @date 2010-03-23
-class InputDataList ( object ):
-    """
-    Parser for InputData in "EventSelector"-style. Extracts filenames.
-  
-    @author Albert PUIG    Albert.Puig@cern.ch
-  
-    """  
-    def __init__ ( self , eventSelectorData ):
-        self._files = self.__extractFileNames( eventSelectorData )
-    
-    def __extractFileNames( self , fileList ):
-        regex = re.compile( "((LFN|PFN):/.*/.*\.\w*)" )
-        return [ match.group( 1 ) for match in [ regex.search( line ) for line in fileList ] if match ]
-        
-    def files( self ):
-        return self._files
-
-# =============================================================================
-if '__name__' == __name__ :
-    
-    ## make printout of the own documentations 
-    print '*'*120
-    print                      __doc__
-    print ' Author  : %s ' %   __author__    
-    print ' Version : %s ' %   __version__
-    print ' Date    : %s ' %   __date__
-    print ' __all__ : '    ,   __all__  
-    print '*'*120  
-    
-    
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/ZipShelve.py b/Phys/KaliCalo/python/KaliCalo/ZipShelve.py
deleted file mode 100755
index f800f5655..000000000
--- a/Phys/KaliCalo/python/KaliCalo/ZipShelve.py
+++ /dev/null
@@ -1,306 +0,0 @@
-"""
-This is  zip-version of shelve-data base
-
-"""
-# =============================================================================
-__all__ = (
-    'ZipShelf' ,
-    'open'      
-    )
-# =============================================================================
-
-try:
-    from cPickle import Pickler, Unpickler, HIGHEST_PROTOCOL
-except ImportError:
-    from  pickle import Pickler, Unpickler, HIGHEST_PROTOCOL 
-
-try:
-    from cStringIO import StringIO
-except ImportError:
-    from  StringIO import StringIO
-
-
-import os
-import zlib        ## use zlib to compress dbfile
-import shelve      ## 
-import shutil
-
-# =============================================================================
-## Zipped-version of ``shelve''-database     
-class ZipShelf(shelve.Shelf):
-    """
-    Zipped-version of ``shelve''-database     
-    """    
-    def __init__(
-        self                                   ,
-        filename                               ,
-        flag      = 'c'                        , 
-        protocol  = HIGHEST_PROTOCOL           , 
-        compress  = zlib.Z_BEST_COMPRESSION    ,
-        writeback = False                      ,
-        silent    = False                      ) :
-
-        self.__gzip          = False 
-        self.__filename      = filename
-        self.__remove        = False
-        self.__silent        = silent
-        self.__opened        = False 
-
-        if not self.__silent :
-            print 'ZipShelve: ', filename
-            
-        if filename.rfind ( '.gz' ) + 3 == len ( filename ) :
-            
-            if os.path.exists ( filename ) and 'r' == flag :
-                ## gunzip into temporary location
-                filename_ = self._gunzip ( filename ) 
-                if not os.path.exists ( filename_ ) :
-                    raise TypeError ( "Unable to gunzip properly:" + filename )
-                if not self.__silent : 
-                    size1 = os.path.getsize ( filename  ) 
-                    size2 = os.path.getsize ( filename_ )
-                    print "GZIP uncompression %s: %.1f%%" %  ( filename , (size2*100.0)/size1 ) 
-                filename        = filename_ 
-                self.__filename = filename_
-                self.__remove   = True
-            elif os.path.exists ( filename ) and 'r' != flag :
-                ## unzip in place
-                filename_     = filename[:-3]
-                # remove existing file (if needed) 
-                if os.path.exists ( filename_ ) : os.remove ( filename_ )
-                size1 = os.path.getsize ( filename  ) 
-                # gunzip in place 
-                self.__in_place_gunzip  ( filename ) 
-                ##
-                if not os.path.exists ( filename_ ) :
-                    raise TypeError ( "Unable to gunzip properly:" + filename )
-                if not self.__silent : 
-                    size2 = os.path.getsize ( filename_ )
-                    print "GZIP uncompression %s: %.1f%%" %  ( filename , (size2*100.0)/size1 )
-                filename        = filename_ 
-                self.__gzip     = True 
-                self.__filename = filename_
-                self.__remove   = False
-            else : 
-                ## 
-                filename        = filename[:-3]
-                self.__gzip     = True 
-                self.__filename = filename
-
-        import anydbm
-        shelve.Shelf.__init__ (
-            self                                   ,
-            anydbm.open ( self.__filename , flag ) ,
-            protocol                               ,
-            writeback                              )
-        
-        self.compresslevel = compress
-        self.__opened      = True 
-        
-    ## destructor 
-    def __del__ ( self ) :
-        """
-        Destructor 
-        """
-        if self.__opened : self.close()  
-
-    ## list the avilable keys 
-    def __dir ( self ) :
-        """
-        List the avilable keys
-        """
-        for key in self : print key
-
-    ## list the avilable keys 
-    def ls    ( self ) :
-        """
-        List the avilable keys
-        """
-        return self.__dir()
-        
-    ## cloze and gzip (if needed)
-    def close ( self ) :
-        """
-        Close the file (and gzip it if required) 
-        """
-        if not self.__opened : return 
-        ##
-        shelve.Shelf.close ( self )
-        self.__opened = False  
-        ##
-        if self.__remove and os.path.exists ( self.__filename ) :
-            if not self.__silent : print 'REMOVE: ', self.__filename
-            os.remove ( self.__filename )
-        ##
-        if self.__gzip and os.path.exists ( self.__filename ) :
-            # get the initial size 
-            size1 = os.path.getsize ( self.__filename )
-            # gzip the file
-            self.__in_place_gzip ( self.__filename ) 
-            #
-            if not os.path.exists ( self.__filename + '.gz' ) :
-                print 'Unable to compress the file ', self.__filename   
-            size2 = os.path.getsize( self.__filename + '.gz' )
-            if not self.__silent : 
-                print 'GZIP compression %s: %.1f%%' % ( self.__filename, (size2*100.0)/size1 )
-
-    ## gzip the file (``in-place'') 
-    def __in_place_gzip   ( self , filein ) :
-        """
-        Gzip the file ``in-place''
-        
-        It is better to use here ``os.system'' or ``popen''-family,
-        but it does not work properly for multiprocessing environemnt
-        
-        """
-        if os.path.exists ( filein + '.gz' ) : os.remove ( filein + '.gz' )
-        #
-        # gzip the file 
-        fileout = self._gzip ( filein )
-        # 
-        if os.path.exists ( fileout ) :
-            # rename the temporary file 
-            shutil.move ( fileout , filein + '.gz' )
-            #
-            import time
-            time.sleep( 3 )
-            #
-            # remove the original
-            os.remove   ( filein ) 
-
-    ## gunzip the file (``in-place'') 
-    def __in_place_gunzip   ( self , filein ) :
-        """
-        Gunzip the file ``in-place''
-        
-        It is better to use here ``os.system'' or ``popen''-family,
-        but unfortunately it does not work properly for multithreaded environemnt
-        
-        """
-        #
-        filename = filein[:-3]            
-        if os.path.exists ( filename ) : os.remove ( filename )
-        #
-        # gunzip the file 
-        fileout = self._gunzip ( filein )
-        #        
-        if os.path.exists ( fileout ) :
-            # rename the temporary file 
-            shutil.move ( fileout , filename )
-            #
-            import time
-            time.sleep( 3 )
-            #
-            # remove the original
-            os.remove   ( filein ) 
-
-    ## gzip the file into temporary location, keep original
-    def _gzip   ( self , filein ) :
-        """
-        Gzip the file into temporary location, keep original
-        """
-        if not os.path.exists  ( filein  ) :
-            raise NameError ( "GZIP: non existing file: " + filein )
-        #
-        fin  =      file ( filein  , 'r' )
-        #
-        import tempfile 
-        fd,fileout = tempfile.mkstemp ( prefix = 'tmp_' , suffix = '_zdb.gz' )
-        #
-        import gzip 
-        fout = gzip.open ( fileout , 'w' )
-        #
-        try : 
-            for all in fin : fout.write ( all )
-        finally:
-            fout.close()
-            fin .close()   
-            import time
-            time.sleep( 3 ) 
-        return fileout
-        
-    ## gzip the file into temporary location, keep original
-    def _gunzip ( self , filein ) :
-        """
-        Gunzip the file into temporary location, keep original
-        """
-        if not os.path.exists  ( filein  ) :
-            raise NameError ( "GUNZIP: non existing file: " + filein )
-        #
-        import gzip 
-        fin  = gzip.open ( filein  , 'r' )
-        #
-        import tempfile 
-        fd,fileout = tempfile.mkstemp ( prefix = 'tmp_' , suffix = '_zdb' )
-        fout = file ( fileout , 'w' )
-        #
-        try : 
-            for all in fin : fout.write ( all )
-        finally: 
-            fout.close()
-            fin .close()
-            import time
-            time.sleep( 3 ) 
-        return fileout
-    
-# =============================================================================
-## ``get-and-uncompress-item'' from dbase 
-def _zip_getitem (self, key):
-    """
-    ``get-and-uncompress-item'' from dbase 
-    """
-    try:
-        value = self.cache[key]
-    except KeyError:
-        f = StringIO(zlib.decompress(self.dict[key]))
-        value = Unpickler(f).load()
-        if self.writeback:
-            self.cache[key] = value
-    return value
-
-# =============================================================================
-## ``set-and-compress-item'' to dbase 
-def _zip_setitem ( self , key , value ) :
-    """
-    ``set-and-compress-item'' to dbase 
-    """
-    if self.writeback:
-        self.cache[key] = value
-    f = StringIO()
-    p = Pickler(f, self._protocol)
-    p.dump(value)
-    self.dict[key] = zlib.compress( f.getvalue(), self.compresslevel)
-
-
-ZipShelf.__getitem__ = _zip_getitem
-ZipShelf.__setitem__ = _zip_setitem
-
-def open ( filename                                   ,
-           flag          = 'c'                        ,
-           protocol      = HIGHEST_PROTOCOL           ,
-           compresslevel = zlib.Z_BEST_COMPRESSION    , 
-           writeback     = False                      ,
-           silent        = True                       ) : 
-    """
-    Open a persistent dictionary for reading and writing.
-    
-    The filename parameter is the base filename for the underlying
-    database.  As a side-effect, an extension may be added to the
-    filename and more than one file may be created.  The optional flag
-    parameter has the same interpretation as the flag parameter of
-    anydbm.open(). The optional protocol parameter specifies the
-    version of the pickle protocol (0, 1, or 2).
-    
-    See the module's __doc__ string for an overview of the interface.
-    """
-    
-    return ZipShelf ( filename      ,
-                      flag          ,
-                      protocol      ,
-                      compresslevel ,
-                      writeback     ,
-                      silent        )
-
-# =============================================================================
-# The END 
-# =============================================================================
diff --git a/Phys/KaliCalo/python/KaliCalo/__init__.py b/Phys/KaliCalo/python/KaliCalo/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/Phys/KaliCalo/root/CellCutter.cxx b/Phys/KaliCalo/root/CellCutter.cxx
deleted file mode 100644
index 2c2688c18..000000000
--- a/Phys/KaliCalo/root/CellCutter.cxx
+++ /dev/null
@@ -1,132 +0,0 @@
-#include "CellCutter.h"
-
-#if !defined( __CINT__ )
-  ClassImp( CellCutter );
-#endif
-
-CellCutter::CellCutter( TString cut, int maxOpenFiles ) : m_chain(NULL), m_cutFormula(NULL), m_files(NULL) {
-  m_cut = cut;
-  m_maxOpenFiles = maxOpenFiles;
-  m_files = new TList();
-  m_chain = configureChain();
-}
-
-TChain* CellCutter::configureChain(){
-  TChain* chain = new TChain("KaliPi0/Pi0-Tuple");
-  // Configure the chain
-  chain->SetBranchStatus("*",0); //disable all branches
-  chain->SetBranchStatus("m12",1);
-  chain->SetBranchStatus("g1E",1);
-  chain->SetBranchStatus("g2E",1);
-  chain->SetBranchStatus("bkg",1);
-  chain->SetBranchStatus("ind1",1);
-  chain->SetBranchStatus("ind2",1);
-  chain->SetBranchStatus("prs1",1);
-  chain->SetBranchStatus("prs2",1);
-  chain->SetBranchStatus("dist",1);
-  // Set branch address
-  chain->SetBranchAddress("m12", &m_m12);
-  chain->SetBranchAddress("bkg", &m_bkg);
-  chain->SetBranchAddress("ind1", &m_cell1);
-  chain->SetBranchAddress("ind2", &m_cell2);
-  chain->SetBranchAddress("prs1", &m_prs1);
-  chain->SetBranchAddress("prs2", &m_prs2);
-  chain->SetBranchAddress("g1E", &m_e1);
-  chain->SetBranchAddress("g2E", &m_e2);
-  chain->SetBranchAddress("dist", &m_dist);
-  return chain;
-}
-
-int CellCutter::addFile( TString filename ) {
-  if ( !m_chain ) return 0;
-  return m_chain->AddFile( filename );
-}
-
-int CellCutter::addCell( int cellID, TString filename ){
-  // If the cellID didn't exist in the map, it returns 1, otherwise 0
-  return int( m_fileMap.insert( std::pair<int, TString>( cellID, filename ) ).second );
-}
-
-int CellCutter::cut( float prsMax ){
-  std::map<int, TString> tempMap ;
-  int nElements = 1 ;
-  for (std::map<int, TString>::const_iterator iter = m_fileMap.begin(); iter != m_fileMap.end(); iter++) {
-    tempMap.insert( std::pair<int, TString>( iter->first, iter->second ) ) ; 
-    if ( nElements == m_maxOpenFiles ){
-      cut(prsMax, tempMap) ;
-      nElements = 0 ;
-      tempMap.clear() ;
-    }
-    nElements++ ;
-  }
-  cut(prsMax, tempMap) ;
-}
-
-
-int CellCutter::cut( float prsMax, std::map<int, TString> fileMap ){
-  // Checks
-  if (!m_chain) return 1;
-  if (!m_files) return 1;
-  // Configure cut formula
-  //if ( !m_cut.IsNull() ) m_cutFormula = new TTreeFormula("cut", m_cut, m_chain);
-  // Let's rock
-  for ( int i=0; m_chain->GetEntry(i); i++ ){
-    if ( 0 == (i%10000000) ) std::cout << "Entry " << i << std::endl;
-    if ( m_m12 > 250.0 ) continue; // cut on mass
-    if ( max(m_prs1, m_prs2) > prsMax ) continue ; // Cut on PrS energy
-    if ( m_cell1 != 0 && m_cell2 != 0 ) {
-      if (fileMap.count(m_cell1)>0){
-        fillTree( fileMap[m_cell1] );
-      }
-      if (fileMap.count(m_cell2)>0){
-        fillTree( fileMap[m_cell2] );
-      }
-    } 
-  }
-  // Close open files
-  TIter fileiter( gROOT->GetListOfFiles() );
-  TFile *file;
-  while ( (file = (TFile*) fileiter() ) ) {
-     if( file->IsWritable() ) file->Write("",TObject::kOverwrite);
-     delete file ;
-  }
-  return 0;
-}
-
-int CellCutter::fillTree(TString filename)
-{
-  TFile *input = (TFile*) m_files->FindObject(filename);
-  TTree *newtree;
-  if ( !input ) {
-    // Check if we have space.
-    int alreadyOpened = m_files->GetEntries();
-    if (alreadyOpened > m_maxOpenFiles) {
-      // Close one of the files
-      TFile *toclose = (TFile*) m_files->First();
-      toclose->Write("",TObject::kOverwrite);
-      m_files->RemoveFirst();
-      delete toclose;
-    }
-    // Open
-    input = TFile::Open(filename.Data(), "UPDATE");
-    m_files->Add(input);
-    newtree = (TTree*) input->Get("KaliPi0/Pi0-Tuple");
-    if (!newtree) {
-      input->mkdir("KaliPi0");
-      input->cd("KaliPi0");
-      newtree = m_chain->CloneTree(0);
-    }
-    else {
-      // Reconnect the TTree.
-      m_chain->AddClone( newtree );
-      m_chain->CopyAddresses( newtree );
-    }     
-  } else {
-    // Assumes we already connected the new tree.
-    //input->GetObject("PiO-Tuple", newtree);
-    newtree = (TTree*) input->Get("KaliPi0/Pi0-Tuple");
-    m_chain->AddClone( newtree );
-    m_chain->CopyAddresses( newtree );
-  }
-  return newtree->Fill();
-}
diff --git a/Phys/KaliCalo/root/CellCutter.h b/Phys/KaliCalo/root/CellCutter.h
deleted file mode 100644
index 622f1938f..000000000
--- a/Phys/KaliCalo/root/CellCutter.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#ifndef CELLCUTTER_H
-#define CELLCUTTER_H
-
-#include <vector>
-#include <map>
-#include <TObject.h>
-#include <TFile.h>
-#include <TTreeFormula.h>
-#include <TChain.h>
-#include <TString.h>
-#include "TROOT.h"
-#include <iostream>
-
-
-class CellCutter : public TObject {
-private:
-  // Configuration variables
-  TChain*                           m_chain;
-  TTreeFormula*                     m_cutFormula;
-  int                               m_maxOpenFiles;
-  TString                           m_cut;
-  // Chain variables
-  float                             m_m12;
-  float                             m_e1;
-  float                             m_e2;
-  float                             m_prs1;
-  float                             m_prs2;
-  int                               m_bkg;
-  int                               m_cell1;
-  int                               m_cell2;
-  float                             m_dist;
-  // Internal maps
-  std::map<int, TString>            m_fileMap;
-  TList*                            m_files;
-  // Methods
-  int cut( float, std::map<int, TString> );
-  TChain* configureChain();
-  int fillTree( TString );
-public:
-  // Constructors and configuration
-  CellCutter() : m_chain(NULL), m_cutFormula(NULL), m_files(NULL) {};
-  CellCutter( TString , int = 100 );
-  // Destructor
-  ~CellCutter(){ if (m_chain) delete m_chain; if (m_cutFormula) delete m_cutFormula; if (m_files) delete m_files; }
-  // Methods
-  int addFile( TString );
-  int addCell( int, TString );
-  int cut( float=1000 );
-  //
-  ClassDef( CellCutter , 1 );
-};
-
-#endif
diff --git a/Phys/KaliCalo/root/EcalMinimizer.cxx b/Phys/KaliCalo/root/EcalMinimizer.cxx
deleted file mode 100644
index 4157a3068..000000000
--- a/Phys/KaliCalo/root/EcalMinimizer.cxx
+++ /dev/null
@@ -1,32 +0,0 @@
-#include "EcalMinimizer.h"
-
-double EcalMinimizer::fcn( const double *par ){
-  double sum = 0.0;
-  double sumw = 0.0;
-  int entry = 0;
-  while ( m_chain->GetEntry( entry ) ) {
-    entry++;
-    int necal1 = m_parameters[ m_cellIDs[ m_cellID1+(CALOSHIFT*2) ] ];
-    int necal2 = m_parameters[ m_cellIDs[ m_cellID2+(CALOSHIFT*2) ] ];
-    // Ecal consts
-    double a1 = 1.0;
-    double a2 = 1.0;
-    if ( necal1 >= 0 ) a1 = par[necal1];
-    if ( necal2 >= 0 ) a2 = par[necal2];
-    int area1 = (m_cellID1 & ((1<<2)-1)<<12) >> 12;
-    int area2 = (m_cellID2 & ((1<<2)-1)<<12) >> 12;   
-    // Corrected mas calculation
-    float massdiff = m_mass * sqrt( a1*a2 ) - pionmass;
-    float sigma = max(m_sigma[area1], m_sigma[area2]);
-    if ( abs(massdiff) > (m_sigmaCut * sigma) ) continue;
-    float correction = 1.0 + m_bkg * m_correction;
-    int bkg = 1 - 2 * m_bkg; // Bkg : -1 , signal : 1
-    float w = weight( massdiff, sigma );
-    // Function to minimize
-    sumw = sumw + correction * bkg * w;
-    sum = sum + correction * bkg * w * massdiff * massdiff;
-  }
-  if ( gDebug ) std::cout << abs((sum/sumw)) << std::endl;
-  return abs((sum/sumw));
-}
-
diff --git a/Phys/KaliCalo/root/EcalMinimizer.h b/Phys/KaliCalo/root/EcalMinimizer.h
deleted file mode 100644
index 2d77da1a0..000000000
--- a/Phys/KaliCalo/root/EcalMinimizer.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "MinuitInterface.cxx"
-
-#ifdef __MAKECINT__
-#pragma link C++ class MinuitInterface+;
-#endif
-
-class EcalMinimizer: public MinuitInterface {
-private:
-  virtual double fcn( const double* );
-  // virtual void fillMassPlot( TH1F*, const double*, int );
-public:
-  ClassDef( EcalMinimizer , 1 );
-};
diff --git a/Phys/KaliCalo/root/MinuitInterface.cxx b/Phys/KaliCalo/root/MinuitInterface.cxx
deleted file mode 100644
index 89864ab46..000000000
--- a/Phys/KaliCalo/root/MinuitInterface.cxx
+++ /dev/null
@@ -1,179 +0,0 @@
-#include "MinuitInterface.h"
-
-#if !defined( __CINT__ )
-  ClassImp( MinuitInterface );
-#endif
-
-void MinuitInterface::loadFiles( std::vector<TString> fileList ){
-  if (m_chain) delete m_chain;
-  m_chain = new TChain("KaliPi0/Pi0-Tuple");
-  for (std::vector<TString>::iterator ifile = fileList.begin(); ifile != fileList.end(); ifile++){
-    m_chain->AddFile(*ifile);
-  }
-  loadTreeVars();
-}
-
-void MinuitInterface::loadTree( TChain* chain ){
-  // if ( m_chain ) delete m_chain;
-  m_chain = chain;
-  loadTreeVars();
-  int n = 0;
-  while ( m_chain->GetEntry( n ) ) {
-    n++;
-  }
-  m_nEntries = n;
-}
-
-void MinuitInterface::loadTreeVars(){
-  m_chain->SetBranchAddress( "m12"  , &m_mass );
-  m_chain->SetBranchAddress( "ind1" , &m_cellID1 );
-  m_chain->SetBranchAddress( "ind2" , &m_cellID2 );
-  m_chain->SetBranchAddress( "bkg"  , &m_bkg);  
-  m_chain->SetBranchAddress( "prs1" , &m_prs1 );
-  m_chain->SetBranchAddress( "prs2" , &m_prs2 );    
-  m_chain->SetBranchAddress( "g1E"  , &m_e1 );
-  m_chain->SetBranchAddress( "g2E"  , &m_e2 );
-}
-
-void MinuitInterface::configure( int nVars ) {
-  // Instantiation of minuit object
-  configureMinuit( nVars );
-  // Clear parameter vector
-  m_parameters.clear();
-  m_parameters[ "" ] = -1;
-  m_cellIDs.clear();
-  m_entries.clear();
-}
-
-void MinuitInterface::configureMinuit( const int nVars ){
-  fMinuit = new ROOT::Minuit2::Minuit2Minimizer( ROOT::Minuit2::kSimplex );
-  fFunc = new ROOT::Math::Functor( this , &MinuitInterface::fcn , nVars );
-  m_vars = nVars;
-  fMinuit->SetFunction( *fFunc );
-  // Printing options
-  if ( gDebug ) fMinuit->SetPrintLevel(3);
-  else fMinuit->SetPrintLevel(-1);
-  // Setting value of UP parameter
-  fMinuit->SetErrorDef(1.0);
-  fMinuit->SetMaxFunctionCalls(10000000);
-  fMinuit->SetMaxIterations(1000000);
-  fMinuit->SetTolerance(m_tolerance);
-}
-
-double MinuitInterface::weight( const double massdiff, const float sigma ){
-  return exp( -0.5*pow( massdiff , 2 ) / pow ( sigma , 2 ) );
-}
-
-int MinuitInterface::addCell( const int cellID , const TString varName , const double initialValue ){
-  if ( !fMinuit ){
-    std::cout << "Minuit not configured" << std::endl;
-    return 0;
-  }
-  if ( m_parameters.size() - 1  > m_vars ) {
-    std::cout << "Max number of parameters reached: " << m_vars << std::endl;
-    return 0;
-  }
-  if ( m_cellIDs.insert( std::pair<int,TString>( cellID , varName ) ).second == false ) {
-    std::cout << "CellID already known: " << cellID << std::endl;
-    return 0;
-  }
-  int varNum = m_parameters.size() - 1;
-  if ( m_parameters.insert( std::pair<TString,int>( varName , varNum ) ).second == true ){
-    if (gDebug) std::cout << "Setting variable " << varName << " to initial value " << initialValue << std::endl;
-    fMinuit->SetFixedVariable( varNum , varName.Data() , initialValue );
-  }
-  return 1;
-}
-
-int MinuitInterface::setFixedVar( const TString varName, const double value ){
-  if ( !fMinuit ){
-    std::cout << "Minuit not configured" << std::endl;
-    return 0;
-  }
-  if ( m_parameters.count(varName) > 0 ){
-    // std::cout << "Fixing variable " << varName << std::endl;
-    const int varNum = m_parameters[varName];
-    // double value = fMinuit->X()[varNum];
-    if (gDebug) std::cout << "Setting fixed var " << varName << " to value " << value << std::endl;    
-    fMinuit->SetFixedVariable(varNum, varName.Data(), value);
-    return 1;
-  }
-  return 0;
-}
-
-int MinuitInterface::setLimitedVar( const TString varName, const double value, const double minValue, const double maxValue ){
-  if ( !fMinuit ){
-    std::cout << "Minuit not configured" << std::endl;
-    return 0;
-  }
-  if ( m_parameters.count(varName) > 0 ){
-    const int varNum = m_parameters[varName];
-    // double value = fMinuit->X()[varNum];
-    if (gDebug) std::cout << "Setting limited var " << varName << " to value " << value << std::endl;
-    fMinuit->SetLimitedVariable(varNum, varName.Data(), value,  0.01 , minValue , maxValue );
-    return 1;
-  }
-  return 0;
-} 
-
-void MinuitInterface::setSigma( int area, float sigma ){
-  m_sigma[area] = sigma;
-}
-
-void MinuitInterface::setBeta( int area, float beta ){
-  m_prsBeta[area] = beta;
-}
-
-float MinuitInterface::setCorrection(){
-  float nsig = m_chain->GetEntries("(bkg==0)*(m12>200 && m12<250)");
-  float nbkg = m_chain->GetEntries("(bkg==1)*(m12>200 && m12<250)");
-  float correction = 1 - nsig/nbkg;
-  return setCorrection(correction);
-}
-
-int MinuitInterface::minimize(){
-  if ( m_parameters.size() - 1 < m_vars ) {
-    std::cout << "Warning: There are still non-defined parameters!" << std::endl;
-    if ( gDebug ) {
-      std::cout << "  Number of initialized parameters: " << m_parameters.size() - 1 << std::endl;
-      std::cout << "  Max number of parameters: " << m_vars << std::endl;
-    }
-  }
-  time_t tstart, tend;
-  tstart = time(0);
-  fMinuit->Minimize();
-  tend = time(0);
-  std::cout << "The calibration took " << difftime( tend, tstart ) << " seconds" << std::endl;
-  return fMinuit->Status();
-}
-
-double MinuitInterface::getVarCalib( const TString var ){
-  if ( !fMinuit ) return -1.0;
-  const double* m_result = fMinuit->X();
-  return m_result[m_parameters[var]];
-}
-
-double MinuitInterface::getCellCalib( const int cellID ) {
-  return getVarCalib(m_cellIDs[cellID]);
-};
-
-std::pair<double,double> MinuitInterface::getVarError( const TString var ) {
-  if ( !fMinuit ) return std::make_pair(0.0, 0.0);
-  double errLow, errUp;
-  const int parnumber = m_parameters[var];
-  bool sc = fMinuit->GetMinosError(parnumber, errLow, errUp);
-  if (!sc) return std::make_pair(0.0, 0.0);
-  return std::make_pair(errLow, errUp);
-};
-
-std::pair<double,double> MinuitInterface::getCellError( const int cellID ) {
-  return getVarError(m_cellIDs[cellID]);
-};
-
-std::vector<int> MinuitInterface::getCellIDs() {
-  std::vector<int> cells;
-  for ( std::map<int,TString>::iterator iter = m_cellIDs.begin(); iter != m_cellIDs.end(); iter++ ){
-    cells.push_back(iter->first);
-  }
-  return cells;
-}
diff --git a/Phys/KaliCalo/root/MinuitInterface.h b/Phys/KaliCalo/root/MinuitInterface.h
deleted file mode 100644
index 08e7e0deb..000000000
--- a/Phys/KaliCalo/root/MinuitInterface.h
+++ /dev/null
@@ -1,93 +0,0 @@
-#ifndef MINUITINTERFACE_H
-#define MINUITINTERFACE_H
-
-#define CALOSHIFT 16384
-
-#include <vector>
-#include <map>
-#include <set>
-#include <algorithm>
-#include <ctime>
-#include <fstream>
-#include <sstream>
-#include <iostream>
-#include <TObject.h>
-#include <TTree.h>
-#include <TChain.h>
-#include <TString.h>
-#include <TH1F.h>
-#include <math.h> 
-#include "Minuit2/Minuit2Minimizer.h"
-#include "Math/Functor.h"
-
-const double pionmass = 134.9766;
-
-class MinuitInterface : public TObject {
-private:
-  // Chain variables
-  TChain*                           m_chain;
-  float                             m_mass;
-  int                               m_cellID1;   
-  int                               m_cellID2;
-  int                               m_bkg;
-  float                             m_e1;
-  float                             m_e2;
-  float                             m_prs1;
-  float                             m_prs2;  
-  // Fit variables
-  bool                              gDebug;
-  float                             m_sigma[3];
-  int                               m_sigmaCut;
-  float                             m_tolerance;
-  float                             m_correction;
-  std::map<int,TString>             m_cellIDs;
-  std::map<TString,int>             m_parameters;
-  std::set<int>                     m_entries;
-  unsigned int                      m_vars;
-  int                               m_nEntries;
-  float                             m_prsBeta[3];
-  // Internal objects
-  ROOT::Minuit2::Minuit2Minimizer*  fMinuit;
-  ROOT::Math::IMultiGenFunction*    fFunc;  
-  // Minimization functions
-  virtual double weight( const double, const float );
-  void configureMinuit( const int );
-  virtual double fcn( const double* ) = 0;
-public:
-  // Constructors and configuration
-  MinuitInterface() : m_chain(NULL), gDebug(false), m_sigmaCut(5), m_tolerance(0.0001), m_correction(0.0), fMinuit(NULL), fFunc(NULL) {};
-  MinuitInterface( TChain* chain ) : m_chain(NULL), gDebug(false), m_sigmaCut(5), m_tolerance(0.0001), m_correction(0.0), fMinuit(NULL), fFunc(NULL) { loadTree(chain); };
-  // Destructor
-  ~MinuitInterface(){ if (fMinuit) delete fMinuit; if (fFunc) delete fFunc; if (m_chain) delete m_chain; }
-  // File loading
-  void loadFiles( std::vector<TString> );
-  // Tree loading
-  // void loadTree( TTree* );
-  void loadTree( TChain* );  
-  virtual void loadTreeVars();
-  // Configuration
-  void configure( int );
-  // Minimization control
-  int addCell( const int , const TString , const double=1.0 );
-  bool hasCell( const int cellID ) { return ( m_cellIDs.find(cellID) != m_cellIDs.end() ) ; };
-  int setFixedVar( const TString, const double );
-  int setLimitedVar( const TString , const double, const double, const double );
-  int minimize();
-  void setDebug() { gDebug = true; };
-  float setCorrection();
-  float setCorrection( float correction ) { m_correction = correction; return m_correction; };
-  // Other config
-  void setStrategy( int value ) { if(fMinuit) fMinuit->SetStrategy(value); };
-  double getVarCalib( const TString );
-  double getCellCalib( const int );
-  std::pair<double,double> getVarError( const TString );
-  std::pair<double,double> getCellError( const int );
-  void setSigma( int , float );
-  void setBeta( int, float );
-  void setSigmaCut( int nsigmas ) { m_sigmaCut = nsigmas; }
-  void setTolerance( float tolerance ) { m_tolerance = tolerance; }  
-  std::vector<int> getCellIDs();
-  ClassDef( MinuitInterface , 1 );
-};
-
-#endif
diff --git a/Phys/KaliCalo/root/PrsMinimizer.cxx b/Phys/KaliCalo/root/PrsMinimizer.cxx
deleted file mode 100644
index 17c7fb52d..000000000
--- a/Phys/KaliCalo/root/PrsMinimizer.cxx
+++ /dev/null
@@ -1,41 +0,0 @@
-#include "PrsMinimizer.h"
-
-double PrsMinimizer::fcn( const double *par ){
-  double sum = 0.0;
-  double sumw = 0.0;
-  int entry = 0;
-  while ( m_chain->GetEntry( entry ) ) {
-    entry++;
-    int necal1 = m_parameters[ m_cellIDs[ m_cellID1+(CALOSHIFT*2) ] ];
-    int necal2 = m_parameters[ m_cellIDs[ m_cellID2+(CALOSHIFT*2) ] ];
-    int nprs1 = m_parameters[ m_cellIDs[ m_cellID1+CALOSHIFT ] ];
-    int nprs2 = m_parameters[ m_cellIDs[ m_cellID2+CALOSHIFT ] ];
-    // Ecal consts
-    double a1 = 1.0;
-    double a2 = 1.0;
-    // PRS consts
-    double b1 = 1.0;
-    double b2 = 1.0;
-    if ( necal1 >= 0 ) a1 = par[necal1];
-    if ( necal2 >= 0 ) a2 = par[necal2];
-    if ( nprs1 >= 0 )  b1 = par[nprs1];
-    if ( nprs2 >= 0 )  b2 = par[nprs2];
-    int area1 = (m_cellID1 & ((1<<2)-1)<<12) >> 12;
-    int area2 = (m_cellID2 & ((1<<2)-1)<<12) >> 12;   
-    // Corrected mas caluclation
-    float f1 = m_prs1*m_prsBeta[area1]*(b1-a1)+a1*m_e1;
-    float f2 = m_prs2*m_prsBeta[area2]*(b2-a2)+a2*m_e2;
-    float newmass = m_mass * sqrt( f1*f2/(m_e1*m_e2) );
-    float massdiff = newmass - pionmass;
-    float sigma = max(m_sigma[area1], m_sigma[area2]);
-    if ( abs(massdiff) > (m_sigmaCut * sigma) ) continue;
-    float correction = 1.0 + m_bkg * m_correction;
-    int bkg = 1 - 2 * m_bkg; // Bkg : -1 , signal : 1
-    float w = weight( massdiff, sigma );
-    // Function to minimize
-    sumw = sumw + correction * bkg * w;
-    sum = sum + correction * bkg * w * massdiff * massdiff;
-  }
-  return abs((sum/sumw));
-}
-
diff --git a/Phys/KaliCalo/root/PrsMinimizer.h b/Phys/KaliCalo/root/PrsMinimizer.h
deleted file mode 100644
index d40bd7cb1..000000000
--- a/Phys/KaliCalo/root/PrsMinimizer.h
+++ /dev/null
@@ -1,13 +0,0 @@
-#include "MinuitInterface.cxx"
-
-#ifdef __MAKECINT__
-#pragma link C++ class MinuitInterface+;
-#endif
-
-class PrsMinimizer: public MinuitInterface {
-private:
-  virtual double fcn( const double* );
-  virtual void fillMassPlot( TH1F*, const double*, int );
-public:
-  ClassDef( PrsMinimizer , 1 );
-};
diff --git a/Phys/KaliCalo/src/Cloner.cpp b/Phys/KaliCalo/src/Cloner.cpp
deleted file mode 100644
index 68b681bec..000000000
--- a/Phys/KaliCalo/src/Cloner.cpp
+++ /dev/null
@@ -1,101 +0,0 @@
-// ============================================================================
-// Include files 
-// ============================================================================
-// Local/Kali
-// ============================================================================
-#include "Destroyer.h"
-// ============================================================================
-/** @file Cloner.cpp
- *  ''Piecefull'' variant of Kali::Destroyer 
- *
- *  @see Kali::Destroyer 
- *  @author Vanya BELYAEV Ivan.Belyaev@cern.ch
- *  @date 2011-07-31
- */
-// ============================================================================
-namespace Kali 
-{
-  // ==========================================================================
-  /** @class cloner 
-   *
-   *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
-   *  @date 2011-07-31
-   */
-  class Cloner : public Kali::Destroyer 
-  {
-    // ========================================================================
-    /// the friend factory for instantiation
-    friend class AlgFactory<Kali::Cloner> ;               // the friend factory
-    // ========================================================================
-  public:
-    // ========================================================================
-    /// 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
-    // ========================================================================
-  };
-  // ==========================================================================
-} //                                                      end of namespace Kali 
-// ============================================================================
-// the only one essential method 
-// ============================================================================
-StatusCode Kali::Cloner::execute () 
-{ 
-  // collect all interetsing digits 
-  LHCb::CaloDigit::Set     digits ;
-  // collect all interesting tracks 
-  TRACKS                   tracks ;
-  
-  // 
-  // collect info 
-  StatusCode sc = collect ( digits , tracks ) ;
-  if ( sc.isFailure() ) 
-  {
-    Warning ("Error from collect", sc ).ignore() ;
-    setFilterPassed ( false ) ;
-    return StatusCode::SUCCESS ;
-  }
-  //
-  const bool OK = !digits.empty() || !tracks.empty();
-  //
-  // copy/clone TES
-  sc = copy ( digits , tracks ) ;
-  if ( sc.isFailure() ) 
-  {
-    Warning ("Error from destroy", sc ).ignore() ;
-    setFilterPassed ( false ) ;
-    return StatusCode::SUCCESS ;
-  }
-  //
-  setFilterPassed  ( OK ) ;
-  //
-  return StatusCode::SUCCESS ;        
-}    
-// ===========================================================================
-// The factory:
-// ============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,Cloner)
-// ============================================================================
-// The END 
-// ============================================================================
diff --git a/Phys/KaliCalo/src/DataMove.cpp b/Phys/KaliCalo/src/DataMove.cpp
deleted file mode 100644
index 4f42dd36e..000000000
--- a/Phys/KaliCalo/src/DataMove.cpp
+++ /dev/null
@@ -1,131 +0,0 @@
-// ============================================================================
-// Include files 
-// ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/AlgFactory.h"
-// ============================================================================
-// GaudiAlg 
-// ============================================================================
-#include "GaudiAlg/GaudiAlgorithm.h"
-// ============================================================================
-// Event
-// ============================================================================
-#include "Event/Track.h"
-#include "Event/CaloDigit.h"
-// ============================================================================
-// Local/Kali
-// ============================================================================
-#include "Kali.h"
-// ============================================================================
-namespace Kali 
-{
-  // ==========================================================================
-  /** @class DataMove
-   *
-   *  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 
-    StatusCode execute() override;
-    // ========================================================================
-  protected:
-    // ========================================================================
-    /** standard constructor 
-     *  @param name algorithm instance name 
-     *  @param psvc pointer to Service Locator 
-     */
-    DataMove  ( const std::string& name ,  // algorithm instance name 
-               ISvcLocator*       pSvc )  // poiunetr to Service locator
-      : GaudiAlgorithm ( name , pSvc ) 
-      , m_locations (        ) 
-      , m_kaliHat   ( "Kali" ) 
-    {
-      //
-      //
-      m_locations.push_back ( LHCb::TrackLocation     :: Default ) ;
-      m_locations.push_back ( LHCb::CaloDigitLocation :: Spd     ) ;
-      m_locations.push_back ( LHCb::CaloDigitLocation :: Prs     ) ;
-      m_locations.push_back ( LHCb::CaloDigitLocation :: Ecal    ) ;
-      m_locations.push_back ( LHCb::CaloDigitLocation :: Hcal    ) ;
-      //
-      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 
-    /// Kali-hat in TES
-    std::string              m_kaliHat   ; //                   Kali-hat in TES
-    // ========================================================================
-  } ;
-  // ==========================================================================
-} //                                                      end of namespace Kali 
-// ============================================================================
-// the only one essential method 
-// ============================================================================
-StatusCode Kali::DataMove::execute()  
-{
-  //  
-  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 ) ) 
-    { 
-      Warning ( "Location does not exist: '" + loc + "'" , StatusCode::SUCCESS , 2 ).ignore() ;
-      continue ;                                                 // CONTINUE 
-    }
-    //
-    DataObject* obj = get<DataObject> ( loc ) ;
-    // unregister it at "kali" location 
-    StatusCode sc = evtSvc()->unregisterObject ( obj ) ;
-    if ( sc.isFailure() ) 
-    {
-      Error ( "Unable unregister '" + loc + "'" , sc ).ignore() ;
-      continue ;                                              // CONTINUE 
-    }
-    // register it at "standard" location 
-    put ( obj , *ites ) ;
-  }
-  //
-  setFilterPassed ( true ) ;
-  //
-  return StatusCode::SUCCESS ;
-  //
-}
-// ============================================================================
-// The Factory
-// ============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,DataMove)
-// ============================================================================
-//                                                                      The END 
-// ============================================================================
diff --git a/Phys/KaliCalo/src/Destroyer.cpp b/Phys/KaliCalo/src/Destroyer.cpp
deleted file mode 100644
index 877cd68d5..000000000
--- a/Phys/KaliCalo/src/Destroyer.cpp
+++ /dev/null
@@ -1,496 +0,0 @@
-// ============================================================================
-// Include files 
-// ============================================================================
-// STD & STL 
-// ============================================================================
-// Relations
-// ============================================================================
-#include "Relations/IRelationWeighted2D.h"
-// ============================================================================
-// CaloUtils 
-// ============================================================================
-#include "CaloUtils/Calo2Track.h"
-// ============================================================================
-// LoKi
-// ============================================================================
-#include "LoKi/PhysExtract.h"
-#include "LoKi/Objects.h"
-#include "LoKi/Photons.h"
-// ============================================================================
-// Local/Kali
-// ============================================================================
-#include "Destroyer.h"
-// ============================================================================
-/** @file 
- *  Implementation file for class Kali::Destroyer
- *
- *  @see Kali::Destroyer 
- *  @author Vanya BELYAEV Ivan.Belyaev@cern.ch
- */
-// ============================================================================
-// Update handler for the property
-// ============================================================================
-void Kali::Destroyer::updateDestroy ( Property& /* p */ ) 
-{
-  if ( FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }   // RETURN 
-  // 
-  if ( m_destroy )
-  { Warning ( "TES containers will be destroyed!" , StatusCode::SUCCESS ).ignore() ; }
-  else 
-  { Warning ( "TES containers will be preserved!" , StatusCode::SUCCESS ).ignore() ; }
-  //
-}
-// ============================================================================
-// finalize 
-// ============================================================================
-StatusCode Kali::Destroyer::finalize () 
-{
-  m_tools.clear() ;
-  m_brems.clear() ;
-  return GaudiAlgorithm::finalize () ;
-}
-// ============================================================================
-// initialize 
-// ============================================================================
-StatusCode Kali::Destroyer::initialize () 
-{
-  StatusCode sc = GaudiAlgorithm::initialize() ;
-  if ( sc.isFailure() ) { return sc ; }                               // RETURN 
-  //
-  m_tools.clear() ;
-  for ( Names::const_iterator iname = m_toolNames.begin() ;
-        m_toolNames.end() != iname ; ++iname ) 
-  {
-    const ICaloDigits4Track* t = tool<ICaloDigits4Track> ( *iname , this ) ;
-    m_tools.push_back ( t ) ;
-  }
-  //
-  m_brems.clear() ;
-  for ( Names::const_iterator ibrem = m_bremNames.begin() ;
-        m_bremNames.end() != ibrem ; ++ibrem ) 
-  {
-    const ICaloDigits4Track* t = tool<ICaloDigits4Track> ( *ibrem , this ) ;
-    m_brems.push_back ( t ) ;
-  }
-  //
-  return StatusCode::SUCCESS ;
-}    
-// ============================================================================
-// collect all ``interesting'' digits & tracks 
-// ============================================================================
-StatusCode Kali::Destroyer::collect 
-( LHCb::CaloDigit::Set&    digits , 
-  Kali::Destroyer::TRACKS& tracks ) const 
-{
-  //
-  // input particles:
-  //
-  LHCb::Particle::ConstVector      particles ;
-  
-  for ( Locations::const_iterator iparticle = m_particles.begin() ; 
-        m_particles.end() != iparticle ; ++iparticle ) 
-  {
-    // FIX ME: it should be Range - here!!
-    if ( exist<DataObject> ( *iparticle ) ) 
-    {
-      const LHCb::Particle::Range p = 
-        get<LHCb::Particle::Range> ( *iparticle ) ;
-      particles.insert ( particles.end() , p.begin() , p.end() ) ;
-    }
-    else { Warning ( "Invalid Location for Particles: " + (*iparticle) , 
-                     StatusCode::SUCCESS ).ignore() ; }
-  }
-  
-  // ==========================================================================
-  counter ( "# particles" ) += particles.size() ;
-  if  ( particles.empty() ) 
-  { return Warning ( "No Input particles has been found", StatusCode::SUCCESS ) ; }
-  // 
-  
-  // get the protoparticles 
-  LHCb::ProtoParticle::ConstVector protos ;
-  LoKi::Extract::protoParticles_if 
-    ( particles.begin() , 
-      particles.end  () , 
-      std::back_inserter ( protos ) , 
-      LoKi::Objects::_ALL_ ) ;
-  counter ("# protos" ) += protos . size() ;
-  
-  // get the tracks:
-  LHCb::Track::ConstVector tracks_ ;
-  LoKi::Extract::tracks_if 
-    ( particles.begin() , 
-      particles.end  () , 
-      std::back_inserter ( tracks_ ) , 
-      LoKi::Objects::_ALL_ ) ;
-  //
-  tracks.insert ( tracks_.begin() , tracks_.end() ) ;
-  counter ("# tracks" ) += tracks . size() ;
-  
-  // collect all hypos 
-  typedef std::vector<const LHCb::CaloHypo*> Hypos ;
-  Hypos hypos ;
-  
-  for ( LHCb::ProtoParticle::ConstVector::const_iterator iproto = 
-          protos.begin() ; protos.end() != iproto ; ++iproto ) 
-  {
-    const LHCb::ProtoParticle* proto = *iproto ;
-    if ( 0 == proto ) { continue ; }
-    const SmartRefVector<LHCb::CaloHypo>& calo = proto->calo() ;
-    hypos.insert ( hypos.end() , calo.begin() , calo.end  () ) ;
-  }
-  counter ("# hypos"  ) += hypos  . size() ;
-  
-  // collect all digits: 
-  for ( Hypos::const_iterator ihypo = hypos.begin() ; 
-        hypos.end() != ihypo ; ++ihypo ) 
-  {
-    LoKi::Photons::getDigits ( *ihypo , digits ) ; 
-  }
-  counter ( "# digits" ) += digits . size() ;
-  
-  // ==========================================================================
-  // collect digits from tracks 
-  // ==========================================================================
-  
-  // cluster match :  Track -> Cluster 
-  const LHCb::Calo2Track::ITrClusTable* phTable = 0 ;
-  // brem    match:  Track -> CaloHypo 
-  const LHCb::Calo2Track::ITrHypoTable* brTable = 0 ;
-  // electron match:  Track -> CaloHypo 
-  const LHCb::Calo2Track::ITrHypoTable* elTable = 0 ;
-  
-  if ( !tracks.empty() )
-  {
-    const LHCb::Calo2Track::IClusTrTable2D* _table = 
-      get<LHCb::Calo2Track::IClusTrTable2D>          ( LHCb::CaloIdLocation::ClusterMatch   ) ;
-    if ( 0 != _table ) { phTable = _table->inverse() ; }
-    brTable = get<LHCb::Calo2Track::ITrHypoTable>    ( LHCb::CaloIdLocation::BremMatch     ) ;
-    elTable = get<LHCb::Calo2Track::ITrHypoTable>    ( LHCb::CaloIdLocation::ElectronMatch ) ;
-  }
-  
-  // 1. for tracks, pickup the digits 
-  LHCb::CaloDigit::Set trdigits ;
-  
-  for ( TRACKS::iterator itrack = tracks.begin() ; 
-        tracks.end() != itrack ; ++itrack ) 
-  {
-    const LHCb::Track* track = *itrack ;
-    if ( 0 == track ) { continue ; }                              // CONTINUE
-    
-    // 1a. collect digits form calorimeters:
-    for ( Tools::const_iterator itool = m_tools.begin() ; 
-          m_tools.end() != itool ; ++itool ) 
-    {
-      const ICaloDigits4Track* t = *itool ;
-      if ( 0 == t ) { continue ; }                                 // CONTINUE
-      //
-      LHCb::CaloDigit::Set tmp ;
-      StatusCode sc = t->collect ( track , tmp ) ; 
-      if ( sc.isFailure() ) { continue ; }                        // CONTINUE 
-      trdigits.insert ( tmp.begin() , tmp.end() ) ;   
-    }
-    // 1a. collect digits form calorimeters:
-    for ( Tools::const_iterator ibrem = m_brems.begin() ; 
-          m_brems.end() != ibrem ; ++ibrem ) 
-    {
-      const ICaloDigits4Track* t = *ibrem ;
-      if ( 0 == t ) { continue ; }                                 // CONTINUE
-      //
-      LHCb::CaloDigit::Set tmp ;
-      const ICaloDigits4Track::Line line 
-        ( track->closestState ( 0.0 ).position () , 
-          track->closestState ( 0.0 ).slopes   () ) ;
-      StatusCode sc = t->collect ( line , tmp ) ; 
-      if ( sc.isFailure() ) { continue ; }                        // CONTINUE 
-      trdigits.insert ( tmp.begin() , tmp.end() ) ;   
-    }
-    // 1c. collect digits from "nearest" cluster 
-    if ( 0 != phTable ) 
-    {
-      LHCb::Calo2Track::ITrClusTable::Range r = phTable->relations ( track ) ;
-      if ( !r.empty() ) 
-      {
-        const LHCb::CaloCluster* cluster = r.front().to() ;
-        LoKi::Photons::getDigits ( cluster , trdigits ) ;
-      }
-    }
-    // 1d. collect digits from "the nearest" brem hypo 
-    if ( 0 != brTable ) 
-    {
-      LHCb::Calo2Track::ITrHypoTable::Range r = brTable->relations ( track ) ;
-      if ( !r.empty() ) 
-      {
-        const LHCb::CaloHypo* hypo = r.front().to() ;
-        LoKi::Photons::getDigits ( hypo , trdigits ) ;
-      }
-    }
-    // 1e. collect digits from "the nearest" electon hypo 
-    if ( 0 != elTable ) 
-    {
-      LHCb::Calo2Track::ITrHypoTable::Range r = elTable->relations ( track ) ;
-      if ( !r.empty() ) 
-      {
-        const LHCb::CaloHypo* hypo = r.front().to() ;
-        LoKi::Photons::getDigits ( hypo , trdigits ) ;
-      }
-    }
-    //
-  } // end of loop over "interesting" tracks
-  
-  counter ( "#trdigs "        ) += trdigits.size() ;
-  
-  // add "track-related digits" into container of "all" digits 
-  digits.insert ( trdigits.begin() , trdigits.end() ) ;
-  
-  counter ( "#alldigit "      ) += digits.size() ;
-  
-  return StatusCode::SUCCESS ;
-  
-}
-// ============================================================================
-// destroy all ``interesting'' digits & tracks 
-// ============================================================================
-StatusCode Kali::Destroyer::destroy
-( LHCb::CaloDigit::Set&    digits , 
-  Kali::Destroyer::TRACKS& tracks ) const 
-{
-  
-  // ==========================================================================
-  // destroy tracks 
-  // ==========================================================================
-  
-  if ( exist<LHCb::Track::Container>( LHCb::TrackLocation::Default ) ) 
-  {
-    
-    LHCb::Track::Container* ttracks = 
-      get<LHCb::Track::Container>( LHCb::TrackLocation::Default ) ;
-    
-    const std::size_t trk1 = ttracks->size() ;
-    
-    if ( tracks.empty() ) { ttracks->clear() ; } // ATTENTION!!!  
-    LHCb::Track::Container::iterator ifind = ttracks->begin() ;
-    while ( ifind != ttracks->end() ) 
-    {
-      const LHCb::Track* track = *ifind ;
-      if ( 0 == track ) { continue ; }
-      // 
-      if ( tracks.end() != tracks.find( track ) )
-      { ++ifind ; continue ; }                               // CONTINUE 
-      //
-      ttracks->erase ( *ifind ) ;
-      //
-      ifind = ttracks->begin() ;
-    }
-    const std::size_t trk2 = ttracks->size() ;
-    //
-    counter ( "#trk 1"        ) +=              trk1 ;
-    counter ( "#trk 2"        ) +=              trk2 ;
-    counter ( "#trk 2/trk 1"  ) +=  0 < trk1 ? double(trk2)/trk1 : 1.0 ; 
-    
-  }
-  
-  // ==========================================================================
-  // destroy digits
-  // ==========================================================================
-  
-  typedef LHCb::CaloDigit::Container Digits ;
-  
-  std::vector<Digits*> digs ;
-  
-  Digits* d1 = get<Digits> ( LHCb::CaloDigitLocation::Spd  ) ;
-  digs.push_back ( d1 ) ;
-  Digits* d2 = get<Digits> ( LHCb::CaloDigitLocation::Prs  ) ;
-  digs.push_back ( d2 ) ;
-  Digits* d3 = get<Digits> ( LHCb::CaloDigitLocation::Ecal ) ;
-  digs.push_back ( d3 ) ;
-  Digits* d4 = get<Digits> ( LHCb::CaloDigitLocation::Hcal ) ;
-  digs.push_back ( d4 ) ;
-  
-  size_t size1 = 0 ;
-  size_t size2 = 0 ;
-  
-  for ( std::vector<Digits*>::iterator ic = digs.begin() ; digs.end() != ic ; ++ic ) 
-  {
-    Digits* d = *ic ;
-    if ( 0 == d ) { continue ; }
-    //
-    size1 += d->size() ;
-    //
-    if ( digits.empty() ) { d->clear() ; }
-    //
-    Digits::iterator ifind = d->begin() ;
-    while ( ifind != d->end() ) 
-    {
-      //
-      if ( digits.empty() ) 
-      { 
-        d->erase ( ifind , d->end() )  ; // ATTENTION!
-        ifind = d->end() ;               // paranoic...
-        break            ;               // BREAK  
-      } 
-      //
-      const LHCb::CaloDigit* digit = *ifind ;
-      if ( 0 == digit     ) { continue ; }
-      //
-      LHCb::CaloDigit::Set::iterator iset = digits.find ( digit ) ;
-      if ( digits.end() != iset ) 
-      { 
-        ++ifind                 ; // found, keep it
-        digits.erase ( iset   ) ; // erase from original 
-        continue                ; // go to the next digit
-      }
-      //
-      const size_t index = ifind - d->begin() ;
-      d->erase ( ifind ) ;
-      ifind = d->begin() + index ;
-      //
-    }
-    //
-    size2 += d->size() ;
-    //
-  }
-  
-  counter ( "#dig 1"        ) +=               size1 ;
-  counter ( "#dig 2"        ) +=               size2 ;
-  counter ( "#dig 2/dig 1"  ) += double(size2)/size1 ;
-  
-  counter ( "#digs Spd"     ) += d1 -> size() ;
-  counter ( "#digs Prs"     ) += d2 -> size() ;
-  counter ( "#digs Ecal"    ) += d3 -> size() ;
-  counter ( "#digs Hcal"    ) += d4 -> size() ;
-
-  return StatusCode::SUCCESS ;        
-}
-// ============================================================================
-// copy all ``interesting'' digits  
-// ============================================================================
-StatusCode Kali::Destroyer::copy
-( LHCb::CaloDigit::Set&    digits , 
-  Kali::Destroyer::TRACKS& tracks ) const 
-{
-  // ==========================================================================
-  // copy tracks 
-  // ==========================================================================
-  // LHCb::Track::Container* otracks = 
-  //   get<LHCb::Track::Container> ( LHCb::TrackLocation::Default ) ;
-  //
-  LHCb::Track::Container* ntracks = new LHCb::Track::Container() ;
-  put ( ntracks ,        kalify ( LHCb::TrackLocation::Default ) ) ;
-  //
-  for ( TRACKS::iterator itrack = tracks.begin() ;
-        tracks.end() != itrack ; ++itrack ) 
-  {
-    const LHCb::Track* track = *itrack ;
-    if ( 0       == track           ) { continue ; }
-    // if ( otracks != track->parent() ) { continue ; }
-    //
-    ntracks->insert ( track->cloneWithKey() ) ; // CLONE WITH KEY !!!
-  }
-  //
-  // const std::size_t trk1 = otracks->size() ;
-  const std::size_t trk2 = ntracks->size() ;
-  //
-  // counter ( "#trk 1"        ) +=              trk1 ;
-  counter ( "#trk 2"        ) +=              trk2 ;
-  // counter ( "#trk 2/trk 1"  ) +=  0 < trk1 ? double(trk2)/trk1 : 1.0 ;
-  
-  // ==========================================================================
-  // copy digits 
-  // ==========================================================================
-  
-  typedef LHCb::CaloDigit::Container          Digits ;
-  
-  typedef std::map<std::string,const Digits*> DIGITS ;
-  
-  DIGITS odigs ;
-  
-  Digits* d1 = get<Digits> ( LHCb::CaloDigitLocation::Spd  ) ;
-  odigs [ LHCb::CaloDigitLocation::Spd  ] =  d1  ;
-  Digits* d2 = get<Digits> ( LHCb::CaloDigitLocation::Prs  ) ;
-  odigs [ LHCb::CaloDigitLocation::Prs  ] =  d2  ;
-  Digits* d3 = get<Digits> ( LHCb::CaloDigitLocation::Ecal ) ;
-  odigs [ LHCb::CaloDigitLocation::Ecal ] =  d3  ;
-  Digits* d4 = get<Digits> ( LHCb::CaloDigitLocation::Hcal ) ;
-  odigs [ LHCb::CaloDigitLocation::Hcal ] =  d4  ;
-
-  
-  size_t size1 = 0 ;
-  size_t size2 = 0 ;
-  
-  for ( DIGITS::const_iterator ic = odigs.begin() ; odigs.end() != ic ; ++ic ) 
-  {
-    const std::string& loc  = ic->first   ;
-    const Digits*      digs = ic->second  ;
-    if ( 0 == digs ) { continue ; }
-    //
-    Digits* ndigs = new Digits()   ;   // create new container 
-    put ( ndigs , kalify ( loc ) ) ;   // register it in TES 
-    //
-    size1 += digs->size() ;
-    //
-    for ( LHCb::CaloDigit::Set::iterator idig = 
-            digits.begin() ; digits.end() != idig ;  ++idig ) 
-    {
-      const LHCb::CaloDigit* dig = *idig ;
-      if ( 0    == dig           ) { continue ; }
-      if ( digs != dig->parent() ) { continue ; }
-      //
-      ndigs->insert ( dig->clone() ) ; // CLONE WITH THE KEY
-    }
-    //
-    size2 += ndigs->size() ;
-    //
-  }
-  
-  counter ( "#dig 1"        ) +=               size1 ;
-  counter ( "#dig 2"        ) +=               size2 ;
-  counter ( "#dig 2/dig 1"  ) += double(size2)/size1 ;
-  
-  return StatusCode::SUCCESS ;        
-}
-// ============================================================================
-// the only one essential method 
-// ============================================================================
-StatusCode Kali::Destroyer::execute () 
-{ 
-  // collect all interetsing digits 
-  LHCb::CaloDigit::Set     digits ;
-  // collect all interesting tracks 
-  TRACKS                   tracks ;
-  
-  // 
-  // collect info 
-  StatusCode sc = collect ( digits , tracks ) ;
-  if ( sc.isFailure() ) 
-  {
-    Warning ("Error from collect", sc ).ignore() ;
-    setFilterPassed ( false ) ;
-    return StatusCode::SUCCESS ;
-  }
-  //
-  const bool OK = !digits.empty() || !tracks.empty();
-  //
-  // destroy TES
-  sc = destroy ( digits , tracks ) ;
-  if ( sc.isFailure() ) 
-  {
-    Warning ("Error from destroy", sc ).ignore() ;
-    setFilterPassed ( false ) ;
-    return StatusCode::SUCCESS ;
-  }
-  //
-  setFilterPassed  ( OK ) ;
-  //
-  return StatusCode::SUCCESS ;        
-}    
-// ===========================================================================
-// The factory:
-// ============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,Destroyer)
-// ============================================================================
-// The END 
-// ============================================================================
-
-  
-
diff --git a/Phys/KaliCalo/src/Destroyer.h b/Phys/KaliCalo/src/Destroyer.h
deleted file mode 100644
index 276f01c0b..000000000
--- a/Phys/KaliCalo/src/Destroyer.h
+++ /dev/null
@@ -1,190 +0,0 @@
-// $Id: Destroyer.cpp 122804 2011-05-04 17:53:14Z ibelyaev $
-// ============================================================================
-#ifndef KALI_DESTROYER_H 
-#define KALI_DESTROYER_H 1 
-// ============================================================================
-// Include files 
-// ============================================================================
-// STD & STL 
-// ============================================================================
-#include <set>
-// ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/AlgFactory.h"
-// ============================================================================
-// GaudiAlg 
-// ============================================================================
-#include "GaudiAlg/GaudiAlgorithm.h"
-// ============================================================================
-// Event 
-// ============================================================================
-#include "Event/CaloHypo.h"
-#include "Event/CaloCluster.h"
-#include "Event/CaloDigit.h"
-// ============================================================================
-#include "Event/CaloDataFunctor.h"
-// ============================================================================
-#include "Event/ProtoParticle.h"
-// ============================================================================
-// CaloInterfaces
-// ============================================================================
-#include "CaloInterfaces/ICaloDigits4Track.h"
-// ============================================================================
-// Local/Kali
-// ============================================================================
-#include "Kali.h"
-// ============================================================================
-namespace Kali 
-{
-  // ==========================================================================
-  /** @class Destroyer
-   *
-   *  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 
-    StatusCode initialize () override;
-    /// the only one essential method 
-    StatusCode execute    () override;
-    /// finalize 
-    StatusCode finalize   () override;
-    // ========================================================================
-  protected:
-    // ========================================================================
-    /// perform "kalification" of input TES location
-    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 , 
-      TRACKS&               tracks ) const ;
-    // ========================================================================
-    /// destroy all ``non-interesting'' information 
-    StatusCode destroy 
-    ( LHCb::CaloDigit::Set& digits , 
-      TRACKS&               tracks ) const ;
-    // ========================================================================
-    /// copy all   ``interesting'' information 
-    StatusCode copy 
-    ( LHCb::CaloDigit::Set& digits , 
-      TRACKS&               tracks ) const ;
-    // ========================================================================
-  protected:
-    // ========================================================================
-    /** 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 ) 
-      , m_particles ()
-      , m_destroy   ( true    )
-      , m_kaliHat   ( "Kali"  ) 
-      , m_toolNames ()
-      , m_tools ()
-      , m_bremNames ()
-      , m_brems ()  
-    {
-      //
-      declareProperty 
-        ( "Particles" , 
-          m_particles , 
-          "The list of input TES locations for particles" );
-      declareProperty
-        ( "Destroy" ,
-          m_destroy , 
-          "Destroy the content of TES containers" ) ->
-        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" , 
-          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" , 
-          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 
-    /// 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 
-    // ========================================================================
-  };
-  // ==========================================================================
-} //                                                      end of namespace Kali
-// ============================================================================
-//                                                                      The END 
-// ============================================================================
-#endif // KALI_DESTROYER_H 1 
-// ============================================================================
-// The END 
-// ============================================================================
-
-  
-
diff --git a/Phys/KaliCalo/src/ElecPresel.cpp_ b/Phys/KaliCalo/src/ElecPresel.cpp_
deleted file mode 100644
index a5e75706e..000000000
--- a/Phys/KaliCalo/src/ElecPresel.cpp_
+++ /dev/null
@@ -1,260 +0,0 @@
-// ============================================================================
-// Include files
-#include <stdio.h>
-#include <string.h>
-//From Kernel/LHCbDefintions
-/////#include "Kernel/Point3DTypes.h"
-#include "Kernel/ParticleID.h"
-#include "Kernel/RichParticleIDType.h"
-// #include "RichKernel/RichParticleIDType.h"
-// Event
-#include "Event/RecHeader.h"
-#include "Event/Particle.h"
-#include "Event/RichPID.h"
-#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"
-// DetDesc
-#include "DetDesc/IGeometryInfo.h"
-// Inteerfaces
-#include "TrackInterfaces/ITrackExtrapolator.h"
-
-// *******************
-// *** local *********
-// *******************
-#include "ElecPresel.h"
-
-using namespace LHCb;
-
-//-----------------------------------------------------------------------------
-// Implementation file for class : ElecPresel
-//-----------------------------------------------------------------------------
-// ****************************************************
-// ****** Declaration of the Algorithm Factory ********
-// ****************************************************
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,ElecPresel );
-/////static const  AlgFactory<ElecPresel>          s_factory ;
-/////const        IAlgFactory& ElecPreselFactory = s_factory ;
-
-
-
-//=============================================================================
-// Standard constructor, initializes variables
-//=============================================================================
-Kali::ElecPresel::ElecPresel( const std::string& name,
-                                ISvcLocator* pSvcLocator)
-  : DVAlgorithm ( name , pSvcLocator),
-    m_Extra()
-{
-  declareProperty( "EcalIsolation",  m_ECALisolation = 300.);
-//  declareProperty( "ProtoSource",  m_Input = ParticleLocation::Charged);
-// Locations in DET
-  declareProperty( "SpdLocation",  
-    m_Calos[ElecPreselDets::Spd]   = DeCalorimeterLocation::Spd);
-  declareProperty( "PrsLocation",  
-    m_Calos[ElecPreselDets::Prs]   = DeCalorimeterLocation::Prs);
-  declareProperty( "EcalLocation",  
-    m_Calos[ElecPreselDets::Ecal]  = DeCalorimeterLocation::Ecal);
-  declareProperty( "HcalLocation",  
-    m_Calos[ElecPreselDets::Hcal]  = DeCalorimeterLocation::Hcal);
-// Locations in RAW
-  declareProperty( "SpdLocation",  
-    m_Digits[ElecPreselDets::Spd]   = LHCb::CaloDigitLocation::Spd);
-  declareProperty( "PrsLocation",  
-    m_Digits[ElecPreselDets::Prs]   = LHCb::CaloDigitLocation::Prs);
-  declareProperty( "EcalLocation",  
-    m_Digits[ElecPreselDets::Ecal]  = LHCb::CaloDigitLocation::Ecal);
-  declareProperty( "HcalLocation",  
-    m_Digits[ElecPreselDets::Hcal]  = LHCb::CaloDigitLocation::Hcal);
-}
-
-
-//=============================================================================
-// Destructor
-//=============================================================================
-Kali::ElecPresel::~ElecPresel() {};
-
-
-//=============================================================================
-// Initialisation. Check parameters
-//=============================================================================
-StatusCode Kali::ElecPresel::initialize() {
-
-  MsgStream log(msgSvc(), name());
-  log << MSG::DEBUG << "==> Initialise" << endreq;
-  StatusCode sc = DVAlgorithm::initialize();
-  if (!sc) return sc;
-// Retrieve geometry info
-  for (int i=0; i<4; i++) {
-    m_Calo[i]  = getDet<DeCalorimeter> ( m_Calos[i] );
-    const IGeometryInfo *geometry = m_Calo[i]->geometry();
-    Gaudi::XYZPoint local(0., 0., m_Calo[i]->zShowerMax());
-    Gaudi::XYZPoint global = geometry->toGlobal(local);
-    m_zShowerMax[i] = global.Z();
-// Get other parameters
-    double size = m_Calo[i]->zSize();
-    double offs = m_Calo[i]->zOffset();
-    local.SetZ(offs-size/2.);
-    global = geometry->toGlobal(local);
-    zShowerLength[i] = m_zShowerMax[i]-global.Z();
-  }
-// Set Track Extrapolator
-  m_Extra = tool<ITrackExtrapolator>("TrackFastParabolicExtrapolator",this);
-  return StatusCode::SUCCESS;
-}
-
-//=============================================================================
-// Main execution
-//=============================================================================
-StatusCode Kali::ElecPresel::execute() {
-
-  StatusCode sc = StatusCode::SUCCESS;
-  MsgStream  log( msgSvc(), name() );
-
-  setFilterPassed(false);
-
-  // ********************************************************************
-  // ***** Retrieve informations about event ****************************
-  // ********************************************************************
-
-  // RecHeader *header = get<RecHeader>( RecHeaderLocation::Default );
-  // if (!header) {
-  //  log << MSG::ERROR << "    not able to retrieve event" << endreq;
-  //  return StatusCode::FAILURE;
-  //}
-  
-// 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;  
-  for (LHCb::Particle::ConstVector::const_iterator iAll = parts.begin();
-    iAll != parts.end(); iAll++) {
-    if ((*iAll)->charge() == 0) continue;
-    const LHCb::ProtoParticle* proto= (*iAll)->proto();
-    if (!proto) continue;
-    const Track *track = proto->track();
-    if (track) {  // Track really exists
-      State state = track->closestState (m_zShowerMax[2]);
-      if (state.z() < 7500.) continue;
-      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;
-      m_AllParts[m_NAllTracks] = *iAll;
-      m_AllProto[m_NAllTracks] = proto;
-      m_Mask[m_NAllTracks++] = 1;
-    }
-  }
-  
-  
-  if (!m_NAllTracks) return sc;
-// Get pointers on Digits
-  for (int i=0; i<4; i++) {
-    m_RawDigits[i] = get<LHCb::CaloDigits>(m_Digits[i]);
-  }
-// Check isolation and electron ID
-  m_NETracks = 0;
-  for (int i=0; i<m_NAllTracks-1; i++) {
-    if (m_Mask[i]) {
-      int j=i+1;
-      int isol = 1;
-      double closest = 1000000000.;
-//      while (isol && j<m_NAllTracks) {
-      while (j<m_NAllTracks) {
-        double dist =
-        (m_XYEcal[0][i]-m_XYEcal[0][j])*(m_XYEcal[0][i]-m_XYEcal[0][j])+
-        (m_XYEcal[1][i]-m_XYEcal[1][j])*(m_XYEcal[1][i]-m_XYEcal[1][j]);
-        if (dist < closest) closest = dist;
-        if (dist < m_ECALisolation*m_ECALisolation) {
-	  isol = 0;
-	  m_Mask[i] = 0;
-	  m_Mask[j] = 0;
-        }
-        j++;
-      }
-      if (isol) {   // Save this track if it matches electron ID
-// Check track momentum
-        const Track *track = m_AllProto[i]->track();
-        State state = track->closestState (m_zShowerMax[2]);
-        if (fabs(state.p()) > 4000.) {
-// Check VELO info
-//          float vcharge = m_AllProto[i]->info(ProtoParticle::VeloCharge,-100.);
-// 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;
-            m_AllProto[m_NETracks]   = m_AllProto[i];
-            m_AllParts[m_NETracks++] = m_AllParts[i];
-// Save in local storage
-            this->markTree(m_AllParts[i]);
-          }
-        }
-      }
-    }
-  }
-  if (m_NETracks) setFilterPassed(true);
-  return sc;
-}
-
-//=============================================================================
-// Propagate ProtoParticle to specified 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
-  m_Extra->propagate (state,z,LHCb::ParticleID(211*(proto->charge())));
-  *x = state.x();
-  *y = state.y();
-  if (state.z() < z - 10.) {
-    *x = -100000.;
-    *y = -100000.;
-  }
-}
-
-//=============================================================================
-// HCAL
-//=============================================================================
-bool Kali::ElecPresel::CheckHCal (const ProtoParticle *proto) {
-  
-  float ehcal = 0.;
-  int iCharge = proto->charge();
-// Propagate to HCAL
-   const Track *track = proto->track();
-   State Pstate = track->closestState (m_zShowerMax[3]);
-   float zpos = m_zShowerMax[3];
-   zpos += zShowerLength[3]*(Pstate.momentum().Z()/Pstate.p() - 1.);
-   m_Extra->propagate (Pstate,zpos,LHCb::ParticleID(211*iCharge));
-   Gaudi::XYZPoint mpos(Pstate.x(), Pstate.y(), zpos);
-   CaloNeighbors near = m_Calo[3]->neighborCells (m_Calo[3]->Cell(mpos));
-   near.push_back (m_Calo[3]->Cell(mpos));
-   for (CaloNeighbors::const_iterator iN = near.begin(); near.end() != iN; iN++) {
-     const LHCb::CaloDigit *dig = m_RawDigits[3]->object( *iN );
-     if (dig != 0) {
-       if (dig->e() > 0.) ehcal += dig->e();
-       if (ehcal > 1000.) return false;
-     }
-   }
-   return true;
-}
-  
-//=============================================================================
-//  Finalize
-//=============================================================================
-StatusCode Kali::ElecPresel::finalize() {
-
-////////  if (m_Linker) delete m_Linker;
-  return DVAlgorithm::finalize();
-}
diff --git a/Phys/KaliCalo/src/ElecPresel.h b/Phys/KaliCalo/src/ElecPresel.h
deleted file mode 100644
index ad509c801..000000000
--- a/Phys/KaliCalo/src/ElecPresel.h
+++ /dev/null
@@ -1,86 +0,0 @@
-#ifndef ELECPRESEL_H
-#define ELECPRESEL_H 1
-
-// from Gaudi
-#include "Kernel/DVAlgorithm.h"
-#include "Kernel/IParticleTransporter.h"            // Interface
-#include "GaudiKernel/SmartRefVector.h"
-
-// from Event
-#include "Event/Particle.h"
-#include "Event/ProtoParticle.h"
-#include "Event/State.h"
-#include "Event/CaloDigit.h"
-// *******************
-// *** From Calo **
-// *******************
-#include "CaloDet/DeCalorimeter.h"
-// From Kernel
-#include "Kernel/CaloCellID.h"
-
-class ITrackExtrapolator;
-
-using namespace LHCb;
-
-namespace ElecPreselDets
-{
-   enum Calorimeters {Spd = 0, Prs, Ecal, Hcal};
-}
-
-namespace Kali 
-{
-  class ElecPresel : public DVAlgorithm {
-    
-  public:
-    /// Standard methods...
-    /// Standard constructor
-    ElecPresel ( const std::string& name, ISvcLocator* pSvcLocator );
-    
-    virtual ~ElecPresel ();  ///< Destructor
-    
-    virtual StatusCode initialize();    ///< Algorithm initialization
-    virtual StatusCode execute   ();    ///< Algorithm execution
-    virtual StatusCode finalize  ();    ///< Algorithm finalization
-    
-    /// Specific methods
-    
-    void  PropagateToZ (const ProtoParticle *proto, double z, double *x,  
-                        double *y);
-    void  StoreCaloInfo ();
-    bool  CheckHCal (const ProtoParticle *proto);
-    
-  private:
-    
-    ITrackExtrapolator* m_Extra;        ///< Track extrapolator 
-    
-    std::string m_Input;       ///< Location of ProtoParticles
-    std::string m_Calos[4];    ///< Location of calorimeters in DET
-    std::string m_Digits[4];   ///< Location of calorimeters in RAW
-    
-    const DeCalorimeter *m_Calo[4];       ///< Calorimeters in DET
-    LHCb::CaloDigits    *m_RawDigits[4];  ///< Digits in RAW
-    
-    double m_zShowerMax[4];
-    double zShowerLength[4];
-    
-    // Electrons collected
-    int m_NETracks;                  ///< Total number of "Electron" candidates
-    float m_ClosestTrack[100];      ///< Distance to the closest track at ECAL
-    
-    // Complete tracks info
-    const Particle      *m_AllParts[10000];
-    const ProtoParticle *m_AllProto[10000];
-    int            m_Mask[10000];
-    int m_NAllTracks;
-    double m_XYEcal[2][10000];
-    int     m_Ele[10000];
-    float   m_Vcharge[10000];  
-    
-    double  m_ECALisolation;  ///< Tracks isolation distance (in mm)
-    
-  };
-}
-
-#endif // ELECPRESEL_H
-
-  
diff --git a/Phys/KaliCalo/src/Kali.cpp b/Phys/KaliCalo/src/Kali.cpp
deleted file mode 100644
index 852ba5dd2..000000000
--- a/Phys/KaliCalo/src/Kali.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-// $Id: $
-// ============================================================================
-// Include files 
-// ============================================================================
-// local
-// ============================================================================
-#include "Kali.h"
-// ============================================================================
-/** @file 
- *  Implementation of simple functions from namespace Kali
- *
- *  @see Kali
- *  @author Vanya BELYAEV Ivan.Belyaev@cern.ch
- *  @date 2011-07-31
- *  
- *                    $Revision$
- *  Last modification $Date$
- *                 by $Author$
- */
-// ============================================================================
-// "kalify the TES-location
-// ============================================================================
-std::string Kali::kalify ( const std::string& input , 
-                           const std::string& kali  ) 
-{
-  // TES-location is already properly "kalified"
-  if ( std::string::npos != input.find ( kali  ) ) { return input ; }
-  //
-  if ( 0 == input.find ( "/Event/" ) ) 
-  { return "/Event/" + kali + "/" + input.substr( 7 ) ; }
-  //
-  return "/Event/" + kali + "/" + input ;
-}
-// ============================================================================
-// The END 
-// ============================================================================
diff --git a/Phys/KaliCalo/src/Kali.h b/Phys/KaliCalo/src/Kali.h
deleted file mode 100644
index c70334652..000000000
--- a/Phys/KaliCalo/src/Kali.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// $Id: $
-// ============================================================================
-#ifndef KALI_KALI_H 
-#define KALI_KALI_H 1
-// ============================================================================
-// Include files
-// ============================================================================
-// STD & STL 
-// ============================================================================
-#include <string>
-// ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/Kernel.h"
-// ============================================================================
-/** @file Kali.h
- *
- *  Set of simple function for Kali 
- *
- *  @see Kali
- *  @author Vanya BELYAEV Ivan.Belyaev@cern.ch
- *  @date 2011-07-31
- *  
- *                    $Revision$
- *  Last modification $Date$
- *                 by $Author$
- */
-namespace Kali 
-{
-  // ==========================================================================
-  /// "kalify the TES-location
-  GAUDI_API 
-  std::string   kalify ( const std::string& input          , 
-                         const std::string& kali  = "Kali" ) ;  
-  // ==========================================================================
-} //                                                      end of namespace Kali 
-// ============================================================================
-//                                                                      The END 
-// ============================================================================
-#endif // KALI_KALI_H
-// ============================================================================
diff --git a/Phys/KaliCalo/src/MakeDir.cpp b/Phys/KaliCalo/src/MakeDir.cpp
deleted file mode 100644
index 9595a860b..000000000
--- a/Phys/KaliCalo/src/MakeDir.cpp
+++ /dev/null
@@ -1,109 +0,0 @@
-// $Id$
-// ============================================================================
-// Include files 
-// ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/AlgFactory.h"
-// ============================================================================
-// GaudiAlg 
-// ============================================================================
-#include "GaudiAlg/GaudiAlgorithm.h"
-// ============================================================================
-// Local
-// ============================================================================
-#include "Kali.h"
-// ============================================================================
-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 
-    {
-      //
-      for ( std::vector<std::string>::const_iterator item = 
-              m_locations1.begin() ; m_locations1.end() != item ; ++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 ) 
-      {
-        put ( new DataObject() , *item ) ; 
-      }
-      //
-      return StatusCode::SUCCESS ;
-    } 
-    // ========================================================================
-  protected:
-    // ========================================================================
-    /** standard constructor 
-     *  @param name algorithm instance name 
-     *  @param psvc pointer to Service Locator 
-     */
-    MakeDir  ( const std::string& name ,  // algorithm instance name 
-               ISvcLocator*       pSvc )  // poiunetr to Service locator
-      : GaudiAlgorithm ( name , pSvc ) 
-      , m_locations1 () 
-      , m_locations2 () 
-    {
-      //
-      m_locations1.push_back ( "/Event/Rec/Track"  ) ;
-      m_locations1.push_back ( "/Event/Raw"        ) ;
-      m_locations1.push_back ( "/Event/Raw/Spd"    ) ;
-      m_locations1.push_back ( "/Event/Raw/Prs"    ) ;
-      m_locations1.push_back ( "/Event/Raw/Ecal"   ) ;
-      m_locations1.push_back ( "/Event/Raw/Hcal"   ) ;
-      //
-      m_locations2.push_back ( "/Event/Rec/ProtoP" ) ;
-      m_locations2.push_back ( "/Event/Rec/Calo"   ) ;
-      //
-      declareProperty 
-        ( "Locations1" , 
-          m_locations1  , 
-          "The list of locations to be created" ) ;
-      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:
-    // ========================================================================
-    /// The list of locations to be created
-    std::vector<std::string> m_locations1 ; // List of locations to be created
-    std::vector<std::string> m_locations2 ; // List of locations to be created
-    // ========================================================================
-  } ;
-  // ==========================================================================
-} //                                                      end of namespace Kali 
-// ============================================================================
-// The Factory
-// ============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,MakeDir)
-// ============================================================================
-// The END 
-// ============================================================================
-
-
diff --git a/Phys/KaliCalo/src/MisCalibrateCalo.cpp b/Phys/KaliCalo/src/MisCalibrateCalo.cpp
deleted file mode 100644
index 7ea7f29ff..000000000
--- a/Phys/KaliCalo/src/MisCalibrateCalo.cpp
+++ /dev/null
@@ -1,299 +0,0 @@
-// $Id$
-// =============================================================================
-// Include files 
-// =============================================================================
-// GaudiKernel
-// =============================================================================
-#include "GaudiKernel/StatusCode.h"
-#include "GaudiKernel/AlgFactory.h"
-#include "GaudiKernel/HashMap.h"
-// ============================================================================
-// LHcCbKernel
-// ============================================================================
-#include "Kernel/CaloCellIDHash.h"
-// ============================================================================
-// CaloUtils 
-// ============================================================================
-#include "CaloUtils/CaloCellIDAsProperty.h"
-// =============================================================================
-// GaudiAlg
-// =============================================================================
-#include "GaudiAlg/GaudiAlgorithm.h"
-// =============================================================================
-// Event 
-// =============================================================================
-#include "Event/CaloDigit.h"
-// =============================================================================
-// CaloDet 
-// =============================================================================
-#include "CaloDet/DeCalorimeter.h"
-// =============================================================================
-/** @namespace Kali
- *  helper namespace to keep classes and functions for Calorimeter 
- *  Calibration
- *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
- *  @date 2009-07-31
- */ 
-namespace Kali 
-{
-  // ===========================================================================
-  /** @class MisCalibrateCalo
-   *  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 = { 
-   *      1451  : 1.2 ,
-   *      1452  : 1.1 ,
-   *      ..
-   *      4551  : 1.2 ,
-   *      1451  : 1.2 
-   *  }
-   *  @endcode
-   *
-   *  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 
-    StatusCode finalize   () override;                 //   standard finalization
-    // =========================================================================
-  protected:
-    // =========================================================================
-    /** standard constructor
-     *  @param name algorithm instance name 
-     *  @param pSvc service locator
-     */
-    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 
-    typedef GaudiUtils::HashMap<LHCb::CaloCellID,double> Table ;
-    // =========================================================================
-  protected:
-    // =========================================================================
-    void handleMap ( Property& /* p */ ) ;
-    // =========================================================================
-    /// 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 } 
-    // =========================================================================
-  private:
-    // =========================================================================
-    /// actual table { cell : double } 
-    Table       m_table    ;                   // actual table { cell : double } 
-    // =========================================================================
-  };
-  // ===========================================================================
-} //                                                       end of namespace Kali 
-// =============================================================================
-/*  standard constructor
- *  @param name algorithm instance name 
- *  @param pSvc service locator
- */
-// =============================================================================
-Kali::MisCalibrateCalo::MisCalibrateCalo 
-( const std::string& name ,                           // algorithm instance name 
-  ISvcLocator*       pSvc )                           //         service locator
-  : GaudiAlgorithm ( name , pSvc ) 
-  , m_location     ( LHCb::CaloDigitLocation::Ecal )
-  , m_caloName     ( DeCalorimeterLocation::Ecal ) 
-  , m_pmap  () 
-  , m_table () 
-{
-  // 
-  if      ( std::string::npos != name.find ( "Ecal" ) ) 
-  {
-    m_location = LHCb::CaloDigitLocation ::Ecal ;
-    m_caloName = DeCalorimeterLocation   ::Ecal ;  
-  }
-  else if ( std::string::npos != name.find ( "Hcal" ) ) 
-  {
-    m_location = LHCb::CaloDigitLocation ::Hcal ;
-    m_caloName = DeCalorimeterLocation   ::Hcal ;  
-  }
-  else if ( std::string::npos != name.find ( "Spd"  ) ) 
-  {
-    m_location = LHCb::CaloDigitLocation ::Spd  ;
-    m_caloName = DeCalorimeterLocation   ::Spd  ;  
-  }
-  else if ( std::string::npos != name.find ( "Prs"  ) ) 
-  {
-    m_location = LHCb::CaloDigitLocation ::Prs  ;
-    m_caloName = DeCalorimeterLocation   ::Prs  ;  
-  }
-  //
-  declareProperty 
-    ( "Digits"        , m_location  ,
-      "TES address of digits to be (mis)cailbrated" );
-  declareProperty 
-    ( "Calorimeter"   , m_caloName  ,
-      "Calorimeter to be used"      ) ;
-  declareProperty 
-    ( "Coefficients"  , m_pmap ,
-      "Map of (mis)calibration coefficients" ) 
-    -> declareUpdateHandler(&Kali::MisCalibrateCalo::handleMap , this ) ;
-}
-// =============================================================================
-// standard initialization 
-// =============================================================================
-StatusCode Kali::MisCalibrateCalo::initialize ()      // standard initialization 
-{
-  StatusCode sc = GaudiAlgorithm::initialize () ;
-  if ( sc.isFailure() ) { return sc ; }                                // RETURN 
-  //
-  m_table.clear() ;
-  updateTable ( m_pmap ) ;
-  //
-  return StatusCode::SUCCESS ;
-}
-// =============================================================================
-// standard finalization 
-// =============================================================================
-StatusCode Kali::MisCalibrateCalo::finalize  ()       //   standard finalization
-{ return GaudiAlgorithm::finalize () ; }
-// =============================================================================
-// execution
-// =============================================================================
-StatusCode Kali::MisCalibrateCalo::execute   ()                     // execution
-{
-  if ( m_table.empty() ) { return StatusCode::SUCCESS ; }              // RETURN 
-  //
-  // 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 ) 
-  {
-    LHCb::CaloDigit* digit = *idigit ;
-    if ( 0 == digit              ) { continue ; }                    // CONTINUE 
-    Table::const_iterator ifind = m_table.find ( digit->cellID() ) ;
-    if (  ifind == m_table.end() ) { continue ; }                    // CONTINUE 
-    //
-    const double scale = ifind->second ;
-    //
-    digit->setE ( digit->e() * scale ) ;
-    //
-    if ( 0 != cnt ) { (*cnt) += ( scale - 1 ) ; }
-  }
-  //
-  return StatusCode::SUCCESS ;
-}
-// =============================================================================
-// update the table of cofficients 
-// =============================================================================
-StatusCode Kali::MisCalibrateCalo::updateTable
-( const Kali::MisCalibrateCalo::PMap& pmap ) 
-{
-  // get calorimeter 
-  const DeCalorimeter* det = getDet<DeCalorimeter>( m_caloName ) ;
-  //
-  const int calo = CaloCellCode::CaloNumFromName ( m_caloName ) ;
-  Assert  (  0  <= calo , "Invalid Calo index" ) ; 
-  const unsigned int icalo = calo ;
-  //
-  for ( PMap::const_iterator item = pmap.begin() ; 
-        pmap.end() != item ; ++item ) 
-  {
-    // get ID 
-    LHCb::CaloCellID cellID ( item->first ) ;
-    // redefine calo (if needed)
-    if ( icalo != cellID.calo() ) 
-    { 
-      ++counter("suspicios cell") ;
-      cellID.setCalo ( icalo ) ; 
-    }
-    //
-    // check the calo
-    if ( !det->valid ( cellID ) )
-    {
-      ++counter ("invalid cell") ;
-      continue ; 
-    }
-    //
-    if ( cellID.isPin() ) 
-    {
-      ++counter ("pin cell") ;
-      continue ; 
-    }
-    // 
-    const double scale = item->second ;
-    //
-    m_table[ cellID ] = scale ;
-    counter ( "cells" ) += scale;
-  }
-  //
-  info () << "Calibration coefficients are defined" << m_table.size() << endmsg ;
-  //
-  if ( m_table.empty() ) 
-  { return Warning ( "No calibration coefficients are defined" ) ; }
-  //
-  return StatusCode::SUCCESS ;
-}
-// ============================================================================
-// Handler for update property 
-// ============================================================================
-void Kali::MisCalibrateCalo::handleMap ( Property& /* p */ ) 
-{
-  // no action if not yet initialized 
-  if ( FSMState() < Gaudi::StateMachine::INITIALIZED ) { return ; }
-  // 
-  m_table.clear() ;
-  updateTable ( m_pmap ) ;
-}
-// =============================================================================
-DECLARE_NAMESPACE_ALGORITHM_FACTORY(Kali,MisCalibrateCalo)
-// =============================================================================
-// The END 
-// =============================================================================
diff --git a/Phys/KaliCalo/src/Pi0.cpp b/Phys/KaliCalo/src/Pi0.cpp
deleted file mode 100755
index 84a84e341..000000000
--- a/Phys/KaliCalo/src/Pi0.cpp
+++ /dev/null
@@ -1,661 +0,0 @@
-// ============================================================================
-// Include files
-// ============================================================================
-// STD & STL
-// ============================================================================
-#include <set>
-#include <memory>
-// ============================================================================
-// GaudiKernel
-// ============================================================================
-#include "GaudiKernel/SmartDataPtr.h"
-// ============================================================================
-//  LHCbKrrnel
-// ============================================================================
-#include "Kernel/Counters.h"
-// ============================================================================
-// Event
-// ============================================================================
-#include "Event/CaloHypo.h"
-#include "Event/CaloCluster.h"
-#include "Event/CaloDigit.h"
-#include "Event/Vertex.h"
-// ============================================================================
-#include "Event/CaloDataFunctor.h"
-// ============================================================================
-#include "Event/ProtoParticle.h"
-// ============================================================================
-// LoKi
-// ============================================================================
-#include "LoKi/Algo.h"
-#include "LoKi/IHybridFactory.h"
-#include "LoKi/ParticleCuts.h"
-#include "LoKi/Photons.h"
-#include "LoKi/BasicFunctors.h"
-// ============================================================================
-// CaloUtils
-// ============================================================================
-#include "CaloUtils/ClusterFunctors.h"
-// ============================================================================
-// ICaloDigits4TrackTool
-// ============================================================================
-#include "CaloInterfaces/ICaloDigits4Track.h"
-// ============================================================================
-// DeCalorimeter
-// ============================================================================
-#include "CaloDet/DeCalorimeter.h"
-// ============================================================================
-// LHCbMath
-// ============================================================================
-#include "LHCbMath/LHCbMath.h"
-// ============================================================================
-namespace Kali
-{
-  // ==========================================================================
-  /** @class Pi0
-   *  Simple algorithm for Calorimeter Cailbration using pi0 peak
-   *
-   *  @author Vanya BELYAEV Ivan.Belyaev@nikhef.nl
-   *  @date 2009-09-28
-   */
-  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
-     */
-    Pi0 ( const std::string& name ,            //    the algorithm instance name
-          ISvcLocator*       pSvc )            // the pointer to Service Locator
-      : LoKi::Algo ( name , pSvc )
-        //
-      , m_mirror        ( false )
-      , m_veto_dm       ( -1 * Gaudi::Units::MeV )
-      , m_veto_chi2     ( -1  )
-      , 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  )
-      , m_ecal          (  0  )
-        // histograms
-      , m_h1    ( 0 )
-      , m_h2    ( 0 )
-      , m_h3    ( 0 )
-      , m_h4    ( 0 )
-    {
-      declareProperty
-        ( "Mirror" ,
-          m_mirror ,
-          "Flag to activate Albert's trick with backroung estimation" )
-        -> declareUpdateHandler ( &Kali::Pi0::mirrorHandler , this ) ;
-      //
-      declareProperty
-        ( "Pi0VetoDeltaMass" ,
-          m_veto_dm          ,
-          "Delta-Mass for pi0-veto" )
-        -> declareUpdateHandler ( &Kali::Pi0::vetoHandler , this ) ;
-      declareProperty
-        ( "Pi0VetoChi2"      ,
-          m_veto_chi2        ,
-          "Chi2 for pi0-veto" )
-        -> declareUpdateHandler ( &Kali::Pi0::vetoHandler , this ) ;
-      //
-      declareProperty
-        ( "Pi0Cut"   ,
-          m_pi0CutExp ,
-          "Predicate for Pi0 (LoKi/Bender expression)" ) ;
-      //
-      declareProperty
-        ( "CounterTES"   ,
-          m_numbers      ,
-          "TES location of Gaudi::Numbers object for global event actovity" ) ;
-      //
-      m_counters.push_back ( "nSpd"          ) ;
-      m_counters.push_back ( "nVelo"         ) ;
-      m_counters.push_back ( "nLong"         ) ;
-      m_counters.push_back ( "nPV"           ) ;
-      m_counters.push_back ( "nOT"           ) ;
-      m_counters.push_back ( "nITClusters"   ) ;
-      m_counters.push_back ( "nTTClusters"   ) ;
-      m_counters.push_back ( "nVeloClusters" ) ;
-      m_counters.push_back ( "nEcalClusters" ) ;
-      m_counters.push_back ( "nEcalDigits"   ) ;
-      declareProperty
-        ( "Counters"    ,
-          m_counters    ,
-          "List of counters" ) ;
-      //
-      Property* histos = Gaudi::Utils::getProperty ( this , "HistoProduce" ) ;
-      Assert ( 0 != histos , "Unable to get property 'HistoProduce'" ) ;
-      if ( 0 != histos && 0 == histos->updateCallBack() )
-      { histos -> declareUpdateHandler ( &Kali::Pi0::histosHandler , this ) ; }
-      //
-      setProperty ( "HistoProduce" , false ) ;
-      //
-      ToolMap _combiners ;
-      _combiners[""] = "MomentumCombiner" ;
-      StatusCode sc = setProperty ( "ParticleCombiners" , _combiners ) ;
-      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& ,
-      const Gaudi::LorentzVector& ,
-      const Gaudi::LorentzVector& ,
-      const Gaudi::LorentzVector& ,
-      const double ,
-      const double ,
-      const double ,
-      const double ,
-      const LHCb::CaloCellID& ,
-      const LHCb::CaloCellID& ,
-      const Gaudi::XYZPoint&  ,
-      const Gaudi::XYZPoint&  ,
-      const LHCb::CaloCluster* ,
-      const LHCb::CaloCluster* ,          
-      const int               ) ;
-    // ========================================================================
-    double caloEnergy4Photon ( const Gaudi::LorentzVector&  p ) ;
-    double getSeedCellEnergy ( const LHCb::CaloCluster* ) ;
-    // ========================================================================
-  private:
-    // ========================================================================
-    /// setup monitoringhistograms
-    void setupHistos () ;
-    // ========================================================================
-  public:
-    // ========================================================================
-    /// update handler for 'Mirror' property
-    void mirrorHandler ( Property& p ) ; // update handler for 'Mirror' property
-    /// update handler for 'Veto' properties
-    void vetoHandler   ( Property& p ) ; // update handler for 'Veto' properties
-    /// update handler for 'HistoProduce' property
-    void histosHandler ( Property& p ) ; // update handler for property
-    // ========================================================================
-  private:
-    // ========================================================================
-    /// use Albert's trick?
-    bool  m_mirror     ;                                 // use Albert's trick?
-    /// Delta-mass for pi0-veto
-    double m_veto_dm   ;                             // Delta-mass for pi0-veto
-    /// chi2       for pi0-veto
-    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 
-    /// pi0-Cut functor
-    std::string       m_pi0CutExp ;                    //       Pi0-Cut functor
-    /// 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
-    DeCalorimeter*      m_ecal ;          //      DeCalorimeter object for ECAL
-    // ========================================================================
-  private:
-    // ========================================================================
-    /// histogram with all pi0s
-    AIDA::IHistogram1D* m_h1 ; // histogram with all pi0s
-    /// histogram with max(eprs1,eprs2)<10 MeV
-    AIDA::IHistogram1D* m_h2 ; // histogram with max(eprs1,eprs2)<10 MeV
-    /// histogram with eprs1< 10 MeV , eprs2 >10 MeV
-    AIDA::IHistogram1D* m_h3 ; // histogram with eprs1< 10 MeV , eprs2 >10 MeV
-    /// histogram with min(eprs1,eprs2)>10 MeV
-    AIDA::IHistogram1D* m_h4 ; // histogram with min(eprs1,eprs2)>10 MeV
-    // ========================================================================
-  } ;
-  // ==========================================================================
-} //                                                      end of namespace Kali
-// ============================================================================
-// update handler for 'Mirror' property
-// ============================================================================
-void Kali::Pi0::mirrorHandler ( Property& /* p */ )
-{
-  // no action if not initialized yet:
-  if ( Gaudi::StateMachine::INITIALIZED > FSMState() ) { return ; }
-  //
-  if ( m_mirror )
-  { Warning ( "Albert's trick for background evaluation is   activated!", StatusCode::SUCCESS ).ignore() ; }
-  else
-  { Warning ( "Albert's trick for background evaluation is deactivated!", StatusCode::SUCCESS ).ignore() ; }
-  //
-}
-// ============================================================================
-// update handler for 'Veto' properties
-// ============================================================================
-void Kali::Pi0::vetoHandler ( Property&  p  )
-{
-  // no action if not initialized yet:
-  if ( Gaudi::StateMachine::INITIALIZED > FSMState() ) { return ; }
-  //
-  info() << "Pi0 Veto is : " << p << endmsg ;
-  //
-}
-// ============================================================================
-// update handler for 'HistoProduce' property
-// ============================================================================
-void Kali::Pi0::histosHandler ( Property& /* p */ )
-{
-  // no action if not initialized yet:
-  if ( Gaudi::StateMachine::INITIALIZED > FSMState() ) { return ; }
-  //
-  setupHistos () ;
-  //
-}
-// ============================================================================
-// setup monitoring histograms
-// ============================================================================
-void Kali::Pi0::setupHistos ()
-{
-  using Gaudi::Units::MeV ;
-
-  if ( produceHistos() )
-  {
-    Warning ( "Monitoring histograms are   activated" , StatusCode::SUCCESS ).ignore() ;
-    if ( 0 == m_h1 ) { m_h1 = book ( "mpi0"               , 0 , 250 * MeV , 250 ) ; }
-    if ( 0 == m_h2 ) { m_h2 = book ( "mpi0-Prs_ll_10_MeV" , 0 , 250 * MeV , 250 ) ; }
-    if ( 0 == m_h3 ) { m_h3 = book ( "mpi0-Prs_lg_10_MeV" , 0 , 250 * MeV , 250 ) ; }
-    if ( 0 == m_h4 ) { m_h4 = book ( "mpi0-Prs_gg_10_MeV" , 0 , 250 * MeV , 250 ) ; }
-  }
-  else
-  {
-    Warning ( "Monitoring histograms are deactivated!", StatusCode::SUCCESS ).ignore() ;
-    m_h1 = 0 ;
-    m_h2 = 0 ;
-    m_h3 = 0 ;
-    m_h4 = 0 ;
-  }
-}
-// ============================================================================
-// tuple fill helper function
-// ============================================================================
-void Kali::Pi0::fillTuple
-( const Tuple&                tuple  ,
-  const Gaudi::LorentzVector& p1     ,
-  const Gaudi::LorentzVector& p2     ,
-  const Gaudi::LorentzVector& p12    ,
-  const double                prs1e  ,
-  const double                prs2e  ,
-  const double                spd1e  ,
-  const double                spd2e  ,
-  const LHCb::CaloCellID&     cell1  ,
-  const LHCb::CaloCellID&     cell2  ,
-  const Gaudi::XYZPoint&      point1 ,
-  const Gaudi::XYZPoint&      point2 ,
-  const LHCb::CaloCluster*    clus1  ,
-  const LHCb::CaloCluster*    clus2  ,
-  const int                   bkg    )
-{
-
-  using Gaudi::Units::GeV ;
-
-  // fill N-tuple
-  tuple -> column ( "m12"  , p12.M()  ) ;
-
-  tuple -> column ( "p0"   , p12      ) ;
-  tuple -> column ( "g1"   , p1       ) ;
-  tuple -> column ( "g2"   , p2       ) ;
-
-  tuple -> column ( "prs1" , prs1e    ) ;
-  tuple -> column ( "prs2" , prs2e    ) ;
-
-  // here 1 MeV precision is OK for us...
-  const unsigned int ipt  =
-    LHCb::Math::round ( std::max ( 0.0 , std::min ( p12.Pt() , 5 * GeV ) ) ) ;
-  const unsigned int ipt1 =
-    LHCb::Math::round ( std::max ( 0.0 , std::min ( p1 .Pt() , 5 * GeV ) ) ) ;
-  const unsigned int ipt2 =
-    LHCb::Math::round ( std::max ( 0.0 , std::min ( p2 .Pt() , 5 * GeV ) ) ) ;
-  //
-  tuple -> column ( "pt"   , ipt  ) ;
-  tuple -> column ( "pt1"  , ipt1 ) ;
-  tuple -> column ( "pt2"  , ipt2 ) ;
-
-  const unsigned short _indx1 = cell1.index() ;
-  const unsigned short _indx2 = cell2.index() ;
-
-  tuple -> column ( "ind1" , _indx1 ) ;
-  tuple -> column ( "ind2" , _indx2 ) ;
-
-  const int ispd1 =
-    LHCb::Math::round ( std::max ( 0.0 , std::min ( 5 * spd1e , 30.0 ) ) ) ;
-  const int ispd2 =
-    LHCb::Math::round ( std::max ( 0.0 , std::min ( 5 * spd2e , 30.0 ) ) ) ;
-  //
-  tuple -> column ( "spd1" , ispd1 , 0 , 31 ) ;
-  tuple -> column ( "spd2" , ispd2 , 0 , 31 ) ;
-
-  tuple -> column ( "bkg"  , bkg , 0 , 2    ) ;
-
-  Gaudi::XYZVector vec = point2 - point1 ;
-  double cSize = std::max (  m_ecal->cellSize ( cell1 ) ,
-                             m_ecal->cellSize ( cell2 ) ) ;
-  double dist = ( cSize > 0) ? vec.Rho() / cSize : 0 ;
-  tuple -> column ( "dist" , dist ) ;
-
-  // Energies
-  const double eRaw1 = clus1->position().e() ;
-  const double eRaw2 = clus2->position().e() ;
-  
-  tuple -> column ( "eClus1" , eRaw1 ) ;
-  tuple -> column ( "eClus2" , eRaw2 ) ;
-
-  const int nClus1 = clus1->entries().size() ;
-  const int nClus2 = clus2->entries().size() ;
-
-  tuple -> column ( "nClus1" , nClus1 ) ;
-  tuple -> column ( "nClus2" , nClus2 ) ;
-
-  const double eSeed1 = getSeedCellEnergy( clus1 ) ;
-  const double eSeed2 = getSeedCellEnergy( clus2 ) ;
-
-  tuple -> column ( "eSeed1" , eSeed1 ) ;
-  tuple -> column ( "eSeed2" , eSeed2 ) ;
-  
-  tuple -> write () ;
-}
-// ============================================================================
-// Photon CaloDigitEnergy
-// ============================================================================
-double Kali::Pi0::caloEnergy4Photon( const Gaudi::LorentzVector&  p )
-{
-  typedef LHCb::CaloDigit::Set SET ;
-  SET digits ;
-  Gaudi::XYZPoint point( 0 , 0 , 0 ) ;
-  Gaudi::XYZVector vector = p.Vect() ;
-  typedef Gaudi::Math::Line<Gaudi::XYZPoint,Gaudi::XYZVector> LINE ;
-  LINE line( point , vector ) ;
-  m_spdDigitsTool->collect ( line , digits );
-  double e = 0.0 ;
-  for ( SET::const_iterator digit = digits.begin() ;
-        digits.end() != digit ; digit++ ){
-    e += (*digit)->e() ;
-  }
-  return e ;
-}
-// ============================================================================
-// Energy of the seed cell of a CaloCluster
-// ============================================================================
-double Kali::Pi0::getSeedCellEnergy ( const LHCb::CaloCluster* cluster )
-{
-  const LHCb::CaloCluster::Entries& entries = cluster->entries();
-  LHCb::CaloCluster::Entries::const_iterator iseed = 
-    LHCb::ClusterFunctors::locateDigit 
-    ( entries.begin () ,entries.end   () , LHCb::CaloDigitStatus::SeedCell ) ;
-  //
-  if( entries.end() == iseed ) return 0.0;
-  //
-  return iseed->digit()->e();
-}
-// ============================================================================
-// the proper initialization
-// ============================================================================
-StatusCode Kali::Pi0::initialize  ()                // the proper initialzation
-{
-  //
-  StatusCode sc = LoKi::Algo::initialize();
-  if ( sc.isFailure() ) { return sc ; }
-  //
-  if ( m_mirror )
-  { Warning ( "Albert's trick         is   activated!", StatusCode::SUCCESS ).ignore() ; }
-  else
-  { Warning ( "Albert's trick         is deactivated!", StatusCode::SUCCESS ).ignore() ; }
-  //
-  if ( 0 < m_veto_dm || 0 < m_veto_chi2 )
-  { Warning ( "Pi0-Veto               is   activated!", StatusCode::SUCCESS ).ignore() ; }
-  //
-  setupHistos() ;
-  //
-  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 ) ; }   
-  //
-  // Load tool for SPD
-  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 ) ; }
-  //
-  m_ecal = getDet<DeCalorimeter>(DeCalorimeterLocation::Ecal);
-  //
-  return StatusCode::SUCCESS ;
-}
-// ============================================================================
-// the only one essential method
-// ============================================================================
-StatusCode Kali::Pi0::analyse    ()            // the only one essential method
-{
-  using namespace LoKi          ;
-  using namespace LoKi::Types   ;
-  using namespace LoKi::Cuts    ;
-  using namespace LoKi::Photons ;
-
-  using Gaudi::Units::MeV ;
-
-  LHCb::CaloDataFunctor::DigitFromCalo spd ( "Spd" ) ;
-  LHCb::CaloDataFunctor::DigitFromCalo prs ( "Prs" ) ;
-
-  const double ptCut_Gamma = cutValue ( "PtGamma" ) ;
-  const double spdCut      = cutValue ( "SpdCut"  ) ;
-
-  // 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: 
-  //
-  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 ) 
-    {
-      gec [ *item ] = -1 ;
-      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 ) 
-    { 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 
-      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  
-      
-      double spd2e = seedEnergyFrom ( g2 , spd ) ;
-      if ( 0 < spd2e ) { continue ; }                // CONITUNE 
-      
-      // order the photons according energy in preshower
-      double prs1e = energyFrom ( g1 , prs ) ;
-      double prs2e = energyFrom ( g2 , prs ) ;
-      if ( prs1e > prs2e )
-	{
-	  std::swap ( g1    , g2    ) ;
-	  std::swap ( prs1e , prs2e ) ;
-	  std::swap ( spd1e , spd2e ) ;
-	}
-      
-      const LHCb::CaloHypo* hypo1 = hypo ( g1 )  ;
-      if ( 0 == hypo1 ) { continue ; }                       // CONTINUE 
-      const LHCb::CaloHypo* hypo2 = hypo ( g2 )  ;
-      if ( 0 == hypo2 ) { continue ; }                       // CONTINUE 
-      
-      const LHCb::CaloCluster* cluster1 = cluster ( g1 )  ;
-      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 
-      
-      // pi0-veto ?
-      bool veto = true ;
-      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 ) ; }
-	  if ( 0 != m_h2 && prs2e < 10 * MeV                     ) { m_h2 -> fill ( m12 ) ; }
-	  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 
-      
-      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 ) 
-	{
-	  for ( GecMap::const_iterator igec = gec.begin() ; gec.end() != igec ; ++igec ) 
-	    { tuple->column ( igec->first , igec->second ) ; }
-	}
-      // fill N-tuples
-      if  ( good )
-	{
-	  const LHCb::CaloPosition* p2 = hypo2->position() ;
-	  const Gaudi::XYZPoint point2 ( p2 -> x () ,
-					 p2 -> y () ,
-					 p2 -> z () );
-	  fillTuple ( tuple , mom1 , mom2 , p12 , prs1e , prs2e ,
-		      spd1e3x3 , spd2e3x3 , cell1 , cell2 , point1 , point2 ,
-		      cluster1 , cluster2 , 0 ) ;
-	}
-      if ( goodBkg )
-	{
-	  const LHCb::CaloPosition* p2 = hypo2->position() ;
-	  const Gaudi::XYZPoint point2Sym ( - p2 -> x () , - p2 -> y () , p2 -> z () );
-	  fillTuple( tuple , mom1 , mom2 , fake , prs1e , prs2e ,
-		     spd1e3x3 , spd2e3x3 , cell1 , cell2 , point1 , point2Sym ,
-		     cluster1 , cluster2 , 1 ) ;
-	}
-      //
-    }
-  
-  for ( Photons::const_iterator iphoton = photons.begin() ;
-        photons.end() != iphoton ; ++iphoton )
-    {
-      // keep these photons
-      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)
-// ============================================================================
-// The END
-// ============================================================================
-- 
GitLab